This commit is contained in:
fan 2020-01-19 14:03:51 +08:00
commit 0f50e1b00a
13 changed files with 160 additions and 112 deletions

View File

@ -6,6 +6,7 @@ import Painter from './painter';
import deviceType from './constant/deviceType';
import {calculateDCenter, createBoundingRect, deviceFactory} from './utils/parser';
import { updateIscsData } from './utils/parser';
import store from '@/store';
const renderer = 'canvas';
const devicePixelRatio = 1;
@ -120,7 +121,7 @@ class Iscs {
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
updateIscsData(elem);
// updateIscsData(store.state.iscs, elem);
const oDevice = this.iscsDevice[code] || deviceFactory(type, elem);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
delete this.iscsDevice[code];

View File

@ -2,7 +2,7 @@ export function getUID(type, list) {
if (list && list.length > 0) {
const lastCode = list[list.length - 1].code;
const num = lastCode.split(type + '_')[1];
return type + `_${num + 1}`;
return type + `_${parseInt(num) + 1}`;
} else {
return type + `_1`;
}

View File

@ -126,100 +126,109 @@ export function parser(data) {
return iscsDevice;
}
function updateIscsListByDevice(iscs, name, device) {
var list = iscs[name];
if (list) {
function updateIscsListByDevice(state, name, device) {
// var list = iscs[name];
const list = state.iscs[name];
if (list && list instanceof Array) {
const index = list.findIndex(elem => { return elem.code == device.code; });
if (index >= 0) {
device._dispose ? list.splice(index, 1) : list[index] = deepClone(device);
} else {
list.push(deepClone(device));
if (device._dispose) {
index >= 0 && list.splice(index, 1); // 删除
} else if (!list[index]) {
list.push(deepClone(device)); // 新增
} else if (index >= 0) {
list[index] = deepClone(device); // item map 数据 model 页面表单数据
}
// if (index >= 0) {
// device._dispose ? list.splice(index, 1) : list[index] = deepClone(device);
// } else {
// list.push(deepClone(device));
// }
} else {
iscs[name] = [device];
// list[name] = [device];
state.iscs[name] = [device];
}
return list;
// return list;
}
export function updateIscsData(device) {
const iscsData = store.state.iscs;
export function updateIscsData(state, device) {
// const state = store.state;
switch (device._type) {
case deviceType.vidiconList :
updateIscsListByDevice(iscsData, 'vidiconList', device);
case deviceType.Vidicon :
updateIscsListByDevice(state, 'vidiconList', device);
break;
case deviceType.vidiconCloudList :
updateIscsListByDevice(iscsData, 'vidiconCloudList', device);
case deviceType.VidiconCloud :
updateIscsListByDevice(state, 'vidiconCloudList', device);
break;
case deviceType.ManualAlarmButton :
updateIscsListByDevice(iscsData, 'manualAlarmButtonList', device);
updateIscsListByDevice(state, 'manualAlarmButtonList', device);
break;
case deviceType.FireHydranAlarmButton:
updateIscsListByDevice(iscsData, 'fireHydranAlarmButtonList', device);
updateIscsListByDevice(state, 'fireHydranAlarmButtonList', device);
break;
case deviceType.GasFireControl:
updateIscsListByDevice(iscsData, 'gasFireControlList', device);
updateIscsListByDevice(state, 'gasFireControlList', device);
break;
case deviceType.SmokeDetector:
updateIscsListByDevice(iscsData, 'smokeDetectorList', device);
updateIscsListByDevice(state, 'smokeDetectorList', device);
break;
case deviceType.TemperatureDetector:
updateIscsListByDevice(iscsData, 'temperatureDetectorList', device);
updateIscsListByDevice(state, 'temperatureDetectorList', device);
break;
case deviceType.PlatformScreenDoor:
updateIscsListByDevice(iscsData, 'platformScreenDoorList', device);
updateIscsListByDevice(state, 'platformScreenDoorList', device);
break;
case deviceType.FrozenPump :
updateIscsListByDevice(iscsData, 'frozenPumpList', device);
updateIscsListByDevice(state, 'frozenPumpList', device);
break;
case deviceType.Ventilator :
updateIscsListByDevice(iscsData, 'ventilatorList', device);
updateIscsListByDevice(state, 'ventilatorList', device);
break;
case deviceType.Chiller :
updateIscsListByDevice(iscsData, 'chillerList', device);
updateIscsListByDevice(state, 'chillerList', device);
break;
case deviceType.CoolTower :
updateIscsListByDevice(iscsData, 'coolTowerList', device);
updateIscsListByDevice(state, 'coolTowerList', device);
break;
case deviceType.EndDoor:
updateIscsListByDevice(iscsData, 'endDoorList', device);
updateIscsListByDevice(state, 'endDoorList', device);
break;
case deviceType.BorderRadius:
updateIscsListByDevice(iscsData, 'borderRadiusList', device);
updateIscsListByDevice(state, 'borderRadiusList', device);
break;
case deviceType.BrakeMachine:
updateIscsListByDevice(iscsData, 'brakeMachineList', device);
updateIscsListByDevice(state, 'brakeMachineList', device);
break;
case deviceType.EntranceGuard:
updateIscsListByDevice(iscsData, 'entranceGuardList', device);
updateIscsListByDevice(state, 'entranceGuardList', device);
break;
case deviceType.TicketMachine:
updateIscsListByDevice(iscsData, 'ticketMachineList', device);
updateIscsListByDevice(state, 'ticketMachineList', device);
break;
case deviceType.SemiAutomaticTicketMachine:
updateIscsListByDevice(iscsData, 'semiAutomaticTicketMachineList', device);
updateIscsListByDevice(state, 'semiAutomaticTicketMachineList', device);
break;
case deviceType.AirConditioner:
updateIscsListByDevice(iscsData, 'airConditionerList', device);
updateIscsListByDevice(state, 'airConditionerList', device);
break;
case deviceType.OrbitalVentilator:
updateIscsListByDevice(iscsData, 'orbitalVentilatorList', device);
updateIscsListByDevice(state, 'orbitalVentilatorList', device);
break;
case deviceType.JetFan:
updateIscsListByDevice(iscsData, 'jetFanList', device);
updateIscsListByDevice(state, 'jetFanList', device);
break;
case deviceType.TunnelFan:
updateIscsListByDevice(iscsData, 'tunnelFanList', device);
updateIscsListByDevice(state, 'tunnelFanList', device);
break;
case deviceType.FireDamper:
updateIscsListByDevice(iscsData, 'fireDamperList', device);
updateIscsListByDevice(state, 'fireDamperList', device);
break;
case deviceType.SmookProofFd:
updateIscsListByDevice(iscsData, 'smookProofFdList', device);
updateIscsListByDevice(state, 'smookProofFdList', device);
break;
case deviceType.VolumeControlDamper:
updateIscsListByDevice(iscsData, 'volumeControlDamperList', device);
updateIscsListByDevice(state, 'volumeControlDamperList', device);
break;
}
store.dispatch('iscs/setIscsData', iscsData);
// store.dispatch('iscs/setIscsData', state.iscs);
}

View File

@ -10,6 +10,7 @@ import deviceType from './constant/deviceType';
import { selectLineCode } from './config/deviceStyle';
import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
import { deepAssign } from '@/utils/index';
import store from '@/store';
const renderer = 'canvas';
const devicePixelRatio = 1;
@ -251,6 +252,9 @@ class Jlmap {
this.$painter.update(oDevice);
}
}
if (elem.deviceType == 'ROUTE') { // 处理进路数据状态
store.dispatch('map/updateRouteState', elem);
}
});
// 状态后处理

View File

@ -262,11 +262,10 @@ export default {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
// querySignalStatus(this.group, {signalCode: this.selected.code}).then(resp => {
// const tempData = resp.data;
const tempData = [];
this.$refs.routeSelection.doShow(step.operation, this.selected, tempData);
// });
this.$store.dispatch('map/getRouteDataListByCode', this.selected.code).then(list => {
const tempData = list;
this.$refs.routeSelection.doShow(step.operation, this.selected, tempData);
});
}
}).catch(() => {
this.$refs.noticeInfo.doShow(step);
@ -373,11 +372,10 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// querySignalStatus(this.group, {signalCode: `${this.selected.code}`}).then(resp => {
// const tempData = resp.data;
const tempData = [];
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
// });
this.$store.dispatch('map/getRouteDataListByCode', this.selected.code).then(list => {
const tempData = [];
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
});
}
});
},
@ -394,11 +392,10 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// querySignalStatus(this.group, {signalCode: `${this.selected.code}`}).then(resp => {
// const tempData = resp.data;
const tempData = [];
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
// });
this.$store.dispatch('map/getRouteDataListByCode', this.selected.code).then(list => {
const tempData = [];
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
});
}
});
},

