UNPKG

@shencom/api

Version:
84 lines (75 loc) 2.05 kB
import type { Operate as IOperate, QueryLr as IQueryLr } from '../utils/operate'; import type { IIndexSorts, ISorts } from '../utils/sorts'; interface IQuery<P extends string = string> { /** 搜索关联 */ lr?: IQueryLr | (string & {}); /** 搜索方式 */ operate: IOperate | (string & {}); /** 搜索字段 */ prop: P; /** 搜索值 */ value: any; } type IIndexQuery<P extends string = string> = { exps: IQuery<P>[] }[]; interface IIndexInterface<T> { /** 是否第一页 */ first: boolean; /** 是否加载完 */ last: boolean; /** 当前页数 */ number: number; /** 每页个数 */ size: number; /** 总数 */ totalElements: number; /** 总页数 */ totalPages: number; /** 列表 */ content: T[]; } interface IIndexBodyInterface<P extends string = string> { /** 页数,默认: 0 */ page?: number; /** 个数,默认: 10 */ size?: number; query?: IIndexQuery<P>; sorts?: IIndexSorts<P>; } interface IExportBodyInterface { page?: number; size?: number; query?: IIndexQuery; cfg: { /** 导出模式: 0选中 | 1全部 */ mode: 0 | 1; /** 导出名称 */ name?: string; /** 导出类型 */ type: 'XLS' | 'XLSX' | 'CSV' | (string & {}); /** 导出字段名 */ cols: string[]; }; } declare namespace SC { export namespace API { /** 操作符 */ export type Operate = IOperate; /** 搜索关联 */ export type Lr = IQueryLr; /** 搜索类型 */ export type Query = IQuery; /** 筛选字段 */ export type Sorts = ISorts; /** index 接口查询参数类型 */ export type IndexQuery = IIndexQuery; /** index 接口排序参数类型 */ export type IndexSorts = IIndexSorts; /** 分页接口 */ export type IndexInterface<T = Record<string, any>> = IIndexInterface<T>; /** index 接口参数类型 */ export type IndexBodyInterface = IIndexBodyInterface; /** export 接口参数类型 */ export type ExportBodyInterface = IExportBodyInterface; } } export { SC };