Skip to content

Commit

Permalink
fix:DrawerList点击确定增加表单校验
Browse files Browse the repository at this point in the history
  • Loading branch information
昔梦 committed Sep 11, 2024
1 parent 6ff699a commit 56c0327
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/form-render/src/widgets/listDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,26 @@ const TableList: React.FC<Props> = (props: any) => {
} else {
form.setFieldValue([...rootPath, indexRef.current], itemData);
}
hanldeConfirm();
handleCloseDrawer();
};

const hanldeConfirm = () => {
const handleCloseDrawer = () => {
setItemData(null);
setVisible(false);
indexRef.current = null;
};

const hanldeConfirm = () => {
form
.validateFields()
.then(res => {
handleCloseDrawer();
})
.catch(error => {
console.log('表单校验错误', error);
});
};

const columns: any = sortProperties(Object.entries(columnSchema))
.map(([dataIndex, item]) => {
const { required, title, tooltip, width, columnHidden } = item;
Expand Down Expand Up @@ -259,7 +270,7 @@ const TableList: React.FC<Props> = (props: any) => {
)}
{visible && (
<FormDrawer
{...drawerProps}
{...drawerProps}
schema={schema}
data={itemData}
widgets={widgets}
Expand Down

0 comments on commit 56c0327

Please sign in to comment.