refactor: source 정리
parent
f4f07d0ad8
commit
9cf8bdb0ab
@ -1,216 +0,0 @@
|
||||
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;
|
@ -1,97 +0,0 @@
|
||||
import React, { useState } from 'react';
|
||||
import { CardMedia, ImageList, ImageListItem } from '@mui/material';
|
||||
import { useDropzone } from 'react-dropzone';
|
||||
import { Image } from '@mui/icons-material';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
const itemData = [
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e',
|
||||
title: 'Breakfast'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d',
|
||||
title: 'Burger'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45',
|
||||
title: 'Camera'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c',
|
||||
title: 'Coffee'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8',
|
||||
title: 'Hats'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62',
|
||||
title: 'Honey'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6',
|
||||
title: 'Basketball'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f',
|
||||
title: 'Fern'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25',
|
||||
title: 'Mushrooms'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af',
|
||||
title: 'Tomato basil'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1',
|
||||
title: 'Sea star'
|
||||
},
|
||||
{
|
||||
img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6',
|
||||
title: 'Bike'
|
||||
}
|
||||
];
|
||||
|
||||
const ProcessJudge2 = () => {
|
||||
const [previewImage, setPreviewImage] = useState();
|
||||
|
||||
const { getRootProps, getInputProps } = useDropzone({
|
||||
accept: 'image/*',
|
||||
onDrop: (acceptedFiles) => {
|
||||
setPreviewImage(URL.createObjectURL(itemData[0].img));
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<CardMedia
|
||||
component="img"
|
||||
sx={{
|
||||
height: 233,
|
||||
width: 350,
|
||||
maxHeight: { xs: 233, md: 167 },
|
||||
maxWidth: { xs: 350, md: 250 }
|
||||
}}
|
||||
src={itemData[0].img}
|
||||
// src={previewImage}
|
||||
/>
|
||||
<Box
|
||||
component="img"
|
||||
sx={{
|
||||
height: 233,
|
||||
width: 350,
|
||||
maxHeight: { xs: 233, md: 167 },
|
||||
maxWidth: { xs: 350, md: 250 }
|
||||
}}
|
||||
alt="The house from the offer."
|
||||
src={itemData[0].img}
|
||||
/>
|
||||
<Image src={itemData[0].img} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProcessJudge2;
|
Loading…
Reference in New Issue