剧本编制代码调整

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