<template>
  <div>
    <PullTableSelect :inputProps="inputProps" :tableConfig="tableConfig" :apiMethod="apiMethod" :apiCallback="apiCallback"></PullTableSelect>
  </div>
</template>
<script>
import PullTableSelect from '@/components/PullTableSelect'
import { pullTableConfig1 } from '@/config/pullTableSelect'
import { getDoctorAllList } from "@/api/hospital";
export default {
  name: 'DoctorPullSelect',
  components: {
    PullTableSelect
  },
  data() {
    return {
      inputProps: {
        placeholder: "请选择医生"
      },
      tableConfig: {
        ...pullTableConfig1,
        columns: [
          {
            type: 'checkbox'
          },
          {
            field: 'doctorId',
            title: '医生ID'
          },
          {
            field: 'userName',
            title: '医生姓名'
          }
        ],
      },
      apiMethod: getDoctorAllList,
      apiCallback: (res) => {
        console.log('apiCallback', res)
        return {
          list: (res?.data || []).map(item => {
            const { userInfo, ...others } = item
            return {
              ...others,
              ...userInfo
            }
          }),
        }
      }
    }
  }
}
</script>
