2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-13 15:54:26 +08:00
|
|
|
<div class="PlanStatusBar">
|
|
|
|
<ul class="ul-box">
|
2020-12-09 17:03:22 +08:00
|
|
|
<!-- v-if="isNotUser" -->
|
|
|
|
<div class="li_plan" @click="showTrain">{{ $t('planMonitor.serviceAndTripNumber') }}</div>
|
|
|
|
<div class="li_plan" @click="handleGernaratePlanningTrain">{{ $t('planMonitor.gerneratePlan') }}</div>
|
|
|
|
<div class="li_plan" @click="handleAddPlanningTrain">{{ $t('planMonitor.addPlan') }}</div>
|
|
|
|
<div class="li_plan" @click="handleDeletePlanningTrain">{{ $t('planMonitor.deletePlan') }}</div>
|
2020-12-29 18:37:33 +08:00
|
|
|
<div class="li_plan" @click="handleMovePlanningTrain">移动计划</div>
|
2020-12-09 17:03:22 +08:00
|
|
|
<div class="li_plan" @click="handleDuplicateTrain">{{ $t('planMonitor.duplicatePlan') }}</div>
|
|
|
|
<div class="li_plan" @click="handleAddTask">{{ $t('planMonitor.addTask') }}</div>
|
|
|
|
<div class="li_plan" @click="handleDeleteTask">{{ $t('planMonitor.deleteTask') }}</div>
|
|
|
|
<div class="li_plan" @click="handleModifyingTask">{{ $t('planMonitor.modifyTask') }}</div>
|
2020-12-22 17:27:04 +08:00
|
|
|
<div class="li_plan" @click="handleClearData">清除数据</div>
|
2019-08-13 15:54:26 +08:00
|
|
|
</ul>
|
|
|
|
<ul class="ul-box tool">
|
2019-11-14 15:54:58 +08:00
|
|
|
<div class="li_plan" @click="handlePlanEffectiveCheck">{{ $t('planMonitor.validityCheck') }}</div>
|
2019-10-25 16:45:17 +08:00
|
|
|
<div class="li_plan" @click="handleTestRunPlan">{{ $t('planMonitor.testRunning') }}</div>
|
2019-08-13 15:54:26 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-12-22 17:27:04 +08:00
|
|
|
import { planEffectiveCheck, runPlanNotify, clearPlaningData } from '@/api/runplan';
|
2019-08-13 15:54:26 +08:00
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
2020-03-30 13:07:11 +08:00
|
|
|
import { UrlConfig } from '@/scripts/ConstDic';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
export default {
|
2019-11-08 15:17:04 +08:00
|
|
|
name: 'PlanStatusBar',
|
2020-08-14 18:30:04 +08:00
|
|
|
props: {
|
|
|
|
loadRunPlanId: {
|
|
|
|
type: String,
|
|
|
|
default() {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-11-08 15:17:04 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2020-12-09 17:03:22 +08:00
|
|
|
// isNotUser: true
|
2019-11-08 15:17:04 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
2019-08-13 15:54:26 +08:00
|
|
|
|
2019-11-08 15:17:04 +08:00
|
|
|
},
|
|
|
|
created() {
|
2020-12-09 17:03:22 +08:00
|
|
|
// if (/^\/plan\/usertool/.test(this.$route.fullPath)) {
|
|
|
|
// this.isNotUser = false;
|
|
|
|
// } else {
|
|
|
|
// this.isNotUser = true;
|
|
|
|
// }
|
2019-11-08 15:17:04 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
showTrain() {
|
|
|
|
this.$emit('showTrain');
|
|
|
|
},
|
|
|
|
// 添加计划
|
|
|
|
handleAddPlanningTrain() {
|
2020-08-14 18:30:04 +08:00
|
|
|
const planId = this.$route.query.planId || this.loadRunPlanId;
|
2019-11-08 15:17:04 +08:00
|
|
|
if (planId) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'addPlanningTrain', params: {} });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectARunGraphFirst'));
|
2020-12-09 17:03:22 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
handleGernaratePlanningTrain() {
|
|
|
|
const planId = this.$route.query.planId || this.loadRunPlanId;
|
|
|
|
if (planId) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'gernaratePlanTrain', params: {} });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectARunGraphFirst'));
|
2019-11-08 15:17:04 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
// 删除计划
|
|
|
|
handleDeletePlanningTrain() {
|
|
|
|
const serviceNumber = this.$store.state.runPlan.selected.serviceNumber;
|
|
|
|
if (serviceNumber) {
|
|
|
|
this.$emit('dispatchDialog', {
|
|
|
|
name: 'offLine', params: {
|
|
|
|
type: 'warning',
|
|
|
|
width: 260,
|
|
|
|
message: this.$t('tip.deleteTrainHint') + serviceNumber + '?',
|
|
|
|
operate: 'DeletePlanningTrain',
|
|
|
|
serviceNumber: serviceNumber,
|
|
|
|
refresh: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectAPlan'));
|
|
|
|
}
|
|
|
|
},
|
2020-12-22 17:27:04 +08:00
|
|
|
handleMovePlanningTrain() {
|
|
|
|
const serviceNumber = this.$store.state.runPlan.selected.serviceNumber;
|
|
|
|
if (serviceNumber) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'movePlaningTrain', params: { serviceNumber } });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectAPlan'));
|
|
|
|
}
|
|
|
|
},
|
2019-11-08 15:17:04 +08:00
|
|
|
// 复制计划
|
|
|
|
handleDuplicateTrain() {
|
|
|
|
const serviceNumber = this.$store.state.runPlan.selected.serviceNumber;
|
|
|
|
if (serviceNumber) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'duplicateTrain', params: { serviceNumber } });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectAPlan'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 添加任务
|
|
|
|
handleAddTask() {
|
|
|
|
const params = this.$store.state.runPlan.selected;
|
|
|
|
if (params.serviceNumber && params.tripNumber) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'addTask', params });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectATrain'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 删除任务
|
|
|
|
handleDeleteTask() {
|
|
|
|
const params = this.$store.state.runPlan.selected;
|
|
|
|
if (params.serviceNumber && params.tripNumber) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectATrain'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 修改任务
|
|
|
|
handleModifyingTask() {
|
|
|
|
const params = this.$store.state.runPlan.selected;
|
|
|
|
if (params.serviceNumber && params.tripNumber) {
|
|
|
|
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectATrain'));
|
|
|
|
}
|
|
|
|
},
|
2020-12-22 17:27:04 +08:00
|
|
|
// 清除数据
|
|
|
|
handleClearData() {
|
|
|
|
this.$confirm('本操作将清除本运行图数据!', '提示', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
center: true
|
|
|
|
}).then(() => {
|
|
|
|
clearPlaningData(this.$route.query.planId).then(resp => {
|
|
|
|
console.log('清除数据成功!');
|
|
|
|
this.$emit('refresh');
|
|
|
|
}).catch(() => {
|
|
|
|
this.$message.error('清除数据失败!');
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
console.error('清除数据失败!');
|
|
|
|
});
|
|
|
|
},
|
2019-11-08 15:17:04 +08:00
|
|
|
// 校验运行图
|
|
|
|
handlePlanEffectiveCheck() {
|
|
|
|
const planId = this.$route.query.planId;
|
|
|
|
if (planId) {
|
2019-11-18 15:42:05 +08:00
|
|
|
if (/^\/plan\/usertool/.test(this.$route.fullPath)) {
|
|
|
|
this.$messageBox(' 功能待完善');
|
|
|
|
} else {
|
|
|
|
planEffectiveCheck(planId).then(resp => {
|
|
|
|
this.$emit('dispatchDialog', {
|
|
|
|
name: 'systermOut',
|
|
|
|
params: {
|
|
|
|
width: 600,
|
|
|
|
contextList: resp.data.length > 0 ? resp.data : ['检查成功']
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(error.message + ' ' + this.$t('tip.runGraphVerificationFailed'));
|
2019-11-08 15:17:04 +08:00
|
|
|
});
|
2019-11-18 15:42:05 +08:00
|
|
|
}
|
|
|
|
|
2019-11-08 15:17:04 +08:00
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('tip.selectARunGraphFirst'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 测试运行图
|
|
|
|
async handleTestRunPlan() {
|
|
|
|
const data = { planId: this.$route.query.planId };
|
2019-11-18 15:42:05 +08:00
|
|
|
if (/^\/plan\/usertool/.test(this.$route.fullPath)) {
|
|
|
|
this.$messageBox(' 功能待完善');
|
|
|
|
} else {
|
|
|
|
runPlanNotify(data).then(resp => {
|
|
|
|
if (resp.data) {
|
|
|
|
const query = {
|
|
|
|
prdType: '01', group: resp.data, mapId: this.$route.query.mapId, planId: this.$route.query.planId
|
|
|
|
};
|
2020-11-12 19:04:57 +08:00
|
|
|
// this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
|
2020-11-13 14:14:18 +08:00
|
|
|
this.$router.push({ path: UrlConfig.design.testRunPlan, query: query });
|
2019-11-18 15:42:05 +08:00
|
|
|
launchFullscreen();
|
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('error.checkTheValidityFirst'));
|
|
|
|
}
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(this.$t('tip.createSimulationFaild') + this.$t('global.colon') + error.message);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-11-08 15:17:04 +08:00
|
|
|
}
|
|
|
|
}
|
2019-08-09 16:57:07 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
<style scoped rel="stylesheet/scss" lang="scss">
|
2019-07-26 13:32:43 +08:00
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
2019-08-13 15:54:26 +08:00
|
|
|
.PlanStatusBar {
|
2019-07-26 13:32:43 +08:00
|
|
|
z-index: 5;
|
|
|
|
position: absolute;
|
2019-08-13 15:54:26 +08:00
|
|
|
width: 50px;
|
|
|
|
height: calc(100% - 45px);
|
|
|
|
top: 45px;
|
|
|
|
right: 0px;
|
|
|
|
background: #293c55;
|
|
|
|
padding-top: 10px;
|
|
|
|
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
2019-08-13 15:54:26 +08:00
|
|
|
.ul-box{
|
|
|
|
width: 100%;
|
|
|
|
padding: 0;
|
|
|
|
.li_plan{
|
|
|
|
width: 100%;
|
|
|
|
height: 50px;
|
|
|
|
font-size: 14px;
|
|
|
|
color: rgba(255, 255, 255, 0.45);
|
|
|
|
text-align: center;
|
|
|
|
padding: 5px;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-bottom: 4px;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover{
|
|
|
|
background: #0e151f;
|
|
|
|
color: #fff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.tool{
|
|
|
|
position: absolute;
|
|
|
|
bottom: 50px;
|
|
|
|
}
|
2019-08-09 16:57:07 +08:00
|
|
|
</style>
|