剧本编制代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-20 15:29:41 +08:00
parent df718218e3
commit 1cc644d893

View File

@ -7,27 +7,28 @@
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
</el-button-group> -->
<el-button-group>
<!-- <el-button type="success" :disabled="isDisable || dataError" @click="selectBeginTime">{{ $t('scriptRecord.drivingByPlan') }}</el-button> -->
<!-- <el-button type="danger" :disabled="!isDisable" @click="end">退出计划</el-button> -->
<el-button v-if="!isScriptCommand" type="success" :disabled="isDisable || dataError" @click="selectBeginTime">{{ $t('scriptRecord.drivingByPlan') }}</el-button>
<el-button v-if="!isScriptCommand" type="danger" :disabled="!isDisable" @click="end">退出计划</el-button>
<el-button type="primary" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button>
</el-button-group>
</div>
<!-- <set-time ref="setTime" @ConfirmSelectBeginTime="start" /> -->
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
</div>
</template>
<!-- 单人仿真 -->
<script>
// import SetTime from './demon/setTime';
import SetTime from './demon/setTime';
import { Notification } from 'element-ui';
import { ranAsPlan, runDiagramOver } from '@/api/simulation';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
// import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus';
import { mapGetters } from 'vuex';
export default {
name: 'MenuTask',
components: {
// SetTime
SetTime
},
props: {
group: {
@ -53,6 +54,7 @@ export default {
time: null, //
countTime: 0, //
remainingTime: 0,
isScriptCommand:false,
goodsId: this.$route.query.goodsId,
// isSaveStage: true,
training: {
@ -65,11 +67,17 @@ export default {
computed: {
scriptId() {
return this.$route.query.scriptId;
}
},
...mapGetters('map', [
'trainList'
])
},
watch: {
'$store.state.training.subscribeCount': function () {
this.group && this.initLoadPage();
},
'$store.state.scriptRecord.bgSet':function (val) {
this.isScriptCommand = val;
}
},
beforeDestroy() {
@ -78,6 +86,9 @@ export default {
clearTimeout(this.time);
}
},
mounted() {
this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
},
methods: {
async initLoadPage() {
try {
@ -98,12 +109,20 @@ export default {
start(model) {
this.isDisable = true;
const data = {
time: model.initTime,
loadNumber:this.trainList.length
time: model.initTime
// loadNumber:this.trainList.length
};
// const data = {
// time: model.initTime
// };
// if (this.$route.query.prdType === '04') {
// data.loadNumber = model.loadNum;
// }
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('map/setRunPlanStatus', true);
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
this.$store.dispatch('map/setShowCentralizedStationNum');
});
}).catch((error) => {
this.isDisable = false;
@ -132,16 +151,17 @@ export default {
},
end() {
this.isDisable = false;
runDiagramOver(this.group).then(() => {
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/setRunPlanStatus', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.isDisable = true;
this.$messageBox('结束仿真失败,请返回');
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
},
setTryTime() {