<!--
  @description: 标中澄清
  @Modifier:郝定康
  @routerPath:/procurement/procurementDrive/procEvaluateClarify/procEvaluateClarifyList
  @date: 2021-02-09 16:30:05
-->
<template>
  <section>
    <!-- roleCode 11 采购员  OFF_EXPERT 评标专家-->
    <gx-button
      v-if="roleCode !=='OFF_EXPERT'"
      :code="'001_014_001'"
      type="primary"
      class="mb10"
      @click="createClarification"
    >
      创建澄清
    </gx-button>
    <div>
      <el-table
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          label="澄清标题"
          prop="bidClarificationTitle"
          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
          header-align="center"
          label="澄清家数"
          prop="clarificationSupplierNumber"
          align="right"
          min-width="200"
        />
        <el-table-column
          header-align="center"
          label="已回复家数"
          prop="replyDepartNumber"
          align="right"
          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
          header-align="center"
          label="操作"
          align="left"
          width="160"
        >
          <template slot-scope="scope">
            <gx-link
              type="primary"
              :code="'001_014_005'"
              @click.stop="preview(scope.row)"
            >
              [查看]
            </gx-link>
            <gx-link
              :code="'001_014_007'"
              type="primary"
              @click.stop="seeReceipt(scope.row)"
            >
              [查看回复机构]
            </gx-link>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="loadData" />
    </div>
  </section>
</template>

<script>
/* 接口*/
import { listBidClarificationPages } from '@/api/procurement/procurementProject'// 澄清
/* 公共方法*/
import { filterDictText } from '@/assets/js/utils' // 常用方法
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { clarificationGroupMixin } from '../../mixins/clarificationGroupMixin'// 澄清质疑-公用参数
import { clarificationMixin } from '../../mixins/clarificationMixin'// 澄清质疑-公用参数
export default {
  name: 'EvaluateClarifyList',
  components: {
    pagination// 分页
  },
  inject: ['getTenderBase'],
  mixins: [ListMixin, clarificationGroupMixin, clarificationMixin],
  data() {
    return {
      tenderBase: this.getTenderBase(), // 项目信息
      loading: true,
      tableData: []
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
  },
  methods: {
    // 字典检索
    filterDictText,
    // 获取数据
    loadData() {
      const params = {
        packId: this.tenderBase.packId,
        pageNo: this.paginationData.pageNo,
        pageSize: this.paginationData.pageSize
      }
      listBidClarificationPages(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {

      })
    },
    // 创建澄清
    createClarification() {
      this.$router.push({
        name: 'procEvaluateClarifyAdd',
        params: {
          packId: this.tenderBase.packId
        }
      })
    },
    // 查看
    preview(row) {
      // 如果是专家评标-澄清质疑 roleCode 11 采购员  OFF_EXPERT 评标专家
      if (this.roleCode === 'OFF_EXPERT') {
        this.$router.push({
          name: 'procEvaluateClarifyExpertDetail',
          params: {
            bidClarificationId: row.bidClarificationId// 澄清id
          }
        })
      } else {
        this.$router.push({
          name: 'procEvaluateClarifyDetail',
          params: {
            bidClarificationId: row.bidClarificationId// 澄清id
          }
        })
      }
    },
    // 查看回复机构
    seeReceipt(row) {
      // 如果是专家评标-澄清质疑 roleCode 11 采购员  OFF_EXPERT 评标专家
      if (this.roleCode === 'OFF_EXPERT') {
        this.$router.push({
          name: 'bidClarificationReceiptExpertDetail',
          params: {
            bidClarificationId: row.bidClarificationId, // 澄清id
            packId: this.tenderBase.packId
          }
        })
      } else {
        this.$router.push({
          name: 'bidClarificationReceiptDetail',
          params: {
            bidClarificationId: row.bidClarificationId, // 澄清id
            packId: this.tenderBase.packId
          }
        })
      }
    }
  }
}
</script>

<style scoped lang="less">

</style>
