调整综合演练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,7 +53,16 @@ export default {
return crules; return crules;
} }
}, },
watch: {
'$route.params.mapId': function() {
this.getStationLIst();
}
},
async created () { async created () {
this.getStationLIst();
},
methods: {
async getStationLIst() {
try { try {
const res = await getStationList(this.$route.params.mapId); const res = await getStationList(this.$route.params.mapId);
this.stationList = []; this.stationList = [];
@ -70,7 +79,6 @@ export default {
console.log(error); console.log(error);
} }
}, },
methods: {
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;
} }
// console.log(deviceCode);
// const ibpDatas = ibpData[deviceCode];
try {
const res = await getIbpInfoByStation(this.$route.query.mapId, deviceCode);
if (res.data.data) {
const ibpDatas = JSON.parse(res.data.data).drawData;
this.stationCode = deviceCode; this.stationCode = deviceCode;
document.getElementById(this.ibpId).oncontextmenu = function (e) { document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false; return false;
}; };
// let offsetX = 0; let offsetX = 0;
// if (ibpPart === 'left') { if (ibpPart === 'left') {
// offsetX = 0; offsetX = 0;
// } else if (ibpPart === 'right') { } else if (ibpPart === 'right') {
// offsetX = 1920; offsetX = 1920;
// } }
const data = parser(ibpData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight}); 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,12 +178,13 @@ export default {
// //
onSelected(em) { onSelected(em) {
if (em.deviceModel.mean) { if (em.deviceModel.mean) {
if (IbpOperation[em.deviceModel.mean]) {
switch (IbpOperation[em.deviceModel.mean].event) { switch (IbpOperation[em.deviceModel.mean].event) {
case 'UpHoldTrain': case 'UpHoldTrain':
case 'UpCancelHoldTrain': case 'UpCancelHoldTrain':
case 'DownHoldTrain': case 'DownHoldTrain':
case 'DownCancelHoldTrain': case 'DownCancelHoldTrain':
handlerIbpEvent(this.$route.query.group, {operate:IbpOperation[em.deviceModel.mean].operate, stationCode: this.stationCode}); handlerIbpEvent(this.$route.query.group, {operate: IbpOperation[em.deviceModel.mean].operate, stationCode: this.stationCode});
break; break;
case 'BanUpOpenScreenDoor': case 'BanUpOpenScreenDoor':
this.banUpOpenScreenDoor = !this.banUpOpenScreenDoor; this.banUpOpenScreenDoor = !this.banUpOpenScreenDoor;
@ -175,10 +200,11 @@ export default {
break; 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});
} }
}, },
// //