From 5e04fffec62ab30da05891310df8f075a3b0cbcc Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Wed, 4 Feb 2026 17:07:36 +0800 Subject: [PATCH] f --- apps/web-antd/src/api/platform-user/index.ts | 4 ++- apps/web-antd/src/views/platform-user/data.ts | 28 +++++++++++++++++++ .../src/views/platform-user/modules/form.vue | 12 ++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/apps/web-antd/src/api/platform-user/index.ts b/apps/web-antd/src/api/platform-user/index.ts index 47a2a14..1e1303d 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; } @@ -23,6 +24,7 @@ export namespace PlatformUserApi { nickname: string; info: string; inside: number; + disable: number; // 0-正常 1-封禁 } } @@ -44,7 +46,7 @@ async function getPlatformUserList(params: Recordable) { * @param data 用户数据 */ async function updatePlatformUser( - id: number, + id: string, data: PlatformUserApi.UpdatePlatformUserRequest, ) { return requestClient.put(`/platform_user/update/${id}`, data); diff --git a/apps/web-antd/src/views/platform-user/data.ts b/apps/web-antd/src/views/platform-user/data.ts index f7fcf03..9b60ffd 100644 --- a/apps/web-antd/src/views/platform-user/data.ts +++ b/apps/web-antd/src/views/platform-user/data.ts @@ -36,6 +36,16 @@ export function useFormSchema(): VbenFormSchema[] { }, defaultValue: 0, }, + { + component: 'Switch', + fieldName: 'disable', + label: '是否封禁', + componentProps: { + checkedValue: 1, + unCheckedValue: 0, + }, + defaultValue: 0, + }, ]; } @@ -64,6 +74,18 @@ export function useGridFormSchema(): VbenFormSchema[] { ], }, }, + { + component: 'Select', + fieldName: 'disable', + label: '是否封禁', + componentProps: { + allowClear: true, + options: [ + { label: '正常', value: 0 }, + { label: '封禁', value: 1 }, + ], + }, + }, { component: 'RangePicker', fieldName: 'create_time', @@ -104,6 +126,12 @@ export function useColumns( width: 100, formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'), }, + { + field: 'disable', + title: '是否封禁', + width: 100, + formatter: ({ cellValue }) => (cellValue === 1 ? '封禁' : '正常'), + }, { field: 'create_time', title: '创建时间', diff --git a/apps/web-antd/src/views/platform-user/modules/form.vue b/apps/web-antd/src/views/platform-user/modules/form.vue index 3a215b7..a455a4a 100644 --- a/apps/web-antd/src/views/platform-user/modules/form.vue +++ b/apps/web-antd/src/views/platform-user/modules/form.vue @@ -25,10 +25,18 @@ const [Drawer, drawerApi] = useVbenDrawer({ const { valid } = await formApi.validate(); if (!valid) return; const values = await formApi.getValues(); + // 显式构建 payload,确保 disable 等字段始终传递(避免 0 被序列化省略) + const payload: PlatformUserApi.UpdatePlatformUserRequest = { + mobile: values?.mobile ?? '', + nickname: values?.nickname ?? '', + info: values?.info ?? '', + inside: values?.inside === 1 ? 1 : 0, + disable: values?.disable === 1 || values?.disable === true ? 1 : 0, + }; drawerApi.lock(); updatePlatformUser( - id.value, - values as PlatformUserApi.UpdatePlatformUserRequest, + String(id.value), + payload, ) .then(() => { emit('success');