2019-12-30 09:00:16 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
2020-03-30 16:15:35 +08:00
|
|
|
|
<div class="display-draft" :style="{bottom: offsetBottom + 'px'}">
|
2019-12-30 09:00:16 +08:00
|
|
|
|
<!-- <el-button-group>
|
|
|
|
|
<el-button type="primary" @click="saveScenesStage" v-if="isSaveStage">保存背景</el-button>
|
|
|
|
|
<el-button type="success" @click="saveScenesData" v-else>保存数据</el-button>
|
|
|
|
|
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
|
|
|
|
|
</el-button-group> -->
|
|
|
|
|
<el-button-group>
|
2020-05-20 15:29:41 +08:00
|
|
|
|
<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>
|
2019-12-30 09:00:16 +08:00
|
|
|
|
<el-button type="primary" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</div>
|
2020-06-11 18:32:26 +08:00
|
|
|
|
<chat-box ref="chatbox" :group="group" :user-role="userRole" />
|
2020-05-20 15:29:41 +08:00
|
|
|
|
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
2020-06-11 18:32:26 +08:00
|
|
|
|
<tip-script-record-new ref="tipTaskRecordNew" :group="group" :offset-bottom="offsetBottom" />
|
2019-12-30 09:00:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 单人仿真 -->
|
|
|
|
|
<script>
|
2020-06-11 18:32:26 +08:00
|
|
|
|
import ChatBox from './chatView/chatBox';
|
|
|
|
|
import TipScriptRecordNew from '@/views/scriptManage/display/tipScriptRecordNew';
|
2020-05-20 15:29:41 +08:00
|
|
|
|
import SetTime from './demon/setTime';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
import { Notification } from 'element-ui';
|
2020-05-20 15:29:41 +08:00
|
|
|
|
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
|
2020-03-13 18:19:04 +08:00
|
|
|
|
// import { timeFormat } from '@/utils/date';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
import { EventBus } from '@/scripts/event-bus';
|
2020-05-20 15:29:41 +08:00
|
|
|
|
import { mapGetters } from 'vuex';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'MenuTask',
|
|
|
|
|
components: {
|
2020-06-11 18:32:26 +08:00
|
|
|
|
SetTime,
|
|
|
|
|
ChatBox,
|
|
|
|
|
TipScriptRecordNew
|
2019-12-30 09:00:16 +08:00
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
group: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
2020-03-30 16:15:35 +08:00
|
|
|
|
offsetBottom: {
|
2019-12-30 09:00:16 +08:00
|
|
|
|
type: Number,
|
|
|
|
|
required: true
|
2020-05-09 20:24:59 +08:00
|
|
|
|
},
|
|
|
|
|
dataError: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isDisable: false,
|
|
|
|
|
tryTime: 0, // 进入页面多少秒
|
|
|
|
|
timeNow: 0, // 进入页面 相对时间
|
|
|
|
|
time: null, // 定时器
|
|
|
|
|
countTime: 0, // 显示 倒计时
|
|
|
|
|
remainingTime: 0,
|
2020-05-20 15:29:41 +08:00
|
|
|
|
isScriptCommand:false,
|
2019-12-30 09:00:16 +08:00
|
|
|
|
goodsId: this.$route.query.goodsId,
|
|
|
|
|
// isSaveStage: true,
|
|
|
|
|
training: {
|
|
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
remarks: ''
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
scriptId() {
|
|
|
|
|
return this.$route.query.scriptId;
|
2020-05-20 15:29:41 +08:00
|
|
|
|
},
|
|
|
|
|
...mapGetters('map', [
|
|
|
|
|
'trainList'
|
2020-06-11 18:32:26 +08:00
|
|
|
|
]),
|
|
|
|
|
userRole() {
|
|
|
|
|
if (this.$store.state.training.prdType == '02') {
|
|
|
|
|
return 'DISPATCHER';
|
|
|
|
|
} else if (this.$store.state.training.prdType == '01') {
|
|
|
|
|
return 'STATION_SUPERVISOR';
|
|
|
|
|
} else if (this.$store.state.training.prdType == '04') {
|
|
|
|
|
return 'DRIVER';
|
|
|
|
|
} else {
|
|
|
|
|
return 'AUDIENCE';
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
'$store.state.training.subscribeCount': function () {
|
|
|
|
|
this.group && this.initLoadPage();
|
2020-05-20 15:29:41 +08:00
|
|
|
|
},
|
|
|
|
|
'$store.state.scriptRecord.bgSet':function (val) {
|
|
|
|
|
this.isScriptCommand = val;
|
2019-12-30 09:00:16 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (this.time) {
|
|
|
|
|
this.setTryTime();
|
|
|
|
|
clearTimeout(this.time);
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-05-20 15:29:41 +08:00
|
|
|
|
mounted() {
|
2020-06-12 18:29:14 +08:00
|
|
|
|
// this.$store.state.training.prdType
|
2020-05-20 15:29:41 +08:00
|
|
|
|
this.isScriptCommand = this.$store.state.scriptRecord.bgSet;
|
2020-06-12 18:29:14 +08:00
|
|
|
|
this.$store.dispatch('training/setPrdType', '01');
|
2020-05-20 15:29:41 +08:00
|
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
|
methods: {
|
|
|
|
|
async initLoadPage() {
|
|
|
|
|
try {
|
|
|
|
|
await this.loadSystemTime();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-03-09 14:23:44 +08:00
|
|
|
|
initPlannedDriving(isDisable) {
|
|
|
|
|
this.isDisable = isDisable;
|
|
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
|
selectBeginTime() {
|
|
|
|
|
this.$refs.setTime.doShow();
|
|
|
|
|
},
|
|
|
|
|
resetBeginTime() {
|
|
|
|
|
this.isDisable = false;
|
|
|
|
|
},
|
|
|
|
|
start(model) {
|
|
|
|
|
this.isDisable = true;
|
2020-01-17 11:31:53 +08:00
|
|
|
|
const data = {
|
2020-05-20 15:29:41 +08:00
|
|
|
|
time: model.initTime
|
|
|
|
|
// loadNumber:this.trainList.length
|
2020-01-17 11:31:53 +08:00
|
|
|
|
};
|
2020-05-20 15:29:41 +08:00
|
|
|
|
// const data = {
|
|
|
|
|
// time: model.initTime
|
|
|
|
|
// };
|
|
|
|
|
// if (this.$route.query.prdType === '04') {
|
|
|
|
|
// data.loadNumber = model.loadNum;
|
|
|
|
|
// }
|
2020-01-17 11:31:53 +08:00
|
|
|
|
ranAsPlan(data, this.group).then(res => {
|
2019-12-30 09:00:16 +08:00
|
|
|
|
this.$store.dispatch('training/simulationStart').then(() => {
|
2020-05-20 15:29:41 +08:00
|
|
|
|
this.$store.dispatch('map/setRunPlanStatus', true);
|
2020-05-25 10:32:14 +08:00
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
|
2020-05-20 15:29:41 +08:00
|
|
|
|
this.$store.dispatch('map/setShowCentralizedStationNum');
|
2019-12-30 09:00:16 +08:00
|
|
|
|
});
|
2020-01-17 11:31:53 +08:00
|
|
|
|
}).catch((error) => {
|
2019-12-30 09:00:16 +08:00
|
|
|
|
this.isDisable = false;
|
2020-01-17 13:17:12 +08:00
|
|
|
|
if (error.code == '5001') {
|
|
|
|
|
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '5002') {
|
|
|
|
|
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '5003') {
|
|
|
|
|
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
|
2020-02-28 11:25:36 +08:00
|
|
|
|
} else if (error.code == '5004') {
|
|
|
|
|
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '5000') {
|
|
|
|
|
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4000') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4001') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4002') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4003') {
|
|
|
|
|
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
|
|
|
|
|
} else if (error.code == '4004') {
|
|
|
|
|
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
|
2020-01-17 13:17:12 +08:00
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
end() {
|
|
|
|
|
this.isDisable = false;
|
2020-05-20 15:29:41 +08:00
|
|
|
|
exitRunPlan(this.group).then(() => {
|
2019-12-30 09:00:16 +08:00
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
|
this.$store.dispatch('training/setMapDefaultState').then(() => {
|
2020-05-20 15:29:41 +08:00
|
|
|
|
this.$store.dispatch('map/setRunPlanStatus', false);
|
2019-12-30 09:00:16 +08:00
|
|
|
|
this.$store.dispatch('map/clearJlmapTrainView');
|
|
|
|
|
this.$store.dispatch('map/setTrainWindowShow', false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.isDisable = true;
|
2020-05-20 15:29:41 +08:00
|
|
|
|
this.$messageBox(this.$t('display.demon.endSimulationFail'));
|
2019-12-30 09:00:16 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
setTryTime() {
|
|
|
|
|
if (this.try) {
|
|
|
|
|
this.$emit('tryTime', { time: this.tryTime, goodsId: this.goodsId });
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
back() {
|
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
|
EventBus.$emit('runPlanStop');
|
|
|
|
|
EventBus.$emit('chatSubscribeStop');
|
|
|
|
|
history.go(-1);
|
|
|
|
|
Notification.closeAll();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
async loadSystemTime() {
|
2020-03-17 14:54:03 +08:00
|
|
|
|
|
2019-12-30 09:00:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
|
|
.display-card {
|
|
|
|
|
z-index: 9;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
</style>
|