fix: error fix

main
minuk926 2 years ago
parent fbc090bfb7
commit 0f7ba1f1c5

@ -53,26 +53,29 @@ const JudgeReview = ({ msDatagb, menuName }) => {
}); });
const [judgeDatas, setJudgeDatas] = useState([]); const [judgeDatas, setJudgeDatas] = useState([]);
const search = useCallback(async () => { const search = useCallback(
const params = { async (datagb) => {
msDatagb, const params = {
msYear: selectedYear, msDatagb: datagb ?? msDatagb,
msChasu: inputRef.current, msYear: selectedYear,
page: rowsState.page, msChasu: inputRef.current,
size: rowsState.pageSize page: rowsState.page,
}; size: rowsState.pageSize
};
let res = {}; let res = {};
if (msDatagb) { if (datagb ?? msDatagb) {
res = await findJudges(params); res = await findJudges(params);
} else { } else {
res = await findParkings(params); res = await findParkings(params);
} }
if (res && res.data) { if (res && res.data) {
setTotalCount(res.count); setTotalCount(res.count);
setRowsState((prevState) => ({ ...prevState, rows: res.data })); setRowsState((prevState) => ({ ...prevState, rows: res.data }));
} }
}, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear]); },
[msDatagb, rowsState.page, rowsState.pageSize, selectedYear]
);
const deleteJudge = useCallback( const deleteJudge = useCallback(
(row) => () => { (row) => () => {
@ -91,7 +94,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
...rowsState, ...rowsState,
page: 0 page: 0
}); });
search(); search(datagb);
} else { } else {
showAlert.show(res.message); showAlert.show(res.message);
} }

@ -120,6 +120,13 @@ const Dashboard = () => {
align: 'center', align: 'center',
width: 95, width: 95,
valueGetter: (params) => `${params.row.jcnt} / ${params.row.tcnt}` 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 })); const parkRows = res.data.parkJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 }));
setMsEdate1(parkRows[0]?.msEdate); setMsEdate1(parkRows[0]?.msEdate);
setTotalCount1(parkRows.count); setTotalCount1(parkRows.length);
setRowsState1((prevState) => ({ ...prevState, rows: parkRows })); setRowsState1((prevState) => ({ ...prevState, rows: parkRows }));
const residentRows = res.data.residentJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 })); const residentRows = res.data.residentJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 }));
setMsEdate2(residentRows[0]?.msEdate); setMsEdate2(residentRows[0]?.msEdate);
setTotalCount2(residentRows.count); setTotalCount2(residentRows.length);
setRowsState2((prevState) => ({ ...prevState, rows: residentRows })); setRowsState2((prevState) => ({ ...prevState, rows: residentRows }));
const disabledRows = res.data.disabledJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 })); const disabledRows = res.data.disabledJudgeList.map((d, idx) => ({ ...d, rowId: idx + 1 }));
setMsEdate3(disabledRows[0]?.msEdate); setMsEdate3(disabledRows[0]?.msEdate);
setTotalCount3(disabledRows.count); setTotalCount3(disabledRows.length);
setRowsState3((prevState) => ({ ...prevState, rows: disabledRows })); setRowsState3((prevState) => ({ ...prevState, rows: disabledRows }));
} else { } else {
showAlert.show(res.data.methodName); showAlert.show(res.data.methodName);

Loading…
Cancel
Save