diff --git a/src/commons/combo_data.js b/src/commons/combo_data.js index 103fc4d..57ee7de 100644 --- a/src/commons/combo_data.js +++ b/src/commons/combo_data.js @@ -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명' } ] }; diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index cd45973..98860ef 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -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: + // element: + element: }, { path: '/parking/register', diff --git a/src/views/biz/admin/judge/JudgeRegistReview.jsx b/src/views/biz/admin/judge/JudgeRegistReview.jsx index daf3441..e012785 100644 --- a/src/views/biz/admin/judge/JudgeRegistReview.jsx +++ b/src/views/biz/admin/judge/JudgeRegistReview.jsx @@ -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 = () => { diff --git a/src/views/biz/admin/judge/JudgeReview.jsx b/src/views/biz/admin/judge/JudgeReview.jsx index 6366e68..758e69f 100644 --- a/src/views/biz/admin/judge/JudgeReview.jsx +++ b/src/views/biz/admin/judge/JudgeReview.jsx @@ -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) => [} label="Delete" onClick={deleteJudge(params.row)} />], + getActions: (params) => [} 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} /> - + ); }; JudgeReview.propTypes = { - msDatagb: PropTypes.string.isRequired, + msDatagb: PropTypes.string, menuName: PropTypes.string.isRequired }; diff --git a/src/views/biz/admin/judge/ModalJudgeResult.jsx b/src/views/biz/admin/judge/ModalJudgeResult.jsx index 7d86d78..3db00e3 100644 --- a/src/views/biz/admin/judge/ModalJudgeResult.jsx +++ b/src/views/biz/admin/judge/ModalJudgeResult.jsx @@ -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 ( } - onClick={onSearch} + onClick={handleJudgeModal} > 일괄처리 @@ -231,6 +237,7 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse > {judgeResult && `총 ${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length} 건`} + ); }; @@ -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; diff --git a/src/views/biz/admin/parking/ParkingRegister.jsx b/src/views/biz/admin/parking/ParkingRegister.jsx index 9bb2a1e..9498ebd 100644 --- a/src/views/biz/admin/parking/ParkingRegister.jsx +++ b/src/views/biz/admin/parking/ParkingRegister.jsx @@ -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={} onClick={handleSave} > - 저장 + 등록 diff --git a/src/views/biz/admin/parking/ParkingReview.jsx b/src/views/biz/admin/parking/ParkingReview.jsx deleted file mode 100644 index c9ee3c2..0000000 --- a/src/views/biz/admin/parking/ParkingReview.jsx +++ /dev/null @@ -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) => ( - - {params.value} - - ), - 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) => [} 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 ( - - - - - - - 심의 년도 - - - - - - - - } - /> - - - - - - - - - - - - {judgeResultData?.selectedRow && } - - - ); -}; -export default ParkingReview; diff --git a/src/views/biz/judge/JudgeModal.jsx b/src/views/biz/judge/JudgeModal.jsx new file mode 100644 index 0000000..6b922d4 --- /dev/null +++ b/src/views/biz/judge/JudgeModal.jsx @@ -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 ( +
+ {/* */} + + + + + } + > + + + + 부과 기준 + + + + + + + + + + + + + + +
+ ); +}; + +CmmModal.propTypes = { + isBackdrop: PropTypes.bool, + open: PropTypes.bool, + title: PropTypes.string, + setOpen: PropTypes.func, + judgeData: PropTypes.array +}; + +export default CmmModal;