BUG 30982

This commit is contained in:
aixianling
2022-08-29 11:21:55 +08:00
parent bbdd34f0ec
commit d037a7d938

View File

@@ -135,20 +135,21 @@
title="选择网格" title="选择网格"
:visible.sync="showGrid" :visible.sync="showGrid"
:destroyOnClose="true" :destroyOnClose="true"
@open="getGridList"
@close="showGrid = false" @close="showGrid = false"
@onConfirm="getCheckedTree" @onConfirm="getCheckedTree"
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-expanded-keys="treeObj.checkedKeys" :default-expanded-keys="treeObj.checkedKeys"
@check="onCheckChange"> @check="onCheckChange">
</el-tree> </el-tree>
</div> </div>
</ai-dialog> </ai-dialog>
@@ -215,7 +216,6 @@ export default {
} }
}, },
created() { created() {
this.getGridList()
this.getFormData() this.getFormData()
if (this.params.id) { if (this.params.id) {
this.getDetail() this.getDetail()
@@ -224,23 +224,14 @@ export default {
methods: { methods: {
getGridList() { getGridList() {
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => { this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
if (res.code == 0) { if (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 = this.$arr2tree(res.data, {parent: "parentGirdId"})
this.treeObj.treeList.map(p => this.addChild(p, res.data.map(v => {
return {
...v
}
}), {
parent: 'parentGirdId'
}))
} }
}) })
}, },
onChange(e) { onChange(e) {
this.formData.resident_id = e.id this.formData.resident_id = e.id
Object.keys(this.formData).forEach(item => { Object.keys(this.formData).forEach(item => {