From c38da0f205e5af6978f4e2dba9b789354986c2d7 Mon Sep 17 00:00:00 2001 From: lb Date: Sun, 23 Apr 2023 16:21:28 +0800 Subject: [PATCH] update carHistory Search Condition --- .../components/ListViewWithHead.vue | 104 +++++++----------- .../pms/order/components/DialogJustForm.vue | 68 +----------- 2 files changed, 39 insertions(+), 133 deletions(-) diff --git a/src/views/modules/pms/carHistory/components/ListViewWithHead.vue b/src/views/modules/pms/carHistory/components/ListViewWithHead.vue index b75448d..c1de553 100644 --- a/src/views/modules/pms/carHistory/components/ListViewWithHead.vue +++ b/src/views/modules/pms/carHistory/components/ListViewWithHead.vue @@ -4,51 +4,20 @@ - + - - + - - - + + + @@ -137,6 +106,7 @@ export default { dataList: [], tableLoading: false, refreshLayoutKey: null, + cachedSearchCondition: {} }; }, inject: ["urls"], @@ -151,9 +121,9 @@ export default { const params = queryParams ? { ...queryParams, page: this.page, limit: this.size } : { - page: this.page, - limit: this.size, - }; + page: this.page, + limit: this.size, + }; if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) { this.listQueryExtra.map((nameOrObj) => { @@ -173,11 +143,11 @@ export default { this.urls.page, this.urls.pageIsPostApi ? { - ...params, - } + ...params, + } : { - params, - } + params, + } ) .then(({ data: res }) => { console.log("[http response] res is: ", res); @@ -273,7 +243,7 @@ export default { } }); }) - .catch((err) => {}); + .catch((err) => { }); } case "edit": { this.openDialog(data); /** data is ==> id */ @@ -460,17 +430,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; } } @@ -478,18 +450,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; } @@ -508,12 +480,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); }, /** 打开对话框 */ diff --git a/src/views/modules/pms/order/components/DialogJustForm.vue b/src/views/modules/pms/order/components/DialogJustForm.vue index 333e4aa..1861b9d 100644 --- a/src/views/modules/pms/order/components/DialogJustForm.vue +++ b/src/views/modules/pms/order/components/DialogJustForm.vue @@ -75,77 +75,11 @@ :mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'" v-bind="col.bind" /> - + -
-
-
-
- - - - - - - - - - - - - -
- - -
- -
-
-