From db5b5091e124c844807ede61a0129213695b6f60 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Thu, 11 Aug 2022 16:08:01 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AE=8C=E6=88=90=E5=8E=82=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base-dialog/addOrUpdate/index.vue | 13 +++++- .../modules/monitoring/workShopSection.vue | 40 ++++++++++++++++++- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 12e4770..38f5330 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -163,7 +163,6 @@ export default { } }, mounted() { - console.log('mounted>..') /** 计算 defaultPlaceholders */ const prefix = '请输入' Object.entries(this.defaultNames).map(([key, value]) => { @@ -254,7 +253,17 @@ export default { const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] if (opt) { // if opt is valid - return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name] + return opt.placeholder + ? opt.placeholder + : this.defaultPlaceholders[opt.name] + ? this.defaultPlaceholders[opt.name] + : opt.label + ? (opt.type === 'select' ? '请选择' : '请输入') + opt.label + : null + + // : opt.type === 'select' + // ? '请选择' + // : '请输入' } }, diff --git a/src/views/modules/monitoring/workShopSection.vue b/src/views/modules/monitoring/workShopSection.vue index 6d5920c..1b3b6b2 100644 --- a/src/views/modules/monitoring/workShopSection.vue +++ b/src/views/modules/monitoring/workShopSection.vue @@ -62,12 +62,29 @@ const tableConfigs = [ { prop: 'createTime', name: '添加时间' }, { prop: 'name', name: '工段名称' }, { prop: 'code', name: '工段编码' }, - { prop: 'productionLineId', name: '产线ID' }, + // { prop: 'productionLineId', name: '产线ID' }, + { prop: 'productionLineName', name: '产线' }, { prop: 'remark', name: '备注' }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } ] -const addOrUpdateConfigs = {} +const addOrUpdateConfigs = { + type: 'dialog', + infoUrl: '/monitoring/workshopSection', + fields: [ + { name: 'name', label: '工段名称' }, + { name: 'code', label: '工段编码', api: '/monitoring/workshopSection/getCode' }, + { name: 'productionLineId', label: '所属产线', type: 'select', options: [] }, + 'description', + 'remark' + ], + operations: [ + { name: 'reset', url: true, showAlways: true }, + { name: 'cancel', url: true, showAlways: true }, + { name: 'save', url: '/monitoring/workshopSection', permission: '', showOnEdit: false }, + { name: 'update', url: '/monitoring/workshopSection', permission: '', showOnEdit: true } + ] +} export default { data() { @@ -78,6 +95,7 @@ export default { key: '' }, dataList: [], + plList: [], pageIndex: 1, pageSize: 10, totalPage: 0, @@ -91,9 +109,27 @@ export default { BaseTable }, activated() { + this.getProductLine() this.getDataList() }, methods: { + // 获取产线列表 + getProductLine() { + this.$http.get(this.$http.adornUrl('/monitoring/productionLine/list')).then(({ data: res }) => { + if (res && res.code === 0) { + // this.plList = res.data + console.log('res', res) + this.addOrUpdateConfigs.fields.forEach(item => { + if (item.name === 'productionLineId') item.options = res.data.map(item => ({ label: item.name, value: item.id })) + }) + } else { + this.addOrUpdateConfigs.fields.forEach(item => { + if (item.name === 'productionLineId') item.options.splice(0) + }) + // this.plList.splice(0) + } + }) + }, // 获取数据列表 getDataList() { this.addOrUpdateVisible = false