fix : 심의 처리 반영

main
Lim Jonguk 3 years ago
parent b664f6144e
commit e94f4824ec

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

@ -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,

@ -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
}}
>
<Grid container spacing={1} alignItems="center" mb={1}>
<Grid item xs={12}>
<Grid container spacing={1}>
<Grid item sm={5}>
<Grid item xs={7}>
<Typography variant="subtitle1">
심의차수: {selectedRow.msChasu} 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate}
</Typography>
</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>
<InputLabel required></InputLabel>
<Select defaultValue={msuTeam} value={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{combo.teams.map((team, idx) => (
<MenuItem key={idx} value={team.code}>
{team.value}
</MenuItem>
))}
</Select>
</FormControl>
</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>
<Button
disabled={judgeDatas.length === 0}
variant="contained"
color="primary"
size="small"
startIcon={<IconSearch />}
onClick={onSearch}
>
일괄처리
</Button>
</Grid>
</Grid>
</Grid>
</Grid>
@ -134,14 +155,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
<StyledTableCell align="center" style={{ width: 130 }}>
차량번호
</StyledTableCell>
{judgeResult?.totJudgeUsers.map((u) => (
<StyledTableCell align="center" key={u.NAME} style={{ width: 80 }}>
{judgeResult?.totJudgeUsers.map((u, idx) => (
<StyledTableCell align="center" key={idx} style={{ width: 80 }}>
{u.NAME}
</StyledTableCell>
))}
<StyledTableCell align="center" style={{ width: 80 }}>
결과
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 80 }}>
처리
</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
@ -152,11 +176,12 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
{totLabel[idx]}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }} />
{totData.map((data) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{totData.map((data, totIdx) => (
<StyledTableCell key={`${idx}${totIdx}`} align="center" style={{ width: 80 }}>
{data}
</StyledTableCell>
))}
<StyledTableCell />
</StyledTableRow>
))}
</TableBody>
@ -177,14 +202,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
{/* /!* 심사위원별 심사결과 *!/ */}
{_.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}
</StyledTableCell>
))}
{/* 최종심사결과 */}
<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>
</StyledTableRow>
))}

@ -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}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
{judgeResultData?.selectedRow && <ModalJudgeResult {...judgeResultData} />}
{judgeResultData?.selectedRow && <ModalJudgeResult {...judgeResultData} judgeData={judgeDatas} />}
</CmmModal>
</MainCard>
);

Loading…
Cancel
Save