diff --git a/src/components/basis/flight/plan/FlightPlanPilot.js b/src/components/basis/flight/plan/FlightPlanPilot.js index bd389999..1b42f5de 100644 --- a/src/components/basis/flight/plan/FlightPlanPilot.js +++ b/src/components/basis/flight/plan/FlightPlanPilot.js @@ -3,7 +3,7 @@ import {Button, Card, CardBody, Col, CustomInput, Row, FormGroup, Input, Label} import {Search} from 'react-feather'; import {GridDatabase} from '../../../crud/grid/GridDatatable'; -const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => { +const FlightPlanPilot = ({ pilotList, handleSelectPilot, returnPilot, onClickEvent, setInputVal }) => { const columns = [ {id: 'groupNm', name: '그룹 명', cell: row => (
{row.groupNm}
)}, {id: 'memberName', name: '성명', cell: row => (
{row.memberName}
)}, @@ -33,7 +33,7 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => { 검색 @@ -57,7 +57,7 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => { id='memberName' name='memberName' // value={props.params.groupNm} - // onChange={props.handlerInput} + onChange={(e) => {setInputVal(e.target.value)}} bsSize='sm' // onKeyPress={props.onKeyPress} placeholder='성명을 입력하세요' @@ -82,7 +82,7 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => {

조종사 목록

- 검색결과 총 {!!pilotList ? pilotList.length : 0}건 + 검색결과 총 {!!returnPilot ? [returnPilot].length : 0}건
@@ -90,8 +90,8 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => {
diff --git a/src/containers/basis/flight/plan/FlightPlanPilotContainer.js b/src/containers/basis/flight/plan/FlightPlanPilotContainer.js index 80efadaa..ee638746 100644 --- a/src/containers/basis/flight/plan/FlightPlanPilotContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanPilotContainer.js @@ -6,6 +6,8 @@ import FlightPlanPilot from '../../../../components/basis/flight/plan/FlightPlan const FlightPlanPilotContainer = ({handleModal, type}) => { const dispatch = useDispatch(); const { pilotList, selectGroup } = useSelector(state => state.flightState); + const [returnPilot, setReturnPilot] = useState(''); + const [inputVal , setInputVal] = useState(''); /* 조종사 조회 */ @@ -19,7 +21,7 @@ const FlightPlanPilotContainer = ({handleModal, type}) => { /* 조종사 선택 */ const handleSelectPilot = (cstmrSno) => { - handleModal({target: 'poilot', isOpen: false}); + handleModal({target: 'pilot', isOpen: false}); const pilot = pilotList.find(pilot => { return pilot.cstmrSno === cstmrSno; @@ -27,16 +29,46 @@ const FlightPlanPilotContainer = ({handleModal, type}) => { /* 파일럿 정보 Redux 저장 */ dispatch(Actions.PILOT_SELECT(pilot)); } - + useEffect(() => { handleSearch(); }, []) - + useEffect(()=> { + console.log('goToHome') + if(pilotList) { + onTest(); + } + },[pilotList]) + + + + const onClickEvent= (e)=> { + setInputVal(e.target.value); + onTest(); + } + + const onTest = () => { + pilotList.filter((unit) =>{ + if(inputVal==''){ + setReturnPilot(unit) + }else if(unit.memberName.includes(inputVal)){ + setReturnPilot(unit) + console.log("Filtered >>>>" , returnPilot) + }else if (inputVal != ''){ + setReturnPilot('') + } + }) + } return ( ) }