From 6269783830c09ccb77322429c00fa645abbae812 Mon Sep 17 00:00:00 2001 From: sanguu516 Date: Wed, 14 Aug 2024 10:25:11 +0900 Subject: [PATCH] =?UTF-8?q?feat/=EC=9A=94=EC=B2=AD=20=EA=B3=A0=EB=8F=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=83=81=EB=8B=A8=20=EB=AC=B8?= =?UTF-8?q?=EA=B5=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flight/ControlApprovalsTable.js | 24 ++++ .../flight/NewFlightApprovalsReport.js | 111 +++++++++------- .../flight/OperationApprovalsTable.js | 120 +++++++++++++----- 3 files changed, 178 insertions(+), 77 deletions(-) diff --git a/src/components/flight/ControlApprovalsTable.js b/src/components/flight/ControlApprovalsTable.js index f966ffaf..7f2b8476 100644 --- a/src/components/flight/ControlApprovalsTable.js +++ b/src/components/flight/ControlApprovalsTable.js @@ -337,6 +337,22 @@ export default function ControlApprovalsTable(props) { return text ? text : '-'; } }, + { + title: ( + <> + 요청 고도 +
+ (m이하) + + ), + dataIndex: 'reqElev', + align: 'center', + width: '80px', + editable: true, + render: (text, record) => { + return text ? text : '-'; + } + }, { title: ( <> @@ -678,6 +694,14 @@ export default function ControlApprovalsTable(props) { return text ? text : <>-; } }, + { + dataIndex: 'reqElev', + align: 'center', + width: '80px', + render: text => { + return text ? text : <>-; + } + }, { dataIndex: 'fltElevMax', align: 'center', diff --git a/src/components/flight/NewFlightApprovalsReport.js b/src/components/flight/NewFlightApprovalsReport.js index f2079355..d272b687 100644 --- a/src/components/flight/NewFlightApprovalsReport.js +++ b/src/components/flight/NewFlightApprovalsReport.js @@ -50,61 +50,76 @@ export default function NewFlightApprovalsReport(props) {

비행승인 신청 검토결과 현황

-
- 검색일자 또는 신청번호/검토결과 또는 확인결과를 입력해주세요. -
+
-
- { - setSearchDate({ - startDate: dayjs(date[0]).format('YYYY-MM-DD'), - endDate: dayjs(date[1]).format('YYYY-MM-DD') - }); - }} - className='form-control flat-picker bg-transparent border-0 shadow-none' - /> - +
+
+

신청일자

+
+
+ { + setSearchDate({ + startDate: dayjs(date[0]).format('YYYY-MM-DD'), + endDate: dayjs(date[1]).format('YYYY-MM-DD') + }); + }} + className='form-control flat-picker bg-transparent border-0 shadow-none' + /> + +
+
- props.setFilterId(e.target.value)} - onKeyPress={handleKeyDown} - /> +
+
+

신청번호

+
+ props.setFilterId(e.target.value)} + onKeyPress={handleKeyDown} + /> +
+
- props.setReviewedType(e.target.value)} - onKeyPress={handleKeyDown} - > - {Object.values( - props.pageName === 'control' - ? FlightCategory.Control - : FlightCategory.Operation - ).map(item => ( - - ))} - +
+
+

검토결과

