Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
c42a184b7b
@ -9,9 +9,9 @@ import Polygon from 'zrender/src/graphic/shape/Polygon';
|
|||||||
const defaultStyle = {
|
const defaultStyle = {
|
||||||
block:{
|
block:{
|
||||||
stroke: '#fff', mapStyle: {
|
stroke: '#fff', mapStyle: {
|
||||||
FB: { fill: '#fff' },
|
FB: { fill: '#fff', stroke: '#000' },
|
||||||
VB: { fill: '#666' },
|
VB: { fill: '#666', stroke: '#000' },
|
||||||
IB: { fill: '#666' }
|
IB: { fill: '#666', stroke: '#000' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
text:{
|
text:{
|
||||||
@ -40,16 +40,19 @@ export default class Responder extends Group {
|
|||||||
create() {
|
create() {
|
||||||
const model = this.model;
|
const model = this.model;
|
||||||
const responderStyle = this.style.Responder || defaultStyle;
|
const responderStyle = this.style.Responder || defaultStyle;
|
||||||
const blockX = model.position.x;
|
const distance = 12;
|
||||||
const blockY = model.position.y;
|
const offsetX = distance * Math.sin(model.rotate);
|
||||||
|
const offsetY = distance * Math.cos(model.rotate);
|
||||||
const blockWidth = responderStyle.block.width || 5;
|
const blockWidth = responderStyle.block.width || 5;
|
||||||
const blockHeight = responderStyle.block.height || 12;
|
const blockHeight = responderStyle.block.height || 12;
|
||||||
const blockStroke = responderStyle.block.stroke;
|
|
||||||
const blockStyle = responderStyle.block.mapStyle[model.type] || { fill: '#fff'};
|
const blockStyle = responderStyle.block.mapStyle[model.type] || { fill: '#fff'};
|
||||||
const textX = model.position.x + model.textOffset.x;
|
const blockX = model.position.x - blockWidth / 2 - offsetX;
|
||||||
const textY = model.position.y + model.textOffset.y;
|
const blockY = model.position.y - blockHeight / 2 - offsetY;
|
||||||
|
const textX = blockX + model.textOffset.x;
|
||||||
|
const textY = blockY + model.textOffset.y;
|
||||||
const textName = `${model.type}-${model.name}`;
|
const textName = `${model.type}-${model.name}`;
|
||||||
const textFill = responderStyle.text.textFill;
|
const textFill = responderStyle.text.textFill;
|
||||||
|
const origin = [model.position.x, model.position.y];
|
||||||
const deltaFill = responderStyle.delta.fill;
|
const deltaFill = responderStyle.delta.fill;
|
||||||
const padding = 1.2;
|
const padding = 1.2;
|
||||||
|
|
||||||
@ -63,25 +66,10 @@ export default class Responder extends Group {
|
|||||||
height: blockHeight
|
height: blockHeight
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
stroke: blockStroke,
|
|
||||||
...blockStyle
|
...blockStyle
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.text = new Text({
|
|
||||||
zlevel: this.zlevel,
|
|
||||||
z: this.z + 1,
|
|
||||||
style: {
|
|
||||||
x: textX,
|
|
||||||
y: textY,
|
|
||||||
text: textName,
|
|
||||||
fontFamily: this.style.fontFamily,
|
|
||||||
fontSize: this.style.fontSize,
|
|
||||||
textFill: textFill,
|
|
||||||
textAlign: 'right'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.delta1 = new Polygon({
|
this.delta1 = new Polygon({
|
||||||
zlevel: this.zlevel,
|
zlevel: this.zlevel,
|
||||||
z: this.z + 1,
|
z: this.z + 1,
|
||||||
@ -112,8 +100,22 @@ export default class Responder extends Group {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.text = new Text({
|
||||||
|
zlevel: this.zlevel,
|
||||||
|
z: this.z + 1,
|
||||||
|
origin,
|
||||||
|
style: {
|
||||||
|
x: textX,
|
||||||
|
y: textY,
|
||||||
|
text: textName,
|
||||||
|
fontFamily: this.style.fontFamily,
|
||||||
|
fontSize: this.style.fontSize,
|
||||||
|
textFill: textFill,
|
||||||
|
textAlign: 'right'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (model.rotate) {
|
if (model.rotate) {
|
||||||
const origin = [blockX, blockY];
|
|
||||||
const rotation = -Math.PI / 180 * Number(model.rotate);
|
const rotation = -Math.PI / 180 * Number(model.rotate);
|
||||||
[this.block, this.delta1, this.delta2].forEach(el => {
|
[this.block, this.delta1, this.delta2].forEach(el => {
|
||||||
this.transformRotation(el, origin, rotation);
|
this.transformRotation(el, origin, rotation);
|
||||||
@ -121,7 +123,6 @@ export default class Responder extends Group {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (model.textRotate) {
|
if (model.textRotate) {
|
||||||
const origin = [textX, textY];
|
|
||||||
const rotation = -Math.PI / 180 * Number(model.textRotate);
|
const rotation = -Math.PI / 180 * Number(model.textRotate);
|
||||||
this.transformRotation(this.text, origin, rotation);
|
this.transformRotation(this.text, origin, rotation);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,46 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-tabs v-model="activeName" class="card">
|
<el-tabs v-model="activeName" class="card">
|
||||||
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
|
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
|
||||||
<responder-model ref="respModel" :field="field" :responder-type-list="responderTypeList" :centralized-station-list="centralizedStationList" v-on="$listeners" @hover="hover" @deviceChange="deviceChange" @deviceSelect="deviceSelect"/>
|
<responder-model
|
||||||
|
ref="respModel"
|
||||||
|
:field="field"
|
||||||
|
:responder-type-list="responderTypeList"
|
||||||
|
:centralized-station-list="centralizedStationList"
|
||||||
|
:responder-list="responderList"
|
||||||
|
:section-list="filterSectionList"
|
||||||
|
v-on="$listeners"
|
||||||
|
@hover="hover"
|
||||||
|
@deviceChange="deviceChange"
|
||||||
|
@deviceSelect="deviceSelect"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
|
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
|
||||||
<responder-create ref="respCreate" :field="field" :responder-type-list="responderTypeList" :centralized-station-list="centralizedStationList" v-on="$listeners" @hover="hover" @deviceChange="deviceChange" @deviceSelect="deviceSelect"/>
|
<responder-create
|
||||||
|
ref="respCreate"
|
||||||
|
:field="field"
|
||||||
|
:responder-type-list="responderTypeList"
|
||||||
|
:centralized-station-list="centralizedStationList"
|
||||||
|
:responder-list="responderList"
|
||||||
|
:section-list="filterSectionList"
|
||||||
|
v-on="$listeners"
|
||||||
|
@hover="hover"
|
||||||
|
@deviceChange="deviceChange"
|
||||||
|
@deviceSelect="deviceSelect"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane class="view-control" label="批量创建" name="third" :lazy="lazy">
|
<el-tab-pane class="view-control" label="批量创建" name="third" :lazy="lazy">
|
||||||
<responder-batch ref="respBatch" :field="field" :responder-type-list="responderTypeList" :centralized-station-list="centralizedStationList" v-on="$listeners" @hover="hover" @deviceChange="deviceChange" @deviceSelect="deviceSelect"/>
|
<responder-batch
|
||||||
|
ref="respBatch"
|
||||||
|
:field="field"
|
||||||
|
:responder-type-list="responderTypeList"
|
||||||
|
:centralized-station-list="centralizedStationList"
|
||||||
|
:responder-list="responderList"
|
||||||
|
:section-list="filterSectionList"
|
||||||
|
v-on="$listeners"
|
||||||
|
@hover="hover"
|
||||||
|
@deviceChange="deviceChange"
|
||||||
|
@deviceSelect="deviceSelect"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</template>
|
</template>
|
||||||
@ -44,8 +77,13 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('map', [
|
...mapGetters('map', [
|
||||||
'stationList'
|
'stationList',
|
||||||
|
'sectionList',
|
||||||
|
'responderList'
|
||||||
]),
|
]),
|
||||||
|
filterSectionList() {
|
||||||
|
return this.sectionList.filter(el => ['01', '03'].includes(el.type));
|
||||||
|
},
|
||||||
responderTypeList() {
|
responderTypeList() {
|
||||||
return ConstConfig.ConstSelect.responderTypeList;
|
return ConstConfig.ConstSelect.responderTypeList;
|
||||||
}
|
}
|
||||||
@ -76,15 +114,23 @@ export default {
|
|||||||
this.activeName = 'first';
|
this.activeName = 'first';
|
||||||
this.$refs.respModel.setModel(selected);
|
this.$refs.respModel.setModel(selected);
|
||||||
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelSectionCode'.toUpperCase()) {
|
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelSectionCode'.toUpperCase()) {
|
||||||
this.$refs.respCreate.setModel(selected);
|
if (['01', '03'].includes(selected.type)) {
|
||||||
this.activeName = 'second';
|
this.$refs.respCreate.setModel(selected);
|
||||||
this.field = '';
|
this.activeName = 'second';
|
||||||
this.$emit('deviceSelect', '');
|
this.field = '';
|
||||||
|
this.$emit('deviceSelect', '');
|
||||||
|
} else {
|
||||||
|
this.$message.error('请选择物理区段');
|
||||||
|
}
|
||||||
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSectionCode'.toUpperCase()) {
|
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSectionCode'.toUpperCase()) {
|
||||||
this.$refs.respBatch.setModel(selected);
|
if (['01', '03'].includes(selected.type)) {
|
||||||
this.activeName = 'third';
|
this.$refs.respBatch.setModel(selected);
|
||||||
this.field = '';
|
this.activeName = 'third';
|
||||||
this.$emit('deviceSelect', '');
|
this.field = '';
|
||||||
|
this.$emit('deviceSelect', '');
|
||||||
|
} else {
|
||||||
|
this.$message.error('请选择物理区段');
|
||||||
|
}
|
||||||
} else if (!selected) {
|
} else if (!selected) {
|
||||||
this.$emit('deviceSelect', '');
|
this.$emit('deviceSelect', '');
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -71,6 +70,14 @@ export default {
|
|||||||
responderTypeList: {
|
responderTypeList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
sectionList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
responderList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -83,12 +90,6 @@ export default {
|
|||||||
rowData: null
|
rowData: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapGetters('map', [
|
|
||||||
'responderList',
|
|
||||||
'sectionList'
|
|
||||||
])
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
setModel(selected) {
|
setModel(selected) {
|
||||||
if (this.rowData) {
|
if (this.rowData) {
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
|
||||||
import CreateOperate from '../components/createOperate';
|
import CreateOperate from '../components/createOperate';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
|
||||||
@ -31,6 +30,14 @@ export default {
|
|||||||
responderTypeList: {
|
responderTypeList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
sectionList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
responderList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -48,16 +55,12 @@ export default {
|
|||||||
{ required: true, message: '请选择应答器类型', trigger: 'blur' }
|
{ required: true, message: '请选择应答器类型', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
sectionCode: [
|
sectionCode: [
|
||||||
{ required: true, message: '请选择关联区段', trigger: 'blur' }
|
{ required: true, message: '请关联物理区段', trigger: 'blur' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('map', [
|
|
||||||
'responderList',
|
|
||||||
'sectionList'
|
|
||||||
]),
|
|
||||||
isButtonType() {
|
isButtonType() {
|
||||||
return this.field == 'RelSectionCode';
|
return this.field == 'RelSectionCode';
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
|
||||||
import { deepAssign } from '@/utils/index';
|
import { deepAssign } from '@/utils/index';
|
||||||
import OperateProperty from '../components/operateProperty';
|
import OperateProperty from '../components/operateProperty';
|
||||||
|
|
||||||
@ -35,6 +34,14 @@ export default {
|
|||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
sectionList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
responderList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
centralizedStationList: {
|
centralizedStationList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
@ -80,7 +87,7 @@ export default {
|
|||||||
{ required: true, message: '请输入应答器文字旋转角度', trigger: 'blur' }
|
{ required: true, message: '请输入应答器文字旋转角度', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
sectionCode: [
|
sectionCode: [
|
||||||
{ required: true, message: '请选择关联区段', trigger: 'blur' }
|
{ required: true, message: '请关联物理区段', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
stationCode: [
|
stationCode: [
|
||||||
{ required: true, message: '请选择关联集中站', trigger: 'blur' }
|
{ required: true, message: '请选择关联集中站', trigger: 'blur' }
|
||||||
@ -101,10 +108,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('map', [
|
|
||||||
'responderList',
|
|
||||||
'sectionList'
|
|
||||||
]),
|
|
||||||
form() {
|
form() {
|
||||||
const form = {
|
const form = {
|
||||||
labelWidth: '130px',
|
labelWidth: '130px',
|
||||||
@ -130,7 +133,7 @@ export default {
|
|||||||
{ prop: 'textOffset.y', firstLevel: 'textOffset', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
|
{ prop: 'textOffset.y', firstLevel: 'textOffset', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
|
||||||
] },
|
] },
|
||||||
{ prop:'textRotate', label: '文字旋转', type: 'number' },
|
{ prop:'textRotate', label: '文字旋转', type: 'number' },
|
||||||
{ prop: 'sectionCode', label: '关联区段', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.sectionList },
|
{ prop: 'sectionCode', label: '关联区段', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.sectionList},
|
||||||
{ prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
|
{ prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -2,21 +2,20 @@ import { getUID } from '@/jmapNew/utils/Uid';
|
|||||||
|
|
||||||
export function buildModelBySection(section, model, list) {
|
export function buildModelBySection(section, model, list) {
|
||||||
if (section) {
|
if (section) {
|
||||||
const distance = 10;
|
|
||||||
const length = section.points.length;
|
const length = section.points.length;
|
||||||
const dx = (section.points[length - 1].x - section.points[0].x);
|
const dx = (section.points[length - 1].x - section.points[0].x);
|
||||||
const dy = (section.points[length - 1].y - section.points[0].y);
|
const dy = (section.points[length - 1].y - section.points[0].y);
|
||||||
const rotate = Math.atan2(dy, dx) * 180 / Math.PI;
|
const rotate = Math.atan2(dy, dx) * 180 / Math.PI;
|
||||||
const vx = (section.points[length - 1].x + section.points[0].x) / 2 - distance * Math.sin(rotate);
|
const vx = (section.points[length - 1].x + section.points[0].x) / 2;
|
||||||
const vy = (section.points[length - 1].y + section.points[0].y) / 2 - distance * Math.cos(rotate);
|
const vy = (section.points[length - 1].y + section.points[0].y) / 2;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_type: 'Responder',
|
_type: 'Responder',
|
||||||
code: getUID('Responder', list),
|
code: getUID('Responder', list),
|
||||||
type: model.type,
|
type: model.type,
|
||||||
name: model.name,
|
name: model.name,
|
||||||
rotate: 90 + rotate,
|
rotate: rotate + 90,
|
||||||
textRotate: 90 + rotate,
|
textRotate: rotate + 90,
|
||||||
position: {
|
position: {
|
||||||
x: vx,
|
x: vx,
|
||||||
y: vy
|
y: vy
|
||||||
|
Loading…
Reference in New Issue
Block a user