调整综合演练ibp获取数据

This commit is contained in:
zyy 2020-03-16 16:06:50 +08:00
parent 1745bfbcf1
commit 933f0c1bba
5 changed files with 99 additions and 63 deletions

View File

@ -59,3 +59,11 @@ export function getIbpInfo(id) {
method: 'get' method: 'get'
}); });
} }
// 根据线路编码和车站编码查询IBP数据
export function getIbpInfoByStation(mapId, stationCode) {
return request({
url: `/api/ibp/query?mapId=${mapId}&stationCode=${stationCode}`,
method: 'get'
});
}

View File

@ -211,7 +211,7 @@ export default {
operation: '', operation: '',
cmdType: '', cmdType: '',
param: { param: {
stationList: list stationCodes: list
} }
}; };
if (this.controlMode == 'center') { if (this.controlMode == 'center') {

View File

@ -115,10 +115,7 @@ export default {
const step = { const step = {
start: true, start: true,
code: this.selected.code, code: this.selected.code,
operation: OperationEvent.StationControl.requestCentralControl.menu.operation, operation: OperationEvent.StationControl.requestCentralControl.menu.operation
param: {
stationControlCode: this.selected.code
}
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid }) => { this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
@ -131,10 +128,7 @@ export default {
const step = { const step = {
start: true, start: true,
code: this.selected.code, code: this.selected.code,
operation: OperationEvent.StationControl.requestStationControl.menu.operation, operation: OperationEvent.StationControl.requestStationControl.menu.operation
param: {
stationControlCode: this.selected.code
}
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid }) => { this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {

View File

@ -53,24 +53,32 @@ export default {
return crules; return crules;
} }
}, },
async created () { watch: {
try { '$route.params.mapId': function() {
const res = await getStationList(this.$route.params.mapId); this.getStationLIst();
this.stationList = [];
if (res.code == 200) {
res.data.forEach(station => {
const param = {
label: station.name,
value: station.code
};
this.stationList.push(param);
});
}
} catch (error) {
console.log(error);
} }
}, },
async created () {
this.getStationLIst();
},
methods: { methods: {
async getStationLIst() {
try {
const res = await getStationList(this.$route.params.mapId);
this.stationList = [];
if (res.code == 200) {
res.data.forEach(station => {
const param = {
label: station.name,
value: station.code
};
this.stationList.push(param);
});
}
} catch (error) {
console.log(error);
}
},
doShow(data) { doShow(data) {
if (data) { if (data) {
this.formModel.stationCode = data.stationCode; this.formModel.stationCode = data.stationCode;

View File

@ -9,12 +9,13 @@
import Vue from 'vue'; import Vue from 'vue';
import IbpPan from '@/ibp/ibpPan'; import IbpPan from '@/ibp/ibpPan';
import { parser } from '@/ibp/utils/parser'; import { parser } from '@/ibp/utils/parser';
import ibpData from '@/ibp/constant/ibpData'; // import ibpData from '@/ibp/constant/ibpData';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen'; import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat'; import { putJointTrainingSimulationUser } from '@/api/chat';
import { handlerIbpEvent } from '@/api/simulation'; import { handlerIbpEvent } from '@/api/simulation';
import { IbpOperation } from '@/scripts/ConstDic'; import { IbpOperation } from '@/scripts/ConstDic';
import { getIbpInfoByStation } from '@/api/ibp';
export default { export default {
name: 'Ibp', name: 'Ibp',
@ -90,7 +91,7 @@ export default {
this.ibpDestroy(); this.ibpDestroy();
}, },
methods: { methods: {
initIbp() { initIbp(offsetX = 0) {
this.ibpDestroy(); this.ibpDestroy();
this.loading = true; this.loading = true;
this.$ibp = new IbpPan({ this.$ibp = new IbpPan({
@ -102,7 +103,7 @@ export default {
}, },
options: { options: {
scaleRate: 1, scaleRate: 1,
offsetX: 0, offsetX: offsetX,
offsetY: 0 offsetY: 0
}, },
methods: { methods: {
@ -115,29 +116,52 @@ export default {
this.$ibp.on('selected', this.onSelected, this); this.$ibp.on('selected', this.onSelected, this);
} }
}, },
show (deviceCode) { async show (deviceCode, ibpPart) {
if (!deviceCode) { if (!deviceCode) {
return; return;
} }
this.stationCode = deviceCode; // console.log(deviceCode);
document.getElementById(this.ibpId).oncontextmenu = function (e) { // const ibpDatas = ibpData[deviceCode];
return false; try {
}; const res = await getIbpInfoByStation(this.$route.query.mapId, deviceCode);
// let offsetX = 0; if (res.data.data) {
// if (ibpPart === 'left') { const ibpDatas = JSON.parse(res.data.data).drawData;
// offsetX = 0; this.stationCode = deviceCode;
// } else if (ibpPart === 'right') { document.getElementById(this.ibpId).oncontextmenu = function (e) {
// offsetX = 1920; return false;
// } };
const data = parser(ibpData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight}); let offsetX = 0;
if (ibpPart === 'left') {
offsetX = 0;
} else if (ibpPart === 'right') {
offsetX = 1920;
}
const data = parser(ibpDatas, {width: this.canvasWidth, height: this.canvasHeight}); // ibp
this.initIbp(offsetX);
this.setIbp(data, ibpData[deviceCode]); this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpData[deviceCode]); this.$store.dispatch('ibp/setIbpData', ibpDatas);
this.handleBanOpenScreenDoorStatus(); this.handleBanOpenScreenDoorStatus();
this.initClockTime(this.initTime); this.initClockTime(this.initTime);
} else {
//
this.loading = false;
this.$alert('当前ibp盘数据不存在', '信息', {
confirmButtonText: '确定',
callback: action => {}
});
}
} catch (error) {
this.loading = false;
this.$alert('当前ibp盘数据不存在', '信息', {
confirmButtonText: '确定',
callback: action => {}
});
}
window.document.oncontextmenu = function () { window.document.oncontextmenu = function () {
return false; return false;
}; };
}, },
setIbp(data, oldData) { setIbp(data, oldData) {
this.$ibp.setIbp(oldData, data); this.$ibp.setIbp(oldData, data);
@ -154,31 +178,33 @@ export default {
// //
onSelected(em) { onSelected(em) {
if (em.deviceModel.mean) { if (em.deviceModel.mean) {
switch (IbpOperation[em.deviceModel.mean].event) { if (IbpOperation[em.deviceModel.mean]) {
case 'UpHoldTrain': switch (IbpOperation[em.deviceModel.mean].event) {
case 'UpCancelHoldTrain': case 'UpHoldTrain':
case 'DownHoldTrain': case 'UpCancelHoldTrain':
case 'DownCancelHoldTrain': case 'DownHoldTrain':
handlerIbpEvent(this.$route.query.group, {operate:IbpOperation[em.deviceModel.mean].operate, stationCode: this.stationCode}); case 'DownCancelHoldTrain':
break; handlerIbpEvent(this.$route.query.group, {operate: IbpOperation[em.deviceModel.mean].operate, stationCode: this.stationCode});
case 'BanUpOpenScreenDoor': break;
this.banUpOpenScreenDoor = !this.banUpOpenScreenDoor; case 'BanUpOpenScreenDoor':
break; this.banUpOpenScreenDoor = !this.banUpOpenScreenDoor;
case 'BanDownOpenScreenDoor': break;
this.banDownOpenScreenDoor = !this.banDownOpenScreenDoor; case 'BanDownOpenScreenDoor':
break; this.banDownOpenScreenDoor = !this.banDownOpenScreenDoor;
case 'UpOpenScreenDoor': break;
this.openScreenDoor(this.banUpOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate); case 'UpOpenScreenDoor':
break; this.openScreenDoor(this.banUpOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate);
case 'DownOpenScreenDoor': break;
this.openScreenDoor(this.banDownOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate); case 'DownOpenScreenDoor':
break; this.openScreenDoor(this.banDownOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate);
break;
}
} }
} }
}, },
openScreenDoor(flag, operate) { openScreenDoor(flag, operate) {
if (flag) { if (flag) {
handlerIbpEvent(this.$route.query.group, {operate: operate, stationCode:this.stationCode}); handlerIbpEvent(this.$route.query.group, {operate: operate, stationCode: this.stationCode});
} }
}, },
// //