feat: 사용자 관리

게시판 관리
main
Lim Jonguk 3 years ago
parent e625f9ed96
commit 05cc552fc6

@ -7,7 +7,7 @@ import { GET_BOARD_LIST } from 'commons/ApiUrl';
import { setRowId } from './common';
// eslint-disable-next-line import/prefer-default-export
export async function findBoars(params) {
export async function findBoards(params) {
const res = await axios.get(GET_BOARD_LIST, { params });
if (res.success) {
res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) }));

@ -1,14 +1,14 @@
//----------------------------------------------------------------------------
// Board : 유저관리
// user : 사용자관리
//----------------------
import axios from 'utils/axios';
import { GET_USER_BOARD_LIST } from 'commons/ApiUrl';
import { GET_USER_LIST } from 'commons/ApiUrl';
import { setRowId } from './common';
// eslint-disable-next-line import/prefer-default-export
export async function getBoardList(params) {
const res = await axios.get(GET_USER_BOARD_LIST, { params });
export async function findUsers(params) {
const res = await axios.get(GET_USER_LIST, { params });
if (res.success) {
res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) }));
return res;

@ -36,6 +36,6 @@ export const GET_DISABLED = '/api/v1/ctgy/judge/data/';
export const GET_DISABLED_LIST = '/api/v1/ctgy/judge';
// 사용자 관리
export const GET_USER_BOARD_LIST = '/api/v1/ctgy/pboard/';
export const SAVE_USER_BOARD = '/api/v1/ctgy/file/pboard';
export const DELETE_USER_BOARD = '/api/v1/ctgy/file/pboard/';
export const GET_USER_LIST = '/api/v1/ctgy/user/';
export const SAVE_USER = '/api/v1/ctgy/user';
export const MODIFY_USER = '/api/v1/ctgy/user/';

