运行图编制 代码调整
This commit is contained in:
parent
2afd703938
commit
0ec4a64f5d
@ -602,7 +602,7 @@ export default {
|
||||
}
|
||||
case 'top': {
|
||||
if (isStation) {
|
||||
if (list.find(el => { el.sectionCode == this.addModel.startSectionCode; })) {
|
||||
if (list.find(el => { el.sectionCode == this.addModel.startSectionCode; })) {
|
||||
list.splice(0, 1, data);
|
||||
} else {
|
||||
list.unshift(data);
|
@ -5,7 +5,7 @@
|
||||
<!-- :style="{height: $store.state.app.height-54+'px' }" -->
|
||||
<div class="routeMap">
|
||||
<route-config v-if="type=='routeMap'" ref="routeConfig" />
|
||||
<runplan-config v-if="type=='runplanParams'" ref="runPlanConfig" />
|
||||
<!-- <runplan-config v-if="type=='runplanParams'" ref="runPlanConfig" /> -->
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@ -16,14 +16,14 @@ import JlmapVisual from '@/views/newMap/jlmapNew/index';
|
||||
import { loadMapDataById } from '@/utils/loaddata';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import RouteConfig from './routeConfig';
|
||||
import RunplanConfig from './runplanConfig';
|
||||
// import RunplanConfig from './runplanConfig';
|
||||
|
||||
export default {
|
||||
name: 'RouteMap',
|
||||
components: {
|
||||
JlmapVisual,
|
||||
RouteConfig,
|
||||
RunplanConfig
|
||||
RouteConfig
|
||||
// RunplanConfig
|
||||
},
|
||||
props:{
|
||||
},
|
||||
@ -52,17 +52,18 @@ export default {
|
||||
this.type = type;
|
||||
if (this.type == 'routeMap') {
|
||||
this.title = '交路配置';
|
||||
} else if (this.type == 'runplanParams') {
|
||||
this.title = '参数配置';
|
||||
|
||||
}
|
||||
// else if (this.type == 'runplanParams') {
|
||||
// this.title = '参数配置';
|
||||
|
||||
// }
|
||||
this.dialogShow = true;
|
||||
await this.setWindowSize();
|
||||
if (this.isFirst) {
|
||||
this.loadInitPage();
|
||||
}
|
||||
this.isFirst = false;
|
||||
if (this.type == 'runplanParams') { this.$refs.runPlanConfig.doShow(); }
|
||||
// if (this.type == 'runplanParams') { this.$refs.runPlanConfig.doShow(); }
|
||||
},
|
||||
// 获取设备数据
|
||||
getDeviceByEm(em) {
|
@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="dialogShow"
|
||||
custom-class="content-route"
|
||||
width="750px"
|
||||
top="10vh"
|
||||
title="折返配置 (单位:秒)"
|
||||
:before-close="close"
|
||||
:z-index="2000"
|
||||
:append-to-body="true"
|
||||
>
|
||||
<div class="runPlanConfig">
|
||||
<!-- <div class="reentryConfig" /> -->
|
||||
<div class="reentryConfigTable">
|
||||
<el-table
|
||||
:data="reentryDataList"
|
||||
border
|
||||
style="width:100%"
|
||||
height="430"
|
||||
class="el-parkSectionCode-table"
|
||||
>
|
||||
<el-table-column prop="stationCode" :label="$t('map.stationName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.stationName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站前折返">
|
||||
<template slot-scope="scope">
|
||||
<!-- v-if="scope.row.reentryData.tbFrom" -->
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbFront"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
<!-- <el-button v-else type="primary" size="small" @click="add(scope.row)">添加</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站后折返">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbBack"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="从股道到折返">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbFrom"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="从折返到股道">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbTo"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="text-align: center; margin-top: 10px;">
|
||||
<el-button type="primary" :loading="loading" @click="save">{{ $t('map.save') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { addRunplanConfig, getRunplanConfig } from '@/api/jmap/mapdraft';
|
||||
export default {
|
||||
name:'RunPlanConfig',
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
reentryDataList:[],
|
||||
stationList:{},
|
||||
sectionCode:'',
|
||||
field:'',
|
||||
loading:false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
])
|
||||
},
|
||||
watch:{
|
||||
'$store.state.map.mapDataLoadedCount':function(val) {
|
||||
if (this.sectionList) {
|
||||
const reentrySections = this.sectionList.filter(elem => { return elem.reentryTrack; });
|
||||
const stationList = {};
|
||||
reentrySections.forEach(each=>{
|
||||
if (each.belongStation) {
|
||||
const station = this.$store.getters['map/getDeviceByCode'](each.belongStation);
|
||||
if (!stationList[each.belongStation]) {
|
||||
stationList[each.belongStation] = {code:each.belongStation, stationName:station.name,
|
||||
reentryData:{tbFront:undefined, tbBack:undefined, tbFrom:undefined, tbTo:undefined}};
|
||||
}
|
||||
}
|
||||
});
|
||||
this.reentryDataList = Object.values(stationList);
|
||||
this.stationList = stationList;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods:{
|
||||
doShow() {
|
||||
this.dialogShow = true;
|
||||
this.loading = false;
|
||||
const self = this;
|
||||
getRunplanConfig(this.$route.query.mapId).then(resp => {
|
||||
if (resp.data && resp.data.config && resp.data.config.reentryData) {
|
||||
const reentryData = resp.data.config.reentryData;
|
||||
const keys = Object.keys(reentryData);
|
||||
keys.forEach(each=>{
|
||||
self.stationList[each].reentryData = reentryData[each];
|
||||
});
|
||||
const newData = Object.values(this.stationList);
|
||||
self.reentryDataList = [...newData || []];
|
||||
}
|
||||
});
|
||||
},
|
||||
close() {
|
||||
this.dialogShow = false;
|
||||
},
|
||||
save() {
|
||||
const tbBackList = [];
|
||||
const reentryData = {};
|
||||
this.reentryDataList.forEach(each=>{
|
||||
if (each.reentryData.tbFront || (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
|
||||
const temp = Object.assign({}, each.reentryData);
|
||||
if (!(each.reentryData.tbFront && (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo))) {
|
||||
if (each.reentryData.tbFront) {
|
||||
temp.tbBack = null;
|
||||
temp.tbFrom = null;
|
||||
temp.tbTo = null;
|
||||
} else {
|
||||
temp.tbFront = null;
|
||||
}
|
||||
}
|
||||
reentryData[each.code] = temp;
|
||||
}
|
||||
if (!(each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
|
||||
if (each.reentryData.tbBack || each.reentryData.tbFrom || each.reentryData.tbTo) {
|
||||
tbBackList.push(each.stationName);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (tbBackList.length > 0) {
|
||||
this.$messageBox('请设置【' + tbBackList.toString() + '】站后折返信息');
|
||||
return;
|
||||
} else if (Object.keys(reentryData).length == 0) {
|
||||
// JSON.stringify(reentryData) == '{}'
|
||||
this.$messageBox('请填写折返配置信息');
|
||||
return;
|
||||
}
|
||||
addRunplanConfig(this.$route.query.mapId, {'reentryData':reentryData}).then(resp => {
|
||||
this.$message.success('折返配置成功');
|
||||
this.loading = false;
|
||||
}).catch((error) => {
|
||||
this.$messageBox('折返配置失败' + ':' + error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.reentryConfigTable{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.runPlanConfig{padding:0px 20px 20px 20px}
|
||||
.reentryConfigTable .el-table--scrollable-y .el-table__body-wrapper{
|
||||
&::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background: #c3c3c3;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
border-radius: 0;
|
||||
background: #f0f0f0;
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
@ -111,11 +111,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<route-map ref="routeMap" />
|
||||
<runplan-config ref="runplanConfig" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import routeMap from './routingoperate/routeMap';
|
||||
import routeMap from '../components/routingoperate/routeMap';
|
||||
import RunplanConfig from '../components/routingoperate/runplanConfig';
|
||||
// import RunplanParams from './config/index';
|
||||
import { planEffectiveCheck, runPlanNotify, clearPlaningData } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
@ -125,7 +127,7 @@ import { publishRunPlan, deleteRunPlan } from '@/api/designPlatform';
|
||||
|
||||
export default {
|
||||
name: 'PlanMenuBar',
|
||||
components: { routeMap },
|
||||
components: { routeMap, RunplanConfig },
|
||||
props: {
|
||||
planConvert: {
|
||||
type: Object,
|
||||
@ -448,7 +450,8 @@ export default {
|
||||
},
|
||||
// 运行图配置文件
|
||||
handleRunplanParams() {
|
||||
this.$refs.routeMap.doShow('runplanParams');
|
||||
// this.$refs.routeMap.doShow('runplanParams');
|
||||
this.$refs.runplanConfig.doShow();
|
||||
},
|
||||
// 停站时间
|
||||
handleDwellTime() {
|
||||
|
@ -221,6 +221,7 @@ export default {
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
// this.doClose();
|
||||
this.loading = false;
|
||||
this.$messageBox(error.message);
|
||||
});
|
||||
});
|
||||
|
@ -1,180 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="dialogShow" custom-class="content-route" width="100%" :fullscreen="true" top="0px" :before-close="close" :z-index="2000" :append-to-body="true">
|
||||
<div class="content-box">
|
||||
<jlmap-visual ref="jlmapVisual" @onMenu="onContextmenu" @onSelect="clickEvent" />
|
||||
<!-- :style="{height: $store.state.app.height-54+'px' }" -->
|
||||
<div class="routeMap">
|
||||
<route-config v-if="type=='routeMap'" ref="routeConfig" />
|
||||
<runplan-config v-if="type=='runplanParams'" ref="runPlanConfig" />
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JlmapVisual from '@/views/newMap/jlmapNew/index';
|
||||
import { loadMapDataById } from '@/utils/loaddata';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import RouteConfig from './routeConfig';
|
||||
import RunplanConfig from './runplanConfig';
|
||||
|
||||
export default {
|
||||
name: 'RouteMap',
|
||||
components: {
|
||||
JlmapVisual,
|
||||
RouteConfig,
|
||||
RunplanConfig
|
||||
},
|
||||
props:{
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type:'',
|
||||
title:'',
|
||||
dialogShow: false,
|
||||
oldDevice: null,
|
||||
oldsection:[],
|
||||
isFirst:true
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.app.width': function(val) {
|
||||
this.setWindowSize();
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.setWindowSize();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
async doShow(type) {
|
||||
this.type = type;
|
||||
if (this.type == 'routeMap') {
|
||||
this.title = '交路配置';
|
||||
} else if (this.type == 'runplanParams') {
|
||||
this.title = '参数配置';
|
||||
|
||||
}
|
||||
this.dialogShow = true;
|
||||
await this.setWindowSize();
|
||||
if (this.isFirst) {
|
||||
this.loadInitPage();
|
||||
}
|
||||
this.isFirst = false;
|
||||
if (this.type == 'runplanParams') { this.$refs.runPlanConfig.doShow(); }
|
||||
},
|
||||
// 获取设备数据
|
||||
getDeviceByEm(em) {
|
||||
var device = this.$store.getters['map/getDeviceByCode'](em.deviceCode) || null;
|
||||
if (device) {
|
||||
device._viewVal = em.val;
|
||||
}
|
||||
return device;
|
||||
},
|
||||
// 高亮设备
|
||||
deviceHighLight(device, flag) {
|
||||
if (device && device.instance && typeof device.instance.drawSelected === 'function' ) {
|
||||
if (device._type === 'Section' && device.type === '04') {
|
||||
device.relevanceSectionList.forEach(item => {
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
|
||||
sectionModel && sectionModel.instance.drawSelected(flag);
|
||||
});
|
||||
} else if (device._type === 'Section' && device.type === '01' && device.logicSectionCodeList && device.logicSectionCodeList.length) {
|
||||
device.logicSectionCodeList.forEach(item => {
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
|
||||
sectionModel && sectionModel.instance.drawSelected(flag);
|
||||
});
|
||||
} else {
|
||||
device.instance.drawSelected(flag);
|
||||
}
|
||||
}
|
||||
},
|
||||
clickEvent(em) {
|
||||
const device = this.getDeviceByEm(em);
|
||||
this.deviceHighLight(this.oldDevice, false);
|
||||
this.deviceHighLight(device, true);
|
||||
this.oldDevice = device;
|
||||
this.setSelected(device);
|
||||
},
|
||||
setWindowSize() {
|
||||
this.$nextTick(() => {
|
||||
const width = this.$store.state.app.width * 0.7;
|
||||
const height = this.$store.state.app.height - 54;
|
||||
this.$store.dispatch('config/resize', { width, height });
|
||||
});
|
||||
},
|
||||
loadInitPage() {
|
||||
this.$store.dispatch('training/changeMode', { mode: null });
|
||||
loadMapDataById(this.$route.query.mapId, 'preview');
|
||||
},
|
||||
endViewLoading(isSuccess) {
|
||||
if (!isSuccess) {
|
||||
this.$store.dispatch('map/mapClear');
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('viewLoading', false);
|
||||
});
|
||||
},
|
||||
setSelected(selected) {
|
||||
if (selected) {
|
||||
if (this.type == 'routeMap') { this.$refs.routeConfig.setSelected(selected); }
|
||||
// if (this.type == 'runplanParams') { this.$refs.runPlanConfig.setSelected(selected); }
|
||||
}
|
||||
},
|
||||
// batchSectionListFocus(flag) {
|
||||
// this.changeSectionSelected(this.addModel.parkSectionCodeList, flag);
|
||||
// },
|
||||
onContextmenu() {
|
||||
|
||||
},
|
||||
close() {
|
||||
this.dialogShow = false;
|
||||
if (this.type == 'routeMap') { this.$refs.routeConfig.createRouteEvent(); }
|
||||
// if (this.type == 'runplanParams') { this.$refs.runPlanConfig.clear(); }
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.content-route{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/deep/ {
|
||||
.el-dialog__body{
|
||||
width: 100%;
|
||||
height:100%;
|
||||
flex:1;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content-box{
|
||||
display:flex;
|
||||
height:100%;
|
||||
}
|
||||
.routeMap{
|
||||
height:100%;
|
||||
overflow:auto;
|
||||
width: 29%;
|
||||
flex:1;
|
||||
&::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background: #c3c3c3;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
border-radius: 0;
|
||||
background: #f0f0f0;
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -1,193 +0,0 @@
|
||||
<template>
|
||||
<div class="runPlanConfig">
|
||||
<div class="reentryConfig">折返配置 (单位:秒)</div>
|
||||
<div class="reentryConfigTable">
|
||||
<el-table
|
||||
:data="reentryDataList"
|
||||
border
|
||||
style="width:100%"
|
||||
height="430"
|
||||
class="el-parkSectionCode-table"
|
||||
>
|
||||
<el-table-column prop="stationCode" :label="$t('map.stationName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.stationName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站前折返">
|
||||
<template slot-scope="scope">
|
||||
<!-- v-if="scope.row.reentryData.tbFrom" -->
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbFront"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
<!-- <el-button v-else type="primary" size="small" @click="add(scope.row)">添加</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站后折返">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbBack"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="从股道到折返">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbFrom"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="从折返到股道">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbTo"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-button-group style="padding:10px">
|
||||
<el-button type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { addRunplanConfig, getRunplanConfig } from '@/api/jmap/mapdraft';
|
||||
export default {
|
||||
name:'RunPlanConfig',
|
||||
data() {
|
||||
return {
|
||||
reentryDataList:[],
|
||||
stationList:{},
|
||||
sectionCode:'',
|
||||
field:'',
|
||||
loading:false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
if (this.sectionList) {
|
||||
const reentrySections = this.sectionList.filter(elem => { return elem.reentryTrack; });
|
||||
const stationList = {};
|
||||
reentrySections.forEach(each=>{
|
||||
if (each.belongStation) {
|
||||
const station = this.$store.getters['map/getDeviceByCode'](each.belongStation);
|
||||
if (!stationList[each.belongStation]) {
|
||||
stationList[each.belongStation] = {code:each.belongStation, stationName:station.name,
|
||||
reentryData:{tbFront:undefined, tbBack:undefined, tbFrom:undefined, tbTo:undefined}};
|
||||
}
|
||||
}
|
||||
});
|
||||
this.reentryDataList = Object.values(stationList);
|
||||
this.stationList = stationList;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
doShow() {
|
||||
this.loading = false;
|
||||
getRunplanConfig(this.$route.query.mapId).then(resp => {
|
||||
if (resp.data && resp.data.config && resp.data.config.reentryData) {
|
||||
const reentryData = resp.data.config.reentryData;
|
||||
const keys = Object.keys(reentryData);
|
||||
keys.forEach(each=>{
|
||||
this.stationList[each].reentryData = reentryData[each];
|
||||
});
|
||||
const newData = Object.values(this.stationList);
|
||||
this.reentryDataList = [...newData || []];
|
||||
}
|
||||
});
|
||||
},
|
||||
save() {
|
||||
const tbBackList = [];
|
||||
const reentryData = {};
|
||||
this.reentryDataList.forEach(each=>{
|
||||
if (each.reentryData.tbFront || (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
|
||||
const temp = Object.assign({}, each.reentryData);
|
||||
if (!(each.reentryData.tbFront && (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo))) {
|
||||
if (each.reentryData.tbFront) {
|
||||
temp.tbBack = null;
|
||||
temp.tbFrom = null;
|
||||
temp.tbTo = null;
|
||||
} else {
|
||||
temp.tbFront = null;
|
||||
}
|
||||
}
|
||||
reentryData[each.code] = temp;
|
||||
}
|
||||
if (!(each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
|
||||
if (each.reentryData.tbBack || each.reentryData.tbFrom || each.reentryData.tbTo) {
|
||||
tbBackList.push(each.stationName);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (tbBackList.length > 0) {
|
||||
this.$messageBox('请设置【' + tbBackList.toString() + '】站后折返信息');
|
||||
return;
|
||||
} else if (Object.keys(reentryData).length == 0) {
|
||||
// JSON.stringify(reentryData) == '{}'
|
||||
this.$messageBox('请填写折返配置信息');
|
||||
return;
|
||||
}
|
||||
addRunplanConfig(this.$route.query.mapId, {'reentryData':reentryData}).then(resp => {
|
||||
this.$message.success('折返配置成功');
|
||||
this.loading = false;
|
||||
}).catch((error) => {
|
||||
this.$messageBox('折返配置失败' + ':' + error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.reentryConfigTable{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.runPlanConfig{padding:15px 20px}
|
||||
// .reentryConfigTable .el-table--scrollable-y .el-table__body-wrapper{
|
||||
// &::-webkit-scrollbar {
|
||||
// width: 4px;
|
||||
// }
|
||||
|
||||
// &::-webkit-scrollbar-thumb {
|
||||
// border-radius: 10px;
|
||||
// background: #c3c3c3;
|
||||
// }
|
||||
|
||||
// &::-webkit-scrollbar-track {
|
||||
// border-radius: 0;
|
||||
// background: #f0f0f0;
|
||||
|
||||
// }
|
||||
// }
|
||||
</style>
|
@ -111,11 +111,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<route-map ref="routeMap" />
|
||||
<runplan-config ref="runplanConfig" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import routeMap from './routingoperate/routeMap';
|
||||
import routeMap from '../components/routingoperate/routeMap';
|
||||
import RunplanConfig from '../components/routingoperate/runplanConfig';
|
||||
// import RunplanParams from './config/index';
|
||||
import { planEffectiveCheck, runPlanNotify, clearPlaningData } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
@ -125,7 +127,7 @@ import { publishRunPlan, deleteRunPlan } from '@/api/designPlatform';
|
||||
|
||||
export default {
|
||||
name: 'PlanMenuBar',
|
||||
components: { routeMap },
|
||||
components: { routeMap, RunplanConfig },
|
||||
props: {
|
||||
planConvert: {
|
||||
type: Object,
|
||||
@ -448,7 +450,8 @@ export default {
|
||||
},
|
||||
// 运行图配置文件
|
||||
handleRunplanParams() {
|
||||
this.$refs.routeMap.doShow('runplanParams');
|
||||
// this.$refs.routeMap.doShow('runplanParams');
|
||||
this.$refs.runplanConfig.doShow();
|
||||
},
|
||||
// 停站时间
|
||||
handleDwellTime() {
|
||||
|
@ -221,6 +221,7 @@ export default {
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
// this.doClose();
|
||||
this.loading = false;
|
||||
this.$messageBox(error.message);
|
||||
});
|
||||
});
|
||||
|
@ -1,62 +0,0 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:title="title"
|
||||
:visible.sync="show"
|
||||
width="30%"
|
||||
:before-close="doClose"
|
||||
center
|
||||
append-to-body
|
||||
>
|
||||
<el-table :data="data" border style="width: 100%">
|
||||
<template v-for="(item, index) in form">
|
||||
<el-table-column :key="index" :label="item.label">
|
||||
<template slot-scope="scope">
|
||||
<template v-if="item.type === 'select'">
|
||||
<el-tooltip effect="dark" :content="item.options[scope.row[item.prop]]" placement="top">
|
||||
<span>{{ item.options[scope.row[item.prop]] }}</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<template v-if="item.type === 'text'">
|
||||
<el-tooltip effect="dark" :content="scope.row[item.prop]" placement="top">
|
||||
<span>{{ scope.row[item.prop] }}</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DictionaryDetailEdit',
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
title: '',
|
||||
name: '',
|
||||
form: [],
|
||||
data: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
doShow(fieldList, dataList) {
|
||||
if (fieldList.model) {
|
||||
const items = fieldList.model.items;
|
||||
if (items) {
|
||||
this.form = items;
|
||||
this.name = fieldList.name;
|
||||
this.data = dataList;
|
||||
this.title = fieldList.title;
|
||||
}
|
||||
this.show = true;
|
||||
}
|
||||
},
|
||||
doClose(done) {
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,700 +0,0 @@
|
||||
<template>
|
||||
<div class="routeConfig">
|
||||
<div>
|
||||
<div class="clearfix" style="padding-right: 20px;">
|
||||
<el-button type="text" class="mapEdit_box" @click="previewRouteEvent">{{ $t('map.preview') }}</el-button>
|
||||
<el-button type="text" class="mapEdit_box" @click="createRouteEvent">{{ $t('map.newConstruction') }}</el-button>
|
||||
</div>
|
||||
<el-form ref="form" :model="addModel" :rules="rules" label-width="120px" size="mini">
|
||||
<div class="definition">
|
||||
<el-form-item :label="$t('map.routingName')" prop="name">
|
||||
<el-input v-model="addModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.startStationCodeColon')" prop="startStationCode">
|
||||
<el-select v-model="addModel.startStationCode" clearable :filterable="true" disabled @change="changeStartStation">
|
||||
<el-option
|
||||
v-for="item in filterStationList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.startSectionColon')" prop="startSectionCode">
|
||||
<el-select v-model="addModel.startSectionCode" clearable :filterable="true" :disabled="editShow" @change="changeStartSection">
|
||||
<el-option
|
||||
v-for="item in filterStartSectionList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:disabled="editShow"
|
||||
:type=" field === 'startSectionCode' ? 'danger' : 'primary'"
|
||||
@click="hover('startSectionCode')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.endStationColon')" prop="endStationCode">
|
||||
<el-select v-model="addModel.endStationCode" :filterable="true" disabled @change="changeEndStation">
|
||||
<el-option
|
||||
v-for="item in filterStationList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.endSectionColon')" prop="endSectionCode">
|
||||
<el-select v-model="addModel.endSectionCode" :filterable="true" clearable :disabled="editShow || !isStartSelected" @change="changeEndSection">
|
||||
<el-option
|
||||
v-for="item in filterEndSectionList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:disabled="editShow || !isStartSelected"
|
||||
:type=" field === 'endSectionCode' ? 'danger' : 'primary'"
|
||||
@click="hover('endSectionCode')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.destinationCode')" prop="destinationCode" :disabled="editShow">
|
||||
<el-input v-model="addModel.destinationCode" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.routingDirection')" prop="directionCode">
|
||||
<el-select v-model="addModel.right" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="item in DirectionCodeList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.remarksColon')" prop="remarks">
|
||||
<el-input v-model="addModel.remarks" type="textarea" :rows="4" :placeholder="$t('map.pleaseSelect')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.trafficSegmentData')" prop="parkSectionCodeList">
|
||||
<el-button type="primary" size="small" :loading="generating" style="margin-bottom:10px" @click.native.prevent="generateParkSection">生成经停区段</el-button>
|
||||
<el-table
|
||||
:data="addModel.parkSectionCodeList"
|
||||
border
|
||||
style="width:97%"
|
||||
height="300"
|
||||
class="el-parkSectionCode-table"
|
||||
>
|
||||
<el-table-column prop="sectionCode" :label="$t('map.stationName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ formatName(scope.row.stationCode) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sectionCode" :label="$t('map.sectionName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ formatName(scope.row.sectionCode) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('map.operation')" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-show="scope.$index!=0&&scope.$index!=addModel.parkSectionCodeList.length-1"
|
||||
type="text"
|
||||
size="small"
|
||||
@click.native.prevent="deleteSection(addModel.parkSectionCodeList, scope.$index)"
|
||||
>
|
||||
{{ $t('map.remove') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin-top:10px;">
|
||||
<span>车站:</span>
|
||||
<el-select v-model="stationCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="item in filterStationList"
|
||||
:key="item.code"
|
||||
:label="`${item.name}(${item.code})`"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:disabled="!allowSelect"
|
||||
:type="field === 'routingStation' ? 'danger' : 'primary'"
|
||||
@click="hover('routingStation')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</div>
|
||||
<div style="margin-top:10px;">
|
||||
<span>区段:</span>
|
||||
<el-select v-model="sectionCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="item in filterStandSection"
|
||||
:key="item.code"
|
||||
:label="`${item.name}(${item.code})`"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type=" field === 'routingSection' ? 'danger' : 'primary'"
|
||||
:disabled="!allowSelect"
|
||||
@click="hover('routingSection')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="!allowSelect"
|
||||
@click="pushSection({stationCode: stationCode, sectionCode: sectionCode},'center')"
|
||||
>
|
||||
{{ $t('map.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button-group style="padding-bottom:10px">
|
||||
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
|
||||
</el-button>
|
||||
<el-button v-else type="warning" size="small" :loading="loading" @click="update">{{ $t('map.updata') }}
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<route-operate ref="routeOperate" @routingSelected="routingSelected" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import RouteOperate from './routeOperate';
|
||||
import { setUID } from '@/jmapNew/utils/Uid';
|
||||
import { addRoutingData, updateRoutingData, gernateRoutingSectionInRunplan } from '@/api/jmap/mapdraft';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { formatName } from '@/utils/runPlan';
|
||||
import Sortable from 'sortablejs';
|
||||
export default {
|
||||
name:'RouteConfig',
|
||||
components: {
|
||||
RouteOperate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
field: '',
|
||||
editShow: false,
|
||||
isSave: true,
|
||||
isStartSelected:false,
|
||||
allowSelect:false,
|
||||
loading: false,
|
||||
generating:false,
|
||||
stationCode: '',
|
||||
sectionCode: '',
|
||||
DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}],
|
||||
oldStartSectionCode: '',
|
||||
oldEndSectionCode: '',
|
||||
addModel: {
|
||||
name: '',
|
||||
mapId: '',
|
||||
code: '',
|
||||
// withLoop:false,
|
||||
right: true,
|
||||
destinationCode: '',
|
||||
startStationCode: '',
|
||||
startSectionCode: '',
|
||||
endStationCode: '',
|
||||
endSectionCode: '',
|
||||
remarks: '',
|
||||
userId: '',
|
||||
parkSectionCodeList: []
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入交路名称', trigger: 'change' }
|
||||
],
|
||||
startStationCode: [
|
||||
{ required: true, message: '请选择起始站', trigger: 'change' }
|
||||
],
|
||||
startSectionCode: [
|
||||
{ required: true, message: '请选择起始区段', trigger: 'change' }
|
||||
],
|
||||
endStationCode: [
|
||||
{ required: true, message: '请选择终到站', trigger: 'change' }
|
||||
],
|
||||
endSectionCode: [
|
||||
{ required: true, message: '请选择终到区段', trigger: 'change' }
|
||||
]
|
||||
},
|
||||
oldsection: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList',
|
||||
'stationList'
|
||||
]),
|
||||
filterStartSectionList() {
|
||||
if (this.sectionList) {
|
||||
return this.sectionList.filter(elem => { return elem.reentryTrack || elem.transferTrack; });
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
filterEndSectionList() {
|
||||
if (this.sectionList) {
|
||||
return this.sectionList.filter(elem => { return elem.reentryTrack || elem.transferTrack; });
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
filterStandSection() {
|
||||
if (this.sectionList) {
|
||||
return this.sectionList.filter(elem => { return elem.standTrack; });
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
filterStationList() {
|
||||
if (this.stationList) {
|
||||
return this.stationList.filter(elem => { return true; });
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
routeName: {
|
||||
get() {
|
||||
var name = '';
|
||||
if (this.isSave) {
|
||||
let begStation = ''; let endStation = '';
|
||||
let begSection = ''; let endSection = '';
|
||||
if (this.stationList) {
|
||||
this.stationList.forEach(elem => {
|
||||
if (elem.code === this.addModel.startStationCode) begStation = elem.name;
|
||||
if (elem.code === this.addModel.endStationCode) endStation = elem.name;
|
||||
});
|
||||
}
|
||||
if (this.sectionList) {
|
||||
this.sectionList.forEach(elem => {
|
||||
if (elem.code === this.addModel.startSectionCode) begSection = '(' + elem.name + ')';
|
||||
if (elem.code === this.addModel.endSectionCode) endSection = '(' + elem.name + ')';
|
||||
});
|
||||
}
|
||||
name = begStation + begSection + '-' + endStation + endSection;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
mapInfo(val) {
|
||||
if (val) {
|
||||
this.addModel.mapId = val.id;
|
||||
}
|
||||
},
|
||||
'addModel.parkSectionCodeList':function(val, old) {
|
||||
if (val.length > 0) {
|
||||
this.changeSectionSelected(val, true);
|
||||
}
|
||||
},
|
||||
routeName(val, old) {
|
||||
if (val) {
|
||||
this.addModel.name = val;
|
||||
}
|
||||
},
|
||||
sectionCode(val) {
|
||||
val && this.changeBelongSection(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.rowDrop();
|
||||
},
|
||||
methods:{
|
||||
previewRouteEvent() {
|
||||
this.$refs.routeOperate.doShow();
|
||||
},
|
||||
createRouteEvent() {
|
||||
this.clear();
|
||||
},
|
||||
routingSelected(data) {
|
||||
this.editData(data);
|
||||
},
|
||||
editData(data) {
|
||||
this.isSave = false;
|
||||
this.allowSelect = true;
|
||||
this.isStartSelected = true;
|
||||
this.editShow = true;
|
||||
this.addModel = data;
|
||||
},
|
||||
clear() {
|
||||
if (this.$refs && this.$refs.form) {
|
||||
this.changeSectionSelected(this.addModel.parkSectionCodeList, false);
|
||||
delete this.addModel.id;
|
||||
this.$refs.form.resetFields();
|
||||
this.addModel.mapId = this.$route.query.mapId;
|
||||
this.addModel.parkSectionCodeList = [];
|
||||
this.addModel.code = '';
|
||||
this.stationCode = '';
|
||||
this.sectionCode = '';
|
||||
this.isSave = true;
|
||||
this.allowSelect = false;
|
||||
this.isStartSelected = false;
|
||||
this.editShow = false;
|
||||
this.field = '';
|
||||
}
|
||||
},
|
||||
setSelected(selected) {
|
||||
if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'startStationCode'.toUpperCase()) {
|
||||
this.addModel.startStationCode = selected.code;
|
||||
this.judgeAllowSelected();
|
||||
this.addStartSectionData(true);
|
||||
|
||||
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'endStationCode'.toUpperCase()) {
|
||||
this.addModel.endStationCode = selected.code;
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(true);
|
||||
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
|
||||
if (selected.code != this.addModel.endSectionCode && (selected.reentryTrack || selected.transferTrack)) {
|
||||
this.popSection(this.addModel, 'startSectionCode');
|
||||
if (selected.belongStation) {
|
||||
this.addModel.startStationCode = selected.belongStation;
|
||||
}
|
||||
this.addModel.startSectionCode = selected.code;
|
||||
this.judgeAllowSelected();
|
||||
this.addStartSectionData(false);
|
||||
this.oldStartSectionCode = selected.code;
|
||||
} else {
|
||||
this.$message.error('请选择正确的起始区段');
|
||||
}
|
||||
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
|
||||
if (selected.code != this.addModel.startSectionCode && (selected.reentryTrack || selected.transferTrack)) {
|
||||
this.popSection(this.addModel, 'endSectionCode');
|
||||
if (this.addModel.startSectionCode == selected.code) {
|
||||
this.$message.error('起始区段和终到区段不能相同');
|
||||
return false;
|
||||
}
|
||||
if (selected.belongStation) {
|
||||
this.addModel.endStationCode = selected.belongStation;
|
||||
}
|
||||
this.addModel.endSectionCode = selected.code;
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(false);
|
||||
this.oldEndSectionCode = selected.code;
|
||||
this.addModel.destinationCode = selected.destinationCode || '';
|
||||
} else {
|
||||
this.$message.error('请选择正确的终到区段');
|
||||
}
|
||||
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) {
|
||||
if (selected.standTrack) {
|
||||
this.sectionCode = selected.code;
|
||||
} else {
|
||||
this.$message.error('请选择正确的区段');
|
||||
}
|
||||
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() == 'routingStation'.toUpperCase()) {
|
||||
this.stationCode = selected.code;
|
||||
}
|
||||
},
|
||||
changeBelongSection(code) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](code);
|
||||
if (section && section.belongStation) {
|
||||
this.stationCode = section.belongStation;
|
||||
}
|
||||
},
|
||||
changeSectionSelected(selectedList, flag) {
|
||||
if (this.oldsection && this.oldsection.length > 0) {
|
||||
this.oldsection.forEach((section)=>{
|
||||
section.instance.drawBatchSelected(section, '');
|
||||
});
|
||||
}
|
||||
|
||||
this.oldsection = [];
|
||||
if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) {
|
||||
if (flag) {
|
||||
selectedList.forEach(each=>{
|
||||
const section = this.$store.getters['map/getDeviceByCode'](each.sectionCode);
|
||||
const list = section.logicSectionCodeList;
|
||||
if (list && list.length > 0) {
|
||||
list.forEach(logicSectionCode=>{
|
||||
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
|
||||
logicSection.instance.drawBatchSelected(logicSection, 'routingSection');
|
||||
this.oldsection && this.oldsection.push(logicSection);
|
||||
});
|
||||
} else {
|
||||
section.instance.drawBatchSelected(section, 'routingSection');
|
||||
this.oldsection && this.oldsection.push(section);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
selectedList.forEach(each=>{
|
||||
const section = this.$store.getters['map/getDeviceByCode'](each.sectionCode);
|
||||
const list = section.logicSectionCodeList;
|
||||
if (list && list.length > 0) {
|
||||
list.forEach(logicSectionCode=>{
|
||||
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
|
||||
logicSection.instance.drawBatchSelected(section, '');
|
||||
});
|
||||
} else {
|
||||
section.instance.drawBatchSelected(section, '');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
changeStartStation(code, code2) {
|
||||
this.judgeAllowSelected();
|
||||
this.addStartSectionData(true);
|
||||
},
|
||||
changeStartSection(code) {
|
||||
if (code) {
|
||||
if (this.addModel.endSectionCode != code) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](code);
|
||||
if (section &&
|
||||
section.belongStation) {
|
||||
this.addModel.startStationCode = section.belongStation;
|
||||
}
|
||||
this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode');
|
||||
this.judgeAllowSelected();
|
||||
this.addStartSectionData(false);
|
||||
this.oldStartSectionCode = code;
|
||||
} else {
|
||||
this.addModel.startSectionCode = this.oldStartSectionCode;
|
||||
this.$message.error('请选择正确的起始区段');
|
||||
}
|
||||
} else {
|
||||
this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode');
|
||||
this.addModel.startStationCode = '';
|
||||
this.addModel.startSectionCode = '';
|
||||
this.oldStartSectionCode = '';
|
||||
}
|
||||
},
|
||||
changeEndStation() {
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(true);
|
||||
},
|
||||
changeEndSection(code) {
|
||||
if (code) {
|
||||
if (this.addModel.startSectionCode != code) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](code);
|
||||
if (section &&
|
||||
section.belongStation) {
|
||||
this.addModel.endStationCode = section.belongStation;
|
||||
}
|
||||
this.addModel.destinationCode = section.destinationCode || '';
|
||||
this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode');
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(false);
|
||||
this.oldEndSectionCode = code;
|
||||
} else {
|
||||
this.addModel.endSectionCode = this.oldEndSectionCode;
|
||||
this.$message.error('请选择正确的终到区段');
|
||||
}
|
||||
} else {
|
||||
this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode');
|
||||
this.addModel.endStationCode = '';
|
||||
this.addModel.endSectionCode = '';
|
||||
this.oldEndSectionCode = '';
|
||||
}
|
||||
},
|
||||
judgeAllowSelected() {
|
||||
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '' && this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
|
||||
this.allowSelect = true;
|
||||
} else {
|
||||
this.allowSelect = false;
|
||||
}
|
||||
},
|
||||
addStartSectionData(isStation) {
|
||||
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '') {
|
||||
this.isStartSelected = true;
|
||||
this.pushSection({stationCode: this.addModel.startStationCode, sectionCode: this.addModel.startSectionCode}, 'top', isStation);
|
||||
}
|
||||
},
|
||||
addEndSectionData(isStation) {
|
||||
if (this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
|
||||
this.pushSection({stationCode: this.addModel.endStationCode, sectionCode: this.addModel.endSectionCode}, 'bottom', isStation);
|
||||
}
|
||||
},
|
||||
buildModel(code) {
|
||||
const model = Object.assign({}, this.addModel);
|
||||
model['mapId'] = this.$route.query.mapId;
|
||||
model['userId'] = this.$store.state.user.id;
|
||||
if (code) { model['code'] = code; }
|
||||
return model;
|
||||
},
|
||||
update() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
const data = this.buildModel();
|
||||
// delete data.withLoop;
|
||||
updateRoutingData(data).then(resp => {
|
||||
this.$message.success(this.$t('tip.pathUpdataSuccessful'));
|
||||
this.loading = false;
|
||||
this.clear();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('tip.pathUpdataFailed') + ':' + error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
addRoutingData(this.buildModel(setUID('Routing'))).then(resp => {
|
||||
this.$message.success(this.$t('tip.pathCreationSuccessful'));
|
||||
this.loading = false;
|
||||
this.clear();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(this.$t('tip.createRoutingFailed') + ':' + error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
formatName(code) {
|
||||
return formatName(code);
|
||||
},
|
||||
deleteSection(list, index) {
|
||||
const data = list.splice(index, 1);
|
||||
if (data.length > 0) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](data[0].sectionCode);
|
||||
section.instance.drawBatchSelected(section, '');
|
||||
}
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field === this.field ? '' : field;
|
||||
},
|
||||
// 行拖拽
|
||||
rowDrop() {
|
||||
const that = this;
|
||||
const tbody = document.querySelector('.el-parkSectionCode-table tbody', {filter:'.ignoreDrag'});
|
||||
if (tbody) {
|
||||
Sortable.create(tbody, {
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const length = that.addModel.parkSectionCodeList.length - 1;
|
||||
if (newIndex != 0 && oldIndex != 0 && newIndex != length && oldIndex != length) {
|
||||
that.addModel.parkSectionCodeList.splice(newIndex, 0, that.addModel.parkSectionCodeList.splice(oldIndex, 1)[0]);
|
||||
const newArray = that.addModel.parkSectionCodeList.slice(0);
|
||||
that.addModel.parkSectionCodeList = [];
|
||||
that.$nextTick(function () {
|
||||
that.addModel.parkSectionCodeList = newArray;
|
||||
});
|
||||
} else {
|
||||
const newArray = that.addModel.parkSectionCodeList.slice(0);
|
||||
that.addModel.parkSectionCodeList = [];
|
||||
that.$nextTick(function () {
|
||||
that.addModel.parkSectionCodeList = newArray;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
pushSection(data, type, isStation) {
|
||||
const list = this.addModel.parkSectionCodeList;
|
||||
if (data && data.stationCode && data.sectionCode) {
|
||||
const index = list.findIndex(elem => { return elem.sectionCode == data.sectionCode; });
|
||||
switch (type) {
|
||||
case 'center': {
|
||||
if (index < 0) {
|
||||
list.splice(list.length - 1, 0, data);
|
||||
} else {
|
||||
this.$messageBox('该区段已经在交路区段中存在');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'top': {
|
||||
if (isStation) {
|
||||
if (list.find(el => { el.sectionCode == this.addModel.startSectionCode; })) {
|
||||
list.splice(0, 1, data);
|
||||
} else {
|
||||
list.unshift(data);
|
||||
}
|
||||
} else {
|
||||
if (index < 0) {
|
||||
if (list.find(el => { el.sectionCode == this.addModel.startSectionCode; })) {
|
||||
list.splice(0, 1, data);
|
||||
} else {
|
||||
list.unshift(data);
|
||||
}
|
||||
} else {
|
||||
if (index == list.length - 1 && list.length >= 2) {
|
||||
this.addModel.startSectionCode = list[0].sectionCode;
|
||||
this.addModel.startStationCode = list[0].stationCode;
|
||||
this.$messageBox('起始区段和终到区段不能相同');
|
||||
} else if (index != list.length - 1 && index != 0) {
|
||||
this.$messageBox('该区段已经在交路区段中存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'bottom': {
|
||||
if (isStation) {
|
||||
if (list.find(el => { el.sectionCode == this.addModel.endSectionCode; })) {
|
||||
list.splice(list.length - 1, 1, data);
|
||||
} else {
|
||||
list.push(data);
|
||||
}
|
||||
} else {
|
||||
if (index < 0) {
|
||||
if (list.find(el => { el.sectionCode == this.addModel.endSectionCode; })) {
|
||||
list.splice(list.length - 1, 1, data);
|
||||
} else {
|
||||
list.push(data);
|
||||
}
|
||||
} else {
|
||||
if (index == 0 && list.length >= 2) {
|
||||
this.addModel.endSectionCode = list[list.length - 1].sectionCode;
|
||||
this.addModel.endStationCode = list[list.length - 1].stationCode;
|
||||
this.$messageBox('起始区段和终到区段不能相同');
|
||||
} else if (index != list.length - 1 && index != 0) {
|
||||
this.$messageBox('该区段已经在交路区段中存在');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (index < 0) {
|
||||
list.splice(list.length - 1, 0, data);
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.routeSameID'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.sectionCode = '';
|
||||
this.stationCode = '';
|
||||
}
|
||||
},
|
||||
popSection(data, type) {
|
||||
const list = this.addModel.parkSectionCodeList;
|
||||
const index = list.findIndex(el => { return el.sectionCode == data[type]; });
|
||||
if (index >= 0) {
|
||||
this.deleteSection(list, index);
|
||||
}
|
||||
},
|
||||
generateParkSection() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.generating = true;
|
||||
gernateRoutingSectionInRunplan(this.buildModel(setUID('Routing'))).then(resp => {
|
||||
this.generating = false;
|
||||
if (resp.data.parkSectionCodeList && resp.data.parkSectionCodeList.length > 2) {
|
||||
this.addModel.parkSectionCodeList = resp.data.parkSectionCodeList;
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$messageBox('生成交路区段数据失败: ' + error.message);
|
||||
this.generating = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.mapEdit_box{
|
||||
float: right;
|
||||
padding: 3px 0;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
@ -1,289 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag title="交路列表" :visible.sync="show" width="85%" :before-do-close="doClose" append-to-body>
|
||||
<div>
|
||||
<QueryListPage
|
||||
ref="queryListPage"
|
||||
:pager-config="pagerConfig"
|
||||
:query-form="queryForm"
|
||||
:query-list="queryList"
|
||||
/>
|
||||
</div>
|
||||
<pre-view-field ref="previewField" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { listMap } from '@/api/jmap/mapdraft';
|
||||
import { listRoutingData, deleteRoutingData, getRoutingData } from '@/api/jmap/mapdraft';
|
||||
import PreViewField from './preview';
|
||||
|
||||
export default {
|
||||
name: 'RouteDetail',
|
||||
components: {
|
||||
PreViewField
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
mapList: [],
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '120px',
|
||||
queryObject: {
|
||||
startStationCode: {
|
||||
type: 'select',
|
||||
label: this.$t('map.startStation'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
endStationCode: {
|
||||
type: 'select',
|
||||
label: this.$t('map.endStation'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
startSectionCode: {
|
||||
type: 'select',
|
||||
label: '起始区段',
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
endSectionCode: {
|
||||
type: 'select',
|
||||
label: '终到区段',
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
afterQuery: this.afterQuery,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('map.routingCode'),
|
||||
prop: 'code'
|
||||
},
|
||||
{
|
||||
title: this.$t('map.startStation'),
|
||||
prop: 'startStationCode'
|
||||
|
||||
},
|
||||
{
|
||||
title: '起始区段',
|
||||
prop: 'startSectionCode'
|
||||
},
|
||||
{
|
||||
title: this.$t('map.endStation'),
|
||||
prop: 'endStationCode'
|
||||
},
|
||||
{
|
||||
title: '终到区段',
|
||||
prop: 'endSectionCode'
|
||||
},
|
||||
{
|
||||
title: this.$t('map.routingDirection'),
|
||||
prop: 'right',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { if (row.right) { return '右行'; } else { return '左行'; } },
|
||||
tagType: (row) => { if (row.right) { return 'primary'; } else { return 'success'; } }
|
||||
},
|
||||
{
|
||||
title: this.$t('map.destination'),
|
||||
prop: 'destinationCode'
|
||||
},
|
||||
{
|
||||
title: this.$t('map.remarks'),
|
||||
prop: 'remarks'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('map.sectionData'),
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('map.preview'),
|
||||
handleClick: this.sectionDetail
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('map.operation'),
|
||||
width: '300',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('map.compile'),
|
||||
handleClick: this.editObj
|
||||
},
|
||||
{
|
||||
name: this.$t('map.deleteObj'),
|
||||
handleClick: this.deleteObj,
|
||||
type: 'danger'
|
||||
}
|
||||
// {
|
||||
// name: '生成站间运行数据',
|
||||
// handleClick: this.generateData,
|
||||
// type: 'danger'
|
||||
// }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList',
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.acquireMapList();
|
||||
this.initQueryObject();
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.show = true;
|
||||
this.reloadTable();
|
||||
},
|
||||
initQueryObject() {
|
||||
const stationList = [];
|
||||
if (this.stationList && this.stationList.length) {
|
||||
this.stationList.forEach(elem => {
|
||||
stationList.push({ label: this.formatName(elem.code), value: elem.code });
|
||||
});
|
||||
this.queryForm.queryObject.startStationCode.config.data = stationList;
|
||||
this.queryForm.queryObject.endStationCode.config.data = stationList;
|
||||
}
|
||||
const sectionList = [];
|
||||
if (this.sectionList && this.sectionList.length) {
|
||||
this.sectionList.forEach(elem => {
|
||||
if (elem.standTrack || elem.reentryTrack || elem.transferTrack) {
|
||||
sectionList.push({ label: this.formatName(elem.code), value: elem.code });
|
||||
}
|
||||
});
|
||||
this.queryForm.queryObject.startSectionCode.config.data = sectionList;
|
||||
this.queryForm.queryObject.endSectionCode.config.data = sectionList;
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.show = false;
|
||||
},
|
||||
formatName(code) {
|
||||
let name = '';
|
||||
const device = this.$store.getters['map/getDeviceByCode'](code);
|
||||
if (device) {
|
||||
name = device.name;
|
||||
}
|
||||
|
||||
return name;
|
||||
},
|
||||
queryFunction(params) {
|
||||
if (this.$route.query.mapId) {
|
||||
return listRoutingData(this.$route.query.mapId, params);
|
||||
}
|
||||
},
|
||||
acquireMapList() {
|
||||
// 地图名称列表
|
||||
listMap({drawWay: true}).then(response => {
|
||||
this.mapList = response.data;
|
||||
});
|
||||
},
|
||||
afterQuery(data) {
|
||||
if (data && data.list) {
|
||||
const that = this;
|
||||
const list = data.list;
|
||||
if (list) {
|
||||
list.map(elem => {
|
||||
that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']);
|
||||
elem.startStationCode = that.formatName(elem.startStationCode);
|
||||
elem.startSectionCode = that.formatName(elem.startSectionCode);
|
||||
elem.endStationCode = that.formatName(elem.endStationCode);
|
||||
elem.endSectionCode = that.formatName(elem.endSectionCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
editObj(index, row) {
|
||||
getRoutingData(row.id).then(response => {
|
||||
const data = Object.assign({ code: response.data.id }, response.data);
|
||||
this.$emit('routingSelected', data);
|
||||
this.doClose();
|
||||
});
|
||||
},
|
||||
deleteObj(index, row) {
|
||||
if (this.$route.query.mapId && row) {
|
||||
this.$confirm('是否确认删除交路', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 删除
|
||||
deleteRoutingData(row.id).then(response => {
|
||||
this.$message.success(this.$t('map.successfullyDelete'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('map.failDelete'));
|
||||
});
|
||||
}).catch();
|
||||
}
|
||||
},
|
||||
// generateData(index, row) {
|
||||
// if (this.$route.query.mapId && row) {
|
||||
// // 根据地图交路区段生成站间运行等级
|
||||
// generateStationRunData(row.id).then(response => {
|
||||
// this.$message.success(this.$t('map.generateStationRunDataSuccess'));
|
||||
// // 站间运行数据生成成功
|
||||
// this.reloadTable();
|
||||
// }).catch((error) => {
|
||||
// // 站间运行数据生成失败
|
||||
// this.$messageBox(this.$t('map.generateStationRunDataFailed') + ': ' + error.message);
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
sectionDetail(index, row) {
|
||||
const sectionDict = {};
|
||||
const stationDict = {};
|
||||
this.sectionList.forEach(elem => { sectionDict[elem.code] = elem.name; });
|
||||
this.stationList.forEach(elem => { stationDict[elem.code] = elem.name; });
|
||||
|
||||
const fieldList = {
|
||||
id: row.id,
|
||||
mapId: this.$route.params.mapId,
|
||||
title: '区段列表',
|
||||
name: row.name,
|
||||
model: {
|
||||
field: 'parkSectionCodeList',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: this.$t('map.stationCodeClomn'), type: 'text' },
|
||||
{
|
||||
prop: 'stationCode', label: '车站名称', type: 'select', options: stationDict
|
||||
},
|
||||
{ prop: 'sectionCode', label: this.$t('map.blockCodingClomn'), type: 'text' },
|
||||
{
|
||||
prop: 'sectionCode', label: this.$t('map.sectionName'), type: 'select', options: sectionDict
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
this.$refs.previewField.doShow(fieldList, row.parkSectionCodeList);
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
this.queryList.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,192 +0,0 @@
|
||||
<template>
|
||||
<div class="runPlanConfig">
|
||||
<div class="reentryConfig">折返配置 (单位:秒)</div>
|
||||
<div class="reentryConfigTable">
|
||||
<el-table
|
||||
:data="reentryDataList"
|
||||
border
|
||||
style="width:100%"
|
||||
height="430"
|
||||
class="el-parkSectionCode-table"
|
||||
>
|
||||
<el-table-column prop="stationCode" :label="$t('map.stationName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.stationName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站前折返">
|
||||
<template slot-scope="scope">
|
||||
<!-- v-if="scope.row.reentryData.tbFrom" -->
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbFront"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
<!-- <el-button v-else type="primary" size="small" @click="add(scope.row)">添加</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站后折返">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbBack"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="从股道到折返">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbFrom"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="从折返到股道">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.reentryData.tbTo"
|
||||
:style="{width: '80px'}"
|
||||
:min="1"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-button-group style="padding:10px">
|
||||
<el-button type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { addRunplanConfig, getRunplanConfig } from '@/api/jmap/mapdraft';
|
||||
export default {
|
||||
name:'RunPlanConfig',
|
||||
data() {
|
||||
return {
|
||||
reentryDataList:[],
|
||||
stationList:{},
|
||||
sectionCode:'',
|
||||
field:'',
|
||||
loading:false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
if (this.sectionList) {
|
||||
const reentrySections = this.sectionList.filter(elem => { return elem.reentryTrack; });
|
||||
const stationList = {};
|
||||
reentrySections.forEach(each=>{
|
||||
if (each.belongStation) {
|
||||
const station = this.$store.getters['map/getDeviceByCode'](each.belongStation);
|
||||
if (!stationList[each.belongStation]) {
|
||||
stationList[each.belongStation] = {code:each.belongStation, stationName:station.name,
|
||||
reentryData:{tbFront:undefined, tbBack:undefined, tbFrom:undefined, tbTo:undefined}};
|
||||
}
|
||||
}
|
||||
});
|
||||
this.reentryDataList = Object.values(stationList);
|
||||
this.stationList = stationList;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
doShow() {
|
||||
this.loading = false;
|
||||
getRunplanConfig(this.$route.query.mapId).then(resp => {
|
||||
if (resp.data && resp.data.config && resp.data.config.reentryData) {
|
||||
const reentryData = resp.data.config.reentryData;
|
||||
const keys = Object.keys(reentryData);
|
||||
keys.forEach(each=>{
|
||||
this.stationList[each].reentryData = reentryData[each];
|
||||
});
|
||||
const newData = Object.values(this.stationList);
|
||||
this.reentryDataList = [...newData || []];
|
||||
}
|
||||
});
|
||||
},
|
||||
save() {
|
||||
const tbBackList = [];
|
||||
const reentryData = {};
|
||||
this.reentryDataList.forEach(each=>{
|
||||
if (each.reentryData.tbFront || (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
|
||||
const temp = Object.assign({}, each.reentryData);
|
||||
if (!(each.reentryData.tbFront && (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo))) {
|
||||
if (each.reentryData.tbFront) {
|
||||
temp.tbBack = null;
|
||||
temp.tbFrom = null;
|
||||
temp.tbTo = null;
|
||||
} else {
|
||||
temp.tbFront = null;
|
||||
}
|
||||
}
|
||||
reentryData[each.code] = temp;
|
||||
} else {
|
||||
if (each.reentryData.tbBack || each.reentryData.tbFrom || each.reentryData.tbTo) {
|
||||
tbBackList.push(each.stationName);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (tbBackList.length > 0) {
|
||||
this.$messageBox('请设置【' + reentryData.toString() + '】站后折返信息');
|
||||
return;
|
||||
} else if (Object.keys(reentryData).length == 0) {
|
||||
// JSON.stringify(reentryData) == '{}'
|
||||
this.$messageBox('请填写折返配置信息');
|
||||
return;
|
||||
}
|
||||
addRunplanConfig(this.$route.query.mapId, {'reentryData':reentryData}).then(resp => {
|
||||
this.$message.success('折返配置成功');
|
||||
this.loading = false;
|
||||
}).catch((error) => {
|
||||
this.$messageBox('折返配置失败' + ':' + error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.reentryConfigTable{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.runPlanConfig{padding:15px 20px}
|
||||
// .reentryConfigTable .el-table--scrollable-y .el-table__body-wrapper{
|
||||
// &::-webkit-scrollbar {
|
||||
// width: 4px;
|
||||
// }
|
||||
|
||||
// &::-webkit-scrollbar-thumb {
|
||||
// border-radius: 10px;
|
||||
// background: #c3c3c3;
|
||||
// }
|
||||
|
||||
// &::-webkit-scrollbar-track {
|
||||
// border-radius: 0;
|
||||
// background: #f0f0f0;
|
||||
|
||||
// }
|
||||
// }
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user