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

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

export const gridOptions: VxeGridProps = {
  columns: [
    { field: 'id', title: '批次ID', width: 90 },
    { field: 'anchor_date', title: '锚定日', width: 120 },
    { field: 'step_txt', title: '类型', width: 110 },
    { field: 'pull_status_txt', title: '拉取状态', width: 100 },
    { field: 'total_count', title: '总数', width: 80 },
    { field: 'success_count', title: '成功', width: 80 },
    {
      field: 'failed_count',
      title: '失败',
      width: 80,
      slots: { default: 'failed_count' },
    },
    { field: 'skipped_count', title: '跳过', width: 80 },
    { field: 'callback_status_txt', title: '回调状态', width: 100 },
    { field: 'started_at', title: '开始时间', width: 160, slots: { default: 'started_at' } },
    { type: 'html', title: '操作', width: 120, slots: { default: 'action' } },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getHyTransitBatchList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        });
      },
    },
  },
  height: 'auto',
  border: false,
  toolbarConfig: {
    search: true,
    refresh: true,
    zoom: true,
  },
};
