licp
2024-12-23 efdd0cfd0c5b65b01491835e94352e8afcb78085
src/components/view/b1-report-preparation.vue
@@ -223,6 +223,17 @@
      <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url"
      :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/>
    </el-dialog>
    <!--报告查看-->
    <el-dialog :fullscreen="fullscreen" top="5vh" :modal-append-to-body="false" :visible.sync="viewIssuedVisible" title="报告查看"
               width="80vw">
      <div class="full-screen">
        <i v-if="!fullscreen" class="el-icon-full-screen" style="cursor: pointer;font-size: 18px" @click="fullscreen=true;"></i>
        <img v-else alt="" src="../../../static/img/no-full.svg" style="cursor: pointer;" @click="fullscreen=false;" >
      </div>
      <div v-if="viewIssuedVisible" style="height: 80vh;">
        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;" />
      </div>
    </el-dialog>
   </div>
</template>
@@ -387,7 +398,8 @@
        inLoading:false,
        imgList:[],
        imgVisible:false,
        currentImg:null
        currentImg:null,
        viewIssuedVisible:false
      }
    },
    computed: {
@@ -588,32 +600,65 @@
      async selectAllByOne(row) {
        // let url = row.urlS ? row.urlS : row.url;
        // this.currentFile.url = this.javaApi + url;
        // let fileName = (row.urlS===null||row.urlS==='')?row.url:row.urlS
        // fileName = fileName.replace('/word/','')
        // const userName = JSON.parse(localStorage.getItem("user")).name;
        // //参考vabOnlyOffice组件参数配置
        // const { href } = this.$router.resolve({
        //   path: `/wordEdit`,
        //   query: {
        //     url: this.javaApi + "/word/" + fileName,
        //     isEdit: false,
        //     fileType: "docx",
        //     title: fileName,
        //     lang: 'zh-CN',
        //     isPrint: true,
        //     user_id: 1,
        //     user_name: userName,
        //   }
        // })
        // window.open(href, '_blank');
        // this.lookFileVisible = true
        this.currentInfo = row;
        console.log(`output->row`,row);
        let fileName = (row.urlS===null||row.urlS==='')?row.url:row.urlS
        let fileType = "docx"
        if (row.tempUrlPdf != null || row.tempUrlPdf === '') {
          fileName = row.tempUrlPdf
          fileType = "pdf"
        }
        fileName = fileName.replace('/word/','')
        const userName = JSON.parse(localStorage.getItem("user")).name;
        //参考vabOnlyOffice组件参数配置
        const { href } = this.$router.resolve({
          path: `/wordEdit`,
          query: {
            url: this.javaApi + "/word/" + fileName,
            isEdit: false,
            fileType: "docx",
            title: fileName,
            lang: 'zh-CN',
            isPrint: true,
            user_id: 1,
            user_name: userName,
          }
        })
        window.open(href, '_blank');
        // this.lookFileVisible = true
        this.option = {
          url: this.javaApi + "/word/" + fileName,
          isEdit: false,
          fileType: fileType,
          title: fileName,
          lang: 'zh-CN',
          isPrint: false,
          user_id: 1,
          user_name: userName,
          editUrl: this.javaApi + "/insReport/onlyOffice/save?fileName=" + fileName
        }
        // console.log(this.javaApi + "/word/" + fileName);
        this.viewIssuedVisible = true;
      },
      download(row) {
        // 判断row对象中是否存在urlS属性,若存在则使用urlS,否则使用url
        let url = row.urlS ? row.urlS : row.url;
        // 创建一个<a>标签元素
        const link = document.createElement('a');
        // 设置<a>标签的href属性,为javaApi和url的组合
        link.href = this.javaApi + url;
        // 设置<a>标签的target属性为'_blank',表示在新窗口中打开链接
        link.target = '_blank';
        // 将<a>标签添加到文档的主体中
        document.body.appendChild(link);
        link.click();
      },
      // 还原操作