自动折返设置优先级

This commit is contained in:
fan 2019-12-11 18:25:03 +08:00
parent eafb83a886
commit cc014d4ccc
5 changed files with 184 additions and 15 deletions

View File

@ -469,3 +469,11 @@ export function getRouteNewList(mapId, params) {
params params
}); });
} }
// 获取自动折返分组列表
export function getAutoReentryGroupList(mapId, params) {
return request({
url: `/api/mapBuild/${mapId}/autoReentry/group/reentryTrack`,
method: 'get',
params
});
}

View File

@ -80,6 +80,9 @@ export default {
} }
] ]
} }
],
actions: [
{ text: '设置优先级', handler: this.setPriority }
] ]
} }
}; };
@ -148,6 +151,10 @@ export default {
getRouteNewList(this.$route.params.mapId, {pageSize:9999, pageNum:1}).then((resp) => { getRouteNewList(this.$route.params.mapId, {pageSize:9999, pageNum:1}).then((resp) => {
this.routeList = resp.data.list; this.routeList = resp.data.list;
}); });
},
setPriority() {
this.show = false;
this.$emit('setPriority');
} }
} }
}; };

View File

@ -1,23 +1,26 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%;">
<route-draft <turned-draft
ref="routeEdit" ref="turnedEdit"
:selected="selected" :selected="selected"
:map-info="mapInfo" :map-info="mapInfo"
:route-data="routeData" :route-data="routeData"
/> />
<route-detail ref="routeDetail" :map-info="mapInfo" @autoReentrySelected="autoReentrySelected" /> <turned-detail ref="turnedDetail" :map-info="mapInfo" @autoReentrySelected="autoReentrySelected" @setPriority="setPriority" />
<turned-priority ref="turnedPriority" :map-info="mapInfo" />
</div> </div>
</template> </template>
<script> <script>
import RouteDraft from './route'; import TurnedDraft from './route';
import RouteDetail from './detail'; import TurnedDetail from './detail';
import TurnedPriority from './priority';
export default { export default {
name: 'TurnedOperate', name: 'TurnedOperate',
components: { components: {
RouteDraft, TurnedDraft,
RouteDetail TurnedDetail,
TurnedPriority
}, },
props: { props: {
mapInfo: { mapInfo: {
@ -59,25 +62,28 @@ export default {
}, },
autoReentrySelected: function (data) { autoReentrySelected: function (data) {
this.routeData = data; this.routeData = data;
if (this.$refs && this.$refs.routeEdit) { if (this.$refs && this.$refs.turnedEdit) {
this.$refs.routeEdit.isSave = false; this.$refs.turnedEdit.isSave = false;
} }
}, },
previewRouteEvent: function () { previewRouteEvent: function () {
if (this.$refs && this.$refs.routeDetail) { if (this.$refs && this.$refs.turnedDetail) {
this.$refs.routeDetail.doShow(); this.$refs.turnedDetail.doShow();
} }
}, },
createRouteEvent: function () { createRouteEvent: function () {
if (this.$refs && this.$refs.routeEdit) { if (this.$refs && this.$refs.turnedEdit) {
this.$refs.routeEdit.clear(); this.$refs.turnedEdit.clear();
} }
}, },
setSelected(selected) { setSelected(selected) {
this.$refs.routeEdit.setSelected(selected); this.$refs.turnedEdit.setSelected(selected);
}, },
setCenter(code) { setCenter(code) {
this.$emit('setCenter', code); this.$emit('setCenter', code);
},
setPriority() {
this.$refs.turnedPriority.doShow();
} }
} }
}; };

View File

@ -0,0 +1,148 @@
<template>
<el-dialog v-dialogDrag title="自动折返分组列表" :visible.sync="show" width="85%" :before-do-close="doClose">
<div>
<el-table
:data="tableData"
:span-method="objectSpanMethod"
border
style="width: 100%; margin-top: 20px"
>
<el-table-column
prop="reentryTrackCode"
label="折返区段"
>
<template slot-scope="scope">
<span>{{ handelSpecifiedField(scope.row.reentryTrackCode, sectionList, 'code', 'name') }}</span>
</template>
</el-table-column>
<el-table-column
prop="name"
label="折返名称"
/>
<el-table-column
prop="basicRouteCode"
label="基础进路"
>
<template slot-scope="scope">
<span>{{ handelSpecifiedField(scope.row.basicRouteCode, routeList, 'code', 'name') }}</span>
</template>
</el-table-column>
<el-table-column
prop="turnBackRouteCode"
label="折返进路"
>
<template slot-scope="scope">
<span>{{ handelSpecifiedField(scope.row.turnBackRouteCode, routeList, 'code', 'name') }}</span>
</template>
</el-table-column>
<el-table-column
prop="priority"
label="优先级"
>
<template slot-scope="scope">
<el-input-number v-model="scope.row.priority" size="small" :min="0" :max="10" />
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
@click.native.prevent="updateRow(scope.$index, scope.row)"
>保存</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import {getAutoReentryGroupList, getRouteNewList, putAutoReentry} from '@/api/jmap/mapdraft';
export default {
name: 'Priority',
props: {
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
show: false,
spanArr: [],
tableData:[],
routeList:[]
};
},
computed: {
...mapGetters('map', [
'sectionList'
])
},
methods:{
async initData() {
const resp = await getAutoReentryGroupList(this.mapInfo.id);
const response = await getRouteNewList(this.$route.params.mapId, {pageSize:9999, pageNum:1});
this.routeList = response.data.list;
const keyList = Object.keys(resp.data);
let data = [];
if (keyList) {
keyList.map(elem => {
for (var i = 0; i < resp.data[elem].length; i++) {
if (i === 0) {
this.spanArr.push(resp.data[elem].length);
} else {
this.spanArr.push(0);
}
}
data = [...data, ...resp.data[elem]];
});
// data.map(elem => {
// this.$convertSpecifiedField(elem, this.sectionList, 'code', 'name', ['reentryTrackCode']);
// this.$convertSpecifiedField(elem, this.routeList, 'code', 'name', ['turnBackRouteCode', 'basicRouteCode']);
// });
}
this.tableData = data;
},
doShow() {
this.show = true;
this.initData();
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
return {
rowspan: this.spanArr[rowIndex],
colspan: this.spanArr[rowIndex] ? 1 : 0
};
}
},
updateRow(index, row) {
putAutoReentry(row).then(resp => {
this.$message.success('更新折返成功!');
this.loading = false;
this.initData();
}).catch(() => {
this.$messageBox('更新折返失败!');
this.loading = false;
});
},
handelSpecifiedField(value, list, code, name ) {
let needName = '';
list.forEach(item => {
if (item[code] === value) {
needName = item[name];
}
});
return needName;
}
}
};
</script>
<style scoped>
</style>

View File

@ -91,7 +91,7 @@ export default {
basicRouteName:'', basicRouteName:'',
turnBackRouteCode: '', turnBackRouteCode: '',
basicRouteCode:'', basicRouteCode:'',
priority: '', priority: 0,
reentryTrackCode: '' reentryTrackCode: ''
}, },
editShow: false, editShow: false,