运行图 代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-05 13:06:06 +08:00
parent e9997a2f7f
commit c785523699

View File

@ -186,8 +186,8 @@ export default {
stationCode: '', stationCode: '',
sectionCode: '', sectionCode: '',
DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}], DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}],
oldStartSectionCode: '', oldStartSectionCode: '',
oldEndSectionCode: '', oldEndSectionCode: '',
addModel: { addModel: {
name: '', name: '',
mapId: '', mapId: '',
@ -220,7 +220,7 @@ export default {
{ required: true, message: '请选择终到区段', trigger: 'change' } { required: true, message: '请选择终到区段', trigger: 'change' }
] ]
}, },
oldsection: [] oldsection: []
}; };
}, },
computed: { computed: {
@ -235,13 +235,13 @@ export default {
return []; return [];
} }
}, },
filterEndSectionList() { filterEndSectionList() {
if (this.sectionList) { if (this.sectionList) {
return this.sectionList.filter(elem => { return elem.reentryTrack; }); return this.sectionList.filter(elem => { return elem.reentryTrack || elem.transferTrack; });
} else { } else {
return []; return [];
} }
}, },
filterStandSection() { filterStandSection() {
if (this.sectionList) { if (this.sectionList) {
return this.sectionList.filter(elem => { return elem.standTrack; }); return this.sectionList.filter(elem => { return elem.standTrack; });
@ -349,21 +349,21 @@ export default {
this.judgeAllowSelected(); this.judgeAllowSelected();
this.addEndSectionData(true); this.addEndSectionData(true);
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
if (selected.code != this.addModel.endSectionCode && (selected.reentryTrack || selected.transferTrack)) { if (selected.code != this.addModel.endSectionCode && (selected.reentryTrack || selected.transferTrack)) {
this.popSection(this.addModel, 'startSectionCode'); this.popSection(this.addModel, 'startSectionCode');
if (selected.belongStation) { if (selected.belongStation) {
this.addModel.startStationCode = selected.belongStation; this.addModel.startStationCode = selected.belongStation;
} }
this.addModel.startSectionCode = selected.code; this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected(); this.judgeAllowSelected();
this.addStartSectionData(false); this.addStartSectionData(false);
this.oldStartSectionCode = selected.code; this.oldStartSectionCode = selected.code;
} else { } else {
this.$message.error('请选择正确的起始区段'); this.$message.error('请选择正确的起始区段');
} }
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
if (selected.code != this.addModel.startSectionCode && selected.reentryTrack) { if (selected.code != this.addModel.startSectionCode && (selected.reentryTrack || selected.transferTrack)) {
this.popSection(this.addModel, 'endSectionCode'); this.popSection(this.addModel, 'endSectionCode');
if (this.addModel.startSectionCode == selected.code) { if (this.addModel.startSectionCode == selected.code) {
this.$message.error('起始区段和终到区段不能相同'); this.$message.error('起始区段和终到区段不能相同');
return false; return false;
@ -374,13 +374,13 @@ export default {
this.addModel.endSectionCode = selected.code; this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected(); this.judgeAllowSelected();
this.addEndSectionData(false); this.addEndSectionData(false);
this.oldEndSectionCode = selected.code; this.oldEndSectionCode = selected.code;
this.addModel.destinationCode = selected.destinationCode || ''; this.addModel.destinationCode = selected.destinationCode || '';
} else { } else {
this.$message.error('请选择正确的终到区段'); this.$message.error('请选择正确的终到区段');
} }
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) {
if (selected.standTrack) { if (selected.standTrack) {
this.sectionCode = selected.code; this.sectionCode = selected.code;
} else { } else {
this.$message.error('请选择正确的区段'); this.$message.error('请选择正确的区段');
@ -396,13 +396,13 @@ export default {
} }
}, },
changeSectionSelected(selectedList, flag) { changeSectionSelected(selectedList, flag) {
if (this.oldsection && this.oldsection.length > 0) { if (this.oldsection && this.oldsection.length > 0) {
this.oldsection.forEach((section)=>{ this.oldsection.forEach((section)=>{
section.instance.drawBatchSelected(section, ''); section.instance.drawBatchSelected(section, '');
}); });
} }
this.oldsection = []; this.oldsection = [];
if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) { if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) {
if (flag) { if (flag) {
selectedList.forEach(each=>{ selectedList.forEach(each=>{
@ -412,11 +412,11 @@ export default {
list.forEach(logicSectionCode=>{ list.forEach(logicSectionCode=>{
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode); const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection.instance.drawBatchSelected(logicSection, 'routingSection'); logicSection.instance.drawBatchSelected(logicSection, 'routingSection');
this.oldsection && this.oldsection.push(logicSection); this.oldsection && this.oldsection.push(logicSection);
}); });
} else { } else {
section.instance.drawBatchSelected(section, 'routingSection'); section.instance.drawBatchSelected(section, 'routingSection');
this.oldsection && this.oldsection.push(section); this.oldsection && this.oldsection.push(section);
} }
}); });
} else { } else {
@ -440,26 +440,26 @@ export default {
this.addStartSectionData(true); this.addStartSectionData(true);
}, },
changeStartSection(code) { changeStartSection(code) {
if (code) { if (code) {
if (this.addModel.endSectionCode != code) { if (this.addModel.endSectionCode != code) {
const section = this.$store.getters['map/getDeviceByCode'](code); const section = this.$store.getters['map/getDeviceByCode'](code);
if (section && if (section &&
section.belongStation) { section.belongStation) {
this.addModel.startStationCode = section.belongStation; this.addModel.startStationCode = section.belongStation;
} }
this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode'); this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode');
this.judgeAllowSelected(); this.judgeAllowSelected();
this.addStartSectionData(false); this.addStartSectionData(false);
this.oldStartSectionCode = code; this.oldStartSectionCode = code;
} else { } else {
this.addModel.startSectionCode = this.oldStartSectionCode; this.addModel.startSectionCode = this.oldStartSectionCode;
this.$message.error('请选择正确的起始区段'); this.$message.error('请选择正确的起始区段');
} }
} else { } else {
this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode'); this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode');
this.addModel.startStationCode = ''; this.addModel.startStationCode = '';
this.addModel.startSectionCode = ''; this.addModel.startSectionCode = '';
this.oldStartSectionCode = ''; this.oldStartSectionCode = '';
} }
}, },
changeEndStation() { changeEndStation() {
@ -468,26 +468,26 @@ export default {
}, },
changeEndSection(code) { changeEndSection(code) {
if (code) { if (code) {
if (this.addModel.startSectionCode != code) { if (this.addModel.startSectionCode != code) {
const section = this.$store.getters['map/getDeviceByCode'](code); const section = this.$store.getters['map/getDeviceByCode'](code);
if (section && if (section &&
section.belongStation) { section.belongStation) {
this.addModel.endStationCode = section.belongStation; this.addModel.endStationCode = section.belongStation;
} }
this.addModel.destinationCode = section.destinationCode || ''; this.addModel.destinationCode = section.destinationCode || '';
this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode'); this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode');
this.judgeAllowSelected(); this.judgeAllowSelected();
this.addEndSectionData(false); this.addEndSectionData(false);
this.oldEndSectionCode = code; this.oldEndSectionCode = code;
} else { } else {
this.addModel.endSectionCode = this.oldEndSectionCode; this.addModel.endSectionCode = this.oldEndSectionCode;
this.$message.error('请选择正确的终到区段'); this.$message.error('请选择正确的终到区段');
} }
} else { } else {
this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode'); this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode');
this.addModel.endStationCode = ''; this.addModel.endStationCode = '';
this.addModel.endSectionCode = ''; this.addModel.endSectionCode = '';
this.oldEndSectionCode = ''; this.oldEndSectionCode = '';
} }
}, },
judgeAllowSelected() { judgeAllowSelected() {
@ -665,13 +665,13 @@ export default {
this.stationCode = ''; this.stationCode = '';
} }
}, },
popSection(data, type) { popSection(data, type) {
const list = this.addModel.parkSectionCodeList; const list = this.addModel.parkSectionCodeList;
const index = list.findIndex(el => { return el.sectionCode == data[type]}); const index = list.findIndex(el => { return el.sectionCode == data[type]; });
if (index >= 0) { if (index >= 0) {
this.deleteSection(list, index); this.deleteSection(list, index);
} }
}, },
generateParkSection() { generateParkSection() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {