This commit is contained in:
fan 2019-12-05 14:55:33 +08:00
commit 22f9332ea3
12 changed files with 557 additions and 507 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

@ -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

@ -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() {