From e4ca0f824f59e20edce0fca816944a11c9f4877e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Mon, 14 Nov 2022 18:23:01 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B3=84=ED=9A=8D=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EB=B2=84=ED=8A=BC=20=EB=B9=84=ED=99=9C=EC=84=B1?= =?UTF-8?q?=ED=99=94=20=EC=9D=B4=EC=8A=88=20=EC=9E=AC=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/plan/FlightPlanGroupGrid.js | 1 - .../flight/aprv/FlightPlanAprvContainer.js | 98 ++++++++++--------- .../basis/flight/plan/FlightPlanContainer.js | 85 ++++++++-------- 3 files changed, 97 insertions(+), 87 deletions(-) diff --git a/src/components/basis/flight/plan/FlightPlanGroupGrid.js b/src/components/basis/flight/plan/FlightPlanGroupGrid.js index 7057e38..a50b8c5 100644 --- a/src/components/basis/flight/plan/FlightPlanGroupGrid.js +++ b/src/components/basis/flight/plan/FlightPlanGroupGrid.js @@ -47,7 +47,6 @@ const FlightPlanGroupGrid = ({ { sortable: true, cell: row => { - // console.log(row); return selectGroup?.groupId === row?.groupId ? ( { } ]; + // useEffect(() => { + // handlerGroupCancel(); + // }, []); + useEffect(() => { + if (user?.cstmrSno) { + if (user.authId === 'SUPER' || user.authId === 'ADMIN') { + dispatch(GROUP_LIST.request({ cstmrSno: user?.cstmrSno })); + } else { + dispatch( + JOIN_LIST.request({ + cstmrSno: user?.cstmrSno + }) + ); + } + } + }, [user]); + + useEffect(() => { + if (searchData?.groupId) { + handleSearch(searchData); + + const group = groupList?.find( + prev => prev.groupId === aprvSelect.groupId + ); + + const join = joinList?.find(prev => prev.groupId === aprvSelect.groupId); + + const obj = { + groupAuthCd: join?.groupAuthCd, + myGroupAuthCd: group?.myGroupAuthCd + }; + + //승인/미승인버튼 활성/비활성 제어 + let my = false; + if (user.authId === 'SUPER') { + my = true; + } else if (user.authId === 'ADMIN') { + my = obj?.myGroupAuthCd && true; + } else if (user.authId === 'USER') { + my = obj?.groupAuthCd && true; + } + setIsMyGroup(my); + } + }, [searchData]); + + useEffect(() => { + if (aprvProc && aprvProc.result > 0) { + handleSearch(searchData); + } + }, [aprvProc]); + const handleGroupSelect = ({ groupId, groupNm, @@ -184,53 +235,6 @@ const FlightPlanAprvContainer = () => { ); }; - // 최초 비행계획서 목록 조회 - // useEffect(() => { - // handlerGroupCancel(); - // // handleSearch(searchData); - // }, []); - - useEffect(() => { - if (searchData?.groupId) { - handleSearch(searchData); - - //승인/미승인버튼 활성/비활성 제어 - let my = false; - if (user.authId === 'SUPER') { - my = true; - } else if (user.authId === 'ADMIN') { - if (myGroupAuthCd) { - my = true; - } - } else if (user.authId === 'USER') { - if (groupAuthCd) { - my = true; - } - } - setIsMyGroup(my); - } - }, [searchData]); - - useEffect(() => { - if (user?.cstmrSno) { - if (user.authId === 'SUPER' || user.authId === 'ADMIN') { - dispatch(GROUP_LIST.request({ cstmrSno: user?.cstmrSno })); - } else { - dispatch( - JOIN_LIST.request({ - cstmrSno: user?.cstmrSno - }) - ); - } - } - }, [user]); - - useEffect(() => { - if (aprvProc && aprvProc.result > 0) { - handleSearch(searchData); - } - }, [aprvProc]); - const handleSearch = data => { dispatch(FlightAction.FLIGHT_APRV_LIST.request({ ...data, page: 1 })); }; diff --git a/src/containers/basis/flight/plan/FlightPlanContainer.js b/src/containers/basis/flight/plan/FlightPlanContainer.js index dbc9e7a..c662aac 100644 --- a/src/containers/basis/flight/plan/FlightPlanContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanContainer.js @@ -46,6 +46,52 @@ const FlightPlanContainer = () => { //비행계획서 신청 버튼 활성/비활성 제어 const [isMyGroup, setIsMyGroup] = useState(); + // useEffect(() => { + // handlerGroupCancel(); + // }, []); + useEffect(() => { + if (user?.cstmrSno) { + if (user.authId === 'SUPER' || user.authId === 'ADMIN') { + dispatch(GROUP_LIST.request({ cstmrSno: user?.cstmrSno })); + } else { + dispatch( + JOIN_LIST.request({ + cstmrSno: user?.cstmrSno + }) + ); + } + } + }, [user]); + + useEffect(() => { + if (searchData?.groupId) { + handleSearch(searchData); + + //admin -> myGroupAuthCd + const group = groupList?.find( + prev => prev.groupId === listSelect.groupId + ); + + const join = joinList?.find(prev => prev.groupId === listSelect.groupId); + + const obj = { + groupAuthCd: join?.groupAuthCd, + myGroupAuthCd: group?.myGroupAuthCd + }; + + //비행계획서 신청 버튼 활성/비활성 제어 + let my = false; + if (user.authId === 'SUPER') { + my = true; + } else if (user.authId === 'ADMIN') { + my = obj?.myGroupAuthCd && true; + } else if (user.authId === 'USER') { + my = obj?.groupAuthCd && true; + } + setIsMyGroup(my); + } + }, [searchData]); + const moveFlightPlanDetailPage = () => { if (planDetailData) { dispatch(FlightAction.FLIGHT_PLAN_DETAIL_INIT()); @@ -129,45 +175,6 @@ const FlightPlanContainer = () => { ); }; - // useEffect(() => { - // handlerGroupCancel(); - // }, []); - - useEffect(() => { - if (searchData?.groupId) { - handleSearch(searchData); - - //비행계획서 신청 버튼 활성/비활성 제어 - let my = false; - if (user.authId === 'SUPER') { - my = true; - } else if (user.authId === 'ADMIN') { - if (myGroupAuthCd) { - my = true; - } - } else if (user.authId === 'USER') { - if (groupAuthCd) { - my = true; - } - } - setIsMyGroup(my); - } - }, [searchData]); - - useEffect(() => { - if (user?.cstmrSno) { - if (user.authId === 'SUPER' || user.authId === 'ADMIN') { - dispatch(GROUP_LIST.request({ cstmrSno: user?.cstmrSno })); - } else { - dispatch( - JOIN_LIST.request({ - cstmrSno: user?.cstmrSno - }) - ); - } - } - }, [user]); - const onChangePage = page => { dispatch(FlightAction.FLIGHT_PLAN_LIST.request({ ...searchData, page })); };