update 压机报工的search logic
This commit is contained in:
parent
84a4b2999d
commit
cdaa2c1f6c
@ -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;
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,31 +1,45 @@
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import initConfig from './config';
|
||||
import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue';
|
||||
import initConfig from "./config";
|
||||
import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
|
||||
|
||||
export default {
|
||||
name: 'CarView',
|
||||
components: { ListViewWithHead },
|
||||
provide() {
|
||||
return {
|
||||
urls: this.allUrls
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
|
||||
return {
|
||||
tableConfig,
|
||||
headFormConfigs,
|
||||
allUrls: urls,
|
||||
dialogConfigs,
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {},
|
||||
name: "CarView",
|
||||
components: { ListViewWithHead },
|
||||
provide() {
|
||||
return {
|
||||
urls: this.allUrls,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
|
||||
return {
|
||||
tableConfig,
|
||||
headFormConfigs,
|
||||
allUrls: urls,
|
||||
dialogConfigs,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user