27140
This commit is contained in:
@@ -42,7 +42,8 @@
|
||||
<div class="grid">
|
||||
<el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" ref="tree"
|
||||
:check-strictly="true" show-checkbox
|
||||
:default-checked-keys="treeObj.checkedKeys" default-expand-all highlight-current>
|
||||
:default-checked-keys="treeObj.checkedKeys" default-expand-all
|
||||
@check="onCheckChange">
|
||||
</el-tree>
|
||||
</div>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
@@ -120,7 +121,7 @@ export default {
|
||||
this.treeObj.checkedKeys = [];
|
||||
this.instance.post(`/app/appgirdinfo/listAll`, null, null).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.treeObj.treeList = res.data;
|
||||
this.treeObj.treeList = this.format(res.data)
|
||||
if (this.form.girdInfoList.length) {
|
||||
this.form.girdInfoList.map((e) => {
|
||||
this.treeObj.checkedKeys.push(e.id);
|
||||
@@ -129,6 +130,29 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onCheckChange (e) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tree.getCheckedKeys().forEach(v => {
|
||||
this.$refs.tree.setChecked(v, false)
|
||||
})
|
||||
this.$refs.tree.setChecked(e.id, true)
|
||||
})
|
||||
},
|
||||
|
||||
format (list) {
|
||||
return list.map(item => {
|
||||
if (item.girdLevel !== '2') {
|
||||
item.disabled = true
|
||||
}
|
||||
|
||||
if (item.girdList && item.girdList.length) {
|
||||
item.girdList = this.format(item.girdList)
|
||||
}
|
||||
|
||||
return item
|
||||
})
|
||||
},
|
||||
getCheckedTree() {
|
||||
if (this.$refs.tree.getCheckedNodes().length > 1) {
|
||||
return this.$message.error('不能绑定多个网格')
|
||||
|
||||
Reference in New Issue
Block a user