调整保存绘图数据调整入参

This commit is contained in:
fan 2019-12-02 14:41:39 +08:00
parent 10036210b7
commit aee552cb43

View File

@ -54,8 +54,8 @@
</el-form-item>
</div>
</div>
<el-form-item v-if="createModel.type == '02'" label="左关联区段:" prop="leftSection">
<el-select v-model="createModel.leftSection" filterable>
<el-form-item v-if="createModel.type == '02'" label="左关联区段:" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable>
<el-option
v-for="item in PhysicalSectionList"
:key="item.code"
@ -69,8 +69,8 @@
@click="hover('getSectionStart')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item v-if="createModel.type == '02'" label="右关联区段:" prop="rightSection">
<el-select v-model="createModel.rightSection" filterable>
<el-form-item v-if="createModel.type == '02'" label="右关联区段:" prop="rightSectionCode">
<el-select v-model="createModel.rightSectionCode" filterable>
<el-option
v-for="item in PhysicalSectionList"
:key="item.code"
@ -142,9 +142,9 @@
/>
</el-select>
<el-button
:type="field === 'leftSection' ? 'danger' : 'primary'"
:type="field === 'leftSectionCode' ? 'danger' : 'primary'"
size="small"
@click="hover('leftSection')"
@click="hover('leftSectionCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.sectionRsectioncode')" prop="rsectioncode">
@ -157,9 +157,9 @@
/>
</el-select>
<el-button
:type="field === 'rightSection' ? 'danger' : 'primary'"
:type="field === 'rightSectionCode' ? 'danger' : 'primary'"
size="small"
@click="hover('rightSection')"
@click="hover('rightSectionCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item>
@ -272,8 +272,8 @@ export default {
points: [],
lengthFact: 0,
isCurve: false,
leftSection: '',
rightSection: ''
leftSectionCode: '',
rightSectionCode: ''
},
tableData: [],
oldPoint: [], //
@ -330,8 +330,8 @@ export default {
type: '01',
startPoint: { x: 0, y: 0 },
endPoint: { x: 0, y: 0 },
leftSection: '',
rightSection: ''
leftSectionCode: '',
rightSectionCode: ''
},
createRules: {
'startPoint.x': [
@ -383,8 +383,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: 'leftSection', label: '左关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', clearable: true, options: this.PhysicalSectionList},
{ prop: 'rightSection', label: '右关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', clearable: true, options: this.PhysicalSectionList},
{ prop: 'leftSectionCode', label: '左关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', clearable: true, options: this.PhysicalSectionList},
{ prop: 'rightSectionCode', label: '右关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', clearable: true, options: this.PhysicalSectionList},
{ 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
@ -523,11 +523,11 @@ export default {
trainPosType: [
{ required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
],
leftSection: [
{ required: this.editModel.type === '01', validator: validateLeftSection, trigger: 'change' }
leftSectionCode: [
{ required: this.editModel.type === '01', validator: validateLeftSection, message: '请选择左关联区段', trigger: 'change' }
],
rightSection: [
{ required: this.editModel.type === '01', validator: validateRightSection, trigger: 'change'}
rightSectionCode: [
{ required: this.editModel.type === '01', validator: validateRightSection, message: '请选择右关联区段', trigger: 'change'}
]
};
return rules;
@ -658,6 +658,7 @@ export default {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
deviceSelect(selected) {
console.log(selected, '====');
if (!this.fieldS) { //
this.$refs.dataform.resetFields();
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
@ -678,12 +679,12 @@ export default {
this.activeName = 'three';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'leftSection'.toUpperCase()) {
} 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() === 'rightSection'.toUpperCase()) {
} else if (this.field.toUpperCase() === 'rightSectionCode'.toUpperCase()) {
this.mergeModel.rsectioncode = selected.code;
this.activeName = 'three';
this.field = '';
@ -692,11 +693,11 @@ export default {
this.operationModel.sectionList.push(selected.code);
this.activeName = 'five';
} else if (this.field.toUpperCase() === 'getSectionStart'.toUpperCase()) {
this.createModel.leftSection = selected.code;
this.createModel.leftSectionCode = selected.code;
this.activeName = 'second';
this.field = '';
} else if (this.field.toUpperCase() === 'getSectionEnd'.toUpperCase()) {
this.createModel.rightSection = selected.code;
this.createModel.rightSectionCode = selected.code;
this.activeName = 'second';
this.field = '';
}
@ -867,14 +868,14 @@ export default {
{ x: this.createModel.endPoint.x, y: this.createModel.endPoint.y }
];
} else if (this.createModel.type == '02') {
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSection);
const endModel = this.$store.getters['map/getDeviceByCode'](this.createModel.rightSection);
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);
const endModel = this.$store.getters['map/getDeviceByCode'](this.createModel.rightSectionCode);
const start_x = startModel.points[startModel.points.length - 1].x;
const end_x = endModel.points[0].x;
const start_y = startModel.points[startModel.points.length - 1].y;
const end_y = endModel.points[0].y;
if (this.createModel.leftSection == this.createModel.rightSection) {
if (this.createModel.leftSectionCode == this.createModel.rightSectionCode) {
this.$messageBox('左关联区段不能和右关联区段相同');
return;
}
@ -886,7 +887,10 @@ export default {
{ x: start_x, y: start_y },
{ x: end_x, y: end_y }
];
model.leftSectionCode = this.createModel.leftSectionCode;
model.rightSectionCode = this.createModel.rightSectionCode;
}
console.log(model, '=========');
this.$emit('updateMapModel', model);
},
//
@ -922,6 +926,7 @@ export default {
}
});
this.fieldS = '';
console.log(models, '---------');
this.$emit('updateMapModel', models);
this.oldPoint = JSON.parse(JSON.stringify(model.points));
} else {
@ -1007,14 +1012,14 @@ export default {
}
models.forEach((elem, index) => {
if (index === 0) {
elem.leftSection = selected.leftSection;
elem.rightSection = models[index + 1].code;
elem.leftSectionCode = selected.leftSectionCode;
elem.rightSectionCode = models[index + 1].code;
} else if (index === models.length - 1) {
elem.leftSection = models[index - 1].code;
elem.rightSection = selected.rightSection;
elem.leftSectionCode = models[index - 1].code;
elem.rightSectionCode = selected.rightSectionCode;
} else {
elem.leftSection = models[index - 1].code;
elem.rightSection = models[index + 1].code;
elem.leftSectionCode = models[index - 1].code;
elem.rightSectionCode = models[index + 1].code;
}
});
models.push(deepAssign(selected, { _dispose: true }));
@ -1091,8 +1096,8 @@ export default {
model.logicSectionNameSort = lsection.logicSectionNameSort;
model.namePosition = { x: 0, y: 0 };
model.lengthFact = Number(lsection.lengthFact) + Number(rsection.lengthFact);
model.leftSection = lsection.leftSection;
model.rightSection = rsection.rightSection;
model.leftSectionCode = lsection.leftSectionCode;
model.rightSectionCode = rsection.rightSectionCode;
models.push(model);
this.$emit('updateMapModel', models);
}
@ -1113,8 +1118,8 @@ export default {
model.logicSectionNameSort = rsection.logicSectionNameSort;
model.namePosition = { x: 0, y: 0 };
model.lengthFact = Number(lsection.lengthFact) + Number(rsection.lengthFact);
model.leftSection = rsection.leftSection;
model.rightSection = lsection.rightSection;
model.leftSectionCode = rsection.leftSectionCode;
model.rightSectionCode = lsection.rightSectionCode;
models.push(model);
this.$emit('updateMapModel', models);
}