修改页面不刷新的问题

This commit is contained in:
ival 2019-08-09 18:29:08 +08:00
parent bfddddf7e6
commit 763cff0a7c
15 changed files with 1418 additions and 1292 deletions

View File

@ -27,7 +27,7 @@ Vue.use(VueI18n);
Vue.config.productionTip = false;
export const i18n = new VueI18n({
locale: LangStorage.getLang('en'),
locale: LangStorage.getLang('zh'),
messages
});

View File

@ -9,9 +9,10 @@ const runPlan = {
planSizeCount: 0, // 运行图canvas 大小变更标识
planLoadedCount: 0, // 运行图数据更新
planUpdateCount: 0, // 运行图更新标识
selected: {}, // 选择的对象
selected: {}, // 选择的对象
width: 800, // 运行图canvas 容器 宽度
height: 600 // 运行图canvas 容器 高度
height: 600, // 运行图canvas 容器 高度
refreshCount: 0 // 刷新页面重新加载
},
getters: {
stations: (state) => {
@ -95,6 +96,9 @@ const runPlan = {
state.planData = {};
state.editData = {};
state.selected = {};
},
refresh: (state) => {
state.refreshCount++;
}
},
actions: {
@ -130,6 +134,10 @@ const runPlan = {
/** 清空数据*/
clear: ({ commit }) => {
commit('clear');
},
/** 刷新页面*/
refresh: ({commit}) => {
commit('refresh');
}
}
};

View File

@ -3,8 +3,8 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培
} else {

View File

@ -145,7 +145,7 @@ export default {
deletePlanService(model).then(resp => {
this.$message.success('删除计划成功');
this.$store.dispatch('runPlan/setSelected', {});
this.$refs.openRunPlan.loadRunPlanData(this.$route.query);
this.$refs.openRunPlan.loadRunPlanData(Object.assign({refresh: true}, this.$route.query));
}).catch(() => {
this.$messageBox('删除计划失败');
});

View File

@ -518,7 +518,8 @@ export default {
width: 260,
message: `真的要删除列车 ${serviceNumber} 吗?`,
operate: 'DeletePlanningTrain',
serviceNumber: serviceNumber
serviceNumber: serviceNumber,
refresh: true
}
});
} else {

View File

@ -1,80 +1,89 @@
<template>
<el-dialog class="planEdit__tool add-planning-train" :title="title" :visible.sync="dialogShow" width="260px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-col :span="6" :offset="3" style="height: 30px; line-height: 30px;">服务号</el-col>
<el-col :span="10" :offset="1">
<el-input v-model="serviceNumber" size="mini"></el-input>
</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 20px">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="planEdit__tool add-planning-train"
:title="title"
:visible.sync="dialogShow"
width="260px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-col :span="6" :offset="3" style="height: 30px; line-height: 30px;">服务号</el-col>
<el-col :span="10" :offset="1">
<el-input v-model="serviceNumber" size="mini" />
</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 20px">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { checkServiceNumberExist } from '@/api/runplan';
import { checkServiceNumberExist } from '@/api/runplan';
export default {
name: 'AddPlanningTrain',
data() {
return {
dialogShow: false,
loading: false,
serviceNumber: '',
}
},
computed: {
title() {
return '添加计划车'
}
},
mounted() {
},
methods: {
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
if (this.$route.query.planId) {
if (this.serviceNumber.length == 2) {
checkServiceNumberExist({ planId: this.$route.query.planId, serviceNumber: this.serviceNumber }).then(resp => {
if (resp.data) {
this.$emit('dispatchDialog', {
name: 'offLine',
params: {
type: 'warning',
operate: 'AddPlanningTrain',
width: 460,
message: '本表号已存在,是否强制设置?(强制设置程序可能会出现异常)',
}
})
export default {
name: 'AddPlanningTrain',
data() {
return {
dialogShow: false,
loading: false,
serviceNumber: ''
};
},
computed: {
title() {
return '添加计划车';
}
},
mounted() {
},
methods: {
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
if (this.$route.query.planId) {
if (this.serviceNumber.length == 2) {
checkServiceNumberExist({ planId: this.$route.query.planId, serviceNumber: this.serviceNumber }).then(resp => {
if (resp.data) {
this.$emit('dispatchDialog', {
name: 'offLine',
params: {
type: 'warning',
operate: 'AddPlanningTrain',
width: 460,
message: '本表号已存在,是否强制设置?(强制设置程序可能会出现异常)'
}
});
this.doClose();
} else {
this.handleConfirm();
}
})
} else {
this.$messageBox('长度应该为两位数');
}
} else {
this.$messageBox('请选打开运行图');
}
},
handleConfirm() {
this.doClose();
this.$store.dispatch('runPlan/addserviceNumber', this.serviceNumber);
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.serviceNumber } })
}
}
}
this.doClose();
} else {
this.handleConfirm();
}
});
} else {
this.$messageBox('长度应该为两位数');
}
} else {
this.$messageBox('请选打开运行图');
}
},
handleConfirm() {
this.doClose();
this.$store.dispatch('runPlan/addserviceNumber', this.serviceNumber);
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.serviceNumber } });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,294 +1,311 @@
<template>
<el-dialog class="planEdit__tool add-task" :title="title" :visible.sync="dialogShow" width="780px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div style="margin: 10px">
<el-row>
<el-col :span="3">
<el-radio v-model="addModel.addToFront" :label="true">加在最前</el-radio>
</el-col>
<el-col :span="4" style="margin-left: 10px">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="addModel.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-time-picker v-model="addModel.startTime" value-format="HH:mm:ss" :clearable="false">
</el-time-picker>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col :span="3">
<el-radio v-model="addModel.addToFront" :label="false">加在最后</el-radio>
</el-col>
<el-col :span="4" style="margin-left: 10px">
<span>缺省停站时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="addModel.defaultStopTime" placeholder="请选择">
<el-option v-for="item in defaultStopTimeList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<span>缺省运行等级</span>
</el-col>
<el-col :span="5">
<el-select v-model="addModel.defaultSpeedLevel" placeholder="请选择">
<el-option v-for="item in defaultSpeedLevelList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-dialog
v-dialogDrag
class="planEdit__tool add-task"
:title="title"
:visible.sync="dialogShow"
width="780px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="margin: 10px">
<el-row>
<el-col :span="3">
<el-radio v-model="addModel.addToFront" :label="true">加在最前</el-radio>
</el-col>
<el-col :span="4" style="margin-left: 10px">
<span>车次号</span>
</el-col>
<el-col :span="5">
<el-select v-model="addModel.tripNumber" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<span>开始时间</span>
</el-col>
<el-col :span="5">
<el-time-picker v-model="addModel.startTime" value-format="HH:mm:ss" :clearable="false" />
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col :span="3">
<el-radio v-model="addModel.addToFront" :label="false">加在最后</el-radio>
</el-col>
<el-col :span="4" style="margin-left: 10px">
<span>缺省停站时间</span>
</el-col>
<el-col :span="5">
<el-select v-model="addModel.defaultStopTime" placeholder="请选择">
<el-option
v-for="item in defaultStopTimeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<span>缺省运行等级</span>
</el-col>
<el-col :span="5">
<el-select v-model="addModel.defaultSpeedLevel" placeholder="请选择">
<el-option
v-for="item in defaultSpeedLevelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="addModel.routingList" border highlight-current-row @row-click="handleClick"
:height="180">
<el-table-column prop="startStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startSectionCode" label="起始区段">
<template slot-scope="scope">
{{ formatName(scope.row.startSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endSectionCode" label="终到区段">
<template slot-scope="scope">
{{ formatName(scope.row.endSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="remarks" label="描述">
</el-table-column>
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="addModel.arriveConfigList" border :height="180">
<el-table-column prop="stationCode" label="车站">
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="sectionCode" label="区段">
<template slot-scope="scope">
{{ formatName(scope.row.sectionCode) }}
</template>
</el-table-column>
<el-table-column prop="arriveTime" label="到点">
</el-table-column>
<el-table-column prop="stopTime" label="停站时间">
</el-table-column>
<el-table-column prop="departureTime" label="发点">
</el-table-column>
<el-table-column prop="speedLevel" label="运行等级">
</el-table-column>
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="showDefault">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row addToFront="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table
:data="addModel.routingList"
border
highlight-current-row
:height="180"
@row-click="handleClick"
>
<el-table-column prop="startStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startSectionCode" label="起始区段">
<template slot-scope="scope">
{{ formatName(scope.row.startSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endSectionCode" label="终到区段">
<template slot-scope="scope">
{{ formatName(scope.row.endSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="remarks" label="描述" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="addModel.arriveConfigList" border :height="180">
<el-table-column prop="stationCode" label="车站">
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="sectionCode" label="区段">
<template slot-scope="scope">
{{ formatName(scope.row.sectionCode) }}
</template>
</el-table-column>
<el-table-column prop="arriveTime" label="到点" />
<el-table-column prop="stopTime" label="停站时间" />
<el-table-column prop="departureTime" label="发点" />
<el-table-column prop="speedLevel" label="运行等级" />
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="showDefault">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row add-to-front="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { getRoutingList, querySectionListByRouting, getStationRunning, addPlanTrip } from '@/api/runplan';
import { formatTime, formatName } from '@/utils/runPlan';
import { getUID } from '@/jmap/utils/Uid';
import { getRoutingList, querySectionListByRouting, getStationRunning, addPlanTrip } from '@/api/runplan';
import { formatTime, formatName } from '@/utils/runPlan';
import { getUID } from '@/jmap/utils/Uid';
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
showDefault: true,
stopStationMap: {},
params: {},
addModel: {
taskIndex: '',
addToFront: false,
routingCode: '',
endStationCode: '',
startStationCode: '',
endSectionCode: '',
startSectionCode: '',
startTime: '00:00:00',
endTime: '',
planId: '',
tripNumber: '',
serviceNumber: '',
defaultStopTime: '',
defaultSpeedLevel: '',
routingList: [],
arriveConfigList: []
},
tripNumberList: [{ value: '', label: '自动' }],
defaultStopTimeList: [{ value: '', label: '默认' }],
defaultSpeedLevelList: [{ value: '', label: '默认' }],
}
},
computed: {
title() {
return '添加任务'
},
},
watch: {
'addModel.routingCode': function () {
this.computedDetailList();
},
'addModel.startTime': function () {
this.computedDetailList();
},
'addModel.defaultStopTime': function () {
this.computedDetailList();
},
'addModel.defaultSpeedLevel': function () {
this.computedDetailList();
}
},
methods: {
loadInitData(params) {
this.isPlan = params.isPlan;
this.addModel.taskIndex = getUID('task_');
this.addModel.serviceNumber = params.serviceNumber;
this.addModel.planId = this.$route.query.planId;
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
showDefault: true,
stopStationMap: {},
params: {},
addModel: {
taskIndex: '',
addToFront: false,
routingCode: '',
endStationCode: '',
startStationCode: '',
endSectionCode: '',
startSectionCode: '',
startTime: '00:00:00',
endTime: '',
planId: '',
tripNumber: '',
serviceNumber: '',
defaultStopTime: '',
defaultSpeedLevel: '',
routingList: [],
arriveConfigList: []
},
tripNumberList: [{ value: '', label: '自动' }],
defaultStopTimeList: [{ value: '', label: '默认' }],
defaultSpeedLevelList: [{ value: '', label: '默认' }]
};
},
computed: {
title() {
return '添加任务';
}
},
watch: {
'addModel.routingCode': function () {
this.computedDetailList();
},
'addModel.startTime': function () {
this.computedDetailList();
},
'addModel.defaultStopTime': function () {
this.computedDetailList();
},
'addModel.defaultSpeedLevel': function () {
this.computedDetailList();
}
},
methods: {
loadInitData(params) {
this.isPlan = params.isPlan;
this.addModel.taskIndex = getUID('task_');
this.addModel.serviceNumber = params.serviceNumber;
this.addModel.planId = this.$route.query.planId;
let planId = this.$route.query.planId;
if (planId) {
getRoutingList(planId).then(resp => {
this.addModel.routingList = resp.data;
})
}
const planId = this.$route.query.planId;
if (planId) {
getRoutingList(planId).then(resp => {
this.addModel.routingList = resp.data;
});
}
let skinStyle = this.$route.query.skinStyle;
if (skinStyle) {
getStationRunning(skinStyle).then(resp => {
let list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
})
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
formatName(code) {
return formatName(code);
},
computedTimeByString(timeStr) {
let bTime = +new Date(`2019-01-01 00:00:00`);
let eTime = +new Date(`2019-01-01 ${timeStr}`);
return Number(eTime) - Number(bTime);
},
compuntedRunTime(list, index, runLevel) {
let runTime = 0;
if (index < list.length - 1) {
let stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (stopStationObj) {
if (stopStationObj.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
} else {
this.$messageBox(`请先设置开始区段 ${stopStationObj.startSectionCode} 终到区段 ${stopStationObj.endSectionCode} 的站间运行时间`);
}
}
}
const skinStyle = this.$route.query.skinStyle;
if (skinStyle) {
getStationRunning(skinStyle).then(resp => {
const list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
});
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
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]);
} else {
this.$messageBox(`请先设置开始区段 ${stopStationObj.startSectionCode} 终到区段 ${stopStationObj.endSectionCode} 的站间运行时间`);
}
}
}
return runTime;
},
computedDetailList() {
if (this.addModel.routingCode) {
querySectionListByRouting({ planId: this.$route.query.planId, routingCode: this.addModel.routingCode }).then(resp => {
let list = resp.data;
let waitTime = this.addModel.defaultStopTime || 30; //
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000 - 30;
let runLevel = this.addModel.defaultSpeedLevel || 'level3'; //
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.stopTime = this.addModel.defaultSpeedLevel || '默认';
elem.speedLevel = this.addModel.defaultStopTime || '默认';
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});
return runTime;
},
computedDetailList() {
if (this.addModel.routingCode) {
querySectionListByRouting({ planId: this.$route.query.planId, routingCode: this.addModel.routingCode }).then(resp => {
const list = resp.data;
const waitTime = this.addModel.defaultStopTime || 30; //
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000 - 30;
const runLevel = this.addModel.defaultSpeedLevel || 'level3'; //
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.stopTime = this.addModel.defaultSpeedLevel || '默认';
elem.speedLevel = this.addModel.defaultStopTime || '默认';
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});
// let startSection = this.$store.getters['map/getDeviceByCode'](this.addModel.startSectionCode);
// if (startSection && startSection.isReentryTrack) {
// list.shift();
// }
// let startSection = this.$store.getters['map/getDeviceByCode'](this.addModel.startSectionCode);
// if (startSection && startSection.isReentryTrack) {
// list.shift();
// }
// let endSection = this.$store.getters['map/getDeviceByCode'](this.addModel.endSectionCode);
// if (endSection && endSection.isReentryTrack) {
// list.pop();
// }
// let endSection = this.$store.getters['map/getDeviceByCode'](this.addModel.endSectionCode);
// if (endSection && endSection.isReentryTrack) {
// list.pop();
// }
this.addModel.arriveConfigList = list;
this.addModel.endTime = formatTime(tempTime - waitTime);
})
}
},
handleClick(row, column, event) {
this.addModel.startStationCode = row.startStationCode;
this.addModel.endStationCode = row.endStationCode;
this.addModel.startSectionCode = row.startSectionCode;
this.addModel.endSectionCode = row.endSectionCode;
this.addModel.routingCode = row.code;
},
handleCommit() {
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmAddTask', params: Object.assign({}, this.addModel) })
} else {
//
addPlanTrip(this.addModel).then(resp => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: this.$route.query
});
this.$message.success('添加任务成功!');
}).catch(error => {
this.$messageBox('添加任务失败');
})
}
this.addModel.arriveConfigList = list;
this.addModel.endTime = formatTime(tempTime - waitTime);
});
}
},
handleClick(row, column, event) {
this.addModel.startStationCode = row.startStationCode;
this.addModel.endStationCode = row.endStationCode;
this.addModel.startSectionCode = row.startSectionCode;
this.addModel.endSectionCode = row.endSectionCode;
this.addModel.routingCode = row.code;
},
handleCommit() {
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmAddTask', params: Object.assign({}, this.addModel) });
} else {
//
addPlanTrip(this.addModel).then(resp => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
});
this.$message.success('添加任务成功!');
}).catch(() => {
this.$messageBox('添加任务失败');
});
}
this.doClose();
}
}
}
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,79 +1,88 @@
<template>
<el-dialog class="planEdit__tool create-empty-plan" :title="title" :visible.sync="dialogShow" width="420px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-form ref="form" :model="addModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input autofocus v-model="addModel.name"></el-input>
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="planEdit__tool create-empty-plan"
:title="title"
:visible.sync="dialogShow"
width="420px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-form ref="form" :model="addModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item label="运行图名称:" prop="name">
<el-input v-model="addModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { createEmptyPlan } from '@/api/runplan';
import { createEmptyPlan } from '@/api/runplan';
export default {
name: 'CreateEmptyPlan',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
addModel: {
name: '',
skinStyle: this.$route.query.skinStyle,
}
}
},
computed: {
title() {
return '创建空运行图数据'
},
rules() {
return {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
}
}
},
methods: {
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.$refs['form'].validate((valid) => {
if (valid) {
createEmptyPlan(this.addModel).then(resp => {
let params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinStyle: this.$route.query.skinStyle, planName: this.addModel.name }
}
export default {
name: 'CreateEmptyPlan',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
addModel: {
name: '',
skinStyle: this.$route.query.skinStyle
}
};
},
computed: {
title() {
return '创建空运行图数据';
},
rules() {
return {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
};
}
},
methods: {
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.$refs['form'].validate((valid) => {
if (valid) {
createEmptyPlan(this.addModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinStyle: this.$route.query.skinStyle, planName: this.addModel.name, refresh: true }
};
this.$emit('dispatchOperate', params)
this.$message.success('创建空运行图成功!');
this.doClose();
}).catch(error => {
this.$messageBox('创建空运行图失败');
this.doClose();
})
}
});
}
}
}
this.$emit('dispatchOperate', params);
this.$message.success('创建空运行图成功!');
this.doClose();
}).catch(() => {
this.$messageBox('创建空运行图失败');
this.doClose();
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,84 +1,93 @@
<template>
<el-dialog class="planEdit__tool delete-task" :title="title" :visible.sync="dialogShow" width="400px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-radio v-model="model.deleteBefore" :label="true">删除以前所有任务包含本任务</el-radio>
</el-row>
<el-row>
<el-radio v-model="model.deleteBefore" :label="false">删除以后所有任务包含本任务</el-radio>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<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">删除以前所有任务包含本任务</el-radio>
</el-row>
<el-row>
<el-radio v-model="model.deleteBefore" :label="false">删除以后所有任务包含本任务</el-radio>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { deletePlanTrip } from '@/api/runplan';
import { deletePlanTrip } from '@/api/runplan';
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
model: {
taskIndex: '',
deleteBefore: false,
tripNumber: '',
serviceNumber: '',
},
}
},
computed: {
title() {
return '删除任务'
}
},
mounted() {
},
methods: {
doShow(params) {
this.isPlan = params.isPlan;
this.model.taskIndex = params.taskIndex;
this.model.tripNumber = params.tripNumber;
this.model.serviceNumber = params.serviceNumber;
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 {
//
let model = {
planId: this.$route.query.planId,
SDTNumber: `${this.model.serviceNumber}${this.model.tripNumber}`,
deleteBefore: this.model.deleteBefore
}
export default {
name: 'DeleteTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
model: {
taskIndex: '',
deleteBefore: false,
tripNumber: '',
serviceNumber: ''
}
};
},
computed: {
title() {
return '删除任务';
}
},
mounted() {
},
methods: {
doShow(params) {
this.isPlan = params.isPlan;
this.model.taskIndex = params.taskIndex;
this.model.tripNumber = params.tripNumber;
this.model.serviceNumber = params.serviceNumber;
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('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: this.$route.query
});
this.$message.success('删除任务成功!');
}).catch(error => {
this.$messageBox('删除任务失败');
})
}
this.doClose();
}
}
}
deletePlanTrip(model).then(resp => {
this.$store.dispatch('runPlan/setSelected', {});
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
});
this.$message.success('删除任务成功!');
}).catch(() => {
this.$messageBox('删除任务失败');
});
}
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,82 +1,91 @@
<template>
<el-dialog class="planEdit__tool duplicate-train" :title="title" :visible.sync="dialogShow" width="420px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row type="flex" justify="center">
<el-radio-group v-model="model.forward">
<el-radio :label="true">向前</el-radio>
<el-radio :label="false">向后</el-radio>
</el-radio-group>
</el-row>
<el-row style="margin-top: 20px">
<el-col :span="5" :offset="4">次数</el-col>
<el-col :span="10">
<el-input-number v-model="model.times" size="mini" controls-position="right"></el-input-number>
</el-col>
</el-row>
<el-row style="margin: 10px 0px">
<el-col :span="5" :offset="4">间隔时间</el-col>
<el-col :span="10">
<el-input-number v-model="model.intervals" size="mini" controls-position="right"></el-input-number>
<span></span>
</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 20px">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="planEdit__tool duplicate-train"
:title="title"
:visible.sync="dialogShow"
width="420px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row type="flex" justify="center">
<el-radio-group v-model="model.forward">
<el-radio :label="true">向前</el-radio>
<el-radio :label="false">向后</el-radio>
</el-radio-group>
</el-row>
<el-row style="margin-top: 20px">
<el-col :span="5" :offset="4">次数</el-col>
<el-col :span="10">
<el-input-number v-model="model.times" size="mini" controls-position="right" />
</el-col>
</el-row>
<el-row style="margin: 10px 0px">
<el-col :span="5" :offset="4">间隔时间</el-col>
<el-col :span="10">
<el-input-number v-model="model.intervals" size="mini" controls-position="right" />
<span></span>
</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 20px">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { duplicateService } from '@/api/runplan';
import { duplicateService } from '@/api/runplan';
export default {
name: 'DuplicateTrain',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
serviceNumber: '',
forward: false,
times: 0,
intervals: 0,
}
}
},
computed: {
title() {
return '复制列车'
}
},
mounted() {
},
methods: {
doShow(params) {
this.model.serviceNumber = params.serviceNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.model['planId'] = this.$route.query.planId;
this.model['serviceNumber'] = this.model.serviceNumber;
this.doClose();
duplicateService(this.model).then(resp => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: this.$route.query
});
this.$message.success('复制计划成功!');
}).catch(error => {
this.$messageBox('复制计划失败');
})
}
}
}
export default {
name: 'DuplicateTrain',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
model: {
serviceNumber: '',
forward: false,
times: 0,
intervals: 0
}
};
},
computed: {
title() {
return '复制列车';
}
},
mounted() {
},
methods: {
doShow(params) {
this.model.serviceNumber = params.serviceNumber;
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.model['planId'] = this.$route.query.planId;
this.model['serviceNumber'] = this.model.serviceNumber;
this.doClose();
duplicateService(this.model).then(resp => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
});
this.$message.success('复制计划成功!');
}).catch(() => {
this.$messageBox('复制计划失败');
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,211 +1,224 @@
<template>
<el-dialog class="planEdit__tool edit-planning-train" :title="title" :visible.sync="dialogShow" width="800px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-row>
<el-col :span="3"> 表号 </el-col>
<el-col :span="4">
<el-input v-model="model.serviceNumber" disabled size="mini"></el-input>
</el-col>
<el-col :span="4" :offset="1">
<el-checkbox v-model="model.debugTrain">调试车</el-checkbox>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
任务
</el-row>
<el-row>
<div style=" float: left; width: 78%">
<el-table :data="model.tripConfigList" highlight-current-row @current-change="handleCurrentChange"
border :height="380">
<el-table-column prop="beginStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startTime" label="起始时间">
<template slot-scope="scope">
{{ scope.row.startTime}}
</template>
</el-table-column>
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endTime" label="终到时间">
<template slot-scope="scope">
{{ scope.row.endTime }}
</template>
</el-table-column>
<el-table-column width="20">
</el-table-column>
</el-table>
</div>
<div style="float: right; width: 22%">
<el-button class="view-button" :disabled="disabled" @click="handleEditTask">编辑任务</el-button>
<el-button class="view-button" :disabled="disabled" @click="handleAddTask">
增加任务
</el-button>
<el-button class="view-button" :disabled="disabled" @click="handleDeleteTask">删除任务</el-button>
<el-button class="view-button" :disabled="disabled" @click="handleCommit">确定</el-button>
</div>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="planEdit__tool edit-planning-train"
:title="title"
:visible.sync="dialogShow"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-col :span="3"> 表号 </el-col>
<el-col :span="4">
<el-input v-model="model.serviceNumber" disabled size="mini" />
</el-col>
<el-col :span="4" :offset="1">
<el-checkbox v-model="model.debugTrain">调试车</el-checkbox>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
任务
</el-row>
<el-row>
<div style=" float: left; width: 78%">
<el-table
:data="model.tripConfigList"
highlight-current-row
border
:height="380"
@current-change="handleCurrentChange"
>
<el-table-column prop="beginStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startTime" label="起始时间">
<template slot-scope="scope">
{{ scope.row.startTime }}
</template>
</el-table-column>
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endTime" label="终到时间">
<template slot-scope="scope">
{{ scope.row.endTime }}
</template>
</el-table-column>
<el-table-column width="20" />
</el-table>
</div>
<div style="float: right; width: 22%">
<el-button class="view-button" :disabled="disabled" @click="handleEditTask">编辑任务</el-button>
<el-button class="view-button" :disabled="disabled" @click="handleAddTask">
增加任务
</el-button>
<el-button class="view-button" :disabled="disabled" @click="handleDeleteTask">删除任务</el-button>
<el-button class="view-button" :disabled="disabled" @click="handleCommit">确定</el-button>
</div>
</el-row>
</el-dialog>
</template>
<script>
import { formatName, formatTime } from '@/utils/runPlan';
import { addPlanService } from '@/api/runplan';
import { getUID } from '@/jmap/utils/Uid';
import { formatName, formatTime } from '@/utils/runPlan';
import { addPlanService } from '@/api/runplan';
import { getUID } from '@/jmap/utils/Uid';
export default {
name: 'EditPlanningTrain',
data() {
return {
dialogShow: false,
loading: false,
currentRow: {},
model: {
serviceNumber: '',
debugTrain: false,
tripConfigList: [],
}
}
},
computed: {
title() {
return '编辑计划车'
},
disabled() {
return !this.model.serviceNumber;
}
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
loadInitData(params) {
this.model.planId = this.$route.query.planId;
this.model.serviceNumber = params.serviceNumber;
this.model.tripConfigList = [];
let editData = this.$store.state.runPlan.editData[params.serviceNumber]
if (editData) {
let tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex });
tripNumberList.forEach(tripNumber => {
let trainInfo = editData.trainMap[tripNumber];
let lastIndex = trainInfo.stationTimeList.length - 1;
let taskObj = {
taskIndex: getUID('task_'),
tripNumber: tripNumber,
startStationCode: trainInfo.stationTimeList[0].stationCode,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime),
endStationCode: trainInfo.stationTimeList[lastIndex].stationCode,
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime),
arriveConfigList: []
}
// console.log(editData.trainMap[tripNumber]);
this.model.tripConfigList.push(taskObj);
})
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCurrentChange(val) {
this.currentRow = val || {};
},
handleAddTask() {
this.$emit('dispatchDialog', {
name: 'addTask', params: {
isPlan: true,
taskIndex: this.currentRow.taskIndex,
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
})
},
handleEditTask() {
if (this.currentRow.taskIndex) {
this.$emit('dispatchDialog', {
name: 'modifyingTask', params: {
isPlan: true,
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
})
} else {
this.$messageBox('请选择一条数据');
}
},
handleDeleteTask() {
if (this.currentRow.taskIndex) {
this.$emit('dispatchDialog', {
name: 'deleteTask', params: {
isPlan: true,
taskIndex: this.currentRow.taskIndex,
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
})
} else {
this.$messageBox('请选择一条数据');
}
},
handleConfirmAddTask(model) {
// let index = this.model.tripConfigList.findIndex(
// elem => { return elem.taskIndex == this.currentRow.taskIndex }
// );
export default {
name: 'EditPlanningTrain',
data() {
return {
dialogShow: false,
loading: false,
currentRow: {},
model: {
serviceNumber: '',
debugTrain: false,
tripConfigList: []
}
};
},
computed: {
title() {
return '编辑计划车';
},
disabled() {
return !this.model.serviceNumber;
}
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
loadInitData(params) {
this.model.planId = this.$route.query.planId;
this.model.serviceNumber = params.serviceNumber;
this.model.tripConfigList = [];
const editData = this.$store.state.runPlan.editData[params.serviceNumber];
if (editData) {
const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; });
tripNumberList.forEach(tripNumber => {
const trainInfo = editData.trainMap[tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
const taskObj = {
taskIndex: getUID('task_'),
tripNumber: tripNumber,
startStationCode: trainInfo.stationTimeList[0].stationCode,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime),
endStationCode: trainInfo.stationTimeList[lastIndex].stationCode,
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime),
arriveConfigList: []
};
// console.log(editData.trainMap[tripNumber]);
this.model.tripConfigList.push(taskObj);
});
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCurrentChange(val) {
this.currentRow = val || {};
},
handleAddTask() {
this.$emit('dispatchDialog', {
name: 'addTask', params: {
isPlan: true,
taskIndex: this.currentRow.taskIndex,
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
});
},
handleEditTask() {
if (this.currentRow.taskIndex) {
this.$emit('dispatchDialog', {
name: 'modifyingTask', params: {
isPlan: true,
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
});
} else {
this.$messageBox('请选择一条数据');
}
},
handleDeleteTask() {
if (this.currentRow.taskIndex) {
this.$emit('dispatchDialog', {
name: 'deleteTask', params: {
isPlan: true,
taskIndex: this.currentRow.taskIndex,
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
});
} else {
this.$messageBox('请选择一条数据');
}
},
handleConfirmAddTask(model) {
// let index = this.model.tripConfigList.findIndex(
// elem => { return elem.taskIndex == this.currentRow.taskIndex }
// );
// if (index >= 0) {
// if (!model.addToFront) {
// index += 1;
// }
// if (index >= 0) {
// if (!model.addToFront) {
// index += 1;
// }
// this.model.tripConfigList = [...this.model.tripConfigList.slice(0, index), model, ...this.model.tripConfigList.slice(index)]
// } else {
// this.model.tripConfigList.push(model);
// }
// this.model.tripConfigList = [...this.model.tripConfigList.slice(0, index), model, ...this.model.tripConfigList.slice(index)]
// } else {
// this.model.tripConfigList.push(model);
// }
if (model.addToFront) {
this.model.tripConfigList = [model, ...this.model.tripConfigList];
} else {
this.model.tripConfigList.push(model);
}
},
handleConfirmDeleteTask(model) {
let index = this.model.tripConfigList.findIndex(
elem => { return elem.taskIndex == this.currentRow.taskIndex }
);
if (model.addToFront) {
this.model.tripConfigList = [model, ...this.model.tripConfigList];
} else {
this.model.tripConfigList.push(model);
}
},
handleConfirmDeleteTask(model) {
const index = this.model.tripConfigList.findIndex(
elem => { return elem.taskIndex == this.currentRow.taskIndex; }
);
if (index >= 0) {
if (model.addToFront) {
this.model.tripConfigList = this.model.tripConfigList.slice(index + 1);
} else {
this.model.tripConfigList = this.model.tripConfigList.slice(0, index);
}
}
},
handleCommit() {
this.doClose();
addPlanService(this.model).then(() => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: this.$route.query
});
this.$message.success('创建计划成功');
}).catch(error => {
this.$messageBox('创建计划失败');
})
}
}
}
if (index >= 0) {
if (model.addToFront) {
this.model.tripConfigList = this.model.tripConfigList.slice(index + 1);
} else {
this.model.tripConfigList = this.model.tripConfigList.slice(0, index);
}
}
},
handleCommit() {
this.doClose();
addPlanService(this.model).then(() => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
});
this.$message.success('创建计划成功');
}).catch(() => {
this.$messageBox('创建计划失败');
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,396 +1,418 @@
<template>
<el-dialog class="planEdit__tool add-task" :title="title" :visible.sync="dialogShow" width="1000px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div style="margin: 10px">
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>车次号</span>
</el-col>
<el-col :span="15">
<el-select style="display: inline-black" v-model="editModel.tripNumber" placeholder="请选择">
<el-option v-for="item in tripNumberList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-dialog
v-dialogDrag
class="planEdit__tool add-task"
:title="title"
:visible.sync="dialogShow"
width="1000px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="margin: 10px">
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>车次号</span>
</el-col>
<el-col :span="15">
<el-select v-model="editModel.tripNumber" style="display: inline-black" placeholder="请选择">
<el-option
v-for="item in tripNumberList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="8">
<el-checkbox v-model="editModel.trainManual">手工</el-checkbox>
</el-col>
</el-row>
</el-col>
<el-col :span="6">
<el-row>
<el-col :span="11" :offset="1">
<span>缺省停站时间</span>
</el-col>
<el-col :span="12">
<el-select
v-model="editModel.defaultStopTime"
style="display: inline-black"
placeholder="请选择"
>
<el-option
v-for="item in defaultStopTimeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>表号</span>
</el-col>
<el-col :span="13">
<el-input v-model="editModel.serviceNumber" />
</el-col>
</el-row>
</el-col>
<el-col :span="7">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="editModel.clearGuest">清客</el-checkbox>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="8">
<el-checkbox v-model="editModel.trainManual">手工</el-checkbox>
</el-col>
</el-row>
<el-col :span="8">
<el-checkbox v-model="editModel.continuationPlan">延续计划</el-checkbox>
</el-col>
<el-col :span="6">
<el-row>
<el-col :span="11" :offset="1">
<span>缺省停站时间</span>
</el-col>
<el-col :span="12">
<el-select style="display: inline-black" v-model="editModel.defaultStopTime"
placeholder="请选择">
<el-option v-for="item in defaultStopTimeList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-checkbox v-model="editModel.firstTrain">首班车</el-checkbox>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>表号</span>
</el-col>
<el-col :span="13">
<el-input v-model="editModel.serviceNumber"></el-input>
</el-col>
</el-row>
</el-row>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>序列号</span>
</el-col>
<el-col :span="15">
<el-select v-model="editModel.serialNumber" style="display: inline-black" placeholder="请选择">
<el-option
v-for="item in serialNumberList"
:key="item.value"
:label="item.label"
:value="editModel.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="8">
<el-checkbox v-model="editModel.serialManual">手工</el-checkbox>
</el-col>
</el-row>
</el-col>
<el-col :span="6">
<el-row>
<el-col :span="11" :offset="1">
<span>缺省运行等级</span>
</el-col>
<el-col :span="12">
<el-select
v-model="editModel.defaultSpeedLevel"
style="display: inline-black"
placeholder="请选择"
>
<el-option
v-for="item in defaultSpeedLevelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>开始时间</span>
</el-col>
<el-col :span="13">
<el-time-picker
v-model="editModel.startTime"
placeholder="选择时间"
value-format="HH:mm:ss"
:clearable="false"
/>
</el-col>
</el-row>
</el-col>
<el-col :span="7">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="editModel.inStock">入库</el-checkbox>
</el-col>
<el-col :span="7">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="editModel.clearGuest">清客</el-checkbox>
</el-col>
<el-col :span="8">
<el-checkbox v-model="editModel.continuationPlan">延续计划</el-checkbox>
</el-col>
<el-col :span="6">
<el-checkbox v-model="editModel.firstTrain">首班车</el-checkbox>
</el-col>
</el-row>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-row>
<el-col :span="9">
<span>序列号</span>
</el-col>
<el-col :span="15">
<el-select style="display: inline-black" v-model="editModel.serialNumber" placeholder="请选择">
<el-option v-for="item in serialNumberList" :key="item.value" :label="item.label"
:value="editModel.value">
</el-option>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-row>
<el-col :offset="8">
<el-checkbox v-model="editModel.serialManual">手工</el-checkbox>
</el-col>
</el-row>
<el-col :span="8">
<el-checkbox v-model="editModel.outStock">出库</el-checkbox>
</el-col>
<el-col :span="6">
<el-row>
<el-col :span="11" :offset="1">
<span>缺省运行等级</span>
</el-col>
<el-col :span="12">
<el-select style="display: inline-black" v-model="editModel.defaultSpeedLevel"
placeholder="请选择">
<el-option v-for="item in defaultSpeedLevelList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-row>
<el-checkbox v-model="editModel.lastTrain">末班车</el-checkbox>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="9" :offset="2">
<span>开始时间</span>
</el-col>
<el-col :span="13">
<el-time-picker v-model="editModel.startTime" placeholder="选择时间" value-format="HH:mm:ss"
:clearable="false">
</el-time-picker>
</el-col>
</el-row>
</el-col>
<el-col :span="7">
<el-row>
<el-col :span="22" :offset="2">
<el-row>
<el-col :span="6">
<el-checkbox v-model="editModel.inStock">入库</el-checkbox>
</el-col>
<el-col :span="8">
<el-checkbox v-model="editModel.outStock">出库</el-checkbox>
</el-col>
<el-col :span="6">
<el-checkbox v-model="editModel.lastTrain">末班车</el-checkbox>
</el-col>
</el-row>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="editModel.routingList" border :height="140">
<el-table-column prop="startStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startSectionCode" label="起始区段">
</el-table-column>
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endSectionCode" label="终到区段">
</el-table-column>
<el-table-column prop="remarks" label="描述" :width="280">
</el-table-column>
<el-table-column :width="40">
</el-table-column>
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="editModel.arriveConfigList" border :height="180">
<el-table-column prop="stationCode" label="车站">
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="sectionCode" label="区段">
<template slot-scope="scope">
{{ formatName(scope.row.sectionCode) }}
</template>
</el-table-column>
<el-table-column prop="arriveTime" label="到点">
</el-table-column>
<el-table-column prop="stopTime" label="停站时间">
</el-table-column>
<el-table-column prop="departureTime" label="发点">
</el-table-column>
<el-table-column prop="speedLevel" label="运行等级">
</el-table-column>
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="editModel.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</el-row>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
交路
</el-row>
<el-row>
<el-table :data="editModel.routingList" border :height="140">
<el-table-column prop="startStationCode" label="起始站">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startSectionCode" label="起始区段" />
<el-table-column prop="endStationCode" label="终到站">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endSectionCode" label="终到区段" />
<el-table-column prop="remarks" label="描述" :width="280" />
<el-table-column :width="40" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
详情
</el-row>
<el-row>
<el-table :data="editModel.arriveConfigList" border :height="180">
<el-table-column prop="stationCode" label="车站">
<template slot-scope="scope">
{{ formatName(scope.row.stationCode) }}
</template>
</el-table-column>
<el-table-column prop="sectionCode" label="区段">
<template slot-scope="scope">
{{ formatName(scope.row.sectionCode) }}
</template>
</el-table-column>
<el-table-column prop="arriveTime" label="到点" />
<el-table-column prop="stopTime" label="停站时间" />
<el-table-column prop="departureTime" label="发点" />
<el-table-column prop="speedLevel" label="运行等级" />
</el-table>
</el-row>
<el-row>
<el-col :offset="16">
<el-checkbox v-model="editModel.default">显示默认停站时间和运行等级</el-checkbox>
</el-col>
</el-row>
</div>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { getRoutingBySDTNumber, querySectionListByRouting, getRoutingList, getStationRunning, updatePlanTrip } from '@/api/runplan';
import { formatTime, formatName } from '@/utils/runPlan';
import { getRoutingBySDTNumber, querySectionListByRouting, getStationRunning, updatePlanTrip } from '@/api/runplan';
import { formatTime, formatName } from '@/utils/runPlan';
export default {
name: 'ModifyingTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
PlanConvert: {},
stopStationMap: {},
editModel: {
taskIndex: '',
routingCode: '',
defaultStopTime: '',
defaultSpeedLevel: '',
tripNumber: '',
serviceNumber: '',
startTime: '00:00:00',
endTime: '',
routingList: [],
arriveConfigList: [],
export default {
name: 'ModifyingTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
PlanConvert: {},
stopStationMap: {},
editModel: {
taskIndex: '',
routingCode: '',
defaultStopTime: '',
defaultSpeedLevel: '',
tripNumber: '',
serviceNumber: '',
startTime: '00:00:00',
endTime: '',
routingList: [],
arriveConfigList: [],
serialNumber: '',
trainManual: false,
serialManual: false,
clearGuest: false,
continuationPlan: false,
firstTrain: false,
lastTrain: false,
inStock: false,
outStock: false,
},
tripNumberList: [{ value: '', label: '自动' }],
defaultStopTimeList: [{ value: '', label: '默认' }],
defaultSpeedLevelList: [{ value: '', label: '默认' }],
serialNumberList: [],
}
},
computed: {
title() {
return '修改任务'
}
},
watch: {
'editModel.startTime': function () {
this.computedDetailList();
},
'editModel.defaultStopTime': function () {
this.computedDetailList();
},
'editModel.defaultSpeedLevel': function () {
this.computedDetailList();
}
},
methods: {
formatTime(time) {
return formatTime(time);
},
formatName(code) {
return formatName(code);
},
computedTimeByString(timeStr) {
let bTime = +new Date(`2019-01-01 00:00:00`);
let eTime = +new Date(`2019-01-01 ${timeStr}`);
return Number(eTime) - Number(bTime);
},
compuntedRunTime(list, index, runLevel) {
let runTime = 0;
if (index < list.length - 1) {
let stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (stopStationObj) {
if (stopStationObj.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
} else {
this.$messageBox(`请先设置开始区段 ${stopStationObj.startSectionCode} 终到区段 ${stopStationObj.endSectionCode} 的站间运行时间`);
}
}
}
serialNumber: '',
trainManual: false,
serialManual: false,
clearGuest: false,
continuationPlan: false,
firstTrain: false,
lastTrain: false,
inStock: false,
outStock: false
},
tripNumberList: [{ value: '', label: '自动' }],
defaultStopTimeList: [{ value: '', label: '默认' }],
defaultSpeedLevelList: [{ value: '', label: '默认' }],
serialNumberList: []
};
},
computed: {
title() {
return '修改任务';
}
},
watch: {
'editModel.startTime': function () {
this.computedDetailList();
},
'editModel.defaultStopTime': function () {
this.computedDetailList();
},
'editModel.defaultSpeedLevel': function () {
this.computedDetailList();
}
},
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]);
} else {
this.$messageBox(`请先设置开始区段 ${stopStationObj.startSectionCode} 终到区段 ${stopStationObj.endSectionCode} 的站间运行时间`);
}
}
}
return runTime;
},
computedDetailList() {
this.editModel.arriveConfigList = [];
if (this.editModel.routingCode) {
querySectionListByRouting({ planId: this.$route.query.planId, routingCode: this.editModel.routingCode }).then(rest => {
let list = rest.data;
let waitTime = this.editModel.defaultStopTime || 30; //
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000 - 30;
let runLevel = this.editModel.defaultSpeedLevel || 'level3'; //
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.stopTime = this.editModel.defaultSpeedLevel || '默认';
elem.speedLevel = this.editModel.defaultStopTime || '默认';
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});
return runTime;
},
computedDetailList() {
this.editModel.arriveConfigList = [];
if (this.editModel.routingCode) {
querySectionListByRouting({ planId: this.$route.query.planId, routingCode: this.editModel.routingCode }).then(rest => {
const list = rest.data;
const waitTime = this.editModel.defaultStopTime || 30; //
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000 - 30;
const runLevel = this.editModel.defaultSpeedLevel || 'level3'; //
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.stopTime = this.editModel.defaultSpeedLevel || '默认';
elem.speedLevel = this.editModel.defaultStopTime || '默认';
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});
if (this.editModel.routingList && this.editModel.routingList.length > 0) {
let row = this.editModel.routingList[0];
let startSection = this.$store.getters['map/getDeviceByCode'](row.startSectionCode);
if (startSection && startSection.isReentryTrack) {
list.shift();
}
if (this.editModel.routingList && this.editModel.routingList.length > 0) {
const row = this.editModel.routingList[0];
const startSection = this.$store.getters['map/getDeviceByCode'](row.startSectionCode);
if (startSection && startSection.isReentryTrack) {
list.shift();
}
let endSection = this.$store.getters['map/getDeviceByCode'](row.endSectionCode);
if (endSection && endSection.isReentryTrack) {
list.pop();
}
}
const endSection = this.$store.getters['map/getDeviceByCode'](row.endSectionCode);
if (endSection && endSection.isReentryTrack) {
list.pop();
}
}
this.editModel.arriveConfigList = list;
this.editModel.endTime = formatTime(tempTime - waitTime);
})
}
},
loadInitData(params) {
let skinStyle = this.$route.query.skinStyle;
this.isPlan = params.isPlan;
this.editModel.taskIndex = params.taskIndex;
this.editModel.serviceNumber = params.serviceNumber;
this.editModel.tripNumber = params.tripNumber;
this.PlanConvert = this.$theme.loadPlanConvert(skinStyle);
this.editModel.arriveConfigList = list;
this.editModel.endTime = formatTime(tempTime - waitTime);
});
}
},
loadInitData(params) {
const skinStyle = this.$route.query.skinStyle;
this.isPlan = params.isPlan;
this.editModel.taskIndex = params.taskIndex;
this.editModel.serviceNumber = params.serviceNumber;
this.editModel.tripNumber = params.tripNumber;
this.PlanConvert = this.$theme.loadPlanConvert(skinStyle);
let editData = this.$store.state.runPlan.editData[this.editModel.serviceNumber]
if (editData) {
let tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex });
let trainInfo = editData.trainMap[tripNumberList[0]];
this.editModel.startTime = formatTime(trainInfo.stationTimeList[0].secondTime + this.PlanConvert.TranslationTime);
}
const editData = this.$store.state.runPlan.editData[this.editModel.serviceNumber];
if (editData) {
const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; });
const trainInfo = editData.trainMap[tripNumberList[0]];
this.editModel.startTime = formatTime(trainInfo.stationTimeList[0].secondTime + this.PlanConvert.TranslationTime);
}
if (skinStyle) {
getStationRunning(skinStyle).then(resp => {
let list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
})
}
if (skinStyle) {
getStationRunning(skinStyle).then(resp => {
const list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
});
}
let model = {
planId: this.$route.query.planId,
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}`
}
const model = {
planId: this.$route.query.planId,
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}`
};
this.editModel.routingList = [];
getRoutingBySDTNumber(model).then(resp => {
let routingObj = resp.data;
this.editModel.routingCode = routingObj.code;
this.editModel.routingList.push(routingObj);
this.computedDetailList();
});
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
buildModel() {
return {
planId: this.$route.query.planId,
routingCode: this.editModel.routingCode,
tripNumber: this.editModel.tripNumber,
startTime: this.editModel.startTime,
endTime: this.editModel.endTime,
arriveConfigList: this.editModel.arriveConfigList,
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}`
}
},
handleCommit() {
if (this.isPlan) {
//
} else {
//
updatePlanTrip(this.buildModel()).then(resp => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: this.$route.query
});
this.$message.success('修改任务成功!');
}).catch(error => {
this.$messageBox('修改任务失败');
});
}
this.doClose();
}
}
}
this.editModel.routingList = [];
getRoutingBySDTNumber(model).then(resp => {
const routingObj = resp.data;
this.editModel.routingCode = routingObj.code;
this.editModel.routingList.push(routingObj);
this.computedDetailList();
});
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
buildModel() {
return {
planId: this.$route.query.planId,
routingCode: this.editModel.routingCode,
tripNumber: this.editModel.tripNumber,
startTime: this.editModel.startTime,
endTime: this.editModel.endTime,
arriveConfigList: this.editModel.arriveConfigList,
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}`
};
},
handleCommit() {
if (this.isPlan) {
//
} else {
//
updatePlanTrip(this.buildModel()).then(resp => {
this.$emit('dispatchOperate', {
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
});
this.$message.success('修改任务成功!');
}).catch(() => {
this.$messageBox('修改任务失败');
});
}
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,61 +1,71 @@
<template>
<el-dialog class="planEdit__tool add-planning-train" :title="title" :visible.sync="dialogShow" :width="width + 'px'"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" append-to-body v-dialogDrag>
<el-row>
<el-col :span="24" :offset="1">
<i class="el-icon-warning"></i>
{{params.message}}
</el-col>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="planEdit__tool add-planning-train"
:title="title"
:visible.sync="dialogShow"
:width="width + 'px'"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<el-row>
<el-col :span="24" :offset="1">
<i class="el-icon-warning" />
{{ params.message }}
</el-col>
</el-row>
<el-row type="flex" justify="center" class="button-group">
<el-button @click="handleCommit"> </el-button>
<el-button @click="doClose"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
export default {
name: 'OffLine',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
params: {},
}
},
computed: {
title() {
return 'offline'
},
width() {
if (this.params.width) {
return this.params.width;
} else {
return 400;
}
}
},
mounted() {
},
methods: {
doShow(params) {
this.params = params || {};
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.$emit('handleConfirm', this.params);
this.doClose();
}
}
}
export default {
name: 'OffLine',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
params: {}
};
},
computed: {
title() {
return 'offline';
},
width() {
if (this.params.width) {
return this.params.width;
} else {
return 400;
}
}
},
mounted() {
},
methods: {
doShow(params) {
this.params = params || {};
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.$emit('handleConfirm', this.params);
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,93 +1,109 @@
<template>
<el-dialog class="planEdit__tool open-runplan" :title="title" :visible.sync="show" width="640px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree ref="tree" class="filter-tree" :data="runPlanList" :props="defaultProps" default-expand-all
:style="{height: height-20+'px'}">
<span slot-scope="{ node, data }">
<el-radio v-model="planId" :label="data.id"><span>{{ data.name }}</span></el-radio>
</span>
</el-tree>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
<el-dialog
v-dialogDrag
class="planEdit__tool open-runplan"
:title="title"
:visible.sync="show"
width="640px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
class="filter-tree"
:data="runPlanList"
:props="defaultProps"
default-expand-all
:style="{height: height-20+'px'}"
>
<span slot-scope="{ node, data }">
<el-radio v-model="planId" :label="data.id"><span>{{ data.name }}</span></el-radio>
</span>
</el-tree>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
</template>
<script>
import { getjointTraining, putJointTrainingSimulationEntrance } from '@/api/chat';
import { getPublishMapInfo } from '@/api/jmap/map';
import { launchFullscreen } from '@/utils/screen';
import { getStationListBySkinStyle, queryRunPlan, getRpListByMapId } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
import { getRpListByMapId } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
export default {
name: 'OpenRunPlan',
props: {
skinStyle: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: false,
height: 260,
planId: '',
runPlanList: [],
runPlanDict: {},
defaultProps: {
label: 'name',
}
}
},
computed: {
show() {
return this.dialogShow;
},
title() {
return '运行图列表';
},
},
mounted() {
this.loadRunPlanData({
planId: this.$route.query.planId,
skinStyle: this.$route.query.skinStyle,
planName: this.$route.query.planName
});
},
methods: {
loadRunPlanData({ planId, skinStyle, planName }) {
let query = { skinStyle: skinStyle, mapId: this.$route.query.mapId, planId: planId, planName, try: this.$route.query.try, goodsId: this.$route.query.goodsId }
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
},
doShow() {
getRpListByMapId(this.$route.query.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
this.dialogShow = true;
}).catch(error => {
this.$messageBox('获取运行图列表失败');
})
},
doClose() {
this.dialogShow = false;
},
handleConfirm() {
this.loadRunPlanData({
planId: this.planId,
skinStyle: this.$route.query.skinStyle,
planName: this.runPlanDict[this.planId]
});
this.doClose();
}
}
}
export default {
name: 'OpenRunPlan',
props: {
skinStyle: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: false,
height: 260,
planId: '',
runPlanList: [],
runPlanDict: {},
defaultProps: {
label: 'name'
}
};
},
computed: {
show() {
return this.dialogShow;
},
title() {
return '运行图列表';
}
},
mounted() {
this.loadRunPlanData({
planId: this.$route.query.planId,
skinStyle: this.$route.query.skinStyle,
planName: this.$route.query.planName
});
},
methods: {
loadRunPlanData({ refresh, planId, skinStyle, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
} else {
const query = { skinStyle: skinStyle, mapId: this.$route.query.mapId, planId: planId, planName, try: this.$route.query.try, goodsId: this.$route.query.goodsId };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
},
doShow() {
getRpListByMapId(this.$route.query.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
this.dialogShow = true;
}).catch(() => {
this.$messageBox('获取运行图列表失败');
});
},
doClose() {
this.dialogShow = false;
},
handleConfirm() {
this.loadRunPlanData({
planId: this.planId,
skinStyle: this.$route.query.skinStyle,
planName: this.runPlanDict[this.planId]
});
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -235,6 +235,9 @@ export default {
});
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
},
'$store.state.runPlan.refreshCount': function() {
this.loadChartPage();
},
$route() {
this.loadChartPage();
}