@ -11,7 +11,7 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/MuiDataGrid';
import { findBoars } from '../../../apis/board';
import { findBoards } from 'apis/board';
const Board = () => {
const [category, setCategory] = useState('ciTitle');
@ -63,7 +63,7 @@ const Board = () => {
};
}
findBoars(params).then((response) => {
findBoards(params).then((response) => {
if (response && response.data) {
setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data }));

@ -11,7 +11,7 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/MuiDataGrid';
import { getBoardList } from '../../../apis/user';
import { findUsers } from 'apis/user';
import CmmModal from '../../cmm/CmmModal';
import UserManagerForm from './UserManagerForm';
import { deletePublicBoard, savePublicBoard } from '../../../apis/public';
@ -23,7 +23,7 @@ const UserManager = () => {
const [totalCount, setTotalCount] = useState(0);
const [rowsState, setRowsState] = useState({
page: 0,
pageSize: 10,
pageSize: 20,
rows: []
// loading: false
});
@ -54,7 +54,7 @@ const UserManager = () => {
size: rowsState.pageSize
};
getBoardList(params).then((response) => {
findUsers(params).then((response) => {
if (response && response.data) {
setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data }));

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
// material-ui
import { Button, Divider, Grid, InputAdornment, MenuItem, OutlinedInput, Select, Link } from '@mui/material';
@ -13,16 +13,18 @@ import MainCard from 'ui-component/cards/MainCard';
import MuiDataGrid from 'views/cmm/MuiDataGrid';
import CmmModal from '../../cmm/CmmModal';
import UserManagerForm from './UserManagerForm';
import { deletePublicBoard, findPublicBoards, modifyPublicBoardHitCount, savePublicBoard } from 'apis/public';
import { findUsers } from 'apis/user';
import { getComboCodeList } from 'apis/common';
const UserManager = () => {
const [team, setTeam] = useState();
const [category, setCategory] = useState('ciTitle');
const [searchTxt, setSearchTxt] = useState('');
const [totalCount, setTotalCount] = useState(0);
const [rowsState, setRowsState] = useState({
page: 0,
pageSize: 10,
pageSize: 20,
rows: []
// loading: false
});
@ -36,43 +38,61 @@ const UserManager = () => {
const columns = [
{ headerName: 'No.', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 },
{
headerName: '사용자아이디',
headerName: '아이디',
headerAlign: 'center',
field: 'inDept',
align: 'center'
field: 'userid',
align: 'center',
width: 100
},
{
headerName: '이름',
headerAlign: 'center',
field: 'inTitle',
minWidth: 200,
renderCell: (params) => (
<Link underline="hover" href="#">
{params.value}
</Link>
)
field: 'name',
align: 'center',
width: 100
},
{ headerName: '연락처', headerAlign: 'center', field: 'mphone', align: 'center', width: 120 },
{ headerName: '이메일', headerAlign: 'center', field: 'email', width: 200 },
{
headerName: '팀',
headerAlign: 'center',
field: 'team',
align: 'center'
// renderCell: (params) => (
// <Select variant="contained" color="primary" size="small" style={{ marginLeft: 16 }}>
// <MenuItem key="1" value="001">
// 1
// </MenuItem>
// </Select>
// )
},
{ headerName: '등록일', headerAlign: 'center', field: 'regdate', align: 'center', width: 100 },
{ headerName: '사용구분', headerAlign: 'center', field: 'accesstype', align: 'center', width: 80 },
{
headerName: '사용여부',
headerAlign: 'center',
field: 'isenable',
align: 'center',
width: 80,
valueFormatter: (params) => (params.value === '0' ? '사용' : '미사용')
},
{ headerName: '전화번호', headerAlign: 'center', field: 'a', align: 'center' },
{ headerName: '이메일', headerAlign: 'center', field: 'b', align: 'center' },
{ headerName: '사용여부', headerAlign: 'center', field: 'c', align: 'center' },
{ headerName: '사용구분', headerAlign: 'center', field: 'd', align: 'center' },
{ headerName: '생성일시', headerAlign: 'center', field: 'e', align: 'right' }
{ headerName: '구청코드', headerAlign: 'center', field: 'gu', align: 'right' }
];
//
const search = () => {
const search = useCallback(() => {
const params = {
page: rowsState.page,
size: rowsState.pageSize
};
findPublicBoards(params).then((response) => {
findUsers(params).then((response) => {
// console.log(response);
if (response && response.data) {
setTotalCount(response.count);
setRowsState((prevState) => ({ ...prevState, rows: response.data }));
}
});
};
}, [rowsState.page, rowsState.pageSize]);
const handleSearch = async (event) => {
if (event.type === 'keydown' && event.key === 'Enter') {
@ -80,9 +100,14 @@ const UserManager = () => {
setSearchTxt(newString);
}
};
useEffect(() => {
getComboCodeList({ codeMcd: 'TEAM' }).then((res) => {
console.log(res);
setTeam(res.data);
});
search();
}, [rowsState.page, rowsState.pageSize, category, searchTxt]);
}, [search]);
//
const handleCreate = () => {
@ -97,28 +122,28 @@ const UserManager = () => {
setCreate(false);
setTitle('사용자 정보 변경');
setSelectedRow(e?.row);
modifyPublicBoardHitCount(e?.row?.inCode);
// modifyPublicBoardHitCount(e?.row?.inCode);
setOpen(true);
}
};
// model
const submitPublicBoard = (type, payload) => {
switch (type) {
case 'SAVE':
savePublicBoard(payload).then(() => {
search();
setOpen(false);
}); // .then((res) => {
break;
case 'DELETE':
deletePublicBoard(payload).then(() => {
search();
setOpen(false);
}); // .then((res) => {
break;
default:
}
// switch (type) {
// case 'SAVE':
// savePublicBoard(payload).then(() => {
// search();
// setOpen(false);
// }); // .then((res) => {
// break;
// case 'DELETE':
// deletePublicBoard(payload).then(() => {
// search();
// setOpen(false);
// }); // .then((res) => {
// break;
// default:
// }
};
return (

@ -116,7 +116,7 @@ const MuiDataGrid = ({
isCheckbox = false,
// isDisableSelection = true,
columns,
rowsState = { page: 0, pageSize: 10, rows: [] },
rowsState = { page: 0, pageSize: 20, rows: [] },
totalCount = 0,
setRowsState = () => {},
handleCellClick = () => {},

Loading…
Cancel
Save