From 0bb7b11271ee2b257bcceadb3daf57676e96c848 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Fri, 17 Jan 2020 17:27:11 +0800 Subject: [PATCH] =?UTF-8?q?iscs=20bas=20=E7=8A=B6=E6=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4=20=20=E7=94=9F?= =?UTF-8?q?=E6=88=90uid=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4=20=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs/utils/Uid.js | 2 +- src/iscs/utils/parser.js | 7 +- src/store/modules/iscs.js | 83 ++++++++++++++++++- .../iscsDraw/iscsBasOperate/fireDamper.vue | 12 +-- .../iscsDraw/iscsBasOperate/frozenPump.vue | 12 +-- .../system/iscsDraw/iscsBasOperate/jetFan.vue | 12 +-- .../iscsBasOperate/orbitalVentilator.vue | 12 +-- .../iscsDraw/iscsBasOperate/tunnelFan.vue | 13 ++- .../iscsDraw/iscsBasOperate/ventilator.vue | 12 +-- 9 files changed, 122 insertions(+), 43 deletions(-) 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 ff1a52a0d..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(); @@ -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/fireDamper.vue b/src/views/system/iscsDraw/iscsBasOperate/fireDamper.vue index 80d15112b..acabe4cf3 100644 --- a/src/views/system/iscsDraw/iscsBasOperate/fireDamper.vue +++ b/src/views/system/iscsDraw/iscsBasOperate/fireDamper.vue @@ -22,6 +22,8 @@