fix: 客户端管理 错误的status disabled
This commit is contained in:
parent
049ccca3e0
commit
1df9236a53
@ -1,3 +1,9 @@
|
|||||||
|
# 1.2.1
|
||||||
|
|
||||||
|
# BUG FIXES
|
||||||
|
|
||||||
|
- 客户端管理 错误的status disabled
|
||||||
|
|
||||||
# 1.2.0
|
# 1.2.0
|
||||||
|
|
||||||
**REFACTOR**
|
**REFACTOR**
|
||||||
|
@ -55,6 +55,14 @@ function setupForm(update: boolean) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提取生成状态字段Schema的函数
|
||||||
|
const getStatusSchema = (disabled: boolean) => [
|
||||||
|
{
|
||||||
|
componentProps: { disabled },
|
||||||
|
fieldName: 'status',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const [BasicDrawer, drawerApi] = useVbenDrawer({
|
const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||||
onCancel: handleCancel,
|
onCancel: handleCancel,
|
||||||
onConfirm: handleConfirm,
|
onConfirm: handleConfirm,
|
||||||
@ -70,15 +78,11 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
|||||||
if (isUpdate.value && id) {
|
if (isUpdate.value && id) {
|
||||||
const record = await clientInfo(id);
|
const record = await clientInfo(id);
|
||||||
// 不能禁用id为1的记录
|
// 不能禁用id为1的记录
|
||||||
formApi.updateSchema([
|
formApi.updateSchema(getStatusSchema(record.id === 1));
|
||||||
{
|
|
||||||
componentProps: {
|
|
||||||
disabled: record.id === 1,
|
|
||||||
},
|
|
||||||
fieldName: 'status',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
await formApi.setValues(record);
|
await formApi.setValues(record);
|
||||||
|
} else {
|
||||||
|
// 新增模式: 确保状态字段可用
|
||||||
|
formApi.updateSchema(getStatusSchema(false));
|
||||||
}
|
}
|
||||||
drawerApi.drawerLoading(false);
|
drawerApi.drawerLoading(false);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user