自动进路和引导总锁

This commit is contained in:
joylink_fanyuhong 2020-03-05 16:39:49 +08:00
parent 2df1803ca5
commit 8d58125e1f
13 changed files with 546 additions and 6 deletions

View File

@ -295,7 +295,8 @@ class SkinCode extends defaultStyle {
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
controlColor: '#FFFF00', // 控制灯颜色
guideColor: '#5A5D5A' // 引导总锁灯颜色
},
turnBack: { // 按图折返
lamp: 1, // 灯数量
@ -413,7 +414,43 @@ class SkinCode extends defaultStyle {
this[deviceType.Line] = {
lineColor: '#FFFFFF' // 线条颜色
};
this[deviceType.Automactic] = {
// 是否显示
visible: true,
text: {
fontSize: 11, // 字体大小
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' // 控制灯颜色 (灰色)
}
};
this[deviceType.AutomaticRoute] = {
// 是否显示
visible: true,
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
lineDash: null, // 灯的包围框
stroke: '#FFFFFF', // 框的颜色
fill: 'rgba(0,0,0,0)', // 填充色
radiusR: 6, // 控制灯大小
controlColor: '#b5b3b3' // 控制灯颜色 (灰色)
}
};
this[deviceType.TrainWindow] = {
lineColor: '#4DD43F', // 车次窗颜色
lineDash: null, // 车次窗虚线间隔

View File

@ -122,5 +122,11 @@ deviceRender[deviceType.Automactic] = {
zlevel: 1
};
/** AutomacticRoute渲染配置 自动折返*/
deviceRender[deviceType.AutomaticRoute] = {
_type: deviceType.AutomaticRoute,
zlevel: 1
};
export default deviceRender;

View File

@ -18,7 +18,8 @@ const deviceType = {
TrainWindow: 'TrainWindow',
Line: 'Line',
Text: 'Text',
CheckBox: 'CheckBox'
CheckBox: 'CheckBox',
AutomaticRoute:'AutomaticRoute'
};
export default deviceType;

View File

@ -0,0 +1,53 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class EMouse extends Group {
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
zlevel: this.device.zlevel,
z: this.device.z+1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance-30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
}

View File

@ -0,0 +1,105 @@
/*
* 自动折返 控制器
*/
import Group from 'zrender/src/container/Group';
import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text';
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);
}
create() {
const model = this.model;
this.control = new Arc({
_subType: 'Control',
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.position.x,
cy: model.position.y,
r: this.style.AutomaticRoute.lamp.radiusR
},
style: {
lineWidth: 0,
fill: this.style.AutomaticRoute.lamp.controlColor
}
});
this.text = new Text({
_subType: 'Text',
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AutomaticRoute.lamp.radiusR + this.style.AutomaticRoute.text.distance,
fontWeight: this.style.AutomaticRoute.text.fontWeight,
fontSize: this.style.AutomaticRoute.text.fontSize,
fontFamily: this.style.fontFamily,
text: model.name,
textFill: '#fff',
textAlign: 'middle',
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.AutomaticRoute.lamp.radiusR + this.style.AutomaticRoute.subtitleText.distance,
fontWeight: this.style.AutomaticRoute.subtitleText.fontWeight,
fontSize: this.style.AutomaticRoute.subtitleText.fontSize,
fontFamily: this.style.fontFamily,
text: model.subtitleName,
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top'
}
});
this.add(this.subtitleText);
}
this.add(this.control);
this.add(this.text);
}
// 设置状态
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); });
}
}
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;
}
}

View File

