This commit is contained in:
joylink_cuiweidong 2021-03-04 16:36:42 +08:00
commit 45054de1f9
3 changed files with 89 additions and 60 deletions

View File

@ -565,6 +565,14 @@ export default class ELines extends Group {
}
}
addHover(style) {
this.__zr && this.__zr.addHover(this.section, style);
}
removeHover() {
this.__zr && this.__zr.removeHover(this.section);
}
recover() {
}

View File

@ -485,15 +485,18 @@ export default class Section extends Group {
this.line.setOrignalCross(false);
}
}
drawBatchSelected(selected, type) {
if (this.selectedType === type) {
return;
}
if (selected && type) {
this.line && this.line.setStyle({ stroke: drawSectionStyle[type] });
} else {
this.line && this.line.setStyle({ stroke: this.style.Section.line.spareColor });
}
this.selectedType = type;
}

View File

@ -19,15 +19,11 @@
:value="item.code"
/>
</el-select>
<!-- <el-button
:type=" field === 'startStationCode' ? 'danger' : 'primary'"
@click="hover('startStationCode')"
>{{ $t('map.activate') }}</el-button> -->
</el-form-item>
<el-form-item :label="$t('map.startSectionColon')" prop="startSectionCode">
<el-select v-model="addModel.startSectionCode" clearable :filterable="true" :disabled="editShow" @change="changeStartSection">
<el-option
v-for="item in filterSectionList"
v-for="item in filterStartSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
@ -40,7 +36,6 @@
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.endStationColon')" prop="endStationCode">
<!-- :disabled="!isStartSelected" -->
<el-select v-model="addModel.endStationCode" :filterable="true" disabled @change="changeEndStation">
<el-option
v-for="item in filterStationList"
@ -49,16 +44,11 @@
:value="item.code"
/>
</el-select>
<!-- <el-button
:disabled="!isStartSelected"
:type=" field === 'endStationCode' ? 'danger' : 'primary'"
@click="hover('endStationCode')"
>{{ $t('map.activate') }}</el-button> -->
</el-form-item>
<el-form-item :label="$t('map.endSectionColon')" prop="endSectionCode">
<el-select v-model="addModel.endSectionCode" :filterable="true" clearable :disabled="editShow || !isStartSelected" @change="changeEndSection">
<el-option
v-for="item in filterSectionList"
v-for="item in filterEndSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
@ -83,9 +73,6 @@
/>
</el-select>
</el-form-item>
<!-- <el-form-item v-if="!editShow" label="是否生成回路" prop="withLoop">
<el-checkbox v-model="addModel.withLoop" />
</el-form-item> -->
<el-form-item :label="$t('map.remarksColon')" prop="remarks">
<el-input v-model="addModel.remarks" type="textarea" :rows="4" :placeholder="$t('map.pleaseSelect')" />
</el-form-item>
@ -199,6 +186,8 @@ export default {
stationCode: '',
sectionCode: '',
DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}],
oldStartSectionCode: '',
oldEndSectionCode: '',
addModel: {
name: '',
mapId: '',
@ -230,7 +219,8 @@ export default {
endSectionCode: [
{ required: true, message: '请选择终到区段', trigger: 'change' }
]
}
},
oldsection: []
};
},
computed: {
@ -238,17 +228,22 @@ export default {
'sectionList',
'stationList'
]),
filterSectionList() {
filterStartSectionList() {
if (this.sectionList) {
// || elem.reentryTrack
return this.sectionList.filter(elem => { return elem.standTrack || elem.transferTrack; });
return this.sectionList.filter(elem => { return elem.reentryTrack || elem.transferTrack; });
} else {
return [];
}
},
filterEndSectionList() {
if (this.sectionList) {
return this.sectionList.filter(elem => { return elem.reentryTrack; });
} else {
return [];
}
},
filterStandSection() {
if (this.sectionList) {
// || elem.reentryTrack
return this.sectionList.filter(elem => { return elem.standTrack; });
} else {
return [];
@ -339,7 +334,6 @@ export default {
this.isSave = true;
this.allowSelect = false;
this.isStartSelected = false;
// this.addModel.withLoop = false;
this.editShow = false;
this.field = '';
}
@ -355,21 +349,21 @@ export default {
this.judgeAllowSelected();
this.addEndSectionData(true);
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
// selected.reentryTrack ||
if (selected.standTrack || selected.transferTrack) {
if (selected.code != this.addModel.endSectionCode && (selected.reentryTrack || selected.transferTrack)) {
this.popSection(this.addModel, 'startSectionCode');
if (selected.belongStation) {
this.addModel.startStationCode = selected.belongStation;
}
this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected();
this.addStartSectionData(false);
this.oldStartSectionCode = selected.code;
} else {
// (//)
this.$message.error('请选择正确的起始区段');
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
// selected.reentryTrack ||
if (selected.standTrack || selected.transferTrack) {
if (selected.code != this.addModel.startSectionCode && selected.reentryTrack) {
this.popSection(this.addModel, 'endSectionCode');
if (this.addModel.startSectionCode == selected.code) {
this.$message.error('起始区段和终到区段不能相同');
return false;
@ -380,13 +374,13 @@ export default {
this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected();
this.addEndSectionData(false);
this.oldEndSectionCode = selected.code;
this.addModel.destinationCode = selected.destinationCode || '';
} else {
this.$message.error('请选择正确的终到区段');
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) {
if (selected.standTrack) {
// || selected.reentryTrack || selected.transferTrack
if (selected.standTrack) {
this.sectionCode = selected.code;
} else {
this.$message.error('请选择正确的区段');
@ -402,26 +396,27 @@ export default {
}
},
changeSectionSelected(selectedList, flag) {
if (this.oldsection && this.oldsection.length > 0) {
this.oldsection.forEach((section)=>{
section.instance.drawBatchSelected(section, '');
});
}
this.oldsection = [];
if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) {
if (flag) {
if (this.oldsection && this.oldsection.length > 0) {
this.oldsection.forEach((section)=>{
section.instance.drawBatchSelected(section, '');
});
this.oldsection = [];
}
selectedList.forEach(each=>{
const section = this.$store.getters['map/getDeviceByCode'](each.sectionCode);
const list = section.logicSectionCodeList;
if (list && list.length > 0) {
list.forEach(logicSectionCode=>{
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
this.oldsection && this.oldsection.push(logicSection);
logicSection.instance.drawBatchSelected(section, 'routingSection');
logicSection.instance.drawBatchSelected(logicSection, 'routingSection');
this.oldsection && this.oldsection.push(logicSection);
});
} else {
this.oldsection && this.oldsection.push(section);
section.instance.drawBatchSelected(section, 'routingSection');
this.oldsection && this.oldsection.push(section);
}
});
} else {
@ -440,41 +435,59 @@ export default {
}
}
},
changeStartStation() {
changeStartStation(code, code2) {
this.judgeAllowSelected();
this.addStartSectionData(true);
},
changeStartSection(data) {
const section = this.$store.getters['map/getDeviceByCode'](data);
if (section &&
section.belongStation) {
this.addModel.startStationCode = section.belongStation;
this.judgeAllowSelected();
this.addStartSectionData(false);
} else {
this.addModel.parkSectionCodeList.shift();
changeStartSection(code) {
if (code) {
if (this.addModel.endSectionCode != code) {
const section = this.$store.getters['map/getDeviceByCode'](code);
if (section &&
section.belongStation) {
this.addModel.startStationCode = section.belongStation;
}
this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode');
this.judgeAllowSelected();
this.addStartSectionData(false);
this.oldStartSectionCode = code;
} else {
this.addModel.startSectionCode = this.oldStartSectionCode;
this.$message.error('请选择正确的起始区段');
}
} else {
this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode');
this.addModel.startStationCode = '';
this.addModel.startSectionCode = '';
this.oldStartSectionCode = '';
}
},
changeEndStation() {
this.judgeAllowSelected();
this.addEndSectionData(true);
},
changeEndSection(data) {
if (data) {
const section = this.$store.getters['map/getDeviceByCode'](data);
if (section &&
section.belongStation) {
this.addModel.endStationCode = section.belongStation;
}
this.addModel.destinationCode = section.destinationCode || '';
this.judgeAllowSelected();
this.addEndSectionData(false);
changeEndSection(code) {
if (code) {
if (this.addModel.startSectionCode != code) {
const section = this.$store.getters['map/getDeviceByCode'](code);
if (section &&
section.belongStation) {
this.addModel.endStationCode = section.belongStation;
}
this.addModel.destinationCode = section.destinationCode || '';
this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode');
this.judgeAllowSelected();
this.addEndSectionData(false);
this.oldEndSectionCode = code;
} else {
this.addModel.endSectionCode = this.oldEndSectionCode;
this.$message.error('请选择正确的终到区段');
}
} else {
this.addModel.parkSectionCodeList.pop();
this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode');
this.addModel.endStationCode = '';
this.addModel.endSectionCode = '';
this.oldEndSectionCode = '';
}
},
judgeAllowSelected() {
@ -497,7 +510,6 @@ export default {
},
buildModel(code) {
const model = Object.assign({}, this.addModel);
// if (model.withLoop) { model.withLoop = true; } else { model.withLoop = false; }
model['mapId'] = this.$route.query.mapId;
model['userId'] = this.$store.state.user.id;
if (code) { model['code'] = code; }
@ -522,7 +534,6 @@ export default {
});
},
save() {
// this.addModel;
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
@ -654,6 +665,13 @@ export default {
this.stationCode = '';
}
},
popSection(data, type) {
const list = this.addModel.parkSectionCodeList;
const index = list.findIndex(el => { return el.sectionCode == data[type]});
if (index >= 0) {
this.deleteSection(list, index);
}
},
generateParkSection() {
this.$refs.form.validate((valid) => {
if (valid) {