diff --git a/src/apis/judge.js b/src/apis/judge.js index 6bbd324..e415cd5 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -4,24 +4,25 @@ import axios from 'utils/axios'; import { - GET_JUDGE_DATA, - GET_JUDGE_DATA_LIST, - SAVE_JUDGE_DATA, - GET_JUDGE_TARGET_LIST, - GET_JUDGE_LIST, - SAVE_JUDGE_TARGET_LIST, - GET_JUDGE_RESULT_LIST, + GET_ADMIN_JUDGE_DATA, + GET_ADMIN_JUDGE_DATA_LIST, + SAVE_ADMIN_JUDGE_DATA, + GET_ADMIN_JUDGE_TARGET_LIST, + GET_ADMIN_JUDGE_LIST, + SAVE_ADMIN_JUDGE_TARGET_LIST, + GET_ADMIN_JUDGE_RESULT_LIST, GET_PARKING_JUDGE_RESULT_LIST, - REMOVE_JUDGE, + REMOVE_ADMIN_JUDGE, GET_JUDGE_FILE_DOWNLOAD, - REMOVE_JUDGE_DATA + REMOVE_ADMIN_JUDGE_DATA, + GET_JUDGE_LIST } from 'commons/ApiUrl'; import { setRowId } from './common'; import FileSaver from 'file-saver'; // eslint-disable-next-line no-return-await export async function findJudgeDatas(params) { - const res = await axios.get(GET_JUDGE_DATA_LIST, { params }); + const res = await axios.get(GET_ADMIN_JUDGE_DATA_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; @@ -31,7 +32,7 @@ export async function findJudgeDatas(params) { export async function saveJudgeData(formData) { // eslint-disable-next-line no-return-await - return await axios(SAVE_JUDGE_DATA, { + return await axios(SAVE_ADMIN_JUDGE_DATA, { method: 'post', data: formData, headers: { 'Content-Type': 'multipart/form-data' } // , Authorization: localStorage.getItem('access_token') } @@ -40,16 +41,16 @@ export async function saveJudgeData(formData) { export async function removeJudgeData(params) { // eslint-disable-next-line no-return-await - return await axios.post(REMOVE_JUDGE_DATA, params); + return await axios.post(REMOVE_ADMIN_JUDGE_DATA, params); } export async function findJudge(scCode) { // eslint-disable-next-line no-return-await - return await axios.get(GET_JUDGE_DATA + scCode); + return await axios.get(GET_ADMIN_JUDGE_DATA + scCode); } export async function findJudges(params) { - const res = await axios.get(GET_JUDGE_LIST, { params }); + const res = await axios.get(GET_ADMIN_JUDGE_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; @@ -59,7 +60,7 @@ export async function findJudges(params) { export async function findJudgeResults2(params) { // eslint-disable-next-line no-return-await - return await axios.get(GET_JUDGE_RESULT_LIST, { params }); + return await axios.get(GET_ADMIN_JUDGE_RESULT_LIST, { params }); } /** @@ -69,7 +70,7 @@ export async function findJudgeResults2(params) { * @returns {Promise<{judgeData: ([]|*), judgeTeam: *, totJudgeUserData: *[][], simsaUser: *}|*>} */ export async function findJudgeResults(params, isParking) { - const res = await axios.get(isParking ? GET_PARKING_JUDGE_RESULT_LIST : GET_JUDGE_RESULT_LIST, { params }); + const res = await axios.get(isParking ? GET_PARKING_JUDGE_RESULT_LIST : GET_ADMIN_JUDGE_RESULT_LIST, { params }); if (res && res.success && res.data) { const totJudgeUserData = res.data?.totJudgeUserData; @@ -104,7 +105,7 @@ export async function findJudgeResults(params, isParking) { } export async function findJudgeTargets(params) { - const res = await axios.get(GET_JUDGE_TARGET_LIST, { params }); + const res = await axios.get(GET_ADMIN_JUDGE_TARGET_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; @@ -114,12 +115,12 @@ export async function findJudgeTargets(params) { export async function saveJudgeTargets(params) { // eslint-disable-next-line no-return-await - return await axios.post(SAVE_JUDGE_TARGET_LIST, params); + return await axios.post(SAVE_ADMIN_JUDGE_TARGET_LIST, params); } export async function removeJudge(params) { // eslint-disable-next-line no-return-await - return await axios.post(REMOVE_JUDGE, params); + return await axios.post(REMOVE_ADMIN_JUDGE, params); } export async function judgeFileDownload(params, alert) { @@ -153,3 +154,15 @@ export async function judgeFileDownload(params, alert) { } }); } + +//---------------------------------------------------------------- +// 심사자 +//---------------------------------------------------------------- +export async function findByUserJudges(params) { + const res = await axios.get(GET_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 6e13c51..84b769d 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -25,18 +25,21 @@ 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_JUDGE_DATA_LIST = '/api/v1/ctgy/judge/data'; -export const SAVE_JUDGE_DATA = '/api/v1/ctgy/judge/data'; -export const GET_JUDGE_DATA = '/api/v1/ctgy/judge/data/'; -export const REMOVE_JUDGE_DATA = '/api/v1/ctgy/judge/data/remove'; +export const GET_ADMIN_JUDGE_DATA_LIST = '/api/v1/ctgy/admin/data'; +export const SAVE_ADMIN_JUDGE_DATA = '/api/v1/ctgy/admin/data'; +export const GET_ADMIN_JUDGE_DATA = '/api/v1/ctgy/admin/data/'; +export const REMOVE_ADMIN_JUDGE_DATA = '/api/v1/ctgy/admin/data/remove'; + +export const GET_ADMIN_JUDGE_LIST = '/api/v1/ctgy/admin'; +export const GET_ADMIN_JUDGE_RESULT_LIST = '/api/v1/ctgy/admin/result'; + +export const GET_ADMIN_JUDGE_TARGET_LIST = '/api/v1/ctgy/admin/target'; +export const SAVE_ADMIN_JUDGE_TARGET_LIST = '/api/v1/ctgy/admin/target'; +export const REMOVE_ADMIN_JUDGE = '/api/v1/ctgy/admin/remove'; export const GET_JUDGE_LIST = '/api/v1/ctgy/judge'; -export const GET_JUDGE_RESULT_LIST = '/api/v1/ctgy/judge/result'; -export const GET_JUDGE_FILE_DOWNLOAD = '/api/v1/ctgy/cmm/download/judge'; -export const GET_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target'; -export const SAVE_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target'; -export const REMOVE_JUDGE = '/api/v1/ctgy/judge/remove'; +export const GET_JUDGE_FILE_DOWNLOAD = '/api/v1/ctgy/cmm/download/judge'; // 사용자 관리 export const GET_USER_LIST = '/api/v1/ctgy/user'; diff --git a/src/menu-items/judge.js b/src/menu-items/judge.js index 4e42faf..a466e72 100644 --- a/src/menu-items/judge.js +++ b/src/menu-items/judge.js @@ -81,7 +81,7 @@ const judge = { id: 'judge-2-2', title: , type: 'item', - url: '/resident/review', + url: '/judge/resident/review', icon: icons.IconList }, { @@ -89,7 +89,7 @@ const judge = { id: 'judge-2-3', title: , type: 'item', - url: '/disabled/review', + url: '/judge/disabled/review', icon: icons.IconList } ] diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index 3f35b65..95e67f1 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -18,10 +18,11 @@ const Board = Loadable(lazy(() => import('views/biz/board/Board'))); const ParkingReview = Loadable(lazy(() => import('views/biz/admin/parking/ParkingReview'))); const ParkingRegister = Loadable(lazy(() => import('views/biz/admin/parking/ParkingRegister'))); -// Resident /Disabled +// Admin Resident /Disabled 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'))); // user const UserManager = Loadable(lazy(() => import('views/biz/user/UserManager'))); @@ -105,6 +106,15 @@ const MainRoutes = { }, // ---------------------------------------- + { + path: '/judge/resident/review', + element: + }, + { + path: '/judge/disabled/review', + element: + }, + { path: '/sample-page', element: diff --git a/src/views/biz/admin/judge/JudgeDataDetailForm.jsx b/src/views/biz/admin/judge/JudgeDataDetailForm.jsx index d1f25b2..ab2d5e8 100644 --- a/src/views/biz/admin/judge/JudgeDataDetailForm.jsx +++ b/src/views/biz/admin/judge/JudgeDataDetailForm.jsx @@ -136,7 +136,18 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav /> - + diff --git a/src/views/biz/admin/judge/JudgeDataModifyForm.jsx b/src/views/biz/admin/judge/JudgeDataModifyForm.jsx index f0a16a5..2d445cb 100644 --- a/src/views/biz/admin/judge/JudgeDataModifyForm.jsx +++ b/src/views/biz/admin/judge/JudgeDataModifyForm.jsx @@ -288,6 +288,10 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav { }} /> - + setScJuso(e?.target?.value)} /> diff --git a/src/views/biz/admin/judge/JudgeReview.jsx b/src/views/biz/admin/judge/JudgeReview.jsx index bc71011..1f5214f 100644 --- a/src/views/biz/admin/judge/JudgeReview.jsx +++ b/src/views/biz/admin/judge/JudgeReview.jsx @@ -111,14 +111,30 @@ const JudgeReview = ({ msDatagb, menuName }) => { valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`, align: 'center' }, + /* { headerName: '상태', headerAlign: 'center', field: 'msResult', width: 150, - renderCell: (params) => <>{params.row.msResult === '1' ? '진행중' : '심사완료'}, + renderCell: (params) => { + switch (params.row.msResult) { + case '0': + return '심의전'; + // break; + case '1': + return '부과'; + // break; + case '2': + return '미부과'; + // break; + default: + return params.row.msResult; + } + }, align: 'center' }, + */ { headerName: '삭제', headerAlign: 'center', diff --git a/src/views/biz/admin/judge/ModalJudgeResult.jsx b/src/views/biz/admin/judge/ModalJudgeResult.jsx index 71b483b..359c1a4 100644 --- a/src/views/biz/admin/judge/ModalJudgeResult.jsx +++ b/src/views/biz/admin/judge/ModalJudgeResult.jsx @@ -94,13 +94,21 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse }; return ( - + - 심의차수: {selectedRow.msChasu}차 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate} + 심의차수: {selectedRow.msChasu}차 ㅣ 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate} @@ -192,11 +200,21 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse ))} - {judgeResult && `총 ${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length} 건`} + {/* {judgeResult && `총 ${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length} 건`} */} + + {judgeResult && `총 ${selectedRow.cnt} 건중 ${judgeResult.judgeCars.length} 건`} + ); }; diff --git a/src/views/biz/admin/parking/ParkingReview.jsx b/src/views/biz/admin/parking/ParkingReview.jsx index e2874eb..dd77928 100644 --- a/src/views/biz/admin/parking/ParkingReview.jsx +++ b/src/views/biz/admin/parking/ParkingReview.jsx @@ -112,6 +112,7 @@ const ParkingReview = () => { valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`, align: 'center' }, + /* { headerName: '상태', headerAlign: 'center', @@ -120,6 +121,7 @@ const ParkingReview = () => { renderCell: (params) => <>{params.row.msResult === '1' ? '진행중' : '심사완료'}, align: 'center' }, + */ { headerName: '삭제', headerAlign: 'center', diff --git a/src/views/biz/board/PublicBoardForm.jsx b/src/views/biz/board/PublicBoardForm.jsx index 40d2a90..46ce456 100644 --- a/src/views/biz/board/PublicBoardForm.jsx +++ b/src/views/biz/board/PublicBoardForm.jsx @@ -112,7 +112,7 @@ const PublicBoardForm = (props) => { { quillRef.current = element; } }} - readOnly={!owner} + readOnly={!create} value={contents} onChange={setContents} modules={modules} @@ -175,7 +175,7 @@ const PublicBoardForm = (props) => { { - {!create && ( - diff --git a/src/views/biz/judge/JudgeReview.jsx b/src/views/biz/judge/JudgeReview.jsx new file mode 100644 index 0000000..b66532d --- /dev/null +++ b/src/views/biz/judge/JudgeReview.jsx @@ -0,0 +1,286 @@ +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 { Button, Divider, FormControl, Grid, InputAdornment, Link, MenuItem, OutlinedInput, Select } from '@mui/material'; +import DeleteIcon from '@mui/icons-material/Delete'; +import { IconSearch, IconFileReport } 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, findJudgeResults, findJudges, removeJudge } 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: '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) => { + switch (params.row.msResult) { + case '0': + return '심의전'; + // break; + case '1': + return '부과'; + // break; + case '2': + return '미부과'; + // break; + default: + return params.row.msResult; + } + }, + align: 'center' + }, + { + headerName: '개별심사', + headerAlign: 'center', + field: 'actions', + type: 'actions', + width: 80, + // getActions: (params) => [} label="개별심사" onClick={deleteJudge(params.row)} />], + getActions: (params) => [ + + ], + 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 ( + + + + + + + 심의 년도 + + + + + + + + } + /> + + + + + + + + + + + +
Empty
+
+
+ ); +}; +JudgeReview.propTypes = { + msDatagb: PropTypes.string.isRequired, + menuName: PropTypes.string.isRequired +}; + +export default JudgeReview; diff --git a/src/views/cmm/file-ctl/FileForm.jsx b/src/views/cmm/file-ctl/FileForm.jsx index 15cf34e..70d26ce 100644 --- a/src/views/cmm/file-ctl/FileForm.jsx +++ b/src/views/cmm/file-ctl/FileForm.jsx @@ -13,7 +13,7 @@ const FileForm = ({ isDownload = false, isDisabled = false, labelName, selectedF return ( - + {isDownload ? (