From 59034e7caaa189171d53f91c61dfc2b8a4f313e5 Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 2 Mar 2023 14:39:19 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=8A=E6=96=99=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E9=87=8C=E7=9A=84=E5=8D=95=E4=BD=8D=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/atomViews/ListViewWithHead.vue | 40 +++++++++---------- src/views/modules/pms/blenderStep/config.js | 24 +++++------ src/views/modules/pms/brokeLog/config.js | 34 ++++++++++++++-- src/views/modules/pms/firingStep/config.js | 24 +++++------ .../components/storageBox.vue | 18 ++++++++- .../modules/pms/materialStorageQty/index.vue | 29 ++++++++------ .../modules/pms/materialUpload/config.js | 28 ++++++++++++- src/views/modules/pms/packingStep/config.js | 26 ++++++------ src/views/modules/pms/shapeStep/config.js | 26 ++++++------ src/views/modules/pms/testingStep/config.js | 26 ++++++------ 10 files changed, 172 insertions(+), 103 deletions(-) diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index d931d46..cc62299 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -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"); } } diff --git a/src/views/modules/pms/blenderStep/config.js b/src/views/modules/pms/blenderStep/config.js index 1697a76..4333ae6 100644 --- a/src/views/modules/pms/blenderStep/config.js +++ b/src/views/modules/pms/blenderStep/config.js @@ -90,16 +90,9 @@ export default function () { rules: { required: true, message: "必填项不能为空", trigger: "blur" }, elparams: { placeholder: "请输入混料程序编码" }, }, - ], - [ - { - forceDisabled: true, - prop: 'bomCode', - label: '当前配方' - }, { select: true, - label: "选择新配方", + label: "配方", prop: "bomId", options: [], refreshOptionsAfterConfirm: true, @@ -107,6 +100,13 @@ export default function () { fetchData: (techId = -1) => this.$http.get("/pms/bom/listUnR", { params: { wsId: 1, externalCode: '', key: '', techId } }), }, ], + // [ + // { + // forceDisabled: true, + // prop: 'bomCode', + // label: '当前配方' + // }, + // ], [{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], ], operations: [ @@ -124,9 +124,9 @@ export default function () { { prop: "name", label: "参数名称", isEditField: true }, { prop: "code", label: "参数编码", isEditField: true }, // { prop: "specifications", label: "规格", isEditField: true }, - { prop: "value", label: "设定值", isEditField: true }, - { prop: "valueFloor", label: "值下限", isEditField: true }, - { prop: "valueTop", label: "值上限", isEditField: true }, + { prop: "value", label: "参数值", isEditField: true }, + { prop: "valueFloor", label: "参数值下限", isEditField: true }, + { prop: "valueTop", label: "参数值上限", isEditField: true }, { prop: "description", label: "描述", isEditField: true }, { prop: "operations", @@ -161,7 +161,7 @@ export default function () { label: "参数编码", prop: "code", rules: { required: true, message: "必填项不能为空", trigger: "blur" }, - elparams: { placeholder: "请输入描述" }, + elparams: { placeholder: "请输入参数编码" }, }, ], [ diff --git a/src/views/modules/pms/brokeLog/config.js b/src/views/modules/pms/brokeLog/config.js index 7212f63..bc2fdbd 100644 --- a/src/views/modules/pms/brokeLog/config.js +++ b/src/views/modules/pms/brokeLog/config.js @@ -1,13 +1,13 @@ import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; import switchBtn from "@/components/noTemplateComponents/switchBtn"; import request from "@/utils/request"; -import { timeFilter } from '@/utils/filters' +import { timeFilter, dictFilter } from '@/utils/filters' export default function () { const tableProps = [ { type: 'index', label: '序号' }, - // { prop: "createTime", label: "添加时间", filter: timeFilter }, - { prop: "updateTime", label: "上料时间", filter: timeFilter }, + { prop: "createTime", label: "添加时间", filter: timeFilter }, + // { prop: "updateTime", label: "上料时间", filter: timeFilter }, { prop: "materialName", label: "原料" }, // { prop: "material", label: "原料编码" }, { prop: "qty", label: "上料量" }, @@ -29,6 +29,32 @@ export default function () { }, ]; + + /** + * 数据字典hack + * @param {object} row 行数据 + * @param {string} dictId 从哪个数据字典映射数据 + * @param {string} dataProp 把字典值附加到哪个 prop 字段上 + * @param {string} dictProp 哪个prop是字典数据 + **/ + let dictList; + tableProps.attachDictValue = (row, dictId, dataProp, dictProp, forceFlushDictList = false) => { + /** 缓存一下 dictList **/ + if (!dictList || (dictList && forceFlushDictList)) dictList = dictFilter(dictId) + + if (typeof row === 'object' && dictList) { + const value = dictList(row[dictProp]) + const data = row[dataProp] + row[dataProp] = data + ' ' + (value === '-' ? '' : value) + } else { + this.$message({ + message: 'tableProps.attachDictValue() 出错!', + type: 'error', + duration: 1500 + }) + } + } + const headFormFields = [ { prop: 'material', @@ -113,7 +139,7 @@ export default function () { elparams: { placeholder: "请输入上料量" }, }, { select: true, label: "破碎作业", prop: "statusDictValue", options: [{ label: '正常停止', value: 0 }, { label: '废除', value: '1' }], elparams: { placeholder: "破碎作业", filterable: true } }, - + ], [ { diff --git a/src/views/modules/pms/firingStep/config.js b/src/views/modules/pms/firingStep/config.js index 882aeb5..f54ad48 100644 --- a/src/views/modules/pms/firingStep/config.js +++ b/src/views/modules/pms/firingStep/config.js @@ -90,16 +90,9 @@ export default function () { rules: { required: true, message: "必填项不能为空", trigger: "blur" }, elparams: { placeholder: "请输入烧制工艺编码" }, }, - ], - [ - { - forceDisabled: true, - prop: 'bomCode', - label: '当前配方' - }, { select: true, - label: "选择新配方", + label: "配方", prop: "bomId", options: [], refreshOptionsAfterConfirm: true, @@ -107,6 +100,13 @@ export default function () { fetchData: (techId = -1) => this.$http.get("/pms/bom/listUnR", { params: { wsId: 3, externalCode: '', key: '', techId } }), }, ], + // [ + // { + // forceDisabled: true, + // prop: 'bomCode', + // label: '当前配方' + // }, + // ], [{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], ], operations: [ @@ -124,9 +124,9 @@ export default function () { { prop: "name", label: "参数名称", isEditField: true }, { prop: "code", label: "参数编码", isEditField: true }, // { prop: "specifications", label: "规格", isEditField: true }, - { prop: "value", label: "设定值", isEditField: true }, - { prop: "valueFloor", label: "值下限", isEditField: true }, - { prop: "valueTop", label: "值上限", isEditField: true }, + { prop: "value", label: "参数值", isEditField: true }, + { prop: "valueFloor", label: "参数值下限", isEditField: true }, + { prop: "valueTop", label: "参数值上限", isEditField: true }, { prop: "description", label: "描述", isEditField: true }, { prop: "operations", @@ -161,7 +161,7 @@ export default function () { label: "参数编码", prop: "code", rules: { required: true, message: "必填项不能为空", trigger: "blur" }, - elparams: { placeholder: "请输入描述" }, + elparams: { placeholder: "请输入参数编码" }, }, ], [ diff --git a/src/views/modules/pms/materialStorageQty/components/storageBox.vue b/src/views/modules/pms/materialStorageQty/components/storageBox.vue index 0f26340..4e39dd0 100644 --- a/src/views/modules/pms/materialStorageQty/components/storageBox.vue +++ b/src/views/modules/pms/materialStorageQty/components/storageBox.vue @@ -17,7 +17,7 @@
{{ material }}
- {{ qty }} 存量 + {{ qty }} {{ computedUnit }}
@@ -29,6 +29,8 @@