From 54b63a7f537699815c83ad07647c563953a4d95c Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 24 Nov 2023 10:41:11 +0800 Subject: [PATCH] update drawer and edit --- .../components/BasicDrawer.vue | 56 +++++---- .../AlarmGroup/components/BasicDrawer.vue | 113 ++++++++++++------ .../base/config/AlarmGroup/index.vue | 18 ++- .../BindGroup/components/BasicDrawer.vue | 110 +++++++++++------ .../equipment/base/config/BindGroup/index.vue | 45 +++++-- .../DataCollection/CollectionConfig.vue | 30 ++++- .../DataCollection/components/BasicDrawer.vue | 51 ++++++-- 7 files changed, 290 insertions(+), 133 deletions(-) diff --git a/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue b/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue index f38fb47d..b1b27230 100644 --- a/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue +++ b/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue @@ -166,13 +166,17 @@ export default { input: true, label: '参数列名', prop: 'plcParamName', - rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '参数列名不能为空', trigger: 'blur' }, + ], }, { input: true, label: '参数名称', prop: 'name', - rules: [{ required: true, message: '参数名称不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '参数名称不能为空', trigger: 'blur' }, + ], }, ], [ @@ -419,35 +423,35 @@ export default { }, // 提交属性表 - async submitAttrForm() { - this.$refs['attrForm'].validate((valid) => { + submitAttrForm() { + this.$refs['attrForm'].validate(async (valid) => { if (!valid) { return; } - }); - const isEdit = this.attrForm.id != null; - this.attrFormSubmitting = true; - const res = await this.$axios({ - url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, - method: isEdit ? 'put' : 'post', - data: { - ...this.attrForm, - connectId: this.infoData.id - }, - }); - - if (res.code == 0) { - this.closeAttrForm(); - this.$message({ - message: `${isEdit ? '更新' : '创建'}成功`, - type: 'success', - duration: 1500, - onClose: () => { - this.getAttrList(); + const isEdit = this.attrForm.id != null; + this.attrFormSubmitting = true; + const res = await this.$axios({ + url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, + method: isEdit ? 'put' : 'post', + data: { + ...this.attrForm, + connectId: this.infoData.id, }, }); - } - this.attrFormSubmitting = false; + + if (res.code == 0) { + this.closeAttrForm(); + this.$message({ + message: `${isEdit ? '更新' : '创建'}成功`, + type: 'success', + duration: 1500, + onClose: () => { + this.getAttrList(); + }, + }); + } + this.attrFormSubmitting = false; + }); }, closeAttrForm() { diff --git a/src/views/equipment/base/config/AlarmGroup/components/BasicDrawer.vue b/src/views/equipment/base/config/AlarmGroup/components/BasicDrawer.vue index f12d707c..079f999e 100644 --- a/src/views/equipment/base/config/AlarmGroup/components/BasicDrawer.vue +++ b/src/views/equipment/base/config/AlarmGroup/components/BasicDrawer.vue @@ -12,7 +12,7 @@ :wrapper-closable="false" class="drawer" custom-class="mes-drawer" - size="60%" + :size="size || '50%'" @closed="$emit('destroy')"> {{ @@ -42,7 +42,8 @@ :dataForm="form" :rows="formRows" /> --> - + +
+ + + + + + + + + + + + + + +
- -
+
添加报警 @@ -84,7 +111,7 @@
@@ -163,7 +192,7 @@ const SmallTitle = { export default { components: { SmallTitle, DialogForm, BaseInfoForm }, - props: ['sections', 'defaultMode', 'dataId'], // dataId 作为一个通用的存放id的字段 + props: ['sections', 'defaultMode', 'dataId', 'size'], // dataId 作为一个通用的存放id的字段 data() { return { mode: '', @@ -191,7 +220,9 @@ export default { label: '报警编码', // 自动生成 prop: 'code', url: '/base/equipment-group-alarm/getCode', - rules: [{ required: true, message: '报警编码不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '报警编码不能为空', trigger: 'blur' }, + ], }, { select: true, @@ -205,13 +236,17 @@ export default { input: true, label: '参数列名', // 在实时数据库的列名 prop: 'plcParamName', - rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '参数列名不能为空', trigger: 'blur' }, + ], }, { input: true, label: '报警内容', prop: 'alarmContent', - rules: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '报警内容不能为空', trigger: 'blur' }, + ], }, ], [ @@ -223,7 +258,9 @@ export default { { label: '布尔型', value: 2 }, { label: '字符型', value: 1 }, ], - rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '报警类型不能为空', trigger: 'blur' }, + ], }, { input: true, @@ -322,7 +359,7 @@ export default { handleSave() { this.$refs['form'][0].validate(async (valid) => { if (valid) { - const isEdit = this.mode == 'edit'; + const isEdit = !this.mode.includes('detail'); await this.$axios({ url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], method: isEdit ? 'put' : 'post', @@ -403,32 +440,32 @@ export default { }, // 提交属性表 - async submitAttrForm() { - this.$refs['attrForm'].validate((valid) => { + submitAttrForm() { + this.$refs['attrForm'].validate(async (valid) => { if (!valid) { return; } - }); - const isEdit = this.attrForm.id != null; - this.attrFormSubmitting = true; - const res = await this.$axios({ - url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, - method: isEdit ? 'put' : 'post', - data: this.attrForm, - }); - - if (res.code == 0) { - this.closeAttrForm(); - this.$message({ - message: `${isEdit ? '更新' : '创建'}成功`, - type: 'success', - duration: 1500, - onClose: () => { - this.getAttrList(); - }, + const isEdit = this.attrForm.id != null; + this.attrFormSubmitting = true; + const res = await this.$axios({ + url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, + method: isEdit ? 'put' : 'post', + data: this.attrForm, }); - } - this.attrFormSubmitting = false; + + if (res.code == 0) { + this.closeAttrForm(); + this.$message({ + message: `${isEdit ? '更新' : '创建'}成功`, + type: 'success', + duration: 1500, + onClose: () => { + this.getAttrList(); + }, + }); + } + this.attrFormSubmitting = false; + }); }, closeAttrForm() { diff --git a/src/views/equipment/base/config/AlarmGroup/index.vue b/src/views/equipment/base/config/AlarmGroup/index.vue index f32f10f5..61cc4027 100644 --- a/src/views/equipment/base/config/AlarmGroup/index.vue +++ b/src/views/equipment/base/config/AlarmGroup/index.vue @@ -45,6 +45,7 @@ {{ @@ -42,7 +42,7 @@ :dataForm="form" :rows="formRows" /> --> - +
+ + + + + + + + + + + + + +
- -
+
添加属性 @@ -84,7 +109,7 @@ 取消 - - + + 保存 +
@@ -163,7 +190,7 @@ const SmallTitle = { export default { components: { SmallTitle, DialogForm, BaseInfoForm }, - props: ['sections', 'defaultMode', 'dataId'], // dataId 作为一个通用的存放id的字段 + props: ['sections', 'defaultMode', 'dataId', 'size'], // dataId 作为一个通用的存放id的字段 data() { return { mode: '', @@ -191,7 +218,9 @@ export default { label: '报警编码', // 自动生成 prop: 'code', url: '/base/equipment-group-alarm/getCode', - rules: [{ required: true, message: '报警编码不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '报警编码不能为空', trigger: 'blur' }, + ], }, { select: true, @@ -201,7 +230,9 @@ export default { { label: '布尔型', value: 2 }, { label: '字符型', value: 1 }, ], - rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '报警类型不能为空', trigger: 'blur' }, + ], }, ], [ @@ -222,13 +253,17 @@ export default { input: true, label: '参数列名', // 在实时数据库的列名 prop: 'plcParamName', - rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '参数列名不能为空', trigger: 'blur' }, + ], }, { input: true, label: '报警内容', prop: 'alarmContent', - rules: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }], + rules: [ + { required: true, message: '报警内容不能为空', trigger: 'blur' }, + ], }, ], ], @@ -322,7 +357,7 @@ export default { handleSave() { this.$refs['form'][0].validate(async (valid) => { if (valid) { - const isEdit = this.mode == 'edit'; + const isEdit = !this.mode.includes('detail'); await this.$axios({ url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], method: isEdit ? 'put' : 'post', @@ -403,33 +438,32 @@ export default { }, // 提交属性表 - async submitAttrForm() { - this.$refs['attrForm'].validate((valid) => { + submitAttrForm() { + this.$refs['attrForm'].validate(async (valid) => { if (!valid) { return; } - }); - console.log('this.attrform', this.attrForm); - const isEdit = this.attrForm.id != null; - this.attrFormSubmitting = true; - const res = await this.$axios({ - url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, - method: isEdit ? 'put' : 'post', - data: this.attrForm, - }); - - if (res.code == 0) { - this.closeAttrForm(); - this.$message({ - message: `${isEdit ? '更新' : '创建'}成功`, - type: 'success', - duration: 1500, - onClose: () => { - this.getAttrList(); - }, + const isEdit = this.attrForm.id != null; + this.attrFormSubmitting = true; + const res = await this.$axios({ + url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, + method: isEdit ? 'put' : 'post', + data: this.attrForm, }); - } - this.attrFormSubmitting = false; + + if (res.code == 0) { + this.closeAttrForm(); + this.$message({ + message: `${isEdit ? '更新' : '创建'}成功`, + type: 'success', + duration: 1500, + onClose: () => { + this.getAttrList(); + }, + }); + } + this.attrFormSubmitting = false; + }); }, closeAttrForm() { diff --git a/src/views/equipment/base/config/BindGroup/index.vue b/src/views/equipment/base/config/BindGroup/index.vue index 12b94408..81c2295d 100644 --- a/src/views/equipment/base/config/BindGroup/index.vue +++ b/src/views/equipment/base/config/BindGroup/index.vue @@ -45,6 +45,7 @@ {{ @@ -42,7 +42,8 @@ v-model="form" :rows="formRows" /> --> - + +
+ + + + + + + + + + + + + + +
- -
+
添加属性 @@ -86,7 +113,7 @@ 取消 - - + + 保存 +
@@ -164,7 +193,7 @@ const SmallTitle = { export default { components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm }, - props: ['sections', 'defaultMode', 'infoData'], + props: ['sections', 'defaultMode', 'infoData', 'size'], data() { return { mode: '', @@ -412,7 +441,7 @@ export default { handleSave() { this.$refs['form'][0].validate(async (valid) => { if (valid) { - const isEdit = this.mode == 'edit'; + const isEdit = !this.mode.includes('detail'); await this.$axios({ url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], method: isEdit ? 'put' : 'post',