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

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

export const gridOptions: VxeGridProps<any> = {
  columnConfig: { useKey: true },
  rowConfig: { useKey: true, isHover: true },
  columns: [
    { field: 'id', title: 'ID', width: 70 },
    { field: 'code', title: '编码', width: 120 },
    { field: 'name', title: '名称', minWidth: 140 },
    { field: 'badge_url', title: '丝带徽标', width: 160, slots: { default: 'badge' } },
    { field: 'sort', title: '排序', width: 80 },
    { field: 'status_txt', title: '状态', width: 80 },
    { field: 'updated_at', title: '更新时间', width: 170 },
    { title: '操作', slots: { default: 'action' }, width: 100, fixed: 'right' },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getVipDurationList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        });
      },
    },
  },
  border: false,
  toolbarConfig: { search: true, refresh: true, zoom: true },
};
