按计划行车状态判断调整

This commit is contained in:
fan 2020-11-05 17:32:48 +08:00
parent cfc6f9648a
commit f09b1aa17d
4 changed files with 11 additions and 36 deletions

View File

@ -149,7 +149,6 @@ export default {
}, },
data() { data() {
return { return {
isDisable: false,
tryTime: 0, // tryTime: 0, //
timeNow: 0, // timeNow: 0, //
time: null, // time: null, //
@ -198,6 +197,9 @@ export default {
}, },
scriptModeList() { scriptModeList() {
return ScriptMode; return ScriptMode;
},
isDisable() {
return this.$store.state.training.started;
} }
}, },
watch: { watch: {
@ -236,8 +238,6 @@ export default {
const initTime = new Date(this.$store.state.training.initTime || null); const initTime = new Date(this.$store.state.training.initTime || null);
const model = {initTime:this.formatTime(initTime)}; const model = {initTime:this.formatTime(initTime)};
this.start(model); this.start(model);
} else {
this.isDisable = true;
} }
} }
}, },
@ -286,9 +286,6 @@ export default {
const ss = prefixIntrger(initTime.getSeconds(), 2); const ss = prefixIntrger(initTime.getSeconds(), 2);
return `${hh}:${mm}:${ss}`; return `${hh}:${mm}:${ss}`;
}, },
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
loadInitData() { loadInitData() {
const data = { const data = {
mapId: this.$route.query.mapId, mapId: this.$route.query.mapId,
@ -334,7 +331,6 @@ export default {
}); });
}, },
start(model) { // 仿 start(model) { // 仿
this.isDisable = true;
const data = { const data = {
time: model.initTime time: model.initTime
}; };
@ -344,7 +340,6 @@ export default {
ranAsPlan(data, this.group).then(res => { ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => { }).catch(error => {
this.isDisable = false;
if (error.code == '5001') { if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed')); this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') { } else if (error.code == '5002') {
@ -375,7 +370,6 @@ export default {
this.$refs.demonMenu.hideScheduling(run); this.$refs.demonMenu.hideScheduling(run);
}, },
end() { end() {
this.isDisable = false;
exitRunPlan(this.group).then(() => { exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => { this.$store.dispatch('training/setMapDefaultState').then(() => {
@ -385,7 +379,6 @@ export default {
}); });
}); });
}).catch(() => { }).catch(() => {
this.isDisable = true;
this.$messageBox(this.$t('display.demon.endSimulationFail')); this.$messageBox(this.$t('display.demon.endSimulationFail'));
}); });
}, },

View File

@ -233,14 +233,9 @@ export default {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/countTime'); this.$store.dispatch('training/countTime');
this.planRunning = resp.data.planRunning; this.planRunning = resp.data.planRunning;
if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(this.planRunning); //
} else if (this.isScript) {
if (resp.data.planRunning) { if (resp.data.planRunning) {
this.$store.commit('training/start'); this.$store.commit('training/start');
} }
}
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) { } else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true; this.dataError = true;
this.$messageBox('此地图数据正在维护中,无法运行!'); this.$messageBox('此地图数据正在维护中,无法运行!');

View File

@ -98,7 +98,6 @@ export default {
}, },
data() { data() {
return { return {
isDisable: false,
tryTime: 0, // tryTime: 0, //
timeNow: 0, // timeNow: 0, //
time: null, // time: null, //
@ -140,6 +139,9 @@ export default {
}, },
projectDevice() { projectDevice() {
return this.$route.query.projectDevice; return this.$route.query.projectDevice;
},
isDisable() {
return this.$store.state.training.started;
} }
}, },
watch: { watch: {
@ -210,9 +212,6 @@ export default {
console.log(error); console.log(error);
} }
}, },
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
loadInitData() { loadInitData() {
const data = { const data = {
mapId: this.$route.query.mapId, mapId: this.$route.query.mapId,
@ -239,7 +238,6 @@ export default {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },
start(model) { // 仿 start(model) { // 仿
this.isDisable = true;
const data = { const data = {
time: model.initTime time: model.initTime
}; };
@ -249,7 +247,6 @@ export default {
ranAsPlan(data, this.group).then(res => { ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => { }).catch(error => {
this.isDisable = false;
if (error.code == '5001') { if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed')); this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') { } else if (error.code == '5002') {
@ -280,7 +277,6 @@ export default {
this.$refs.demonMenu.hideScheduling(run); this.$refs.demonMenu.hideScheduling(run);
}, },
end() { end() {
this.isDisable = false;
exitRunPlan(this.group).then(() => { exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => { this.$store.dispatch('training/setMapDefaultState').then(() => {
@ -290,14 +286,12 @@ export default {
}); });
}); });
}).catch(() => { }).catch(() => {
this.isDisable = true;
this.$messageBox(this.$t('display.demon.endSimulationFail')); this.$messageBox(this.$t('display.demon.endSimulationFail'));
}); });
}, },
handleQuitQuest() { handleQuitQuest() {
quitScriptNew(this.group).then(resp => { quitScriptNew(this.group).then(resp => {
getSimulationInfoNew(this.group).then((res)=>{ getSimulationInfoNew(this.group).then((res)=>{
this.isDisable = false;
EventBus.$emit('clearRunSeries'); EventBus.$emit('clearRunSeries');
this.quitQuest(); this.quitQuest();
this.initLoadPage(); this.initLoadPage();

View File

@ -109,7 +109,6 @@ export default {
}, },
data() { data() {
return { return {
isDisable: false,
backLoading: false, backLoading: false,
chatShow: true, chatShow: true,
jsStart: true, jsStart: true,
@ -161,6 +160,9 @@ export default {
isDeviceLogin() { isDeviceLogin() {
const typeList = ['LW', 'CW']; const typeList = ['LW', 'CW'];
return typeList.includes(this.$route.query.type); return typeList.includes(this.$route.query.type);
},
isDisable() {
return this.$store.state.training.started;
} }
}, },
watch: { watch: {
@ -172,11 +174,6 @@ export default {
}); });
} }
}, },
'$store.state.training.started': function (val) {
if (val) {
this.isDisable = true;
}
},
'$store.state.socket.simulationOver':function(val) { '$store.state.socket.simulationOver':function(val) {
if (val && this.project == 'refereeJsxt') { if (val && this.project == 'refereeJsxt') {
this.$router.go(-1); this.$router.go(-1);
@ -284,7 +281,6 @@ export default {
}, },
// 仿 // 仿
start(model) { start(model) {
this.isDisable = true;
const data = { const data = {
time: model.initTime time: model.initTime
}; };
@ -294,7 +290,6 @@ export default {
} }
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch((error) => { }).catch((error) => {
this.isDisable = false;
if (error.code == '5001') { if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed')); this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') { } else if (error.code == '5002') {
@ -319,13 +314,11 @@ export default {
}); });
}, },
end() { end() {
this.isDisable = false;
exitRunPlan(this.group).then(()=>{ exitRunPlan(this.group).then(()=>{
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
this.$store.dispatch('map/resetActiveTrainList', false); this.$store.dispatch('map/resetActiveTrainList', false);
}).catch(() => { }).catch(() => {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
this.isDisable = true;
this.$store.dispatch('map/resetActiveTrainList', false); this.$store.dispatch('map/resetActiveTrainList', false);
this.$messageBox(this.$t('error.endSimulationFailed')); this.$messageBox(this.$t('error.endSimulationFailed'));
}); });