This commit is contained in:
fan 2021-05-26 17:25:26 +08:00
commit 4191df5fff
4 changed files with 349 additions and 246 deletions

View File

@ -412,9 +412,16 @@ export function putRouteNew(data) {
data:data
});
}
export function delRouteNew(id) {
// export function delRouteNew(id) {
// return request({
// url: `/api/mapBuild/routeNew/${id}`,
// method: 'delete'
// });
// }
// 删除指定code进路
export function delRouteNew(mapId, code) {
return request({
url: `/api/mapBuild/routeNew/${id}`,
url: `/api/draftMap/${mapId}/route/${code}`,
method: 'delete'
});
}
@ -424,13 +431,30 @@ export function getRouteNewById(id) {
method: 'get'
});
}
// // 分页查询进路数据(old)
// export function getRouteNewList(mapId, params) {
// return request({
// url: `/api/mapBuild/${mapId}/routeNew`,
// method: 'get',
// params
// });
// }
// 分页查询进路数据(new)
export function getRouteNewList(mapId, params) {
return request({
url: `/api/mapBuild/${mapId}/routeNew`,
url: `/api/draftMap/${mapId}/route/paging`,
method: 'get',
params
});
}
// 修改进路属性对象
export function putSetDraftMapRouteById(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/route/${data.code} `,
method: 'put',
data
});
}
// 新建进路侧防
export function postFlankProtection(data) {
return request({

View File

@ -45,13 +45,22 @@
<el-table-column
v-if="checkColumnTyep(column, 'basic')"
:key="index"
:prop="column.prop"
:label="column.title"
:width="column.width"
show-overflow-tooltip
:sortable="column.sortable"
:sort-by="column.sortBy"
/>
>
<template slot-scope="scope">
<template v-if="!column.edit">
<span class="hideOutContent">{{ scope.row[column.prop] }}</span>
</template>
<template v-else>
<div v-show="!scope.row.isEdit" class="hideOutContent" @click="handleEdit(scope.row, column, scope.$index)">{{ scope.row[column.prop] }}</div>
<el-input v-show="scope.row.isEdit" ref="customerInput" v-model="scope.row[column.prop]" placeholder="请输入内容" size="mini" autofocus @blur="handleEditBlur(scope.row, column)" />
</template>
</template>
</el-table-column>
<el-table-column
v-else-if="checkColumnTyep(column, 'html')"
:key="index"
@ -87,7 +96,12 @@
:sort-by="column.sortBy"
>
<template slot-scope="scope">
<el-tag v-if="column.columnValue(scope.row, scope.$index)" :type="column.tagType(scope.row, scope.$index)">{{ column.columnValue(scope.row, scope.$index) }}</el-tag>
<template v-if="!column.edit">
<el-tag v-if="column.columnValue(scope.row, scope.$index)" :type="column.tagType(scope.row, scope.$index)">{{ column.columnValue(scope.row, scope.$index) }}</el-tag>
</template>
<template v-else>
<el-checkbox v-model="scope.row[column.prop]" />
</template>
</template>
</el-table-column>
<el-table-column
@ -295,6 +309,16 @@ export default {
// this.tableHeight = this.$refs.table2.$el.offsetHeight + 23;
},
methods: {
handleEdit(row, column, index) {
this.$set(row, 'isEdit', true);
// console.log(this.$refs);
// if (this.$refs.customerInput.length) {
// this.$refs.customerInput[index].$el.querySelector('input').focus();
// }
},
handleEditBlur(row, column) {
this.$set(row, 'isEdit', false);
},
//
checkColumnTyep(column, typeName) {
if (column.show === false) {
@ -379,6 +403,7 @@ export default {
});
if (fv.type === 'date') {
const format = fv.format || 'yyyy-MM-dd';
// eslint-disable-next-line new-cap
return new Date(obj).Format(format);
} else if (fv.formatter instanceof Function) {
return fv.formatter(v);

View File

@ -2,9 +2,9 @@ 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 = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康

View File

@ -1,6 +1,6 @@
<template>
<div v-show="show">
<el-dialog v-dialogDrag :title="$t('map.routePreview')" :visible.sync="show" width="95%" :before-do-close="doClose" append-to-body>
<el-dialog v-dialogDrag :title="$t('map.routePreview')" :visible.sync="show" width="95%" top="1vh" class="dialog_content_box" :before-do-close="doClose" append-to-body>
<div>
<QueryListPage
ref="queryListPage"
@ -18,7 +18,7 @@
<script>
import { mapGetters } from 'vuex';
import { listMap, getRouteNewList, delRouteNew, getRouteNewById, putRouteNew, getContinueProtectList, delContinueProtect } from '@/api/jmap/mapdraft';
import { listMap, getRouteNewList, delRouteNew, getRouteNewById, putRouteNew, getContinueProtectList, delContinueProtect, putSetDraftMapRouteById } from '@/api/jmap/mapdraft';
import ProtectDetail from './protectDetail';
import PreViewField from './preview';
import Related from './related';
@ -99,6 +99,7 @@ export default {
{
title: this.$t('map.pathName'),
prop: 'name',
edit: true,
width: 180
},
{
@ -108,7 +109,28 @@ export default {
},
{
title: this.$t('map.routeStationName'),
prop: 'stationCode'
prop: 'stationCode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.stationCode, this.stationList, ['code', 'name']); },
tagType: (row) => { return ''; }
},
{
title: '是否自动追踪/联锁自动触发',
edit: true,
type: 'tag',
prop: 'arc'
},
{
title: '自排',
edit: true,
type: 'tag',
prop: 'ars'
},
{
title: this.$t('map.whetherAutoRoute'),
edit: true,
type: 'tag',
prop: 'flt'
},
{
title: this.$t('map.accessType'),
@ -119,10 +141,24 @@ export default {
},
{
title: this.$t('map.whetherAutoRoute'),
prop: 'flt',
title: 'atp进路',
prop: 'atp',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.flt, this.turnBackList, ['value', 'label']); },
columnValue: (row) => { return this.$convertField(row.atp, this.turnBackList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: '联锁进路',
prop: 'ground',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.ground, this.turnBackList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: '引导进路',
prop: 'guide',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.guide, this.turnBackList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
@ -133,57 +169,57 @@ export default {
title: this.$t('map.endingSignalName'),
prop: 'endSignalCode'
},
{
type: 'button',
title: this.$t('map.continueProtect'),
buttons: [
{
name: this.$t('map.preview'),
handleClick: this.overlapSwitchDetail,
showControl: (row) => { return row.overlapCode; }
}
]
},
{
type: 'button',
title: this.$t('map.accessSideTurnoutData'),
buttons: [
{
name: this.$t('map.preview'),
handleClick: this.flankProtectionSwitchDetail,
showControl: (row) => { return row.routeFlankProtectionList && row.routeFlankProtectionList.length > 0; }
}
]
},
{
type: 'button',
title: this.$t('map.physicalSection'), // list
buttons: [
{
name: this.$t('map.preview'),
handleClick: this.sectionDetail
}
]
},
{
type: 'button',
title: this.$t('map.routeRouteTurnoutData'),
buttons: [
{
name: this.$t('map.preview'),
handleClick: this.routeSwitchDetail,
showControl: (row) => { return row.routeSwitchList.length > 0; }
}
]
},
{
title: this.$t('map.hostileData'),
prop: 'conflictingSignalList',
type: 'tagMore',
width: '250',
columnValue: (row) => { return this.showConflictingSignalList(row.conflictingSignalList); },
tagType: (row) => { return ''; }
},
// {
// type: 'button',
// title: this.$t('map.continueProtect'),
// buttons: [
// {
// name: this.$t('map.preview'),
// handleClick: this.overlapSwitchDetail,
// showControl: (row) => { return row.overlapCode; }
// }
// ]
// },
// {
// type: 'button',
// title: this.$t('map.accessSideTurnoutData'),
// buttons: [
// {
// name: this.$t('map.preview'),
// handleClick: this.flankProtectionSwitchDetail,
// showControl: (row) => { return row.routeFlankProtectionList && row.routeFlankProtectionList.length > 0; }
// }
// ]
// },
// {
// type: 'button',
// title: this.$t('map.physicalSection'), // list
// buttons: [
// {
// name: this.$t('map.preview'),
// handleClick: this.sectionDetail
// }
// ]
// },
// {
// type: 'button',
// title: this.$t('map.routeRouteTurnoutData'),
// buttons: [
// {
// name: this.$t('map.preview'),
// handleClick: this.routeSwitchDetail,
// showControl: (row) => { return row.routeSwitchList.length > 0; }
// }
// ]
// },
// {
// title: this.$t('map.hostileData'),
// prop: 'conflictingSignalList',
// type: 'tagMore',
// width: '250',
// columnValue: (row) => { return this.showConflictingSignalList(row.conflictingSignalList); },
// tagType: (row) => { return ''; }
// },
{
type: 'button',
title: this.$t('map.operation'),
@ -194,12 +230,12 @@ export default {
handleClick: this.edit,
showControl: () => { return this.showType !== 'select'; }
},
{
name: '复制',
handleClick: this.copyObj,
type: 'warning',
showControl: () => { return this.showType !== 'select'; }
},
// {
// name: '',
// handleClick: this.copyObj,
// type: 'warning',
// showControl: () => { return this.showType !== 'select'; }
// },
{
name: this.$t('map.deleteObj'),
handleClick: this.deleteObj,
@ -210,6 +246,11 @@ export default {
name: this.$t('global.select'),
handleClick: this.selectedObj,
showControl: () => { return this.showType === 'select'; }
},
{
name: '更新',
handleClick: this.handleUpdate,
showControl: () => { return this.showType !== 'select'; }
}
]
}
@ -294,116 +335,121 @@ export default {
that.$convertSpecifiedField(elem, that.RouteAutoTypeList, 'code', 'name', ['autoType']);
that.$convertSpecifiedField(elem, that.RouteNatureTypeList, 'code', 'name', ['natureType']);
that.$convertSpecifiedField(elem, that.SwitchLocateTypeList, 'code', 'name', ['overlapSwitchLocateType']);
that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']);
that.$convertSpecifiedField(elem, that.switchList, 'code', 'name', ['routeOverlapSwitchList']);
that.$convertSpecifiedField(elem, that.signalList, 'code', 'name', ['startSignalCode', 'endSignalCode']);
that.$convertSpecifiedField(elem, that.stationList, 'code', 'name', ['stationCode']);
that.$convertSpecifiedField(elem, that.sectionList, 'code', 'name', ['nearSectionCode', 'autoTriggerSectionCode', 'turnBackSectionCode']);
});
}
}
return data;
},
async routeOverlap(index, row) { //
if (this.$refs && this.$refs.previewField && row) {
const sectionDict = {};
this.sectionList.map(elem => { sectionDict[elem.code] = elem.name; });
const routeOverlapSectionList = row.routeOverlapSectionList.map(elem => { return {sectionCode : elem}; });
const fieldList = {
id: row.id,
mapId: this.$route.params.mapId,
title: this.$t('map.routeContinuesToProtectSectorData'),
name: row.name,
model: {
items: [
{ prop: 'sectionCode', label: this.$t('map.physicalSectionID'), type: 'text' },
{ prop: 'sectionCode', label: this.$t('map.physicalSectionName'), type: 'select', options: sectionDict }
]
}
};
this.$refs.previewField.doShow(fieldList, routeOverlapSectionList);
}
},
async sectionDetail(index, row) { //
if (this.$refs && this.$refs.previewField && row) {
const sectionDict = {};
this.sectionList.map(elem => { sectionDict[elem.code] = elem.name; });
const routeSectionList = row.routeSectionList.map(elem => { return {sectionCode : elem}; });
const fieldList = {
id: row.id,
mapId: this.$route.params.mapId,
title: this.$t('map.routePhysicalSectionData'),
name: row.name,
model: {
items: [
{ prop: 'sectionCode', label: this.$t('map.physicalSectionID'), type: 'text' },
{ prop: 'sectionCode', label: this.$t('map.physicalSectionName'), type: 'select', options: sectionDict }
]
}
};
this.$refs.previewField.doShow(fieldList, routeSectionList);
}
},
async overlapSwitchDetail(index, row) { //
if (this.$refs && this.$refs.protectDetail && row) {
const param = {
code: row.overlapCode,
pageNum: 10,
pageSize:1
};
getContinueProtectList(this.$route.params.mapId, param).then(resp => {
this.$refs.protectDetail.doShow(resp.data.list[0]);
}).catch((error) => {
console.log(error);
});
}
},
async flankProtectionSwitchDetail(index, row) { //
if (this.$refs && this.$refs.previewField && row) {
const switchDict = {};
this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
const fieldList = {
id: row.id,
mapId: this.$route.params.mapId,
title: this.$t('map.routeSideDefenseSwitch'),
name: row.name,
model: {
items: [
{ prop: 'switchCode', label: this.$t('map.switchID'), type: 'text' },
{ prop: 'switchCode', label: this.$t('map.switchName'), type: 'select', options: switchDict },
{ prop: 'switchType', label: this.$t('map.switchType'), type: 'text'}
]
}
};
row.routeFlankProtectionList.forEach( item => {
item.switchType = item.normal ? this.$t('map.normalPosition') : this.$t('map.reversePosition');
});
this.$refs.previewField.doShow(fieldList, row.routeFlankProtectionList);
}
},
async routeSwitchDetail(index, row) { //
if (this.$refs && this.$refs.previewField && row) {
const switchDict = {};
this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
const fieldList = {
id: row.id,
mapId: this.$route.params.mapId,
title: this.$t('map.entryTurnout'),
name: row.name,
model: {
field: 'routeSwitchList',
items: [
{ prop: 'switchCode', label: this.$t('map.switchID'), type: 'text' },
{ prop: 'switchCode', label: this.$t('map.switchName'), type: 'select', options: switchDict },
{ prop: 'switchType', label: this.$t('map.switchType'), type: 'text'}
]
}
};
row.routeSwitchList.forEach( item => {
item.switchType = item.normal ? this.$t('map.normalPosition') : this.$t('map.reversePosition');
});
this.$refs.previewField.doShow(fieldList, row.routeSwitchList);
}
// async routeOverlap(index, row) { //
// if (this.$refs && this.$refs.previewField && row) {
// const sectionDict = {};
// this.sectionList.map(elem => { sectionDict[elem.code] = elem.name; });
// const routeOverlapSectionList = row.routeOverlapSectionList.map(elem => { return {sectionCode : elem}; });
// const fieldList = {
// id: row.id,
// mapId: this.$route.params.mapId,
// title: this.$t('map.routeContinuesToProtectSectorData'),
// name: row.name,
// model: {
// items: [
// { prop: 'sectionCode', label: this.$t('map.physicalSectionID'), type: 'text' },
// { prop: 'sectionCode', label: this.$t('map.physicalSectionName'), type: 'select', options: sectionDict }
// ]
// }
// };
// this.$refs.previewField.doShow(fieldList, routeOverlapSectionList);
// }
// },
// async sectionDetail(index, row) { //
// if (this.$refs && this.$refs.previewField && row) {
// const sectionDict = {};
// this.sectionList.map(elem => { sectionDict[elem.code] = elem.name; });
// const routeSectionList = row.routeSectionList.map(elem => { return {sectionCode : elem}; });
// const fieldList = {
// id: row.id,
// mapId: this.$route.params.mapId,
// title: this.$t('map.routePhysicalSectionData'),
// name: row.name,
// model: {
// items: [
// { prop: 'sectionCode', label: this.$t('map.physicalSectionID'), type: 'text' },
// { prop: 'sectionCode', label: this.$t('map.physicalSectionName'), type: 'select', options: sectionDict }
// ]
// }
// };
// this.$refs.previewField.doShow(fieldList, routeSectionList);
// }
// },
// async overlapSwitchDetail(index, row) { //
// if (this.$refs && this.$refs.protectDetail && row) {
// const param = {
// code: row.overlapCode,
// pageNum: 10,
// pageSize:1
// };
// getContinueProtectList(this.$route.params.mapId, param).then(resp => {
// this.$refs.protectDetail.doShow(resp.data.list[0]);
// }).catch((error) => {
// console.log(error);
// });
// }
// },
// async flankProtectionSwitchDetail(index, row) { //
// if (this.$refs && this.$refs.previewField && row) {
// const switchDict = {};
// this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
// const fieldList = {
// id: row.id,
// mapId: this.$route.params.mapId,
// title: this.$t('map.routeSideDefenseSwitch'),
// name: row.name,
// model: {
// items: [
// { prop: 'switchCode', label: this.$t('map.switchID'), type: 'text' },
// { prop: 'switchCode', label: this.$t('map.switchName'), type: 'select', options: switchDict },
// { prop: 'switchType', label: this.$t('map.switchType'), type: 'text'}
// ]
// }
// };
// row.routeFlankProtectionList.forEach( item => {
// item.switchType = item.normal ? this.$t('map.normalPosition') : this.$t('map.reversePosition');
// });
// this.$refs.previewField.doShow(fieldList, row.routeFlankProtectionList);
// }
// },
// async routeSwitchDetail(index, row) { //
// if (this.$refs && this.$refs.previewField && row) {
// const switchDict = {};
// this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
// const fieldList = {
// id: row.id,
// mapId: this.$route.params.mapId,
// title: this.$t('map.entryTurnout'),
// name: row.name,
// model: {
// field: 'routeSwitchList',
// items: [
// { prop: 'switchCode', label: this.$t('map.switchID'), type: 'text' },
// { prop: 'switchCode', label: this.$t('map.switchName'), type: 'select', options: switchDict },
// { prop: 'switchType', label: this.$t('map.switchType'), type: 'text'}
// ]
// }
// };
// row.routeSwitchList.forEach( item => {
// item.switchType = item.normal ? this.$t('map.normalPosition') : this.$t('map.reversePosition');
// });
// this.$refs.previewField.doShow(fieldList, row.routeSwitchList);
// }
// },
handleUpdate(index, row) {
putSetDraftMapRouteById(this.$route.params.mapId, row).then(res => {
this.$message.success('更新成功');
}).catch(() => {
this.$messageBox('操作异常');
});
},
//
saveRelated(row) {
@ -414,36 +460,36 @@ export default {
});
},
edit(index, row) {
this.mapList.forEach(elem => {
if (elem.name === row.mapId) {
const model = {
mapId: elem.id,
id: row.id
};
getRouteNewById(model.id).then(response => {
const data = response.data;
this.$emit('routeSelected', data);
this.doClose();
});
}
});
},
copyObj(index, row) {
this.mapList.forEach(elem => {
if (elem.name === row.mapId) {
const model = {
mapId: elem.id,
id: row.id
};
getRouteNewById(model.id).then(response => {
const data = response.data;
delete data.id;
this.$emit('routeSelected', data);
this.doClose();
});
}
// this.mapList.forEach(elem => {
// if (elem.name === row.mapId) {
// const model = {
// mapId: elem.id,
// id: row.id
// };
getRouteNewById(row.mapId).then(response => {
const data = response.data;
this.$emit('routeSelected', data);
this.doClose();
});
// }
// });
},
// copyObj(index, row) {
// this.mapList.forEach(elem => {
// if (elem.name === row.mapId) {
// const model = {
// mapId: elem.id,
// id: row.id
// };
// getRouteNewById(model.id).then(response => {
// const data = response.data;
// delete data.id;
// this.$emit('routeSelected', data);
// this.doClose();
// });
// }
// });
// },
deleteObj(index, row) {
if (row) {
this.$confirm('是否确认删除?', '提示', {
@ -451,19 +497,19 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delRouteNew(row.id).then(response => {
const param = {
code: row.overlapCode,
pageNum: 10,
pageSize:1
};
getContinueProtectList(this.$route.params.mapId, param).then(resp => {
if (resp.data.list[0]) {
delContinueProtect(resp.data.list[0].id).then( res => {
this.$message.success('删除成功');
});
}
});
delRouteNew(this.$route.params.mapId, row.code).then(response => {
// const param = {
// code: row.overlapCode,
// pageNum: 10,
// pageSize:1
// };
// getContinueProtectList(this.$route.params.mapId, param).then(resp => {
// if (resp.data.list[0]) {
// delContinueProtect(resp.data.list[0].id).then( res => {
// this.$message.success('');
// });
// }
// });
this.reloadTable();
}).catch(() => {
this.$messageBox('删除失败');
@ -481,39 +527,47 @@ export default {
selectedObj(index, row) {
this.$emit('setRouteCode', row, this.codeType);
this.show = false;
},
showConflictingSignalList(data) {
const nameList = [];
data.forEach(ele => {
let signalName = '';
this.signalList.some(item => {
if (item.code === ele.signalCode) {
signalName = item.name;
return true;
}
});
let switchName = '';
ele.switchPositionList.forEach((item, index) => {
this.switchList.some(it => {
if (it.code === item.switchCode) {
const pos = item.normal ? 'N' : 'R';
if (index === 0) {
switchName = switchName + it.name + pos;
} else {
switchName = switchName + '/' + it.name + pos;
}
return true;
}
});
});
if (switchName) {
nameList.push(signalName + ' ' + 'WITH' + ' ' + switchName);
} else {
nameList.push(signalName);
}
});
return nameList;
}
// showConflictingSignalList(data) {
// const nameList = [];
// data.forEach(ele => {
// let signalName = '';
// this.signalList.some(item => {
// if (item.code === ele.signalCode) {
// signalName = item.name;
// return true;
// }
// });
// let switchName = '';
// ele.switchPositionList.forEach((item, index) => {
// this.switchList.some(it => {
// if (it.code === item.switchCode) {
// const pos = item.normal ? 'N' : 'R';
// if (index === 0) {
// switchName = switchName + it.name + pos;
// } else {
// switchName = switchName + '/' + it.name + pos;
// }
// return true;
// }
// });
// });
// if (switchName) {
// nameList.push(signalName + ' ' + 'WITH' + ' ' + switchName);
// } else {
// nameList.push(signalName);
// }
// });
// return nameList;
// }
}
};
</script>
<style lang="scss">
.dialog_content_box{
.el-dialog__body{
padding-top: 3px;
}
}
</style>