diff --git a/CHANGELOG.md b/CHANGELOG.md index 8575978f..95864559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 1.2.1 + +# BUG FIXES + +- 客户端管理 错误的status disabled + # 1.2.0 **REFACTOR** diff --git a/apps/web-antd/src/views/system/client/client-drawer.vue b/apps/web-antd/src/views/system/client/client-drawer.vue index 6ba88e67..bcbed4ec 100644 --- a/apps/web-antd/src/views/system/client/client-drawer.vue +++ b/apps/web-antd/src/views/system/client/client-drawer.vue @@ -55,6 +55,14 @@ function setupForm(update: boolean) { ]); } +// 提取生成状态字段Schema的函数 +const getStatusSchema = (disabled: boolean) => [ + { + componentProps: { disabled }, + fieldName: 'status', + }, +]; + const [BasicDrawer, drawerApi] = useVbenDrawer({ onCancel: handleCancel, onConfirm: handleConfirm, @@ -70,15 +78,11 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({ if (isUpdate.value && id) { const record = await clientInfo(id); // 不能禁用id为1的记录 - formApi.updateSchema([ - { - componentProps: { - disabled: record.id === 1, - }, - fieldName: 'status', - }, - ]); + formApi.updateSchema(getStatusSchema(record.id === 1)); await formApi.setValues(record); + } else { + // 新增模式: 确保状态字段可用 + formApi.updateSchema(getStatusSchema(false)); } drawerApi.drawerLoading(false); },