<!--
  @description: 变更采购方式审核列表
  @Modifier: 肖文龙
  @routerPath: /projectManagement/changePurchaseAudit-list
  @date: 2020/12/24
-->
<template>
  <table-crud
    ref="tableCrud"
    :search-form="searchForm"
    :tabs="auditStatusList"
    search-label-width="120px"
    @on-load="loadData"
  >
    <template v-slot:header>
      变更采购方式审核列表
    </template>
    <template v-slot:search="">
      <el-form-item label="招标项目名称">
        <el-input v-model.trim="searchForm.tenderName" placeholder="招标项目名称" />
      </el-form-item>
    </template>
    <template v-slot:GXTable>
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          align="center"
          width="60"
        />
        <!-- <el-table-column
          label="变更采购方式公告"
          header-align="center"
          prop="title"
          min-width="230"
        /> -->
        <el-table-column
          header-align="center"
          prop="tenderName"
          label="招标项目名称"
          min-width="230"
        />
        <el-table-column
          header-align="center"
          label="包编号"
          prop="packNo"
          align="left"
          min-width="200"
        />
        <el-table-column label="操作" align="center" 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>
</template>
<script>
/* api */
import { waitExceptionAuditList } from '@/api/bidding/changePurchase'
import { initGroupMixin } from '@/mixins/initGroupMixin' // 公共tabs切换页数据list
export default {
  name: 'ChangePurchaseAuditList',
  mixins: [initGroupMixin],
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        tenderName: '' // 项目名称
      },
      tableData: [], // 列表
      auditStatus: '' // 00待审核 01已审核
    }
  },
  methods: {
    // 获取数据
    loadData(params, callback, tabData) {
      this.auditStatus = tabData.typecode // 审核状态
      params.auditStatus = tabData.typecode
      waitExceptionAuditList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {
        this.loading = false
      })
    },
    // 审核
    audit(row) {
      this.$router.push({
        name: 'changePurchaseAudit-detail',
        params: {
          exceptionId: row.exceptionId, // 变更采购方式id
          auditStatus: this.auditStatus // 00待审核 01已审核
        }
      })
    }
  }
}
</script>

<style lang="less">

</style>
