运行图代码调整

This commit is contained in:
joylink_cuiweidong 2021-04-14 14:26:00 +08:00
parent c9985869f1
commit 448832293b
6 changed files with 57 additions and 347 deletions

View File

@ -1,230 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool duplicate-train"
:title="title"
:visible.sync="dialogShow"
width="500px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<data-form ref="dataform" v-loading="dataLoading" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" :loading="loading" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { listUserRoutingData, populatingGenericData } from '@/api/runplan';
export default {
props: {
loadRunPlanId: {
type: String,
default() {
return '';
}
}
},
data() {
return {
dialogShow: false,
// stationList: [],
// routingList: [],
loading: false,
dataLoading:false,
runningRoutingMap:{},
formModel: {
stationRunningTime: 60, //
right: 3, //
beginTime: '',
overTime: '',
departureTimeInterval: 180, //
// parkedTime: 30, //
// reentryTime: 120, //
runningRouting1:'', // code1
runningRouting2:'', // code2
runningRouting:''
// startStationCode: '',
// endStationCode: ''
},
rules: {
beginTime: [
{ required: true, message: '请填写开始时间', trigger: 'blur' }
],
overTime: [
{ required: true, message: '请填写结束时间', trigger: 'blur' }
],
departureTimeInterval: [
{ required: true, message: '请填写发车间隔', trigger: 'blur' }
],
runningRouting: [
{ required: true, message: '请选择环路', trigger: 'blur' },
{ required: true, message: '请选择环路', trigger: 'change' }
]
// parkedTime: [
// { required: true, message: '', trigger: 'blur' }
// ],
// reentryTime: [
// { required: true, message: '', trigger: 'blur' }
// ],
// runningRouting1: [
// { required: true, validator: this.validateRunningRouting, trigger: 'change' }
// ],
// runningRouting2: [
// { required: true, validator: this.validateRunningRouting, trigger: 'change' }
// ]
// startStationCode: [
// { required: true, message: '', trigger: 'change' }
// ],
// endStationCode: [
// { required: true, message: '', trigger: 'change' }
// ]
}
};
},
computed: {
title() {
return '创建运行图';
},
form() {
return {
labelWidth: '100px',
items: [
{ prop: 'beginTime', label: '开始时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'departureTimeInterval', label: '发车间隔', type: 'number', min:0, step:1, precisionFlag:true, precision:0, message:'s'},
{ prop: 'right', label: '发车类型', type: 'checkBox', children: [
{ name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 },
{ name: '同时发车', value: 3 }
] },
{ prop: 'runningRouting1', label: '环路交路1', type: 'select', show:false},
{ prop: 'runningRouting2', label: '环路交路2', type: 'select', show:false},
{ prop:'runningRouting', label:'环路', type: 'select', options:this.covertRouting(), noDataText:'请先设置交路', change:true, onChange:this.changeRoute}
// { prop: 'startStationCode', label: '', type: 'select', options: this.stationList },
// { prop: 'endStationCode', label: '', type: 'select', options: this.stationList }
]
};
}
},
created() {
// const mapId = this.$route.query.mapId;
// if (mapId) {
// getStationList(mapId).then(response => {
// this.stationList = response.data.map(elem => { return { value: elem.code, label: elem.name }; });
// }).catch(() => {
// this.$messageBox(``);
// });
// }
},
methods: {
doShow(params) {
this.loading = false;
const mapId = this.$route.query.mapId;
if (mapId) {
const runningRoutingMap = {};
this.dataLoading = true;
listUserRoutingData(mapId).then(response => {
const list = response.data;
list.forEach(elem=>{
if (elem.routingType === 'LOOP') {
// const name = elem.name;
// let temp = '';
if (elem.right) {
// temp = name.split('-')[0];
// const data = ;
const data = runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode];
if (!data) { runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode] = {}; }
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].label = elem.name;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].value = elem.startSectionCode + '-' + elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.id;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].startStationCode = elem.startStationCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].endStationCode = elem.endStationCode;
} else {
// temp = name.split('-')[1];
// const data = ;
const data = runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode];
if (!data) { runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode] = {}; }
// runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].label = elem.name;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].value = elem.endSectionCode + '-' + elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].runningRouting2 = elem.id;
}
}
});
this.runningRoutingMap = runningRoutingMap;
this.dataLoading = false;
}).catch(() => {
this.dataLoading = false;
this.$messageBox(`获取交路列表失败`);
});
this.dialogShow = true;
}
},
doClose() {
this.loading = false;
this.$refs.dataform.resetForm();
this.formModel = {
stationRunningTime: 60, //
right: 3, //
beginTime: '',
overTime: '',
departureTimeInterval: 180, //
runningRouting1:'', // code1
runningRouting2:'', // code2
runningRouting:''
};
this.dialogShow = false;
},
handleCommit() {
this.$refs.dataform.validateForm(() => {
delete this.formModel.runningRouting;
if (this.formModel.right == 1) {
this.formModel.right = true;
} else if (this.formModel.right == 2) {
this.formModel.right = false;
} else {
this.formModel.right = null;
}
if (this.formModel.overTime > this.formModel.beginTime) {
this.loading = true;
populatingGenericData(this.$route.query.planId || this.loadRunPlanId, this.formModel).then(res => {
this.loading = false;
this.doClose();
this.$store.dispatch('runPlan/refresh');
}).catch(error => {
this.loading = false;
console.log(error);
this.$messageBox('生成通用数据失败: ' + error.message);
this.doClose();
});
} else {
this.$messageBox('结束时间必须大于开始时间');
}
});
},
changeRoute(runningRouting) {
const temp = this.runningRoutingMap[runningRouting];
this.formModel.runningRouting1 = temp.runningRouting1;
this.formModel.runningRouting2 = temp.runningRouting2;
},
covertRouting() {
let list = Object.values(this.runningRoutingMap).filter(route=>{ return route.runningRouting1 && route.runningRouting2; });
list = list.sort((a, b) => {
const startStationA = this.$store.getters['map/getDeviceByCode'](a.startStationCode);
const startStationB = this.$store.getters['map/getDeviceByCode'](b.startStationCode);
const endStationCodeA = this.$store.getters['map/getDeviceByCode'](a.endStationCode);
const endStationCodeB = this.$store.getters['map/getDeviceByCode'](b.endStationCode);
return startStationA.kmRange == startStationB.kmRange ? endStationCodeA.kmRange - endStationCodeB.kmRange : startStationA.kmRange - startStationB.kmRange;
});
return list;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -10,7 +10,6 @@
@checkIsLoadRunPlan="checkIsLoadRunPlan"
@modifyRunPlanName="modifyRunPlanName"
/>
<!-- :plan-parser="PlanParser" -->
<schedule
ref="schedule"
v-loading="runplanLoading"
@ -38,9 +37,7 @@
<modifying-station-interval-time ref="modifyingStationIntervalTime" />
<modifying-station-stop-time ref="modifyingStationStopTime" />
<populating-generic-data ref="populatingGenericData" :load-run-plan-id="loadRunPlanId" />
<edit-plan-name ref="editPlan" @renewal="refreshRunPlanName" />
<!-- <gernarate-plan ref="gernaratePlanTrain" /> -->
</div>
</template>
@ -58,11 +55,9 @@ 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 GernaratePlan from '../components/menus/gernaratePlanTrain';
import MovePlaningTrain from '../components/menus/movePlaningTrain';
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
import PopulatingGenericData from '../components/menus/populatingGenericData';
import { deletePlanService } from '@/api/runplan';
import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata';
@ -73,7 +68,6 @@ export default {
MenuBar,
StatusBar,
Schedule,
PopulatingGenericData,
Parameter,
OffLine,
AddPlanningTrain,
@ -88,7 +82,6 @@ export default {
ModifyingStationIntervalTime,
ModifyingStationStopTime,
EditPlanName,
// GernaratePlan,
MovePlaningTrain
},
data() {
@ -235,25 +228,6 @@ export default {
color: #000;
}
.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;
}

View File

@ -171,11 +171,6 @@ export default {
title: '生成计划',
click: this.handleGernaratePlanningTrain
}
// {
// title: '()',
// click: this.populatingGenericData
// // disabledCallback: () => { return !this.$route.query.planId },
// }
]
},
{
@ -432,10 +427,6 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
});
},
//
populatingGenericData() {
this.$emit('dispatchDialog', { name: 'populatingGenericData', params: {} });
},
// newRunPlan() {
// this.$emit('dispatchDialog', { name: 'createEmptyPlan', params: {}});
// },

