<script lang="ts" setup>
import ADropTable from '@/components/a-drop-table/ADropTable.vue'
import CustomerApi from '@/pages/cst/customer/customer-api.ts'

const props = defineProps<{
  identityCategory?: string,
}>()
const model = defineModel<string | undefined | null>()
const dropTableColumns = [
  {
    label: '账号',
    prop: 'username',
  },
  {
    label: '客户名称',
    prop: 'nickname',
  },
  {
    label: '客户电话',
    prop: 'phone',
  },
  {
    label: '企业名称',
    prop: 'orgName',
  },
]
const dropTableLoader = (param: CustomerTypes.SearchCustomerParam) => {
  return CustomerApi.paging({
    ...param,
    identityCategory: props.identityCategory,
  }).then(res => res.data)
}

</script>

<template>
  <ADropTable v-model="model"
    :columns="dropTableColumns"
    :loader="dropTableLoader"
    display-field="nickname"/>
</template>
