<!--
  @description:应答文件
  @Modifier:gmy
  @date:2020/09/22
-->
<template>
  <div class="mb16">
    <el-table :data="responseFileList" border>
      <el-table-column header-align="center" type="index" label="序号" width="60px" align="center" />
      <el-table-column prop="pdfName" label="文件名称" align="center" min-width="230">
        <template slot-scope="scope">
          <p>{{ scope.row.fileName }}</p>
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="上传时间" align="center" width="150">
        <template slot-scope="scope">
          <span>{{ scope.row.createTime && $Moment(scope.row.createTime).format(momentDateTime) }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="signatureStatus" label="签章状态" align="center">
        <template slot-scope="scope">
          {{ filterDictText(signatureStatusList, scope.row.signatureStatus) }}
        </template>
      </el-table-column> -->
      <el-table-column
        header-align="center"
        label="操作"
        align="center"
        min-width="110"
      >
        <template slot-scope="scope">
          <!-- 下载组件 -->
          <downloadFile :one-download="true" :but-type="'link'" :but-text="'[下载]'" :file-list="scope.row.fileList" style="margin-right:8px;display: inline-block;" />
          <!-- allowEdit是否显示签章删除按钮 00隐藏 01显示-->
          <!-- <el-link v-if="pageIsEdit.allowEdit==='01'" :underline="false" type="primary" size="mini" @click="setSignatureClick(scope.row)">
            [签章]
          </el-link> -->
          <el-link v-if="pageIsEdit.allowEdit==='01'&&responseOtherData.isShow" :underline="false" type="primary" size="mini" @click="deleteSignatureClick(scope.row)">
            [删除]
          </el-link>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
/* api接口 */
import { downLoadFile } from '@/api/common/uploadCenter'
/* 公共方法*/
import { filterDictText, download } from '@/assets/js/utils'
import { procurementOfferGroupMixin } from '../mixins/procurementOffGroupMixin'
import { procurementOfferMixin } from '../mixins/procurementOfferMixin'
/* 公共组件 */
import downloadFile from '@comp/common/updownload/downloadFile' // 获取附件信息 下载组件

export default {
  name: 'ProcurementOfferResonseFileCompVue',
  components: {
    downloadFile // 文件下载
  },
  mixins: [procurementOfferGroupMixin, procurementOfferMixin],
  props: {
    // 应答文件列表
    responseFileList: {
      type: Array,
      default: () => {
        return []
      }
    },
    // 点击签章事件
    setSignatureClick: {
      type: Function,
      default: function(row) {}
    },
    // 点击删除应答文件
    deleteSignatureClick: {
      type: Function,
      default: function(row) {}
    },
    pageIsEdit: {
      type: Object,
      default: () => {
        return {
          allowEdit: '' // 供应商最最新轮次报价状态
        }
      }
    },
    // 应答文件其他数据
    responseOtherData: {
      type: Object,
      default: () => {
        return {
          isShow: true
        }
      }
    }
  },
  data() {
    return {

    }
  },
  methods: {
    filterDictText,
    // 下载
    downloadFileClick(row) {
      // this.$refs.oneDownload.href = url
      this.setDownLoadFile(row)
    },
    // 文件下载请求
    setDownLoadFile(row) {
      const data = {
        fileId: row.fileId, // row.fileId, // 附件id
        fileType: this.responseFileData.fileType // 附件类型
      }
      downLoadFile(data).then(res => {
        download(res, row.fileName)
      })
    }
  }
}
</script>

<style lang="less" scoped>
@import url("~@/assets/style/common/public.less");
.prompt-text{
  color: @orange
}
</style>
