|
|
@ -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, |
|
|
|