diff --git a/apps/web-antd/src/api/platform-user/index.ts b/apps/web-antd/src/api/platform-user/index.ts index 47a2a14..370d8c0 100644 --- a/apps/web-antd/src/api/platform-user/index.ts +++ b/apps/web-antd/src/api/platform-user/index.ts @@ -9,6 +9,7 @@ export namespace PlatformUserApi { nickname: string; info: string; inside: number; + disable: number; // 0可用 1禁用 create_time: string; update_time: string; } @@ -19,10 +20,11 @@ export namespace PlatformUserApi { } export interface UpdatePlatformUserRequest { - mobile: string; - nickname: string; - info: string; - inside: number; + mobile?: string; + nickname?: string; + info?: string; + inside?: number; + disable?: number; // 0可用 1禁用 } } diff --git a/apps/web-antd/src/views/platform-user/data.ts b/apps/web-antd/src/views/platform-user/data.ts index f7fcf03..25c376b 100644 --- a/apps/web-antd/src/views/platform-user/data.ts +++ b/apps/web-antd/src/views/platform-user/data.ts @@ -36,6 +36,18 @@ export function useFormSchema(): VbenFormSchema[] { }, defaultValue: 0, }, + { + component: 'Switch', + fieldName: 'disable', + label: '是否封禁', + componentProps: { + checkedChildren: '封禁', + unCheckedChildren: '可用', + checkedValue: 1, + unCheckedValue: 0, + }, + defaultValue: 0, + }, ]; } @@ -104,6 +116,12 @@ export function useColumns( width: 100, formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'), }, + { + field: 'disable', + title: '是否封禁', + width: 100, + formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'), + }, { field: 'create_time', title: '创建时间', @@ -125,9 +143,7 @@ export function useColumns( onClick: onActionClick, }, name: 'CellOperation', - options: [ - 'edit', // 默认的编辑按钮 - ], + options: ['edit'], }, field: 'operation', fixed: 'right', diff --git a/apps/web-antd/src/views/platform-user/list.vue b/apps/web-antd/src/views/platform-user/list.vue index 115d7cd..2821b07 100644 --- a/apps/web-antd/src/views/platform-user/list.vue +++ b/apps/web-antd/src/views/platform-user/list.vue @@ -91,11 +91,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ function onActionClick( e: OnActionClickParams, ) { - switch (e.code) { - case 'edit': { - onEdit(e.row); - break; - } + if (e.code === 'edit') { + onEdit(e.row); } }