feat: [문서] 검사성적서/작업일지 저장 시 HTML 스냅샷 캡처 전송
- InspectionReportModal: contentWrapperRef로 DOM 캡처, handleSave에서 rendered_html 포함 - WorkLogModal: contentWrapperRef로 DOM 캡처, handleSave에서 rendered_html 포함 - saveInspectionDocument/saveWorkLog 타입에 rendered_html 추가 - MNG에서 스냅샷 기반 문서 출력을 위한 프론트 파이프라인 완성
This commit is contained in:
@@ -857,6 +857,7 @@ export async function saveInspectionDocument(
|
||||
title?: string;
|
||||
data: Record<string, unknown>[];
|
||||
approvers?: { role_name: string; user_id?: number }[];
|
||||
rendered_html?: string;
|
||||
}
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
|
||||
@@ -164,6 +164,7 @@ export function InspectionReportModal({
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const contentRef = useRef<InspectionContentRef>(null);
|
||||
const contentWrapperRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// API에서 로딩된 검사 데이터 (props 없을 때 fallback)
|
||||
const [apiWorkItems, setApiWorkItems] = useState<WorkItemData[] | null>(null);
|
||||
@@ -341,6 +342,8 @@ export function InspectionReportModal({
|
||||
if (!workOrderId || !contentRef.current) return;
|
||||
|
||||
const data = contentRef.current.getInspectionData();
|
||||
// HTML 스냅샷 캡처 (MNG 출력용)
|
||||
const renderedHtml = contentWrapperRef.current?.innerHTML || undefined;
|
||||
setIsSaving(true);
|
||||
try {
|
||||
// 템플릿 모드: Document 기반 저장 (정규화 형식)
|
||||
@@ -359,6 +362,7 @@ export function InspectionReportModal({
|
||||
step_id: activeStepId ?? undefined,
|
||||
title: activeTemplate.title || activeTemplate.name,
|
||||
data: inspData.records,
|
||||
rendered_html: renderedHtml,
|
||||
});
|
||||
if (result.success) {
|
||||
toast.success('검사 문서가 저장되었습니다.');
|
||||
@@ -530,7 +534,9 @@ export function InspectionReportModal({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{renderContent()}
|
||||
<div ref={contentWrapperRef}>
|
||||
{renderContent()}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</DocumentViewer>
|
||||
|
||||
Reference in New Issue
Block a user