添加用户管理

This commit is contained in:
xie7654
2025-07-01 15:08:26 +08:00
parent 57429ba359
commit 36b6a8437b
19 changed files with 686 additions and 125 deletions

View File

@@ -2,7 +2,7 @@ import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn } from '#/adapter/vxe-table';
import type { ${app_name_camel}${model_name}Api } from '#/models/$app_name/${model_name_snake}';
import type { ${app_name_camel}${model_name}Api } from '#/models/${app_name}/${model_name_snake}';
import { z } from '#/adapter/form';
import { $$t } from '#/locales';
@@ -13,66 +13,35 @@ import { format_datetime } from '#/utils/date';
*/
export function useSchema(): VbenFormSchema[] {
return [
$form_fields
${form_fields}
];
}
/**
* 获取表格列配置
* @description 使用函数的形式返回列数据而不是直接export一个Array常量是为了响应语言切换时重新翻译表头
* @param onActionClick 表格操作按钮点击事件
*/
export function useColumns(
onActionClick?: OnActionClickFn<${app_name_camel}${model_name}Api.${app_name_camel}${model_name}>,
): VxeTableGridOptions<${app_name_camel}${model_name}Api.${app_name_camel}${model_name}>['columns'] {
return [
${columns}
{
align: 'left',
field: 'id',
},
{
cellRender: {
name: 'CellTag',
options: [
{ label: $$t('common.enabled'), value: true },
{ label: $$t('common.disabled'), value: false },
],
},
field: 'status',
title: '状态',
width: 100,
},
{
field: 'remark',
title: '备注',
},
{
field: 'create_time',
title: '创建时间',
width: 180,
formatter: ({ cellValue }) => format_datetime(cellValue),
},
{
align: 'right',
align: 'center',
cellRender: {
attrs: {
nameField: 'name',
nameTitle: $$t('${app_name}.{model_name_snake}.name'),
nameTitle: $t('${app_name}.${model_name_snake}.name'),
onClick: onActionClick,
},
name: 'CellOperation',
options: [
'edit', //
{
code: 'view', // code
text: '数据', //
},
{
code: 'delete', //
},
],
options: ['edit', 'delete'],
},
field: 'operation',
field: 'action',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
title: '操作',
width: 200,
width: 120,
},
];
}