From f1e8cfdf96f3cf970bfa8cb3a003397d6b664a35 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Fri, 6 May 2022 16:48:39 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8B=AC=EC=82=AC=EC=9E=90=20=EC=8B=AC?= =?UTF-8?q?=EC=82=AC=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/parking.js | 21 +- src/commons/ApiUrl.js | 2 + src/menu-items/judge.js | 2 +- src/routes/MainRoutes.js | 5 + src/views/biz/board/NewBoardForm.jsx | 3 - src/views/biz/judge/JudgeByUserReview.jsx | 87 ++++--- .../biz/judge/ParkingJudgeByUserReview.jsx | 238 ++++++++++++++++++ src/views/biz/judge/ProcessJudge.jsx | 21 +- src/views/biz/judge/ProcessParkingJudge.jsx | 206 +++++++++++++++ src/views/cmm/mui-grid/MuiDataGrid.jsx | 2 - 10 files changed, 521 insertions(+), 66 deletions(-) create mode 100644 src/views/biz/judge/ParkingJudgeByUserReview.jsx create mode 100644 src/views/biz/judge/ProcessParkingJudge.jsx diff --git a/src/apis/parking.js b/src/apis/parking.js index c1e3114..8910659 100644 --- a/src/apis/parking.js +++ b/src/apis/parking.js @@ -3,7 +3,14 @@ //---------------------------------------------------------------------------- import axios from 'utils/axios'; -import { GET_PARKING_JUDGE_TARGET_LIST, GET_PARKING_LIST, REMOVE_PARKING_JUDGE, SAVE_PARKING_JUDGE_TARGET_LIST } from 'commons/ApiUrl'; +import { + GET_JUDGE_LIST, + GET_PARKING_JUDGE_LIST, + GET_PARKING_JUDGE_TARGET_LIST, + GET_PARKING_LIST, + REMOVE_PARKING_JUDGE, + SAVE_PARKING_JUDGE_TARGET_LIST +} from 'commons/ApiUrl'; import { setRowId } from './common'; // eslint-disable-next-line no-return-await @@ -34,3 +41,15 @@ export async function removeParkingJudge(params) { // eslint-disable-next-line no-return-await return await axios.post(REMOVE_PARKING_JUDGE, params); } + +//---------------------------------------------------------------- +// 심사자 +//---------------------------------------------------------------- +export async function findByUserJudges(params) { + const res = await axios.get(GET_PARKING_JUDGE_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index e1e2cd0..882bdba 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -24,6 +24,8 @@ export const GET_PARKING_JUDGE_TARGET_LIST = '/api/v1/ctgy/parking/target'; export const SAVE_PARKING_JUDGE_TARGET_LIST = '/api/v1/ctgy/parking/target'; export const REMOVE_PARKING_JUDGE = '/api/v1/ctgy/parking/remove'; +export const GET_PARKING_JUDGE_LIST = '/api/v1/ctgy/parking/judge'; + // 거주자/장애인 의견 진술 export const GET_ADMIN_JUDGE_DATA_LIST = '/api/v1/ctgy/admin/data'; export const SAVE_ADMIN_JUDGE_DATA = '/api/v1/ctgy/admin/data'; diff --git a/src/menu-items/judge.js b/src/menu-items/judge.js index a466e72..55ee123 100644 --- a/src/menu-items/judge.js +++ b/src/menu-items/judge.js @@ -73,7 +73,7 @@ const judge = { id: 'judge-2-1', title: , type: 'item', - url: '/parking/review', + url: '/judge/parking/review', icon: icons.IconList }, { diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index 5bb659d..cd45973 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -17,6 +17,7 @@ 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'))); // Admin Resident /Disabled const JudgeDataReview = Loadable(lazy(() => import('views/biz/admin/judge/JudgeDataReview'))); @@ -106,6 +107,10 @@ const MainRoutes = { }, // ---------------------------------------- + { + path: '/judge/parking/review', + element: + }, { path: '/judge/resident/review', element: diff --git a/src/views/biz/board/NewBoardForm.jsx b/src/views/biz/board/NewBoardForm.jsx index 3d05b22..803a005 100644 --- a/src/views/biz/board/NewBoardForm.jsx +++ b/src/views/biz/board/NewBoardForm.jsx @@ -1,11 +1,8 @@ import { useMemo, useRef, useState } from 'react'; -import { useAlert } from 'react-alert'; // material-ui import { Button, Divider, Grid, TextField } from '@mui/material'; -// assets - // berry ui import ReactQuill from 'react-quill'; import 'react-quill/dist/quill.snow.css'; diff --git a/src/views/biz/judge/JudgeByUserReview.jsx b/src/views/biz/judge/JudgeByUserReview.jsx index 34f173b..ae60c7a 100644 --- a/src/views/biz/judge/JudgeByUserReview.jsx +++ b/src/views/biz/judge/JudgeByUserReview.jsx @@ -172,52 +172,51 @@ const JudgeByUserReview = ({ msDatagb, menuName }) => { return ( - - - - - [ 심의기간 : {' '} - - {minSdate} ~ {maxEdate} - {' '} - ] - + {totalCount > 0 && ( + <> + + + + + [ 심의기간 : {' '} + + {minSdate} ~ {maxEdate} + {' '} + ] + + + + + [ 접수번호 : + + {' '} + {minSeq} ~ {maxSeq} + {' '} + ] + + + + + + + [ {user?.name} 위원 / + {user?.team?.substring(2)}팀 ] + + + + + + - - - [ 접수번호 : - - {' '} - {minSeq} ~ {maxSeq} - {' '} - ] - + + + + - - - - - [ {user?.name} 위원 / - {user?.team?.substring(2)}팀 ] - - - - - - - {/* */} - {/* */} - {/* */} - - - - - - + + )} { + 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(() => { + findByUserJudges().then((res) => { + if (res && res.data) { + setTotalCount(res.count); + setRowsState((prevState) => ({ ...prevState, rows: res.data })); + + if (res?.data?.length > 0) { + 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)); + } + } + }); + }, []); + + const onJudge = () => { + // setRowDatas(rowsState?.rows); + // setTitle(`주정차 의견진술 심의 결정`); + // setOpen(true); + alert('적용예정'); + }; + + const processJudge = useCallback( + (row) => () => { + // setRowDatas([row]); + // setTitle(`주정차 의견진술 심의 결정`); + // setOpen(true); + alert('적용예정'); + }, + [] + ); + + 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: '심사자심사', + headerAlign: 'center', + field: 'msuResult', + align: 'center', + renderCell: (params) => { + switch (params.row.msuResult) { + case '0': + return '심의전'; + // break; + case '1': + return '부과'; + // break; + case '2': + return '미부과'; + // break; + default: + return params.row.msuResult; + } + }, + 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) => [ + } label="개별심사" onClick={processJudge(params.row)} /> + ], + align: 'center' + } + ]; + + const handleSearch = async (event) => { + if (event.type === 'keydown' && event.key === 'Enter') { + search(); + } + }; + + useEffect(() => { + search(); + // }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + }, [search]); + + return ( + + {totalCount > 0 && ( + <> + + + + + [ 심의기간 : {' '} + + {minSdate} ~ {maxEdate} + {' '} + ] + + + + + [ 접수번호 : + + {' '} + {minSeq} ~ {maxSeq} + {' '} + ] + + + + + + + [ {user?.name} 위원 / + {user?.team?.substring(2)}팀 ] + + + + + + + + + + + + + + )} + + + + + + ); +}; + +export default ParkingJudgeByUserReview; diff --git a/src/views/biz/judge/ProcessJudge.jsx b/src/views/biz/judge/ProcessJudge.jsx index f608dc8..9a4769b 100644 --- a/src/views/biz/judge/ProcessJudge.jsx +++ b/src/views/biz/judge/ProcessJudge.jsx @@ -68,14 +68,11 @@ const ProcessJudge = (props) => { <> {picadImgs?.map((img, idx) => ( - + @@ -85,14 +82,11 @@ const ProcessJudge = (props) => { {frecadImgs?.map((img, idx) => ( - + @@ -102,14 +96,11 @@ const ProcessJudge = (props) => { {contadImgs?.map((img, idx) => ( - + diff --git a/src/views/biz/judge/ProcessParkingJudge.jsx b/src/views/biz/judge/ProcessParkingJudge.jsx new file mode 100644 index 0000000..bf15f26 --- /dev/null +++ b/src/views/biz/judge/ProcessParkingJudge.jsx @@ -0,0 +1,206 @@ +import { useEffect, useRef, useState } from 'react'; +import PropTypes from 'prop-types'; + +import { Button, CardMedia, Divider, FormControl, Grid, InputLabel, MenuItem, Select, TextField } from '@mui/material'; +import { findImages, saveJudgeResult } from 'apis/judge'; +import { SkipNext, SkipPrevious, Save } from '@mui/icons-material'; + +const ProcessParkingJudge = (props) => { + const { rowDatas, setOpen, showAlert } = props; + const pageRef = useRef(0); + const totalPageRef = useRef(0); + const curDataRef = useRef({}); + const [picadImgs, setPicadImgs] = useState([]); + const [frecadImgs, setFrecadImgs] = useState([]); + const [contadImgs, setContadImgs] = useState([]); + const [reason, setReason] = useState(); + const [selectedResult, setSelectedResult] = useState(); + + const getImgList = (row) => { + findImages(row, showAlert).then((res) => { + const { arrPicadImg, arrFrecadImg, arrContadImg } = res; + setPicadImgs(arrPicadImg); + setFrecadImgs(arrFrecadImg); + setContadImgs(arrContadImg); + }); + }; + + const onPrev = () => { + pageRef.current -= 1; + curDataRef.current = rowDatas[pageRef.current]; + setReason(curDataRef.current.msuReason ?? ''); + setSelectedResult(curDataRef.current.msuResult); + getImgList(curDataRef.current); + }; + const onNext = () => { + pageRef.current += 1; + curDataRef.current = rowDatas[pageRef.current]; + setReason(curDataRef.current.msuReason ?? ''); + setSelectedResult(curDataRef.current.msuResult); + getImgList(rowDatas[pageRef.current]); + }; + + const handleSave = () => { + saveJudgeResult({ msuCode: curDataRef.current.msuCode, msuResult: selectedResult, msuReason: reason }).then((res) => { + if (res?.success) { + curDataRef.current.msuResult = selectedResult; + curDataRef.current.msuReason = reason; + showAlert.show('심의처리 되었습니다'); + } else { + showAlert.show(`${res?.data.message}`); + } + }); + }; + const handleClose = () => { + setOpen(false); + }; + + useEffect(() => { + pageRef.current = 0; + totalPageRef.current = rowDatas.length - 1; + curDataRef.current = rowDatas[pageRef.current]; + setReason(curDataRef.current.msuReason ?? ''); + setSelectedResult(curDataRef.current.msuResult); + getImgList(curDataRef.current); + }, []); + + return ( + <> + + {picadImgs?.map((img, idx) => ( + + + + ))} + + + + {frecadImgs?.map((img, idx) => ( + + + + ))} + + + + {contadImgs?.map((img, idx) => ( + + + + ))} + + + + + + + + + + + + + + + + + + + + 심의결정 + + + + + + + + setReason(e.target.value)} + /> + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +ProcessParkingJudge.propTypes = { + rowDatas: PropTypes.array.isRequired, + showAlert: PropTypes.object, + setOpen: PropTypes.func.isRequired +}; + +export default ProcessParkingJudge; diff --git a/src/views/cmm/mui-grid/MuiDataGrid.jsx b/src/views/cmm/mui-grid/MuiDataGrid.jsx index f595922..7b6f323 100644 --- a/src/views/cmm/mui-grid/MuiDataGrid.jsx +++ b/src/views/cmm/mui-grid/MuiDataGrid.jsx @@ -3,9 +3,7 @@ import PropTypes from 'prop-types'; // material-ui import { DataGrid, gridClasses } from '@mui/x-data-grid'; -// import { grey } from '@mui/material/colors'; import Box from '@mui/material/Box'; -// import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/styles'; import dataGridKoKR from './defaultDataGridLocale'; import CustomPagination from './CustomPagination';