From d906ac949a30cd1f46f6993ef2edc25d221d71d0 Mon Sep 17 00:00:00 2001 From: lb Date: Mon, 27 Feb 2023 11:07:05 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E4=B8=8A=E6=96=99=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 4 +- src/components/BaseSearchForm.vue | 22 ++- .../modules/pms/materialUpload/config.js | 185 ++++++++++++++++++ .../modules/pms/materialUpload/index.vue | 32 +++ 4 files changed, 233 insertions(+), 10 deletions(-) create mode 100644 src/views/modules/pms/materialUpload/config.js create mode 100644 src/views/modules/pms/materialUpload/index.vue diff --git a/public/index.html b/public/index.html index 2bac74f..3abd097 100644 --- a/public/index.html +++ b/public/index.html @@ -38,8 +38,8 @@ <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% } %> diff --git a/src/components/BaseSearchForm.vue b/src/components/BaseSearchForm.vue index 72e8354..dfe9f41 100644 --- a/src/components/BaseSearchForm.vue +++ b/src/components/BaseSearchForm.vue @@ -86,14 +86,20 @@ export default { field.fn().then(({ data: res }) => { if (res.code === 0 && res.data) { // TODO: 此处需要随具体情况再做更新 - field.select = res.map((_) => { - // 找到默认项 - if (_.default) { - this.searchForm[index] = _.value; - } - return _; - }); - console.log("[update] 更新选项列表", res, field.select); + if ("list" in res.data) { + this.$set( + field, + "select", + res.data.list.map((item) => ({ label: item.name, value: item.id })) + ); + console.log("[update] 更新选项列表", res, field.select); + } + } else { + this.$message({ + message: `${field.label} 数据获取出错: ${res.code} - ${res.msg}`, + type: 'error', + duration: 1500 + }) } }); } diff --git a/src/views/modules/pms/materialUpload/config.js b/src/views/modules/pms/materialUpload/config.js new file mode 100644 index 0000000..7e1f020 --- /dev/null +++ b/src/views/modules/pms/materialUpload/config.js @@ -0,0 +1,185 @@ +import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; +import switchBtn from "@/components/noTemplateComponents/switchBtn"; +import QuillRichInput from "@/components/noTemplateComponents/richInput"; +import request from "@/utils/request"; +import { timeFilter } from '@/utils/filters' + +export default function () { + const tableProps = [ + { type: 'index', label: '序号' }, + { prop: "createTime", label: "添加时间", filter: timeFilter }, + { prop: "startTime", label: "上料时间", filter: timeFilter }, + { prop: "endTime", label: "结束上料时间", filter: timeFilter }, + { prop: "material", label: "物料" }, + { prop: "qty", label: "上料数量" }, + { prop: "storeCOde", label: "料仓" }, + { prop: "upPos", label: "上料位点" }, + // { prop: "typeDictValue", label: "过渡车", filter: val => ['否', '是'][val] }, + // { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent + // { prop: "currentQty", label: "载量" }, + // { prop: "currentPos", label: "当前位置" }, + { prop: "description", label: "描述" }, + { prop: "remark", label: "备注" }, + { + prop: "operations", + name: "操作", + fixed: "right", + width: 120, + subcomponent: TableOperaionComponent, + options: ["edit", { name: "delete", emitFull: true, permission: "pms:materialUpload:delete" }], + }, + ]; + + const headFormFields = [ + { + prop: 'materialID', + label: "物料", + // default: { value: "" }, + select: [], + // 绑定数据获取函数 + fn: () => this.$http.get('/pms/material/page', { params: { page: 1, limit: 999 } }), + bind: { + placeholder: '请选择物料', + filterable: true + } + }, + { + prop: 'storeId', + label: "日料仓", + select: [], + // default: { value: "" }, + fn: () => this.$http.get('/pms/materialStorage/page', { params: { page: 1, limit: 999, typeDictValue: '1' } }), + bind: { + placeholder: '请选择日料仓', + filterable: true + } + }, + { + timerange: true, + prop: 'timerange', // 应该是个数组,在提交数据时需单独处理 + label: '时间段', + bind: { + placeholder: '选择日期时间' + } + }, + { + button: { + type: "primary", + name: "查询", + }, + }, + { + button: { + type: "primary", + name: "新增", + permission: "pms:materialStorage:save" + }, + bind: { + plain: true, + } + }, + ]; + + /** + * dialog config 有两个版本,一个适用于 DialogWithMenu 组件,另一个适用于 DialogJustForm 组件 + * 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js + * 此为后者的配置: + */ + const dialogJustFormConfigs = { + clickModalToClose: true, + form: { + rows: [ + [ + { + input: true, + label: "上料时间", + prop: "name", + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请输入上料时间" }, + }, + + { + input: true, + label: "结束上料时间", + prop: "name", + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请输入结束上料时间" }, + } + ], + [ + { + select: true, + label: "物料", + prop: "materialId", + options: [], + fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }), + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请选择物料", filterable: true }, + }, + { + input: true, + label: "上料数量", + prop: "qty", + // options: [], + // fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }), + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请输入上料数量" }, + }, + ], + // [{ component: QuillRichInput, label: "描述信息", prop: "description" }], + [ + { + select: true, + label: "料仓", + prop: "storeId", + options: [], + fetchData: () => this.$http('/pms/materialStorage/page', { params: { page: 1, size: 999 } }), + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请选择料仓", filterable: true }, + }, + { + input: true, + label: "上料位点", + prop: "upPos", + // options: [], + // fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }), + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请输入上料位点" }, + }, + ], + // [{ component: QuillRichInput, label: "描述信息", prop: "description" }], + // [{ + // richInput: true, label: "描述信息", prop: "description" + // }], + [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], + ], + operations: [ + { name: "add", label: "保存", type: "primary", permission: "pms:materialUpload:save", showOnEdit: false }, + { name: "update", label: "更新", type: "primary", permission: "pms:materialUpload:update", showOnEdit: true }, + { name: "reset", label: "重置", type: "warning", showAlways: true }, + // { name: 'cancel', label: '取消', showAlways: true }, + ], + }, + }; + // 备注:弹窗弹出的时间和网速有关...... + + return { + dialogConfigs: dialogJustFormConfigs, + tableConfig: { + table: null, // 此处可省略,el-table 上的配置项 + column: tableProps, // el-column-item 上的配置项 + }, + headFormConfigs: { + rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 + fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的 + }, + urls: { + base: "/pms/materialUpload", + page: "/pms/materialUpload/page", + // subase: '/pms/blenderStepParam', + // subpage: '/pms/blenderStepParam/page', + // more... + }, + }; +} + diff --git a/src/views/modules/pms/materialUpload/index.vue b/src/views/modules/pms/materialUpload/index.vue new file mode 100644 index 0000000..da21189 --- /dev/null +++ b/src/views/modules/pms/materialUpload/index.vue @@ -0,0 +1,32 @@ + + + + +