From 31f1f8f3c1ef53a39c6b497cb5ab88eedecfaae8 Mon Sep 17 00:00:00 2001 From: lb Date: Mon, 27 Feb 2023 17:00:23 +0800 Subject: [PATCH] =?UTF-8?q?finish=20=E5=AE=8C=E6=88=90=E4=B8=8A=E6=96=99?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BaseSearchForm.vue | 9 +-- src/components/DialogJustForm.vue | 17 ++++- .../modules/pms/materialUpload/config.js | 68 ++++++++++--------- 3 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/components/BaseSearchForm.vue b/src/components/BaseSearchForm.vue index de9b49e..7399481 100644 --- a/src/components/BaseSearchForm.vue +++ b/src/components/BaseSearchForm.vue @@ -82,6 +82,7 @@ export default { // 更新选项列表 if (!field.watch && field.fn && typeof field.fn === "function") { + const optionLabel = field.fieldOptionLabel; // 设置自身的选项列表 field.fn().then(({ data: res }) => { if (res.code === 0 && res.data) { @@ -90,15 +91,15 @@ export default { this.$set( field, "select", - res.data.list.map((item) => ({ label: item.name, value: item.id })) + res.data.list.map((item) => ({ label: optionLabel ? item[optionLabel] : item.name, value: item.id })) ); } } else { this.$message({ message: `${field.label} 数据获取出错: ${res.code} - ${res.msg}`, - type: 'error', - duration: 1500 - }) + type: "error", + duration: 1500, + }); } }); } diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue index c29dd48..e7c03d9 100644 --- a/src/components/DialogJustForm.vue +++ b/src/components/DialogJustForm.vue @@ -46,7 +46,7 @@ :disabled="detailMode" /> - + ['否', '是'][val] }, // { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent // { prop: "currentQty", label: "载量" }, // { prop: "currentPos", label: "当前位置" }, - { prop: "description", label: "描述" }, + // { prop: "description", label: "描述" }, { prop: "remark", label: "备注" }, { prop: "operations", @@ -32,38 +32,39 @@ export default function () { const headFormFields = [ { - prop: 'materialId', + prop: "materialId", label: "物料", // default: { value: "" }, select: [], // 绑定数据获取函数 - fn: () => this.$http.get('/pms/material/page', { params: { page: 1, limit: 999 } }), + fn: () => this.$http.get("/pms/material/page", { params: { page: 1, limit: 999 } }), bind: { - placeholder: '请选择物料', - filterable: true - } + placeholder: "请选择物料", + filterable: true, + }, }, { - prop: 'storeId', + prop: "storeId", label: "日料仓", + fieldOptionLabel: 'code', // 把料仓筛选条件的label改为展示code,而不是展示name select: [], // default: { value: "" }, - fn: () => this.$http.get('/pms/materialStorage/page', { params: { page: 1, limit: 999, typeDictValue: '1' } }), + fn: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "1" } }), bind: { - placeholder: '请选择日料仓', - filterable: true - } + placeholder: "请选择日料仓", + filterable: true, + }, }, { timerange: true, - prop: 'timerange', // 应该是个数组,在提交数据时需单独处理 - label: '时间段', + prop: "timerange", // 应该是个数组,在提交数据时需单独处理 + label: "时间段", bind: { - placeholder: '选择日期时间', - type: 'datetimerange', + placeholder: "选择日期时间", + type: "datetimerange", "start-placeholder": "开始时间", "end-placeholder": "结束时间", - } + }, }, { button: { @@ -75,11 +76,11 @@ export default function () { button: { type: "primary", name: "新增", - permission: "pms:materialStorage:save" + permission: "pms:materialStorage:save", }, bind: { plain: true, - } + }, }, ]; @@ -94,20 +95,19 @@ export default function () { rows: [ [ { - input: true, + datetime: true, label: "上料时间", - prop: "name", + prop: "startTime", rules: { required: true, message: "必填项不能为空", trigger: "blur" }, - elparams: { placeholder: "请输入上料时间" }, + elparams: { placeholder: "请选择上料时间", type: "datetime" }, }, - { - input: true, + datetime: true, label: "结束上料时间", - prop: "name", + prop: "endTime", rules: { required: true, message: "必填项不能为空", trigger: "blur" }, - elparams: { placeholder: "请输入结束上料时间" }, - } + elparams: { placeholder: "请选择结束上料时间", type: "datetime" }, + }, ], [ { @@ -115,7 +115,7 @@ export default function () { label: "物料", prop: "materialId", options: [], - fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }), + fetchData: () => this.$http("/pms/material/page", { params: { page: 1, size: 999 } }), rules: { required: true, message: "必填项不能为空", trigger: "blur" }, elparams: { placeholder: "请选择物料", filterable: true }, }, @@ -125,7 +125,10 @@ export default function () { prop: "qty", // options: [], // fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }), - rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + rules: [ + { required: true, message: "必填项不能为空", trigger: "blur" }, + { type: "number", message: "请输入正确的数字", trigger: "blur", transform: (val) => Number(val) }, + ], elparams: { placeholder: "请输入上料数量" }, }, ], @@ -136,7 +139,7 @@ export default function () { label: "料仓", prop: "storeId", options: [], - fetchData: () => this.$http('/pms/materialStorage/page', { params: { page: 1, size: 999 } }), + fetchData: () => this.$http("/pms/materialStorage/page", { params: { page: 1, size: 999, typeDictValue: '1' } }), rules: { required: true, message: "必填项不能为空", trigger: "blur" }, elparams: { placeholder: "请选择料仓", filterable: true }, }, @@ -185,4 +188,3 @@ export default function () { }, }; } -