From d352163a06e4da6b42d56047f16d6e72e57491a2 Mon Sep 17 00:00:00 2001 From: JANGHYUNn Date: Thu, 5 Sep 2024 15:03:37 +0900 Subject: [PATCH] =?UTF-8?q?=EB=93=9C=EB=A1=A0=20=EC=9B=90=EC=8A=A4?= =?UTF-8?q?=ED=86=B1=20=EC=A0=84=EC=86=A1=20api=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 | 14 ++++--- .../flight/OperationApprovalsTable.js | 37 +++++++++++++------ src/configs/constants.ts | 4 +- src/redux/features/laanc/laancState.ts | 5 +++ src/redux/features/laanc/laancThunk.ts | 22 ++++++++++- 5 files changed, 62 insertions(+), 20 deletions(-) diff --git a/src/components/flight/ControlApprovalsTable.js b/src/components/flight/ControlApprovalsTable.js index 67cc1161..f24302b9 100644 --- a/src/components/flight/ControlApprovalsTable.js +++ b/src/components/flight/ControlApprovalsTable.js @@ -555,7 +555,7 @@ export default function ControlApprovalsTable(props) { e.stopPropagation(); }} > - {reviewedProcType === 'W' ? '검토대기' : '검토완료'} + 검토대기 ) : ( '검토완료' @@ -573,11 +573,15 @@ export default function ControlApprovalsTable(props) { 상태 ), - dataIndex: 'reviewedProcType', + dataIndex: 'sendProcStatus', width: '100px', align: 'center', - render: reviewedProcType => { - return reviewedProcType === 'W' ? '미전송' : '전송'; + render: sendProcStatus => { + return sendProcStatus + ? sendProcStatus === 'S' + : '전송' + ? '미전송' + : '미전송'; } } ]; @@ -1006,7 +1010,7 @@ export default function ControlApprovalsTable(props) { setModal={setModal} handlerConfirm={() => modal.type === 'review' - ? updateReviewedType('P', currentPlanAreaSno) + ? updateReviewedType('S', currentPlanAreaSno) : handleSave(modal.row) } handleCancel={handleCancel} diff --git a/src/components/flight/OperationApprovalsTable.js b/src/components/flight/OperationApprovalsTable.js index 6e8e7b33..fafa570d 100644 --- a/src/components/flight/OperationApprovalsTable.js +++ b/src/components/flight/OperationApprovalsTable.js @@ -7,7 +7,8 @@ import { Form, Input, Select, Table } from 'antd'; import { updateLaancAprv, getLaancAprvList, - updateLaancAprvReview + updateLaancAprvReview, + updateDronOneStopSend } from '@src/redux/features/laanc/laancThunk'; import { ERROR_MESSAGE, ERROR_TITLE } from '@src/configs/msgConst'; import OperationModal from './OperationModal'; @@ -256,7 +257,7 @@ export default function OperationApprovalsTable(props) { case 'C': text = '검토취소'; break; - case 'P': + case 'S': text = '검토완료'; break; @@ -562,8 +563,8 @@ export default function OperationApprovalsTable(props) { if (reviewedType === 'U') { reviewedType = 'W'; - } else if (reviewedType === 'S') { - reviewedType = 'P'; + } else if (reviewedType === 'P') { + reviewedType = 'S'; } return ( @@ -596,7 +597,7 @@ export default function OperationApprovalsTable(props) { */} - @@ -637,11 +638,11 @@ export default function OperationApprovalsTable(props) { 상태 ), - dataIndex: 'planAreaSno', + dataIndex: 'sendStatus', width: '100px', align: 'center', - render: planAreaSno => { - return '미전송'; + render: sendStatus => { + return sendStatus ? (sendStatus === 'S' ? '전송' : '미전송') : '미전송'; } }, { @@ -822,7 +823,8 @@ export default function OperationApprovalsTable(props) { A: item => { return ( !(item.reviewedType === 'P' || item.reviewedType === 'S') && - !(item?.reviewedProcType === 'P' || item?.reviewedProcType === 'S') + !(item?.reviewedProcType === 'P' || item?.reviewedProcType === 'S') && + !(item?.sendStatus === 'N') ); }, Q: item => item.reviewedType !== 'W', @@ -845,8 +847,19 @@ export default function OperationApprovalsTable(props) { // 요청 성공 시 액션 핸들러 const actionHandlers = { A: () => { - setCheckData(res); - setIsCheckBoxModal(true); + try { + setCheckData(res); + + const planAreaSnoList = res.map(i => i.planAreaSno); + + dispatch(updateDronOneStopSend(planAreaSnoList)); + } catch (error) { + return handlerErrorModal( + '전송 실패', + '전송 요청을 실패하였습니다. 다시 시도해주세요.', + false + ); + } }, Q: async () => { try { @@ -900,7 +913,7 @@ export default function OperationApprovalsTable(props) { } // 요청 성공 시 액션 핸들러 실행 - // await actionHandlers[type](); + await actionHandlers[type](); }; return ( diff --git a/src/configs/constants.ts b/src/configs/constants.ts index 0869a7cb..8fbd2404 100644 --- a/src/configs/constants.ts +++ b/src/configs/constants.ts @@ -240,14 +240,14 @@ export const FlightCategory = { Control: { 전체: '관제통신과', W: '검토대기', - P: '검토완료' + S: '검토완료' // R: '재검토', // C: '검토취소', // P: '요청처리' }, Operation: { 전체: '안전운항과', - P: '검토완료', + S: '검토완료', W: '검토대기', Q: '검토요청' // R: '재검토요청', diff --git a/src/redux/features/laanc/laancState.ts b/src/redux/features/laanc/laancState.ts index 830250ea..6d19f24d 100644 --- a/src/redux/features/laanc/laancState.ts +++ b/src/redux/features/laanc/laancState.ts @@ -737,3 +737,8 @@ export interface ILaancApprovalReviewdRq { planAreaSnoList: []; reviewedType: string; } + +// 운항과 드론원스톱 전송 +export interface ILaancApprovalSendRq { + planAreaSnoList: number[]; +} diff --git a/src/redux/features/laanc/laancThunk.ts b/src/redux/features/laanc/laancThunk.ts index 94fff12d..568a5709 100644 --- a/src/redux/features/laanc/laancThunk.ts +++ b/src/redux/features/laanc/laancThunk.ts @@ -18,7 +18,8 @@ import { ILaancAprvListRs, ILaancAprvListRq, ILaancAprvUpdateRq, - ILaancApprovalReviewdRq + ILaancApprovalReviewdRq, + ILaancApprovalSendRq } from './laancState'; import { createAsyncThunk } from '@reduxjs/toolkit'; import { openModal } from '../comn/message/messageSlice'; @@ -391,3 +392,22 @@ export const updateLaancCAprvReview = createAsyncThunk( } } ); + +// 관제과 검토 수정 API +export const updateDronOneStopSend = createAsyncThunk( + 'laanc/updateDronOneStopSend', + async (rq: ILaancApprovalSendRq, thunkAPI) => { + try { + const data: { undefined } = await axios.post(`/api/bas/dos/send`, { + planAreaSnoList: rq + }); + console.log(data); + // return data; + } catch (error) { + openModal({ + header: ERROR_TITLE, + body: ERROR_MESSAGE + }); + } + } +);