2020-01-14 09:06:03 +08:00
|
|
|
import Vue from 'vue';
|
2020-01-17 17:27:11 +08:00
|
|
|
import {updateIscsData } from '@/iscs/utils/parser';
|
2020-01-14 09:06:03 +08:00
|
|
|
/**
|
|
|
|
* 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;
|
2020-01-16 14:52:45 +08:00
|
|
|
},
|
2020-01-16 18:02:57 +08:00
|
|
|
vidiconList: (state) => {
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs) {
|
2020-01-16 18:02:57 +08:00
|
|
|
return state.iscs.vidiconList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
vidiconCloudList: (state) => {
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.vidiconCloudList) {
|
2020-01-16 18:02:57 +08:00
|
|
|
return state.iscs.vidiconCloudList;
|
2020-01-16 14:52:45 +08:00
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
2020-01-17 17:27:11 +08:00
|
|
|
},
|
|
|
|
frozenPumpList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.frozenPumpList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.frozenPumpList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
airConditionerList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.airConditionerList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.airConditionerList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tunnelFanList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.tunnelFanList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.tunnelFanList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
orbitalVentilatorList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.orbitalVentilatorList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.orbitalVentilatorList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
smookProofFdList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.smookProofFdList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.smookProofFdList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
chillerList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.chillerList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.chillerList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
coolTowerList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.coolTowerList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.coolTowerList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fireDamperList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.fireDamperList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.fireDamperList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
jetFanList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.jetFanList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.jetFanList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ventilatorList:(state)=>{
|
2020-01-19 13:49:55 +08:00
|
|
|
if (state.iscs.ventilatorList) {
|
2020-01-17 17:27:11 +08:00
|
|
|
return state.iscs.ventilatorList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
2020-02-07 18:19:56 +08:00
|
|
|
},
|
|
|
|
arcStatusList:(state)=>{
|
|
|
|
if (state.iscs.arcStatusList) {
|
|
|
|
return state.iscs.arcStatusList;
|
|
|
|
} else {
|
|
|
|
return [];
|
|
|
|
}
|
2020-01-14 09:06:03 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mutations: {
|
|
|
|
iscsRender: (state, devices) => {
|
2020-02-05 14:43:12 +08:00
|
|
|
Vue.prototype.$iscs && Vue.prototype.$iscs.render(devices);
|
2020-01-14 09:06:03 +08:00
|
|
|
},
|
|
|
|
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];
|
|
|
|
}
|
2020-01-17 17:27:11 +08:00
|
|
|
|
2020-01-14 09:06:03 +08:00
|
|
|
commit('iscsRender', models);
|
|
|
|
resolve(models);
|
2020-01-17 17:27:11 +08:00
|
|
|
|
2020-01-14 09:06:03 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
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;
|