diff --git a/src/components/flight/NewFlightApprovalsTable.js b/src/components/flight/NewFlightApprovalsTable.js
index d3587c02..a59652b1 100644
--- a/src/components/flight/NewFlightApprovalsTable.js
+++ b/src/components/flight/NewFlightApprovalsTable.js
@@ -3,9 +3,8 @@ import { useDispatch, useSelector } from '@src/redux/store';
import { Button, Card } from '@component/ui';
import dayjs from 'dayjs';
import { openModal } from '@src/redux/features/comn/message/messageSlice';
-import { Table } from 'antd';
import { FaAngleDown, FaAngleUp } from 'react-icons/fa';
-import { area } from '@turf/turf';
+import { Form, Input, InputNumber, Popconfirm, Table, Typography } from 'antd';
export default function NewFlightApprovalsTable(props) {
const dispatch = useDispatch();
@@ -22,12 +21,52 @@ export default function NewFlightApprovalsTable(props) {
// 확장된 행 키
const [expandedRowKeys, setExpandedRowKeys] = useState([]);
+ const [editingKey, setEditingKey] = useState('');
+
+ const [form] = Form.useForm();
+
+ const isEditing = record => record.key === editingKey;
// 승인, 미승인, 비대상 건수 계산
useEffect(() => {
resApprovalCd();
}, [laancAprvList]);
+ const edit = record => {
+ form.setFieldsValue({
+ bufferZone: '',
+ fltElev: '',
+
+ ...record
+ });
+ setEditingKey(record.key);
+ };
+
+ const cancel = () => {
+ setEditingKey('');
+ };
+
+ const save = async key => {
+ try {
+ const row = await form.validateFields();
+ const newData = [...laancAprvList];
+ const index = newData.findIndex(item => key === item.key);
+
+ if (index > -1) {
+ const item = newData[index];
+ newData.splice(index, 1, { ...item, ...row });
+ setData(newData);
+ setEditingKey('');
+ } else {
+ newData.push(row);
+ setData(newData);
+ setEditingKey('');
+ }
+ } catch (errInfo) {
+ console.log('Validate Failed:', errInfo);
+ }
+ };
+
const columns = [
{
title: (
@@ -40,22 +79,34 @@ export default function NewFlightApprovalsTable(props) {
dataIndex: 'applyNo',
align: 'center',
width: '40px',
- key: 'applyNo',
+
editable: true
},
{
title: (
<>
- 신청
- 일자
+ 신청
월
+ >
+ ),
+ dataIndex: 'applyDt',
+ width: '80px',
+ align: 'center',
+
+ editable: true,
+ render: text => dayjs(text).format(' M월')
+ },
+ {
+ title: (
+ <>
+ 신청
일
>
),
dataIndex: 'applyDt',
- width: '60px',
+ width: '80px',
align: 'center',
- key: 'applyDt',
+
editable: true,
- render: text => dayjs(text).format('YYYY-MM-DD')
+ render: text => dayjs(text).format('DD일')
},
{
title: (
@@ -67,33 +118,67 @@ export default function NewFlightApprovalsTable(props) {
dataIndex: 'areaList',
align: 'center',
width: '85px',
- key: 'areaList',
+
editable: true,
render: areaList => <>총{areaList.length}건>
},
{
title: <>신청자>,
dataIndex: 'applyDt',
- width: '78px',
+ width: '90px',
align: 'center',
- key: 'applyDt',
+
editable: true,
render: text => '홍*동'
},
{
title: (
<>
- 비행
+ 행정
구역
+
1
>
),
dataIndex: 'areaList',
- width: '75px',
+ width: '90px',
align: 'center',
- key: 'adress',
+
editable: true,
render: areaList => {
- return areaList.length <= 1 ? '서울시 마포구상암동1674(원추)' : '-';
+ return areaList.length <= 1 ? '서울시특별시' : '-';
+ }
+ },
+ {
+ title: (
+ <>
+ 행정
+ 구역
+
2
+ >
+ ),
+ dataIndex: 'areaList',
+ width: '90px',
+ align: 'center',
+
+ editable: true,
+ render: areaList => {
+ return areaList.length <= 1 ? '강서구' : '-';
+ }
+ },
+ {
+ title: (
+ <>
+ 상세
+ 주소
+ >
+ ),
+ dataIndex: 'areaList',
+ width: '100px',
+ align: 'center',
+
+ editable: true,
+ render: areaList => {
+ return areaList.length <= 1 ? '가양동439-1(원추)' : '-';
}
},
{
@@ -106,7 +191,7 @@ export default function NewFlightApprovalsTable(props) {
dataIndex: 'areaList',
align: 'center',
width: '85px',
- key: 'latLon',
+
editable: true,
render: areaList => {
return areaList.length <= 1 ? (
@@ -123,14 +208,13 @@ export default function NewFlightApprovalsTable(props) {
{
title: (
<>
- 반경
- (M)
+ 비행
+ 반경
>
),
dataIndex: 'areaList',
align: 'center',
width: '70px',
- key: 'bufferZone',
editable: true,
render: areaList => {
return areaList.length <= 1 ? <>{areaList[0].bufferZone}> : '-';
@@ -139,12 +223,11 @@ export default function NewFlightApprovalsTable(props) {
{
title: (
<>
- 고도
- (M)
+ 해발
+ 고도
>
),
dataIndex: 'areaList',
- key: 'fltElev',
align: 'center',
width: '70px',
editable: true,
@@ -152,6 +235,47 @@ export default function NewFlightApprovalsTable(props) {
return areaList.length <= 1 ? <>{areaList[0].fltElev}> : '-';
}
},
+ {
+ title: (
+ <>
+ 비행
+ 목적
+ >
+ ),
+ dataIndex: 'areaList',
+ align: 'center',
+ width: '110px',
+ editable: true,
+ render: areaList => {
+ return areaList.length <= 1 ? <>기타> : '-';
+ }
+ },
+ {
+ title: (
+ <>
+ 긴급
+ 구조
+ 기관
+ >
+ ),
+ dataIndex: 'areaList',
+ align: 'center',
+ width: '110px',
+ editable: true,
+ render: areaList => {
+ return areaList.length <= 1 ? <>> : '-';
+ }
+ },
+ {
+ title: <>비고>,
+ dataIndex: 'areaList',
+ align: 'center',
+ width: '110px',
+ editable: true,
+ render: areaList => {
+ return areaList.length <= 1 ? <>비행 고도 특별 주의 건 입니다.> : '-';
+ }
+ },
{
title: (
<>
@@ -161,8 +285,8 @@ export default function NewFlightApprovalsTable(props) {
),
dataIndex: 'areaList',
align: 'center',
- width: '100px',
- key: 'approvalCd',
+ width: '110px',
+
editable: true,
render: areaList => {
@@ -206,8 +330,7 @@ export default function NewFlightApprovalsTable(props) {
title: <>더보기>,
dataIndex: 'areaList',
align: 'center',
- width: '95px',
- key: 'more',
+ width: '130px',
editable: true,
render: (areaList, record) =>
areaList.length > 2 ? (
@@ -227,6 +350,39 @@ export default function NewFlightApprovalsTable(props) {
) : (
<>->
)
+ },
+ {
+ title: '편집',
+ dataIndex: 'operation',
+ align: 'center',
+ width: '110px',
+ render: (_, record) => {
+ const editable = isEditing(record);
+ return editable ? (
+
+