This commit is contained in:
yanran200730
2022-08-25 09:39:51 +08:00
parent 8fa7e9c083
commit d2f611623b

View File

@@ -140,15 +140,15 @@
width="720px"> width="720px">
<div class="grid"> <div class="grid">
<el-tree <el-tree
:data="treeObj.treeList" :data="treeObj.treeList"
:props="treeObj.defaultProps" :props="treeObj.defaultProps"
node-key="id" node-key="id"
ref="tree" ref="tree"
:check-strictly="true" :check-strictly="true"
show-checkbox show-checkbox
:default-checked-keys="treeObj.checkedKeys" :default-checked-keys="treeObj.checkedKeys"
default-expand-all :default-expanded-keys="treeObj.checkedKeys"
@check="onCheckChange"> @check="onCheckChange">
</el-tree> </el-tree>
</div> </div>
</ai-dialog> </ai-dialog>
@@ -192,7 +192,7 @@ export default {
treeObj: { treeObj: {
treeList: [], treeList: [],
defaultProps: { defaultProps: {
children: "girdList", children: "children",
label: "girdName", label: "girdName",
}, },
checkedKeys: [], checkedKeys: [],
@@ -223,12 +223,20 @@ export default {
}, },
methods: { methods: {
getGridList() { getGridList() {
this.instance.post(`/app/appgirdinfo/listAll`).then((res) => { this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.treeObj.treeList = this.format(res.data)
if (this.formData.girdId) { if (this.formData.girdId) {
this.$set(this.treeObj, 'checkedKeys', [this.formData.girdId]) this.$set(this.treeObj, 'checkedKeys', [this.formData.girdId])
} }
this.treeObj.treeList = res.data.filter(e => !e.parentGirdId)
this.treeObj.treeList.map(p => this.addChild(p, res.data.map(v => {
return {
...v
}
}), {
parent: 'parentGirdId'
}))
} }
}) })
}, },