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 @@
-
-
+
@@ -23,25 +22,26 @@
删除
+
+
-
-
-
+
+
-
+
@@ -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]
+ }
+ })
+ }
+ },
}