Authored by lzhy

修改点击分页时的问题

... ... @@ -64,6 +64,8 @@ import baseExportApi from 'util/excel';
export default {
data() {
return {
//当前的搜索条件
currentSearchParams: {},
filters: {
createTime: {
label: '创建时间',
... ... @@ -245,33 +247,39 @@ export default {
this.search();
},
methods: {
//组织当前的搜索条件
filterValues() {
const queryParams = {};
const _this = this;
_.each(this.filters, (value, key) => {
queryParams[key] = value.model;
_this.currentSearchParams[key] = value.model;
});
const { current, pageSize } = this.pageData;
return { ...queryParams, pageNo: current, pageSize };
this.currentSearchParams.pageNo = current;
this.currentSearchParams.pageSize = pageSize;
},
//点击搜索动作
search() {
this.filters.timeFlag.model = '';
this.pageData.current = 1;
this.filterValues();
this.list();
},
//点击全部操作
reset() {
this.pageData.current = 1;
_.each(this.filters, value => {
if (value.hasOwnProperty('model')) {
value.model = '';
}
});
this.resetFilter();
this.filterValues();
this.list();
},
//点击快速查询操作
timeFlag(flag) {
this.resetFilter();
this.filters.timeFlag.model = flag;
this.pageData.current = 1;
this.filterValues();
this.list();
},
//格式化时间
createTimeChange(time) {
if (!_.isArray(time)) {
time = time.split(' - ');
... ... @@ -284,13 +292,15 @@ export default {
this.filters.endTime.model = '';
}
},
//点击分页
pageChange(page) {
this.pageData.current = page;
this.currentSearchParams.pageNo = page;
this.list();
},
//获取列表数据
list() {
const params = this.filterValues();
this.financeService.shopBillList(params).then(ret => {
this.financeService.shopBillList(this.currentSearchParams).then(ret => {
this.tableData = _.get(ret, 'data.records', []);
this.pageData.total = _.get(ret, 'data.totalCount', 0);
this.pageData.current = _.get(ret, 'data.pageNo', 1);
... ... @@ -298,11 +308,20 @@ export default {
},
//导出列表
exportList() {
const queryString = { ...this.filterValues(), excelConf: 'shopBill' };
const queryString = { ...this.currentSearchParams, excelConf: 'shopBill' };
const params = qs.stringify(queryString, true);
const href = `${baseExportApi}${params}`;
window.open(href, '_blank');
},
//重置筛选条件
resetFilter() {
//重置筛选框中的数据
_.each(this.filters, value => {
if (value.hasOwnProperty('model')) {
value.model = '';
}
});
},
},
};
</script>
... ...