更新环境配置,修正服务地址,调整表格操作按钮可见性逻辑

This commit is contained in:
2025-12-18 19:34:09 +07:00
parent df876ffc3c
commit 01a61dbb27
7 changed files with 31 additions and 45 deletions

View File

@@ -6,8 +6,13 @@ import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
import type { safeClient } from '@/service/api';
import type TableBase from './table-base.vue';
export type TableActionButtonProps = Partial<ButtonProps> & {
contentText: string;
visible?: boolean;
};
export type TableBaseExpandColumn<T = InternalRowData> = {
operations?: (row: T) => Array<Partial<ButtonProps> & { contentText: string }>;
operations?: (row: T) => Array<TableActionButtonProps>;
key: string;
title: string;
};
@@ -49,7 +54,10 @@ export function transformColumns<T = InternalRowData>(columns: TableBaseColumns<
render: col.operations
? (row: T) =>
h(NSpace, null, {
default: () => col.operations!(row).map(item => h(NButton, item, { default: () => item.contentText }))
default: () =>
col.operations!(row)
.filter(item => item.visible !== false)
.map(item => h(NButton, item, { default: () => item.contentText }))
})
: (col as any).render
} as TableBaseColumn<T>;