ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import type { SorterResult } from './types/table';
 
const tableSetting = {
  // 自定义过滤方法
  defaultFilterFn: (data: Partial<Recordable<string[]>>) => {
    return data;
  },
  // 默认每页显示多少条
  defaultPageSize: 20,
  // 默认尺寸
  defaultSize: 'small',
  // 默认排序方法
  defaultVxeSortFn: (sortInfo: SorterResult) => {
    const { field, order } = sortInfo;
 
    return field && order
      ? {
          // 排序字段
          sidx: field,
          // 排序方式 asc/desc
          sort: order,
        }
      : {};
  },
  // 表格接口请求通用配置,可在组件prop覆盖
  // 支持 xxx.xxx.xxx格式
  fetchSetting: {
    // 传给后台的当前页字段
    pageField: 'currentPage',
    // 传给后台的每页显示多少条的字段
    sizeField: 'pageSize',
    // 接口返回表格总数的字段
    totalField: 'pagination.total',
    // 接口返回表格数据的字段
    listField: 'list',
  },
  // 可选的分页选项
  pageSizeOptions: ['20', '50', '100', '500'],
};
 
const { defaultFilterFn, defaultPageSize, defaultSize, defaultVxeSortFn, fetchSetting, pageSizeOptions } = tableSetting;
 
export const ROW_KEY = 'id';
 
// Optional display number per page;
export const PAGE_SIZE_OPTIONS = pageSizeOptions;
 
// Number of items displayed per page
export const PAGE_SIZE = defaultPageSize;
 
// Common interface field settings
export const FETCH_SETTING = fetchSetting;
 
// Default Size
export const DEFAULT_SIZE = defaultSize;
 
// Configure general sort function
export const DEFAULT_VXE_SORT_FN = defaultVxeSortFn;
 
export const DEFAULT_FILTER_FN = defaultFilterFn;
 
//  Default layout of table cells
export const DEFAULT_ALIGN = 'left';
 
export const INDEX_COLUMN_FLAG = 'seq';
 
export const EXPAND_COLUMN_FLAG = 'expand';
 
export const ACTION_COLUMN_FLAG = 'action';