问题:运行图编辑问题

1:交路设置 ,转换轨<——>折返轨    或者   折返轨 <——>折返轨
2:高亮问题处理
This commit is contained in:
ival 2021-03-04 13:45:25 +08:00
parent 4c649312c1
commit 2fe27a3c47
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() { recover() {
} }

View File

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

View File

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