/* options配置项 */ interface Loading { isLoading: boolean } export interface OptionsInterface { height?: string | number | Function maxHeight?: string | number getRowClassName?: () => string i18n?: boolean loading?: Loading | Function stripe?: boolean border?: boolean showHeader?: boolean chooseOne?: boolean mutiSelect?: boolean // 拼写错误将废弃 使用multiple multiple?: boolean reserveSelection?: boolean expand?: boolean tooltip?: boolean isHideSet?: boolean isAllList?: boolean isDrop?: boolean isColumnDrop?: boolean expandRowKeys?: string[] expandAll?: boolean treeProps?: Object headerStyle?: Object getRowStyle?: Function selectable?: (object, number) => boolean localHeaders?: boolean rowKey: string size?: string index?: boolean pageNum?: Function pageSize?: Function hasScrollBar?: boolean listSize?: number } export class Options implements Partial { rowKey = 'id' reserveSelection = false stripe = false multiple = false height = '' size = 'large' index = true isAllList = false showHeader = true isHideSet = false localHeaders = false tooltip = true isDrop = false isColumnDrop = false hasScrollBar = true listSize = 20 pageNum = () => 1 pageSize = () => 20 constructor (params: OptionsInterface) { for (const key in params) { if (params.hasOwnProperty(key)) { this[key] = params[key] } if (key === 'mutiSelect' && params[key] !== undefined) { this.multiple = params[key] as boolean } } } } /* columns配置项 */ export interface ColumnsInterface { prop: string label: string align?: string fixed?: boolean | string highlight?: string filters?: Boolean enableEdit?: Function width?: number | string minWidth?: number | string show?: Function | boolean sortable?: string | boolean render?: Function formatter?: Function type?: String filterMethod?: Function options?: Function i18n?: Boolean optionsLabel?: string optionsValue?: string useCustom?: Boolean useCascader?: Boolean queryFeature?: Boolean columns?: ColumnsInterface[] method?: Function formType?: string formShow?: Function } /* operates配置项 */ export interface operatesList { label: Function | string method: Function type?: string text?: boolean plain?: boolean show?: Function circle?: boolean icon?: string code?: string disabled?: Function | boolean loading?: Function | boolean } export interface OperatesInterface { i18n?: boolean isHiddenOperates?: Function | boolean fixed?: boolean | string width?: number | string align?: string showNumber?: boolean | number list: operatesList[] } /* list表格数据 */ export interface ListInterface { [propName: string]: any }