diff --git a/src/commons/XitCmm.js b/src/commons/XitCmm.js index d715da5..2b408eb 100644 --- a/src/commons/XitCmm.js +++ b/src/commons/XitCmm.js @@ -1,5 +1,4 @@ import Swal from 'sweetalert2'; -import { useCallback, useState } from 'react'; import format from 'date-fns/format'; const XitCmm = { @@ -32,28 +31,6 @@ const XitCmm = { return false; }, - /** - * - * @return [value: string, onchange: (e: ChangeEvent) => void] - * @param initalValue - * @param validator - */ - - useInput(initalValue, validator) { - const [value, setValue] = useState < typeof initalValue > initalValue; - const changer = useCallback( - (e) => { - const v = e.target.value; - if (validator === undefined || validator(v)) { - setValue(v); - } - }, - [validator] - ); - - return [value, setValue, changer]; - }, - formatDate(dateStr, fmt) { return format(dateStr, fmt); }, diff --git a/src/menu-items/opst.js b/src/menu-items/opst.js index 20fb1d8..5ccf6fd 100755 --- a/src/menu-items/opst.js +++ b/src/menu-items/opst.js @@ -49,7 +49,7 @@ const icons = { const opst = { id: 'opst', - title: , + // title: , type: 'group', children: [ { diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index 1a2322f..d464fed 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -4,7 +4,6 @@ import { lazy } from 'react'; import MainLayout from 'layout/MainLayout'; import Loadable from 'ui-component/Loadable'; import AuthGuard from 'utils/route-guard/AuthGuard'; -import ResidentDataReview from '../views/biz/resident/Review'; // sample page routing const SamplePage = Loadable(lazy(() => import('views/sample-page'))); @@ -14,9 +13,15 @@ const DashboardAnalytics = Loadable(lazy(() => import('views/dashboard/Analytics // opst page routing 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'))); + +// parking +const ParkingReview = Loadable(lazy(() => import('views/biz/parking/ParkingReview'))); const ParkingDetails = Loadable(lazy(() => import('views/biz/parking/ModalDetails'))); -const ParkingRegister = Loadable(lazy(() => import('views/biz/parking/Regist'))); +const ParkingRegister = Loadable(lazy(() => import('views/biz/parking/ParkingRegister'))); + +// resident +const ResidentDataReview = Loadable(lazy(() => import('views/biz/resident/ResidentDataReview'))); +const ResidentRegister = Loadable(lazy(() => import('views/biz/resident/ResidentRegist'))); // component const ModalForm = Loadable(lazy(() => import('views/form/Modal'))); @@ -61,11 +66,11 @@ const MainRoutes = { }, { path: '/resident/review', - element: + element: }, { path: '/resident/register', - element: + element: }, /* 장애인 */ { diff --git a/src/views/biz/board/PublicBoard.jsx b/src/views/biz/board/PublicBoard.jsx index ec62bd3..1e7b58a 100644 --- a/src/views/biz/board/PublicBoard.jsx +++ b/src/views/biz/board/PublicBoard.jsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; // material-ui import { Button, Divider, Grid, Link } from '@mui/material'; @@ -11,9 +11,9 @@ import MainCard from 'ui-component/cards/MainCard'; // project imports import MuiDataGrid from 'views/form/MuiDataGrid'; -import CmmModal from '../../form/Modal/CmmModal'; +import CmmModal from 'views/form/Modal/CmmModal'; import PublicBoardForm from './PublicBoardForm'; -import { deletePublicBoard, findPublicBoards, modifyPublicBoardHitCount, savePublicBoard } from '../../../apis/public'; +import { deletePublicBoard, findPublicBoards, modifyPublicBoardHitCount, savePublicBoard } from 'apis/public'; const PublicBoard = () => { const [totalCount, setTotalCount] = useState(0); @@ -61,7 +61,7 @@ const PublicBoard = () => { { headerName: '조회수', headerAlign: 'center', field: 'inHit', align: 'right' } ]; - const search = () => { + const search = useCallback(() => { const params = { page: rowsState.page, size: rowsState.pageSize @@ -74,11 +74,11 @@ const PublicBoard = () => { setRowsState((prevState) => ({ ...prevState, rows: response.data })); } }); - }; + }, [rowsState.page, rowsState.pageSize]); useEffect(() => { search(); - }, [rowsState.page, rowsState.pageSize]); // rowsState.page, rowsState.pageSize, rowsState.rows]); + }, [search]); // rowsState.page, rowsState.pageSize, rowsState.rows]); const handleOnCellClick = (e) => { if (e?.field === 'inTitle') { diff --git a/src/views/biz/parking/Regist.jsx b/src/views/biz/parking/ParkingRegister.jsx similarity index 91% rename from src/views/biz/parking/Regist.jsx rename to src/views/biz/parking/ParkingRegister.jsx index b2f754d..4da22eb 100644 --- a/src/views/biz/parking/Regist.jsx +++ b/src/views/biz/parking/ParkingRegister.jsx @@ -15,7 +15,7 @@ import MuiDataGrid from 'views/form/MuiDataGrid'; import xitCmm from 'commons/XitCmm'; import CmmModal from 'views/form/Modal/CmmModal'; -import SaveParkingSimsaForm from './SaveParkingSimsaForm'; +import SaveParkingTargetForm from './SaveParkingTargetForm'; import NumberFormat from 'react-number-format'; import ExcelDownload from 'views/form/ExcelDownload'; import { findParkingTargets, saveParkingTargets } from 'apis/parking'; @@ -24,7 +24,7 @@ const ParkingRegister = () => { const [rcIrTransfer, setRcIrTransfer] = useState('1'); const [rcSeq1, setRcSeq1] = useState('2022200801'); const [rcSeq2, setRcSeq2] = useState('2022200899'); - const [selection, setSelection] = useState([]); + const [selectionModel, setSelectionModel] = useState([]); const [totalCount, setTotalCount] = useState(0); const [rowsStatus, setRowsStatus] = useState({ page: 0, @@ -60,6 +60,7 @@ const ParkingRegister = () => { findParkingTargets(params).then((response) => { if (response && response.data) { + setSelectionModel([]); setTotalCount(response.count); setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data })); } @@ -67,7 +68,7 @@ const ParkingRegister = () => { }; const handleSave = () => { - if (selection.length === 0) { + if (selectionModel.length === 0) { xitCmm.alertParam(`처리할 데이타가 없습니다`); } else { setOpen(true); @@ -75,19 +76,19 @@ const ParkingRegister = () => { } }; - const submitParkingSimsa = (params) => { + const submitParkingTargets = (params) => { const param = { ...params, rcIrTransfer, rcSeq1, rcSeq2, - rcCodes: selection.map((d) => rowsStatus.rows[d - 1].rcCode) + rcCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].rcCode) }; setOpen(false); // return false; saveParkingTargets(param).then(() => { - setSelection([]); + setSelectionModel([]); search(); }); }; @@ -105,7 +106,7 @@ const ParkingRegister = () => { }; const handleSelection = (newSelection) => { - setSelection(newSelection); + setSelectionModel(newSelection); }; return ( @@ -166,7 +167,7 @@ const ParkingRegister = () => {