update 查询条件没应用上的问题

This commit is contained in:
lb
2023-04-23 17:03:01 +08:00
parent c38da0f205
commit c371516064
8 changed files with 402 additions and 255 deletions

View File

@@ -143,6 +143,7 @@ export default {
dataList: [],
tableLoading: false,
refreshLayoutKey: null,
cachedSearchCondition: {}
};
},
inject: ["urls"],
@@ -462,17 +463,19 @@ export default {
}
case "查询": {
const params = {};
if (typeof payload === "object") {
// BaseSearchForm 给这个组件传递了数据
Object.assign(params, payload);
if ("timerange" in params) {
if (!!params.timerange) {
const [startTime, endTime] = params["timerange"];
params.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
params.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
Object.assign(this.cachedSearchCondition, payload);
if ("timerange" in payload) {
if (!!payload.timerange) {
const [startTime, endTime] = payload["timerange"];
this.cachedSearchCondition.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
this.cachedSearchCondition.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
} else {
delete this.cachedSearchCondition.startTime;
delete this.cachedSearchCondition.endTime;
}
delete params.timerange;
delete this.cachedSearchCondition.timerange;
}
}
@@ -480,18 +483,18 @@ export default {
this.listQueryExtra?.map((cond) => {
if (typeof cond === "string") {
if (!!payload[cond]) {
params[cond] = payload[cond];
this.cachedSearchCondition[cond] = payload[cond];
} else {
params[cond] = "";
this.cachedSearchCondition[cond] = "";
}
} else if (typeof cond === "object") {
Object.keys(cond).forEach((key) => {
params[key] = cond[key];
this.cachedSearchCondition[key] = cond[key];
});
}
});
console.log("查询", params);
this.getList(params);
console.log("查询", this.cachedSearchCondition);
this.getList(this.cachedSearchCondition);
break;
}
@@ -510,12 +513,12 @@ export default {
// val 是新值
this.page = 1;
this.size = val;
this.getList();
this.getList(this.cachedSearchCondition);
},
handlePageChange(val) {
// val 是新值
this.getList();
this.getList(this.cachedSearchCondition);
},
/** 打开对话框 */