|
|
|
@ -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 (
|
|
|
|
|