This commit is contained in:
Mrx
2026-02-04 17:07:36 +08:00
parent 15f83a031f
commit 5e04fffec6
3 changed files with 41 additions and 3 deletions

View File

@@ -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<any>) {
* @param data 用户数据
*/
async function updatePlatformUser(
id: number,
id: string,
data: PlatformUserApi.UpdatePlatformUserRequest,
) {
return requestClient.put(`/platform_user/update/${id}`, data);

View File

@@ -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<T = PlatformUserApi.PlatformUserItem>(
width: 100,
formatter: ({ cellValue }) => (cellValue === 1 ? '是' : '否'),
},
{
field: 'disable',
title: '是否封禁',
width: 100,
formatter: ({ cellValue }) => (cellValue === 1 ? '封禁' : '正常'),
},
{
field: 'create_time',
title: '创建时间',

View File

@@ -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');