zhouwx
2025-10-14 6fc51c87a7846ea58fd4395524534ef1cd0ff264
修改
已修改1个文件
22 ■■■■■ 文件已修改
src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue
@@ -56,6 +56,7 @@
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="userTpye == 0 || userTpye == 6">
        <template #default="scope">
          <el-button v-if="scope.row.filePath" link type="primary"  @click="downloadFile(scope.row)" >下载</el-button>
          <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
          <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
        </template>
@@ -84,6 +85,8 @@
import {renderAsync} from "docx-preview";
import {get} from "@vueuse/core";
import {delReview, getReviewPage} from "@/api/selfProblems/projectReview";
import axios from "axios";
import {getToken} from "@/utils/auth";
const userStore = useUserStore()
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -252,6 +255,25 @@
  }
}
const downloadFile = (e)=>{
  axios.get(import.meta.env.VITE_APP_BASE_API + '/' +e.filePath,{headers:{'Content-Type': 'application/json','Authorization': `${getToken()}`},responseType: 'blob'}).then(res=>{
    if (res) {
      const link = document.createElement('a')
      let blob = new Blob([res.data],{type: res.data.type})
      link.style.display = "none";
      link.href = URL.createObjectURL(blob); // 创建URL
      link.setAttribute("download", e.fileName);
      document.body.appendChild(link);
      link.click();
      document.body.removeChild(link);
    } else {
      ElMessage({
        type: 'warning',
        message: '文件读取失败'
      });
    }
  })
}
const changeCom = () => {
  getProjectList()
}