From 0f7ba1f1c5e99e7454080596c8791975030251d4 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 6 Jul 2022 14:14:25 +0900 Subject: [PATCH] fix: error fix --- src/views/biz/admin/judge/JudgeReview.jsx | 43 ++++++++++++----------- src/views/dashboard/index.js | 13 +++++-- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/views/biz/admin/judge/JudgeReview.jsx b/src/views/biz/admin/judge/JudgeReview.jsx index e00b005..c311107 100644 --- a/src/views/biz/admin/judge/JudgeReview.jsx +++ b/src/views/biz/admin/judge/JudgeReview.jsx @@ -53,26 +53,29 @@ const JudgeReview = ({ msDatagb, menuName }) => { }); const [judgeDatas, setJudgeDatas] = useState([]); - const search = useCallback(async () => { - const params = { - msDatagb, - msYear: selectedYear, - msChasu: inputRef.current, - page: rowsState.page, - size: rowsState.pageSize - }; + const search = useCallback( + async (datagb) => { + const params = { + msDatagb: datagb ?? msDatagb, + msYear: selectedYear, + msChasu: inputRef.current, + page: rowsState.page, + size: rowsState.pageSize + }; - let res = {}; - if (msDatagb) { - res = await findJudges(params); - } else { - res = await findParkings(params); - } - if (res && res.data) { - setTotalCount(res.count); - setRowsState((prevState) => ({ ...prevState, rows: res.data })); - } - }, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear]); + let res = {}; + if (datagb ?? msDatagb) { + res = await findJudges(params); + } else { + res = await findParkings(params); + } + if (res && res.data) { + setTotalCount(res.count); + setRowsState((prevState) => ({ ...prevState, rows: res.data })); + } + }, + [msDatagb, rowsState.page, rowsState.pageSize, selectedYear] + ); const deleteJudge = useCallback( (row) => () => { @@ -91,7 +94,7 @@ const JudgeReview = ({ msDatagb, menuName }) => { ...rowsState, page: 0 }); - search(); + search(datagb); } else { showAlert.show(res.message); } diff --git a/src/views/dashboard/index.js b/src/views/dashboard/index.js index 2743dfc..6998eda 100644 --- a/src/views/dashboard/index.js +++ b/src/views/dashboard/index.js @@ -120,6 +120,13 @@ const Dashboard = () => { align: 'center', width: 95, valueGetter: (params) => `${params.row.jcnt} / ${params.row.tcnt}` + }, + { + headerName: '종료일', + headerAlign: 'center', + field: 'msEdate', + align: 'center', + width: 95 } ]; @@ -138,17 +145,17 @@ const Dashboard = () => { const parkRows = res.data.parkJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 })); setMsEdate1(parkRows[0]?.msEdate); - setTotalCount1(parkRows.count); + setTotalCount1(parkRows.length); setRowsState1((prevState) => ({ ...prevState, rows: parkRows })); const residentRows = res.data.residentJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 })); setMsEdate2(residentRows[0]?.msEdate); - setTotalCount2(residentRows.count); + setTotalCount2(residentRows.length); setRowsState2((prevState) => ({ ...prevState, rows: residentRows })); const disabledRows = res.data.disabledJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 })); setMsEdate3(disabledRows[0]?.msEdate); - setTotalCount3(disabledRows.count); + setTotalCount3(disabledRows.length); setRowsState3((prevState) => ({ ...prevState, rows: disabledRows })); } else { showAlert.show(res.data.methodName);