From b082164ff696fb8fe1b7d43081834b9cc7ebce39 Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Sat, 8 Oct 2022 10:16:49 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resourceClassification.vue | 77 ++++++++++++++----- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue index b9275d3f..44734c2e 100644 --- a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue +++ b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue @@ -9,13 +9,12 @@ - - + + + - - - + + - + @@ -67,23 +67,24 @@ export default { dialog: false, form: { categoryName: '', - categoryIcon: '' + categoryIcon: '', + categoryIconArr: [] } } }, computed: { colConfigs() { return [ - {prop: 'resourceName', label: '分类名称', width: '300px'}, - {prop: 'categoryName', label: '资源数量', align: 'center'}, - // {prop: "merchandisePhoto",slot: "merchandisePhoto",align: "center",label: "商品图"}, - {prop: 'option'} + {prop: 'categoryName', label: '分类名称', width: '300px'}, + {prop: 'resourceNum', label: '资源数量', align: 'center'}, + {slot: "categoryIcon"}, + {slot: 'option'}, ] }, rules() { return { categoryName: [{required: true, message: "请输入分类名称"}], - categoryIcon: [{required: true, message: "请上传分类图标"}], + categoryIconArr: [{required: true, message: "请上传分类图标"}], } } }, @@ -99,8 +100,17 @@ export default { } }).then(res=> { if(res?.data) { - this.tableData = res.data.records - this.total = res.total + this.tableData = res.data.records.map(e=> { + return { + categoryName: e.categoryName, + resourceNum: e.resourceNum, + categoryIcon: e.categoryIcon, + id: e.id, + categoryIconArr: [{0:e.categoryIcon}] + } + }) + this.total = res.data.total + console.log(this.tableData); } }) }, @@ -108,13 +118,42 @@ export default { onConfirm() { this.$refs.form.validate((valid) => { if(valid) { - this.instance.post(`/app/appresourcecategory/addOrUpdate`, ...this.form).then(res=> { - console.log(res,this.form.categoryIcon); + if(this.form.categoryIconArr.length) { + this.form.categoryIcon = this.form.categoryIconArr[0].url + } + this.instance.post(`/app/appresourcecategory/addOrUpdate`, {...this.form}).then(res=> { + if(res.code == 0) { + this.$message.success('新增成功') + this.dialog = false + this.getList() + } }) } }) }, - } + handleDelete(ids) { + this.$confirm('确定删除该数据?').then(() => { + this.instance.post(`/app/appresourcecategory/delete?ids=${ids}`).then(res=> { + if (res.code== 0) { + this.$message.success('删除成功!') + this.getList() + } + }) + }) + }, + toEdit(id) { + this.getDetail(id) + this.dialog = true + }, + getDetail(ids) { + this.instance.post(`/app/appresourcecategory/queryDetailById?id=${ids}`).then(res=> { + if(res.data) { + this.form = res.data + // this.form.categoryIconArr = [...res.data.categoryIcon] + } + }) + } + }, } From 1bbb14bf5d4ae6a8dca0d24cba8ae4491d9960b6 Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Sat, 8 Oct 2022 10:56:24 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=BD=AC=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resourceClassification.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue index 44734c2e..38a4556f 100644 --- a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue +++ b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue @@ -106,11 +106,13 @@ export default { resourceNum: e.resourceNum, categoryIcon: e.categoryIcon, id: e.id, - categoryIconArr: [{0:e.categoryIcon}] + // categoryIconArr: [{ 0: e.categoryIcon}], + categoryIconArr: [e.categoryIcon] } }) this.total = res.data.total console.log(this.tableData); + } }) }, @@ -148,8 +150,9 @@ export default { getDetail(ids) { this.instance.post(`/app/appresourcecategory/queryDetailById?id=${ids}`).then(res=> { if(res.data) { + console.log(res.data); this.form = res.data - // this.form.categoryIconArr = [...res.data.categoryIcon] + this.form.categoryIconArr = [res.data.categoryIcon] } }) } From 89a22c82c93a0873d9bfbb361ad2ec93176f8241 Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Sat, 8 Oct 2022 11:33:13 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resourceClassification.vue | 24 ++++--------------- .../components/resourceManagement.vue | 3 +-- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue index 38a4556f..61b75300 100644 --- a/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue +++ b/project/pengliuyang/apps/AppCommunityResource/components/resourceClassification.vue @@ -12,7 +12,7 @@ @@ -32,8 +32,8 @@ - - + +