This commit is contained in:
fan 2021-04-21 15:02:38 +08:00
commit e068496c75
4 changed files with 262 additions and 11 deletions

View File

@ -571,3 +571,9 @@ export function postBigRoute(data, mapId) {
data:data
});
}
export function getBigRouteList(mapId) {
return request({
url: `/api/draftMap/${mapId}/route/all `,
method: 'get'
});
}

View File

@ -0,0 +1,231 @@
<template>
<el-dialog v-dialogDrag :title="$t('map.routePreview')" :visible.sync="show" width="95%" :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" :map-info="mapInfo" />
<protect-detail ref="protectDetail" :map-info="mapInfo" /> -->
</el-dialog>
</template>
<script>
import { getBigRouteList } from '@/api/jmap/mapdraft';
export default {
name:'BigRouteDetail',
props: {
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
show:false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
filterRouteMap:{},
queryForm: {
// labelWidth: '120px',
// queryObject: {
// }
show:false
},
signalAspectList:[
{label:'红', value:1},
{label:'绿', value:2},
{label:'黄', value:3},
{label:'黄红', value:4},
{label:'绿绿', value:5},
{label:'绿黄', value:6},
{label:'黄黄', value:7},
{label:'黄闪黄', value:8},
{label:'白红', value:9},
{label:'蓝', value:10},
{label:'白', value:11},
{label:'红闪', value:12}
],
switchLocateTypeList: [
{ label: '定位', value: true },
{ label: '反位', value: false }
],
queryList: {
// query: this.queryFunction,
data:[],
// afterQuery: this.afterQuery,
selectCheckShow: false,
indexShow: true,
paginationHiden:true,
columns: [
{
title: '进路名称',
prop: 'name'
},
{
title: '始端信号机',
prop: 'startSignalCode',
width: 150,
type: 'tag',
columnValue: (row) => { return this.getSignalName(row.startSignalCode, row.multiRoute); },
tagType: (row) => { return ''; }
},
{
title: '信号显示',
prop: 'signalAspect',
width: 150,
type: 'tag',
columnValue: (row) => { return this.getSignalAspect(row.signalAspect, row.multiRoute); },
tagType: (row) => { return ''; }
},
{
title: '起始区段',
prop: 'startSectionCode',
width: 150,
type: 'tag',
columnValue: (row) => { return this.getSectionName(row.startSectionCode, row.multiRoute); },
tagType: (row) => { return ''; }
},
{
title: '终到区段',
prop: 'endSectionCode',
width: 150,
type: 'tag',
columnValue: (row) => { return this.getSectionName(row.endSectionCode, row.multiRoute); },
tagType: (row) => { return ''; }
},
{
title: '途经道岔位置',
prop: 'pathSwitchPosition',
width: 300,
type: 'tag',
columnValue: (row) => { return this.getPathSwitchPosition(row.pathSwitchPosition, row.multiRoute); },
tagType: (row) => { return ''; }
},
{
title: '多进路引用进路',
prop: 'routeAspectList',
width: 300,
type: 'tagMore',
columnValue: (row) => { return this.getRouteAspectList(row.routeAspectList, row.multiRoute); },
tagType: (row) => { return ''; }
},
{
title: '排列进路按钮',
prop: 'btnCodeList',
width: 300,
type: 'tagMore',
columnValue: (row) => { return this.getBtnCodeList(row.btnCodeList); },
tagType: (row) => { return ''; }
}
// multiRoute
]
}
};
},
mounted() {
},
methods:{
doShow() {
this.show = true;
if (this.mapInfo && this.mapInfo.id) {
this.queryList.data = [];
getBigRouteList(this.mapInfo.id).then(response => {
this.queryList.data = response.data;
response.data.forEach(route=>{
if (!route.multiRoute) {
this.filterRouteMap[route.code] = route.name;
}
});
}).catch(()=>{
this.queryList.data = [];
});
}
this.reloadTable();
},
doClose() {
this.show = false;
},
// queryFunction(params) {
// if (this.mapInfo && this.mapInfo.id) {
// debugger;
// // this.queryList.query(this.queryData).then(response => {
// return getBigRouteList(this.mapInfo.id);
// }
// },
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
getSignalName(code, multiRoute) {
if (multiRoute) {
return '';
} else {
return this.formatName(code);
}
},
getSectionName(code, multiRoute) {
if (multiRoute) {
return '';
} else {
return this.formatName(code);
}
},
getSignalAspect(code, multiRoute) {
if (multiRoute) {
return '';
} else {
return this.$convertField(code, this.signalAspectList, ['value', 'label']);
}
},
getPathSwitchPosition(pathSwitchPosition, multiRoute) {
if (multiRoute) {
return '';
} else {
if (pathSwitchPosition) {
const position = this.$convertField(pathSwitchPosition.normal, this.switchLocateTypeList, ['value', 'label']);
return '' + this.formatName(pathSwitchPosition.switchCode) + ' (' + position + ')';
} else {
return '';
}
}
},
getBtnCodeList(btnCodeList) {
const nameList = [];
btnCodeList.forEach(item => {
nameList.push(this.formatName(item));
});
return nameList;
},
formatName(code) {
let name = '';
const device = this.$store.getters['map/getDeviceByCode'](code);
if (device) {
name = device.name || '';
}
return name;
},
getRouteAspectList(routeAspectList, multiRoute) {
const nameList = [];
if (multiRoute) {
routeAspectList.forEach(item => {
const route = this.filterRouteList[item.routeCode];
if (route) {
const signalAspect = this.$convertField(route.signalAspect, this.signalAspectList, ['value', 'label']) || '';
nameList.push(route.name + '(' + signalAspect + ')');
}
});
}
return nameList;
}
}
};
</script>

