绘图相关调整_(批量创建车站,区段添加激活)
This commit is contained in:
parent
30bab42bbf
commit
f5a5d20ebb
@ -372,8 +372,8 @@ export default {
|
||||
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
||||
] },
|
||||
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList},
|
||||
{ prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList},
|
||||
{ prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList},
|
||||
{ prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList, hover: this.hover, buttonType: 'leftSection', buttonShowType: this.isLeftSectionButtonShow},
|
||||
{ prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList},
|
||||
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
|
||||
|
||||
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1
|
||||
@ -445,7 +445,7 @@ export default {
|
||||
rules() {
|
||||
var validateLeftSection = (rule, value, callback) => {
|
||||
const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
|
||||
if (leftSection && (leftSection.points[1].x !== this.selected.points[0].x || leftSection.points[1].y !== this.selected.points[0].y )) {
|
||||
if (leftSection && (leftSection.points[1].x !== this.editModel.points[0].x || leftSection.points[1].y !== this.editModel.points[0].y )) {
|
||||
callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
|
||||
} else {
|
||||
callback();
|
||||
@ -453,7 +453,7 @@ export default {
|
||||
};
|
||||
var validateRightSection = (rule, value, callback) => {
|
||||
const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
|
||||
if (rightSection && (rightSection.points[0].x !== this.selected.points[1].x || rightSection.points[0].y !== this.selected.points[1].y )) {
|
||||
if (rightSection && (rightSection.points[0].x !== this.editModel.points[1].x || rightSection.points[0].y !== this.editModel.points[1].y )) {
|
||||
callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
|
||||
} else {
|
||||
callback();
|
||||
@ -595,6 +595,9 @@ export default {
|
||||
},
|
||||
isStandTrackShow() {
|
||||
return this.editModel.type !== '04' && this.editModel.type !== '03' && !this.editModel.isSwitchSection;
|
||||
},
|
||||
isLeftSectionButtonShow() {
|
||||
return this.field === 'leftSection';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -642,8 +645,21 @@ export default {
|
||||
deviceSelect(selected) {
|
||||
this.AssociateSectionList = this.sectionList.filter(item => { return item.type === '01' && item.code !== selected.code; });
|
||||
if (!this.fieldS) { // 判断是否激活选择站台
|
||||
this.$refs.dataform.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
if (this.field === 'leftSection') {
|
||||
this.editModel.leftSectionCode = selected.code;
|
||||
this.activeName = 'first';
|
||||
this.field = '';
|
||||
this.$emit('fieldSelect', '');
|
||||
return;
|
||||
} else if (this.field === 'rightSection') {
|
||||
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);
|
||||
|
@ -18,7 +18,7 @@
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-form ref="make" label-width="140px" :model="addModel" size="mini" :rules="mergeRules">
|
||||
<el-form-item :label="$t('map.physicalSegmentName')" prop="sectionCode">
|
||||
<el-select v-model="addModel.sectionCode" filterable>
|
||||
<el-select v-model="addModel.sectionCode" multiple filterable style="width:300px;">
|
||||
<el-option
|
||||
v-for="item in PhysicalSectionList"
|
||||
:key="item.code"
|
||||
@ -140,7 +140,7 @@ export default {
|
||||
controlled:false
|
||||
},
|
||||
addModel: {
|
||||
sectionCode: ''
|
||||
sectionCode: []
|
||||
},
|
||||
skins: [],
|
||||
mergeRules: {
|
||||
@ -254,7 +254,7 @@ export default {
|
||||
}
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectStationCode'.toUpperCase()) {
|
||||
if (selected.type == '01') {
|
||||
this.addModel.sectionCode = selected.code;
|
||||
this.addModel.sectionCode.push(selected.code);
|
||||
this.activeName = 'second';
|
||||
this.field = '';
|
||||
this.$emit('stationSectionCode', '');
|
||||
@ -333,38 +333,41 @@ export default {
|
||||
create() {
|
||||
this.$refs['make'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.addModel.sectionCode) {
|
||||
const uid = getUID('Station');
|
||||
const model = {
|
||||
_type: 'Station',
|
||||
code: uid,
|
||||
zcCode: '',
|
||||
runPlanName: '',
|
||||
visible: true,
|
||||
nameFont: '14px consolas',
|
||||
nameFontColor: '#FFFFFF',
|
||||
kmPost: '1000km~2000km',
|
||||
kmPostShow: true,
|
||||
kmPostFont: '8px consolas',
|
||||
kmPostFontColor: '#FFFFFF',
|
||||
centralized: false,
|
||||
concentrateStationCode: '',
|
||||
controlled:false,
|
||||
chargeStationCodeList:[]
|
||||
};
|
||||
this.sectionList.forEach(elem => {
|
||||
if (elem.code === this.addModel.sectionCode) {
|
||||
const l = 0;
|
||||
const r = elem.points.length - 1;
|
||||
model.name = 'Station_' + elem.name.replace('Station_', '');
|
||||
model.position = {
|
||||
x: elem.points[l].x + (elem.points[r].x - elem.points[l].x) / 2,
|
||||
y: elem.points[l].y
|
||||
};
|
||||
}
|
||||
if (this.addModel.sectionCode.length) {
|
||||
const models = [];
|
||||
this.addModel.sectionCode.forEach((item) => {
|
||||
const uid = getUID('Station');
|
||||
const model = {
|
||||
_type: 'Station',
|
||||
code: uid,
|
||||
zcCode: '',
|
||||
runPlanName: '',
|
||||
visible: true,
|
||||
nameFont: '14px consolas',
|
||||
nameFontColor: '#FFFFFF',
|
||||
kmPost: '1000km~2000km',
|
||||
kmPostShow: true,
|
||||
kmPostFont: '8px consolas',
|
||||
kmPostFontColor: '#FFFFFF',
|
||||
centralized: false,
|
||||
concentrateStationCode: '',
|
||||
controlled:false,
|
||||
chargeStationCodeList:[]
|
||||
};
|
||||
this.sectionList.forEach(elem => {
|
||||
if (elem.code === item) {
|
||||
const l = 0;
|
||||
const r = elem.points.length - 1;
|
||||
model.name = 'Station_' + elem.name.replace('Station_', '');
|
||||
model.position = {
|
||||
x: elem.points[l].x + (elem.points[r].x - elem.points[l].x) / 2,
|
||||
y: elem.points[l].y - 100
|
||||
};
|
||||
}
|
||||
});
|
||||
models.push(model);
|
||||
});
|
||||
|
||||
this.$emit('updateMapModel', model);
|
||||
this.$emit('updateMapModel', models);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user