Merge remote-tracking branch 'remotes/origin/dev' into test

This commit is contained in:
joylink_cuiweidong 2019-12-13 18:31:23 +08:00
commit 61ee6415cf
19 changed files with 505 additions and 298 deletions

View File

@ -329,6 +329,13 @@ export default {
stationPositionX: 'X coordinate:', stationPositionX: 'X coordinate:',
stationPositionY: 'Y coordinate:', stationPositionY: 'Y coordinate:',
stationPosition: 'Station position:', stationPosition: 'Station position:',
isCIStation:'Concentrate station or not',
stationNumber:'Station number:',
subhead:'Subhead:',
subheadDisplay:'Subhead display:',
subheadFont:'Subhead font:',
subheadFontColor:'Subhead font color:',
subheadPosition:'Subhead position:',
stationControlCode: 'Control mode coding:', stationControlCode: 'Control mode coding:',
stationControlName: 'Control mode name:', stationControlName: 'Control mode name:',

View File

@ -321,6 +321,8 @@ export default {
stationPositionX: 'x坐标:', stationPositionX: 'x坐标:',
stationPositionY: 'y坐标:', stationPositionY: 'y坐标:',
stationPosition: '车站坐标:', stationPosition: '车站坐标:',
isCIStation:'是否联锁站',
stationNumber:'车站编号:',
stationControlPosition: '控制模式坐标:', stationControlPosition: '控制模式坐标:',
stationControlCode: '控制模式编码:', stationControlCode: '控制模式编码:',
@ -340,6 +342,11 @@ export default {
stationstandWidth: '宽度 w:', stationstandWidth: '宽度 w:',
stationstandHeight: '高度 h:', stationstandHeight: '高度 h:',
stationstandPosition: '车站坐标:', stationstandPosition: '车站坐标:',
subhead:'副标题:',
subheadDisplay:'是否显示副标题:',
subheadFont:'副标题字体:',
subheadFontColor:'副标题字体颜色:',
subheadPosition:'副标题坐标:',
switchCode: '道岔编码:', switchCode: '道岔编码:',
switchName: '道岔名称:', switchName: '道岔名称:',

View File

@ -304,10 +304,14 @@ class MouseController extends Eventful {
// 右键拖动区域大小 // 右键拖动区域大小
handleMouseMoveRight(point2) { handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint; const point1 = this.rightClickPoint;
const x = Math.min(point1.x, point2.x) + this.$jmap.$options.offsetX; const originX = Math.min(point1.x, point2.x);
const y = Math.min(point1.y, point2.y) + this.$jmap.$options.offsetY; const originY = Math.min(point1.y, point2.y);
const width = Math.abs(point1.x - point2.x); const dx = originX + this.$jmap.$options.offsetX;
const height = Math.abs(point1.y - point2.y); const dy = originY + this.$jmap.$options.offsetY;
const x = dx / this.$jmap.$options.scaleRate;
const y = dy / this.$jmap.$options.scaleRate;
const width = Math.abs(point1.x - point2.x) / this.$jmap.$options.scaleRate + 10;
const height = Math.abs(point1.y - point2.y) / this.$jmap.$options.scaleRate + 10;
this.$jmap.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height }); this.$jmap.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height });
} }
} }

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import ESafeDoor from './ESafeDoor'; import ESafeDoor from './ESafeDoor';
import EHighlight from '../element/EHighlight';
export default class Line2 extends Group { export default class Line2 extends Group {
constructor(model, style) { constructor(model, style) {
@ -12,6 +13,7 @@ export default class Line2 extends Group {
this.style = style; this.style = style;
this.create(); this.create();
this.setState(model); this.setState(model);
this.checkIsDrawMap();
} }
create() { create() {
@ -34,4 +36,17 @@ export default class Line2 extends Group {
setState(model) { setState(model) {
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }

View File

@ -853,7 +853,7 @@ export default class Section extends Group {
drawSelected(selected) { drawSelected(selected) {
this.selected = selected; this.selected = selected;
if (selected) { if (selected) {
this.section && this.section.setStyle({stroke: 'rgba(204,255,255,0.8)'}); this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'});
} else { } else {
this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor });
} }
@ -863,7 +863,7 @@ export default class Section extends Group {
const path = window.location.href; const path = window.location.href;
if (path.includes('/map/draw')) { if (path.includes('/map/draw')) {
this.on('mouseout', () => { !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); }); this.on('mouseout', () => { !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); });
this.on('mouseover', () => { this.section && this.section.setStyle({stroke: 'rgba(204,255,255,0.8)'}); }); this.on('mouseover', () => { this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); });
} }
} }
} }

View File

@ -21,7 +21,7 @@ export default class EMouse extends Group {
z: this.device.z + 1, z: this.device.z + 1,
shape: stationTextRect, shape: stationTextRect,
style: { style: {
fill: 'rgba(204,255,255,0.5)' fill: 'rgba(0,255,255,0.6)'
} }
}); });

View File

@ -40,7 +40,7 @@ export default class Station extends Group {
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.nameFont || 18, fontSize: model.nameFont || 18,
fontFamily: style.fontFamily, fontFamily: style.fontFamily,
text: model.name, text: model.number ? model.number + model.name : model.name,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top', textVerticalAlign: 'top',
textFill: model.nameFontColor textFill: model.nameFontColor
@ -74,6 +74,23 @@ export default class Station extends Group {
}); });
this.add(this.mileageText); this.add(this.mileageText);
} }
if (model.subheadDisplay) {
this.subheadText = new ETextName({
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
x: model.subheadPosition.x,
y: model.subheadPosition.y,
fontWeight: model.fontWeight,
fontSize: model.subheadFont || 18,
fontFamily: style.fontFamily,
text: model.subhead,
textAlign: 'middle',
textVerticalAlign: 'top',
textFill: model.subheadFontColor
});
this.add(this.subheadText);
}
} }
} }
createTurnBack() { // 创建按图折返 createTurnBack() { // 创建按图折返

View File

@ -14,17 +14,13 @@ export default class checkBox extends Group {
create() { create() {
const model = this.model; const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.box = new Rect({ this.box = new Rect({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
draggable: false, draggable: false,
shape: { shape: {
x: 0, x: model.point.x,
y: 0, y: model.point.y,
width: this.model.width, width: this.model.width,
height: this.model.height height: this.model.height
}, },
@ -32,15 +28,6 @@ export default class checkBox extends Group {
fill: 'rgb(135,206,250,0.2)' fill: 'rgb(135,206,250,0.2)'
} }
}); });
this.grouper.add(this.box); this.add(this.box);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
setSize(width, height) {
this.model.width = width;
this.model.height = height;
} }
} }

View File

