import Vue from 'vue'; import {updateIscsData } from '@/iscs/utils/parser'; /** * iscs状态数据 */ const iscs = { namespaced: true, state: { iscs: null, // 数据 iscsDevice: {}, // 解析后的地图数据 iscsList: {}, // 数据列表 iscsIdList: {}, // 数据列表(以id为标识) updateDeviceData: {}, // 修改的数据 rightClickCount: 0 // 右键点击设备 }, getters: { iscsList: (state) => { return state.iscsList; }, iscs: (state) => { return state.iscs; }, version: (state) => { if (state.iscs) { return state.iscs.version; } else { return null; } }, updateDeviceData: (state) => { return state.updateDeviceData; }, vidiconList: (state) => { if (state.iscs) { return state.iscs.vidiconList; } else { return []; } }, vidiconCloudList: (state) => { if (state.iscs.vidiconCloudList) { return state.iscs.vidiconCloudList; } else { return []; } }, frozenPumpList:(state)=>{ if (state.iscs.frozenPumpList) { return state.iscs.frozenPumpList; } else { return []; } }, airConditionerList:(state)=>{ if (state.iscs.airConditionerList) { return state.iscs.airConditionerList; } else { return []; } }, tunnelFanList:(state)=>{ if (state.iscs.tunnelFanList) { return state.iscs.tunnelFanList; } else { return []; } }, orbitalVentilatorList:(state)=>{ if (state.iscs.orbitalVentilatorList) { return state.iscs.orbitalVentilatorList; } else { return []; } }, smookProofFdList:(state)=>{ if (state.iscs.smookProofFdList) { return state.iscs.smookProofFdList; } else { return []; } }, chillerList:(state)=>{ if (state.iscs.chillerList) { return state.iscs.chillerList; } else { return []; } }, coolTowerList:(state)=>{ if (state.iscs.coolTowerList) { return state.iscs.coolTowerList; } else { return []; } }, fireDamperList:(state)=>{ if (state.iscs.fireDamperList) { return state.iscs.fireDamperList; } else { return []; } }, jetFanList:(state)=>{ if (state.iscs.jetFanList) { return state.iscs.jetFanList; } else { return []; } }, ventilatorList:(state)=>{ if (state.iscs.ventilatorList) { return state.iscs.ventilatorList; } else { return []; } }, arcStatusList:(state)=>{ if (state.iscs.arcStatusList) { return state.iscs.arcStatusList; } else { return []; } } }, mutations: { iscsRender: (state, devices) => { Vue.prototype.$iscs && Vue.prototype.$iscs.render(devices); }, setIscsData: (state, iscs) => { state.iscs = iscs; }, setUpdateDeviceData: (state, model) => { state.rightClickCount++; state.updateDeviceData = model; }, deleteIscsDevices: (state, devices) => { Vue.prototype.$iscs && Vue.prototype.$iscs.render(devices); } }, actions: { setIscsData: ({ commit }, iscs) => { commit('setIscsData', iscs); }, updateIscsDevices: ({ commit }, models) => { return new Promise((resolve) => { if (!(models instanceof Array)) { models = [models]; } commit('iscsRender', models); resolve(models); }); }, setUpdateDeviceData: ({ commit }, models) => { commit('setUpdateDeviceData', models); }, deleteIscsDevices: ({ commit }, models ) => { models = Object.assign(models, {_dispose: true}); if (!(models instanceof Array)) { models = [models]; } commit('deleteIscsDevices', models); } } }; export default iscs;