View File

@ -7,18 +7,18 @@
:route-data="routeData"
@setCenter="setCenter"
/>
<!-- <route-detail ref="routeDetail" :map-info="mapInfo" @routeSelected="routeSelected" /> -->
<big-route-detail ref="routeDetail" :map-info="mapInfo" @routeSelected="routeSelected" />
</div>
</template>
<script>
import BigRouteDraft from './route';
// import BigRouteDetail from './detail';
import BigRouteDetail from './detail';
export default {
name: 'BigRouteOperate',
components: {
BigRouteDraft
// BigRouteDetail
BigRouteDraft,
BigRouteDetail
},
props: {
mapInfo: {
@ -37,9 +37,15 @@ export default {
data() {
return {
enabledTab: 'Route',
routeData: null
routeData: null,
routeList:[]
};
},
created() {
// filterRouteList() {
// return this.routeList.filter(route=>{ return !route.multiRoute; });
// } 'routeList',
},
methods: {
clickEvent(e, model) {
this.onSelect(model);
@ -61,7 +67,7 @@ export default {
routeSelected: function (data) {
this.routeData = data;
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.isSave = !data.id;
this.$refs.routeEdit.isModify = data.id;
}
},
previewRouteEvent: function () {

View File

@ -151,6 +151,7 @@
</div>
</template>
<script>
import { getBigRouteList } from '@/api/jmap/mapdraft';
import { setUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index';
// putRouteNew, getRouteNewList, getContinueProtectList, getFlankProtectionList
@ -185,6 +186,7 @@ export default {
isModify:false,
routeCode:'',
signalAspect:1,
routeList:[],
signalAspectList:[
{label:'红', value:1},
{label:'绿', value:2},
@ -257,16 +259,22 @@ export default {
'sectionList',
'switchList',
'signalList',
'routeList',
'signalButtonList'
]),
btnList() {
return [...this.signalList, ...this.signalButtonList];
},
filterRouteList() {
return this.routeList.filter(route=>{ return !route.multiRoute; });
}
},
mounted() {
getBigRouteList(this.$route.params.mapId).then(response => {
response.data.forEach(route=>{
if (!route.multiRoute) {
this.routeList.push({code:route.code, name:route.name});
}
});
}).catch(()=>{
});
},
methods:{
hover(field) {
this.field = field === this.field ? '' : field;
@ -333,7 +341,7 @@ export default {
postBigRoute(newModel, that.mapInfo.id).then(res=>{
that.$message.success(that.$t('tip.creatingSuccessful'));
that.loading = false;
that.routeList.push(newModel);
if (!newModel.multiRoute) { that.routeList.push({code:newModel.code, name:newModel.name}); }
that.clear();
}).catch(() => {
that.$messageBox(that.$t('tip.operationAbnormal'));