2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-06 10:11:32 +08:00
|
|
|
<div class="display-draft">
|
|
|
|
<el-button-group>
|
2019-11-12 09:24:11 +08:00
|
|
|
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('display.plan.drivingByPlan') }}</el-button>
|
|
|
|
<el-button type="danger" :disabled="!isDisable" @click="end">{{ $t('display.plan.exitPlan') }}</el-button>
|
|
|
|
<el-button type="primary" @click="back">{{ $t('display.plan.back') }}</el-button>
|
2019-08-06 10:11:32 +08:00
|
|
|
</el-button-group>
|
|
|
|
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-06 10:11:32 +08:00
|
|
|
import SetTime from './demon/setTime';
|
|
|
|
import { Notification } from 'element-ui';
|
|
|
|
import { runDiagramIsStart, runDiagramGetTime, runDiagramOver, runDiagramStart } from '@/api/simulation';
|
|
|
|
import { timeFormat } from '@/utils/date';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-11-14 14:10:20 +08:00
|
|
|
// 琏计划 暂时不用
|
2019-08-06 10:11:32 +08:00
|
|
|
export default {
|
2019-11-12 09:24:11 +08:00
|
|
|
name: 'MenuPlan',
|
|
|
|
components: {
|
|
|
|
SetTime
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isDisable: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.training.simulationGroupCount': function () {
|
|
|
|
this.initLoadPage();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async initLoadPage() {
|
|
|
|
try {
|
|
|
|
const rest = await runDiagramIsStart(this.group);
|
|
|
|
if (rest && rest.data) {
|
|
|
|
this.isDisable = true;
|
|
|
|
this.$store.dispatch('training/simulationStart');
|
|
|
|
} else {
|
|
|
|
this.isDisable = false;
|
|
|
|
this.$store.dispatch('training/over');
|
|
|
|
}
|
|
|
|
await this.loadSystemTime();
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async loadSystemTime() {
|
|
|
|
const rest = await runDiagramGetTime(this.group);
|
|
|
|
if (rest && rest.code == 200) {
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(rest.data)}`));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selectBeginTime() {
|
|
|
|
this.$refs.setTime.doShow();
|
|
|
|
},
|
|
|
|
start(model) {
|
|
|
|
this.isDisable = true;
|
|
|
|
runDiagramStart(model, this.group).then(res => {
|
|
|
|
this.$store.dispatch('training/simulationStart').then(() => {
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.isDisable = false;
|
|
|
|
this.$messageBox(this.$t('display.plan.startPlanFail'));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
end() {
|
|
|
|
this.isDisable = false;
|
|
|
|
runDiagramOver(this.group).then(() => {
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
this.$store.dispatch('training/setMapDefaultState').then(() => {
|
|
|
|
this.$store.dispatch('map/clearJlmapTrainView');
|
|
|
|
this.$store.dispatch('map/setTrainWindowShow', false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.isDisable = true;
|
|
|
|
this.$messageBox(this.$t('display.plan.endPlanFail'));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
async back() {
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
history.go(-1);
|
|
|
|
Notification.closeAll();
|
|
|
|
// exitFullscreen();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-08-06 10:11:32 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
.display-card {
|
|
|
|
z-index: 9;
|
2019-07-26 15:52:50 +08:00
|
|
|
display: inline-block;
|
2019-07-26 13:32:43 +08:00
|
|
|
position: absolute;
|
|
|
|
top: 17px;
|
|
|
|
left: 160px;
|
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.display-card .el-row {
|
|
|
|
line-height: 32px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.display-score {
|
|
|
|
background-color: black;
|
|
|
|
display: -moz-inline-box;
|
|
|
|
display: inline-block;
|
|
|
|
text-align: left;
|
|
|
|
height: 32px;
|
|
|
|
line-height: 24px;
|
|
|
|
border-radius: 4px;
|
|
|
|
padding-left: 2px;
|
|
|
|
margin-left: 10px;
|
|
|
|
font-family: "Microsoft" !important;
|
|
|
|
font-size: 18px !important;
|
|
|
|
color: #fff;
|
|
|
|
}
|
|
|
|
|
|
|
|
.display-draft {
|
|
|
|
position: absolute;
|
|
|
|
float: right;
|
|
|
|
right: 15px;
|
|
|
|
bottom: 15px;
|
|
|
|
}
|
2019-08-06 10:11:32 +08:00
|
|
|
</style>
|