From 9ccc8b44b358a4f5c2135230eccc1bf5510d4d85 Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 2 Feb 2023 17:03:28 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=AE=BE=E5=A4=87=E8=A1=A8=E3=80=81?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E8=A1=A8=20&=20=E5=90=8C=E6=AD=A5DialogJustF?= =?UTF-8?q?orm=E5=88=B0DialogWithMenu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DialogJustForm.vue | 2 - src/components/DialogWithMenu.vue | 791 +++++++++++----------- src/views/modules/pms/equipment/config.js | 140 ++++ src/views/modules/pms/equipment/index.vue | 32 + src/views/modules/pms/product/config.js | 149 ++++ src/views/modules/pms/product/index.vue | 32 + 6 files changed, 747 insertions(+), 399 deletions(-) create mode 100644 src/views/modules/pms/equipment/config.js create mode 100644 src/views/modules/pms/equipment/index.vue create mode 100644 src/views/modules/pms/product/config.js create mode 100644 src/views/modules/pms/product/index.vue diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue index 867a514..d06821c 100644 --- a/src/components/DialogJustForm.vue +++ b/src/components/DialogJustForm.vue @@ -162,8 +162,6 @@ export default { } else { col.options.splice(0); } - - return col; }); } }); diff --git a/src/components/DialogWithMenu.vue b/src/components/DialogWithMenu.vue index 46fdf2a..fb46f76 100644 --- a/src/components/DialogWithMenu.vue +++ b/src/components/DialogWithMenu.vue @@ -1,130 +1,82 @@ diff --git a/src/views/modules/pms/equipment/config.js b/src/views/modules/pms/equipment/config.js new file mode 100644 index 0000000..a2af785 --- /dev/null +++ b/src/views/modules/pms/equipment/config.js @@ -0,0 +1,140 @@ +import TableOperaionComponent from '@/components/noTemplateComponents/operationComponent' +import TableTextComponent from '@/components/noTemplateComponents/detailComponent' +import switchBtn from '@/components/noTemplateComponents/switchBtn' + +export default function () { + + const tableProps = [ + { prop: 'name', label: '设备名称' }, + { prop: 'code', label: '设备编码' }, + { prop: 'equipmentType', label: '设备类型' }, + { prop: 'enabled', label: '状态', subcomponent: switchBtn }, // subcomponent + { prop: 'remark', label: '备注' }, + { prop: 'description', label: '查看详情', subcomponent: TableTextComponent }, + { + prop: 'operations', + name: '操作', + fixed: 'right', + width: 120, + subcomponent: TableOperaionComponent, + options: ['edit', { name: 'delete', permission: 'pms:equipment:delete' }] + } + ] + + + const headFormFields = [ + { + label: '设备名称', + prop: 'name', + input: true, + default: { value: '' }, + bind: { placeholder: '请输入设备名称' } + }, + { + button: { + type: 'primary', + name: '查询' + } + }, + { + button: { + type: 'plain', + name: '新增', + permission: 'pms:equipment:save' + } + } + ] + + + const dialogConfigs = { + menu: [{ name: '设备信息' }, { name: '设备属性信息', onlyEditMode: false }], + form: { + rows: [ + [ + { input: true, label: '设备名称', prop: 'name', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称' } }, + { input: true, label: '设备名称编码', prop: 'code', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } }, + // { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } }, + { + select: true, + label: '设备类型', + prop: 'equipmentTypeId', + options: [ + // { label: '1', value: 1 }, + // { label: '2', value: 2 }, + // { label: '3', value: 3 }, + ], + fetchData: () => { + return this.$http.get('/pms/equipmentType/page', { params: { page: 1, limit: 999, key: '' } }) + }, + elparams: { placeholder: '选择一个设备类型' } + }, + ], + [{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }], + ], + operations: [ + { name: 'add', label: '保存', type: 'primary', permission: 'pms:equipment:save', showOnEdit: false }, + { name: 'update', label: '更新', type: 'primary', permission: 'pms:equipment:update', showOnEdit: true }, + { name: 'reset', label: '重置', type: 'warning', showAlways: true }, + // { name: 'cancel', label: '取消', showAlways: true }, + ], + }, + table: { + // extraParams: ['stepId'], + extraParams: 'stepId', + props: [ + { prop: 'createTime', label: '创建时间' }, + { prop: 'equipmentId', label: '所属设备id' }, + { prop: 'attrName', label: '属性名称', isEditField: true }, + { prop: 'attrValue', label: '属性值', isEditField: true }, + { + prop: 'operations', + name: '操作', + fixed: 'right', + width: 120, + subcomponent: TableOperaionComponent, + options: [ + { name: 'edit', permission: 'pms:equipment:update' }, + { name: 'delete', permission: 'pms:equipment:delete' }, + ] + } + ], + data: [ + // TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要) + ], + }, + + subDialog: { + extraParam: 'equipmentId', + rows: [ + [ + { input: true, label: '属性名称', prop: 'attrName', elparams: { placeholder: '请输入属性名称' } }, + { input: true, label: '属性值', prop: 'attrValue', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入属性值' } }, + ], + [ + { textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '添加备注' } }, + ] + ], + operations: [ + { name: 'add', label: '保存', type: 'primary', permission: 'pms:equipment:save', showOnEdit: false }, + { name: 'update', label: '更新', type: 'primary', permission: 'pms:equipment:update', showOnEdit: true }, + ], + }, + }; + + + return { + dialogConfigs, + tableConfig: { + table: null, // 此处可省略,el-table 上的配置项 + column: tableProps, // el-column-item 上的配置项 + }, + headFormConfigs: { + rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 + fields: headFormFields // 名称是由 BaseSearchForm.vue 组件固定的 + }, + urls: { + base: '/pms/equipment', + page: '/pms/equipment/page' + } + } +} \ No newline at end of file diff --git a/src/views/modules/pms/equipment/index.vue b/src/views/modules/pms/equipment/index.vue new file mode 100644 index 0000000..490466a --- /dev/null +++ b/src/views/modules/pms/equipment/index.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/src/views/modules/pms/product/config.js b/src/views/modules/pms/product/config.js new file mode 100644 index 0000000..9dc3970 --- /dev/null +++ b/src/views/modules/pms/product/config.js @@ -0,0 +1,149 @@ +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 tableProps = [ + { prop: 'createTime', label: '添加时间', filter: timeFilter }, + { prop: 'name', label: '产品名称' }, + { prop: 'code', label: '产品编码' }, + { prop: 'typeDictValue', label: '产品类型', filter: dictFilter('product_type') }, + { prop: 'specifications', label: '规格' }, + { prop: 'unitDictValue', label: '单位', filter: dictFilter('unit') }, + { prop: 'weight', label: '重量(kg)' }, + { prop: 'remark', label: '备注' }, + { prop: 'description', label: '附件信息', subcomponent: TableTextComponent, buttonContent: '查看附件' }, + { + prop: 'operations', + name: '操作', + fixed: 'right', + width: 120, + subcomponent: TableOperaionComponent, + options: ['edit', { name: 'delete', permission: 'pms:product:delete' }] + } + ] + + + const headFormFields = [ + { + label: '关键字', + prop: 'key', + input: true, + default: { value: '' }, + bind: { placeholder: '请输入产品名称或编码' } + }, + { + button: { + type: 'primary', + name: '查询' + } + }, + { + button: { + type: 'plain', + name: '新增', + permission: 'pms:product:save' + } + } + ] + + + const dictList = JSON.parse(localStorage.getItem('dictList') || {}) + const dialogConfigs = { + menu: [{ name: '产品信息' }, { name: '产品属性信息', onlyEditMode: false }], + form: { + rows: [ + [ + { input: true, label: '产品名称/砖型名称', prop: 'name', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称' } }, + { input: true, label: '产品编码/砖型编码', prop: 'code', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } }, + // { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } }, + { + select: true, + label: '产品类型', + prop: 'typeDictValue', + options: 'product_type' in dictList ? dictList['product_type'].map(item => ({ value: item.dictValue, label: item.dictLabel })) : [], + elparams: { placeholder: '选择一个产品类型' } + }, + ], + [ + { input: true, label: '规格', prop: 'specifications', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } }, + { input: true, label: '单位平方数', prop: 'code', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } }, + { + select: true, + label: '单位', + prop: 'unitDictValue', + options: 'unit' in dictList ? dictList['unit'].map(item => ({ value: item.dictValue, label: item.dictLabel })) : [], + elparams: { placeholder: '选择一个产品类型' } + }, + ], + [{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }], + ], + operations: [ + { name: 'add', label: '保存', type: 'primary', permission: 'pms:product:save', showOnEdit: false }, + { name: 'update', label: '更新', type: 'primary', permission: 'pms:product:update', showOnEdit: true }, + { name: 'reset', label: '重置', type: 'warning', showAlways: true }, + // { name: 'cancel', label: '取消', showAlways: true }, + ], + }, + table: { + // extraParams: ['stepId'], + extraParams: 'productId', + props: [ + { prop: 'createTime', label: '创建时间' }, + { prop: 'productId', label: '产品ID' }, + { prop: 'attrName', label: '属性名称', isEditField: true }, + { prop: 'attrValue', label: '属性值', isEditField: true }, + { + prop: 'operations', + name: '操作', + fixed: 'right', + width: 120, + subcomponent: TableOperaionComponent, + options: [ + { name: 'edit', permission: 'pms:product:update' }, + { name: 'delete', permission: 'pms:product:delete' }, + ] + } + ], + data: [ + // TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要) + ], + }, + + subDialog: { + extraParam: 'productId', + rows: [ + [ + { input: true, label: '属性名称', prop: 'attrName', elparams: { placeholder: '请输入属性名称' } }, + { input: true, label: '属性值', prop: 'attrValue', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入属性值' } }, + ], + [ + { textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '添加备注' } }, + ] + ], + operations: [ + { name: 'add', label: '保存', type: 'primary', permission: 'pms:product:save', showOnEdit: false }, + { name: 'update', label: '更新', type: 'primary', permission: 'pms:product:update', showOnEdit: true }, + ], + }, + }; + + + return { + dialogConfigs, + tableConfig: { + table: null, // 此处可省略,el-table 上的配置项 + column: tableProps, // el-column-item 上的配置项 + }, + headFormConfigs: { + rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 + fields: headFormFields // 名称是由 BaseSearchForm.vue 组件固定的 + }, + urls: { + base: '/pms/product', + page: '/pms/product/page' + } + } +} \ No newline at end of file diff --git a/src/views/modules/pms/product/index.vue b/src/views/modules/pms/product/index.vue new file mode 100644 index 0000000..52a946c --- /dev/null +++ b/src/views/modules/pms/product/index.vue @@ -0,0 +1,32 @@ + + + + +