From 78dd2f3d260f47a829484f0e7f87cb6f2a7c8010 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Thu, 15 Oct 2020 10:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=BC=E5=90=88=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E5=BC=80=E5=85=B3=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs/shape/group.js | 10 +++---- src/iscs/shape/iscsCircle.js | 28 +++++++++++++++++-- src/iscs/status/mapGroup.js | 4 +-- src/views/iscs/iscsDraw/group/tab-custom.vue | 23 ++++++++++----- .../iscs/iscsDraw/group/tab-template.vue | 2 +- .../stationConfig/canvas/iscsCanvas.vue | 6 ++-- .../iscsSystem/stationConfig/dialog/valve.vue | 20 +++++++------ 7 files changed, 63 insertions(+), 30 deletions(-) diff --git a/src/iscs/shape/group.js b/src/iscs/shape/group.js index 9cdb23c59..7f4e4601e 100644 --- a/src/iscs/shape/group.js +++ b/src/iscs/shape/group.js @@ -33,14 +33,14 @@ export default class rect extends Group { position: [rect.x, rect.y] }); // 处理内部元素的包围框 - const rectWidth = rect.width + 30; - const rectHeight = rect.height + 30; + const rectWidth = rect.width + 10; + const rectHeight = rect.height + 10; this.iscsRect = new Rect({ zlevel: model.zlevel, - z: 0, + z: 15, // 层级最高 shape: { - x: -15, - y: -15, + x: -5, + y: -5, width: rectWidth, height: rectHeight }, diff --git a/src/iscs/shape/iscsCircle.js b/src/iscs/shape/iscsCircle.js index e6de6b8e5..96f136a53 100644 --- a/src/iscs/shape/iscsCircle.js +++ b/src/iscs/shape/iscsCircle.js @@ -1,5 +1,6 @@ import Group from 'zrender/src/container/Group'; import Circle from 'zrender/src/graphic/shape/Circle'; +import Vue from 'vue'; export default class iscsCircle extends Group { constructor(device) { @@ -8,8 +9,19 @@ export default class iscsCircle extends Group { this._type = device.model._type; this._code = device.model.code; this.zlevel = device.model.zlevel; - this.z = device.model.z; + this.z = device.model.z; this.create(); + if (this.model.groupId) { + this.createMouseEvent(); + } + } + createMouseEvent() { + // this.on('mouseout', (e) => { + // Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.hide(); + // }); + this.on('mouseover', (e) => { + Vue.prototype.$iscs.iscsDevice[this.model.groupId].instance.show(); + }); } create() { const model = this.model; @@ -19,8 +31,8 @@ export default class iscsCircle extends Group { }); this.iscsCircle = new Circle({ zlevel: model.zlevel, - z: model.z, - z2: model.z2||0, + z: model.z, + z2: model.z2 || 0, shape: { cx:this.model.radius, cy:this.model.radius, @@ -35,8 +47,18 @@ export default class iscsCircle extends Group { this.grouper.add(this.iscsCircle); this.add(this.grouper); } + setState(model) { + this.iscsCircle.setStyle('fill', model.fillColor); + this.iscsCircle.setStyle('stroke', model.strokeColor); + } setModel(dx, dy) { this.model.point.x += dx; this.model.point.y += dy; } + getBoundingRect() { + const rect = this.iscsCircle.getBoundingRect().clone(); + rect.x = rect.x + this.model.point.x; + rect.y = rect.y + this.model.point.y; + return rect; + } } diff --git a/src/iscs/status/mapGroup.js b/src/iscs/status/mapGroup.js index 7a6b15403..d384e70f8 100644 --- a/src/iscs/status/mapGroup.js +++ b/src/iscs/status/mapGroup.js @@ -9,8 +9,8 @@ export default { {type: elType.C} ], statusList: [ - { key: 'valve', value: true, des: '阀门' }, - { key: 'valve', value: false, des: '阀门' } + { key: 'valve', value: true, des: '某某开关分闸', childList: [{type: 'b', status: 'stateB'}] }, + { key: 'valve', value: false, des: '某某开关分闸', childList: [{type: 'b', status: 'stateA'}] } ] } }; diff --git a/src/views/iscs/iscsDraw/group/tab-custom.vue b/src/views/iscs/iscsDraw/group/tab-custom.vue index eab4e6349..cdbb9f4b3 100644 --- a/src/views/iscs/iscsDraw/group/tab-custom.vue +++ b/src/views/iscs/iscsDraw/group/tab-custom.vue @@ -50,16 +50,16 @@ @@ -85,6 +85,7 @@ import mapElement from '@/iscs/status/mapElement.js'; import elCreate from './create'; import deviceType from '@/iscs/constant/deviceType.js'; import {getUID} from '@/iscs/utils/Uid'; +import { mapGetters } from 'vuex'; export default { components: { @@ -122,7 +123,10 @@ export default { { type: 'array', required: true, message: '组元素不能为空', trigger: 'change' } ] }; - } + }, + ...mapGetters('iscs', [ + 'iscs' + ]) }, watch: { '$store.state.iscs.rightClickCount': function (val) { @@ -162,7 +166,6 @@ export default { }, handleCreate(type, describe) { if (type) { - console.log(this.elTypeList); const opt = this.elTypeList.filter(ele => ele.lab == type); this.formModel.elemList.push({ type: type, des: opt[0].describe, code: '' }); } else { @@ -183,7 +186,7 @@ export default { doCreateGroup() { const modelList = []; const model = { - code: getUID('group'), + code: getUID('group', this.iscs.iscsGroupList), _type: deviceType.IscsGroup, name: this.formModel.name, type: this.formModel.type, @@ -201,6 +204,12 @@ export default { }); this.$emit('createDataModel', modelList.concat(model)); + this.formModel = { + name: '', + type: '', + elemList: [], + statusList: [] + }; }, changeStatus(type) { if (mapElement[type]) { @@ -213,7 +222,7 @@ export default { this.formModel.statusList.push({ childList: [], key: '', value: '', des: '' }); }, addChildElement(row) { - row.childList.push({ code: this.elemCode, type: this.elemStatusType, status: this.elemStatus }); + row.childList.push({ type: this.elemStatusType, status: this.elemStatus }); this.elemCode = ''; this.elemStatusType = ''; this.elemStatus = ''; diff --git a/src/views/iscs/iscsDraw/group/tab-template.vue b/src/views/iscs/iscsDraw/group/tab-template.vue index 1d3dda673..55f689a0a 100644 --- a/src/views/iscs/iscsDraw/group/tab-template.vue +++ b/src/views/iscs/iscsDraw/group/tab-template.vue @@ -56,12 +56,12 @@ export default { }, methods: { deviceChange(code) { + this.groupAllHide(); if (code) { this.deviceSelect(this.$iscs.iscsDevice[code]); const device = this.$iscs.iscsDevice[code]; device.instance.show(); } else { - this.groupAllHide(); this.formModel = { code: '', name: '', diff --git a/src/views/iscs/iscsSystem/stationConfig/canvas/iscsCanvas.vue b/src/views/iscs/iscsSystem/stationConfig/canvas/iscsCanvas.vue index ba1b3d773..54266d6d5 100644 --- a/src/views/iscs/iscsSystem/stationConfig/canvas/iscsCanvas.vue +++ b/src/views/iscs/iscsSystem/stationConfig/canvas/iscsCanvas.vue @@ -67,9 +67,9 @@ export default { }, onDblclick(em) { // 父编组上元素内容 - if (em.deviceModel.groupId) { - this.$iscs.iscsDevice[em.deviceModel.groupId].instance.hide(); - this.$refs.valve.doShow(this.$iscs.iscsDevice[em.deviceModel.groupId].model); + if (em.deviceType == 'IscsGroup') { + this.$iscs.iscsDevice[em.deviceModel.code].instance.hide(); + this.$refs.valve.doShow(em.deviceModel); } }, handleViewLoaded() { diff --git a/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue b/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue index 87f807a16..fe38feba4 100644 --- a/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue +++ b/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue @@ -73,7 +73,7 @@ export default { model: {}, formModel: { name: '35KV高压开关室 35KV动力变馈线柜-CT5/1', - action: '短路器遥控分合闸', + action: '短路器遥控开关分闸', info: '' }, list: { @@ -89,9 +89,9 @@ export default { methods: { doShow(models) { this.model = models; - console.log(models, '-----'); + console.log(models); this.dialogShow = true; - this.title = models.name || '1111'; + this.title = models.name || '弹窗名称'; this.elemList = []; models.statusList.forEach(item => { if (!this.elemList.length) { @@ -127,12 +127,15 @@ export default { this.model.statusList.forEach(item => { if (item.key == this.rowData.key && item.value === this.rowData[this.rowData.key]) { item.childList.forEach(ele => { - // console.log(mapElement[ele.type].stateMap[ele.status]); - arr.push({ - code: ele.code, - [this.rowData.key]: this.rowData[this.rowData.key], - ...mapElement[ele.type].stateMap[ele.status] + Object.values(this.model.elemMap).forEach(elem => { + if (elem.type == ele.type) { + arr.push({ + code: elem.code, + ...mapElement[ele.type].stateMap[ele.status] + }); + } }); + // const data = this.model.elemMap }); } }); @@ -155,7 +158,6 @@ export default { handleOption(index, row) { this.activeIndex = index; this.formModel.info = row[row.key] ? this.list[row.key][0] : this.list[row.key][1]; - // this.formModel[row.key] = !row[row.key]; this.rowData = JSON.parse(JSON.stringify(row)); this.showSublayer = true; },