diff --git a/.env b/.env index fcfa2c5..5f656ff 100755 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ REACT_APP_VERSION = v0.0.1 REACT_APP_API_URL=http://localhost:8090 -REACT_APP_SERVER_TIMEOUT=60000 \ No newline at end of file +REACT_APP_SERVER_TIMEOUT=6000 \ No newline at end of file diff --git a/package.json b/package.json index 17ee062..3618c02 100755 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "jwt-decode": "^3.1.2", "lodash": "^4.17.21", "material-ui-popup-state": "^2.0.0", + "moment": "^2.29.1", "prop-types": "^15.8.1", "react": "^17.0.2", "react-apexcharts": "^1.3.9", diff --git a/src/apis/ApiService.js b/src/apis/ApiService.js deleted file mode 100644 index cb35c5d..0000000 --- a/src/apis/ApiService.js +++ /dev/null @@ -1,133 +0,0 @@ -import axios, { AxiosInstance, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from 'axios'; -import Swal from 'sweetalert2'; - -type CustomResponseFormat = { - response: T, // e; - refreshedToken?: string -}; - -export interface CustomInstance extends AxiosInstance { - interceptors: { - request: AxiosInterceptorManager, - response: AxiosInterceptorManager> - }; - - getUri(config?: AxiosRequestConfig): string; - - request(config: AxiosRequestConfig): Promise; - - get(url: string, config?: AxiosRequestConfig): Promise; - - delete(url: string, config?: AxiosRequestConfig): Promise; - - head(url: string, config?: AxiosRequestConfig): Promise; - - options(url: string, config?: AxiosRequestConfig): Promise; - - post(url: string, data?: any, config?: AxiosRequestConfig): Promise; - - put(url: string, data?: any, config?: AxiosRequestConfig): Promise; - - patch(url: string, data?: any, config?: AxiosRequestConfig): Promise; -} - -const reqApi: CustomInstance = axios.create({ - baseURL: process.env.NODE_ENV === 'development' ? process.env.REACT_APP_API_URL : '', - withCredentials: process.env.NODE_ENV === 'development', // 개발시만 사용 : crossdomain - timeout: 1000 - // headers: { - // 'Content-Type': 'application/json' - // // AUTH_HEADER_NAME: accessToken - // } - // params: {key: key} -}); - -/** - * before axios request - */ -reqApi.interceptors.request.use( - (config) => { - Swal.fire({ - title: 'Please Wait ...', - // html: '', - // imageUrl: - // timer: 10000, - didOpen: () => Swal.showLoading() - }).then((r) => {}); - return config; - }, - ({ config, request, response, ...error }) => { - console.error('========== ApiService.request error Data =========='); - return alertError(config, request, response, error); - } -); - -/** - * after axios response - */ -reqApi.interceptors.response.use( - (response: AxiosResponse) => { - Swal.close(); - if (!response.data.success) { - Swal.fire({ - icon: 'error', - title: 'Api Error', - html: `${response.data.message}`, - // imageUrl: - timer: 5000 - }).then((r) => {}); - console.log(response); - } - return Promise.resolve(response.data); - }, - ({ config, request, response, ...error }) => { - console.error('========== ApiService.response Error Data =========='); - alertError(config, request, response, error); - // error 데이타 return - // return response.data; - return error; - } -); - -/** - * 에러 처리 - * TODO :: 토큰 에러인 경우 업무 정의에 따라 alert 처리 여부등 결정하여 내용 추가 - * @param config - * @param request - * @param response - * @param error - */ -const alertError = (config: AxiosRequestConfig, request: any, response: AxiosResponse, error: Error) => { - if (!response) { - Swal.fire({ - icon: 'error', - title: 'Api Error', - html: `시스템 에러~~~~~~~~~~~~`, - // imageUrl: - timer: 5000 - }).then((r) => {}); - return; - } - - const errCode = response.data.code; - const errMsg = response.data.error; - console.error(`${errCode}: ${errMsg}`); - console.error('================================='); - - // Alert.error(`${errCode}: ${errMsg}`); - Swal.fire({ - icon: 'error', - title: 'Api Error', - html: `${errCode}: ${errMsg}`, - // imageUrl: - timer: 5000 - }).then((r) => {}); - - // return Promise.reject({ - // config, - // //message: errMsg, - // response, - // ...error - // }) -}; -export default reqApi; diff --git a/src/apis/CmmService.js b/src/apis/CmmService.js index e7077da..2c3d0b3 100644 --- a/src/apis/CmmService.js +++ b/src/apis/CmmService.js @@ -1,17 +1,17 @@ -import reqApi from './ApiService'; import { CMM_CODE_LIST_URL } from 'commons/ApiUrl'; -import { IApiResponse } from 'types/api'; -import { IComboCode, IParam } from 'types/Data'; +import axios from 'utils/axios'; class CmmService { - // eslint-disable-next-line class-methods-use-this - getComboCodeList(params) { - return reqApi.get(CMM_CODE_LIST_URL, { params }); - // .then(r => console.log(r)) - // .catch(e => { - // console.log(e) - // }); - } + // eslint-disable-next-line no-return-await + getComboCodeList = async (params) => await axios.get(CMM_CODE_LIST_URL, { params }); + + // getComboCodeList(params) { + // return reqApi.get(CMM_CODE_LIST_URL, { params }); + // .then(r => console.log(r)) + // .catch(e => { + // console.log(e) + // }); + // } } export default CmmService; diff --git a/src/contexts/JWTContext.js b/src/contexts/JWTContext.js index 31e9289..0bba603 100755 --- a/src/contexts/JWTContext.js +++ b/src/contexts/JWTContext.js @@ -64,6 +64,7 @@ export const JWTProvider = ({ children }) => { setLocalStorage(ACCESS_TOKEN_NAME, accessToken); const response = await axios.get('/api/v1/ctgy/user'); console.log(response); + // TODO : 적용 필요 const { userid, email, name } = response.data; dispatch({ type: LOGIN, diff --git a/src/menu-items/opst.js b/src/menu-items/opst.js index b1afad8..20fb1d8 100755 --- a/src/menu-items/opst.js +++ b/src/menu-items/opst.js @@ -131,7 +131,7 @@ const opst = { id: 'opst-4-1', title: , type: 'item', - url: '/disabled/dataMgt', + url: '/disabled/data', icon: icons.IconDatabase }, { diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index d8e15ea..99d7698 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -11,8 +11,10 @@ const DashboardDefault = Loadable(lazy(() => import('views/dashboard/Default'))) const DashboardAnalytics = Loadable(lazy(() => import('views/dashboard/Analytics'))); // opst page routing -const PublicBoard = Loadable(lazy(() => import('views/biz/board/public'))); -const Board = Loadable(lazy(() => import('views/biz/board'))); +const PublicBoard = Loadable(lazy(() => import('views/biz/board/PublicBoard'))); +const Board = Loadable(lazy(() => import('views/biz/board/Board'))); +const ParkingReview = Loadable(lazy(() => import('views/biz/parking/Review'))); +const ParkingRegister = Loadable(lazy(() => import('views/biz/parking/Regist'))); // ==============================|| MAIN ROUTING ||============================== // @@ -41,11 +43,11 @@ const MainRoutes = { /* 주정차 */ { path: '/parking/review', - element: + element: }, { path: '/parking/register', - element: + element: }, /* 거주자 */ { diff --git a/src/ui-component/MuiGridList.jsx b/src/ui-component/MuiGridList.jsx index 636f7e4..e5982a8 100644 --- a/src/ui-component/MuiGridList.jsx +++ b/src/ui-component/MuiGridList.jsx @@ -45,7 +45,7 @@ const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => { {...rowsState} onPageChange={(page) => setRowsState((prev) => ({ ...prev, page }))} onPageSizeChange={(pageSize) => setRowsState((prev) => ({ ...prev, page: 0, pageSize }))} - rowsPerPageOptions={[5, 10, 50, 100]} + rowsPerPageOptions={[10, 50, 100]} pagination /> diff --git a/src/views/biz/board/index.jsx b/src/views/biz/board/Board.jsx similarity index 82% rename from src/views/biz/board/index.jsx rename to src/views/biz/board/Board.jsx index 7ff3614..6bc7efc 100644 --- a/src/views/biz/board/index.jsx +++ b/src/views/biz/board/Board.jsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; // material-ui -import { Button, Divider, FormControl, FormControlLabel, Grid, OutlinedInput, Radio, RadioGroup } from '@mui/material'; +import { Button, Divider, FormControl, FormControlLabel, Grid, InputAdornment, OutlinedInput, Radio, RadioGroup } from '@mui/material'; // assets import { IconSearch } from '@tabler/icons'; @@ -13,14 +13,14 @@ import MainCard from 'ui-component/cards/MainCard'; import MuiGridList from 'ui-component/MuiGridList'; import boardService from 'apis/BoardService'; -const Index = () => { +const Board = () => { const [category, setCategory] = useState('ciTitle'); const [searchTxt, setSearchTxt] = useState(''); const [totalCount, setTotalCount] = useState(0); const [rowsState, setRowsState] = useState({ page: 0, - pageSize: 5, + pageSize: 10, rows: [] // loading: false }); @@ -84,7 +84,7 @@ const Index = () => { setRowsState((prevState) => ({ ...prevState, rows: response.data })); } }); - }, [rowsState.page, rowsState.pageSize, searchTxt]); // rowsState.page, rowsState.pageSize, rowsState.rows]); + }, [rowsState.page, rowsState.pageSize, category, searchTxt]); // rowsState.page, rowsState.pageSize, rowsState.rows]); return ( @@ -107,8 +107,18 @@ const Index = () => { - - + + + + } + /> + {/* */} @@ -123,4 +133,4 @@ const Index = () => { ); }; -export default Index; +export default Board; diff --git a/src/views/biz/board/BoardList.jsx b/src/views/biz/board/BoardList.jsx deleted file mode 100644 index 11769ee..0000000 --- a/src/views/biz/board/BoardList.jsx +++ /dev/null @@ -1,121 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { NavLink } from 'react-router-dom'; - -// material-ui -import { DataGrid } from '@mui/x-data-grid'; -import { Box, Button } from '@mui/material'; -import ListItemText from '@mui/material/ListItemText'; -import { useTheme } from '@mui/material/styles'; - -// project imports -import CmmService from 'apis/CmmService'; -import boardService from '../../../apis/BoardService'; - -const columns = [ - { headerName: '게시판코드', field: 'ciCode' }, - { headerName: '글번호', field: 'ciContentno' }, - { headerName: '제목', field: 'ciTitle', editable: true }, - { headerName: '사용자ID', field: 'ciId' }, - { headerName: '사용자 비번', field: 'ciPwd' }, - { headerName: '사용자 이름', field: 'ciName' }, - { headerName: '등록일', field: 'ciNalja' }, - { headerName: '등록시간', field: 'ciTime' }, - { headerName: '조회수', field: 'ciHit' }, - { headerName: 'ref', field: 'ciRef' }, - { headerName: 'step', field: 'ciStep' }, - { headerName: 'level', field: 'ciRevel' }, - { headerName: '비번', field: 'ciPass' }, - { - headerName: 'email', - field: 'ciEmail', - renderCell: (params) => ( - - {params.value} - - - ) - }, - { headerName: '내용', field: 'ciContents' }, - { - headerName: 'IP', - field: `ciIp` - } -]; - -const cmmService = new CmmService(); - -const BoardList = () => { - const theme = useTheme(); - const [totalCount, setTotalCount] = useState(0); - const [rowsState, setRowsState] = useState({ - page: 0, - pageSize: 5, - rows: [] - // loading: false - }); - - const [ciDiv, setCiDiv] = useState(); - - useEffect(() => { - const params = { - page: rowsState.page + 1, - size: rowsState.pageSize - }; - - boardService.getBoardList(params).then((response) => { - console.log(response); - if (response && response.data) { - setTotalCount(response.count); - setRowsState((prevState) => ({ ...prevState, rows: response.data })); - } - }); - }, [rowsState.page, rowsState.pageSize]); // rowsState.page, rowsState.pageSize, rowsState.rows]); - - return ( - // - //
- - row.ciContentno} - rowCount={totalCount} - checkboxSelection - disableSelectionOnClick - // isRowSelectable={(params: any) => params.row.id > 0} - // rows={tableData} - columns={columns} - // pageSize={pageSize} - {...rowsState} - onPageChange={(page) => setRowsState((prev) => ({ ...prev, page }))} - onPageSizeChange={(pageSize) => setRowsState((prev) => ({ ...prev, pageSize }))} - rowsPerPageOptions={[5, 10, 50, 100]} - pagination - /> - - 글쓰기 - - - ); -}; - -export default BoardList; diff --git a/src/views/biz/board/public.jsx b/src/views/biz/board/PublicBoard.jsx similarity index 99% rename from src/views/biz/board/public.jsx rename to src/views/biz/board/PublicBoard.jsx index ddd8f5c..84f48c9 100644 --- a/src/views/biz/board/public.jsx +++ b/src/views/biz/board/PublicBoard.jsx @@ -15,7 +15,7 @@ import MuiGridList from 'ui-component/MuiGridList'; import InputLabel from 'ui-component/extended/Form/InputLabel'; import boardService from '../../../apis/BoardService'; -const Index = () => { +const PublicBoard = () => { const [totalCount, setTotalCount] = useState(0); const [rowsState, setRowsState] = useState({ page: 0, @@ -208,4 +208,4 @@ const Index = () => { ); }; -export default Index; +export default PublicBoard; diff --git a/src/views/biz/parking/Regist.jsx b/src/views/biz/parking/Regist.jsx new file mode 100644 index 0000000..c6758fb --- /dev/null +++ b/src/views/biz/parking/Regist.jsx @@ -0,0 +1,5 @@ +import React from 'react'; + +const ParkingRegister = () =>
주정차 의견진술 심의 등록
; + +export default ParkingRegister; diff --git a/src/views/biz/parking/Review.jsx b/src/views/biz/parking/Review.jsx new file mode 100644 index 0000000..bae7809 --- /dev/null +++ b/src/views/biz/parking/Review.jsx @@ -0,0 +1,138 @@ +import { useEffect, useState } from 'react'; + +import _ from 'lodash'; + +// material-ui +import { Button, Divider, Grid, InputAdornment, MenuItem, OutlinedInput, Select } from '@mui/material'; +import MuiTooltip from '@mui/material/Tooltip'; + +// assets +import { IconSearch } from '@tabler/icons'; + +// berry ui +import MainCard from 'ui-component/cards/MainCard'; + +// project imports +import MuiGridList from 'ui-component/MuiGridList'; +import boardService from 'apis/BoardService'; +import moment from 'moment'; + +const ParkingReview = () => { + const toYear = Number(moment().format('YYYY')); + const years = _.range(toYear, toYear - 14, -1); + + const [selectedYear, setSelectedYear] = useState(toYear); + const [searchTxt, setSearchTxt] = useState(''); + + const [totalCount, setTotalCount] = useState(0); + const [rowsState, setRowsState] = useState({ + page: 0, + pageSize: 10, + rows: [] + // loading: false + }); + + const columns = [ + { headerName: '게시판코드', field: 'ciCode' }, + { headerName: '글번호', field: 'ciContentno' }, + { headerName: '제목', field: 'ciTitle', editable: true }, + { headerName: '사용자ID', field: 'ciId' }, + { headerName: '사용자 비번', field: 'ciPwd' }, + { headerName: '사용자 이름', field: 'ciName' }, + { headerName: '등록일', field: 'ciNalja' }, + { headerName: '등록시간', field: 'ciTime' }, + { headerName: '조회수', field: 'ciHit' }, + { headerName: 'ref', field: 'ciRef' }, + { headerName: 'step', field: 'ciStep' }, + { headerName: 'level', field: 'ciRevel' }, + { headerName: '비번', field: 'ciPass' }, + { + headerName: 'email', + field: 'ciEmail', + renderCell: (params) => ( + + {params.value} + + + ) + }, + { headerName: '내용', field: 'ciContents' }, + { + headerName: 'IP', + field: `ciIp` + } + ]; + const handleSearch = async (event) => { + if (event.type === 'keydown' && event.key === 'Enter') { + const newString = event?.target.value; + setSearchTxt(newString); + } + }; + + useEffect(() => { + let params = { + page: rowsState.page + 1, + size: rowsState.pageSize + }; + console.log(selectedYear); + if (searchTxt) { + params = { + ...params, + year: selectedYear + }; + } + + // boardService.getBoardList(params).then((response) => { + // console.log(response); + // if (response && response.data) { + // setTotalCount(response.count); + // setRowsState((prevState) => ({ ...prevState, rows: response.data })); + // } + // }); + }, [rowsState.page, rowsState.pageSize, searchTxt]); // rowsState.page, rowsState.pageSize, rowsState.rows]); + + return ( + + + + + + + + + + + + + + } + /> + + + + + + + + + + + + + ); +}; +export default ParkingReview;