+
+ props.setReviewedType(e.target.value)} + onKeyPress={handleKeyDown} + > + {Object.values( + props.pageName === 'control' + ? FlightCategory.Control + : FlightCategory.Operation + ).map(item => ( + + ))} + +
diff --git a/src/components/flight/OperationApprovalsTable.js b/src/components/flight/OperationApprovalsTable.js index ca4baf19..4bea3231 100644 --- a/src/components/flight/OperationApprovalsTable.js +++ b/src/components/flight/OperationApprovalsTable.js @@ -6,7 +6,8 @@ import { FaAngleDown, FaAngleUp } from 'react-icons/fa'; import { Form, Input, Table, Typography } from 'antd'; import { updateLaancAprv, - getLaancAprvList + getLaancAprvList, + updateLaancAprvReview } from '@src/redux/features/laanc/laancThunk'; import { ERROR_MESSAGE, ERROR_TITLE } from '@src/configs/msgConst'; import OperationModal from './OperationModal'; @@ -322,6 +323,22 @@ export default function OperationApprovalsTable(props) { return text ? text : '-'; } }, + { + title: ( + <> + 요청 고도 +
+ (m이하) + + ), + dataIndex: 'reqElev', + align: 'center', + width: '80px', + editable: true, + render: (text, record) => { + return text ? text : '-'; + } + }, { title: ( <> @@ -659,6 +676,14 @@ export default function OperationApprovalsTable(props) { return text ? text : <>-; } }, + { + dataIndex: 'reqElev', + align: 'center', + width: '80px', + render: text => { + return text ? text : <>-; + } + }, { dataIndex: 'fltElevMax', align: 'center', @@ -788,6 +813,7 @@ export default function OperationApprovalsTable(props) { approvalCd: item.approvalCd, planAreaSno: item.planAreaSno, planSno: item.planSno, + reqElev: item.reqElev, addr1: item.addr1, addr2: item.addr2, addr3: item.addr3, @@ -1083,15 +1109,12 @@ export default function OperationApprovalsTable(props) { setIsModal(!ismodal); // } }; + // 부모 체크박스 const rowSelection = { selectedRowKeys: checkList, getCheckboxProps: record => { - const allChildrenReviewed = record.areaList.every( - child => child.reviewedType !== 'R' - ); return { - disabled: allChildrenReviewed, name: record.key }; }, @@ -1100,9 +1123,9 @@ export default function OperationApprovalsTable(props) { const key = record.key; if (key.startsWith('parent_')) { - const childKeys = record.areaList - .filter(child => child.reviewedType === 'R') - .map(child => `child_${record.planSno}_${child.planAreaSno}`); + const childKeys = record.areaList.map( + child => `child_${record.planSno}_${child.planAreaSno}` + ); if (selected) { newCheckList.push(key, ...childKeys); @@ -1119,16 +1142,12 @@ export default function OperationApprovalsTable(props) { const newCheckList = selected ? laancAprvList.flatMap(parent => { const parentKey = `parent_${parent.planSno}`; - const selectableChildren = parent.areaList.filter( - child => child.reviewedType === 'R' - ); - const childKeys = selectableChildren.map( + + const childKeys = parent.areaList.map( child => `child_${parent.planSno}_${child.planAreaSno}` ); - return selectableChildren.length > 0 - ? [parentKey, ...childKeys] - : []; + return parent.areaList.length > 0 ? [parentKey, ...childKeys] : []; }) : []; @@ -1143,10 +1162,8 @@ export default function OperationApprovalsTable(props) { // 부모 키 업데이트 laancAprvList.forEach(parent => { const parentKey = `parent_${parent.planSno}`; - const selectableChildren = parent.areaList.filter( - child => child.reviewedType === 'R' - ); - const childKeys = selectableChildren.map( + + const childKeys = parent.areaList.map( child => `child_${parent.planSno}_${child.planAreaSno}` ); const allSelectableChildrenChecked = childKeys.every(key => @@ -1156,7 +1173,7 @@ export default function OperationApprovalsTable(props) { newList.includes(key) ); - if (allSelectableChildrenChecked && selectableChildren.length > 0) { + if (allSelectableChildrenChecked && parent.areaList.length > 0) { if (!newList.includes(parentKey)) { newList.push(parentKey); } @@ -1175,7 +1192,6 @@ export default function OperationApprovalsTable(props) { const childRowSelection = { selectedRowKeys: checkList.filter(key => key.startsWith('child_')), getCheckboxProps: record => ({ - disabled: record.reviewedType !== 'R', name: record.key }), @@ -1193,11 +1209,13 @@ export default function OperationApprovalsTable(props) { }; // 체크박스 업데이트 함수 - const handleCheckbox = async () => { + const handleCheckbox = async type => { if (checkList.length === 0) { return handlerErrorModal( - '재검토 요청 실패', - '재검토 항목을 선택해주세요.', + type === 'R' ? '재 요청 요청 실패' : '검토 요청 실패', + type === 'R' + ? '재 요청 항목을 선택해주세요.' + : '검토 항목을 선택해주세요.', false ); } @@ -1217,10 +1235,51 @@ export default function OperationApprovalsTable(props) { ) ); - setCheckData(res); - setIsCheckBoxModal(true); + if (type === 'A') { + const check = !res.some(item => item.approvalCd !== 'R'); + if (!check) { + return handlerErrorModal( + '재 요청 요청 실패', + '검토결과 완료인 신청건만 재 요청이 가능합니다.' + ); + } else { + setCheckData(res); + setIsCheckBoxModal(true); + } + } else if (type === 'R') { + const check = res.some( + item => item.approvalCd !== 'R' && item.approvalCd !== 'C' + ); + if (!check) { + return handlerErrorModal( + '검토 요청 실패', + '검토결과 대기인 신청건만 요청이 가능합니다.' + ); + } else { + try { + dispatch( + updateLaancAprvReview({ planAreaSnoList, reviewedType: 'R' }) + ).then(() => { + props.handlerSearch( + props.filterId, + { + startDate: props.startDate, + endDate: props.endDate + }, + props.filterArea + ); + }); + setCheckList([]); + } catch (error) { + return handlerErrorModal( + '검토 실패', + '검토를 요청을 실패하였습니다. 다시 시도해주세요.', + false + ); + } + } + } }; - return (
@@ -1265,8 +1324,11 @@ export default function OperationApprovalsTable(props) {
- +