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

671 lines
29 KiB
Vue
Raw Normal View History

2020-08-14 18:30:04 +08:00
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool add-task"
:title="title"
:visible.sync="dialogShow"
width="1000px"
:before-close="doClose"
:z-index="2000"
top="50px"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
2020-12-11 20:17:18 +08:00
<!-- <el-col :span="2">
2020-08-14 18:30:04 +08:00
<el-row>
<el-col :offset="8" class="lineHeight">
<el-checkbox v-model="editModel.trainManual">{{ $t('planMonitor.modifying.manual') }}</el-checkbox>
</el-col>
</el-row>
2020-12-11 20:17:18 +08:00
</el-col> -->
<!-- <el-col :span="6">
2020-08-14 18:30:04 +08:00
<el-row>
<el-col :span="11" :offset="1" class="lineHeight">
<span>{{ $t('planMonitor.modifying.defaultStopTime') }}</span>
</el-col>
<el-col :span="12">
2020-12-11 20:17:18 +08:00
<el-input-number v-model="defaultStopTime" placeholder="请输入时间" size="mini" :controls="false" :min="0" /> -->
<!-- <el-select
2020-08-14 18:30:04 +08:00
v-model="editModel.defaultStopTime"
style="display: inline-black"
2020-08-14 18:30:04 +08:00
size="mini"
:placeholder="$t('planMonitor.modifying.pleaseSelect')"
>
<el-option
v-for="item in defaultStopTimeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
2020-12-11 20:17:18 +08:00
<!-- </el-col>
2020-08-14 18:30:04 +08:00
</el-row>
2020-12-11 20:17:18 +08:00
</el-col> -->
<el-col :span="6">
2020-08-14 18:30:04 +08:00
<el-row>
2020-12-11 20:17:18 +08:00
<el-col :span="9" class="lineHeight">
2020-08-14 18:30:04 +08:00
<span>{{ $t('planMonitor.modifying.serviceNumber') }}</span>
</el-col>
2020-12-11 20:17:18 +08:00
<el-col :span="15">
<el-input v-model="serviceNumber" size="mini" disabled />
2020-08-14 18:30:04 +08:00
</el-col>
</el-row>
</el-col>
2020-12-11 20:17:18 +08:00
<!-- <el-col :span="7" class="lineHeight">
2020-08-14 18:30:04 +08:00
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="editModel.clearGuest">{{ $t('planMonitor.modifying.clearGuest') }}</el-checkbox>
</el-col>
<el-col :span="8">
<el-checkbox v-model="editModel.continuationPlan">{{ $t('planMonitor.modifying.continuationPlan') }}</el-checkbox>
</el-col>
<el-col :span="6">
<el-checkbox v-model="editModel.firstTrain">{{ $t('planMonitor.modifying.firstTrain') }}</el-checkbox>
</el-col>
</el-row>
</el-col>
</el-row>
2020-12-11 20:17:18 +08:00
</el-col> -->
<el-col :span="6" class="lineHeight">
<el-row>
<el-col :span="10" :offset="1">
<span>{{ $t('planMonitor.modifying.defaultRunLevel') }}</span>
</el-col>
<el-col :span="12">
<el-select
v-model="defaultSpeedLevel"
style="display: inline-black"
size="mini"
:placeholder="$t('planMonitor.modifying.pleaseSelect')"
>
<el-option
v-for="item in defaultSpeedLevelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
2020-08-14 18:30:04 +08:00
</el-col>
</el-row>
<el-row>
2020-12-11 20:17:18 +08:00
<el-col :span="6">
2020-08-14 18:30:04 +08:00
<el-row>
<el-col :span="9" class="lineHeight">
2020-12-11 20:17:18 +08:00
<span>{{ $t('planMonitor.modifying.tripNumber') }}</span>
2020-08-14 18:30:04 +08:00
</el-col>
<el-col :span="15">
2020-12-11 20:17:18 +08:00
<el-select v-model="tripNumber" size="mini" style="display: inline-black" disabled :placeholder="$t('planMonitor.modifying.pleaseSelect')">
2020-08-14 18:30:04 +08:00
<el-option
2020-12-11 20:17:18 +08:00
v-for="item in tripNumberList"
2020-08-14 18:30:04 +08:00
:key="item.value"
:label="item.label"
2020-12-11 20:17:18 +08:00
:value="item.value"
2020-08-14 18:30:04 +08:00
/>
</el-select>
</el-col>
</el-row>
</el-col>
2020-12-11 20:17:18 +08:00
<!-- <el-col :span="6">
2020-08-14 18:30:04 +08:00
<el-row>
2020-12-11 20:17:18 +08:00
<el-col :span="9" class="lineHeight">
<span>{{ $t('planMonitor.modifying.serialNumber') }}</span>
2020-08-14 18:30:04 +08:00
</el-col>
2020-12-11 20:17:18 +08:00
<el-col :span="15">
<el-select v-model="editModel.serialNumber" size="mini" style="display: inline-black" disabled :placeholder="$t('planMonitor.modifying.pleaseSelect')">
2020-08-14 18:30:04 +08:00
<el-option
2020-12-11 20:17:18 +08:00
v-for="item in serialNumberList"
2020-08-14 18:30:04 +08:00
:key="item.value"
:label="item.label"
2020-12-11 20:17:18 +08:00
:value="editModel.value"
2020-08-14 18:30:04 +08:00
/>
</el-select>
</el-col>
</el-row>
2020-12-11 20:17:18 +08:00
</el-col> -->
<!-- <el-col :span="2">
<el-row>
<el-col :offset="8" class="lineHeight">
<el-checkbox v-model="editModel.serialManual" size="mini">{{ $t('planMonitor.modifying.manual') }}</el-checkbox>
</el-col>
</el-row>
</el-col> -->
<el-col :span="6" class="lineHeight">
2020-08-14 18:30:04 +08:00
<el-row>
2020-12-11 20:17:18 +08:00
<el-col :span="10" :offset="1">
2020-08-14 18:30:04 +08:00
<span>{{ $t('planMonitor.modifying.startTime') }}</span>
</el-col>
2020-12-11 20:17:18 +08:00
<el-col :span="12">
2020-08-14 18:30:04 +08:00
<el-time-picker
v-model="editModel.startTime"
:placeholder="$t('planMonitor.modifying.selectTime')"
value-format="HH:mm:ss"
size="mini"
:clearable="false"
/>
</el-col>
</el-row>
</el-col>
2020-12-11 20:17:18 +08:00
<!-- <el-col :span="7" class="lineHeight">
2020-08-14 18:30:04 +08:00
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="editModel.inStock">{{ $t('planMonitor.modifying.inStock') }}</el-checkbox>
</el-col>
<el-col :span="8">
<el-checkbox v-model="editModel.outStock">{{ $t('planMonitor.modifying.outStock') }}</el-checkbox>
</el-col>
<el-col :span="6">
<el-checkbox v-model="editModel.lastTrain">{{ $t('planMonitor.modifying.lastTrain') }}</el-checkbox>
</el-col>
</el-row>
</el-col>
</el-row>
2020-12-11 20:17:18 +08:00
</el-col> -->
2020-08-14 18:30:04 +08:00
</el-row>
<el-row style="margin-bottom: 5px;">
{{ $t('planMonitor.modifying.route') }}
</el-row>
<el-row>
<el-table :data="routingList" border :height="140">
2020-08-14 18:30:04 +08:00
<el-table-column prop="startStationCode" :label="$t('planMonitor.modifying.startingStation')">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
2020-11-11 11:22:26 +08:00
<el-table-column prop="startSectionCode" :label="$t('planMonitor.modifying.startSection')">
<template slot-scope="scope">
{{ formatName(scope.row.startSectionCode) }}
</template>
</el-table-column>
2020-08-14 18:30:04 +08:00
<el-table-column prop="endStationCode" :label="$t('planMonitor.modifying.endStationTitle')">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
2020-11-11 11:22:26 +08:00
<el-table-column prop="endSectionCode" :label="$t('planMonitor.modifying.endSection')">
<template slot-scope="scope">
{{ formatName(scope.row.endSectionCode) }}
</template>
</el-table-column>
2020-08-14 18:30:04 +08:00
<el-table-column prop="remarks" :label="$t('planMonitor.modifying.description')" :width="315" />
<!-- <el-table-column :width="40" /> -->
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
{{ '经停转换轨 / 站台轨:' }}
2020-08-14 18:30:04 +08:00
</el-row>
<el-row>
<el-table :data="editModel.arriveConfigList" border :height="230">
<el-table-column prop="stationCode" :label="this.$t('planMonitor.station')">
2020-08-14 18:30:04 +08:00
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="sectionCode" :label="this.$t('planMonitor.section')">
2020-08-14 18:30:04 +08:00
<template slot-scope="scope">
{{ formatName(scope.row.sectionCode) }}
</template>
</el-table-column>
2020-12-11 20:17:18 +08:00
<el-table-column :label="this.$t('planMonitor.arriveTime')">
<template v-if="scope.$index!=0" slot-scope="scope">
{{ scope.row.arriveTime }}
</template>
</el-table-column>
<!-- prop="stopTime" -->
<el-table-column :label="this.$t('planMonitor.stopTime')">
2020-12-11 20:17:18 +08:00
<template v-if="scope.$index!=0&&scope.$index!=editModel.arriveConfigList.length-1" slot-scope="scope">
{{ scope.row.stopTime+'s' }}
<!-- <el-input v-model="scope.row.stopTime" placeholder="请输入时间" size="mini" @input="changeStopTime(scope.$index, scope.row.stopTime)" /> -->
</template>
</el-table-column>
<el-table-column :label="this.$t('planMonitor.departureTime')">
<template v-if="scope.$index!=editModel.arriveConfigList.length-1" slot-scope="scope">
{{ scope.row.departureTime }}
</template>
</el-table-column>
<el-table-column :label="this.$t('planMonitor.runLevel')">
<template slot-scope="scope">
2020-12-11 20:17:18 +08:00
<span style="font-size:13px;"> {{ scope.row.speedLevel }}</span>
<span>{{ '('+scope.row.speedLevelTime+'s)' }}</span>
<!-- <el-input v-model="scope.row.speedLevelTime" placeholder="请输入运行等级" size="mini" @input="changeSpeedLevelTime(scope.$index, scope.row.speedLevelTime)" /> -->
</template>
</el-table-column>
2020-08-14 18:30:04 +08:00
</el-table>
</el-row>
2020-12-11 20:17:18 +08:00
<!-- <el-row>
2020-08-14 18:30:04 +08:00
<el-col :offset="16">
<el-checkbox v-model="editModel.default">{{ $t('planMonitor.modifying.showDefaultTime') }}</el-checkbox>
</el-col>
2020-12-11 20:17:18 +08:00
</el-row> -->
2020-08-14 18:30:04 +08:00
<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>
2020-12-11 20:17:18 +08:00
import { getRoutingBySDTNumber, updatePlanTrip, getMapStationRunUser, getStationStopTime } from '@/api/runplan';
2020-08-14 18:30:04 +08:00
import { formatTime, formatName } from '@/utils/runPlan';
export default {
name: 'ModifyingTask',
components: {
},
props: {
loadRunPlanId: {
type: String,
default() {
return '';
}
}
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
PlanConvert: {},
parkSectionCodeList:[],
2020-08-14 18:30:04 +08:00
stopStationMap: {},
2020-12-11 20:17:18 +08:00
stopTimeMap:{},
// defaultStopTime: 0,
defaultSpeedLevel: 'l1',
routingList: [],
tripNumber: '',
serviceNumber: '',
planId: '',
2020-08-14 18:30:04 +08:00
editModel: {
routingCode: '',
endStationCode: '',
startStationCode: '',
2020-08-14 18:30:04 +08:00
startTime: '00:00:00',
endTime: '',
arriveConfigList: []
// serialNumber: '',
// trainManual: false,
// serialManual: false,
// clearGuest: false,
// continuationPlan: false,
// firstTrain: false,
// lastTrain: false,
// inStock: false,
// outStock: false
2020-08-14 18:30:04 +08:00
},
tripNumberList: [{ value: '', label: this.$t('planMonitor.modifying.automatic') }],
// defaultStopTimeList: [{ value: '', label: this.$t('planMonitor.modifying.default') }],
// defaultSpeedLevelList: [{ value: '', label: this.$t('planMonitor.modifying.default') }],
2020-12-11 20:17:18 +08:00
// serialNumberList: [],
defaultSpeedLevelList: [
{ value: 'l1', label: '等级一' },
{ value: 'l2', label: '等级二' },
{ value: 'l3', label: '等级三'},
{ value: 'l4', label: '等级四' },
{ value: 'l5', label: '等级五' }
]
2020-08-14 18:30:04 +08:00
};
},
computed: {
title() {
return this.$t('planMonitor.modifying.modifyTask');
}
},
watch: {
'editModel.startTime': function () {
this.computedDetailList();
},
2020-12-11 20:17:18 +08:00
// 'defaultStopTime': function () {
// this.computedDetailList('defaultStopTime');
// },
'defaultSpeedLevel': function () {
this.computedDetailList('defaultSpeedLevel');
2020-08-14 18:30:04 +08:00
}
},
methods: {
formatTime(time) {
return formatTime(time);
},
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-12-11 20:17:18 +08:00
} else if (stopStationObj[runLevel]) {
runTime = parseInt(stopStationObj[runLevel]);
2020-08-14 18:30:04 +08:00
}
}
}
return runTime;
},
computedDetailList(type = null) {
2020-08-14 18:30:04 +08:00
if (this.editModel.routingCode) {
const list = Object.assign([], this.editModel.arriveConfigList);
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000;
2020-12-11 20:17:18 +08:00
const runLevel = this.defaultSpeedLevel || 'l1'; // 默认等级三
list.forEach((elem, index) => {
2020-12-11 20:17:18 +08:00
// type == 'defaultStopTime' ||
if (type == 'routingCode') {
// elem.stopTime = parseInt(this.defaultStopTime);
if (this.stopTimeMap[elem.stationCode]) {
elem.stopTime = this.stopTimeMap[elem.stationCode].parkingTime;
} else {
elem.stopTime = 0;
}
}
// elem.arriveTime = index ? formatTime(tempTime) : '';
if (index) {
elem.arriveTime = formatTime(tempTime);
} else {
const time = tempTime || this.computedTimeByString('23:59:59') / 1000 + 1;
elem.arriveTime = formatTime(time - elem.stopTime);
}
if (index > 0) {
2020-12-11 20:17:18 +08:00
// elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + elem.stopTime);
elem.departureTime = formatTime(tempTime + elem.stopTime);
} else {
elem.departureTime = formatTime(tempTime);
}
const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
2020-12-11 20:17:18 +08:00
// if (!elem.speedLevelTime || type == 'defaultSpeedLevel') {
const realRunlevel = this.compuntedRunTime(list, index, runLevel);
elem.speedLevelTime = realRunlevel;
// }
// this.defaultSpeedLevel == 'l1' ? `(${runLevelObj.label})` : runLevelObj.label
elem.speedLevel = runLevelObj.label;
// elem.speedLevelTime = realRunlevel;
if (index > 0) {
tempTime = tempTime + elem.stopTime + elem.speedLevelTime;
} else {
tempTime = tempTime + elem.speedLevelTime;
2020-08-14 18:30:04 +08:00
}
});
this.editModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
2020-08-14 18:30:04 +08:00
}
},
loadInitData(params) {
const lineCode = this.$route.query.lineCode;
const mapId = this.$route.query.mapId;
this.isPlan = params.isPlan;
this.tripNumber = params.tripNumber;
this.serviceNumber = params.serviceNumber;
this.planId = this.loadRunPlanId;
2020-08-14 18:30:04 +08:00
this.PlanConvert = this.$theme.loadPlanConvert(lineCode);
if (mapId) {
2020-12-11 20:17:18 +08:00
getMapStationRunUser(mapId).then(resp => {
const list = resp.data.list;
2020-08-14 18:30:04 +08:00
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
2020-12-11 20:17:18 +08:00
getStationStopTime(mapId).then(response=>{
const stopTimeList = response.data.list;
stopTimeList.forEach(element=>{
this.stopTimeMap[element.stationCode] = {parkingTime:element.parkingTime};
});
this.initTaskData(params);
this.dialogShow = true;
});
2020-08-14 18:30:04 +08:00
});
}
2020-12-11 20:17:18 +08:00
},
initTaskData(params) {
if (params.rowData && params.rowData.arriveConfigList.length > 0) {
2020-12-11 20:17:18 +08:00
const paramData = params.rowData;
this.initRunlevel(paramData);
// const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.label == ; });
this.editModel.arriveConfigList = paramData.arriveConfigList;
this.editModel.routingCode = paramData.routingCode;
this.editModel.startStationCode = paramData.startStationCode;
this.editModel.endStationCode = paramData.endStationCode;
this.editModel.startTime = paramData.startTime;
this.editModel.endTime = paramData.endTime;
this.editModel.endSectionCode = paramData.endSectionCode;
this.editModel.startSectionCode = paramData.startSectionCode;
this.editModel.id = paramData.id;
this.routingList = [];
this.routingList.push({
2020-12-11 20:17:18 +08:00
code:paramData.routingCode,
startStationCode:paramData.startStationCode,
endStationCode:paramData.endStationCode,
endSectionCode:paramData.endSectionCode,
startSectionCode:paramData.startSectionCode
});
2020-08-14 18:30:04 +08:00
this.computedDetailList();
} else {
const model = {
planId: this.loadRunPlanId,
SDTNumber: `${this.serviceNumber}${this.tripNumber}`
};
this.routingList = [];
getRoutingBySDTNumber(model).then(resp => { // 根据车次号查询交路
// const routingObj = resp.data;
2020-11-11 11:22:26 +08:00
const editData = this.$store.state.runPlan.draftEditData[this.serviceNumber];
if (editData) {
const trainInfo = editData.trainMap[this.tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
this.routingList.push({
code:resp.data.code,
startStationCode:resp.data.startStationCode,
endStationCode:resp.data.endStationCode,
endSectionCode:resp.data.endSectionCode,
startSectionCode:resp.data.startSectionCode
});
2020-11-11 11:22:26 +08:00
let length = resp.data.parkSectionCodeList.length;
if ( length >= 4) {
if (resp.data.parkSectionCodeList[0].stationCode == resp.data.parkSectionCodeList[1].stationCode) {
resp.data.parkSectionCodeList.shift();
}
length = resp.data.parkSectionCodeList.length;
if (resp.data.parkSectionCodeList[length - 1].stationCode == resp.data.parkSectionCodeList[length - 2].stationCode) {
resp.data.parkSectionCodeList.pop();
}
}
this.editModel = {
tripNumber: this.tripNumber,
2020-11-11 11:22:26 +08:00
// startStationCode: resp.data.startStationCode,
startTime: formatTime(trainInfo.stationTimeList[1].secondTime + 7200),
2020-11-11 11:22:26 +08:00
// endStationCode: resp.data.endStationCode,
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime + 7200),
routingCode : resp.data.code,
2020-11-11 11:22:26 +08:00
// endSectionCode:resp.data.endSectionCode,
// startSectionCode:resp.data.startSectionCode,
arriveConfigList: []
// parkSectionCodeList
};
const newstationTimeList = [];
let current = {};
trainInfo.stationTimeList.forEach((stationTime, index)=>{
if (index % 2 == 0) {
current = {};
current.stationCode = stationTime.stationCode;
current.arriveTime = stationTime.secondTime;
} else {
current.departureTime = stationTime.secondTime;
newstationTimeList.push(current);
}
});
newstationTimeList.forEach((newstationTime, index)=>{
const newModel = {
sectionCode:resp.data.parkSectionCodeList[index].sectionCode,
stationCode:newstationTime.stationCode,
2020-12-11 20:17:18 +08:00
// speedLevel:'默认',
arriveTime: formatTime(newstationTime.arriveTime + 7200),
departureTime: formatTime(newstationTime.departureTime + 7200),
stopTime:newstationTime.departureTime - newstationTime.arriveTime
};
if (index < newstationTimeList.length - 1) {
newModel.speedLevelTime = newstationTimeList[index + 1].arriveTime - newstationTime.departureTime;
}
this.editModel.arriveConfigList.push(newModel);
});
2020-12-11 20:17:18 +08:00
this.initRunlevel(this.editModel);
this.dialogShow = true;
this.computedDetailList();
}
});
}
},
2020-12-11 20:17:18 +08:00
initRunlevel(paramData) {
const speedLevelData = this.stopStationMap[[paramData.arriveConfigList[0].sectionCode, paramData.arriveConfigList[1].sectionCode].toString()];
switch (paramData.arriveConfigList[0].speedLevelTime) {
case speedLevelData.l1: {
this.defaultSpeedLevel = 'l1';
break;
}
case speedLevelData.l2: {
this.defaultSpeedLevel = 'l2';
break;
}
case speedLevelData.l3: {
this.defaultSpeedLevel = 'l3';
break;
}
case speedLevelData.l4: {
this.defaultSpeedLevel = 'l4';
break;
}
case speedLevelData.l5: {
this.defaultSpeedLevel = 'l5';
break;
}
default: {
this.defaultSpeedLevel = 'l1';
break;
}
}
2020-08-14 18:30:04 +08:00
},
2020-12-11 20:17:18 +08:00
// changeStopTime(indexs, time) {
// let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000;
// // const runLevel = this.defaultSpeedLevel || 'l3'; // 默认等级三
// const arriveConfigList = Object.assign([], this.editModel.arriveConfigList);
// arriveConfigList.forEach((elem, index) => {
// 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);
// }
// const realRunlevel = elem.speedLevelTime;
// if (index > 0) {
// tempTime = tempTime + elem.stopTime + realRunlevel;
// } else {
// tempTime = tempTime + realRunlevel;
// }
// });
// this.editModel.arriveConfigList = arriveConfigList;
// this.editModel.endTime = formatTime(tempTime - this.editModel.arriveConfigList[this.editModel.arriveConfigList.length - 1].stopTime);
// },
// changeSpeedLevelTime(indexs, speedLevelTime) {
// const arriveConfigList = Object.assign([], this.editModel.arriveConfigList);
// let tempTime = this.computedTimeByString(this.editModel.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.editModel.arriveConfigList = arriveConfigList;
// this.editModel.endTime = formatTime(tempTime - this.editModel.arriveConfigList[this.editModel.arriveConfigList.length - 1].stopTime);
// },
2020-08-14 18:30:04 +08:00
doShow(params) {
this.loadInitData(params);
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
buildModel() {
return {
planId: this.loadRunPlanId,
2020-08-14 18:30:04 +08:00
routingCode: this.editModel.routingCode,
tripNumber: this.tripNumber,
2020-12-11 20:17:18 +08:00
// startTime: this.editModel.startTime,
startTime:this.editModel.arriveConfigList[0].arriveTime,
// endTime: this.editModel.endTime,
endTime: this.editModel.arriveConfigList[this.editModel.arriveConfigList.length - 1].departureTime,
2020-08-14 18:30:04 +08:00
arriveConfigList: this.editModel.arriveConfigList,
SDTNumber: `${this.serviceNumber}${this.tripNumber}`
2020-08-14 18:30:04 +08:00
};
},
handleCommit() {
if (this.isPlan) {
// 计划修改任务
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmUpdateTask', params: Object.assign({}, this.editModel) });
2020-08-14 18:30:04 +08:00
} else {
// 直接修改
updatePlanTrip(this.buildModel()).then(resp => {
// this.$emit('dispatchOperate', {
// dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
// });
2020-08-14 18:30:04 +08:00
this.$emit('refresh');
this.$message.success(this.$t('planMonitor.modifying.modifyTaskSuccess'));
}).catch(() => {
this.$messageBox(this.$t('planMonitor.modifying.modifyTaskFailed'));
});
}
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.lineHeight{
height: 28px;
line-height: 28px;
}
/deep/ {
.el-row {
margin-bottom: 5px !important;
}
.el-button+.el-button{
margin-left: 10px !important;
}
2020-08-14 18:30:04 +08:00
}
.add-task{
/deep/ {
.el-dialog__body{
padding: 0 20px;
}
.el-dialog .el-input {
width: 120px !important;
}
.dialog-footer{
display: flex;
justify-content: center;
}
}
}
</style>