增加绘图图层 全选

This commit is contained in:
zyy 2020-01-13 17:31:58 +08:00
parent 1fab892047
commit 9d42feb47e

View File

@ -3,6 +3,7 @@
<el-row type="flex" justify="center" class="content_box">
<el-form label-width="80px" class="demo-ruleForm">
<el-form-item :label="$t('map.contentShows')">
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
<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">
@ -25,14 +26,13 @@ export default {
ViewMode: ViewMode,
dialogTableVisible: false,
viewSelect: [ViewMode.LOGIC, ViewMode.PHYSICAL],
LogicalViewTypeList: [
{ code: 'Link', name: this.$t('map.link') }
],
PhysicalViewTypeList: [
{ code: 'Section', name: this.$t('map.section') },
{ code: 'Signal', name: this.$t('map.signal') },
{ code: 'Switch', name: this.$t('map.switch') }
],
checkAll: true,
isIndeterminate: false,
physicalLevelsSelect: [] // list
};
},
@ -56,9 +56,17 @@ export default {
},
handleSelectPhysicalView(handle) {
this.$emit('handleSelectPhysicalView', handle);
const checkedCount = handle.length;
this.checkAll = checkedCount === this.PhysicalViewTypeList.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.PhysicalViewTypeList.length;
},
copyList(list) {
return JSON.parse(JSON.stringify(list));
},
handleCheckAllChange(val) {
this.physicalLevelsSelect = val ? this.PhysicalViewTypeList.map(item => item.code) : ['Section'];
this.isIndeterminate = this.physicalLevelsSelect.length > 0 && this.physicalLevelsSelect.length < this.PhysicalViewTypeList.length;
this.$emit('handleSelectPhysicalView', this.physicalLevelsSelect);
}
}
};