feat: 表单按钮状态修改
This commit is contained in:
@ -497,3 +497,37 @@ export function changeSchemaDisabled(schemas) {
|
||||
});
|
||||
return schemas;
|
||||
}
|
||||
// 辅助设置表单可以编辑
|
||||
export function changeSchemaEnable(schemas) {
|
||||
const layoutComponents = ['tab', 'grid', 'card'];
|
||||
schemas?.map((info) => {
|
||||
if (layoutComponents.includes(info.type!)) {
|
||||
info.children?.map((childInfo) => {
|
||||
childInfo.list.map((com) => {
|
||||
if (layoutComponents.includes(com.type)) {
|
||||
changeSchemaDisabled(childInfo.list);
|
||||
} else {
|
||||
com.dynamicDisabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (info.type == 'table-layout') {
|
||||
info.children?.map((childInfo) => {
|
||||
childInfo.list.map((com) => {
|
||||
com.children.map((el) => {
|
||||
if (layoutComponents.includes(el.type) || el.type == 'table-layout') {
|
||||
changeSchemaDisabled(com.children);
|
||||
} else {
|
||||
el.dynamicDisabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (info.type == 'one-for-one') {
|
||||
changeSchemaDisabled(info.componentProps.childSchemas);
|
||||
} else {
|
||||
info.dynamicDisabled = false;
|
||||
}
|
||||
});
|
||||
return schemas;
|
||||
}
|
||||
Reference in New Issue
Block a user