<!--
  @description: 报名审核/报名审核列表
  @Modifier: 张慢慢
  @routerPath: /projectManagement/tenderApplyAudit-list
  @date: 2021/07/08-16:05
-->
<template>
  <div>
    <table-crud
      ref="tableCrud"
      :search-form="searchForm"
      :tabs="auditStatusList"
      search-label-width="100px"
      :menu="true"
      @on-load="loadData"
    >
      <template v-slot:header>
        报名审核列表
      </template>
      <template v-slot:search="">
        <el-form-item label="项目编号" prop="tenderNo">
          <el-input v-model.trim="searchForm.tenderNo" placeholder="招标项目编号" style="width:268px" />
        </el-form-item>
        <el-form-item label="招标项目名称" prop="tenderName">
          <el-input v-model.trim="searchForm.tenderName" placeholder="招标项目名称" style="width:268px" />
        </el-form-item>
      </template>
      <template v-slot:menuLeft>
        <el-button v-if="auditStatus === '00'" type="primary" @click="handBatchAudit">
          批量审核
        </el-button>
      </template>
      <template v-slot:GXTable>
        <el-table
          ref="smallTable"
          v-loading="loading"
          :data="tableData"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
            type="index"
            label="序号"
            align="center"
            width="60"
          />
          <el-table-column
            label="招标项目编号"
            header-align="center"
            prop="tenderNo"
            min-width="180"
          />
          <el-table-column
            header-align="center"
            prop="tenderName"
            label="招标项目名称"
            min-width="230"
          />
          <el-table-column
            header-align="center"
            prop="supplierName"
            label="供应商名称"
            min-width="230"
          />
          <el-table-column
            header-align="center"
            label="标段（包）编号"
            prop="packNo"
            align="left"
            min-width="200"
          />
          <el-table-column
            header-align="center"
            label="联系人"
            prop="linker"
            align="left"
            min-width="100"
          />
          <el-table-column
            header-align="center"
            label="联系电话"
            prop="linkerPhone"
            align="left"
            min-width="110"
          />
          <el-table-column
            header-align="center"
            label="报名时间"
            prop="createTime"
            align="left"
            min-width="150"
          />
          <el-table-column
            header-align="center"
            label="审核状态"
            prop="auditStatus"
            align="center"
            min-width="130"
          >
            <template slot-scope="scope">
              {{ scope.row.auditStatus==='00'?'待审核':'审核通过' }}
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" fixed="right" width="80">
            <template slot-scope="scope">
              <el-link
                v-if="auditStatus === '00'"
                type="primary"
                @click="audit(scope.row)"
              >
                [审核]
              </el-link>
              <el-link
                v-if="auditStatus === '01'"
                type="primary"
                @click="audit(scope.row)"
              >
                [查看]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </table-crud>
    <batchAuditDialog ref="batchAuditDialog" @batchAuditInfo="batchAuditInfo" />
  </div>
</template>
<script>
/* api*/
import { getSignupAuditList } from '@api/bidding/biddocfee'
/* 混入方法*/
import { initGroupMixin } from '@/mixins/initGroupMixin' // 公共tabs切换页数据list
/* 公共方法 */
/* 组件 */
import batchAuditDialog from './batchAudit-dialog' // 批量审核
export default {
  name: 'TenderApplyAuditList',
  components: {
    batchAuditDialog
  },
  mixins: [initGroupMixin],
  data() {
    return {
      loading: false,
      searchForm: {
        auditStatus: '', // 审批状态 00审核中,02驳回,01通过
        tenderName: '', // 项目名称
        tenderNo: '' // 项目编号
      },
      tableData: [], // 列表
      auditStatus: '', // 00待审核 01已审核
      selectData: [] // 勾选数据
    }
  },
  created() {
  },
  methods: {
    // 审核
    audit(row) {
      this.$router.push({
        name: 'TenderApplyAudit-detail',
        params: {
          auditStatus: this.auditStatus, // 审核状态00待审核 01已审核
          signupId: row.signupId// 报名Id
        }
      })
    },
    // 获取招标文件列表数据
    loadData(params, callback, tabData) {
      this.auditStatus = tabData.typecode // 审核状态
      params.auditStatus = tabData.typecode
      getSignupAuditList(params).then(response => {
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {

      })
    },
    // 批量审核
    handBatchAudit() {
      if (this.selectData.length > 0) {
        this.$refs.batchAuditDialog.open(this.selectData)
      } else {
        this.$message({
          type: 'warning',
          message: '请选择要审核的数据'
        })
      }
    },
    // 多选
    handleSelectionChange(data) {
      this.selectData = data
    },
    // 批量审核成功
    batchAuditInfo(data) {
      if (data) {
        this.$refs.tableCrud.onSearchChange() // 刷新列表
      }
    }
  }
}
</script>

<style lang="less">

</style>
