吉安感知网项目-前端
chenyao
2026-07-08 2d83f0c2b6348366f1e7a234012142e755b16e98
applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
@@ -269,14 +269,23 @@
];
const { VITE_APP_PREVIEW_URL } = import.meta.env
// kkfileView 中,word/pdf 默认转成只读 pdf 预览,excel 才是可编辑的 html 模式。
// 对这些类型追加 officePreviewType=html,让其以可编辑的 html 方式打开
const editableOfficeTypes = ['doc', 'docx', 'pdf']
// 在线查看文档
function seeOnlineWord(row) {
   // 获取点之后的文件格式名
   const fileType = row?.link?.split('.').pop() || ''
   const fileType = (row?.link?.split('.').pop() || '').toLowerCase()
   if (!row.link) {
      ElMessage.warning('文件链接不存在')
   } else if (allSupportedExtensions.includes(fileType)){
      window.open(`${VITE_APP_PREVIEW_URL}/onlinePreview?url=`+encodeURIComponent(Base64.encode(row.link)));
      let url = `${VITE_APP_PREVIEW_URL}/onlinePreview?url=` + encodeURIComponent(Base64.encode(row.link))
      // word/pdf 以可编辑的 html 模式打开(与 excel 一致)
      if (editableOfficeTypes.includes(fileType)) {
         url += '&officePreviewType=html'
      }
      window.open(url)
   } else {
      ElMessage.warning(`${fileType}文件格式,可以下载再查看`)
   }