调整综合监控开关状态

This commit is contained in:
zyy 2020-10-15 10:30:30 +08:00
parent 3770b4a153
commit 78dd2f3d26
7 changed files with 63 additions and 30 deletions

View File

@ -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
},

View File

@ -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;
}
}

View File

@ -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'}] }
]
}
};

View File

@ -50,16 +50,16 @@
<el-table-column label="关联">
<template slot-scope="scope">
<el-tag v-for="(tag, index) in scope.row.childList" :key="index" closable @close="handleClose(tag, scope.row.childList)">
{{ tag.code }}--{{ tag.status }}
{{ tag.type }}--{{ tag.status }}
</el-tag>
{{ elemCode }}
<!-- {{ elemCode }} -->
<el-select v-model="elemStatusType" size="small" clearable placeholder="" @change="changeStatus">
<el-option v-for="item in elTypeList" :key="item.lab" :label="item.describe" :value="item.lab" />
</el-select>
<el-select v-model="elemStatus" size="small" clearable>
<el-option v-for="item in optionsList" :key="item" :label="item" :value="item" />
</el-select>
<el-button size="mini" :type="activeChild == scope.$index? 'danger': ''" @click="handleActiveChild(scope.$index, scope.row)">激活</el-button>
<!-- <el-button size="mini" :type="activeChild == scope.$index? 'danger': ''" @click="handleActiveChild(scope.$index, scope.row)">激活</el-button> -->
<el-button size="small" @click="addChildElement(scope.row)">添加</el-button>
</template>
</el-table-column>
@ -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 = '';

View File

@ -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: '',

View File

@ -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() {

View File

@ -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;
},