diff --git a/src/views/collectReorganizi/collectionLibrary/file/index.vue b/src/views/collectReorganizi/collectionLibrary/file/index.vue index e03d01e..d951491 100644 --- a/src/views/collectReorganizi/collectionLibrary/file/index.vue +++ b/src/views/collectReorganizi/collectionLibrary/file/index.vue @@ -52,32 +52,8 @@ @@ -180,6 +156,41 @@ export default { mounted() { }, methods: { + getFileIconClass(fileType) { + if (!fileType) return 'icon-other' + + const lowerFileType = fileType.toLowerCase() + + switch (lowerFileType) { + case 'jpg': + case 'jpeg': + case 'png': + case 'bmp': + case 'gif': + return 'icon-image' + case 'xlsx': + case 'xls': + return 'icon-excel' + case 'docx': + case 'doc': + return 'icon-word' + case 'pdf': + return 'icon-pdf' + case 'ppt': + case 'pptx': + return 'icon-ppt' + case 'zip': + case 'rar': + return 'icon-zip' + case 'txt': + return 'icon-txt' + case 'ofd': + return 'icon-ofd' + // 其他未匹配的文件类型 + default: + return 'icon-other' + } + }, getFileSize(fileSize) { const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' const fileSizeInB = fileSize + 'B' diff --git a/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue b/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue index b83b94d..f51670f 100644 --- a/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue +++ b/src/views/collectReorganizi/collectionLibrary/module/uploadFile/index.vue @@ -36,32 +36,8 @@ --> @@ -188,6 +164,41 @@ export default { }, methods: { + getFileIconClass(fileType) { + if (!fileType) return 'icon-other' + + const lowerFileType = fileType.toLowerCase() + + switch (lowerFileType) { + case 'jpg': + case 'jpeg': + case 'png': + case 'bmp': + case 'gif': + return 'icon-image' + case 'xlsx': + case 'xls': + return 'icon-excel' + case 'docx': + case 'doc': + return 'icon-word' + case 'pdf': + return 'icon-pdf' + case 'ppt': + case 'pptx': + return 'icon-ppt' + case 'zip': + case 'rar': + return 'icon-zip' + case 'txt': + return 'icon-txt' + case 'ofd': + return 'icon-ofd' + // 其他未匹配的文件类型 + default: + return 'icon-other' + } + }, getFileSize(fileSize) { const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' const fileSizeInB = fileSize + 'B' diff --git a/src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/bigUpload22.vue b/src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/bigUpload22.vue new file mode 100644 index 0000000..1fd4ab3 --- /dev/null +++ b/src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/bigUpload22.vue @@ -0,0 +1,666 @@ + + + + + diff --git a/src/views/components/category/preUpload4 -数组.vue b/src/views/components/category/preUpload4 -数组.vue deleted file mode 100644 index 6e778f2..0000000 --- a/src/views/components/category/preUpload4 -数组.vue +++ /dev/null @@ -1,645 +0,0 @@ - - - - - diff --git a/src/views/prearchiveLibrary/file/index.vue b/src/views/prearchiveLibrary/file/index.vue index a0a747e..b6f9fd8 100644 --- a/src/views/prearchiveLibrary/file/index.vue +++ b/src/views/prearchiveLibrary/file/index.vue @@ -87,32 +87,8 @@ @@ -149,6 +125,8 @@ import { header, form } from '@crud/crud' import { mapGetters } from 'vuex' import { downloadFile } from '@/utils/index' import { FetchFileListByDocumentId } from '@/api/prearchiveLibrary/prearchiveLibrary' +import { getToken } from '@/utils/auth' + export default { name: 'File', components: { }, @@ -196,6 +174,41 @@ export default { mounted() { }, methods: { + getFileIconClass(fileType) { + if (!fileType) return 'icon-other' + + const lowerFileType = fileType.toLowerCase() + + switch (lowerFileType) { + case 'jpg': + case 'jpeg': + case 'png': + case 'bmp': + case 'gif': + return 'icon-image' + case 'xlsx': + case 'xls': + return 'icon-excel' + case 'docx': + case 'doc': + return 'icon-word' + case 'pdf': + return 'icon-pdf' + case 'ppt': + case 'pptx': + return 'icon-ppt' + case 'zip': + case 'rar': + return 'icon-zip' + case 'txt': + return 'icon-txt' + case 'ofd': + return 'icon-ofd' + // 其他未匹配的文件类型 + default: + return 'icon-other' + } + }, getFileSize(fileSize) { const fileSizeInKB = (fileSize / 1024).toFixed(2) + ' KB' const fileSizeInB = fileSize + 'B' @@ -271,28 +284,32 @@ export default { done() }, toPreview(row) { - console.log('row', row) - console.log('selectedCategory', row) - - console.log('this.parentInfo', this.parentInfo) const routeData = this.$router.resolve({ path: '/preview', query: { 'archiveNo': this.parentInfo.maintitle }}) window.open(routeData.href, '_blank') - + localStorage.setItem('documentId', JSON.stringify(this.selectedCategory.id)) localStorage.setItem('fileParentInfo', JSON.stringify(this.parentInfo)) localStorage.setItem('fileTables', JSON.stringify(this.fileData)) localStorage.setItem('fileCurrent', JSON.stringify(row)) }, // 下载附件 downloadFile(row) { - const url = this.baseApi + '/downloadFile' + row.file_path - fetch(url).then(res => res.blob()).then(blob => { + // filePath 保存的文件路径 + // bucketType 1预归档 2档案 + const url = this.baseApi + '/api/minioUpload/getFile?filePath=' + row.file_path + '&bucketType=1' + const fetchOptions = { + method: 'GET', + headers: { + 'Authorization': getToken() + } + } + fetch(url, fetchOptions).then(res => res.blob()).then(blob => { downloadFile(blob, row.file_name.split('.')[0], row.file_type) }).catch(() => { - this.$message({ message: '下载文件失败!', type: 'error', offset: 8 }) + this.$message({ message: '下载文件失败', type: 'error', offset: 8 }) }) } } diff --git a/src/views/prearchiveLibrary/index.vue b/src/views/prearchiveLibrary/index.vue index 0bbf2ef..7c251bc 100644 --- a/src/views/prearchiveLibrary/index.vue +++ b/src/views/prearchiveLibrary/index.vue @@ -148,8 +148,6 @@ - - @@ -151,6 +127,41 @@ export default { mounted() { }, methods: { + getFileIconClass(fileType) { + if (!fileType) return 'icon-other' + + const lowerFileType = fileType.toLowerCase() + + switch (lowerFileType) { + case 'jpg': + case 'jpeg': + case 'png': + case 'bmp': + case 'gif': + return 'icon-image' + case 'xlsx': + case 'xls': + return 'icon-excel' + case 'docx': + case 'doc': + return 'icon-word' + case 'pdf': + return 'icon-pdf' + case 'ppt': + case 'pptx': + return 'icon-ppt' + case 'zip': + case 'rar': + return 'icon-zip' + case 'txt': + return 'icon-txt' + case 'ofd': + return 'icon-ofd' + // 其他未匹配的文件类型 + default: + return 'icon-other' + } + }, downloadFile(row) { // filePath 保存的文件路径 // bucketType 1预归档 2档案