1.优化后台菜单页面

This commit is contained in:
2026-06-24 16:55:04 +08:00
parent ceb4386440
commit 58b22cfb64
6 changed files with 114 additions and 37 deletions

View File

@@ -37,6 +37,8 @@ export const getCellValue = (row: TableRow, field: TableColumn, column: TableCol
return cellValue
}
type DefaultOptButType = 'weigh-sort' | 'edit' | 'delete'
/*
* 默认按钮组
*/
@@ -138,4 +140,29 @@ export const invokeTableContextDataFun = <T>(
return fun
}
type DefaultOptButType = 'weigh-sort' | 'edit' | 'delete'
/** 操作列单个按钮占位宽度px */
export const OPERATE_BUTTON_WIDTH = 40
/**
* 根据按钮数量计算操作列宽度
*/
export const getButtonsColumnWidth = (buttons?: OptButton[]): number => {
const count = buttons?.length ?? 1
return count * OPERATE_BUTTON_WIDTH
}
/**
* 统一操作列:右侧固定,宽度 = 按钮数 × OPERATE_BUTTON_WIDTH
*/
export const normalizeButtonsColumn = (column: TableColumn): TableColumn => {
if (column.render !== 'buttons') {
return column
}
const className = column.className ? `${column.className} ba-table-operate-column` : 'ba-table-operate-column'
return {
...column,
fixed: 'right',
width: getButtonsColumnWidth(column.buttons),
className,
}
}