From 04f19e82e30cdefab149dad434858a3d81162e69 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Fri, 12 Aug 2022 13:45:34 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=AE=BE=E5=A4=87=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=92=8C=E8=AE=BE=E5=A4=87=E5=88=86=E7=BB=84=E6=8A=A5=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base-dialog/addOrUpdate/index.vue | 8 +++--- .../modules/monitoring/equipmentGroup.vue | 13 ++++++++-- .../monitoring/equipmentGroupAlarm.vue | 25 ++++++++++++++----- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index ba96e3b..cd427fd 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -315,7 +315,9 @@ export default { /** 提取url */ const urls = {} this.configs.operations.map(item => { - urls[item.name] = item.url + urls[item.name] = {} + urls[item.name].url = item.url + urls[item.name].extraFields = item.extraFields || {} }) /** 操作 */ switch (btn.name) { @@ -325,9 +327,9 @@ export default { this.$refs['dataForm'].validate(valid => { if (valid) { this.$http({ - url: this.$http.adornUrl(urls[btn.name]), + url: this.$http.adornUrl(urls[btn.name].url), method: btn.name === 'save' ? 'POST' : 'PUT', - data: this.dataForm + data: { ...this.dataForm, ...urls[btn.name].extraFields} }) .then(({ data: res }) => { if (res && res.code === 0) { diff --git a/src/views/modules/monitoring/equipmentGroup.vue b/src/views/modules/monitoring/equipmentGroup.vue index 839b47c..bb2a3c0 100644 --- a/src/views/modules/monitoring/equipmentGroup.vue +++ b/src/views/modules/monitoring/equipmentGroup.vue @@ -64,7 +64,16 @@ const tableConfigs = [ { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } ] -const addOrUpdateConfigs = {} +const addOrUpdateConfigs = { + type: 'dialog', + infoUrl: '/monitoring/equipmentGroup', + fields: [{ name: 'name', label: '分组名称' }, { name: 'code', label: '分组编码' }, 'remark'], + operations: [ + { name: 'cancel', showAlways: true }, + { name: 'save', url: '/monitoring/equipmentGroup', permission: '', showOnEdit: false }, + { name: 'update', url: '/monitoring/equipmentGroup', permission: '', showOnEdit: true } + ] +} export default { data() { @@ -132,7 +141,7 @@ export default { handleOperations({ type, data: id }) { switch (type) { case 'view-alarm': - const {name, code} = this.dataList.find(item => item.id === id) + const { name, code } = this.dataList.find(item => item.id === id) this.$router.push({ name: 'monitoring-equipmentGroupAlarm', params: { diff --git a/src/views/modules/monitoring/equipmentGroupAlarm.vue b/src/views/modules/monitoring/equipmentGroupAlarm.vue index d92dea9..c85c188 100644 --- a/src/views/modules/monitoring/equipmentGroupAlarm.vue +++ b/src/views/modules/monitoring/equipmentGroupAlarm.vue @@ -48,7 +48,7 @@ --> - + { + if (item.extraFields) { + item.extraFields.equipmentGroupId = this.$route.params.id || null + } + }) this.addOrUpdateVisible = true this.$nextTick(() => { this.$refs.addOrUpdate.init(id)