diff --git a/src/iscs/constant/deviceRender.js b/src/iscs/constant/deviceRender.js index cc3020dc9..6c258a42a 100644 --- a/src/iscs/constant/deviceRender.js +++ b/src/iscs/constant/deviceRender.js @@ -99,37 +99,37 @@ deviceRender[deviceType.BorderRadius] = { z: 4 }; -/** 圆角边框渲染配置 */ +/** 空调机 */ deviceRender[deviceType.AirConditioner] = { _type: deviceType.AirConditioner, zlevel: 1, z: 4 }; -/** 圆角边框渲染配置 */ +/** 轨道排风机 */ deviceRender[deviceType.OrbitalVentilator] = { _type: deviceType.OrbitalVentilator, zlevel: 1, z: 4 }; -/** 圆角边框渲染配置 */ +/** 射流风机 */ deviceRender[deviceType.JetFan] = { _type: deviceType.JetFan, zlevel: 1, z: 4 }; -/** 圆角边框渲染配置 */ +/** 隧道风机 */ deviceRender[deviceType.TunnelFan] = { _type: deviceType.TunnelFan, zlevel: 1, z: 4 }; -/** 圆角边框渲染配置 */ +/** 防火阀 */ deviceRender[deviceType.FireDamper] = { _type: deviceType.FireDamper, zlevel: 1, z: 4 }; -/** 圆角边框渲染配置 */ +/** 防烟防火阀 */ deviceRender[deviceType.SmookProofFd] = { _type: deviceType.SmookProofFd, zlevel: 1, diff --git a/src/iscs/utils/Uid.js b/src/iscs/utils/Uid.js index 7c260f989..f559072b0 100644 --- a/src/iscs/utils/Uid.js +++ b/src/iscs/utils/Uid.js @@ -1,5 +1,5 @@ export function getUID(type, list) { - if (list.length) { + if (list && list.length > 0) { const lastCode = list[list.length - 1].code; const num = lastCode.split(type + '_')[1]; return type + `_${num + 1}`; diff --git a/src/iscs/utils/parser.js b/src/iscs/utils/parser.js index 0ff6fd738..9b02f7917 100644 --- a/src/iscs/utils/parser.js +++ b/src/iscs/utils/parser.js @@ -3,6 +3,7 @@ import * as matrix from 'zrender/src/core/matrix'; import deviceType from '../constant/deviceType'; import deviceRender from '../constant/deviceRender'; import store from '@/store'; +import { deepClone } from '@/utils/index'; export function createTransform(opts) { let transform = matrix.create(); @@ -87,22 +88,22 @@ export function parser(data) { iscsDevice[elem.code] = deviceFactory(deviceType.BorderRadius, elem); } ); - zrUtil.each(data.AirConditioner || [], elem =>{ + zrUtil.each(data.airConditionerList || [], elem =>{ iscsDevice[elem.code] = deviceFactory(deviceType.AirConditioner, elem); } ); - zrUtil.each(data.OrbitalVentilator || [], elem =>{ + zrUtil.each(data.orbitalVentilatorList || [], elem =>{ iscsDevice[elem.code] = deviceFactory(deviceType.OrbitalVentilator, elem); } ); - zrUtil.each(data.JetFan || [], elem =>{ + zrUtil.each(data.jetFanList || [], elem =>{ iscsDevice[elem.code] = deviceFactory(deviceType.JetFan, elem); } ); - zrUtil.each(data.TunnelFan || [], elem =>{ + zrUtil.each(data.tunnelFanList || [], elem =>{ iscsDevice[elem.code] = deviceFactory(deviceType.TunnelFan, elem); } ); - zrUtil.each(data.FireDamper || [], elem =>{ + zrUtil.each(data.fireDamperList || [], elem =>{ iscsDevice[elem.code] = deviceFactory(deviceType.FireDamper, elem); } ); - zrUtil.each(data.SmookProofFd || [], elem =>{ + zrUtil.each(data.smookProofFdList || [], elem =>{ iscsDevice[elem.code] = deviceFactory(deviceType.SmookProofFd, elem); } ); @@ -116,9 +117,9 @@ function updateIscsListByDevice(iscs, name, device) { if (list) { const index = list.findIndex(elem => { return elem.code == device.code; }); if (index >= 0) { - device._dispose ? list.splice(index, 1) : list[index] = device; + device._dispose ? list.splice(index, 1) : list[index] = deepClone(device); } else { - list.push(device); + list.push(deepClone(device)); } } else { iscs[name] = [device]; @@ -127,7 +128,7 @@ function updateIscsListByDevice(iscs, name, device) { } export function updateIscsData(device) { - const iscsData = store.getters['iscs/iscs']; + const iscsData = store.state.iscs; switch (device._type) { case deviceType.vidiconList : updateIscsListByDevice(iscsData, 'vidiconList', device); diff --git a/src/store/modules/iscs.js b/src/store/modules/iscs.js index 70df69726..965567ec8 100644 --- a/src/store/modules/iscs.js +++ b/src/store/modules/iscs.js @@ -1,5 +1,5 @@ import Vue from 'vue'; - +import {updateIscsData } from '@/iscs/utils/parser'; /** * iscs状态数据 */ @@ -45,12 +45,89 @@ const iscs = { } else { return []; } + }, + frozenPumpList:(state)=>{ + if (state.iscs && state.iscs.frozenPumpList) { + return state.iscs.frozenPumpList; + } else { + return []; + } + }, + airConditionerList:(state)=>{ + if (state.iscs && state.iscs.airConditionerList) { + return state.iscs.airConditionerList; + } else { + return []; + } + }, + tunnelFanList:(state)=>{ + if (state.iscs && state.iscs.tunnelFanList) { + return state.iscs.tunnelFanList; + } else { + return []; + } + }, + orbitalVentilatorList:(state)=>{ + if (state.iscs && state.iscs.orbitalVentilatorList) { + return state.iscs.orbitalVentilatorList; + } else { + return []; + } + }, + smookProofFdList:(state)=>{ + if (state.iscs && state.iscs.smookProofFdList) { + return state.iscs.smookProofFdList; + } else { + return []; + } + }, + chillerList:(state)=>{ + if (state.iscs && state.iscs.chillerList) { + return state.iscs.chillerList; + } else { + return []; + } + }, + coolTowerList:(state)=>{ + if (state.iscs && state.iscs.coolTowerList) { + return state.iscs.coolTowerList; + } else { + return []; + } + }, + fireDamperList:(state)=>{ + if (state.iscs && state.iscs.fireDamperList) { + return state.iscs.fireDamperList; + } else { + return []; + } + }, + jetFanList:(state)=>{ + if (state.iscs && state.iscs.jetFanList) { + return state.iscs.jetFanList; + } else { + return []; + } + }, + ventilatorList:(state)=>{ + if (state.iscs && state.iscs.ventilatorList) { + return state.iscs.ventilatorList; + } else { + return []; + } } }, mutations: { iscsRender: (state, devices) => { - Vue.prototype.$iscs && Vue.prototype.$iscs.render(devices); + if (devices && devices.length) { + if (state.iscs) { + devices.forEach(elem => { updateIscsData(elem); }); + } + if (Vue.prototype.$iscs) { + Vue.prototype.$iscs.render(devices); + } + } }, setIscsData: (state, iscs) => { state.iscs = iscs; @@ -73,8 +150,10 @@ const iscs = { if (!(models instanceof Array)) { models = [models]; } + commit('iscsRender', models); resolve(models); + }); }, setUpdateDeviceData: ({ commit }, models) => { diff --git a/src/views/system/iscsDraw/iscsBasOperate/airConditioner.vue b/src/views/system/iscsDraw/iscsBasOperate/airConditioner.vue index 6001d4fa7..dff906551 100644 --- a/src/views/system/iscsDraw/iscsBasOperate/airConditioner.vue +++ b/src/views/system/iscsDraw/iscsBasOperate/airConditioner.vue @@ -22,6 +22,8 @@