diff --git a/src/components/DialogForm/index.vue b/src/components/DialogForm/index.vue index 80c08798..a290ce95 100644 --- a/src/components/DialogForm/index.vue +++ b/src/components/DialogForm/index.vue @@ -116,6 +116,10 @@ export default { type: Object, default: () => ({}), }, + disabled: { + type: Boolean, + default: false, + } }, data() { return { diff --git a/src/views/base/equipmentBindGroup/components/BasicDrawer.vue b/src/views/base/equipmentBindGroup/components/BasicDrawer.vue new file mode 100644 index 00000000..3bfb196c --- /dev/null +++ b/src/views/base/equipmentBindGroup/components/BasicDrawer.vue @@ -0,0 +1,482 @@ + + + + + + + diff --git a/src/views/base/equipmentBindGroup/components/dialogForm.vue b/src/views/base/equipmentBindGroup/components/dialogForm.vue new file mode 100644 index 00000000..fe7b848b --- /dev/null +++ b/src/views/base/equipmentBindGroup/components/dialogForm.vue @@ -0,0 +1,186 @@ + + + + + + + diff --git a/src/views/base/equipmentBindGroup/index.vue b/src/views/base/equipmentBindGroup/index.vue index bab7525f..e504c804 100644 --- a/src/views/base/equipmentBindGroup/index.vue +++ b/src/views/base/equipmentBindGroup/index.vue @@ -40,6 +40,57 @@ @confirm="submitForm"> + + + @@ -55,16 +106,24 @@ import { import { getEquipmentGroupPage } from '@/api/base/equipmentGroup'; import moment from 'moment'; +import { publicFormatter } from '@/utils/dict'; import basicPageMixin from '@/mixins/lb/basicPageMixin'; +import BasicDrawer from './components/BasicDrawer.vue'; export default { name: 'EquipmentBindGroup', - components: {}, + components: { BasicDrawer }, mixins: [basicPageMixin], data() { return { searchBarKeys: ['groupId', 'equipmentName'], tableBtn: [ + this.$auth.hasPermi('base:equipment-bind-group:update') + ? { + type: 'detail', + btnName: '查看报警', + } + : undefined, this.$auth.hasPermi('base:equipment-bind-group:update') ? { type: 'edit', @@ -88,32 +147,32 @@ export default { }, { prop: 'equipmentName', label: '设备' }, { prop: 'groupName', label: '分组' }, - { - _action: 'equipment-bind-group-show-alert', - label: '分组报警', - subcomponent: { - props: ['injectData'], - render: function (h) { - const _this = this; - return h( - 'el-button', - { - props: { type: 'text' }, - on: { - click: function () { - console.log('inejctdata', _this.injectData); - _this.$emit('emitData', { - action: _this.injectData._action, - value: _this.injectData, - }); - }, - }, - }, - '查看报警' - ); - }, - }, - }, + // { + // _action: 'equipment-bind-group-show-alert', + // label: '分组报警', + // subcomponent: { + // props: ['injectData'], + // render: function (h) { + // const _this = this; + // return h( + // 'el-button', + // { + // props: { type: 'text' }, + // on: { + // click: function () { + // console.log('inejctdata', _this.injectData); + // _this.$emit('emitData', { + // action: _this.injectData._action, + // value: _this.injectData, + // }); + // }, + // }, + // }, + // '查看报警' + // ); + // }, + // }, + // }, ], searchBarFormConfig: [ { @@ -196,6 +255,59 @@ export default { form: {}, // 表单校验 rules: {}, + // + alarmForm: { + id: undefined, + equipmentGroupCode: undefined, + equipmentGroupName: undefined, + }, + editVisible: false, + editMode: '', + drawerBaseInfoRows: [ + [ + { + input: true, + label: '设备分组名称', + prop: 'name', + rules: [{ required: true, message: '不能为空', trigger: 'blur' }], + // bind: { + // disabled: this.editMode == 'detail', // some condition, like detail mode... + // } + }, + { + input: true, + label: '设备分组编码', + prop: 'code', + // url: '/base/equipment/getCode', + }, + ], + ], + drawerListProps: [ + { + prop: 'createTime', + label: '添加时间', + fixed: true, + width: 180, + filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), + }, + { width: 240, prop: 'code', label: '报警编码' }, + { + width: 100, + prop: 'type', + label: '报警类型', + filter: (val) => + val != null ? ['-', '字符型', '布尔型', '-'][val] : '-', + }, + { + width: 90, + prop: 'grade', + label: '报警级别', + filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL), + }, + { width: 180, prop: 'alarmCode', label: '设备报警编码' }, + { width: 128, prop: 'plcParamName', label: '参数列名' }, + { width: 128, prop: 'alarmContent', label: '报警内容' }, + ], }; }, created() { @@ -229,7 +341,6 @@ export default { /** 查询列表 */ getList() { this.loading = true; - _; // 执行查询 getEquipmentBindGroupPage(this.queryParams).then((response) => { this.list = response.data.list; this.total = response.data.total; @@ -299,6 +410,20 @@ export default { }); }); }, + // 查看报警 + handleDetail(row) { + const { equipmentId, equipmentName, groupCode, groupId, groupName, id } = + row; + // 打开抽屉 + this.editMode = 'detail'; + this.alarmForm.id = groupId; + this.alarmForm.equipmentGroupCode = groupCode; + this.alarmForm.equipmentGroupName = groupName; + this.editVisible = true; + this.$nextTick(() => { + this.$refs['drawer'].init(); + }); + }, /** 删除按钮操作 */ handleDelete(row) { const id = row.id; diff --git a/src/views/base/equipmentGroup/components/BasicDrawer.vue b/src/views/base/equipmentGroup/components/BasicDrawer.vue index 3fe8e381..7a6f7a67 100644 --- a/src/views/base/equipmentGroup/components/BasicDrawer.vue +++ b/src/views/base/equipmentGroup/components/BasicDrawer.vue @@ -70,13 +70,11 @@