调整综合演练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'
});
}
// 根据线路编码和车站编码查询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: '',
cmdType: '',
param: {
stationList: list
stationCodes: list
}
};
if (this.controlMode == 'center') {

View File

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

View File

@ -53,7 +53,16 @@ export default {
return crules;
}
},
watch: {
'$route.params.mapId': function() {
this.getStationLIst();
}
},
async created () {
this.getStationLIst();
},
methods: {
async getStationLIst() {
try {
const res = await getStationList(this.$route.params.mapId);
this.stationList = [];
@ -70,7 +79,6 @@ export default {
console.log(error);
}
},
methods: {
doShow(data) {
if (data) {
this.formModel.stationCode = data.stationCode;

View File

@ -9,12 +9,13 @@
import Vue from 'vue';
import IbpPan from '@/ibp/ibpPan';
import { parser } from '@/ibp/utils/parser';
import ibpData from '@/ibp/constant/ibpData';
// import ibpData from '@/ibp/constant/ibpData';
import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat';
import { handlerIbpEvent } from '@/api/simulation';
import { IbpOperation } from '@/scripts/ConstDic';
import { getIbpInfoByStation } from '@/api/ibp';
export default {
name: 'Ibp',
@ -90,7 +91,7 @@ export default {
this.ibpDestroy();
},
methods: {
initIbp() {
initIbp(offsetX = 0) {
this.ibpDestroy();
this.loading = true;
this.$ibp = new IbpPan({
@ -102,7 +103,7 @@ export default {
},
options: {
scaleRate: 1,
offsetX: 0,
offsetX: offsetX,
offsetY: 0
},
methods: {
@ -115,29 +116,52 @@ export default {
this.$ibp.on('selected', this.onSelected, this);
}
},
show (deviceCode) {
async show (deviceCode, ibpPart) {
if (!deviceCode) {
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;
document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false;
};
// let offsetX = 0;
// if (ibpPart === 'left') {
// offsetX = 0;
// } else if (ibpPart === 'right') {
// offsetX = 1920;
// }
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.$store.dispatch('ibp/setIbpData', ibpData[deviceCode]);
this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpDatas);
this.handleBanOpenScreenDoorStatus();
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 () {
return false;
};
},
setIbp(data, oldData) {
this.$ibp.setIbp(oldData, data);
@ -154,6 +178,7 @@ export default {
//
onSelected(em) {
if (em.deviceModel.mean) {
if (IbpOperation[em.deviceModel.mean]) {
switch (IbpOperation[em.deviceModel.mean].event) {
case 'UpHoldTrain':
case 'UpCancelHoldTrain':
@ -175,6 +200,7 @@ export default {
break;
}
}
}
},
openScreenDoor(flag, operate) {
if (flag) {