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

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

export const gridOptions: VxeGridProps<any> = {
  columns: [
    { field: 'id', title: 'ID', width: 70 },
    { field: 'created_at', title: '时间', width: 170 },
    { field: 'user_type_txt', title: '用户类型', width: 90 },
    { field: 'user_id', title: '用户ID', width: 90 },
    { field: 'source_type_txt', title: '来源', width: 100 },
    { field: 'field_name_txt', title: '字段', width: 140 },
    { field: 'before_amount', title: '变动前', width: 110 },
    { field: 'after_amount', title: '变动后', width: 110 },
    { field: 'change_amount', title: '变动值', width: 110 },
    { field: 'order_no', title: '订单号', minWidth: 140 },
    { field: 'source_table_txt', title: '来源表', width: 120 },
    { field: 'remark', title: '备注', minWidth: 140 },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      // 走 BaseService search_time（勿转 start_time），并带 audit=1
      query: async ({ page }, formValues) =>
        getAccountAbleChangeLogAuditList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        }),
    },
  },
  height: 'auto',
  toolbarConfig: { search: true, refresh: true, zoom: true },
};
