feat: 심의목록 반영

main
Lim Jonguk 3 years ago
parent 592b8f882e
commit 4534e52c58

@ -1,14 +0,0 @@
import { BOARD_LIST_URL } from 'commons/ApiUrl';
import axios from 'utils/axios';
class BoardService {
// eslint-disable-next-line no-return-await
getBoardList = async (params) => await axios.get(BOARD_LIST_URL, { params });
// const res = await axios.get(BOARD_LIST_URL, { params });
// return res;
// axios.get(BOARD_LIST_URL, { params }).then((r) => {
// console.log(r);
// return r;
// });
}
export default new BoardService();

@ -0,0 +1,32 @@
import { BOARD_LIST_URL, SIMSA_LIST_URL } from 'commons/ApiUrl';
import axios from 'utils/axios';
class OpstBizService {
// eslint-disable-next-line no-return-await
getBoardList = async (params) => {
const res = await axios.get(BOARD_LIST_URL, { params });
if (res.success) {
res.data = res.data.map((d, idx) => ({ ...d, rowId: idx }));
return res;
}
return res;
};
// const res = await axios.get(BOARD_LIST_URL, { params });
// return res;
// axios.get(BOARD_LIST_URL, { params }).then((r) => {
// console.log(r);
// return r;
// });
// eslint-disable-next-line no-return-await
getSimsa680GroupList = async (params) => {
const res = await axios.get(SIMSA_LIST_URL, { params });
if (res.success) {
res.data = res.data.map((d, idx) => ({ ...d, rowId: idx }));
return res;
}
return res;
};
}
export default new OpstBizService();

@ -3,3 +3,4 @@
export const LOGIN_URL = '/api/v1/ctgy/account/login'; export const LOGIN_URL = '/api/v1/ctgy/account/login';
export const CMM_CODE_LIST_URL = '/api/v1/biz/cmm/combo'; export const CMM_CODE_LIST_URL = '/api/v1/biz/cmm/combo';
export const BOARD_LIST_URL = '/api/v1/ctgy/board'; export const BOARD_LIST_URL = '/api/v1/ctgy/board';
export const SIMSA_LIST_URL = '/api/v1/ctgy/simsa/review';

