【修改】收藏功能

This commit is contained in:
zhoulingpo
2023-05-29 11:22:31 +08:00
parent 7da50d5a75
commit dbed5746b0
3 changed files with 32 additions and 94 deletions
+16
View File
@@ -116,6 +116,22 @@ export default {
params: data
})
},
// 收藏报告
reportCollect(data) {
return request({
url: '/api/reportLogBook/collectOrCancelCollect',
method: 'get',
params:data
})
},
// 收藏列表
collectList(data) {
return request({
url: '/api/report/myCollectPage',
method: 'post',
data
})
},
// 报告列表
reportList (data) {
return request({
+7 -49
View File
@@ -123,7 +123,7 @@
<vxe-column show-overflow show-header-overflow field="uploader" title="上传人"></vxe-column>
<vxe-column show-overflow show-header-overflow title="操作" width="200" fixed="right">
<template #default="{ row }">
<!-- <el-button type="text" v-if="row.collect" @click="collectReport(row,'y')">收藏</el-button>-->
<el-button type="text" @click="collectReport(row.id)">{{ row.collect==0?'收藏':'取消收藏' }}</el-button>
<!-- <el-button type="text" v-if="!row.collect" @click="collectReport(row,'n')">取消收藏</el-button>-->
<el-button type="text" v-if="row.power == 1 ||row.power == 2" @click="goReportDetail(row)">预览</el-button>
<el-button type="text" v-if="row.power == 3 || row.power == 2 " @click="downloadRow(row)">下载</el-button>
@@ -352,18 +352,6 @@ export default {
this.treeData = res.data
})
},
// 标签列表
labelList() {
this.$api.report.labelList().then(({data}) => {
this.tagData[1].name = data.labelOne.name
this.tagData[2].name = data.labelTwo.name
this.tagData[3].name = data.labelThree.name
this.tagData[1].tags = data.labelOne.childList
this.tagData[2].tags = data.labelTwo.childList
this.tagData[3].tags = data.labelThree.childList
})
},
search() {
this.q.pageNo = 1
this.reportList()
@@ -381,30 +369,7 @@ export default {
}
})
},
// 监听全选按钮
handleCheckAllChange(val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []
break
}
this.tagData[type].isIndeterminate = !val
},
// 监听group checkbox
handleCheckedTagsChange(val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length)
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length
},
// 切换展开隐藏
switchTagShow(type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow
},
// 日期列表
reportDateList() {
this.$api.report.reportDateList().then(({data}) => {
@@ -448,12 +413,6 @@ export default {
}
this.total = 0
this.tableData = []
this.tagData[1].checkAll = false
this.tagData[1].isIndeterminate = true
this.tagData[2].checkAll = false
this.tagData[2].isIndeterminate = true
this.tagData[3].checkAll = false
this.tagData[3].isIndeterminate = true
this.reportList()
},
// 下载
@@ -468,12 +427,11 @@ export default {
})
// })
},
collectReport(row,type){
if(type=='y'){
// 调用收藏
}else{
}
collectReport(id){
this.$api.report.reportCollect({reportId:id}).then(res=>{
this.$message.success("操作成功")
this.reportList()
})
},
// 跳转到详情
goReportDetail(row) {
+9 -45
View File
@@ -122,8 +122,8 @@
<vxe-column show-overflow show-header-overflow field="uploader" title="上传人"></vxe-column>
<vxe-column show-overflow show-header-overflow title="操作" width="200" fixed="right">
<template #default="{ row }">
<el-button type="text" v-if="row.collect" @click="collectReport(row,'y')">收藏</el-button>
<el-button type="text" v-if="!row.collect" @click="collectReport(row,'n')">取消收藏</el-button>
<el-button type="text" v-if="row.collect" @click="collectReport(row.id)">收藏</el-button>
<el-button type="text" v-if="!row.collect" @click="collectReport(row.id)">取消收藏</el-button>
<el-button type="text" v-if="row.power == 1 ||row.power == 2" @click="goReportDetail(row)">预览</el-button>
<el-button type="text" v-if="row.power == 3 || row.power == 2 " @click="downloadRow(row)">下载</el-button>
<el-button type="text" v-if="row.power !== 2 && !isAdmin" @click="permissionApp(row)">申请权限</el-button>
@@ -351,25 +351,13 @@ export default {
this.treeData = res.data
})
},
// 标签列表
labelList() {
this.$api.report.labelList().then(({data}) => {
this.tagData[1].name = data.labelOne.name
this.tagData[2].name = data.labelTwo.name
this.tagData[3].name = data.labelThree.name
this.tagData[1].tags = data.labelOne.childList
this.tagData[2].tags = data.labelTwo.childList
this.tagData[3].tags = data.labelThree.childList
})
},
search() {
this.q.pageNo = 1
this.reportList()
},
// 列表
reportList() {
this.$api.report.reportList({...this.q, labelId: this.checkedKeys}).then(({data}) => {
this.$api.report.collectList({...this.q, labelId: this.checkedKeys}).then(({data}) => {
this.tableData = data.records
this.total = data.total
this.q.pageNo = data.current
@@ -380,30 +368,7 @@ export default {
}
})
},
// 监听全选按钮
handleCheckAllChange(val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []
break
}
this.tagData[type].isIndeterminate = !val
},
// 监听group checkbox
handleCheckedTagsChange(val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length)
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length
},
// 切换展开隐藏
switchTagShow(type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow
},
// 日期列表
reportDateList() {
this.$api.report.reportDateList().then(({data}) => {
@@ -467,12 +432,11 @@ export default {
})
// })
},
collectReport(row,type){
if(type=='y'){
// 调用收藏
}else{
}
collectReport(id){
this.$api.report.reportCollect({reportId:id}).then(res=>{
this.$message.success("操作成功")
this.reportList()
})
},
// 跳转到详情
goReportDetail(row) {