马宇豪
2024-04-02 d91fd1557ebed3e9bcb8c051c71b9d41c0e36eef
src/views/dataUpload/saftyBaseInfo/judgeReport/index.vue
@@ -107,20 +107,21 @@
      }
      const openFile=(file: string)=>{
        axios.get(import.meta.env.VITE_API_URL + file,{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{
          if (res) {
            const link = document.createElement('a')
            let blob = new Blob([res.data],{type: 'application/pdf'})
            link.style.display = "none";
            link.href = URL.createObjectURL(blob); // 创建URL
            window.open(link.href)
          } else {
            ElMessage({
              type: 'warning',
              message: '文件读取失败'
            });
          }
        })
        // axios.get(file,{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{
        //   if (res) {
        //     const link = document.createElement('a')
        //     let blob = new Blob([res.data],{type: 'application/pdf'})
        //     link.style.display = "none";
        //     link.href = URL.createObjectURL(blob); // 创建URL
        //     window.open(link.href)
        //   } else {
        //     ElMessage({
        //       type: 'warning',
        //       message: '文件读取失败'
        //     });
        //   }
        // })
        window.open(file)
      }
      // 删除用户