feat: 심사자 심의 진행

main
minuk926 3 years ago
parent 51bc985152
commit 2af89d02a8

@ -115,7 +115,8 @@ export const JWTProvider = ({ children }) => {
user: {
id: user.userid,
email: user.email,
name: user.name
name: user.name,
team: user.team
}
}
});

@ -22,7 +22,7 @@ const ParkingRegister = Loadable(lazy(() => import('views/biz/admin/parking/Park
const JudgeDataReview = Loadable(lazy(() => import('views/biz/admin/judge/JudgeDataReview')));
const JudgeReview = Loadable(lazy(() => import('views/biz/admin/judge/JudgeReview')));
const JudgeRegistReview = Loadable(lazy(() => import('views/biz/admin/judge/JudgeRegistReview')));
const UserByJudgeReview = Loadable(lazy(() => import('views/biz/judge/JudgeReview')));
const UserByJudgeReview = Loadable(lazy(() => import('views/biz/judge/JudgeByUserReview')));
// user
const UserManager = Loadable(lazy(() => import('views/biz/user/UserManager')));

@ -0,0 +1,305 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import getYear from 'date-fns/getYear';
// material-ui
import { GridActionsCellItem } from '@mui/x-data-grid';
import { Divider, FormControl, Grid, InputAdornment, Link, MenuItem, OutlinedInput, Select, Typography } from '@mui/material';
import CreditScoreIcon from '@mui/icons-material/CreditScore';
import { IconSearch } from '@tabler/icons';
// berry ui
import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/mui-grid/MuiDataGrid';
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { findByUserJudges } from 'apis/judge';
import CmmModal from 'views/cmm/CmmModal';
import ProcessJudge from './ProcessJudge';
import useAuth from 'hooks/useAuth';
import { Delete } from '@mui/icons-material';
import Button from '@mui/material/Button';
import { useAlert } from 'react-alert';
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 JudgeByUserReview = ({ msDatagb, menuName }) => {
const { user } = useAuth();
const showAlert = useAlert();
const [totalCount, setTotalCount] = useState(0);
const [rowsState, setRowsState] = useState({
page: 0,
pageSize: 100,
rows: []
// loading: false
});
const [open, setOpen] = useState(false);
const [title, setTitle] = useState('');
const [rowDatas, setRowDatas] = useState([]);
const [minSdate, setMinSdate] = useState('');
const [maxEdate, setMaxEdate] = useState('');
const [minSeq, setMinSeq] = useState(0);
const [maxSeq, setMaxSeq] = useState(0);
const search = useCallback(() => {
const params = {
msDatagb
};
findByUserJudges(params).then((res) => {
if (res && res.data) {
setTotalCount(res.count);
setRowsState((prevState) => ({ ...prevState, rows: res.data }));
const arrMsSeq = res.data.map((r) => r.msSeq);
setMinSdate(_.min(res.data.map((r) => r.msSdate)));
setMaxEdate(_.max(res.data.map((r) => r.msEdate)));
setMinSeq(_.min(arrMsSeq));
setMaxSeq(_.max(arrMsSeq));
}
});
}, [msDatagb]);
const processJudge = useCallback(
(row) => () => {
setTitle(`${menuName} 심의 - ${row.msSeq}`);
setRowDatas([row]);
setOpen(true);
},
[]
);
const columns = [
// { headerName: 'rowId', field: 'rowId' },
{
headerName: 'msMaincode',
headerAlign: 'center',
field: 'msMaincode',
align: 'center',
width: 100
},
{
headerName: '접수번호',
headerAlign: 'center',
field: 'msSeq',
align: 'center',
width: 100
},
{ headerName: '심의차수', headerAlign: 'center', field: 'msChasu', align: 'center', width: 100 },
{ headerName: '차량번호', headerAlign: 'center', field: 'msCarnum', align: 'center', width: 100 },
{
headerName: '심의결정',
headerAlign: 'center',
field: 'msResult',
align: 'center',
renderCell: (params) => {
switch (params.row.msResult) {
case '0':
return '심의전';
// break;
case '1':
return '부과';
// break;
case '2':
return '미부과';
// break;
default:
return params.row.msResult;
}
},
width: 100
},
{
headerName: '심의결정(msu)',
headerAlign: 'center',
field: 'msuResult',
align: 'center',
renderCell: (params) => {
switch (params.row.msResult) {
case '0':
return '심의전';
// break;
case '1':
return '부과';
// break;
case '2':
return '미부과';
// break;
default:
return params.row.msResult;
}
},
width: 100
},
{
headerName: '심의 기간',
headerAlign: 'center',
field: 'msDate',
minWidth: 200,
width: 250,
description: '심사 기간',
valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`,
align: 'center'
},
{
headerName: '심의 마감 일시',
headerAlign: 'center',
field: 'msCdate',
type: 'dateTime',
minWidth: 150,
width: 200,
valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`,
align: 'center'
},
{
headerName: '개별심사',
headerAlign: 'center',
field: 'actions',
type: 'actions',
width: 80,
getActions: (params) => [
<GridActionsCellItem color="error" icon={<CreditScoreIcon />} label="개별심사" onClick={processJudge(params.row)} />
],
align: 'center'
}
];
const handleSearch = async (event) => {
if (event.type === 'keydown' && event.key === 'Enter') {
const newString = event?.target.value;
search();
}
};
const onJudge = useCallback(() => {
setTitle(`${menuName} 심의`);
setRowDatas(rowsState?.rows);
setOpen(true);
}, []);
useEffect(() => {
search();
// }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
}, [search]);
return (
<MainCard>
<Grid container spacing={2} alignItems="center">
<Grid container item spacing={2} xs={7} justifyContent="start">
<Grid item>
<Typography variant="subtitle1">
[ <span style={{ color: 'red' }}>심의기간 : </span>{' '}
<span style={{ color: 'blue' }}>
{minSdate} ~ {maxEdate}
</span>{' '}
]
</Typography>
</Grid>
<Grid item>
<Typography variant="subtitle1">
[ <span style={{ color: 'red' }}>접수번호 : </span>
<span style={{ color: 'blue' }}>
{' '}
{minSeq} ~ {maxSeq}
</span>{' '}
]
</Typography>
</Grid>
</Grid>
<Grid container item spacing={2} xs={5} justifyContent="end" alignItems="center">
<Grid item>
<Typography variant="subtitle1">
[ <span style={{ color: 'blue' }}>{user?.name} 위원 / </span>
<span style={{ color: 'red' }}>{user?.team?.substring(2)}</span> ]
</Typography>
</Grid>
<Grid item>
<Button variant="contained" size="small" startIcon={<CreditScoreIcon />} onClick={onJudge}>
심사
</Button>
</Grid>
</Grid>
{/* <Grid item> */}
{/* <Button variant="contained" size="small" startIcon={<CreditScoreIcon />} onClick={onJudge}> */}
{/* 심사 */}
{/* </Button> */}
{/* </Grid> */}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<MuiDataGrid
// isCheckbox
isHideFooter
columns={columns}
rowsState={rowsState}
totalCount={totalCount}
setRowsState={setRowsState}
// handleCellClick={handleOnCellClick}
// handleSelection={handleSelection}
// selectionModel={selectionModel}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ProcessJudge rowDatas={rowDatas} />
</CmmModal>
</MainCard>
);
};
JudgeByUserReview.propTypes = {
msDatagb: PropTypes.string.isRequired,
menuName: PropTypes.string.isRequired
};
export default JudgeByUserReview;

@ -1,275 +0,0 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import getYear from 'date-fns/getYear';
// material-ui
import { GridActionsCellItem } from '@mui/x-data-grid';
import { Divider, FormControl, Grid, InputAdornment, Link, MenuItem, OutlinedInput, Select } from '@mui/material';
import CreditScoreIcon from '@mui/icons-material/CreditScore';
import { IconSearch } from '@tabler/icons';
// berry ui
import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/mui-grid/MuiDataGrid';
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { findByUserJudges } from 'apis/judge';
import CmmModal from 'views/cmm/CmmModal';
const JudgeReview = ({ msDatagb, menuName }) => {
const isInit = useRef(true);
const year = getYear(new Date());
const years = _.range(year, year - 14, -1);
const [open, setOpen] = useState(false);
const [title, setTitle] = useState();
const [selectedYear, setSelectedYear] = useState(year);
const [searchTxt, setSearchTxt] = useState('');
const [totalCount, setTotalCount] = useState(0);
const [rowsState, setRowsState] = useState({
page: 0,
pageSize: 100,
rows: []
// loading: false
});
const [judgeResultData, setJudgeResultData] = useState({
totJudgeUserData: [],
judgeData: [],
judgeCars: [],
judgeUserData: [],
simsaUser: [],
selectedRow: {},
judgeTeam: ''
});
const search = useCallback(() => {
const params = {
msDatagb
};
findByUserJudges(params).then((response) => {
if (response && response.data) {
setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data }));
// apiRef.current.forceUpdate(); // .updateRowData([]);
// apiRef.current.updateRowData([]);
}
});
}, [msDatagb, selectedYear, searchTxt]);
const execJudge = useCallback(
(row) => () => {
// removeJudge(row).then((response) => {
// if (response && response.success) {
// setRowsState({
// ...rowsState,
// page: 0
// });
// search();
// } else {
// alert.show(response.message);
// }
// });
},
[]
);
const columns = [
// { headerName: 'rowId', field: 'rowId' },
{ headerName: '접수번호', headerAlign: 'center', field: 'msSeq', align: 'center', width: 100 },
{ headerName: '심의차수', headerAlign: 'center', field: 'msChasu', align: 'center', width: 100 },
{ headerName: '차량번호', headerAlign: 'center', field: 'msCarnum', align: 'center', width: 100 },
{
headerName: '심의결정',
headerAlign: 'center',
field: 'msResult',
align: 'center',
renderCell: (params) => {
switch (params.row.msResult) {
case '0':
return '심의전';
// break;
case '1':
return '부과';
// break;
case '2':
return '미부과';
// break;
default:
return params.row.msResult;
}
},
width: 100
},
{
headerName: '심의결정(msu)',
headerAlign: 'center',
field: 'msuResult',
align: 'center',
renderCell: (params) => {
switch (params.row.msResult) {
case '0':
return '심의전';
// break;
case '1':
return '부과';
// break;
case '2':
return '미부과';
// break;
default:
return params.row.msResult;
}
},
width: 100
},
{
headerName: '심사 기간',
headerAlign: 'center',
field: 'msDate',
minWidth: 200,
width: 250,
description: '심사 기간',
valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`,
renderCell: (params) => (
<Link underline="hover" href="#">
{params.value}
</Link>
),
align: 'center'
},
{
headerName: '심사 마감 일시',
headerAlign: 'center',
field: 'msCdate',
type: 'dateTime',
minWidth: 150,
width: 200,
valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`,
align: 'center'
},
{
headerName: '개별심사',
headerAlign: 'center',
field: 'actions',
type: 'actions',
width: 80,
getActions: (params) => [
<GridActionsCellItem color="error" icon={<CreditScoreIcon />} label="개별심사" onClick={execJudge(params.row)} />
],
align: 'center'
}
];
const handleSearch = async (event) => {
if (!selectedYear) return;
if (event.type === 'keydown' && event.key === 'Enter') {
const newString = event?.target.value;
setSearchTxt(newString);
search();
}
};
useEffect(() => {
if (isInit.current) {
isInit.current = false;
return;
}
search();
// }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
}, [search]);
const handleOnCellClick = async (e) => {
// if (e?.field === 'msDate') {
// const params = {
// msDatagb: e.row.msDatagb,
// msSdate: e.row.msSdate,
// msEdate: e.row.msEdate,
// msChasu: e.row.msChasu,
// msuTeam: e.row.msuTeam
// };
// const res = await findJudgeResults(params);
// setJudgeResultData({
// ...res?.data,
// selectedRow: e.row,
// judgeTeam: res.data?.judgeTeam
// });
//
// setTitle(`${e.row.msCdate} ${menuName} (${e.row.msChasu} - ${e.row.cnt})`);
// setOpen(true);
// }
};
return (
<MainCard>
<Grid container spacing={2} alignItems="center">
<Grid item xs={12}>
<Grid container spacing={1}>
<Grid item xs={2}>
<FormControl fullWidth>
<InputLabel required>심의 년도</InputLabel>
<Select
size="small"
id="reviewYear"
name="reviewYear"
defaultValue={year}
onChange={(e) => setSelectedYear(e.target.value)}
>
{years.map((year, idx) => (
<MenuItem key={idx} value={year}>
{year}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
<Grid item>
<OutlinedInput
required
placeholder="심의차수"
onKeyDown={handleSearch}
size="small"
autoFocus
endAdornment={
<InputAdornment position="end">
<IconSearch stroke={1.5} size="1rem" />
</InputAdornment>
}
/>
</Grid>
</Grid>
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<MuiDataGrid
isHideFooter
columns={columns}
rowsState={rowsState}
totalCount={totalCount}
setRowsState={setRowsState}
handleCellClick={handleOnCellClick}
// handleSelection={handleSelection}
// selectionModel={selectionModel}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<div>Empty</div>
</CmmModal>
</MainCard>
);
};
JudgeReview.propTypes = {
msDatagb: PropTypes.string.isRequired,
menuName: PropTypes.string.isRequired
};
export default JudgeReview;

@ -0,0 +1,124 @@
import React, { useEffect, 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';
import PropTypes from 'prop-types';
import { judgeFileDownload } from '../../../apis/judge';
import _ from 'lodash';
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 ProcessJudge = ({ rowDatas, showAlert }) => {
const [previewImage, setPreviewImage] = useState();
const { getRootProps, getInputProps } = useDropzone({
accept: 'image/*',
onDrop: (acceptedFiles) => {
setPreviewImage(URL.createObjectURL(itemData[0].img));
}
});
const viewImg = (scDatagb, scCode, methodName) => {
judgeFileDownload(
{
scDatagb,
scCode,
methodName
},
showAlert
);
};
// rowDatas[0]?[`scFrecad`];
// rowDatas[0]?[`scContad`];
// 1. - msMaincode gnRecallSc
// 2. - judgeFileDownload : data['scPicad1']
useEffect(() => {
rowDatas?.forEach((r) => _.range(1, 5, 1).forEach((idx) => viewImg(r.scDatagb, r.msMaincode, `scPicad${idx}`)));
}, []);
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} />
</>
);
};
ProcessJudge.propTypes = {
rowDatas: PropTypes.array.isRequired,
showAlert: PropTypes.object
};
export default ProcessJudge;

@ -0,0 +1,97 @@
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…
Cancel
Save