Browse Source

[비행계획서] 조종사,기체 버그 수정

pull/2/head
노승철 2 years ago
parent
commit
0d8da961e0
  1. 2
      src/components/basis/flight/plan/FlightPlanArcrft.js
  2. 4
      src/containers/basis/flight/plan/FlightPlanArcrftContainer.js
  3. 80
      src/containers/basis/flight/plan/FlightPlanDetailContainer.js

2
src/components/basis/flight/plan/FlightPlanArcrft.js

@ -13,7 +13,7 @@ const FlightPlanArcrft = ({ arcrftList, handleSelectArcrft, onClickEvent, name,
{ {
id: 'selectPilot', name: '선택', cell: row => { id: 'selectPilot', name: '선택', cell: row => {
return <Button.Ripple color='primary' size='sm' onClick={() => { return <Button.Ripple color='primary' size='sm' onClick={() => {
handleSelectArcrft(row.arcrftSno) handleSelectArcrft(row.idntfNum)
} }
}>선택</Button.Ripple>; }>선택</Button.Ripple>;
} }

4
src/containers/basis/flight/plan/FlightPlanArcrftContainer.js

@ -20,11 +20,11 @@ const FlightPlanArcrftContainer = ({handleModal, type}) => {
} }
/* 기체 선택 */ /* 기체 선택 */
const handleSelectArcrft = (arcrftSno) => { const handleSelectArcrft = (idntfNum) => {
handleModal({target: 'arcrft', isOpen: false}); handleModal({target: 'arcrft', isOpen: false});
const arcrft = arcrftList.find(arcrft => { const arcrft = arcrftList.find(arcrft => {
return arcrft.arcrftSno === arcrftSno; return arcrft.idntfNum === idntfNum;
}); });
/* 기체 정보 Redux 저장 */ /* 기체 정보 Redux 저장 */
dispatch(Actions.ARCRFT_SELECT(arcrft)); dispatch(Actions.ARCRFT_SELECT(arcrft));

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

@ -41,8 +41,8 @@ const FlightPlanDetailContainer = () => {
if(pilotSelect !== undefined) { if(pilotSelect !== undefined) {
const pilotList = detailData.pilotList.concat(); const pilotList = detailData.pilotList.concat();
const pilot = Object.assign({}, initFlightBas['pilot']); const pilot = Object.assign({}, initFlightBas['pilot']);
console.log(pilotSelect);
pilot.planSno = detailData.planSno;
pilot.cstmrSno = pilotSelect.cstmrSno; pilot.cstmrSno = pilotSelect.cstmrSno;
pilot.groupNm = pilotSelect.groupNm; pilot.groupNm = pilotSelect.groupNm;
pilot.clncd = pilotSelect.clncd; pilot.clncd = pilotSelect.clncd;
@ -53,32 +53,27 @@ const FlightPlanDetailContainer = () => {
// 파일럿 중복 확인 // 파일럿 중복 확인
let checking = true let checking = true
pilotList.forEach(p => { pilotList.forEach((p, i) => {
if(p.cstmrSno === pilotSelect.cstmrSno) {
alert('이미 등록된 조종사입니다.');
checking = false;
return false;
}
if(p.cstmrSno !== 0) { if(p.cstmrSno !== 0) {
if(p.cstmrSno === pilotSelect.cstmrSno) { if(i === pilotList.length -1) pilotList.push(pilot);
alert('중복'); } else {
checking = false; pilotList[i] = pilot;
return false;
}
} }
}); });
if(checking) { if(checking) {
pilotList.forEach((p, i) => {
console.log(pilotList);
if(p.cstmrSno === 0) {
pilotList[i] = pilot
} else if(i == 0){
return pilotList.push(pilot);
}
});
setDetailData(prevState => { setDetailData(prevState => {
return { return {
...prevState, ...prevState,
['pilotList']: pilotList ['pilotList']: pilotList
} }
}) });
} }
} }
@ -89,6 +84,7 @@ const FlightPlanDetailContainer = () => {
const arcrftList = detailData.arcrftList.concat(); const arcrftList = detailData.arcrftList.concat();
const arcrft = Object.assign({}, initFlightBas['arcrft']); const arcrft = Object.assign({}, initFlightBas['arcrft']);
arcrft.planSno = detailData.planSno;
arcrft.arcrftSno = arcrftSelect.arcrftSno; arcrft.arcrftSno = arcrftSelect.arcrftSno;
arcrft.groupId = arcrftSelect.groupId; arcrft.groupId = arcrftSelect.groupId;
arcrft.groupNm = arcrftSelect.groupNm; arcrft.groupNm = arcrftSelect.groupNm;
@ -99,34 +95,29 @@ const FlightPlanDetailContainer = () => {
arcrft.ownerNm = arcrftSelect.ownerNm; arcrft.ownerNm = arcrftSelect.ownerNm;
let checking = true; let checking = true;
arcrftList.forEach(p => {
if(p.arcrftSno !== 0){ arcrftList.forEach((p,i) => {
if(p.arcrftSno === arcrftSelect.arcrftSno) { if(p.idntfNum === arcrftSelect.idntfNum) {
alert('중복'); alert('이미 등록된 기체 식별번호입니다.');
checking = false; checking = false;
return false; return false;
} }
if(p.idntfNum) {
if(i === arcrftList.length -1) arcrftList.push(arcrft);
} else {
arcrftList[i] = arcrft;
} }
console.log(p);
}); });
if(checking){ if(checking) {
arcrftList.forEach((p,i) => { setDetailData(prevState => {
console.log('>>>>>>>>>>', arcrftList); return {
if(p.arcrftSno === 0){ ...prevState,
arcrftList[i] = arcrft ['arcrftList']: arcrftList
} else if(i == 0){
return arcrftList.push(arcrft);
} }
}); })
} }
setDetailData(prevState => {
return {
...prevState,
['arcrftList']: arcrftList
}
})
} }
}, [arcrftSelect]) }, [arcrftSelect])
@ -331,11 +322,10 @@ const FlightPlanDetailContainer = () => {
setDetailData(prevState => { setDetailData(prevState => {
const arr = [...prevState[arrName]]; const arr = [...prevState[arrName]];
const deleteData = arr.splice(index, 1); const deleteData = arr.splice(index, 1);
console.log(deleteData);
const id = initFlight.detail['pilotList'] const id = initFlight.detail['pilotList']
console.log(id);
if(arr.length > 0) { if(arr.length > 0) {
debugger
return { return {
...prevState, ...prevState,
[arrName]: arr [arrName]: arr
@ -353,8 +343,8 @@ const FlightPlanDetailContainer = () => {
setDetailData(prevState => { setDetailData(prevState => {
const arr = [...prevState[arrName]]; const arr = [...prevState[arrName]];
const deleteData = arr.splice(index, 1); const deleteData = arr.splice(index, 1);
console.log(deleteData);
const id = initFlight.detail['arcrftList'] const id = initFlight.detail['arcrftList']
if(arr.length > 0) { if(arr.length > 0) {
return { return {
...prevState, ...prevState,

Loading…
Cancel
Save