import type { VxeGridProps } from '#/adapter/vxe-table';

import { normalizeLogTimeFilters } from '../../shared/normalizeLogFilters';
import { getPatientCallLogList } from '../api';

export const gridOptions: VxeGridProps<any> = {
  columns: [
    { field: 'id', title: 'ID', width: 80 },
    { field: 'up_id', title: '就诊人ID', width: 100 },
    { field: 'phone', title: '电话', width: 120 },
    { field: 'caller_role_txt', title: '拨打角色', width: 110 },
    { field: 'store_id', title: '门店ID', width: 90 },
    { field: 'result_txt', title: '结果', width: 90 },
    { field: 'tags', title: '标签', minWidth: 120 },
    { field: 'conclusion', title: '结论', minWidth: 140 },
    { field: 'call_at', title: '拨号时间', width: 170 },
    { title: '操作', width: 90, fixed: 'right', slots: { default: 'action' } },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) =>
        getPatientCallLogList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...normalizeLogTimeFilters(formValues || {}),
        }),
    },
  },
  height: 'auto',
  toolbarConfig: { search: true, refresh: true, zoom: true },
};
