From e94f4824ec3f920705cf2bca60735ded1a81e1e7 Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Fri, 13 May 2022 16:17:58 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EC=8B=AC=EC=9D=98=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/judge.js | 1 + src/views/biz/admin/judge/JudgeReview.jsx | 34 ++----- .../biz/admin/judge/ModalJudgeResult.jsx | 92 ++++++++++++------- src/views/biz/admin/parking/ParkingReview.jsx | 12 ++- 4 files changed, 82 insertions(+), 57 deletions(-) diff --git a/src/apis/judge.js b/src/apis/judge.js index faf64a1..3be67a1 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -88,6 +88,7 @@ export async function findJudgeResults(params, isParking) { // 마지막 '결과' 맵 삭제 totJudgeUserData.pop(); + // _.sortBy(totJudgeUserData, ['userid', 'msSeq', 'msCarnum']); return { success: true, data: { diff --git a/src/views/biz/admin/judge/JudgeReview.jsx b/src/views/biz/admin/judge/JudgeReview.jsx index 2008579..6366e68 100644 --- a/src/views/biz/admin/judge/JudgeReview.jsx +++ b/src/views/biz/admin/judge/JudgeReview.jsx @@ -47,6 +47,7 @@ const JudgeReview = ({ msDatagb, menuName }) => { selectedRow: {}, judgeTeam: '' }); + const [judgeDatas, setJudgeDatas] = useState([]); const search = useCallback(() => { const params = { @@ -115,30 +116,6 @@ const JudgeReview = ({ msDatagb, menuName }) => { valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`, align: 'center' }, - /* - { - headerName: '상태', - headerAlign: 'center', - field: 'msResult', - width: 150, - renderCell: (params) => { - switch (params.row.msResult) { - case '0': - return '심의전'; - // break; - case '1': - return '부과'; - // break; - case '2': - return '미부과'; - // break; - default: - return params.row.msResult; - } - }, - align: 'center' - }, - */ { headerName: '삭제', headerAlign: 'center', @@ -179,6 +156,15 @@ const JudgeReview = ({ msDatagb, menuName }) => { msuTeam: e.row.msuTeam }; const res = await findJudgeResults(params); + const arrJudgeData = []; + // eslint-disable-next-line no-plusplus + for (let idx = 0; idx < res.data.judgeCars.length; idx++) { + if (res.data.judgeUserData[idx].msResult === '0') { + arrJudgeData.push({ msMaincode: res.data.judgeUserData[idx].msMaincode, msSeq: res.data.judgeUserData[idx].msSeq }); + } + } + setJudgeDatas(arrJudgeData); + setJudgeResultData({ ...res?.data, selectedRow: e.row, diff --git a/src/views/biz/admin/judge/ModalJudgeResult.jsx b/src/views/biz/admin/judge/ModalJudgeResult.jsx index 518e2dc..7d86d78 100644 --- a/src/views/biz/admin/judge/ModalJudgeResult.jsx +++ b/src/views/biz/admin/judge/ModalJudgeResult.jsx @@ -39,7 +39,7 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({ const totLabel = ['부과', '서손', '미부과', '계']; -const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam }) => { +const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam, judgeData }) => { const alert = useAlert(); const [judgeResult, setJudgeResult] = useState({ totJudgeUsers, @@ -47,10 +47,10 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse judgeCars, judgeUserData }); + const [judgeDatas, setJudgeDatas] = useState(judgeData ?? []); const [msuTeam, setMsuTeam] = useState(judgeTeam ?? '001'); const onSearch = async () => { - // setAlertOpen(false); if (msuTeam) { const params = { msDatagb: selectedRow.msDatagb ?? '', @@ -60,8 +60,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse msuTeam }; const res = await findJudgeResults(params, params.msDatagb === ''); - + const arrJudgeData = []; if (res && res?.success) { + // eslint-disable-next-line no-plusplus + for (let idx = 0; idx < res.data.judgeCars.length; idx++) { + console.log(idx); + if (res.data.judgeUserData[idx].msResult === '0') { + arrJudgeData.push({ msMaincode: res.data.judgeUserData[idx].msMaincode, msSeq: res.data.judgeUserData[idx].msSeq }); + } + } + setJudgeDatas(arrJudgeData); + setJudgeResult({ ...judgeResult, totJudgeUsers: res.data?.totJudgeUsers, @@ -93,29 +102,41 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse }} > - - - - - 심의차수: {selectedRow.msChasu}차 ㅣ 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate} - - - - - - - - - - + + + + 심의차수: {selectedRow.msChasu}차 ㅣ 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate} + + + + + + + + + + + + + + @@ -134,14 +155,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse 차량번호 - {judgeResult?.totJudgeUsers.map((u) => ( - + {judgeResult?.totJudgeUsers.map((u, idx) => ( + {u.NAME} ))} 결과 + + 처리 + @@ -152,11 +176,12 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse {totLabel[idx]} - {totData.map((data) => ( - + {totData.map((data, totIdx) => ( + {data} ))} + ))} @@ -177,14 +202,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse {/* /!* 심사위원별 심사결과 *!/ */} {_.range(carIdx, judgeResult.judgeUserData.length, judgeResult.judgeCars.length).map((userIdx) => ( - + {judgeResult.judgeUserData[userIdx].msuResult} ))} {/* 최종심사결과 */} - {judgeResult.judgeUserData[carIdx].msResult} + {judgeResult.judgeUserData[carIdx].msResultNm} + + + {judgeResult.judgeUserData[carIdx].msResult === '0' ? '처리' : ''} ))} diff --git a/src/views/biz/admin/parking/ParkingReview.jsx b/src/views/biz/admin/parking/ParkingReview.jsx index aafff45..c9ee3c2 100644 --- a/src/views/biz/admin/parking/ParkingReview.jsx +++ b/src/views/biz/admin/parking/ParkingReview.jsx @@ -49,6 +49,7 @@ const ParkingReview = () => { selectedRow: {}, judgeTeam: '' }); + const [judgeDatas, setJudgeDatas] = useState([]); const search = useCallback(() => { const params = { @@ -167,6 +168,15 @@ const ParkingReview = () => { }; const res = await findJudgeResults(params, true); + const arrJudgeData = []; + // eslint-disable-next-line no-plusplus + for (let idx = 0; idx < res.data.judgeCars.length; idx++) { + if (res.data.judgeUserData[idx].msResult === '0') { + arrJudgeData.push({ msMaincode: res.data.judgeUserData[idx].msMaincode, msSeq: res.data.judgeUserData[idx].msSeq }); + } + } + setJudgeDatas(arrJudgeData); + setJudgeResultData({ ...res.data, selectedRow: e.row, @@ -231,7 +241,7 @@ const ParkingReview = () => { handleCellClick={handleOnCellClick} /> - {judgeResultData?.selectedRow && } + {judgeResultData?.selectedRow && } );