<template>
  <div>
    <el-popover
      placement="bottom"
      width="100%"
      v-model="visible">
      <div>
        <div class="flex-align-center flex-between" style="margin-bottom:10px">
          <el-input style="width:200px" suffix-icon="el-icon-search" size="small" v-model="params.content.where.condition" placeholder="输入企业信息" @keyup.enter.native="queryLogisticcom(params.content.pageNumber = 1)" @clear="queryLogisticcom(params.content.pageNumber = 1)" clearable></el-input>
          <!-- <addTemp @onSuccess="queryLogisticcom"></addTemp> -->
        </div>
        <el-table
          :data="logisticcomlist"
          style="width: 100%"
          size="mini">
          <el-table-column
            prop="abbreviation"
            label="公司简称"
            width="120">
          </el-table-column>
          <el-table-column
            prop="kd100id"
            label="快递100ID"
            width="120">
          </el-table-column>
          <el-table-column
            label="操作"
            width="90">
            <template slot-scope="scope">
              <el-button type="text" @click="rowClick(scope.row)" size="mini">选 择</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="params.content.pageSize"
            layout="total, prev, pager, next, jumper"
            :total="total">
          </el-pagination>
        </div>
      </div>
      <el-input :validate-event="false" slot="reference" v-model="form.abbreviation" @focus="queryLogisticcom"  placeholder="物流公司" clearable></el-input>
    </el-popover>
  </div>
</template>

<script>
import { log } from '@antv/g2plot/lib/utils'
// import addTemp from '@/Form/EnterpriseArchives/add.vue'
export default {
  props:['ID'],
  components:{
  },
  data () {
    return {
      logisticcomlist:[],
      total:0,
      currentPage:0,
      form:{
        abbreviation:''
      },
      params:{
        "id": 20221121135804,
        "content": {
          "pageNumber": 1,
          "pageSize": 10,
          "where": {
            "condition": ''
          }
        }
      },
      visible:false
    }
  },
  methods:{
    async queryLogisticcom () {
      const res = await this.$api.requested(this.params)
      this.logisticcomlist = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
    },
    handleSizeChange(val) {
      this.params.content.pageSize = val
      this.queryLogisticcom()
    },
    handleCurrentChange(val) {
      this.params.content.pageNumber = val
      this.queryLogisticcom()
    },
    rowClick (row) {
      this.visible = false
      this.form.abbreviation = this.ID ? row.kd100id : this.abbreviation
      this.$emit('logisticRowClick',row)
    }
  },
  mounted () {
    // this.queryLogisticcom()
  }
}

</script>
<style>
</style>