绘图相关调整_(问题调整)
This commit is contained in:
parent
0a51aa1e23
commit
a83b2cd2cd
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="delayShow">
|
<div v-if="delayShow">
|
||||||
<div v-for="item in delayInfoList" />
|
<div v-for="item in stationList">
|
||||||
|
<delay-info v-if="item.delayInfo" :delay-info-list="item.delayInfo" position="item.points" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -10,16 +11,21 @@ import DelayInfo from './delayInfo';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DelayBox',
|
name: 'DelayBox',
|
||||||
|
components: {
|
||||||
|
DelayInfo
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
delayShow: false,
|
delayShow: false,
|
||||||
delayInfoList: []
|
stationList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
watch: {
|
||||||
doShow() {
|
'$store.state.map.stationList': function(val) {
|
||||||
|
this.stationList = val;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,19 +1,72 @@
|
|||||||
<template>
|
<template>
|
||||||
<div><span>人解</span><span>信号机名</span><span>时间</span></div>
|
<div v-show="showDelayBox" class="info_box" :style="{left: tPosition.x+'px', top: tPosition.y+'px' }">
|
||||||
|
<el-scrollbal>
|
||||||
|
<div v-for="item in delayInfoList"><span>人解</span><span>信号机名</span><span>时间</span></div>
|
||||||
|
</el-scrollbal>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'DelayInfo',
|
name: 'DelayInfo',
|
||||||
props: {
|
props: {
|
||||||
delayInformation: {
|
delayInfoList: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true,
|
||||||
|
default: function () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
default: function () {
|
||||||
|
return {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tPosition: {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
},
|
||||||
|
showDelayBox: true
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'position.x': function (val) {
|
||||||
|
this.handlePosition();
|
||||||
|
},
|
||||||
|
'position.y': function (val) {
|
||||||
|
this.handlePosition();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handlePosition() {
|
||||||
|
const offset = this.$store.state.config.canvasOffset;
|
||||||
|
this.tPosition = {
|
||||||
|
x: this.position.x + offset.x,
|
||||||
|
y: this.position.y + offset.y
|
||||||
|
};
|
||||||
|
if (this.tPosition.x < 0 || this.tPosition < 0) {
|
||||||
|
this.showDelayBox = false;
|
||||||
|
} else {
|
||||||
|
this.showDelayBox = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.info_box{
|
||||||
|
border-top:1px solid #fff;
|
||||||
|
height: auto;
|
||||||
|
max-height: 200px;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -137,7 +137,6 @@ export default {
|
|||||||
this.setDelayUnlockStatus(response.data, '00');
|
this.setDelayUnlockStatus(response.data, '00');
|
||||||
this.initAutoSaveTask();
|
this.initAutoSaveTask();
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error);
|
|
||||||
this.$message.error(this.$t('tip.failedLoadMap'));
|
this.$message.error(this.$t('tip.failedLoadMap'));
|
||||||
this.endViewLoading();
|
this.endViewLoading();
|
||||||
});
|
});
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
filterable
|
filterable
|
||||||
:placeholder="item.placeholder"
|
:placeholder="item.placeholder"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
|
:clearable="item.clearable"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="option in item.options"
|
v-for="option in item.options"
|
||||||
|
@ -342,7 +342,9 @@ export default {
|
|||||||
value: '02',
|
value: '02',
|
||||||
label: this.$t('map.sectionAssociationMode')
|
label: this.$t('map.sectionAssociationMode')
|
||||||
}],
|
}],
|
||||||
AssociateSectionList: []
|
AssociateSectionList: [],
|
||||||
|
oldLeftSectionCode: '',
|
||||||
|
oldRightSectionCode: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -372,8 +374,8 @@ export default {
|
|||||||
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
||||||
] },
|
] },
|
||||||
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList},
|
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList},
|
||||||
{ prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList, hover: this.hover, buttonType: 'leftSection', buttonShowType: this.isLeftSectionButtonShow},
|
{ prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList, hover: this.hover, buttonType: 'leftSection', buttonShowType: this.isLeftSectionButtonShow, isHidden: !this.hasAssociatedSection},
|
||||||
{ prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList},
|
{ prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList, hover: this.hover, buttonType: 'rightSection', buttonShowType: this.isRightSectionButtonShow, isHidden: !this.hasAssociatedSection},
|
||||||
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
|
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
|
||||||
|
|
||||||
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
|
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
|
||||||
@ -444,16 +446,16 @@ export default {
|
|||||||
},
|
},
|
||||||
rules() {
|
rules() {
|
||||||
var validateLeftSection = (rule, value, callback) => {
|
var validateLeftSection = (rule, value, callback) => {
|
||||||
const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
|
const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null;
|
||||||
if (leftSection && (leftSection.points[1].x !== this.editModel.points[0].x || leftSection.points[1].y !== this.editModel.points[0].y )) {
|
if (leftSection && !(this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.editModel.points[0].x) || this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.oldPoint[0]) )) {
|
||||||
callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
|
callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var validateRightSection = (rule, value, callback) => {
|
var validateRightSection = (rule, value, callback) => {
|
||||||
const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
|
const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null;
|
||||||
if (rightSection && (rightSection.points[0].x !== this.editModel.points[1].x || rightSection.points[0].y !== this.editModel.points[1].y )) {
|
if (rightSection && !(this.checkPointsCoincide(rightSection.points[0], this.editModel.points[this.editModel.points.length - 1]) || this.checkPointsCoincide(rightSection.points[0], this.oldPoint[this.oldPoint.length - 1]))) {
|
||||||
callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
|
callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
@ -598,6 +600,12 @@ export default {
|
|||||||
},
|
},
|
||||||
isLeftSectionButtonShow() {
|
isLeftSectionButtonShow() {
|
||||||
return this.field === 'leftSection';
|
return this.field === 'leftSection';
|
||||||
|
},
|
||||||
|
isRightSectionButtonShow() {
|
||||||
|
return this.field === 'rightSection';
|
||||||
|
},
|
||||||
|
hasAssociatedSection() {
|
||||||
|
return this.editModel.type === '01' || this.editModel.type === '03';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -647,16 +655,20 @@ export default {
|
|||||||
if (!this.fieldS) { // 判断是否激活选择站台
|
if (!this.fieldS) { // 判断是否激活选择站台
|
||||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||||
if (this.field === 'leftSection') {
|
if (this.field === 'leftSection') {
|
||||||
|
if (selected.type === '01' || selected.type === '03') {
|
||||||
this.editModel.leftSectionCode = selected.code;
|
this.editModel.leftSectionCode = selected.code;
|
||||||
this.activeName = 'first';
|
this.activeName = 'first';
|
||||||
this.field = '';
|
this.field = '';
|
||||||
this.$emit('fieldSelect', '');
|
this.$emit('fieldSelect', '');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else if (this.field === 'rightSection') {
|
} else if (this.field === 'rightSection') {
|
||||||
|
if ((selected.type === '01' || selected.type === '03')) {
|
||||||
this.editModel.rightSectionCode = selected.code;
|
this.editModel.rightSectionCode = selected.code;
|
||||||
this.activeName = 'first';
|
this.activeName = 'first';
|
||||||
this.field = '';
|
this.field = '';
|
||||||
this.$emit('fieldSelect', '');
|
this.$emit('fieldSelect', '');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$refs.dataform.resetFields();
|
this.$refs.dataform.resetFields();
|
||||||
@ -667,6 +679,8 @@ export default {
|
|||||||
this.editModel.isSegmentation = selected.isSegmentation || false;
|
this.editModel.isSegmentation = selected.isSegmentation || false;
|
||||||
this.editModel.points = JSON.parse(JSON.stringify(selected.points));
|
this.editModel.points = JSON.parse(JSON.stringify(selected.points));
|
||||||
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
|
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
|
||||||
|
this.oldLeftSectionCode = selected.leftSectionCode;
|
||||||
|
this.oldRightSectionCode = selected.rightSectionCode;
|
||||||
this.editModel.lengthFact = selected.lengthFact || 0;
|
this.editModel.lengthFact = selected.lengthFact || 0;
|
||||||
|
|
||||||
this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
|
this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
|
||||||
@ -902,6 +916,10 @@ export default {
|
|||||||
edit() {
|
edit() {
|
||||||
this.$refs['dataform'].validate((valid) => {
|
this.$refs['dataform'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) {
|
||||||
|
this.$messageBox('道岔区段应仅有一侧关联区段!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const models = [];
|
const models = [];
|
||||||
const model = deepAssign(this.editModel, {_type: 'Section'}); // 修改元素model
|
const model = deepAssign(this.editModel, {_type: 'Section'}); // 修改元素model
|
||||||
model.leftStopPointOffset = Number(model.leftStopPointOffset);
|
model.leftStopPointOffset = Number(model.leftStopPointOffset);
|
||||||
@ -933,11 +951,50 @@ export default {
|
|||||||
this.fieldS = '';
|
this.fieldS = '';
|
||||||
this.$emit('updateMapModel', models);
|
this.$emit('updateMapModel', models);
|
||||||
this.oldPoint = JSON.parse(JSON.stringify(model.points));
|
this.oldPoint = JSON.parse(JSON.stringify(model.points));
|
||||||
|
this.oldLeftSectionCode = model.leftSectionCode;
|
||||||
|
this.oldRightSectionCode = model.rightSectionCode;
|
||||||
} else {
|
} else {
|
||||||
this.$message('还有属性未填写,修改未生效!');
|
this.$message('还有属性未填写,修改未生效!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleAssociatedSectionChange(model) { // 处理因该区段关联区段改变影响的区段数据
|
||||||
|
const models = [];
|
||||||
|
if (model.leftSectionCode !== this.oldLeftSectionCode) {
|
||||||
|
const editLeftSection = this.getSectionByCode(model.leftSectionCode);
|
||||||
|
const oldEditLeftSection = this.getSectionByCode(this.oldLeftSectionCode);
|
||||||
|
if (editLeftSection) {
|
||||||
|
editLeftSection.rightSectionCode = model.code;
|
||||||
|
models.push(editLeftSection);
|
||||||
|
}
|
||||||
|
if (oldEditLeftSection) {
|
||||||
|
oldEditLeftSection.rightSectionCode = '';
|
||||||
|
models.push(oldEditLeftSection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (model.rightSectionCode !== this.oldRightSectionCode) {
|
||||||
|
const editRightSection = this.getSectionByCode(model.rightSectionCode);
|
||||||
|
const oldEditRightSection = this.getSectionByCode(this.oldRightSectionCode);
|
||||||
|
if (editRightSection) {
|
||||||
|
editRightSection.leftSectionCode = model.code;
|
||||||
|
models.push(editRightSection);
|
||||||
|
}
|
||||||
|
if (oldEditRightSection) {
|
||||||
|
oldEditRightSection.leftSectionCode = '';
|
||||||
|
models.push(oldEditRightSection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return models;
|
||||||
|
},
|
||||||
|
getSectionByCode(code) { // 根据sectionCode 获取深拷贝的section对象
|
||||||
|
if (code) {
|
||||||
|
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](code) || {});
|
||||||
|
if (JSON.stringify(section) !== '{}') {
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
// 删除对象
|
// 删除对象
|
||||||
deleteObj() {
|
deleteObj() {
|
||||||
const models = [];
|
const models = [];
|
||||||
@ -1170,6 +1227,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
checkPointsCoincide(point1, point2) { // 校验两点是否重合
|
||||||
|
if (point1 && point2) {
|
||||||
|
return point1.x === point2.x && point1.y === point2.y;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user