[as] chore: 보완요청 섹션 첨부파일 관련 코드 수정

This commit is contained in:
2026-09-22 16:21:13 +09:00
parent a77246a1db
commit 25c357a423
3 changed files with 13 additions and 6 deletions
@@ -113,7 +113,8 @@ function PwrkCnsltnDocEvlDialog({ open, pwrkCnsltnDocNo, onClose }: PwrkCnsltnDo
<Textarea
id="pwrkCnsltnDocEvlCn"
rows={4}
placeholder="의견을 입력해 주세요 (선택)"
placeholder="의견을 입력해 주세요"
className="!text-xl"
{...register("pwrkCnsltnDocEvlCn")}
/>
</div>
@@ -275,7 +275,10 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
initialEsntlFiles={isEditMode ? initialData?.esntlFileList : undefined}
initialEtcFiles={isEditMode ? initialData?.etcFileList : undefined}
/>
<SplmntDmndFormSection readOnly={!isSplmntPrgrsStts} />
<SplmntDmndFormSection
initialData={initialData?.splmntDmndList}
readOnly={!isSplmntPrgrsStts}
/>
<div className="sticky bottom-0 z-40 !-mb-2 border-t bg-white pb-8 pt-6 shadow-[0_-4px_12px_rgba(0,0,0,0.06)]">
<div className="mx-4 flex flex-wrap justify-center gap-3 sm:gap-4">
@@ -10,6 +10,7 @@ import {
attachService,
useDownloadAttachmentByAtflId,
} from "@/entities/attach";
import { FnrsCnsltnSplmntDmndResponseDto } from "@/entities/fnrs-cnsltn";
import {
Badge,
Table,
@@ -50,6 +51,7 @@ interface SplmntDmndFormData {
}
interface SplmntDmndFormSectionProps {
initialData?: FnrsCnsltnSplmntDmndResponseDto[];
readOnly?: boolean;
}
@@ -69,7 +71,7 @@ function getRowKey(item: SplmntDmndFormItem, index: number) {
return item.splmntDmndSn != null ? String(item.splmntDmndSn) : `idx-${index}`;
}
function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps) {
function SplmntDmndFormSection({ initialData, readOnly = false }: SplmntDmndFormSectionProps) {
const formId = useId();
const { control, setValue, getValues } = useFormContext<SplmntDmndFormData>();
const splmntDmndList = useWatch({ control, name: "splmntDmndList" }) ?? [];
@@ -264,6 +266,7 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
const isRowUploading = rowFiles.some((file) => isUploading[file.fileKey] ?? false);
const fileInputId = `${formId}-${rowKey}-file`;
const isRowReadOnly = readOnly || item.cmptnYn === "Y";
const splmntAtchFileInfo = initialData?.[index]?.splmntAtchFileInfo;
return (
<TableRow key={rowKey}>
@@ -288,10 +291,10 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
{isRowReadOnly ? (
<div className="space-y-2">
<div className="whitespace-pre-wrap">{item.splmntCn || "-"}</div>
{item.splmntAtchFileGroupId ? (
{splmntAtchFileInfo?.atflCd ? (
<AttachmentDownloadLink
atflCd={item.splmntAtchFileGroupId}
fileName={rowFiles[0]?.fileName}
atflCd={splmntAtchFileInfo?.atflCd}
fileName={splmntAtchFileInfo?.orgnlFileNm}
/>
) : null}
</div>