Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60ee194cc9 | ||
|
|
3d027ed374 | ||
|
|
d70eb17a72 | ||
|
|
ddd619babc | ||
|
|
5d27ee830e | ||
|
|
212b9a43a9 | ||
|
|
f092a23ee4 | ||
|
|
25c357a423 | ||
|
|
a77246a1db | ||
|
|
f00ce31648 | ||
|
|
dc57a491dd | ||
|
|
c9b7266959 | ||
|
|
0dd2111cb9 | ||
|
|
87fbf15e2b |
@@ -2,35 +2,35 @@ import { z } from "zod";
|
|||||||
|
|
||||||
/** 백엔드 DcRagFileInfoDto */
|
/** 백엔드 DcRagFileInfoDto */
|
||||||
export const dcRagFileInfoSchema = z.object({
|
export const dcRagFileInfoSchema = z.object({
|
||||||
fileId: z.string().optional(),
|
fileId: z.string().nullish(),
|
||||||
fileGroupId: z.string().optional(),
|
fileGroupId: z.string().nullish(),
|
||||||
fileName: z.string().optional(),
|
fileName: z.string().nullish(),
|
||||||
physicalPath: z.string().optional(),
|
physicalPath: z.string().nullish(),
|
||||||
downloadUrl: z.string().optional(),
|
downloadUrl: z.string().nullish(),
|
||||||
fileSize: z.number().optional(),
|
fileSize: z.number().nullish(),
|
||||||
esntlAtchFileId: z.string().optional(),
|
esntlAtchFileId: z.string().nullish(),
|
||||||
esntlAtchFileNm: z.string().optional(),
|
esntlAtchFileNm: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DcRagDocumentTransferRequestDto */
|
/** 백엔드 DcRagDocumentTransferRequestDto */
|
||||||
export const dcRagDocumentTransferRequestSchema = z.object({
|
export const dcRagDocumentTransferRequestSchema = z.object({
|
||||||
fnrsCnsltnDocNo: z.string(),
|
fnrsCnsltnDocNo: z.string(),
|
||||||
taskSeComCd: z.string().optional(),
|
taskSeComCd: z.string().nullish(),
|
||||||
taskSeCdNm: z.string().optional(),
|
taskSeCdNm: z.string().nullish(),
|
||||||
essentialFiles: z.array(dcRagFileInfoSchema).optional(),
|
essentialFiles: z.array(dcRagFileInfoSchema).nullish(),
|
||||||
etcFiles: z.array(dcRagFileInfoSchema).optional(),
|
etcFiles: z.array(dcRagFileInfoSchema).nullish(),
|
||||||
callbackUrl: z.string().optional(),
|
callbackUrl: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DcRagDraftGenerateRequestDto */
|
/** 백엔드 DcRagDraftGenerateRequestDto */
|
||||||
export const dcRagDraftGenerateRequestSchema = z.object({
|
export const dcRagDraftGenerateRequestSchema = z.object({
|
||||||
fnrsCnsltnDocNo: z.string(),
|
fnrsCnsltnDocNo: z.string(),
|
||||||
pwrkCnsltnDocNo: z.string(),
|
pwrkCnsltnDocNo: z.string(),
|
||||||
crtDmndUuid: z.string().optional(),
|
crtDmndUuid: z.string().nullish(),
|
||||||
essentialFiles: z.array(dcRagFileInfoSchema).optional(),
|
essentialFiles: z.array(dcRagFileInfoSchema).nullish(),
|
||||||
etcFiles: z.array(dcRagFileInfoSchema).optional(),
|
etcFiles: z.array(dcRagFileInfoSchema).nullish(),
|
||||||
rqstrUuid: z.string().optional(),
|
rqstrUuid: z.string().nullish(),
|
||||||
callbackUrl: z.string().optional(),
|
callbackUrl: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DcRagCostVerifyRequestDto */
|
/** 백엔드 DcRagCostVerifyRequestDto */
|
||||||
|
|||||||
@@ -2,68 +2,68 @@ import { z } from "zod";
|
|||||||
|
|
||||||
/** 백엔드 DesignCnstnMngSaveRequestDto */
|
/** 백엔드 DesignCnstnMngSaveRequestDto */
|
||||||
export const designCnstnMngSaveSchema = z.object({
|
export const designCnstnMngSaveSchema = z.object({
|
||||||
designCnstnDocNo: z.string().optional(),
|
designCnstnDocNo: z.string().nullish(),
|
||||||
admdstCd: z.string().optional(),
|
admdstCd: z.string().nullish(),
|
||||||
envoSeComCd: z.string().optional(),
|
envoSeComCd: z.string().nullish(),
|
||||||
taskSeComCd: z.string().optional(),
|
taskSeComCd: z.string().nullish(),
|
||||||
bizNm: z.string().optional(),
|
bizNm: z.string().nullish(),
|
||||||
bizBgngYr: z.string().optional(),
|
bizBgngYr: z.string().nullish(),
|
||||||
bizEndYr: z.string().optional(),
|
bizEndYr: z.string().nullish(),
|
||||||
bizCn: z.string().optional(),
|
bizCn: z.string().nullish(),
|
||||||
aplcntNm: z.string().optional(),
|
aplcntNm: z.string().nullish(),
|
||||||
aplcntMblTelno: z.string().optional(),
|
aplcntMblTelno: z.string().nullish(),
|
||||||
aplcntOgdpNm: z.string().optional(),
|
aplcntOgdpNm: z.string().nullish(),
|
||||||
aplcntEmlAddr: z.string().optional(),
|
aplcntEmlAddr: z.string().nullish(),
|
||||||
dsgnrNm: z.string().optional(),
|
dsgnrNm: z.string().nullish(),
|
||||||
dsgnrTelno: z.string().optional(),
|
dsgnrTelno: z.string().nullish(),
|
||||||
dsgnrOgdpNm: z.string().optional(),
|
dsgnrOgdpNm: z.string().nullish(),
|
||||||
dsgnrEmlAddr: z.string().optional(),
|
dsgnrEmlAddr: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
prgrsSttsComCd: z.string().optional(),
|
prgrsSttsComCd: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DesignCnstnApplySaveRequestDto.BzScaleItem */
|
/** 백엔드 DesignCnstnApplySaveRequestDto.BzScaleItem */
|
||||||
export const designCnstnBzScaleItemSchema = z.object({
|
export const designCnstnBzScaleItemSchema = z.object({
|
||||||
cnstpSeCd: z.string().optional(),
|
cnstpSeCd: z.string().nullish(),
|
||||||
bscPl: z.number().optional(),
|
bscPl: z.number().nullish(),
|
||||||
budgetReflct: z.number().optional(),
|
budgetReflct: z.number().nullish(),
|
||||||
thtiDsgn: z.number().optional(),
|
thtiDsgn: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DesignCnstnApplySaveRequestDto.BizCstItem */
|
/** 백엔드 DesignCnstnApplySaveRequestDto.BizCstItem */
|
||||||
export const designCnstnBizCstItemSchema = z.object({
|
export const designCnstnBizCstItemSchema = z.object({
|
||||||
acntgSeCd: z.string().optional(),
|
acntgSeCd: z.string().nullish(),
|
||||||
bscPlanAmt: z.number().optional(),
|
bscPlanAmt: z.number().nullish(),
|
||||||
bgtRfltAmt: z.number().optional(),
|
bgtRfltAmt: z.number().nullish(),
|
||||||
tstmDesignAmt: z.number().optional(),
|
tstmDesignAmt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DesignCnstnApplySaveRequestDto.EsntlAtchFileItem */
|
/** 백엔드 DesignCnstnApplySaveRequestDto.EsntlAtchFileItem */
|
||||||
export const designCnstnEsntlAtchFileItemSchema = z.object({
|
export const designCnstnEsntlAtchFileItemSchema = z.object({
|
||||||
esntlAtchFileId: z.string().optional(),
|
esntlAtchFileId: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DesignCnstnRvwOpnnSaveRequestDto */
|
/** 백엔드 DesignCnstnRvwOpnnSaveRequestDto */
|
||||||
export const designCnstnRvwOpnnSaveSchema = z.object({
|
export const designCnstnRvwOpnnSaveSchema = z.object({
|
||||||
designCnstnDocNo: z.string(),
|
designCnstnDocNo: z.string(),
|
||||||
rvwOpnnSn: z.number().optional(),
|
rvwOpnnSn: z.number().nullish(),
|
||||||
opnrSeComCd: z.string().optional(),
|
opnrSeComCd: z.string().nullish(),
|
||||||
opnrNm: z.string().optional(),
|
opnrNm: z.string().nullish(),
|
||||||
rvwRsltCn: z.string().optional(),
|
rvwRsltCn: z.string().nullish(),
|
||||||
rvwRsltAnmlyYn: z.string().optional(),
|
rvwRsltAnmlyYn: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 DesignCnstnApplySaveRequestDto */
|
/** 백엔드 DesignCnstnApplySaveRequestDto */
|
||||||
export const designCnstnApplySaveSchema = z.object({
|
export const designCnstnApplySaveSchema = z.object({
|
||||||
techReViewSaveCd: z.string().optional(),
|
techReViewSaveCd: z.string().nullish(),
|
||||||
rvwStpCd: z.string().optional(),
|
rvwStpCd: z.string().nullish(),
|
||||||
designCnstnMng: designCnstnMngSaveSchema,
|
designCnstnMng: designCnstnMngSaveSchema,
|
||||||
bzScaleList: z.array(designCnstnBzScaleItemSchema).optional(),
|
bzScaleList: z.array(designCnstnBzScaleItemSchema).nullish(),
|
||||||
bizCstList: z.array(designCnstnBizCstItemSchema).optional(),
|
bizCstList: z.array(designCnstnBizCstItemSchema).nullish(),
|
||||||
esntlAtchFileList: z.array(designCnstnEsntlAtchFileItemSchema).optional(),
|
esntlAtchFileList: z.array(designCnstnEsntlAtchFileItemSchema).nullish(),
|
||||||
rvwOpnnList: z.array(designCnstnRvwOpnnSaveSchema).optional(),
|
rvwOpnnList: z.array(designCnstnRvwOpnnSaveSchema).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type DesignCnstnMngSaveRequestDto = z.infer<typeof designCnstnMngSaveSchema>;
|
export type DesignCnstnMngSaveRequestDto = z.infer<typeof designCnstnMngSaveSchema>;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export {
|
|||||||
validateAllRowsForSave,
|
validateAllRowsForSave,
|
||||||
validateAplnRow,
|
validateAplnRow,
|
||||||
validateAtrzOrder,
|
validateAtrzOrder,
|
||||||
|
validateUniqueAtrzAprvr,
|
||||||
validateUniqueSeqNo,
|
validateUniqueSeqNo,
|
||||||
} from "./lib/apln-validators";
|
} from "./lib/apln-validators";
|
||||||
export {
|
export {
|
||||||
|
|||||||
@@ -76,3 +76,16 @@ export function validateUniqueSeqNo(rows: ElaprAplnRow[]): string | null {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function validateUniqueAtrzAprvr(rows: ElaprAplnRow[]): string | null {
|
||||||
|
const pairSet = new Set<string>();
|
||||||
|
for (const row of getVisibleRows(rows)) {
|
||||||
|
const atrz = row.atrzSeComCd?.trim();
|
||||||
|
const aprvr = row.aprvrUuid?.trim();
|
||||||
|
if (!atrz || !aprvr) continue;
|
||||||
|
const key = `${atrz}::${aprvr}`;
|
||||||
|
if (pairSet.has(key)) return "동일한 결재구분과 결재자가 중복됩니다.";
|
||||||
|
pairSet.add(key);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ export interface ElaprDmndSaveRequestDto {
|
|||||||
elaprDocNo: string;
|
elaprDocNo: string;
|
||||||
dmndTtl: string;
|
dmndTtl: string;
|
||||||
dmndCn: string;
|
dmndCn: string;
|
||||||
elaprCycl?: number;
|
elaprCycl?: number | null;
|
||||||
docPrgrsSttsComCd?: string;
|
docPrgrsSttsComCd?: string | null;
|
||||||
elaprPrgrsSttsList?: ElaprPrgrsSttsSaveRequestDto[];
|
elaprPrgrsSttsList?: ElaprPrgrsSttsSaveRequestDto[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from "@common/components";
|
} from "@common/components";
|
||||||
|
|
||||||
import { useElaprAplnPage } from "../api/queries";
|
import { useElaprAplnPage } from "../api/queries";
|
||||||
import { validateAplnRow } from "../lib/apln-validators";
|
import { validateAplnRow, validateUniqueAtrzAprvr } from "../lib/apln-validators";
|
||||||
import { useAplnRows } from "../lib/use-apln-rows";
|
import { useAplnRows } from "../lib/use-apln-rows";
|
||||||
import { useDndSensors } from "../lib/use-dnd-sensors";
|
import { useDndSensors } from "../lib/use-dnd-sensors";
|
||||||
import type { ElaprApln } from "../model/elapr-apln-interface";
|
import type { ElaprApln } from "../model/elapr-apln-interface";
|
||||||
@@ -110,6 +110,12 @@ function ElaprAplnPickerGrid({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const duplicateError = validateUniqueAtrzAprvr(rows);
|
||||||
|
if (duplicateError) {
|
||||||
|
alert(duplicateError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
commitEdit(row.rowKey);
|
commitEdit(row.rowKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
getVisibleRows,
|
getVisibleRows,
|
||||||
validateAllRowsForSave,
|
validateAllRowsForSave,
|
||||||
validateAtrzOrder,
|
validateAtrzOrder,
|
||||||
|
validateUniqueAtrzAprvr,
|
||||||
validateUniqueSeqNo,
|
validateUniqueSeqNo,
|
||||||
} from "../lib/apln-validators";
|
} from "../lib/apln-validators";
|
||||||
import { mapDocPrgrsToAplnRows } from "../lib/doc-prgrs-to-apln-rows";
|
import { mapDocPrgrsToAplnRows } from "../lib/doc-prgrs-to-apln-rows";
|
||||||
@@ -90,6 +91,12 @@ function ElaprDocPrgrsPickerDialog({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const atrzAprvrError = validateUniqueAtrzAprvr(aplnRows);
|
||||||
|
if (atrzAprvrError) {
|
||||||
|
alert(atrzAprvrError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const visibleRows = getVisibleRows(aplnRows);
|
const visibleRows = getVisibleRows(aplnRows);
|
||||||
onConfirm?.({ aplnRows: visibleRows });
|
onConfirm?.({ aplnRows: visibleRows });
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
getVisibleRows,
|
getVisibleRows,
|
||||||
validateAllRowsForSave,
|
validateAllRowsForSave,
|
||||||
validateAtrzOrder,
|
validateAtrzOrder,
|
||||||
|
validateUniqueAtrzAprvr,
|
||||||
validateUniqueSeqNo,
|
validateUniqueSeqNo,
|
||||||
} from "../lib/apln-validators";
|
} from "../lib/apln-validators";
|
||||||
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
@@ -106,6 +107,12 @@ function ElaprTmpltPickerDialog({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const atrzAprvrError = validateUniqueAtrzAprvr(aplnRows);
|
||||||
|
if (atrzAprvrError) {
|
||||||
|
alert(atrzAprvrError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const visibleRows = getVisibleRows(aplnRows);
|
const visibleRows = getVisibleRows(aplnRows);
|
||||||
|
|
||||||
const payload: ElaprTmpltPickerConfirmPayload = {
|
const payload: ElaprTmpltPickerConfirmPayload = {
|
||||||
|
|||||||
@@ -2,52 +2,52 @@ import { z } from "zod";
|
|||||||
|
|
||||||
/** 백엔드 FnrsCnsltnMngSaveRequestDto */
|
/** 백엔드 FnrsCnsltnMngSaveRequestDto */
|
||||||
export const fnrsCnsltnMngSaveSchema = z.object({
|
export const fnrsCnsltnMngSaveSchema = z.object({
|
||||||
fnrsCnsltnDocNo: z.string().optional(),
|
fnrsCnsltnDocNo: z.string().nullish(),
|
||||||
admdstCd: z.string().optional(),
|
admdstCd: z.string().nullish(),
|
||||||
envoSeComCd: z.string().optional(),
|
envoSeComCd: z.string().nullish(),
|
||||||
taskSeComCd: z.string().optional(),
|
taskSeComCd: z.string().nullish(),
|
||||||
cfmtnBgtBizNo: z.string().optional(),
|
cfmtnBgtBizNo: z.string().nullish(),
|
||||||
bgtAplyYr: z.string().optional(),
|
bgtAplyYr: z.string().nullish(),
|
||||||
bizNm: z.string().optional(),
|
bizNm: z.string().nullish(),
|
||||||
bizBgngYr: z.string().optional(),
|
bizBgngYr: z.string().nullish(),
|
||||||
bizEndYr: z.string().optional(),
|
bizEndYr: z.string().nullish(),
|
||||||
bizCn: z.string().optional(),
|
bizCn: z.string().nullish(),
|
||||||
aplcntNm: z.string().optional(),
|
aplcntNm: z.string().nullish(),
|
||||||
aplcntMblTelno: z.string().optional(),
|
aplcntMblTelno: z.string().nullish(),
|
||||||
aplcntOgdpNm: z.string().optional(),
|
aplcntOgdpNm: z.string().nullish(),
|
||||||
aplcntEmlAddr: z.string().optional(),
|
aplcntEmlAddr: z.string().nullish(),
|
||||||
dsgnrNm: z.string().optional(),
|
dsgnrNm: z.string().nullish(),
|
||||||
dsgnrTelno: z.string().optional(),
|
dsgnrTelno: z.string().nullish(),
|
||||||
dsgnrOgdpNm: z.string().optional(),
|
dsgnrOgdpNm: z.string().nullish(),
|
||||||
dsgnrEmlAddr: z.string().optional(),
|
dsgnrEmlAddr: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
sharAtchFileGroupId: z.string().optional(),
|
sharAtchFileGroupId: z.string().nullish(),
|
||||||
prgrsSttsComCd: z.string().optional(),
|
prgrsSttsComCd: z.string().nullish(),
|
||||||
rtlztnFcltSeComCd: z.string().optional(),
|
rtlztnFcltSeComCd: z.string().nullish(),
|
||||||
rtlztnUsgSeComCd: z.string().optional(),
|
rtlztnUsgSeComCd: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto.BzScaleItem */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto.BzScaleItem */
|
||||||
export const fnrsCnsltnBzScaleItemSchema = z.object({
|
export const fnrsCnsltnBzScaleItemSchema = z.object({
|
||||||
cnstpSeCd: z.string().optional(),
|
cnstpSeCd: z.string().nullish(),
|
||||||
bscPl: z.number().optional(),
|
bscPl: z.number().nullish(),
|
||||||
budgetReflct: z.number().optional(),
|
budgetReflct: z.number().nullish(),
|
||||||
thtiDsgn: z.number().optional(),
|
thtiDsgn: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto.BizCstItem */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto.BizCstItem */
|
||||||
export const fnrsCnsltnBizCstItemSchema = z.object({
|
export const fnrsCnsltnBizCstItemSchema = z.object({
|
||||||
acntgSeCd: z.string().optional(),
|
acntgSeCd: z.string().nullish(),
|
||||||
bscPlanAmt: z.number().optional(),
|
bscPlanAmt: z.number().nullish(),
|
||||||
bgtRfltAmt: z.number().optional(),
|
bgtRfltAmt: z.number().nullish(),
|
||||||
tstmDesignAmt: z.number().optional(),
|
tstmDesignAmt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto.CklstResultItem */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto.CklstResultItem */
|
||||||
export const fnrsCnsltnCklstResultItemSchema = z.object({
|
export const fnrsCnsltnCklstResultItemSchema = z.object({
|
||||||
cklstRvwSn: z.number().optional(),
|
cklstRvwSn: z.number().nullish(),
|
||||||
cklstArtclSn: z.number().optional(),
|
cklstArtclSn: z.number().nullish(),
|
||||||
cklstSn: z.number().optional(),
|
cklstSn: z.number().nullish(),
|
||||||
rvwStpComCd: z.string().nullish(),
|
rvwStpComCd: z.string().nullish(),
|
||||||
selected: z.enum(["Y", "N"]).nullish(),
|
selected: z.enum(["Y", "N"]).nullish(),
|
||||||
picRvwCn: z.string().nullish(),
|
picRvwCn: z.string().nullish(),
|
||||||
@@ -55,58 +55,58 @@ export const fnrsCnsltnCklstResultItemSchema = z.object({
|
|||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto.EsntlAtchFileItem */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto.EsntlAtchFileItem */
|
||||||
export const fnrsCnsltnEsntlAtchFileItemSchema = z.object({
|
export const fnrsCnsltnEsntlAtchFileItemSchema = z.object({
|
||||||
esntlAtchFileId: z.string().optional(),
|
esntlAtchFileId: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto.FnrsCnsltnSplmntDmndItem */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto.FnrsCnsltnSplmntDmndItem */
|
||||||
export const fnrsCnsltnSplmntDmndItemSchema = z.object({
|
export const fnrsCnsltnSplmntDmndItemSchema = z.object({
|
||||||
splmntDmndSn: z.number().nullish(),
|
splmntDmndSn: z.number().nullish(),
|
||||||
splmntArtclComCd: z.string().nullish(),
|
splmntArtclComCd: z.string().nullish(),
|
||||||
splmntDmndCn: z.string().optional(),
|
splmntDmndCn: z.string().nullish(),
|
||||||
splmntDmndDt: z.string().optional(),
|
splmntDmndDt: z.string().nullish(),
|
||||||
splmntDmndAtchFileGroupId: z.string().optional(),
|
splmntDmndAtchFileGroupId: z.string().nullish(),
|
||||||
splmntCn: z.string().optional(),
|
splmntCn: z.string().nullish(),
|
||||||
splmntPicNm: z.string().optional(),
|
splmntPicNm: z.string().nullish(),
|
||||||
splmntCmptnDt: z.string().optional(),
|
splmntCmptnDt: z.string().nullish(),
|
||||||
splmntAtchFileGroupId: z.string().optional(),
|
splmntAtchFileGroupId: z.string().nullish(),
|
||||||
cmptnYn: z.string().optional(),
|
cmptnYn: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnRvwOpnnSaveRequestDto */
|
/** 백엔드 FnrsCnsltnRvwOpnnSaveRequestDto */
|
||||||
export const fnrsCnsltnRvwOpnnSaveSchema = z.object({
|
export const fnrsCnsltnRvwOpnnSaveSchema = z.object({
|
||||||
fnrsCnsltnDocNo: z.string(),
|
fnrsCnsltnDocNo: z.string(),
|
||||||
rvwOpnnSn: z.number().optional(),
|
rvwOpnnSn: z.number().nullish(),
|
||||||
opnrSeComCd: z.string().optional(),
|
opnrSeComCd: z.string().nullish(),
|
||||||
opnrNm: z.string().optional(),
|
opnrNm: z.string().nullish(),
|
||||||
rvwRsltCn: z.string().optional(),
|
rvwRsltCn: z.string().nullish(),
|
||||||
rvwRsltAnmlyYn: z.string().optional(),
|
rvwRsltAnmlyYn: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto.FnrsSharItem */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto.FnrsSharItem */
|
||||||
export const fnrsSharItemSchema = z.object({
|
export const fnrsSharItemSchema = z.object({
|
||||||
fnrsSharSeCd: z.string().optional(),
|
fnrsSharSeCd: z.string().nullish(),
|
||||||
exstnAmt: z.number().optional(),
|
exstnAmt: z.number().nullish(),
|
||||||
chgRqtAmt: z.number().optional(),
|
chgRqtAmt: z.number().nullish(),
|
||||||
ajmtAmt: z.number().optional(),
|
ajmtAmt: z.number().nullish(),
|
||||||
rmrkCn: z.string().optional(),
|
rmrkCn: z.string().nullish(),
|
||||||
envoRmrkCn: z.string().optional(),
|
envoRmrkCn: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto */
|
/** 백엔드 FnrsCnsltnApplySaveRequestDto */
|
||||||
export const fnrsCnsltnApplySaveSchema = z.object({
|
export const fnrsCnsltnApplySaveSchema = z.object({
|
||||||
techReViewSaveCd: z.string().optional(),
|
techReViewSaveCd: z.string().nullish(),
|
||||||
rvwStpCd: z.string().optional(),
|
rvwStpCd: z.string().nullish(),
|
||||||
fnrsCnsltnMng: fnrsCnsltnMngSaveSchema,
|
fnrsCnsltnMng: fnrsCnsltnMngSaveSchema,
|
||||||
bzScaleList: z.array(fnrsCnsltnBzScaleItemSchema).optional(),
|
bzScaleList: z.array(fnrsCnsltnBzScaleItemSchema).nullish(),
|
||||||
bizCstList: z.array(fnrsCnsltnBizCstItemSchema).optional(),
|
bizCstList: z.array(fnrsCnsltnBizCstItemSchema).nullish(),
|
||||||
cklstResultList: z.array(fnrsCnsltnCklstResultItemSchema).optional(),
|
cklstResultList: z.array(fnrsCnsltnCklstResultItemSchema).nullish(),
|
||||||
cklstResultMap: z.record(z.array(fnrsCnsltnCklstResultItemSchema)).optional(),
|
cklstResultMap: z.record(z.array(fnrsCnsltnCklstResultItemSchema)).nullish(),
|
||||||
esntlAtchFileList: z.array(fnrsCnsltnEsntlAtchFileItemSchema).optional(),
|
esntlAtchFileList: z.array(fnrsCnsltnEsntlAtchFileItemSchema).nullish(),
|
||||||
rvwOpnnList: z.array(fnrsCnsltnRvwOpnnSaveSchema).optional(),
|
rvwOpnnList: z.array(fnrsCnsltnRvwOpnnSaveSchema).nullish(),
|
||||||
splmntDmndList: z.array(fnrsCnsltnSplmntDmndItemSchema).optional(),
|
splmntDmndList: z.array(fnrsCnsltnSplmntDmndItemSchema).nullish(),
|
||||||
fnrsSharList: z.array(fnrsSharItemSchema).optional(),
|
fnrsSharList: z.array(fnrsSharItemSchema).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type FnrsCnsltnMngSaveRequestDto = z.infer<typeof fnrsCnsltnMngSaveSchema>;
|
export type FnrsCnsltnMngSaveRequestDto = z.infer<typeof fnrsCnsltnMngSaveSchema>;
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import { z } from "zod";
|
|||||||
|
|
||||||
/** 백엔드 FnrsExamineRequestDto */
|
/** 백엔드 FnrsExamineRequestDto */
|
||||||
export const fnrsExamineRequestSchema = z.object({
|
export const fnrsExamineRequestSchema = z.object({
|
||||||
prgrsSttsComCd: z.string().optional(),
|
prgrsSttsComCd: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 EnvoActnReviewReqDto */
|
/** 백엔드 EnvoActnReviewReqDto */
|
||||||
export const envoActnReviewReqSchema = z.object({
|
export const envoActnReviewReqSchema = z.object({
|
||||||
specialRqstCn: z.string().optional(),
|
specialRqstCn: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type FnrsExamineRequestDto = z.infer<typeof fnrsExamineRequestSchema>;
|
export type FnrsExamineRequestDto = z.infer<typeof fnrsExamineRequestSchema>;
|
||||||
|
|||||||
@@ -2,52 +2,52 @@ import { z } from "zod";
|
|||||||
|
|
||||||
/** 백엔드 InstlSncnMngSaveRequestDto */
|
/** 백엔드 InstlSncnMngSaveRequestDto */
|
||||||
export const instlSncnMngSaveSchema = z.object({
|
export const instlSncnMngSaveSchema = z.object({
|
||||||
instlSncnDocNo: z.string().optional(),
|
instlSncnDocNo: z.string().nullish(),
|
||||||
admdstCd: z.string().optional(),
|
admdstCd: z.string().nullish(),
|
||||||
envoSeComCd: z.string().optional(),
|
envoSeComCd: z.string().nullish(),
|
||||||
sncnSeComCd: z.string().optional(),
|
sncnSeComCd: z.string().nullish(),
|
||||||
taskSeComCd: z.string().optional(),
|
taskSeComCd: z.string().nullish(),
|
||||||
bgtBizCd: z.string().optional(),
|
bgtBizCd: z.string().nullish(),
|
||||||
bgtAplyYr: z.string().optional(),
|
bgtAplyYr: z.string().nullish(),
|
||||||
bizNm: z.string().optional(),
|
bizNm: z.string().nullish(),
|
||||||
bizBgngYr: z.string().optional(),
|
bizBgngYr: z.string().nullish(),
|
||||||
bizEndYr: z.string().optional(),
|
bizEndYr: z.string().nullish(),
|
||||||
bizCn: z.string().optional(),
|
bizCn: z.string().nullish(),
|
||||||
aplcntNm: z.string().optional(),
|
aplcntNm: z.string().nullish(),
|
||||||
aplcntMblTelno: z.string().optional(),
|
aplcntMblTelno: z.string().nullish(),
|
||||||
aplcntOgdpNm: z.string().optional(),
|
aplcntOgdpNm: z.string().nullish(),
|
||||||
aplcntEmlAddr: z.string().optional(),
|
aplcntEmlAddr: z.string().nullish(),
|
||||||
dsgnrNm: z.string().optional(),
|
dsgnrNm: z.string().nullish(),
|
||||||
dsgnrTelno: z.string().optional(),
|
dsgnrTelno: z.string().nullish(),
|
||||||
dsgnrOgdpNm: z.string().optional(),
|
dsgnrOgdpNm: z.string().nullish(),
|
||||||
dsgnrEmlAddr: z.string().optional(),
|
dsgnrEmlAddr: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
prgrsSttsComCd: z.string().optional(),
|
prgrsSttsComCd: z.string().nullish(),
|
||||||
rtlztnFcltSeComCd: z.string().optional(),
|
rtlztnFcltSeComCd: z.string().nullish(),
|
||||||
rtlztnUsgSeComCd: z.string().optional(),
|
rtlztnUsgSeComCd: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 InstlSncnApplySaveRequestDto.BzScaleItem (diff는 API 미전송) */
|
/** 백엔드 InstlSncnApplySaveRequestDto.BzScaleItem (diff는 API 미전송) */
|
||||||
export const instlSncnBzScaleItemSchema = z.object({
|
export const instlSncnBzScaleItemSchema = z.object({
|
||||||
cnstpSeCd: z.string().optional(),
|
cnstpSeCd: z.string().nullish(),
|
||||||
bscPl: z.number().optional(),
|
bscPl: z.number().nullish(),
|
||||||
budgetReflct: z.number().optional(),
|
budgetReflct: z.number().nullish(),
|
||||||
thtiDsgn: z.number().optional(),
|
thtiDsgn: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 InstlSncnApplySaveRequestDto.BizCstItem */
|
/** 백엔드 InstlSncnApplySaveRequestDto.BizCstItem */
|
||||||
export const instlSncnBizCstItemSchema = z.object({
|
export const instlSncnBizCstItemSchema = z.object({
|
||||||
acntgSeCd: z.string().optional(),
|
acntgSeCd: z.string().nullish(),
|
||||||
bscPlanAmt: z.number().optional(),
|
bscPlanAmt: z.number().nullish(),
|
||||||
bgtRfltAmt: z.number().optional(),
|
bgtRfltAmt: z.number().nullish(),
|
||||||
tstmDesignAmt: z.number().optional(),
|
tstmDesignAmt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 InstlSncnApplySaveRequestDto.CklstResultItem */
|
/** 백엔드 InstlSncnApplySaveRequestDto.CklstResultItem */
|
||||||
export const instlSncnCklstResultItemSchema = z.object({
|
export const instlSncnCklstResultItemSchema = z.object({
|
||||||
cklstRvwSn: z.number().optional(),
|
cklstRvwSn: z.number().nullish(),
|
||||||
cklstArtclSn: z.number().optional(),
|
cklstArtclSn: z.number().nullish(),
|
||||||
cklstSn: z.number().optional(),
|
cklstSn: z.number().nullish(),
|
||||||
rvwStpComCd: z.string().nullish(),
|
rvwStpComCd: z.string().nullish(),
|
||||||
selected: z.enum(["Y", "N"]).nullish(),
|
selected: z.enum(["Y", "N"]).nullish(),
|
||||||
picRvwCn: z.string().nullish(),
|
picRvwCn: z.string().nullish(),
|
||||||
@@ -55,47 +55,47 @@ export const instlSncnCklstResultItemSchema = z.object({
|
|||||||
|
|
||||||
/** 백엔드 InstlSncnApplySaveRequestDto.EsntlAtchFileItem */
|
/** 백엔드 InstlSncnApplySaveRequestDto.EsntlAtchFileItem */
|
||||||
export const instlSncnEsntlAtchFileItemSchema = z.object({
|
export const instlSncnEsntlAtchFileItemSchema = z.object({
|
||||||
esntlAtchFileId: z.string().optional(),
|
esntlAtchFileId: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 InstlSncnRvwOpnnSaveRequestDto */
|
/** 백엔드 InstlSncnRvwOpnnSaveRequestDto */
|
||||||
export const instlSncnRvwOpnnSaveSchema = z.object({
|
export const instlSncnRvwOpnnSaveSchema = z.object({
|
||||||
instlSncnDocNo: z.string(),
|
instlSncnDocNo: z.string(),
|
||||||
rvwOpnnSn: z.number().optional(),
|
rvwOpnnSn: z.number().nullish(),
|
||||||
opnrSeComCd: z.string().optional(),
|
opnrSeComCd: z.string().nullish(),
|
||||||
opnrNm: z.string().optional(),
|
opnrNm: z.string().nullish(),
|
||||||
rvwRsltCn: z.string().optional(),
|
rvwRsltCn: z.string().nullish(),
|
||||||
rvwRsltAnmlyYn: z.string().optional(),
|
rvwRsltAnmlyYn: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 InstlSncnApplySaveRequestDto.InstlSncnSplmntDmndItem */
|
/** 백엔드 InstlSncnApplySaveRequestDto.InstlSncnSplmntDmndItem */
|
||||||
export const instlSncnSplmntDmndItemSchema = z.object({
|
export const instlSncnSplmntDmndItemSchema = z.object({
|
||||||
splmntDmndSn: z.number().nullish(),
|
splmntDmndSn: z.number().nullish(),
|
||||||
splmntArtclComCd: z.string().nullish(),
|
splmntArtclComCd: z.string().nullish(),
|
||||||
splmntDmndCn: z.string().optional(),
|
splmntDmndCn: z.string().nullish(),
|
||||||
splmntDmndDt: z.string().optional(),
|
splmntDmndDt: z.string().nullish(),
|
||||||
splmntDmndAtchFileGroupId: z.string().optional(),
|
splmntDmndAtchFileGroupId: z.string().nullish(),
|
||||||
splmntCn: z.string().optional(),
|
splmntCn: z.string().nullish(),
|
||||||
splmntPicNm: z.string().optional(),
|
splmntPicNm: z.string().nullish(),
|
||||||
splmntCmptnDt: z.string().optional(),
|
splmntCmptnDt: z.string().nullish(),
|
||||||
splmntAtchFileGroupId: z.string().optional(),
|
splmntAtchFileGroupId: z.string().nullish(),
|
||||||
cmptnYn: z.string().optional(),
|
cmptnYn: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 InstlSncnApplySaveRequestDto */
|
/** 백엔드 InstlSncnApplySaveRequestDto */
|
||||||
export const instlSncnApplySaveSchema = z.object({
|
export const instlSncnApplySaveSchema = z.object({
|
||||||
techReViewSaveCd: z.string().optional(),
|
techReViewSaveCd: z.string().nullish(),
|
||||||
rvwStpCd: z.string().optional(),
|
rvwStpCd: z.string().nullish(),
|
||||||
instlSncnMng: instlSncnMngSaveSchema,
|
instlSncnMng: instlSncnMngSaveSchema,
|
||||||
bzScaleList: z.array(instlSncnBzScaleItemSchema).optional(),
|
bzScaleList: z.array(instlSncnBzScaleItemSchema).nullish(),
|
||||||
bizCstList: z.array(instlSncnBizCstItemSchema).optional(),
|
bizCstList: z.array(instlSncnBizCstItemSchema).nullish(),
|
||||||
cklstResultList: z.array(instlSncnCklstResultItemSchema).optional(),
|
cklstResultList: z.array(instlSncnCklstResultItemSchema).nullish(),
|
||||||
cklstResultMap: z.record(z.array(instlSncnCklstResultItemSchema)).optional(),
|
cklstResultMap: z.record(z.array(instlSncnCklstResultItemSchema)).nullish(),
|
||||||
esntlAtchFileList: z.array(instlSncnEsntlAtchFileItemSchema).optional(),
|
esntlAtchFileList: z.array(instlSncnEsntlAtchFileItemSchema).nullish(),
|
||||||
rvwOpnnList: z.array(instlSncnRvwOpnnSaveSchema).optional(),
|
rvwOpnnList: z.array(instlSncnRvwOpnnSaveSchema).nullish(),
|
||||||
splmntDmndList: z.array(instlSncnSplmntDmndItemSchema).optional(),
|
splmntDmndList: z.array(instlSncnSplmntDmndItemSchema).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type InstlSncnMngSaveRequestDto = z.infer<typeof instlSncnMngSaveSchema>;
|
export type InstlSncnMngSaveRequestDto = z.infer<typeof instlSncnMngSaveSchema>;
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import { z } from "zod";
|
|||||||
export const pwrkCnsltnDocCrtRsltSaveRequestSchema = z.object({
|
export const pwrkCnsltnDocCrtRsltSaveRequestSchema = z.object({
|
||||||
crtDmndUuid: z.string().uuid(),
|
crtDmndUuid: z.string().uuid(),
|
||||||
pwrkCnsltnDocNo: z.string().min(1).max(100),
|
pwrkCnsltnDocNo: z.string().min(1).max(100),
|
||||||
atchFileGroupId: z.string().max(30).optional(),
|
atchFileGroupId: z.string().max(30).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type PwrkCnsltnDocCrtRsltSaveRequestDto = z.infer<
|
export type PwrkCnsltnDocCrtRsltSaveRequestDto = z.infer<
|
||||||
|
|||||||
+4
-4
@@ -3,10 +3,10 @@ import { z } from "zod";
|
|||||||
/** 백엔드 PwrkCnsltnDocEvlSaveRequestDto */
|
/** 백엔드 PwrkCnsltnDocEvlSaveRequestDto */
|
||||||
export const pwrkCnsltnDocEvlSaveRequestSchema = z.object({
|
export const pwrkCnsltnDocEvlSaveRequestSchema = z.object({
|
||||||
pwrkCnsltnDocNo: z.string().min(1),
|
pwrkCnsltnDocNo: z.string().min(1),
|
||||||
pwrkCnsltnDocEvlUuid: z.string().uuid().optional(),
|
pwrkCnsltnDocEvlUuid: z.string().uuid().nullish(),
|
||||||
pwrkCnsltnDocEvlCn: z.string().max(2000).optional(),
|
pwrkCnsltnDocEvlCn: z.string().max(2000).nullish(),
|
||||||
pwrkCnsltnDocEvlScr: z.number().optional(),
|
pwrkCnsltnDocEvlScr: z.number().nullish(),
|
||||||
pwrkCnsltnDocEvlDt: z.string().optional(),
|
pwrkCnsltnDocEvlDt: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type PwrkCnsltnDocEvlSaveRequestDto = z.infer<typeof pwrkCnsltnDocEvlSaveRequestSchema>;
|
export type PwrkCnsltnDocEvlSaveRequestDto = z.infer<typeof pwrkCnsltnDocEvlSaveRequestSchema>;
|
||||||
|
|||||||
@@ -3,18 +3,18 @@ import { z } from "zod";
|
|||||||
/** 백엔드 PwrkActnResultSubmitDto.ActnItemDto */
|
/** 백엔드 PwrkActnResultSubmitDto.ActnItemDto */
|
||||||
export const pwrkActnResultActnItemSchema = z.object({
|
export const pwrkActnResultActnItemSchema = z.object({
|
||||||
rvwOpnnSn: z.number(),
|
rvwOpnnSn: z.number(),
|
||||||
actnRsltCn: z.string().optional(),
|
actnRsltCn: z.string().nullish(),
|
||||||
rfltYn: z.string().optional(),
|
rfltYn: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 PwrkActnResultSubmitDto */
|
/** 백엔드 PwrkActnResultSubmitDto */
|
||||||
export const pwrkActnResultSubmitSchema = z.object({
|
export const pwrkActnResultSubmitSchema = z.object({
|
||||||
isSubmit: z.boolean(),
|
isSubmit: z.boolean(),
|
||||||
actnList: z.array(pwrkActnResultActnItemSchema).optional(),
|
actnList: z.array(pwrkActnResultActnItemSchema).nullish(),
|
||||||
totActnSummary: z.string().optional(),
|
totActnSummary: z.string().nullish(),
|
||||||
muniDocNo: z.string().optional(),
|
muniDocNo: z.string().nullish(),
|
||||||
pwrkAtchFileGroupId: z.string().optional(),
|
pwrkAtchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type PwrkActnResultSubmitDto = z.infer<typeof pwrkActnResultSubmitSchema>;
|
export type PwrkActnResultSubmitDto = z.infer<typeof pwrkActnResultSubmitSchema>;
|
||||||
|
|||||||
@@ -2,50 +2,50 @@ import { z } from "zod";
|
|||||||
|
|
||||||
/** 백엔드 SewerBscPlanSaveRequestDto */
|
/** 백엔드 SewerBscPlanSaveRequestDto */
|
||||||
export const sewerBscPlanSaveSchema = z.object({
|
export const sewerBscPlanSaveSchema = z.object({
|
||||||
sewerBscPlanDocNo: z.string().optional(),
|
sewerBscPlanDocNo: z.string().nullish(),
|
||||||
admdstCd: z.string().optional(),
|
admdstCd: z.string().nullish(),
|
||||||
envoSeComCd: z.string().optional(),
|
envoSeComCd: z.string().nullish(),
|
||||||
sewerBscPlanSeComCd: z.string().optional(),
|
sewerBscPlanSeComCd: z.string().nullish(),
|
||||||
sewerBscPlanNm: z.string().optional(),
|
sewerBscPlanNm: z.string().nullish(),
|
||||||
taskSeComCd: z.string().optional(),
|
taskSeComCd: z.string().nullish(),
|
||||||
prgrsSttsComCd: z.string().optional(),
|
prgrsSttsComCd: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanDtlSaveRequestDto */
|
/** 백엔드 SewerBscPlanDtlSaveRequestDto */
|
||||||
export const sewerBscPlanDtlSaveSchema = z.object({
|
export const sewerBscPlanDtlSaveSchema = z.object({
|
||||||
sewerBscPlanDocNo: z.string().optional(),
|
sewerBscPlanDocNo: z.string().nullish(),
|
||||||
chgCycl: z.number().optional(),
|
chgCycl: z.number().nullish(),
|
||||||
aplcntNm: z.string().optional(),
|
aplcntNm: z.string().nullish(),
|
||||||
aplcntMblTelno: z.string().optional(),
|
aplcntMblTelno: z.string().nullish(),
|
||||||
aplcntOgdpNm: z.string().optional(),
|
aplcntOgdpNm: z.string().nullish(),
|
||||||
aplcntEmlAddr: z.string().optional(),
|
aplcntEmlAddr: z.string().nullish(),
|
||||||
dsgnrNm: z.string().optional(),
|
dsgnrNm: z.string().nullish(),
|
||||||
dsgnrTelno: z.string().optional(),
|
dsgnrTelno: z.string().nullish(),
|
||||||
dsgnrOgdpNm: z.string().optional(),
|
dsgnrOgdpNm: z.string().nullish(),
|
||||||
dsgnrEmlAddr: z.string().optional(),
|
dsgnrEmlAddr: z.string().nullish(),
|
||||||
planYr: z.string().optional(),
|
planYr: z.string().nullish(),
|
||||||
crtrYr: z.string().optional(),
|
crtrYr: z.string().nullish(),
|
||||||
bizOtlnCn: z.string().optional(),
|
bizOtlnCn: z.string().nullish(),
|
||||||
frlvlGoalYr: z.string().optional(),
|
frlvlGoalYr: z.string().nullish(),
|
||||||
sclvlGoalYr: z.string().optional(),
|
sclvlGoalYr: z.string().nullish(),
|
||||||
thlvlGoalYr: z.string().optional(),
|
thlvlGoalYr: z.string().nullish(),
|
||||||
folvlGoalYr: z.string().optional(),
|
folvlGoalYr: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanOtlnItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanOtlnItem */
|
||||||
export const sewerBscPlanOtlnItemSchema = z.object({
|
export const sewerBscPlanOtlnItemSchema = z.object({
|
||||||
planStpNo: z.number().optional(),
|
planStpNo: z.number().nullish(),
|
||||||
sewerPlanPpltnCnt: z.number().optional(),
|
sewerPlanPpltnCnt: z.number().nullish(),
|
||||||
sewerPrcsPpltnCnt: z.number().optional(),
|
sewerPrcsPpltnCnt: z.number().nullish(),
|
||||||
sewerPsplyRt: z.number().optional(),
|
sewerPsplyRt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.CklstResultItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.CklstResultItem */
|
||||||
export const sewerBscPlanCklstResultItemSchema = z.object({
|
export const sewerBscPlanCklstResultItemSchema = z.object({
|
||||||
cklstRvwSn: z.number().optional(),
|
cklstRvwSn: z.number().nullish(),
|
||||||
cklstArtclSn: z.number().optional(),
|
cklstArtclSn: z.number().nullish(),
|
||||||
cklstSn: z.number().optional(),
|
cklstSn: z.number().nullish(),
|
||||||
rvwStpComCd: z.string(),
|
rvwStpComCd: z.string(),
|
||||||
selected: z.enum(["Y", "N"]).nullish(),
|
selected: z.enum(["Y", "N"]).nullish(),
|
||||||
picRvwCn: z.string().nullish(),
|
picRvwCn: z.string().nullish(),
|
||||||
@@ -53,109 +53,109 @@ export const sewerBscPlanCklstResultItemSchema = z.object({
|
|||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanFnrsCstItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanFnrsCstItem */
|
||||||
export const sewerBscPlanFnrsCstItemSchema = z.object({
|
export const sewerBscPlanFnrsCstItemSchema = z.object({
|
||||||
planStpNo: z.number().optional(),
|
planStpNo: z.number().nullish(),
|
||||||
gvexpAmt: z.number().optional(),
|
gvexpAmt: z.number().nullish(),
|
||||||
lcexpAmt: z.number().optional(),
|
lcexpAmt: z.number().nullish(),
|
||||||
orgprBdchgAmt: z.number().optional(),
|
orgprBdchgAmt: z.number().nullish(),
|
||||||
etcAmt: z.number().optional(),
|
etcAmt: z.number().nullish(),
|
||||||
sumAmt: z.number().optional(),
|
sumAmt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanSplmntDmndItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanSplmntDmndItem */
|
||||||
export const sewerBscPlanSplmntDmndItemSchema = z.object({
|
export const sewerBscPlanSplmntDmndItemSchema = z.object({
|
||||||
splmntDmndSn: z.number().nullish(),
|
splmntDmndSn: z.number().nullish(),
|
||||||
splmntArtclComCd: z.string().nullish(),
|
splmntArtclComCd: z.string().nullish(),
|
||||||
splmntDmndCn: z.string().optional(),
|
splmntDmndCn: z.string().nullish(),
|
||||||
splmntDmndDt: z.string().optional(),
|
splmntDmndDt: z.string().nullish(),
|
||||||
splmntDmndAtchFileGroupId: z.string().optional(),
|
splmntDmndAtchFileGroupId: z.string().nullish(),
|
||||||
splmntCn: z.string().optional(),
|
splmntCn: z.string().nullish(),
|
||||||
splmntPicNm: z.string().optional(),
|
splmntPicNm: z.string().nullish(),
|
||||||
splmntCmptnDt: z.string().optional(),
|
splmntCmptnDt: z.string().nullish(),
|
||||||
splmntAtchFileGroupId: z.string().optional(),
|
splmntAtchFileGroupId: z.string().nullish(),
|
||||||
cmptnYn: z.string().optional(),
|
cmptnYn: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanRvwOpnnItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanRvwOpnnItem */
|
||||||
export const sewerBscPlanRvwOpnnItemSchema = z.object({
|
export const sewerBscPlanRvwOpnnItemSchema = z.object({
|
||||||
rvwOpnnSn: z.number().optional(),
|
rvwOpnnSn: z.number().nullish(),
|
||||||
opnrSeComCd: z.string().optional(),
|
opnrSeComCd: z.string().nullish(),
|
||||||
opnrNm: z.string().optional(),
|
opnrNm: z.string().nullish(),
|
||||||
rvwRsltCn: z.string().optional(),
|
rvwRsltCn: z.string().nullish(),
|
||||||
rvwRsltAnmlyYn: z.string().optional(),
|
rvwRsltAnmlyYn: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.EsntlAtchFileItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.EsntlAtchFileItem */
|
||||||
export const sewerBscPlanEsntlAtchFileItemSchema = z.object({
|
export const sewerBscPlanEsntlAtchFileItemSchema = z.object({
|
||||||
esntlAtchFileId: z.string().optional(),
|
esntlAtchFileId: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanBizCstItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanBizCstItem */
|
||||||
export const sewerBscPlanBizCstItemSchema = z.object({
|
export const sewerBscPlanBizCstItemSchema = z.object({
|
||||||
planStpNo: z.number().optional(),
|
planStpNo: z.number().nullish(),
|
||||||
acntgSeCd: z.string().optional(),
|
acntgSeCd: z.string().nullish(),
|
||||||
cstrnAmt: z.number().optional(),
|
cstrnAmt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanTmplntDtlItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanTmplntDtlItem */
|
||||||
export const sewerBscPlanTmplntDtlItemSchema = z.object({
|
export const sewerBscPlanTmplntDtlItemSchema = z.object({
|
||||||
planStpNo: z.number().optional(),
|
planStpNo: z.number().nullish(),
|
||||||
swtrmtFcltCd: z.string().optional(),
|
swtrmtFcltCd: z.string().nullish(),
|
||||||
prcsZoneArea: z.number().optional(),
|
prcsZoneArea: z.number().nullish(),
|
||||||
swtrmtPpltnCnt: z.number().optional(),
|
swtrmtPpltnCnt: z.number().nullish(),
|
||||||
planSwqty: z.number().optional(),
|
planSwqty: z.number().nullish(),
|
||||||
fcltCpct: z.number().optional(),
|
fcltCpct: z.number().nullish(),
|
||||||
sprsysDrtwPplLen: z.number().optional(),
|
sprsysDrtwPplLen: z.number().nullish(),
|
||||||
sprsysExlnPplLen: z.number().optional(),
|
sprsysExlnPplLen: z.number().nullish(),
|
||||||
cbsysPplLen: z.number().optional(),
|
cbsysPplLen: z.number().nullish(),
|
||||||
icptgPplLen: z.number().optional(),
|
icptgPplLen: z.number().nullish(),
|
||||||
drgCnt: z.number().optional(),
|
drgCnt: z.number().nullish(),
|
||||||
drtwRlyPumpCnt: z.number().optional(),
|
drtwRlyPumpCnt: z.number().nullish(),
|
||||||
drtwPumpCnt: z.number().optional(),
|
drtwPumpCnt: z.number().nullish(),
|
||||||
exlnPumpCnt: z.number().optional(),
|
exlnPumpCnt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanTmplntItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanTmplntItem */
|
||||||
export const sewerBscPlanTmplntItemSchema = z.object({
|
export const sewerBscPlanTmplntItemSchema = z.object({
|
||||||
swtrmtFcltCd: z.string().optional(),
|
swtrmtFcltCd: z.string().nullish(),
|
||||||
atchFileGroupId: z.string().optional(),
|
atchFileGroupId: z.string().nullish(),
|
||||||
sewerBscPlanTmplntDtlList: z.array(sewerBscPlanTmplntDtlItemSchema).optional(),
|
sewerBscPlanTmplntDtlList: z.array(sewerBscPlanTmplntDtlItemSchema).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanTmplntTmprStrgItem */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto.SewerBscPlanTmplntTmprStrgItem */
|
||||||
export const sewerBscPlanTmplntTmprStrgItemSchema = z.object({
|
export const sewerBscPlanTmplntTmprStrgItemSchema = z.object({
|
||||||
dtStrgDt: z.string().optional(),
|
dtStrgDt: z.string().nullish(),
|
||||||
swtrmtFcltCd: z.string().optional(),
|
swtrmtFcltCd: z.string().nullish(),
|
||||||
prcsZoneArea: z.number().optional(),
|
prcsZoneArea: z.number().nullish(),
|
||||||
swtrmtPpltnCnt: z.number().optional(),
|
swtrmtPpltnCnt: z.number().nullish(),
|
||||||
planSwqty: z.number().optional(),
|
planSwqty: z.number().nullish(),
|
||||||
fcltCpct: z.number().optional(),
|
fcltCpct: z.number().nullish(),
|
||||||
sprsysDrtwPplLen: z.number().optional(),
|
sprsysDrtwPplLen: z.number().nullish(),
|
||||||
sprsysExlnPplLen: z.number().optional(),
|
sprsysExlnPplLen: z.number().nullish(),
|
||||||
cbsysPplLen: z.number().optional(),
|
cbsysPplLen: z.number().nullish(),
|
||||||
icptgPplLen: z.number().optional(),
|
icptgPplLen: z.number().nullish(),
|
||||||
drgCnt: z.number().optional(),
|
drgCnt: z.number().nullish(),
|
||||||
drtwRlyPumpCnt: z.number().optional(),
|
drtwRlyPumpCnt: z.number().nullish(),
|
||||||
drtwPumpCnt: z.number().optional(),
|
drtwPumpCnt: z.number().nullish(),
|
||||||
exlnPumpCnt: z.number().optional(),
|
exlnPumpCnt: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 백엔드 SewerBscPlanApplySaveRequestDto */
|
/** 백엔드 SewerBscPlanApplySaveRequestDto */
|
||||||
export const sewerBscPlanApplySaveSchema = z.object({
|
export const sewerBscPlanApplySaveSchema = z.object({
|
||||||
techReViewSaveCd: z.string().optional(),
|
techReViewSaveCd: z.string().nullish(),
|
||||||
rvwStpCd: z.string().optional(),
|
rvwStpCd: z.string().nullish(),
|
||||||
sewerBscPlan: sewerBscPlanSaveSchema,
|
sewerBscPlan: sewerBscPlanSaveSchema,
|
||||||
sewerBscPlanDtl: sewerBscPlanDtlSaveSchema,
|
sewerBscPlanDtl: sewerBscPlanDtlSaveSchema,
|
||||||
sewerBscPlanOtlnList: z.array(sewerBscPlanOtlnItemSchema).optional(),
|
sewerBscPlanOtlnList: z.array(sewerBscPlanOtlnItemSchema).nullish(),
|
||||||
cklstResultList: z.array(sewerBscPlanCklstResultItemSchema).optional(),
|
cklstResultList: z.array(sewerBscPlanCklstResultItemSchema).nullish(),
|
||||||
fnrsCstList: z.array(sewerBscPlanFnrsCstItemSchema).optional(),
|
fnrsCstList: z.array(sewerBscPlanFnrsCstItemSchema).nullish(),
|
||||||
splmntDmndList: z.array(sewerBscPlanSplmntDmndItemSchema).optional(),
|
splmntDmndList: z.array(sewerBscPlanSplmntDmndItemSchema).nullish(),
|
||||||
rvwOpnnList: z.array(sewerBscPlanRvwOpnnItemSchema).optional(),
|
rvwOpnnList: z.array(sewerBscPlanRvwOpnnItemSchema).nullish(),
|
||||||
esntlAtchFileList: z.array(sewerBscPlanEsntlAtchFileItemSchema).optional(),
|
esntlAtchFileList: z.array(sewerBscPlanEsntlAtchFileItemSchema).nullish(),
|
||||||
bizCstList: z.array(sewerBscPlanBizCstItemSchema).optional(),
|
bizCstList: z.array(sewerBscPlanBizCstItemSchema).nullish(),
|
||||||
sewerBscPlanTmplntList: z.array(sewerBscPlanTmplntItemSchema).optional(),
|
sewerBscPlanTmplntList: z.array(sewerBscPlanTmplntItemSchema).nullish(),
|
||||||
tmplntTmprStrgList: z.array(sewerBscPlanTmplntTmprStrgItemSchema).optional(),
|
tmplntTmprStrgList: z.array(sewerBscPlanTmplntTmprStrgItemSchema).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type SewerBscPlanSaveRequestDto = z.infer<typeof sewerBscPlanSaveSchema>;
|
export type SewerBscPlanSaveRequestDto = z.infer<typeof sewerBscPlanSaveSchema>;
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ export const designCnstnRegistSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1, "설계자 이메일은 필수입니다")
|
.min(1, "설계자 이메일은 필수입니다")
|
||||||
.email("올바른 이메일 형식이 아닙니다"),
|
.email("올바른 이메일 형식이 아닙니다"),
|
||||||
sido: z.string().optional(),
|
sido: z.string().nullish(),
|
||||||
gugun: z.string().optional(),
|
gugun: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
bzScaleList: z.array(
|
bzScaleList: z.array(
|
||||||
designCnstnBzScaleItemSchema.extend({
|
designCnstnBzScaleItemSchema.extend({
|
||||||
@@ -32,7 +32,7 @@ export const designCnstnRegistSchema = z.object({
|
|||||||
bscPl: z.number(),
|
bscPl: z.number(),
|
||||||
budgetReflct: z.number(),
|
budgetReflct: z.number(),
|
||||||
thtiDsgn: z.number(),
|
thtiDsgn: z.number(),
|
||||||
diff: z.number().optional(),
|
diff: z.number().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
esntlAtchFileList: z.array(
|
esntlAtchFileList: z.array(
|
||||||
@@ -52,7 +52,7 @@ export function formatTaskSeComCdForApi(taskSeComCd: string[]): string {
|
|||||||
return taskSeComCd.join(",");
|
return taskSeComCd.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseTaskSeComCdFromApi(taskSeComCd?: string): string[] {
|
export function parseTaskSeComCdFromApi(taskSeComCd?: string | null): string[] {
|
||||||
if (!taskSeComCd) return [];
|
if (!taskSeComCd) return [];
|
||||||
return taskSeComCd.split(",").filter(Boolean);
|
return taskSeComCd.split(",").filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function getBadgeColor(state: BadgeState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatOptional(value: string | undefined) {
|
function formatOptional(value: string | null | undefined) {
|
||||||
return value?.trim() ? value : "-";
|
return value?.trim() ? value : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,14 +51,19 @@ const ROLE_STATUS_BUTTON_ACTIONS: Record<string, Record<string, FnrsCnsltnViewBu
|
|||||||
LE: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply, FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstTechRvw],
|
LE: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply, FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstTechRvw],
|
||||||
TP: [
|
TP: [
|
||||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply,
|
|
||||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwOpnnRply,
|
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwOpnnRply,
|
||||||
],
|
],
|
||||||
|
RB: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||||
RA: [
|
RA: [
|
||||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstActnRvw,
|
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstActnRvw,
|
||||||
],
|
],
|
||||||
|
AV: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||||
|
EV: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||||
|
RK: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||||
RR: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng, FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply],
|
RR: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng, FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply],
|
||||||
|
EP: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||||
|
TA: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
type ChecklistFormState,
|
type ChecklistFormState,
|
||||||
type ChecklistProgress,
|
type ChecklistProgress,
|
||||||
type ChecklistRowKey,
|
type ChecklistRowKey,
|
||||||
type ChecklistStepMap,
|
|
||||||
REVIEW_STEP_CODES,
|
REVIEW_STEP_CODES,
|
||||||
type ReviewStepCode,
|
type ReviewStepCode,
|
||||||
} from "../model/view-types";
|
} from "../model/view-types";
|
||||||
@@ -17,15 +16,6 @@ export function buildChecklistRowKey(
|
|||||||
return `${row.taskSeComCd}_${row.cklstSn}_${row.cklstArtclSn}_${row.cklstRvwSn}_${step}`;
|
return `${row.taskSeComCd}_${row.cklstSn}_${row.cklstArtclSn}_${row.cklstRvwSn}_${step}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function groupByReviewStep(rows: CklstRvwRsltTreeDto[]): ChecklistStepMap {
|
|
||||||
const base: ChecklistStepMap = { LOCAL: [], ENV: [], KECO: [] };
|
|
||||||
rows.forEach((row) => {
|
|
||||||
const step = (row.rvwStpComCd ?? "LOCAL") as ReviewStepCode;
|
|
||||||
if (REVIEW_STEP_CODES.includes(step)) base[step].push(row);
|
|
||||||
});
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function extractTaskCodes(rows: CklstRvwRsltTreeDto[]): string[] {
|
export function extractTaskCodes(rows: CklstRvwRsltTreeDto[]): string[] {
|
||||||
return Array.from(new Set(rows.map((row) => row.taskSeComCd).filter(Boolean)));
|
return Array.from(new Set(rows.map((row) => row.taskSeComCd).filter(Boolean)));
|
||||||
}
|
}
|
||||||
@@ -70,13 +60,6 @@ export function computeChecklistProgress(
|
|||||||
return { total, completed, percent };
|
return { total, completed, percent };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterChecklistRowsByReviewStep(
|
|
||||||
rows: CklstRvwRsltTreeDto[],
|
|
||||||
reviewStep: ReviewStepCode,
|
|
||||||
): CklstRvwRsltTreeDto[] {
|
|
||||||
return rows.filter((row) => row.rvwStpComCd === reviewStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function computeReviewStepChecklistProgress(
|
export function computeReviewStepChecklistProgress(
|
||||||
rows: CklstRvwRsltTreeDto[],
|
rows: CklstRvwRsltTreeDto[],
|
||||||
results: ChecklistFormState["results"],
|
results: ChecklistFormState["results"],
|
||||||
@@ -93,23 +76,6 @@ export function computeReviewStepChecklistProgress(
|
|||||||
return { total, completed, percent };
|
return { total, completed, percent };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildChecklistFormState(rows: CklstRvwRsltTreeDto[]): ChecklistFormState {
|
|
||||||
const results: ChecklistFormState["results"] = {};
|
|
||||||
const comments: ChecklistFormState["comments"] = {};
|
|
||||||
rows.forEach((row) => {
|
|
||||||
const key = buildChecklistRowKey(row);
|
|
||||||
if (row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N") {
|
|
||||||
results[key] = row.rvwRsltAnmlyYn;
|
|
||||||
}
|
|
||||||
if (row.picRvwCn) comments[key] = row.picRvwCn;
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
results,
|
|
||||||
comments,
|
|
||||||
progress: computeChecklistProgress(rows, results),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function mergeChecklistFormStateFromServer(
|
export function mergeChecklistFormStateFromServer(
|
||||||
prev: ChecklistFormState,
|
prev: ChecklistFormState,
|
||||||
allRows: CklstRvwRsltTreeDto[],
|
allRows: CklstRvwRsltTreeDto[],
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export const fnrsCnsltnRegistSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1, "설계자 이메일은 필수입니다")
|
.min(1, "설계자 이메일은 필수입니다")
|
||||||
.email("올바른 이메일 형식이 아닙니다"),
|
.email("올바른 이메일 형식이 아닙니다"),
|
||||||
sido: z.string().optional(),
|
sido: z.string().nullish(),
|
||||||
gugun: z.string().optional(),
|
gugun: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
bzScaleList: z.array(
|
bzScaleList: z.array(
|
||||||
fnrsCnsltnBzScaleItemSchema.extend({
|
fnrsCnsltnBzScaleItemSchema.extend({
|
||||||
@@ -36,7 +36,7 @@ export const fnrsCnsltnRegistSchema = z.object({
|
|||||||
bscPl: z.number(),
|
bscPl: z.number(),
|
||||||
budgetReflct: z.number(),
|
budgetReflct: z.number(),
|
||||||
thtiDsgn: z.number(),
|
thtiDsgn: z.number(),
|
||||||
diff: z.number().optional(),
|
diff: z.number().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
bizCstList: z.array(
|
bizCstList: z.array(
|
||||||
@@ -52,8 +52,8 @@ export const fnrsCnsltnRegistSchema = z.object({
|
|||||||
fnrsSharSeCd: z.string(),
|
fnrsSharSeCd: z.string(),
|
||||||
exstnAmt: z.number(),
|
exstnAmt: z.number(),
|
||||||
chgRqtAmt: z.number(),
|
chgRqtAmt: z.number(),
|
||||||
ajmtAmt: z.number().optional(),
|
ajmtAmt: z.number().nullish(),
|
||||||
rmrkCn: z.string().optional(),
|
rmrkCn: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
cklstResultList: z.array(
|
cklstResultList: z.array(
|
||||||
@@ -74,7 +74,7 @@ export const fnrsCnsltnRegistSchema = z.object({
|
|||||||
splmntDmndList: z.array(
|
splmntDmndList: z.array(
|
||||||
fnrsCnsltnSplmntDmndItemSchema.extend({
|
fnrsCnsltnSplmntDmndItemSchema.extend({
|
||||||
splmntArtclCdNm: z.string().nullish(),
|
splmntArtclCdNm: z.string().nullish(),
|
||||||
splmntDmndAtchFileNm: z.string().optional(),
|
splmntDmndAtchFileNm: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
privacyConsent: z.enum(["Y", "N"], {
|
privacyConsent: z.enum(["Y", "N"], {
|
||||||
@@ -88,7 +88,7 @@ export function formatTaskSeComCdForApi(taskSeComCd: string[]): string {
|
|||||||
return taskSeComCd.join(",");
|
return taskSeComCd.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseTaskSeComCdFromApi(taskSeComCd?: string): string[] {
|
export function parseTaskSeComCdFromApi(taskSeComCd?: string | null): string[] {
|
||||||
if (!taskSeComCd) return [];
|
if (!taskSeComCd) return [];
|
||||||
return taskSeComCd.split(",").filter(Boolean);
|
return taskSeComCd.split(",").filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const pwrkCnsltnDocEvlFormSchema = z.object({
|
|||||||
required_error: "만족도를 선택해 주세요.",
|
required_error: "만족도를 선택해 주세요.",
|
||||||
invalid_type_error: "만족도를 선택해 주세요.",
|
invalid_type_error: "만족도를 선택해 주세요.",
|
||||||
}),
|
}),
|
||||||
pwrkCnsltnDocEvlCn: z.string().max(2000).optional(),
|
pwrkCnsltnDocEvlCn: z.string().max(2000).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type PwrkCnsltnDocEvlFormValues = z.infer<typeof pwrkCnsltnDocEvlFormSchema>;
|
export type PwrkCnsltnDocEvlFormValues = z.infer<typeof pwrkCnsltnDocEvlFormSchema>;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PBADMS_PROGRESS_ORDER,
|
PBADMS_PROGRESS_ORDER,
|
||||||
REVIEW_STEP_CODES,
|
REVIEW_STEP_CODES,
|
||||||
@@ -28,6 +30,25 @@ export function getVisibleReviewSteps(
|
|||||||
return REVIEW_STEP_CODES.slice(0, count);
|
return REVIEW_STEP_CODES.slice(0, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolveVisibleReviewSteps(
|
||||||
|
prgrsSttsComCd: string,
|
||||||
|
userRoleCode: string | undefined,
|
||||||
|
cklstResultList: CklstRvwRsltTreeDto[],
|
||||||
|
): ReviewStepCode[] {
|
||||||
|
const byProgressAndRole = getVisibleReviewSteps(prgrsSttsComCd, userRoleCode);
|
||||||
|
const currentStep = byProgressAndRole.at(-1);
|
||||||
|
const stepsWithData = new Set<ReviewStepCode>();
|
||||||
|
|
||||||
|
for (const row of cklstResultList) {
|
||||||
|
const step = row.rvwStpComCd as ReviewStepCode | undefined;
|
||||||
|
if (step && REVIEW_STEP_CODES.includes(step)) stepsWithData.add(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
return REVIEW_STEP_CODES.filter(
|
||||||
|
(step) => stepsWithData.has(step) || step === currentStep,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function getEditableReviewStep(
|
export function getEditableReviewStep(
|
||||||
dtlInstCd?: string,
|
dtlInstCd?: string,
|
||||||
prgrsSttsComCd?: string,
|
prgrsSttsComCd?: string,
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ function getBadgeColor(state: BadgeState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatOptional(value: string | undefined) {
|
function formatOptional(value: string | null | undefined) {
|
||||||
return value?.trim() ? value : "-";
|
return value?.trim() ? value : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,14 @@ export interface ChecklistFormState {
|
|||||||
progress: ChecklistProgress;
|
progress: ChecklistProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ChecklistStepMap = Record<ReviewStepCode, CklstRvwRsltTreeDto[]>;
|
|
||||||
|
|
||||||
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||||
|
|
||||||
|
export const CHECKLIST_TAB_LABELS: Record<ReviewStepCode, string> = {
|
||||||
|
LOCAL: "자가체크",
|
||||||
|
ENV: "기술검토",
|
||||||
|
KECO: "환경청검토",
|
||||||
|
};
|
||||||
|
|
||||||
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
||||||
LOCAL: "지자체",
|
LOCAL: "지자체",
|
||||||
ENV: "환경청",
|
ENV: "환경청",
|
||||||
|
|||||||
@@ -180,7 +180,9 @@ function FloatingActionButtons({
|
|||||||
userInfo?.userUnqId,
|
userInfo?.userUnqId,
|
||||||
);
|
);
|
||||||
const viewOnlyPwrkCnsltnDoc =
|
const viewOnlyPwrkCnsltnDoc =
|
||||||
prgrsSttsComCd === "SL" || (prgrsSttsComCd === "RB" && dtlInstCd !== "ROLE_USER05");
|
prgrsSttsComCd === "SL" ||
|
||||||
|
(prgrsSttsComCd === "RB" && dtlInstCd !== "ROLE_USER05") ||
|
||||||
|
(prgrsSttsComCd === "RK" && dtlInstCd === "ROLE_USER03");
|
||||||
|
|
||||||
const actionButtons = useMemo(() => {
|
const actionButtons = useMemo(() => {
|
||||||
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ function PwrkCnsltnDocEvlDialog({ open, pwrkCnsltnDocNo, onClose }: PwrkCnsltnDo
|
|||||||
<Textarea
|
<Textarea
|
||||||
id="pwrkCnsltnDocEvlCn"
|
id="pwrkCnsltnDocEvlCn"
|
||||||
rows={4}
|
rows={4}
|
||||||
placeholder="의견을 입력해 주세요 (선택)"
|
placeholder="의견을 입력해 주세요"
|
||||||
|
className="!text-xl"
|
||||||
{...register("pwrkCnsltnDocEvlCn")}
|
{...register("pwrkCnsltnDocEvlCn")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
fnrsCnsltnMngService,
|
fnrsCnsltnMngService,
|
||||||
} from "@/entities/fnrs-cnsltn";
|
} from "@/entities/fnrs-cnsltn";
|
||||||
import { useFnrsSharSeMngTree } from "@/entities/fnrs-shar-se";
|
import { useFnrsSharSeMngTree } from "@/entities/fnrs-shar-se";
|
||||||
|
import { findCompletedPwrkDraft, usePwrkCnsltnMngByUpDocNo } from "@/entities/pwrk-cnsltn-mng";
|
||||||
import {
|
import {
|
||||||
AttachmentsFormSection,
|
AttachmentsFormSection,
|
||||||
buildAcntgCostItems,
|
buildAcntgCostItems,
|
||||||
@@ -35,7 +36,10 @@ import {
|
|||||||
} from "@/widgets/pbadms-sprt";
|
} from "@/widgets/pbadms-sprt";
|
||||||
import { Button } from "@common/components";
|
import { Button } from "@common/components";
|
||||||
|
|
||||||
import { type FnrsCnsltnRegistFormData, fnrsCnsltnRegistSchema } from "../lib/fnrs-cnsltn-regist-schema";
|
import {
|
||||||
|
type FnrsCnsltnRegistFormData,
|
||||||
|
fnrsCnsltnRegistSchema,
|
||||||
|
} from "../lib/fnrs-cnsltn-regist-schema";
|
||||||
import {
|
import {
|
||||||
buildFormPayload,
|
buildFormPayload,
|
||||||
getCreateDefaultValues,
|
getCreateDefaultValues,
|
||||||
@@ -68,6 +72,12 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
const isSplmntPrgrsStts = initialData?.detDto?.prgrsSttsComCd === "SL";
|
const isSplmntPrgrsStts = initialData?.detDto?.prgrsSttsComCd === "SL";
|
||||||
const fnrsCnsltnDocNo = initialData?.detDto?.fnrsCnsltnDocNo;
|
const fnrsCnsltnDocNo = initialData?.detDto?.fnrsCnsltnDocNo;
|
||||||
|
|
||||||
|
const { data: pwrkCnsltnData } = usePwrkCnsltnMngByUpDocNo(
|
||||||
|
fnrsCnsltnDocNo,
|
||||||
|
isSplmntPrgrsStts && Boolean(fnrsCnsltnDocNo),
|
||||||
|
);
|
||||||
|
const hasCompletedDraft = Boolean(findCompletedPwrkDraft(pwrkCnsltnData));
|
||||||
|
|
||||||
const { data: masterSharTree = [] } = useFnrsSharSeMngTree();
|
const { data: masterSharTree = [] } = useFnrsSharSeMngTree();
|
||||||
const { data: acntgTree = [] } = useAcntgSeMngTree();
|
const { data: acntgTree = [] } = useAcntgSeMngTree();
|
||||||
const { data: essentialFiles = [] } = useEsntlAtchFileMngTree({ docSeComCd: "FNRS" });
|
const { data: essentialFiles = [] } = useEsntlAtchFileMngTree({ docSeComCd: "FNRS" });
|
||||||
@@ -126,7 +136,7 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
(item) => !item.splmntCn || !item.splmntCn.trim(),
|
(item) => !item.splmntCn || !item.splmntCn.trim(),
|
||||||
);
|
);
|
||||||
if (hasEmptySplmntCn) {
|
if (hasEmptySplmntCn) {
|
||||||
alert("보완요청내용이 있습니다. 보완 완료내용을 입력해 주세요.");
|
alert("보완 요청 내용이 있습니다.\n보완 완료 내용을 입력해 주세요.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +184,11 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
async function onApply(data: FnrsCnsltnRegistFormData) {
|
async function onApply(data: FnrsCnsltnRegistFormData) {
|
||||||
if (isSubmitting) return;
|
if (isSubmitting) return;
|
||||||
|
|
||||||
|
if (data.privacyConsent !== "Y") {
|
||||||
|
alert("개인정보 수집/이용에 동의해야 신청이 가능합니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isFormChecklistComplete(data.cklstResultList)) {
|
if (!isFormChecklistComplete(data.cklstResultList)) {
|
||||||
alert("모든 체크리스트 항목을 체크해야 신청이 가능합니다.");
|
alert("모든 체크리스트 항목을 체크해야 신청이 가능합니다.");
|
||||||
return;
|
return;
|
||||||
@@ -260,7 +275,10 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
initialEsntlFiles={isEditMode ? initialData?.esntlFileList : undefined}
|
initialEsntlFiles={isEditMode ? initialData?.esntlFileList : undefined}
|
||||||
initialEtcFiles={isEditMode ? initialData?.etcFileList : 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="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">
|
<div className="mx-4 flex flex-wrap justify-center gap-3 sm:gap-4">
|
||||||
@@ -300,7 +318,7 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{fnrsCnsltnDocNo ? (
|
{hasCompletedDraft ? (
|
||||||
<Button
|
<Button
|
||||||
color="orange"
|
color="orange"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -324,7 +342,7 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
</div>
|
</div>
|
||||||
</SectionCollapsibleGroup>
|
</SectionCollapsibleGroup>
|
||||||
</form>
|
</form>
|
||||||
{fnrsCnsltnDocNo ? (
|
{hasCompletedDraft && fnrsCnsltnDocNo ? (
|
||||||
<PwrkCnsltnDocMngDialog
|
<PwrkCnsltnDocMngDialog
|
||||||
open={isPwrkCnsltnDocMngOpen}
|
open={isPwrkCnsltnDocMngOpen}
|
||||||
fnrsCnsltnDocNo={fnrsCnsltnDocNo}
|
fnrsCnsltnDocNo={fnrsCnsltnDocNo}
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import {
|
|||||||
} from "@/widgets/pbadms-sprt";
|
} from "@/widgets/pbadms-sprt";
|
||||||
import { Skeleton } from "@common/components";
|
import { Skeleton } from "@common/components";
|
||||||
|
|
||||||
import { getAiPendingMessage, isAiPendingStatus, isRagIndexingInProgress } from "../lib/ai-pending-utils";
|
import {
|
||||||
|
getAiPendingMessage,
|
||||||
|
isAiPendingStatus,
|
||||||
|
isRagIndexingInProgress,
|
||||||
|
} from "../lib/ai-pending-utils";
|
||||||
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
|
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
|
||||||
import { getEditableReviewStep } from "../lib/review-step-utils";
|
import { getEditableReviewStep } from "../lib/review-step-utils";
|
||||||
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
extractTaskCodes,
|
extractTaskCodes,
|
||||||
getChecklistDisplayRows,
|
getChecklistDisplayRows,
|
||||||
} from "../../lib/checklist-utils";
|
} from "../../lib/checklist-utils";
|
||||||
import { getVisibleReviewSteps } from "../../lib/review-step-utils";
|
import { resolveVisibleReviewSteps } from "../../lib/review-step-utils";
|
||||||
import type { ReviewStepCode } from "../../model/view-types";
|
import type { ReviewStepCode } from "../../model/view-types";
|
||||||
import {
|
import {
|
||||||
|
CHECKLIST_TAB_LABELS,
|
||||||
type ChecklistFormState,
|
type ChecklistFormState,
|
||||||
REVIEW_STEP_LABELS,
|
|
||||||
ROLE_TO_REVIEW_STEP,
|
ROLE_TO_REVIEW_STEP,
|
||||||
TASK_CODE_LABELS,
|
TASK_CODE_LABELS,
|
||||||
} from "../../model/view-types";
|
} from "../../model/view-types";
|
||||||
@@ -37,8 +37,8 @@ function ChecklistSection({
|
|||||||
setFormState,
|
setFormState,
|
||||||
}: ChecklistSectionProps) {
|
}: ChecklistSectionProps) {
|
||||||
const visibleReviewSteps = useMemo(
|
const visibleReviewSteps = useMemo(
|
||||||
() => getVisibleReviewSteps(prgrsSttsComCd, userRoleCode),
|
() => resolveVisibleReviewSteps(prgrsSttsComCd, userRoleCode, cklstResultList),
|
||||||
[prgrsSttsComCd, userRoleCode],
|
[prgrsSttsComCd, userRoleCode, cklstResultList],
|
||||||
);
|
);
|
||||||
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ function ChecklistSection({
|
|||||||
<TabsList>
|
<TabsList>
|
||||||
{visibleReviewSteps.map((stepCode) => (
|
{visibleReviewSteps.map((stepCode) => (
|
||||||
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
||||||
{REVIEW_STEP_LABELS[stepCode]}
|
{CHECKLIST_TAB_LABELS[stepCode]}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export const instlSncnRegistSchema = z.object({
|
|||||||
splmntDmndList: z.array(
|
splmntDmndList: z.array(
|
||||||
instlSncnSplmntDmndItemSchema.extend({
|
instlSncnSplmntDmndItemSchema.extend({
|
||||||
splmntArtclCdNm: z.string().nullish(),
|
splmntArtclCdNm: z.string().nullish(),
|
||||||
splmntDmndAtchFileNm: z.string().optional(),
|
splmntDmndAtchFileNm: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
privacyConsent: z.enum(["Y", "N"], {
|
privacyConsent: z.enum(["Y", "N"], {
|
||||||
@@ -82,7 +82,7 @@ export function formatTaskSeComCdForApi(taskSeComCd: string[]): string {
|
|||||||
return taskSeComCd.join(",");
|
return taskSeComCd.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseTaskSeComCdFromApi(taskSeComCd?: string): string[] {
|
export function parseTaskSeComCdFromApi(taskSeComCd?: string | null): string[] {
|
||||||
if (!taskSeComCd) return [];
|
if (!taskSeComCd) return [];
|
||||||
return taskSeComCd.split(",").filter(Boolean);
|
return taskSeComCd.split(",").filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ReviewStepCode } from "@/entities/instl-sncn";
|
import type { CklstRvwRsltTreeDto, ReviewStepCode } from "@/entities/instl-sncn";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
INSTL_PROGRESS_ORDER,
|
INSTL_PROGRESS_ORDER,
|
||||||
@@ -27,6 +27,25 @@ export function getVisibleReviewSteps(
|
|||||||
return REVIEW_STEP_CODES.slice(0, count);
|
return REVIEW_STEP_CODES.slice(0, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolveVisibleReviewSteps(
|
||||||
|
prgrsSttsComCd: string,
|
||||||
|
userRoleCode: string | undefined,
|
||||||
|
cklstResultList: CklstRvwRsltTreeDto[],
|
||||||
|
): ReviewStepCode[] {
|
||||||
|
const byProgressAndRole = getVisibleReviewSteps(prgrsSttsComCd, userRoleCode);
|
||||||
|
const currentStep = byProgressAndRole.at(-1);
|
||||||
|
const stepsWithData = new Set<ReviewStepCode>();
|
||||||
|
|
||||||
|
for (const row of cklstResultList) {
|
||||||
|
const step = row.rvwStpComCd as ReviewStepCode | undefined;
|
||||||
|
if (step && REVIEW_STEP_CODES.includes(step)) stepsWithData.add(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
return REVIEW_STEP_CODES.filter(
|
||||||
|
(step) => stepsWithData.has(step) || step === currentStep,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function getEditableReviewStep(
|
export function getEditableReviewStep(
|
||||||
dtlInstCd?: string,
|
dtlInstCd?: string,
|
||||||
prgrsSttsComCd?: string,
|
prgrsSttsComCd?: string,
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import type {
|
|||||||
ReviewStepCode,
|
ReviewStepCode,
|
||||||
} from "@/entities/instl-sncn";
|
} from "@/entities/instl-sncn";
|
||||||
import { instlSncnApplySaveSchema } from "@/entities/instl-sncn";
|
import { instlSncnApplySaveSchema } from "@/entities/instl-sncn";
|
||||||
import { type SplmntDmndDialogConfirmPayload, toEsntlAtchFileSaveList } from "@/widgets/pbadms-sprt";
|
import {
|
||||||
|
type SplmntDmndDialogConfirmPayload,
|
||||||
|
toEsntlAtchFileSaveList,
|
||||||
|
} from "@/widgets/pbadms-sprt";
|
||||||
|
|
||||||
import type { ChecklistFormState } from "../model/view-types";
|
import type { ChecklistFormState } from "../model/view-types";
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function getBadgeColor(state: BadgeState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatOptional(value: string | undefined) {
|
function formatOptional(value: string | null | undefined) {
|
||||||
return value?.trim() ? value : "-";
|
return value?.trim() ? value : "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ export type ChecklistStepMap = Record<ReviewStepCode, CklstRvwRsltTreeDto[]>;
|
|||||||
|
|
||||||
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||||
|
|
||||||
|
export const CHECKLIST_TAB_LABELS: Record<ReviewStepCode, string> = {
|
||||||
|
LOCAL: "자가체크",
|
||||||
|
ENV: "기술검토",
|
||||||
|
KECO: "환경청검토",
|
||||||
|
};
|
||||||
|
|
||||||
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
||||||
LOCAL: "지자체",
|
LOCAL: "지자체",
|
||||||
ENV: "환경청",
|
ENV: "환경청",
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import {
|
|||||||
extractTaskCodes,
|
extractTaskCodes,
|
||||||
getChecklistDisplayRows,
|
getChecklistDisplayRows,
|
||||||
} from "../../lib/checklist-utils";
|
} from "../../lib/checklist-utils";
|
||||||
import { getVisibleReviewSteps } from "../../lib/review-step-utils";
|
import { resolveVisibleReviewSteps } from "../../lib/review-step-utils";
|
||||||
import {
|
import {
|
||||||
|
CHECKLIST_TAB_LABELS,
|
||||||
type ChecklistFormState,
|
type ChecklistFormState,
|
||||||
REVIEW_STEP_LABELS,
|
|
||||||
ROLE_TO_REVIEW_STEP,
|
ROLE_TO_REVIEW_STEP,
|
||||||
TASK_CODE_LABELS,
|
TASK_CODE_LABELS,
|
||||||
} from "../../model/view-types";
|
} from "../../model/view-types";
|
||||||
@@ -36,8 +36,8 @@ function ChecklistSection({
|
|||||||
setFormState,
|
setFormState,
|
||||||
}: ChecklistSectionProps) {
|
}: ChecklistSectionProps) {
|
||||||
const visibleReviewSteps = useMemo(
|
const visibleReviewSteps = useMemo(
|
||||||
() => getVisibleReviewSteps(prgrsSttsComCd, userRoleCode),
|
() => resolveVisibleReviewSteps(prgrsSttsComCd, userRoleCode, cklstResultList),
|
||||||
[prgrsSttsComCd, userRoleCode],
|
[prgrsSttsComCd, userRoleCode, cklstResultList],
|
||||||
);
|
);
|
||||||
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ function ChecklistSection({
|
|||||||
<TabsList>
|
<TabsList>
|
||||||
{visibleReviewSteps.map((stepCode) => (
|
{visibleReviewSteps.map((stepCode) => (
|
||||||
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
||||||
{REVIEW_STEP_LABELS[stepCode]}
|
{CHECKLIST_TAB_LABELS[stepCode]}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { type CostItemDef, roundAmount } from "@/widgets/pbadms-sprt";
|
import { type CostItemDef, roundAmount } from "@/widgets/pbadms-sprt";
|
||||||
|
|
||||||
import { type BizCstMatrixItem,getAmt, PLAN_STEPS } from "./biz-cst-matrix-utils";
|
import { type BizCstMatrixItem, getAmt, PLAN_STEPS } from "./biz-cst-matrix-utils";
|
||||||
|
|
||||||
export interface FnrsCstItem {
|
export interface FnrsCstItem {
|
||||||
planStpNo: number;
|
planStpNo: number;
|
||||||
gvexpAmt?: number;
|
gvexpAmt?: number | null;
|
||||||
lcexpAmt?: number;
|
lcexpAmt?: number | null;
|
||||||
orgprBdchgAmt?: number;
|
orgprBdchgAmt?: number | null;
|
||||||
etcAmt?: number;
|
etcAmt?: number | null;
|
||||||
sumAmt?: number;
|
sumAmt?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FnrsCstStepRemaining {
|
export interface FnrsCstStepRemaining {
|
||||||
@@ -32,10 +32,7 @@ function getBizCstStepTotal(
|
|||||||
|
|
||||||
function sumFnrsCstLeaf(item: FnrsCstItem): number {
|
function sumFnrsCstLeaf(item: FnrsCstItem): number {
|
||||||
return roundAmount(
|
return roundAmount(
|
||||||
(item.gvexpAmt ?? 0) +
|
(item.gvexpAmt ?? 0) + (item.lcexpAmt ?? 0) + (item.orgprBdchgAmt ?? 0) + (item.etcAmt ?? 0),
|
||||||
(item.lcexpAmt ?? 0) +
|
|
||||||
(item.orgprBdchgAmt ?? 0) +
|
|
||||||
(item.etcAmt ?? 0),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { CklstRvwRsltTreeDto } from "@/entities/sewer-bsc-plan";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PBADMS_PROGRESS_ORDER,
|
PBADMS_PROGRESS_ORDER,
|
||||||
REVIEW_STEP_CODES,
|
REVIEW_STEP_CODES,
|
||||||
@@ -28,6 +30,25 @@ export function getVisibleReviewSteps(
|
|||||||
return REVIEW_STEP_CODES.slice(0, count);
|
return REVIEW_STEP_CODES.slice(0, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolveVisibleReviewSteps(
|
||||||
|
prgrsSttsComCd: string,
|
||||||
|
userRoleCode: string | undefined,
|
||||||
|
cklstResultList: CklstRvwRsltTreeDto[],
|
||||||
|
): ReviewStepCode[] {
|
||||||
|
const byProgressAndRole = getVisibleReviewSteps(prgrsSttsComCd, userRoleCode);
|
||||||
|
const currentStep = byProgressAndRole.at(-1);
|
||||||
|
const stepsWithData = new Set<ReviewStepCode>();
|
||||||
|
|
||||||
|
for (const row of cklstResultList) {
|
||||||
|
const step = row.rvwStpComCd as ReviewStepCode | undefined;
|
||||||
|
if (step && REVIEW_STEP_CODES.includes(step)) stepsWithData.add(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
return REVIEW_STEP_CODES.filter(
|
||||||
|
(step) => stepsWithData.has(step) || step === currentStep,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function getEditableReviewStep(
|
export function getEditableReviewStep(
|
||||||
dtlInstCd?: string,
|
dtlInstCd?: string,
|
||||||
prgrsSttsComCd?: string,
|
prgrsSttsComCd?: string,
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ import {
|
|||||||
export const sewerBscPlanRegistSchema = z.object({
|
export const sewerBscPlanRegistSchema = z.object({
|
||||||
sewerBscPlan: sewerBscPlanSaveSchema.extend({
|
sewerBscPlan: sewerBscPlanSaveSchema.extend({
|
||||||
sewerBscPlanNm: z.string().min(1, "기본계획명은 필수입니다"),
|
sewerBscPlanNm: z.string().min(1, "기본계획명은 필수입니다"),
|
||||||
sewerBscPlanSeCdNm: z.string().optional(),
|
sewerBscPlanSeCdNm: z.string().nullish(),
|
||||||
taskSeCdNm: z.string().optional(),
|
taskSeCdNm: z.string().nullish(),
|
||||||
sido: z.string().optional(),
|
sido: z.string().nullish(),
|
||||||
gugun: z.string().nullish(),
|
gugun: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
sewerBscPlanDtl: sewerBscPlanDtlSaveSchema.extend({
|
sewerBscPlanDtl: sewerBscPlanDtlSaveSchema.extend({
|
||||||
@@ -61,7 +61,7 @@ export const sewerBscPlanRegistSchema = z.object({
|
|||||||
sewerBscPlanTmplntItemSchema.extend({
|
sewerBscPlanTmplntItemSchema.extend({
|
||||||
swtrmtFcltCd: z.string(),
|
swtrmtFcltCd: z.string(),
|
||||||
swtrmtFcltNm: z.string().nullish(),
|
swtrmtFcltNm: z.string().nullish(),
|
||||||
atchFileNm: z.string().optional(),
|
atchFileNm: z.string().nullish(),
|
||||||
sewerBscPlanTmplntDtlList: z
|
sewerBscPlanTmplntDtlList: z
|
||||||
.array(
|
.array(
|
||||||
sewerBscPlanTmplntDtlItemSchema.extend({
|
sewerBscPlanTmplntDtlItemSchema.extend({
|
||||||
@@ -69,7 +69,7 @@ export const sewerBscPlanRegistSchema = z.object({
|
|||||||
swtrmtFcltCd: z.string(),
|
swtrmtFcltCd: z.string(),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.optional(),
|
.nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
cklstResultList: z.array(
|
cklstResultList: z.array(
|
||||||
@@ -78,7 +78,7 @@ export const sewerBscPlanRegistSchema = z.object({
|
|||||||
cklstArtclSn: z.number(),
|
cklstArtclSn: z.number(),
|
||||||
cklstRvwSn: z.number(),
|
cklstRvwSn: z.number(),
|
||||||
selected: z.enum(["Y", "N"]).nullish(),
|
selected: z.enum(["Y", "N"]).nullish(),
|
||||||
picRvwCn: z.string().nullable().optional(),
|
picRvwCn: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
esntlAtchFileList: z.array(
|
esntlAtchFileList: z.array(
|
||||||
@@ -90,9 +90,9 @@ export const sewerBscPlanRegistSchema = z.object({
|
|||||||
splmntDmndList: z.array(
|
splmntDmndList: z.array(
|
||||||
sewerBscPlanSplmntDmndItemSchema.extend({
|
sewerBscPlanSplmntDmndItemSchema.extend({
|
||||||
splmntArtclCdNm: z.string().nullish(),
|
splmntArtclCdNm: z.string().nullish(),
|
||||||
splmntDmndAtchFileNm: z.string().optional(),
|
splmntDmndAtchFileNm: z.string().nullish(),
|
||||||
splmntAtchFileNm: z.string().optional(),
|
splmntAtchFileNm: z.string().nullish(),
|
||||||
splmntAtchFileAtflId: z.string().optional(),
|
splmntAtchFileAtflId: z.string().nullish(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
privacyConsent: z.enum(["Y", "N"], {
|
privacyConsent: z.enum(["Y", "N"], {
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export type ChecklistStepMap = Record<ReviewStepCode, CklstRvwRsltTreeDto[]>;
|
|||||||
|
|
||||||
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||||
|
|
||||||
|
export const CHECKLIST_TAB_LABELS: Record<ReviewStepCode, string> = {
|
||||||
|
LOCAL: "자가체크",
|
||||||
|
ENV: "기술검토",
|
||||||
|
KECO: "환경청검토",
|
||||||
|
};
|
||||||
|
|
||||||
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
||||||
LOCAL: "지자체",
|
LOCAL: "지자체",
|
||||||
ENV: "환경청",
|
ENV: "환경청",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ interface PreviousPlanLookupDialogProps {
|
|||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
/** 부모 폼 `sewerBscPlan.sido` 표시명 */
|
/** 부모 폼 `sewerBscPlan.sido` 표시명 */
|
||||||
initialSidoNm?: string;
|
initialSidoNm?: string | null;
|
||||||
/** 부모 폼 `sewerBscPlan.gugun` 표시명 */
|
/** 부모 폼 `sewerBscPlan.gugun` 표시명 */
|
||||||
initialGugunNm?: string | null;
|
initialGugunNm?: string | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
extractTaskCodes,
|
extractTaskCodes,
|
||||||
getChecklistDisplayRows,
|
getChecklistDisplayRows,
|
||||||
} from "../../lib/checklist-utils";
|
} from "../../lib/checklist-utils";
|
||||||
import { getVisibleReviewSteps } from "../../lib/review-step-utils";
|
import { resolveVisibleReviewSteps } from "../../lib/review-step-utils";
|
||||||
import type { ReviewStepCode } from "../../model/view-types";
|
import type { ReviewStepCode } from "../../model/view-types";
|
||||||
import {
|
import {
|
||||||
|
CHECKLIST_TAB_LABELS,
|
||||||
type ChecklistFormState,
|
type ChecklistFormState,
|
||||||
REVIEW_STEP_LABELS,
|
|
||||||
ROLE_TO_REVIEW_STEP,
|
ROLE_TO_REVIEW_STEP,
|
||||||
TASK_CODE_LABELS,
|
TASK_CODE_LABELS,
|
||||||
} from "../../model/view-types";
|
} from "../../model/view-types";
|
||||||
@@ -37,8 +37,8 @@ function ChecklistSection({
|
|||||||
setFormState,
|
setFormState,
|
||||||
}: ChecklistSectionProps) {
|
}: ChecklistSectionProps) {
|
||||||
const visibleReviewSteps = useMemo(
|
const visibleReviewSteps = useMemo(
|
||||||
() => getVisibleReviewSteps(prgrsSttsComCd, userRoleCode),
|
() => resolveVisibleReviewSteps(prgrsSttsComCd, userRoleCode, cklstResultList),
|
||||||
[prgrsSttsComCd, userRoleCode],
|
[prgrsSttsComCd, userRoleCode, cklstResultList],
|
||||||
);
|
);
|
||||||
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ function ChecklistSection({
|
|||||||
<TabsList>
|
<TabsList>
|
||||||
{visibleReviewSteps.map((stepCode) => (
|
{visibleReviewSteps.map((stepCode) => (
|
||||||
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
||||||
{REVIEW_STEP_LABELS[stepCode]}
|
{CHECKLIST_TAB_LABELS[stepCode]}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
))}
|
))}
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|||||||
@@ -214,8 +214,8 @@ function TmplntFacilityMatrix({
|
|||||||
interface TmplntFacilityAttachmentsProps {
|
interface TmplntFacilityAttachmentsProps {
|
||||||
facilityIndex: number;
|
facilityIndex: number;
|
||||||
facilityName?: string;
|
facilityName?: string;
|
||||||
atchFileGroupId?: string;
|
atchFileGroupId?: string | null;
|
||||||
atchFileNm?: string;
|
atchFileNm?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TmplntFacilityAttachments({
|
function TmplntFacilityAttachments({
|
||||||
|
|||||||
@@ -205,14 +205,14 @@ export interface EsntlAtchFileSaveBase {
|
|||||||
export interface SplmntDmndSaveBase {
|
export interface SplmntDmndSaveBase {
|
||||||
splmntDmndSn?: number | null;
|
splmntDmndSn?: number | null;
|
||||||
splmntArtclComCd?: string | null;
|
splmntArtclComCd?: string | null;
|
||||||
splmntDmndCn?: string;
|
splmntDmndCn?: string | null;
|
||||||
splmntDmndDt?: string;
|
splmntDmndDt?: string | null;
|
||||||
splmntDmndAtchFileGroupId?: string;
|
splmntDmndAtchFileGroupId?: string | null;
|
||||||
splmntCn?: string;
|
splmntCn?: string | null;
|
||||||
splmntPicNm?: string;
|
splmntPicNm?: string | null;
|
||||||
splmntCmptnDt?: string;
|
splmntCmptnDt?: string | null;
|
||||||
splmntAtchFileGroupId?: string;
|
splmntAtchFileGroupId?: string | null;
|
||||||
cmptnYn?: string;
|
cmptnYn?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 검토의견 저장 공통 필드 (문서번호 제외) */
|
/** 검토의견 저장 공통 필드 (문서번호 제외) */
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
interface CanEditPbadmsDocParams {
|
interface CanEditPbadmsDocParams {
|
||||||
docSeComCd: string;
|
docSeComCd: string;
|
||||||
prgrsSttsComCd: string | undefined;
|
prgrsSttsComCd?: string | null;
|
||||||
rgtr: string | undefined;
|
rgtr?: string | null;
|
||||||
loggedInUserUnqId: string | undefined;
|
loggedInUserUnqId?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canEditPbadmsDoc({
|
function canEditPbadmsDoc({
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ export interface FnrsSharListItem {
|
|||||||
fnrsSharSeCd: string;
|
fnrsSharSeCd: string;
|
||||||
exstnAmt: number;
|
exstnAmt: number;
|
||||||
chgRqtAmt: number;
|
chgRqtAmt: number;
|
||||||
ajmtAmt?: number;
|
ajmtAmt?: number | null;
|
||||||
rmrkCn?: string;
|
rmrkCn?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FnrsSharTreeNode = FnrsSharSeMngTreeDto | FnrsSharBizCstTreeDto;
|
export type FnrsSharTreeNode = FnrsSharSeMngTreeDto | FnrsSharBizCstTreeDto;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { Controller, useFormContext } from "react-hook-form";
|
import { useFormContext } from "react-hook-form";
|
||||||
|
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { Download } from "lucide-react";
|
import { Download } from "lucide-react";
|
||||||
@@ -78,7 +78,7 @@ function AttachmentsFormSection({
|
|||||||
initialEsntlFiles,
|
initialEsntlFiles,
|
||||||
initialEtcFiles,
|
initialEtcFiles,
|
||||||
}: AttachmentsFormSectionProps) {
|
}: AttachmentsFormSectionProps) {
|
||||||
const { control, getValues, setValue } = useFormContext<AttachmentsFormData>();
|
const { getValues, setValue } = useFormContext<AttachmentsFormData>();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [uploadedFiles, setUploadedFiles] = useState<Record<string, UploadedFileItem[]>>({});
|
const [uploadedFiles, setUploadedFiles] = useState<Record<string, UploadedFileItem[]>>({});
|
||||||
const [etcFiles, setEtcFiles] = useState<EtcFileItem[]>([]);
|
const [etcFiles, setEtcFiles] = useState<EtcFileItem[]>([]);
|
||||||
@@ -373,89 +373,83 @@ function AttachmentsFormSection({
|
|||||||
return (
|
return (
|
||||||
<SectionCollapsible title="첨부파일">
|
<SectionCollapsible title="첨부파일">
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<Controller
|
<div className="px-2">
|
||||||
name="esntlAtchFileList"
|
<h3 className="mb-4 text-xl font-semibold">필수 첨부파일</h3>
|
||||||
control={control}
|
<Table variant="secondary" className="table-fixed">
|
||||||
render={() => (
|
<colgroup>
|
||||||
<div className="px-2">
|
<col width="44%" />
|
||||||
<h3 className="mb-4 text-xl font-semibold">필수 첨부파일</h3>
|
<col width="12%" />
|
||||||
<Table variant="secondary" className="table-fixed">
|
<col width="44%" />
|
||||||
<colgroup>
|
</colgroup>
|
||||||
<col width="44%" />
|
<TableHeader>
|
||||||
<col width="12%" />
|
<TableRow>
|
||||||
<col width="44%" />
|
<TableHead className="w-[30rem]" align="left">
|
||||||
</colgroup>
|
파일명
|
||||||
<TableHeader>
|
</TableHead>
|
||||||
<TableRow>
|
<TableHead>파일 확장자</TableHead>
|
||||||
<TableHead className="w-[30rem]" align="left">
|
<TableHead>파일첨부</TableHead>
|
||||||
파일명
|
</TableRow>
|
||||||
</TableHead>
|
</TableHeader>
|
||||||
<TableHead>파일 확장자</TableHead>
|
<TableBody>
|
||||||
<TableHead>파일첨부</TableHead>
|
{essentialFiles.length === 0 ? (
|
||||||
</TableRow>
|
<TableRow>
|
||||||
</TableHeader>
|
<TableCell colSpan={4} className="py-12 text-center text-muted-foreground">
|
||||||
<TableBody>
|
조회된 필수 첨부파일 항목이 없습니다.
|
||||||
{essentialFiles.length === 0 ? (
|
</TableCell>
|
||||||
<TableRow>
|
</TableRow>
|
||||||
<TableCell colSpan={4} className="py-12 text-center text-muted-foreground">
|
) : (
|
||||||
조회된 필수 첨부파일 항목이 없습니다.
|
essentialFiles.map((file) => {
|
||||||
|
const atflCd = file.atchFileGroupId ?? "";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow key={file.esntlAtchFileId}>
|
||||||
|
<TableHead
|
||||||
|
className="group break-keep font-medium"
|
||||||
|
data-required={file.esntlAtchYn === "Y"}
|
||||||
|
align="left"
|
||||||
|
>
|
||||||
|
<div className="inline-flex w-[calc(100%-1rem)] items-center justify-between gap-10">
|
||||||
|
{file.esntlAtchFileNm}
|
||||||
|
{atflCd ? (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
color="white"
|
||||||
|
onClick={() => downloadTemplate(atflCd)}
|
||||||
|
>
|
||||||
|
<Download className="!size-5 shrink-0" />
|
||||||
|
양식내려받기
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</TableHead>
|
||||||
|
<TableCell align="center">{file.esntlAtchFileRmrk}</TableCell>
|
||||||
|
<TableCell className="space-y-2">
|
||||||
|
<AttachmentFileField
|
||||||
|
files={(uploadedFiles[file.esntlAtchFileId] ?? []).map((item) => ({
|
||||||
|
fileKey: item.fileKey,
|
||||||
|
fileName: item.file?.name ?? item.fileName,
|
||||||
|
onDownload: item.atflId
|
||||||
|
? () => downloadByAtflId(item.atflId!)
|
||||||
|
: undefined,
|
||||||
|
}))}
|
||||||
|
inputId={`${file.esntlAtchFileId}-file-input`}
|
||||||
|
isUploadingByKey={isUploading}
|
||||||
|
accept={toFileAccept(file.esntlAtchFileRmrk) || undefined}
|
||||||
|
onAdd={(fileList) =>
|
||||||
|
void handleEssentialFileUpload(file.esntlAtchFileId, fileList)
|
||||||
|
}
|
||||||
|
onRemove={(index) =>
|
||||||
|
void removeEssentialFile(file.esntlAtchFileId, index)
|
||||||
|
}
|
||||||
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
) : (
|
);
|
||||||
essentialFiles.map((file) => {
|
})
|
||||||
const atflCd = file.atchFileGroupId ?? "";
|
)}
|
||||||
|
</TableBody>
|
||||||
return (
|
</Table>
|
||||||
<TableRow key={file.esntlAtchFileId}>
|
</div>
|
||||||
<TableHead
|
|
||||||
className="group break-keep font-medium"
|
|
||||||
data-required={file.esntlAtchYn === "Y"}
|
|
||||||
align="left"
|
|
||||||
>
|
|
||||||
<div className="inline-flex w-[calc(100%-1rem)] items-center justify-between gap-10">
|
|
||||||
{file.esntlAtchFileNm}
|
|
||||||
{atflCd ? (
|
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
color="white"
|
|
||||||
onClick={() => downloadTemplate(atflCd)}
|
|
||||||
>
|
|
||||||
<Download className="!size-5 shrink-0" />
|
|
||||||
양식내려받기
|
|
||||||
</Button>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
</TableHead>
|
|
||||||
<TableCell align="center">{file.esntlAtchFileRmrk}</TableCell>
|
|
||||||
<TableCell className="space-y-2">
|
|
||||||
<AttachmentFileField
|
|
||||||
files={(uploadedFiles[file.esntlAtchFileId] ?? []).map((item) => ({
|
|
||||||
fileKey: item.fileKey,
|
|
||||||
fileName: item.file?.name ?? item.fileName,
|
|
||||||
onDownload: item.atflId
|
|
||||||
? () => downloadByAtflId(item.atflId!)
|
|
||||||
: undefined,
|
|
||||||
}))}
|
|
||||||
inputId={`${file.esntlAtchFileId}-file-input`}
|
|
||||||
isUploadingByKey={isUploading}
|
|
||||||
accept={toFileAccept(file.esntlAtchFileRmrk) || undefined}
|
|
||||||
onAdd={(fileList) =>
|
|
||||||
void handleEssentialFileUpload(file.esntlAtchFileId, fileList)
|
|
||||||
}
|
|
||||||
onRemove={(index) =>
|
|
||||||
void removeEssentialFile(file.esntlAtchFileId, index)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="px-2">
|
<div className="px-2">
|
||||||
<div className="mb-4 flex items-center justify-between">
|
<div className="mb-4 flex items-center justify-between">
|
||||||
|
|||||||
@@ -43,12 +43,13 @@ function AttachmentsViewSection({ esntlFileList, etcFileList }: AttachmentsViewS
|
|||||||
) : (
|
) : (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{files.map((file) => (
|
{files.map((file) => (
|
||||||
<AttachmentDownloadLink
|
<div key={file.atflId}>
|
||||||
key={file.atflId}
|
<AttachmentDownloadLink
|
||||||
atflId={file.atflId}
|
atflId={file.atflId}
|
||||||
fileName={file.orgnlFileNm || "다운로드"}
|
fileName={file.orgnlFileNm || "다운로드"}
|
||||||
className="items-center"
|
className="items-center"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo } from "react";
|
import { useEffect, useMemo } from "react";
|
||||||
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
import { useFormContext, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
import { SectionCollapsible } from "@/shared/ui";
|
import { SectionCollapsible } from "@/shared/ui";
|
||||||
import { Field } from "@/shared/ui/field";
|
import { Field } from "@/shared/ui/field";
|
||||||
@@ -31,6 +31,16 @@ interface BusinessCostFormData {
|
|||||||
|
|
||||||
type CostFieldKey = "bscPlanAmt" | "bgtRfltAmt" | "tstmDesignAmt";
|
type CostFieldKey = "bscPlanAmt" | "bgtRfltAmt" | "tstmDesignAmt";
|
||||||
|
|
||||||
|
function isSameBizCstCodes(
|
||||||
|
current: BusinessCostFormData["bizCstList"],
|
||||||
|
next: BusinessCostFormData["bizCstList"],
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
current.length === next.length &&
|
||||||
|
current.every((item, index) => item.acntgSeCd === next[index]?.acntgSeCd)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function BusinessCostFormSection() {
|
function BusinessCostFormSection() {
|
||||||
const { control, setValue, getValues } = useFormContext<BusinessCostFormData>();
|
const { control, setValue, getValues } = useFormContext<BusinessCostFormData>();
|
||||||
const bizCstList = useWatch({ control, name: "bizCstList" }) ?? [];
|
const bizCstList = useWatch({ control, name: "bizCstList" }) ?? [];
|
||||||
@@ -42,22 +52,22 @@ function BusinessCostFormSection() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (costItems.length === 0) return;
|
if (costItems.length === 0) return;
|
||||||
|
|
||||||
const existingMap = new Map(getValues("bizCstList").map((item) => [item.acntgSeCd, item]));
|
const current = getValues("bizCstList") ?? [];
|
||||||
|
const existingMap = new Map(current.map((item) => [item.acntgSeCd, item]));
|
||||||
|
const next = costItems.map((item) => {
|
||||||
|
const existing = existingMap.get(item.code);
|
||||||
|
if (existing) return existing;
|
||||||
|
|
||||||
setValue(
|
return {
|
||||||
"bizCstList",
|
acntgSeCd: item.code,
|
||||||
costItems.map((item) => {
|
bscPlanAmt: 0,
|
||||||
const existing = existingMap.get(item.code);
|
bgtRfltAmt: 0,
|
||||||
if (existing) return existing;
|
tstmDesignAmt: 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
if (isSameBizCstCodes(current, next)) return;
|
||||||
acntgSeCd: item.code,
|
setValue("bizCstList", next);
|
||||||
bscPlanAmt: 0,
|
|
||||||
bgtRfltAmt: 0,
|
|
||||||
tstmDesignAmt: 0,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}, [costItems, getValues, setValue]);
|
}, [costItems, getValues, setValue]);
|
||||||
|
|
||||||
function handleCostChange(index: number, fieldKey: CostFieldKey, value: string) {
|
function handleCostChange(index: number, fieldKey: CostFieldKey, value: string) {
|
||||||
@@ -119,58 +129,37 @@ function BusinessCostFormSection() {
|
|||||||
</div>
|
</div>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`bizCstList.${idx}.bgtRfltAmt`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.bgtRfltAmt ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleCostChange(idx, "bgtRfltAmt", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||||
value={field.value || ""}
|
/>
|
||||||
onChange={(e) => handleCostChange(idx, "bgtRfltAmt", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`bizCstList.${idx}.bscPlanAmt`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.bscPlanAmt ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleCostChange(idx, "bscPlanAmt", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||||
value={field.value || ""}
|
/>
|
||||||
onChange={(e) => handleCostChange(idx, "bscPlanAmt", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`bizCstList.${idx}.tstmDesignAmt`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.tstmDesignAmt ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleCostChange(idx, "tstmDesignAmt", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||||
value={field.value || ""}
|
/>
|
||||||
onChange={(e) => handleCostChange(idx, "tstmDesignAmt", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo } from "react";
|
import { useEffect, useMemo } from "react";
|
||||||
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
import { useFormContext, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
import { SectionCollapsible } from "@/shared/ui";
|
import { SectionCollapsible } from "@/shared/ui";
|
||||||
import { Field } from "@/shared/ui/field";
|
import { Field } from "@/shared/ui/field";
|
||||||
@@ -31,6 +31,16 @@ interface BusinessScaleFormData {
|
|||||||
|
|
||||||
type ScaleFieldKey = "bscPl" | "budgetReflct" | "thtiDsgn";
|
type ScaleFieldKey = "bscPl" | "budgetReflct" | "thtiDsgn";
|
||||||
|
|
||||||
|
function isSameBzScaleCodes(
|
||||||
|
current: BusinessScaleFormData["bzScaleList"],
|
||||||
|
next: BusinessScaleFormData["bzScaleList"],
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
current.length === next.length &&
|
||||||
|
current.every((item, index) => item.cnstpSeCd === next[index]?.cnstpSeCd)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function BusinessScaleFormSection() {
|
function BusinessScaleFormSection() {
|
||||||
const { control, setValue, getValues } = useFormContext<BusinessScaleFormData>();
|
const { control, setValue, getValues } = useFormContext<BusinessScaleFormData>();
|
||||||
const bzScaleList = useWatch({ control, name: "bzScaleList" }) ?? [];
|
const bzScaleList = useWatch({ control, name: "bzScaleList" }) ?? [];
|
||||||
@@ -42,7 +52,8 @@ function BusinessScaleFormSection() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (scaleItems.length === 0) return;
|
if (scaleItems.length === 0) return;
|
||||||
|
|
||||||
const existingMap = new Map(getValues("bzScaleList").map((item) => [item.cnstpSeCd, item]));
|
const current = getValues("bzScaleList") ?? [];
|
||||||
|
const existingMap = new Map(current.map((item) => [item.cnstpSeCd, item]));
|
||||||
|
|
||||||
const next = scaleItems.map((item) => {
|
const next = scaleItems.map((item) => {
|
||||||
const existing = existingMap.get(item.code);
|
const existing = existingMap.get(item.code);
|
||||||
@@ -57,6 +68,7 @@ function BusinessScaleFormSection() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isSameBzScaleCodes(current, next)) return;
|
||||||
setValue("bzScaleList", recalculateBzScaleTotals(next, scaleItems));
|
setValue("bzScaleList", recalculateBzScaleTotals(next, scaleItems));
|
||||||
}, [scaleItems, getValues, setValue]);
|
}, [scaleItems, getValues, setValue]);
|
||||||
|
|
||||||
@@ -112,58 +124,37 @@ function BusinessScaleFormSection() {
|
|||||||
</div>
|
</div>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`bzScaleList.${idx}.bscPl`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.bscPl ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleScaleChange(idx, "bscPl", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||||
value={field.value || ""}
|
/>
|
||||||
onChange={(e) => handleScaleChange(idx, "bscPl", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`bzScaleList.${idx}.budgetReflct`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.budgetReflct ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleScaleChange(idx, "budgetReflct", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||||
value={field.value || ""}
|
/>
|
||||||
onChange={(e) => handleScaleChange(idx, "budgetReflct", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`bzScaleList.${idx}.thtiDsgn`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.thtiDsgn ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleScaleChange(idx, "thtiDsgn", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||||
value={field.value || ""}
|
/>
|
||||||
onChange={(e) => handleScaleChange(idx, "thtiDsgn", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
import { useFormContext, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import { SectionCollapsible } from "@/shared/ui";
|
import { SectionCollapsible } from "@/shared/ui";
|
||||||
import { Field, FieldLabel } from "@/shared/ui/field";
|
|
||||||
import { cklstMngService, type CklstTreeNode } from "@/entities/cklst";
|
import { cklstMngService, type CklstTreeNode } from "@/entities/cklst";
|
||||||
import { useCodeList } from "@/entities/code";
|
import { useCodeList } from "@/entities/code";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
RadioGroup,
|
|
||||||
RadioGroupItem,
|
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Table,
|
Table,
|
||||||
TableBody,
|
TableBody,
|
||||||
@@ -125,11 +122,21 @@ function ChecklistFormSection({ docSeComCd, fieldPrefix }: ChecklistFormSectionP
|
|||||||
}
|
}
|
||||||
}, [checklistTabs, activeTab]);
|
}, [checklistTabs, activeTab]);
|
||||||
|
|
||||||
|
function handleSelectChange(resultIdx: number, value: "Y" | "N") {
|
||||||
|
const currentList = getValues("cklstResultList") as CklstResultListItem[];
|
||||||
|
const row = currentList[resultIdx];
|
||||||
|
if (!row) return;
|
||||||
|
|
||||||
|
const newList = [...currentList];
|
||||||
|
newList[resultIdx] = { ...row, selected: value };
|
||||||
|
setValue("cklstResultList", newList, { shouldDirty: true });
|
||||||
|
}
|
||||||
|
|
||||||
function handleSelectAll(tabCode: string, value: "Y" | "N") {
|
function handleSelectAll(tabCode: string, value: "Y" | "N") {
|
||||||
const tab = checklistTabs.find((t) => t.code === tabCode);
|
const tab = checklistTabs.find((t) => t.code === tabCode);
|
||||||
if (!tab) return;
|
if (!tab) return;
|
||||||
|
|
||||||
const currentList = getValues("cklstResultList");
|
const currentList = getValues("cklstResultList") as CklstResultListItem[];
|
||||||
const newList = [...currentList];
|
const newList = [...currentList];
|
||||||
|
|
||||||
tab.items
|
tab.items
|
||||||
@@ -141,7 +148,7 @@ function ChecklistFormSection({ docSeComCd, fieldPrefix }: ChecklistFormSectionP
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setValue("cklstResultList", newList);
|
setValue("cklstResultList", newList, { shouldDirty: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasSelectedTaskCodes = Boolean(taskSeComCdArray?.length);
|
const hasSelectedTaskCodes = Boolean(taskSeComCdArray?.length);
|
||||||
@@ -234,6 +241,8 @@ function ChecklistFormSection({ docSeComCd, fieldPrefix }: ChecklistFormSectionP
|
|||||||
{tab.items.map((item) => {
|
{tab.items.map((item) => {
|
||||||
const resultIdx = cklstRvwSnIndexMap.get(item.cklstRvwSn) ?? -1;
|
const resultIdx = cklstRvwSnIndexMap.get(item.cklstRvwSn) ?? -1;
|
||||||
const showRadios = item.bchckUseYn === "Y";
|
const showRadios = item.bchckUseYn === "Y";
|
||||||
|
const selected = cklstResultList[resultIdx]?.selected;
|
||||||
|
const radioName = `check-${item.cklstRvwSn}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={item.cklstRvwSn}>
|
<TableRow key={item.cklstRvwSn}>
|
||||||
@@ -248,66 +257,30 @@ function ChecklistFormSection({ docSeComCd, fieldPrefix }: ChecklistFormSectionP
|
|||||||
{item.content}
|
{item.content}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
{showRadios && resultIdx >= 0 ? (
|
{showRadios && resultIdx >= 0 ? (
|
||||||
<Controller
|
<>
|
||||||
name={`cklstResultList.${resultIdx}.selected`}
|
<TableCell className="text-center">
|
||||||
control={control}
|
<input
|
||||||
render={({ field, fieldState }) => (
|
type="radio"
|
||||||
<>
|
name={radioName}
|
||||||
<TableCell className="text-center">
|
value="Y"
|
||||||
<RadioGroup
|
checked={selected === "Y"}
|
||||||
name={field.name}
|
onChange={() => handleSelectChange(resultIdx, "Y")}
|
||||||
value={field.value === "Y" ? "Y" : undefined}
|
aria-label="예"
|
||||||
onValueChange={field.onChange}
|
className="cursor-pointer"
|
||||||
className="flex justify-center"
|
/>
|
||||||
>
|
</TableCell>
|
||||||
<FieldLabel
|
<TableCell className="text-center">
|
||||||
htmlFor={`check-${item.cklstRvwSn}-Y`}
|
<input
|
||||||
className="!w-auto justify-center border-none"
|
type="radio"
|
||||||
>
|
name={radioName}
|
||||||
<Field
|
value="N"
|
||||||
orientation="horizontal"
|
checked={selected === "N"}
|
||||||
data-invalid={fieldState.invalid}
|
onChange={() => handleSelectChange(resultIdx, "N")}
|
||||||
className="w-auto"
|
aria-label="아니오"
|
||||||
>
|
className="cursor-pointer"
|
||||||
<RadioGroupItem
|
/>
|
||||||
value="Y"
|
</TableCell>
|
||||||
id={`check-${item.cklstRvwSn}-Y`}
|
</>
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
aria-label="예"
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
</FieldLabel>
|
|
||||||
</RadioGroup>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell className="text-center">
|
|
||||||
<RadioGroup
|
|
||||||
name={field.name}
|
|
||||||
value={field.value === "N" ? "N" : undefined}
|
|
||||||
onValueChange={field.onChange}
|
|
||||||
className="flex justify-center"
|
|
||||||
>
|
|
||||||
<FieldLabel
|
|
||||||
htmlFor={`check-${item.cklstRvwSn}-N`}
|
|
||||||
className="!w-auto justify-center border-none"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
orientation="horizontal"
|
|
||||||
data-invalid={fieldState.invalid}
|
|
||||||
className="w-auto"
|
|
||||||
>
|
|
||||||
<RadioGroupItem
|
|
||||||
value="N"
|
|
||||||
id={`check-${item.cklstRvwSn}-N`}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
aria-label="아니오"
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
</FieldLabel>
|
|
||||||
</RadioGroup>
|
|
||||||
</TableCell>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
) : null}
|
) : null}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
import { useFormContext, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
import { getDefaultFileKey, useTus } from "@/shared/lib";
|
import { getDefaultFileKey, useTus } from "@/shared/lib";
|
||||||
import { TextShimmer } from "@/shared/ui";
|
import { AttachmentFileField, SectionCollapsible } from "@/shared/ui";
|
||||||
import { SectionCollapsible } from "@/shared/ui";
|
|
||||||
import { Field } from "@/shared/ui/field";
|
import { Field } from "@/shared/ui/field";
|
||||||
import { useAcntgSeMngTree } from "@/entities/acntg";
|
import { useAcntgSeMngTree } from "@/entities/acntg";
|
||||||
|
import { useDownloadAttachmentByAtflId } from "@/entities/attach";
|
||||||
import type { AtflMngClientResponseDto } from "@/entities/fnrs-cnsltn";
|
import type { AtflMngClientResponseDto } from "@/entities/fnrs-cnsltn";
|
||||||
import type { FnrsSharBizCstTreeDto } from "@/entities/fnrs-shar-se";
|
import type { FnrsSharBizCstTreeDto } from "@/entities/fnrs-shar-se";
|
||||||
import { useFnrsSharSeMngTree } from "@/entities/fnrs-shar-se";
|
import { useFnrsSharSeMngTree } from "@/entities/fnrs-shar-se";
|
||||||
import {
|
import {
|
||||||
Button,
|
|
||||||
cn,
|
cn,
|
||||||
Input,
|
Input,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
@@ -37,6 +36,7 @@ import { calcDiffPercent } from "../lib/format-utils";
|
|||||||
import { BizCstTotalDisplayTable } from "./biz-cst-total-display-table";
|
import { BizCstTotalDisplayTable } from "./biz-cst-total-display-table";
|
||||||
|
|
||||||
const SHAR_FILE_KEY_PREFIX = "fnrs-shar::";
|
const SHAR_FILE_KEY_PREFIX = "fnrs-shar::";
|
||||||
|
const SHAR_FILE_ACCEPT = ".hwp,.hwpx";
|
||||||
|
|
||||||
interface FnrsSharFormData {
|
interface FnrsSharFormData {
|
||||||
fnrsSharList: FnrsSharListItem[];
|
fnrsSharList: FnrsSharListItem[];
|
||||||
@@ -53,6 +53,12 @@ interface FnrsSharFormData {
|
|||||||
|
|
||||||
type SharFieldKey = "exstnAmt" | "chgRqtAmt" | "rmrkCn";
|
type SharFieldKey = "exstnAmt" | "chgRqtAmt" | "rmrkCn";
|
||||||
|
|
||||||
|
interface SharUploadedFile {
|
||||||
|
fileKey: string;
|
||||||
|
fileName: string;
|
||||||
|
atflId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface FnrsSharFormSectionProps {
|
interface FnrsSharFormSectionProps {
|
||||||
initialSharTree?: FnrsSharBizCstTreeDto[];
|
initialSharTree?: FnrsSharBizCstTreeDto[];
|
||||||
initialSharAtchFiles?: AtflMngClientResponseDto[];
|
initialSharAtchFiles?: AtflMngClientResponseDto[];
|
||||||
@@ -62,12 +68,30 @@ function createSharUploadKey(file: File) {
|
|||||||
return `${SHAR_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
return `${SHAR_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toInitialSharFile(file?: AtflMngClientResponseDto): SharUploadedFile | null {
|
||||||
|
if (!file?.orgnlFileNm) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
fileKey: file.atflId ? `server::${file.atflId}` : `${SHAR_FILE_KEY_PREFIX}${file.atflCd}`,
|
||||||
|
fileName: file.orgnlFileNm,
|
||||||
|
atflId: file.atflId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSameFnrsSharCodes(current: FnrsSharListItem[], next: FnrsSharListItem[]) {
|
||||||
|
return (
|
||||||
|
current.length === next.length &&
|
||||||
|
current.every((item, index) => item.fnrsSharSeCd === next[index]?.fnrsSharSeCd)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsSharFormSectionProps) {
|
function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsSharFormSectionProps) {
|
||||||
const { control, setValue, getValues } = useFormContext<FnrsSharFormData>();
|
const { control, setValue, getValues } = useFormContext<FnrsSharFormData>();
|
||||||
const fnrsSharList = useWatch({ control, name: "fnrsSharList" }) ?? [];
|
const fnrsSharList = useWatch({ control, name: "fnrsSharList" }) ?? [];
|
||||||
const [uploadedFileName, setUploadedFileName] = useState(
|
const [uploadedFile, setUploadedFile] = useState<SharUploadedFile | null>(() =>
|
||||||
() => initialSharAtchFiles?.[0]?.orgnlFileNm ?? "",
|
toInitialSharFile(initialSharAtchFiles?.[0]),
|
||||||
);
|
);
|
||||||
|
const { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
|
||||||
|
|
||||||
const { data: masterTree = [], isLoading: isMasterLoading } = useFnrsSharSeMngTree();
|
const { data: masterTree = [], isLoading: isMasterLoading } = useFnrsSharSeMngTree();
|
||||||
const { data: acntgTree = [] } = useAcntgSeMngTree();
|
const { data: acntgTree = [] } = useAcntgSeMngTree();
|
||||||
@@ -78,9 +102,13 @@ function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsShar
|
|||||||
const isLoading = initialSharTree?.length ? false : isMasterLoading;
|
const isLoading = initialSharTree?.length ? false : isMasterLoading;
|
||||||
|
|
||||||
const { uploadFileAsync, isUploading } = useTus({
|
const { uploadFileAsync, isUploading } = useTus({
|
||||||
onSuccess: (atflCd) => {
|
onSuccess: (atflCd, atflId, _file, fileKey) => {
|
||||||
if (!atflCd) return;
|
if (!atflCd) return;
|
||||||
setValue("fnrsCnsltnMng.sharAtchFileGroupId", atflCd, { shouldDirty: true });
|
setValue("fnrsCnsltnMng.sharAtchFileGroupId", atflCd, { shouldDirty: true });
|
||||||
|
setUploadedFile((prev) => (prev?.fileKey === fileKey ? { ...prev, atflId } : prev));
|
||||||
|
},
|
||||||
|
onError: (_error, _file, fileKey) => {
|
||||||
|
setUploadedFile((prev) => (prev?.fileKey === fileKey ? null : prev));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const isSharUploading = Object.values(isUploading).some(Boolean);
|
const isSharUploading = Object.values(isUploading).some(Boolean);
|
||||||
@@ -96,6 +124,7 @@ function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsShar
|
|||||||
: mergeFnrsSharTreeWithForm(sharTree, []);
|
: mergeFnrsSharTreeWithForm(sharTree, []);
|
||||||
|
|
||||||
const withTotals = recalculateFnrsSharTotals(merged, sharItems);
|
const withTotals = recalculateFnrsSharTotals(merged, sharItems);
|
||||||
|
if (isSameFnrsSharCodes(existing, withTotals)) return;
|
||||||
setValue("fnrsSharList", withTotals);
|
setValue("fnrsSharList", withTotals);
|
||||||
}, [sharItems, sharTree, initialSharTree, getValues, setValue]);
|
}, [sharItems, sharTree, initialSharTree, getValues, setValue]);
|
||||||
|
|
||||||
@@ -120,16 +149,32 @@ function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsShar
|
|||||||
applySharList(draft);
|
applySharList(draft);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleSharFileChange(event: React.ChangeEvent<HTMLInputElement>) {
|
async function handleSharFileAdd(files: FileList | null) {
|
||||||
const file = event.target.files?.[0];
|
const file = files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
const fileKey = createSharUploadKey(file);
|
const fileKey = createSharUploadKey(file);
|
||||||
setUploadedFileName(file.name);
|
setUploadedFile({ fileName: file.name, fileKey });
|
||||||
await uploadFileAsync(file, { fileKey });
|
|
||||||
event.target.value = "";
|
try {
|
||||||
|
await uploadFileAsync(file, { fileKey });
|
||||||
|
} catch {
|
||||||
|
// onError callback handles cleanup
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sharAtchFiles = uploadedFile
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
fileKey: uploadedFile.fileKey,
|
||||||
|
fileName: uploadedFile.fileName,
|
||||||
|
onDownload: uploadedFile.atflId
|
||||||
|
? () => downloadByAtflId(uploadedFile.atflId!)
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [];
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<SectionCollapsible title="재원분담">
|
<SectionCollapsible title="재원분담">
|
||||||
@@ -189,40 +234,26 @@ function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsShar
|
|||||||
{item.label}
|
{item.label}
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`fnrsSharList.${idx}.exstnAmt`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.exstnAmt ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleSharChange(idx, "exstnAmt", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={cn("text-right", item.readonly && "bg-muted")}
|
||||||
value={field.value ?? ""}
|
/>
|
||||||
onChange={(e) => handleSharChange(idx, "exstnAmt", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={cn("text-right", item.readonly && "bg-muted")}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`fnrsSharList.${idx}.chgRqtAmt`}
|
<Input
|
||||||
control={control}
|
type="number"
|
||||||
render={({ field, fieldState }) => (
|
value={data.chgRqtAmt ?? ""}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
onChange={(e) => handleSharChange(idx, "chgRqtAmt", e.target.value)}
|
||||||
<Input
|
readOnly={item.readonly}
|
||||||
type="number"
|
className={cn("text-right", item.readonly && "bg-muted")}
|
||||||
value={field.value ?? ""}
|
/>
|
||||||
onChange={(e) => handleSharChange(idx, "chgRqtAmt", e.target.value)}
|
</Field>
|
||||||
readOnly={item.readonly}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
className={cn("text-right", item.readonly && "bg-muted")}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
@@ -233,19 +264,12 @@ function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsShar
|
|||||||
<div className="text-right">{calcDiffPercent(diff, data.exstnAmt || 0)}</div>
|
<div className="text-right">{calcDiffPercent(diff, data.exstnAmt || 0)}</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Controller
|
<Field>
|
||||||
name={`fnrsSharList.${idx}.rmrkCn`}
|
<Input
|
||||||
control={control}
|
value={data.rmrkCn ?? ""}
|
||||||
render={({ field, fieldState }) => (
|
onChange={(e) => handleSharChange(idx, "rmrkCn", e.target.value)}
|
||||||
<Field data-invalid={fieldState.invalid}>
|
/>
|
||||||
<Input
|
</Field>
|
||||||
value={field.value ?? ""}
|
|
||||||
onChange={(e) => handleSharChange(idx, "rmrkCn", e.target.value)}
|
|
||||||
aria-invalid={fieldState.invalid}
|
|
||||||
/>
|
|
||||||
</Field>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
@@ -257,31 +281,20 @@ function FnrsSharFormSection({ initialSharTree, initialSharAtchFiles }: FnrsShar
|
|||||||
|
|
||||||
<div className="mt-6 px-2 pb-2">
|
<div className="mt-6 px-2 pb-2">
|
||||||
<h3 className="mb-2 text-xl font-semibold">첨부파일</h3>
|
<h3 className="mb-2 text-xl font-semibold">첨부파일</h3>
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
{!uploadedFile ? (
|
||||||
{isSharUploading && uploadedFileName ? (
|
<p className="mb-2 px-1 text-xl text-muted-foreground">
|
||||||
<TextShimmer className="max-w-lg text-xl" active>
|
총사업비 신청서(.hwp) 파일을 등록해주세요.
|
||||||
{uploadedFileName}
|
</p>
|
||||||
</TextShimmer>
|
) : null}
|
||||||
) : (
|
<AttachmentFileField
|
||||||
<Input
|
files={sharAtchFiles}
|
||||||
value={uploadedFileName}
|
inputId="fnrs-shar-atch-file-input"
|
||||||
readOnly
|
isUploadingByKey={isUploading}
|
||||||
placeholder="총사업비 신청서(.hwp) 파일을 등록해주세요."
|
accept={SHAR_FILE_ACCEPT}
|
||||||
className="max-w-lg rounded-sm"
|
multiple={false}
|
||||||
/>
|
addDisabled={isSharUploading}
|
||||||
)}
|
onAdd={(fileList) => void handleSharFileAdd(fileList)}
|
||||||
<Button type="button" color="white" disabled={isSharUploading} asChild>
|
/>
|
||||||
<label className="cursor-pointer">
|
|
||||||
첨부파일
|
|
||||||
<input
|
|
||||||
type="file"
|
|
||||||
accept=".hwp,.hwpx"
|
|
||||||
className="hidden"
|
|
||||||
onChange={handleSharFileChange}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</SectionCollapsible>
|
</SectionCollapsible>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";
|
|||||||
|
|
||||||
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib";
|
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib";
|
||||||
import { AttachmentFileField, SectionCollapsible } from "@/shared/ui";
|
import { AttachmentFileField, SectionCollapsible } from "@/shared/ui";
|
||||||
import { AttachmentDownloadLink, attachService, useDownloadAttachmentByAtflId } from "@/entities/attach";
|
import {
|
||||||
|
AttachmentDownloadLink,
|
||||||
|
attachService,
|
||||||
|
useDownloadAttachmentByAtflId,
|
||||||
|
} from "@/entities/attach";
|
||||||
|
import { FnrsCnsltnSplmntDmndResponseDto } from "@/entities/fnrs-cnsltn";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
Table,
|
Table,
|
||||||
@@ -46,6 +51,7 @@ interface SplmntDmndFormData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface SplmntDmndFormSectionProps {
|
interface SplmntDmndFormSectionProps {
|
||||||
|
initialData?: FnrsCnsltnSplmntDmndResponseDto[];
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +71,7 @@ function getRowKey(item: SplmntDmndFormItem, index: number) {
|
|||||||
return item.splmntDmndSn != null ? String(item.splmntDmndSn) : `idx-${index}`;
|
return item.splmntDmndSn != null ? String(item.splmntDmndSn) : `idx-${index}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps) {
|
function SplmntDmndFormSection({ initialData, readOnly = false }: SplmntDmndFormSectionProps) {
|
||||||
const formId = useId();
|
const formId = useId();
|
||||||
const { control, setValue, getValues } = useFormContext<SplmntDmndFormData>();
|
const { control, setValue, getValues } = useFormContext<SplmntDmndFormData>();
|
||||||
const splmntDmndList = useWatch({ control, name: "splmntDmndList" }) ?? [];
|
const splmntDmndList = useWatch({ control, name: "splmntDmndList" }) ?? [];
|
||||||
@@ -260,6 +266,7 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
|
|||||||
const isRowUploading = rowFiles.some((file) => isUploading[file.fileKey] ?? false);
|
const isRowUploading = rowFiles.some((file) => isUploading[file.fileKey] ?? false);
|
||||||
const fileInputId = `${formId}-${rowKey}-file`;
|
const fileInputId = `${formId}-${rowKey}-file`;
|
||||||
const isRowReadOnly = readOnly || item.cmptnYn === "Y";
|
const isRowReadOnly = readOnly || item.cmptnYn === "Y";
|
||||||
|
const splmntAtchFileInfo = initialData?.[index]?.splmntAtchFileInfo;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={rowKey}>
|
<TableRow key={rowKey}>
|
||||||
@@ -282,7 +289,15 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="align-top">
|
<TableCell className="align-top">
|
||||||
{isRowReadOnly ? (
|
{isRowReadOnly ? (
|
||||||
<span className="whitespace-pre-wrap">{item.splmntCn || "-"}</span>
|
<div className="space-y-2">
|
||||||
|
<div className="whitespace-pre-wrap">{item.splmntCn || "-"}</div>
|
||||||
|
{splmntAtchFileInfo?.atflCd ? (
|
||||||
|
<AttachmentDownloadLink
|
||||||
|
atflCd={splmntAtchFileInfo?.atflCd}
|
||||||
|
fileName={splmntAtchFileInfo?.orgnlFileNm}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
@@ -292,7 +307,7 @@ function SplmntDmndFormSection({ readOnly = false }: SplmntDmndFormSectionProps)
|
|||||||
value={field.value ?? ""}
|
value={field.value ?? ""}
|
||||||
onChange={field.onChange}
|
onChange={field.onChange}
|
||||||
onBlur={field.onBlur}
|
onBlur={field.onBlur}
|
||||||
placeholder="보완완료 내용을 입력하세요."
|
placeholder="보완 완료 내용을 입력하세요."
|
||||||
className="min-h-[6rem] !text-xl"
|
className="min-h-[6rem] !text-xl"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -276,7 +276,9 @@ function Post({ bbsId, pstNo }: { bbsId: string; pstNo: string }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</PostAction>
|
</PostAction>
|
||||||
<PostComment bbsId={parseInt(bbsId)} pstNo={parseInt(pstNo)} />
|
{bbsInfo?.cmntUseYn === "Y" && (
|
||||||
|
<PostComment bbsId={parseInt(bbsId)} pstNo={parseInt(pstNo)} />
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,220 +1,222 @@
|
|||||||
/**
|
/**
|
||||||
* JWT를 decoding하면 만료시간을 읽을 수 있다.
|
* 티베로(하수도정보시스템) 조회 콘솔
|
||||||
* JWT는 3부분으로 구성 : Header.Payload.Signature
|
*
|
||||||
* Payload 부분에 만료시간(exp)이 있다.
|
* - reuse-service 의 티베로 데이터소스로 조회 SQL 한 문장(SELECT, WITH)을 실행하고 결과를 표로 보여준다.
|
||||||
|
* - 서버에서 조회 문장만 통과시키고, 읽기 전용 연결과 최대 행 수(기본 100, 최대 1000) 제한을 적용한다.
|
||||||
|
* - 서버 설정 tibero.sql-console.enabled=true 일 때만 동작한다.
|
||||||
|
*
|
||||||
|
* 🔗 사용 API
|
||||||
|
* 티베로 조회 SQL 실행 POST /ones/sql body: { sql, maxRows }
|
||||||
|
*
|
||||||
|
* 이전 JWT 만료시간 테스트 화면은 같은 폴더의 page.tsx.bak 에 보관되어 있다.
|
||||||
*/
|
*/
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
import { authService } from "@/src/entities/auth";
|
import { fetchType, postFectch } from "@/components/lib/api";
|
||||||
import { CLAIM_NAME } from "@/src/shared/config";
|
|
||||||
import { getCookie } from "@/src/shared/lib";
|
|
||||||
|
|
||||||
interface JwtPayload {
|
type TiberoSqlResult = {
|
||||||
sub?: string; // 토큰 subject. 일반적으로 사용자 식별자나 주체 정보
|
success: boolean;
|
||||||
exp?: number; // 만료 시각(Unix timestamp, 초 단위)
|
message: string | null;
|
||||||
iat?: number; // 토큰 발급 시각(Unix timestamp, 초 단위)
|
columns: string[];
|
||||||
[key: string]: unknown; // 그 외 JWT payload에 포함될 수 있는 추가 클레임
|
rows: (string | null)[][];
|
||||||
}
|
rowCount: number;
|
||||||
|
truncated: boolean;
|
||||||
interface JwtState {
|
maxRows: number;
|
||||||
token: string; // 쿠키에서 읽어온 JWT 원본 문자열
|
elapsedMs: number;
|
||||||
payload: JwtPayload | null; // JWT를 파싱한 payload 객체
|
|
||||||
exp: number | null; // payload에서 추출한 exp 값
|
|
||||||
expDateLocal: string | null; // exp를 로컬 시간 문자열로 변환한 값
|
|
||||||
remainingMs: number | null; // 현재 시각 기준 남은 시간(ms)
|
|
||||||
error: string | null; // 쿠키 없음, 파싱 실패 등 오류 메시지
|
|
||||||
}
|
|
||||||
|
|
||||||
const initialJwtState: JwtState = {
|
|
||||||
token: "",
|
|
||||||
payload: null,
|
|
||||||
exp: null,
|
|
||||||
expDateLocal: null,
|
|
||||||
remainingMs: null,
|
|
||||||
error: null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function parseJwt(token: string): JwtPayload {
|
type TiberoSqlResponse = {
|
||||||
const parts = token.split(".");
|
status: number;
|
||||||
if (parts.length !== 3) {
|
data: TiberoSqlResult | null;
|
||||||
throw new Error("유효한 JWT 형식이 아닙니다.");
|
count: number;
|
||||||
}
|
msg: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
const base64Url = parts[1] ?? ""; // Payload를 가져온다.
|
const DEFAULT_SQL = `SELECT BSC_FCT_CD, BSC_FCT_NM, RGN_CD, ADST_DSTR_CD, FCT_CPC
|
||||||
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
FROM ONSEMIRO_NEW.OM_MS_VW
|
||||||
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
WHERE ROWNUM <= 20`;
|
||||||
const jsonPayload = decodeURIComponent(
|
|
||||||
atob(padded)
|
|
||||||
.split("")
|
|
||||||
.map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`)
|
|
||||||
.join("")
|
|
||||||
);
|
|
||||||
|
|
||||||
return JSON.parse(jsonPayload) as JwtPayload;
|
const MAX_ROWS_LIMIT = 1000;
|
||||||
}
|
|
||||||
|
|
||||||
function formatRemainingMs(remainingMs: number | null): string {
|
const toTsv = (columns: string[], rows: (string | null)[][]) =>
|
||||||
if (remainingMs === null) return "-";
|
[columns, ...rows]
|
||||||
if (remainingMs <= 0) return "만료됨";
|
.map((row) => row.map((value) => (value ?? "").replace(/[\t\r\n]+/g, " ")).join("\t"))
|
||||||
|
.join("\n");
|
||||||
|
|
||||||
const totalSeconds = Math.floor(remainingMs / 1000);
|
export default function TiberoSqlConsolePage() {
|
||||||
const hours = Math.floor(totalSeconds / 3600);
|
const [sql, setSql] = useState<string>(DEFAULT_SQL);
|
||||||
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
const [maxRows, setMaxRows] = useState<number>(100);
|
||||||
const seconds = totalSeconds % 60;
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
const [result, setResult] = useState<TiberoSqlResult | null>(null);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const [copied, setCopied] = useState<boolean>(false);
|
||||||
|
|
||||||
return `${hours}시간 ${minutes}분 ${seconds}초`;
|
const runQuery = useCallback(async () => {
|
||||||
}
|
if (loading) return;
|
||||||
|
if (!sql.trim()) {
|
||||||
function readJwtState(): JwtState {
|
setError("SQL을 입력해주세요.");
|
||||||
const token = getCookie(CLAIM_NAME) ?? "";
|
return;
|
||||||
|
|
||||||
if (!token) {
|
|
||||||
return {
|
|
||||||
token: "",
|
|
||||||
payload: null,
|
|
||||||
exp: null,
|
|
||||||
expDateLocal: null,
|
|
||||||
remainingMs: null,
|
|
||||||
error: `${CLAIM_NAME} 쿠키가 없습니다.`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const payload = parseJwt(token);
|
|
||||||
|
|
||||||
if (typeof payload.exp !== "number") {
|
|
||||||
return {
|
|
||||||
token,
|
|
||||||
payload,
|
|
||||||
exp: null,
|
|
||||||
expDateLocal: null,
|
|
||||||
remainingMs: null,
|
|
||||||
error: "JWT payload에 exp 값이 없습니다.",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
const expMs = payload.exp * 1000;
|
setError(null);
|
||||||
|
setCopied(false);
|
||||||
return {
|
|
||||||
token,
|
|
||||||
payload,
|
|
||||||
exp: payload.exp,
|
|
||||||
expDateLocal: new Date(expMs).toLocaleString(),
|
|
||||||
remainingMs: Math.max(expMs - Date.now(), 0),
|
|
||||||
error: null,
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
return {
|
|
||||||
token,
|
|
||||||
payload: null,
|
|
||||||
exp: null,
|
|
||||||
expDateLocal: null,
|
|
||||||
remainingMs: null,
|
|
||||||
error:
|
|
||||||
error instanceof Error
|
|
||||||
? error.message
|
|
||||||
: "JWT 파싱 중 오류가 발생했습니다.",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Page() {
|
|
||||||
const [jwtState, setJwtState] = useState<JwtState>(initialJwtState);
|
|
||||||
const isRefreshingRef = useRef(false);
|
|
||||||
|
|
||||||
const handleSilentRefresh = async () => {
|
|
||||||
try {
|
try {
|
||||||
await authService.silentRefresh();
|
const response = (await postFectch(
|
||||||
} catch (error) {
|
"/ones/sql",
|
||||||
console.error("Manual silent refresh failed:", error);
|
{ sql, maxRows },
|
||||||
|
fetchType.WR
|
||||||
|
)) as TiberoSqlResponse;
|
||||||
|
const data = response?.data ?? null;
|
||||||
|
setResult(data);
|
||||||
|
if (!data || !data.success) {
|
||||||
|
setError(response?.msg || data?.message || "조회에 실패했습니다.");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setResult(null);
|
||||||
|
setError(e instanceof Error ? e.message : "요청 중 오류가 발생했습니다.");
|
||||||
} finally {
|
} finally {
|
||||||
setJwtState(readJwtState());
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
}, [loading, sql, maxRows]);
|
||||||
|
|
||||||
useEffect(() => {
|
const copyTsv = useCallback(async () => {
|
||||||
const syncJwtState = async () => {
|
if (!result?.success) return;
|
||||||
const nextState = readJwtState();
|
try {
|
||||||
|
await navigator.clipboard.writeText(toTsv(result.columns, result.rows));
|
||||||
|
setCopied(true);
|
||||||
|
} catch {
|
||||||
|
setError("클립보드 복사에 실패했습니다.");
|
||||||
|
}
|
||||||
|
}, [result]);
|
||||||
|
|
||||||
if (
|
const summary = useMemo(() => {
|
||||||
nextState.remainingMs !== null &&
|
if (!result?.success) return null;
|
||||||
nextState.remainingMs > 0 &&
|
return `${result.rowCount.toLocaleString()}행 · ${result.elapsedMs.toLocaleString()}ms · 최대 ${result.maxRows.toLocaleString()}행`;
|
||||||
nextState.remainingMs < 5 * 60 * 1000 &&
|
}, [result]);
|
||||||
!isRefreshingRef.current
|
|
||||||
) {
|
|
||||||
isRefreshingRef.current = true;
|
|
||||||
try {
|
|
||||||
await authService.silentRefresh();
|
|
||||||
} catch (error) {
|
|
||||||
console.error("JWT test silent refresh failed:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setJwtState(readJwtState());
|
|
||||||
|
|
||||||
if (
|
|
||||||
nextState.remainingMs === null ||
|
|
||||||
nextState.remainingMs >= 5 * 60 * 1000 ||
|
|
||||||
nextState.remainingMs <= 0
|
|
||||||
) {
|
|
||||||
isRefreshingRef.current = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void syncJwtState();
|
|
||||||
const timer = window.setInterval(() => {
|
|
||||||
void syncJwtState();
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
return () => window.clearInterval(timer);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4 p-8 text-base">
|
<div className="flex h-full flex-col gap-4 p-6 text-base">
|
||||||
<h1 className="text-2xl font-bold">JWT Exp Test</h1>
|
<div className="flex items-baseline justify-between">
|
||||||
|
<h1 className="text-2xl font-bold">티베로 조회 콘솔</h1>
|
||||||
|
<span className="text-sm text-gray-500">
|
||||||
|
SELECT, WITH 한 문장만 실행됩니다 · Ctrl+Enter 실행
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button
|
<textarea
|
||||||
type="button"
|
className="h-48 w-full resize-y rounded border border-gray-300 p-3 font-mono text-xl focus:border-blue-500 focus:outline-none"
|
||||||
className="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700"
|
value={sql}
|
||||||
onClick={() => {
|
spellCheck={false}
|
||||||
void handleSilentRefresh();
|
placeholder="SELECT ... FROM ONSEMIRO_NEW.테이블명"
|
||||||
|
onChange={(e) => setSql(e.target.value)}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||||
|
e.preventDefault();
|
||||||
|
void runQuery();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
Silent Refresh 호출
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div className="rounded border p-4">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
<div className="font-semibold">쿠키명</div>
|
<label className="flex items-center gap-2 text-sm">
|
||||||
<div>{CLAIM_NAME}</div>
|
최대 행 수
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min={1}
|
||||||
|
max={MAX_ROWS_LIMIT}
|
||||||
|
className="w-24 rounded border border-gray-300 px-2 py-1 text-right"
|
||||||
|
value={maxRows}
|
||||||
|
onChange={(e) => {
|
||||||
|
const next = Number(e.target.value);
|
||||||
|
if (Number.isFinite(next)) {
|
||||||
|
setMaxRows(Math.min(Math.max(Math.trunc(next), 1), MAX_ROWS_LIMIT));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="rounded bg-blue-600 px-5 py-2 text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-400"
|
||||||
|
disabled={loading}
|
||||||
|
onClick={() => void runQuery()}
|
||||||
|
>
|
||||||
|
{loading ? "실행 중..." : "실행"}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="rounded border border-gray-300 px-4 py-2 hover:bg-gray-50 disabled:cursor-not-allowed disabled:text-gray-400"
|
||||||
|
disabled={!result?.success || result.rowCount === 0}
|
||||||
|
onClick={() => void copyTsv()}
|
||||||
|
>
|
||||||
|
{copied ? "복사됨" : "결과 복사(TSV)"}
|
||||||
|
</button>
|
||||||
|
{summary && <span className="text-sm text-gray-600">{summary}</span>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded border p-4">
|
{error && (
|
||||||
<div className="font-semibold">exp</div>
|
<div className="whitespace-pre-wrap break-all rounded border border-red-300 bg-red-50 p-3 text-sm text-red-700">
|
||||||
<div>{jwtState.exp ?? "-"}</div>
|
{error}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
{result?.success && result.truncated && (
|
||||||
|
<div className="rounded border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800">
|
||||||
|
{result.message}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="rounded border p-4">
|
{result?.success && (
|
||||||
<div className="font-semibold">만료시각</div>
|
<div className="min-h-0 flex-1 overflow-auto rounded border border-gray-300">
|
||||||
<div>{jwtState.expDateLocal ?? "-"}</div>
|
{result.columns.length === 0 ? (
|
||||||
</div>
|
<div className="p-4 text-sm text-gray-500">컬럼이 없습니다.</div>
|
||||||
|
) : (
|
||||||
<div className="rounded border p-4">
|
<table className="min-w-full border-collapse text-sm">
|
||||||
<div className="font-semibold">남은시간</div>
|
<thead className="sticky top-0 bg-gray-100">
|
||||||
<div>{formatRemainingMs(jwtState.remainingMs)}</div>
|
<tr>
|
||||||
</div>
|
<th className="border-b border-r border-gray-300 px-2 py-1 text-right text-gray-500">#</th>
|
||||||
|
{result.columns.map((column, index) => (
|
||||||
<div className="rounded border p-4">
|
<th
|
||||||
<div className="font-semibold">상태</div>
|
key={`${column}-${index}`}
|
||||||
<div>{jwtState.error ?? "정상"}</div>
|
className="whitespace-nowrap border-b border-r border-gray-300 px-2 py-1 text-left font-semibold"
|
||||||
</div>
|
>
|
||||||
|
{column}
|
||||||
<div className="rounded border p-4">
|
</th>
|
||||||
<div className="font-semibold">payload</div>
|
))}
|
||||||
<pre className="overflow-auto whitespace-pre-wrap break-all text-sm">
|
</tr>
|
||||||
{jwtState.payload ? JSON.stringify(jwtState.payload, null, 2) : "-"}
|
</thead>
|
||||||
</pre>
|
<tbody>
|
||||||
</div>
|
{result.rows.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
className="px-3 py-4 text-center text-gray-500"
|
||||||
|
colSpan={result.columns.length + 1}
|
||||||
|
>
|
||||||
|
조회 결과가 없습니다.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
result.rows.map((row, rowIndex) => (
|
||||||
|
<tr key={rowIndex} className="odd:bg-white even:bg-gray-50 hover:bg-blue-50">
|
||||||
|
<td className="border-b border-r border-gray-200 px-2 py-1 text-right text-gray-400">
|
||||||
|
{rowIndex + 1}
|
||||||
|
</td>
|
||||||
|
{row.map((value, colIndex) => (
|
||||||
|
<td
|
||||||
|
key={colIndex}
|
||||||
|
className="max-w-md truncate whitespace-nowrap border-b border-r border-gray-200 px-2 py-1"
|
||||||
|
title={value ?? "NULL"}
|
||||||
|
>
|
||||||
|
{value === null ? <span className="italic text-gray-400">NULL</span> : value}
|
||||||
|
</td>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,220 @@
|
|||||||
|
/**
|
||||||
|
* JWT를 decoding하면 만료시간을 읽을 수 있다.
|
||||||
|
* JWT는 3부분으로 구성 : Header.Payload.Signature
|
||||||
|
* Payload 부분에 만료시간(exp)이 있다.
|
||||||
|
*/
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { authService } from "@/src/entities/auth";
|
||||||
|
import { CLAIM_NAME } from "@/src/shared/config";
|
||||||
|
import { getCookie } from "@/src/shared/lib";
|
||||||
|
|
||||||
|
interface JwtPayload {
|
||||||
|
sub?: string; // 토큰 subject. 일반적으로 사용자 식별자나 주체 정보
|
||||||
|
exp?: number; // 만료 시각(Unix timestamp, 초 단위)
|
||||||
|
iat?: number; // 토큰 발급 시각(Unix timestamp, 초 단위)
|
||||||
|
[key: string]: unknown; // 그 외 JWT payload에 포함될 수 있는 추가 클레임
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JwtState {
|
||||||
|
token: string; // 쿠키에서 읽어온 JWT 원본 문자열
|
||||||
|
payload: JwtPayload | null; // JWT를 파싱한 payload 객체
|
||||||
|
exp: number | null; // payload에서 추출한 exp 값
|
||||||
|
expDateLocal: string | null; // exp를 로컬 시간 문자열로 변환한 값
|
||||||
|
remainingMs: number | null; // 현재 시각 기준 남은 시간(ms)
|
||||||
|
error: string | null; // 쿠키 없음, 파싱 실패 등 오류 메시지
|
||||||
|
}
|
||||||
|
|
||||||
|
const initialJwtState: JwtState = {
|
||||||
|
token: "",
|
||||||
|
payload: null,
|
||||||
|
exp: null,
|
||||||
|
expDateLocal: null,
|
||||||
|
remainingMs: null,
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
function parseJwt(token: string): JwtPayload {
|
||||||
|
const parts = token.split(".");
|
||||||
|
if (parts.length !== 3) {
|
||||||
|
throw new Error("유효한 JWT 형식이 아닙니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const base64Url = parts[1] ?? ""; // Payload를 가져온다.
|
||||||
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
||||||
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
||||||
|
const jsonPayload = decodeURIComponent(
|
||||||
|
atob(padded)
|
||||||
|
.split("")
|
||||||
|
.map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`)
|
||||||
|
.join("")
|
||||||
|
);
|
||||||
|
|
||||||
|
return JSON.parse(jsonPayload) as JwtPayload;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRemainingMs(remainingMs: number | null): string {
|
||||||
|
if (remainingMs === null) return "-";
|
||||||
|
if (remainingMs <= 0) return "만료됨";
|
||||||
|
|
||||||
|
const totalSeconds = Math.floor(remainingMs / 1000);
|
||||||
|
const hours = Math.floor(totalSeconds / 3600);
|
||||||
|
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
||||||
|
const seconds = totalSeconds % 60;
|
||||||
|
|
||||||
|
return `${hours}시간 ${minutes}분 ${seconds}초`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readJwtState(): JwtState {
|
||||||
|
const token = getCookie(CLAIM_NAME) ?? "";
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return {
|
||||||
|
token: "",
|
||||||
|
payload: null,
|
||||||
|
exp: null,
|
||||||
|
expDateLocal: null,
|
||||||
|
remainingMs: null,
|
||||||
|
error: `${CLAIM_NAME} 쿠키가 없습니다.`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const payload = parseJwt(token);
|
||||||
|
|
||||||
|
if (typeof payload.exp !== "number") {
|
||||||
|
return {
|
||||||
|
token,
|
||||||
|
payload,
|
||||||
|
exp: null,
|
||||||
|
expDateLocal: null,
|
||||||
|
remainingMs: null,
|
||||||
|
error: "JWT payload에 exp 값이 없습니다.",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const expMs = payload.exp * 1000;
|
||||||
|
|
||||||
|
return {
|
||||||
|
token,
|
||||||
|
payload,
|
||||||
|
exp: payload.exp,
|
||||||
|
expDateLocal: new Date(expMs).toLocaleString(),
|
||||||
|
remainingMs: Math.max(expMs - Date.now(), 0),
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
token,
|
||||||
|
payload: null,
|
||||||
|
exp: null,
|
||||||
|
expDateLocal: null,
|
||||||
|
remainingMs: null,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: "JWT 파싱 중 오류가 발생했습니다.",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
const [jwtState, setJwtState] = useState<JwtState>(initialJwtState);
|
||||||
|
const isRefreshingRef = useRef(false);
|
||||||
|
|
||||||
|
const handleSilentRefresh = async () => {
|
||||||
|
try {
|
||||||
|
await authService.silentRefresh();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Manual silent refresh failed:", error);
|
||||||
|
} finally {
|
||||||
|
setJwtState(readJwtState());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const syncJwtState = async () => {
|
||||||
|
const nextState = readJwtState();
|
||||||
|
|
||||||
|
if (
|
||||||
|
nextState.remainingMs !== null &&
|
||||||
|
nextState.remainingMs > 0 &&
|
||||||
|
nextState.remainingMs < 5 * 60 * 1000 &&
|
||||||
|
!isRefreshingRef.current
|
||||||
|
) {
|
||||||
|
isRefreshingRef.current = true;
|
||||||
|
try {
|
||||||
|
await authService.silentRefresh();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("JWT test silent refresh failed:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setJwtState(readJwtState());
|
||||||
|
|
||||||
|
if (
|
||||||
|
nextState.remainingMs === null ||
|
||||||
|
nextState.remainingMs >= 5 * 60 * 1000 ||
|
||||||
|
nextState.remainingMs <= 0
|
||||||
|
) {
|
||||||
|
isRefreshingRef.current = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void syncJwtState();
|
||||||
|
const timer = window.setInterval(() => {
|
||||||
|
void syncJwtState();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
return () => window.clearInterval(timer);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4 p-8 text-base">
|
||||||
|
<h1 className="text-2xl font-bold">JWT Exp Test</h1>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700"
|
||||||
|
onClick={() => {
|
||||||
|
void handleSilentRefresh();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Silent Refresh 호출
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="rounded border p-4">
|
||||||
|
<div className="font-semibold">쿠키명</div>
|
||||||
|
<div>{CLAIM_NAME}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded border p-4">
|
||||||
|
<div className="font-semibold">exp</div>
|
||||||
|
<div>{jwtState.exp ?? "-"}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded border p-4">
|
||||||
|
<div className="font-semibold">만료시각</div>
|
||||||
|
<div>{jwtState.expDateLocal ?? "-"}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded border p-4">
|
||||||
|
<div className="font-semibold">남은시간</div>
|
||||||
|
<div>{formatRemainingMs(jwtState.remainingMs)}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded border p-4">
|
||||||
|
<div className="font-semibold">상태</div>
|
||||||
|
<div>{jwtState.error ?? "정상"}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded border p-4">
|
||||||
|
<div className="font-semibold">payload</div>
|
||||||
|
<pre className="overflow-auto whitespace-pre-wrap break-all text-sm">
|
||||||
|
{jwtState.payload ? JSON.stringify(jwtState.payload, null, 2) : "-"}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -107,7 +107,7 @@ export function NoticePopover() {
|
|||||||
전체 선택
|
전체 선택
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul className="max-h-[48rem] overflow-y-auto">
|
||||||
{noticeUserList?.map((item) => (
|
{noticeUserList?.map((item) => (
|
||||||
<li
|
<li
|
||||||
key={item.notiId}
|
key={item.notiId}
|
||||||
|
|||||||
Reference in New Issue
Block a user