Browse Source

식별장치 disabled 조건 수정

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
5b01356ddf
  1. 27
      src/containers/basis/dron/BasisIdntfContainer.js

27
src/containers/basis/dron/BasisIdntfContainer.js

@ -28,9 +28,6 @@ export const BasisIdntfContainer = props => {
const [idntDataList, setIdntfDataList] = useState([]);
//내가 등록한 식별장치 목록
const [myIdntf, setMyIdntf] = useState([]);
useEffect(() => {
if (props.id) {
handlerSearch();
@ -44,29 +41,26 @@ export const BasisIdntfContainer = props => {
newArr.push({ ...item });
});
//내가 등록한 식별장치 목록
//내가 등록한 식별장치이면 disabled = false
if (user?.authId === 'SUPER') {
// setIsDisabled(false);
newArr.map(prev => {
prev.disabled = false;
});
} else if (user?.authId === 'ADMIN') {
if (props.isMyGroup) {
if (newArr.length > 0) {
newArr.filter(prev => {
if (user?.cstmrSno === prev.cstmrSno) {
prev.disabled = false;
setMyIdntf(r => [...r, prev]);
}
});
}
// else {
// console.log('식별장치 없음');
// }
}
} else if (user?.authId === 'USER') {
if (newArr.length > 0) {
newArr.filter(prev => {
if (user?.cstmrSno === prev.cstmrSno) {
prev.disabled = false;
setMyIdntf(r => [...r, prev]);
}
});
}
@ -82,17 +76,6 @@ export const BasisIdntfContainer = props => {
}
}, [isRefreshIdntf]);
useEffect(() => {
if (detail?.createUserId) {
if (detail?.createUserId != user?.userId) {
props.setIsDisabled(true);
}
}
if (user.authId === 'SUPER') {
props.setIsDisabled(false);
}
}, [detail]);
const handlerSearch = () => {
dispatch(Actions.IDNTF_LIST.request(props.id));
};
@ -231,8 +214,6 @@ export const BasisIdntfContainer = props => {
deletaData={deletaData}
handlerSave={handlerCreate}
handlerDelete={handlerDelete}
// isDisabled={props.isDisabled}
myIdntf={myIdntf}
/>
<ErrorModal modal={modal} setModal={setModal} />
</Col>

Loading…
Cancel
Save