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

View File

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

View File

@ -126,100 +126,109 @@ export function parser(data) {
return iscsDevice; return iscsDevice;
} }
function updateIscsListByDevice(iscs, name, device) { function updateIscsListByDevice(state, name, device) {
var list = iscs[name]; // var list = iscs[name];
if (list) { const list = state.iscs[name];
if (list && list instanceof Array) {
const index = list.findIndex(elem => { return elem.code == device.code; }); const index = list.findIndex(elem => { return elem.code == device.code; });
if (index >= 0) { if (device._dispose) {
device._dispose ? list.splice(index, 1) : list[index] = deepClone(device); index >= 0 && list.splice(index, 1); // 删除
} else { } else if (!list[index]) {
list.push(deepClone(device)); 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 { } else {
iscs[name] = [device]; // list[name] = [device];
state.iscs[name] = [device];
} }
return list; // return list;
} }
export function updateIscsData(device) { export function updateIscsData(state, device) {
const iscsData = store.state.iscs; // const state = store.state;
switch (device._type) { switch (device._type) {
case deviceType.vidiconList : case deviceType.Vidicon :
updateIscsListByDevice(iscsData, 'vidiconList', device); updateIscsListByDevice(state, 'vidiconList', device);
break; break;
case deviceType.vidiconCloudList : case deviceType.VidiconCloud :
updateIscsListByDevice(iscsData, 'vidiconCloudList', device); updateIscsListByDevice(state, 'vidiconCloudList', device);
break; break;
case deviceType.ManualAlarmButton : case deviceType.ManualAlarmButton :
updateIscsListByDevice(iscsData, 'manualAlarmButtonList', device); updateIscsListByDevice(state, 'manualAlarmButtonList', device);
break; break;
case deviceType.FireHydranAlarmButton: case deviceType.FireHydranAlarmButton:
updateIscsListByDevice(iscsData, 'fireHydranAlarmButtonList', device); updateIscsListByDevice(state, 'fireHydranAlarmButtonList', device);
break; break;
case deviceType.GasFireControl: case deviceType.GasFireControl:
updateIscsListByDevice(iscsData, 'gasFireControlList', device); updateIscsListByDevice(state, 'gasFireControlList', device);
break; break;
case deviceType.SmokeDetector: case deviceType.SmokeDetector:
updateIscsListByDevice(iscsData, 'smokeDetectorList', device); updateIscsListByDevice(state, 'smokeDetectorList', device);
break; break;
case deviceType.TemperatureDetector: case deviceType.TemperatureDetector:
updateIscsListByDevice(iscsData, 'temperatureDetectorList', device); updateIscsListByDevice(state, 'temperatureDetectorList', device);
break; break;
case deviceType.PlatformScreenDoor: case deviceType.PlatformScreenDoor:
updateIscsListByDevice(iscsData, 'platformScreenDoorList', device); updateIscsListByDevice(state, 'platformScreenDoorList', device);
break; break;
case deviceType.FrozenPump : case deviceType.FrozenPump :
updateIscsListByDevice(iscsData, 'frozenPumpList', device); updateIscsListByDevice(state, 'frozenPumpList', device);
break; break;
case deviceType.Ventilator : case deviceType.Ventilator :
updateIscsListByDevice(iscsData, 'ventilatorList', device); updateIscsListByDevice(state, 'ventilatorList', device);
break; break;
case deviceType.Chiller : case deviceType.Chiller :
updateIscsListByDevice(iscsData, 'chillerList', device); updateIscsListByDevice(state, 'chillerList', device);
break; break;
case deviceType.CoolTower : case deviceType.CoolTower :
updateIscsListByDevice(iscsData, 'coolTowerList', device); updateIscsListByDevice(state, 'coolTowerList', device);
break; break;
case deviceType.EndDoor: case deviceType.EndDoor:
updateIscsListByDevice(iscsData, 'endDoorList', device); updateIscsListByDevice(state, 'endDoorList', device);
break; break;
case deviceType.BorderRadius: case deviceType.BorderRadius:
updateIscsListByDevice(iscsData, 'borderRadiusList', device); updateIscsListByDevice(state, 'borderRadiusList', device);
break; break;
case deviceType.BrakeMachine: case deviceType.BrakeMachine:
updateIscsListByDevice(iscsData, 'brakeMachineList', device); updateIscsListByDevice(state, 'brakeMachineList', device);
break; break;
case deviceType.EntranceGuard: case deviceType.EntranceGuard:
updateIscsListByDevice(iscsData, 'entranceGuardList', device); updateIscsListByDevice(state, 'entranceGuardList', device);
break; break;
case deviceType.TicketMachine: case deviceType.TicketMachine:
updateIscsListByDevice(iscsData, 'ticketMachineList', device); updateIscsListByDevice(state, 'ticketMachineList', device);
break; break;
case deviceType.SemiAutomaticTicketMachine: case deviceType.SemiAutomaticTicketMachine:
updateIscsListByDevice(iscsData, 'semiAutomaticTicketMachineList', device); updateIscsListByDevice(state, 'semiAutomaticTicketMachineList', device);
break; break;
case deviceType.AirConditioner: case deviceType.AirConditioner:
updateIscsListByDevice(iscsData, 'airConditionerList', device); updateIscsListByDevice(state, 'airConditionerList', device);
break; break;
case deviceType.OrbitalVentilator: case deviceType.OrbitalVentilator:
updateIscsListByDevice(iscsData, 'orbitalVentilatorList', device); updateIscsListByDevice(state, 'orbitalVentilatorList', device);
break; break;
case deviceType.JetFan: case deviceType.JetFan:
updateIscsListByDevice(iscsData, 'jetFanList', device); updateIscsListByDevice(state, 'jetFanList', device);
break; break;
case deviceType.TunnelFan: case deviceType.TunnelFan:
updateIscsListByDevice(iscsData, 'tunnelFanList', device); updateIscsListByDevice(state, 'tunnelFanList', device);
break; break;
case deviceType.FireDamper: case deviceType.FireDamper:
updateIscsListByDevice(iscsData, 'fireDamperList', device); updateIscsListByDevice(state, 'fireDamperList', device);
break; break;
case deviceType.SmookProofFd: case deviceType.SmookProofFd:
updateIscsListByDevice(iscsData, 'smookProofFdList', device); updateIscsListByDevice(state, 'smookProofFdList', device);
break; break;
case deviceType.VolumeControlDamper: case deviceType.VolumeControlDamper:
updateIscsListByDevice(iscsData, 'volumeControlDamperList', device); updateIscsListByDevice(state, 'volumeControlDamperList', device);
break; 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 { selectLineCode } from './config/deviceStyle';
import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser'; import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import store from '@/store';
const renderer = 'canvas'; const renderer = 'canvas';
const devicePixelRatio = 1; const devicePixelRatio = 1;
@ -251,6 +252,9 @@ class Jlmap {
this.$painter.update(oDevice); 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('training/nextNew', step).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) { if (valid) {
// querySignalStatus(this.group, {signalCode: this.selected.code}).then(resp => { this.$store.dispatch('map/getRouteDataListByCode', this.selected.code).then(list => {
// const tempData = resp.data; const tempData = list;
const tempData = [];
this.$refs.routeSelection.doShow(step.operation, this.selected, tempData); this.$refs.routeSelection.doShow(step.operation, this.selected, tempData);
// }); });
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow(step);
@ -373,11 +372,10 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// querySignalStatus(this.group, {signalCode: `${this.selected.code}`}).then(resp => { this.$store.dispatch('map/getRouteDataListByCode', this.selected.code).then(list => {
// const tempData = resp.data;
const tempData = []; const tempData = [];
this.$refs.routeHandControl.doShow(operate, this.selected, tempData); this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
// }); });
} }
}); });
}, },
@ -394,11 +392,10 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// querySignalStatus(this.group, {signalCode: `${this.selected.code}`}).then(resp => { this.$store.dispatch('map/getRouteDataListByCode', this.selected.code).then(list => {
// const tempData = resp.data;
const tempData = []; const tempData = [];
this.$refs.routeHandControl.doShow(operate, this.selected, tempData); this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
// }); });
} }
}); });
}, },

