From cdaa2c1f6c69685c9fe25a5f3266db68b7a45e14 Mon Sep 17 00:00:00 2001 From: lb Date: Wed, 16 Aug 2023 11:30:16 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=8E=8B=E6=9C=BA=E6=8A=A5=E5=B7=A5?= =?UTF-8?q?=E7=9A=84search=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/atomViews/ListViewWithHead.vue | 31 +++++----- .../modules/pms/carOrderReport/config.js | 19 +++++- .../modules/pms/carOrderReport/index.vue | 58 ++++++++++++------- 3 files changed, 68 insertions(+), 40 deletions(-) diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index 89f14fe..7f7201c 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -216,6 +216,7 @@ export default { this.cachedSearchCondition = Object.assign({}, params); } + console.log("[http request] params is: ", params); this.$http[this.urls.pageIsPostApi ? "post" : "get"]( this.urls.page, this.urls.pageIsPostApi @@ -664,7 +665,21 @@ export default { } case "查询": { if (typeof payload === "object") { - // BaseSearchForm 给这个组件传递了数据 + /** 必须先处理 listQueryExtra 里的数据 */ + this.listQueryExtra?.map((cond) => { + if (typeof cond === "string") { + if (!!payload[cond]) { + this.cachedSearchCondition[cond] = payload[cond]; + } else { + this.cachedSearchCondition[cond] = ""; + } + } else if (typeof cond === "object") { + Object.keys(cond).forEach((key) => { + this.cachedSearchCondition[key] = cond[key]; + }); + } + }); + // 再处理 payload 里的数据,用于刷新 上面的 数据 Object.assign(this.cachedSearchCondition, payload); if ("timerange" in payload) { if (!!payload.timerange) { @@ -679,20 +694,6 @@ export default { } } - /** 处理 listQueryExtra 里的数据 */ - this.listQueryExtra?.map((cond) => { - if (typeof cond === "string") { - if (!!payload[cond]) { - this.cachedSearchCondition[cond] = payload[cond]; - } else { - this.cachedSearchCondition[cond] = ""; - } - } else if (typeof cond === "object") { - Object.keys(cond).forEach((key) => { - this.cachedSearchCondition[key] = cond[key]; - }); - } - }); console.log("查询", this.cachedSearchCondition); this.getList(this.cachedSearchCondition); break; diff --git a/src/views/modules/pms/carOrderReport/config.js b/src/views/modules/pms/carOrderReport/config.js index 1703eed..7d26ab5 100644 --- a/src/views/modules/pms/carOrderReport/config.js +++ b/src/views/modules/pms/carOrderReport/config.js @@ -7,7 +7,7 @@ import { timeFilter } from "@/utils/filters"; export default function () { const tableProps = [ // 多选框 - // { type: 'index', label: '序号' }, + { type: "selection", width: 60, align: "center" }, { width: 128, prop: "createTime", label: "添加时间", filter: timeFilter }, { width: 128, prop: "updaterName", label: "更改人" }, { width: 128, prop: "code", label: "窑车号" }, @@ -19,8 +19,18 @@ export default function () { { width: 128, prop: "badqty", label: "报废数量" }, // { prop: "typeDictValue", label: "过渡车", filter: val => ['否', '是'][val] }, // { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent - { width: 128, prop: "team", label: "班次", filter: (val) => (val != null ? ["早班", "中班", "晚班"][val] : "-") }, - { width: 128, prop: "report", label: "报工", filter: (val) => (val != null ? ["未报工", "已报工"][val] : "-") }, + { + width: 128, + prop: "team", + label: "班次", + filter: (val) => (val != null ? ["早班", "中班", "晚班"][val] : "-"), + }, + { + width: 128, + prop: "report", + label: "报工", + filter: (val) => (val != null ? ["未报工", "已报工"][val] : "-"), + }, { width: 128, prop: "rtime", label: "报工时间", filter: timeFilter }, { prop: "operations", @@ -41,6 +51,7 @@ export default function () { }, ]; + const now = new Date().getTime(); const headFormFields = [ { prop: "orderCode", @@ -89,6 +100,7 @@ export default function () { timerange: true, prop: "timerange", label: "时间段", + default: { value: [now - 3600 * 24 * 7 * 1000, now] }, bind: { placeholder: "请选择时间段", type: "datetimerange", @@ -226,6 +238,7 @@ export default function () { urls: { base: "/pms/carOrderReport", page: "/pms/carOrderReport/pageView", + pageIsPostApi: true, }, }; } diff --git a/src/views/modules/pms/carOrderReport/index.vue b/src/views/modules/pms/carOrderReport/index.vue index da21189..64a7f8f 100644 --- a/src/views/modules/pms/carOrderReport/index.vue +++ b/src/views/modules/pms/carOrderReport/index.vue @@ -1,31 +1,45 @@