행정지원 검토의견 수정

This commit is contained in:
2026-10-20 10:04:42 +09:00
parent 3a5b48b608
commit 8a98cd7d19
15 changed files with 2012 additions and 1526 deletions
@@ -0,0 +1,22 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { RvwOpnnUpdateRequestDto } from "@/shared/model";
const BASE = ENDPOINT.AS_SERVICE.FNRS_CNSLTN_RVW_OPNN;
async function update(
fnrsCnsltnDocNo: string,
rvwOpnnSn: number,
body: RvwOpnnUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${fnrsCnsltnDocNo}/${rvwOpnnSn}`, body);
}
async function deleteFn(fnrsCnsltnDocNo: string, rvwOpnnSn: number): Promise<void> {
await client.delete<void>(`${BASE}/${fnrsCnsltnDocNo}/${rvwOpnnSn}`);
}
export const fnrsCnsltnRvwOpnnService = {
update,
delete: deleteFn,
};
@@ -1,3 +1,4 @@
export { fnrsCnsltnRvwOpnnService } from "./api/fnrs-cnsltn-rvw-opnn-service";
export { fnrsCnsltnMngService } from "./api/fnrs-cnsltn-service"; export { fnrsCnsltnMngService } from "./api/fnrs-cnsltn-service";
export { fnrsCnsltnKeys } from "./api/queries"; export { fnrsCnsltnKeys } from "./api/queries";
export { export {
@@ -0,0 +1,22 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { RvwOpnnUpdateRequestDto } from "@/shared/model";
const BASE = ENDPOINT.AS_SERVICE.INSTL_SNCN_RVW_OPNN;
async function update(
instlSncnDocNo: string,
rvwOpnnSn: number,
body: RvwOpnnUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${instlSncnDocNo}/${rvwOpnnSn}`, body);
}
async function deleteFn(instlSncnDocNo: string, rvwOpnnSn: number): Promise<void> {
await client.delete<void>(`${BASE}/${instlSncnDocNo}/${rvwOpnnSn}`);
}
export const instlSncnRvwOpnnService = {
update,
delete: deleteFn,
};
+1
View File
@@ -1,3 +1,4 @@
export { instlSncnRvwOpnnService } from "./api/instl-sncn-rvw-opnn-service";
export { instlSncnRegionService, instlSncnService } from "./api/instl-sncn-service"; export { instlSncnRegionService, instlSncnService } from "./api/instl-sncn-service";
export { export {
instlSncnKeys, instlSncnKeys,
@@ -0,0 +1,23 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { RvwOpnnUpdateRequestDto } from "@/shared/model";
const BASE = ENDPOINT.AS_SERVICE.SEWER_BSC_PLAN_RVW_OPNNS;
async function update(
sewerBscPlanDocNo: string,
chgCycl: number,
rvwOpnnSn: number,
body: RvwOpnnUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${sewerBscPlanDocNo}/${chgCycl}/${rvwOpnnSn}`, body);
}
async function deleteFn(sewerBscPlanDocNo: string, chgCycl: number, rvwOpnnSn: number): Promise<void> {
await client.delete<void>(`${BASE}/${sewerBscPlanDocNo}/${chgCycl}/${rvwOpnnSn}`);
}
export const sewerBscPlanRvwOpnnService = {
update,
delete: deleteFn,
};
@@ -11,6 +11,7 @@ export {
useTechReviewSewerBscPlan, useTechReviewSewerBscPlan,
useUpdateSewerBscPlan, useUpdateSewerBscPlan,
} from "./api/queries"; } from "./api/queries";
export { sewerBscPlanRvwOpnnService } from "./api/sewer-bsc-plan-rvw-opnn-service";
export { sewerBscPlanService } from "./api/sewer-bsc-plan-service"; export { sewerBscPlanService } from "./api/sewer-bsc-plan-service";
export type { export type {
CklstResultItem, CklstResultItem,
@@ -2,18 +2,24 @@
import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib"; import { useQueryClient } from "@tanstack/react-query";
import { getDefaultFileKey, useTus, useUserStore } from "@/shared/lib";
import { TextShimmer } from "@/shared/ui"; import { TextShimmer } from "@/shared/ui";
import { SectionCollapsible } from "@/shared/ui"; import { SectionCollapsible } from "@/shared/ui";
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field"; import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
import { AttachmentDownloadLink, attachService } from "@/entities/attach"; import { attachService } from "@/entities/attach";
import type { DesignCnstnRvwOpnnResponseDto } from "@/entities/design-cnstn"; import {
designCnstnKeys,
type DesignCnstnRvwOpnnResponseDto,
designCnstnRvwOpnnService,
} from "@/entities/design-cnstn";
import { RvwOpnnListTable } from "@/widgets/pbadms-sprt";
import { import {
Button, Button,
RadioGroup, RadioGroup,
RadioGroupItem, RadioGroupItem,
Table, Table,
TableBody,
TableCell, TableCell,
TableHead, TableHead,
TableHeader, TableHeader,
@@ -44,6 +50,7 @@ export interface TechReviewOpinionSectionHandle {
interface TechReviewOpinionTableProps { interface TechReviewOpinionTableProps {
items: DesignCnstnRvwOpnnResponseDto[]; items: DesignCnstnRvwOpnnResponseDto[];
isReviewTurn: boolean;
} }
interface UploadedOpinionFile { interface UploadedOpinionFile {
@@ -172,18 +179,27 @@ const TechReviewOpinionSection = forwardRef<
setFormData((prev) => ({ ...prev, atchFileGroupId: "" })); setFormData((prev) => ({ ...prev, atchFileGroupId: "" }));
} }
function isReviewTurn(reviewStep: ReviewStepCode) {
return editableReviewStep === reviewStep && canWriteOpinion;
}
function renderOpinionForm(reviewStep: ReviewStepCode) { function renderOpinionForm(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep || !canWriteOpinion) return null; if (!isReviewTurn(reviewStep)) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false; const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
return ( return (
<div className="space-y-2"> <div className="space-y-2">
<h4 className="text-xl font-semibold">검토의견 작성</h4> <h4 className="text-xl font-semibold">검토의견 작성</h4>
<Table caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공" variant="secondary"> <Table
caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공"
variant="secondary"
>
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead scope="row" className="w-[12rem]">의견내용</TableHead> <TableHead scope="row" className="w-[12rem]">
의견내용
</TableHead>
<TableCell> <TableCell>
<Textarea <Textarea
value={formData.rvwRsltCn} value={formData.rvwRsltCn}
@@ -279,59 +295,41 @@ const TechReviewOpinionSection = forwardRef<
return ( return (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{kecoRvwList.length > 0 ? <TechReviewOpinionTable items={kecoRvwList} /> : null} {kecoRvwList.length > 0 ? (
<TechReviewOpinionTable items={kecoRvwList} isReviewTurn={isReviewTurn("KECO")} />
) : null}
{renderOpinionForm("KECO")} {renderOpinionForm("KECO")}
</div> </div>
</SectionCollapsible> </SectionCollapsible>
); );
}); });
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) { function getRvwOpnnIds(item: DesignCnstnRvwOpnnResponseDto) {
if (!item.designCnstnDocNo || item.rvwOpnnSn == null) {
throw new Error("검토의견 식별값이 없습니다.");
}
return [item.designCnstnDocNo, item.rvwOpnnSn] as const;
}
function TechReviewOpinionTable({ items, isReviewTurn }: TechReviewOpinionTableProps) {
const queryClient = useQueryClient();
const currentUserUuid = useUserStore((state) => state.userInfo?.userUnqId);
return ( return (
<div className="overflow-x-auto"> <RvwOpnnListTable
<Table caption="검토의견 목록으로 의견자명, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary"> items={items}
<colgroup> getRowKey={(item) => `${item.designCnstnDocNo}_${item.rvwOpnnSn}`}
<col width="10%" /> currentUserUuid={currentUserUuid}
<col width="55%" /> isReviewTurn={isReviewTurn}
<col width="5%" /> onUpdate={async (item, body) => {
<col width="20%" /> await designCnstnRvwOpnnService.update(...getRvwOpnnIds(item), body);
<col width="10%" /> await queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
</colgroup> }}
<TableHeader> onDelete={async (item) => {
<TableRow> await designCnstnRvwOpnnService.delete(...getRvwOpnnIds(item));
<TableHead>의견자명</TableHead> await queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
<TableHead>의견내용</TableHead> }}
<TableHead>검토결과</TableHead> />
<TableHead>첨부파일</TableHead>
<TableHead>등록일시</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{items.map((item) => (
<TableRow key={`${item.designCnstnDocNo}_${item.rvwOpnnSn}`}>
<TableCell align="center">{item.opnrNm}</TableCell>
<TableCell align="left">{item.rvwRsltCn || "-"}</TableCell>
<TableCell align="center">
{item.rvwRsltAnmlyYn === "Y" ? "이상" : item.rvwRsltAnmlyYn === "N" ? "정상" : "-"}
</TableCell>
<TableCell align="center">
{item.atchFileInfo?.atflCd ? (
<AttachmentDownloadLink
atflCd={item.atchFileInfo.atflCd}
fileName={item.atchFileInfo.orgnlFileNm || "다운로드"}
/>
) : (
"-"
)}
</TableCell>
<TableCell align="center">
{item.regDt ? dayjs(item.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
); );
} }
@@ -2,20 +2,22 @@
import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib"; import { useQueryClient } from "@tanstack/react-query";
import { getDefaultFileKey, useTus, useUserStore } from "@/shared/lib";
import { AttachmentFileField, SectionCollapsible } from "@/shared/ui"; import { AttachmentFileField, SectionCollapsible } from "@/shared/ui";
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field"; import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
import { attachService, useDownloadAttachmentByAtflId } from "@/entities/attach";
import { import {
AttachmentDownloadLink, fnrsCnsltnKeys,
attachService, type FnrsCnsltnRvwOpnnResponseDto,
useDownloadAttachmentByAtflId, fnrsCnsltnRvwOpnnService,
} from "@/entities/attach"; } from "@/entities/fnrs-cnsltn";
import type { FnrsCnsltnRvwOpnnResponseDto } from "@/entities/fnrs-cnsltn"; import { RvwOpnnListTable } from "@/widgets/pbadms-sprt";
import { import {
RadioGroup, RadioGroup,
RadioGroupItem, RadioGroupItem,
Table, Table,
TableBody,
TableCell, TableCell,
TableHead, TableHead,
TableHeader, TableHeader,
@@ -46,6 +48,7 @@ export interface TechReviewOpinionSectionHandle {
interface TechReviewOpinionTableProps { interface TechReviewOpinionTableProps {
items: FnrsCnsltnRvwOpnnResponseDto[]; items: FnrsCnsltnRvwOpnnResponseDto[];
isReviewTurn: boolean;
} }
interface UploadedOpinionFile { interface UploadedOpinionFile {
@@ -180,16 +183,24 @@ const TechReviewOpinionSection = forwardRef<
setFormData((prev) => ({ ...prev, atchFileGroupId: "" })); setFormData((prev) => ({ ...prev, atchFileGroupId: "" }));
} }
function isReviewTurn(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return false;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return false;
return true;
}
function renderOpinionForm(reviewStep: ReviewStepCode) { function renderOpinionForm(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return null; if (!isReviewTurn(reviewStep)) return null;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false; const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
return ( return (
<div className="space-y-2"> <div className="space-y-2">
<h4 className="text-xl font-semibold">검토의견 작성</h4> <h4 className="text-xl font-semibold">검토의견 작성</h4>
<Table caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공" variant="secondary"> <Table
caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공"
variant="secondary"
>
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead className="w-[12rem]">의견내용</TableHead> <TableHead className="w-[12rem]">의견내용</TableHead>
@@ -280,7 +291,9 @@ const TechReviewOpinionSection = forwardRef<
{hasEnvSection ? ( {hasEnvSection ? (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{envRvwList.length > 0 ? <TechReviewOpinionTable items={envRvwList} /> : null} {envRvwList.length > 0 ? (
<TechReviewOpinionTable items={envRvwList} isReviewTurn={isReviewTurn("ENV")} />
) : null}
{renderOpinionForm("ENV")} {renderOpinionForm("ENV")}
</div> </div>
</SectionCollapsible> </SectionCollapsible>
@@ -288,7 +301,9 @@ const TechReviewOpinionSection = forwardRef<
{hasKecoSection ? ( {hasKecoSection ? (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{kecoRvwList.length > 0 ? <TechReviewOpinionTable items={kecoRvwList} /> : null} {kecoRvwList.length > 0 ? (
<TechReviewOpinionTable items={kecoRvwList} isReviewTurn={isReviewTurn("KECO")} />
) : null}
{/* {/*
재원협의에서 환경공단 검토의견은 자동 생성 재원협의에서 환경공단 검토의견은 자동 생성
{renderOpinionForm("KECO")} {renderOpinionForm("KECO")}
@@ -300,52 +315,32 @@ const TechReviewOpinionSection = forwardRef<
); );
}); });
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) { function getRvwOpnnIds(item: FnrsCnsltnRvwOpnnResponseDto) {
if (!item.fnrsCnsltnDocNo || item.rvwOpnnSn == null) {
throw new Error("검토의견 식별값이 없습니다.");
}
return [item.fnrsCnsltnDocNo, item.rvwOpnnSn] as const;
}
function TechReviewOpinionTable({ items, isReviewTurn }: TechReviewOpinionTableProps) {
const queryClient = useQueryClient();
const currentUserUuid = useUserStore((state) => state.userInfo?.userUnqId);
return ( return (
<div className="overflow-x-auto"> <RvwOpnnListTable
<Table caption="검토의견 목록으로 의견자명, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary"> items={items}
<colgroup> getRowKey={(item) => `${item.fnrsCnsltnDocNo}_${item.rvwOpnnSn}`}
<col width="10%" /> currentUserUuid={currentUserUuid}
<col width="55%" /> isReviewTurn={isReviewTurn}
<col width="5%" /> onUpdate={async (item, body) => {
<col width="20%" /> await fnrsCnsltnRvwOpnnService.update(...getRvwOpnnIds(item), body);
<col width="10%" /> await queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
</colgroup> }}
<TableHeader> onDelete={async (item) => {
<TableRow> await fnrsCnsltnRvwOpnnService.delete(...getRvwOpnnIds(item));
<TableHead>의견자명</TableHead> await queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
<TableHead>의견내용</TableHead> }}
<TableHead>검토결과</TableHead> />
<TableHead>첨부파일</TableHead>
<TableHead>등록일시</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{items.map((item) => (
<TableRow key={`${item.fnrsCnsltnDocNo}_${item.rvwOpnnSn}`}>
<TableCell align="center">{item.opnrNm}</TableCell>
<TableCell align="left">{item.rvwRsltCn || "-"}</TableCell>
<TableCell align="center">
{item.rvwRsltAnmlyYn === "Y" ? "이상" : item.rvwRsltAnmlyYn === "N" ? "정상" : "-"}
</TableCell>
<TableCell align="center">
{item.atchFileInfo?.atflCd ? (
<AttachmentDownloadLink
atflCd={item.atchFileInfo.atflCd}
fileName={item.atchFileInfo.orgnlFileNm || "다운로드"}
/>
) : (
"-"
)}
</TableCell>
<TableCell align="center">
{item.regDt ? dayjs(item.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
); );
} }
@@ -2,18 +2,25 @@
import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib"; import { useQueryClient } from "@tanstack/react-query";
import { getDefaultFileKey, useTus, useUserStore } from "@/shared/lib";
import { TextShimmer } from "@/shared/ui"; import { TextShimmer } from "@/shared/ui";
import { SectionCollapsible } from "@/shared/ui"; import { SectionCollapsible } from "@/shared/ui";
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field"; import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
import { AttachmentDownloadLink, attachService } from "@/entities/attach"; import { attachService } from "@/entities/attach";
import type { InstlSncnRvwOpnnResponseDto, ReviewStepCode } from "@/entities/instl-sncn"; import {
instlSncnKeys,
type InstlSncnRvwOpnnResponseDto,
instlSncnRvwOpnnService,
type ReviewStepCode,
} from "@/entities/instl-sncn";
import { RvwOpnnListTable } from "@/widgets/pbadms-sprt";
import { import {
Button, Button,
RadioGroup, RadioGroup,
RadioGroupItem, RadioGroupItem,
Table, Table,
TableBody,
TableCell, TableCell,
TableHead, TableHead,
TableHeader, TableHeader,
@@ -40,6 +47,7 @@ export interface TechReviewOpinionSectionHandle {
interface TechReviewOpinionTableProps { interface TechReviewOpinionTableProps {
items: InstlSncnRvwOpnnResponseDto[]; items: InstlSncnRvwOpnnResponseDto[];
isReviewTurn: boolean;
} }
interface UploadedOpinionFile { interface UploadedOpinionFile {
@@ -171,19 +179,29 @@ const TechReviewOpinionSection = forwardRef<
setFormData((prev) => ({ ...prev, atchFileGroupId: "" })); setFormData((prev) => ({ ...prev, atchFileGroupId: "" }));
} }
function isReviewTurn(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return false;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return false;
return true;
}
function renderOpinionForm(reviewStep: ReviewStepCode) { function renderOpinionForm(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return null; if (!isReviewTurn(reviewStep)) return null;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false; const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
return ( return (
<div className="space-y-2"> <div className="space-y-2">
<h4 className="text-xl font-semibold">검토의견 작성</h4> <h4 className="text-xl font-semibold">검토의견 작성</h4>
<Table caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공" variant="secondary"> <Table
caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공"
variant="secondary"
>
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead scope="row" className="w-[12rem]">의견내용</TableHead> <TableHead scope="row" className="w-[12rem]">
의견내용
</TableHead>
<TableCell> <TableCell>
<Textarea <Textarea
value={formData.rvwRsltCn} value={formData.rvwRsltCn}
@@ -281,7 +299,9 @@ const TechReviewOpinionSection = forwardRef<
{hasEnvSection ? ( {hasEnvSection ? (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{envRvwList.length > 0 ? <TechReviewOpinionTable items={envRvwList} /> : null} {envRvwList.length > 0 ? (
<TechReviewOpinionTable items={envRvwList} isReviewTurn={isReviewTurn("ENV")} />
) : null}
{renderOpinionForm("ENV")} {renderOpinionForm("ENV")}
</div> </div>
</SectionCollapsible> </SectionCollapsible>
@@ -289,7 +309,9 @@ const TechReviewOpinionSection = forwardRef<
{hasKecoSection ? ( {hasKecoSection ? (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{kecoRvwList.length > 0 ? <TechReviewOpinionTable items={kecoRvwList} /> : null} {kecoRvwList.length > 0 ? (
<TechReviewOpinionTable items={kecoRvwList} isReviewTurn={isReviewTurn("KECO")} />
) : null}
{renderOpinionForm("KECO")} {renderOpinionForm("KECO")}
</div> </div>
</SectionCollapsible> </SectionCollapsible>
@@ -298,52 +320,32 @@ const TechReviewOpinionSection = forwardRef<
); );
}); });
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) { function getRvwOpnnIds(item: InstlSncnRvwOpnnResponseDto) {
if (!item.instlSncnDocNo || item.rvwOpnnSn == null) {
throw new Error("검토의견 식별값이 없습니다.");
}
return [item.instlSncnDocNo, item.rvwOpnnSn] as const;
}
function TechReviewOpinionTable({ items, isReviewTurn }: TechReviewOpinionTableProps) {
const queryClient = useQueryClient();
const currentUserUuid = useUserStore((state) => state.userInfo?.userUnqId);
return ( return (
<div className="overflow-x-auto"> <RvwOpnnListTable
<Table caption="검토의견 목록으로 의견자명, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary"> items={items}
<colgroup> getRowKey={(item) => `${item.instlSncnDocNo}_${item.rvwOpnnSn}`}
<col width="10%" /> currentUserUuid={currentUserUuid}
<col width="55%" /> isReviewTurn={isReviewTurn}
<col width="5%" /> onUpdate={async (item, body) => {
<col width="20%" /> await instlSncnRvwOpnnService.update(...getRvwOpnnIds(item), body);
<col width="10%" /> await queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
</colgroup> }}
<TableHeader> onDelete={async (item) => {
<TableRow> await instlSncnRvwOpnnService.delete(...getRvwOpnnIds(item));
<TableHead>의견자명</TableHead> await queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
<TableHead>의견내용</TableHead> }}
<TableHead>검토결과</TableHead> />
<TableHead>첨부파일</TableHead>
<TableHead>등록일시</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{items.map((item) => (
<TableRow key={`${item.instlSncnDocNo}_${item.rvwOpnnSn}`}>
<TableCell align="center">{item.opnrNm}</TableCell>
<TableCell align="left">{item.rvwRsltCn || "-"}</TableCell>
<TableCell align="center">
{item.rvwRsltAnmlyYn === "Y" ? "이상" : item.rvwRsltAnmlyYn === "N" ? "정상" : "-"}
</TableCell>
<TableCell align="center">
{item.atchFileInfo?.atflCd ? (
<AttachmentDownloadLink
atflCd={item.atchFileInfo.atflCd}
fileName={item.atchFileInfo.orgnlFileNm || "다운로드"}
/>
) : (
"-"
)}
</TableCell>
<TableCell align="center">
{item.regDt ? dayjs(item.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
); );
} }
@@ -2,18 +2,24 @@
import { forwardRef, useEffect, useImperativeHandle, useState } from "react"; import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib"; import { useQueryClient } from "@tanstack/react-query";
import { getDefaultFileKey, useTus, useUserStore } from "@/shared/lib";
import { TextShimmer } from "@/shared/ui"; import { TextShimmer } from "@/shared/ui";
import { SectionCollapsible } from "@/shared/ui"; import { SectionCollapsible } from "@/shared/ui";
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field"; import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
import { AttachmentDownloadLink, attachService } from "@/entities/attach"; import { attachService } from "@/entities/attach";
import type { SewerBscPlanRvwOpnnResponseDto } from "@/entities/sewer-bsc-plan"; import {
sewerBscPlanKeys,
type SewerBscPlanRvwOpnnResponseDto,
sewerBscPlanRvwOpnnService,
} from "@/entities/sewer-bsc-plan";
import { RvwOpnnListTable } from "@/widgets/pbadms-sprt";
import { import {
Button, Button,
RadioGroup, RadioGroup,
RadioGroupItem, RadioGroupItem,
Table, Table,
TableBody,
TableCell, TableCell,
TableHead, TableHead,
TableHeader, TableHeader,
@@ -44,6 +50,7 @@ export interface TechReviewOpinionSectionHandle {
interface TechReviewOpinionTableProps { interface TechReviewOpinionTableProps {
items: SewerBscPlanRvwOpnnResponseDto[]; items: SewerBscPlanRvwOpnnResponseDto[];
isReviewTurn: boolean;
} }
interface UploadedOpinionFile { interface UploadedOpinionFile {
@@ -178,16 +185,24 @@ const TechReviewOpinionSection = forwardRef<
setFormData((prev) => ({ ...prev, atchFileGroupId: "" })); setFormData((prev) => ({ ...prev, atchFileGroupId: "" }));
} }
function isReviewTurn(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return false;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return false;
return true;
}
function renderOpinionForm(reviewStep: ReviewStepCode) { function renderOpinionForm(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return null; if (!isReviewTurn(reviewStep)) return null;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false; const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
return ( return (
<div className="space-y-2"> <div className="space-y-2">
<h4 className="text-xl font-semibold">검토의견 작성</h4> <h4 className="text-xl font-semibold">검토의견 작성</h4>
<Table caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공" variant="secondary"> <Table
caption="검토의견 작성으로 의견내용, 검토결과, 첨부파일 정보 제공"
variant="secondary"
>
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead className="w-[12rem]">의견내용</TableHead> <TableHead className="w-[12rem]">의견내용</TableHead>
@@ -288,7 +303,9 @@ const TechReviewOpinionSection = forwardRef<
{hasEnvSection ? ( {hasEnvSection ? (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{envRvwList.length > 0 ? <TechReviewOpinionTable items={envRvwList} /> : null} {envRvwList.length > 0 ? (
<TechReviewOpinionTable items={envRvwList} isReviewTurn={isReviewTurn("ENV")} />
) : null}
{renderOpinionForm("ENV")} {renderOpinionForm("ENV")}
</div> </div>
</SectionCollapsible> </SectionCollapsible>
@@ -296,7 +313,9 @@ const TechReviewOpinionSection = forwardRef<
{hasKecoSection ? ( {hasKecoSection ? (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}> <SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}>
<div className="space-y-6"> <div className="space-y-6">
{kecoRvwList.length > 0 ? <TechReviewOpinionTable items={kecoRvwList} /> : null} {kecoRvwList.length > 0 ? (
<TechReviewOpinionTable items={kecoRvwList} isReviewTurn={isReviewTurn("KECO")} />
) : null}
{renderOpinionForm("KECO")} {renderOpinionForm("KECO")}
</div> </div>
</SectionCollapsible> </SectionCollapsible>
@@ -305,52 +324,32 @@ const TechReviewOpinionSection = forwardRef<
); );
}); });
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) { function getRvwOpnnIds(item: SewerBscPlanRvwOpnnResponseDto) {
if (!item.sewerBscPlanDocNo || item.chgCycl == null || item.rvwOpnnSn == null) {
throw new Error("검토의견 식별값이 없습니다.");
}
return [item.sewerBscPlanDocNo, item.chgCycl, item.rvwOpnnSn] as const;
}
function TechReviewOpinionTable({ items, isReviewTurn }: TechReviewOpinionTableProps) {
const queryClient = useQueryClient();
const currentUserUuid = useUserStore((state) => state.userInfo?.userUnqId);
return ( return (
<div className="overflow-x-auto"> <RvwOpnnListTable
<Table caption="검토의견 목록으로 의견자명, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary"> items={items}
<colgroup> getRowKey={(item) => `${item.sewerBscPlanDocNo}_${item.rvwOpnnSn}`}
<col width="10%" /> currentUserUuid={currentUserUuid}
<col width="55%" /> isReviewTurn={isReviewTurn}
<col width="5%" /> onUpdate={async (item, body) => {
<col width="20%" /> await sewerBscPlanRvwOpnnService.update(...getRvwOpnnIds(item), body);
<col width="10%" /> await queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
</colgroup> }}
<TableHeader> onDelete={async (item) => {
<TableRow> await sewerBscPlanRvwOpnnService.delete(...getRvwOpnnIds(item));
<TableHead>의견자명</TableHead> await queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
<TableHead>의견내용</TableHead> }}
<TableHead>검토결과</TableHead> />
<TableHead>첨부파일</TableHead>
<TableHead>등록일시</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{items.map((item) => (
<TableRow key={`${item.sewerBscPlanDocNo}_${item.rvwOpnnSn}`}>
<TableCell align="center">{item.opnrNm}</TableCell>
<TableCell align="left">{item.rvwRsltCn || "-"}</TableCell>
<TableCell align="center">
{item.rvwRsltAnmlyYn === "Y" ? "이상" : item.rvwRsltAnmlyYn === "N" ? "정상" : "-"}
</TableCell>
<TableCell align="center">
{item.atchFileInfo?.atflCd ? (
<AttachmentDownloadLink
atflCd={item.atchFileInfo.atflCd}
fileName={item.atchFileInfo.orgnlFileNm || "다운로드"}
/>
) : (
"-"
)}
</TableCell>
<TableCell align="center">
{item.regDt ? dayjs(item.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
); );
} }
+3
View File
@@ -12,11 +12,13 @@ export const ENDPOINT = {
RVW_MNPW: "/as-service/api/v1/rvw-mnpw", RVW_MNPW: "/as-service/api/v1/rvw-mnpw",
BNS_IF: "/as-service/api/v1/if", BNS_IF: "/as-service/api/v1/if",
INSTL_SNCN: "/as-service/api/v1/instl-sncn", INSTL_SNCN: "/as-service/api/v1/instl-sncn",
INSTL_SNCN_RVW_OPNN: "/as-service/api/v1/instl-sncn-rvw-opnn",
CKLST: "/as-service/api/v1/cklst", CKLST: "/as-service/api/v1/cklst",
CKLST_ARTCL: "/as-service/api/v1/cklst-artcl", CKLST_ARTCL: "/as-service/api/v1/cklst-artcl",
CKLST_RVW: "/as-service/api/v1/cklst-rvw", CKLST_RVW: "/as-service/api/v1/cklst-rvw",
ADSTDSTR: "/as-service/api/v1/adstdstr", ADSTDSTR: "/as-service/api/v1/adstdstr",
FNRS_CNSLTN_MNG: "/as-service/api/v1/fnrs-cnsltn-mng", FNRS_CNSLTN_MNG: "/as-service/api/v1/fnrs-cnsltn-mng",
FNRS_CNSLTN_RVW_OPNN: "/as-service/api/v1/fnrs-cnsltn-rvw-opnn",
FNRS_SHAR_SE: "/as-service/api/v1/fnrs-shar-se-mng", FNRS_SHAR_SE: "/as-service/api/v1/fnrs-shar-se-mng",
DESIGN_CNSTN: "/as-service/api/v1/design-cnstn", DESIGN_CNSTN: "/as-service/api/v1/design-cnstn",
DESIGN_CNSTN_BIZ_CST: "/as-service/api/v1/design-cnstn-biz-cst", DESIGN_CNSTN_BIZ_CST: "/as-service/api/v1/design-cnstn-biz-cst",
@@ -24,6 +26,7 @@ export const ENDPOINT = {
DESIGN_CNSTN_ESNTL_ATCH_FILE: "/as-service/api/v1/design-cnstn-esntl-atch-file", DESIGN_CNSTN_ESNTL_ATCH_FILE: "/as-service/api/v1/design-cnstn-esntl-atch-file",
DESIGN_CNSTN_RVW_OPNN: "/as-service/api/v1/design-cnstn-rvw-opnn", DESIGN_CNSTN_RVW_OPNN: "/as-service/api/v1/design-cnstn-rvw-opnn",
SEWER_BSC_PLAN: "/as-service/api/v1/sewer-bsc-plans", SEWER_BSC_PLAN: "/as-service/api/v1/sewer-bsc-plans",
SEWER_BSC_PLAN_RVW_OPNNS: "/as-service/api/v1/sewer-bsc-plan-rvw-opnns",
DASHBOARD: "/as-service/api/v1/dashboard", DASHBOARD: "/as-service/api/v1/dashboard",
DCRAG_TO: "/as-service/api/v1/dcrag-to", DCRAG_TO: "/as-service/api/v1/dcrag-to",
AI_AUTO_PRCS_MNG: "/as-service/api/v1/ai-auto-prcs-mng", AI_AUTO_PRCS_MNG: "/as-service/api/v1/ai-auto-prcs-mng",
+1
View File
@@ -46,6 +46,7 @@ export type {
PbadmsMngDetResponseBase, PbadmsMngDetResponseBase,
RvwOpnnResponseExtension, RvwOpnnResponseExtension,
RvwOpnnSaveBase, RvwOpnnSaveBase,
RvwOpnnUpdateRequestDto,
SplmntDmndResponseExtension, SplmntDmndResponseExtension,
SplmntDmndSaveBase, SplmntDmndSaveBase,
} from "./pbadms-sprt"; } from "./pbadms-sprt";
+11
View File
@@ -231,11 +231,22 @@ export interface PbadmsApplySaveHeader {
rvwStpCd?: string; rvwStpCd?: string;
} }
/** 검토의견 수정 공통 요청 DTO */
export interface RvwOpnnUpdateRequestDto {
opnrSeComCd?: string;
opnrNm?: string;
rvwRsltCn?: string;
rvwRsltAnmlyYn?: string;
atchFileGroupId?: string;
}
/** 검토의견 응답 공통 확장 필드 */ /** 검토의견 응답 공통 확장 필드 */
export interface RvwOpnnResponseExtension { export interface RvwOpnnResponseExtension {
opnrSeCdNm?: string; opnrSeCdNm?: string;
atchFileInfo?: AtflMngClientResponseDto; atchFileInfo?: AtflMngClientResponseDto;
regDt?: string; regDt?: string;
rgtr?: string;
rgtrNm?: string;
} }
/** 보완요구 응답 공통 확장 필드 */ /** 보완요구 응답 공통 확장 필드 */
+1
View File
@@ -51,6 +51,7 @@ export {
} from "./ui/pbadms-task-apply-dialog"; } from "./ui/pbadms-task-apply-dialog";
export { PrivacyConsentSection } from "./ui/privacy-consent-section"; export { PrivacyConsentSection } from "./ui/privacy-consent-section";
export { ProgressStatusSection } from "./ui/progress-status-section"; export { ProgressStatusSection } from "./ui/progress-status-section";
export { RvwOpnnListTable, type RvwOpnnListTableProps } from "./ui/rvw-opnn-list-table";
export { export {
SplmntDmndDialog, SplmntDmndDialog,
type SplmntDmndDialogConfirmItem, type SplmntDmndDialogConfirmItem,
@@ -0,0 +1,406 @@
"use client";
import { useState } from "react";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib";
import type { AtflMngClientResponseDto, RvwOpnnUpdateRequestDto } from "@/shared/model";
import { AttachmentFileField } from "@/shared/ui";
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
import {
AttachmentDownloadLink,
attachService,
useDownloadAttachmentByAtflId,
} from "@/entities/attach";
import {
Button,
RadioGroup,
RadioGroupItem,
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
Textarea,
} from "@common/components";
const RVW_OPNN_EDIT_FILE_KEY_PREFIX = "rvw-opnn-edit::";
/** 업무별 검토의견 응답 DTO 공통 필드 (업무마다 null 허용 여부가 달라 느슨하게 정의) */
interface RvwOpnnListItem {
opnrSeComCd?: string | null;
opnrNm?: string | null;
rvwRsltCn?: string | null;
rvwRsltAnmlyYn?: string | null;
atchFileGroupId?: string | null;
atchFileInfo?: AtflMngClientResponseDto | null;
regDt?: string | null;
rgtr?: string | null;
}
interface RvwOpnnListTableProps<T extends RvwOpnnListItem> {
items: T[];
getRowKey: (item: T) => string;
/** 로그인 사용자 UUID — 검토의견 등록자(rgtr)와 같을 때만 수정·삭제 버튼 노출 */
currentUserUuid?: string;
/** 현재 검토 단계가 로그인 사용자 차례인지 여부 — false면 등록자라도 수정·삭제 불가 */
isReviewTurn?: boolean;
onUpdate: (item: T, body: RvwOpnnUpdateRequestDto) => Promise<void>;
onDelete: (item: T) => Promise<void>;
}
interface EditDraft {
rvwRsltCn: string;
rvwRsltAnmlyYn: string;
atchFileGroupId: string;
}
interface EditFile {
fileName: string;
fileKey: string;
atflId?: string;
atflCd?: string;
/** 이번 수정 중 새로 업로드한 파일 여부 (취소 시 정리 대상) */
isNew: boolean;
}
function formatAnmlyYn(value?: string | null) {
if (value === "Y") return "이상";
if (value === "N") return "정상";
return "-";
}
function RvwOpnnListTable<T extends RvwOpnnListItem>({
items,
getRowKey,
currentUserUuid,
isReviewTurn = false,
onUpdate,
onDelete,
}: RvwOpnnListTableProps<T>) {
const { confirm } = useConfirm();
const { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
const [editingKey, setEditingKey] = useState<string | null>(null);
const [draft, setDraft] = useState<EditDraft | null>(null);
const [editFile, setEditFile] = useState<EditFile | null>(null);
const [isSubmitting, setIsSubmitting] = useState(false);
const { uploadFileAsync, isUploading, uploads } = useTus({
onSuccess: (atflCd, atflId, _file, fileKey) => {
if (!atflCd || !atflId) return;
setDraft((prev) => (prev ? { ...prev, atchFileGroupId: atflCd } : prev));
setEditFile((prev) => (prev?.fileKey === fileKey ? { ...prev, atflCd, atflId } : prev));
},
onError: (_error, _file, fileKey) => {
setEditFile((prev) => (prev?.fileKey === fileKey ? null : prev));
},
});
const editFileUploading = editFile ? (isUploading[editFile.fileKey] ?? false) : false;
function canModify(item: T) {
return isReviewTurn && Boolean(currentUserUuid) && item.rgtr === currentUserUuid;
}
async function discardNewFile(file: EditFile | null) {
if (!file?.isNew) return;
uploads[file.fileKey]?.abort();
if (file.atflId) {
try {
await attachService.deleteAttachmentByAtflId(file.atflId);
} catch (error) {
console.error("검토의견 첨부파일 삭제 실패:", error);
}
}
}
function resetEdit() {
setEditingKey(null);
setDraft(null);
setEditFile(null);
}
function startEdit(item: T) {
void discardNewFile(editFile);
setEditingKey(getRowKey(item));
setDraft({
rvwRsltCn: item.rvwRsltCn ?? "",
rvwRsltAnmlyYn: item.rvwRsltAnmlyYn ?? "",
atchFileGroupId: item.atchFileGroupId ?? "",
});
setEditFile(
item.atchFileInfo?.atflCd
? {
fileName: item.atchFileInfo.orgnlFileNm || "첨부파일",
fileKey: `${RVW_OPNN_EDIT_FILE_KEY_PREFIX}${item.atchFileInfo.atflCd}`,
atflId: item.atchFileInfo.atflId,
atflCd: item.atchFileInfo.atflCd,
isNew: false,
}
: null,
);
}
function cancelEdit() {
void discardNewFile(editFile);
resetEdit();
}
async function handleFileAdd(files: FileList | null) {
if (!files || files.length === 0) return;
const file = files[0];
const fileKey = `${RVW_OPNN_EDIT_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
setEditFile({ fileName: file.name, fileKey, isNew: true });
try {
await uploadFileAsync(file, { fileKey });
} catch {
// onError callback handles cleanup
}
}
function handleFileRemove() {
// 기존 파일은 저장 시점에 연결만 해제하고, 새로 올린 파일은 즉시 정리
void discardNewFile(editFile);
setEditFile(null);
setDraft((prev) => (prev ? { ...prev, atchFileGroupId: "" } : prev));
}
async function handleSave(item: T) {
if (!draft) return;
if (!draft.rvwRsltCn.trim()) {
alert("의견내용을 입력하세요.");
return;
}
if (!draft.rvwRsltAnmlyYn) {
alert("검토결과를 선택하세요.");
return;
}
if (!(await confirm("검토의견을 수정하시겠습니까?"))) return;
setIsSubmitting(true);
try {
await onUpdate(item, {
opnrSeComCd: item.opnrSeComCd ?? undefined,
opnrNm: item.opnrNm ?? undefined,
rvwRsltCn: draft.rvwRsltCn,
rvwRsltAnmlyYn: draft.rvwRsltAnmlyYn,
atchFileGroupId: draft.atchFileGroupId,
});
alert("수정되었습니다.");
resetEdit();
} catch (error) {
console.error("검토의견 수정 실패:", error);
alert("검토의견 수정 중 오류가 발생했습니다.");
} finally {
setIsSubmitting(false);
}
}
async function handleDelete(item: T) {
if (!(await confirm("검토의견을 삭제하시겠습니까?"))) return;
setIsSubmitting(true);
try {
await onDelete(item);
alert("삭제되었습니다.");
if (editingKey === getRowKey(item)) resetEdit();
} catch (error) {
console.error("검토의견 삭제 실패:", error);
alert("검토의견 삭제 중 오류가 발생했습니다.");
} finally {
setIsSubmitting(false);
}
}
function renderViewRow(item: T) {
return (
<>
<TableCell align="left">{item.rvwRsltCn || "-"}</TableCell>
<TableCell align="center">{formatAnmlyYn(item.rvwRsltAnmlyYn)}</TableCell>
<TableCell align="center">
{item.atchFileInfo?.atflCd ? (
<AttachmentDownloadLink
atflCd={item.atchFileInfo.atflCd}
fileName={item.atchFileInfo.orgnlFileNm || "다운로드"}
/>
) : (
"-"
)}
</TableCell>
</>
);
}
function renderEditRow(rowKey: string, editDraft: EditDraft) {
return (
<>
<TableCell align="left">
<Textarea
value={editDraft.rvwRsltCn}
onChange={(event) =>
setDraft((prev) => (prev ? { ...prev, rvwRsltCn: event.target.value } : prev))
}
placeholder="의견내용을 입력하세요"
rows={4}
className="min-h-[8rem] !text-xl"
/>
</TableCell>
<TableCell align="center">
<FieldSet>
<RadioGroup
value={editDraft.rvwRsltAnmlyYn}
onValueChange={(value) =>
setDraft((prev) => (prev ? { ...prev, rvwRsltAnmlyYn: value } : prev))
}
>
<div className="flex flex-col gap-2">
<FieldLabel
htmlFor={`rvw-opnn-edit-normal-${rowKey}`}
className="!w-auto border-none"
>
<Field orientation="horizontal" className="w-auto">
<RadioGroupItem value="N" id={`rvw-opnn-edit-normal-${rowKey}`} />
<span className="font-normal">정상</span>
</Field>
</FieldLabel>
<FieldLabel
htmlFor={`rvw-opnn-edit-abnormal-${rowKey}`}
className="!w-auto border-none"
>
<Field orientation="horizontal" className="w-auto">
<RadioGroupItem value="Y" id={`rvw-opnn-edit-abnormal-${rowKey}`} />
<span className="font-normal">이상</span>
</Field>
</FieldLabel>
</div>
</RadioGroup>
</FieldSet>
</TableCell>
<TableCell align="center">
<AttachmentFileField
files={
editFile
? [
{
fileKey: editFile.fileKey,
fileName: editFile.fileName,
onDownload: editFile.atflId
? () => downloadByAtflId(editFile.atflId!)
: undefined,
},
]
: []
}
inputId={`rvw-opnn-edit-${rowKey}-file-input`}
isUploadingByKey={isUploading}
multiple={false}
showAddButton={!editFile}
addDisabled={editFileUploading}
onAdd={(fileList) => void handleFileAdd(fileList)}
onRemove={handleFileRemove}
/>
</TableCell>
</>
);
}
return (
<div className="overflow-x-auto">
<Table
caption="검토의견 목록으로 의견자명, 의견내용, 검토결과, 첨부파일, 등록일시, 관리 정보 제공"
variant="secondary"
>
<colgroup>
<col width="10%" />
<col width="47%" />
<col width="6%" />
<col width="17%" />
<col width="10%" />
<col width="10%" />
</colgroup>
<TableHeader>
<TableRow>
<TableHead>의견자명</TableHead>
<TableHead>의견내용</TableHead>
<TableHead>검토결과</TableHead>
<TableHead>첨부파일</TableHead>
<TableHead>등록일시</TableHead>
<TableHead>관리</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{items.map((item) => {
const rowKey = getRowKey(item);
const isEditing = editingKey === rowKey && draft !== null;
return (
<TableRow key={rowKey}>
<TableCell align="center">{item.opnrNm}</TableCell>
{isEditing ? renderEditRow(rowKey, draft) : renderViewRow(item)}
<TableCell align="center">
{item.regDt ? dayjs(item.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}
</TableCell>
<TableCell align="center">
{!canModify(item) ? (
"-"
) : isEditing ? (
<div className="flex flex-wrap justify-center gap-1">
<Button
type="button"
size="sm"
onClick={() => void handleSave(item)}
disabled={isSubmitting || editFileUploading}
>
저장
</Button>
<Button
type="button"
size="sm"
color="white"
onClick={cancelEdit}
disabled={isSubmitting}
>
취소
</Button>
</div>
) : (
<div className="flex flex-wrap justify-center gap-1">
<Button
type="button"
size="sm"
color="white"
onClick={() => startEdit(item)}
disabled={isSubmitting}
>
수정
</Button>
<Button
type="button"
size="sm"
color="gray"
onClick={() => void handleDelete(item)}
disabled={isSubmitting}
>
삭제
</Button>
</div>
)}
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
</div>
);
}
export { RvwOpnnListTable, type RvwOpnnListTableProps };