<!--
  @description: 变更公告内容
  @Modifier: haoFx
  @routerPath:
  @date: 2020/1/7-16:18
-->
<template>
  <div>
    <pdf :pdf-url="pdfUrl" />
    <div v-show="isShow" class="view mb16">
      <div class="page-title">
        变更公告附件
      </div>
      <downloadFile ref="downloadFile" :data="upLoadData" @file="fileList" />
    </div>
  </div>
</template>

<script>
/* api*/
import { readImageRoot } from '@api/common/uploadCenter'
import { getFileDetail } from '@/api/common/uploadCenter'
/* 组件*/
import downloadFile from '@comp/common/updownload/downloadFile' // 获取附件信息 下载组件
import pdf from '@comp/common/pdf/pdf'
/* 混入公共方法 */
import { changeBulletinCommon } from './mixins/changeBulletinCommon'
export default {
  name: 'MakeTenderingBulletinPdfDetail',
  components: {
    downloadFile, // 文件下载
    pdf
  },
  mixins: [changeBulletinCommon],
  data() {
    return {
      readImageUrl: readImageRoot, // 预览图片
      pdfUrl: '',
      flowList: [], // 流程信息
      isShow: true // 是否展示附件
    }
  },
  created() {
    // 变更公告id
    this.upLoadData.bizId = this.changeBulletinId
    this.bulletinContentData.bizId = this.changeBulletinId
  },
  mounted() {
    // 获取公告内容pdf
    this.getBulletinContentPdf()
  },
  methods: {
    // 获取公告内容
    getBulletinContentPdf() {
      getFileDetail(this.bulletinContentData).then(response => {
        const url = this.readImageUrl + response.data[0].path
        this.pdfUrl = encodeURIComponent(url)
      }).catch(() => {
      })
    },
    fileList(file) {
      if (file && file.length <= 0) {
        this.isShow = false
      }
    }
  }
}
</script>

<style scoped lang="less">

</style>
