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 CMM_CODE_LIST_URL = '/api/v1/biz/cmm/combo';
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
* @param message
*/
alertParam: (message: string) => {
alertParam: (message) => {
Swal.fire({
icon: 'warning',
html: message,
@ -90,7 +90,7 @@ const XitCmm = {
* API Error message
* @param message
*/
alertError: (message: string) => {
alertError: (message) => {
Swal.fire({
icon: 'error',
title: 'API error',
@ -108,10 +108,7 @@ const XitCmm = {
* @param validator
*/
useInput<T>(
initalValue: T,
validator?: (value: string) => boolean
): [T, Dispatch<SetStateAction<T>>, (e?: React.ChangeEvent<HTMLInputElement>) => void] {
useInput(initalValue, validator) {
const [value, setValue] = useState < typeof initalValue > initalValue;
const changer = useCallback(
(e) => {
@ -171,8 +168,8 @@ const XitCmm = {
* @param name
* @returns string
*/
getParameterByName: (name: string) => {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
getParameterByName: (name) => {
name = name.replace(/[\\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp(`[\\?&]${name}=([^&#]*)`);
const results = regex.exec(window.location.search);
return results == null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
@ -198,7 +195,7 @@ const XitCmm = {
* @param name
* @returns {string|number|null}
*/
urlParam: (name: string) => {
urlParam: (name) => {
// var url = decodeURIComponent(window.location.href);
const results = new RegExp(`[?&]${name}=([^&#]*)`).exec(window.location.href);
if (results == null) {
@ -212,7 +209,7 @@ const XitCmm = {
* @param paramName
* @returns {string}
*/
getParameters: (paramName: string) => {
getParameters: (paramName) => {
// 리턴값을 위한 변수 선언
let returnValue;
@ -240,7 +237,7 @@ const XitCmm = {
* @param value - The value of the cookie
* @param expireDays
*/
setCookie: (name: string, value: string, expireDays: number = 1) => {
setCookie: (name, value, expireDays = 1) => {
const todayDate = new Date();
todayDate.setTime(todayDate.getTime() + expireDays * 24 * 60 * 60 * 1000);
const expired = todayDate.toISOString(); // .toGMTString();
@ -251,14 +248,14 @@ const XitCmm = {
*
* @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 value - The value of the cookie
*/
removeCookie: (name: string, value?: string) => {
removeCookie: (name, value) => {
if (!value) document.cookie = `${name}=Max-Age=-99999999;`;
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
const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => {
const MuiGridList = ({ setRowId, columns, rowsState, totalCount, setRowsState }) => {
// const { columns, rowsState, totalCount, setRowsState } = props;
const theme = useTheme();
return (
<Box
sx={{
height: 700,
height: 670,
width: '100%',
'& .MuiDataGrid-root': {
border: 'none',
@ -34,7 +34,7 @@ const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => {
>
<DataGrid
paginationMode="server"
getRowId={(row) => row.ciContentno}
getRowId={(row) => row.rowId}
rowCount={totalCount}
checkboxSelection
disableSelectionOnClick
@ -53,6 +53,7 @@ const MuiGridList = ({ columns, rowsState, totalCount, setRowsState }) => {
};
MuiGridList.propTypes = {
setRowId: PropTypes.func,
columns: PropTypes.array,
rowsState: PropTypes.any,
totalCount: PropTypes.number,

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

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

@ -75,7 +75,7 @@ const ParkingRegister = () => {
useEffect(() => {
const params = {
page: rowsState.page + 1,
page: rowsState.page,
size: rowsState.pageSize
};
}, [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';
// 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';
// assets
@ -14,9 +16,10 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiGridList from 'ui-component/MuiGridList';
import boardService from 'apis/BoardService';
import opstBizService from 'apis/OpstBizService';
import moment from 'moment';
import { useTheme } from '@mui/material/styles';
import xitCmm from 'commons/XitCmm';
const ParkingReview = () => {
const theme = useTheme();
@ -33,58 +36,94 @@ const ParkingReview = () => {
rows: []
// 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 = [
{ headerName: '심의차수', field: 'ciCode' },
{ headerName: '심사건수', field: 'ciContentno' },
{ headerName: '심사기간', field: 'ciTitle', editable: true },
{ headerName: '심사마감일시', field: 'ciId' },
{ headerName: '상태', field: 'ciPwd' },
// { headerName: 'rowId', field: 'rowId' },
{ headerName: '심의차수', field: 'msChasu' },
{ headerName: '심사건수', field: 'cnt' },
{
headerName: '삭제하기',
field: 'ciEmail',
renderCell: (params) => (
<strong>
{params.value}
<Button
variant="contained"
color="primary"
size="small"
sx={{ background: theme.palette.error.main, '&:hover': { background: theme.palette.error.dark } }}
>
삭제
</Button>
</strong>
)
headerName: '심사기간',
field: 'msDate',
minWidth: 180,
description: 'dddddd',
valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`
},
{
headerName: '심사마감일시',
field: 'msCdate',
type: 'dateTime',
minWidth: 125,
valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`
},
{ 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 = {
page: rowsState.page + 1,
page: rowsState.page,
size: rowsState.pageSize
};
if (searchTxt) {
params = {
...params,
year: selectedYear
msYear: selectedYear,
msChasu: searchTxt
};
}
boardService.getBoardList(params).then((response) => {
opstBizService.getSimsa680GroupList(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]);
};
const handleSearch = async (event) => {
if (!selectedYear) return;
if (event.type === 'keydown' && event.key === 'Enter') {
const newString = event?.target.value || selectedYear;
setSearchTxt(newString);
search();
}
};
return (
<MainCard>

Loading…
Cancel
Save