<!--
  @description: 代理机构-招标文件查看/资审文件查看-公共
  @Modifier: 肖文龙
  @routerPath:/bidding/tenderDocInfo-detail
  @date: 2020/1/13-15:20
-->
<template>
  <div>
    <!--flowStatus true 工作流进入 不显示标题-->
    <section v-if="!flowStatus" class="title p0-16 clearfix">
      <!--待审核查看项目信息-->
      <template v-if="backType === '00'">
        <div class="title-back pointer" @click="back">
          <i class="iconfont icon-fanhui mr10" />资审文件列表
        </div>
      </template>
      <!--待审核查看项目信息-->
      <template v-if="backType === '01'">
        <div class="title-back pointer" @click="back">
          <i class="iconfont icon-fanhui mr10" />招标文件列表
        </div>
      </template>
      <!--审核通过进入项目查看-->
      <template v-if="backType === '02' || backType === '03'">
        <div class="title-back pointer" @click="back">
          <i class="iconfont icon-fanhui mr10" />返回
        </div>
      </template>
    </section>
    <div class="p0-16 pt16 mb16">
      <!--招标文件-->
      <pdf :pdf-url="pdfUrl" />
      <div class="page-title">
        {{ dict.examinationFileName }}文件附件
      </div>
      <downloadFile :data="bidAccessory" />
    </div>
  </div>
</template>

<script>
/* api*/
import { readImageRoot, getFileDetail } from '@/api/common/uploadCenter'
/* 混合开发*/
import { tenderDoc } from './../mixins/tenderDoc'// 招标文件/资审文件
// 组件
import pdf from '@comp/common/pdf/pdf'
export default {
  name: 'TenderDocInfoDetail',
  components: {
    pdf
  },
  mixins: [tenderDoc],
  data() {
    return {
      readImageRoot: readImageRoot, // 预览
      backType: this.$route.query.backType,
      procfileId: this.$route.query.procfileId,
      pdfUrl: '', // pdf查看
      // 字典标题
      dict: {
        wjmc: '', // 文件名称
        fjmc: '' // 附件名称
      }
    }
  },
  created() {
    this.initFile()// 查询文件
    if (this.backType === '00' || this.backType === '03') {
      this.dict.wjmc = '资审文件'
      this.dict.fjmc = '资审文件名称'
    } else {
      this.dict.wjmc = '招标文件'
      this.dict.fjmc = '招标文件名称'
    }
  },
  methods: {
    // 点击返回 00 返回资审文件列表 01 招标文件列表 02运维审核招标列表 03 运维审核资审文件列表
    back() {
      if (this.backType === '00') {
        this.$router.push({
          path: '/bidding/tenderZswjDocFileList'
        })
      } else if (this.backType === '01') {
        this.$router.push({
          path: '/bidding/tenderDocFileList'
        })
      } else if (this.backType === '02') {
        this.$router.push({
          path: '/projectManagement/tenderDocFileAudit'
        })
      } else if (this.backType === '03') {
        this.$router.push({
          path: '/projectManagement/tenderInformationDocFileAudit'
        })
      }
    },
    //  查询文件
    initFile() {
      getFileDetail(this.bidFileData).then(response => {
        const url = this.readImageRoot + response.data[0].path// 路径地址
        this.pdfUrl = encodeURIComponent(url)// 预览pdf
      }).catch(() => {
      })
    }
  }
}
</script>
<style lang="less" scoped>

</style>

