diff --git a/src/apis/judge.js b/src/apis/judge.js index d089735..422f46a 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -9,7 +9,8 @@ import { SAVE_JUDGE_DATA, GET_JUDGE_TARGET_LIST, GET_JUDGE_LIST, - SAVE_JUDGE_TARGET_LIST + SAVE_JUDGE_TARGET_LIST, + GET_JUDGE_DETAIL_LIST } from 'commons/ApiUrl'; import { setRowId } from './common'; @@ -49,6 +50,15 @@ export async function findJudges(params) { return res; } +export async function findJudgeDetails(params) { + const res = await axios.get(GET_JUDGE_DETAIL_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + export async function findJudgeTargets(params) { const res = await axios.get(GET_JUDGE_TARGET_LIST, { params }); if (res.success) { diff --git a/src/apis/parking.js b/src/apis/parking.js index 522b054..858de21 100644 --- a/src/apis/parking.js +++ b/src/apis/parking.js @@ -3,7 +3,7 @@ //---------------------------------------------------------------------------- import axios from 'utils/axios'; -import { GET_PARKING_JUDGE_TARGET_LIST, GET_PARKING_LIST, SAVE_PARKING_JUDGE_TARGET_LIST } from 'commons/ApiUrl'; +import { GET_PARKING_DETAIL_LIST, GET_PARKING_JUDGE_TARGET_LIST, GET_PARKING_LIST, SAVE_PARKING_JUDGE_TARGET_LIST } from 'commons/ApiUrl'; import { setRowId } from './common'; // eslint-disable-next-line no-return-await @@ -16,6 +16,15 @@ export async function findParkings(params) { return res; } +export async function findParkingDetails(params) { + const res = await axios.get(GET_PARKING_DETAIL_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + export async function findParkingJudgeTargets(params) { const res = await axios.get(GET_PARKING_JUDGE_TARGET_LIST, { params }); if (res.success) { @@ -32,12 +41,3 @@ export async function saveParkingJudgeTargets(params) { } return res; } - -// export async function findParkingDetails(params) { -// const res = await axios.get(GET_PARKING_DETAILS_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 15a2b23..398fb3f 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -16,16 +16,17 @@ export const GET_BOARD_LIST = '/api/v1/ctgy/board'; // 주정차 의견 진술 export const GET_PARKING_LIST = '/api/v1/ctgy/parking'; +export const GET_PARKING_DETAIL_LIST = '/api/v1/ctgy/parking/detail'; 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 GET_PARKING_DETAILS_LIST = '/api/v1/ctgy/parking/details'; // 거주자/장애인 의견 진술 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 GET_JUDGE_LIST = '/api/v1/ctgy/judge'; -export const GET_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target'; +export const GET_JUDGE_DETAIL_LIST = '/api/v1/ctgy/judge/detail'; +export const GET_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge'; export const SAVE_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target'; // 장애인 의견 진술 diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index 843d02b..bf8754d 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -22,7 +22,9 @@ const ParkingRegister = Loadable(lazy(() => import('views/biz/parking/ParkingReg // resident const ResidentDataReview = Loadable(lazy(() => import('views/biz/resident/ResidentDataReview'))); const ResidentRegister = Loadable(lazy(() => import('views/biz/resident/ResidentRegist'))); -const ResidentReview = Loadable(lazy(() => import('views/biz/resident/ResidentReview'))); + +// Resident /Disabled +const JudgeReview = Loadable(lazy(() => import('views/biz/judge/JudgeReview'))); // disabled // const DisabledDataReview = Loadable(lazy(() => import('views/biz/disabled/DisabledDataReview'))); @@ -76,7 +78,7 @@ const MainRoutes = { }, { path: '/resident/review', - element: + element: }, { path: '/resident/register', @@ -89,7 +91,7 @@ const MainRoutes = { }, { path: '/disabled/review', - element: <> // + element: // }, { path: '/disabled/register', diff --git a/src/utils/axios.js b/src/utils/axios.js index a59aac8..ab6b706 100755 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -38,17 +38,9 @@ const alertError = (config, request, response, error) => { return; } if (response.data) { - const errCode = response.data.code || response.data.status; - let errMsg = ''; - if (response.data.code !== '' && response.data.code !== null) { - if (response.data.message !== '' && response.data.message != null) { - errMsg = response.data.message; - } else { - errMsg = response.data.error; - } - } - console.error(`${errCode}: ${errMsg}`); - console.error('================================='); + const errCode = response.data?.code || response.data?.status; + const errMsg = response.data?.message || response.data?.error; + console.error(`============= ${errCode}: ${errMsg} ====================`); // Alert.error(`${errCode}: ${errMsg}`); Swal.fire({ diff --git a/src/views/biz/resident/ResidentReview.jsx b/src/views/biz/judge/JudgeReview.jsx similarity index 76% rename from src/views/biz/resident/ResidentReview.jsx rename to src/views/biz/judge/JudgeReview.jsx index a422eea..68abbef 100644 --- a/src/views/biz/resident/ResidentReview.jsx +++ b/src/views/biz/judge/JudgeReview.jsx @@ -16,14 +16,21 @@ import MainCard from 'ui-component/cards/MainCard'; import MuiDataGrid from 'views/form/MuiDataGrid'; import xitCmm from 'commons/XitCmm'; import InputLabel from 'ui-component/extended/Form/InputLabel'; -import { findJudges } from 'apis/judge'; +import { findJudge, findJudges } from 'apis/judge'; +import CmmModal from 'views/form/Modal/CmmModal'; +import ModalJudgeDetail from './ModalJudgeDetail'; -const ResidentReview = () => { +const JudgeReview = ({ msDatagb, menuName }) => { const isInit = useRef(true); const year = getYear(new Date()); console.log(typeof year); const years = _.range(year, year - 14, -1); + const [open, setOpen] = useState(false); + // const [create, setCreate] = useState(false); + // const [selectedRow, setSelectedRow] = useState({}); + const [title, setTitle] = useState(); + const [selectedYear, setSelectedYear] = useState(year); const [searchTxt, setSearchTxt] = useState(''); @@ -34,7 +41,8 @@ const ResidentReview = () => { rows: [] // loading: false }); - const removeSimsa = useCallback( + const [selectedRowData, setSelectedRowData] = useState({}); + const removeJudge = useCallback( (row) => () => { // setTimeout(() => { // setRowsState((prevRows) => prevRows.filter((row) => row.rowId !== rowId)); @@ -45,24 +53,6 @@ const ResidentReview = () => { [] ); - const openModalDetails = () => {}; - - /* - ms_maincode : '민원코드' - ms_seq : '접수번호' - ms_carnum : '차량번호' - ms_year : '년도' - ms_chasu : '차수' - ms_sdate : '심사시작일시' - ms_startsi : '심사시작시간' - ms_edate : '심사종료일시' - ms_cdate : '심사마감일시' - ms_closesi : '심사마감시간' - ms_wdate : '단속일자' - ms_pos : '단속장소' - ms_result : '결과코드' - ms_jbtime : '단속시간' - */ const columns = [ // { headerName: 'rowId', field: 'rowId' }, { headerName: '심의차수', headerAlign: 'center', field: 'msChasu', align: 'center' }, @@ -75,19 +65,9 @@ const ResidentReview = () => { description: '심사기간', valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`, renderCell: (params) => ( - // - navigate(`/parking/details?msChasu=${params.msChasu}&msSdate=${params.msSdate}&msEdate=${params.msEdate}`)} - onClick={openModalDetails} - data-target="modalDetails" - rel="noopener" - > - {/* }> */} - {/* }> */} + {params.value} - // ), align: 'center' }, @@ -113,14 +93,14 @@ const ResidentReview = () => { field: 'actions', type: 'actions', width: 80, - getActions: (params) => [} label="Delete" onClick={removeSimsa(params.row)} />], + getActions: (params) => [} label="Delete" onClick={removeJudge(params.row)} />], align: 'center' } ]; const search = useCallback(() => { const params = { - // scDatagb: '1', + msDatagb, page: rowsState.page, size: rowsState.pageSize }; @@ -133,7 +113,7 @@ const ResidentReview = () => { // apiRef.current.updateRowData([]); } }); - }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + }, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); const handleSearch = async (event) => { if (!selectedYear) return; @@ -154,6 +134,25 @@ const ResidentReview = () => { // }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); }, [search]); + const handleOnCellClick = (e) => { + if (e?.field === 'msDate') { + // findJudge(e.row?.msDate).then((res) => { + // setRowData(res.data); + // setCreate(false); + setSelectedRowData({ + ...selectedRowData, + msDatagb: e.row.msDatagb, + msSdate: e.row.msSdate, + msEdate: e.row.msEdate, + msChasu: e.row.msChasu, + msuTeam: e.row.msuTeam + }); + setTitle(`${menuName} 의견진술 심의 상세 목록`); + setOpen(true); + // }); + } + }; + return ( @@ -201,8 +200,17 @@ const ResidentReview = () => { - + + + + ); }; -export default ResidentReview; +export default JudgeReview; diff --git a/src/views/biz/judge/ModalJudgeDetail.jsx b/src/views/biz/judge/ModalJudgeDetail.jsx new file mode 100644 index 0000000..cdfb38e --- /dev/null +++ b/src/views/biz/judge/ModalJudgeDetail.jsx @@ -0,0 +1,50 @@ +import Board from '../board/Board'; +import { useCallback, useEffect, useState } from 'react'; +import { findJudgeDetails } from 'apis/judge'; + +const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => { + const [rowData, setRowData] = useState({}); + + const [totalCount, setTotalCount] = useState(0); + const [rowsState, setRowsState] = useState({ + page: 0, + pageSize: 20, + rows: [] + // loading: false + }); + + const search = useCallback(() => { + const params = { + msDatagb, + msSdate, + msEdate, + msChasu, + msuTeam + }; + + findJudgeDetails(params).then((response) => { + if (response && response.data) { + setTotalCount(response.count); + setRowsState((prevState) => ({ ...prevState, rows: response.data })); + // apiRef.current.forceUpdate(); // .updateRowData([]); + // apiRef.current.updateRowData([]); + } + }); + }, [msDatagb, msSdate, msEdate, msChasu, msuTeam]); + + useEffect(() => { + // if (isInit.current) { + // isInit.current = false; + // return; + // } + search(); + // }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + }, [search]); + + return ( + <> +

dkdkkdkd

+ + ); +}; +export default ModalDetails;