<!--
  @description: 供应商-澄清答疑-异议
  @Modifier: 杨胜国
  @routerPath:/procurement/procurementDriveSupplier/procClarificationQuestionSupplier/procObjectionList
  @date: 2021-02-08 10:31:37
  isCanOperate: true可以操作 false不可以查看只有查看权限
-->
<template>
  <section>
    <el-button
      type="primary"
      class="mb10"
      @click="addeClarification"
    >
      提出问题
    </el-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="packNo"
          align="left"
          min-width="200"
        />
        <el-table-column
          prop="submitQuestionTime"
          align="center"
          label="问题提出时间"
          width="160"
        />
        <el-table-column
          label="问题描述"
          header-align="center"
          prop="questionDescribe"
          min-width="230"
        />
        <el-table-column
          label="状态"
          prop="useStatus"
          align="center"
          width="100"
        >
          <template slot-scope="scope">
            <span v-for="(item,index) in bidderStatusList" v-if="scope.row.useStatus===item.typecode" :key="index">
              {{ item.typename }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="操作"
          align="center"
          width="120"
        >
          <template slot-scope="scope">
            <el-link
              type="primary"
              @click.stop="preview(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="loadData" />
    </div>
  </section>
</template>

<script>
/* 接口*/
import { listClarificationQuestionOfSupplierPages } from '@/api/procurement/procurementProject'// 澄清
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { clarificationGroupMixin } from '../mixins/clarificationGroupMixin'// 澄清质疑-字典信息
export default {
  name: 'ProcClarificationQuestionList',
  components: {
    pagination// 分页
  },
  inject: ['getTenderBase'],
  mixins: [ListMixin, clarificationGroupMixin],
  data() {
    return {
      tenderBase: this.getTenderBase(), // 项目信息
      loading: true,
      tableData: [], // 列表数据
      selectionData: []// 已选的数据
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
  },
  methods: {
    // 获取数据
    loadData() {
      const params = {
        packId: this.tenderBase.packId,
        pageNo: this.paginationData.pageNo,
        pageSize: this.paginationData.pageSize
      }
      listClarificationQuestionOfSupplierPages(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
        for (let i = 0; i < this.tableData.length; i++) {
          // 问题提出时间
          if (this.tableData[i].submitQuestionTime) {
            this.tableData[i].submitQuestionTime = this.$Moment(this.tableData[i].submitQuestionTime).format(this.momentDateTime)
          }
        }
      }).catch(() => {

      })
    },
    // 新增-提出问题
    addeClarification() {
      // router-跳转
      this.$router.push({
        name: 'procObjectionAdd',
        params: {
          packId: this.tenderBase.packId,
          packName: this.tenderBase.packName,
          packNo: this.tenderBase.packNo,
          tenderId: this.tenderBase.tenderId
        }
      })
    },
    // 查看
    preview(row) {
      this.$router.push({
        name: 'procObjectionDetail',
        params: {
          questionId: row.questionId // 澄清问题Id
        }
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
