运行图代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-09 14:55:03 +08:00
parent b3af1646dd
commit f89d557393
6 changed files with 4 additions and 306 deletions

View File

@ -60,7 +60,7 @@ import EditPlanName from './menus/editPlanName';
import DuplicateTrain from './menus/duplicateTrain'; import DuplicateTrain from './menus/duplicateTrain';
import SystermOut from './menus/systermOut'; import SystermOut from './menus/systermOut';
import AddTask from './menus/addTask'; import AddTask from './menus/addTask';
import DeleteTask from './menus/deleteTask'; import DeleteTask from '../components/menus/deleteTask';
import ModifyingTask from './menus/modifyingTask'; import ModifyingTask from './menus/modifyingTask';
import ModifyingRouting from './menus/modifyingRouting'; import ModifyingRouting from './menus/modifyingRouting';
import ModifyingBeginTime from './menus/modifyingBeginTime'; import ModifyingBeginTime from './menus/modifyingBeginTime';
@ -69,7 +69,7 @@ import GernaratePlan from '../components/menus/gernaratePlanTrain';
import MovePlaningTrain from './menus/movePlaningTrain'; import MovePlaningTrain from './menus/movePlaningTrain';
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime'; import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime'; import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
import PopulatingGenericData from './menus/populatingGenericData'; import PopulatingGenericData from '../components/menus/populatingGenericData';
import { deletePlanService } from '@/api/runplan'; import { deletePlanService } from '@/api/runplan';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata'; import { loadMapDataById } from '@/utils/loaddata';

View File

@ -60,7 +60,7 @@ import EditPlanName from './menus/editPlanName';
import DuplicateTrain from './menus/duplicateTrain'; import DuplicateTrain from './menus/duplicateTrain';
import SystermOut from './menus/systermOut'; import SystermOut from './menus/systermOut';
import AddTask from './menus/addTask'; import AddTask from './menus/addTask';
import DeleteTask from './menus/deleteTask'; import DeleteTask from '../components/menus/deleteTask';
import ModifyingTask from './menus/modifyingTask'; import ModifyingTask from './menus/modifyingTask';
import ModifyingRouting from './menus/modifyingRouting'; import ModifyingRouting from './menus/modifyingRouting';
import ModifyingBeginTime from './menus/modifyingBeginTime'; import ModifyingBeginTime from './menus/modifyingBeginTime';
@ -69,7 +69,7 @@ import GernaratePlan from '../components/menus/gernaratePlanTrain';
import MovePlaningTrain from './menus/movePlaningTrain'; import MovePlaningTrain from './menus/movePlaningTrain';
import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime'; import ModifyingStationIntervalTime from '../components/menus/modifyingStationIntervalTime';
import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime'; import ModifyingStationStopTime from '../components/menus/modifyingStationStopTime';
import PopulatingGenericData from './menus/populatingGenericData'; import PopulatingGenericData from '../components/menus/populatingGenericData';
import { deletePlanService } from '@/api/runplan'; import { deletePlanService } from '@/api/runplan';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata'; import { loadMapDataById } from '@/utils/loaddata';

View File

@ -1,113 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool delete-task"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-radio v-model="model.deleteBefore" :label="true">{{ $t('planMonitor.deleteAllPreviousTasks') }}</el-radio>
</el-row>
<el-row>
<el-radio v-model="model.deleteBefore" :label="false">{{ $t('planMonitor.deleteAllSubsequentTasks') }}</el-radio>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { deletePlanTrip } from '@/api/runplan';
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
model: {
routingCode: '',
deleteBefore: false,
tripNumber: '',
serviceNumber: ''
}
};
},
computed: {
title() {
return this.$t('planMonitor.deleteTask');
}
},
mounted() {
},
methods: {
doShow(params) {
this.isPlan = params.isPlan;
this.model.taskIndex = params.taskIndex;
this.model.tripNumber = params.tripNumber;
this.model.serviceNumber = params.serviceNumber;
this.model.routingCode = params.routingCode;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmDeleteTask', params: this.model });
} else {
//
const model = {
planId: this.$route.query.planId,
SDTNumber: `${this.model.serviceNumber}${this.model.tripNumber}`,
deleteBefore: this.model.deleteBefore
};
deletePlanTrip(model).then(resp => {
this.$store.dispatch('runPlan/setSelected', {});
this.$emit('refresh');
// this.$emit('dispatchOperate', {
// dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
// });
this.$message.success(this.$t('tip.deleteTaskSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.deleteTaskFailed'));
});
}
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-row {
margin: 10px;
}
}
.delete-task{
/deep/ {
.el-dialog__body{
padding: 0 20px;
}
.dialog-footer{
display: flex;
justify-content: center;
}
}
}
</style>

View File

@ -1,189 +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" :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,
formModel: {
stationRunningTime: 60, //
right: 3, //
beginTime: '',
overTime: '',
departureTimeInterval: 180, //
// parkedTime: 30, //
// reentryTime: 120, //
runningRouting1:'', // code1
runningRouting2:'' // code2
// startStationCode: '',
// endStationCode: ''
},
rules: {
beginTime: [
{ required: true, message: '请填写开始时间', trigger: 'blur' }
],
overTime: [
{ required: true, message: '请填写结束时间', trigger: 'blur' }
],
departureTimeInterval: [
{ required: true, message: '请填写发车间隔', trigger: 'blur' }
],
// 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: 'parkedTime', label: '', type: 'number', min:0, step:1, precisionFlag:true, precision:0},
// { prop: 'reentryTime', label: '', type: 'number', min:120, 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:true, options: this.covertRouting('LOOP'), noDataText:'请先设置交路', change:true, onChange:this.changeRoute2 },
{ prop: 'runningRouting2', label: '环路交路2', type: 'select', show:true, options: this.covertRouting('LOOP'), noDataText:'请先设置交路', change:true, onChange:this.changeRoute1}
// { 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) {
listUserRoutingData(mapId).then(response => {
this.routingList = response.data.map(elem => { return { value: elem.code, label: elem.name, routingType:elem.routingType }; });
}).catch(() => {
this.$messageBox(`获取交路列表失败`);
});
}
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.$refs.dataform.resetForm();
this.dialogShow = false;
},
handleCommit() {
this.$refs.dataform.validateForm(() => {
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 => {
console.log(error);
this.$messageBox('生成通用数据失败: ' + error.message);
this.doClose();
});
} else {
this.$messageBox('结束时间必须大于开始时间');
}
});
},
validateRunningRouting(rule, value, callback) {
if (value.trim().length == 0) {
return callback(new Error('请选择环路'));
} else {
if (this.formModel.runningRouting1 == this.formModel.runningRouting2) {
return callback(new Error('环路交路1和环路交路2不能相同'));
} else {
return callback();
}
}
},
changeRoute2() {
this.changeRoute('runningRouting2');
},
changeRoute1() {
this.changeRoute('runningRouting1');
},
changeRoute(runningRouting) {
if (this.formModel[runningRouting]) { this.$refs.dataform.validateField([runningRouting]); }
},
covertRouting(routingType) {
return this.routingList.filter(route=>{ return route.routingType == routingType; });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>