feat: 基本信息

This commit is contained in:
2025-10-17 17:43:42 +08:00
parent 3c7473f8d1
commit 263a7d3e20
20 changed files with 1745 additions and 492 deletions

View File

@@ -2,7 +2,12 @@ import type { ProFormColumnsType } from '@ant-design/pro-components';
import { BetaSchemaForm } from '@ant-design/pro-components';
import { Button, type ColProps, Drawer, Space } from 'antd';
import type { FormInstance } from 'antd/lib';
import React, { forwardRef, useImperativeHandle } from 'react';
import React, {
Children,
cloneElement,
forwardRef,
useImperativeHandle,
} from 'react';
interface ConfigurableDrawerFormProps {
title?: string;
@@ -56,7 +61,17 @@ const ConfigurableDrawerForm = forwardRef<
},
close: () => setOpen(false),
}));
const renderChildren = () => {
return Children.map(children, (child) => {
if (React.isValidElement(child)) {
// 使用更安全的方式传递属性,避免 TypeScript 错误
return cloneElement(child, {
...formData,
} as any);
}
return child;
});
};
const handleSubmit = async () => {
try {
if (onSubmit) {
@@ -75,7 +90,7 @@ const ConfigurableDrawerForm = forwardRef<
setLoading(false);
}
};
console.log(footer);
return (
<Drawer
title={title}
@@ -122,7 +137,8 @@ const ConfigurableDrawerForm = forwardRef<
submitter={false}
/>
) : (
children
renderChildren()
// children
)}
</Drawer>
);