update 上料模块里的单位展示

This commit is contained in:
lb
2023-03-02 14:39:19 +08:00
parent 5b871f27f5
commit 59034e7caa
10 changed files with 172 additions and 103 deletions

View File

@@ -50,7 +50,7 @@ import BaseListTable from "@/components/BaseListTable.vue";
import BaseSearchForm from "@/components/BaseSearchForm.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "@/components/DialogJustForm.vue";
import moment from 'moment'
import moment from "moment";
const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm";
@@ -62,8 +62,8 @@ export default {
tableConfig: {
type: Object,
default: () => ({
/** 列配置, 即 props **/ columnConfig: [],
/** 表格整体配置 */ tableConfig: undefined,
/** 列配置, 即 props **/ column: [],
/** 表格整体配置 */ table: undefined,
}),
},
headConfig: {
@@ -151,14 +151,14 @@ export default {
if (res.code === 0) {
// page 场景:
if ("list" in res.data) {
// real env:
this.dataList = res.data.list.map((item) => {
return {
...item,
id: item._id ?? item.id,
};
// }
});
/** 破碎记录的特殊需求:数据要结合单位 material + materialUnitDictValue */
if ("attachDictValue" in this.tableConfig.column) {
this.dataList = res.data.list.map((row) => {
this.tableConfig.column.attachDictValue(row, "unit", "qty", "materialUnitDictValue");
return row;
});
} else this.dataList = res.data.list;
this.totalPage = res.data.total;
} else if ("records" in res.data) {
this.dataList = res.data.records.map((item) => ({
@@ -185,7 +185,7 @@ export default {
type: "error",
duration: 2000,
});
this.tableLoading = false
this.tableLoading = false;
});
// }
},
@@ -311,16 +311,16 @@ export default {
break;
case "查询": {
const params = {};
/** 处理 payload 里的数据 */
if (typeof payload === 'object') {
if (typeof payload === "object") {
// BaseSearchForm 给这个组件传递了数据
Object.assign(params, payload)
if ('timerange' in params && !!params.timerange) {
const [startTime, endTime] = params['timerange']
delete params.timerange
params.startTime = moment(startTime).format('YYYY-MM-DD HH:mm:ss')
params.endTime = moment(endTime).format('YYYY-MM-DD HH:mm:ss')
Object.assign(params, payload);
if ("timerange" in params && !!params.timerange) {
const [startTime, endTime] = params["timerange"];
delete params.timerange;
params.startTime = moment(startTime).format("YYYY-MM-DD HH:mm:ss");
params.endTime = moment(endTime).format("YYYY-MM-DD HH:mm:ss");
}
}