Browse Source

권한정리 - 비행계획승인

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
c6c9b62d2a
  1. 45
      src/components/basis/flight/aprv/FlightPlanAprvGrid.js
  2. 16
      src/components/basis/flight/plan/FlightPlanGrid.js
  3. 81
      src/containers/basis/flight/aprv/FlightPlanAprvContainer.js
  4. 15
      src/containers/basis/flight/plan/FlightPlanDetailContainer.js

45
src/components/basis/flight/aprv/FlightPlanAprvGrid.js

@ -7,50 +7,18 @@ import { useSelector } from 'react-redux';
const FlightPlanAprvGrid = ({ const FlightPlanAprvGrid = ({
data, data,
// columns,
handleChangeSelected, handleChangeSelected,
handleClickAprv, handleClickAprv,
joinList,
selectGroup,
handleChangeCheckbox,
paginationPerPage, paginationPerPage,
pagination, pagination,
paginationRowsPerPageOptions, paginationRowsPerPageOptions,
handlerPageChange, handlerPageChange,
total total,
isMyGroup
}) => { }) => {
const [aprvAuth, setAprvAuth] = useState('');
const { loading } = useSelector(state => state.loadingReducer); const { loading } = useSelector(state => state.loadingReducer);
useEffect(() => {
joinList.forEach(c => {
if (c.groupId === selectGroup.groupId) {
if (c.groupAuthCd === 'NORMAL') {
setAprvAuth(false);
} else if (c.groupAuthCd === 'MASTER' || c.groupAuthCd === 'LEADER') {
setAprvAuth(true);
}
}
});
}, [selectGroup]);
const columns = [ const columns = [
// {
// id: '',
// name: '',
// minWidth: '50px',
// cell: (row, i) => (
// <>
// <CustomInput
// type='checkbox'
// id={`check${i + 1}`}
// name={`check${i + 1}`}
// // checked={checkState}
// onChange={e => handleChangeCheckbox(e, row)}
// />
// </>
// )
// },
{ {
id: 'planSno', id: 'planSno',
name: '번호', name: '번호',
@ -87,7 +55,10 @@ const FlightPlanAprvGrid = ({
name: '상세보기', name: '상세보기',
cell: row => { cell: row => {
return ( return (
<Link to={`/basis/flight/plan/detail/${row.planSno}`} size='sm'> <Link
to={`/basis/flight/plan/detail/${row.planSno}?type=aprv`}
size='sm'
>
상세보기 상세보기
</Link> </Link>
); );
@ -109,7 +80,7 @@ const FlightPlanAprvGrid = ({
color='primary' color='primary'
size='sm' size='sm'
onClick={handleClickAprv('aprv')} onClick={handleClickAprv('aprv')}
{...(aprvAuth ? {} : { disabled: true })} {...(isMyGroup ? {} : { disabled: true })}
> >
승인 승인
</Button.Ripple> </Button.Ripple>
@ -118,7 +89,7 @@ const FlightPlanAprvGrid = ({
size='sm' size='sm'
style={{ marginLeft: 10 }} style={{ marginLeft: 10 }}
onClick={handleClickAprv('notAprov')} onClick={handleClickAprv('notAprov')}
{...(aprvAuth ? {} : { disabled: true })} {...(isMyGroup ? {} : { disabled: true })}
> >
미승인 미승인
</Button.Ripple> </Button.Ripple>

16
src/components/basis/flight/plan/FlightPlanGrid.js

@ -46,21 +46,13 @@ const FlightPlanGrid = ({
id: 'moveDetail', id: 'moveDetail',
name: '상세보기', name: '상세보기',
cell: row => { cell: row => {
// let mine = false;
// if (user.authId === 'SUPER') {
// mine = true;
// } else if (user.authId === 'ADMIN' || user.authId === 'USER') {
// if (row.createUserId === user.userId) {
// mine = true;
// }
// }
return ( return (
<> <Link
<Link to={`/basis/flight/plan/detail/${row.planSno}`} size='sm'> to={`/basis/flight/plan/detail/${row.planSno}?type=plan`}
size='sm'
>
상세보기 상세보기
</Link> </Link>
</>
); );
} }
} }

81
src/containers/basis/flight/aprv/FlightPlanAprvContainer.js

@ -28,7 +28,6 @@ const initSearchData = {
const FlightPlanAprvContainer = () => { const FlightPlanAprvContainer = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const history = useHistory();
const [searchData, setSearchData] = useState(initSearchData); const [searchData, setSearchData] = useState(initSearchData);
const [selPlanSnoList, setSelPlanSnoList] = useState([]); const [selPlanSnoList, setSelPlanSnoList] = useState([]);
const { const {
@ -47,6 +46,10 @@ const FlightPlanAprvContainer = () => {
desc: '', desc: '',
color: '' color: ''
}); });
//승인/미승인버튼 활성/비활성 제어
const [isMyGroup, setIsMyGroup] = useState();
const columns = [ const columns = [
{ {
// id: 'groupNm', // id: 'groupNm',
@ -104,7 +107,8 @@ const FlightPlanAprvContainer = () => {
handleGroupSelect({ handleGroupSelect({
groupId: row?.groupId, groupId: row?.groupId,
groupNm: row?.groupNm, groupNm: row?.groupNm,
groupAuthCd: row?.groupAuthCd groupAuthCd: row?.groupAuthCd,
myGroupAuthCd: row?.myGroupAuthCd
}); });
}} }}
> >
@ -115,18 +119,16 @@ const FlightPlanAprvContainer = () => {
} }
]; ];
const handleGroupSelect = ({ groupId, groupNm, groupAuthCd }) => { const handleGroupSelect = ({
groupId,
groupNm,
groupAuthCd,
myGroupAuthCd
}) => {
const param = searchData; const param = searchData;
param.cstmrSno = user.cstmrSno; param.cstmrSno = user.cstmrSno;
param.groupId = groupId; param.groupId = groupId;
// if (groupAuthCd === 'CREATER' || groupAuthCd === 'ADMIN') {
if (
groupAuthCd === 'MASTER' ||
groupAuthCd === 'LEADER' ||
user.authId === 'SUPER' ||
user.authId === 'ADMIN'
) {
dispatch( dispatch(
FlightAction.FLIGHT_PLAN_GROUP_SELECT({ FlightAction.FLIGHT_PLAN_GROUP_SELECT({
cstmrSno: user.cstmrSno, cstmrSno: user.cstmrSno,
@ -147,15 +149,21 @@ const FlightPlanAprvContainer = () => {
}; };
}); });
dispatch(FlightAction.FLIGHT_APRV_LIST.request({ ...param, page: 1 })); dispatch(FlightAction.FLIGHT_APRV_LIST.request({ ...param, page: 1 }));
} else {
setModal({ //승인/미승인버튼 활성/비활성 제어
isOpen: true, let my = false;
title: '권한 확인', if (user.authId === 'SUPER') {
desc: '승인정보 확인을 위해서는 운영자 권한이 필요합니다. 운영자에게 권한을 부여받고 다시 시도해 주세요.', my = true;
color: 'info' } else if (user.authId === 'ADMIN') {
}); if (myGroupAuthCd) {
return; my = true;
}
} else if (user.authId === 'USER') {
if (groupAuthCd) {
my = true;
}
} }
setIsMyGroup(my);
}; };
const handlerGroupCancel = () => { const handlerGroupCancel = () => {
@ -252,39 +260,9 @@ const FlightPlanAprvContainer = () => {
return ( return (
<CustomMainLayout title={'비행계획서 승인'}> <CustomMainLayout title={'비행계획서 승인'}>
{/* <div className='pal-card-box'> */} <div className='pal-card-box'>
<div className='mt-2 pal-card-box'>
<Row> <Row>
{/* <Col sm='12'>
<FlightPlanAprvSearch
searchData={searchData}
handleChangeSearchData={handleChangeSearchData}
handleSearch={handleSearch}
/>
<FlightPlanAprvGrid
data={aprvList}
columns={columns}
handleChangeSelected={handleChangeSelected}
handleClickAprv={handleClickAprv}
/>
<FlightPlanGrid
planListData={aprvList}
handleMoveDetail={handleMoveDetail}
handleChangeSelected={handleChangeSelected}
handleClickAprv={handleClickAprv}
/>
</Col> */}
{/* <Col sm='4'>
<FlightPlanAprvGroupGrid
data={joinList}
count={joinListCount}
columns={columns}
/>
</Col> */}
{/* <Col sm='4'> */}
<Col sm='12' lg='12'> <Col sm='12' lg='12'>
{user ? ( {user ? (
<> <>
<FlightPlanAprvGroupGrid <FlightPlanAprvGroupGrid
@ -317,7 +295,6 @@ const FlightPlanAprvContainer = () => {
handlerPageChange={onChangePage} handlerPageChange={onChangePage}
data={aprvList} data={aprvList}
handleClickAprv={handleClickAprv} handleClickAprv={handleClickAprv}
// joinList={joinList}
{...(user?.authId === 'SUPER' || user?.authId === 'ADMIN' {...(user?.authId === 'SUPER' || user?.authId === 'ADMIN'
? { joinList: groupList } ? { joinList: groupList }
: { joinList: joinList })} : { joinList: joinList })}
@ -329,11 +306,11 @@ const FlightPlanAprvContainer = () => {
paginationPerPage={10} paginationPerPage={10}
paginationRowsPerPageOptions={[10, 20, 30, 40]} paginationRowsPerPageOptions={[10, 20, 30, 40]}
total={total} total={total}
isMyGroup={isMyGroup}
// handleChangeCheckbox={handleChangeCheckbox} // handleChangeCheckbox={handleChangeCheckbox}
/> />
</> </>
) : ( ) : (
// <div className='no-dataTable'>
<div className='mt-2 no-dataTable'> <div className='mt-2 no-dataTable'>
그룹 목록에서 상세보기를 클릭하세요. 그룹 목록에서 상세보기를 클릭하세요.
</div> </div>

15
src/containers/basis/flight/plan/FlightPlanDetailContainer.js

@ -8,9 +8,8 @@ import {
initFlight, initFlight,
initFlightBas initFlightBas
} from '../../../../modules/basis/flight/models/basisFlightModel'; } from '../../../../modules/basis/flight/models/basisFlightModel';
import { AiFillPropertySafety } from 'react-icons/ai';
import { ErrorModal } from '../../../../components/modal/ErrorModal'; import { ErrorModal } from '../../../../components/modal/ErrorModal';
import { CgArrowLeftR } from 'react-icons/cg'; import qs from 'qs';
const initModal = { const initModal = {
area: false, area: false,
@ -18,9 +17,10 @@ const initModal = {
arcrft: false arcrft: false
}; };
const FlightPlanDetailContainer = () => { const FlightPlanDetailContainer = props => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const urlParams = useParams(); const urlParams = useParams();
const { search } = useLocation();
const { user } = useSelector(state => state.authState); const { user } = useSelector(state => state.authState);
const flightState = useSelector(state => state.flightState); const flightState = useSelector(state => state.flightState);
const { detail, pilotSelect, arcrftSelect, areaList, selectGroup } = const { detail, pilotSelect, arcrftSelect, areaList, selectGroup } =
@ -52,7 +52,10 @@ const FlightPlanDetailContainer = () => {
} }
}, [date]); }, [date]);
//본인이 등록한 기체가 아니면 true //목록에서 넘어오는지 승인에서 넘어오는지 체크
const { type } = qs.parse(search, { ignoreQueryPrefix: true });
//본인이 등록한 기체가 아니거나 승인에서 넘어오면 true
const [isDisabled, setIsDisabled] = useState(false); const [isDisabled, setIsDisabled] = useState(false);
useEffect(() => { useEffect(() => {
@ -71,6 +74,7 @@ const FlightPlanDetailContainer = () => {
groupId: sessionStorage.getItem('groupId') groupId: sessionStorage.getItem('groupId')
}); });
if (type === 'plan') {
if (user?.authId === 'ADMIN' || user?.authId === 'USER') { if (user?.authId === 'ADMIN' || user?.authId === 'USER') {
if (detail?.createUserId !== '') { if (detail?.createUserId !== '') {
if (detail?.createUserId != user.userId) { if (detail?.createUserId != user.userId) {
@ -80,6 +84,9 @@ const FlightPlanDetailContainer = () => {
} }
} }
} }
} else if (type === 'aprv') {
setIsDisabled(true);
}
}, [detail]); }, [detail]);
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save