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

import { getHyTransitRecordList } from '../../api';

export const gridOptions: VxeGridProps = {
  columns: [
    { field: 'id', title: 'ID', width: 80 },
    { field: 'batch_id', title: '批次', width: 80 },
    { field: 'step_txt', title: '类型', width: 100 },
    { field: 'register_id', title: '挂号ID', width: 90 },
    { field: 'prescription_id', title: '处方ID', width: 90 },
    { field: 'order_id', title: '订单ID', width: 90 },
    { field: 'prescription_no', title: '处方编号', width: 140 },
    { field: 'patient_name', title: '患者', width: 90 },
    { field: 'push_status_txt', title: '上报', width: 90 },
    { field: 'callback_status_txt', title: '回调', width: 90, slots: { default: 'callback_status' } },
    {
      field: 'error_summary',
      title: '校验/报错',
      minWidth: 200,
      showOverflow: true,
      slots: { default: 'error_summary' },
    },
    { field: 'callback_at', title: '回调时间', width: 160, slots: { default: 'callback_at' } },
    { type: 'html', title: '操作', width: 100, slots: { default: 'action' } },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getHyTransitRecordList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        });
      },
    },
  },
  height: 'auto',
  border: false,
  toolbarConfig: {
    search: true,
    refresh: true,
    zoom: true,
  },
};
