rt-sim-training-client/src/store/modules/iscs.js

232 lines
7.0 KiB
JavaScript
Raw Normal View History

2020-01-14 09:06:03 +08:00
import Vue from 'vue';
/**
* iscs状态数据
*/
const iscs = {
namespaced: true,
state: {
iscs: null, // 数据
updateDeviceData: {}, // 修改的数据
2020-05-07 16:39:38 +08:00
rightClickCount: 0, // 右键点击设备
selected: '', // 左键选中设备
2020-10-22 13:03:26 +08:00
selectedCount: 0, // 左键选中
2020-11-03 13:21:56 +08:00
closeMusicNum: 0, // 关闭音乐标识
2020-11-03 10:30:26 +08:00
faultList: [], // 故障 元素状态
2020-10-22 13:03:26 +08:00
incidentList: [], // 事件列表
alarmList: [] // 报警列表
2020-01-14 09:06:03 +08:00
},
getters: {
2020-10-27 18:04:19 +08:00
incidentList: (state) => {
return state.incidentList;
},
alarmList: (state) => {
return state.alarmList;
},
// iscsList: (state) => {
// return state.iscsList;
// },
iscs: (state) => {
return state.iscs;
},
// version: (state) => {
// if (state.iscs) {
// return state.iscs.version;
// } else {
// return null;
// }
// },
2020-01-14 09:06:03 +08:00
updateDeviceData: (state) => {
return state.updateDeviceData;
2020-10-27 18:04:19 +08:00
},
iscsGroupList: (state) => {
if (state.iscs) {
return state.iscs.iscsGroupList || [];
} else {
return [];
}
2020-01-14 09:06:03 +08:00
}
2020-10-27 18:04:19 +08:00
// 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 [];
// }
// },
// selected: (state) => {
// return state.selected;
// },
// selectedCount: (state) => {
// return state.selectedCount;
// },
// getDeviceByCode: (state) => (code) => {
// return state.iscsDevice[code];
// }
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);
2020-05-07 16:39:38 +08:00
},
setSelectedDevice: (state, device) => {
state.selected = device;
state.selectedCount++;
2020-10-22 13:03:26 +08:00
},
setAddAlarmList: (state, device) => {
state.alarmList.unshift(device);
},
setDelIncidentList: (state) => {
state.alarmList = [];
},
setAddIncidentList: (state, device) => {
state.incidentList.unshift(device);
2020-11-03 10:30:26 +08:00
},
setFaultList: (state, list) => {
state.faultList = list;
2020-11-03 13:21:56 +08:00
},
setCloseMusic: (state, num) => {
state.closeMusicNum = num;
2021-09-09 17:22:47 +08:00
},
updateIscsState: (state, deviceStatus) => {
Vue.prototype.$iscs && Vue.prototype.$iscs.update(deviceStatus);
2020-01-14 09:06:03 +08:00
}
},
actions: {
setIscsData: ({ commit }, iscs) => {
commit('setIscsData', iscs);
},
2021-09-09 17:22:47 +08:00
updateIscsState: ({ commit }, deviceStatus) => {
commit('updateIscsState', deviceStatus);
},
2020-01-14 09:06:03 +08:00
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);
2020-05-07 16:39:38 +08:00
},
setSelectedDevice: ( { commit }, device) => {
commit('setSelectedDevice', device);
2020-10-22 13:03:26 +08:00
},
setAddAlarmList: ( { commit }, device) => {
commit('setAddAlarmList', device);
},
setAddIncidentList: ( { commit }, device) => {
commit('setAddIncidentList', device);
},
setDelIncidentList: ( { commit }) => {
commit('setDelIncidentList');
2020-01-14 09:06:03 +08:00
}
}
};
export default iscs;