修改显示层级

This commit is contained in:
zyy 2019-12-03 18:44:46 +08:00
parent 4428a968ee
commit 4526204f03
7 changed files with 21 additions and 133 deletions

View File

@ -150,10 +150,6 @@ class Jlmap {
}
}
setLayerVisible(layer) {
this.$painter.setLayerVisible(layer);
}
setLevelVisible(list) {
this.$painter.setLevelVisible(list);
}

View File

@ -241,7 +241,7 @@ class MouseController extends Eventful {
deviceList.forEach( item =>{
if (item.instance && item.instance._type == deviceType.Section) {
let deviceBoundingRect = {};
if (item.type == '03') {
if (item.type == '04') {
deviceBoundingRect = {
x1: item.namePosition.x,
y1: item.namePosition.y,

View File

@ -27,11 +27,6 @@ class Painter {
* @param {*} config
*/
initLevels() {
// 图层分级策略
this.layerBranch = {};
this.layerBranch['01'] = (type) => { return type == deviceType.Link; }; // 逻辑图层级
this.layerBranch['02'] = (type) => { return type != deviceType.Link; }; // 物理图层级
this.layerBranch['03'] = (type) => { return true; }; // 混合图层级
// 添加父级图层
this.parentLevel = new Group({ name: '__parent__' });
@ -43,9 +38,6 @@ class Painter {
this.mapInstanceLevel[type] = level;
this.parentLevel.add(level);
});
// 设置默认显示图级
this.setLayerVisible('02');
}
/**
@ -193,21 +185,6 @@ class Painter {
}
}
/**
* 设置逻辑和物理图层
* @param {*} layer
*/
setLayerVisible(layer) {
zrUtil.each(Object.values(deviceType), type => {
const level = this.mapInstanceLevel[type];
if (this.layerBranch[layer](type)) {
level.show();
} else {
level.hide();
}
}, this);
}
/**
* 设置图层可见
* @param {*} code

View File

@ -183,10 +183,6 @@ export default {
}, 100);
});
},
//
setLayerVisible(layer) {
this.$jlmap && this.$jlmap.setLayerVisible(layer);
},
//
setLevelVisible(levels) {
this.$jlmap && this.$jlmap.setLevelVisible(levels);

View File

@ -2,31 +2,13 @@
<el-dialog v-dialogDrag :title="$t('map.layerDisplay')" :visible.sync="dialogTableVisible" class="view_box" width="460px" :before-close="doClose" :modal-append-to-body="false">
<el-row type="flex" justify="center" class="content_box">
<el-form label-width="80px" class="demo-ruleForm">
<el-form-item :label="$t('map.viewShows')">
<el-checkbox-group v-model="viewSelect" :min="1" @change="handleSelectView">
<el-checkbox :label="ViewMode.LOGIC">{{ $t('map.logicalView') }}</el-checkbox>
<el-checkbox :label="ViewMode.PHYSICAL">{{ $t('map.physicalView') }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item :label="$t('map.contentShows')">
<el-row v-if="ViewMode.LOGIC === viewSelect[0] && viewSelect.length == 1" class="logical-view" type="flex" justify="center" style="width: 100%;">
<el-checkbox-group v-model="logicalLevelsSelect" @change="handleSelectLogicalView">
<el-checkbox v-for="view in LogicalViewTypeList" :key="view.code" :label="view.code" size="mini">
{{ view.name }}</el-checkbox>
</el-checkbox-group>
</el-row>
<el-row v-if="ViewMode.PHYSICAL === viewSelect[0] && viewSelect.length == 1" class="physical-view" type="flex" justify="center" style="width: 100%;">
<el-row class="physical-view" type="flex" justify="center" style="width: 100%;">
<el-checkbox-group v-model="physicalLevelsSelect" @change="handleSelectPhysicalView">
<el-checkbox v-for="view in PhysicalViewTypeList" :key="view.code" :label="view.code">
{{ view.name }}</el-checkbox>
</el-checkbox-group>
</el-row>
<el-row v-if=" viewSelect.length == 2" class="physical-view" type="flex" justify="center" style="width: 100%;">
<el-checkbox-group v-model="hybridLevelsSelect" @change="handleSelectHybridView">
<el-checkbox v-for="view in HybridViewTypeList" :key="view.code" :label="view.code">
{{ view.name }}</el-checkbox>
</el-checkbox-group>
</el-row>
</el-form-item>
</el-form>
</el-row>
@ -51,22 +33,10 @@ export default {
{ code: 'Signal', name: this.$t('map.signal') },
{ code: 'Switch', name: this.$t('map.switch') }
],
HybridViewTypeList: [],
defaultLogicalSelect: [],
defaultPhysicalSelect: [],
defaultHybridSelect: [],
logicalLevelsSelect: [],
physicalLevelsSelect: [],
hybridLevelsSelect: [] //
// defaultPhysicalSelect: [], //
physicalLevelsSelect: [] // list
};
},
watch: {
'$store.state.map.mapDataLoadedCount': function (val) {
this.handleSelectView(this.viewSelect);
}
},
mounted() {
this.initPage();
},
@ -78,53 +48,17 @@ export default {
this.dialogTableVisible = false;
},
initPage() {
this.$Dictionary.logicalViewType().then(list => {
this.LogicalViewTypeList = list;
list.forEach(v => {
this.HybridViewTypeList.push(v);
this.hybridLevelsSelect.push(v.code);
this.defaultHybridSelect.push(v.code);
});
this.LogicalViewTypeList.forEach(elem => {
this.logicalLevelsSelect.push(elem.code);
this.defaultLogicalSelect.push(elem.code);
});
});
this.$Dictionary.physicalViewType().then(list => {
this.PhysicalViewTypeList = list;
list.forEach(v => {
this.HybridViewTypeList.push(v);
this.hybridLevelsSelect.push(v.code);
this.defaultHybridSelect.push(v.code);
});
this.PhysicalViewTypeList.forEach(elem => {
this.physicalLevelsSelect.push(elem.code);
this.defaultPhysicalSelect.push(elem.code);
// this.defaultPhysicalSelect.push(elem.code);
});
});
},
handleSelectView(value) {
if (value.length == 2) {
this.$emit('handleSelectView', '03');
this.hybridLevelsSelect = this.copyList(this.defaultHybridSelect);
} else {
this.$emit('handleSelectView', value);
if (this.viewSelect[0] == this.ViewMode.LOGIC) {
this.logicalLevelsSelect = this.copyList(this.defaultLogicalSelect);
} else {
this.physicalLevelsSelect = this.copyList(this.defaultPhysicalSelect);
}
}
},
handleSelectLogicalView(handle) {
this.$emit('handleSelectLogicalView', handle);
},
handleSelectPhysicalView(handle) {
this.$emit('handleSelectPhysicalView', handle);
},
handleSelectHybridView(handle) {
this.$emit('handleSelectHybridView', handle);
},
copyList(list) {
return JSON.parse(JSON.stringify(list));
}

View File

@ -164,26 +164,11 @@ export default {
this.$store.dispatch('menuOperation/setMapDrawSelectCount');
}
},
handleSelectView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLayerVisible(handle);
}
},
handleSelectLogicalView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
handleSelectPhysicalView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
handleSelectHybridView(handle) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
clickEvent(em) {
var device = this.getDeviceByEm(em);
this.onSelect(device);

View File

@ -65,7 +65,7 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.zcZoneControl')" class="tab_pane_box" name="ZcControl">
<!-- <el-tab-pane :label="$t('map.zcZoneControl')" class="tab_pane_box" name="ZcControl">
<zc-control-draft
ref="ZcControl"
:selected="selected"
@ -104,7 +104,7 @@
@updateMapModel="updateMapModel"
@setCenter="setCenter"
/>
</el-tab-pane>
</el-tab-pane> -->
<el-tab-pane :label="$t('map.train')" class="tab_pane_box" name="Train">
<train-draft
ref="Train"
@ -145,14 +145,14 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.button')" class="tab_pane_box" name="ButtonControl">
<!-- <el-tab-pane :label="$t('map.button')" class="tab_pane_box" name="ButtonControl">
<button-draft
ref="ButtonControl"
:selected="selected"
@updateMapModel="updateMapModel"
@setCenter="setCenter"
/>
</el-tab-pane>
</el-tab-pane> -->
<el-tab-pane label="包围框" class="tab_pane_box" name="CheckBox">
<checkbox-draft
ref="CheckBox"
@ -174,17 +174,17 @@ import SignalDraft from './signal';
import StationDraft from './station';
import StationStandDraft from './stationstand';
import StationControlDraft from './stationcontrol';
import CounterDraft from './counter';
import DelayUnlockDraft from './delayunlock';
// import CounterDraft from './counter';
// import DelayUnlockDraft from './delayunlock';
import TrainDraft from './train/index';
import LineDraft from './line';
import TextDraft from './text';
import TrainWindowDraft from './trainwindow';
import ZcControlDraft from './zcControl';
import LimitControlDraft from './limitControl';
import LcControlDraft from './lcControl';
// import ZcControlDraft from './zcControl';
// import LimitControlDraft from './limitControl';
// import LcControlDraft from './lcControl';
import ImageControlDraft from './ImageControl';
import ButtonDraft from './buttonDraft';
// import ButtonDraft from './buttonDraft';
import CheckboxDraft from './checkboxDraft';
import { ViewMode } from '@/scripts/ConstDic';
@ -192,23 +192,23 @@ import { ViewMode } from '@/scripts/ConstDic';
export default {
name: 'MapOperate',
components: {
CounterDraft,
// CounterDraft,
SectionDraft,
SwitchDraft,
SignalDraft,
StationDraft,
StationStandDraft,
StationControlDraft,
DelayUnlockDraft,
// DelayUnlockDraft,
TrainWindowDraft,
TrainDraft,
LineDraft,
TextDraft,
ZcControlDraft,
LimitControlDraft,
LcControlDraft,
// ZcControlDraft,
// LimitControlDraft,
// LcControlDraft,
ImageControlDraft,
ButtonDraft,
// ButtonDraft,
CheckboxDraft
},
props: {