2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-09 18:29:08 +08:00
|
|
|
<el-dialog
|
|
|
|
v-dialogDrag
|
|
|
|
class="planEdit__tool add-task"
|
|
|
|
:title="title"
|
|
|
|
:visible.sync="dialogShow"
|
2019-09-23 13:37:11 +08:00
|
|
|
width="880px"
|
2019-08-09 18:29:08 +08:00
|
|
|
:before-close="doClose"
|
|
|
|
:z-index="2000"
|
2019-09-23 13:37:11 +08:00
|
|
|
top="50px"
|
2019-08-09 18:29:08 +08:00
|
|
|
:modal="false"
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
>
|
2019-09-17 13:16:49 +08:00
|
|
|
<el-row>
|
|
|
|
<el-col :span="3" style="height: 28px;line-height: 28px;">
|
2020-10-20 17:21:02 +08:00
|
|
|
<el-radio v-model="addModel.forward" :label="true">{{ $t('planMonitor.addToTheFront') }}</el-radio>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-col :span="3" style="margin-left: 10px;height: 28px;line-height: 28px;">
|
|
|
|
<span>{{ $t('planMonitor.tripNumber')+$t('global.colon') }}</span>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="5">
|
2019-09-19 16:12:05 +08:00
|
|
|
<el-select v-model="addModel.tripNumber" size="mini" :placeholder="this.$t('global.choose')">
|
2019-09-17 13:16:49 +08:00
|
|
|
<el-option
|
|
|
|
v-for="item in tripNumberList"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-col>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-col :span="3" style="margin-left: 20px;height: 28px;line-height: 28px;">
|
|
|
|
<span>{{ $t('global.startTime')+$t('global.colon') }}</span>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="5">
|
|
|
|
<el-time-picker v-model="addModel.startTime" size="mini" value-format="HH:mm:ss" :clearable="false" />
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row style="margin-top: 5px;height: 28px;line-height: 28px;">
|
|
|
|
<el-col :span="3">
|
2020-10-20 17:21:02 +08:00
|
|
|
<el-radio v-model="addModel.forward" :label="false">{{ $t('planMonitor.addToTheEnd') }}</el-radio>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-col :span="3" style="margin-left: 10px;height: 28px;line-height: 28px;">
|
|
|
|
<span>{{ $t('planMonitor.defaultStopTime') }}</span>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="5">
|
2020-10-21 11:07:10 +08:00
|
|
|
<el-input-number v-model="defaultStopTime" placeholder="请输入时间" size="mini" :controls="false" :min="0" />
|
|
|
|
<!-- <el-select v-model="defaultStopTime" size="mini" :placeholder="this.$t('global.choose')">
|
2019-09-17 13:16:49 +08:00
|
|
|
<el-option
|
|
|
|
v-for="item in defaultStopTimeList"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
2020-10-21 11:07:10 +08:00
|
|
|
</el-select> -->
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-col :span="3" style="margin-left: 20px;height: 28px;line-height: 28px;">
|
|
|
|
<span>{{ $t('planMonitor.defaultRunLevel') }}</span>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="5">
|
2020-10-20 17:21:02 +08:00
|
|
|
<el-select v-model="defaultSpeedLevel" size="mini" :placeholder="this.$t('global.choose')">
|
2019-09-17 13:16:49 +08:00
|
|
|
<el-option
|
|
|
|
v-for="item in defaultSpeedLevelList"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-col>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 18:29:08 +08:00
|
|
|
</el-row>
|
2019-09-17 13:16:49 +08:00
|
|
|
<el-row style="margin-bottom: 5px;">
|
2019-09-23 13:37:11 +08:00
|
|
|
{{ $t('planMonitor.crossRailway')+$t('global.colon') }}
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-table
|
2020-10-20 17:21:02 +08:00
|
|
|
:data="routingList"
|
2019-09-17 13:16:49 +08:00
|
|
|
border
|
|
|
|
highlight-current-row
|
2020-10-19 15:08:30 +08:00
|
|
|
:height="230"
|
2019-09-17 13:16:49 +08:00
|
|
|
@row-click="handleClick"
|
|
|
|
>
|
2020-10-22 09:53:29 +08:00
|
|
|
<el-table-column
|
|
|
|
prop="startStationCode"
|
|
|
|
:label="this.$t('planMonitor.startingStation')"
|
|
|
|
:filters="startStationFilters"
|
|
|
|
:filter-method="filterStartStation"
|
|
|
|
column-key="startStationCode"
|
|
|
|
>
|
2019-09-17 13:16:49 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ formatName(scope.row.startStationCode) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-table-column prop="startSectionCode" :label="this.$t('planMonitor.startingSection')" width="95">
|
2019-09-17 13:16:49 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ formatName(scope.row.startSectionCode) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2020-10-22 09:53:29 +08:00
|
|
|
<el-table-column
|
|
|
|
prop="endStationCode"
|
|
|
|
:label="this.$t('planMonitor.terminal')"
|
|
|
|
:filters="endStationFilters"
|
|
|
|
:filter-method="filterEndStation"
|
|
|
|
column-key="endStationCode"
|
|
|
|
>
|
2019-09-17 13:16:49 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ formatName(scope.row.endStationCode) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-table-column prop="endSectionCode" :label="this.$t('planMonitor.endingSection')" width="95">
|
2019-09-17 13:16:49 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ formatName(scope.row.endSectionCode) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-table-column prop="remarks" :label="this.$t('planMonitor.description')" width="315" />
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-table>
|
|
|
|
</el-row>
|
|
|
|
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
|
2020-11-04 17:05:23 +08:00
|
|
|
{{ '经停转换轨 / 站台轨'+$t('global.colon') }}
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-row>
|
|
|
|
<el-row>
|
2020-10-19 15:08:30 +08:00
|
|
|
<el-table :data="addModel.arriveConfigList" border :height="230">
|
2020-11-04 17:05:23 +08:00
|
|
|
<el-table-column prop="stationCode" :label="this.$t('planMonitor.station')" width="160">
|
2019-09-17 13:16:49 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ formatName(scope.row.stationCode) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2020-11-04 17:05:23 +08:00
|
|
|
<el-table-column prop="sectionCode" :label="this.$t('planMonitor.section')" width="95">
|
2019-09-17 13:16:49 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
{{ formatName(scope.row.sectionCode) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2020-11-04 17:05:23 +08:00
|
|
|
<el-table-column prop="arriveTime" :label="this.$t('planMonitor.arriveTime')" width="100px" />
|
2020-10-19 18:41:15 +08:00
|
|
|
<!-- prop="stopTime" -->
|
2020-11-04 17:05:23 +08:00
|
|
|
<el-table-column :label="this.$t('planMonitor.stopTime')" width="100px">
|
2019-09-23 13:37:11 +08:00
|
|
|
<template slot-scope="scope">
|
2020-11-04 17:05:23 +08:00
|
|
|
<el-input v-model="scope.row.stopTime" placeholder="请输入时间" size="mini" @input="changeStopTime(scope.$index, scope.row.stopTime)" />
|
2019-09-23 13:37:11 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2020-11-04 17:05:23 +08:00
|
|
|
<el-table-column prop="departureTime" :label="this.$t('planMonitor.departureTime')" width="100px" />
|
2020-10-20 17:21:02 +08:00
|
|
|
<el-table-column :label="this.$t('planMonitor.runLevel')">
|
|
|
|
<template slot-scope="scope">
|
2020-11-04 17:05:23 +08:00
|
|
|
<span style="font-size:13px;">{{ scope.row.speedLevel }}</span>
|
|
|
|
<el-input v-model="scope.row.speedLevelTime" style="width:70px" placeholder="请输入运行等级" size="mini" @input="changeSpeedLevelTime(scope.$index, scope.row.speedLevelTime)" />
|
2020-10-20 17:21:02 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-table>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :offset="16">
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-checkbox v-model="showDefault">{{ $t('planMonitor.showDefaultStopTimeAndRunLevel') }}</el-checkbox>
|
2019-09-17 13:16:49 +08:00
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<span slot="footer" class="dialog-footer">
|
2019-09-23 13:37:11 +08:00
|
|
|
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
|
|
|
|
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
|
2019-09-17 13:16:49 +08:00
|
|
|
</span>
|
2019-08-09 18:29:08 +08:00
|
|
|
</el-dialog>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-10-28 10:22:46 +08:00
|
|
|
import { getRoutingList, addPlanTrip, getMapStationRun } from '@/api/runplan';
|
2019-08-09 18:29:08 +08:00
|
|
|
import { formatTime, formatName } from '@/utils/runPlan';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 18:29:08 +08:00
|
|
|
export default {
|
2019-11-11 15:54:04 +08:00
|
|
|
name: 'AddTask',
|
|
|
|
components: {
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogShow: false,
|
|
|
|
loading: false,
|
|
|
|
isPlan: false,
|
|
|
|
showDefault: true,
|
|
|
|
stopStationMap: {},
|
|
|
|
params: {},
|
2020-10-20 17:21:02 +08:00
|
|
|
routingList: [],
|
2020-10-22 09:53:29 +08:00
|
|
|
startStationFilters:[],
|
|
|
|
endStationFilters:[],
|
2020-10-20 17:21:02 +08:00
|
|
|
defaultStopTime: '30',
|
|
|
|
defaultSpeedLevel: 'l3',
|
2019-11-11 15:54:04 +08:00
|
|
|
addModel: {
|
2020-10-20 17:21:02 +08:00
|
|
|
forward: false,
|
2019-11-11 15:54:04 +08:00
|
|
|
routingCode: '',
|
|
|
|
endStationCode: '',
|
|
|
|
startStationCode: '',
|
|
|
|
startTime: '00:00:00',
|
|
|
|
endTime: '',
|
2020-10-21 11:07:10 +08:00
|
|
|
arriveConfigList: [],
|
|
|
|
tripNumber: '',
|
|
|
|
planId: '',
|
|
|
|
serviceNumber: ''
|
2019-11-11 15:54:04 +08:00
|
|
|
},
|
|
|
|
tripNumberList: [{ value: '', label: this.$t('planMonitor.automatic') }],
|
2020-10-21 11:07:10 +08:00
|
|
|
// defaultStopTimeList: [{ value: '30', label: this.$t('planMonitor.default') }, { value: '0', label: '0' }],
|
2020-10-19 15:08:30 +08:00
|
|
|
defaultSpeedLevelList: [
|
|
|
|
{ value: 'l1', label: '等级一' },
|
|
|
|
{ value: 'l2', label: '等级二' },
|
|
|
|
{ value: 'l3', label: '等级三'},
|
|
|
|
{ value: 'l4', label: '等级四' },
|
|
|
|
{ value: 'l5', label: '等级五' }
|
|
|
|
]
|
2019-11-11 15:54:04 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
title() {
|
|
|
|
return this.$t('planMonitor.addTask');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2020-10-21 11:07:10 +08:00
|
|
|
'addModel.routingCode': function (val) {
|
|
|
|
if (val) {
|
|
|
|
this.computedDetailList('routingCode');
|
|
|
|
}
|
2019-11-11 15:54:04 +08:00
|
|
|
},
|
|
|
|
'addModel.startTime': function () {
|
|
|
|
this.computedDetailList();
|
|
|
|
},
|
2020-10-20 17:21:02 +08:00
|
|
|
'defaultStopTime': function () {
|
2020-10-19 18:41:15 +08:00
|
|
|
this.computedDetailList('defaultStopTime');
|
2019-11-11 15:54:04 +08:00
|
|
|
},
|
2020-10-20 17:21:02 +08:00
|
|
|
'defaultSpeedLevel': function () {
|
|
|
|
this.computedDetailList('defaultSpeedLevel');
|
2019-11-11 15:54:04 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadInitData(params) {
|
|
|
|
this.isPlan = params.isPlan;
|
2020-10-20 17:21:02 +08:00
|
|
|
// this.addModel.taskIndex = getUID('task_');
|
2020-10-21 11:07:10 +08:00
|
|
|
this.addModel.serviceNumber = params.serviceNumber;
|
|
|
|
this.addModel.planId = this.$route.query.planId;
|
2020-10-20 17:21:02 +08:00
|
|
|
this.addModel.arriveConfigList = [];
|
2019-11-11 15:54:04 +08:00
|
|
|
const planId = this.$route.query.planId;
|
|
|
|
if (planId) {
|
|
|
|
getRoutingList(planId).then(resp => {
|
2020-10-20 17:21:02 +08:00
|
|
|
this.routingList = resp.data;
|
2020-11-04 17:05:23 +08:00
|
|
|
// debugger;
|
2020-10-22 09:53:29 +08:00
|
|
|
const startStationFilterMap = {};
|
|
|
|
const endStationFilterMap = {};
|
|
|
|
this.routingList.forEach(routing=>{
|
|
|
|
if (!startStationFilterMap[routing.startStationCode]) {
|
|
|
|
startStationFilterMap[routing.startStationCode] = {text:formatName(routing.startStationCode), value:routing.startStationCode};
|
|
|
|
}
|
|
|
|
if (!endStationFilterMap[routing.endStationCode]) {
|
|
|
|
endStationFilterMap[routing.endStationCode] = {text:formatName(routing.endStationCode), value:routing.endStationCode};
|
|
|
|
}
|
2020-11-04 17:05:23 +08:00
|
|
|
let length = routing.parkSectionCodeList.length;
|
|
|
|
if ( length >= 4) {
|
|
|
|
if (routing.parkSectionCodeList[0].stationCode == routing.parkSectionCodeList[1].stationCode) {
|
|
|
|
// routing.startSectionCode = routing.parkSectionCodeList[1].sectionCode;
|
|
|
|
routing.parkSectionCodeList.shift();
|
|
|
|
}
|
|
|
|
length = routing.parkSectionCodeList.length;
|
|
|
|
if (routing.parkSectionCodeList[length - 1].stationCode == routing.parkSectionCodeList[length - 2].stationCode) {
|
|
|
|
// routing.endSectionCode = routing.parkSectionCodeList[length - 2].sectionCode;
|
|
|
|
routing.parkSectionCodeList.pop();
|
|
|
|
}
|
|
|
|
}
|
2020-10-22 09:53:29 +08:00
|
|
|
});
|
|
|
|
this.startStationFilters = Object.values(startStationFilterMap);
|
|
|
|
this.endStationFilters = Object.values(endStationFilterMap);
|
2019-11-11 15:54:04 +08:00
|
|
|
});
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-11-11 15:54:04 +08:00
|
|
|
const mapId = this.$route.query.mapId;
|
2020-10-26 11:07:49 +08:00
|
|
|
if (mapId) {
|
2020-08-14 18:30:04 +08:00
|
|
|
getMapStationRun(mapId).then(resp =>{
|
|
|
|
const list = resp.data;
|
|
|
|
list.forEach(elem => {
|
|
|
|
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
|
|
|
|
});
|
2020-10-19 10:25:36 +08:00
|
|
|
// if (list && list.length) {
|
|
|
|
// list.forEach(elem => {
|
|
|
|
// if (!elem.runPlanLevelVO) {
|
|
|
|
// this.$alert(`${this.$t('planMonitor.tipOperationTime')}`, {
|
|
|
|
// confirmButtonText: this.$t('global.confirm'),
|
|
|
|
// callback: action => {
|
|
|
|
// this.doClose();
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
2019-11-11 15:54:04 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
doShow(params) {
|
|
|
|
this.loadInitData(params);
|
|
|
|
this.dialogShow = true;
|
|
|
|
},
|
2020-10-22 09:53:29 +08:00
|
|
|
filterStartStation(value, row) {
|
|
|
|
return row.startStationCode == value;
|
|
|
|
},
|
|
|
|
filterEndStation(value, row) {
|
|
|
|
return row.endStationCode == value;
|
|
|
|
},
|
2019-11-11 15:54:04 +08:00
|
|
|
doClose() {
|
|
|
|
this.loading = false;
|
|
|
|
this.dialogShow = false;
|
|
|
|
},
|
|
|
|
formatName(code) {
|
|
|
|
return formatName(code);
|
|
|
|
},
|
|
|
|
computedTimeByString(timeStr) {
|
|
|
|
const bTime = +new Date(`2019-01-01 00:00:00`);
|
|
|
|
const eTime = +new Date(`2019-01-01 ${timeStr}`);
|
|
|
|
return Number(eTime) - Number(bTime);
|
|
|
|
},
|
|
|
|
compuntedRunTime(list, index, runLevel) {
|
|
|
|
let runTime = 0;
|
|
|
|
if (index < list.length - 1) {
|
|
|
|
const stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
|
|
|
|
if (stopStationObj) {
|
|
|
|
if (stopStationObj.runPlanLevelVO) {
|
|
|
|
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
|
2020-10-19 15:08:30 +08:00
|
|
|
} else if (stopStationObj[runLevel]) {
|
|
|
|
runTime = parseInt(stopStationObj[runLevel]);
|
2019-11-11 15:54:04 +08:00
|
|
|
} else {
|
|
|
|
this.$messageBox(this.$t('planMonitor.addTaskHint1') + stopStationObj.startSectionCode + this.$t('planMonitor.addTaskHint2') + stopStationObj.endSectionCode + this.$t('planMonitor.addTaskHint3'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return runTime;
|
|
|
|
},
|
2020-10-20 17:21:02 +08:00
|
|
|
changeSpeedLevelTime(indexs, speedLevelTime) {
|
|
|
|
const arriveConfigList = Object.assign([], this.addModel.arriveConfigList);
|
|
|
|
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000;
|
|
|
|
arriveConfigList.forEach((elem, index) => {
|
|
|
|
elem.arriveTime = index ? formatTime(tempTime) : '';
|
|
|
|
if (index == indexs) { elem.speedLevelTime = speedLevelTime ? Number(speedLevelTime) : 0; }
|
|
|
|
elem.arriveTime = index ? formatTime(tempTime) : '';
|
|
|
|
if (index > 0) {
|
|
|
|
elem.departureTime = index == arriveConfigList.length - 1 ? '' : formatTime(tempTime + elem.stopTime);
|
|
|
|
} else {
|
|
|
|
elem.departureTime = formatTime(tempTime);
|
|
|
|
}
|
|
|
|
const realRunlevel = elem.speedLevelTime;
|
|
|
|
if (index > 0) {
|
|
|
|
tempTime = tempTime + elem.stopTime + realRunlevel;
|
|
|
|
} else {
|
|
|
|
tempTime = tempTime + realRunlevel;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.addModel.arriveConfigList = arriveConfigList;
|
|
|
|
this.addModel.endTime = formatTime(tempTime - this.addModel.arriveConfigList[this.addModel.arriveConfigList.length - 1].stopTime);
|
|
|
|
},
|
2019-11-11 15:54:04 +08:00
|
|
|
changeStopTime(indexs, time) {
|
2020-10-19 18:41:15 +08:00
|
|
|
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000;
|
2020-10-20 17:21:02 +08:00
|
|
|
// const runLevel = this.defaultSpeedLevel || 'l3'; // 默认等级三
|
2020-10-19 18:41:15 +08:00
|
|
|
const arriveConfigList = Object.assign([], this.addModel.arriveConfigList);
|
|
|
|
arriveConfigList.forEach((elem, index) => {
|
2020-10-20 17:21:02 +08:00
|
|
|
if (index == indexs) { elem.stopTime = time ? Number(time) : 0; }
|
|
|
|
elem.arriveTime = index ? formatTime(tempTime) : '';
|
|
|
|
// const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
|
|
|
|
// elem.speedLevel = this.defaultSpeedLevel == 'l3' ? `${this.$t('planMonitor.default')}(${runLevelObj.label})` : runLevelObj.label;
|
|
|
|
if (index > 0) {
|
|
|
|
elem.departureTime = index == arriveConfigList.length - 1 ? '' : formatTime(tempTime + elem.stopTime);
|
|
|
|
} else {
|
|
|
|
elem.departureTime = formatTime(tempTime);
|
2020-10-19 18:41:15 +08:00
|
|
|
}
|
2020-10-20 17:21:02 +08:00
|
|
|
const realRunlevel = elem.speedLevelTime;
|
|
|
|
if (index > 0) {
|
|
|
|
tempTime = tempTime + elem.stopTime + realRunlevel;
|
|
|
|
} else {
|
|
|
|
tempTime = tempTime + realRunlevel;
|
2019-11-11 15:54:04 +08:00
|
|
|
}
|
|
|
|
});
|
2020-10-19 18:41:15 +08:00
|
|
|
this.addModel.arriveConfigList = arriveConfigList;
|
2019-11-11 15:54:04 +08:00
|
|
|
this.addModel.endTime = formatTime(tempTime - this.addModel.arriveConfigList[this.addModel.arriveConfigList.length - 1].stopTime);
|
|
|
|
},
|
2020-10-19 18:41:15 +08:00
|
|
|
computedDetailList(type = null) {
|
2019-11-11 15:54:04 +08:00
|
|
|
if (this.addModel.routingCode) {
|
2020-10-20 17:21:02 +08:00
|
|
|
const list = Object.assign([], this.addModel.arriveConfigList);
|
2020-10-19 18:41:15 +08:00
|
|
|
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000;
|
2020-10-20 17:21:02 +08:00
|
|
|
const runLevel = this.defaultSpeedLevel || 'l3'; // 默认等级三
|
2020-10-19 15:08:30 +08:00
|
|
|
list.forEach((elem, index) => {
|
2020-10-20 17:21:02 +08:00
|
|
|
if (type == 'defaultStopTime' || type == 'routingCode') {
|
2020-10-21 11:07:10 +08:00
|
|
|
elem.stopTime = parseInt(this.defaultStopTime);
|
2020-10-19 18:41:15 +08:00
|
|
|
}
|
2020-10-19 15:08:30 +08:00
|
|
|
elem.arriveTime = index ? formatTime(tempTime) : '';
|
2020-10-20 17:21:02 +08:00
|
|
|
if (index > 0) {
|
|
|
|
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + elem.stopTime);
|
|
|
|
} else {
|
|
|
|
elem.departureTime = formatTime(tempTime);
|
|
|
|
}
|
2020-10-19 15:08:30 +08:00
|
|
|
const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
|
2020-10-20 17:21:02 +08:00
|
|
|
if (!elem.speedLevelTime || type == 'defaultSpeedLevel') {
|
|
|
|
const realRunlevel = this.compuntedRunTime(list, index, runLevel);
|
|
|
|
elem.speedLevelTime = realRunlevel;
|
|
|
|
}
|
|
|
|
elem.speedLevel = this.defaultSpeedLevel == 'l3' ? `${this.$t('planMonitor.default')}(${runLevelObj.label})` : runLevelObj.label;
|
|
|
|
if (index > 0) {
|
|
|
|
tempTime = tempTime + elem.stopTime + elem.speedLevelTime;
|
|
|
|
} else {
|
|
|
|
tempTime = tempTime + elem.speedLevelTime;
|
|
|
|
}
|
2020-10-19 15:08:30 +08:00
|
|
|
|
2020-10-20 17:21:02 +08:00
|
|
|
});
|
2020-10-19 15:08:30 +08:00
|
|
|
this.addModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
|
2019-11-11 15:54:04 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
handleClick(row, column, event) {
|
2020-10-20 17:21:02 +08:00
|
|
|
const arriveConfigList = [];
|
2020-11-04 10:46:55 +08:00
|
|
|
row.parkSectionCodeList.forEach((parkSectionCode, index)=>{
|
2020-11-04 17:05:23 +08:00
|
|
|
arriveConfigList.push({arriveTime:'', departureTime:'', sectionCode:parkSectionCode.sectionCode, stationCode:parkSectionCode.stationCode});
|
2020-10-20 17:21:02 +08:00
|
|
|
});
|
|
|
|
this.$set(this.addModel, 'arriveConfigList', arriveConfigList);
|
2020-11-11 11:22:26 +08:00
|
|
|
// this.addModel.startStationCode = row.startStationCode;
|
|
|
|
// this.addModel.endStationCode = row.endStationCode;
|
|
|
|
// this.addModel.endSectionCode = row.endSectionCode;
|
|
|
|
// this.addModel.startSectionCode = row.startSectionCode;
|
2019-11-11 15:54:04 +08:00
|
|
|
this.addModel.routingCode = row.code;
|
2020-11-11 11:22:26 +08:00
|
|
|
this.computedDetailList('routingCode');
|
2019-11-11 15:54:04 +08:00
|
|
|
},
|
|
|
|
handleCommit() {
|
|
|
|
if (this.isPlan) {
|
|
|
|
// 计划添加任务
|
|
|
|
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmAddTask', params: Object.assign({}, this.addModel) });
|
2020-10-21 11:07:10 +08:00
|
|
|
this.addModel.routingCode = '';
|
2019-11-11 15:54:04 +08:00
|
|
|
} else {
|
|
|
|
// 直接添加任务
|
2020-10-21 11:07:10 +08:00
|
|
|
delete this.addModel.tripNumber;
|
2019-11-11 15:54:04 +08:00
|
|
|
addPlanTrip(this.addModel).then(resp => {
|
|
|
|
// this.$emit('dispatchOperate', {
|
|
|
|
// dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
|
|
|
|
// });
|
|
|
|
this.$emit('refresh');
|
|
|
|
this.$message.success(this.$t('tip.addTaskSuccessfully'));
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('tip.addTaskFailed'));
|
|
|
|
});
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-11-11 15:54:04 +08:00
|
|
|
this.doClose();
|
|
|
|
}
|
|
|
|
}
|
2019-08-09 18:29:08 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
/deep/ {
|
|
|
|
.el-row {
|
|
|
|
margin-bottom: 5px !important;
|
|
|
|
}
|
|
|
|
}
|
2019-09-17 13:16:49 +08:00
|
|
|
|
|
|
|
.add-task{
|
|
|
|
/deep/ {
|
|
|
|
.el-dialog__body{
|
|
|
|
padding: 0 20px;
|
|
|
|
}
|
|
|
|
.dialog-footer{
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-09 18:29:08 +08:00
|
|
|
</style>
|