This commit is contained in:
zyy 2019-12-05 15:39:21 +08:00
commit ea5f2a30b2
18 changed files with 784 additions and 622 deletions

View File

@ -254,7 +254,30 @@ class SkinCode extends defaultStyle {
}
};
this[deviceType.StationControl] = {
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold', // 文字错细
StationControl:{
text: {
distance: 2, // 灯和文字之间的距离
fontSize: 10, // 控制模式字体大小
@ -289,33 +312,9 @@ class SkinCode extends defaultStyle {
textAlign: 'middle',
textVerticalAlign: 'top'
}
};
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold' // 文字错细
};
this[deviceType.Switch] = {
text: {
show: true, // 道岔名称显示

View File

@ -254,7 +254,39 @@ class SkinCode extends defaultStyle {
}
};
this[deviceType.StationControl] = {
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold', // 文字错细
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
},
StationControl:{
text: {
distance: 2, // 灯和文字之间的距离
fontSize: 10, // 控制模式字体大小
@ -295,39 +327,6 @@ class SkinCode extends defaultStyle {
textAlign: 'middle',
textVerticalAlign: 'top'
}
};
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold', // 文字错细
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};

View File

@ -258,7 +258,38 @@ class SkinCode extends defaultStyle {
}
};
this[deviceType.StationControl] = {
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
},
StationControl:{
text: {
distance: 2, // 灯和文字之间的距离
fontSize: 11, // 字体大小
@ -291,38 +322,6 @@ class SkinCode extends defaultStyle {
arrow: {
show: false // 控制模式箭头显隐
}
};
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};

View File

@ -255,7 +255,38 @@ class SkinCode extends defaultStyle {
}
};
this[deviceType.StationControl] = {
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
},
StationControl:{
text: {
distance: 2, // 灯和文字之间的距离
fontSize: 12, // 字体大小
@ -288,38 +319,6 @@ class SkinCode extends defaultStyle {
arrow: {
show: false // 控制模式箭头显隐
}
};
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};

View File

@ -237,7 +237,38 @@ class SkinCode extends defaultStyle {
}
};
this[deviceType.StationControl] = {
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
},
StationControl:{
text: {
distance: 2, // 灯和文字之间的距离
fontSize: 11, // 字体大小
@ -278,38 +309,6 @@ class SkinCode extends defaultStyle {
textAlign: 'middle',
textVerticalAlign: 'top'
}
};
this[deviceType.StationCounter] = {
text: {
distance: 2, // 计数器名称和文字的距离
fontColor: '#FFFFFF', // 计数器字体颜色
borderColor: '#E4EF50' // 计数器边框颜色
}
};
this[deviceType.StationDelayUnlock] = {
text: {
distance: 3, // 延迟解锁和设备之间的距离
fontColor: '#FFFFFF', // 延时解锁字体颜色
borderColor: '#FFFFFF' // 延迟解锁边框颜色
}
};
this[deviceType.Station] = {
// text: {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};

View File

@ -33,12 +33,12 @@ export default class ESingleControl extends Group {
shape: {
cx: model.point.x,
cy: model.point.y,
r: model.style.StationControl.lamp.radiusR
r: model.style.Station.StationControl.lamp.radiusR
},
style: {
lineWidth: 0.5,
fill: model.style.StationControl.lamp.grayColor,
stroke: model.style.StationControl.lamp.grayColor
fill: model.style.Station.StationControl.lamp.grayColor,
stroke: model.style.Station.StationControl.lamp.grayColor
}
});
@ -50,14 +50,14 @@ export default class ESingleControl extends Group {
position: [0, 0],
style: {
x: model.point.x,
y: model.point.y + model.style.StationControl.lamp.radiusR + model.style.StationControl.text.distance,
fontWeight: model.style.StationControl.text.fontWeight,
fontSize: model.style.StationControl.text.fontSize,
fontFamily: model.style.StationControl.text.fontFormat,
y: model.point.y + model.style.Station.StationControl.lamp.radiusR + model.style.Station.StationControl.text.distance,
fontWeight: model.style.Station.StationControl.text.fontWeight,
fontSize: model.style.Station.StationControl.text.fontSize,
fontFamily: model.style.Station.StationControl.text.fontFormat,
text: model.context,
textFill: model.style.StationControl.text.fontColor,
textAlign: model.style.StationControl.text.textAlign,
textVerticalAlign: model.style.StationControl.text.textVerticalAlign
textFill: model.style.Station.StationControl.text.fontColor,
textAlign: model.style.Station.StationControl.text.textAlign,
textVerticalAlign: model.style.Station.StationControl.text.textVerticalAlign
}
});

View File

@ -114,76 +114,76 @@ export default class Station extends Group {
const model = this.model;
if (model.visible && model.isCreateControlMode) {
// 紧急站控
if (this.style.StationControl.lamp.emergencyControlShow) {
if (this.style.Station.StationControl.lamp.emergencyControlShow) {
this.emergencyControl = new ESingleControl({
_subType: 'emergency',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
context: this.style.StationControl.text.emergencyControlText,
context: this.style.Station.StationControl.text.emergencyControlText,
// model.jjzkContent,
pop: false
});
this.add(this.emergencyControl);
}
// 中控按钮
if (this.style.StationControl.lamp.centerControlShow) {
if (this.style.Station.StationControl.lamp.centerControlShow) {
this.centerControl = new ESingleControl({
_subType: 'center',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
context: this.style.StationControl.text.centerControlText,
context: this.style.Station.StationControl.text.centerControlText,
// model.zokContent,
pop: false
});
this.add(this.centerControl);
}
// 站控按钮
if (this.style.StationControl.lamp.substationControlShow) {
if (this.style.Station.StationControl.lamp.substationControlShow) {
this.substationControl = new ESingleControl({
_subType: 'substation',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
context: this.style.StationControl.text.substationControlText,
context: this.style.Station.StationControl.text.substationControlText,
// model.zakContent
pop: false
});
this.add(this.substationControl);
}
// 联锁控
if (this.style.StationControl.lamp.interconnectedControlShow) {
if (this.style.Station.StationControl.lamp.interconnectedControlShow) {
this.interconnectedControl = new ESingleControl({
_subType: 'interconnected',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.StationControl.lamp.offset.y
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
// context: model.lskContent || '联锁控',
context:this.style.StationControl.text.interconnectedControlText || '联锁控',
context:this.style.Station.StationControl.text.interconnectedControlText || '联锁控',
pop: false
});
this.add(this.interconnectedControl);
}
// 箭头
if (this.style.StationControl.arrow.show) {
const point = arrow(this.model.controlModePoint.x, this.model.controlModePoint.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8);
if (this.style.Station.StationControl.arrow.show) {
const point = arrow(this.model.controlModePoint.x, this.model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
this.arrowsControl = new EArrow({
zlevel: this.zlevel,
z: this.z,
@ -191,9 +191,9 @@ export default class Station extends Group {
count: this.count,
drict: 1,
point: point,
x: model.controlModePoint.x + this.style.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y,
fill: this.style.StationControl.lamp.grayColor,
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
fill: this.style.Station.StationControl.lamp.grayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
});
@ -209,24 +209,24 @@ export default class Station extends Group {
setState(model) {
// switch (model.status) {
// case '00': // 无状态
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
// this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// break;
// case '01': // 中控
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor);
// this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor);
// break;
// case '02': // 站控
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
// this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor);
// this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// break;
// case '03': // 紧急站控
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
// this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor);
// this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// break;
// }
}

View File

@ -2,7 +2,6 @@ import deviceType from '../constant/deviceType';
import Section from './Section/index.js';
import Signal from './Signal/index.js';
import Station from './Station/index.js';
import StationControl from './StationControl/index.js';
import ImageControl from './ImageControl/index.js';
import LcControl from './LcControl/index.js';
import LimitControl from './LimitControl/index.js';
@ -22,7 +21,6 @@ const mapShape = {};
mapShape[deviceType.Section] = Section;
mapShape[deviceType.Signal] = Signal;
mapShape[deviceType.Station] = Station;
mapShape[deviceType.StationControl] = StationControl;
mapShape[deviceType.ImageControl] = ImageControl;
mapShape[deviceType.LcControl] = LcControl;
mapShape[deviceType.LimitControl] = LimitControl;

View File

@ -1,7 +1,8 @@
<template>
<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>
</template>
@ -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: {
}
};
</script>

View File

@ -1,19 +1,72 @@
<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>
<script>
export default {
name: 'DelayInfo',
props: {
delayInformation: {
delayInfoList: {
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>
<style scoped>
.info_box{
border-top:1px solid #fff;
height: auto;
max-height: 200px;
background-color: #000;
}
</style>

View File

@ -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();
});

View File

@ -68,6 +68,7 @@
filterable
:placeholder="item.placeholder"
:disabled="item.disabled"
:clearable="item.clearable"
>
<el-option
v-for="option in item.options"

View File

@ -172,7 +172,7 @@
<script>
import SectionDraft from './section';
import SwitchDraft from './switch';
import SignalDraft from './signal';
import SignalDraft from './signal/index';
import StationDraft from './station';
import StationStandDraft from './stationstand';
// import StationControlDraft from './stationcontrol';

View File

@ -337,7 +337,9 @@ export default {
value: '02',
label: this.$t('map.sectionAssociationMode')
}],
AssociateSectionList: []
AssociateSectionList: [],
oldLeftSectionCode: '',
oldRightSectionCode: ''
};
},
computed: {
@ -367,8 +369,8 @@ export default {
{ 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: '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: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList},
{ 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, 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: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
@ -439,16 +441,16 @@ export default {
},
rules() {
var validateLeftSection = (rule, value, callback) => {
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();
@ -593,6 +595,12 @@ export default {
},
isLeftSectionButtonShow() {
return this.field === 'leftSection';
},
isRightSectionButtonShow() {
return this.field === 'rightSection';
},
hasAssociatedSection() {
return this.editModel.type === '01' || this.editModel.type === '03';
}
},
watch: {
@ -642,16 +650,20 @@ export default {
if (!this.fieldS) { //
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (this.field === 'leftSection') {
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') {
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();
@ -662,6 +674,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);
@ -897,41 +911,74 @@ export default {
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const models = [];
if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) {
this.$messageBox('道岔区段应仅有一侧关联区段!');
return;
}
let models = [];
const model = deepAssign(this.editModel, {_type: 'Section'}); // model
model.leftStopPointOffset = Number(model.leftStopPointOffset);
model.rightStopPointOffset = Number(model.rightStopPointOffset);
models.push(model);
this.fieldS = '';
const changeSectionList = this.handleOtherSectionChange(model);
models = [model, ...changeSectionList];
this.$emit('updateMapModel', models);
this.oldPoint = JSON.parse(JSON.stringify(model.points));
this.oldLeftSectionCode = model.leftSectionCode;
this.oldRightSectionCode = model.rightSectionCode;
} else {
this.$message('还有属性未填写,修改未生效!');
}
});
},
handleOtherSectionChange(model) { //
const models = [];
this.sectionList.forEach(section => {
if (section.parentCode == model.code) {
if (section.parentCode === model.code) {
const copySection = deepAssign({}, section);
copySection.logicSectionShow = model.logicSectionShow;
copySection.trainPosType = model.trainPosType;
models.push(copySection);
}
if (model.code != section.code && section.type == '01') {
const lastIndex = this.oldPoint.length - 1;
if (model.code !== section.code && (section.type === '01' || section.typel === '03')) {
const copySection = deepAssign({}, section);
if (this.oldPoint[0].x == section.points[section.points.length - 1].x && this.oldPoint[0].y == section.points[section.points.length - 1].y) {
if (this.checkPointsCoincide(this.oldPoint[0], section.points[section.points.length - 1])) {
copySection.points[copySection.points.length - 1].x = model.points[0].x;
copySection.points[copySection.points.length - 1].y = model.points[0].y;
copySection.offsetRight = model.offsetLeft;
}
if (this.oldPoint[lastIndex].x == section.points[0].x && this.oldPoint[lastIndex].y == section.points[0].y) {
if (this.checkPointsCoincide(this.oldPoint[this.oldPoint.length - 1], section.points[0])) {
copySection.points[0].x = model.points[model.points.length - 1].x;
copySection.points[0].y = model.points[model.points.length - 1].y;
copySection.offsetLeft = model.offsetRight;
}
if (model.leftSectionCode !== this.oldLeftSectionCode) {
if (copySection.code === model.leftSectionCode) {
copySection.rightSectionCode = model.code;
} else if (copySection.code === this.oldLeftSectionCode) {
copySection.rightSectionCode = '';
}
}
if (model.rightSectionCode !== this.oldRightSectionCode) {
if (copySection.code === model.rightSectionCode) {
copySection.leftSectionCode = model.code;
} else if (copySection.code === this.oldRightSectionCode) {
copySection.leftSectionCode = '';
}
}
models.push(copySection);
}
});
this.fieldS = '';
this.$emit('updateMapModel', models);
this.oldPoint = JSON.parse(JSON.stringify(model.points));
} else {
this.$message('还有属性未填写,修改未生效!');
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() {
@ -1165,6 +1212,12 @@ export default {
}
}
});
},
checkPointsCoincide(point1, point2) { //
if (point1 && point2) {
return point1.x === point2.x && point1.y === point2.y;
}
return false;
}
}
};

View File

@ -0,0 +1,218 @@
<template>
<div style="height:100%;">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" label-width="130px" :model="addModel" size="mini" :rules="mergeRules">
<el-form-item :label="$t('map.physicalSegmentName')" prop="sectionCode">
<el-select v-model="addModel.sectionCode" filterable>
<el-option
v-for="item in signalSectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'selectSingalCode' ? 'danger' : 'primary'"
size="small"
@click="hover('selectSingalCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.signalNameColon')" prop="name">
<el-input v-model="addModel.name" style="width: 178px;" />
</el-form-item>
<el-form-item :label="$t('map.leftOrRight')" prop="leftOrRight">
<el-radio-group v-model="addModel.leftOrRight">
<el-radio
v-for="item in SignalLeftOrRightList"
:key="item.value"
:label="item.value"
border
size="mini"
>
{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.signalDirectionTypeX')" prop="directionShowType">
<el-radio-group v-model="addModel.directionShowType">
<el-radio
v-for="item in SignalDirectionList"
:key="item.code"
:label="item.code"
border
size="mini"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.positionType')" prop="positionType">
<el-radio-group v-model="addModel.positionType">
<el-radio
v-for="item in SignalPositionTypeList"
:key="item.code"
:label="item.code"
border
size="mini"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.equipmentStation')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name + item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import JTriangle from '@/jmap/utils/JTriangle';
export default {
name: 'SignalCreate',
props: {
field:{
type:String,
default: function () {
return '';
}
}
},
data() {
return {
addModel: {
sectionCode: '',
name: '',
directionShowType: '01',
leftOrRight: '0',
positionType: '01',
stationCode: ''
},
SignalPositionTypeList:[],
SignalDirectionList: [
{ code: '01', name: '向左' },
{ code: '02', name: '向右' }
],
SignalLeftOrRightList: [],
mergeRules: {
sectionCode: [
{ required: true, message: this.$t('rules.selectPhysicalExtentName'), trigger: 'change' }
],
directionShowType: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.directionType'), trigger: 'change' }
],
leftOrRight: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.leftOrRight'), trigger: 'change' }
],
positionType: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.positionType'), trigger: 'change' }
],
stationCode: [
{ required: false, message: this.$t('map.pleaseSelect') + '' + this.$t('map.equipmentStation'), trigger: 'change' }
]
}
};
},
computed:{
...mapGetters('map', [
'sectionList',
'stationList'
]),
//
signalSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => {
return elem.type === '01' || elem.type === '03';
});
}
return list;
}
},
mounted() {
this.SignalLeftOrRightList = this.$ConstSelect.SignalLeftOrRightList;
this.$Dictionary.signalPositionType().then(list => {
this.SignalPositionTypeList = list;
});
},
methods:{
create() {
this.$refs['make'].validate((valid) => {
if (valid) {
if (this.addModel.sectionCode) {
const uid = getUID('Singal');
var model = {
_type: 'Signal',
code: uid,
uniqueName: uid,
sectionCode: this.addModel.sectionCode,
positionType: this.addModel.positionType,
directionShowType: this.addModel.directionShowType,
nameShow: true,
namePosition: { x: 0, y: 0 },
buttonShow: true,
useType: '01',
potLampType: '01',
lampPostType: '01',
lampPositionType: '01',
guideShow: false,
stationCode: this.addModel.stationCode
};
this.sectionList.forEach(elem => {
if (elem.code === this.addModel.sectionCode) {
model.name = this.addModel.name || 'Signal_' + elem.name.replace('Section_', '');
if (this.addModel.leftOrRight === '0') {
const beg = elem.points[0];
const end = elem.points[0 + 1];
const traingle = new JTriangle(beg, end);
model.rotate = Math.floor(traingle.getAngle());
model.position = { x: elem.points[0].x, y: elem.points[0].y };
model.guidePosition = { x: elem.points[0].x, y: elem.points[0].y };
model.buttonPosition = { x: elem.points[0].x, y: elem.points[0].y };
model.offset = elem.lengthFact && elem.lengthFact > 2 ? 2 : 0;
} else {
const r = elem.points.length - 1;
const beg = elem.points[r - 1];
const end = elem.points[r];
const traingle = new JTriangle(beg, end);
model.rotate = Math.floor(traingle.getAngle());
model.position = { x: elem.points[r].x, y: elem.points[r].y };
model.guidePosition = { x: elem.points[r].x, y: elem.points[r].y };
model.buttonPosition = { x: elem.points[r].x, y: elem.points[r].y };
model.offset = elem.lengthFact && elem.lengthFact > 2 ? elem.lengthFact - 2 : 0;
}
}
});
this.$emit('updateMapModel', model);
} else {
this.$messageBox(this.$t('tip.selectedSectionEmpty'));
}
}
});
},
hover(field) {
this.field = field === this.field ? '' : field;
this.$emit('signalSectionCode', this.field);
},
setSectionCode(code) {
this.addModel.sectionCode = code;
}
}
};
</script>

View File

@ -14,104 +14,22 @@
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" label-width="130px" :model="addModel" size="mini" :rules="mergeRules">
<el-form-item :label="$t('map.physicalSegmentName')" prop="sectionCode">
<el-select v-model="addModel.sectionCode" filterable>
<!-- <el-option
v-for="item in PhysicalSectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/> -->
<el-option
v-for="item in signalSectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'selectSingalCode' ? 'danger' : 'primary'"
size="small"
@click="hover('selectSingalCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.signalNameColon')" prop="name">
<el-input v-model="addModel.name" style="width: 178px;" />
</el-form-item>
<el-form-item :label="$t('map.leftOrRight')" prop="leftOrRight">
<el-radio-group v-model="addModel.leftOrRight">
<el-radio
v-for="item in SignalLeftOrRightList"
:key="item.value"
:label="item.value"
border
size="mini"
>
{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.signalDirectionTypeX')" prop="directionShowType">
<el-radio-group v-model="addModel.directionShowType">
<el-radio
v-for="item in SignalDirectionList"
:key="item.code"
:label="item.code"
border
size="mini"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.positionType')" prop="positionType">
<el-radio-group v-model="addModel.positionType">
<el-radio
v-for="item in SignalPositionTypeList"
:key="item.code"
:label="item.code"
border
size="mini"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.equipmentStation')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name + item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
<create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" @updateMapModel="updateMapModel" />
</el-tab-pane>
</el-tabs>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import JTriangle from '@/jmap/utils/JTriangle';
import ConfigList from './config/list';
import ConfigList from '../config/list';
import { deepAssign } from '@/utils/index';
import createSignal from './create';
export default {
name: 'SignalDraft',
components: {
ConfigList
ConfigList,
createSignal
},
props: {
selected: {
@ -138,6 +56,7 @@ export default {
{ code: '00', name: this.$t('map.normal') },
{ code: '01', name: this.$t('map.signalFilamentAlarm') }
],
field:'',
editModel: {
code: '',
name: '',
@ -159,38 +78,11 @@ export default {
position: { x: 0, y: 0 },
buttonPosition: { x: 0, y: 0 },
guidePosition: { x: 0, y: 0 }
},
field: '',
addModel: {
sectionCode: '',
name: '',
directionShowType: '01',
leftOrRight: '0',
positionType: '01',
stationCode: ''
},
mergeRules: {
sectionCode: [
{ required: true, message: this.$t('rules.selectPhysicalExtentName'), trigger: 'change' }
],
directionShowType: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.directionType'), trigger: 'change' }
],
leftOrRight: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.leftOrRight'), trigger: 'change' }
],
positionType: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.positionType'), trigger: 'change' }
],
stationCode: [
{ required: false, message: this.$t('map.pleaseSelect') + '' + this.$t('map.equipmentStation'), trigger: 'change' }
]
}
};
},
computed: {
...mapGetters('map', [
'linkList',
'signalList',
'sectionList',
'stationList',
@ -344,74 +236,21 @@ export default {
this.editModel.rotate = selected.rotate || 0; //
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSingalCode'.toUpperCase()) {
if (selected.type == '01') {
this.addModel.sectionCode = selected.code;
this.$refs.createSignal.setSectionCode(selected.code);
} else if (selected.type == '02') {
this.addModel.sectionCode = selected.parentCode;
this.$refs.createSignal.setSectionCode(selected.parentCode);
}
this.activeName = 'second';
this.field = '';
this.$emit('signalSectionCode', '');
}
},
hover(field) {
this.field = field === this.field ? '' : field;
this.$emit('signalSectionCode', this.field);
signalSectionCode(field) {
this.field = field;
this.$emit('signalSectionCode', field);
},
create() {
this.$refs['make'].validate((valid) => {
if (valid) {
if (this.addModel.sectionCode) {
const uid = getUID('Singal');
var model = {
_type: 'Signal',
code: uid,
uniqueName: uid,
sectionCode: this.addModel.sectionCode,
positionType: this.addModel.positionType,
directionShowType: this.addModel.directionShowType,
nameShow: true,
namePosition: { x: 0, y: 0 },
buttonShow: true,
useType: '01',
potLampType: '01',
lampPostType: '01',
lampPositionType: '01',
guideShow: false,
stationCode: this.addModel.stationCode
};
this.sectionList.forEach(elem => {
if (elem.code === this.addModel.sectionCode) {
model.name = this.addModel.name || 'Signal_' + elem.name.replace('Section_', '');
model.linkCode = elem.code;
if (this.addModel.leftOrRight === '0') {
const beg = elem.points[0];
const end = elem.points[0 + 1];
const traingle = new JTriangle(beg, end);
model.rotate = Math.floor(traingle.getAngle());
model.position = { x: elem.points[0].x, y: elem.points[0].y };
model.guidePosition = { x: elem.points[0].x, y: elem.points[0].y };
model.buttonPosition = { x: elem.points[0].x, y: elem.points[0].y };
model.offset = elem.lengthFact && elem.lengthFact > 2 ? 2 : 0;
} else {
const r = elem.points.length - 1;
const beg = elem.points[r - 1];
const end = elem.points[r];
const traingle = new JTriangle(beg, end);
model.rotate = Math.floor(traingle.getAngle());
model.position = { x: elem.points[r].x, y: elem.points[r].y };
model.guidePosition = { x: elem.points[r].x, y: elem.points[r].y };
model.buttonPosition = { x: elem.points[r].x, y: elem.points[r].y };
model.offset = elem.lengthFact && elem.lengthFact > 2 ? elem.lengthFact - 2 : 0;
}
}
});
updateMapModel(model) {
this.$emit('updateMapModel', model);
} else {
this.$messageBox(this.$t('tip.selectedSectionEmpty'));
}
}
});
},
//
edit() {