From a83b2cd2cdbc78cdce60f332c89a9048d2f02747 Mon Sep 17 00:00:00 2001
From: fan <18706759286@163.com>
Date: Thu, 5 Dec 2019 14:54:33 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=98=E5=9B=BE=E7=9B=B8=E5=85=B3=E8=B0=83?=
=?UTF-8?q?=E6=95=B4=5F(=E9=97=AE=E9=A2=98=E8=B0=83=E6=95=B4)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/jmapNew/shape/LcControl/index.js | 128 +++++++++---------
src/views/mapsystem/plugin/delayBox.vue | 18 ++-
src/views/mapsystem/plugin/delayInfo.vue | 61 ++++++++-
src/views/newMap/newMapdraft/index.vue | 1 -
.../newMapdraft/mapoperate/config/list.vue | 1 +
.../newMap/newMapdraft/mapoperate/section.vue | 93 +++++++++++--
6 files changed, 212 insertions(+), 90 deletions(-)
diff --git a/src/jmapNew/shape/LcControl/index.js b/src/jmapNew/shape/LcControl/index.js
index 985bea40d..3072dba26 100644
--- a/src/jmapNew/shape/LcControl/index.js
+++ b/src/jmapNew/shape/LcControl/index.js
@@ -6,73 +6,73 @@ import EControl from '../element/EControl';
import EMouse from './EMouse';
export default class LcControl extends Group {
- constructor(model, style) {
- super();
- this.z = 20;
- this._code = model.code;
- this._type = model._type;
- this.zlevel = model.zlevel;
- this.model = model;
- this.style = style;
- this.create();
- this.createMouseEvent();
- this.setState(model);
- }
+ constructor(model, style) {
+ super();
+ this.z = 20;
+ this._code = model.code;
+ this._type = model._type;
+ this.zlevel = model.zlevel;
+ this.model = model;
+ this.style = style;
+ this.create();
+ this.createMouseEvent();
+ this.setState(model);
+ }
- create() {
- const model = this.model;
- this.control = new EControl({
- zlevel: this.zlevel,
- z: this.z,
- arc: {
- shape: {
- cx: model.position.x,
- cy: model.position.y,
- r: this.style.LcControl.lamp.radiusR
- },
- lineWidth: 0,
- fill: this.style.LcControl.lamp.controlColor
- },
- text: {
- position: [0, 0],
- x: model.position.x,
- y: model.position.y + this.style.LcControl.lamp.radiusR + this.style.LcControl.text.distance,
- fontWeight: this.style.LcControl.text.fontWeight,
- fontSize: this.style.LcControl.text.fontSize,
- fontFamily: this.style.fontFamily,
- text: model.name,
- textFill: '#fff',
- textAlign: 'middle',
- textVerticalAlign: 'top'
- },
- style: this.style
- });
+ create() {
+ const model = this.model;
+ this.control = new EControl({
+ zlevel: this.zlevel,
+ z: this.z,
+ arc: {
+ shape: {
+ cx: model.position.x,
+ cy: model.position.y,
+ r: this.style.LcControl.lamp.radiusR
+ },
+ lineWidth: 0,
+ fill: this.style.LcControl.lamp.controlColor
+ },
+ text: {
+ position: [0, 0],
+ x: model.position.x,
+ y: model.position.y + this.style.LcControl.lamp.radiusR + this.style.LcControl.text.distance,
+ fontWeight: this.style.LcControl.text.fontWeight,
+ fontSize: this.style.LcControl.text.fontSize,
+ fontFamily: this.style.fontFamily,
+ text: model.name,
+ textFill: '#fff',
+ textAlign: 'middle',
+ textVerticalAlign: 'top'
+ },
+ style: this.style
+ });
- this.add(this.control);
- }
+ this.add(this.control);
+ }
- // 设置状态
- setState(model) {
- }
+ // 设置状态
+ setState(model) {
+ }
- createMouseEvent() {
- if (this.style.LcControl.mouseOverStyle) {
- this.mouseEvent = new EMouse(this);
- this.add(this.mouseEvent);
- this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
- this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
- }
- }
+ createMouseEvent() {
+ if (this.style.LcControl.mouseOverStyle) {
+ this.mouseEvent = new EMouse(this);
+ this.add(this.mouseEvent);
+ this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
+ this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
+ }
+ }
- getShapeTipPoint() {
- if (this.control) {
- var distance = 2;
- var rect = this.control.getBoundingRect();
- return {
- x: rect.x + rect.width / 2,
- y: rect.y - distance
- };
- }
- return null;
- }
+ getShapeTipPoint() {
+ if (this.control) {
+ var distance = 2;
+ var rect = this.control.getBoundingRect();
+ return {
+ x: rect.x + rect.width / 2,
+ y: rect.y - distance
+ };
+ }
+ return null;
+ }
}
diff --git a/src/views/mapsystem/plugin/delayBox.vue b/src/views/mapsystem/plugin/delayBox.vue
index bd8afc4c4..ef36dd91b 100644
--- a/src/views/mapsystem/plugin/delayBox.vue
+++ b/src/views/mapsystem/plugin/delayBox.vue
@@ -1,7 +1,8 @@
@@ -10,16 +11,21 @@ import DelayInfo from './delayInfo';
export default {
name: 'DelayBox',
+ components: {
+ DelayInfo
+ },
data() {
return {
delayShow: false,
- delayInfoList: []
+ stationList: []
};
},
- methods: {
- doShow() {
-
+ watch: {
+ '$store.state.map.stationList': function(val) {
+ this.stationList = val;
}
+ },
+ methods: {
}
};
diff --git a/src/views/mapsystem/plugin/delayInfo.vue b/src/views/mapsystem/plugin/delayInfo.vue
index 6286d23d9..d6a9bdba2 100644
--- a/src/views/mapsystem/plugin/delayInfo.vue
+++ b/src/views/mapsystem/plugin/delayInfo.vue
@@ -1,19 +1,72 @@
- 人解信号机名时间
+
diff --git a/src/views/newMap/newMapdraft/index.vue b/src/views/newMap/newMapdraft/index.vue
index 10e6faf08..23f634044 100644
--- a/src/views/newMap/newMapdraft/index.vue
+++ b/src/views/newMap/newMapdraft/index.vue
@@ -137,7 +137,6 @@ export default {
this.setDelayUnlockStatus(response.data, '00');
this.initAutoSaveTask();
}).catch((error) => {
- console.log(error);
this.$message.error(this.$t('tip.failedLoadMap'));
this.endViewLoading();
});
diff --git a/src/views/newMap/newMapdraft/mapoperate/config/list.vue b/src/views/newMap/newMapdraft/mapoperate/config/list.vue
index 94b054d41..8355620ea 100644
--- a/src/views/newMap/newMapdraft/mapoperate/config/list.vue
+++ b/src/views/newMap/newMapdraft/mapoperate/config/list.vue
@@ -68,6 +68,7 @@
filterable
:placeholder="item.placeholder"
:disabled="item.disabled"
+ :clearable="item.clearable"
>
{
- const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
- if (leftSection && (leftSection.points[1].x !== this.editModel.points[0].x || leftSection.points[1].y !== this.editModel.points[0].y )) {
+ const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null;
+ 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')));
} else {
callback();
}
};
var validateRightSection = (rule, value, callback) => {
- const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
- if (rightSection && (rightSection.points[0].x !== this.editModel.points[1].x || rightSection.points[0].y !== this.editModel.points[1].y )) {
+ const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null;
+ 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')));
} else {
callback();
@@ -598,6 +600,12 @@ export default {
},
isLeftSectionButtonShow() {
return this.field === 'leftSection';
+ },
+ isRightSectionButtonShow() {
+ return this.field === 'rightSection';
+ },
+ hasAssociatedSection() {
+ return this.editModel.type === '01' || this.editModel.type === '03';
}
},
watch: {
@@ -647,16 +655,20 @@ export default {
if (!this.fieldS) { // 判断是否激活选择站台
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (this.field === 'leftSection') {
- this.editModel.leftSectionCode = selected.code;
- this.activeName = 'first';
- this.field = '';
- this.$emit('fieldSelect', '');
+ if (selected.type === '01' || selected.type === '03') {
+ this.editModel.leftSectionCode = selected.code;
+ this.activeName = 'first';
+ this.field = '';
+ this.$emit('fieldSelect', '');
+ }
return;
} else if (this.field === 'rightSection') {
- this.editModel.rightSectionCode = selected.code;
- this.activeName = 'first';
- this.field = '';
- this.$emit('fieldSelect', '');
+ if ((selected.type === '01' || selected.type === '03')) {
+ this.editModel.rightSectionCode = selected.code;
+ this.activeName = 'first';
+ this.field = '';
+ this.$emit('fieldSelect', '');
+ }
return;
}
this.$refs.dataform.resetFields();
@@ -667,6 +679,8 @@ export default {
this.editModel.isSegmentation = selected.isSegmentation || false;
this.editModel.points = 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.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
@@ -902,6 +916,10 @@ export default {
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
+ if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) {
+ this.$messageBox('道岔区段应仅有一侧关联区段!');
+ return;
+ }
const models = [];
const model = deepAssign(this.editModel, {_type: 'Section'}); // 修改元素model
model.leftStopPointOffset = Number(model.leftStopPointOffset);
@@ -933,11 +951,50 @@ export default {
this.fieldS = '';
this.$emit('updateMapModel', models);
this.oldPoint = JSON.parse(JSON.stringify(model.points));
+ this.oldLeftSectionCode = model.leftSectionCode;
+ this.oldRightSectionCode = model.rightSectionCode;
} else {
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() {
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;
}
}
};