spring
2025-03-24 6ec4ab163cff16c7ce0f4822efc224abe8e85410
合并
已修改5个文件
76 ■■■■ 文件已修改
src/components/Preview/filePreview.vue 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/process/method/standardMethodsChange/component/calibrationsFileDia.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/structural/capabilityAndLaboratory/workshop/components/fileList.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Preview/filePreview.vue
@@ -82,7 +82,7 @@
        minRowLength: 0,  // excel最少渲染多少行,如果想实现根据xlsx实际函数渲染,可以将此值设置为0.
        widthOffset: 10,  //如果渲染出来的结果感觉单元格宽度不够,可以在默认渲染的列表宽度上再加 Npx宽
        heightOffset: 10, //在默认渲染的列表高度上再加 Npx高
        beforeTransformData: (workbookData) => { return workbookData }, //底层通过exceljs获取excel文件内容,通过该钩子函数,可以对获取的excel文件内容进行修改,比如某个单元格的数据显示不正确,可以在此自行修改每个单元格的value值。
        beforeTransformData: (workbookData) => { return workbookData }, //底层通过exceljs获取excel文件内容,通过该钩子函数,可以对获取的excel文件内容进行修改,比如某个单元格的数据显示不正确,可以自行修改每个单元格的value值。
        transformData: (workbookData) => { return workbookData }, //将获取到的excel数据进行处理之后且渲染到页面之前,可通过transformData对即将渲染的数据及样式进行修改,此时每个单元格的text值就是即将渲染到页面上的内容
      },
      csvList: [],//csv文件数据
@@ -91,23 +91,41 @@
  },
  computed: {
    isImage() {
      let state = /\.(jpg|jpeg|png|gif)$/i.test(this.fileUrl)
      // let state = /\.(jpg|jpeg|png|gif)$/i.test(this.fileUrl)
      // this.imgUrl = this.fileUrl
      // if (state) {
      //   this.imgUrl = this.fileUrl.replaceAll('word', 'img')
      // }
      // 从 URL 或文件名中提取实际的文件名
      const fileName = this.currentFile.fileName || this.fileUrl.split('/').pop().split('?')[0]
      let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName)
      this.imgUrl = this.fileUrl
      if (state) {
        this.imgUrl = this.fileUrl.replaceAll('word', 'img')
      }
      console.log("文件名:", fileName, "是否图片:", state)
      return state;
    },
    isPdf() {
      return /\.pdf$/i.test(this.fileUrl);
      // return /\.pdf$/i.test(this.fileUrl);
      const fileName = this.currentFile.fileName || this.fileUrl.split('/').pop().split('?')[0]
      return /\.pdf$/i.test(fileName);
    },
    isDoc() {
      return /\.(doc|docx)$/i.test(this.fileUrl);
      // return /\.(doc|docx)$/i.test(this.fileUrl);
      const fileName = this.currentFile.fileName || this.fileUrl.split('/').pop().split('?')[0]
      return /\.(doc|docx)$/i.test(fileName);
    },
    isXls() {
      let state = /\.(xls|xlsx)$/i.test(this.fileUrl)
      // let state = /\.(xls|xlsx)$/i.test(this.fileUrl)
      // if (state) {
      //   if (/\.(xlsx)$/i.test(this.fileUrl)) {
      //     this.options.xls = false
      //   } else {
      //     this.options.xls = true
      //   }
      // }
      const fileName = this.currentFile.fileName || this.fileUrl.split('/').pop().split('?')[0]
      let state = /\.(xls|xlsx)$/i.test(fileName)
      if (state) {
        if (/\.(xlsx)$/i.test(this.fileUrl)) {
        if (/\.(xlsx)$/i.test(fileName)) {
          this.options.xls = false
        } else {
          this.options.xls = true
src/main.js
@@ -66,7 +66,7 @@
Vue.prototype.HaveJson = (val) => {
  return JSON.parse(JSON.stringify(val));
};
Vue.prototype.javaApi = "http://10.21.10.74:8089";
Vue.prototype.javaApi = "http://10.21.10.78:8089";
Vue.prototype.checkPermi = checkPermi;
Vue.prototype.uploadHeader = {
  Authorization: "Bearer " + getToken(),
src/views/CNAS/process/method/standardMethodsChange/component/calibrationsFileDia.vue
@@ -103,16 +103,28 @@
    },
    // 下载
    upload (row) {
      let url = '';
      if(row.type==1){
        url = this.javaApi+'/img/'+row.fileUrl
        file.downloadIamge(url,row.fileName)
      }else{
        url = this.javaApi+'/word/'+row.fileUrl
        const link = document.createElement('a');
        link.href = url;
        link.download = row.fileName;
        link.click();
      const fileName = row.fileName;
      const fileUrl = row.fileUrl;
      try {
          const response = axios({
              method: 'get',
              url: `${Vue.prototype.javaApi}/common/downloadMinio`,
              params: {
                fileUrl,
                fileName
              },
              responseType: 'blob',
              headers: { Authorization: 'Bearer ' + getToken() }
          });
          if (blobValidate(response.data)) {
              saveAs(new Blob([response.data]), fileName);
              Message.success("下载成功");
          } else {
              this.printErrMsg(response.data);
          }
      } catch (error) {
          Message.error("下载失败:" + error.message);
      }
    },
  }
src/views/structural/capabilityAndLaboratory/workshop/components/fileList.vue
@@ -11,7 +11,7 @@
    <lims-table :tableData="tableDataFile" :column="columnFile" height="500px" key="tableDataFile"
      :tableLoading="tableLoadingFile"></lims-table>
    <el-dialog title="查看附件" :visible.sync="lookDialogVisible" width="800px" top="5vh" fullscreen append-to-body>
      <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.fileUrl" :currentFile="{}"
      <filePreview v-if="lookDialogVisible" :fileUrl="currentInfo.fileMinioUrl" :currentFile="currentInfo"
        style="max-height: 90vh;overflow-y: auto;" />
    </el-dialog>
  </div>
@@ -85,6 +85,7 @@
              name: '预览',
              type: 'text',
              clickFun: (row) => {
                console.log('预览文件信息:', row)
                this.currentInfo = row
                this.lookDialogVisible = true
              }
@@ -109,6 +110,7 @@
        this.tableLoadingFile = false
        if (res.code === 200) {
          this.tableDataFile = res.data
          console.log('文件列表数据:', this.tableDataFile)
        }
      }).catch(err => {
        this.tableLoadingFile = false
vue.config.js
@@ -36,7 +36,7 @@
    proxy: {
      // detail: https://cli.vuejs.org/config/#devserver-proxy
      [process.env.VUE_APP_BASE_API]: {
        target: `http://10.21.10.74:8089`,
        target: `http://10.21.10.78:8089`,
        changeOrigin: true,
        pathRewrite: {
          ["^" + process.env.VUE_APP_BASE_API]: "",