<!--
  @description: 供应商-采购方澄清列表
  @Modifier: 杨胜国
  @routerPath:/procurement/procurementDriveSupplier/procClarificationSupplier/procClarificationSupList
  @date: 2021-02-08 16:52:17
-->
<template>
  <section>
    <div>
      <el-table
        v-loading="loading"
        :data="tableData"
        width="100%"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          label="澄清标题"
          prop="clarificationTitle"
          align="left"
          min-width="200"
        />
        <el-table-column
          prop="clarificationSendTime"
          align="center"
          label="澄清发送时间"
          min-width="160"
        >
          <template slot-scope="scope">
            {{ scope.row.clarificationSendTime && $Moment(scope.row.clarificationSendTime).format(momentDateTime) }}
          </template>
        </el-table-column>
        <el-table-column
          prop="clarificationType"
          align="center"
          label="类型"
          min-width="120"
        >
          <template slot-scope="scope">
            <span v-for="(item,index) in clarificationTypeList" v-if="scope.row.clarificationType===item.typecode" :key="index" :class="item.class">
              {{ item.typename }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="操作"
          align="center"
          min-width="120"
        >
          <template slot-scope="scope">
            <!-- receiptStatus 00 未回执 01 已回执 -->
            <el-link
              v-if="scope.row.receiptStatus === '00'"
              type="primary"
              @click.stop="receipt(scope.row)"
            >
              [回执]
            </el-link>
            <el-link
              v-if="scope.row.receiptStatus === '01'"
              type="primary"
              @click.stop="preview(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="loadData" />
    </div>
    <!--流程追踪查看弹框-->
    <flow-detail-dialog ref="tracingFlow" />
  </section>
</template>

<script>
/* 接口*/
import { listClarificationOfSupplierPages } from '@/api/procurement/procurementProject'// 澄清
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import flowDetailDialog from '@views/work/process/flowDetail-dialog' //  流程追踪组件
import { clarificationGroupMixin } from '../mixins/clarificationGroupMixin'// 澄清质疑-字典信息
export default {
  name: 'ClarificationQuestionList',
  components: {
    pagination, // 分页
    flowDetailDialog
  },
  // clarificationGroupMixin
  mixins: [ListMixin, clarificationGroupMixin],
  inject: ['getTenderBase'],
  data() {
    return {
      tenderBase: this.getTenderBase(), // 项目信息
      clarificationConfigType: this.$store.getters.systemConfigVo.configType, // true走工作流 false隐藏流程追踪
      loading: true,
      tableData: []
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
  },
  methods: {
    // 获取数据
    loadData() {
      const params = {
        packId: this.tenderBase.packId,
        pageNo: this.paginationData.pageNo,
        pageSize: this.paginationData.pageSize
      }
      listClarificationOfSupplierPages(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {

      })
    },
    // 回执
    receipt(row) {
      this.$router.push({
        name: 'procClarificationAdd',
        params: {
          clarificationId: row.clarificationId // 澄清问题Id
        }
      })
    },
    // 查看
    preview(row) {
      this.$router.push({
        name: 'procClarificationDetail',
        params: {
          clarificationId: row.clarificationId, // 澄清问题Id
          clarificationReceiptId: row.clarificationReceiptId // 澄清回执id(附件ID)
        }
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
