[update] 国标外标预览文件有pdfId优先预览

This commit is contained in:
lideqin
2024-07-23 17:10:49 +08:00
parent 31b25424af
commit 23e1eec2e7
3 changed files with 30 additions and 2 deletions
@@ -405,6 +405,12 @@ export default {
if (!file || !file.url) {
return
}
if (file.pdfId) {
// 说明是onlyOffice生成的
const url = previewPdf(file.pdfId)
window.open(url)
return
}
// 截取文件后缀名
const fileSuffix = file.fileName ? file.fileName.split('.')[file.fileName.split('.').length - 1] : ''
const canPreview = CAN_PREVIEW_FILE_SUFFIX.some(tt => fileSuffix.toLowerCase() === tt)
@@ -693,6 +693,14 @@ export default {
}
console.log('seletedFile', file)
// 预览关联的pdf文件
if (file.pdfId) {
// 说明是onlyOffice生成的
const url = previewPdf(file.pdfId)
window.open(url)
return
}
// 预览选择的文件
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
console.log(fileFullUrl)
@@ -709,7 +717,10 @@ export default {
*/
async selectNewestFile (fileList) {
if (!fileList || fileList.length === 0) return null
if (fileList.length === 1) return fileList[0]
if (fileList.length === 1) {
const res = await getFileInfo(fileList[0])
return { ...fileList[0], ...res.result }
}
const newFileList = []
// 获取时间信息
for (const file of fileList) {
@@ -694,6 +694,14 @@ export default {
}
console.log('seletedFile', file)
// 预览关联的pdf文件
if (file.pdfId) {
// 说明是onlyOffice生成的
const url = previewPdf(file.pdfId)
window.open(url)
return
}
// 预览选择的文件
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
console.log(fileFullUrl)
@@ -710,7 +718,10 @@ export default {
*/
async selectNewestFile (fileList) {
if (!fileList || fileList.length === 0) return null
if (fileList.length === 1) return fileList[0]
if (fileList.length === 1) {
const res = await getFileInfo(fileList[0])
return { ...fileList[0], ...res.result }
}
const newFileList = []
// 获取时间信息
for (const file of fileList) {