<template>
  <div> 
    <div class="flex-align-center flex-between mt-10">
      <el-input style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="param.content.where.condition" placeholder="搜索" @keyup.enter.native="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" clearable></el-input>
      <slot name="add"></slot>
    </div>
    <div>
      <el-table
        ref="multipleTable"
        :data="tableData"
        style="width: 100%"
        size="mini"
        border>
        <el-table-column
          prop="enterprisename"
          label="开票单位"
          width="180">
        </el-table-column>
        <el-table-column
          prop="taxno"
          label="税号"
          width="180">
        </el-table-column>
         <el-table-column
          prop="address"
          label="开票地址"
          width="90">
        </el-table-column>
        <el-table-column
          label="开户行"
          prop="bank"
          width="180">
        </el-table-column>
        <el-table-column
          label="开票账户"
          prop="bankcardno"
          width="180">
        </el-table-column>
        <el-table-column
          label="操作"
          width="90">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="selectRow(scope.row)">选 择</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div style="margin-top:16px;text-align:right">
        <el-pagination
          background
          small
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="param.content.pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props:['sys_enterpriseid'],
  data () {
    return {
      param:{
        "id": "20221217135803",
        "content": {
          "nocache":true,
          "pageNumber":1,
          "pageSize":20,
          "sys_enterpriseid":0,
          "where":{
            "condition":''
          }
        }
      },
      tableData: [],
      total:0,
      currentPage:0
    }
  },
  methods:{
    async listData () {
      this.param.content.sys_enterpriseid = this.sys_enterpriseid
      const res = await this.$api.requested(this.param)
      this.tableData = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.listData()
    },
    selectRow (row) {
      this.$emit('selectTaxRow',row)
    }
  },
  mounted () {}
}

</script>
<style>
</style>