@ -22,6 +22,7 @@ export default class Station extends Group {
this.style = style;
this.create();
this.createTurnBack(); // 创建按图折返
this.createGuideTotalLock(); // 创建引导总锁
this.createControlMode();
this.setState(model);
this.checkIsDrawMap();
@ -104,6 +105,39 @@ export default class Station extends Group {
}
}
}
createGuideTotalLock() { // 创建引导总锁
const model = this.model;
const style = this.style;
if(model.guideTotalLock) {
this.guideLamp = new EControl({
zlevel: this.zlevel,
z: this.z,
arc: {
shape: {
cx: model.guideTotalLockPoint.x,
cy: model.guideTotalLockPoint.y,
r: style.Station.lamp.radiusR
},
lineWidth: 0,
fill: style.Station.lamp.guideColor
},
text: {
position: [0, 0],
x: model.guideTotalLockPoint.x,
y: model.guideTotalLockPoint.y + style.Station.lamp.radiusR + style.Station.StationControl.text.distance,
fontWeight: style.Station.text.fontWeight,
fontSize: style.Station.text.fontSize,
fontFamily: style.fontFamily,
text: '引导总锁',
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top'
},
style: this.style
});
this.add(this.guideLamp);
}
}
createTurnBack() { // 创建按图折返
const model = this.model;
const style = this.style;

View File

@ -17,6 +17,7 @@ import Line from './Line/index.js';
import Text2 from './Text/index.js';
import Automactic from './Automactic/index.js';
import CheckBox from './checkBox/checkBox.js';
import AutomaticRoute from './AutomacticRoute/index.js';
/** 图库*/
const mapShape = {};
@ -38,6 +39,7 @@ mapShape[deviceType.Line] = Line;
mapShape[deviceType.Text] = Text2;
mapShape[deviceType.Automactic] = Automactic;
mapShape[deviceType.CheckBox] = CheckBox;
mapShape[deviceType.AutomaticRoute] = AutomaticRoute;
function shapefactory(device, jmap) {
const type = device._type;

View File

@ -210,6 +210,7 @@ export function updateMapData(state, model) {
case deviceType.Psd: updateForList(model, state, 'psdList'); break;
case deviceType.Esp: updateForList(model, state, 'espList'); break;
case deviceType.Automactic: updateForList(model, state, 'automaticList'); break;
case deviceType.AutomaticRoute: updateForList(model, state, 'automaticRouteButtonList'); break;
}
}
}

View File