@ -1,6 +1,5 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class EHighlight extends Group { class EHighlight extends Group {
constructor(device) { constructor(device) {
@ -11,13 +10,17 @@ class EHighlight extends Group {
} }
create() { create() {
if (this.device) { if (this.device) {
let fill = 'rgba(0,255,255,0.6)';
if (this.device._type === 'Psd') {
fill = 'rgba(255,0,0,0.6)';
}
const rect = this.device.getBoundingRect(); const rect = this.device.getBoundingRect();
this.lineBorder = new Rect({ this.lineBorder = new Rect({
zlevel: this.device.zlevel, zlevel: this.device.zlevel,
z: this.device.z + 1, z: this.device.z + 1,
shape: rect, shape: rect,
style: { style: {
fill: 'rgba(204,255,255,0.5)' fill: fill
} }
}); });
this.add(this.lineBorder); this.add(this.lineBorder);

View File

@ -27,8 +27,8 @@ export default {
], ],
SignalLeftOrRightList: [ SignalLeftOrRightList: [
{ label: '左侧', value: '0' }, { label: '左侧', value: 'L' },
{ label: '右侧', value: '1' } { label: '右侧', value: 'R' }
], ],
roleList: [ roleList: [

View File

@ -109,7 +109,8 @@ export default {
}, },
data() { data() {
return { return {
enabledTab: 'route' enabledTab: 'route',
oldDevice: null
}; };
}, },
mounted() { mounted() {
@ -172,6 +173,7 @@ export default {
this.enabledTab = data.name; this.enabledTab = data.name;
}, },
setSelected(selected) { setSelected(selected) {
this.handleHightLight(selected);
switch (this.enabledTab) { switch (this.enabledTab) {
case 'protect': case 'protect':
this.$refs.protectOperate.setSelected(selected); this.$refs.protectOperate.setSelected(selected);
@ -201,6 +203,31 @@ export default {
}, },
drawMap() { drawMap() {
this.$emit('selectView', 'draft'); this.$emit('selectView', 'draft');
},
handleHightLight(selected) {
if (this.oldDevice && (this.oldDevice._type === 'Section' || this.oldDevice._type === 'Psd') && this.oldDevice.instance && typeof this.oldDevice.instance.drawSelected === 'function') {
if (this.isSwitchSection) {
if (this.oldDevice._type == 'Section' && this.oldDevice.type == '04') {
this.oldDevice.relevanceSectionList.forEach(item => {
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
sectionModel.instance.drawSelected(false);
});
this.isSwitchSection = false;
}
}
this.oldDevice.instance.drawSelected(false);
}
if (selected && (selected._type === 'Section' || selected._type === 'Psd') && selected.instance && typeof selected.instance.drawSelected === 'function' ) {
if (selected._type == 'Section' && selected.type == '04') {
this.isSwitchSection = true;
selected.relevanceSectionList.forEach(item => {
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
sectionModel.instance.drawSelected(true);
});
}
selected.instance.drawSelected(true);
}
this.oldDevice = selected;
} }
} }
}; };

View File

@ -5,9 +5,9 @@
<el-form-item :label="$t('map.pathName') + ':'" prop="name"> <el-form-item :label="$t('map.pathName') + ':'" prop="name">
<el-input v-model="addModel.name" /> <el-input v-model="addModel.name" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('map.equipmentStation') + ':'" prop="stationCode"> <el-form-item :label="$t('map.concentrateStationCode')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable @change="deviceChange"> <el-select v-model="addModel.stationCode" filterable @change="deviceChange">
<el-option v-for="item in stationList" :key="item.code" :label="item.name" :value="item.code" /> <el-option v-for="item in interBlockStationList" :key="item.code" :label="item.name" :value="item.code" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('map.routeArc') + ':'" prop="arc"> <el-form-item :label="$t('map.routeArc') + ':'" prop="arc">
@ -177,6 +177,10 @@
:value="item.code" :value="item.code"
/> />
</el-select> </el-select>
<el-button
:type=" field === 'routePsdList' ? 'danger' : 'primary'"
@click="hover('routePsdList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item :label="$t('map.espList') + ':'" prop="espList"> <el-form-item :label="$t('map.espList') + ':'" prop="espList">
<el-select v-model="addModel.espList" multiple clearable :filterable="true"> <el-select v-model="addModel.espList" multiple clearable :filterable="true">
@ -258,6 +262,7 @@ export default {
routeCode: '', routeCode: '',
routeType: '', routeType: '',
loading: false, loading: false,
interBlockStationList:[],
SwitchLocateTypeList: [ SwitchLocateTypeList: [
{ name: '定位', code: true }, { name: '定位', code: true },
{ name: '反位', code: false } { name: '反位', code: false }
@ -361,6 +366,9 @@ export default {
// this.$Dictionary.normal().then(list => { // this.$Dictionary.normal().then(list => {
// this.SwitchLocateTypeList = list; // this.SwitchLocateTypeList = list;
// }); // });
this.interBlockStationList = this.stationList.filter(station=>{
return station.isCIStation;
});
}, },
methods: { methods: {
swictchName(code) { swictchName(code) {
@ -468,6 +476,8 @@ export default {
this.routeCode = selected.code; this.routeCode = selected.code;
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeFlankProtectionList'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeFlankProtectionList'.toUpperCase()) {
this.flankCode = selected.code; this.flankCode = selected.code;
} else if (selected._type.toUpperCase() === 'Psd'.toUpperCase() && this.field.toUpperCase() === 'routePsdList'.toUpperCase()) {
this.addModel.psdList.push(selected.code);
} }
} }
}, },

View File

@ -17,21 +17,6 @@
<div style="height: calc(100% - 46px);"> <div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" label-width="140px" :model="addModel" :rules="createRules" size="mini"> <el-form ref="make" label-width="140px" :model="addModel" :rules="createRules" size="mini">
<el-form-item label="关联站台轨:" prop="standTrackCode">
<el-select v-model="addModel.standTrackCode" filterable>
<el-option
v-for="item in PhysicalSectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'sectionSelectCode' ? 'danger' : 'primary'"
size="small"
@click="hover('sectionSelectCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="关联站台:" prop="standCode"> <el-form-item label="关联站台:" prop="standCode">
<el-select v-model="addModel.standCode" filterable> <el-select v-model="addModel.standCode" filterable>
<el-option <el-option
@ -97,18 +82,15 @@ export default {
code: '', code: '',
name: '', name: '',
standCode: '', // code standCode: '', // code
standTrackCode: '', //
width: 60, width: 60,
height: 3, height: 3,
position: { x: 0, y: 0 }, position: { x: 0, y: 0 }
doorLocationType: '01' //
}, },
field: '', field: '',
addModel: { addModel: {
standCode: '', standCode: '',
width: 60, width: 60,
height: 3, height: 3,
standTrackCode: '',
doorLocationType: '01' // doorLocationType: '01' //
} }
}; };
@ -136,8 +118,6 @@ export default {
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { 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' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }, ] },
{ prop: 'doorLocationType', label: '显示方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.DoorLocationTypeList },
{ prop: 'standTrackCode', label: '关联区段:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList },
{ prop: 'width', label: '屏蔽门宽度', type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'width', label: '屏蔽门宽度', type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'height', label: '屏蔽门高度', type: 'number', min: 0, max: 2000, placeholder: 'px' } { prop: 'height', label: '屏蔽门高度', type: 'number', min: 0, max: 2000, placeholder: 'px' }
] ]
@ -162,9 +142,6 @@ export default {
standCode: [ standCode: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' } { required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
], ],
standTrackCode: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
],
'position.x': [ 'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'change' } { required: true, message: this.$t('rules.trainPositionX'), trigger: 'change' }
], ],
@ -185,9 +162,6 @@ export default {
standCode: [ standCode: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' } { required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
], ],
standTrackCode: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
],
doorLocationType: [ doorLocationType: [
{ required: true, message: this.$t('rules.stationCode'), trigger: 'change' } { required: true, message: this.$t('rules.stationCode'), trigger: 'change' }
] ]
@ -236,12 +210,6 @@ export default {
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.$emit('standStationCode', '');
} }
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectCode'.toUpperCase()) {
this.addModel.standTrackCode = selected.code;
this.activeName = 'second';
this.field = '';
this.$emit('standStationCode', '');
}
}, },
create() { create() {
this.$refs.make.validate((valid) => { this.$refs.make.validate((valid) => {
@ -253,8 +221,7 @@ export default {
name: `Psd${this.psdList.length + 1}`, name: `Psd${this.psdList.length + 1}`,
width: this.addModel.width, width: this.addModel.width,
height: this.addModel.height, height: this.addModel.height,
standCode: this.addModel.standCode, // code standCode: this.addModel.standCode // code
standTrackCode: this.addModel.standTrackCode //
}; };
this.stationStandList.forEach(elem => { this.stationStandList.forEach(elem => {
if (elem.code === this.addModel.standCode) { if (elem.code === this.addModel.standCode) {

View File

@ -133,11 +133,11 @@
<el-form-item :label="$t('map.breakUpNumber')" prop="splitNumber"> <el-form-item :label="$t('map.breakUpNumber')" prop="splitNumber">
<el-input-number v-model="addModel.splitNumber" :min="1" :max="addModel.splitOffsetMax" /> <el-input-number v-model="addModel.splitNumber" :min="1" :max="addModel.splitOffsetMax" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('map.trainDirection')" prop="trainPosType"> <!-- <el-form-item :label="$t('map.trainDirection')" prop="trainPosType">
<el-radio-group v-model="addModel.trainPosType"> <el-radio-group v-model="addModel.trainPosType">
<el-radio v-for="item in TrainPositionTypeList" :key="item.code" :label="item.code" border size="mini">{{ item.name }}</el-radio> <el-radio v-for="item in TrainPositionTypeList" :key="item.code" :label="item.code" border size="mini">{{ item.name }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button-group> <el-button-group>
<el-button type="primary" size="big" @click="split">{{ $t('map.split') }}</el-button> <el-button type="primary" size="big" @click="split">{{ $t('map.split') }}</el-button>
@ -253,10 +253,9 @@ export default {
stationCode: '', stationCode: '',
logicSectionNameSort: '', logicSectionNameSort: '',
sepTypeLeft: '', sepTypeLeft: '',
offsetLeft: 0,
sepTypeRight: '', sepTypeRight: '',
offsetRight: 0, offsetRight: 0,
trainPosType: '', // // trainPosType: '', //
parentCode: '', parentCode: '',
points: [], points: [],
lengthFact: 0, lengthFact: 0,
@ -264,13 +263,15 @@ export default {
leftSectionCode: '', leftSectionCode: '',
rightSectionCode: '', rightSectionCode: '',
trainWindowCode: '', trainWindowCode: '',
relevanceSectionList: [] relevanceSectionList: [],
lSectionEndOffset: {x:0, y:0},
lSectionStartOffset: {x:0, y:0}
}, },
oldPoint: [], // oldPoint: [], //
addModel: { addModel: {
code: '', code: '',
splitNumber: 2, splitNumber: 2,
trainPosType: '01', // // trainPosType: '01', //
splitOffsetMax: 15 splitOffsetMax: 15
}, },
operationModel: { // operationModel: { //
@ -282,7 +283,6 @@ export default {
rsectioncode: '' rsectioncode: ''
}, },
logicSectionNums: [1], logicSectionNums: [1],
fieldS: '',
field: '', field: '',
addRules: { addRules: {
code: [ code: [
@ -290,10 +290,10 @@ export default {
], ],
splitNumber: [ splitNumber: [
{ required: true, message: this.$t('rules.pleaseEnterSplit'), trigger: 'blur' } { required: true, message: this.$t('rules.pleaseEnterSplit'), trigger: 'blur' }
],
trainPosType: [
{ required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
] ]
// trainPosType: [
// { required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
// ]
}, },
mergeRules: { mergeRules: {
lsectioncode: [ lsectioncode: [
@ -387,7 +387,14 @@ export default {
{ prop: 'sepTypeLeft', label: this.$t('map.sepTypeLeft'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType }, { prop: 'sepTypeLeft', label: this.$t('map.sepTypeLeft'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
{ prop: 'sepTypeRight', label: this.$t('map.sepTypeRight'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType }, { prop: 'sepTypeRight', label: this.$t('map.sepTypeRight'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, pointDisabled: this.isStationCodeDisabled, addPoint: this.addPoint, delPoint: this.delPoint, lastDisabled: true }, { prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, pointDisabled: this.isStationCodeDisabled, addPoint: this.addPoint, delPoint: this.delPoint, lastDisabled: true },
{ prop: 'lSectionStartOffset', label: '逻辑区段起点偏移:', type: 'coordinate', width: '150px', isHidden: !this.isLSectionOffsetShow, children: [
{ prop: 'lSectionStartOffset.x', firstLevel: 'lSectionStartOffset', secondLevel: 'x', label: 'x', type: 'number', labelWidth: '25px'},
{ prop: 'lSectionStartOffset.y', firstLevel: 'lSectionStartOffset', secondLevel: 'y', label: 'y', type: 'number', labelWidth: '25px'}
]},
{ prop: 'lSectionEndOffset', label: '逻辑区段终点偏移:', type: 'coordinate', width: '150px', isHidden: !this.isLSectionOffsetShow, children:[
{prop: 'lSectionEndOffset.x', firstLevel: 'lSectionEndOffset', secondLevel: 'x', label: 'x', type: 'number', labelWidth: '25px'},
{prop: 'lSectionEndOffset.y', firstLevel: 'lSectionEndOffset', secondLevel: 'y', label: 'y', type: 'number', labelWidth: '25px'}
]},
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1 { prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
{ prop: 'standTrackName', label: this.$t('map.standTrackName'), type: 'input', isHidden: !this.isstandTrackNameShow }, { prop: 'standTrackName', label: this.$t('map.standTrackName'), type: 'input', isHidden: !this.isstandTrackNameShow },
@ -395,8 +402,6 @@ export default {
{ prop: 'standTrackNamePosition.x', firstLevel: 'standTrackNamePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px'}, { prop: 'standTrackNamePosition.x', firstLevel: 'standTrackNamePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px'},
{ prop: 'standTrackNamePosition.y', firstLevel: 'standTrackNamePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px'} { prop: 'standTrackNamePosition.y', firstLevel: 'standTrackNamePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px'}
] }, ] },
{ prop: 'relStandCode', label: this.$t('map.relStandCode'), type: 'selectHover', optionLabel: 'code&&name', optionValue: 'code', options: this.stationStandList, hover: this.hover, buttonType: 'relStandCode', buttonShowType: this.isButtonType, isHidden: !this.isrelStandCode },
{ prop: 'isReentryTrack', label: this.$t('map.isReentryTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1 { prop: 'isReentryTrack', label: this.$t('map.isReentryTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
{ prop: 'reentryTrackName', label: this.$t('map.reentryTrackName'), type: 'input', isHidden: !this.isreentryTrackName }, { prop: 'reentryTrackName', label: this.$t('map.reentryTrackName'), type: 'input', isHidden: !this.isreentryTrackName },
@ -444,8 +449,8 @@ export default {
{ prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset }, { prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow }, { prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow },
{ prop: 'kmRangeLeft', label: this.$t('map.leftKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') }, { prop: 'kmRangeLeft', label: this.$t('map.leftKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') },
{ prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') }, { prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') }
{ prop: 'trainPosType', label: this.$t('map.trainDirection'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.TrainPositionTypeList } // { prop: 'trainPosType', label: this.$t('map.trainDirection'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.TrainPositionTypeList }
] ]
} }
} }
@ -453,22 +458,22 @@ export default {
return form; return form;
}, },
rules() { rules() {
var validateLeftSection = (rule, value, callback) => { // var validateLeftSection = (rule, value, callback) => {
const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null; // const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null;
if (leftSection && !(this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.editModel.points[0].x) || this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.oldPoint[0]) )) { // if (leftSection && !(this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.editModel.points[0].x) || this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.oldPoint[0]) )) {
callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); // callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
} else { // } else {
callback(); // callback();
} // }
}; // };
var validateRightSection = (rule, value, callback) => { // var validateRightSection = (rule, value, callback) => {
const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null; // const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null;
if (rightSection && !(this.checkPointsCoincide(rightSection.points[0], this.editModel.points[this.editModel.points.length - 1]) || this.checkPointsCoincide(rightSection.points[0], this.oldPoint[this.oldPoint.length - 1]))) { // if (rightSection && !(this.checkPointsCoincide(rightSection.points[0], this.editModel.points[this.editModel.points.length - 1]) || this.checkPointsCoincide(rightSection.points[0], this.oldPoint[this.oldPoint.length - 1]))) {
callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); // callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
} else { // } else {
callback(); // callback();
} // }
}; // };
const rules = { const rules = {
code: [ code: [
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
@ -479,9 +484,6 @@ export default {
type: [ type: [
{ required: true, message: this.$t('rules.pleaseEnterSectionType'), trigger: 'blur' } { required: true, message: this.$t('rules.pleaseEnterSectionType'), trigger: 'blur' }
], ],
relStandCode: [
{ required: true, message: this.$t('rules.pleaseSelectAssociatedPlatform'), trigger: 'change' }
],
leftStopPointOffset: [ leftStopPointOffset: [
{ required: true, message: this.$t('rules.pleaseEnterLeftStopPointOffset'), trigger: 'blur' } { required: true, message: this.$t('rules.pleaseEnterLeftStopPointOffset'), trigger: 'blur' }
], ],
@ -514,13 +516,13 @@ export default {
], ],
relSwitchCode: [ relSwitchCode: [
{ required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' } { required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' }
],
leftSectionCode: [
{ validator: validateLeftSection, trigger: 'change' }
],
rightSectionCode: [
{ validator: validateRightSection, trigger: 'change'}
] ]
// leftSectionCode: [
// { validator: validateLeftSection, trigger: 'change' }
// ],
// rightSectionCode: [
// { validator: validateRightSection, trigger: 'change'}
// ]
}; };
return rules; return rules;
}, },
@ -579,13 +581,6 @@ export default {
isStopPointOffset() { isStopPointOffset() {
return this.editModel.type !== '04' && (this.editModel.isReentryTrack || this.editModel.isStandTrack || this.editModel.isTransferTrack); return this.editModel.type !== '04' && (this.editModel.isReentryTrack || this.editModel.isStandTrack || this.editModel.isTransferTrack);
}, },
isButtonType() {
return this.fieldS == 'relStandCode';
},
isrelStandCode() {
return this.editModel.type !== '04' && this.editModel.isStandTrack && this.editModel.type == '01';
},
isRelSwitchCode() { isRelSwitchCode() {
return this.editModel.type !== '04' && this.editModel.isSwitchSection; return this.editModel.type !== '04' && this.editModel.isSwitchSection;
}, },
@ -621,6 +616,9 @@ export default {
}, },
hasAssociatedSection() { hasAssociatedSection() {
return this.editModel.type === '01' || this.editModel.type === '03'; return this.editModel.type === '01' || this.editModel.type === '03';
},
isLSectionOffsetShow() {
return this.editModel.type === '02';
} }
}, },
watch: { watch: {
@ -647,90 +645,76 @@ export default {
}, },
deviceSelect(selected) { deviceSelect(selected) {
const obj = this; const obj = this;
if (!this.fieldS) { // //
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (this.field === 'leftSection') { if (this.field === 'leftSection') {
if (selected.type === '01' || selected.type === '03') { if (selected.type === '01' || selected.type === '03') {
this.editModel.leftSectionCode = selected.code; this.editModel.leftSectionCode = selected.code;
this.activeName = 'first'; this.activeName = 'first';
this.field = '';
this.$emit('fieldSelect', '');
}
return;
} else if (this.field === 'rightSection') {
if ((selected.type === '01' || selected.type === '03')) {
this.editModel.rightSectionCode = selected.code;
this.activeName = 'first';
this.field = '';
this.$emit('fieldSelect', '');
}
return;
}
this.$refs.dataform.resetFields();
this.editModel.points = [];
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
this.editModel.isSegmentation = selected.isSegmentation || false;
this.editModel.points = JSON.parse(JSON.stringify(selected.points));
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
this.oldLeftSectionCode = selected.leftSectionCode;
this.oldRightSectionCode = selected.rightSectionCode;
this.editModel.lengthFact = selected.lengthFact || 0;
this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
this.addModel.splitOffset = this.addModel.splitOffsetMax / 2;
obj.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
this.addModel.code = selected.code;
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'leftSectionCode'.toUpperCase()) {
this.mergeModel.lsectioncode = selected.code;
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'rightSectionCode'.toUpperCase()) {
this.mergeModel.rsectioncode = selected.code;
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'getSectionStart'.toUpperCase()) {
this.createModel.leftSectionCode = selected.code;
this.activeName = 'second';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'getSectionEnd'.toUpperCase()) {
this.createModel.rightSectionCode = selected.code;
this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('fieldSelect', ''); this.$emit('fieldSelect', '');
} }
return;
} else if (this.field === 'rightSection') {
if ((selected.type === '01' || selected.type === '03')) {
this.editModel.rightSectionCode = selected.code;
this.activeName = 'first';
this.field = '';
this.$emit('fieldSelect', '');
}
return;
}
this.$refs.dataform.resetFields();
this.editModel.points = [];
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
this.editModel.isSegmentation = selected.isSegmentation || false;
this.editModel.points = JSON.parse(JSON.stringify(selected.points));
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
this.oldLeftSectionCode = selected.leftSectionCode;
this.oldRightSectionCode = selected.rightSectionCode;
this.editModel.lengthFact = selected.lengthFact || 0;
this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
this.addModel.splitOffset = this.addModel.splitOffsetMax / 2;
this.setLSectionOffsetByPoint(this.editModel);
obj.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
this.addModel.code = selected.code;
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'leftSectionCode'.toUpperCase()) {
this.mergeModel.lsectioncode = selected.code;
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'rightSectionCode'.toUpperCase()) {
this.mergeModel.rsectioncode = selected.code;
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'getSectionStart'.toUpperCase()) {
this.createModel.leftSectionCode = selected.code;
this.activeName = 'second';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'getSectionEnd'.toUpperCase()) {
this.createModel.rightSectionCode = selected.code;
this.activeName = 'second';
this.field = '';
this.$emit('fieldSelect', '');
} }
} else {
this.editModel.relStandCode = selected.code;
this.selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
this.fieldS = '';
this.$emit('fieldSelect', '');
} }
}, },
handleClick(tab, event) { handleClick(tab, event) {
if (tab.name != 'first') {
this.fieldS = '';
}
this.questionList = []; this.questionList = [];
}, },
hover(field) { hover(field) {
if (field == 'relStandCode') { this.field = field == this.field ? '' : field;
this.fieldS = field == this.fieldS ? '' : field; this.$emit('fieldSelect', this.field);
this.$emit('fieldSelect', this.fieldS);
} else {
this.field = field == this.field ? '' : field;
this.$emit('fieldSelect', this.field);
}
}, },
addPoint(index) { addPoint(index) {
const data = { x: 0, y: 0 }; const data = { x: 0, y: 0 };
@ -781,9 +765,8 @@ export default {
logicSectionShow: true, logicSectionShow: true,
logicSectionNameSort: true, logicSectionNameSort: true,
sepTypeLeft: '01', // sepTypeLeft: '01', //
offsetLeft: 0,
sepTypeRight: '01', sepTypeRight: '01',
trainPosType: '', // // trainPosType: '', //
lengthFact: 0, lengthFact: 0,
parentCode: '', parentCode: '',
relStandCode: '', relStandCode: '',
@ -911,12 +894,13 @@ export default {
return; return;
} }
let models = []; let models = [];
this.setPointByLSectionOffset(this.editModel);
const model = deepAssign(this.editModel, {_type: 'Section'}); // model const model = deepAssign(this.editModel, {_type: 'Section'}); // model
model.leftStopPointOffset = Number(model.leftStopPointOffset); model.leftStopPointOffset = Number(model.leftStopPointOffset);
model.rightStopPointOffset = Number(model.rightStopPointOffset); model.rightStopPointOffset = Number(model.rightStopPointOffset);
this.fieldS = '';
const changeSectionList = this.handleOtherSectionChange(model); const changeSectionList = this.handleOtherSectionChange(model);
models = [model, ...changeSectionList]; models = [model, ...changeSectionList];
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
this.oldPoint = JSON.parse(JSON.stringify(model.points)); this.oldPoint = JSON.parse(JSON.stringify(model.points));
this.oldLeftSectionCode = model.leftSectionCode; this.oldLeftSectionCode = model.leftSectionCode;
@ -932,36 +916,54 @@ export default {
if (section.parentCode === model.code) { if (section.parentCode === model.code) {
const copySection = deepAssign({}, section); const copySection = deepAssign({}, section);
copySection.logicSectionShow = model.logicSectionShow; copySection.logicSectionShow = model.logicSectionShow;
copySection.trainPosType = model.trainPosType; // copySection.trainPosType = model.trainPosType;
models.push(copySection); models.push(copySection);
} } else if ( model.code !== section.code && section.type === '02' && model.type === '02' && section.parentCode === model.parentCode) {
if (model.code !== section.code && (section.type === '01' || section.typel === '03')) {
const copySection = deepAssign({}, section); const copySection = deepAssign({}, section);
if (this.checkPointsCoincide(this.oldPoint[0], section.points[section.points.length - 1])) { if (this.checkPointsCoincide(this.oldPoint[0], section.points[section.points.length - 1])) {
copySection.points[copySection.points.length - 1].x = model.points[0].x; copySection.points[copySection.points.length - 1].x = model.points[0].x;
copySection.points[copySection.points.length - 1].y = model.points[0].y; copySection.points[copySection.points.length - 1].y = model.points[0].y;
copySection.offsetRight = model.offsetLeft;
} }
if (this.checkPointsCoincide(this.oldPoint[this.oldPoint.length - 1], section.points[0])) { if (this.checkPointsCoincide(this.oldPoint[this.oldPoint.length - 1], section.points[0])) {
copySection.points[0].x = model.points[model.points.length - 1].x; copySection.points[0].x = model.points[model.points.length - 1].x;
copySection.points[0].y = model.points[model.points.length - 1].y; copySection.points[0].y = model.points[model.points.length - 1].y;
copySection.offsetLeft = model.offsetRight; }
models.push(copySection);
} else if (model.code !== section.code && (section.type === '01' || section.type === '03')) {
const copySection = deepAssign({}, section);
let updataFlag = false;
if (this.checkPointsCoincide(this.oldPoint[0], section.points[section.points.length - 1])) {
copySection.points[copySection.points.length - 1].x = model.points[0].x;
copySection.points[copySection.points.length - 1].y = model.points[0].y;
updataFlag = true;
}
if (this.checkPointsCoincide(this.oldPoint[this.oldPoint.length - 1], section.points[0])) {
copySection.points[0].x = model.points[model.points.length - 1].x;
copySection.points[0].y = model.points[model.points.length - 1].y;
updataFlag = true;
} }
if (model.leftSectionCode !== this.oldLeftSectionCode) { if (model.leftSectionCode !== this.oldLeftSectionCode) {
if (copySection.code === model.leftSectionCode) { if (copySection.code === model.leftSectionCode) {
copySection.rightSectionCode = model.code; copySection.rightSectionCode = model.code;
updataFlag = true;
} else if (copySection.code === this.oldLeftSectionCode) { } else if (copySection.code === this.oldLeftSectionCode) {
copySection.rightSectionCode = ''; copySection.rightSectionCode = '';
updataFlag = true;
} }
} }
if (model.rightSectionCode !== this.oldRightSectionCode) { if (model.rightSectionCode !== this.oldRightSectionCode) {
if (copySection.code === model.rightSectionCode) { if (copySection.code === model.rightSectionCode) {
copySection.leftSectionCode = model.code; copySection.leftSectionCode = model.code;
updataFlag = true;
} else if (copySection.code === this.oldRightSectionCode) { } else if (copySection.code === this.oldRightSectionCode) {
copySection.leftSectionCode = ''; copySection.leftSectionCode = '';
updataFlag = true;
} }
} }
models.push(copySection); if (updataFlag) {
models.push(copySection);
}
} }
}); });
return models; return models;
@ -1048,10 +1050,9 @@ export default {
logicSectionNum: selected.logicSectionNum, logicSectionNum: selected.logicSectionNum,
logicSectionShow: selected.logicSectionShow, logicSectionShow: selected.logicSectionShow,
sepTypeLeft: index == 0 ? selected.sepTypeLeft : '01', // ( 01) sepTypeLeft: index == 0 ? selected.sepTypeLeft : '01', // ( 01)
offsetLeft: selected.offsetLeft,
sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // ( 01) sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // ( 01)
offsetRight: selected.offsetRight, offsetRight: selected.offsetRight,
trainPosType: this.addModel.trainPosType, // trainPosType: this.addModel.trainPosType,
isCurve: selected.isCurve, isCurve: selected.isCurve,
lengthFact: 0, lengthFact: 0,
points: [ points: [
@ -1154,11 +1155,9 @@ export default {
model.axleShow = lsection.axleShow; model.axleShow = lsection.axleShow;
model.logicSectionNum = lsection.logicSectionNum; model.logicSectionNum = lsection.logicSectionNum;
model.logicSectionShow = lsection.logicSectionShow; model.logicSectionShow = lsection.logicSectionShow;
model.trainPosType = lsection.trainPosType; // model.trainPosType = lsection.trainPosType;
model.sepTypeLeft = lsection.sepTypeLeft; model.sepTypeLeft = lsection.sepTypeLeft;
model.offsetLeft = lsection.offsetLeft;
model.sepTypeRight = rsection.sepTypeRight; model.sepTypeRight = rsection.sepTypeRight;
model.offsetRight = lsection.offsetRight + rsection.offsetRight;
model.isCurve = lsection.isCurve; model.isCurve = lsection.isCurve;
model.points = [ model.points = [
{ x: lsection.points[0].x, y: lsection.points[0].y }, { x: lsection.points[0].x, y: lsection.points[0].y },
@ -1186,7 +1185,7 @@ export default {
model.axleShow = rsection.axleShow; model.axleShow = rsection.axleShow;
model.logicSectionNum = rsection.logicSectionNum; model.logicSectionNum = rsection.logicSectionNum;
model.logicSectionShow = rsection.logicSectionShow; model.logicSectionShow = rsection.logicSectionShow;
model.trainPosType = rsection.trainPosType; // model.trainPosType = rsection.trainPosType;
model.sepTypeLeft = rsection.sepTypeLeft; model.sepTypeLeft = rsection.sepTypeLeft;
model.offsetLeft = rsection.offsetLeft; model.offsetLeft = rsection.offsetLeft;
model.sepTypeRight = lsection.sepTypeRight; model.sepTypeRight = lsection.sepTypeRight;
@ -1231,6 +1230,32 @@ export default {
return point1.x === point2.x && point1.y === point2.y; return point1.x === point2.x && point1.y === point2.y;
} }
return false; return false;
},
setLSectionOffsetByPoint(model) {
if (model.type === '02') {
const parentSection = this.$store.getters['map/getDeviceByCode'](model.parentCode);
model.lSectionStartOffset = {
x: model.points[0].x - parentSection.points[0].x,
y: model.points[0].y - parentSection.points[0].y
};
model.lSectionEndOffset = {
x: model.points[1].x - parentSection.points[0].x,
y: model.points[1].y - parentSection.points[0].y
};
}
},
setPointByLSectionOffset(model) {
if (model.type === '02') {
const parentSection = this.$store.getters['map/getDeviceByCode'](model.parentCode);
model.points[0] = {
x: parentSection.points[0].x + model.lSectionStartOffset.x,
y: parentSection.points[0].y + model.lSectionStartOffset.y
};
model.points[1] = {
x: parentSection.points[0].x + model.lSectionEndOffset.x,
y: parentSection.points[0].y + model.lSectionEndOffset.y
};
}
} }
} }
}; };

View File

@ -62,7 +62,7 @@
<el-form-item :label="$t('map.equipmentStation')" prop="stationCode"> <el-form-item :label="$t('map.equipmentStation')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable> <el-select v-model="addModel.stationCode" filterable>
<el-option <el-option
v-for="item in stationList" v-for="item in centralizedStationList"
:key="item.code" :key="item.code"
:label="item.name + item.code" :label="item.name + item.code"
:value="item.code" :value="item.code"
@ -99,7 +99,7 @@ export default {
sectionCode: '', sectionCode: '',
name: '', name: '',
directionShowType: '01', directionShowType: '01',
leftOrRight: '0', leftOrRight: 'L', //
positionType: '01', positionType: '01',
stationCode: '' stationCode: ''
}, },
@ -109,6 +109,7 @@ export default {
{ code: '02', name: '向右' } { code: '02', name: '向右' }
], ],
SignalLeftOrRightList: [], SignalLeftOrRightList: [],
CentralizedStationList:[],
mergeRules: { mergeRules: {
sectionCode: [ sectionCode: [
{ required: true, message: this.$t('rules.selectPhysicalExtentName'), trigger: 'change' } { required: true, message: this.$t('rules.selectPhysicalExtentName'), trigger: 'change' }
@ -143,6 +144,13 @@ export default {
}); });
} }
return list; return list;
},
centralizedStationList() {
let list = [];
list = this.stationList.filter(station=>{
return station.centralized;
});
return list;
} }
}, },
mounted() { mounted() {
@ -171,6 +179,7 @@ export default {
sectionCode: this.addModel.sectionCode, sectionCode: this.addModel.sectionCode,
positionType: this.addModel.positionType, positionType: this.addModel.positionType,
directionShowType: this.addModel.directionShowType, directionShowType: this.addModel.directionShowType,
// leftOrRight: this.addModel.leftOrRight,
nameShow: true, nameShow: true,
namePosition: { x: 0, y: 0 }, namePosition: { x: 0, y: 0 },
buttonShow: true, buttonShow: true,
@ -184,7 +193,7 @@ export default {
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
if (elem.code === this.addModel.sectionCode) { if (elem.code === this.addModel.sectionCode) {
if (this.addModel.leftOrRight === '0') { if (this.addModel.leftOrRight === 'L') {
const beg = elem.points[0]; const beg = elem.points[0];
const end = elem.points[0 + 1]; const end = elem.points[0 + 1];
const traingle = new JTriangle(beg, end); const traingle = new JTriangle(beg, end);

View File

@ -16,6 +16,19 @@
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second"> <el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" @updateMapModel="updateMapModel" /> <create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" @updateMapModel="updateMapModel" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" label="批量操作" name="three">
<div class="flex_box">
<el-button type="primary" style="margin-right: 10px;" @click="editAll">构建信号机偏移量</el-button>
<el-button type="" style="margin: 0;" @click="questionList = []">{{ $t('map.clearHint') }}</el-button>
</div>
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-card v-if="questionList.length" class="box-card">
<div v-for="(item, index) in questionList" :key="index" class="text item">{{ item }}</div>
</el-card>
</el-scrollbar>
</div>
</el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
@ -56,6 +69,7 @@ export default {
{ code: '00', name: this.$t('map.normal') }, { code: '00', name: this.$t('map.normal') },
{ code: '01', name: this.$t('map.signalFilamentAlarm') } { code: '01', name: this.$t('map.signalFilamentAlarm') }
], ],
questionList: [],
field:'', field:'',
editModel: { editModel: {
code: '', code: '',
@ -65,6 +79,7 @@ export default {
lampPostType: '', lampPostType: '',
lampPositionType: '', lampPositionType: '',
potLampType: '01', potLampType: '01',
leftOrRight: 'L',
directionShowType: '', directionShowType: '',
positionType: '', positionType: '',
namePosition: { x: 0, y: 0 }, namePosition: { x: 0, y: 0 },
@ -105,6 +120,13 @@ export default {
} }
return list; return list;
}, },
centralizedStationList() {
let list = [];
list = this.stationList.filter(station=>{
return station.centralized;
});
return list;
},
form() { form() {
return { return {
labelWidth: '150px', labelWidth: '150px',
@ -146,11 +168,11 @@ export default {
map: { map: {
name: this.$t('map.mapData'), name: this.$t('map.mapData'),
item: [ item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }, { prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList },
{ prop: 'uniqueName', label: this.$t('map.signalUniqueName'), type: 'input' }, { prop: 'uniqueName', label: this.$t('map.signalUniqueName'), type: 'input' },
{ prop: 'useType', label: this.$t('map.signalUseType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalUseTypeList }, { prop: 'useType', label: this.$t('map.signalUseType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalUseTypeList },
{ prop: 'potLampType', label: this.$t('map.potLampType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPotLampTypeList }, { prop: 'potLampType', label: this.$t('map.potLampType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPotLampTypeList },
{ prop: 'sectionCode', label: this.$t('map.belongsSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.signalSectionList, disabled: true }, { prop: 'sectionCode', label: this.$t('map.belongsSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.signalSectionList },
{ prop: 'offset', label: this.$t('map.signalOffset'), type: 'number', min: 0, placeholder: this.$t('tip.meter') } { prop: 'offset', label: this.$t('map.signalOffset'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }
] ]
@ -227,7 +249,6 @@ export default {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
}, },
deviceSelect(selected) { deviceSelect(selected) {
// this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) {
this.$refs.dataform.resetFields(); this.$refs.dataform.resetFields();
this.activeName = 'first'; this.activeName = 'first';
@ -278,6 +299,46 @@ export default {
_that.$message.info(this.$t('tip.cancelledDelete')); _that.$message.info(this.$t('tip.cancelledDelete'));
}); });
} }
},
//
editAll() {
const models = [];
this.questionList = [];
this.signalList.forEach(item => {
const signalModel = deepAssign({}, item);
const section = this.findSection(signalModel);
if (section.code && item.sectionCode != section.code) {
item.sectionCode = section.code;
}
if (!section.code) {
this.questionList.push(`${item.name} 信号机位置可能不正确,请手动调试归属区段及偏移量.`);
}
signalModel.offset = 2;
if (signalModel.directionShowType == '02') {
if (section.lengthFact) {
signalModel.offset = Math.abs(Number(section.lengthFact) - 2);
}
}
models.push(signalModel);
});
this.$emit('updateMapModel', models);
},
//
findSection(signal) {
// 01 02
let model = {};
this.sectionList.forEach(section => {
if (signal.directionShowType == '01' && section.type != '02') {
if (section.points[0].x == signal.position.x && Math.abs(section.points[0].y - signal.position.y) <= 20) {
model = section;
}
} else if (signal.directionShowType == '02' && section.type != '02') {
if (section.points[section.points.length - 1].x == signal.position.x && Math.abs(section.points[section.points.length - 1].y - signal.position.y) <= 20) {
model = section;
}
}
});
return model;
} }
} }
}; };
@ -288,6 +349,24 @@ export default {
height: 100%; height: 100%;
} }
.flex_box{
display: flex;
justify-content: center;
}
.box-card {
width: calc(100% - 80px);
margin: 20px auto 0;
padding: 0 20px;
.text {
font-size: 14px;
}
.item {
padding: 6px 0;
}
}
.card { .card {
height: 100%; height: 100%;
} }

View File

@ -95,7 +95,9 @@ export default {
chargeStation:[], chargeStation:[],
editModel: { editModel: {
centralized: false, centralized: false,
concentrateStationCode: '', concentrateStationCode: '', //
isCIStation:false, //
number:'', //
code: '', code: '',
zcCode: '', zcCode: '',
visible: true, visible: true,
@ -103,6 +105,11 @@ export default {
name: '', name: '',
nameFont: '', nameFont: '',
nameFontColor: '#FFFFFF', nameFontColor: '#FFFFFF',
subheadDisplay:false,
subhead:'', //
subheadFont:'',
subheadFontColor:'#FFFFFF',
subheadPosition:{ x: 0, y: 0 },
kmPostShow: '', kmPostShow: '',
kmRange: 0, kmRange: 0,
kmPost: '', kmPost: '',
@ -151,6 +158,7 @@ export default {
item: [ item: [
{ prop: 'code', label: this.$t('map.stationCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.deviceChange }, { prop: 'code', label: this.$t('map.stationCode'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.stationName'), type: 'input' }, { prop: 'name', label: this.$t('map.stationName'), type: 'input' },
{ prop: 'number', label: this.$t('map.stationNumber'), type: 'input' },
{ prop: 'position', label: this.$t('map.stationPosition'), type: 'coordinate', width: '120px', children: [ { prop: 'position', label: this.$t('map.stationPosition'), type: 'coordinate', width: '120px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { 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' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
@ -158,6 +166,14 @@ export default {
{ prop: 'visible', label: this.$t('map.stationstandShowName'), type: 'checkbox' }, { prop: 'visible', label: this.$t('map.stationstandShowName'), type: 'checkbox' },
{ prop: 'nameFont', label: this.$t('map.stationNameFont'), type: 'font', placeholder: this.$t('tip.stationFont') }, { prop: 'nameFont', label: this.$t('map.stationNameFont'), type: 'font', placeholder: this.$t('tip.stationFont') },
{ prop: 'nameFontColor', label: this.$t('map.stationNameFontColor'), type: 'color' }, { prop: 'nameFontColor', label: this.$t('map.stationNameFontColor'), type: 'color' },
{ prop: 'subheadDisplay', label: this.$t('map.subheadDisplay'), type: 'checkbox' },
{ prop: 'subhead', label: this.$t('map.subhead'), type: 'input', isHidden:!this.editModel.subheadDisplay },
{ prop: 'subheadFont', label: this.$t('map.subheadFont'), type: 'font', isHidden:!this.editModel.subheadDisplay },
{ prop: 'subheadFontColor', label: this.$t('map.subheadFontColor'), type: 'color', isHidden:!this.editModel.subheadDisplay },
{ prop: 'subheadPosition', label: this.$t('map.subheadPosition'), type: 'coordinate', width: '120px', isHidden:!this.editModel.subheadDisplay, children: [
{ prop: 'subheadPosition.x', firstLevel: 'subheadPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'subheadPosition.y', firstLevel: 'subheadPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'kilometerPosition', label: '公里标偏移坐标:', type: 'coordinate', width: '120px', children: [ { prop: 'kilometerPosition', label: '公里标偏移坐标:', type: 'coordinate', width: '120px', children: [
{ prop: 'kilometerPosition.x', firstLevel: 'kilometerPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { prop: 'kilometerPosition.x', firstLevel: 'kilometerPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'kilometerPosition.y', firstLevel: 'kilometerPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } { prop: 'kilometerPosition.y', firstLevel: 'kilometerPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
@ -181,7 +197,7 @@ export default {
map: { map: {
name: this.$t('map.mapData'), name: this.$t('map.mapData'),
item: [ item: [
{ prop: 'concentrateStationCode', label: this.$t('map.concentrateStationCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.stationList, disabled:this.editModel.controlled }, { prop: 'isCIStation', label: this.$t('map.isCIStation'), type: 'checkbox'},
{ prop: 'centralized', label: this.$t('map.centralized'), type: 'checkbox', disabled:this.editModel.controlled, change:true, deviceChange:this.changeCentralized }, { prop: 'centralized', label: this.$t('map.centralized'), type: 'checkbox', disabled:this.editModel.controlled, change:true, deviceChange:this.changeCentralized },
{ prop: 'zcCode', label: this.$t('map.zcCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList, isHidden: !this.isZcCode }, { prop: 'zcCode', label: this.$t('map.zcCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList, isHidden: !this.isZcCode },
{ prop: 'chargeStationCodeList', label: this.$t('map.chargeStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.chargeStation, isHidden: !this.isZcCode, deviceChange:this.changeChargeStation}, { prop: 'chargeStationCodeList', label: this.$t('map.chargeStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.chargeStation, isHidden: !this.isZcCode, deviceChange:this.changeChargeStation},
@ -339,6 +355,8 @@ export default {
_type: 'Station', _type: 'Station',
code: uid, code: uid,
name: item.stationName, name: item.stationName,
number:'',
subheadDisplay:false,
zcCode: '', zcCode: '',
runPlanName: '', runPlanName: '',
visible: true, visible: true,

View File

@ -17,23 +17,6 @@
<div style="height: calc(100% - 46px);"> <div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<config-list ref="make" :form="addForm" :form-model="addModel" :rules="createRules" /> <config-list ref="make" :form="addForm" :form-model="addModel" :rules="createRules" />
<!-- <el-form ref="make" label-width="140px" :model="addModel" :rules="createRules" size="mini">
<el-form-item :label="$t('map.stationstandName')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable @change="changeStation">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'standSelectStationCode' ? 'danger' : 'primary'"
size="small"
@click="hover('standSelectStationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
</el-form> -->
</el-scrollbar> </el-scrollbar>
</div> </div>
<div class="button_box"> <div class="button_box">
@ -73,6 +56,10 @@ export default {
{ code: '01', name: '朝下' }, { code: '01', name: '朝下' },
{ code: '02', name: '朝上' } { code: '02', name: '朝上' }
*/ */
isRightList: [
{ code: 'right', name: '向右'},
{ code: 'left', name: '向左'}
],
editModel: { editModel: {
code: '', code: '',
name: '', name: '',
@ -83,7 +70,10 @@ export default {
height: 0, height: 0,
stationCode: '', // stationCode: '', //
position: { x: 0, y: 0 }, position: { x: 0, y: 0 },
visible: true // visible: true, //
isRight: 'right',
standTrackCode: '',
small: false
// direction: '' // // direction: '' //
}, },
field: '', field: '',
@ -93,11 +83,12 @@ export default {
pointY: 0, // y pointY: 0, // y
width: 60, width: 60,
height: 20, height: 20,
doorType: '01', //
standTrackCode: '', // standTrackCode: '', //
standTrackUpCode: '', // standTrackUpCode: '', //
standTrackDownCode: '', // standTrackDownCode: '', //
stationstandDirection: '02' // stationstandDirection: '02', //
isRight: 'right',
small: false
} }
}; };
}, },
@ -127,7 +118,10 @@ export default {
] }, ] },
{ prop: 'visible', label: this.$t('map.stationVisible'), type: 'checkbox' }, { prop: 'visible', label: this.$t('map.stationVisible'), type: 'checkbox' },
{ prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' } { prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'editSectionSelectCode', buttonShowType: this.isButtonTypeES },
{ prop: 'isRight', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'small', label: '是否小型站台:', type: 'checkbox' }
] ]
}, },
map: { map: {
@ -163,6 +157,9 @@ export default {
], ],
'position.y': [ 'position.y': [
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'change' } { required: true, message: this.$t('rules.trainPositionY'), trigger: 'change' }
],
standTrackCode: [
{ required: true, message: '请选择关联站台轨', trigger: 'change' }
] ]
}; };
// //
@ -183,20 +180,16 @@ export default {
{ prop: 'stationCode', label: this.$t('map.stationstandName'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, hover: this.hover, buttonType: 'standSelectStationCode', buttonShowType: this.isButtonType }, { prop: 'stationCode', label: this.$t('map.stationstandName'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, hover: this.hover, buttonType: 'standSelectStationCode', buttonShowType: this.isButtonType },
{ prop: 'pointY', label: 'Y 坐标:', type: 'number' }, { prop: 'pointY', label: 'Y 坐标:', type: 'number' },
{ prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' } { prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS },
{ prop: 'isRight', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'small', label: '是否小型站台:', type: 'checkbox' }
] ]
}, },
door: { door: {
name: '屏蔽门数据', name: '屏蔽门数据',
item: [ item: [
{ prop: 'doorType', label: '屏蔽门类型:', type: 'radio', radioList: [ { prop: 'stationstandDirection', label: '屏蔽门朝向:', type: 'radio', radioList: this.DoorLocationTypeList }
{value: '01', label: '单侧屏蔽门' },
{value: '02', label: '双侧屏蔽门' }
] },
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS, isHidden: !this.doorTypeOne },
{ prop: 'stationstandDirection', label: '屏蔽门朝向:', type: 'radio', radioList: this.DoorLocationTypeList, isHidden: !this.doorTypeOne },
{ prop: 'standTrackUpCode', label: '上行站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectUpCode', buttonShowType: this.isButtonTypeU, isHidden: !this.doorTypeTwo },
{ prop: 'standTrackDownCode', label: '下行站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectDownCode', buttonShowType: this.isButtonTypeD, isHidden: !this.doorTypeTwo }
] ]
} }
} }
@ -218,12 +211,6 @@ export default {
], ],
standTrackCode: [ standTrackCode: [
{ required: true, message: '请选择关联站台轨', trigger: 'change' } { required: true, message: '请选择关联站台轨', trigger: 'change' }
],
standTrackUpCode: [
{ required: true, message: '请选择站台轨', trigger: 'change' }
],
standTrackDownCode: [
{ required: true, message: '请选择站台轨', trigger: 'change' }
] ]
}; };
}, },
@ -233,17 +220,8 @@ export default {
isButtonTypeS() { isButtonTypeS() {
return this.field == 'sectionSelectCode'; return this.field == 'sectionSelectCode';
}, },
isButtonTypeU() { isButtonTypeES() {
return this.field == 'sectionSelectUpCode'; return this.field === 'editSectionSelectCode';
},
isButtonTypeD() {
return this.field == 'sectionSelectDownCode';
},
doorTypeOne() {
return this.addModel.doorType == '01';
},
doorTypeTwo() {
return this.addModel.doorType == '02';
}, },
PhysicalSectionList() { PhysicalSectionList() {
let list = []; let list = [];
@ -295,6 +273,7 @@ export default {
this.$refs.dataform.resetFields(); this.$refs.dataform.resetFields();
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
this.editModel.isRight = selected.isRight ? 'right' : 'left';
} }
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'standSelectStationCode'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'standSelectStationCode'.toUpperCase()) {
this.addModel.stationCode = selected.code; this.addModel.stationCode = selected.code;
@ -306,14 +285,9 @@ export default {
this.activeName = 'second'; this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.$emit('standStationCode', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectUpCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'editSectionSelectCode'.toUpperCase()) {
this.addModel.standTrackUpCode = selected.code; this.editModel.standTrackCode = selected.code;
this.activeName = 'second'; this.activeName = 'first';
this.field = '';
this.$emit('standStationCode', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectDownCode'.toUpperCase()) {
this.addModel.standTrackDownCode = selected.code;
this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.$emit('standStationCode', '');
} }
@ -335,7 +309,10 @@ export default {
position: { position: {
x: 0, x: 0,
y: this.addModel.pointY y: this.addModel.pointY
} },
standTrackCode: this.addModel.standTrackCode,
isRight: this.addModel.isRight === 'right',
small: this.addModel.small
}; };
this.stationList.forEach(elem => { this.stationList.forEach(elem => {
if (elem.code == this.addModel.stationCode) { if (elem.code == this.addModel.stationCode) {
@ -344,7 +321,7 @@ export default {
} }
}); });
models.push(model); models.push(model);
if (this.addModel.doorType == '01') { if (!this.addModel.small) {
const uid = getUID('Psd', this.psdList); const uid = getUID('Psd', this.psdList);
const param = { const param = {
_type: 'Psd', _type: 'Psd',
@ -353,7 +330,6 @@ export default {
width: this.addModel.width, width: this.addModel.width,
height: 3, height: 3,
standCode: Standuid, // code standCode: Standuid, // code
standTrackCode: this.addModel.standTrackCode, //
position: { position: {
x: models[0].position.x, x: models[0].position.x,
y: this.addModel.pointY - (this.addModel.height / 2) - space y: this.addModel.pointY - (this.addModel.height / 2) - space
@ -363,35 +339,6 @@ export default {
param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space; param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space;
} }
models.push(param); models.push(param);
} else if (this.addModel.doorType == '02') {
const arr = [];
for (let index = 0; index < 2; index++) {
const uid = getUID('Psd', [...this.psdList, ...arr]);
const param = {
_type: 'Psd',
code: uid,
name: `Psd${[...this.psdList, ...arr].length + 1}`,
width: this.addModel.width,
height: 3,
standCode: Standuid, // code
standTrackCode: '', //
position: {
x: models[0].position.x,
y: this.addModel.pointY
}
};
if (index == 0) {
param.standTrackCode = this.addModel.standTrackUpCode;
param.position.y = this.addModel.pointY - (this.addModel.height / 2) - space;
} else {
param.standTrackCode = this.addModel.standTrackDownCode;
param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space;
}
arr.push(param);
}
arr.forEach(item => {
models.push(item);
});
} }
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
@ -401,7 +348,9 @@ export default {
edit() { edit() {
this.$refs.dataform.validate((valid) => { this.$refs.dataform.validate((valid) => {
if (valid) { if (valid) {
this.editModel.isRight = this.addModel.isRight === 'right';
const data = Object.assign({_type: 'StationStand'}, this.editModel); const data = Object.assign({_type: 'StationStand'}, this.editModel);
console.log(data);
this.$emit('updateMapModel', data); this.$emit('updateMapModel', data);
} }
}); });

View File

@ -13,7 +13,7 @@
</el-button-group> </el-button-group>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three"> <el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="second">
<div style="height: 100%"> <div style="height: 100%">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<div style="text-align:center;"> <div style="text-align:center;">
@ -23,6 +23,43 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="addForm" label-width="130px" :model="addModel" size="mini" :rules="mergeRules">
<el-form-item label="车次窗编码:" prop="modelList">
<el-select v-model="addModel.modelList" filterable multiple>
<el-option
v-for="item in trainWindowList"
:key="item.code"
:label="item.code"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'trainWindowCode' ? 'danger' : 'primary'"
size="small"
@click="hover('trainWindowCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="Y轴坐标:" prop="pointY">
<el-input-number v-model="addModel.pointY" style="width: 178px;" @change="handleChange" />
</el-form-item>
<el-form-item label="车次窗宽度:" prop="width">
<el-input-number v-model="addModel.width" style="width: 178px;" @change="handleChange" />
</el-form-item>
<el-form-item label="车次窗高度:" prop="height">
<el-input-number v-model="addModel.height" style="width: 178px;" @change="handleChange" />
</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="editTrainWindow">{{ $t('map.updateObj') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
@ -77,6 +114,27 @@ export default {
height: [ height: [
{ required: true, message: this.$t('rules.trainWindowHeight'), trigger: 'blur' } { required: true, message: this.$t('rules.trainWindowHeight'), trigger: 'blur' }
] ]
},
field: '',
addModel: {
pointY: '',
width: '',
height: '',
modelList: []
},
mergeRules: {
pointY: [
{ required: true, message: '请输入', trigger: 'blur' }
],
modelList: [
{ required: true, message: '请选择', trigger: 'change' }
],
width: [
{ required: true, message: this.$t('rules.trainWindowWidth'), trigger: 'blur' }
],
height: [
{ required: true, message: this.$t('rules.trainWindowHeight'), trigger: 'blur' }
]
} }
}; };
}, },
@ -140,11 +198,20 @@ export default {
this.$emit('setCenter', code); this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
}, },
hover(field) {
this.field = field == this.field ? '' : field;
},
deviceSelect(selected) { deviceSelect(selected) {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
if (selected && selected._type.toUpperCase() === 'TrainWindow'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'TrainWindow'.toUpperCase()) {
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
if (this.field == 'trainWindowCode') {
if (this.addModel.modelList.indexOf(selected.code) == -1) {
this.addModel.modelList.push(selected.code);
}
this.activeName = 'three';
}
} }
}, },
createModel(opts) { createModel(opts) {
@ -314,6 +381,22 @@ export default {
_that.$message.info(this.$t('tip.cancelledDelete')); _that.$message.info(this.$t('tip.cancelledDelete'));
}); });
} }
},
editTrainWindow() {
this.$refs['addForm'].validate((valid) => {
if (valid) {
const models = [];
this.addModel.modelList.forEach(item => {
const model = this.$store.getters['map/getDeviceByCode'](item);
model.point.y = this.addModel.pointY;
model.height = this.addModel.height;
model.width = this.addModel.width;
models.push(model);
});
this.$emit('updateMapModel', models);
this.addModel.modelList = [];
}
});
} }
} }
}; };