From 36f979a67a8c84d1fdbfbb8e5eb088a54ec8cb01 Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Wed, 12 Oct 2022 09:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86=E7=BC=96?= =?UTF-8?q?=E8=BE=91=20=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/addResource.vue | 24 +++++++++++++++--- .../components/resourceClassification.vue | 2 +- .../components/resourceManagement.vue | 25 +++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/project/pengliuyang/apps/AppCommunityResource/components/addResource.vue b/project/pengliuyang/apps/AppCommunityResource/components/addResource.vue index 442828c6..d6b17a35 100644 --- a/project/pengliuyang/apps/AppCommunityResource/components/addResource.vue +++ b/project/pengliuyang/apps/AppCommunityResource/components/addResource.vue @@ -124,12 +124,13 @@ export default { created() { this.areaId = this.user.info.areaId this.getCategoryList() + this.getDetail() }, methods: { cancel() { - // currentPage: resourceManagement this.$router.push({}) }, + getCategoryList() { this.instance.post(`/app/appresourcecategory/list`,null,{ params: { @@ -147,16 +148,19 @@ export default { } }) }, + handleAreaSelect(v) { if(v.length) { this.form.areaName = v[0]?.label } }, + selectMap() { this.form.lng = this.placeDetail.lng this.form.lat = this.placeDetail.lat this.showMap = false }, + getCorpLocation() { this.instance.post('/app/appdvcpconfig/getCorpLocation').then((res) => { if (res.code == 0) { @@ -164,6 +168,7 @@ export default { } }) }, + initMap({ lng, lat }) { AMapLoader.load({ key: '54a02a43d9828a8f9cd4f26fe281e74e', @@ -200,6 +205,7 @@ export default { }) }) }, + movePosition(center) { if (this.map) { this.map.clearMap() @@ -214,6 +220,15 @@ export default { } }, + getDetail() { + let {id} = this.$route.query + if (!id) return + this.instance.post(`/app/appresourceinfo/queryDetailById?id=${id}`).then(res=> { + if(res?.data) { + this.form = res.data + } + }) + }, confirm() { this.$refs.form.validate((valid) => { @@ -222,13 +237,16 @@ export default { ...this.form }).then(res => { if (res.code == 0) { - this.$message.success('新增成功') + if(this.form.id) { + this.$message.success('修改成功') + } else { + this.$message.success('新增成功') + } this.cancel() } }) } }) - }, }, } diff --git a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue index 51b7c82f..b716d8fa 100644 --- a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue +++ b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue @@ -77,7 +77,7 @@ export default { {prop: 'categoryName', label: '分类名称', width: '300px'}, {prop: 'resourceNum', label: '资源数量', align: 'center'}, {slot: "categoryIcon"}, - {slot: 'option'}, + {slot: 'options'}, ] }, rules() { diff --git a/project/pengliuyang/apps/AppCommunityResource/components/resourceManagement.vue b/project/pengliuyang/apps/AppCommunityResource/components/resourceManagement.vue index 29231e61..956a89cd 100644 --- a/project/pengliuyang/apps/AppCommunityResource/components/resourceManagement.vue +++ b/project/pengliuyang/apps/AppCommunityResource/components/resourceManagement.vue @@ -15,6 +15,13 @@ + + + + @@ -50,6 +57,7 @@ export default { {prop: 'categoryName', label: '资源种类', align: 'center'}, {prop: 'areaName', label: '行政归属', align: 'center'}, {prop: 'createTime', label: '添加时间', align: 'center'}, + {slot: 'options'} ] } }, @@ -71,9 +79,11 @@ export default { } }) }, + addResource() { this.$router.push({hash: "#addResource", query: {}}) }, + getCategoryList() { this.instance.post(`/app/appresourcecategory/list`,null,{ params: { @@ -91,6 +101,21 @@ export default { } }) }, + + toEdit(id) { + this.$router.push({hash: "#addResource", query: {id}}) + }, + + Delete(id) { + this.$confirm('确定删除该数据?').then(() => { + this.instance.post(`/app/appresourceinfo/delete?ids=${id}`).then(res=> { + if(res.code == 0) { + this.$message.success('删除成功!') + this.getList() + } + }) + }) + } } }