fix: 심의 부과 처리 반영

main
minuk926 3 years ago
parent 2633048cf3
commit 7f47240e9f

@ -23,14 +23,14 @@ const style = {
p: 3 p: 3
}; };
const CmmModal = ({ isBackdrop = false, open, setOpen, title, judgeData = () => {}, dataGb, showAlert }) => { const CmmModal = ({ isBackdrop = false, open, setOpen, title, judgeData = () => {}, dataGb, showAlert, callback }) => {
const [judgeStd, setJudgeStd] = useState('1'); const [judgeStd, setJudgeStd] = useState('1');
const handleClose = () => { const handleClose = () => {
setOpen(false); setOpen(false);
}; };
const handleJudge = () => { const handleJudge = () => {
if (window.confirm(`부과판정 ${judgeStd} 기준으로 ${judgeData.length}건 심사 처리 하시겠습니까?`)) { if (window.confirm(`${judgeStd}[부과] 기준으로 ${judgeData.length}건 심사 처리 하시겠습니까?`)) {
const param = { const param = {
dataGb, dataGb,
judgeStdCnt: judgeStd, judgeStdCnt: judgeStd,
@ -41,6 +41,7 @@ const CmmModal = ({ isBackdrop = false, open, setOpen, title, judgeData = () =>
if (res?.success) { if (res?.success) {
showAlert.show(`${judgeData.length}건 처리되었습니다`); showAlert.show(`${judgeData.length}건 처리되었습니다`);
setOpen(false); setOpen(false);
callback();
} else { } else {
showAlert.show(`${res?.data.message}`); showAlert.show(`${res?.data.message}`);
} }
@ -99,7 +100,8 @@ CmmModal.propTypes = {
setOpen: PropTypes.func, setOpen: PropTypes.func,
judgeData: PropTypes.array, judgeData: PropTypes.array,
dataGb: PropTypes.string, dataGb: PropTypes.string,
showAlert: PropTypes.object showAlert: PropTypes.object,
callback: PropTypes.func
}; };
export default CmmModal; export default CmmModal;

@ -10,7 +10,7 @@ import { Divider, FormControl, Grid, InputLabel, MenuItem, Select, TableFooter,
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import combo from 'commons/combo_data'; import combo from 'commons/combo_data';
import { useState } from 'react'; import { useCallback, useRef, useState } from 'react';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons'; import { IconSearch } from '@tabler/icons';
import { findJudgeResults } from 'apis/judge'; import { findJudgeResults } from 'apis/judge';
@ -72,6 +72,7 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
} }
} }
setJudgeDatas(arrJudgeData); setJudgeDatas(arrJudgeData);
// judgeDatas.current = arrJudgeData;
setJudgeResult({ setJudgeResult({
...judgeResult, ...judgeResult,
@ -94,9 +95,19 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
}; };
const handleJudgeModal = () => { const handleJudgeModal = () => {
setJudgeDatas(judgeData ?? []);
// judgeDatas.current = judgeData;
setOpen(true); setOpen(true);
}; };
const onHandleJudge = useCallback(
(row) => () => {
setJudgeDatas([{ msMaincode: row.msMaincode, msSeq: row.msSeq }]);
setOpen(true);
},
[]
);
return ( return (
<Box <Box
sx={{ sx={{
@ -218,7 +229,13 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
{judgeResult.judgeUserData[carIdx].msResultNm} {judgeResult.judgeUserData[carIdx].msResultNm}
</StyledTableCell> </StyledTableCell>
<StyledTableCell align="center" style={{ width: 80 }}> <StyledTableCell align="center" style={{ width: 80 }}>
{judgeResult.judgeUserData[carIdx].msResult === '0' ? '처리' : ''} {judgeResult.judgeUserData[carIdx].msResult === '0' ? (
<Button size="small" color="error" onClick={onHandleJudge(row)}>
처리
</Button>
) : (
''
)}
</StyledTableCell> </StyledTableCell>
</StyledTableRow> </StyledTableRow>
))} ))}
@ -237,7 +254,15 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
> >
{judgeResult && `${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length}`} {judgeResult && `${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length}`}
</TableFooter> </TableFooter>
<JudgeModal open={open} setOpen={setOpen} title={title} judgeData={judgeDatas} dataGb={dataGb} showAlert={alert} /> <JudgeModal
open={open}
setOpen={setOpen}
title={title}
judgeData={judgeDatas}
dataGb={dataGb}
showAlert={alert}
callback={onSearch}
/>
</Box> </Box>
); );
}; };

Loading…
Cancel
Save