View File

@ -1,36 +1,34 @@
<template>
<div class="plan">
<div class="plan-glass"/>
<div class="plan__header">
<span class="title">运行图编辑工具</span>
<span class="close" @click="doClose"/>
</div>
<div class="plan__layer" style="width: 100%; height: 100%;">
<div class="layer-glass" />
<nav-bar ref="bar"/>
<nav-tool ref="tool" :planId="planId" @dispatchDialog="dispatchDialog" @showTable="showTable" @showTripDetail="showTripDetail" @refresh="refresh"/>
<nav-schedule ref="schedule" :PlanParser="PlanParser" :planId="planId" :planTitle="planTitle" :mapId="mapId" v-loading="runplanLoading" />
<nav-state ref="state" />
</div>
<div class="plan">
<div class="plan-glass" />
<div class="plan__header">
<span class="title">运行图编辑工具</span>
<span class="close" @click="doClose" />
</div>
<div class="plan__layer" style="width: 100%; height: 100%;">
<div class="layer-glass" />
<nav-bar ref="bar" />
<nav-tool ref="tool" :plan-id="planId" @dispatchDialog="dispatchDialog" @showTable="showTable" @showTripDetail="showTripDetail" @refresh="refresh" />
<nav-schedule ref="schedule" v-loading="runplanLoading" :plan-parser="PlanParser" :plan-id="planId" :plan-title="planTitle" :map-id="mapId" />
<nav-state ref="state" />
</div>
<parameter ref="parameter" />
<off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" />
<add-planning-train ref="addPlanningTrain" :load-run-plan-id="planId" @dispatchDialog="dispatchDialog" />
<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="planId" @dispatchDialog="dispatchDialog" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<parameter ref="parameter" />
<off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" />
<add-planning-train ref="addPlanningTrain" :load-run-plan-id="planId" @dispatchDialog="dispatchDialog" />
<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="planId" @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="planId" @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="planId" @dispatchOperate="dispatchOperate" @refresh="refresh" />
<modifying-station-interval-time ref="modifyingStationIntervalTime" />
<modifying-station-stop-time ref="modifyingStationStopTime" />
<populating-generic-data ref="populatingGenericData" :load-run-plan-id="planId" />
<edit-plan-name ref="editPlan" @renewal="refreshMapName" />
<!-- <gernarate-plan ref="gernaratePlanTrain" /> -->
</div>
<modifying-station-interval-time ref="modifyingStationIntervalTime" />
<modifying-station-stop-time ref="modifyingStationStopTime" />
<edit-plan-name ref="editPlan" @renewal="refreshMapName" />
</div>
</template>
<script>
@ -48,11 +46,9 @@ 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 GernaratePlan from '../components/menus/gernaratePlanTrain';
import MovePlaningTrain from '../components/menus/movePlaningTrain';
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
import PopulatingGenericData from '../components/menus/populatingGenericData';
import { deletePlanService } from '@/api/runplan';
import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata';
@ -60,10 +56,9 @@ import { loadMapDataById } from '@/utils/loaddata';
export default {
components: {
NavBar,
NavTool,
NavState,
NavTool,
NavState,
NavSchedule,
PopulatingGenericData,
Parameter,
OffLine,
AddPlanningTrain,
@ -76,41 +71,40 @@ export default {
ModifyingStationIntervalTime,
ModifyingStationStopTime,
EditPlanName,
GernaratePlan,
MovePlaningTrain
},
data() {
return {
mapId: '',
planId: '',
planTitle: '',
PlanParser: {},
timeDemon: null,
runplanLoading: false
mapId: '',
planId: '',
planTitle: '',
PlanParser: {},
timeDemon: null,
runplanLoading: false
};
},
computed: {
dispaly() {
computed: {
dispaly() {
return this.$route.path.includes('display');
}
},
watch: {
},
watch: {
'$store.state.map.mapDataLoadedCount': function (val) {
this.runplanLoading = false;
this.runplanLoading = false;
this.planId = this.$route.query.planId;
}
},
created() {
this.PlanParser = this.$theme.loadPlanParser(this.$route.query.lineCode||'02');
},
this.PlanParser = this.$theme.loadPlanParser(this.$route.query.lineCode || '02');
},
async mounted() {
this.mapId = this.$route.query.mapId;
this.planId = this.$route.query.planId;
this.planTitle = this.$route.query.planName;
if (this.mapId) {
this.runplanLoading = true;
this.mapId = this.$route.query.mapId;
this.planId = this.$route.query.planId;
this.planTitle = this.$route.query.planName;
if (this.mapId) {
this.runplanLoading = true;
await loadMapDataById(this.mapId, 'parse');
this.timeDemon = setInterval(_ => checkLoginLine(), 5000 * 60);
this.timeDemon = setInterval(_ => checkLoginLine(), 5000 * 60);
}
},
beforeDestroy() {
@ -119,7 +113,7 @@ export default {
}
},
methods: {
dispatchDialog(dialogObj) {
dispatchDialog(dialogObj) {
this.$nextTick(() => {
if (this.$refs[dialogObj.name]) {
this.$refs[dialogObj.name].doShow(dialogObj.params);
@ -166,26 +160,26 @@ export default {
this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan'));
}
},
showTable() {
showTable() {
if (this.$refs.schedule) {
this.$refs.schedule.displayTable();
}
},
showTripDetail() {
showTripDetail() {
if (this.$refs.schedule) {
this.$refs.schedule.displayTripDetail();
}
},
},
refreshMapName(name) {
this.$refs.schedule.refreshMapName(name);
this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, planName: name }});
},
doClose() {
if (this.dispaly) {
doClose() {
if (this.dispaly) {
this.$emit('doClose');
} else {
this.$router.go(-1);
}
} else {
this.$router.go(-1);
}
}
}
};

View File

@ -38,9 +38,7 @@
<modifying-station-interval-time ref="modifyingStationIntervalTime" />
<modifying-station-stop-time ref="modifyingStationStopTime" />
<populating-generic-data ref="populatingGenericData" :load-run-plan-id="loadRunPlanId" />
<edit-plan-name ref="editPlan" @renewal="refreshRunPlanName" />
<!-- <gernarate-plan ref="gernaratePlanTrain" /> -->
</div>
</template>
@ -58,11 +56,9 @@ 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 GernaratePlan from '../components/menus/gernaratePlanTrain';
import MovePlaningTrain from '../components/menus/movePlaningTrain';
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
import PopulatingGenericData from '../components/menus/populatingGenericData';
import { deletePlanService } from '@/api/runplan';
import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata';
@ -73,7 +69,6 @@ export default {
MenuBar,
StatusBar,
Schedule,
PopulatingGenericData,
Parameter,
OffLine,
AddPlanningTrain,
@ -88,7 +83,6 @@ export default {
ModifyingStationIntervalTime,
ModifyingStationStopTime,
EditPlanName,
// GernaratePlan,
MovePlaningTrain
},
data() {

View File

@ -218,11 +218,6 @@ export default {
title: '生成计划',
click: this.handleGernaratePlanningTrain
}
// {
// title: '()',
// click: this.populatingGenericData
// // disabledCallback: () => { return !this.$route.query.planId },
// }
]
},
{
@ -492,14 +487,6 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
});
},
//
populatingGenericData() {
if (this.loadRunPlanId) {
this.$emit('dispatchDialog', { name: 'populatingGenericData', params: {} });
} else {
this.$messageBox(this.$t('tip.selectARunGraphFirst'));
}
},
newRunPlan() {
this.$emit('dispatchDialog', { name: 'createEmptyPlan', params: {}});
},