吉安感知网项目-前端
chenyao
2026-01-28 5ea049205416e245ecb1ec3d0962e48c5ec73ec3
applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
@@ -145,6 +145,7 @@
import { getDictLabel } from '@ztzf/utils'
import PreviewFiles from '@/components/PreviewFiles/PreviewFiles.vue'
import { getDictionaryByCode } from '@/api/system/dictbiz'
import { Base64 } from 'js-base64'
const store = useStore()
const userInfo = computed(() => store.getters.userInfo)
@@ -237,29 +238,33 @@
   editParams.value.link = row.link
}
// 'zip', 'rar', 'jar', 'tar', 'gzip', '7z',
const allSupportedExtensions = [
   'doc', 'docx', 'xls', 'xlsx', 'xlsm', 'ppt', 'pptx', 'csv', 'tsv', 'dotm', 'xlt', 'xltm', 'dot', 'dotx', 'xlam', 'xla',
   'wps', 'dps', 'et', 'ett', 'wpt',
   'odt', 'ods', 'ots', 'odp', 'otp', 'six', 'ott', 'fodt', 'fods',
   'vsd', 'vsdx', 'wmf', 'emf', 'psd',
   'pdf', 'ofd', 'rtf', 'epub',
   'xmind', 'bpmn', 'eml',
   'obj', '3ds', 'stl', 'ply', 'gltf', 'glb', 'off', '3dm', 'fbx', 'dae', 'wrl', '3mf', 'ifc', 'brep', 'step', 'iges', 'fcstd', 'bim',
   'dwg', 'dxf',
   'txt', 'xml', 'md', 'java', 'php', 'py', 'js', 'css',
   'jpg', 'jpeg', 'png', 'gif', 'bmp', 'ico', 'jfif', 'webp', 'tif', 'tiff', 'tga', 'svg',
   'mp3', 'wav', 'mp4', 'flv', 'avi', 'mov', 'rm', 'webm', 'ts', 'mkv', 'mpeg', 'ogg', 'mpg', 'rmvb', 'wmv', '3gp', 'swf'
];
const { VITE_APP_PREVIEW_URL } = import.meta.env
// 在线查看文档
function seeOnlineWord(row) {
   // 获取点之后的文件格式名
   const fileType = row?.link?.split('.').pop() || ''
   if (!row.link) {
      ElMessage.warning('文件链接不存在')
      return
   } else if (
      !row.link.includes('docx') &&
      !row.link.includes('pdf') &&
      !row.link.includes('png') &&
      !row.link.includes('jpg')
   ) {
   }else if (allSupportedExtensions.includes(fileType)){
      window.open(`${VITE_APP_PREVIEW_URL}/onlinePreview?url=`+encodeURIComponent(Base64.encode(row.link)));
   }else {
      ElMessage.warning(`${fileType}文件格式,可以下载再查看`)
      return
   } else if (row.link.includes('png') || row.link.includes('jpg')) {
      previewVisibleImg.value = true
      searchUrl.value = row.link
      return
   } else if (row.link.includes('docx') || row.link.includes('pdf')) {
      previewVisible.value = true
      searchUrl.value = row.link
      return
   }
}