diff --git a/src/apis/judge.js b/src/apis/judge.js index 7f23a92..43ca59c 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -11,7 +11,8 @@ import { GET_JUDGE_LIST, SAVE_JUDGE_TARGET_LIST, GET_JUDGE_RESULT_LIST, - GET_PARKING_JUDGE_RESULT_LIST + GET_PARKING_JUDGE_RESULT_LIST, + REMOVE_JUDGE } from 'commons/ApiUrl'; import { setRowId } from './common'; @@ -107,3 +108,8 @@ export async function saveJudgeTargets(params) { // eslint-disable-next-line no-return-await return await axios.post(SAVE_JUDGE_TARGET_LIST, params); } + +export async function removeJudge(params) { + // eslint-disable-next-line no-return-await + return await axios.post(REMOVE_JUDGE, params); +} diff --git a/src/apis/parking.js b/src/apis/parking.js index 8b70eca..c1e3114 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_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 @@ -26,9 +26,11 @@ export async function findParkingJudgeTargets(params) { } export async function saveParkingJudgeTargets(params) { - const res = await axios.post(SAVE_PARKING_JUDGE_TARGET_LIST, params); - if (res.success) { - return res; - } - return res; + // eslint-disable-next-line no-return-await + return await axios.post(SAVE_PARKING_JUDGE_TARGET_LIST, params); +} + +export async function removeParkingJudge(params) { + // eslint-disable-next-line no-return-await + return await axios.post(REMOVE_PARKING_JUDGE, params); } diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index 879e14a..681ca0d 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -22,6 +22,7 @@ export const GET_PARKING_LIST = '/api/v1/ctgy/parking'; export const GET_PARKING_JUDGE_RESULT_LIST = '/api/v1/ctgy/parking/result'; 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_JUDGE_DATA_LIST = '/api/v1/ctgy/judge/data'; @@ -31,6 +32,7 @@ export const GET_JUDGE_LIST = '/api/v1/ctgy/judge'; export const GET_JUDGE_RESULT_LIST = '/api/v1/ctgy/judge/result'; 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_USER_LIST = '/api/v1/ctgy/user'; diff --git a/src/commons/combo_data.js b/src/commons/combo_data.js index 263b7f0..103fc4d 100644 --- a/src/commons/combo_data.js +++ b/src/commons/combo_data.js @@ -1,6 +1,5 @@ const combo = { teams: [ - { code: '', value: '-- 선택 --' }, { code: '001', value: '1팀' }, { code: '002', value: '2팀' }, { code: '003', value: '3팀' }, diff --git a/src/views/biz/board/Board.jsx b/src/views/biz/board/Board.jsx index e82e417..8fd1b8f 100644 --- a/src/views/biz/board/Board.jsx +++ b/src/views/biz/board/Board.jsx @@ -70,7 +70,7 @@ const Board = () => { { headerName: '작성자ID', headerAlign: 'center', field: 'ciId', hide: true }, { headerName: '등록시간', headerAlign: 'center', field: 'ciTime', hide: true }, { headerName: 'ref', headerAlign: 'center', field: 'ciRef', hide: true }, - { headerName: 'step', headerAlign: 'center', field: 'ciStep', hide: false }, + { headerName: 'step', headerAlign: 'center', field: 'ciStep', hide: true }, { headerName: '비번', headerAlign: 'center', field: 'ciPass', hide: true }, { headerName: '내용', headerAlign: 'center', field: 'ciContents', hide: true }, { headerName: 'IP', headerAlign: 'center', field: `ciIp`, hide: true }, diff --git a/src/views/biz/judge/JudgeRegistReview.jsx b/src/views/biz/judge/JudgeRegistReview.jsx index 32a0f90..6ac82d7 100644 --- a/src/views/biz/judge/JudgeRegistReview.jsx +++ b/src/views/biz/judge/JudgeRegistReview.jsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useState } from 'react'; +import { useState } from 'react'; // material-ui import { Button, Divider, FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from '@mui/material'; @@ -55,7 +55,7 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => { { headerName: '접수방법', headerAlign: 'center', field: 'scIngbNm', align: 'center', width: 120 } ]; - const search = useCallback(() => { + const search = () => { const params = { scDatagb, // 거주자 scTransfer, @@ -70,7 +70,7 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => { setRowsState((prevRows) => ({ ...prevRows, rows: response.data })); } }); - }, [rowsState.page, rowsState.pageSize, scDatagb]); + }; const handleSave = () => { if (selectionModel.length === 0) { @@ -106,10 +106,6 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => { } }; - useEffect(() => { - search(); - }, [search]); - const handleOnKeyDown = (event) => { if (event.type === 'keydown' && event.key === 'Enter' && scSeq1 && scSeq2) { search(); diff --git a/src/views/biz/judge/JudgeReview.jsx b/src/views/biz/judge/JudgeReview.jsx index 144d8f7..890a987 100644 --- a/src/views/biz/judge/JudgeReview.jsx +++ b/src/views/biz/judge/JudgeReview.jsx @@ -14,9 +14,8 @@ import MainCard from 'ui-component/cards/MainCard'; // project imports import MuiDataGrid from 'views/cmm/MuiDataGrid'; -import xitCmm from 'commons/XitCmm'; import InputLabel from 'ui-component/extended/Form/InputLabel'; -import { findJudgeResults, findJudges } from 'apis/judge'; +import { findJudgeResults, findJudges, removeJudge } from 'apis/judge'; import CmmModal from 'views/cmm/CmmModal'; import ModalJudgeResult from './ModalJudgeResult'; import PropTypes from 'prop-types'; @@ -49,13 +48,36 @@ const JudgeReview = ({ msDatagb, menuName }) => { judgeTeam: '' }); - const removeJudge = useCallback( + const search = useCallback(() => { + const params = { + msDatagb, + page: rowsState.page, + size: rowsState.pageSize + }; + + findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { + if (response && response.data) { + setTotalCount(response.count); + setRowsState((prevState) => ({ ...prevState, rows: response.data })); + // apiRef.current.forceUpdate(); // .updateRowData([]); + // apiRef.current.updateRowData([]); + } + }); + }, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + + const deleteJudge = useCallback( (row) => () => { - // setTimeout(() => { - // setRowsState((prevRows) => prevRows.filter((row) => row.rowId !== rowId)); - // }); - xitCmm.alertParam(`삭제대상
${JSON.stringify(row)}`); - console.log(row); + removeJudge(row).then((response) => { + if (response && response.success) { + setRowsState({ + ...rowsState, + page: 0 + }); + search(); + } else { + alert.show(response.message); + } + }); }, [] ); @@ -103,28 +125,11 @@ const JudgeReview = ({ msDatagb, menuName }) => { field: 'actions', type: 'actions', width: 80, - getActions: (params) => [} label="Delete" onClick={removeJudge(params.row)} />], + getActions: (params) => [} label="Delete" onClick={deleteJudge(params.row)} />], align: 'center' } ]; - const search = useCallback(() => { - const params = { - msDatagb, - page: rowsState.page, - size: rowsState.pageSize - }; - - findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { - if (response && response.data) { - setTotalCount(response.count); - setRowsState((prevState) => ({ ...prevState, rows: response.data })); - // apiRef.current.forceUpdate(); // .updateRowData([]); - // apiRef.current.updateRowData([]); - } - }); - }, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); - const handleSearch = async (event) => { if (!selectedYear) return; diff --git a/src/views/biz/parking/ParkingReview.jsx b/src/views/biz/parking/ParkingReview.jsx index 360b45c..ff2c897 100644 --- a/src/views/biz/parking/ParkingReview.jsx +++ b/src/views/biz/parking/ParkingReview.jsx @@ -16,18 +16,19 @@ import MainCard from 'ui-component/cards/MainCard'; // project imports import MuiDataGrid from 'views/cmm/MuiDataGrid'; -import xitCmm from 'commons/XitCmm'; -import { findParkings } from 'apis/parking'; +import { findParkings, removeParkingJudge } from 'apis/parking'; import { findJudgeResults } from 'apis/judge'; import InputLabel from '../../../ui-component/extended/Form/InputLabel'; import ModalJudgeResult from 'views/biz/judge/ModalJudgeResult'; import CmmModal from 'views/cmm/CmmModal'; +import { useAlert } from 'react-alert'; const ParkingReview = () => { const isInit = useRef(true); const year = getYear(new Date()); const years = _.range(year, year - 14, -1); + const alert = useAlert(); const [open, setOpen] = useState(false); const [title, setTitle] = useState(); @@ -49,13 +50,35 @@ const ParkingReview = () => { judgeTeam: '' }); + const search = useCallback(() => { + const params = { + page: rowsState.page, + size: rowsState.pageSize + }; + + findParkings({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { + if (response && response.data) { + setTotalCount(response.count); + setRowsState((prevState) => ({ ...prevState, rows: response.data })); + // apiRef.current.forceUpdate(); // .updateRowData([]); + // apiRef.current.updateRowData([]); + } + }); + }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + const removeJudge = useCallback( (row) => () => { - // setTimeout(() => { - // setRowsState((prevRows) => prevRows.filter((row) => row.rowId !== rowId)); - // }); - xitCmm.alertParam(`삭제대상
${JSON.stringify(row)}`); - console.log(row); + removeParkingJudge(row).then((response) => { + if (response && response.success) { + setRowsState({ + ...rowsState, + page: 0 + }); + search(); + } else { + alert.show(response.message); + } + }); }, [] ); @@ -108,22 +131,6 @@ const ParkingReview = () => { } ]; - const search = useCallback(() => { - const params = { - page: rowsState.page, - size: rowsState.pageSize - }; - - findParkings({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { - if (response && response.data) { - setTotalCount(response.count); - setRowsState((prevState) => ({ ...prevState, rows: response.data })); - // apiRef.current.forceUpdate(); // .updateRowData([]); - // apiRef.current.updateRowData([]); - } - }); - }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); - const handleSearch = async (event) => { if (!selectedYear) return; diff --git a/src/views/biz/user/UserManagerForm.jsx b/src/views/biz/user/UserManagerForm.jsx index 5ca9b9e..928a8f6 100644 --- a/src/views/biz/user/UserManagerForm.jsx +++ b/src/views/biz/user/UserManagerForm.jsx @@ -13,7 +13,6 @@ import PropTypes from 'prop-types'; const UserManagementForm = (props) => { // eslint-disable-next-line react/prop-types const { create, setOpen, handleModalSave, teams = [], accesstypes = [], rowData = {} } = props; - console.log(rowData); const [userid, setUserid] = useState(rowData?.userid || ''); const [passwd, setPasswd] = useState(rowData?.passwd || ''); const [accesstype, setAccesstype] = useState(rowData?.accesstype || '001');