调整综合演练ibp获取数据
This commit is contained in:
parent
1745bfbcf1
commit
933f0c1bba
@ -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'
|
||||
});
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ export default {
|
||||
operation: '',
|
||||
cmdType: '',
|
||||
param: {
|
||||
stationList: list
|
||||
stationCodes: list
|
||||
}
|
||||
};
|
||||
if (this.controlMode == 'center') {
|
||||
|
@ -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) {
|
||||
|
@ -53,24 +53,32 @@ export default {
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
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);
|
||||
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 = [];
|
||||
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) {
|
||||
if (data) {
|
||||
this.formModel.stationCode = data.stationCode;
|
||||
|
@ -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;
|
||||
}
|
||||
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});
|
||||
// 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(ibpDatas, {width: this.canvasWidth, height: this.canvasHeight}); // ibp 绘图编译数据
|
||||
this.initIbp(offsetX);
|
||||
|
||||
this.setIbp(data, ibpData[deviceCode]);
|
||||
this.$store.dispatch('ibp/setIbpData', ibpData[deviceCode]);
|
||||
this.handleBanOpenScreenDoorStatus();
|
||||
this.initClockTime(this.initTime);
|
||||
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,31 +178,33 @@ export default {
|
||||
// 点击选择事件
|
||||
onSelected(em) {
|
||||
if (em.deviceModel.mean) {
|
||||
switch (IbpOperation[em.deviceModel.mean].event) {
|
||||
case 'UpHoldTrain':
|
||||
case 'UpCancelHoldTrain':
|
||||
case 'DownHoldTrain':
|
||||
case 'DownCancelHoldTrain':
|
||||
handlerIbpEvent(this.$route.query.group, {operate:IbpOperation[em.deviceModel.mean].operate, stationCode: this.stationCode});
|
||||
break;
|
||||
case 'BanUpOpenScreenDoor':
|
||||
this.banUpOpenScreenDoor = !this.banUpOpenScreenDoor;
|
||||
break;
|
||||
case 'BanDownOpenScreenDoor':
|
||||
this.banDownOpenScreenDoor = !this.banDownOpenScreenDoor;
|
||||
break;
|
||||
case 'UpOpenScreenDoor':
|
||||
this.openScreenDoor(this.banUpOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate);
|
||||
break;
|
||||
case 'DownOpenScreenDoor':
|
||||
this.openScreenDoor(this.banDownOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate);
|
||||
break;
|
||||
if (IbpOperation[em.deviceModel.mean]) {
|
||||
switch (IbpOperation[em.deviceModel.mean].event) {
|
||||
case 'UpHoldTrain':
|
||||
case 'UpCancelHoldTrain':
|
||||
case 'DownHoldTrain':
|
||||
case 'DownCancelHoldTrain':
|
||||
handlerIbpEvent(this.$route.query.group, {operate: IbpOperation[em.deviceModel.mean].operate, stationCode: this.stationCode});
|
||||
break;
|
||||
case 'BanUpOpenScreenDoor':
|
||||
this.banUpOpenScreenDoor = !this.banUpOpenScreenDoor;
|
||||
break;
|
||||
case 'BanDownOpenScreenDoor':
|
||||
this.banDownOpenScreenDoor = !this.banDownOpenScreenDoor;
|
||||
break;
|
||||
case 'UpOpenScreenDoor':
|
||||
this.openScreenDoor(this.banUpOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate);
|
||||
break;
|
||||
case 'DownOpenScreenDoor':
|
||||
this.openScreenDoor(this.banDownOpenScreenDoor, IbpOperation[em.deviceModel.mean].operate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
openScreenDoor(flag, operate) {
|
||||
if (flag) {
|
||||
handlerIbpEvent(this.$route.query.group, {operate: operate, stationCode:this.stationCode});
|
||||
handlerIbpEvent(this.$route.query.group, {operate: operate, stationCode: this.stationCode});
|
||||
}
|
||||
},
|
||||
// 右键点击事件
|
||||
|
Loading…
Reference in New Issue
Block a user