@ -76,7 +76,7 @@ const XitCmm = {
* validation check error message * validation check error message
* @param message * @param message
*/ */
alertParam: (message: string) => { alertParam: (message) => {
Swal.fire({ Swal.fire({
icon: 'warning', icon: 'warning',
html: message, html: message,
@ -90,7 +90,7 @@ const XitCmm = {
* API Error message * API Error message
* @param message * @param message
*/ */
alertError: (message: string) => { alertError: (message) => {
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'API error', title: 'API error',
@ -108,10 +108,7 @@ const XitCmm = {
* @param validator * @param validator
*/ */
useInput<T>( useInput(initalValue, validator) {
initalValue: T,
validator?: (value: string) => boolean
): [T, Dispatch<SetStateAction<T>>, (e?: React.ChangeEvent<HTMLInputElement>) => void] {
const [value, setValue] = useState < typeof initalValue > initalValue; const [value, setValue] = useState < typeof initalValue > initalValue;
const changer = useCallback( const changer = useCallback(
(e) => { (e) => {
@ -171,8 +168,8 @@ const XitCmm = {
* @param name * @param name
* @returns string * @returns string
*/ */
getParameterByName: (name: string) => { getParameterByName: (name) => {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); name = name.replace(/[\\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp(`[\\?&]${name}=([^&#]*)`); const regex = new RegExp(`[\\?&]${name}=([^&#]*)`);
const results = regex.exec(window.location.search); const results = regex.exec(window.location.search);
return results == null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); return results == null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
@ -198,7 +195,7 @@ const XitCmm = {
* @param name * @param name
* @returns {string|number|null} * @returns {string|number|null}
*/ */
urlParam: (name: string) => { urlParam: (name) => {
// var url = decodeURIComponent(window.location.href); // var url = decodeURIComponent(window.location.href);
const results = new RegExp(`[?&]${name}=([^&#]*)`).exec(window.location.href); const results = new RegExp(`[?&]${name}=([^&#]*)`).exec(window.location.href);
if (results == null) { if (results == null) {
@ -212,7 +209,7 @@ const XitCmm = {
* @param paramName * @param paramName
* @returns {string} * @returns {string}
*/ */
getParameters: (paramName: string) => { getParameters: (paramName) => {
// 리턴값을 위한 변수 선언 // 리턴값을 위한 변수 선언
let returnValue; let returnValue;
@ -240,7 +237,7 @@ const XitCmm = {
* @param value - The value of the cookie * @param value - The value of the cookie
* @param expireDays * @param expireDays
*/ */
setCookie: (name: string, value: string, expireDays: number = 1) => { setCookie: (name, value, expireDays = 1) => {
const todayDate = new Date(); const todayDate = new Date();
todayDate.setTime(todayDate.getTime() + expireDays * 24 * 60 * 60 * 1000); todayDate.setTime(todayDate.getTime() + expireDays * 24 * 60 * 60 * 1000);
const expired = todayDate.toISOString(); // .toGMTString(); const expired = todayDate.toISOString(); // .toGMTString();
@ -251,14 +248,14 @@ const XitCmm = {
* *
* @param name * @param name
*/ */
getCookie: (name: string) => document.cookie.split(';').some((c) => c.trim().startsWith(`${name}=`)), getCookie: (name) => document.cookie.split(';').some((c) => c.trim().startsWith(`${name}=`)),
/** /**
* *
* @param name - The name of the cookie to be set * @param name - The name of the cookie to be set
* @param value - The value of the cookie * @param value - The value of the cookie
*/ */
removeCookie: (name: string, value?: string) => { removeCookie: (name, value) => {
if (!value) document.cookie = `${name}=Max-Age=-99999999;`; if (!value) document.cookie = `${name}=Max-Age=-99999999;`;
else document.cookie = `${name}=${encodeURIComponent(value)}${{ expires: 'Sun, 01-May-2019 14:00:00 UTC' }}`; else document.cookie = `${name}=${encodeURIComponent(value)}${{ expires: 'Sun, 01-May-2019 14:00:00 UTC' }}`;
} }

@ -8,14 +8,14 @@ import { useTheme } from '@mui/material/styles';
// project imports // project imports
const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => { const MuiGridList = ({ setRowId, columns, rowsState, totalCount, setRowsState }) => {
// const { columns, rowsState, totalCount, setRowsState } = props; // const { columns, rowsState, totalCount, setRowsState } = props;
const theme = useTheme(); const theme = useTheme();
return ( return (
<Box <Box
sx={{ sx={{
height: 700, height: 670,
width: '100%', width: '100%',
'& .MuiDataGrid-root': { '& .MuiDataGrid-root': {
border: 'none', border: 'none',
@ -34,7 +34,7 @@ const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => {
> >
<DataGrid <DataGrid
paginationMode="server" paginationMode="server"
getRowId={(row) => row.ciContentno} getRowId={(row) => row.rowId}
rowCount={totalCount} rowCount={totalCount}
checkboxSelection checkboxSelection
disableSelectionOnClick disableSelectionOnClick
@ -53,6 +53,7 @@ const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => {
}; };
MuiGridList.propTypes = { MuiGridList.propTypes = {
setRowId: PropTypes.func,
columns: PropTypes.array, columns: PropTypes.array,
rowsState: PropTypes.any, rowsState: PropTypes.any,
totalCount: PropTypes.number, totalCount: PropTypes.number,

@ -24,7 +24,7 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports // project imports
import MuiGridList from 'ui-component/MuiGridList'; import MuiGridList from 'ui-component/MuiGridList';
import boardService from 'apis/BoardService'; import opstBizService from 'apis/OpstBizService';
const Board = () => { const Board = () => {
const [category, setCategory] = useState('ciTitle'); const [category, setCategory] = useState('ciTitle');
@ -65,7 +65,7 @@ const Board = () => {
useEffect(() => { useEffect(() => {
let params = { let params = {
page: rowsState.page + 1, page: rowsState.page,
size: rowsState.pageSize size: rowsState.pageSize
}; };
@ -76,7 +76,7 @@ const Board = () => {
}; };
} }
boardService.getBoardList(params).then((response) => { opstBizService.getBoardList(params).then((response) => {
console.log(response); console.log(response);
if (response && response.data) { if (response && response.data) {
setTotalCount(response.count); setTotalCount(response.count);

@ -13,7 +13,7 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports // project imports
import MuiGridList from 'ui-component/MuiGridList'; import MuiGridList from 'ui-component/MuiGridList';
import InputLabel from 'ui-component/extended/Form/InputLabel'; import InputLabel from 'ui-component/extended/Form/InputLabel';
import boardService from '../../../apis/BoardService'; import opstBizService from '../../../apis/OpstBizService';
const PublicBoard = () => { const PublicBoard = () => {
const [totalCount, setTotalCount] = useState(0); const [totalCount, setTotalCount] = useState(0);
@ -45,11 +45,11 @@ const PublicBoard = () => {
useEffect(() => { useEffect(() => {
const params = { const params = {
page: rowsState.page + 1, page: rowsState.page,
size: rowsState.pageSize size: rowsState.pageSize
}; };
boardService.getBoardList(params).then((response) => { opstBizService.getBoardList(params).then((response) => {
console.log(response); console.log(response);
if (response && response.data) { if (response && response.data) {
setTotalCount(response.count); setTotalCount(response.count);

@ -75,7 +75,7 @@ const ParkingRegister = () => {
useEffect(() => { useEffect(() => {
const params = { const params = {
page: rowsState.page + 1, page: rowsState.page,
size: rowsState.pageSize size: rowsState.pageSize
}; };
}, [rowsState.page, rowsState.pageSize]); // rowsState.page, rowsState.pageSize, rowsState.rows]); }, [rowsState.page, rowsState.pageSize]); // rowsState.page, rowsState.pageSize, rowsState.rows]);

@ -1,9 +1,11 @@
import { useEffect, useState } from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react';
import _ from 'lodash'; import _ from 'lodash';
// material-ui // material-ui
import { Button, Divider, Grid, InputAdornment, MenuItem, OutlinedInput, Select } from '@mui/material'; import { GridActionsCellItem } from '@mui/x-data-grid';
import { Divider, Grid, InputAdornment, MenuItem, OutlinedInput, Select } from '@mui/material';
import DeleteIcon from '@mui/icons-material/Delete';
import MuiTooltip from '@mui/material/Tooltip'; import MuiTooltip from '@mui/material/Tooltip';
// assets // assets
@ -14,9 +16,10 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports // project imports
import MuiGridList from 'ui-component/MuiGridList'; import MuiGridList from 'ui-component/MuiGridList';
import boardService from 'apis/BoardService'; import opstBizService from 'apis/OpstBizService';
import moment from 'moment'; import moment from 'moment';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import xitCmm from 'commons/XitCmm';
const ParkingReview = () => { const ParkingReview = () => {
const theme = useTheme(); const theme = useTheme();
@ -33,58 +36,94 @@ const ParkingReview = () => {
rows: [] rows: []
// loading: false // loading: false
}); });
const [rows, setRows] = useState();
const removeSimsa = useCallback(
(row) => () => {
// setTimeout(() => {
// setRowsState((prevRows) => prevRows.filter((row) => row.rowId !== rowId));
// });
xitCmm.alertParam(`삭제대상<br>${JSON.stringify(row)}`);
console.log(row);
},
[]
);
/*
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 = [ const columns = [
{ headerName: '심의차수', field: 'ciCode' }, // { headerName: 'rowId', field: 'rowId' },
{ headerName: '심사건수', field: 'ciContentno' }, { headerName: '심의차수', field: 'msChasu' },
{ headerName: '심사기간', field: 'ciTitle', editable: true }, { headerName: '심사건수', field: 'cnt' },
{ headerName: '심사마감일시', field: 'ciId' },
{ headerName: '상태', field: 'ciPwd' },
{ {
headerName: '삭제하기', headerName: '심사기간',
field: 'ciEmail', field: 'msDate',
renderCell: (params) => ( minWidth: 180,
<strong> description: 'dddddd',
{params.value} valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`
<Button },
variant="contained" {
color="primary" headerName: '심사마감일시',
size="small" field: 'msCdate',
sx={{ background: theme.palette.error.main, '&:hover': { background: theme.palette.error.dark } }} type: 'dateTime',
> minWidth: 125,
삭제 valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`
</Button> },
</strong> { headerName: '상태', field: 'msResult', renderCell: (params) => <>{params.value === '1' ? '진행중' : '심사완료'}</> },
) {
headerName: '삭제',
field: 'actions',
type: 'actions',
width: 80,
getActions: (params) => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" onClick={removeSimsa(params.row)} />]
} }
]; ];
const handleSearch = async (event) => {
if (event.type === 'keydown' && event.key === 'Enter') {
const newString = event?.target.value;
setSearchTxt(newString);
}
};
useEffect(() => { const search = () => {
let params = { let params = {
page: rowsState.page + 1, page: rowsState.page,
size: rowsState.pageSize size: rowsState.pageSize
}; };
if (searchTxt) { if (searchTxt) {
params = { params = {
...params, ...params,
year: selectedYear msYear: selectedYear,
msChasu: searchTxt
}; };
} }
boardService.getBoardList(params).then((response) => { opstBizService.getSimsa680GroupList(params).then((response) => {
console.log(response); console.log(response);
if (response && response.data) { if (response && response.data) {
setTotalCount(response.count); setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data })); setRowsState((prevState) => ({ ...prevState, rows: response.data }));
} }
}); });
}, [rowsState.page, rowsState.pageSize, searchTxt]); // rowsState.page, rowsState.pageSize, rowsState.rows]); };
const handleSearch = async (event) => {
if (!selectedYear) return;
if (event.type === 'keydown' && event.key === 'Enter') {
const newString = event?.target.value || selectedYear;
setSearchTxt(newString);
search();
}
};
return ( return (
<MainCard> <MainCard>

Loading…
Cancel
Save