Skip to content

Commit

Permalink
[chore]: Optimize order and SQL review form
Browse files Browse the repository at this point in the history
  • Loading branch information
LZS911 committed Nov 7, 2023
1 parent 80d9869 commit a2551c2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/page/Order/AuditResult/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const AuditResult: React.FC<AuditResultProps> = (props) => {
}, [pagination, filterInfo, duplicate, props.taskId, getAuditTaskSql]);

return (
<Card {...cardProps}>
<Card {...cardProps} id="audit-result-task-card">
<AuditResultFilterForm
form={filterForm}
submit={submitFilter}
Expand Down
8 changes: 6 additions & 2 deletions src/page/Order/Create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 13 additions & 0 deletions src/page/SqlAuditRecord/Create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ const SQLAuditCreate: React.FC = () => {
const baseRef = useRef<BaseInfoFormRef>(null);
const sqlInfoRef = useRef<SQLInfoFormRef>(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 = {
Expand All @@ -56,6 +66,7 @@ const SQLAuditCreate: React.FC = () => {
} else {
setTask(res.data.data.task);
message.success(t('sqlAudit.create.SQLInfo.successTips'));
scrollToAuditResult();
}
}
});
Expand All @@ -75,13 +86,15 @@ const SQLAuditCreate: React.FC = () => {
if (res.data.code === ResponseCode.SUCCESS) {
setTask(record.task);
message.success(t('sqlAudit.create.SQLInfo.successTips'));
scrollToAuditResult();
}
});
};

const resetForm = () => {
baseRef.current?.reset();
sqlInfoRef.current?.reset();
setTask(undefined);
};

return (
Expand Down

0 comments on commit a2551c2

Please sign in to comment.