feat: 주정차 의견 진술 - 심의 목록 반영1
parent
8f43d84268
commit
dac5dc0cbe
@ -1,3 +1,3 @@
|
||||
REACT_APP_VERSION = v0.0.1
|
||||
REACT_APP_API_URL=http://localhost:8090
|
||||
REACT_APP_SERVER_TIMEOUT=60000
|
||||
REACT_APP_SERVER_TIMEOUT=6000
|
@ -1,133 +0,0 @@
|
||||
import axios, { AxiosInstance, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
type CustomResponseFormat<T = any> = {
|
||||
response: T, // e<T>;
|
||||
refreshedToken?: string
|
||||
};
|
||||
|
||||
export interface CustomInstance extends AxiosInstance {
|
||||
interceptors: {
|
||||
request: AxiosInterceptorManager<AxiosRequestConfig>,
|
||||
response: AxiosInterceptorManager<AxiosResponse<CustomResponseFormat>>
|
||||
};
|
||||
|
||||
getUri(config?: AxiosRequestConfig): string;
|
||||
|
||||
request<T>(config: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
head<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
options<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
||||
|
||||
patch<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
||||
}
|
||||
|
||||
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;
|
@ -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 });
|
||||
// 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;
|
||||
|
@ -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) => (
|
||||
<strong>
|
||||
{params.value}
|
||||
<Button variant="contained" color="primary" size="small">
|
||||
Open
|
||||
</Button>
|
||||
</strong>
|
||||
)
|
||||
},
|
||||
{ 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 (
|
||||
// <CardContent>
|
||||
// <div style={{ height: 700, width: '100%' }}>
|
||||
<Box
|
||||
sx={{
|
||||
height: 700,
|
||||
width: '100%',
|
||||
'& .MuiDataGrid-root': {
|
||||
border: 'none',
|
||||
'& .MuiDataGrid-cell': {
|
||||
borderColor: theme.palette.mode === 'dark' ? theme.palette.text.primary + 15 : 'grey.200'
|
||||
},
|
||||
'& .MuiDataGrid-columnsContainer': {
|
||||
color: theme.palette.mode === 'dark' ? 'grey.600' : 'grey.900',
|
||||
borderColor: theme.palette.mode === 'dark' ? theme.palette.text.primary + 15 : 'grey.200'
|
||||
},
|
||||
'& .MuiDataGrid-columnSeparator': {
|
||||
color: theme.palette.mode === 'dark' ? theme.palette.text.primary + 15 : 'grey.200'
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<DataGrid
|
||||
paginationMode="server"
|
||||
getRowId={(row) => 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
|
||||
/>
|
||||
<NavLink to="/writeBoard">
|
||||
<ListItemText>글쓰기</ListItemText>
|
||||
</NavLink>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default BoardList;
|
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
const ParkingRegister = () => <div>주정차 의견진술 심의 등록</div>;
|
||||
|
||||
export default ParkingRegister;
|
@ -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) => (
|
||||
<strong>
|
||||
{params.value}
|
||||
<Button variant="contained" color="primary" size="small">
|
||||
Open
|
||||
</Button>
|
||||
</strong>
|
||||
)
|
||||
},
|
||||
{ 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 (
|
||||
<MainCard>
|
||||
<Grid container spacing={2} alignItems="center">
|
||||
<Grid item xs={12} lg={6}>
|
||||
<Grid container spacing={1}>
|
||||
<Grid item>
|
||||
<MuiTooltip title="의견진술 심의 년도">
|
||||
<Select id="reviewYear" name="reviewYear" defaultValue={toYear} onChange={(e) => setSelectedYear(e.target.value)}>
|
||||
{years.map((year, idx) => (
|
||||
<MenuItem key={idx} value={year}>
|
||||
{year}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</MuiTooltip>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<OutlinedInput
|
||||
placeholder="심의차수"
|
||||
onKeyDown={handleSearch}
|
||||
size="small"
|
||||
autoFocus
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconSearch stroke={1.5} size="1rem" />
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Divider />
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Divider />
|
||||
</Grid>
|
||||
<MuiGridList columns={columns} rowsState={rowsState} totalCount={totalCount} setRowsState={setRowsState} />
|
||||
</MainCard>
|
||||
);
|
||||
};
|
||||
export default ParkingReview;
|
Loading…
Reference in New Issue