fix : 심의 처리 반영

main
Lim Jonguk 3 years ago
parent b664f6144e
commit e94f4824ec

@ -88,6 +88,7 @@ export async function findJudgeResults(params, isParking) {
// 마지막 '결과' 맵 삭제 // 마지막 '결과' 맵 삭제
totJudgeUserData.pop(); totJudgeUserData.pop();
// _.sortBy(totJudgeUserData, ['userid', 'msSeq', 'msCarnum']);
return { return {
success: true, success: true,
data: { data: {

@ -47,6 +47,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
selectedRow: {}, selectedRow: {},
judgeTeam: '' judgeTeam: ''
}); });
const [judgeDatas, setJudgeDatas] = useState([]);
const search = useCallback(() => { const search = useCallback(() => {
const params = { const params = {
@ -115,30 +116,6 @@ const JudgeReview = ({ msDatagb, menuName }) => {
valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`, valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`,
align: 'center' 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: '삭제', headerName: '삭제',
headerAlign: 'center', headerAlign: 'center',
@ -179,6 +156,15 @@ const JudgeReview = ({ msDatagb, menuName }) => {
msuTeam: e.row.msuTeam msuTeam: e.row.msuTeam
}; };
const res = await findJudgeResults(params); 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({ setJudgeResultData({
...res?.data, ...res?.data,
selectedRow: e.row, selectedRow: e.row,

@ -39,7 +39,7 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
const totLabel = ['부과', '서손', '미부과', '계']; const totLabel = ['부과', '서손', '미부과', '계'];
const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam }) => { const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam, judgeData }) => {
const alert = useAlert(); const alert = useAlert();
const [judgeResult, setJudgeResult] = useState({ const [judgeResult, setJudgeResult] = useState({
totJudgeUsers, totJudgeUsers,
@ -47,10 +47,10 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
judgeCars, judgeCars,
judgeUserData judgeUserData
}); });
const [judgeDatas, setJudgeDatas] = useState(judgeData ?? []);
const [msuTeam, setMsuTeam] = useState(judgeTeam ?? '001'); const [msuTeam, setMsuTeam] = useState(judgeTeam ?? '001');
const onSearch = async () => { const onSearch = async () => {
// setAlertOpen(false);
if (msuTeam) { if (msuTeam) {
const params = { const params = {
msDatagb: selectedRow.msDatagb ?? '', msDatagb: selectedRow.msDatagb ?? '',
@ -60,8 +60,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
msuTeam msuTeam
}; };
const res = await findJudgeResults(params, params.msDatagb === ''); const res = await findJudgeResults(params, params.msDatagb === '');
const arrJudgeData = [];
if (res && res?.success) { 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({ setJudgeResult({
...judgeResult, ...judgeResult,
totJudgeUsers: res.data?.totJudgeUsers, totJudgeUsers: res.data?.totJudgeUsers,
@ -93,29 +102,41 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
}} }}
> >
<Grid container spacing={1} alignItems="center" mb={1}> <Grid container spacing={1} alignItems="center" mb={1}>
<Grid item xs={12}>
<Grid container spacing={1}> <Grid container spacing={1}>
<Grid item sm={5}> <Grid item xs={7}>
<Typography variant="subtitle1"> <Typography variant="subtitle1">
심의차수: {selectedRow.msChasu} 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate} 심의차수: {selectedRow.msChasu} 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate}
</Typography> </Typography>
</Grid> </Grid>
<Grid item sm={2}> <Grid item xs={5}>
<Grid container spacing={0.5} alignItems="center" mb={1}>
<Grid item xs={6} style={{ marginLeft: 'auto' }}>
<FormControl fullWidth> <FormControl fullWidth>
<InputLabel required></InputLabel> <InputLabel required></InputLabel>
<Select defaultValue={msuTeam} value={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}> <Select defaultValue={msuTeam} value={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
{combo.teams.map((team) => ( {combo.teams.map((team, idx) => (
<MenuItem key={team.code} value={team.code}> <MenuItem key={idx} value={team.code}>
{team.value} {team.value}
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>
</FormControl> </FormControl>
</Grid> </Grid>
<Grid item sm={2} sx={{ marginTop: 1 }}> <Grid item xs={6} sx={{ marginTop: 1 }}>
<Button variant="contained" color="primary" size="small" startIcon={<IconSearch />} onClick={onSearch}> <Button variant="contained" color="primary" size="small" startIcon={<IconSearch />} onClick={onSearch}>
조회 조회
</Button> </Button>
<Button
disabled={judgeDatas.length === 0}
variant="contained"
color="primary"
size="small"
startIcon={<IconSearch />}
onClick={onSearch}
>
일괄처리
</Button>
</Grid>
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
@ -134,14 +155,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
<StyledTableCell align="center" style={{ width: 130 }}> <StyledTableCell align="center" style={{ width: 130 }}>
차량번호 차량번호
</StyledTableCell> </StyledTableCell>
{judgeResult?.totJudgeUsers.map((u) => ( {judgeResult?.totJudgeUsers.map((u, idx) => (
<StyledTableCell align="center" key={u.NAME} style={{ width: 80 }}> <StyledTableCell align="center" key={idx} style={{ width: 80 }}>
{u.NAME} {u.NAME}
</StyledTableCell> </StyledTableCell>
))} ))}
<StyledTableCell align="center" style={{ width: 80 }}> <StyledTableCell align="center" style={{ width: 80 }}>
결과 결과
</StyledTableCell> </StyledTableCell>
<StyledTableCell align="center" style={{ width: 80 }}>
처리
</StyledTableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
@ -152,11 +176,12 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
{totLabel[idx]} {totLabel[idx]}
</StyledTableCell> </StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }} /> <StyledTableCell align="center" style={{ width: 130 }} />
{totData.map((data) => ( {totData.map((data, totIdx) => (
<StyledTableCell align="center" style={{ width: 80 }}> <StyledTableCell key={`${idx}${totIdx}`} align="center" style={{ width: 80 }}>
{data} {data}
</StyledTableCell> </StyledTableCell>
))} ))}
<StyledTableCell />
</StyledTableRow> </StyledTableRow>
))} ))}
</TableBody> </TableBody>
@ -177,14 +202,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
{/* /!* 심사위원별 심사결과 *!/ */} {/* /!* 심사위원별 심사결과 *!/ */}
{_.range(carIdx, judgeResult.judgeUserData.length, judgeResult.judgeCars.length).map((userIdx) => ( {_.range(carIdx, judgeResult.judgeUserData.length, judgeResult.judgeCars.length).map((userIdx) => (
<StyledTableCell align="center" key={carIdx + userIdx} style={{ width: 80 }}> <StyledTableCell align="center" key={userIdx} style={{ width: 80 }}>
{judgeResult.judgeUserData[userIdx].msuResult} {judgeResult.judgeUserData[userIdx].msuResult}
</StyledTableCell> </StyledTableCell>
))} ))}
{/* 최종심사결과 */} {/* 최종심사결과 */}
<StyledTableCell align="center" style={{ width: 80 }}> <StyledTableCell align="center" style={{ width: 80 }}>
{judgeResult.judgeUserData[carIdx].msResult} {judgeResult.judgeUserData[carIdx].msResultNm}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 80 }}>
{judgeResult.judgeUserData[carIdx].msResult === '0' ? '처리' : ''}
</StyledTableCell> </StyledTableCell>
</StyledTableRow> </StyledTableRow>
))} ))}

@ -49,6 +49,7 @@ const ParkingReview = () => {
selectedRow: {}, selectedRow: {},
judgeTeam: '' judgeTeam: ''
}); });
const [judgeDatas, setJudgeDatas] = useState([]);
const search = useCallback(() => { const search = useCallback(() => {
const params = { const params = {
@ -167,6 +168,15 @@ const ParkingReview = () => {
}; };
const res = await findJudgeResults(params, true); 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({ setJudgeResultData({
...res.data, ...res.data,
selectedRow: e.row, selectedRow: e.row,
@ -231,7 +241,7 @@ const ParkingReview = () => {
handleCellClick={handleOnCellClick} handleCellClick={handleOnCellClick}
/> />
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}> <CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
{judgeResultData?.selectedRow && <ModalJudgeResult {...judgeResultData} />} {judgeResultData?.selectedRow && <ModalJudgeResult {...judgeResultData} judgeData={judgeDatas} />}
</CmmModal> </CmmModal>
</MainCard> </MainCard>
); );

Loading…
Cancel
Save