调整lc模块保存,自动折返绘图状态配置,流程完善

This commit is contained in:
zyy 2020-03-05 12:21:28 +08:00
parent 5ef8a595e8
commit 8e7fc5104a
6 changed files with 66 additions and 15 deletions

View File

@ -211,7 +211,15 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
subtitleText: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 17 // 等于副标题距离
},
lamp: {
lineDash: null, // 灯的包围框
stroke: '#FFFFFF', // 框的颜色
fill: 'rgba(0,0,0,0)', // 填充色
radiusR: 6, // 控制灯大小
controlColor: '#b5b3b3' // 控制灯颜色 (灰色)
}

View File

@ -97,6 +97,9 @@ class Status {
handleZcControl(device) {
this.statusObj = { };
}
handleLcControl(device) {
this.statusObj = { };
}
handleTrainWindow(device) {
this.statusObj = { };
}

View File

@ -2,7 +2,10 @@
* 自动折返 控制器
*/
import Group from 'zrender/src/container/Group';
import EControl from '../element/EControl';
import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text';
import { createBoundingRect } from '../../utils/parser';
import Rect from 'zrender/src/graphic/shape/Rect';
import EMouse from './EMouse';
export default class LcControl extends Group {
@ -53,6 +56,27 @@ export default class LcControl extends Group {
textVerticalAlign: 'top'
}
});
if (this.model.subtitleName) {
this.subtitleText = new Text({
_subType: 'Text',
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.Automactic.lamp.radiusR + this.style.Automactic.subtitleText.distance,
fontWeight: this.style.Automactic.subtitleText.fontWeight,
fontSize: this.style.Automactic.subtitleText.fontSize,
fontFamily: this.style.fontFamily,
text: model.subtitleName,
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top'
}
});
this.add(this.subtitleText);
}
const arcRect = this.getArcBoundingRect();
this.arcBorder = new Rect({
zlevel: this.zlevel,
@ -60,14 +84,14 @@ export default class LcControl extends Group {
silent: true,
shape: arcRect,
style: {
lineDash: this.style.arcBorderStyle.lineDash,
stroke: this.style.arcBorderStyle.stroke,
fill: this.style.arcBorderStyle.fill
lineDash: this.style.Automactic.lamp.lineDash,
stroke: this.style.Automactic.lamp.stroke,
fill: this.style.Automactic.lamp.fill
}
});
this.add(this.control);
this.add(this.text);
this.add(this.textBorder);
this.add(this.arcBorder);
}
// 设置状态
@ -83,6 +107,18 @@ export default class LcControl extends Group {
}
}
getArcBoundingRect() {
const rect = this.control.getBoundingRect().clone();
const scale = this.control.scale[0];
const offsetX = this.control.position[0];
const offsetY = this.control.position[1];
rect.x = rect.x * scale + offsetX - 2;
rect.y = rect.y * scale + offsetY - 2;
rect.width = rect.width * scale + 4;
rect.height = rect.height * scale + 4;
return rect;
}
getShapeTipPoint() {
if (this.control) {
var distance = 2;

View File

@ -200,7 +200,7 @@ export function updateMapData(state, model) {
case deviceType.StationCounter: updateForList(model, state, 'stationCounterList'); break;
case deviceType.ZcControl: updateForList(model, state, 'zcList'); break;
case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break;
case deviceType.LcControl: updateForList(model, state, 'lcList'); break;
case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
case deviceType.Resource: updateForList(model, state, 'resourceList'); break;
case deviceType.Train: updateForList(model, state, 'trainList'); break;

View File

@ -57,6 +57,7 @@ export default {
editModel: {
code: '',
name: '',
subtitleName: '', //
automaticCode: '', // code
position: {
x: 0,
@ -66,6 +67,7 @@ export default {
addModel: {
code: '',
name: '',
subtitleName: '', //
automaticCode: '', // code
position: {
x: 0,
@ -106,9 +108,10 @@ export default {
draw: {
name: this.$t('map.drawData'),
item: [
{ prop: 'code', label: `${this.$t('map.zcZoneControl')}${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.automaticList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.statusSignalName'), type: 'input' },
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.automaticList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: '标题名称:', type: 'input' },
{ prop: 'subtitleName', label: '副标题名称:', type: 'input' },
{ prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] },
@ -125,9 +128,10 @@ export default {
items: [
{ prop:'automaticCode', label: '自动折返进路:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList },
{ prop: 'name', label: '自动折返名称:', type: 'input' },
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
{ prop: 'subtitleName', label: '副标题名称:', type: 'input' },
{ prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
]
@ -182,7 +186,6 @@ export default {
};
const resp = await getAutoReentryList(this.$route.params.mapId, params);
this.autoList = resp.data.list;
console.log(this.autoList)
},
//
create() {
@ -194,6 +197,7 @@ export default {
_type: 'Automactic',
code: uid,
name: this.addModel.name,
subtitleName: this.addModel.subtitleName,
position: {
x: this.addModel.position.x,
y: this.addModel.position.y

View File

@ -92,9 +92,9 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="自动折返" class="tab_pane_box" name="AutomaticControl">
<el-tab-pane label="自动折返" class="tab_pane_box" name="Automactic">
<automatic-control-draft
ref="AutomaticControl"
ref="Automactic"
:selected="selected"
@updateMapModel="updateMapModel"
@setCenter="setCenter"