diff --git a/src/api/prearchiveLibrary/prearchiveLibrary.js b/src/api/prearchiveLibrary/prearchiveLibrary.js index 9de4409..8492621 100644 --- a/src/api/prearchiveLibrary/prearchiveLibrary.js +++ b/src/api/prearchiveLibrary/prearchiveLibrary.js @@ -125,4 +125,12 @@ export function FetchMinioReDocumentBase64ByFileId(params) { }) } -export default { add, prearchEdit, del, FetchInitPreDocument, FetchInitDocumentsViewTable, FetchDoeditDocument, FetchBatchToFile, FetchMergeToFile, FetchMove, FetchArchivesDetails, FetchFileListByDocumentId, FetchArchivesMetadata, FetchReDocumentBase64ByFileId, FetchMinioReDocumentBase64ByFileId } +export function FetchDeleteDocumentFile(data) { + return request({ + url: 'api/re-document/deleteDocumentFile', + method: 'post', + data + }) +} + +export default { add, prearchEdit, del, FetchInitPreDocument, FetchInitDocumentsViewTable, FetchDoeditDocument, FetchBatchToFile, FetchMergeToFile, FetchMove, FetchArchivesDetails, FetchFileListByDocumentId, FetchArchivesMetadata, FetchReDocumentBase64ByFileId, FetchMinioReDocumentBase64ByFileId, FetchDeleteDocumentFile } diff --git a/src/views/archivesManage/managementLibrary/file/index.vue b/src/views/archivesManage/managementLibrary/file/index.vue index 737e92e..397335f 100644 --- a/src/views/archivesManage/managementLibrary/file/index.vue +++ b/src/views/archivesManage/managementLibrary/file/index.vue @@ -159,9 +159,31 @@ export default { }, methods: { getFileSize(fileSize) { - const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' - const fileSizeInB = fileSize + 'B' - return (fileSize / 1024) <= 0.01 ? fileSizeInB : fileSizeInKB + // 1. 先将接口返回的KB值转为数字,处理非数字/空值情况 + const sizeInKB = Number(fileSize) + if (isNaN(sizeInKB) || sizeInKB < 0) { + return '0 KB' // 异常值默认显示0 KB + } + + // 2. 定义单位换算关系(1 MB = 1024 KB,1 GB = 1024 MB) + const KB = 1 + const MB = 1024 * KB + const GB = 1024 * MB + + // 3. 根据大小自动选择单位并格式化 + if (sizeInKB >= GB) { + // 大于等于1GB,显示GB(保留2位小数) + return (sizeInKB / GB).toFixed(2) + ' GB' + } else if (sizeInKB >= MB) { + // 大于等于1MB且小于1GB,显示MB(保留2位小数) + return (sizeInKB / MB).toFixed(2) + ' MB' + } else if (sizeInKB < 1) { + // 不足1KB,统一显示1 KB(保持你之前的需求) + return '1 KB' + } else { + // 1KB到1MB之间,显示KB(保留2位小数) + return sizeInKB + ' KB' + } }, getCommonData(categoryLevel, parentId, type) { this.getViewTable(categoryLevel, parentId, type) diff --git a/src/views/archivesManage/managementLibrary/module/uploadFile/index.vue b/src/views/archivesManage/managementLibrary/module/uploadFile/index.vue index 2bd488d..0b5c21a 100644 --- a/src/views/archivesManage/managementLibrary/module/uploadFile/index.vue +++ b/src/views/archivesManage/managementLibrary/module/uploadFile/index.vue @@ -134,9 +134,31 @@ export default { localStorage.setItem('fileCurrent', JSON.stringify(row)) }, getFileSize(fileSize) { - const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' - const fileSizeInB = fileSize + 'B' - return (fileSize / 1024) <= 0.01 ? fileSizeInB : fileSizeInKB + // 1. 先将接口返回的KB值转为数字,处理非数字/空值情况 + const sizeInKB = Number(fileSize) + if (isNaN(sizeInKB) || sizeInKB < 0) { + return '0 KB' // 异常值默认显示0 KB + } + + // 2. 定义单位换算关系(1 MB = 1024 KB,1 GB = 1024 MB) + const KB = 1 + const MB = 1024 * KB + const GB = 1024 * MB + + // 3. 根据大小自动选择单位并格式化 + if (sizeInKB >= GB) { + // 大于等于1GB,显示GB(保留2位小数) + return (sizeInKB / GB).toFixed(2) + ' GB' + } else if (sizeInKB >= MB) { + // 大于等于1MB且小于1GB,显示MB(保留2位小数) + return (sizeInKB / MB).toFixed(2) + ' MB' + } else if (sizeInKB < 1) { + // 不足1KB,统一显示1 KB(保持你之前的需求) + return '1 KB' + } else { + // 1KB到1MB之间,显示KB(保留2位小数) + return sizeInKB + ' KB' + } }, // 上传list getFileList() { diff --git a/src/views/collectReorganizi/collectionLibrary/file/index.vue b/src/views/collectReorganizi/collectionLibrary/file/index.vue index cc86074..e673d9e 100644 --- a/src/views/collectReorganizi/collectionLibrary/file/index.vue +++ b/src/views/collectReorganizi/collectionLibrary/file/index.vue @@ -192,9 +192,31 @@ export default { } }, getFileSize(fileSize) { - const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' - const fileSizeInB = fileSize + 'B' - return (fileSize / 1024) <= 0.01 ? fileSizeInB : fileSizeInKB + // 1. 先将接口返回的KB值转为数字,处理非数字/空值情况 + const sizeInKB = Number(fileSize) + if (isNaN(sizeInKB) || sizeInKB < 0) { + return '0 KB' // 异常值默认显示0 KB + } + + // 2. 定义单位换算关系(1 MB = 1024 KB,1 GB = 1024 MB) + const KB = 1 + const MB = 1024 * KB + const GB = 1024 * MB + + // 3. 根据大小自动选择单位并格式化 + if (sizeInKB >= GB) { + // 大于等于1GB,显示GB(保留2位小数) + return (sizeInKB / GB).toFixed(2) + ' GB' + } else if (sizeInKB >= MB) { + // 大于等于1MB且小于1GB,显示MB(保留2位小数) + return (sizeInKB / MB).toFixed(2) + ' MB' + } else if (sizeInKB < 1) { + // 不足1KB,统一显示1 KB(保持你之前的需求) + return '1 KB' + } else { + // 1KB到1MB之间,显示KB(保留2位小数) + return sizeInKB + ' KB' + } }, getCommonData(categoryLevel, parentId, type) { this.getViewTable(categoryLevel, parentId, type) diff --git a/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue b/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue index 7e0c444..d5489c5 100644 --- a/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue +++ b/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue @@ -693,6 +693,10 @@ export default { this.$refs.previewForm.archivesType = 'edit' this.$refs.previewForm.addOrUpdateForm = data.echo // this.$refs.previewForm.FetchNoFormatField(this.selectedCategory.id) + + if (data.echo.fonds_name === '' || data.echo.fonds_name === null) { + this.$set(this.$refs.previewForm.addOrUpdateForm, 'fonds_name', this.selectedCategory.fondName) + } }) }) }) @@ -850,11 +854,17 @@ export default { return false } } + console.log('this.collectLevel', this.collectLevel) + console.log('this.activeIndex', this.activeIndex) let messageTip if (this.activeIndex === 1) { - messageTip = '此删除将把会所选条目与其子集彻底删除' + messageTip = '此删除将把所选条目与其子集彻底删除' } else { - messageTip = '此删除将把会所选条目与其子集放入回收站' + if (this.collectLevel === 4) { + messageTip = '此删除将把所选条目彻底删除' + } else { + messageTip = '此删除将把所选条目与其子集放入回收站' + } } this.$confirm(messageTip + '你是否还要继续?', '提示', { confirmButtonText: '继续', diff --git a/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue b/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue index f51670f..68300de 100644 --- a/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue +++ b/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue @@ -200,9 +200,31 @@ export default { } }, getFileSize(fileSize) { - const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' - const fileSizeInB = fileSize + 'B' - return (fileSize / 1024) <= 0.01 ? fileSizeInB : fileSizeInKB + // 1. 先将接口返回的KB值转为数字,处理非数字/空值情况 + const sizeInKB = Number(fileSize) + if (isNaN(sizeInKB) || sizeInKB < 0) { + return '0 KB' // 异常值默认显示0 KB + } + + // 2. 定义单位换算关系(1 MB = 1024 KB,1 GB = 1024 MB) + const KB = 1 + const MB = 1024 * KB + const GB = 1024 * MB + + // 3. 根据大小自动选择单位并格式化 + if (sizeInKB >= GB) { + // 大于等于1GB,显示GB(保留2位小数) + return (sizeInKB / GB).toFixed(2) + ' GB' + } else if (sizeInKB >= MB) { + // 大于等于1MB且小于1GB,显示MB(保留2位小数) + return (sizeInKB / MB).toFixed(2) + ' MB' + } else if (sizeInKB < 1) { + // 不足1KB,统一显示1 KB(保持你之前的需求) + return '1 KB' + } else { + // 1KB到1MB之间,显示KB(保留2位小数) + return sizeInKB + ' KB' + } }, // 选择附件 async changeFile(e) { diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index d310654..d5d2cf9 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -122,11 +122,11 @@
-