rt-sim-training-client/src/views/newMap/newMapdraft/dataRelation/turnedoperate/detail.vue

188 lines
6.0 KiB
Vue
Raw Normal View History

2019-12-10 16:50:38 +08:00
<template>
2020-03-10 18:56:03 +08:00
<el-dialog v-dialogDrag :title="$t('map.autoTurnedList')" :visible.sync="show" width="85%" :before-do-close="doClose">
2019-12-10 16:50:38 +08:00
<div>
<QueryListPage
ref="queryListPage"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
/>
</div>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
2019-12-11 13:56:46 +08:00
import { getAutoReentryList, delAutoReentry, getAutoReentryById, getRouteNewList } from '@/api/jmap/mapdraft';
2019-12-10 16:50:38 +08:00
export default {
name: 'RouteDetail',
props: {
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
show: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
2019-12-11 13:56:46 +08:00
routeList: [],
2019-12-10 16:50:38 +08:00
queryForm: {
labelWidth: '120px',
queryObject: {
2019-12-11 14:10:51 +08:00
name: {
type: 'text',
2020-03-10 18:56:03 +08:00
label: this.$t('map.autoTurnedName')
2020-03-26 17:23:19 +08:00
},
code: {
type: 'text',
label: '折返进路code'
2019-12-10 16:50:38 +08:00
}
}
},
queryList: {
query: this.queryFunction,
afterQuery: this.afterQuery,
selectCheckShow: false,
indexShow: true,
columns: [
{
2020-03-10 18:56:03 +08:00
title: this.$t('map.autoTurnedName'),
2019-12-11 13:56:46 +08:00
prop: 'name'
2019-12-10 16:50:38 +08:00
},
2020-03-26 17:23:19 +08:00
{
title: '折返进路code',
prop: 'code'
},
2020-02-18 14:45:32 +08:00
{
2020-03-10 18:56:03 +08:00
title: this.$t('map.routeStationName'),
2020-02-18 14:45:32 +08:00
prop: 'stationCode'
},
2019-12-10 16:50:38 +08:00
{
2020-03-10 18:56:03 +08:00
title: this.$t('map.reentryRoute'),
2019-12-11 13:56:46 +08:00
prop: 'turnBackRouteCode'
2019-12-10 16:50:38 +08:00
},
{
2020-03-10 18:56:03 +08:00
title: this.$t('map.basicRoute'),
2019-12-11 13:56:46 +08:00
prop: 'basicRouteCode'
2019-12-10 16:50:38 +08:00
},
{
2020-03-10 18:56:03 +08:00
title: this.$t('map.reentrySection'),
2019-12-11 13:56:46 +08:00
prop: 'reentryTrackCode'
2019-12-10 16:50:38 +08:00
},
2020-03-10 18:56:03 +08:00
{
title: this.$t('map.reentryRoute2'),
prop: 'turnBackRoute2Code'
},
{
title: this.$t('map.basicRoute2'),
prop: 'basicRoute2Code'
},
{
title: this.$t('map.reentrySection2'),
prop: 'reentryTrack2Code'
},
2019-12-10 16:50:38 +08:00
{
type: 'button',
title: this.$t('map.operation'),
width: '200',
buttons: [
{
name: this.$t('map.compile'),
handleClick: this.editObj
},
{
name: this.$t('map.deleteObj'),
handleClick: this.deleteObj,
type: 'danger'
}
]
}
2019-12-11 18:25:03 +08:00
],
actions: [
2020-03-10 18:56:03 +08:00
{ text: this.$t('map.setPriority'), handler: this.setPriority }
2019-12-10 16:50:38 +08:00
]
}
};
},
computed: {
...mapGetters('map', [
2020-02-18 14:45:32 +08:00
'sectionList',
'stationList'
2019-12-10 16:50:38 +08:00
])
},
watch: {
2019-12-11 13:56:46 +08:00
2019-12-10 16:50:38 +08:00
},
mounted() {
},
methods: {
doShow() {
this.show = true;
2019-12-11 13:56:46 +08:00
this.getRouteList();
2019-12-10 16:50:38 +08:00
this.reloadTable();
},
doClose() {
this.show = false;
},
queryFunction(params) {
if (this.mapInfo && this.mapInfo.id) {
2019-12-11 13:56:46 +08:00
return getAutoReentryList(this.mapInfo.id, params);
2019-12-10 16:50:38 +08:00
}
},
afterQuery(data) {
if (data && data.list) {
const that = this;
const list = data.list;
if (list) {
list.map(elem => {
2020-02-18 14:45:32 +08:00
that.$convertSpecifiedField(elem, that.stationList, 'code', 'name', ['stationCode']);
2020-03-10 18:56:03 +08:00
that.$convertSpecifiedField(elem, that.sectionList, 'code', 'name', ['reentryTrackCode', 'reentryTrack2Code']);
that.$convertSpecifiedField(elem, that.routeList, 'code', 'name', ['turnBackRouteCode', 'basicRouteCode', 'turnBackRoute2Code', 'basicRoute2Code']);
2019-12-10 16:50:38 +08:00
});
}
}
return data;
},
editObj(index, row) {
2019-12-11 13:56:46 +08:00
getAutoReentryById(row.id).then(response => {
2019-12-10 16:50:38 +08:00
const data = response.data;
2019-12-11 13:56:46 +08:00
this.$emit('autoReentrySelected', data);
2019-12-10 16:50:38 +08:00
this.doClose();
});
},
deleteObj(index, row) {
if (this.mapInfo && this.mapInfo.id && row) {
// 删除
2019-12-11 13:56:46 +08:00
delAutoReentry(row.id).then(response => {
2019-12-10 16:50:38 +08:00
this.$message.success(this.$t('map.successfullyDelete'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('map.failDelete'));
});
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
2019-12-11 13:56:46 +08:00
},
2020-03-10 18:56:03 +08:00
async getRouteList() {
2019-12-11 13:56:46 +08:00
getRouteNewList(this.$route.params.mapId, {pageSize:9999, pageNum:1}).then((resp) => {
this.routeList = resp.data.list;
});
2019-12-11 18:25:03 +08:00
},
setPriority() {
this.show = false;
this.$emit('setPriority');
2019-12-10 16:50:38 +08:00
}
}
};
</script>