From 5f5a9f645d11d0a8961c53aacee83c87cb6416a2 Mon Sep 17 00:00:00 2001 From: lb Date: Tue, 7 Mar 2023 15:29:08 +0800 Subject: [PATCH] add order --- public/index.html | 4 +- src/components/DialogJustForm.vue | 55 ++- .../pms/order/components/BaseListTable.vue | 133 ++++++ .../pms/order/components/DialogJustForm.vue | 271 ++++++++++++ .../pms/order/components/ListViewWithHead.vue | 402 ++++++++++++++++++ src/views/modules/pms/order/config.js | 258 +++++++++++ src/views/modules/pms/order/index.vue | 32 ++ 7 files changed, 1130 insertions(+), 25 deletions(-) create mode 100644 src/views/modules/pms/order/components/BaseListTable.vue create mode 100644 src/views/modules/pms/order/components/DialogJustForm.vue create mode 100644 src/views/modules/pms/order/components/ListViewWithHead.vue create mode 100644 src/views/modules/pms/order/config.js create mode 100644 src/views/modules/pms/order/index.vue diff --git a/public/index.html b/public/index.html index 2bac74f..c743726 100644 --- a/public/index.html +++ b/public/index.html @@ -39,8 +39,8 @@ <% } %> diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue index 4aa30a1..6fc9d7a 100644 --- a/src/components/DialogJustForm.vue +++ b/src/components/DialogJustForm.vue @@ -264,32 +264,41 @@ export default { this.loadingStatus = true; // 获取基本信息 - this.$http.get(this.urls.base + `/${this.dataForm.id}`).then(({ data: res }) => { - if (res && res.code === 0) { - this.dataForm = __pick(res.data, Object.keys(this.dataForm)); - /** 格式化文件上传列表 */ - if (Array.isArray(this.dataForm.files)) { - this.dataForm.files = this.dataForm.files.map((file) => ({ - id: file.id, - name: file.fileUrl.split("/").pop(), - typeCode: file.typeCode, - url: file.fileUrl, - })); + this.$http + .get(this.urls.base + `/${this.dataForm.id}`) + .then(({ data: res }) => { + if (res && res.code === 0) { + this.dataForm = __pick(res.data, Object.keys(this.dataForm)); + /** 格式化文件上传列表 */ + if (Array.isArray(this.dataForm.files)) { + this.dataForm.files = this.dataForm.files.map((file) => ({ + id: file.id, + name: file.fileUrl.split("/").pop(), + typeCode: file.typeCode, + url: file.fileUrl, + })); + } else { + this.$message({ + message: `${res.code}: ${res.msg}`, + type: "error", + duration: 1500, + }); + } + // console.log("[DialogJustForm] init():", this.dataForm); } - // console.log("[DialogJustForm] init():", this.dataForm); - } - this.loadingStatus = false; - }).catch(err => { - this.loadingStatus = false; - this.$message({ - message: `${err}`, - type: 'error', - duration: 1500 + this.loadingStatus = false; }) - }); + .catch((err) => { + this.loadingStatus = false; + this.$message({ + message: `${err}`, + type: "error", + duration: 1500, + }); + }); } else { // 如果不是编辑 - this.loadingStatus = false + this.loadingStatus = false; } }); }, @@ -347,7 +356,7 @@ export default { const { updateTime } = this.dataForm; httpPayload = { ...httpPayload, - updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss") + updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"), }; } diff --git a/src/views/modules/pms/order/components/BaseListTable.vue b/src/views/modules/pms/order/components/BaseListTable.vue new file mode 100644 index 0000000..53b9c5a --- /dev/null +++ b/src/views/modules/pms/order/components/BaseListTable.vue @@ -0,0 +1,133 @@ + + + + + + diff --git a/src/views/modules/pms/order/components/DialogJustForm.vue b/src/views/modules/pms/order/components/DialogJustForm.vue new file mode 100644 index 0000000..1e2a82f --- /dev/null +++ b/src/views/modules/pms/order/components/DialogJustForm.vue @@ -0,0 +1,271 @@ + + + + + diff --git a/src/views/modules/pms/order/components/ListViewWithHead.vue b/src/views/modules/pms/order/components/ListViewWithHead.vue new file mode 100644 index 0000000..8e3d303 --- /dev/null +++ b/src/views/modules/pms/order/components/ListViewWithHead.vue @@ -0,0 +1,402 @@ + + + + + + diff --git a/src/views/modules/pms/order/config.js b/src/views/modules/pms/order/config.js new file mode 100644 index 0000000..3be518c --- /dev/null +++ b/src/views/modules/pms/order/config.js @@ -0,0 +1,258 @@ +import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; +import TableTextComponent from "@/components/noTemplateComponents/detailComponent"; +import StatusComponent from "@/components/noTemplateComponents/statusComponent"; +import { timeFilter, dictFilter } from "@/utils/filters"; + +export default function () { + + const operations = { + 'ongoing': ['edit'], + 'pending': ['edit', 'delete'], + 'finished': ['edit'] + } + + const genTableProps = (type /** ongoing, pending, finished */) => + [ + { type: 'index', label: '序号' }, + { prop: "createTime", label: "添加时间", filter: timeFilter }, + { prop: "statusDictValue", label: "订单状态", filter: dictFilter('order_status') }, // 不可编辑 + { prop: "code", label: "订单号" }, + { prop: "cate", label: "子订单号" }, + { prop: "productCode", label: "物料编号" }, // select, filterable + { prop: "shapeCode", label: "砖型编号" }, // select, filterable + { prop: "brand", label: "牌号" }, // select, filterable + { prop: "addon", label: "addon" }, + { prop: "ai", label: "版本号" }, // auto display according to the 配方 + { prop: "shortDesc", label: "物料号销售文本" }, + { prop: "bomCode", label: "配方编码" }, + { prop: "pressCode", label: "压机号" }, // select, filterable + { prop: "blenderCode", label: "混料机号" }, // select, filterable + { prop: "kilnCode", label: "隧道窑号" }, // select, filterable + { prop: "prodqty", label: "订单砖数" }, + { prop: "ktmp", label: "烧成温度" }, + { prop: "tt", label: "烧成时间" }, + { prop: "yieldqty", label: "已生产数量" }, // uneditable + { prop: "soqty", label: "销售订单数" }, + { prop: "saleNo", label: "销售订单号" }, + { prop: "saleOrderItem", label: "销售订单item号" }, + { prop: "packTechCode", label: "包装工艺代码" }, // select, filterable + { prop: "specifications", label: "生产订单类型" }, + { prop: "deliveryTime", label: "发货时间" }, + { prop: "customerCode", label: "客户" }, + // { prop: "description", label: "详情", subcomponent: TableTextComponent }, + { prop: "pcsKilnCar", label: "托盘码放砖数", }, + { prop: "remark", label: "备注" }, + { + prop: "operations", + name: "操作", + fixed: "right", + subcomponent: TableOperaionComponent, + options: operations[type] + }, + ]; + + const headFormFields = [ + { + label: "原料名称/编码", + prop: "key", + input: true, + default: { value: "" }, + bind: { placeholder: "请输入原料名称或编码" }, + }, + { + button: { + type: "primary", + name: "查询", + }, + }, + { + button: { + type: "primary", + name: "新增", + permission: "", + }, + bind: { + plain: true, + }, + }, + ]; + + /** + * dialog config 有两个版本,一个适用于 DialogWithMenu 组件,另一个适用于 DialogJustForm 组件 + * 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js + * 此为后者的配置: + */ + const dictList = JSON.parse(localStorage.getItem("dictList")); + const dialogConfigs = { + menu: [ + { name: "原料信息", key: "info" }, + { name: "原料属性信息", key: "attr", onlyEditMode: true }, + // { name: "添加子类", key: "add-sub", onlyEditMode: true }, + ], + form: { + rows: [ + [ + { + input: true, + label: "原料名称", + prop: "name", + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请输入原料名称" }, + }, + { + input: true, + label: "原料编码", + prop: "code", + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请输入原料编码" }, + }, + { + select: true, + label: "单位", + prop: "unitDictValue", + options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })), + elparams: { placeholder: "单位" }, + }, + ], + [ + // { + // cascader: true, + // label: "父级原料", + // prop: "parentId", + // // TODO: 待解决:DialogWithMenu 中设置default只在初始化的时候有效,一旦清空过就无效了 + // // default: '0', + // // rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + // options: [{ id: '0', name: '无' }], // 手动注入额外选项,用到的场景不多... + // fetchData: () => this.$http.get('/pms/material/page', { params: { page: 1, limit: 999, key: '' } }), + // elparams: { placeholder: "请选择父级原料", filterable: true, clearable: true }, + // // fetchTreeData: () => { + // // // TODO:前提是工厂里总的设备类型数不会超过 999 + // // return this.$http.get('/pms/material/tree', { + // // params: { rootId: '0' } + // // }) + // // }, + // // elparams: { placeholder: "请选择父级原料", 'show-all-levels': false, props: { checkStrictly: true } }, + // }, + { + select: true, + label: "原料类型", + prop: "typeId", + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + options: [], + fetchData: () => this.$http.get('/pms/materialType/page', { params: { page: 1, limit: 999 } }), + elparams: { placeholder: "请输入原料类型" }, + // autoDisabled: true, // 有某个条件触发后,自动变成 disabled 状态 + }, + { + select: true, + label: "原料类别", + prop: "typeDictValue", + options: dictList["material_category"].map((u) => ({ label: u.dictLabel, value: u.dictValue })), + elparams: { placeholder: "原料类别" }, + // autoDisabled: true + }, + { input: true, label: "堆积密度(g/cm³)", prop: "density", elparams: { placeholder: "堆积密度" } }, + // { + // input: true, + // label: "设备类型", + // prop: "eqTypeId", + // rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + // elparams: { placeholder: "请输入设备类型" }, + // }, + ], + [ + { + input: true, + label: "英文名称", + prop: "enName", + elparams: { placeholder: "请输入英文名称" }, + }, + { + input: true, + label: "缩写", + prop: "enAb", + elparams: { placeholder: "请输入缩写" }, + }, + { input: true, label: "原料描述", prop: "description", elparams: { placeholder: "原料描述" } }, + ], + [{ input: true, label: "中文描述", prop: "remark", elparams: { placeholder: "备注" } }], + ], + operations: [ + { name: "add", label: "保存", type: "primary", permission: "pms:material:save", showOnEdit: false }, + { name: "update", label: "更新", type: "primary", permission: "pms:material:save", showOnEdit: true }, + { name: "reset", label: "重置", type: "warning", showAlways: true }, + // { name: 'cancel', label: '取消', showAlways: true }, + ], + }, + table: { + // extraParams: ['stepId'], + extraParams: "materialId", + props: [ + { type: 'index', label: '序号' }, + { prop: "createTime", label: "添加时间", filter: timeFilter }, + { prop: "name", label: "属性名", isEditField: true }, + { prop: "value", label: "属性值", isEditField: true }, + { + prop: "operations", + name: "操作", + fixed: "right", + width: 120, + subcomponent: TableOperaionComponent, + options: [ + { name: "edit", permission: "pms:materialArrt:save" }, + { name: "delete", emitFull: true, permission: "pms:materialArrt:save" }, + ], + }, + ], + data: [ + // TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要) + ], + }, + + subDialog: { + extraParam: "materialId", + forceAttachCode: true, + rows: [ + [ + { input: true, label: "属性名", prop: "name", elparams: { placeholder: "请输入属性名" } } + ], + [ + { input: true, label: "属性值", prop: "value", elparams: { placeholder: "请输入属性值" } } + ], + [ + { input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } }, + ] + ], + operations: [ + { name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false }, + { name: "update", label: "更新", type: "primary", permission: "pms:materialArrt:update", showOnEdit: true }, + // { name: 'reset', label: '重置', type: 'warning', showAlways: true }, + // { name: 'cancel', label: '取消', showAlways: true }, + ], + }, + }; + + return { + dialogConfigs, + tableConfigs: { + ongoingTable: genTableProps('ongoing'), + pendingTable: genTableProps('pending'), + finishedTable: genTableProps('finished'), + }, + headFormConfigs: { + rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 + fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的 + }, + urls: { + confirmedOrder: '/pms/order/pageCom', + finishedOrder: '/pms/order/pageEnd', + unConfirmedOrder: '/pms/order/pageUnCom', + // base: "/pms/material", + // page: "/pms/material/page", + // tree: "/pms/material/tree", + // subase: "/pms/materialArrt", + // subpage: "/pms/materialArrt/page", + // more... + }, + }; +} diff --git a/src/views/modules/pms/order/index.vue b/src/views/modules/pms/order/index.vue new file mode 100644 index 0000000..9713950 --- /dev/null +++ b/src/views/modules/pms/order/index.vue @@ -0,0 +1,32 @@ + + + + +