Browse Source

비행계획관리 버튼 비활성화 이슈 재수정

ctrlDraw
이준희 2 years ago
parent
commit
e4ca0f824f
  1. 1
      src/components/basis/flight/plan/FlightPlanGroupGrid.js
  2. 98
      src/containers/basis/flight/aprv/FlightPlanAprvContainer.js
  3. 85
      src/containers/basis/flight/plan/FlightPlanContainer.js

1
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 ? (
<Button.Ripple
color='danger'

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

@ -121,6 +121,57 @@ const FlightPlanAprvContainer = () => {
}
];
// 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 }));
};

85
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 }));
};

Loading…
Cancel
Save