2019-12-30 09:00:16 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="display-card" :style="{top: offset+'px'}">
|
|
|
|
|
<el-row>
|
|
|
|
|
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
|
|
|
|
|
</el-row>
|
|
|
|
|
</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 v-if="isShowScheduling" type="primary" @click="jumpScheduling">{{ $t('display.demon.dispatchingPlan') }}</el-button>
|
2020-04-20 15:38:30 +08:00
|
|
|
|
<el-button v-if="!isShowScheduling" type="jl3dpassflow" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
|
2020-04-24 18:00:12 +08:00
|
|
|
|
<el-button v-if="!isShowScheduling" type="jl3dstation" @click="jumpjl3dstation">{{ jl3dstation }}</el-button>
|
2020-04-20 15:38:30 +08:00
|
|
|
|
<el-button v-if="!isShowScheduling" type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
|
|
|
|
<el-button v-if="isShow3dmodel && !isShowScheduling" type="jumpjlmap3dmodel" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
|
2019-12-30 09:00:16 +08:00
|
|
|
|
<template v-if="isShowQuest">
|
|
|
|
|
<!-- && !isDesignPlatform -->
|
|
|
|
|
<el-button v-if="!isDesignPlatform " type="danger" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
|
|
|
|
|
<el-button type="danger" :disabled="!isDisable" @click="end">{{ $t('display.demon.exitPlan') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<el-button type="primary" @click="back">{{ $t('display.demon.back') }}</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 单人仿真 -->
|
|
|
|
|
<script>
|
|
|
|
|
import SetTime from './demon/setTime';
|
|
|
|
|
import { Notification } from 'element-ui';
|
|
|
|
|
import { getGoodsTryUse } from '@/api/management/goods';
|
2020-02-24 17:04:39 +08:00
|
|
|
|
import { ranAsPlan, exitRunPlan, clearSimulation } from '@/api/simulation';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
import { PermissionType } from '@/scripts/ConstDic';
|
|
|
|
|
import { getCountTime } from '@/utils/index';
|
2020-02-24 17:04:39 +08:00
|
|
|
|
import { quitScript } from '@/api/simulation';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'MenuDemon',
|
|
|
|
|
components: {
|
|
|
|
|
SetTime
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
group: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
offset: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
2020-03-30 16:15:35 +08:00
|
|
|
|
offsetBottom: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
|
questId: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2020-04-09 17:37:27 +08:00
|
|
|
|
},
|
|
|
|
|
showStation: {
|
|
|
|
|
type: String,
|
|
|
|
|
default() {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isDisable: false,
|
|
|
|
|
tryTime: 0, // 进入页面多少秒
|
|
|
|
|
timeNow: 0, // 进入页面 相对时间
|
|
|
|
|
time: null, // 定时器
|
|
|
|
|
countTime: 0, // 显示 倒计时
|
|
|
|
|
remainingTime: 0,
|
|
|
|
|
goodsId: this.$route.query.goodsId,
|
|
|
|
|
try: this.$route.query.try, // 是否是试用权限
|
|
|
|
|
training: {
|
|
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
remarks: ''
|
|
|
|
|
},
|
2020-02-14 18:22:11 +08:00
|
|
|
|
jl3dpassflow:this.$t('display.demon.passengerflow'),
|
2019-12-30 09:00:16 +08:00
|
|
|
|
jl3dname: this.$t('display.demon.threeDimensionalView'),
|
2020-04-24 18:00:12 +08:00
|
|
|
|
jl3dstation: this.$t('display.demon.threeDimensionalStation'),
|
2019-12-30 09:00:16 +08:00
|
|
|
|
jl3dmodel: this.$t('display.demon.deviceView'),
|
2019-12-30 18:45:05 +08:00
|
|
|
|
isShow3dmodel :false
|
2019-12-30 09:00:16 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
isShowQuest() {
|
|
|
|
|
return this.questId;
|
|
|
|
|
},
|
|
|
|
|
isShowScheduling() {
|
|
|
|
|
return this.$route.query.prdType == '05';
|
|
|
|
|
},
|
|
|
|
|
isDesignPlatform() {
|
|
|
|
|
return this.$route.fullPath.includes('design/display/demon');
|
2020-04-22 17:24:45 +08:00
|
|
|
|
},
|
|
|
|
|
isHebLine() {
|
|
|
|
|
return this.$route.query.lineCode === '07';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
'$store.state.training.subscribeCount': function () {
|
|
|
|
|
this.group && this.initLoadPage();
|
|
|
|
|
},
|
|
|
|
|
'$store.state.socket.tipOperateCount': function (val) {
|
|
|
|
|
this.$alert(this.$t('display.demon.taskOperateSuccess'), this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
callback: action => {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (this.time) {
|
|
|
|
|
this.setTryTime();
|
|
|
|
|
clearTimeout(this.time);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async initLoadPage() {
|
|
|
|
|
try {
|
|
|
|
|
if (this.try != '0') {
|
|
|
|
|
this.loadInitData();
|
|
|
|
|
}
|
|
|
|
|
this.change3dname();
|
|
|
|
|
} 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
|
|
|
|
loadInitData() {
|
|
|
|
|
const data = {
|
|
|
|
|
mapId: this.$route.query.mapId,
|
2019-12-30 18:45:05 +08:00
|
|
|
|
prdType: this.$route.query.prdType,
|
2019-12-30 09:00:16 +08:00
|
|
|
|
permissionType: PermissionType.SIMULATION
|
|
|
|
|
};
|
|
|
|
|
getGoodsTryUse(data).then(res => {
|
|
|
|
|
this.remainingTime = res.data.tryTime;
|
|
|
|
|
this.timeNow = Date.parse(new Date()) / 1000 + this.remainingTime;
|
|
|
|
|
if (this.try) {
|
|
|
|
|
this.time = setInterval(() => {
|
|
|
|
|
this.tryTime += 1;
|
|
|
|
|
this.countTime = getCountTime(this.timeNow);
|
|
|
|
|
if (this.countTime == -1) {
|
|
|
|
|
this.back();
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$messageBox(this.$t('display.demon.getTimeFail'));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectBeginTime() {
|
|
|
|
|
this.$refs.setTime.doShow();
|
|
|
|
|
},
|
|
|
|
|
start(model) {
|
|
|
|
|
this.isDisable = true;
|
2020-01-17 11:31:53 +08:00
|
|
|
|
const data = {
|
2020-02-24 17:04:39 +08:00
|
|
|
|
time: model.initTime
|
2020-01-17 11:31:53 +08:00
|
|
|
|
};
|
2020-02-24 17:04:39 +08:00
|
|
|
|
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-04-01 12:53:58 +08:00
|
|
|
|
this.$store.dispatch('map/setRunPlanStatus', true);
|
2019-12-30 09:00:16 +08:00
|
|
|
|
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
|
2020-04-09 17:37:27 +08:00
|
|
|
|
this.$store.dispatch('map/setShowCentralizedStationNum');
|
2019-12-30 09:00:16 +08:00
|
|
|
|
});
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
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-02-24 17:04:39 +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-04-01 12:53:58 +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;
|
|
|
|
|
this.$messageBox(this.$t('display.demon.endSimulationFail'));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleQuitQuest() {
|
|
|
|
|
quitScript(this.group).then(resp => {
|
|
|
|
|
this.$emit('quitQuest');
|
|
|
|
|
this.initLoadPage();
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$messageBox(this.$t('display.demon.exitTaskFail'));
|
|
|
|
|
});
|
|
|
|
|
},
|
2020-01-03 15:50:26 +08:00
|
|
|
|
async back() {
|
2020-01-17 11:31:53 +08:00
|
|
|
|
await clearSimulation(this.group);
|
2019-12-30 09:00:16 +08:00
|
|
|
|
this.$store.dispatch('training/over').then(() => {
|
|
|
|
|
history.go(-1);
|
|
|
|
|
Notification.closeAll();
|
|
|
|
|
});
|
|
|
|
|
},
|
2020-04-01 12:53:58 +08:00
|
|
|
|
jumpjl3dpassflow() {
|
2020-02-14 18:22:11 +08:00
|
|
|
|
this.$emit('passflow');
|
|
|
|
|
},
|
2020-04-24 18:00:12 +08:00
|
|
|
|
jumpjl3dstation() {
|
|
|
|
|
this.$emit('jl3dstation');
|
|
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
|
jumpjlmap3d() {
|
|
|
|
|
this.$emit('hidepanel');
|
|
|
|
|
},
|
|
|
|
|
jumpjlmap3dmodel() {
|
|
|
|
|
this.$emit('devicemodel');
|
|
|
|
|
},
|
|
|
|
|
jumpScheduling() {
|
|
|
|
|
this.$emit('showScheduling');
|
|
|
|
|
},
|
|
|
|
|
setTryTime() {
|
|
|
|
|
if (this.try) {
|
|
|
|
|
this.$emit('tryTime', { time: this.tryTime, goodsId: this.goodsId });
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
change3dname() {
|
|
|
|
|
if (this.$route.query.prdType == '04') {
|
|
|
|
|
this.jl3dname = this.$t('display.demon.driverPerspective');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.jl3dname = this.$t('display.demon.threeDimensionalView');
|
|
|
|
|
this.isShow3dmodel = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</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: 20px;
|
|
|
|
|
bottom: 15px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|