<!--
  @description: 查看范本详情
  @Modifier: sunxinman
  @routerPath:
  @date: 2020/04/10-15:50
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogData.dialog"
    :close-on-click-modal="false"
    :title="title"
    width="700px"
    custom-class="el-dialog__body-p0"
    top="calc((100vh - 611px) / 2)"
  >
    <section class="main mb10">
      <table class="tableData">
        <tr>
          <td>文件名称</td>
          <td colspan="3">
            {{ formData.templateName }}
          </td>
        </tr>
        <tr>
          <td>模板类型</td>
          <td>
            <span
              v-for="(item, index) in templateTypeList"
              v-if="formData.templateType === item.typecode"
              :key="index"
            >{{ item.typename }}</span>
          </td>
          <td>专业类型</td>
          <td>
            <span
              v-for="(item, index) in projectClassificationList"
              v-if="formData.industryType === item.typecode"
              :key="index"
            >{{ item.typename }}</span>
          </td>
        </tr>
        <tr>
          <td>版本号</td>
          <td>{{ formData.versionNumber }}</td>
          <td style="white-space: nowrap">
            是否显示投标文件结构
          </td>
          <td>
            <span
              v-for="(item, index) in showDocList"
              v-if="formData.isShowBiddingDocumentStructure === item.typecode"
              :key="index"
            >{{ item.typename }}
            </span>
          </td>
        </tr>
        <tr>
          <td>说明</td>
          <td colspan="3">
            {{ formData.remark }}
          </td>
        </tr>
        <tr>
          <td>附件</td>
          <td colspan="3">
            <downloadFile
              ref="upload"
              :data="upLoadData"
              :down-load="true"
            />
          </td>
        </tr>
      </table>
    </section>
  </el-dialog>
</template>

<script>
/* 公共参数*/
import { templateLibrary } from './mixins/templateLibraryMixin'
import { templateGroupMixin } from './mixins/templateGroupMixin'
/* 组件*/
import downloadFile from '@comp/common/updownload/downloadFile'// 文件查看
/* 接口 */
import { getTemplateLibraryById } from '@/api/common/tools.js'
export default {
  name: 'TemplateDetailDialog',
  components: {
    downloadFile
  },
  mixins: [templateLibrary, templateGroupMixin],
  props: {
    // 弹框展示状态
    dialogData: {
      type: Object,
      default: function() {

      }
    }
  },
  data() {
    return {
      title: '查看范本', // 弹框标题
      formData: {
        id: '',
        templateName: '', // 文件名称
        industryType: '01', // 专业类型
        isShowBiddingDocumentStructure: '00', // 是否显示投标文件结构 00否；01是
        templateType: '00', // 模板类型
        remark: '', // 说明
        versionNumber: '', // 版本号
        templateStatus: '00' // 模板状态 00未上传 01已上传
      }
    }
  },
  mounted() {
    this.getTemplateLibraryById(this.dialogData.id)
  },
  methods: {
    // 获取详情
    getTemplateLibraryById(id) {
      getTemplateLibraryById(id).then(res => {
        if (res.header.ret === '0') {
          this.formData = { ...res.data }
          this.upLoadData.bizId = this.formData.id
        }
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
