import { Vue } from 'vue-property-decorator'; import EtPagination from '@/EtPagination/src/index.vue'; import type { ColumnConfig } from './types'; /** * 封装 element-ui 组件库 Table 表格 * @see https://element.eleme.cn/#/zh-CN/component/table *
*
* 表头slot动态名称:prop+header 拼接 *
* {object} { column, $index } 当前列属性,列索引值 *
*
* 表格slot动态名称:prop *
* {object} { row, column, $index } 表格数据,当前列属性,列索引值 */ declare class EtTable extends Vue { private readonly table; /** * 发送请求的 axios */ private axios; /** * 发送请求的 axios 配置,优先级低于 headers * @see https://github.com/axios/axios */ private axiosConfig; /** * 表格请求接口地址 */ url: string; /** * 表格请求接口方式 */ method: string; /** * 表格创建后是否立即发送请求 */ immediate: boolean; /** * 表格请求头部 */ headers: Record; /** * 表格请求参数 */ params: Record; /** * 表格请求参数变化时,自动发送请求 */ watchParams: boolean; onParamsChange(): void; /** * 返回结果中数据字段名称 */ listField: string; /** * 返回结果中总数字段名称 */ totalField: string; /** * 处理返回原始数据函数 */ parseResponse: Function; /** * 处理返回列表数据函数 */ parseList: Function; /** * 本地数据,不需要请求接口 */ localData: Array; onLocalDataChange(): void; /** * 分页组件配置参数,参考 EtPagination 组件 * page、limit、total 自动计算,暂不支持传入 */ pagination: typeof EtPagination; /** * 展示分页组件,支持传入 true(展示)、false(不展示)、auto(有数据时展示) */ showPagination: boolean | string; private get needShowPagination(); /** * 表格列配置,支持 el-table-column 所有配置项,并增加了额外的配置项
* {
*
*    formatter: (row, column, cellValue, index) => {}, // 格式化表格数据,同 el-table-column 的 formatter *    formatType: 'timestamp', // 格式化表格数据,支持 timestamp,优先级高于 el-table-column 的 formatter
*
*    headerType: 'tip', // 表头内容类型,支持 tip
*    headerTip: '这是一个tip提示', // tip内容
*
*    contentType: 'avatar', // 表格内容类型,支持 avatar | image | link | tag | ctrl
*
*    contentType: 'avatar' | 'image' | 'link', // 需要传入string字符串
*    tagConfig: { // link展示的配置,非必填
*      type: 'primary', // 对应 el-link 的 type 属性
*      external: true, // 是否在新窗口打开链接
*    },
*    contentType: 'tag', // 需要传入string字符串或数组
*    tagConfig: { // tag展示的配置,非必填
*      type: '', // 对应 el-tag 的 type 属性。也可以传入一个函数,接收标签内容和单元格原始内容,返回属性值
*    },
*
*    contentType: 'ctrl', // 需要传入配置对象列表
*    ctrlList: { // 需要传入配置对象
*      type: '', // 类型,对应 el-link 的类型
*      icon: '', // 图标,对应 el-link 的图标类名
*      name: '', // 名称
*      show: (row, column, index) => boolean, // 是否展示
*      disabled: (row, column, index) => boolean, // 是否禁用
*      onClick: (row, column, index) => void, // 点击回调
*    },
*
*    scopeSlot: true, // 自定义表头内容,slot 动态名称:prop+header 拼接 *
*    scopeHeaderSlot: true, // 自定义表格内容,slot 动态名称:prop *
*
*    hidden: (column) => {}, // 判断是否显示该列
* }
*/ columns: Array; private data; private total; private loading; private pageIndex; private pageSize; private noop; created(): void; /** * 返回数据格式 * { * code: 0, * message: '', * data: { * total: 100, * list: [] * } * } */ private cancelToken?; private fetch; private onPageChange; /** * 格式化时间戳 */ private formatTimestamp; private formatMap; private customFormatter; /** * 刷新表格数据 * @public * @property {number} pageIndex 刷新表格数据时,指定刷新页索引 */ refresh(pageIndex?: number): void; } export default EtTable;