perf: 添加 序号和操作栏标题

This commit is contained in:
xingyu4j
2022-11-16 12:34:08 +08:00
parent eed6a9a689
commit f4525f7a0a
3 changed files with 9 additions and 4 deletions

View File

@ -16,9 +16,11 @@ import { ComponentOptions } from '@/types/components'
export type VxeCrudSchema = {
primaryKey?: string // 主键ID
primaryTitle?: string // 主键标题 默认为序号
primaryType?: VxeColumnPropTypes.Type // 不填写为数据库编号 还支持 "seq" | "radio" | "checkbox" | "expand" | "html" | null
action?: boolean // 是否开启操作栏插槽
actionWidth?: string // 操作栏插槽宽度一般1个 text 类型按钮 60-80
actionTitle?: string // 操作栏标题 默认为操作
actionWidth?: string // 操作栏插槽宽度一般2个字带图标 text 类型按钮 50-70
columns: VxeCrudColumns[]
}
type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
@ -169,7 +171,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
// 主键ID
if (crudSchema.primaryKey) {
const tableSchemaItem = {
title: t('common.index'),
title: crudSchema.primaryTitle ? crudSchema.primaryTitle : t('common.index'),
field: crudSchema.primaryKey,
type: crudSchema.primaryType ? crudSchema.primaryType : null,
width: '50px'
@ -202,7 +204,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
// 操作栏插槽
if (crudSchema.action && crudSchema.action == true) {
const tableSchemaItem = {
title: t('table.action'),
title: crudSchema.actionTitle ? crudSchema.actionTitle : t('table.action'),
field: 'actionbtns',
width: crudSchema.actionWidth ? crudSchema.actionWidth : '200px',
slots: {