2022-03-10 09:47:29 +08:00
|
|
|
|
// 用于配置某些组件的常规配置,而无需修改组件
|
2021-10-20 14:32:09 +08:00
|
|
|
|
|
|
|
|
|
import type { SorterResult } from '../components/Table';
|
|
|
|
|
|
|
|
|
|
export default {
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 表格配置
|
2021-10-20 14:32:09 +08:00
|
|
|
|
table: {
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 表格接口请求通用配置,可在组件prop覆盖
|
|
|
|
|
// 支持 xxx.xxx.xxx格式
|
2021-10-20 14:32:09 +08:00
|
|
|
|
fetchSetting: {
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 传给后台的当前页字段
|
2021-10-20 14:32:09 +08:00
|
|
|
|
pageField: 'pageNo',
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 传给后台的每页显示多少条的字段
|
2021-10-20 14:32:09 +08:00
|
|
|
|
sizeField: 'pageSize',
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 接口返回表格数据的字段
|
2021-10-20 14:32:09 +08:00
|
|
|
|
listField: 'records',
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 接口返回表格总数的字段
|
2021-10-20 14:32:09 +08:00
|
|
|
|
totalField: 'total',
|
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 可选的分页选项
|
2021-10-20 14:32:09 +08:00
|
|
|
|
pageSizeOptions: ['10', '50', '80', '100'],
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 表格默认尺寸
|
|
|
|
|
defaultSize: 'middle',
|
|
|
|
|
//默认每页显示多少条
|
2021-10-20 14:32:09 +08:00
|
|
|
|
defaultPageSize: 10,
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 默认排序方法
|
2021-10-20 14:32:09 +08:00
|
|
|
|
defaultSortFn: (sortInfo: SorterResult) => {
|
|
|
|
|
const { field, order } = sortInfo;
|
2022-03-10 09:47:29 +08:00
|
|
|
|
if (field && order) {
|
|
|
|
|
let sortType = 'ascend' == order ? 'asc' : 'desc';
|
|
|
|
|
return {
|
|
|
|
|
// 排序字段
|
|
|
|
|
column: field,
|
|
|
|
|
// 排序方式 asc/desc
|
|
|
|
|
order: sortType,
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
2021-10-20 14:32:09 +08:00
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 自定义过滤方法
|
2021-10-20 14:32:09 +08:00
|
|
|
|
defaultFilterFn: (data: Partial<Recordable<string[]>>) => {
|
|
|
|
|
return data;
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 滚动组件配置
|
2021-10-20 14:32:09 +08:00
|
|
|
|
scrollbar: {
|
2022-03-10 09:47:29 +08:00
|
|
|
|
// 是否使用原生滚动样式
|
|
|
|
|
// 开启后,菜单,弹窗,抽屉会使用原生滚动条组件
|
2021-10-20 14:32:09 +08:00
|
|
|
|
native: false,
|
|
|
|
|
},
|
2022-03-10 09:47:29 +08:00
|
|
|
|
//表单配置
|
|
|
|
|
form: {
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 4 },
|
|
|
|
|
},
|
|
|
|
|
wrapperCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 18 },
|
|
|
|
|
},
|
|
|
|
|
//表单默认冒号
|
|
|
|
|
colon: true,
|
|
|
|
|
},
|
2021-10-20 14:32:09 +08:00
|
|
|
|
};
|