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

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