修改页面不刷新的问题

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

@ -11,7 +11,8 @@ const runPlan = {
planUpdateCount: 0, // 运行图更新标识
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,10 +1,19 @@
<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-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-input>
<el-input v-model="serviceNumber" size="mini" />
</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 20px">
@ -23,12 +32,12 @@
return {
dialogShow: false,
loading: false,
serviceNumber: '',
}
serviceNumber: ''
};
},
computed: {
title() {
return '添加计划车'
return '添加计划车';
}
},
mounted() {
@ -52,15 +61,15 @@
type: 'warning',
operate: 'AddPlanningTrain',
width: 460,
message: '本表号已存在,是否强制设置?(强制设置程序可能会出现异常)',
message: '本表号已存在,是否强制设置?(强制设置程序可能会出现异常)'
}
})
});
this.doClose();
} else {
this.handleConfirm();
}
})
});
} else {
this.$messageBox('长度应该为两位数');
}
@ -71,10 +80,10 @@
handleConfirm() {
this.doClose();
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>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,6 +1,15 @@
<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>
<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">
@ -11,17 +20,19 @@
</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-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-time-picker>
<el-time-picker v-model="addModel.startTime" value-format="HH:mm:ss" :clearable="false" />
</el-col>
</el-row>
<el-row style="margin-top: 5px">
@ -33,9 +44,12 @@
</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-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">
@ -43,9 +57,12 @@
</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-option
v-for="item in defaultSpeedLevelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
@ -54,8 +71,13 @@
交路
</el-row>
<el-row>
<el-table :data="addModel.routingList" border highlight-current-row @row-click="handleClick"
:height="180">
<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) }}
@ -76,8 +98,7 @@
{{ formatName(scope.row.endSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="remarks" label="描述">
</el-table-column>
<el-table-column prop="remarks" label="描述" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
@ -95,14 +116,10 @@
{{ 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-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>
@ -111,7 +128,7 @@
</el-col>
</el-row>
</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="doClose"> </el-button>
</el-row>
@ -155,13 +172,13 @@
},
tripNumberList: [{ value: '', label: '自动' }],
defaultStopTimeList: [{ value: '', label: '默认' }],
defaultSpeedLevelList: [{ value: '', label: '默认' }],
}
defaultSpeedLevelList: [{ value: '', label: '默认' }]
};
},
computed: {
title() {
return '添加任务'
},
return '添加任务';
}
},
watch: {
'addModel.routingCode': function () {
@ -184,21 +201,21 @@
this.addModel.serviceNumber = params.serviceNumber;
this.addModel.planId = this.$route.query.planId;
let planId = this.$route.query.planId;
const planId = this.$route.query.planId;
if (planId) {
getRoutingList(planId).then(resp => {
this.addModel.routingList = resp.data;
})
});
}
let skinStyle = this.$route.query.skinStyle;
const skinStyle = this.$route.query.skinStyle;
if (skinStyle) {
getStationRunning(skinStyle).then(resp => {
let list = resp.data;
const list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
})
});
}
},
doShow(params) {
@ -213,14 +230,14 @@
return formatName(code);
},
computedTimeByString(timeStr) {
let bTime = +new Date(`2019-01-01 00:00:00`);
let eTime = +new Date(`2019-01-01 ${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) {
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.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
@ -235,10 +252,10 @@
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; //
const list = resp.data;
const waitTime = this.addModel.defaultStopTime || 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) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
@ -259,7 +276,7 @@
this.addModel.arriveConfigList = list;
this.addModel.endTime = formatTime(tempTime - waitTime);
})
});
}
},
handleClick(row, column, event) {
@ -272,23 +289,23 @@
handleCommit() {
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 {
//
addPlanTrip(this.addModel).then(resp => {
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('添加任务成功!');
}).catch(error => {
}).catch(() => {
this.$messageBox('添加任务失败');
})
});
}
this.doClose();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,10 +1,19 @@
<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-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 autofocus v-model="addModel.name"></el-input>
<el-input v-model="addModel.name" autofocus />
</el-form-item>
</el-form>
</el-row>
@ -28,20 +37,20 @@
loading: false,
addModel: {
name: '',
skinStyle: this.$route.query.skinStyle,
}
skinStyle: this.$route.query.skinStyle
}
};
},
computed: {
title() {
return '创建空运行图数据'
return '创建空运行图数据';
},
rules() {
return {
name: [
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
]
}
};
}
},
methods: {
@ -56,24 +65,24 @@
this.$refs['form'].validate((valid) => {
if (valid) {
createEmptyPlan(this.addModel).then(resp => {
let params = {
const params = {
dialogName: 'openRunPlan',
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.doClose();
}).catch(error => {
}).catch(() => {
this.$messageBox('创建空运行图失败');
this.doClose();
})
});
}
});
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,6 +1,15 @@
<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-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>
@ -30,13 +39,13 @@
taskIndex: '',
deleteBefore: false,
tripNumber: '',
serviceNumber: '',
},
serviceNumber: ''
}
};
},
computed: {
title() {
return '删除任务'
return '删除任务';
}
},
mounted() {
@ -56,29 +65,29 @@
handleCommit() {
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmDeleteTask', params: this.model })
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmDeleteTask', params: this.model });
} else {
//
let model = {
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
dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
});
this.$message.success('删除任务成功!');
}).catch(error => {
}).catch(() => {
this.$messageBox('删除任务失败');
})
});
}
this.doClose();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,6 +1,15 @@
<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-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>
@ -10,13 +19,13 @@
<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-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"></el-input-number>
<el-input-number v-model="model.intervals" size="mini" controls-position="right" />
<span></span>
</el-col>
</el-row>
@ -42,13 +51,13 @@
serviceNumber: '',
forward: false,
times: 0,
intervals: 0,
}
intervals: 0
}
};
},
computed: {
title() {
return '复制列车'
return '复制列车';
}
},
mounted() {
@ -68,15 +77,15 @@
this.doClose();
duplicateService(this.model).then(resp => {
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('复制计划成功!');
}).catch(error => {
}).catch(() => {
this.$messageBox('复制计划失败');
})
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,10 +1,19 @@
<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-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-input>
<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>
@ -15,8 +24,13 @@
</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
: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) }}
@ -37,8 +51,7 @@
{{ scope.row.endTime }}
</template>
</el-table-column>
<el-table-column width="20">
</el-table-column>
<el-table-column width="20" />
</el-table>
</div>
<div style="float: right; width: 22%">
@ -68,13 +81,13 @@
model: {
serviceNumber: '',
debugTrain: false,
tripConfigList: [],
}
tripConfigList: []
}
};
},
computed: {
title() {
return '编辑计划车'
return '编辑计划车';
},
disabled() {
return !this.model.serviceNumber;
@ -91,13 +104,13 @@
this.model.planId = this.$route.query.planId;
this.model.serviceNumber = params.serviceNumber;
this.model.tripConfigList = [];
let editData = this.$store.state.runPlan.editData[params.serviceNumber]
const 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 });
const 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 = {
const trainInfo = editData.trainMap[tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
const taskObj = {
taskIndex: getUID('task_'),
tripNumber: tripNumber,
startStationCode: trainInfo.stationTimeList[0].stationCode,
@ -105,10 +118,10 @@
endStationCode: trainInfo.stationTimeList[lastIndex].stationCode,
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime),
arriveConfigList: []
}
};
// console.log(editData.trainMap[tripNumber]);
this.model.tripConfigList.push(taskObj);
})
});
}
},
doShow(params) {
@ -130,7 +143,7 @@
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
})
});
},
handleEditTask() {
if (this.currentRow.taskIndex) {
@ -140,7 +153,7 @@
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
})
});
} else {
this.$messageBox('请选择一条数据');
}
@ -154,7 +167,7 @@
serviceNumber: this.model.serviceNumber,
tripNumber: this.currentRow.tripNumber
}
})
});
} else {
this.$messageBox('请选择一条数据');
}
@ -181,8 +194,8 @@
}
},
handleConfirmDeleteTask(model) {
let index = this.model.tripConfigList.findIndex(
elem => { return elem.taskIndex == this.currentRow.taskIndex }
const index = this.model.tripConfigList.findIndex(
elem => { return elem.taskIndex == this.currentRow.taskIndex; }
);
if (index >= 0) {
@ -197,15 +210,15 @@
this.doClose();
addPlanService(this.model).then(() => {
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('创建计划成功');
}).catch(error => {
}).catch(() => {
this.$messageBox('创建计划失败');
})
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,6 +1,15 @@
<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>
<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">
@ -9,10 +18,13 @@
<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 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>
@ -30,11 +42,17 @@
<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
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>
@ -45,7 +63,7 @@
<span>表号</span>
</el-col>
<el-col :span="13">
<el-input v-model="editModel.serviceNumber"></el-input>
<el-input v-model="editModel.serviceNumber" />
</el-col>
</el-row>
</el-col>
@ -74,10 +92,13 @@
<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 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>
@ -95,11 +116,17 @@
<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
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>
@ -110,9 +137,12 @@
<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-time-picker
v-model="editModel.startTime"
placeholder="选择时间"
value-format="HH:mm:ss"
:clearable="false"
/>
</el-col>
</el-row>
</el-col>
@ -144,19 +174,15 @@
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startSectionCode" label="起始区段">
</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>
<el-table-column prop="remarks" label="描述" :width="280">
</el-table-column>
<el-table-column :width="40">
</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;">
@ -174,14 +200,10 @@
{{ 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-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>
@ -198,7 +220,7 @@
</template>
<script>
import { getRoutingBySDTNumber, querySectionListByRouting, getRoutingList, getStationRunning, updatePlanTrip } from '@/api/runplan';
import { getRoutingBySDTNumber, querySectionListByRouting, getStationRunning, updatePlanTrip } from '@/api/runplan';
import { formatTime, formatName } from '@/utils/runPlan';
export default {
@ -232,17 +254,17 @@
firstTrain: false,
lastTrain: false,
inStock: false,
outStock: false,
outStock: false
},
tripNumberList: [{ value: '', label: '自动' }],
defaultStopTimeList: [{ value: '', label: '默认' }],
defaultSpeedLevelList: [{ value: '', label: '默认' }],
serialNumberList: [],
}
serialNumberList: []
};
},
computed: {
title() {
return '修改任务'
return '修改任务';
}
},
watch: {
@ -264,14 +286,14 @@
return formatName(code);
},
computedTimeByString(timeStr) {
let bTime = +new Date(`2019-01-01 00:00:00`);
let eTime = +new Date(`2019-01-01 ${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) {
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.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
@ -287,10 +309,10 @@
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; //
const list = rest.data;
const waitTime = this.editModel.defaultStopTime || 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) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
@ -300,13 +322,13 @@
});
if (this.editModel.routingList && this.editModel.routingList.length > 0) {
let row = this.editModel.routingList[0];
let startSection = this.$store.getters['map/getDeviceByCode'](row.startSectionCode);
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);
const endSection = this.$store.getters['map/getDeviceByCode'](row.endSectionCode);
if (endSection && endSection.isReentryTrack) {
list.pop();
}
@ -314,41 +336,41 @@
this.editModel.arriveConfigList = list;
this.editModel.endTime = formatTime(tempTime - waitTime);
})
});
}
},
loadInitData(params) {
let skinStyle = this.$route.query.skinStyle;
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]
const 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]];
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;
const list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
})
});
}
let model = {
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;
const routingObj = resp.data;
this.editModel.routingCode = routingObj.code;
this.editModel.routingList.push(routingObj);
this.computedDetailList();
@ -371,7 +393,7 @@
endTime: this.editModel.endTime,
arriveConfigList: this.editModel.arriveConfigList,
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}`
}
};
},
handleCommit() {
if (this.isPlan) {
@ -380,17 +402,17 @@
//
updatePlanTrip(this.buildModel()).then(resp => {
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('修改任务成功!');
}).catch(error => {
}).catch(() => {
this.$messageBox('修改任务失败');
});
}
this.doClose();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,9 +1,19 @@
<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-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"></i>
<i class="el-icon-warning" />
{{ params.message }}
</el-col>
</el-row>
@ -24,12 +34,12 @@
return {
dialogShow: false,
loading: false,
params: {},
}
params: {}
};
},
computed: {
title() {
return 'offline'
return 'offline';
},
width() {
if (this.params.width) {
@ -55,7 +65,7 @@
this.doClose();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,9 +1,24 @@
<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'}">
<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>
@ -17,10 +32,7 @@
</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 { getRpListByMapId } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
export default {
@ -40,9 +52,9 @@
runPlanList: [],
runPlanDict: {},
defaultProps: {
label: 'name',
}
label: 'name'
}
};
},
computed: {
show() {
@ -50,7 +62,7 @@
},
title() {
return '运行图列表';
},
}
},
mounted() {
this.loadRunPlanData({
@ -60,9 +72,13 @@
});
},
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 }
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) => {
@ -71,9 +87,9 @@
this.runPlanDict[elem.id] = elem.name;
});
this.dialogShow = true;
}).catch(error => {
}).catch(() => {
this.$messageBox('获取运行图列表失败');
})
});
},
doClose() {
this.dialogShow = false;
@ -87,7 +103,7 @@
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();
}