feat: 심사결과 일괄처리 적용

main
Lim Jonguk 3 years ago
parent e94f4824ec
commit f4f07d0ad8

@ -4,6 +4,15 @@ const combo = {
{ code: '002', value: '2팀' },
{ code: '003', value: '3팀' },
{ code: '004', value: '4팀' }
],
judgeStds: [
{ code: '1', value: '1명' },
{ code: '2', value: '2명' },
{ code: '3', value: '3명' },
{ code: '4', value: '4명' },
{ code: '5', value: '5명' },
{ code: '6', value: '6명' },
{ code: '7', value: '7명' }
]
};

@ -15,7 +15,6 @@ const PublicBoard = Loadable(lazy(() => import('views/biz/pboard/PublicBoard')))
const Board = Loadable(lazy(() => import('views/biz/board/Board')));
// parking
const ParkingReview = Loadable(lazy(() => import('views/biz/admin/parking/ParkingReview')));
const ParkingRegister = Loadable(lazy(() => import('views/biz/admin/parking/ParkingRegister')));
const ParkingUserByJudgeReview = Loadable(lazy(() => import('views/biz/judge/ParkingJudgeByUserReview')));
@ -58,7 +57,8 @@ const MainRoutes = {
/* 주정차 */
{
path: '/parking/review',
element: <ParkingReview />
// element: <ParkingReview />
element: <JudgeReview msDatagb="" menuName="주정차" />
},
{
path: '/parking/register',

@ -75,39 +75,37 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => {
};
const handleSave = () => {
if (window.confirm('저장 하시겠습니까?')) {
if (selectionModel.length === 0) {
xitCmm.alertParam(`처리할 데이타가 없습니다`);
} else {
setTitle(`${menuName} 의견진술 심의목록 저장`);
setOpen(true);
// alert(` => ${selectRows}`);
}
if (selectionModel.length === 0) {
xitCmm.alertParam(`처리할 데이타가 없습니다`);
} else {
window.close();
setTitle(`${menuName} 의견진술 심의목록 저장`);
setOpen(true);
// alert(` => ${selectRows}`);
}
};
const submitResidentTargets = (params) => {
const param = {
...params,
scDatagb, //
scTransfer,
scSeq1,
scSeq2,
scCodes: selectionModel.map((d) => rowsState.rows[d - 1].scCode)
};
setOpen(false);
console.log(param);
saveJudgeTargets(param).then((res) => {
if (res?.success) {
setSelectionModel([]);
search();
} else {
showAlert.show(`${res?.data.message}`);
}
});
if (window.confirm('저장 하시겠습니까?')) {
const param = {
...params,
scDatagb, //
scTransfer,
scSeq1,
scSeq2,
scCodes: selectionModel.map((d) => rowsState.rows[d - 1].scCode)
};
setOpen(false);
console.log(param);
saveJudgeTargets(param).then((res) => {
if (res?.success) {
setSelectionModel([]);
search();
} else {
showAlert.show(`${res?.data.message}`);
}
});
}
};
const handleSearch = () => {

@ -19,11 +19,15 @@ import InputLabel from 'ui-component/extended/Form/InputLabel';
import { findJudgeResults, findJudges, removeJudge } from 'apis/judge';
import CmmModal from 'views/cmm/CmmModal';
import ModalJudgeResult from './ModalJudgeResult';
import { findParkings, removeParkingJudge } from '../../../../apis/parking';
import { useAlert } from 'react-alert';
const year = getYear(new Date());
const years = _.range(year, year - 14, -1);
const JudgeReview = ({ msDatagb, menuName }) => {
const showAlert = useAlert();
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();
@ -49,37 +53,52 @@ const JudgeReview = ({ msDatagb, menuName }) => {
});
const [judgeDatas, setJudgeDatas] = useState([]);
const search = useCallback(() => {
const search = useCallback(async () => {
const params = {
msDatagb,
page: rowsState.page,
size: rowsState.pageSize
};
findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => {
if (response && response.data) {
setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data }));
// apiRef.current.forceUpdate(); // .updateRowData([]);
// apiRef.current.updateRowData([]);
}
});
let res = {};
if (msDatagb) {
res = await findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt });
} else {
res = await findParkings({ ...params, msYear: selectedYear, msChasu: searchTxt });
}
if (res && res.data) {
console.log(res);
setTotalCount(res.count);
setRowsState((prevState) => ({ ...prevState, rows: res.data }));
}
// findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => {
// if (response && response.data) {
// setTotalCount(response.count);
// setRowsState((prevState) => ({ ...prevState, rows: response.data }));
// }
// });
}, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
const deleteJudge = useCallback(
(row) => () => {
const removeJudge = useCallback(
(row) => async () => {
let res = {};
if (window.confirm('삭제 하시겠습니까?')) {
removeJudge(row).then((response) => {
if (response && response.success) {
setRowsState({
...rowsState,
page: 0
});
search();
} else {
alert.show(response.message);
}
});
if (msDatagb) {
res = await removeJudge(row);
} else {
res = await removeParkingJudge(row);
}
console.log(res);
if (res && res.success) {
setRowsState({
...rowsState,
page: 0
});
search();
} else {
showAlert.show(res.message);
}
} else {
window.close();
}
@ -122,7 +141,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
field: 'actions',
type: 'actions',
width: 80,
getActions: (params) => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" onClick={deleteJudge(params.row)} />],
getActions: (params) => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" onClick={removeJudge(params.row)} />],
align: 'center'
}
];
@ -149,13 +168,17 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const handleOnCellClick = async (e) => {
if (e?.field === 'msDate') {
const params = {
msDatagb: e.row.msDatagb,
msDatagb,
msSdate: e.row.msSdate,
msEdate: e.row.msEdate,
msChasu: e.row.msChasu,
msuTeam: e.row.msuTeam
};
const res = await findJudgeResults(params);
const res = await findJudgeResults(params, msDatagb === '');
if (!res.success) {
showAlert.show(res.message);
return;
}
const arrJudgeData = [];
// eslint-disable-next-line no-plusplus
for (let idx = 0; idx < res.data.judgeCars.length; idx++) {
@ -163,12 +186,14 @@ const JudgeReview = ({ msDatagb, menuName }) => {
arrJudgeData.push({ msMaincode: res.data.judgeUserData[idx].msMaincode, msSeq: res.data.judgeUserData[idx].msSeq });
}
}
console.log(arrJudgeData);
setJudgeDatas(arrJudgeData);
setJudgeResultData({
...res?.data,
selectedRow: e.row,
judgeTeam: res.data?.judgeTeam
judgeTeam: res.data?.judgeTeam,
dataGb: msDatagb
});
setTitle(`${e.row.msCdate} ${menuName} 심사 결과 (${e.row.msChasu}차 - 총 ${e.row.cnt}건)`);
@ -189,7 +214,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
id="reviewYear"
name="reviewYear"
defaultValue={year}
value={year}
value={selectedYear}
onChange={(e) => setSelectedYear(e.target.value)}
>
{years.map((year, idx) => (
@ -230,13 +255,13 @@ const JudgeReview = ({ msDatagb, menuName }) => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ModalJudgeResult {...judgeResultData} />
<ModalJudgeResult {...judgeResultData} judgeData={judgeDatas} />
</CmmModal>
</MainCard>
);
};
JudgeReview.propTypes = {
msDatagb: PropTypes.string.isRequired,
msDatagb: PropTypes.string,
menuName: PropTypes.string.isRequired
};

@ -16,6 +16,7 @@ import { IconSearch } from '@tabler/icons';
import { findJudgeResults } from 'apis/judge';
import _ from 'lodash';
import { useAlert } from 'react-alert';
import JudgeModal from '../../judge/JudgeModal';
const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
@ -39,8 +40,10 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
const totLabel = ['부과', '서손', '미부과', '계'];
const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam, judgeData }) => {
const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam, judgeData, dataGb }) => {
const alert = useAlert();
const [open, setOpen] = useState(false);
const [title, setTitle] = useState('심사 처리');
const [judgeResult, setJudgeResult] = useState({
totJudgeUsers,
totJudgeUserData,
@ -53,18 +56,17 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
const onSearch = async () => {
if (msuTeam) {
const params = {
msDatagb: selectedRow.msDatagb ?? '',
msDatagb: dataGb,
msSdate: selectedRow.msSdate,
msEdate: selectedRow.msEdate,
msChasu: selectedRow.msChasu,
msuTeam
};
const res = await findJudgeResults(params, params.msDatagb === '');
const res = await findJudgeResults(params, dataGb === '');
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 });
}
@ -91,6 +93,10 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
}
};
const handleJudgeModal = () => {
setOpen(true);
};
return (
<Box
sx={{
@ -132,7 +138,7 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
color="primary"
size="small"
startIcon={<IconSearch />}
onClick={onSearch}
onClick={handleJudgeModal}
>
일괄처리
</Button>
@ -231,6 +237,7 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
>
{judgeResult && `${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length}`}
</TableFooter>
<JudgeModal open={open} setOpen={setOpen} title={title} judgeData={judgeDatas} />
</Box>
);
};
@ -240,7 +247,8 @@ ModalJudgeResult.propTypes = {
judgeCars: PropTypes.array,
judgeUserData: PropTypes.array,
selectedRow: PropTypes.object.isRequired,
judgeTeam: PropTypes.string
judgeTeam: PropTypes.string,
dataGb: PropTypes.string
};
export default ModalJudgeResult;

@ -34,8 +34,8 @@ const ParkingRegister = () => {
const [open, setOpen] = useState(false);
const columns = [
{ headerName: 'No', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 },
{ headerName: '접수번호', headerAlign: 'center', field: 'rcSeq', align: 'center' },
{ headerName: 'No', headerAlign: 'center', field: 'rowId', align: 'center', width: 80 },
{ headerName: '접수번호', headerAlign: 'center', field: 'rcSeq', align: 'center', width: 130 },
{ headerName: '최초차량번호', headerAlign: 'center', field: 'mmOcarno', align: 'center', minWidth: 110 },
{ headerName: '최종차량번호', headerAlign: 'center', field: 'mmNcarno', align: 'center', minWidth: 110 },
{ headerName: '성명', headerAlign: 'center', field: 'rcName', minWidth: 150 },
@ -45,10 +45,13 @@ const ParkingRegister = () => {
headerAlign: 'center',
field: 'rcDate',
align: 'center',
format: '####-##-##'
// valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`
width: 150,
valueFormatter: (params) => {
if (params.value == null || params.value.length < 8) return params.value;
return xitCmm.formatDateStr(params.value, '-');
}
},
{ headerName: '접수방법', headerAlign: 'center', field: 'rcIngbNm', align: 'center' }
{ headerName: '접수방법', headerAlign: 'center', field: 'rcIngbNm', align: 'center', width: 120 }
];
const search = () => {
@ -68,33 +71,31 @@ const ParkingRegister = () => {
};
const handleSave = () => {
if (window.confirm('저장 하시겠습니까?')) {
if (selectionModel.length === 0) {
xitCmm.alertParam(`처리할 데이타가 없습니다`);
} else {
setOpen(true);
// alert(` => ${selectRows}`);
}
if (selectionModel.length === 0) {
xitCmm.alertParam(`처리할 데이타가 없습니다`);
} else {
window.close();
setOpen(true);
// alert(` => ${selectRows}`);
}
};
const submitParkingTargets = (params) => {
const param = {
...params,
rcIrTransfer,
rcSeq1,
rcSeq2,
rcCodes: selectionModel.map((d) => rowsState.rows[d - 1].rcCode)
};
setOpen(false);
// return false;
saveParkingJudgeTargets(param).then(() => {
setSelectionModel([]);
search();
});
if (window.confirm('저장 하시겠습니까?')) {
const param = {
...params,
rcIrTransfer,
rcSeq1,
rcSeq2,
rcCodes: selectionModel.map((d) => rowsState.rows[d - 1].rcCode)
};
setOpen(false);
// return false;
saveParkingJudgeTargets(param).then(() => {
setSelectionModel([]);
search();
});
}
};
const handleSearch = () => {
@ -178,7 +179,7 @@ const ParkingRegister = () => {
startIcon={<PersonAddTwoToneIcon />}
onClick={handleSave}
>
저장
등록
</Button>
</Grid>
<Grid item>

@ -1,249 +0,0 @@
import { useCallback, useEffect, useRef, useState } from 'react';
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 DeleteIcon from '@mui/icons-material/Delete';
// assets
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 { findParkings, removeParkingJudge } from 'apis/parking';
import { findJudgeResults } from 'apis/judge';
import InputLabel from 'ui-component/extended/Form/InputLabel';
import ModalJudgeResult from 'views/biz/admin/judge/ModalJudgeResult';
import CmmModal from 'views/cmm/CmmModal';
import { useAlert } from 'react-alert';
const ParkingReview = () => {
const isInit = useRef(true);
const year = getYear(new Date());
const years = _.range(year, year - 14, -1);
const alert = useAlert();
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: 20,
rows: []
// loading: false
});
const [judgeResultData, setJudgeResultData] = useState({
totJudgeUserData: [],
judgeData: [],
simsaUser: [],
selectedRow: {},
judgeTeam: ''
});
const [judgeDatas, setJudgeDatas] = useState([]);
const search = useCallback(() => {
const params = {
page: rowsState.page,
size: rowsState.pageSize
};
findParkings({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => {
if (response && response.data) {
setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data }));
// apiRef.current.forceUpdate(); // .updateRowData([]);
// apiRef.current.updateRowData([]);
}
});
}, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
const removeJudge = useCallback(
(row) => () => {
if (window.confirm('삭제 하시겠습니까?')) {
removeParkingJudge(row).then((response) => {
if (response && response.success) {
setRowsState({
...rowsState,
page: 0
});
search();
} else {
alert.show(response.message);
}
});
} else {
window.close();
}
},
[]
);
const columns = [
// { headerName: 'rowId', field: 'rowId' },
{ headerName: '심의 차수', headerAlign: 'center', field: 'msChasu', align: 'center', width: 100 },
{ headerName: '심사 건수', headerAlign: 'center', field: 'cnt', align: 'center', 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: 'msResult',
width: 150,
renderCell: (params) => <>{params.row.msResult === '1' ? '진행중' : '심사완료'}</>,
align: 'center'
},
*/
{
headerName: '삭제',
headerAlign: 'center',
field: 'actions',
type: 'actions',
width: 80,
getActions: (params) => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" onClick={removeJudge(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: '',
msSdate: e.row.msSdate,
msEdate: e.row.msEdate,
msChasu: e.row.msChasu,
msuTeam: e.row.msuTeam
};
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,
judgeTeam: res.data?.judgeTeam
});
setTitle(`${e.row.msCdate} 주정차 심사 결과 (${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
columns={columns}
rowsState={rowsState}
totalCount={totalCount}
setRowsState={setRowsState}
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
{judgeResultData?.selectedRow && <ModalJudgeResult {...judgeResultData} judgeData={judgeDatas} />}
</CmmModal>
</MainCard>
);
};
export default ParkingReview;

@ -0,0 +1,86 @@
import PropTypes from 'prop-types';
import Modal from '@mui/material/Modal';
import { Divider, FormControl, Grid, IconButton, InputLabel, MenuItem, Select } from '@mui/material';
import CloseOutlined from '@mui/icons-material/CloseOutlined';
import MainCard from 'ui-component/cards/MainCard';
import { IconSearch } from '@tabler/icons';
import Button from '@mui/material/Button';
import combo from 'commons/combo_data';
import { useState } from 'react';
const style = {
position: 'relative',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 500,
minHeight: 300,
bgcolor: 'background.paper',
border: '2px solid #000',
boxShadow: 24,
p: 3
};
const CmmModal = ({ isBackdrop = false, open, setOpen, title, judgeData = () => {} }) => {
const [judgeStd, setJudgeStd] = useState('1');
const handleClose = () => {
setOpen(false);
};
const handleJudge = () => {
alert(`[${JSON.stringify(judgeData)}]==>>심사기준::${judgeStd}`);
};
return (
<div className="modalGroup">
{/* <Button onClick={handleOpen}>Grid Modal(List)</Button> */}
<Modal hideBackdrop={isBackdrop} open={open} aria-labelledby="modal-modal-title" aria-describedby="modal-modal-description">
<MainCard
sx={style}
title={title}
content
secondary={
<IconButton size="small" variant="rounded" onClick={handleClose}>
<CloseOutlined fontSize="small" />
</IconButton>
}
>
<Grid container spacing={1} alignItems="center">
<Grid item xs={12}>
<FormControl fullWidth>
<InputLabel required>부과 기준</InputLabel>
<Select defaultValue={judgeStd} value={judgeStd} onChange={(e) => setJudgeStd(e.target.value)}>
{combo.judgeStds.map((judge, idx) => (
<MenuItem key={idx} value={judge.code}>
{judge.value}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
</Grid>
<Grid item xs={12}>
<Divider />
</Grid>
<Grid container spacing={1} mt={1}>
<Grid item xs={12} style={{ marginLeft: 'auto' }}>
<Button variant="contained" color="primary" size="small" startIcon={<IconSearch />} onClick={handleJudge}>
저장
</Button>
</Grid>
</Grid>
</MainCard>
</Modal>
</div>
);
};
CmmModal.propTypes = {
isBackdrop: PropTypes.bool,
open: PropTypes.bool,
title: PropTypes.string,
setOpen: PropTypes.func,
judgeData: PropTypes.array
};
export default CmmModal;
Loading…
Cancel
Save