<!--
  @description: 保证金凭证审核列表
  @Modifier: 肖文龙
  @routerPath: /fee/bailfeeVoucherAudit-list
  @date: 2021/01/04
-->
<template>
  <div>
    <table-crud
      ref="tableCrud"
      :search-form="searchForm"
      search-label-width="100px"
      @on-load="loadData"
    >
      <template v-slot:header>
        待确认保证金凭证列表
      </template>
      <template v-slot:search="search">
        <el-form-item ref="tenderNo" label="招标项目编号" prop="tenderNo">
          <el-input
            v-model.trim="searchForm.tenderNo"
            placeholder="招标项目编号"
            style="width:220px"
            @keyup.enter.native="search.onSearch"
          />
        </el-form-item>
        <el-form-item ref="tenderName" label="招标项目名称" prop="tenderName">
          <el-input
            v-model.trim="searchForm.tenderName"
            style="width:220px"
            placeholder="招标项目名称"
            @keyup.enter.native="search.onSearch"
          />
        </el-form-item>
        <el-form-item ref="supplierName" label="投标人名称" prop="supplierName">
          <el-input
            v-model.trim="searchForm.supplierName"
            style="width:220px"
            placeholder="投标人名称"
            @keyup.enter.native="search.onSearch"
          />
        </el-form-item>
      </template>
      <template v-slot:GXTable>
        <el-table
          ref="smallTable"
          v-loading="loading"
          :data="tableData"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column
            prop="tenderNo"
            align="center"
            label="招标项目编号"
            width="170"
          />
          <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="160"
          />
          <el-table-column
            header-align="center"
            label="标段（包）名称"
            prop="packName"
            align="left"
            min-width="200"
          />
          <el-table-column
            header-align="center"
            label="投标人名称"
            prop="supplierName"
            min-width="230"
          />
          <el-table-column
            label="提交时间"
            align="center"
            prop="submitTime"
            width="160"
          />
          <el-table-column
            align="center"
            label="操作"
            width="60"
          >
            <template slot-scope="scope">
              <el-link
                type="primary"
                @click.stop="audit(scope.row)"
              >
                [审核]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </table-crud>
    <!-- 保证金凭证确认弹框 -->
    <bailfeeVoucherAuditDialog ref="voucherAudit" @loadData="loadData" />
  </div>
</template>
<script>
/* 接口*/
import { waitAuditBailFeeList } from '@/api/fee/bailfee.js'
/* 公用方法*/
import { filterDictText } from '@/assets/js/utils'// 常用方法
import { initGroupMixin } from '@/mixins/initGroupMixin'// 字典信息
/* 组件 */
import bailfeeVoucherAuditDialog from './bailfeeVoucherAudit-dialog'// 保证金凭证确认弹框
export default {
  name: 'BailfeeVoucherAuditList',
  components: {
    bailfeeVoucherAuditDialog// 保证金凭证确认弹框
  },
  mixins: [initGroupMixin],
  data() {
    return {
      loading: true,
      // 搜索
      createTime: [], // 创建时间 不传给后端只做回显
      searchForm: {
        auditStatus: '', // 审核状态 00:待审核 01:审核通过 02:审核不通过
        supplierName: '', // 投标人名称
        tenderName: '', // 项目名称
        tenderNo: '' // 项目编号
      },
      tableData: []
    }
  },
  created() {
  },
  methods: {
    filterDictText, // 字典值替换文本通用方法
    // 创建时间选择
    createTimeChange(val) {
      this.searchForm.createBeginTime = val[0]// 开始日期
      this.searchForm.createEndTime = val[1]// 结束日期
    },
    // 获取数据
    loadData(params, callback) {
      waitAuditBailFeeList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {
        this.loading = false
      })
    },
    // 审核
    audit(row) {
      this.$refs.voucherAudit.open(row)
    }
  }
}
</script>
<style lang="less" scoped>

</style>