@ -323,6 +323,13 @@ const map = {
return [];
}
},
automaticRouteButtonList: (state) => {
if (state.map) {
return state.map.automaticRouteButtonList || [];
} else {
return [];
}
},
resourceList: (state) => {
if (state.map) {
return state.map.resourceList;

View File

@ -3,14 +3,14 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -0,0 +1,274 @@
<template>
<el-tabs v-model="activeName" class="card" @tab-click="handleClick">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" />
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</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">
<config-data ref="make" :form="formMake" :form-model="addModel" :rules="createRules" />
</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>
</el-tab-pane>
</el-tabs>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import ConfigList from './config/list';
import ConfigData from './config/data';
import { deepAssign } from '@/utils/index';
import { getRouteNewList} from '@/api/jmap/mapdraft';
export default {
name: 'AutoMaticRoute',
components: {
ConfigList,
ConfigData
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
activeName: 'first',
autoList: [],
editModel: {
code: '',
name: '',
automaticRouteCode: '', // code
position: {
x: 0,
y: 0
}
},
addModel: {
code: '',
name: '',
automaticRouteCode: '', // code
position: {
x: 0,
y: 0
}
},
rules: {
code: [
{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.pleaseEnterStatusSignal'), trigger: 'blur' }
],
automaticRouteCode:[
{ required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
],
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
],
'position.y': [
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }
]
}
};
},
computed: {
...mapGetters('map', [
'automaticRouteButtonList'
]),
form() {
const form = {
labelWidth: '150px',
items: {
code: {
name: '',
item: []
},
draw: {
name: this.$t('map.drawData'),
item: [
{ prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.automaticRouteButtonList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', 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' }
] },
{ prop:'automaticRouteCode', label: '自动进路code:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList },
]
}
}
};
return form;
},
formMake() {
const form = {
labelWidth: '150px',
items: [
{ prop:'automaticRouteCode', label: '自动进路:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList },
{ prop: 'name', 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' }
] }
]
};
return form;
},
createRules: function () {
return {
automaticRouteCode: [
{ required: true, message: '请选择自动进路', trigger: 'change' }
],
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
],
'position.y': [
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }
]
};
}
},
watch: {
selected(val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
this.getAutoMaticList();
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
handleClick() {
this.getAutoMaticList();
},
deviceSelect(selected) {
this.$refs.dataform.resetFields();
this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'AutomaticRoute'.toUpperCase()) {
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
}
},
async getAutoMaticList() {
const params = {
pageSize: 9999,
pageNum: 1
};
const resp = await getRouteNewList(this.$route.params.mapId, params);
this.autoList = [];
resp.data && resp.data.list && resp.data.list.forEach(elem => {
if (elem.flt) {
this.autoList.push(elem);
}
});
},
//
create() {
this.$refs.make.validate((valid) => {
console.log(valid, this.addModel, this.editModel);
if (valid) {
const uid = getUID('AutomaticRoute', this.automaticRouteButtonList);
let models = [];
const model = {
_type: 'AutomaticRoute',
code: uid,
name: this.addModel.name,
position: {
x: this.addModel.position.x,
y: this.addModel.position.y
},
automaticRouteCode:this.addModel.automaticRouteCode
};
models.push(model, '=-----');
this.$emit('updateMapModel', models);
this.$refs.make.resetForm();
}
});
},
//
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'AutomaticRoute'}, this.editModel);
let models = [data];
this.$emit('updateMapModel', models);
}
});
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'AutomacticRoute'.toUpperCase()) {
const _that = this;
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
_that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect();
}).catch(() => {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.view-control{
height: 100%;
}
.card {
height: 100%;
}
.coordinate {
overflow: hidden;
.title {
text-align: right;
font-size: 14px;
color: #606266;
line-height: 40px;
padding: 0 12px 0 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
line-height: 28px;
width: 160px;
font-weight: bold;
display: block;
float: left;
}
}
.map-draft-group {
color: #3E44BE;
}
</style>

View File

@ -100,6 +100,14 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="自动进路" class="tab_pane_box" name="AutomacticRoute">
<automatic-route
ref="AutomacticRoute"
:selected="selected"
@updateMapModel="updateMapModel"
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.train')" class="tab_pane_box" name="Train">
<train-draft
ref="Train"
@ -176,6 +184,7 @@ import TextDraft from './text';
import TrainWindowDraft from './trainwindow';
import ZcControlDraft from './zcControl';
import AutomaticControlDraft from './automaticControl';
import AutomaticRoute from './automaticRoute';
import LimitControlDraft from './limitControl';
import LcControlDraft from './lcControl';
import ImageControlDraft from './ImageControl';
@ -204,7 +213,8 @@ export default {
LimitControlDraft,
LcControlDraft,
ImageControlDraft,
CheckboxDraft
CheckboxDraft,
AutomaticRoute
},
props: {
selected: {

View File

@ -125,6 +125,8 @@ export default {
// controlled:false,
createControlMode:false,
createTurnBack:false,
guideTotalLock: false,
guideTotalLockPoint: {x: 0, y: 0},
turnBackPoint: {x: 0, y: 0}, //
controlModePoint: { x: 0, y: 0 } //
},
@ -198,6 +200,11 @@ export default {
{ prop: 'turnBackPoint', label: '按图折返坐标:', type: 'coordinate', width: '120px', isHidden: !this.isPointsShow, children: [
{ prop: 'turnBackPoint.x', firstLevel: 'turnBackPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'turnBackPoint.y', firstLevel: 'turnBackPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'guideTotalLock', label: '引导总锁:', type: 'checkbox'},
{ prop: 'guideTotalLockPoint', label: '引导总锁坐标:', type: 'coordinate', width: '120px', isHidden: !this.isGuidePointsShow, children: [
{ prop: 'guideTotalLockPoint.x', firstLevel: 'guideTotalLockPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'guideTotalLockPoint.y', firstLevel: 'guideTotalLockPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }
]
},
@ -247,6 +254,9 @@ export default {
isPointsShow() {
return this.editModel.createTurnBack;
},
isGuidePointsShow() {
return this.editModel.guideTotalLock;
},
isZcCode() {
return this.editModel.centralized;
}