diff --git a/project/fengdu/AppOutSource/AppArchives/components/Add.vue b/project/fengdu/AppOutSource/AppArchives/components/Add.vue index 15a01444..0a2b14c1 100644 --- a/project/fengdu/AppOutSource/AppArchives/components/Add.vue +++ b/project/fengdu/AppOutSource/AppArchives/components/Add.vue @@ -68,7 +68,7 @@ @@ -94,7 +94,7 @@ + @name="v=>form.areaName=v" v-model="form.addressCode"/> @@ -161,9 +163,15 @@ export default { phone: '', birthday: '', age: '', + girdInfoList:[] }, + currCheckedKeys:[], dialog: false, treeList: [], + treeObj: { + checkedKeys: [], + }, + defaultExpandedKeys: [], defaultProps: { children: "children", label: "girdName", @@ -183,6 +191,7 @@ export default { }, created() { + this.beforeSelectTree() this.form.areaId = this.$store.state.user.info.areaId this.$dict.load('sex', 'operatorType') @@ -191,7 +200,33 @@ export default { } }, + methods: { + beforeSelectTree() { + this.treeObj.checkedKeys = []; + this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => { + if (res.code == 0) { + this.form.girdInfoList.map((e) => { + this.treeObj.checkedKeys.push(e.id); + }); + + this.treeList = res.data.filter(e => !e.parentGirdId) + const parentGirdId = this.treeList[0].id + + this.treeList.map(p => this.addChild(p, res.data.map(v => { + if (v.id === parentGirdId) { + this.defaultExpandedKeys.push(v.id) + } + + return { + ...v + } + }), { + parent: 'parentGirdId' + })) + } + }); + }, async getDetail({id}){ try { const {code,data} = await this.instance.post('/app/appshoparchives/queryDetailById',null,{ @@ -206,21 +241,21 @@ export default { console.error(e) } }, - async handleSelectGrid() { - try { - this.dialog = true - const {code, data} = await this.instance.post('/app/appgirdinfo/listAll3') - if (code === 0) { - console.log('data--->', data) - } - } catch (e) { - console.error(e) - } - }, getCheckedTree() { + const nodes = this.$refs.treeRef.getCheckedNodes() + if (!nodes.length) { + return this.$message.error('请选择网格') + } + if (nodes.length > 1) { + return this.$message.error('不支持多选') + } + + this.currCheckedKeys = [nodes[0]?.id] + this.dialog = false; }, + onCheckChange(e) { }, diff --git a/project/fengdu/AppOutSource/AppArchives/components/List.vue b/project/fengdu/AppOutSource/AppArchives/components/List.vue index 7d45cf48..e6875ba4 100644 --- a/project/fengdu/AppOutSource/AppArchives/components/List.vue +++ b/project/fengdu/AppOutSource/AppArchives/components/List.vue @@ -2,7 +2,7 @@