大铁调整
This commit is contained in:
parent
0bb06fd142
commit
8a363c068a
@ -275,5 +275,9 @@ deviceRender[deviceType.Responder] = {
|
||||
_type: deviceType.Responder,
|
||||
zlevel: 1
|
||||
};
|
||||
|
||||
/** 信号按钮 */
|
||||
deviceRender[deviceType.SignalButton] = {
|
||||
_type: deviceType.SignalButton,
|
||||
zlevel: 1
|
||||
};
|
||||
export default deviceRender;
|
||||
|
@ -48,7 +48,8 @@ const deviceType = {
|
||||
OverAp: 'OverAp',
|
||||
FloodGate: 'FloodGate',
|
||||
DirectionRod: 'DirectionRod',
|
||||
Responder: 'Responder'
|
||||
Responder: 'Responder',
|
||||
SignalButton: 'SignalButton'
|
||||
};
|
||||
|
||||
export default deviceType;
|
||||
|
127
src/jmapNew/shape/signalButton/index.js
Normal file
127
src/jmapNew/shape/signalButton/index.js
Normal file
@ -0,0 +1,127 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||||
|
||||
export default class Line2 extends Group {
|
||||
constructor(model, {style}) {
|
||||
super();
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = 0;
|
||||
this.model = model;
|
||||
this.style = style.Line;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
if (model && model.points.length > 1) {
|
||||
const points = [];
|
||||
const vicePoints = [];
|
||||
const modelPoints = model.points;
|
||||
const length = modelPoints.length;
|
||||
const path = window.location.href;
|
||||
if (model.type === '03' && !path.includes('/map/draw')) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
points.push([modelPoints[i].x + 10, modelPoints[i].y]);
|
||||
}
|
||||
this.segment = new Polyline({
|
||||
zlevel: this.zlevel,
|
||||
z:this.z,
|
||||
shape: {
|
||||
points:points
|
||||
},
|
||||
style: {
|
||||
lineWidth: model.width,
|
||||
stroke: model.lineColor || this.style.lineColor
|
||||
}
|
||||
});
|
||||
this.add(this.segment);
|
||||
for (let i = 0; i < length; i++) {
|
||||
vicePoints.push([modelPoints[i].x - model.offsetX, modelPoints[i].y + model.offsetY]);
|
||||
}
|
||||
this.viceSegment = new Polyline({
|
||||
zlevel: this.zlevel,
|
||||
z:this.z,
|
||||
shape: {
|
||||
points:vicePoints
|
||||
},
|
||||
style: {
|
||||
lineWidth: model.width,
|
||||
stroke: model.lineColor || this.style.lineColor
|
||||
}
|
||||
});
|
||||
this.add(this.viceSegment);
|
||||
} else {
|
||||
for (let i = 0; i < length; i++) {
|
||||
points.push([modelPoints[i].x, modelPoints[i].y]);
|
||||
}
|
||||
this.segment = new Polyline({
|
||||
zlevel: this.zlevel,
|
||||
z:this.z,
|
||||
shape: {
|
||||
points:points
|
||||
},
|
||||
style: {
|
||||
lineWidth: model.width,
|
||||
stroke: model.lineColor || this.style.lineColor
|
||||
}
|
||||
});
|
||||
this.add(this.segment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setLineType(type) {
|
||||
switch (type) {
|
||||
case '01': break;
|
||||
case '02':
|
||||
this.segment && this.segment.setStyle('lineDash', this.style.lineDash || [4]);
|
||||
break;
|
||||
case '03':
|
||||
this.segment && this.segment.setStyle('lineDash', this.style.lineDash || [4]);
|
||||
this.viceSegment && this.viceSegment.setStyle('lineDash', this.style.lineDash || [4]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.setLineType(model.type);
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = this.model.showConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.segment && this.segment.show();
|
||||
this.viceSegment && this.viceSegment.show();
|
||||
} else {
|
||||
this.segment && this.segment.hide();
|
||||
this.viceSegment && this.viceSegment.hide();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || this.model.stationCode === stationCode) {
|
||||
this.segment && this.segment.show();
|
||||
this.viceSegment && this.viceSegment.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.segment && this.segment.hide();
|
||||
this.viceSegment && this.viceSegment.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
if (this.segment) {
|
||||
const rect = this.segment.getBoundingRect();
|
||||
return {x:rect.x, y:rect.y};
|
||||
} else {
|
||||
return {x:0, y:0};
|
||||
}
|
||||
}
|
||||
}
|
250
src/views/newMap/newMapdraft/mapoperate/signalButton.vue
Normal file
250
src/views/newMap/newMapdraft/mapoperate/signalButton.vue
Normal file
@ -0,0 +1,250 @@
|
||||
<template>
|
||||
<el-tabs v-model="activeName" class="card">
|
||||
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
|
||||
<operate-property
|
||||
ref="dataform"
|
||||
:form="form"
|
||||
:edit-model="editModel"
|
||||
:rules="rules"
|
||||
type="Text"
|
||||
@updateMapModel="updateMapModel"
|
||||
@clearDeviceSelect="clearDeviceSelect"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
|
||||
<create-operate
|
||||
ref="createForm"
|
||||
:create-form="createForm"
|
||||
:add-model="addModel"
|
||||
:create-rules="rules"
|
||||
@create="create"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Cookies from 'js-cookie';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmapNew/utils/Uid';
|
||||
import OperateProperty from './components/operateProperty';
|
||||
import CreateOperate from './components/createOperate';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
|
||||
export default {
|
||||
name: 'SignalButton',
|
||||
components: {
|
||||
OperateProperty,
|
||||
CreateOperate
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: 'first',
|
||||
lazy: true,
|
||||
skins: [],
|
||||
editModel: {
|
||||
code: '',
|
||||
prepend: 'H',
|
||||
content: '',
|
||||
font: '',
|
||||
fontColor: '',
|
||||
showConditions: '01',
|
||||
position: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
stationCode: ''
|
||||
},
|
||||
addModel: {
|
||||
prepend: 'H',
|
||||
content: '',
|
||||
showConditions: '01',
|
||||
position: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
},
|
||||
typeList: [
|
||||
{ value: 'pass', label: '接车按钮' }
|
||||
],
|
||||
centralizedStationList: [], // 设备集中站列表
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: this.$t('rules.selectText'), trigger: 'blur' }
|
||||
],
|
||||
content: [
|
||||
{ required: true, message: this.$t('rules.pleaseEnterContent'), trigger: 'blur' }
|
||||
],
|
||||
font: [
|
||||
{ required: true, message: this.$t('rules.textFont'), trigger: 'blur' }
|
||||
],
|
||||
fontColor: [
|
||||
{ required: true, message: this.$t('rules.textFontColor'), trigger: 'blur' }
|
||||
],
|
||||
'position.x': [
|
||||
{ required: true, message: this.$t('rules.pleaseEnterXCoordinate'), trigger: 'blur' }
|
||||
],
|
||||
'position.y': [
|
||||
{ required: true, message: this.$t('rules.pleaseEnterYCoordinate'), trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'textList',
|
||||
'stationList',
|
||||
'lineCode'
|
||||
]),
|
||||
showConditionsList() {
|
||||
const showConditionsList = ConstConfig.ConstSelect.showConditionsList;
|
||||
return Cookies.get('user_lang') == 'en'
|
||||
? showConditionsList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
|
||||
: showConditionsList.map(elem => { return { value: elem.value, label: elem.label }; });
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '130px',
|
||||
items: {
|
||||
code: {
|
||||
name: '',
|
||||
item: []
|
||||
},
|
||||
draw: {
|
||||
name: this.$t('map.drawData'),
|
||||
item: [
|
||||
{ prop: 'code', label: this.$t('map.textCode'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.textList, deviceChange: this.deviceChange },
|
||||
{ prop: 'content', label: this.$t('map.textContent'), type: 'fontContent', content: 'content', prepend: 'prepend', placeholder: this.$t('map.pleaseEnter') },
|
||||
{ prop: 'font', label: this.$t('map.textFont'), type: 'font', placeholder: this.$t('map.font') },
|
||||
{ prop: 'fontColor', label: this.$t('map.textFontColor'), type: 'color' },
|
||||
{ prop: 'showConditions', label: this.$t('map.showConditions'), type: 'radio', optionLabel: 'label', optionValue:'value', radioList: this.showConditionsList},
|
||||
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '120px', children: [
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px', disabled: false },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
|
||||
] },
|
||||
{ prop: 'stationCode', label: this.$t('map.equipmentStation') + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
|
||||
]
|
||||
},
|
||||
map: {
|
||||
name: this.$t('map.mapData'),
|
||||
item: [
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
return form;
|
||||
},
|
||||
createForm() {
|
||||
const form = {
|
||||
labelWidth: '110px',
|
||||
items:{
|
||||
all:{
|
||||
name:'',
|
||||
item: [
|
||||
{ prop: 'content', label: this.$t('map.textContent'), type: 'fontContent', content: 'content', prepend: 'prepend', placeholder: this.$t('map.pleaseEnter') },
|
||||
{ prop: 'showConditions', label: this.$t('map.showConditions'), type: 'radio', optionLabel: 'label', optionValue:'value', radioList: this.showConditionsList},
|
||||
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '120px', children: [
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px', disabled: false },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
|
||||
] }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
return form;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleInit() {
|
||||
if (this.stationList && this.stationList.length) {
|
||||
this.centralizedStationList = this.stationList.filter(station=> station.centralized);
|
||||
}
|
||||
},
|
||||
deviceChange(code) {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.handleInit();
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
this.$refs.dataform && this.$refs.dataform.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Text'.toUpperCase()) {
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
[this.editModel.prepend, this.editModel.content] = selected.content.split('::');
|
||||
}
|
||||
},
|
||||
clearDeviceSelect() {
|
||||
this.$emit('deviceSelect', '');
|
||||
},
|
||||
create() {
|
||||
const model = {
|
||||
_type: 'Text',
|
||||
code: getUID('Text', this.textList),
|
||||
font: '14',
|
||||
fontColor: '#FFFFFF',
|
||||
content: `${this.addModel.prepend}::${this.addModel.content}`,
|
||||
position: {
|
||||
x: this.addModel.position.x,
|
||||
y: this.addModel.position.y
|
||||
}
|
||||
};
|
||||
this.$refs.createForm.resetForm();
|
||||
this.$emit('updateMapModel', model);
|
||||
},
|
||||
deleteObj() {
|
||||
this.$refs.dataform.deleteObj();
|
||||
},
|
||||
// 修改对象
|
||||
edit() {
|
||||
this.$refs.dataform.edit();
|
||||
},
|
||||
updateMapModel(data) {
|
||||
this.$emit('updateMapModel', data);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
.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: 120px;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 7px;
|
||||
}
|
||||
}
|
||||
/deep/ {
|
||||
.el-select .el-input {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.input-with-select .el-input-group__prepend {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user