diff --git a/apps/st/src/components/statistics/verification/VerificationArticleManagement.tsx b/apps/st/src/components/statistics/verification/VerificationArticleManagement.tsx index b852b1496..d919a6823 100644 --- a/apps/st/src/components/statistics/verification/VerificationArticleManagement.tsx +++ b/apps/st/src/components/statistics/verification/VerificationArticleManagement.tsx @@ -108,6 +108,30 @@ function VerificationArticleManagement() { }); } + const saveMutation = useMutation({ + mutationFn: (data: VerificationTargetManagementResponse) => + verificationTargetManagementApi.saveVerificationTargetManagement({ + vrfcMthdCd: data.vrfcMthdCd || activeTab, + statsCd: data.statsCd, + schmNm: data.schmNm, + tblNm: data.tblNm, + colNm: data.colNm, + pkColNm: data.pkColNm, + ipcrCntVl: data.ipcrCntVl, + pctlCrtrVl: data.pctlCrtrVl, + scopCntCntVl: data.scopCntCntVl, + thrsCntVl: data.thrsCntVl, + useYn: data.useYn, + vrfcTrgtNm: data.vrfcTrgtNm, + }), + onSuccess: () => { + queryClient.invalidateQueries({ + queryKey: [ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG], + }); + setDialogOpen(false); + }, + }); + const updateMutation = useMutation({ mutationFn: (data: VerificationTargetManagementResponse) => verificationTargetManagementApi.updateVerificationTargetManagement( @@ -155,6 +179,11 @@ function VerificationArticleManagement() { setDialogOpen(true); } + function handleRegister() { + setSelectedData(null); + setDialogOpen(true); + } + function handleSubmit(e: React.FormEvent) { e.preventDefault(); handleSearch(); @@ -162,7 +191,11 @@ function VerificationArticleManagement() { async function handleSave(data: VerificationTargetManagementResponse) { if (await confirm("저장하시겠습니까?")) { - updateMutation.mutate(data); + if (data.vrfcTrgtSn) { + updateMutation.mutate(data); + } else { + saveMutation.mutate(data); + } } } @@ -219,6 +252,13 @@ function VerificationArticleManagement() {
+ - + {data && ( + + )}