View File

@ -33,84 +33,84 @@ const iscs = {
return state.updateDeviceData;
},
vidiconList: (state) => {
if (state.iscs && state.iscs.vidiconList) {
if (state.iscs) {
return state.iscs.vidiconList;
} else {
return [];
}
},
vidiconCloudList: (state) => {
if (state.iscs && state.iscs.vidiconCloudList) {
if (state.iscs.vidiconCloudList) {
return state.iscs.vidiconCloudList;
} else {
return [];
}
},
frozenPumpList:(state)=>{
if (state.iscs && state.iscs.frozenPumpList) {
if (state.iscs.frozenPumpList) {
return state.iscs.frozenPumpList;
} else {
return [];
}
},
airConditionerList:(state)=>{
if (state.iscs && state.iscs.airConditionerList) {
if (state.iscs.airConditionerList) {
return state.iscs.airConditionerList;
} else {
return [];
}
},
tunnelFanList:(state)=>{
if (state.iscs && state.iscs.tunnelFanList) {
if (state.iscs.tunnelFanList) {
return state.iscs.tunnelFanList;
} else {
return [];
}
},
orbitalVentilatorList:(state)=>{
if (state.iscs && state.iscs.orbitalVentilatorList) {
if (state.iscs.orbitalVentilatorList) {
return state.iscs.orbitalVentilatorList;
} else {
return [];
}
},
smookProofFdList:(state)=>{
if (state.iscs && state.iscs.smookProofFdList) {
if (state.iscs.smookProofFdList) {
return state.iscs.smookProofFdList;
} else {
return [];
}
},
chillerList:(state)=>{
if (state.iscs && state.iscs.chillerList) {
if (state.iscs.chillerList) {
return state.iscs.chillerList;
} else {
return [];
}
},
coolTowerList:(state)=>{
if (state.iscs && state.iscs.coolTowerList) {
if (state.iscs.coolTowerList) {
return state.iscs.coolTowerList;
} else {
return [];
}
},
fireDamperList:(state)=>{
if (state.iscs && state.iscs.fireDamperList) {
if (state.iscs.fireDamperList) {
return state.iscs.fireDamperList;
} else {
return [];
}
},
jetFanList:(state)=>{
if (state.iscs && state.iscs.jetFanList) {
if (state.iscs.jetFanList) {
return state.iscs.jetFanList;
} else {
return [];
}
},
ventilatorList:(state)=>{
if (state.iscs && state.iscs.ventilatorList) {
if (state.iscs.ventilatorList) {
return state.iscs.ventilatorList;
} else {
return [];
@ -122,7 +122,7 @@ const iscs = {
iscsRender: (state, devices) => {
if (devices && devices.length) {
if (state.iscs) {
devices.forEach(elem => { updateIscsData(elem); });
devices.forEach(elem => { updateIscsData(state, elem); });
}
if (Vue.prototype.$iscs) {
Vue.prototype.$iscs.render(devices);

View File

@ -179,6 +179,7 @@ const map = {
namespaced: true,
state: {
routeData: {}, // 进路数据
stepData: [], // 缓存数据
recoverStepData: [], // 缓存恢复数据
seclectDeviceList: [], // 包围框选中元素列表
@ -556,6 +557,14 @@ const map = {
},
setMousemove: (state) => {
state.mousemove++;
},
setRouteData: (state, routeDataList) => {
routeDataList.forEach(data => {
state.routeData[data.code] = data;
});
},
updateRouteState: (state, status) => {
state.routeData[status.code] = deepAssign(state.routeData[status.code], status);
}
},
@ -573,10 +582,30 @@ const map = {
commit('setDataZoom', dataZoom);
},
setMapData: ({ commit }, map) => {
setMapData: ({ commit }, map) => { // 设置地图数据
commit('setMapData', map);
},
setRouteData: ({ commit }, routeData) => { // 设置进路数据
commit('setRouteData', routeData);
},
updateRouteState: ({ commit }, status) => { // 设置进路数据状态
commit('updateRouteState', status);
},
getRouteDataListByCode: ({ state, commit }, code) => { // 获取进路数据
return new Promise((resolve) => {
const list = [];
const routeList = Object.values(state.routeData);
routeList.forEach(route => {
if (route.startSignalCode == code) {
list.push(route);
}
});
resolve(list);
});
},
setTrainDetails: ({ commit }, message) => {
commit('setTrainDetails', message);
},

View File

@ -44,6 +44,8 @@ export function loadNewMapDataByGroup(group) {
resolve();
});
});
const routeData = resp.data.logicDataNew.routeList; // 设置进路数据
store.dispatch('map/setRouteData', routeData);
}).catch(error => {
reject(error);
});

View File

@ -49,7 +49,7 @@ export default {
},
watch: {
$route(val) {
this.iscsChange();
}
},
created() {

View File

@ -65,7 +65,7 @@ export default {
},
computed:{
...mapGetters('iscs', [
'frozenPumpList'
'iscs'
])
},
watch:{
@ -96,7 +96,7 @@ export default {
y: this.form.y
},
_type: 'FrozenPump',
code: this.isUpdate ? this.form.code : getUID('FrozenPump', this.frozenPumpList),
code: this.isUpdate ? this.form.code : getUID('FrozenPump', this.iscs.frozenPumpList),
width: this.form.width,
color:'#00ff00',
pumpType:this.form.type

View File

@ -49,14 +49,14 @@ export default {
},
computed: {
...mapGetters('iscs', [
'vidiconList'
'iscs'
])
},
methods: {
onSubmit(form) {
this.$refs.form.validate((valid) => {
if (valid) {
const Uid = getUID('Vidicon', this.vidiconList);
const Uid = getUID('Vidicon', this.iscs.vidiconList);
const model = {
_type: 'Vidicon',
code: Uid,

View File

@ -45,14 +45,14 @@ export default {
},
computed: {
...mapGetters('iscs', [
'vidiconCloudList'
'iscs'
])
},
methods: {
onSubmit(form) {
this.$refs.form.validate((valid) => {
if (valid) {
const Uid = getUID('VidiconCloud', this.vidiconCloudList);
const Uid = getUID('VidiconCloud', this.iscs.vidiconCloudList);
const model = {
_type: 'VidiconCloud',
code: Uid,

View File

@ -26,7 +26,6 @@ export default {
navList: [
{
name: '火灾报警',
type: 'FAS',
children: [
{
name: '站台报警',
@ -42,116 +41,123 @@ export default {
}
]
}, {
name: '机电',
type: 'FAS',
children: []
name: '机电', //
children: [
{
name: '机电',
type: 'BAS'
}
]
}, {
name: '广播',
type: 'FAS',
children: [
{
name: '主画面',
type: 'standFAS'
type: 'PA'
},
{
name: '广播监听',
type: 'standFAS'
type: 'PA'
},
{
name: '计时一览',
type: 'standFAS'
type: 'PA'
}
]
}, {
name: '乘客信息',
type: 'FAS',
children: [
{
name: '主画面',
type: 'standFAS'
type: 'PIS'
},
{
name: 'LCD屏控制',
type: 'standFAS'
type: 'PIS'
},
{
name: '计时一览',
type: 'standFAS'
type: 'PIS'
},
{
name: '车站网络',
type: 'standFAS'
type: 'PIS'
},
{
name: '紧急发布一览',
type: 'standFAS'
type: 'PIS'
}
]
}, {
name: '闭路电视',
type: 'FAS',
children: [
{
name: '车站控制',
type: 'standFAS'
type: 'CCTV'
},
{
name: '车站时序',
type: 'standFAS'
type: 'CCTV'
},
{
name: '车站时序编辑',
type: 'standFAS'
type: 'CCTV'
},
{
name: '车站设备状态',
type: 'standFAS'
type: 'CCTV'
},
{
name: '中心设备状态',
type: 'standFAS'
type: 'CCTV'
}
]
}, {
name: '屏蔽门',
type: 'FAS',
children: [
{
name: '屏蔽门',
type: 'standFAS'
type: 'PSD'
}
]
}, {
name: '售检票',
type: 'FAS',
children: [
{
name: '售检票',
type: 'standFAS'
type: 'AFC'
}
]
}, {
name: '门禁',
type: 'FAS',
children: [
{
name: '站厅层',
type: 'standFAS'
type: 'ACS'
},
{
name: '站台层',
type: 'standFAS'
type: 'ACS'
}
]
}, {
name: '防淹门',
type: 'FAS',
children: []
}, {
name: '网络状态',
type: 'FAS',
children: []
}
// {
// name: '', //
// children: [
// {
// name: '',
// type: 'standFAS'
// }
// ]
// }, {
// name: '', //
// children: [
// {
// name: '',
// type: 'standFAS'
// }
// ]
// }
],
stationList: [
{