From 1df9236a531a354cb8d6c4181bf9963757a43fa9 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 5 Feb 2025 13:20:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E9=94=99=E8=AF=AF=E7=9A=84status=20disabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ .../src/views/system/client/client-drawer.vue | 20 +++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) 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); },