From e8b25d44557567be2b9cde65082370fff17a1b6a Mon Sep 17 00:00:00 2001 From: wangxk Date: Mon, 9 Jun 2025 15:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=AE=A1=E7=90=86-=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=92=8C=E9=A2=84=E8=A7=88url=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/document/index.ts | 8 +++++++ web/src/views/special/document/index.vue | 30 ++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/web/src/api/document/index.ts b/web/src/api/document/index.ts index fcbf2c1..6445ed2 100644 --- a/web/src/api/document/index.ts +++ b/web/src/api/document/index.ts @@ -109,4 +109,12 @@ export function selectNodesByProjectId(queryParams:any) { method: 'post', params:queryParams }); +} +//获取文档管理url +export function sdLocalUrl(queryParams:any) { + return request({ + url: '/specialDocument/sd_files/sdLocalUrl', + method: 'post', + params:queryParams + }); } \ No newline at end of file diff --git a/web/src/views/special/document/index.vue b/web/src/views/special/document/index.vue index c75d06f..adc8df1 100644 --- a/web/src/views/special/document/index.vue +++ b/web/src/views/special/document/index.vue @@ -13,7 +13,7 @@ import { Search } from '@element-plus/icons-vue' import Page from '@/components/Pagination/page.vue'; import AudioPlayer from '@/components/file/preview/AudioPlayer.vue'; import { batchDeleteReq } from "@/api/file-operator"; -import { projectList, selectNodesByProjectId, documentUploadById, obtainInformationAsync, getNodesTree, addNodes, updateNodes, deleteNodesById, getFilesPage, addFiles, updateFiles, deleteFilesById, deleteFilesByIds, specialScanById } from "@/api/document"; +import { projectList, selectNodesByProjectId, documentUploadById, obtainInformationAsync, getNodesTree, addNodes, updateNodes, deleteNodesById, getFilesPage, addFiles, updateFiles, deleteFilesById, deleteFilesByIds, specialScanById,sdLocalUrl } from "@/api/document"; import ZUpload from '@/components/file/ZUpload.vue' import useFileUpload from "@/components/file/file/useFileUpload"; import useHeaderStorageList from "@/components/header/useHeaderStorageList"; @@ -587,7 +587,10 @@ function xiafile(row: any) { } ) .then(() => { - window.open(row.url); + sdLocalUrl({ id: row.id }).then((res: any) => { + window.open(res.data.url); + }) + }) @@ -690,17 +693,30 @@ function openPreview(row: any) { // } if (getFileExtension(row.fileName) == 'pdf' || getFileExtension(row.fileName) == 'xlsx' || getFileExtension(row.fileName) == 'xls' || getFileExtension(row.fileName) == 'docx' || getFileExtension(row.fileName) == 'doc' || getFileExtension(row.fileName) == 'bin') { title1.value = row.fileName - ViewfileUrl.value = row.url - isViewfile.value = true - fileType.value = getFileExtension(row.fileName) + geturl(row, true) } else { row.fileType = getFileType(row.fileName) filePreview.value = row - localStorage.setItem('videorow', JSON.stringify(row)); - openRow(row) + geturl(row, false) } } +function geturl(row: any, pan: any) { + sdLocalUrl({ id: row.id }).then((res: any) => { + if (pan) { + ViewfileUrl.value = res.data.url + isViewfile.value = true + fileType.value = getFileExtension(row.fileName) + } else { + filePreview.value.url = res.data.url + filePreview.value.type = res.data.type + localStorage.setItem('videorow', JSON.stringify(row)); + openRow(row) + } + + + }) +} function getFileExtension(filename: any) { // 获取点号在文件名中的位置(从后往前查找) const lastIndex = filename.lastIndexOf('.');