diff --git a/src/api/enterpriseStandardLibraryApi.js b/src/api/enterpriseStandardLibraryApi.js index 4a59d9cd..69ec76dd 100644 --- a/src/api/enterpriseStandardLibraryApi.js +++ b/src/api/enterpriseStandardLibraryApi.js @@ -21,7 +21,9 @@ const initChange = (params) => getAction('', params) // 临时权限设置 const temporaryPermissionSet = (params) => postAction('/laws/standard/enterprise/tempPermission', params) // 收藏企标 -const collectStandard = (params) => getAction('', params) +const collectStandard = (params) => postAction('/personal/lawsStandardCollection/enterprise/add', params) +// 取消收藏企标 +const cancelCollectStandard = (params) => postAction('/personal/lawsStandardCollection/enterprise/delete', params) // 分享企标 const shareStandard = (params) => getAction('', params) @@ -55,6 +57,7 @@ export { initChange, temporaryPermissionSet, collectStandard, + cancelCollectStandard, shareStandard, setQualityStandard, diff --git a/src/components/jero/JDate.vue b/src/components/jero/JDate.vue index 752cba21..764d8de4 100644 --- a/src/components/jero/JDate.vue +++ b/src/components/jero/JDate.vue @@ -169,6 +169,6 @@ export default { diff --git a/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue b/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue index 25a59d4f..36697641 100644 --- a/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue +++ b/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue @@ -161,6 +161,7 @@ import { shiftStandard, initChange, collectStandard, + cancelCollectStandard, shareStandard, deleteTreeNode } from '@api/enterpriseStandardLibraryApi' @@ -415,15 +416,31 @@ export default { }, // 收藏 handleCollection (record) { - const params = {} - params.id = record.id - collectStandard(params).then(res => { - if (res.success) { - this.$message.success(res.message) - } else { - this.$message.warning(res.message) - } - }) + if (record.collectionFlag) { + const params = {} + params.id = record.id + // 说明已收藏,调取消收藏接口 + cancelCollectStandard(params).then(res => { + if (res.success) { + this.$message.success(res.message) + this.loadData() + } else { + this.$message.warning(res.message) + } + }) + } else { + const params = {} + params.standardId = record.id + params.standardNumber = record.standard_no + collectStandard(params).then(res => { + if (res.success) { + this.$message.success(res.message) + this.loadData() + } else { + this.$message.warning(res.message) + } + }) + } }, // 分享 handleShare (record) {