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. 56
      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 => {
return <Button.Ripple color='primary' size='sm' onClick={() => {
handleSelectArcrft(row.arcrftSno)
handleSelectArcrft(row.idntfNum)
}
}>선택</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});
const arcrft = arcrftList.find(arcrft => {
return arcrft.arcrftSno === arcrftSno;
return arcrft.idntfNum === idntfNum;
});
/* 기체 정보 Redux 저장 */
dispatch(Actions.ARCRFT_SELECT(arcrft));

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

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

Loading…
Cancel
Save