add
Some checks failed
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled

This commit is contained in:
Mrx
2026-02-02 13:17:40 +08:00
parent db85f77ea8
commit 5a36e27370
3 changed files with 27 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ export namespace PlatformUserApi {
nickname: string; nickname: string;
info: string; info: string;
inside: number; inside: number;
disable: number; // 0可用 1禁用
create_time: string; create_time: string;
update_time: string; update_time: string;
} }
@@ -19,10 +20,11 @@ export namespace PlatformUserApi {
} }
export interface UpdatePlatformUserRequest { export interface UpdatePlatformUserRequest {
mobile: string; mobile?: string;
nickname: string; nickname?: string;
info: string; info?: string;
inside: number; inside?: number;
disable?: number; // 0可用 1禁用
} }
} }

View File

@@ -36,6 +36,18 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
defaultValue: 0, defaultValue: 0,
}, },
{
component: 'Switch',
fieldName: 'disable',
label: '是否封禁',
componentProps: {
checkedChildren: '封禁',
unCheckedChildren: '可用',
checkedValue: 1,
unCheckedValue: 0,
},
defaultValue: 0,
},
]; ];
} }
@@ -104,6 +116,12 @@ export function useColumns<T = PlatformUserApi.PlatformUserItem>(
width: 100, width: 100,
formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'), formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'),
}, },
{
field: 'disable',
title: '是否封禁',
width: 100,
formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'),
},
{ {
field: 'create_time', field: 'create_time',
title: '创建时间', title: '创建时间',
@@ -125,9 +143,7 @@ export function useColumns<T = PlatformUserApi.PlatformUserItem>(
onClick: onActionClick, onClick: onActionClick,
}, },
name: 'CellOperation', name: 'CellOperation',
options: [ options: ['edit'],
'edit', // 默认的编辑按钮
],
}, },
field: 'operation', field: 'operation',
fixed: 'right', fixed: 'right',

View File

@@ -91,11 +91,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
function onActionClick( function onActionClick(
e: OnActionClickParams<PlatformUserApi.PlatformUserItem>, e: OnActionClickParams<PlatformUserApi.PlatformUserItem>,
) { ) {
switch (e.code) { if (e.code === 'edit') {
case 'edit': { onEdit(e.row);
onEdit(e.row);
break;
}
} }
} }