fix: 심의결과 반영

main
minuk926 3 years ago
parent 15a88f050a
commit 7778e48c5c

@ -70,35 +70,29 @@ export async function findJudgeResults(params, isParking) {
const res = await axios.get(isParking ? GET_PARKING_JUDGE_RESULT_LIST : GET_JUDGE_RESULT_LIST, { params });
if (res && res.data) {
const totData = res.data?.totData;
const totJudgeUserData = res.data?.totJudgeUserData;
// tot데이타 정제
const totUserData = [[], [], [], []];
totData.forEach((data) => {
totJudgeUserData.forEach((data) => {
totUserData[0].push(data.BU);
totUserData[1].push(data.SEO);
totUserData[2].push(data.MIBU);
totUserData[3].push(data.TOT);
});
const judgeDataList = res.data?.judgeData;
judgeDataList.map((m) => {
let result = { ...m };
const users = [...m.simsa];
delete result.simsa;
users.map((u) => {
result = { ...result, [u.NAME]: u.msResult };
return result;
});
return result;
// return users.map((u) => ({ ...result, [u.NAME]: u.msResult }));
});
// 마지막 '결과' 맵 삭제
totJudgeUserData.pop();
return {
// 심사자별 심사 합산
totJudgeUsers: totJudgeUserData,
// 심사자별 심사 합산에서 추출한 심사 합산 데이타
totJudgeUserData: totUserData,
judgeData: res.data?.judgeData,
simsaUser: judgeDataList[0].simsa,
judgeTeam: totData[totData.length - 1].msuTeam
// 심사대상 차량 목록
judgeCars: res.data?.judgeCarData,
// 차량별 심시 결과
judgeUserData: res.data?.judgeUserData,
judgeTeam: res.data?.teamList[0].msuTeam
};
}
return res;

@ -42,6 +42,8 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const [judgeResultData, setJudgeResultData] = useState({
totJudgeUserData: [],
judgeData: [],
judgeCars: [],
judgeUserData: [],
simsaUser: [],
selectedRow: {},
judgeTeam: ''
@ -154,10 +156,11 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const res = await findJudgeResults(params);
setJudgeResultData({
...res,
selectedRow: e.row
selectedRow: e.row,
judgeTeam: res.judgeTeam
});
setTitle(`${e.row.msCdate} ${menuName} 심사 결과 (${e.row.msChasu})`);
setTitle(`${e.row.msCdate} ${menuName} 심사 결과 (${e.row.msChasu} - 총 ${e.row.cnt})`);
setOpen(true);
}
};

@ -6,7 +6,7 @@ import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import { styled } from '@mui/material/styles';
import { Divider, FormControl, Grid, InputLabel, MenuItem, Select, Typography } from '@mui/material';
import { Divider, FormControl, Grid, InputLabel, MenuItem, Select, TableFooter, Typography } from '@mui/material';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import combo from 'commons/combo_data';
@ -15,6 +15,7 @@ import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons';
import { findJudgeResults } from 'apis/judge';
import MuiAlert from 'views/cmm/MuiAlert';
import _ from 'lodash';
const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
@ -36,11 +37,14 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
}
}));
const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow, judgeTeam }) => {
const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam }) => {
const [judgeResult, setJudgeResult] = useState({
totJudgeUsers,
totJudgeUserData,
judgeData,
simsaUser
judgeCars,
judgeUserData
// judgeData
// simsaUser
});
const [msuTeam, setMsuTeam] = useState(judgeTeam);
const [alertOpen, setAlertOpen] = useState(false);
@ -52,8 +56,9 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
});
const totLabel = ['부과', '서손', '미부과', '계'];
console.log(totJudgeUserData, judgeData, simsaUser, selectedRow, judgeTeam);
console.log(totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, judgeTeam);
const onSearch = async () => {
setAlertOpen(false);
if (msuTeam) {
const params = {
msDatagb: selectedRow.msDatagb ?? '',
@ -68,9 +73,12 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
if (res && res.isAxiosError) {
setJudgeResult({
...judgeResult,
totJudgeUsers: [],
totJudgeUserData: [],
judgeData: [],
simsaUser: []
judgeCars: [],
judgeUserData: []
// judgeData: [],
// simsaUser: []
});
// alert.show(' .');
setAlertState({
@ -82,17 +90,12 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
} else {
setJudgeResult({
...judgeResult,
totJudgeUsers: res.totJudgeUsers,
totJudgeUserData: res.totJudgeUserData,
judgeData: res.judgeData,
simsaUser: res.simsaUser
judgeCars: res.judgeCars,
judgeUserData: res.judgeUserData
});
}
// totJudgeUserData = res.totJudgeUserData;
// judgeData = res.judgeData;
// simsaUser = res.simsaUser;
// selectedRow,
// judgeTeam: msuTeam
// });
}
};
@ -140,7 +143,7 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
<StyledTableCell align="center" style={{ width: 130 }}>
차량번호
</StyledTableCell>
{judgeResult.simsaUser.map((u) => (
{judgeResult.totJudgeUsers.map((u) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{u.NAME}
</StyledTableCell>
@ -169,10 +172,9 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
<TableBody sx={{ mt: 3 }}>
<Grid item xs={12}>
<Divider />
<Divider />
</Grid>
{/* 접수번호별 심사 결과 */}
{judgeResult.judgeData.map((row) => (
{judgeResult.judgeCars.map((row, carIdx) => (
<StyledTableRow hover key={row.msSeq}>
{/* <StyledTableCell>{row.msMaincode}</StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
@ -182,20 +184,21 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
{row.msCarnum}
</StyledTableCell>
{/* 심사위원별 심사결과 */}
{row.simsa.map((r) => (
{/* /!* 심사위원별 심사결과 *!/ */}
{_.range(carIdx, judgeResult.judgeUserData.length, judgeResult.judgeCars.length).map((userIdx) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{r.msuResult}
{judgeResult.judgeUserData[userIdx].msuResult}
</StyledTableCell>
))}
{/* 최종심사결과 */}
<StyledTableCell align="center" style={{ width: 80 }}>
{row.simsa[0].msResult}
{judgeResult.judgeUserData[carIdx].msResult}
</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
<TableFooter>{`${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length}`}</TableFooter>
</Table>
</TableContainer>
</Paper>
@ -204,9 +207,10 @@ const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow,
);
};
ModalJudgeResult.propTypes = {
totJudgeUsers: PropTypes.array.isRequired,
totJudgeUserData: PropTypes.array.isRequired,
judgeData: PropTypes.array.isRequired,
simsaUser: PropTypes.array.isRequired,
judgeCars: PropTypes.array.isRequired,
judgeUserData: PropTypes.array.isRequired,
selectedRow: PropTypes.object.isRequired,
judgeTeam: PropTypes.string
};

@ -0,0 +1,216 @@
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import { styled } from '@mui/material/styles';
import { Divider, FormControl, Grid, InputLabel, MenuItem, Select, Typography } from '@mui/material';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import combo from 'commons/combo_data';
import { useState } from 'react';
import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons';
import { findJudgeResults } from 'apis/judge';
import MuiAlert from 'views/cmm/MuiAlert';
const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white
},
[`&.${tableCellClasses.body}`]: {
// fontSize: 14
}
}));
const StyledTableRow = styled(TableRow)(({ theme }) => ({
'&:nth-of-type(odd)': {
backgroundColor: theme.palette.action.hover
},
// hide last border
'&:last-child td, &:last-child th': {
border: 0
}
}));
const ModalJudgeResult = ({ judgeUsers, totJudgeUserData, judgeData, simsaUser, selectedRow, judgeTeam }) => {
const [judgeResult, setJudgeResult] = useState({
judgeUsers,
totJudgeUserData,
judgeData
// simsaUser
});
const [msuTeam, setMsuTeam] = useState(judgeTeam);
const [alertOpen, setAlertOpen] = useState(false);
const [alertState, setAlertState] = useState({
// prettier-ignore
severity: "warning",
title: '',
message: ''
});
const totLabel = ['부과', '서손', '미부과', '계'];
console.log(totJudgeUserData, judgeData, simsaUser, selectedRow, judgeTeam);
const onSearch = async () => {
if (msuTeam) {
const params = {
msDatagb: selectedRow.msDatagb ?? '',
msSdate: selectedRow.msSdate,
msEdate: selectedRow.msEdate,
msChasu: selectedRow.msChasu,
msuTeam
};
const res = await findJudgeResults(params, params.msDatagb === '');
// TODO: alert
if (res && res.isAxiosError) {
setJudgeResult({
...judgeResult,
totJudgeUserData: [],
judgeData: [],
simsaUser: []
});
// alert.show(' .');
setAlertState({
...alertState,
message: '조회된 데이타가 없습니다.'
});
setAlertOpen(true);
// descriptionAlertsDescriptionAlerts();
} else {
setJudgeResult({
...judgeResult,
totJudgeUserData: res.totJudgeUserData,
judgeData: res.judgeData,
simsaUser: res.simsaUser
});
}
// totJudgeUserData = res.totJudgeUserData;
// judgeData = res.judgeData;
// simsaUser = res.simsaUser;
// selectedRow,
// judgeTeam: msuTeam
// });
}
};
return (
<Box>
<Grid container spacing={2} alignItems="center">
<Grid item xs={12}>
<Grid container spacing={1}>
<Grid item>
<Typography variant="subtitle1">
심의차수: {selectedRow.msChasu} 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate}
</Typography>
</Grid>
<Grid item xs={12} sm={2}>
<FormControl fullWidth>
<InputLabel required></InputLabel>
<Select defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{team.value}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
<Grid item sx={{ marginTop: 3 }}>
<Button variant="contained" color="primary" size="small" startIcon={<IconSearch />} onClick={onSearch}>
조회
</Button>
</Grid>
</Grid>
</Grid>
</Grid>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxwidth: 950, maxHeight: 700 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{/* <StyledTableCell align="center" style={{ minWidth: 80 }} hidden> */}
{/* 민원코드 */}
{/* </StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
접수번호
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }}>
차량번호
</StyledTableCell>
{judgeResult.judgeUsers.map((u) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{u.NAME}
</StyledTableCell>
))}
<StyledTableCell align="center" style={{ width: 80 }}>
결과
</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
{/* 심사 통계 */}
{judgeResult.totJudgeUserData.map((totData, idx) => (
<StyledTableRow hover key={idx}>
<StyledTableCell align="center" style={{ width: 95 }}>
{totLabel[idx]}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }} />
{totData.map((data) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{data}
</StyledTableCell>
))}
</StyledTableRow>
))}
</TableBody>
<TableBody sx={{ mt: 3 }}>
<Grid item xs={12}>
<Divider />
<Divider />
</Grid>
{/* 접수번호별 심사 결과 */}
{judgeResult.judgeData.map((row) => (
<StyledTableRow hover key={row.msSeq}>
{/* <StyledTableCell>{row.msMaincode}</StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
{row.msSeq}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }}>
{row.msCarnum}
</StyledTableCell>
{/* 심사위원별 심사결과 */}
{row.simsa.map((r) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{r.msuResult}
</StyledTableCell>
))}
{/* 최종심사결과 */}
<StyledTableCell align="center" style={{ width: 80 }}>
{row.simsa[0].msResult}
</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Paper>
<MuiAlert open={alertOpen} setOpen={setAlertOpen} {...alertState} />
</Box>
);
};
ModalJudgeResult.propTypes = {
judgeUsers: PropTypes.array,
totJudgeUserData: PropTypes.array.isRequired,
judgeData: PropTypes.array.isRequired,
// simsaUser: PropTypes.array.isRequired,
selectedRow: PropTypes.object.isRequired,
judgeTeam: PropTypes.string
};
export default ModalJudgeResult;

@ -159,7 +159,7 @@ const ParkingReview = () => {
selectedRow: e.row
});
setTitle(`${e.row.msCdate} 주정차 심사 결과 (${e.row.msChasu})`);
setTitle(`${e.row.msCdate} 주정차 심사 결과 (${e.row.msChasu} - 총 ${e.row.cnt})`);
setOpen(true);
}
};

Loading…
Cancel
Save