<!--
  @description: 项目经理澄清
  @Modifier: 郝定康
  @routerPath:/procurement/procurementDrive/procClarification/procClarificationList
  @date: 2021-02-08 16:52:17
isCanOperate: true可以操作 false不可以查看只有查看权限
-->
<template>
  <section>
    <!-- v-if="tenderBase.isCanOperate" -->
    <!-- roleCode 11 采购员  OFF_EXPERT 评标专家-->
    <gx-button
      v-if="roleCode !=='OFF_EXPERT'"
      :code="'001_013_001'"
      type="primary"
      class="mb10"
      @click="addChangeBulletin"
    >
      发布澄清
    </gx-button>
    <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="澄清发送时间"
          width="160"
        >
          <template slot-scope="scope">
            {{ scope.row.clarificationSendTime && $Moment(scope.row.clarificationSendTime).format(momentDateTime) }}
          </template>
        </el-table-column>
        <el-table-column
          prop="signUpNumber"
          align="right"
          label="参与供应商家数"
          width="120"
        />
        <el-table-column
          prop="replyDepartNumber"
          align="right"
          label="已回执家数"
          width="100"
        />
        <el-table-column
          prop="clarificationType"
          align="center"
          label="类型"
          width="100"
        >
          <template slot-scope="scope">
            {{ filterDictText(clarificationTypeList, scope.row.clarificationType) }}
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="操作"
          align="center"
          width="230"
        >
          <template slot-scope="scope">
            <!--auditStatus 01 审核通过 00 待审核-->
            <!-- v-if="scope.row.auditStatus==='01'||scope.row.auditStatus==='00'" -->
            <gx-link
              type="primary"
              :code="'001_013_004'"
              @click.stop="preview(scope.row)"
            >
              [查看]
            </gx-link>
            <!--auditStatus 01 审核通过-->
            <!-- v-if="scope.row.auditStatus==='01'" -->
            <gx-link
              type="primary"
              :code="'001_013_005'"
              @click.stop="seeReceipt(scope.row)"
            >
              [查看回执机构]
            </gx-link>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="loadData" />
    </div>
  </section>
</template>

<script>
/* 接口*/
import { listClarificationPages } 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: 'ClarificationQuestionList',
  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
      }
      listClarificationPages(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {

      })
    },
    // 新增澄清
    addChangeBulletin() {
      this.$router.push({
        name: 'procClarificationReleaseAdd',
        params: {
          packId: this.tenderBase.packId
        }
      })
    },
    // 查看
    preview(row) {
      // 答疑
      // if (row.clarificationType === '00') {
      //   this.$router.push({
      //     name: 'objectionDetail',
      //     params: {
      //       questionId: row.clarificationId
      //     }
      //   })
      // } else if (row.clarificationType === '01') {
      // 补疑
      // 如果是专家评标-澄清质疑 roleCode 11 采购员  OFF_EXPERT 评标专家
      if (this.roleCode === 'OFF_EXPERT') {
        this.$router.push({
          name: 'procClarificationReleaseExpertDetail',
          params: {
            clarificationType: row.clarificationType,
            clarificationId: row.clarificationId
          }
        })
      } else {
        this.$router.push({
          name: 'procClarificationReleaseDetail',
          params: {
            clarificationType: row.clarificationType,
            clarificationId: row.clarificationId
          }
        })
      }

      // }
    },
    // 查看回执机构
    seeReceipt(row) {
      // 如果是专家评标-澄清质疑 roleCode 11 采购员  OFF_EXPERT 评标专家
      if (this.roleCode === 'OFF_EXPERT') {
        this.$router.push({
          name: 'procClarificationReceiptExpertDetail',
          params: {
            clarificationId: row.clarificationId, // 澄清Id
            packId: this.tenderBase.packId
          }
        })
      } else {
        this.$router.push({
          name: 'procClarificationReceiptDetail',
          params: {
            clarificationId: row.clarificationId, // 澄清Id
            packId: this.tenderBase.packId
          }
        })
      }
    }
  }
}
</script>

<style scoped lang="less">

</style>
