<!--
  @description: 澄清函pdf预览
  @Modifier: haoFx
  @routerPath:/bidding/projectDrive/clarification/clarificationLetterPdfDetail
  @date: 2020/3/13-15:48
-->
<template>
  <div>
    <pdf :pdf-url="pdfUrl" />
    <div class="p16-0">
      澄清函附件：
      <downloadFile :data="upLoadData" />
    </div>
    <!--保存按钮-->
    <!--工作流进入不显示-->
    <div v-if="!flowStatus" class="but_footer">
      <div class="but_footer-h" />
      <div class="but_footer-but">
        <el-button @click="back">
          返 回
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
/* api*/
import { readImageRoot } from '@api/common/uploadCenter'
import { getFileDetail } from '@/api/common/uploadCenter'
/* 混合开发方法-参数字段*/
import { clarificationMixin } from '../../mixins/clarificationMixin'// 澄清质疑-公用参数
/* 组件*/
import pdf from '@comp/common/pdf/pdf'
import downloadFile from '@comp/common/updownload/downloadFile'
export default {
  name: 'ClarificationPdfDetail',
  components: {
    pdf,
    downloadFile
  },
  mixins: [clarificationMixin],
  data() {
    return {
      readImageUrl: readImageRoot, // 预览图片
      pdfUrl: ''
    }
  },
  created() {
    // 获取公告内容pdf
    this.getBulletinContentPdf()
  },
  methods: {
    // 返回
    back() {
      this.$router.push({
        path: '/bidding/projectDrive/clarification/clarificationList',
        query: {
          ...this.$route.query
        }
      })
    },
    // 获取公告内容
    getBulletinContentPdf() {
      getFileDetail(this.clarificationContentData).then(response => {
        const url = this.readImageUrl + response.data[0].path
        this.pdfUrl = encodeURIComponent(url)
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped>

</style>
