修改页面不刷新的问题

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; Vue.config.productionTip = false;
export const i18n = new VueI18n({ export const i18n = new VueI18n({
locale: LangStorage.getLang('en'), locale: LangStorage.getLang('zh'),
messages messages
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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