View File

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

View File

@ -179,6 +179,7 @@ const map = {
namespaced: true, namespaced: true,
state: { state: {
routeData: {}, // 进路数据
stepData: [], // 缓存数据 stepData: [], // 缓存数据
recoverStepData: [], // 缓存恢复数据 recoverStepData: [], // 缓存恢复数据
seclectDeviceList: [], // 包围框选中元素列表 seclectDeviceList: [], // 包围框选中元素列表
@ -556,6 +557,14 @@ const map = {
}, },
setMousemove: (state) => { setMousemove: (state) => {
state.mousemove++; 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); commit('setDataZoom', dataZoom);
}, },
setMapData: ({ commit }, map) => { setMapData: ({ commit }, map) => { // 设置地图数据
commit('setMapData', 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) => { setTrainDetails: ({ commit }, message) => {
commit('setTrainDetails', message); commit('setTrainDetails', message);
}, },

View File

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

View File

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

View File

@ -65,7 +65,7 @@ export default {
}, },
computed:{ computed:{
...mapGetters('iscs', [ ...mapGetters('iscs', [
'frozenPumpList' 'iscs'
]) ])
}, },
watch:{ watch:{
@ -96,7 +96,7 @@ export default {
y: this.form.y y: this.form.y
}, },
_type: 'FrozenPump', _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, width: this.form.width,
color:'#00ff00', color:'#00ff00',
pumpType:this.form.type pumpType:this.form.type

View File

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

View File

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

View File

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