优化
This commit is contained in:
@@ -37,17 +37,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<ai-dialog title="选择网格" :visible.sync="showGrid" :customFooter="true" :destroyOnClose="true"
|
<ai-dialog title="选择网格" :visible.sync="showGrid" :customFooter="true" :destroyOnClose="true" border width="720px">
|
||||||
@opened="beforeSelectTree" border width="720px">
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" ref="tree"
|
<el-tree
|
||||||
:check-strictly="true" show-checkbox
|
:data="treeObj.treeList"
|
||||||
:default-checked-keys="treeObj.checkedKeys" default-expand-all
|
:props="treeObj.defaultProps"
|
||||||
@check="onCheckChange">
|
node-key="id"
|
||||||
<template slot-scope="{node,data}">
|
ref="tree"
|
||||||
<el-tooltip :content="node.label">
|
:check-strictly="true"
|
||||||
<div class="el-tree-node__label" v-text="node.label"/>
|
show-checkbox
|
||||||
</el-tooltip>
|
:default-checked-keys="treeObj.checkedKeys"
|
||||||
|
:default-expanded-keys="treeObj.checkedKeys"
|
||||||
|
@check="onCheckChange">
|
||||||
|
<template slot-scope="{node}">
|
||||||
|
<div class="el-tree-node__label" :title="node.label" v-text="node.label"/>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,7 +101,7 @@ export default {
|
|||||||
treeObj: {
|
treeObj: {
|
||||||
treeList: [],
|
treeList: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: "girdList",
|
children: "children",
|
||||||
label: "girdName",
|
label: "girdName",
|
||||||
},
|
},
|
||||||
checkedKeys: [],
|
checkedKeys: [],
|
||||||
@@ -115,6 +118,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
this.beforeSelectTree()
|
||||||
this.dict.load('cardType', 'sex', 'nation').then(() => {
|
this.dict.load('cardType', 'sex', 'nation').then(() => {
|
||||||
if (this.params && this.params.id) {
|
if (this.params && this.params.id) {
|
||||||
this.getInfo(this.params.id)
|
this.getInfo(this.params.id)
|
||||||
@@ -123,15 +127,23 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
beforeSelectTree() {
|
beforeSelectTree() {
|
||||||
this.treeObj.checkedKeys = [];
|
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
|
||||||
this.instance.post(`/app/appgirdinfo/listAll`, null, null).then((res) => {
|
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.treeObj.treeList = this.format(res.data)
|
this.treeObj.checkedKeys = []
|
||||||
if (this.form.girdInfoList.length) {
|
if (this.form.girdInfoList.length) {
|
||||||
this.form.girdInfoList.map((e) => {
|
this.form.girdInfoList.map((e) => {
|
||||||
this.treeObj.checkedKeys.push(e.id);
|
this.treeObj.checkedKeys.push(e.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
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'
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user