update 压机报工的search logic

This commit is contained in:
lb 2023-08-16 11:30:16 +08:00
parent 84a4b2999d
commit cdaa2c1f6c
3 changed files with 68 additions and 40 deletions

View File

@ -216,6 +216,7 @@ export default {
this.cachedSearchCondition = Object.assign({}, params); this.cachedSearchCondition = Object.assign({}, params);
} }
console.log("[http request] params is: ", params);
this.$http[this.urls.pageIsPostApi ? "post" : "get"]( this.$http[this.urls.pageIsPostApi ? "post" : "get"](
this.urls.page, this.urls.page,
this.urls.pageIsPostApi this.urls.pageIsPostApi
@ -664,7 +665,21 @@ export default {
} }
case "查询": { case "查询": {
if (typeof payload === "object") { 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); Object.assign(this.cachedSearchCondition, payload);
if ("timerange" in payload) { if ("timerange" in payload) {
if (!!payload.timerange) { 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); console.log("查询", this.cachedSearchCondition);
this.getList(this.cachedSearchCondition); this.getList(this.cachedSearchCondition);
break; break;

View File

@ -7,7 +7,7 @@ import { timeFilter } from "@/utils/filters";
export default function () { export default function () {
const tableProps = [ const tableProps = [
// 多选框 // 多选框
// { type: 'index', label: '序号' }, { type: "selection", width: 60, align: "center" },
{ width: 128, prop: "createTime", label: "添加时间", filter: timeFilter }, { width: 128, prop: "createTime", label: "添加时间", filter: timeFilter },
{ width: 128, prop: "updaterName", label: "更改人" }, { width: 128, prop: "updaterName", label: "更改人" },
{ width: 128, prop: "code", label: "窑车号" }, { width: 128, prop: "code", label: "窑车号" },
@ -19,8 +19,18 @@ export default function () {
{ width: 128, prop: "badqty", label: "报废数量" }, { width: 128, prop: "badqty", label: "报废数量" },
// { prop: "typeDictValue", label: "过渡车", filter: val => ['否', '是'][val] }, // { prop: "typeDictValue", label: "过渡车", filter: val => ['否', '是'][val] },
// { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent // { 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 }, { width: 128, prop: "rtime", label: "报工时间", filter: timeFilter },
{ {
prop: "operations", prop: "operations",
@ -41,6 +51,7 @@ export default function () {
}, },
]; ];
const now = new Date().getTime();
const headFormFields = [ const headFormFields = [
{ {
prop: "orderCode", prop: "orderCode",
@ -89,6 +100,7 @@ export default function () {
timerange: true, timerange: true,
prop: "timerange", prop: "timerange",
label: "时间段", label: "时间段",
default: { value: [now - 3600 * 24 * 7 * 1000, now] },
bind: { bind: {
placeholder: "请选择时间段", placeholder: "请选择时间段",
type: "datetimerange", type: "datetimerange",
@ -226,6 +238,7 @@ export default function () {
urls: { urls: {
base: "/pms/carOrderReport", base: "/pms/carOrderReport",
page: "/pms/carOrderReport/pageView", page: "/pms/carOrderReport/pageView",
pageIsPostApi: true,
}, },
}; };
} }

View File

@ -1,31 +1,45 @@
<template> <template>
<ListViewWithHead :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" :listQueryExtra="['name']" /> <ListViewWithHead
:table-config="tableConfig"
:head-config="headFormConfigs"
:dialog-configs="dialogConfigs"
:listQueryExtra="['carCode', 'orderCode', 'team', { report: 0, startTime: now[0], endTime: now[1] }]" />
</template> </template>
<script> <script>
import initConfig from './config'; import initConfig from "./config";
import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue'; import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
export default { export default {
name: 'CarView', name: "CarView",
components: { ListViewWithHead }, components: { ListViewWithHead },
provide() { provide() {
return { return {
urls: this.allUrls urls: this.allUrls,
} };
}, },
data() { data() {
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this); const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return { return {
tableConfig, tableConfig,
headFormConfigs, headFormConfigs,
allUrls: urls, allUrls: urls,
dialogConfigs, dialogConfigs,
}; };
}, },
created() {},
mounted() {}, computed: {
methods: {}, now() {
const curr = this.headFormConfigs.fields.find((item) => item.prop == "timerange").default.value;
const start = new Date(curr[0]);
const end = new Date(curr[1]);
return [
start.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
end.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
]
},
},
methods: {},
}; };
</script> </script>