|
|
@ -46,6 +46,9 @@ export default function OperationApprovalsTable(props) { |
|
|
|
|
|
|
|
|
|
|
|
const [form] = Form.useForm(); |
|
|
|
const [form] = Form.useForm(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 체크박스 선택
|
|
|
|
|
|
|
|
const [checkList, setCheckList] = useState([]); |
|
|
|
|
|
|
|
|
|
|
|
// 수정 키 확인
|
|
|
|
// 수정 키 확인
|
|
|
|
const isEditing = record => record.key === editingKey; |
|
|
|
const isEditing = record => record.key === editingKey; |
|
|
|
|
|
|
|
|
|
|
@ -805,6 +808,12 @@ export default function OperationApprovalsTable(props) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}; |
|
|
|
}; |
|
|
|
})} |
|
|
|
})} |
|
|
|
|
|
|
|
rowSelection={{ |
|
|
|
|
|
|
|
...childRowSelection, |
|
|
|
|
|
|
|
selectedRowKeys: checkList.filter(key => |
|
|
|
|
|
|
|
key.startsWith(`child_${record.planSno}_`) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}} |
|
|
|
dataSource={data} |
|
|
|
dataSource={data} |
|
|
|
pagination={false} |
|
|
|
pagination={false} |
|
|
|
components={{ |
|
|
|
components={{ |
|
|
@ -858,13 +867,13 @@ export default function OperationApprovalsTable(props) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 단순 메시지 표출 모달
|
|
|
|
// 단순 메시지 표출 모달
|
|
|
|
const handlerErrorModal = (header, body) => { |
|
|
|
const handlerErrorModal = (header, body, isRefresh) => { |
|
|
|
dispatch( |
|
|
|
dispatch( |
|
|
|
openModal({ |
|
|
|
openModal({ |
|
|
|
header: header, |
|
|
|
header: header, |
|
|
|
body: body, |
|
|
|
body: body, |
|
|
|
isHistoryBack: false, |
|
|
|
isHistoryBack: false, |
|
|
|
isRefresh: true |
|
|
|
isRefresh: isRefresh |
|
|
|
}) |
|
|
|
}) |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -916,10 +925,10 @@ export default function OperationApprovalsTable(props) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
handlerErrorModal(ERROR_TITLE, ERROR_MESSAGE); |
|
|
|
handlerErrorModal(ERROR_TITLE, ERROR_MESSAGE, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (errInfo) { |
|
|
|
} catch (errInfo) { |
|
|
|
handlerErrorModal(ERROR_TITLE, ERROR_MESSAGE); |
|
|
|
handlerErrorModal(ERROR_TITLE, ERROR_MESSAGE, true); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -1043,6 +1052,151 @@ export default function OperationApprovalsTable(props) { |
|
|
|
setIsModal(!ismodal); |
|
|
|
setIsModal(!ismodal); |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
// 부모 체크박스
|
|
|
|
|
|
|
|
const rowSelection = { |
|
|
|
|
|
|
|
selectedRowKeys: checkList, |
|
|
|
|
|
|
|
getCheckboxProps: record => { |
|
|
|
|
|
|
|
const allChildrenReviewed = record.areaList.every( |
|
|
|
|
|
|
|
child => child.reviewedType !== 'R' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
disabled: allChildrenReviewed, |
|
|
|
|
|
|
|
name: record.key |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onSelect: (record, selected, selectedRows, nativeEvent) => { |
|
|
|
|
|
|
|
let newCheckList = [...checkList]; // const를 let으로 변경
|
|
|
|
|
|
|
|
const key = record.key; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (key.startsWith('parent_')) { |
|
|
|
|
|
|
|
const childKeys = record.areaList |
|
|
|
|
|
|
|
.filter(child => child.reviewedType !== 'R') |
|
|
|
|
|
|
|
.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 함수 수정
|
|
|
|
|
|
|
|
const updateCheckList = list => { |
|
|
|
|
|
|
|
const newList = [...list]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 부모 키 업데이트
|
|
|
|
|
|
|
|
laancAprvList.forEach(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}` |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const allSelectableChildrenChecked = childKeys.every(key => |
|
|
|
|
|
|
|
newList.includes(key) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const someSelectableChildrenChecked = childKeys.some(key => |
|
|
|
|
|
|
|
newList.includes(key) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (allSelectableChildrenChecked && selectableChildren.length > 0) { |
|
|
|
|
|
|
|
if (!newList.includes(parentKey)) { |
|
|
|
|
|
|
|
newList.push(parentKey); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (!someSelectableChildrenChecked) { |
|
|
|
|
|
|
|
const index = newList.indexOf(parentKey); |
|
|
|
|
|
|
|
if (index > -1) { |
|
|
|
|
|
|
|
newList.splice(index, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setCheckList(newList); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 자식 테이블 체크박스
|
|
|
|
|
|
|
|
const childRowSelection = { |
|
|
|
|
|
|
|
selectedRowKeys: checkList.filter(key => key.startsWith('child_')), |
|
|
|
|
|
|
|
getCheckboxProps: record => ({ |
|
|
|
|
|
|
|
disabled: record.reviewedType !== 'R', |
|
|
|
|
|
|
|
name: record.key |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onSelect: (record, selected, selectedRows) => { |
|
|
|
|
|
|
|
const key = record.key; |
|
|
|
|
|
|
|
let newCheckList = [...checkList]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
|
|
|
|
newCheckList.push(key); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
newCheckList = newCheckList.filter(k => k !== key); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
updateCheckList(newCheckList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 체크박스 업데이트 함수
|
|
|
|
|
|
|
|
const handleCheckbox = async () => { |
|
|
|
|
|
|
|
if (checkList.length === 0) { |
|
|
|
|
|
|
|
return handlerErrorModal( |
|
|
|
|
|
|
|
'재검토 요청 실패', |
|
|
|
|
|
|
|
'재검토 항목을 선택해주세요.', |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// const planAreaSnoList = [
|
|
|
|
|
|
|
|
// ...new Set(
|
|
|
|
|
|
|
|
// checkList
|
|
|
|
|
|
|
|
// .filter(item => item.startsWith('child_')) // 'child_'로 시작하는 항목 필터링
|
|
|
|
|
|
|
|
// .map(item => item.split('_').pop()) // 마지막 언더바 이후의 숫자 추출
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// ];
|
|
|
|
|
|
|
|
// dispatch(
|
|
|
|
|
|
|
|
// updateLaancAprvReview({ planAreaSnoList, reviewedType: 'R' })
|
|
|
|
|
|
|
|
// ).then(() => {
|
|
|
|
|
|
|
|
// dispatch(
|
|
|
|
|
|
|
|
// getLaancAprvList({
|
|
|
|
|
|
|
|
// searchStDt: props.startDate,
|
|
|
|
|
|
|
|
// searchEndDt: props.endDate
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// setCheckList([]);
|
|
|
|
|
|
|
|
// } catch (error) {
|
|
|
|
|
|
|
|
// return handlerErrorModal(
|
|
|
|
|
|
|
|
// '재검토 요청 실패',
|
|
|
|
|
|
|
|
// '재검토 요청을 실패하였습니다. 다시 시도해주세요.',
|
|
|
|
|
|
|
|
// false
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className='layer-content'> |
|
|
|
<div className='layer-content'> |
|
|
@ -1073,6 +1227,11 @@ export default function OperationApprovalsTable(props) { |
|
|
|
건 |
|
|
|
건 |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className='download'> |
|
|
|
|
|
|
|
<Button color='primary' size='sm' onClick={handleCheckbox}> |
|
|
|
|
|
|
|
재검토 요청 |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className='search-case-list'> |
|
|
|
<div className='search-case-list'> |
|
|
|
<div> |
|
|
|
<div> |
|
|
@ -1110,10 +1269,7 @@ export default function OperationApprovalsTable(props) { |
|
|
|
}} |
|
|
|
}} |
|
|
|
dataSource={laancAprvList.map((item, index) => ({ |
|
|
|
dataSource={laancAprvList.map((item, index) => ({ |
|
|
|
...item, |
|
|
|
...item, |
|
|
|
key: |
|
|
|
key: `parent_${item.planSno}` |
|
|
|
item.areaList.length >= 1 |
|
|
|
|
|
|
|
? `${item.planAreaSno}-${index}` |
|
|
|
|
|
|
|
: `${item.planAreaSno}` |
|
|
|
|
|
|
|
}))} |
|
|
|
}))} |
|
|
|
columns={mergedColumns} |
|
|
|
columns={mergedColumns} |
|
|
|
rowClassName={record => { |
|
|
|
rowClassName={record => { |
|
|
@ -1165,6 +1321,9 @@ export default function OperationApprovalsTable(props) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
})} |
|
|
|
})} |
|
|
|
|
|
|
|
rowSelection={{ |
|
|
|
|
|
|
|
...rowSelection |
|
|
|
|
|
|
|
}} |
|
|
|
loading={laancAprvLoading} |
|
|
|
loading={laancAprvLoading} |
|
|
|
expandable={{ |
|
|
|
expandable={{ |
|
|
|
expandedRowRender, |
|
|
|
expandedRowRender, |
|
|
|