<template>
  <TableWrapper
    :loading="loading"
    :pagination="pagination"
    @change="onChange"
  >
    <el-table
      :data="data"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
      @select="onSelectChange"
      @select-all="onSelectChange"
    >
      <el-table-column align="center" label="" width="55" type="selection" />
      <el-table-column label="合同名称" align="center" prop="name" />
      <el-table-column label="合同编号" align="center" prop="contractNo" width="155" />
      <el-table-column label="承兑人" align="center" prop="acceptorName" />
      <el-table-column label="出票人" align="center" prop="drawersName" />
      <el-table-column label="汇票状态" align="center" prop="draftStatusText" />
      <el-table-column label="合同状态" align="center" prop="contractStatusText" />
      <el-table-column class-name="status-col" label="审核状态" align="center" prop="statusText" />
      <el-table-column align="center" label="时间" prop="createdAt" width="155" />
      <el-table-column align="center" prop="created_at" label="操作" width="250">
        <template slot-scope="scope">
          <div class="result-table-btns">
            <!-- <el-button
              type="primary"
              @click="$emit('onShow', scope.row)"
            >详情</el-button>
            <el-button
              type="primary"
              @click="$emit('onEdit', scope.row)"
            >修改</el-button>
            <el-button
              type="primary"
              @click="$emit('onDelete', scope.row)"
            >删除</el-button> -->
            <el-tag class="table-btn" type="primary" style="cursor: pointer" @click="$emit('onShow', scope.row)">详情</el-tag>
            <el-tag class="table-btn" type="success" style="cursor: pointer" @click="$emit('onEdit', scope.row)">修改</el-tag>
            <el-tag class="table-btn" type="danger" style="cursor: pointer" @click="$emit('onDelete', scope.row)">删除</el-tag>
            <el-tag class="table-btn" type="primary" style="cursor: pointer" @click="$emit('onAudit', scope.row)">审核</el-tag>
          </div>
          <!-- <el-tag type="primary" style="cursor: pointer" @click="tapDetail(scope.row.id)">查看详情</el-tag>
          <el-tag v-if="checked === 0" type="success" style="cursor: pointer" @click="Ssuccessed(scope.row.id)">
            审核成功</el-tag>
          <el-tag v-if="checked === 0" type="danger" style="cursor: pointer" @click="Sfailed(scope.row.id)">审核失败
          </el-tag>
          <el-tag v-if="checked === 1" type="success" style="cursor: pointer">恢复
          </el-tag>
          <el-tag v-if="checked === 1" type="danger" style="cursor: pointer">删除</el-tag> -->
        </template>
      </el-table-column>
    </el-table>
  </TableWrapper>
</template>

<script>

export default {
  props: {
    data: {
      type: Array,
      default() {
        return []
      }
    },
    pagination: {
      type: Object,
      default() {
        return {}
      }
    },
    loading: {
      type: Boolean,
      default() {
        return false
      }
    }
  },
  methods: {
    onChange(pagination) {
      this.$emit('filter', {
        pageIndex: pagination.pageIndex,
        pageSize: pagination.pageSize
      })
    },
    onSelectChange(rows, currentRow) {
      this.$emit('update:selectedRows', rows)
    }
  }
}
</script>
<style scoped>
.table-btn +.table-btn{
  margin-left: 5px;
}
</style>
