diff --git a/src/page/Order/AuditResult/__test__/__snapshots__/AuditResultCollection.test.tsx.snap b/src/page/Order/AuditResult/__test__/__snapshots__/AuditResultCollection.test.tsx.snap index cfbd2c0b..ef72b657 100644 --- a/src/page/Order/AuditResult/__test__/__snapshots__/AuditResultCollection.test.tsx.snap +++ b/src/page/Order/AuditResult/__test__/__snapshots__/AuditResultCollection.test.tsx.snap @@ -125,6 +125,7 @@ exports[`test AuditResultCollection should be show overview tab when showOvervie >
= (props) => { }, [pagination, filterInfo, duplicate, props.taskId, getAuditTaskSql]); return ( - +
{ await act(async () => jest.advanceTimersByTime(3000)); + await act(async () => jest.advanceTimersByTime(3000)); + fireEvent.input(screen.getByLabelText('order.sqlInfo.sql'), { target: { value: 'select * from table3' }, }); diff --git a/src/page/Order/Create/index.tsx b/src/page/Order/Create/index.tsx index 09153a2e..87567b3d 100644 --- a/src/page/Order/Create/index.tsx +++ b/src/page/Order/Create/index.tsx @@ -83,9 +83,13 @@ const CreateOrder = () => { currentTabKey: string ) => { if (values.isSameSqlOrder) { - auditOrderWithSameSql(values); + return auditOrderWithSameSql(values); } else { - auditOrderWthDifferenceSql(values, currentTabIndex, currentTabKey); + return auditOrderWthDifferenceSql( + values, + currentTabIndex, + currentTabKey + ); } }, [auditOrderWithSameSql, auditOrderWthDifferenceSql] diff --git a/src/page/Order/Detail/__snapshots__/index.test.tsx.snap b/src/page/Order/Detail/__snapshots__/index.test.tsx.snap index dc55cec0..4dab19ff 100644 --- a/src/page/Order/Detail/__snapshots__/index.test.tsx.snap +++ b/src/page/Order/Detail/__snapshots__/index.test.tsx.snap @@ -992,6 +992,7 @@ exports[`Order/Detail should get new sql audit result when update audit sql 1`] >
{ const baseRef = useRef(null); const sqlInfoRef = useRef(null); + const scrollToAuditResult = () => { + const auditResultCardElement = document.getElementById( + 'audit-result-task-card' + ); + auditResultCardElement?.scrollIntoView({ + behavior: 'smooth', + block: 'end', + }); + }; + const auditSQL: SQLInfoFormProps['submit'] = async (values) => { const baseValues = await baseForm.validateFields(); const params: ICreateSQLAuditRecordV1Params = { @@ -56,6 +66,7 @@ const SQLAuditCreate: React.FC = () => { } else { setTask(res.data.data.task); message.success(t('sqlAudit.create.SQLInfo.successTips')); + scrollToAuditResult(); } } }); @@ -75,6 +86,7 @@ const SQLAuditCreate: React.FC = () => { if (res.data.code === ResponseCode.SUCCESS) { setTask(record.task); message.success(t('sqlAudit.create.SQLInfo.successTips')); + scrollToAuditResult(); } }); }; @@ -82,6 +94,7 @@ const SQLAuditCreate: React.FC = () => { const resetForm = () => { baseRef.current?.reset(); sqlInfoRef.current?.reset(); + setTask(undefined); }; return (