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

262 lines
9.2 KiB
Vue
Raw Normal View History

2020-08-14 18:30:04 +08:00
<template>
2021-05-10 13:50:17 +08:00
<div class="plan-tool" style="width: 100%; height: 100%;padding-top: 45px;">
2020-08-14 18:30:04 +08:00
<menu-bar
ref="menuBar"
:load-run-plan-id="loadRunPlanId"
2021-05-10 13:50:17 +08:00
:load-run-plan-name="loadRunPlanName"
:run-plan-list="runPlanList"
2020-08-14 18:30:04 +08:00
@doClose="doClose"
@dispatchDialog="dispatchDialog"
@loadingRunPlan="loadingRunPlan"
@modifyRunPlanName="modifyRunPlanName"
2021-05-10 13:50:17 +08:00
@refresh="refreshRunPlanList"
@refreshData="refresh"
2020-08-14 18:30:04 +08:00
/>
2021-05-10 13:50:17 +08:00
<!-- :plan-parser="PlanParser" -->
2021-04-14 16:43:09 +08:00
<div class="scheduleIn">
<schedule
ref="schedule"
v-loading="runplanLoading"
:plan-parser="PlanParser"
:load-run-plan-id="loadRunPlanId"
:load-run-plan-name="loadRunPlanName"
/>
<status-bar ref="statusBar" :load-run-plan-id="loadRunPlanId" @dispatchDialog="dispatchDialog" @showTrain="showTrain" @refresh="refresh" />
</div>
2020-08-14 18:30:04 +08:00
<parameter ref="parameter" />
<off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" />
<add-planning-train ref="addPlanningTrain" :load-run-plan-id="loadRunPlanId" @dispatchDialog="dispatchDialog" />
<edit-planning-train
ref="editPlanningTrain"
2021-05-10 15:08:58 +08:00
:load-run-plan-id="loadRunPlanId"
2020-08-14 18:30:04 +08:00
@dispatchDialog="dispatchDialog"
@dispatchOperate="dispatchOperate"
@refresh="refresh"
/>
<duplicate-train ref="duplicateTrain" :load-run-plan-id="loadRunPlanId" @dispatchDialog="dispatchDialog" @dispatchOperate="dispatchOperate" @refresh="refresh" />
2020-12-22 17:27:04 +08:00
<move-planing-train ref="movePlaningTrain" :load-run-plan-id="loadRunPlanId" @dispatchDialog="dispatchDialog" @dispatchOperate="dispatchOperate" @refresh="refresh" />
2020-08-14 18:30:04 +08:00
<systerm-out ref="systermOut" />
<add-task ref="addTask" :load-run-plan-id="loadRunPlanId" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<delete-task ref="deleteTask" :load-run-plan-id="loadRunPlanId" @dispatchOperate="dispatchOperate" @refresh="refresh" />
2020-08-14 18:30:04 +08:00
<modifying-task ref="modifyingTask" :load-run-plan-id="loadRunPlanId" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<modifying-station-interval-time ref="modifyingStationIntervalTime" />
2021-03-05 16:44:32 +08:00
<modifying-station-stop-time ref="modifyingStationStopTime" />
2020-08-14 18:30:04 +08:00
<edit-plan-name ref="editPlan" @renewal="refreshRunPlanName" />
2021-05-10 13:50:17 +08:00
<create-empty-plan ref="createEmptyPlan" @refresh="refreshRunPlanList" />
2020-08-14 18:30:04 +08:00
</div>
</template>
<script>
import MenuBar from './menuBar';
import StatusBar from './statusBar';
2021-04-14 16:43:09 +08:00
import Schedule from '../components/schedule';
2020-08-14 18:30:04 +08:00
import Parameter from './menus/parameter/index';
2021-03-09 15:41:05 +08:00
import OffLine from '../components/menus/offLine';
import AddPlanningTrain from '../components/menus/addPlanningTrain';
2021-03-09 17:11:58 +08:00
import EditPlanningTrain from '../components/menus/editPlanningTrain';
import EditPlanName from '../components/menus/editPlanName';
import DuplicateTrain from '../components/menus/duplicateTrain';
import SystermOut from '../components/menus/systermOut';
2021-03-09 17:11:58 +08:00
import AddTask from '../components/menus/addTask';
2021-03-09 14:55:03 +08:00
import DeleteTask from '../components/menus/deleteTask';
2021-03-09 17:11:58 +08:00
import ModifyingTask from '../components/menus/modifyingTask';
2021-03-09 15:57:59 +08:00
import MovePlaningTrain from '../components/menus/movePlaningTrain';
2021-03-09 14:45:50 +08:00
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
2021-05-10 13:50:17 +08:00
import CreateEmptyPlan from './menus/createEmptyPlan';
2020-08-14 18:30:04 +08:00
import { deletePlanService } from '@/api/runplan';
import { loadMapDataById } from '@/utils/loaddata';
2021-05-10 13:50:17 +08:00
import { getRpListByMapId } from '@/api/runplan';
2020-08-14 18:30:04 +08:00
export default {
name: 'Menus',
components: {
MenuBar,
StatusBar,
Schedule,
Parameter,
OffLine,
AddPlanningTrain,
EditPlanningTrain,
DuplicateTrain,
SystermOut,
AddTask,
DeleteTask,
ModifyingTask,
2021-03-05 16:44:32 +08:00
// AddSmoothRunTime,
// EditSmoothRunTime,
2020-08-14 18:30:04 +08:00
ModifyingStationIntervalTime,
2021-03-05 16:44:32 +08:00
ModifyingStationStopTime,
2020-12-11 20:17:18 +08:00
EditPlanName,
2021-05-10 13:50:17 +08:00
MovePlaningTrain,
CreateEmptyPlan
2020-08-14 18:30:04 +08:00
},
data() {
return {
2021-03-17 13:35:15 +08:00
PlanParser: {},
2020-08-14 18:30:04 +08:00
runPlanList: [],
loadRunPlanId: '',
2021-03-05 16:44:32 +08:00
loadRunPlanName: '',
runplanLoading:false
2020-08-14 18:30:04 +08:00
};
},
computed: {
lineCode() {
2021-03-05 16:44:32 +08:00
return this.$route.query.lineCode || '02';
}
},
watch: {
'$store.state.map.mapDataLoadedCount': function (val) {
this.runplanLoading = false;
2020-08-14 18:30:04 +08:00
}
},
created() {
2021-03-17 13:35:15 +08:00
this.PlanParser = this.$theme.loadPlanParser(this.lineCode);
2020-08-14 18:30:04 +08:00
},
2020-12-11 20:17:18 +08:00
async mounted() {
2021-05-10 13:50:17 +08:00
// this.loadRunPlanName = this.$route.query.planName;
2020-08-14 18:30:04 +08:00
if (this.$route.query.mapId) {
this.refreshRunPlanList(true);
2020-12-11 20:17:18 +08:00
await this.loadMap();
2020-08-14 18:30:04 +08:00
}
},
beforeDestroy() {
},
methods: {
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (dialogObj.name == 'gernaratePlanTrain') {
this.$refs['menuBar'].handleGernaratePlanningTrain();
} else {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
}
2020-08-14 18:30:04 +08:00
}
});
},
dispatchOperate(operateObj) {
this.$nextTick(() => {
if (this.$refs[operateObj.dialogName]) {
this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
}
});
},
2021-03-05 16:44:32 +08:00
async loadMap() {
this.runplanLoading = true;
// 加载地图数据
loadMapDataById(this.$route.query.mapId, 'parse');
},
2020-08-14 18:30:04 +08:00
handleConfirm(params) {
if (params.operate == 'AddPlanningTrain') {
// 添加计划
this.$refs.addPlanningTrain.handleConfirm();
} else if (params.operate == 'DeletePlanningTrain') {
// 删除计划
const model = {
planId: this.loadRunPlanId,
2020-08-14 18:30:04 +08:00
serviceNumber: params.serviceNumber
};
deletePlanService(model).then(resp => {
this.$message.success(this.$t('tip.deletePlanSuccessfully'));
2021-03-05 16:44:32 +08:00
this.$store.dispatch('runPlan/setSelected', {});
2020-08-14 18:30:04 +08:00
this.$store.dispatch('runPlan/refresh');
2021-03-05 16:44:32 +08:00
// this.$refs.openRunPlan.loadRunPlanData(Object.assign({refresh: true}, this.$route.query));
2020-08-14 18:30:04 +08:00
}).catch(() => {
this.$messageBox(this.$t('tip.deletePlanFailed'));
});
}
},
showTrain() {
if (this.$refs.schedule) {
this.$refs.schedule.displayTrain();
}
},
refresh() {
this.$store.dispatch('runPlan/refresh');
},
2021-05-10 13:50:17 +08:00
refreshRunPlanList(planId) {
getRpListByMapId(this.$route.query.mapId).then(resp => {
this.runPlanList = resp.data || [];
if (planId && this.runPlanList.length) {
this.runPlanList.forEach(item => {
if (item.id === planId) {
this.loadRunPlanId = item.id;
this.loadRunPlanName = item.name;
}
});
} else {
this.loadRunPlanId = '';
this.loadRunPlanName = '';
}
}).catch(() => {
this.$message.error('获取草稿运行图列表失败');
});
2020-08-14 18:30:04 +08:00
},
doClose() {
2021-03-05 16:44:32 +08:00
this.$emit('doClose');
2020-08-14 18:30:04 +08:00
},
loadingRunPlan(param) {
this.loadRunPlanId = param.planId;
this.loadRunPlanName = param.planName;
},
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);
2021-03-05 16:44:32 +08:00
this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, planName: name }});
2020-08-14 18:30:04 +08:00
}
}
};
</script>
<style>
.plan-tool {
position: absolute;
}
.plan-tool .pop-menu {
background: #F0F0F0;
}
.plan-tool .pop-menu span {
color: #000;
}
2021-04-14 16:43:09 +08:00
.scheduleIn{
width:100%;
height: 100%;
2021-05-10 13:50:17 +08:00
position: relative;
2021-04-14 16:43:09 +08:00
}
2020-08-14 18:30:04 +08:00
.plan-tool .system-close {
cursor: pointer;
height: 25px;
width: 25px;
background: -webkit-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: -o-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: -moz-linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
background: linear-gradient(#CD98A0, #C27D6E, #B63022, #C68770);
border: 1px solid white;
border-radius: 4px;
}
.plan-tool .system-close::before {
position: absolute;
top: 0px;
left: 0px;
font-size: x-large;
}
.planEdit__tool {
overflow: hidden !important;
}
</style>