Browse Source

권한에 따른 사용자 관리 변경

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
02831824e9
  1. 31
      src/components/basis/flight/plan/FlightPlanForm.js
  2. 56
      src/containers/basis/group/BasisGroupUsersContainer.js

31
src/components/basis/flight/plan/FlightPlanForm.js

@ -1,3 +1,5 @@
import * as yup from 'yup';
import classnames from 'classnames';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Card, Card,
@ -7,7 +9,8 @@ import {
Input, Input,
Label, Label,
Row, Row,
Button Button,
FormFeedback
} from 'reactstrap'; } from 'reactstrap';
import Flatpickr from 'react-flatpickr'; import Flatpickr from 'react-flatpickr';
import '@styles/react/libs/flatpickr/flatpickr.scss'; import '@styles/react/libs/flatpickr/flatpickr.scss';
@ -35,18 +38,14 @@ const FlightPlanForm = ({
}) => { }) => {
const { areaList, pilotList, arcrftList } = data; const { areaList, pilotList, arcrftList } = data;
const [date, setDate] = useState();
const [isFlightDone, setIsFlightDone] = useState();
const [test, setTest] = useState(); const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual); const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState); const { detail } = useSelector(state => state.flightState);
useEffect(() => { // const schema = yup.object().shape({});
if (detail.createDt) {
setDate(detail.schFltStDt);
}
useEffect(() => {
// console.log(detail);
if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) {
// console.log(true) // console.log(true)
setTest(false); setTest(false);
@ -56,22 +55,6 @@ const FlightPlanForm = ({
} }
}, [detail]); }, [detail]);
useEffect(() => {
setDate('');
}, []);
useEffect(() => {
if (date) {
let cTime = new Date();
let pTime = new Date(date);
if (cTime > pTime) {
setIsFlightDone(true);
} else {
setIsFlightDone(false);
}
}
}, [date]);
return ( return (
<Row> <Row>
<Col sm='12'> <Col sm='12'>

56
src/containers/basis/group/BasisGroupUsersContainer.js

@ -9,7 +9,15 @@ import { ConfirmModal } from '../../../components/modal/ConfirmModal';
import * as Actions from '../../../modules/basis/group/actions/basisGroupAction'; import * as Actions from '../../../modules/basis/group/actions/basisGroupAction';
export const BasisGroupUsersContainer = props => { export const BasisGroupUsersContainer = props => {
const { userList, userCount } = useSelector(state => state.groupState); const { userList, userCount, joinList, joinListCount } = useSelector(
state => state.groupState
);
useEffect(() => {
if (user?.cstmrSno) {
dispatch(Actions.JOIN_LIST.request({ cstmrSno: user?.cstmrSno }));
}
}, [user]);
const { user } = useSelector(state => state.authState); const { user } = useSelector(state => state.authState);
@ -97,7 +105,19 @@ export const BasisGroupUsersContainer = props => {
// minWidth: '102px', // minWidth: '102px',
sortable: false, sortable: false,
cell: row => { cell: row => {
return row?.groupAuthCd === 'ADMIN' ? ( const my = joinList?.find((prev, idx) => {
if (prev.groupId === row?.groupId) {
return prev;
}
});
console.log('내 권한 : ', my?.groupAuthCd);
console.log('이 사람의 권한 : ', row?.groupAuthCd);
if (row?.groupAuthCd === 'CREATER') {
return <div>수정불가</div>;
} else if (row?.groupAuthCd === 'ADMIN') {
if (my?.groupAuthCd === 'CREATER') {
return (
<Button.Ripple <Button.Ripple
color='primary' color='primary'
className='badge badge-primary' className='badge badge-primary'
@ -105,9 +125,13 @@ export const BasisGroupUsersContainer = props => {
> >
사용자로 변경 사용자로 변경
</Button.Ripple> </Button.Ripple>
) : row?.groupAuthCd === 'CREATER' ? ( );
<div>수정불가</div> } else {
) : ( return <div>수정불가</div>;
}
} else if (row?.groupAuthCd === 'USER') {
if (my?.groupAuthCd === 'CREATER' || my?.groupAuthCd === 'ADMIN') {
return (
<Button.Ripple <Button.Ripple
color='danger' color='danger'
className='badge badge-danger' className='badge badge-danger'
@ -118,6 +142,28 @@ export const BasisGroupUsersContainer = props => {
); );
} }
} }
// return row?.groupAuthCd === 'ADMIN' ? (
// <Button.Ripple
// color='primary'
// className='badge badge-primary'
// onClick={() => handlerUserConfirm(row?.cstmrGroupSno)}
// >
// 사용자로 변경
// </Button.Ripple>
// ) : // <div>-</div>
// row?.groupAuthCd === 'CREATER' ? (
// <div>수정불가</div>
// ) : (
// <Button.Ripple
// color='danger'
// className='badge badge-danger'
// onClick={() => handlerAdminConfirm(row?.cstmrGroupSno)}
// >
// 운영자로 변경
// </Button.Ripple>
// );
}
}
]; ];
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save