rt-sim-training-client/src/views/planMonitor/editTool/index.vue

240 lines
8.1 KiB
Vue

<template>
<div class="plan-tool" style="width: 100%; height: 100%;">
<menu-bar
ref="menuBar"
@doClose="doClose"
@refresh="refresh"
@dispatchDialog="dispatchDialog"
@modifyRunPlanName="modifyRunPlanName"
/>
<!-- :load-run-plan-id="loadRunPlanId" -->
<!-- @loadingRunPlan="loadingRunPlan" -->
<!-- @checkIsLoadRunPlan="checkIsLoadRunPlan" -->
<div class="scheduleIn">
<schedule
ref="schedule"
v-loading="runplanLoading"
:plan-parser="PlanParser"
:load-run-plan-name="loadRunPlanName"
/>
<!-- :load-run-plan-id="loadRunPlanId" -->
<status-bar ref="statusBar" @dispatchDialog="dispatchDialog" @showTrain="showTrain" @refresh="refresh" />
<!-- :load-run-plan-id="loadRunPlanId" -->
</div>
<parameter ref="parameter" />
<!-- 删除计划 -->
<off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" />
<add-planning-train ref="addPlanningTrain" @dispatchDialog="dispatchDialog" />
<!-- :load-run-plan-id="loadRunPlanId" -->
<edit-planning-train
ref="editPlanningTrain"
@dispatchDialog="dispatchDialog"
@dispatchOperate="dispatchOperate"
@refresh="refresh"
/>
<!-- 复制计划 -->
<duplicate-train ref="duplicateTrain" @dispatchDialog="dispatchDialog" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<!-- 移动计划 -->
<move-planing-train ref="movePlaningTrain" :load-run-plan-id="loadRunPlanId" @dispatchDialog="dispatchDialog" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<!-- 检查运行图-->
<systerm-out ref="systermOut" />
<add-task ref="addTask" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<delete-task ref="deleteTask" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<modifying-task ref="modifyingTask" :load-run-plan-id="loadRunPlanId" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<modifying-station-interval-time ref="modifyingStationIntervalTime" />
<modifying-station-stop-time ref="modifyingStationStopTime" />
<edit-plan-name ref="editPlan" @renewal="refreshRunPlanName" />
</div>
</template>
<script>
import MenuBar from './menuBar';
import StatusBar from './statusBar';
import Schedule from '../components/schedule';
import Parameter from './menus/parameter/index';
import OffLine from '../components/menus/offLine';
import AddPlanningTrain from '../components/menus/addPlanningTrain';
import EditPlanningTrain from '../components/menus/editPlanningTrain';
import EditPlanName from '../components/menus/editPlanName';
import DuplicateTrain from '../components/menus/duplicateTrain';
import SystermOut from '../components/menus/systermOut';
import AddTask from '../components/menus/addTask';
import DeleteTask from '../components/menus/deleteTask';
import ModifyingTask from '../components/menus/modifyingTask';
import MovePlaningTrain from '../components/menus/movePlaningTrain';
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
import { deletePlanService } from '@/api/runplan';
import { loadMapDataById } from '@/utils/loaddata';
export default {
name: 'Menus',
components: {
MenuBar,
StatusBar,
Schedule,
Parameter,
OffLine,
AddPlanningTrain,
EditPlanningTrain,
DuplicateTrain,
SystermOut,
AddTask,
DeleteTask,
ModifyingTask,
// AddSmoothRunTime,
// EditSmoothRunTime,
ModifyingStationIntervalTime,
ModifyingStationStopTime,
EditPlanName,
MovePlaningTrain
},
data() {
return {
PlanParser: {},
runPlanList: [],
loadRunPlanId: '',
loadRunPlanName: '',
runplanLoading:false
};
},
computed: {
lineCode() {
return this.$route.query.lineCode || '02';
}
},
watch: {
'$store.state.map.mapDataLoadedCount': function (val) {
this.loadRunPlanId = this.$route.query.planId;
this.runplanLoading = false;
}
},
created() {
this.PlanParser = this.$theme.loadPlanParser(this.lineCode);
},
async mounted() {
this.loadRunPlanName = this.$route.query.planName;
if (this.$route.query.mapId) {
// this.refreshRunPlanList(true);
await this.loadMap();
}
},
beforeDestroy() {
},
methods: {
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (dialogObj.name == 'generateRouting') {
this.$refs['menuBar'].handleGernarateRouting();
} else {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
}
});
},
dispatchOperate(operateObj) {
this.$nextTick(() => {
if (this.$refs[operateObj.dialogName]) {
this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
}
});
},
async loadMap() {
this.runplanLoading = true;
// 加载地图数据
loadMapDataById(this.$route.query.mapId, 'parse');
},
handleConfirm(params) {
if (params.operate == 'AddPlanningTrain') {
// 添加计划
this.$refs.addPlanningTrain.handleConfirm();
} else if (params.operate == 'DeletePlanningTrain') {
// 删除计划
const model = {
planId: this.$route.query.planId,
serviceNumber: params.serviceNumber
};
deletePlanService(model).then(resp => {
this.$message.success(this.$t('tip.deletePlanSuccessfully'));
this.$store.dispatch('runPlan/setSelected', {});
this.$store.dispatch('runPlan/refresh');
// this.$refs.openRunPlan.loadRunPlanData(Object.assign({refresh: true}, this.$route.query));
}).catch(() => {
this.$messageBox(this.$t('tip.deletePlanFailed'));
});
}
},
showTrain() {
if (this.$refs.schedule) {
this.$refs.schedule.displayTrain();
}
},
refresh() {
this.$store.dispatch('runPlan/refresh');
},
// refreshRunPlanList(firstLoad) {
// },
doClose() {
this.$emit('doClose');
},
// loadingRunPlan(param) {
// // this.loadRunPlanId = param.planId;
// this.loadRunPlanName = param.planName;
// },
checkIsLoadRunPlan(planId) {
// this.refreshRunPlanList(planId === this.loadRunPlanId);
},
modifyRunPlanName() {
if (this.loadRunPlanId && this.loadRunPlanName) {
this.$refs.editPlan.doShow({id: this.loadRunPlanId, name: this.loadRunPlanName});
} else {
this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan'));
}
},
refreshRunPlanName(name) {
this.$refs.schedule.refreshRunPlanName(name);
this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, planName: name }});
}
}
};
</script>
<style lang="scss">
.plan-tool {
position: absolute;
overflow: hidden;
&::before {
// content: '';
// position: absolute;
// width: 100%;
// height: 100%;
// left: 0;
// top: 0;
// background-image: url(https://www.cnblogs.com/skins/imetro/images/background.jpg);
// filter: blur(30px);
}
}
.scheduleIn{
width:100%;
height: 100%;
padding-top: 45px;
}
.plan-tool .pop-menu {
background: #F0F0F0;
}
.plan-tool .pop-menu span {
color: #000;
}
.planEdit__tool {
overflow: hidden !important;
}
</style>