Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
2f6f75ff3c
@ -227,6 +227,90 @@ export default {
|
||||
});
|
||||
return flag;
|
||||
},
|
||||
verifySectionRelation(map) {
|
||||
let flag = true;
|
||||
const tipInfoList = [];
|
||||
map.sectionList.forEach(section => {
|
||||
section.type === '01' && map.sectionList.forEach(item => {
|
||||
if (section.code !== item.code && item.type === '01' && this.checkSectionPointsHasCoincide(section.points, item.points) && !this.checkCorrelation(section, item)) {
|
||||
tipInfoList.push('区段' + section.name + '(' + section.code + '): 与区段' + item.name + '(' + item.code + ')' + '有点重叠,但并未设置与其的关联关系!' );
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!tipInfoList.length) {
|
||||
flag = true;
|
||||
} else {
|
||||
flag = false;
|
||||
this.$messageBox(this.$t('tip.dataValidationFailed'));
|
||||
this.tableToExcel(tipInfoList);
|
||||
}
|
||||
return flag;
|
||||
},
|
||||
verifySignalPosition(map) {
|
||||
let flag = true;
|
||||
const tipInfoList = [];
|
||||
map.signalList.forEach(signal => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](signal.sectionCode);
|
||||
if (section) {
|
||||
const offsetX = signal.positionPoint ? signal.positionPoint.x : 0;
|
||||
const signalPositionX = signal.position.x - offsetX;
|
||||
const max = Math.max(section.points[section.points.length - 1].x, section.points[0].x);
|
||||
const min = Math.min(section.points[section.points.length - 1].x, section.points[0].x);
|
||||
if (signalPositionX < min && signalPositionX > max) {
|
||||
tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里');
|
||||
}
|
||||
// if (signal.right) {
|
||||
// const rightSection = this.$store.getters['map/getDeviceByCode'](section.rightSectionCode);
|
||||
// if (rightSection && rightSection.points[0].x != section.points[section.points.length - 1].x) {
|
||||
// const max = Math.max(section.points[section.points.length - 1].x, section.points[0].x);
|
||||
// const min = Math.min(section.points[section.points.length - 1].x, section.points[0].x);
|
||||
// if (signalPositionX < min && signalPositionX > max) {
|
||||
// tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里');
|
||||
// }
|
||||
// } else {
|
||||
// if (signalPositionX > section.points[section.points.length - 1].x && signalPositionX < section.points[0].x) {
|
||||
// tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里');
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// const leftSection = this.$store.getters['map/getDeviceByCode'](section.leftSectionCode);
|
||||
// if (leftSection && leftSection.points[leftSection.points.length - 1].x != section.points[0].x) {
|
||||
// const max = Math.max(section.points[section.points.length - 1].x, section.points[0].x);
|
||||
// const min = Math.min(section.points[section.points.length - 1].x, section.points[0].x);
|
||||
// if (signalPositionX < min && signalPositionX > max) {
|
||||
// tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里');
|
||||
// }
|
||||
// } else {
|
||||
// if (signalPositionX < section.points[0].x && signalPositionX > section.points[section.points.length - 1].x) {
|
||||
// tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')未在其关联的区段' + section.name + '(' + section.code + ')里');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
tipInfoList.push('信号机' + signal.name + '(' + signal.code + ')所关联的区段不存在');
|
||||
}
|
||||
});
|
||||
if (!tipInfoList.length) {
|
||||
flag = true;
|
||||
} else {
|
||||
flag = false;
|
||||
this.$messageBox(this.$t('tip.dataValidationFailed'));
|
||||
this.tableToExcel(tipInfoList);
|
||||
}
|
||||
return flag;
|
||||
},
|
||||
checkPointsCoincide(point1, point2) { // 校验两点是否重合
|
||||
if (point1 && point2) {
|
||||
return point1.x === point2.x && point1.y === point2.y;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
checkSectionPointsHasCoincide(points1, points2) { // 校验两区段的左右点是否有重合
|
||||
return points1.length && points2.length && (this.checkPointsCoincide(points1[0], points2[0]) || this.checkPointsCoincide(points1[0], points2[points2.length - 1]) || this.checkPointsCoincide(points1[points1.length - 1], points2[points2.length - 1]) || this.checkPointsCoincide(points1[points1.length - 1], points2[0]));
|
||||
},
|
||||
checkCorrelation(section1, section2) { // 校验后者是否与前者有关联关系
|
||||
return section1.leftSectionCode === section2.code || section1.rightSectionCode === section2.code;
|
||||
},
|
||||
saveMapEvent() { // 保存地图
|
||||
const map = this.$store.state.map.map;
|
||||
if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) {
|
||||
@ -259,20 +343,23 @@ export default {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
const map = this.$store.state.map.map;
|
||||
if (map && this.$route.params.mapId) {
|
||||
verifyMap(this.$route.params.mapId).then(res => {
|
||||
if (res.data.length) {
|
||||
this.tableToExcel(res.data);
|
||||
this.$messageBox(this.$t('tip.dataValidationFailed'));
|
||||
} else {
|
||||
this.$message.success(this.$t('tip.dataValidationSuccess'));
|
||||
if (this.verifySectionRelation(map)) {
|
||||
if (this.verifySignalPosition(map)) {
|
||||
verifyMap(this.$route.params.mapId).then(res => {
|
||||
if (res.data.length) {
|
||||
this.tableToExcel(res.data);
|
||||
this.$messageBox(this.$t('tip.dataValidationFailed'));
|
||||
} else {
|
||||
this.$message.success(this.$t('tip.dataValidationSuccess'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('tip.requestFailed'));
|
||||
});
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('tip.requestFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tableToExcel(data) {
|
||||
const filterVal = ['index'];
|
||||
const arr = [];
|
||||
|
@ -7,7 +7,7 @@
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button type="primary" size="small" style="margin-top: 5px; margin-left: 10px" @click="verifyData">{{ $t('map.sectionRelationCheck') }}</el-button>
|
||||
<!-- <el-button type="primary" size="small" style="margin-top: 5px; margin-left: 10px" @click="verifyData">{{ $t('map.sectionRelationCheck') }}</el-button> -->
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
|
||||
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
|
||||
@ -620,24 +620,24 @@ export default {
|
||||
checkSectionPointsHasCoincide(points1, points2) { // 校验两区段的左右点是否有重合
|
||||
return points1.length && points2.length && (this.checkPointsCoincide(points1[0], points2[0]) || this.checkPointsCoincide(points1[0], points2[points2.length - 1]) || this.checkPointsCoincide(points1[points1.length - 1], points2[points2.length - 1]) || this.checkPointsCoincide(points1[points1.length - 1], points2[0]));
|
||||
},
|
||||
checkCorrelation(section1, section2) { // 校验后者是否与前者有关联关系
|
||||
return section1.leftSectionCode === section2.code || section1.rightSectionCode === section2.code;
|
||||
},
|
||||
verifyData() { // 区段关联关系校验
|
||||
this.tipInfoList = [];
|
||||
this.sectionList.forEach(section => {
|
||||
section.type === '01' && this.sectionList.forEach(item => {
|
||||
if (section.code !== item.code && item.type === '01' && this.checkSectionPointsHasCoincide(section.points, item.points) && !this.checkCorrelation(section, item)) {
|
||||
this.tipInfoList.push(section.name + '(' + section.code + '): 与' + item.name + '(' + item.code + ')' + '有点重叠,但并未设置与其的关联关系!' );
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!this.tipInfoList.length) {
|
||||
this.$message.success('计轴区段关联关系校验通过!');
|
||||
} else {
|
||||
this.$refs.tipInfo.doShow();
|
||||
}
|
||||
},
|
||||
// checkCorrelation(section1, section2) { // 校验后者是否与前者有关联关系
|
||||
// return section1.leftSectionCode === section2.code || section1.rightSectionCode === section2.code;
|
||||
// },
|
||||
// verifyData() { // 区段关联关系校验
|
||||
// this.tipInfoList = [];
|
||||
// this.sectionList.forEach(section => {
|
||||
// section.type === '01' && this.sectionList.forEach(item => {
|
||||
// if (section.code !== item.code && item.type === '01' && this.checkSectionPointsHasCoincide(section.points, item.points) && !this.checkCorrelation(section, item)) {
|
||||
// this.tipInfoList.push(section.name + '(' + section.code + '): 与' + item.name + '(' + item.code + ')' + '有点重叠,但并未设置与其的关联关系!' );
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// if (!this.tipInfoList.length) {
|
||||
// this.$message.success('计轴区段关联关系校验通过!');
|
||||
// } else {
|
||||
// this.$refs.tipInfo.doShow();
|
||||
// }
|
||||
// },
|
||||
tipInfoHandle(list) {
|
||||
if (list.length) {
|
||||
this.tipInfoList = list;
|
||||
|
Loading…
Reference in New Issue
Block a user