Commit 2a4bac46 by 张杰

修复分页跳转bug

1 parent 02eb1269
......@@ -278,3 +278,68 @@ export const speedShortcuts = [
},
},
]
// 运营统计报表-车辆维度
export const staticReportCarShortcuts = [
{
text: '全部',
onClick(picker) {
const end = ''
const start = ''
picker.$emit('pick', [start, end])
},
},
{
text: '昨日',
onClick(picker) {
const start = moment()
.day(moment().day() - 1)
.format('YYYY-MM-DD')
const end = moment()
.day(moment().day() - 1)
.format('YYYY-MM-DD')
picker.$emit('pick', [start, end])
},
},
{
text: '本周',
onClick(picker) {
const end = moment().format('YYYY-MM-DD')
const start = moment().weekday(0).format('YYYY-MM-DD')
picker.$emit('pick', [start, end])
},
},
{
text: '上周',
onClick(picker) {
let weekOfDay = parseInt(moment().format('E'))
const end = moment().subtract(weekOfDay, 'days').format('YYYY-MM-DD')
const start = moment()
.subtract(weekOfDay + 7 - 1, 'days')
.format('YYYY-MM-DD')
picker.$emit('pick', [start, end])
},
},
{
text: '本月',
onClick(picker) {
const start = moment().add('month', 0).format('YYYY-MM') + '-01'
const end = moment().format('YYYY-MM-DD')
picker.$emit('pick', [start, end])
},
},
{
text: '上月',
onClick(picker) {
const end = moment()
.month(moment().month() - 1)
.endOf('month')
.format('YYYY-MM-DD')
const start = moment()
.month(moment().month() - 1)
.startOf('month')
.format('YYYY-MM-DD')
picker.$emit('pick', [start, end])
},
},
]
\ No newline at end of file
......@@ -84,6 +84,7 @@ export default {
params: {
handler: function (n, o) {
if (n) {
console.log(n);
this.getList();
}
},
......@@ -107,9 +108,14 @@ export default {
// 获取参数
getParams(current) {
console.log(this.params);
let oParams = { ...this.params };
if (current || oParams.current) {
this.currentPage = current || oParams.current;
}
oParams.pageSize = this.pageSize;
oParams.pageNumber = current || this.currentPage;
oParams.pageNumber = current || oParams.current || this.currentPage;
delete oParams.current;
return oParams;
},
......@@ -117,6 +123,7 @@ export default {
getList(current) {
let request = this.request;
let oParams = this.getParams(current);
console.log(oParams);
this.loading = true;
request(oParams)
.then((res) => {
......@@ -141,6 +148,12 @@ export default {
this.currentPage = 1;
this.getList();
},
// 重置分页参数
restParams() {
// this.pageSize = 10;
this.currentPage = 1;
},
},
};
</script>
......
......@@ -24,7 +24,7 @@
<el-option label="车辆激活时间" :value="1"></el-option>
<el-option label="工单接收时间" :value="2"></el-option>
</el-select>
<el-date-picker v-model="searchForm.timeDate" class="data_picker" value-format="yyyy-MM-dd" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期">
<el-date-picker v-model="searchForm.timeDate" class="data_picker" value-format="yyyy-MM-dd" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" unlink-panels :picker-options="dataPickerOptions">
</el-date-picker>
</div>
</el-form-item>
......@@ -63,6 +63,7 @@ import {
import GlsxOrganization from "@/components/glsx-organization";
import { deepClone, showToast } from "@/utils/util";
import GlsxDialog from "@/components/dialog";
import { staticReportCarShortcuts } from "@/common";
export default {
name: "StatisticsCar",
components: {
......@@ -95,6 +96,9 @@ export default {
loading: false,
GET_OPEREPORT_VEHICLE_SEARCH,
tableParams: {},
dataPickerOptions: {
shortcuts: staticReportCarShortcuts,
},
};
},
......@@ -125,13 +129,13 @@ export default {
// 搜索
searchEvent() {
this.$refs.glsxTable.restParams();
this.tableParams = this.getParams();
},
// 监听树
onChange(e) {
this.filterVisible = false;
console.log(e);
if (e) {
this.orgInfo = e.origin;
this.searchForm.orgId = e.origin.orgId;
......@@ -159,7 +163,7 @@ export default {
rest() {
this.tableParams = {};
this.searchForm = { queryTimeType: 1 };
this.$refs.glsxTable.rest();
//this.$refs.glsxTable.getList();
},
},
};
......
......@@ -24,7 +24,7 @@
<el-option label="设备激活时间" :value="1"></el-option>
<el-option label="定位时间" :value="2"></el-option>
</el-select>
<el-date-picker v-model="searchForm.timeDate" class="data_picker" value-format="yyyy-MM-dd" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期">
<el-date-picker v-model="searchForm.timeDate" class="data_picker" value-format="yyyy-MM-dd" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" unlink-panels :picker-options="dataPickerOptions">
</el-date-picker>
</div>
</el-form-item>
......@@ -63,6 +63,7 @@ import {
import GlsxOrganization from "@/components/glsx-organization";
import { deepClone, showToast } from "@/utils/util";
import GlsxDialog from "@/components/dialog";
import {staticReportCarShortcuts} from '@/common'
export default {
name: "StatisticsDevice",
components: {
......@@ -94,6 +95,9 @@ export default {
loading: false,
GET_OPEREPORT_DEVICE_SEARCH,
tableParams: {},
dataPickerOptions:{
shortcuts: staticReportCarShortcuts,
}
};
},
......@@ -124,6 +128,7 @@ export default {
// 搜索
searchEvent() {
this.$refs.glsxTable.restParams();
this.tableParams = this.getParams();
},
......@@ -158,7 +163,7 @@ export default {
rest() {
this.tableParams = {};
this.searchForm = {queryTimeType: 1 };
this.$refs.glsxTable.rest();
//this.$refs.glsxTable.rest();
},
},
};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!