|
|
@ -9,7 +9,8 @@ import axios from 'axios'; |
|
|
|
import { getAccessToken } from '../../utility/authService/jwtTokenUtil'; |
|
|
|
import { getAccessToken } from '../../utility/authService/jwtTokenUtil'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
updateLaancAprv, |
|
|
|
updateLaancAprv, |
|
|
|
getLaancAprvList |
|
|
|
getLaancAprvList, |
|
|
|
|
|
|
|
updateLaancAprvReview |
|
|
|
} from '@src/redux/features/laanc/laancThunk'; |
|
|
|
} from '@src/redux/features/laanc/laancThunk'; |
|
|
|
import { ERROR_MESSAGE, ERROR_TITLE } from '@src/configs/msgConst'; |
|
|
|
import { ERROR_MESSAGE, ERROR_TITLE } from '@src/configs/msgConst'; |
|
|
|
import { CgKey } from 'react-icons/cg'; |
|
|
|
import { CgKey } from 'react-icons/cg'; |
|
|
@ -248,13 +249,7 @@ export default function ControlApprovalsTable(props) { |
|
|
|
width: '100px', |
|
|
|
width: '100px', |
|
|
|
align: 'center', |
|
|
|
align: 'center', |
|
|
|
render: areaList => { |
|
|
|
render: areaList => { |
|
|
|
return areaList.length <= 1 |
|
|
|
return areaList.length <= 1 ? areaList[0].limitZoneNm : '-'; |
|
|
|
? areaList[0].fltElevMax === 120 |
|
|
|
|
|
|
|
? '원추' |
|
|
|
|
|
|
|
: areaList[0].fltElevMax > 45 && areaList[0].fltElevMax < 100 |
|
|
|
|
|
|
|
? '수평' |
|
|
|
|
|
|
|
: '-' |
|
|
|
|
|
|
|
: '-'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
@ -394,7 +389,7 @@ export default function ControlApprovalsTable(props) { |
|
|
|
), |
|
|
|
), |
|
|
|
dataIndex: 'areaList', |
|
|
|
dataIndex: 'areaList', |
|
|
|
align: 'center', |
|
|
|
align: 'center', |
|
|
|
width: '120px', |
|
|
|
width: '140px', |
|
|
|
render: areaList => { |
|
|
|
render: areaList => { |
|
|
|
const approvalCounts = areaList.reduce( |
|
|
|
const approvalCounts = areaList.reduce( |
|
|
|
(counts, item) => { |
|
|
|
(counts, item) => { |
|
|
@ -497,6 +492,24 @@ export default function ControlApprovalsTable(props) { |
|
|
|
<>-</> |
|
|
|
<>-</> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
title: <>확인</>, |
|
|
|
|
|
|
|
dataIndex: 'areaList', |
|
|
|
|
|
|
|
align: 'center', |
|
|
|
|
|
|
|
width: '130px', |
|
|
|
|
|
|
|
render: (areaList, record) => |
|
|
|
|
|
|
|
areaList.length <= 1 ? ( |
|
|
|
|
|
|
|
areaList[0].reviewedType === 'R' ? ( |
|
|
|
|
|
|
|
'검토완료' |
|
|
|
|
|
|
|
) : areaList[0].reviewedType === 'W' ? ( |
|
|
|
|
|
|
|
'검토대기' |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
'검토취소' |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<>-</> |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
@ -563,17 +576,11 @@ export default function ControlApprovalsTable(props) { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
dataIndex: 'fltElevMax', |
|
|
|
dataIndex: 'limitZoneNm', |
|
|
|
align: 'center', |
|
|
|
align: 'center', |
|
|
|
width: '100px', |
|
|
|
width: '100px', |
|
|
|
render: text => { |
|
|
|
render: text => { |
|
|
|
return text |
|
|
|
return text ? text : <>-</>; |
|
|
|
? text === 120 |
|
|
|
|
|
|
|
? '원추' |
|
|
|
|
|
|
|
: text > 45 && text < 100 |
|
|
|
|
|
|
|
? '수평' |
|
|
|
|
|
|
|
: '-' |
|
|
|
|
|
|
|
: '-'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -650,7 +657,7 @@ export default function ControlApprovalsTable(props) { |
|
|
|
{ |
|
|
|
{ |
|
|
|
dataIndex: 'approvalCd', |
|
|
|
dataIndex: 'approvalCd', |
|
|
|
align: 'center', |
|
|
|
align: 'center', |
|
|
|
width: '120px', |
|
|
|
width: '140px', |
|
|
|
render: text => ( |
|
|
|
render: text => ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{text === 'U' |
|
|
|
{text === 'U' |
|
|
@ -700,6 +707,18 @@ export default function ControlApprovalsTable(props) { |
|
|
|
</Button> |
|
|
|
</Button> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
dataIndex: 'reviewedType', |
|
|
|
|
|
|
|
align: 'center', |
|
|
|
|
|
|
|
width: '130px', |
|
|
|
|
|
|
|
render: text => { |
|
|
|
|
|
|
|
return text === 'R' |
|
|
|
|
|
|
|
? '검토완료' |
|
|
|
|
|
|
|
: text === 'W' |
|
|
|
|
|
|
|
? '검토대기' |
|
|
|
|
|
|
|
: '검토취소'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
@ -720,6 +739,7 @@ export default function ControlApprovalsTable(props) { |
|
|
|
era: item.era, |
|
|
|
era: item.era, |
|
|
|
fltElevMax: item.fltElevMax, |
|
|
|
fltElevMax: item.fltElevMax, |
|
|
|
purpose: item.purpose, |
|
|
|
purpose: item.purpose, |
|
|
|
|
|
|
|
reviewedType: item.reviewedType, |
|
|
|
applyNm: item.applyNm, |
|
|
|
applyNm: item.applyNm, |
|
|
|
dtl: item.dtl, |
|
|
|
dtl: item.dtl, |
|
|
|
approvalCd: item.approvalCd, |
|
|
|
approvalCd: item.approvalCd, |
|
|
@ -920,12 +940,12 @@ export default function ControlApprovalsTable(props) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const fileDetails = { |
|
|
|
const fileDetails = { |
|
|
|
pdf: { |
|
|
|
pdf: { |
|
|
|
url: `${HOST}api/bas/dos/plan/download/pdf?searchStDt=${ |
|
|
|
url: `${HOST}api/bas/dos/plan/download/han-com?searchStDt=${ |
|
|
|
props.startDate |
|
|
|
props.startDate |
|
|
|
}&searchEndDt=${props.endDate}&selectZone=${props.filterArea}${ |
|
|
|
}&searchEndDt=${props.endDate}&selectZone=${props.filterArea}${ |
|
|
|
props.filterId ? '&approvalCd=${props.filterId}' : '' |
|
|
|
props.filterId ? '&approvalCd=${props.filterId}' : '' |
|
|
|
}`,
|
|
|
|
}`,
|
|
|
|
name: '비행승인 관련 검토결과.pdf' |
|
|
|
name: '비행승인 관련 검토결과.hwp' |
|
|
|
}, |
|
|
|
}, |
|
|
|
excel: { |
|
|
|
excel: { |
|
|
|
url: `${HOST}api/bas/dos/plan/download/excel?searchStDt=${ |
|
|
|
url: `${HOST}api/bas/dos/plan/download/excel?searchStDt=${ |
|
|
@ -980,44 +1000,84 @@ export default function ControlApprovalsTable(props) { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 자식 테이블 체크박스
|
|
|
|
// 부모 체크박스
|
|
|
|
const childRowSelection = { |
|
|
|
const rowSelection = { |
|
|
|
selectedRowKeys: checkList.filter(key => key.startsWith('child_')), |
|
|
|
selectedRowKeys: checkList, |
|
|
|
onChange: (selectedRowKeys, selectedRows, info) => { |
|
|
|
getCheckboxProps: record => { |
|
|
|
const newCheckList = checkList.filter(key => !key.startsWith('child_')); |
|
|
|
const allChildrenReviewed = record.areaList.every( |
|
|
|
// console.log('>>>>', selectedRowKeys);
|
|
|
|
child => child.reviewedType === 'R' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
disabled: allChildrenReviewed, |
|
|
|
|
|
|
|
name: record.key |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
onSelect: (record, selected, selectedRows) => { |
|
|
|
onSelect: (record, selected, selectedRows, nativeEvent) => { |
|
|
|
|
|
|
|
let newCheckList = [...checkList]; // const를 let으로 변경
|
|
|
|
const key = record.key; |
|
|
|
const key = record.key; |
|
|
|
const newCheckList = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
if (key.startsWith('parent_')) { |
|
|
|
newCheckList.push(...checkList, key); |
|
|
|
const childKeys = record.areaList |
|
|
|
} else { |
|
|
|
.filter(child => child.reviewedType !== 'R') |
|
|
|
newCheckList.push(...checkList.filter(k => k !== key)); |
|
|
|
.map(child => `child_${record.planSno}_${child.planAreaSno}`); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
|
|
|
|
newCheckList.push(key, ...childKeys); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
newCheckList = newCheckList.filter( |
|
|
|
|
|
|
|
k => k !== key && !childKeys.includes(k) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateCheckList(newCheckList); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onSelectAll: (selected, selectedRows, changeRows) => { |
|
|
|
|
|
|
|
const newCheckList = selected |
|
|
|
|
|
|
|
? laancAprvList.flatMap(parent => { |
|
|
|
|
|
|
|
const parentKey = `parent_${parent.planSno}`; |
|
|
|
|
|
|
|
const selectableChildren = parent.areaList.filter( |
|
|
|
|
|
|
|
child => child.reviewedType !== 'R' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const childKeys = selectableChildren.map( |
|
|
|
|
|
|
|
child => `child_${parent.planSno}_${child.planAreaSno}` |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return selectableChildren.length > 0 |
|
|
|
|
|
|
|
? [parentKey, ...childKeys] |
|
|
|
|
|
|
|
: []; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
: []; |
|
|
|
|
|
|
|
|
|
|
|
updateCheckList(newCheckList); |
|
|
|
updateCheckList(newCheckList); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 체크박스 업데이트
|
|
|
|
// updateCheckList 함수 수정
|
|
|
|
const updateCheckList = list => { |
|
|
|
const updateCheckList = list => { |
|
|
|
const newList = [...list]; |
|
|
|
const newList = [...list]; |
|
|
|
|
|
|
|
|
|
|
|
// 부모 키 업데이트
|
|
|
|
// 부모 키 업데이트
|
|
|
|
laancAprvList.forEach(parent => { |
|
|
|
laancAprvList.forEach(parent => { |
|
|
|
const parentKey = `parent_${parent.planSno}`; |
|
|
|
const parentKey = `parent_${parent.planSno}`; |
|
|
|
const childKeys = parent.areaList.map( |
|
|
|
const selectableChildren = parent.areaList.filter( |
|
|
|
|
|
|
|
child => child.reviewedType !== 'R' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const childKeys = selectableChildren.map( |
|
|
|
child => `child_${parent.planSno}_${child.planAreaSno}` |
|
|
|
child => `child_${parent.planSno}_${child.planAreaSno}` |
|
|
|
); |
|
|
|
); |
|
|
|
const allChildrenChecked = childKeys.every(key => newList.includes(key)); |
|
|
|
const allSelectableChildrenChecked = childKeys.every(key => |
|
|
|
const someChildrenChecked = childKeys.some(key => newList.includes(key)); |
|
|
|
newList.includes(key) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const someSelectableChildrenChecked = childKeys.some(key => |
|
|
|
|
|
|
|
newList.includes(key) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (allChildrenChecked) { |
|
|
|
if (allSelectableChildrenChecked && selectableChildren.length > 0) { |
|
|
|
if (!newList.includes(parentKey)) { |
|
|
|
if (!newList.includes(parentKey)) { |
|
|
|
newList.push(parentKey); |
|
|
|
newList.push(parentKey); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (!someChildrenChecked) { |
|
|
|
} else if (!someSelectableChildrenChecked) { |
|
|
|
const index = newList.indexOf(parentKey); |
|
|
|
const index = newList.indexOf(parentKey); |
|
|
|
if (index > -1) { |
|
|
|
if (index > -1) { |
|
|
|
newList.splice(index, 1); |
|
|
|
newList.splice(index, 1); |
|
|
@ -1028,48 +1088,26 @@ export default function ControlApprovalsTable(props) { |
|
|
|
setCheckList(newList); |
|
|
|
setCheckList(newList); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 부모 체크박스
|
|
|
|
console.log('check>>', checkList); |
|
|
|
const rowSelection = { |
|
|
|
// 자식 테이블 체크박스
|
|
|
|
selectedRowKeys: checkList, |
|
|
|
const childRowSelection = { |
|
|
|
onSelect: (record, selected, selectedRows, nativeEvent) => { |
|
|
|
selectedRowKeys: checkList.filter(key => key.startsWith('child_')), |
|
|
|
const newCheckList = [...checkList]; |
|
|
|
getCheckboxProps: record => ({ |
|
|
|
|
|
|
|
disabled: record.reviewedType === 'R', |
|
|
|
|
|
|
|
name: record.key |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
onChange: (selectedRowKeys, selectedRows, info) => { |
|
|
|
|
|
|
|
// 기존 코드 유지
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onSelect: (record, selected, selectedRows) => { |
|
|
|
const key = record.key; |
|
|
|
const key = record.key; |
|
|
|
|
|
|
|
let newCheckList = [...checkList]; |
|
|
|
|
|
|
|
|
|
|
|
if (key.startsWith('parent_')) { |
|
|
|
if (selected) { |
|
|
|
const childKeys = record.areaList.map(child => { |
|
|
|
newCheckList.push(key); |
|
|
|
// console.log('>>', checkList);
|
|
|
|
} else { |
|
|
|
|
|
|
|
newCheckList = newCheckList.filter(k => k !== key); |
|
|
|
return `child_${record.planSno}_${child.planAreaSno}`; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
|
|
|
|
newCheckList.push(key, ...childKeys); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const index = newCheckList.indexOf(key); |
|
|
|
|
|
|
|
if (index > -1) { |
|
|
|
|
|
|
|
newCheckList.splice(index, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
childKeys.forEach(childKey => { |
|
|
|
|
|
|
|
const childIndex = newCheckList.indexOf(childKey); |
|
|
|
|
|
|
|
if (childIndex > -1) { |
|
|
|
|
|
|
|
newCheckList.splice(childIndex, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateCheckList(newCheckList); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onSelectAll: (selected, selectedRows, changeRows) => { |
|
|
|
|
|
|
|
const newCheckList = selected |
|
|
|
|
|
|
|
? laancAprvList.flatMap(parent => [ |
|
|
|
|
|
|
|
`parent_${parent.planSno}`, |
|
|
|
|
|
|
|
...parent.areaList.map( |
|
|
|
|
|
|
|
child => `child_${parent.planSno}_${child.planAreaSno}` |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
: []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateCheckList(newCheckList); |
|
|
|
updateCheckList(newCheckList); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -1201,7 +1239,7 @@ export default function ControlApprovalsTable(props) { |
|
|
|
rowExpandable: record => record?.areaList?.length > 1 |
|
|
|
rowExpandable: record => record?.areaList?.length > 1 |
|
|
|
}} |
|
|
|
}} |
|
|
|
scroll={{ |
|
|
|
scroll={{ |
|
|
|
x: 1500 |
|
|
|
x: 1600 |
|
|
|
}} |
|
|
|
}} |
|
|
|
rowHoverable={false} |
|
|
|
rowHoverable={false} |
|
|
|
expandIconColumnIndex={-1} |
|
|
|
expandIconColumnIndex={-1} |
|
|
|