diff --git a/project/fengdu/AppOutSource/AppArchives/components/Add.vue b/project/fengdu/AppOutSource/AppArchives/components/Add.vue index 87686370..c61e61cf 100644 --- a/project/fengdu/AppOutSource/AppArchives/components/Add.vue +++ b/project/fengdu/AppOutSource/AppArchives/components/Add.vue @@ -129,6 +129,7 @@ show-checkbox :default-expanded-keys="currCheckedKeys" :default-checked-keys="currCheckedKeys" + @check-change="handleCheckChange" @check="onCheckChange"> @@ -171,6 +172,7 @@ export default { currCheckedKeys: [], dialog: false, treeList: [], + treeArray:[], treeObj: { checkedKeys: [], }, @@ -209,6 +211,7 @@ export default { this.treeObj.checkedKeys = []; this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => { if (res.code == 0) { + this.treeArray = res.data this.form.girdInfoList.map((e) => { this.treeObj.checkedKeys.push(e.id); }); @@ -238,7 +241,12 @@ export default { } }) if (code === 0) { - this.form = {...data} + this.form = {...data,girdInfoList:[]} + this.form.fileUrl = [{ + url: data.fileUrl + }] + const target = this.treeArray?.find(v=>v.girdCode === data.girdCode) + this.currCheckedKeys = [target.id] } } catch (e) { console.error(e) @@ -247,23 +255,26 @@ export default { getCheckedTree() { const nodes = this.$refs.treeRef.getCheckedNodes() - console.log(nodes) if (!nodes.length) { return this.$message.error('请选择网格') } - if (nodes.length > 1) { - return this.$message.error('不支持多选') - } - this.currCheckedKeys = [nodes[0]?.id] this.form.girdCode = nodes[0]?.girdCode this.form.girdName = nodes[0]?.girdName this.dialog = false; }, - onCheckChange(e) { + handleCheckChange(data, checked){ + if (checked) { + this.$refs.treeRef.setCheckedKeys([data.id]) + } + }, + onCheckChange(e) { + if(e.children && e.children.length>0){ + this.$refs.treeRef.setCheckedKeys([]); + } }, idChange(val) { @@ -282,14 +293,14 @@ export default { async addOrUpdate() { try { - const {code, data} = await this.instance.post(`/app/appshoparchives/addOrUpdate`,{ + const {code} = await this.instance.post(`/app/appshoparchives/addOrUpdate`,{ ...this.form, fileId:this.form.fileUrl[0]?.id, fileUrl:this.form.fileUrl[0]?.path, }) if (code === 0) { this.$message.success('保存成功'); - this.form = {...data} + this.cancel() } } catch (e) { console.error(e) diff --git a/project/fengdu/AppOutSource/AppArchives/components/Detail.vue b/project/fengdu/AppOutSource/AppArchives/components/Detail.vue index ce1b114e..3a7c8b73 100644 --- a/project/fengdu/AppOutSource/AppArchives/components/Detail.vue +++ b/project/fengdu/AppOutSource/AppArchives/components/Detail.vue @@ -7,35 +7,35 @@ @@ -68,12 +68,15 @@ export default { girdName: '', address: '', description: '', + fileUrl:[] }, } }, created() { - this.getDetail() + this.$dict.load('sex','operatorType').then(()=>{ + this.getDetail() + }) }, methods: { @@ -81,11 +84,14 @@ export default { try { const {code, data} = await this.instance.post('/app/appshoparchives/queryDetailById', null, { params: { - id: this.parmas.id + id: this.params.id } }) if (code === 0) { this.form = {...data} + this.form.fileUrl = [{ + url: data.fileUrl + }] } } catch (e) { console.error(e) diff --git a/project/fengdu/AppOutSource/AppArchives/components/List.vue b/project/fengdu/AppOutSource/AppArchives/components/List.vue index 56986aa8..f6dafa25 100644 --- a/project/fengdu/AppOutSource/AppArchives/components/List.vue +++ b/project/fengdu/AppOutSource/AppArchives/components/List.vue @@ -2,13 +2,11 @@