fix: 심의결과 반영
parent
15a88f050a
commit
7778e48c5c
@ -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;
|
Loading…
Reference in New Issue