Compare commits
69
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7dfd535841 | ||
|
|
e76cddd45b | ||
|
|
39d928b5b1 | ||
|
|
3c214f4725 | ||
|
|
80861938f3 | ||
|
|
401f2dba13 | ||
|
|
525695072a | ||
|
|
c4d7c516ef | ||
|
|
42274a71b7 | ||
|
|
f1fcfa9ee4 | ||
|
|
afcfbbbf61 | ||
|
|
4c7666169c | ||
|
|
5580b4301f | ||
|
|
972a4ce789 | ||
|
|
421ff8cb40 | ||
|
|
879aadc068 | ||
|
|
96b95e0eb9 | ||
|
|
cea2d39df8 | ||
|
|
873a74492a | ||
|
|
958a8ffe2c | ||
|
|
0286e2a92e | ||
|
|
01e339cc61 | ||
|
|
8d17623d3a | ||
|
|
ba9d7c8172 | ||
|
|
06f5a3cde0 | ||
|
|
25417dcda1 | ||
|
|
9a3b332130 | ||
|
|
1236a24b61 | ||
|
|
f50de743e3 | ||
|
|
0c2568aad0 | ||
|
|
b15cbeb568 | ||
|
|
afdc06638f | ||
|
|
3008ae2eeb | ||
|
|
3b4d9df0e8 | ||
|
|
48d4a5e135 | ||
|
|
ff33565513 | ||
|
|
b40bae1b50 | ||
|
|
0533d229e6 | ||
|
|
bbb755bf56 | ||
|
|
e2b8f901a3 | ||
|
|
951e2c1f89 | ||
|
|
20fd291cc3 | ||
|
|
fb160e712b | ||
|
|
9a6cc1779f | ||
|
|
b459d0fbcb | ||
|
|
9816a9c46a | ||
|
|
08e8d7343c | ||
|
|
5505791b6e | ||
|
|
1862477641 | ||
|
|
f93f2674df | ||
|
|
1d7d34b7c1 | ||
|
|
9837a7af71 | ||
|
|
d3ef4094c6 | ||
|
|
bf86291016 | ||
|
|
52a0635810 | ||
|
|
2337b4cce2 | ||
|
|
6f51b90178 | ||
|
|
162e18142c | ||
|
|
20e17861e1 | ||
|
|
deb7375d6b | ||
|
|
407051287d | ||
|
|
3d178dd6bc | ||
|
|
8ddedc60ac | ||
|
|
ddb8031e55 | ||
|
|
46cf24c193 | ||
|
|
82ab1376cc | ||
|
|
5ea68435ed | ||
|
|
58ca85ce90 | ||
|
|
7483d351c3 |
@@ -0,0 +1,6 @@
|
||||
import { CnfmModifyPage } from "@/pages/instl-sncn-old";
|
||||
|
||||
export default async function InstlSncnModifyPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
return <CnfmModifyPage id={id} />;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { CnfmViewPage } from "@/pages/instl-sncn-old";
|
||||
|
||||
export default async function InstlSncnViewPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
return <CnfmViewPage id={id} />;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { CnfmListPage } from "@/pages/instl-sncn-old";
|
||||
|
||||
export default CnfmListPage;
|
||||
@@ -0,0 +1,5 @@
|
||||
import { CnfmRegistPage } from "@/pages/instl-sncn-old";
|
||||
|
||||
export default function Page(props: any) {
|
||||
return <CnfmRegistPage {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { InstlEditPage } from "@/pages/instl-sncn";
|
||||
|
||||
interface InstlSncnEditRouteProps {
|
||||
params: Promise<{ id: string }>;
|
||||
}
|
||||
|
||||
export default async function Page({ params }: InstlSncnEditRouteProps) {
|
||||
const { id } = await params;
|
||||
return <InstlEditPage id={id} />;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { CnfmModifyPage } from "@/pages/instl-sncn";
|
||||
|
||||
export default async function InstlSncnModifyPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
return <CnfmModifyPage id={id} />;
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
import { CnfmViewPage } from "@/pages/instl-sncn";
|
||||
|
||||
export default async function InstlSncnViewPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
return <CnfmViewPage id={id} />;
|
||||
}
|
||||
import { InstlViewPage } from "@/pages/instl-sncn";
|
||||
|
||||
export default async function InstlSncnDetailPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
return <InstlViewPage id={id} />;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { CnfmListPage } from "@/pages/instl-sncn";
|
||||
|
||||
export default CnfmListPage;
|
||||
import { InstlListPage } from "@/pages/instl-sncn";
|
||||
|
||||
export default InstlListPage;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { InstlRegistPage } from "@/pages/instl-sncn";
|
||||
|
||||
interface InstlSncnRegistRouteProps {
|
||||
searchParams: Promise<{ taskSeComCd?: string }>;
|
||||
}
|
||||
|
||||
export default async function Page({ searchParams }: InstlSncnRegistRouteProps) {
|
||||
const params = await searchParams;
|
||||
const taskSeComCd = params.taskSeComCd
|
||||
? params.taskSeComCd.split(",").filter(Boolean)
|
||||
: undefined;
|
||||
|
||||
return <InstlRegistPage taskSeComCd={taskSeComCd} />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { CnfmRegistPage } from "@/pages/instl-sncn";
|
||||
|
||||
export default function Page(props: any) {
|
||||
return <CnfmRegistPage {...props} />;
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
"@tanstack/react-query-devtools": "^5.75.5",
|
||||
"@tanstack/react-table": "^8.21.2",
|
||||
"axios": "^1.8.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"js-cookie": "^3.0.5",
|
||||
"lucide-react": "^0.474.0",
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
type AcntgSeMngTreeDto,
|
||||
} from "../model/acntg-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE;
|
||||
const BASE = ENDPOINT.AS_SERVICE.ACNTG_SE;
|
||||
|
||||
async function findAll(params: AcntgSeMngSearchDto): Promise<PageResponse<AcntgSeMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<AcntgSeMngResponseDto>>(BASE, { params });
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
|
||||
import { acntgSeMngService } from "./acntg-service";
|
||||
|
||||
const acntgSeMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE] as const;
|
||||
const acntgSeMngBaseKey = [ENDPOINT.AS_SERVICE.ACNTG_SE] as const;
|
||||
|
||||
export function useAcntgSeMngPage(params: AcntgSeMngSearchDto) {
|
||||
return useQuery({
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
CmCdAdstDstrComboResponseDto,
|
||||
CmCdAdstDstrService,
|
||||
} from "../model/adstdstr-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.ADSTDSTR;
|
||||
|
||||
async function findSidoCombo(): Promise<CmCdAdstDstrComboResponseDto[]> {
|
||||
const response = await client.get<CmCdAdstDstrComboResponseDto[]>(`${BASE}/sido`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findGugunCombo(sido: string): Promise<CmCdAdstDstrComboResponseDto[]> {
|
||||
const response = await client.get<CmCdAdstDstrComboResponseDto[]>(`${BASE}/gugun`, {
|
||||
params: { sido },
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const cmCdAdstDstrService = {
|
||||
findSidoCombo,
|
||||
findGugunCombo,
|
||||
} satisfies CmCdAdstDstrService;
|
||||
@@ -0,0 +1,22 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import { cmCdAdstDstrService } from "./adstdstr-service";
|
||||
|
||||
const cmCdAdstDstrBaseKey = [ENDPOINT.AS_SERVICE.ADSTDSTR] as const;
|
||||
|
||||
export function useFindSidoCombo() {
|
||||
return useQuery({
|
||||
queryKey: [...cmCdAdstDstrBaseKey, "findSidoCombo"],
|
||||
queryFn: () => cmCdAdstDstrService.findSidoCombo(),
|
||||
});
|
||||
}
|
||||
|
||||
export function useFindGugunCombo(sido: string) {
|
||||
return useQuery({
|
||||
queryKey: [...cmCdAdstDstrBaseKey, "findGugunCombo", sido],
|
||||
queryFn: () => cmCdAdstDstrService.findGugunCombo(sido),
|
||||
enabled: Boolean(sido),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export { cmCdAdstDstrService } from "./api/adstdstr-service";
|
||||
export { useFindGugunCombo, useFindSidoCombo } from "./api/queries";
|
||||
export type {
|
||||
CmCdAdstDstrComboResponseDto,
|
||||
CmCdAdstDstrService,
|
||||
} from "./model/adstdstr-interface";
|
||||
@@ -0,0 +1,11 @@
|
||||
/** 백엔드 CmCdAdstDstrComboResponseDto */
|
||||
export interface CmCdAdstDstrComboResponseDto {
|
||||
adstDstrCd: string;
|
||||
adstDstrNm: string;
|
||||
}
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface CmCdAdstDstrService {
|
||||
findSidoCombo(): Promise<CmCdAdstDstrComboResponseDto[]>;
|
||||
findGugunCombo(sido: string): Promise<CmCdAdstDstrComboResponseDto[]>;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { AttachService } from "../model/attach-interface";
|
||||
|
||||
async function deleteAttachmentByAtflId(atflId: string): Promise<void> {
|
||||
if (!atflId) return;
|
||||
await client.delete(`${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}/${atflId}`);
|
||||
}
|
||||
|
||||
async function downloadAttachmentByAtflCd(atflCd: string): Promise<AxiosResponse> {
|
||||
return await client.get<Blob>(`${ENDPOINT.ATTACH_SERVICE.DOWNLOAD}/${atflCd}`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
||||
|
||||
export const attachService = {
|
||||
deleteAttachmentByAtflId,
|
||||
downloadAttachmentByAtflCd,
|
||||
} satisfies AttachService;
|
||||
@@ -0,0 +1,39 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import { parseFilenameFromResponse } from "../lib/parse-filename-from-response";
|
||||
|
||||
import { attachService } from "./attach-service";
|
||||
|
||||
const attachBaseKey = [ENDPOINT.ATTACH_SERVICE.ATTACHMENTS] as const;
|
||||
const attachDownloadBaseKey = [ENDPOINT.ATTACH_SERVICE.DOWNLOAD] as const;
|
||||
|
||||
export function useDeleteAttachment() {
|
||||
return useMutation({
|
||||
mutationKey: [...attachBaseKey, "delete"],
|
||||
mutationFn: (atflId: string) => attachService.deleteAttachmentByAtflId(atflId),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadAttachmentByAtflCd() {
|
||||
return useMutation({
|
||||
mutationKey: [...attachDownloadBaseKey, "download"],
|
||||
mutationFn: async (atflCd: string) => {
|
||||
const response = await attachService.downloadAttachmentByAtflCd(atflCd);
|
||||
const filename = parseFilenameFromResponse(response);
|
||||
|
||||
const blob = new Blob([response.data]);
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(link);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export { attachService } from "./api/attach-service";
|
||||
export { useDeleteAttachment, useDownloadAttachmentByAtflCd } from "./api/queries";
|
||||
export type { Attach, AttachService } from "./model/attach-interface";
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export function parseFilenameFromResponse(response: AxiosResponse): string {
|
||||
const contentDisposition = response.headers["content-disposition"];
|
||||
if (!contentDisposition) return "download";
|
||||
|
||||
const filenameMatch = contentDisposition.match(/filename\*=UTF-8''([^;]+)/);
|
||||
if (!filenameMatch?.[1]) return "download";
|
||||
|
||||
return decodeURIComponent(filenameMatch[1]);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
/** 백엔드 AtflMngResponseDto */
|
||||
export interface Attach {
|
||||
atflCd: string;
|
||||
atflSn: number;
|
||||
atflId: string;
|
||||
physFileNm: string;
|
||||
orgnlFileNm: string;
|
||||
atflFlieSz: number;
|
||||
atflType: string;
|
||||
dwnldNocs: number;
|
||||
delYn: string;
|
||||
lnkgDmnId: string;
|
||||
lnkgDmnNm: string;
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
export interface AttachService {
|
||||
deleteAttachmentByAtflId: (atflId: string) => Promise<void>;
|
||||
downloadAttachmentByAtflCd: (atflCd: string) => Promise<AxiosResponse>;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import { buildBnsSearchDto } from "../lib/build-bns-search-dto";
|
||||
import type {
|
||||
BnsDetailResponseWrapperDto,
|
||||
BnsIfService,
|
||||
BnsListResponseWrapperDto,
|
||||
BnsSearchDto,
|
||||
EmCodeListResponseDto,
|
||||
} from "../model/bns-if-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.BNS_IF;
|
||||
|
||||
async function getBnsList(params: BnsSearchDto): Promise<BnsListResponseWrapperDto> {
|
||||
const response = await client.get<BnsListResponseWrapperDto>(`${BASE}/bns`, {
|
||||
params: buildBnsSearchDto(params),
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getBnsDetail(
|
||||
gbn: string,
|
||||
yr: string,
|
||||
seqNo: string,
|
||||
): Promise<BnsDetailResponseWrapperDto> {
|
||||
const response = await client.get<BnsDetailResponseWrapperDto>(`${BASE}/bns/detail`, {
|
||||
params: { gbn, yr, seqNo },
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getEmCodeList(
|
||||
dpmCd?: string,
|
||||
lclgvrnmntCd?: string,
|
||||
): Promise<EmCodeListResponseDto> {
|
||||
const response = await client.get<EmCodeListResponseDto>(`${BASE}/emCodeList`, {
|
||||
params: { dpmCd, lclgvrnmntCd },
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const bnsIfService = {
|
||||
getBnsList,
|
||||
getBnsDetail,
|
||||
getEmCodeList,
|
||||
} satisfies BnsIfService;
|
||||
@@ -0,0 +1,33 @@
|
||||
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { BnsSearchDto } from "../model/bns-if-interface";
|
||||
|
||||
import { bnsIfService } from "./bns-if-service";
|
||||
|
||||
const bnsIfBaseKey = [ENDPOINT.AS_SERVICE.BNS_IF] as const;
|
||||
|
||||
export function useBnsList(params: BnsSearchDto, options?: { enabled?: boolean }) {
|
||||
return useQuery({
|
||||
queryKey: [...bnsIfBaseKey, "getBnsList", params],
|
||||
queryFn: () => bnsIfService.getBnsList(params),
|
||||
enabled: options?.enabled,
|
||||
placeholderData: keepPreviousData,
|
||||
});
|
||||
}
|
||||
|
||||
export function useBnsDetail(gbn: string, yr: string, seqNo: string) {
|
||||
return useQuery({
|
||||
queryKey: [...bnsIfBaseKey, "getBnsDetail", gbn, yr, seqNo],
|
||||
queryFn: () => bnsIfService.getBnsDetail(gbn, yr, seqNo),
|
||||
enabled: Boolean(gbn && yr && seqNo),
|
||||
});
|
||||
}
|
||||
|
||||
export function useEmCodeList(dpmCd?: string, lclgvrnmntCd?: string) {
|
||||
return useQuery({
|
||||
queryKey: [...bnsIfBaseKey, "getEmCodeList", dpmCd, lclgvrnmntCd],
|
||||
queryFn: () => bnsIfService.getEmCodeList(dpmCd, lclgvrnmntCd),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export { bnsIfService } from "./api/bns-if-service";
|
||||
export { useBnsDetail, useBnsList, useEmCodeList } from "./api/queries";
|
||||
export { buildBnsSearchDto } from "./lib/build-bns-search-dto";
|
||||
export type {
|
||||
BnsDetailResponseDto,
|
||||
BnsDetailResponseWrapperDto,
|
||||
BnsIfService,
|
||||
BnsListResponseDto,
|
||||
BnsListResponseWrapperDto,
|
||||
BnsSearchDto,
|
||||
EmCodeItemDto,
|
||||
EmCodeListResponseDto,
|
||||
} from "./model/bns-if-interface";
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { BnsSearchDto } from "../model/bns-if-interface";
|
||||
|
||||
export function buildBnsSearchDto(input: {
|
||||
cPage: number;
|
||||
searchStartYear?: string;
|
||||
searchSido?: string;
|
||||
searchGugun?: string;
|
||||
}): BnsSearchDto {
|
||||
const dto: BnsSearchDto = { cPage: input.cPage };
|
||||
|
||||
const year = input.searchStartYear?.trim();
|
||||
const sido = input.searchSido?.trim();
|
||||
const gugun = input.searchGugun?.trim();
|
||||
|
||||
if (year) dto.searchStartYear = year;
|
||||
if (sido) dto.searchSido = sido;
|
||||
if (gugun) dto.searchGugun = gugun;
|
||||
|
||||
return dto;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/** 백엔드 BnsSearchDto */
|
||||
export interface BnsSearchDto {
|
||||
searchStartYear?: string;
|
||||
cPage: number;
|
||||
searchSido?: string;
|
||||
searchGugun?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 BnsListResponseWrapperDto */
|
||||
export interface BnsListResponseWrapperDto {
|
||||
list: BnsListResponseDto[];
|
||||
cnt: number;
|
||||
}
|
||||
|
||||
/** 백엔드 BnsListResponseDto */
|
||||
export interface BnsListResponseDto {
|
||||
cPage: number;
|
||||
gbn: number;
|
||||
chk: number;
|
||||
seqNo: string;
|
||||
rgnNm: string;
|
||||
sido: string;
|
||||
gugun: string;
|
||||
bzCd: string;
|
||||
bzNm: string;
|
||||
yr: string;
|
||||
strtYr: string;
|
||||
edYr: string;
|
||||
totBzamt: string;
|
||||
}
|
||||
|
||||
/** 백엔드 BnsDetailResponseWrapperDto */
|
||||
export interface BnsDetailResponseWrapperDto {
|
||||
saup: unknown;
|
||||
detail: BnsDetailResponseDto;
|
||||
}
|
||||
|
||||
/** 백엔드 BnsDetailResponseDto */
|
||||
export interface BnsDetailResponseDto {
|
||||
cPage: number;
|
||||
seqNo: string;
|
||||
confBzCd: string;
|
||||
chngDgr: string;
|
||||
yr: string;
|
||||
sido: string;
|
||||
gugun: string;
|
||||
rvbsnNm: string;
|
||||
lgbsnNm: string;
|
||||
mdmbsnNm: string;
|
||||
lclgvrnmntNm: string;
|
||||
accKdNm: string;
|
||||
bzKdNm: string;
|
||||
untBzNm: string;
|
||||
dtlBzNm: string;
|
||||
mevBzNm: string;
|
||||
ddtlBzNm: string;
|
||||
strtYr: string;
|
||||
edYr: string;
|
||||
aidRt: string;
|
||||
bzStatus: string;
|
||||
bzCd: string;
|
||||
bzNm: string;
|
||||
bzLoc: string;
|
||||
efflWqltStndrdNm: string;
|
||||
goalYear: string;
|
||||
bssProm: string;
|
||||
uppPlan: string;
|
||||
techInsp: string;
|
||||
bssCont: string;
|
||||
rmk: string;
|
||||
inflBscFctNm: string;
|
||||
inflBscFctCd: string;
|
||||
trtMtd: string;
|
||||
swrExtns: string;
|
||||
swrChng: string;
|
||||
swrRnvt: string;
|
||||
totFamNum: string;
|
||||
pumpCnt: string;
|
||||
rvWbsn: string;
|
||||
rvText: string;
|
||||
imprvExpctFlw: string;
|
||||
imprvExpctWqlt: string;
|
||||
trtplntPlEfflWqlt: string;
|
||||
wqltAvg: string;
|
||||
wqltHgh: string;
|
||||
wqltLow: string;
|
||||
stdCost: string;
|
||||
bzEtc: string;
|
||||
bscFctCd: string;
|
||||
bscFctNm: string;
|
||||
fctCpc: string;
|
||||
fctCpcAfr: string;
|
||||
trtDstrArea: string;
|
||||
trtDstrAreaAfr: string;
|
||||
swrTrtPopl: string;
|
||||
swrTrtPoplAfr: string;
|
||||
adstPopl: string;
|
||||
}
|
||||
|
||||
/** 백엔드 EmCodeItemDto */
|
||||
export interface EmCodeItemDto {
|
||||
code: string;
|
||||
data: string;
|
||||
upCode: string;
|
||||
}
|
||||
|
||||
/** 백엔드 EmCodeListResponseDto */
|
||||
export interface EmCodeListResponseDto {
|
||||
rvbsnList: EmCodeItemDto[];
|
||||
lgbsnList: EmCodeItemDto[];
|
||||
mdmbsnList: EmCodeItemDto[];
|
||||
accList: EmCodeItemDto[];
|
||||
bzList: EmCodeItemDto[];
|
||||
untList: EmCodeItemDto[];
|
||||
dtlList: EmCodeItemDto[];
|
||||
mevList: EmCodeItemDto[];
|
||||
ddtlList: EmCodeItemDto[];
|
||||
}
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface BnsIfService {
|
||||
getBnsList(params: BnsSearchDto): Promise<BnsListResponseWrapperDto>;
|
||||
getBnsDetail(gbn: string, yr: string, seqNo: string): Promise<BnsDetailResponseWrapperDto>;
|
||||
getEmCodeList(dpmCd?: string, lclgvrnmntCd?: string): Promise<EmCodeListResponseDto>;
|
||||
}
|
||||
@@ -11,33 +11,25 @@ import type {
|
||||
CklstArtclUpdateRequest,
|
||||
} from "../model/cklst-artcl-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.CKLST_ARTCL;
|
||||
|
||||
async function findPage(params: CklstArtclSearchParams): Promise<PageResponse<CklstArtcl>> {
|
||||
const response = await client.get<PageResponse<CklstArtcl>>(
|
||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL,
|
||||
{ params },
|
||||
);
|
||||
const response = await client.get<PageResponse<CklstArtcl>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findByCklstSn(cklstSn: number): Promise<CklstArtcl[]> {
|
||||
const response = await client.get<CklstArtcl[]>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/by-cklst/${cklstSn}`,
|
||||
);
|
||||
const response = await client.get<CklstArtcl[]>(`${BASE}/by-cklst/${cklstSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findById(cklstArtclSn: number, cklstSn: number): Promise<CklstArtcl> {
|
||||
const response = await client.get<CklstArtcl>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
|
||||
);
|
||||
const response = await client.get<CklstArtcl>(`${BASE}/${cklstArtclSn}/${cklstSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function create(body: CklstArtclSaveRequest): Promise<CklstArtclId> {
|
||||
const response = await client.post<CklstArtclId>(
|
||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL,
|
||||
body,
|
||||
);
|
||||
const response = await client.post<CklstArtclId>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -46,17 +38,12 @@ async function update(
|
||||
cklstSn: number,
|
||||
body: CklstArtclUpdateRequest,
|
||||
): Promise<CklstArtclId> {
|
||||
const response = await client.put<CklstArtclId>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
|
||||
body,
|
||||
);
|
||||
const response = await client.put<CklstArtclId>(`${BASE}/${cklstArtclSn}/${cklstSn}`, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function remove(cklstArtclSn: number, cklstSn: number): Promise<CklstArtclId> {
|
||||
const response = await client.delete<CklstArtclId>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
|
||||
);
|
||||
const response = await client.delete<CklstArtclId>(`${BASE}/${cklstArtclSn}/${cklstSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,40 +11,39 @@ import type {
|
||||
CklstTreeSearchParams,
|
||||
} from "../model/cklst-mng-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.CKLST;
|
||||
|
||||
async function findPage(params: CklstMngSearchParams): Promise<PageResponse<CklstMng>> {
|
||||
const response = await client.get<PageResponse<CklstMng>>(ENDPOINT.AS_CHECKLIST_SERVICE.CKLST, {
|
||||
const response = await client.get<PageResponse<CklstMng>>(BASE, {
|
||||
params,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findById(cklstSn: number): Promise<CklstMng> {
|
||||
const response = await client.get<CklstMng>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`);
|
||||
const response = await client.get<CklstMng>(`${BASE}/${cklstSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findTree(params: CklstTreeSearchParams): Promise<CklstTreeNode[]> {
|
||||
const response = await client.get<CklstTreeNode[]>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/list/tree`, {
|
||||
const response = await client.get<CklstTreeNode[]>(`${BASE}/list/tree`, {
|
||||
params,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function create(body: CklstMngSaveRequest): Promise<number> {
|
||||
const response = await client.post<number>(ENDPOINT.AS_CHECKLIST_SERVICE.CKLST, body);
|
||||
const response = await client.post<number>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(cklstSn: number, body: CklstMngSaveRequest): Promise<number> {
|
||||
const response = await client.put<number>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`,
|
||||
body,
|
||||
);
|
||||
const response = await client.put<number>(`${BASE}/${cklstSn}`, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function remove(cklstSn: number): Promise<number> {
|
||||
const response = await client.delete<number>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`);
|
||||
const response = await client.delete<number>(`${BASE}/${cklstSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,15 @@ import type {
|
||||
CklstRvwUpdateRequest,
|
||||
} from "../model/cklst-rvw-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.CKLST_RVW;
|
||||
|
||||
async function findPage(params: CklstRvwSearchParams): Promise<PageResponse<CklstRvw>> {
|
||||
const response = await client.get<PageResponse<CklstRvw>>(
|
||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW,
|
||||
{ params },
|
||||
);
|
||||
const response = await client.get<PageResponse<CklstRvw>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findByArtcl(cklstSn: number, cklstArtclSn: number): Promise<CklstRvw[]> {
|
||||
const response = await client.get<CklstRvw[]>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/by-artcl/${cklstSn}/${cklstArtclSn}`,
|
||||
);
|
||||
const response = await client.get<CklstRvw[]>(`${BASE}/by-artcl/${cklstSn}/${cklstArtclSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -31,17 +28,12 @@ async function findById(
|
||||
cklstArtclSn: number,
|
||||
cklstSn: number,
|
||||
): Promise<CklstRvw> {
|
||||
const response = await client.get<CklstRvw>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||
);
|
||||
const response = await client.get<CklstRvw>(`${BASE}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function create(body: CklstRvwSaveRequest): Promise<CklstRvwId> {
|
||||
const response = await client.post<CklstRvwId>(
|
||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW,
|
||||
body,
|
||||
);
|
||||
const response = await client.post<CklstRvwId>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -52,7 +44,7 @@ async function update(
|
||||
body: CklstRvwUpdateRequest,
|
||||
): Promise<CklstRvwId> {
|
||||
const response = await client.put<CklstRvwId>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||
`${BASE}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||
body,
|
||||
);
|
||||
return response.data;
|
||||
@@ -64,7 +56,7 @@ async function remove(
|
||||
cklstSn: number,
|
||||
): Promise<CklstRvwId> {
|
||||
const response = await client.delete<CklstRvwId>(
|
||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||
`${BASE}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ import { cklstArtclService } from "./cklst-artcl-service";
|
||||
import { cklstMngService } from "./cklst-mng-service";
|
||||
import { cklstRvwService } from "./cklst-rvw-service";
|
||||
|
||||
const cklstMngBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST] as const;
|
||||
const cklstArtclBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL] as const;
|
||||
const cklstRvwBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW] as const;
|
||||
const cklstMngBaseKey = [ENDPOINT.AS_SERVICE.CKLST] as const;
|
||||
const cklstArtclBaseKey = [ENDPOINT.AS_SERVICE.CKLST_ARTCL] as const;
|
||||
const cklstRvwBaseKey = [ENDPOINT.AS_SERVICE.CKLST_RVW] as const;
|
||||
|
||||
export function useCklstMngPage(params: CklstMngSearchParams) {
|
||||
return useQuery({
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
type CnstpSeMngTreeDto,
|
||||
} from "../model/cnstp-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE;
|
||||
const BASE = ENDPOINT.AS_SERVICE.CNSTP_SE;
|
||||
|
||||
async function findAll(params: CnstpSeMngSearchDto): Promise<PageResponse<CnstpSeMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<CnstpSeMngResponseDto>>(BASE, { params });
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
|
||||
import { cnstpSeMngService } from "./cnstp-service";
|
||||
|
||||
const cnstpSeMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE] as const;
|
||||
const cnstpSeMngBaseKey = [ENDPOINT.AS_SERVICE.CNSTP_SE] as const;
|
||||
|
||||
export function useCnstpSeMngPage(params: CnstpSeMngSearchDto) {
|
||||
return useQuery({
|
||||
|
||||
@@ -1,17 +1,67 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
|
||||
import type {
|
||||
ElaprDmndResponse,
|
||||
ElaprDmndSaveRequest,
|
||||
ElaprDmndResponseDto,
|
||||
ElaprDmndSaveRequestDto,
|
||||
ElaprDmndSearchDto,
|
||||
ElaprDmndService,
|
||||
ElaprDocPrgrsResponseDto,
|
||||
} from "../model/elapr-dmnd-interface";
|
||||
|
||||
async function create(body: ElaprDmndSaveRequest): Promise<ElaprDmndResponse> {
|
||||
const response = await client.post<ElaprDmndResponse>(ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, body);
|
||||
const BASE = ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND;
|
||||
|
||||
async function findPage(params: ElaprDmndSearchDto): Promise<PageResponse<ElaprDmndResponseDto>> {
|
||||
const response = await client.get<PageResponse<ElaprDmndResponseDto>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const ElaprDmndApi: ElaprDmndService = {
|
||||
create,
|
||||
};
|
||||
async function findById(elaprDmndId: string): Promise<ElaprDmndResponseDto> {
|
||||
const response = await client.get<ElaprDmndResponseDto>(`${BASE}/${elaprDmndId}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function save(body: ElaprDmndSaveRequestDto): Promise<ElaprDmndResponseDto> {
|
||||
const response = await client.post<ElaprDmndResponseDto>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(
|
||||
elaprDmndId: string,
|
||||
body: ElaprDmndSaveRequestDto,
|
||||
): Promise<ElaprDmndResponseDto> {
|
||||
const response = await client.put<ElaprDmndResponseDto>(`${BASE}/${elaprDmndId}`, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function updateStatus(
|
||||
elaprDmndId: string,
|
||||
atrzSttsComCd: string,
|
||||
): Promise<ElaprDmndResponseDto> {
|
||||
const response = await client.put<ElaprDmndResponseDto>(`${BASE}/${elaprDmndId}/status`, null, {
|
||||
params: { atrzSttsComCd },
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function remove(elaprDmndId: string): Promise<void> {
|
||||
await client.delete(`${BASE}/${elaprDmndId}`);
|
||||
}
|
||||
|
||||
async function findDocPrgrsByDocNo(elaprDocNo: string): Promise<ElaprDocPrgrsResponseDto[]> {
|
||||
const response = await client.get<ElaprDocPrgrsResponseDto[]>(
|
||||
`${BASE}/sanc/docprgrs/${elaprDocNo}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const elaprDmndService = {
|
||||
findPage,
|
||||
findById,
|
||||
save,
|
||||
update,
|
||||
updateStatus,
|
||||
remove,
|
||||
findDocPrgrsByDocNo,
|
||||
} satisfies ElaprDmndService;
|
||||
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
ElaprAplnSaveRequest,
|
||||
ElaprAplnUpdateRequest,
|
||||
} from "../model/elapr-apln-interface";
|
||||
import type { ElaprDmndSaveRequestDto, ElaprDmndSearchDto } from "../model/elapr-dmnd-interface";
|
||||
import type {
|
||||
ElaprTmpltSaveRequest,
|
||||
ElaprTmpltSearchParams,
|
||||
@@ -15,10 +16,12 @@ import type {
|
||||
} from "../model/elapr-tmplt-interface";
|
||||
|
||||
import { elaprAplnService } from "./elapr-apln-service";
|
||||
import { elaprDmndService } from "./elapr-dmnd-service";
|
||||
import { elaprTmpltService } from "./elapr-tmplt-service";
|
||||
|
||||
const elaprTmpltBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT] as const;
|
||||
const elaprAplnBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN] as const;
|
||||
const elaprDmndBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND] as const;
|
||||
|
||||
export function useElaprTmpltPage(params: ElaprTmpltSearchParams) {
|
||||
return useQuery({
|
||||
@@ -50,13 +53,8 @@ export function useUpdateElaprTmplt() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
elaprTmpltId,
|
||||
body,
|
||||
}: {
|
||||
elaprTmpltId: string;
|
||||
body: ElaprTmpltUpdateRequest;
|
||||
}) => elaprTmpltService.update(elaprTmpltId, body),
|
||||
mutationFn: ({ elaprTmpltId, body }: { elaprTmpltId: string; body: ElaprTmpltUpdateRequest }) =>
|
||||
elaprTmpltService.update(elaprTmpltId, body),
|
||||
onSuccess: (_data, { elaprTmpltId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprTmpltBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
@@ -99,12 +97,8 @@ export function useSaveMultiElaprApln() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
body,
|
||||
}: {
|
||||
body: ElaprAplnSaveRequest[];
|
||||
elaprTmpltId: string;
|
||||
}) => elaprAplnService.saveMulti(body),
|
||||
mutationFn: ({ body }: { body: ElaprAplnSaveRequest[]; elaprTmpltId: string }) =>
|
||||
elaprAplnService.saveMulti(body),
|
||||
onSuccess: (_data, { elaprTmpltId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
@@ -118,13 +112,8 @@ export function useUpdateElaprApln() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
aplnId,
|
||||
body,
|
||||
}: {
|
||||
aplnId: string;
|
||||
body: ElaprAplnUpdateRequest;
|
||||
}) => elaprAplnService.update(aplnId, body),
|
||||
mutationFn: ({ aplnId, body }: { aplnId: string; body: ElaprAplnUpdateRequest }) =>
|
||||
elaprAplnService.update(aplnId, body),
|
||||
onSuccess: (_data, { body, aplnId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
@@ -141,12 +130,8 @@ export function useDeleteElaprApln() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
aplnId,
|
||||
}: {
|
||||
aplnId: string;
|
||||
elaprTmpltId: string;
|
||||
}) => elaprAplnService.remove(aplnId),
|
||||
mutationFn: ({ aplnId }: { aplnId: string; elaprTmpltId: string }) =>
|
||||
elaprAplnService.remove(aplnId),
|
||||
onSuccess: (_data, { elaprTmpltId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
@@ -160,12 +145,8 @@ export function useReorderElaprApln() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
body,
|
||||
}: {
|
||||
body: ElaprAplnReorderRequest;
|
||||
elaprTmpltId: string;
|
||||
}) => elaprAplnService.reorder(body),
|
||||
mutationFn: ({ body }: { body: ElaprAplnReorderRequest; elaprTmpltId: string }) =>
|
||||
elaprAplnService.reorder(body),
|
||||
onSuccess: (_data, { elaprTmpltId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
@@ -174,3 +155,78 @@ export function useReorderElaprApln() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useElaprDmndPage(params: ElaprDmndSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...elaprDmndBaseKey, "findPage", params],
|
||||
queryFn: () => elaprDmndService.findPage(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useElaprDmnd(elaprDmndId: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...elaprDmndBaseKey, "findById", elaprDmndId],
|
||||
queryFn: () => elaprDmndService.findById(elaprDmndId!),
|
||||
enabled: Boolean(elaprDmndId),
|
||||
});
|
||||
}
|
||||
|
||||
export function useElaprDocPrgrsByDocNo(elaprDocNo: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...elaprDmndBaseKey, "findDocPrgrsByDocNo", elaprDocNo],
|
||||
queryFn: () => elaprDmndService.findDocPrgrsByDocNo(elaprDocNo!),
|
||||
enabled: Boolean(elaprDocNo),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSaveElaprDmnd() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (body: ElaprDmndSaveRequestDto) => elaprDmndService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateElaprDmnd() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ elaprDmndId, body }: { elaprDmndId: string; body: ElaprDmndSaveRequestDto }) =>
|
||||
elaprDmndService.update(elaprDmndId, body),
|
||||
onSuccess: (_data, { elaprDmndId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...elaprDmndBaseKey, "findById", elaprDmndId],
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateElaprDmndStatus() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ elaprDmndId, atrzSttsComCd }: { elaprDmndId: string; atrzSttsComCd: string }) =>
|
||||
elaprDmndService.updateStatus(elaprDmndId, atrzSttsComCd),
|
||||
onSuccess: (_data, { elaprDmndId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...elaprDmndBaseKey, "findById", elaprDmndId],
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useRemoveElaprDmnd() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (elaprDmndId: string) => elaprDmndService.remove(elaprDmndId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export { elaprAplnService } from "./api/elapr-apln-service";
|
||||
export { elaprDmndService } from "./api/elapr-dmnd-service";
|
||||
export { elaprTmpltService } from "./api/elapr-tmplt-service";
|
||||
export {
|
||||
useCreateElaprTmplt,
|
||||
@@ -6,11 +7,18 @@ export {
|
||||
useDeleteElaprTmplt,
|
||||
useElaprApln,
|
||||
useElaprAplnPage,
|
||||
useElaprDmnd,
|
||||
useElaprDmndPage,
|
||||
useElaprDocPrgrsByDocNo,
|
||||
useElaprTmplt,
|
||||
useElaprTmpltPage,
|
||||
useRemoveElaprDmnd,
|
||||
useReorderElaprApln,
|
||||
useSaveElaprDmnd,
|
||||
useSaveMultiElaprApln,
|
||||
useUpdateElaprApln,
|
||||
useUpdateElaprDmnd,
|
||||
useUpdateElaprDmndStatus,
|
||||
useUpdateElaprTmplt,
|
||||
} from "./api/queries";
|
||||
export {
|
||||
@@ -24,6 +32,13 @@ export {
|
||||
type ElaprAplnService,
|
||||
type ElaprAplnUpdateRequest,
|
||||
} from "./model/elapr-apln-interface";
|
||||
export type {
|
||||
ElaprDmndResponseDto,
|
||||
ElaprDmndSaveRequestDto,
|
||||
ElaprDmndSearchDto,
|
||||
ElaprDmndService,
|
||||
ElaprDocPrgrsResponseDto,
|
||||
} from "./model/elapr-dmnd-interface";
|
||||
export type {
|
||||
ElaprTmplt,
|
||||
ElaprTmpltSaveRequest,
|
||||
|
||||
@@ -1,22 +1,62 @@
|
||||
export interface ElaprDmndSaveRequest {
|
||||
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||
|
||||
/** 백엔드 ElaprDmndSaveRequestDto */
|
||||
export interface ElaprDmndSaveRequestDto {
|
||||
elaprDocNo: string;
|
||||
elaprTmpltId: string;
|
||||
dmndTtl: string;
|
||||
dmndCn: string;
|
||||
}
|
||||
|
||||
export interface ElaprDmndResponse {
|
||||
/** 백엔드 ElaprDmndResponseDto */
|
||||
export interface ElaprDmndResponseDto {
|
||||
elaprDmndId: string;
|
||||
rqstrUuid?: string;
|
||||
elaprDocNo: string;
|
||||
elaprTmpltId: string;
|
||||
dmndTtl: string;
|
||||
dmndCn: string;
|
||||
atrzSttsComCd: string;
|
||||
rqstrUuid: string;
|
||||
regDt: string;
|
||||
updtDt: string;
|
||||
atrzSttsComNm?: string;
|
||||
dmndDt?: string;
|
||||
updtDt?: string;
|
||||
}
|
||||
|
||||
export interface ElaprDmndService {
|
||||
create(body: ElaprDmndSaveRequest): Promise<ElaprDmndResponse>;
|
||||
/** 백엔드 ElaprDmndSearchDto + Pageable */
|
||||
export interface ElaprDmndSearchDto extends PageableParams {
|
||||
rqstrUuid?: string;
|
||||
atrzSttsComCd?: string;
|
||||
dmndTtl?: string;
|
||||
dmndDtStart?: string;
|
||||
dmndDtEnd?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 ElaprDocPrgrsResponseDto */
|
||||
export interface ElaprDocPrgrsResponseDto {
|
||||
elaprDocNo: string;
|
||||
elaprDmndId: string;
|
||||
elaprPrgrsId: string;
|
||||
atrzSeqNo?: number;
|
||||
atrzSeComCd: string;
|
||||
atrzSeComNm?: string;
|
||||
aprvrUuid?: string;
|
||||
aprvrUuidNm?: string;
|
||||
atrzPrgrsSttsComCd: string;
|
||||
atrzPrgrsSttsComNm?: string;
|
||||
rjctRsn?: string;
|
||||
atrzDt?: string;
|
||||
jbpsSeNm?: string;
|
||||
jbgdSeNm?: string;
|
||||
ognzNm?: string;
|
||||
}
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface ElaprDmndService {
|
||||
findPage(params: ElaprDmndSearchDto): Promise<PageResponse<ElaprDmndResponseDto>>;
|
||||
findById(elaprDmndId: string): Promise<ElaprDmndResponseDto>;
|
||||
save(body: ElaprDmndSaveRequestDto): Promise<ElaprDmndResponseDto>;
|
||||
update(elaprDmndId: string, body: ElaprDmndSaveRequestDto): Promise<ElaprDmndResponseDto>;
|
||||
updateStatus(elaprDmndId: string, atrzSttsComCd: string): Promise<ElaprDmndResponseDto>;
|
||||
remove(elaprDmndId: string): Promise<void>;
|
||||
findDocPrgrsByDocNo(elaprDocNo: string): Promise<ElaprDocPrgrsResponseDto[]>;
|
||||
}
|
||||
|
||||
@@ -11,50 +11,41 @@ import type {
|
||||
EsntlAtchFileMngTreeSearchParams,
|
||||
} from "../model/esntl-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.ESNTL_ATCH_FILE;
|
||||
|
||||
async function findTree(
|
||||
params: EsntlAtchFileMngTreeSearchParams,
|
||||
): Promise<EsntlAtchFileMngTreeResponseDto[]> {
|
||||
const response = await client.get<EsntlAtchFileMngTreeResponseDto[]>(
|
||||
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/list/tree`,
|
||||
{ params },
|
||||
);
|
||||
const response = await client.get<EsntlAtchFileMngTreeResponseDto[]>(`${BASE}/list/tree`, {
|
||||
params,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findPage(
|
||||
params: EsntlAtchFileMngSearchParams,
|
||||
): Promise<PageResponse<EsntlAtchFileMng>> {
|
||||
const response = await client.get<PageResponse<EsntlAtchFileMng>>(
|
||||
ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE,
|
||||
{ params },
|
||||
);
|
||||
const response = await client.get<PageResponse<EsntlAtchFileMng>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findById(esntlAtchFileId: string): Promise<EsntlAtchFileMng> {
|
||||
const response = await client.get<EsntlAtchFileMng>(
|
||||
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
||||
);
|
||||
const response = await client.get<EsntlAtchFileMng>(`${BASE}/${esntlAtchFileId}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function create(body: EsntlAtchFileMngSaveRequest): Promise<string> {
|
||||
const response = await client.post<string>(ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE, body);
|
||||
const response = await client.post<string>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(esntlAtchFileId: string, body: EsntlAtchFileMngSaveRequest): Promise<string> {
|
||||
const response = await client.put<string>(
|
||||
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
||||
body,
|
||||
);
|
||||
const response = await client.put<string>(`${BASE}/${esntlAtchFileId}`, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function remove(esntlAtchFileId: string): Promise<string> {
|
||||
const response = await client.delete<string>(
|
||||
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
||||
);
|
||||
const response = await client.delete<string>(`${BASE}/${esntlAtchFileId}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
|
||||
import { esntlAtchFileMngService } from "./esntl-service";
|
||||
|
||||
const esntlAtchFileMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE] as const;
|
||||
const esntlAtchFileMngBaseKey = [ENDPOINT.AS_SERVICE.ESNTL_ATCH_FILE] as const;
|
||||
|
||||
export function useEsntlAtchFileMngTree(params: EsntlAtchFileMngTreeSearchParams) {
|
||||
return useQuery({
|
||||
|
||||
@@ -1,41 +1,91 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
|
||||
import type {
|
||||
AdstZoneResponseDto,
|
||||
DocPrgrsUpdateRequestDto,
|
||||
InstlSncnApplySaveRequestDto,
|
||||
InstlSncnMng,
|
||||
InstlSncnMngDetResponse,
|
||||
InstlSncnMngResponseDto,
|
||||
InstlSncnMngSaveRequestDto,
|
||||
InstlSncnMngSearchParams,
|
||||
InstlSncnMngService,
|
||||
SpringPage,
|
||||
InstlSncnMngDetResponse,
|
||||
InstlSncnMngUpdateRequestDto,
|
||||
} from "../model/instl-sncn-interface";
|
||||
|
||||
export class InstlSncnApiService implements InstlSncnMngService {
|
||||
public async getPage(params: InstlSncnMngSearchParams): Promise<SpringPage<InstlSncnMng>> {
|
||||
const response = await client.get<SpringPage<InstlSncnMng>>(ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN, {
|
||||
params,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
async function getSidoCombo(): Promise<AdstZoneResponseDto[]> {
|
||||
const response = await client.get<AdstZoneResponseDto[]>(
|
||||
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}/sido`,
|
||||
);
|
||||
|
||||
public async getById(id: string): Promise<InstlSncnMngDetResponse> {
|
||||
const response = await client.get<InstlSncnMngDetResponse>(`${ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN}/${id}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async saveApply(payload: InstlSncnApplySaveRequestDto): Promise<string> {
|
||||
const response = await client.post<string>(
|
||||
`${ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN}/save-apply`,
|
||||
payload,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
public async techReview(payload: InstlSncnApplySaveRequestDto): Promise<string> {
|
||||
const response = await client.post<string>(
|
||||
`${ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN}/tech-review`,
|
||||
payload,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const InstlSncnApi = new InstlSncnApiService();
|
||||
async function getSigunguCombo(sidoCd: string): Promise<AdstZoneResponseDto[]> {
|
||||
const response = await client.get<AdstZoneResponseDto[]>(
|
||||
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}/sigungu`,
|
||||
{ params: { sidoCd } },
|
||||
);
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
const BASE = ENDPOINT.AS_SERVICE.INSTL_SNCN;
|
||||
|
||||
async function getPage(
|
||||
params: InstlSncnMngSearchParams,
|
||||
): Promise<PageResponse<InstlSncnMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<InstlSncnMngResponseDto>>(BASE, {
|
||||
params,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getById(id: string): Promise<InstlSncnMngDetResponse> {
|
||||
const response = await client.get<InstlSncnMngDetResponse>(`${BASE}/${id}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function save(payload: InstlSncnMngSaveRequestDto): Promise<string> {
|
||||
const response = await client.post<string>(BASE, payload);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function saveApply(payload: InstlSncnApplySaveRequestDto): Promise<string> {
|
||||
const response = await client.post<string>(`${BASE}/save-apply`, payload);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(id: string, payload: InstlSncnMngUpdateRequestDto): Promise<void> {
|
||||
await client.put(`${BASE}/${id}`, payload);
|
||||
}
|
||||
|
||||
async function techReview(id: string, payload: InstlSncnApplySaveRequestDto): Promise<void> {
|
||||
await client.post(`${BASE}/${id}/tech-review`, payload);
|
||||
}
|
||||
|
||||
async function remove(id: string): Promise<void> {
|
||||
await client.delete(`${BASE}/${id}`);
|
||||
}
|
||||
|
||||
async function changePrgrsSttsComCd(payload: DocPrgrsUpdateRequestDto): Promise<void> {
|
||||
await client.post(`${BASE}/doc/updatePrgrsStts`, payload);
|
||||
}
|
||||
|
||||
export const instlSncnService = {
|
||||
getPage,
|
||||
getById,
|
||||
save,
|
||||
saveApply,
|
||||
update,
|
||||
techReview,
|
||||
remove,
|
||||
changePrgrsSttsComCd,
|
||||
} satisfies InstlSncnMngService;
|
||||
|
||||
// TODO: st-anls-mst service 로 분리
|
||||
export const instlSncnRegionService = {
|
||||
getSidoCombo,
|
||||
getSigunguCombo,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
DocPrgrsUpdateRequestDto,
|
||||
InstlSncnApplySaveRequestDto,
|
||||
InstlSncnMngSaveRequestDto,
|
||||
InstlSncnMngSearchParams,
|
||||
InstlSncnMngUpdateRequestDto,
|
||||
} from "../model/instl-sncn-interface";
|
||||
|
||||
import { instlSncnRegionService, instlSncnService } from "./instl-sncn-service";
|
||||
|
||||
export const instlSncnKeys = {
|
||||
all: ["instl-sncn"] as const,
|
||||
list: () => [...instlSncnKeys.all, "list"] as const,
|
||||
detail: (id: string) => [...instlSncnKeys.all, "detail", id] as const,
|
||||
sidoCombo: () => [ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST, "sido"] as const,
|
||||
sigunguCombo: (sidoCd: string) =>
|
||||
[ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST, "sigungu", sidoCd] as const,
|
||||
};
|
||||
|
||||
export function useInstlSncnList(params: InstlSncnMngSearchParams) {
|
||||
return useQuery({
|
||||
queryKey: [...instlSncnKeys.list(), params],
|
||||
queryFn: () => instlSncnService.getPage(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnDetail(id: string) {
|
||||
return useQuery({
|
||||
queryKey: instlSncnKeys.detail(id),
|
||||
queryFn: () => instlSncnService.getById(id),
|
||||
enabled: Boolean(id),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnSidoCombo() {
|
||||
return useQuery({
|
||||
queryKey: instlSncnKeys.sidoCombo(),
|
||||
queryFn: () => instlSncnRegionService.getSidoCombo(),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnSigunguCombo(sidoCd: string) {
|
||||
return useQuery({
|
||||
queryKey: instlSncnKeys.sigunguCombo(sidoCd),
|
||||
queryFn: () => instlSncnRegionService.getSigunguCombo(sidoCd),
|
||||
enabled: Boolean(sidoCd),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnSave() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (payload: InstlSncnMngSaveRequestDto) => instlSncnService.save(payload),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnSaveApply() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (payload: InstlSncnApplySaveRequestDto) => instlSncnService.saveApply(payload),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnUpdate() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ id, payload }: { id: string; payload: InstlSncnMngUpdateRequestDto }) =>
|
||||
instlSncnService.update(id, payload),
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(variables.id) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnTechReview() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ id, payload }: { id: string; payload: InstlSncnApplySaveRequestDto }) =>
|
||||
instlSncnService.techReview(id, payload),
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(variables.id) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnRemove() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => instlSncnService.remove(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstlSncnChangePrgrsStts() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (payload: DocPrgrsUpdateRequestDto) =>
|
||||
instlSncnService.changePrgrsSttsComCd(payload),
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.detail(variables.docNo),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,12 +1,33 @@
|
||||
export { InstlSncnApi } from "./api/instl-sncn-service";
|
||||
export { instlSncnRegionService, instlSncnService } from "./api/instl-sncn-service";
|
||||
export {
|
||||
instlSncnKeys,
|
||||
useInstlSncnDetail,
|
||||
useInstlSncnList,
|
||||
useInstlSncnSidoCombo,
|
||||
useInstlSncnSigunguCombo,
|
||||
useInstlSncnTechReview,
|
||||
} from "./api/queries";
|
||||
export {
|
||||
type AdstZoneResponseDto,
|
||||
type AtflMngClientResponseDto,
|
||||
type BizCstTreeDto,
|
||||
type BizSclTreeDto,
|
||||
type CklstRvwRsltTreeDto,
|
||||
type DocPrgrsUpdateRequestDto,
|
||||
type ElaprDocPrgrsClientResponseDto,
|
||||
type EsntlAtchFileMngTreeResponseDto,
|
||||
INSTL_SNCN_REGISTER_SELECTION_KEY,
|
||||
type InstlSncnApplySaveRequestDto,
|
||||
type InstlSncnBizCstSaveRequestDto,
|
||||
type InstlSncnBzScaleSaveDto,
|
||||
type InstlSncnCklstResultSaveDto,
|
||||
type InstlSncnMng,
|
||||
type InstlSncnEsntlAtchFileSaveDto,
|
||||
type InstlSncnMngDetResponse,
|
||||
type InstlSncnMngResponseDto,
|
||||
type InstlSncnMngSaveRequestDto,
|
||||
type InstlSncnMngSearchParams,
|
||||
type SpringPage,
|
||||
type ElaprDocPrgrsClientResponseDto,
|
||||
type InstlSncnRvwOpnnResponseDto,
|
||||
type InstlSncnRvwOpnnSaveRequestDto,
|
||||
type InstlSncnSplmntDmndSaveDto,
|
||||
type ReviewStepCode,
|
||||
} from "./model/instl-sncn-interface";
|
||||
|
||||
@@ -1,74 +1,127 @@
|
||||
export const INSTL_SNCN_REGISTER_SELECTION_KEY = "instlSncnRegisterSelection";
|
||||
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||
|
||||
export interface SpringPage<T> {
|
||||
content: T[];
|
||||
totalElements: number;
|
||||
totalPages: number;
|
||||
number: number;
|
||||
size: number;
|
||||
first: boolean;
|
||||
last: boolean;
|
||||
numberOfElements: number;
|
||||
/** 행정구역(시도·시군구) 콤보 응답 DTO */
|
||||
export interface AdstZoneResponseDto {
|
||||
/** 행정구역 코드 */
|
||||
adstCd: string;
|
||||
/** 행정구역 명 */
|
||||
adstNm: string;
|
||||
}
|
||||
|
||||
export interface InstlSncnMngSearchParams {
|
||||
export const INSTL_SNCN_REGISTER_SELECTION_KEY = "instlSncnRegisterSelection";
|
||||
|
||||
export interface InstlSncnMngSearchParams extends PageableParams {
|
||||
bizNm?: string;
|
||||
taskSeComCd?: string;
|
||||
sidoComCd?: string;
|
||||
sggComCd?: string;
|
||||
page?: number;
|
||||
size?: number;
|
||||
sort?: string;
|
||||
}
|
||||
|
||||
export interface InstlSncnMng {
|
||||
gugun: string;
|
||||
sido: string;
|
||||
instlSncnDocNo: string;
|
||||
admdstCd: string;
|
||||
sidoNm?: string;
|
||||
sggNm?: string;
|
||||
chrgrNm?: string;
|
||||
instNm?: string;
|
||||
envoSeComCd: string;
|
||||
/** 설치인가관리 저장 요청 DTO */
|
||||
export interface InstlSncnMngSaveRequestDto {
|
||||
/** 설치인가문서번호 */
|
||||
instlSncnDocNo?: string;
|
||||
/** 행정구역코드 */
|
||||
admdstCd?: string;
|
||||
/** 환경청구분공통코드 */
|
||||
envoSeComCd?: string;
|
||||
/** 인가구분공통코드 */
|
||||
sncnSeComCd: string;
|
||||
envoSeCdNm: string;
|
||||
/** 업무구분공통코드 */
|
||||
taskSeComCd: string;
|
||||
taskSeCdNm: string;
|
||||
bgtBizCd: string;
|
||||
bgtAplyYr: string;
|
||||
/** 예산사업코드 */
|
||||
bgtBizCd?: string;
|
||||
/** 예산신청연도 */
|
||||
bgtAplyYr?: string;
|
||||
/** 사업명 */
|
||||
bizNm: string;
|
||||
/** 사업시작연도 */
|
||||
bizBgngYr: string;
|
||||
/** 사업종료연도 */
|
||||
bizEndYr: string;
|
||||
/** 사업내용 */
|
||||
bizCn: string;
|
||||
aplcntNm: string;
|
||||
aplcntMblTelno: string;
|
||||
aplcntOgdpNm: string;
|
||||
aplcntEmlAddr: string;
|
||||
/** 신청자명 */
|
||||
aplcntNm?: string;
|
||||
/** 신청자휴대전화번호 */
|
||||
aplcntMblTelno?: string;
|
||||
/** 신청자소속명 */
|
||||
aplcntOgdpNm?: string;
|
||||
/** 신청자이메일주소 */
|
||||
aplcntEmlAddr?: string;
|
||||
/** 설계자명 */
|
||||
dsgnrNm: string;
|
||||
/** 설계자전화번호 */
|
||||
dsgnrTelno: string;
|
||||
/** 설계자소속명 */
|
||||
dsgnrOgdpNm: string;
|
||||
/** 설계자이메일주소 */
|
||||
dsgnrEmlAddr: string;
|
||||
atchFileGroupId: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
atchFileGroupId?: string;
|
||||
/** 진행상태공통코드 */
|
||||
prgrsSttsComCd?: string;
|
||||
/** 재이용시설구분공통코드 */
|
||||
rtlztnFcltSeComCd?: string;
|
||||
/** 재이용용도구분공통코드 */
|
||||
rtlztnUsgSeComCd?: string;
|
||||
}
|
||||
|
||||
/** 설치인가관리 수정 요청 DTO */
|
||||
export type InstlSncnMngUpdateRequestDto = InstlSncnMngSaveRequestDto;
|
||||
|
||||
/** 문서 진행상태 수정 요청 DTO */
|
||||
export interface DocPrgrsUpdateRequestDto {
|
||||
/** 행정지원문서번호 */
|
||||
docNo: string;
|
||||
/** 문서구분코드 */
|
||||
docSeComCd: string;
|
||||
/** 진행상태공통코드 */
|
||||
prgrsSttsComCd: string;
|
||||
}
|
||||
|
||||
/** 설치인가관리 응답 DTO */
|
||||
export interface InstlSncnMngResponseDto extends InstlSncnMngSaveRequestDto {
|
||||
/** 설치인가문서번호 (필수로 재정의) */
|
||||
instlSncnDocNo: string;
|
||||
/** 환경청구분공통코드명 */
|
||||
envoSeCdNm: string;
|
||||
/** 인가구분공통코드명 */
|
||||
sncnSeCdNm: string;
|
||||
/** 업무구분공통코드명 */
|
||||
taskSeCdNm: string;
|
||||
/** 진행상태공통코드명 */
|
||||
prgrsSttsCdNm: string;
|
||||
/** 재이용시설구분공통코드명 */
|
||||
rtlztnFcltSeComNm: string;
|
||||
/** 재이용용도구분공통코드명 */
|
||||
rtlztnUsgSeComNm: string;
|
||||
/** 등록일시 */
|
||||
regDt: string;
|
||||
mdfcnDt: string;
|
||||
/** 등록자 UUID */
|
||||
rgtr: string;
|
||||
/** 등록자명 */
|
||||
rgtrNm: string;
|
||||
/** 수정 일시 */
|
||||
mdfcnDt: string;
|
||||
/** 시도 */
|
||||
sido: string;
|
||||
/** 구군 */
|
||||
gugun: string;
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 사업규모 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnBzScaleSaveDto {
|
||||
/** 공종구분코드 */
|
||||
cnstpSeCd: string;
|
||||
/** 기본계획(A) */
|
||||
/** 기본계획수량 */
|
||||
bscPl: number;
|
||||
/** 예산반영(B) */
|
||||
/** 예산반영수량 */
|
||||
budgetReflct: number;
|
||||
/** 금회설계시(C) */
|
||||
/** 금회설계수량 */
|
||||
thtiDsgn: number;
|
||||
/** 증감(C-B) */
|
||||
diff: number;
|
||||
/** 증감(C-B) — 클라이언트 계산용, API 미전송 */
|
||||
diff?: number;
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 총사업비 저장 DTO(배열 원소) */
|
||||
@@ -85,32 +138,245 @@ export interface InstlSncnBizCstSaveRequestDto {
|
||||
|
||||
/** 설치인가 신청 - 체크리스트 결과 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnCklstResultSaveDto {
|
||||
/** 점검표일련번호 */
|
||||
cklstSn: number;
|
||||
/** 점검표항목일련번호 */
|
||||
cklstArtclSn: number;
|
||||
/** 점검표검토일련번호 */
|
||||
cklstRvwSn: number;
|
||||
/** 검토단계공통코드 */
|
||||
rvwStpComCd: string;
|
||||
/** 선택값(Y/N/null) */
|
||||
selected: "Y" | "N" | null;
|
||||
/** 담당자검토내용(기술검토의견) */
|
||||
picRvwCn?: string | null;
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 필수첨부파일 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnEsntlAtchFileSaveDto {
|
||||
/** 필수첨부파일아이디 */
|
||||
esntlAtchFileId: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
atchFileGroupId: string;
|
||||
}
|
||||
|
||||
/** 설치인가검토의견 저장 요청 DTO */
|
||||
export interface InstlSncnRvwOpnnSaveRequestDto {
|
||||
/** 설치인가문서번호 */
|
||||
instlSncnDocNo: string;
|
||||
/** 검토의견일련번호 */
|
||||
rvwOpnnSn?: number;
|
||||
/** 의견자구분공통코드 */
|
||||
opnrSeComCd?: string;
|
||||
/** 의견자명 */
|
||||
opnrNm?: string;
|
||||
/** 검토결과내용 */
|
||||
rvwRsltCn?: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn?: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
atchFileGroupId?: string;
|
||||
}
|
||||
|
||||
/** 설치인가 보완요구 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnSplmntDmndSaveDto {
|
||||
/** 보완요구 일련번호 */
|
||||
splmntDmndSn?: number;
|
||||
/** 보완항목 공통코드 */
|
||||
splmntArtclComCd?: string;
|
||||
/** 보완요구 내용 */
|
||||
splmntDmndCn?: string;
|
||||
/** 보완요구 일시 */
|
||||
splmntDmndDt?: string;
|
||||
/** 보완요구 첨부파일 그룹 ID */
|
||||
splmntDmndAtchFileGroupId?: string;
|
||||
/** 보완 내용 */
|
||||
splmntCn?: string;
|
||||
/** 보완 담당자 명 */
|
||||
splmntPicNm?: string;
|
||||
/** 보완완료 일시 */
|
||||
splmntCmptnDt?: string;
|
||||
/** 보완 첨부파일 그룹 ID */
|
||||
splmntAtchFileGroupId?: string;
|
||||
/** 완료 여부 */
|
||||
cmptnYn?: string;
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 통합 저장 요청 DTO */
|
||||
export interface InstlSncnApplySaveRequestDto {
|
||||
instlSncnMng: InstlSncnMng;
|
||||
/** 기술검토저장구분(SV.저장, CP.검토완료) */
|
||||
techReViewSaveCd?: string;
|
||||
/** 검토단계공통코드(ENV.환경청.EP, KECO.환경공단.TE) */
|
||||
rvwStpCd?: string;
|
||||
/** 설치인가관리 정보 */
|
||||
instlSncnMng: InstlSncnMngSaveRequestDto;
|
||||
/** 사업규모 목록 */
|
||||
bzScaleList: InstlSncnBzScaleSaveDto[];
|
||||
/** 총사업비 목록 */
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[];
|
||||
/** 체크리스트 검토결과 목록 */
|
||||
cklstResultList: InstlSncnCklstResultSaveDto[];
|
||||
/** 체크리스트 검토결과 맵 (rvwStpComCd -> 목록) */
|
||||
cklstResultMap?: Record<string, InstlSncnCklstResultSaveDto[]>;
|
||||
/** 필수첨부파일 목록 */
|
||||
esntlAtchFileList: InstlSncnEsntlAtchFileSaveDto[];
|
||||
/** 검토의견 목록 */
|
||||
rvwOpnnList?: InstlSncnRvwOpnnSaveRequestDto[];
|
||||
/** 보완요구 목록 */
|
||||
splmntDmndList?: InstlSncnSplmntDmndSaveDto[];
|
||||
}
|
||||
|
||||
export type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
|
||||
|
||||
/** 공종 트리와 사업규모(수량) 조합 DTO */
|
||||
export interface BizSclTreeDto {
|
||||
/** 들여쓰기 적용된 공종명(시각적) */
|
||||
indCnstpSeCdNm: string;
|
||||
/** 공종 코드 */
|
||||
cnstpSeCd: string;
|
||||
/** 공종 코드명 */
|
||||
cnstpSeCdNm: string;
|
||||
/** 사용 여부(Y/N) */
|
||||
useYn: string;
|
||||
/** 트리 레벨(깊이) */
|
||||
treeLevel: number;
|
||||
/** 트리 경로 표시용 문자열 */
|
||||
treePath: string;
|
||||
/** 기본계획수량 */
|
||||
bscPlanQty: number;
|
||||
/** 예산반영수량 */
|
||||
bgtRfltQty: number;
|
||||
/** 금회설계수량 */
|
||||
tstmDesignQty: number;
|
||||
}
|
||||
|
||||
/** 회계구분 트리와 사업비용 조합 DTO */
|
||||
export interface BizCstTreeDto {
|
||||
/** 들여쓰기 적용된 회계구분명(시각적) */
|
||||
indAcntgSeCdNm: string;
|
||||
/** 회계구분 코드 */
|
||||
acntgSeCd: string;
|
||||
/** 회계구분 코드명 */
|
||||
acntgSeCdNm: string;
|
||||
/** 사용 여부(Y/N) */
|
||||
useYn: string;
|
||||
/** 트리 레벨(깊이) */
|
||||
treeLevel: number;
|
||||
/** 트리 경로 표시용 문자열 */
|
||||
treePath: string;
|
||||
/** 기본계획금액 */
|
||||
bscPlanAmt: number;
|
||||
/** 예산반영금액 */
|
||||
bgtRfltAmt: number;
|
||||
/** 금회설계금액 */
|
||||
tstmDesignAmt: number;
|
||||
}
|
||||
|
||||
/** 점검표 검토결과 트리 DTO */
|
||||
export interface CklstRvwRsltTreeDto {
|
||||
/** 점검표일련번호 */
|
||||
cklstSn: number;
|
||||
/** 점검표명 */
|
||||
cklstNm: string;
|
||||
/** 점검표항목일련번호 */
|
||||
cklstArtclSn: number;
|
||||
/** 점검표항목명 */
|
||||
cklstArtclNm: string;
|
||||
/** 검토일련번호 */
|
||||
cklstRvwSn: number;
|
||||
/** 상위검토일련번호 */
|
||||
upCklstRvwSn: number | null;
|
||||
/** 트리 레벨 */
|
||||
treeLevel: number;
|
||||
/** 검토내용 */
|
||||
rvwCn: string;
|
||||
/** 점검 사용 여부 */
|
||||
bchckUseYn: string;
|
||||
/** 정렬순서 */
|
||||
sortSeq: number;
|
||||
/** 업무구분코드 */
|
||||
taskSeComCd: string;
|
||||
/** 검토단계공통코드 */
|
||||
rvwStpComCd: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn: string;
|
||||
/** 검토담당자 UUID */
|
||||
rvwPicUuid: string | null;
|
||||
/** 담당자검토내용 */
|
||||
picRvwCn: string | null;
|
||||
/** 검토일시 */
|
||||
rvwDt: string | null;
|
||||
}
|
||||
|
||||
/** 필수첨부파일관리 트리 조회 응답 DTO */
|
||||
export interface EsntlAtchFileMngTreeResponseDto {
|
||||
/** 필수첨부파일아이디 */
|
||||
esntlAtchFileId: string;
|
||||
/** 문서구분공통코드 */
|
||||
docSeComCd: string;
|
||||
/** 필수첨부파일명 */
|
||||
esntlAtchFileNm: string;
|
||||
/** 필수첨부여부 */
|
||||
esntlAtchYn: string;
|
||||
/** 필수첨부파일비고 */
|
||||
esntlAtchFileRmrk: string | null;
|
||||
/** 첨부파일 코드 */
|
||||
atflCd?: string;
|
||||
/** 첨부파일 일련번호 */
|
||||
atflSn?: number;
|
||||
/** 첨부파일 ID */
|
||||
atflId?: string;
|
||||
/** 원본 파일명 */
|
||||
orgnlFileNm?: string;
|
||||
/** 첨부파일 크기 */
|
||||
atflFlieSz?: number;
|
||||
/** 첨부파일 타입 */
|
||||
atflType?: string;
|
||||
/** 다운로드 횟수 */
|
||||
dwnldNocs?: number;
|
||||
/** 등록일시 */
|
||||
regDt?: string;
|
||||
}
|
||||
|
||||
/** 첨부파일 응답 DTO (attach-service client) */
|
||||
export interface AtflMngClientResponseDto {
|
||||
atflCd: string;
|
||||
atflSn: number;
|
||||
atflId: string;
|
||||
physFileNm: string;
|
||||
orgnlFileNm: string;
|
||||
atflFlieSz: number;
|
||||
atflType: string;
|
||||
dwnldNocs: number;
|
||||
delYn: string;
|
||||
lnkgDmnId: string | null;
|
||||
lnkgDmnNm: string | null;
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
/** 설치인가검토의견 응답 DTO */
|
||||
export interface InstlSncnRvwOpnnResponseDto {
|
||||
/** 설치인가문서번호 */
|
||||
instlSncnDocNo: string;
|
||||
/** 검토의견일련번호 */
|
||||
rvwOpnnSn: number;
|
||||
/** 의견자구분공통코드 */
|
||||
opnrSeComCd: string;
|
||||
/** 의견자구분공통코드명 */
|
||||
opnrSeCdNm: string | null;
|
||||
/** 의견자명 */
|
||||
opnrNm: string;
|
||||
/** 검토결과내용 */
|
||||
rvwRsltCn: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
atchFileGroupId: string | null;
|
||||
/** 첨부파일 상세 정보 */
|
||||
atchFileInfo?: AtflMngClientResponseDto;
|
||||
/** 등록일시 */
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
/** 전자결재 진행상태 (클라이언트 응답용) */
|
||||
export interface ElaprDocPrgrsClientResponseDto {
|
||||
@@ -131,19 +397,25 @@ export interface ElaprDocPrgrsClientResponseDto {
|
||||
ognzNm?: string;
|
||||
}
|
||||
|
||||
// det 응답에 전자결재 진행상태 목록을 포함
|
||||
/** 설치인가관리 상세 응답 DTO */
|
||||
export interface InstlSncnMngDetResponse {
|
||||
detDto: InstlSncnMng;
|
||||
bizSclList: any[];
|
||||
bizCstList: any[];
|
||||
cklstResultList?: any[];
|
||||
esntlFileList: any[];
|
||||
etcFileList: any[];
|
||||
detDto: InstlSncnMngResponseDto;
|
||||
bizSclList: BizSclTreeDto[];
|
||||
bizCstList: BizCstTreeDto[];
|
||||
cklstResultList?: CklstRvwRsltTreeDto[];
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList: AtflMngClientResponseDto[];
|
||||
rvwList?: InstlSncnRvwOpnnResponseDto[];
|
||||
elaprDocPrgrsList?: ElaprDocPrgrsClientResponseDto[] | null;
|
||||
}
|
||||
|
||||
export interface InstlSncnMngService {
|
||||
getPage: (params: InstlSncnMngSearchParams) => Promise<SpringPage<InstlSncnMng>>;
|
||||
getPage: (params: InstlSncnMngSearchParams) => Promise<PageResponse<InstlSncnMngResponseDto>>;
|
||||
getById: (id: string) => Promise<InstlSncnMngDetResponse>;
|
||||
save: (payload: InstlSncnMngSaveRequestDto) => Promise<string>;
|
||||
saveApply: (payload: InstlSncnApplySaveRequestDto) => Promise<string>;
|
||||
update: (id: string, payload: InstlSncnMngUpdateRequestDto) => Promise<void>;
|
||||
techReview: (id: string, payload: InstlSncnApplySaveRequestDto) => Promise<void>;
|
||||
remove: (id: string) => Promise<void>;
|
||||
changePrgrsSttsComCd: (payload: DocPrgrsUpdateRequestDto) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
RvwMnpwMngPageSearchDto,
|
||||
RvwMnpwMngSaveRequestDto,
|
||||
RvwMnpwMngSearchDto,
|
||||
RvwMnpwMngUpdateRequestDto,
|
||||
@@ -10,9 +11,12 @@ import type {
|
||||
|
||||
import { rvwMnpwMngService } from "./rvw-mnpw-service";
|
||||
|
||||
const rvwMnpwMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.RVW_MNPW] as const;
|
||||
const rvwMnpwMngBaseKey = [ENDPOINT.AS_SERVICE.RVW_MNPW] as const;
|
||||
|
||||
export function useRvwMnpwMngPage(params: RvwMnpwMngSearchDto, options?: { enabled?: boolean }) {
|
||||
export function useRvwMnpwMngPage(
|
||||
params: RvwMnpwMngPageSearchDto,
|
||||
options?: { enabled?: boolean },
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...rvwMnpwMngBaseKey, "findPage", params],
|
||||
queryFn: () => rvwMnpwMngService.findPage(params),
|
||||
@@ -20,6 +24,17 @@ export function useRvwMnpwMngPage(params: RvwMnpwMngSearchDto, options?: { enabl
|
||||
});
|
||||
}
|
||||
|
||||
export function useRvwMnpwMngLoginUserList(
|
||||
searchDto: RvwMnpwMngSearchDto,
|
||||
options?: { enabled?: boolean },
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...rvwMnpwMngBaseKey, "findRvwLoginUserList", searchDto],
|
||||
queryFn: () => rvwMnpwMngService.findRvwLoginUserList(searchDto),
|
||||
enabled: options?.enabled,
|
||||
});
|
||||
}
|
||||
|
||||
export function useRvwMnpwMng(
|
||||
atrzSeComCd: string | null | undefined,
|
||||
ognzSn: number | null | undefined,
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ENDPOINT } from "@/shared/config";
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
|
||||
import type {
|
||||
RvwMnpwMngPageSearchDto,
|
||||
RvwMnpwMngResponseDto,
|
||||
RvwMnpwMngSaveRequestDto,
|
||||
RvwMnpwMngSearchDto,
|
||||
@@ -10,14 +11,21 @@ import type {
|
||||
RvwMnpwMngUpdateRequestDto,
|
||||
} from "../model/rvw-mnpw-interface";
|
||||
|
||||
const BASE = ENDPOINT.AS_COMMON_SERVICE.RVW_MNPW;
|
||||
const BASE = ENDPOINT.AS_SERVICE.RVW_MNPW;
|
||||
|
||||
function pkPath(atrzSeComCd: string, ognzSn: number, userUuid: string): string {
|
||||
return `${BASE}/${atrzSeComCd}/${ognzSn}/${userUuid}`;
|
||||
async function findPage(
|
||||
params: RvwMnpwMngPageSearchDto,
|
||||
): Promise<PageResponse<RvwMnpwMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<RvwMnpwMngResponseDto>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findPage(params: RvwMnpwMngSearchDto): Promise<PageResponse<RvwMnpwMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<RvwMnpwMngResponseDto>>(BASE, { params });
|
||||
async function findRvwLoginUserList(
|
||||
searchDto: RvwMnpwMngSearchDto,
|
||||
): Promise<PageResponse<RvwMnpwMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<RvwMnpwMngResponseDto>>(`${BASE}/loginuser/me`, {
|
||||
params: searchDto,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -26,41 +34,48 @@ async function findById(
|
||||
ognzSn: number,
|
||||
userUuid: string,
|
||||
): Promise<RvwMnpwMngResponseDto> {
|
||||
const response = await client.get<RvwMnpwMngResponseDto>(pkPath(atrzSeComCd, ognzSn, userUuid));
|
||||
const response = await client.get<RvwMnpwMngResponseDto>(
|
||||
`${BASE}/${atrzSeComCd}/${ognzSn}/${userUuid}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function save(body: RvwMnpwMngSaveRequestDto): Promise<RvwMnpwMngResponseDto> {
|
||||
const response = await client.post<RvwMnpwMngResponseDto>(BASE, body);
|
||||
async function saveRvwMnpwMng(body: RvwMnpwMngSaveRequestDto): Promise<RvwMnpwMngResponseDto> {
|
||||
const { atrzSeComCd, ognzSn, userUuid } = body;
|
||||
const response = await client.post<RvwMnpwMngResponseDto>(
|
||||
`${BASE}/${atrzSeComCd}/${ognzSn}/${userUuid}`,
|
||||
body,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(
|
||||
async function updateRvwMnpwMng(
|
||||
atrzSeComCd: string,
|
||||
ognzSn: number,
|
||||
userUuid: string,
|
||||
body: RvwMnpwMngUpdateRequestDto,
|
||||
): Promise<RvwMnpwMngResponseDto> {
|
||||
const response = await client.put<RvwMnpwMngResponseDto>(
|
||||
pkPath(atrzSeComCd, ognzSn, userUuid),
|
||||
`${BASE}/${atrzSeComCd}/${ognzSn}/${userUuid}`,
|
||||
body,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function deleteRvwMnpw(
|
||||
async function deleteRvwMnpwMng(
|
||||
atrzSeComCd: string,
|
||||
ognzSn: number,
|
||||
userUuid: string,
|
||||
): Promise<string> {
|
||||
const response = await client.delete<string>(pkPath(atrzSeComCd, ognzSn, userUuid));
|
||||
const response = await client.delete<string>(`${BASE}/${atrzSeComCd}/${ognzSn}/${userUuid}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const rvwMnpwMngService = {
|
||||
findPage,
|
||||
findRvwLoginUserList,
|
||||
findById,
|
||||
save,
|
||||
update,
|
||||
delete: deleteRvwMnpw,
|
||||
save: saveRvwMnpwMng,
|
||||
update: updateRvwMnpwMng,
|
||||
delete: deleteRvwMnpwMng,
|
||||
} satisfies RvwMnpwMngService;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
export {
|
||||
useDeleteRvwMnpwMng,
|
||||
useRvwMnpwMng,
|
||||
useRvwMnpwMngLoginUserList,
|
||||
useRvwMnpwMngPage,
|
||||
useSaveRvwMnpwMng,
|
||||
useUpdateRvwMnpwMng,
|
||||
} from "./api/queries";
|
||||
export { rvwMnpwMngService } from "./api/rvw-mnpw-service";
|
||||
export type {
|
||||
RvwMnpwMngPageSearchDto,
|
||||
RvwMnpwMngResponseDto,
|
||||
RvwMnpwMngSaveRequestDto,
|
||||
RvwMnpwMngSearchDto,
|
||||
|
||||
@@ -14,13 +14,16 @@ export interface RvwMnpwMngResponseDto {
|
||||
regDt?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 RvwMnpwMngSearchDto + Pageable */
|
||||
export interface RvwMnpwMngSearchDto extends PageableParams {
|
||||
/** 백엔드 RvwMnpwMngSearchDto */
|
||||
export interface RvwMnpwMngSearchDto {
|
||||
atrzSeComCd?: string;
|
||||
ognzSn?: number;
|
||||
userUuid?: string;
|
||||
}
|
||||
|
||||
/** findPage — RvwMnpwMngSearchDto + Pageable */
|
||||
export type RvwMnpwMngPageSearchDto = RvwMnpwMngSearchDto & PageableParams;
|
||||
|
||||
/** 백엔드 RvwMnpwMngSaveRequestDto */
|
||||
export interface RvwMnpwMngSaveRequestDto {
|
||||
atrzSeComCd: string;
|
||||
@@ -35,7 +38,10 @@ export interface RvwMnpwMngUpdateRequestDto {
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface RvwMnpwMngService {
|
||||
findPage(params: RvwMnpwMngSearchDto): Promise<PageResponse<RvwMnpwMngResponseDto>>;
|
||||
findPage(params: RvwMnpwMngPageSearchDto): Promise<PageResponse<RvwMnpwMngResponseDto>>;
|
||||
findRvwLoginUserList(
|
||||
searchDto: RvwMnpwMngSearchDto,
|
||||
): Promise<PageResponse<RvwMnpwMngResponseDto>>;
|
||||
findById(atrzSeComCd: string, ognzSn: number, userUuid: string): Promise<RvwMnpwMngResponseDto>;
|
||||
save(body: RvwMnpwMngSaveRequestDto): Promise<RvwMnpwMngResponseDto>;
|
||||
update(
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { handleTusUpload, type TusUploadOptions } from "./lib/utils";
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Upload } from "tus-js-client";
|
||||
|
||||
import { ENDPOINT, PROXY_HOST } from "@/shared/config";
|
||||
import { AUTH_USER_ID, CLAIM_NAME } from "@/shared/config/env";
|
||||
import { getCookie } from "@/shared/lib";
|
||||
|
||||
interface TusUploadOptions {
|
||||
metadata?: Record<string, string>;
|
||||
handleUploadStart?: (upload: Upload) => void;
|
||||
handleProgress?: (percentage: number) => void;
|
||||
handleSuccess?: (upload: Upload, atflCd: string, atflId: string) => void;
|
||||
handleError?: (error: Error) => void;
|
||||
}
|
||||
|
||||
function handleTusUpload(file: File, options?: TusUploadOptions) {
|
||||
let atflCd = "";
|
||||
let atflId = "";
|
||||
|
||||
const metadata = {
|
||||
filename: file.name,
|
||||
filetype: file.type,
|
||||
...options?.metadata,
|
||||
};
|
||||
|
||||
const upload = new Upload(file, {
|
||||
endpoint: `${PROXY_HOST}${ENDPOINT.ATTACH_SERVICE.TUS_UPLOAD}`,
|
||||
chunkSize: 10 * 1024 * 1024,
|
||||
headers: {
|
||||
[CLAIM_NAME]: getCookie(CLAIM_NAME) ?? "",
|
||||
[AUTH_USER_ID]: getCookie(AUTH_USER_ID) ?? "",
|
||||
},
|
||||
metadata,
|
||||
onError(error) {
|
||||
console.error("TUS upload failed:", error);
|
||||
options?.handleError?.(error);
|
||||
},
|
||||
onProgress(bytesUploaded, bytesTotal) {
|
||||
const percentage = (bytesUploaded / bytesTotal) * 100;
|
||||
options?.handleProgress?.(percentage);
|
||||
},
|
||||
onAfterResponse(_req, res) {
|
||||
const fileInfo = res.getHeader("X-File-Info");
|
||||
if (!fileInfo) return;
|
||||
|
||||
const parsed = JSON.parse(fileInfo) as { atflCd?: string; atflId?: string };
|
||||
atflCd = parsed.atflCd ?? "";
|
||||
atflId = parsed.atflId ?? "";
|
||||
},
|
||||
onSuccess() {
|
||||
options?.handleSuccess?.(upload, atflCd, atflId);
|
||||
},
|
||||
});
|
||||
|
||||
upload.start();
|
||||
options?.handleUploadStart?.(upload);
|
||||
|
||||
return upload;
|
||||
}
|
||||
|
||||
export { handleTusUpload };
|
||||
export type { TusUploadOptions };
|
||||
@@ -92,7 +92,7 @@ function ElaprTmpltFormDialog({
|
||||
<div className="space-y-2">
|
||||
<Label>문서구분</Label>
|
||||
<CodeSelect
|
||||
upCd="ASDOCSECD"
|
||||
upCd="ASDOCSE"
|
||||
value={docSeComCd}
|
||||
onValueChange={(v) => setValue("docSeComCd", v)}
|
||||
placeholder="문서구분 선택"
|
||||
|
||||
@@ -102,7 +102,7 @@ function CklstMngFormDialog({
|
||||
<div className="space-y-2">
|
||||
<Label>문서구분</Label>
|
||||
<CodeSelect
|
||||
upCd="ASDOCSECD"
|
||||
upCd="ASDOCSE"
|
||||
value={docSeComCd}
|
||||
onValueChange={(v) => setValue("docSeComCd", v)}
|
||||
placeholder="문서구분 선택"
|
||||
@@ -112,7 +112,7 @@ function CklstMngFormDialog({
|
||||
<div className="space-y-2">
|
||||
<Label>업무구분</Label>
|
||||
<CodeSelect
|
||||
upCd={docSeComCd || "ASDOCSECD"}
|
||||
upCd={docSeComCd || "ASDOCSE"}
|
||||
value={watch("taskSeComCd")}
|
||||
onValueChange={(v) => setValue("taskSeComCd", v)}
|
||||
placeholder="업무구분 선택"
|
||||
|
||||
@@ -67,6 +67,7 @@ function CklstPreviewDialog({
|
||||
<TableBody>
|
||||
{displayRows.map(({ row, depth }) => {
|
||||
const branchPrefix = formatTreeBranchPrefix(depth);
|
||||
const showRadios = row.bchckUseYn !== "N";
|
||||
|
||||
if (row.useYn === "N") return null;
|
||||
|
||||
@@ -82,16 +83,20 @@ function CklstPreviewDialog({
|
||||
</TableCell>
|
||||
<TableCell>{row.rvwCn ?? "—"}</TableCell>
|
||||
<TableCell align="center">
|
||||
<RadioGroup className="flex items-center justify-center">
|
||||
<div className="flex items-center gap-1">
|
||||
<RadioGroupItem value="Y" id={`${row.rowKey}-use-y`} />
|
||||
<Label htmlFor={`${row.rowKey}-use-y`}>예</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<RadioGroupItem value="N" id={`${row.rowKey}-use-n`} />
|
||||
<Label htmlFor={`${row.rowKey}-use-n`}>아니오</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
{showRadios ? (
|
||||
<RadioGroup className="flex items-center justify-center">
|
||||
<div className="flex items-center gap-1">
|
||||
<RadioGroupItem value="Y" id={`${row.rowKey}-preview-y`} />
|
||||
<Label htmlFor={`${row.rowKey}-preview-y`}>예</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<RadioGroupItem value="N" id={`${row.rowKey}-preview-n`} />
|
||||
<Label htmlFor={`${row.rowKey}-preview-n`}>아니오</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
) : (
|
||||
"—"
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
|
||||
@@ -113,6 +113,7 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
rvwCnLvNo: 1,
|
||||
rvwCn: "",
|
||||
useYn: "Y",
|
||||
bchckUseYn: "Y",
|
||||
sortSeq: maxSort + 1,
|
||||
isNew: true,
|
||||
isDirty: true,
|
||||
@@ -145,6 +146,7 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
rvwCnLvNo: parentLv + 1,
|
||||
rvwCn: "",
|
||||
useYn: "Y",
|
||||
bchckUseYn: "Y",
|
||||
sortSeq: maxSort + 1,
|
||||
isNew: true,
|
||||
isDirty: true,
|
||||
@@ -189,6 +191,8 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
const handleSave = async () => {
|
||||
if (!cklstSn) return;
|
||||
|
||||
if (!(await confirm("체크리스트 항목을 저장하시겠습니까?"))) return;
|
||||
|
||||
const dirty = getDirtyRows().sort((a, b) => (a.rvwCnLvNo ?? 1) - (b.rvwCnLvNo ?? 1));
|
||||
|
||||
for (const row of dirty) {
|
||||
@@ -198,8 +202,6 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(await confirm("체크리스트 항목을 저장하시겠습니까?"))) return;
|
||||
|
||||
if (row.isNew) {
|
||||
await createMutation.mutateAsync({
|
||||
cklstSn: row.cklstSn,
|
||||
@@ -209,7 +211,7 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
rvwCn: row.rvwCn,
|
||||
useYn: row.useYn,
|
||||
sortSeq: row.sortSeq,
|
||||
bchckUseYn: "Y",
|
||||
bchckUseYn: row.bchckUseYn ?? "Y",
|
||||
});
|
||||
} else if (row.cklstRvwSn != null) {
|
||||
await updateMutation.mutateAsync({
|
||||
@@ -277,17 +279,19 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
) : (
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="50%" />
|
||||
<col width="15%" />
|
||||
<col width="18%" />
|
||||
<col width="42%" />
|
||||
<col width="12%" />
|
||||
<col width="12%" />
|
||||
<col width="5%" />
|
||||
<col width="10%" />
|
||||
<col width="11%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>점검항목</TableHead>
|
||||
<TableHead>주요 검토내용</TableHead>
|
||||
<TableHead>사용 여부</TableHead>
|
||||
<TableHead>체크 사용</TableHead>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableHead>관리</TableHead>
|
||||
</TableRow>
|
||||
|
||||
@@ -91,6 +91,22 @@ function CklstRvwRowComponent({
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
<RadioGroup
|
||||
value={row.bchckUseYn ?? "Y"}
|
||||
onValueChange={(v) => onChange({ bchckUseYn: v as "Y" | "N", isDirty: true })}
|
||||
className="flex justify-center gap-4"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="Y" id={`${row.rowKey}-bchck-y`} />
|
||||
<Label htmlFor={`${row.rowKey}-bchck-y`}>예</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="N" id={`${row.rowKey}-bchck-n`} />
|
||||
<Label htmlFor={`${row.rowKey}-bchck-n`}>아니오</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</TableCell>
|
||||
<TableCell align="center">{levelLabel}</TableCell>
|
||||
<TableCell align="center">
|
||||
<div className="flex justify-center gap-2">
|
||||
|
||||
@@ -94,7 +94,7 @@ function EsntlAtchFileFormDialog({
|
||||
<div className="space-y-2">
|
||||
<Label>문서구분</Label>
|
||||
<CodeSelect
|
||||
upCd="ASDOCSECD"
|
||||
upCd="ASDOCSE"
|
||||
value={docSeComCd}
|
||||
onValueChange={(v) => setValue("docSeComCd", v, { shouldValidate: true })}
|
||||
placeholder="문서구분 선택"
|
||||
|
||||
@@ -36,7 +36,7 @@ function EsntlAtchFileList({
|
||||
onPaginationChange,
|
||||
}: EsntlAtchFileListProps) {
|
||||
const { confirm } = useConfirm();
|
||||
const { data: docSeCodes } = useCodeList("ASDOCSECD");
|
||||
const { data: docSeCodes } = useCodeList("ASDOCSE");
|
||||
|
||||
const [dialogMode, setDialogMode] = useState<"create" | "edit" | null>(null);
|
||||
const [editingRow, setEditingRow] = useState<EsntlAtchFileMng | null>(null);
|
||||
|
||||
@@ -32,7 +32,7 @@ const DEFAULT_SEARCH_PARAMS = {
|
||||
};
|
||||
|
||||
function EsntlAtchFileMngPage() {
|
||||
const { data: docSeCodes, isPending: isDocSeLoading } = useCodeList("ASDOCSECD");
|
||||
const { data: docSeCodes, isPending: isDocSeLoading } = useCodeList("ASDOCSE");
|
||||
|
||||
const [docSeComCd, setDocSeComCd] = useState(ESNTL_ATCH_FILE_ALL_DOC_SE);
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export { CnfmListPage } from "./ui/cnfm-list-page";
|
||||
export { CnfmViewPage } from "./ui/cnfm-view-page";
|
||||
export { CnfmRegistPage } from "./ui/cnfm-regist-page";
|
||||
export { CnfmModifyPage } from "./ui/cnfm-modify-page";
|
||||
+57
-31
@@ -9,8 +9,8 @@ import { dayjs } from "@/shared/lib";
|
||||
import { useCodeList } from "@/entities/code";
|
||||
import {
|
||||
INSTL_SNCN_REGISTER_SELECTION_KEY,
|
||||
InstlSncnApi,
|
||||
type InstlSncnMngSearchParams,
|
||||
instlSncnService,
|
||||
} from "@/entities/instl-sncn";
|
||||
|
||||
import "./cnfm-page.css";
|
||||
@@ -78,14 +78,14 @@ function CnfmListPage() {
|
||||
useEffect(() => {
|
||||
if (!taskDialogOpen) return;
|
||||
if (selectedTaskSeComCd.length) return;
|
||||
if (fnrsCodeList.length === 0) return;
|
||||
// setSelectedTaskSeComCd([fnrsCodeList[0].lwpoCd]);
|
||||
if (fnrsCodeList.length === 0) return;
|
||||
// setSelectedTaskSeComCd([fnrsCodeList[0].lwpoCd]);
|
||||
}, [taskDialogOpen, selectedTaskSeComCd, fnrsCodeList]);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ["instl-sncn-list", search, pageIndex, pageSize],
|
||||
queryFn: () =>
|
||||
InstlSncnApi.getPage({
|
||||
instlSncnService.getPage({
|
||||
...search,
|
||||
page: pageIndex,
|
||||
size: pageSize,
|
||||
@@ -120,13 +120,15 @@ function CnfmListPage() {
|
||||
|
||||
// prepare arrays of selected codes and names
|
||||
const selectedCodes = selectedTaskSeComCd;
|
||||
const selectedNames = selectedTaskSeComCd.map((code) => fnrsCodeList.find((item) => item.lwpoCd === code)?.lwpoCdNm || "");
|
||||
const selectedNames = selectedTaskSeComCd.map(
|
||||
(code) => fnrsCodeList.find((item) => item.lwpoCd === code)?.lwpoCdNm || "",
|
||||
);
|
||||
sessionStorage.setItem(
|
||||
INSTL_SNCN_REGISTER_SELECTION_KEY,
|
||||
JSON.stringify({
|
||||
taskSeComCdList: selectedCodes,
|
||||
taskSeComCdNmList: selectedNames
|
||||
})
|
||||
taskSeComCdNmList: selectedNames,
|
||||
}),
|
||||
);
|
||||
setTaskDialogOpen(false);
|
||||
router.push("/instl-sncn/register");
|
||||
@@ -138,7 +140,9 @@ function CnfmListPage() {
|
||||
<div className="cnfm-card">
|
||||
<form onSubmit={handleSearch} className="cnfm-search-bar">
|
||||
<div className="cnfm-search-field">
|
||||
<label className="cnfm-search-label" htmlFor="sidoComCd">시도</label>
|
||||
<label className="cnfm-search-label" htmlFor="sidoComCd">
|
||||
시도
|
||||
</label>
|
||||
<select
|
||||
id="sidoComCd"
|
||||
className="cnfm-select"
|
||||
@@ -146,13 +150,17 @@ function CnfmListPage() {
|
||||
onChange={(e) => setSidoComCd(e.target.value)}
|
||||
>
|
||||
{SIDO_OPTIONS.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>{opt.label}</option>
|
||||
<option key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className="cnfm-search-field">
|
||||
<label className="cnfm-search-label" htmlFor="sggComCd">시군구</label>
|
||||
<label className="cnfm-search-label" htmlFor="sggComCd">
|
||||
시군구
|
||||
</label>
|
||||
<select
|
||||
id="sggComCd"
|
||||
className="cnfm-select"
|
||||
@@ -164,7 +172,9 @@ function CnfmListPage() {
|
||||
</div>
|
||||
|
||||
<div className="cnfm-search-field cnfm-search-field--grow">
|
||||
<label className="cnfm-search-label" htmlFor="bizNm">사업명</label>
|
||||
<label className="cnfm-search-label" htmlFor="bizNm">
|
||||
사업명
|
||||
</label>
|
||||
<input
|
||||
id="bizNm"
|
||||
type="text"
|
||||
@@ -176,7 +186,9 @@ function CnfmListPage() {
|
||||
</div>
|
||||
|
||||
<div className="cnfm-search-field">
|
||||
<label className="cnfm-search-label" htmlFor="taskSeComCd">구분</label>
|
||||
<label className="cnfm-search-label" htmlFor="taskSeComCd">
|
||||
구분
|
||||
</label>
|
||||
<select
|
||||
id="taskSeComCd"
|
||||
className="cnfm-select cnfm-select--wide"
|
||||
@@ -184,12 +196,16 @@ function CnfmListPage() {
|
||||
onChange={(e) => setTaskSeComCd(e.target.value)}
|
||||
>
|
||||
{TASK_OPTIONS.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>{opt.label}</option>
|
||||
<option key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" className="cnfm-btn-search">검색</button>
|
||||
<button type="submit" className="cnfm-btn-search">
|
||||
검색
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -198,11 +214,7 @@ function CnfmListPage() {
|
||||
<div className="cnfm-list-header">
|
||||
<h3 className="cnfm-list-title">설치인가 목록</h3>
|
||||
<div className="cnfm-list-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="cnfm-btn-register"
|
||||
onClick={handleOpenTaskDialog}
|
||||
>
|
||||
<button type="button" className="cnfm-btn-register" onClick={handleOpenTaskDialog}>
|
||||
✎ 신청
|
||||
</button>
|
||||
<select
|
||||
@@ -214,7 +226,9 @@ function CnfmListPage() {
|
||||
}}
|
||||
>
|
||||
{[10, 20, 30, 50].map((size) => (
|
||||
<option key={size} value={size}>{size}개</option>
|
||||
<option key={size} value={size}>
|
||||
{size}개
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
@@ -237,12 +251,16 @@ function CnfmListPage() {
|
||||
<tbody>
|
||||
{query.isLoading && (
|
||||
<tr>
|
||||
<td colSpan={8} className="cnfm-td-empty">조회 중입니다...</td>
|
||||
<td colSpan={8} className="cnfm-td-empty">
|
||||
조회 중입니다...
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{!query.isLoading && (query.data?.content?.length ?? 0) === 0 && (
|
||||
<tr>
|
||||
<td colSpan={8} className="cnfm-td-empty">조회 결과가 없습니다.</td>
|
||||
<td colSpan={8} className="cnfm-td-empty">
|
||||
조회 결과가 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{(query.data?.content ?? []).map((row) => {
|
||||
@@ -254,7 +272,7 @@ function CnfmListPage() {
|
||||
onClick={() => router.push(`/instl-sncn/${row.instlSncnDocNo}`)}
|
||||
>
|
||||
<td>{row.sido || "-"}</td>
|
||||
<td>{row.gugun|| "-"}</td>
|
||||
<td>{row.gugun || "-"}</td>
|
||||
<td className="text-left">{row.bizNm || "-"}</td>
|
||||
<td>{row.taskSeCdNm || row.taskSeComCd || "-"}</td>
|
||||
<td>{row.aplcntNm || "-"}</td>
|
||||
@@ -267,10 +285,13 @@ function CnfmListPage() {
|
||||
index < currentStepIndex
|
||||
? "completed"
|
||||
: index === currentStepIndex
|
||||
? "current"
|
||||
: "pending";
|
||||
? "current"
|
||||
: "pending";
|
||||
return (
|
||||
<span key={step.code} className={`cnfm-step-badge cnfm-step-badge--${state}`}>
|
||||
<span
|
||||
key={step.code}
|
||||
className={`cnfm-step-badge cnfm-step-badge--${state}`}
|
||||
>
|
||||
<span className={`cnfm-step-dot cnfm-step-dot--${state}`} />
|
||||
{step.label}
|
||||
</span>
|
||||
@@ -284,10 +305,13 @@ function CnfmListPage() {
|
||||
index < currentStepIndex
|
||||
? "completed"
|
||||
: index === currentStepIndex
|
||||
? "current"
|
||||
: "pending";
|
||||
? "current"
|
||||
: "pending";
|
||||
return (
|
||||
<span key={step.code} className={`cnfm-step-badge cnfm-step-badge--${state}`}>
|
||||
<span
|
||||
key={step.code}
|
||||
className={`cnfm-step-badge cnfm-step-badge--${state}`}
|
||||
>
|
||||
<span className={`cnfm-step-dot cnfm-step-dot--${state}`} />
|
||||
{step.label}
|
||||
</span>
|
||||
@@ -378,7 +402,9 @@ function CnfmListPage() {
|
||||
checked={selectedTaskSeComCd.includes(item.lwpoCd)}
|
||||
onChange={() => {
|
||||
setSelectedTaskSeComCd((prev) =>
|
||||
prev.includes(item.lwpoCd) ? prev.filter((v) => v !== item.lwpoCd) : [...prev, item.lwpoCd],
|
||||
prev.includes(item.lwpoCd)
|
||||
? prev.filter((v) => v !== item.lwpoCd)
|
||||
: [...prev, item.lwpoCd],
|
||||
);
|
||||
}}
|
||||
/>
|
||||
@@ -396,7 +422,7 @@ function CnfmListPage() {
|
||||
>
|
||||
취소
|
||||
</button>
|
||||
<button
|
||||
<button
|
||||
type="button"
|
||||
className="rounded bg-blue-500 px-5 py-2 text-[1.3rem] font-semibold text-white hover:bg-blue-600 disabled:cursor-not-allowed disabled:bg-gray-300"
|
||||
onClick={handleConfirmTaskDialog}
|
||||
+4
-3
@@ -1,9 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { CnfmRegistPage } from "./cnfm-regist-page";
|
||||
|
||||
import { InstlSncnApi } from "@/entities/instl-sncn";
|
||||
import { instlSncnService } from "@/entities/instl-sncn";
|
||||
|
||||
import { CnfmRegistPage } from "./cnfm-regist-page";
|
||||
|
||||
import "./cnfm-page.css";
|
||||
|
||||
@@ -11,7 +12,7 @@ function CnfmModifyPage({ id }: { id: string }) {
|
||||
const query = useQuery({
|
||||
// share cache with view page
|
||||
queryKey: ["instl-sncn-detail", id],
|
||||
queryFn: () => InstlSncnApi.getById(id),
|
||||
queryFn: () => instlSncnService.getById(id),
|
||||
});
|
||||
|
||||
if (query.isLoading) {
|
||||
+178
-142
@@ -10,27 +10,25 @@ import { type HttpResponse, Upload } from "tus-js-client";
|
||||
|
||||
import { AUTH_USER_ID, CLAIM_NAME, ENDPOINT, PROXY_HOST } from "@/shared/config";
|
||||
import { getCookie, setCookie, useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { deleteAttachment } from "@/shared/lib/attach";
|
||||
import { formatFileSize } from "@/shared/lib/file-utils";
|
||||
import type { AcntgSeMngTreeDto } from "@/entities/acntg";
|
||||
import { acntgSeMngService } from "@/entities/acntg";
|
||||
import { attachService } from "@/entities/attach";
|
||||
import type { CklstTreeNode } from "@/entities/cklst";
|
||||
import { cklstMngService } from "@/entities/cklst";
|
||||
import type { CnstpSeMngTreeDto } from "@/entities/cnstp";
|
||||
import { cnstpSeMngService } from "@/entities/cnstp";
|
||||
import {
|
||||
esntlAtchFileMngService,
|
||||
type EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/entities/esntl";
|
||||
import { esntlAtchFileMngService, type EsntlAtchFileMngTreeResponseDto } from "@/entities/esntl";
|
||||
import {
|
||||
INSTL_SNCN_REGISTER_SELECTION_KEY,
|
||||
InstlSncnApi,
|
||||
type InstlSncnApplySaveRequestDto,
|
||||
type InstlSncnBizCstSaveRequestDto,
|
||||
type InstlSncnBzScaleSaveDto,
|
||||
type InstlSncnMng,
|
||||
type InstlSncnMngResponseDto,
|
||||
InstlSncnMngSaveRequestDto,
|
||||
instlSncnService,
|
||||
} from "@/entities/instl-sncn";
|
||||
import { EtcAttachments,NumCell, PrivacyConsent, ReadCell } from "@/widgets/cnfm";
|
||||
import { EtcAttachments, NumCell, PrivacyConsent, ReadCell } from "@/widgets/cnfm";
|
||||
import { Button, Input } from "@common/components";
|
||||
|
||||
import "./cnfm-page.css";
|
||||
@@ -128,7 +126,7 @@ const normalizeChecklistResultRows = (payload: any): any[] => {
|
||||
/* 메인 컴포넌트 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/**
|
||||
* initialData 매핑 안내
|
||||
* initialData 매핑 안내
|
||||
* - initialData 데이터는 cnfm-modify-page에서 서버로부터 받아온 상세 데이터를 그대로 전달받거나, cnfm-regist-page에서 수정 모드로 진입할 때 전달받을 수 있습니다.
|
||||
* - 이 컴포넌트는 수정 모드로 호출될 때 `initialData`를 받습니다.
|
||||
* - 서버 응답은 두 가지 형태 중 하나일 수 있습니다:
|
||||
@@ -184,7 +182,6 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
return visibleReviewStepCodes.includes(step) ? step : null;
|
||||
}, [isModifyMode, userInfo?.dtlInstCd, visibleReviewStepCodes]);
|
||||
const [selectedReviewStep, setSelectedReviewStep] = useState<ReviewStepCode>("LOCAL");
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (visibleReviewStepCodes.length === 0) return;
|
||||
@@ -208,13 +205,15 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
const [taskSeComCdNm, setTaskSeComCdNm] = useState<string>(
|
||||
() => (currentDet?.taskSeComCdNm as string) ?? "",
|
||||
);
|
||||
const [taskSeComCd, setTaskSeComCd] = useState<string>(() => (currentDet?.taskSeComCd as string) ?? "RE");
|
||||
const [taskSeComCd, setTaskSeComCd] = useState<string>(
|
||||
() => (currentDet?.taskSeComCd as string) ?? "RE",
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// do not override server-provided initialData (modify mode)
|
||||
if (currentDet) return;
|
||||
|
||||
const raw = sessionStorage.getItem(INSTL_SNCN_REGISTER_SELECTION_KEY);
|
||||
const raw = sessionStorage.getItem(INSTL_SNCN_REGISTER_SELECTION_KEY);
|
||||
if (!raw) return;
|
||||
|
||||
try {
|
||||
@@ -222,7 +221,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
taskSeComCdList?: string[];
|
||||
taskSeComCdNmList?: string[];
|
||||
};
|
||||
|
||||
|
||||
setTaskSeComCd(parsed.taskSeComCdList?.join(",") || "RE");
|
||||
setTaskSeComCdNm(parsed.taskSeComCdNmList?.join(",") || "재이용수");
|
||||
} catch {
|
||||
@@ -262,13 +261,10 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
|
||||
// selected task code for header filtering (null = none selected)
|
||||
const [selectedTaskCode, setSelectedTaskCode] = useState<string | null>(null);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const [requiredFiles, setRequiredFiles] = useState<Record<RequiredAttachKey, RequiredAttachItem>>({});
|
||||
const [requiredFiles, setRequiredFiles] = useState<Record<RequiredAttachKey, RequiredAttachItem>>(
|
||||
{},
|
||||
);
|
||||
const requiredFileInputRefs = useRef<Record<RequiredAttachKey, HTMLInputElement | null>>({});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -352,22 +348,22 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
upload.start();
|
||||
};
|
||||
|
||||
/* ── 기타 첨부파일 ── */
|
||||
type EtcFile = {
|
||||
id: string;
|
||||
name: string;
|
||||
ext: string;
|
||||
size: string;
|
||||
uploader: string;
|
||||
atflCd: string;
|
||||
atflId: string;
|
||||
};
|
||||
const [etcFiles, setEtcFiles] = useState<EtcFile[]>([]);
|
||||
const [etcNoticeOpen, setEtcNoticeOpen] = useState(true);
|
||||
const [etcFileGroupId, setEtcFileGroupId] = useState("");
|
||||
const [etcUploading, setEtcUploading] = useState(false);
|
||||
const etcFileGroupIdRef = useRef("");
|
||||
const initialMappedRef = useRef(false);
|
||||
/* ── 기타 첨부파일 ── */
|
||||
type EtcFile = {
|
||||
id: string;
|
||||
name: string;
|
||||
ext: string;
|
||||
size: string;
|
||||
uploader: string;
|
||||
atflCd: string;
|
||||
atflId: string;
|
||||
};
|
||||
const [etcFiles, setEtcFiles] = useState<EtcFile[]>([]);
|
||||
const [etcNoticeOpen, setEtcNoticeOpen] = useState(true);
|
||||
const [etcFileGroupId, setEtcFileGroupId] = useState("");
|
||||
const [etcUploading, setEtcUploading] = useState(false);
|
||||
const etcFileGroupIdRef = useRef("");
|
||||
const initialMappedRef = useRef(false);
|
||||
|
||||
// 초기 데이터가 주어지면 폼 상태로 매핑 (수정 모드에서 사용)
|
||||
useEffect(() => {
|
||||
@@ -382,7 +378,6 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
//const cklstResultList = initialData.cklstResultList ?? [];
|
||||
const esntlFileList = initialData.esntlFileList ?? [];
|
||||
const etcFileList = initialData.etcFileList ?? [];
|
||||
|
||||
|
||||
// 기본 정보 및 설계자 정보
|
||||
setBzNm(det.bizNm ?? "");
|
||||
@@ -412,9 +407,12 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
.filter((f: any) => f && typeof f === "object")
|
||||
.map((f: any) => {
|
||||
const fileName = f.orgnlFileNm ?? f.physFileNm ?? "";
|
||||
const ext = fileName && typeof fileName === "string" && fileName.includes(".") ? fileName.split(".").pop() ?? "" : "";
|
||||
const ext =
|
||||
fileName && typeof fileName === "string" && fileName.includes(".")
|
||||
? (fileName.split(".").pop() ?? "")
|
||||
: "";
|
||||
return {
|
||||
id: f.atflId ,
|
||||
id: f.atflId,
|
||||
name: fileName,
|
||||
ext,
|
||||
size: f.atflFlieSz ?? 0,
|
||||
@@ -428,17 +426,18 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
|
||||
// 수정모드시 기타첨부 그룹아이디 적용 (중복 매핑 방지)
|
||||
// - det.atchFileGroupId 또는 det.atflCd 우선, 없으면 etcFileList 첫 항목의 atflCd 사용
|
||||
const existingGroup = (det.atchFileGroupId ) || (Array.isArray(etcFileList) && etcFileList[0]?.atflCd) || "";
|
||||
const existingGroup =
|
||||
det.atchFileGroupId || (Array.isArray(etcFileList) && etcFileList[0]?.atflCd) || "";
|
||||
//console.log("etcFileGroupIdRef.current 초기화1:", existingGroup);
|
||||
if (existingGroup && etcFileGroupIdRef.current !== existingGroup) {
|
||||
etcFileGroupIdRef.current = existingGroup;
|
||||
setEtcFileGroupId((prev) => prev || existingGroup);
|
||||
}
|
||||
// console.log("etcFileGroupIdRef.current 초기화:", etcFileGroupIdRef.current);
|
||||
// console.log("etcFileGroupIdRef.current 초기화:", etcFileGroupIdRef.current);
|
||||
|
||||
// 수정모드인 경우 서버가 전달한 업무구분(단일 혹은 콤마로 결합된 복수)을 상태로 복원
|
||||
setTaskSeComCd(det.taskSeComCd);
|
||||
setTaskSeComCdNm(det.taskSeCdNm );
|
||||
setTaskSeComCd(det.taskSeComCd);
|
||||
setTaskSeComCdNm(det.taskSeCdNm);
|
||||
|
||||
// 매핑 완료 플래그 설정 — 이후 동일 컴포넌트 인스턴스에서 재매핑 방지
|
||||
initialMappedRef.current = true;
|
||||
@@ -500,17 +499,17 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
};
|
||||
}
|
||||
setAmtMap(map);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("initialData 매핑 실패", err);
|
||||
}
|
||||
}, [initialData]);
|
||||
|
||||
/** 기타첨부파일 삭제 핸들러: 백엔드에 DELETE 요청을 보내 소프트삭제 처리 후 상태 갱신 */
|
||||
const handleDeleteEtcFile = async (fileId: string, atflId: string) => {
|
||||
/** 기타첨부파일 삭제 핸들러: 백엔드에 DELETE 요청을 보내 소프트삭제 처리 후 상태 갱신 */
|
||||
const handleDeleteEtcFile = async (fileId: string, atflId: string) => {
|
||||
try {
|
||||
if (atflId) {
|
||||
await deleteAttachment(atflId);
|
||||
await attachService.deleteAttachmentByAtflId(atflId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("기타 첨부파일 삭제 실패", error);
|
||||
@@ -528,18 +527,21 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
});
|
||||
};
|
||||
|
||||
const handleRequiredFileChange = (key: RequiredAttachKey, e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const handleRequiredFileChange = (
|
||||
key: RequiredAttachKey,
|
||||
e: React.ChangeEvent<HTMLInputElement>,
|
||||
) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
uploadRequiredFile(file, key);
|
||||
e.target.value = "";
|
||||
};
|
||||
|
||||
|
||||
const uploadEtcFile = (file: File): Promise<EtcFile> =>
|
||||
new Promise((resolve, reject) => {
|
||||
let uploadedAtflCd = "";
|
||||
let uploadedAtflId = "";
|
||||
console.log("기타첨부파일 업로드 시작:", file.name ,etcFileGroupIdRef.current);
|
||||
console.log("기타첨부파일 업로드 시작:", file.name, etcFileGroupIdRef.current);
|
||||
const upload = new Upload(file, {
|
||||
endpoint: `${PROXY_HOST}${ENDPOINT.ATTACH_SERVICE.TUS_UPLOAD}`,
|
||||
chunkSize: 10 * 1024 * 1024,
|
||||
@@ -569,7 +571,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
}
|
||||
},
|
||||
onSuccess() {
|
||||
const ext = file.name.includes(".") ? file.name.split(".").pop() ?? "" : "";
|
||||
const ext = file.name.includes(".") ? (file.name.split(".").pop() ?? "") : "";
|
||||
resolve({
|
||||
id: uploadedAtflId || `${Date.now()}_${Math.random()}`,
|
||||
name: file.name,
|
||||
@@ -666,7 +668,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
const cklstRows = useMemo(() => {
|
||||
// bchckUseYn 필터 제거: 부모가 있는 자식 노드(bchckUseYn=N)도 트리에 포함
|
||||
// cklstTree 내의 피드 taskSeComCd 에 따라서 그룹핑 되도록 해줘
|
||||
|
||||
|
||||
const useRows = selectedTaskCode
|
||||
? cklstTree.filter((r) => (r as any).taskSeComCd === selectedTaskCode)
|
||||
: cklstTree;
|
||||
@@ -710,7 +712,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
const codes = Array.from(
|
||||
new Set((cklstTree ?? []).map((r) => (r as any).taskSeComCd).filter(Boolean)),
|
||||
);
|
||||
|
||||
|
||||
if (codes.length === 0) {
|
||||
if (selectedTaskCode !== null) setSelectedTaskCode(null);
|
||||
return;
|
||||
@@ -791,7 +793,9 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
const el = cklstRowRefs.current[pendingInvalidKey];
|
||||
if (el) {
|
||||
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
const firstRadio = el.querySelector<HTMLInputElement>(`input[name="chk_${pendingInvalidKey}"]`);
|
||||
const firstRadio = el.querySelector<HTMLInputElement>(
|
||||
`input[name="chk_${pendingInvalidKey}"]`,
|
||||
);
|
||||
firstRadio?.focus();
|
||||
setPendingInvalidKey(null);
|
||||
}
|
||||
@@ -800,7 +804,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
|
||||
// 수정 모드에서 서버의 체크리스트 결과값을 폼 상태로 반영
|
||||
useEffect(() => {
|
||||
if (!initialData || cklstRows.length === 0) return;
|
||||
if (!initialData || cklstRows.length === 0) return;
|
||||
const results = normalizeChecklistResultRows(initialData);
|
||||
if (!Array.isArray(results) || results.length === 0) return;
|
||||
|
||||
@@ -866,7 +870,6 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
return { total, completed, percent };
|
||||
}, [cklstRows, checkResults, selectedReviewStep]);
|
||||
|
||||
|
||||
const toCklstSaveDtoList = () => {
|
||||
const persistedStepCodeSet = new Set<ReviewStepCode>();
|
||||
normalizeChecklistResultRows(initialData).forEach((r: any) => {
|
||||
@@ -877,9 +880,9 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
visibleReviewStepCodes.forEach((code) => persistedStepCodeSet.add(code));
|
||||
|
||||
// only persist rows that are enabled for checkbox (`bchckUseYn === "Y")
|
||||
// only persist rows that are enabled for checkbox (`bchckUseYn === "Y")
|
||||
// Use full cklstTree so items not currently visible (other task codes) are included
|
||||
const relevantRows = (cklstTree ?? []).filter((row) => row.bchckUseYn === "Y");
|
||||
// only persist rows that are enabled for checkbox (`bchckUseYn === "Y")
|
||||
// Use full cklstTree so items not currently visible (other task codes) are included
|
||||
const relevantRows = (cklstTree ?? []).filter((row) => row.bchckUseYn === "Y");
|
||||
|
||||
// Ensure we generate DTOs grouped by all known task codes (TASK_CODE_LABELS keys)
|
||||
const allTaskCodes = Object.keys(TASK_CODE_LABELS);
|
||||
@@ -930,7 +933,9 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
|
||||
const subtotalScale = (node: CnstpSeMngTreeDto, col: keyof BzScaleRow): number =>
|
||||
cnstpTree
|
||||
.filter((n) => cnstpLeafSet.has(n.cnstpSeCd) && n.treePath.split("|").includes(node.cnstpSeCd))
|
||||
.filter(
|
||||
(n) => cnstpLeafSet.has(n.cnstpSeCd) && n.treePath.split("|").includes(node.cnstpSeCd),
|
||||
)
|
||||
.reduce((sum, n) => sum + num((bzScaleMap[n.cnstpSeCd] ?? emptyScale())[col]), 0);
|
||||
|
||||
const scaleNodeVal = (node: CnstpSeMngTreeDto, col: keyof BzScaleRow): number =>
|
||||
@@ -1046,7 +1051,6 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
|
||||
/* ── 검증 ── */
|
||||
function fnValidation(mode: "SAVE" | "PRESENTN") {
|
||||
|
||||
if (!bzNm.trim()) {
|
||||
alert("사업명을 입력하세요.");
|
||||
return false;
|
||||
@@ -1063,8 +1067,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
alert("개인정보 제공에 동의하셔야 제출이 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!editableReviewStep) {
|
||||
alert("현재 사용자 권한/진행상태 조합에서 입력 가능한 체크리스트 단계가 없습니다.");
|
||||
return false;
|
||||
@@ -1100,14 +1103,18 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
visibleReviewStepCodes.some((step) => !checkResults[cklstKey(row, step)]),
|
||||
);
|
||||
if (missingRow) {
|
||||
const missingStep = visibleReviewStepCodes.find((step) => !checkResults[cklstKey(missingRow, step)])!;
|
||||
const missingStep = visibleReviewStepCodes.find(
|
||||
(step) => !checkResults[cklstKey(missingRow, step)],
|
||||
)!;
|
||||
const invalidKey = cklstKey(missingRow, missingStep);
|
||||
console.warn("검토 결과 미선택 항목 발견:", invalidKey, missingRow, missingStep);
|
||||
|
||||
const invalidRowEl = cklstRowRefs.current[invalidKey];
|
||||
if (invalidRowEl) {
|
||||
invalidRowEl.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
const firstRadio = invalidRowEl.querySelector<HTMLInputElement>(`input[name="chk_${invalidKey}"]`);
|
||||
const firstRadio = invalidRowEl.querySelector<HTMLInputElement>(
|
||||
`input[name="chk_${invalidKey}"]`,
|
||||
);
|
||||
firstRadio?.focus();
|
||||
} else {
|
||||
// row not visible: switch header filter to the missing row's task code,
|
||||
@@ -1125,18 +1132,14 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const toInstlSncnMngPayload = (prgrsSttsComCd: "SV" | "ST"| "ER"): InstlSncnMng => ({
|
||||
const toInstlSncnMngPayload = (
|
||||
prgrsSttsComCd: "SV" | "ST" | "ER",
|
||||
): InstlSncnMngSaveRequestDto => ({
|
||||
instlSncnDocNo: docId ?? "",
|
||||
admdstCd: "",
|
||||
sidoNm: "",
|
||||
sggNm: "",
|
||||
chrgrNm: "",
|
||||
instNm: "",
|
||||
envoSeComCd: currentDet?.envoSeComCd ?? "",
|
||||
sncnSeComCd: sncnSeComCd || DEFAULT_SNCN_SE_COM_CD,
|
||||
envoSeCdNm: "",
|
||||
taskSeComCd,
|
||||
taskSeCdNm: taskSeComCdNm,
|
||||
bgtBizCd: "",
|
||||
bgtAplyYr: "",
|
||||
bizNm: bzNm,
|
||||
@@ -1153,12 +1156,6 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
dsgnrEmlAddr,
|
||||
atchFileGroupId: etcFileGroupId,
|
||||
prgrsSttsComCd,
|
||||
prgrsSttsCdNm: "",
|
||||
regDt: "",
|
||||
mdfcnDt: "",
|
||||
rgtrNm: "",
|
||||
gugun: "",
|
||||
sido: ""
|
||||
});
|
||||
|
||||
async function handleSave() {
|
||||
@@ -1173,7 +1170,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
};
|
||||
|
||||
try {
|
||||
const issuedDocNo = await InstlSncnApi.saveApply(payload);
|
||||
const issuedDocNo = await instlSncnService.saveApply(payload);
|
||||
alert(`저장되었습니다. 문서번호: ${issuedDocNo}`);
|
||||
} catch (error) {
|
||||
console.error("저장 API 호출 실패", error);
|
||||
@@ -1188,16 +1185,16 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
async function handleSubmit() {
|
||||
if (!fnValidation("SAVE")) return;
|
||||
|
||||
const payload: InstlSncnApplySaveRequestDto = {
|
||||
const payload: InstlSncnApplySaveRequestDto = {
|
||||
instlSncnMng: toInstlSncnMngPayload("SV"), // 저장 시 진행상태는 SV (임시저장)
|
||||
bzScaleList: toBzScaleSaveDtoList(),
|
||||
bizCstList: toBizCstSaveDtoList(),
|
||||
cklstResultList: toCklstSaveDtoList(),
|
||||
esntlAtchFileList: toEsntlAtchFileSaveDtoList(),
|
||||
};
|
||||
};
|
||||
|
||||
try {
|
||||
const issuedDocNo = await InstlSncnApi.saveApply(payload);
|
||||
try {
|
||||
const issuedDocNo = await instlSncnService.saveApply(payload);
|
||||
alert(`제출 되었습니다. 문서번호: ${issuedDocNo}`);
|
||||
} catch (error) {
|
||||
console.error("저장 API 호출 실패", error);
|
||||
@@ -1264,7 +1261,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
<button className="cnfm-btn-search whitespace-nowrap">🔍 사업찾기</button>
|
||||
</div>
|
||||
</td>
|
||||
<th style={{ textAlign: "center" }}>
|
||||
<th style={{ textAlign: "center" }}>
|
||||
<span className="text-red-500">*</span> 사업기간
|
||||
</th>
|
||||
<td>
|
||||
@@ -1286,7 +1283,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style={{ textAlign: "center" }}>
|
||||
<th style={{ textAlign: "center" }}>
|
||||
<span className="text-red-500">*</span> 사업내용
|
||||
</th>
|
||||
<td colSpan={3}>
|
||||
@@ -1299,22 +1296,24 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style={{ textAlign: "center" }}>구분</th>
|
||||
<th style={{ textAlign: "center" }}>구분</th>
|
||||
<td>
|
||||
<div className="flex gap-4 text-[1.3rem]">{taskSeComCdNm}</div>
|
||||
<input type="hidden" name="taskSeComCd" value={taskSeComCd} />
|
||||
</td>
|
||||
<th style={{ textAlign: "center" }}>신청 지자체</th>
|
||||
<th style={{ textAlign: "center" }}>신청 지자체</th>
|
||||
<td>
|
||||
<span className="inline-block min-w-[16rem] whitespace-nowrap text-[1.3rem] text-gray-500">
|
||||
{isModifyMode
|
||||
? `${currentDet?.sido ?? "-"} ${currentDet?.gugun ?? "-"}`
|
||||
: userInfo?.laeSeNm ?? "\u00A0"}
|
||||
: (userInfo?.laeSeNm ?? "\u00A0")}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style={{ textAlign: "center" }}><span className="text-red-500">*</span>사업구분</th>
|
||||
<th style={{ textAlign: "center" }}>
|
||||
<span className="text-red-500">*</span>사업구분
|
||||
</th>
|
||||
<td colSpan={3}>
|
||||
<div className="flex gap-4 text-[1.3rem]">
|
||||
{[
|
||||
@@ -1346,31 +1345,47 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
<table className="cnfm-form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th rowSpan={2} style={{ textAlign: "center" }} className="text-center align-middle w-[6.5rem]">신청자</th>
|
||||
<th style={{ textAlign: "center" }}>이름</th>
|
||||
<th
|
||||
rowSpan={2}
|
||||
style={{ textAlign: "center" }}
|
||||
className="w-[6.5rem] text-center align-middle"
|
||||
>
|
||||
신청자
|
||||
</th>
|
||||
<th style={{ textAlign: "center" }}>이름</th>
|
||||
<td>
|
||||
<span className="inline-block min-w-[16rem] whitespace-nowrap text-[1.3rem] text-gray-500">{aplcntNm || userInfo?.userName || "\u00A0"}</span>
|
||||
<span className="inline-block min-w-[16rem] whitespace-nowrap text-[1.3rem] text-gray-500">
|
||||
{aplcntNm || userInfo?.userName || "\u00A0"}
|
||||
</span>
|
||||
</td>
|
||||
<th style={{ textAlign: "center" }}>전화번호</th>
|
||||
<th style={{ textAlign: "center" }}>전화번호</th>
|
||||
<td>
|
||||
<span className="inline-block min-w-[16rem] whitespace-nowrap text-[1.3rem] text-gray-500">{aplcntMblTelno || userInfo?.mphn || userInfo?.telno || "\u00A0"}</span>
|
||||
<span className="inline-block min-w-[16rem] whitespace-nowrap text-[1.3rem] text-gray-500">
|
||||
{aplcntMblTelno || userInfo?.mphn || userInfo?.telno || "\u00A0"}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style={{ textAlign: "center" }}>부서</th>
|
||||
<th style={{ textAlign: "center" }}>부서</th>
|
||||
<td>
|
||||
<span className="text-[1.3rem] text-gray-500">{aplcntOgdpNm || userInfo?.instSeNm || "\u00A0"}</span>
|
||||
<span className="text-[1.3rem] text-gray-500">
|
||||
{aplcntOgdpNm || userInfo?.instSeNm || "\u00A0"}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<th style={{ textAlign: "center" }}>이메일</th>
|
||||
|
||||
<th style={{ textAlign: "center" }}>이메일</th>
|
||||
<td>
|
||||
<span className="text-[1.3rem] text-gray-500">{aplcntEmlAddr || userInfo?.email || "\u00A0"}</span>
|
||||
<span className="text-[1.3rem] text-gray-500">
|
||||
{aplcntEmlAddr || userInfo?.email || "\u00A0"}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th rowSpan={2} style={{ textAlign: "center" }}>설계자</th>
|
||||
<th style={{ textAlign: "center" }}>이름</th>
|
||||
<th rowSpan={2} style={{ textAlign: "center" }}>
|
||||
설계자
|
||||
</th>
|
||||
<th style={{ textAlign: "center" }}>이름</th>
|
||||
<td>
|
||||
<Input
|
||||
placeholder="설계자 성명"
|
||||
@@ -1379,7 +1394,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
onChange={(e) => setDsgnrNm(e.target.value)}
|
||||
/>
|
||||
</td>
|
||||
<th style={{ textAlign: "center" }}>전화번호</th>
|
||||
<th style={{ textAlign: "center" }}>전화번호</th>
|
||||
<td>
|
||||
<Input
|
||||
placeholder="설계자 전화번호"
|
||||
@@ -1399,8 +1414,8 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
onChange={(e) => setDsgnrPsitn(e.target.value)}
|
||||
/>
|
||||
</td>
|
||||
|
||||
<th style={{ textAlign: "center" }}>이메일</th>
|
||||
|
||||
<th style={{ textAlign: "center" }}>이메일</th>
|
||||
<td>
|
||||
<Input
|
||||
placeholder="설계자 이메일"
|
||||
@@ -1418,29 +1433,34 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
<PrivacyConsent value={privacyAgree} onChange={setPrivacyAgree}>
|
||||
<p className="mb-1 font-semibold">[ 개인정보 수집항목 ]</p>
|
||||
<div>
|
||||
* 필수항목 : 소속기관, 소속부서, 담당자, 직급, 사무실 번호, FAX 번호<br />
|
||||
․ 선택항목 : 휴대폰 번호, 이메일 주소<br />
|
||||
․ 기타항목 : IP Address, 쿠키, 시스템 접속 및 이용 기록<br />
|
||||
※ 시스템 이용과정에서 기타 항목의 정보들이 자동으로 생성되어 수집될 수 있습니다.
|
||||
* 필수항목 : 소속기관, 소속부서, 담당자, 직급, 사무실 번호, FAX 번호
|
||||
<br />
|
||||
․ 선택항목 : 휴대폰 번호, 이메일 주소
|
||||
<br />
|
||||
․ 기타항목 : IP Address, 쿠키, 시스템 접속 및 이용 기록
|
||||
<br />※ 시스템 이용과정에서 기타 항목의 정보들이 자동으로 생성되어 수집될 수 있습니다.
|
||||
</div>
|
||||
|
||||
<p className="mt-4 font-semibold">[ 개인정보 이용목적 ]</p>
|
||||
<div>
|
||||
․ 국가하수도정보시스템 웹서비스 이용에 따른 본인 확인 절차에 이용<br />
|
||||
․ 국가하수도정보시스템 사용에 필요한 권한 부여<br />
|
||||
․ 사용자별 맞춤 컨텐츠 (처리시설의 운영 데이터 조회, 수질현황 데이터 조회, 예산 편성 / 예산편성 등) 제공에 이용
|
||||
․ 국가하수도정보시스템 웹서비스 이용에 따른 본인 확인 절차에 이용
|
||||
<br />
|
||||
․ 국가하수도정보시스템 사용에 필요한 권한 부여
|
||||
<br />․ 사용자별 맞춤 컨텐츠 (처리시설의 운영 데이터 조회, 수질현황 데이터 조회, 예산 편성
|
||||
/ 예산편성 등) 제공에 이용
|
||||
</div>
|
||||
|
||||
<div className="tit mt-4">● 개인정보의 보유 및 이용기간</div>
|
||||
<div>
|
||||
․ 수집된 고객의 개인정보는 2년 동안 보유하며 그 이후에는 문서를 파쇄합니다.<br />
|
||||
․ 정보제공자가 개인정보 파쇄를 요청할 경우 즉시 파쇄합니다.
|
||||
․ 수집된 고객의 개인정보는 2년 동안 보유하며 그 이후에는 문서를 파쇄합니다.
|
||||
<br />․ 정보제공자가 개인정보 파쇄를 요청할 경우 즉시 파쇄합니다.
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div className="tit">● 개인정보 제공 거부에 따른 제한사항</div>
|
||||
<div>
|
||||
․ 귀하는 개인정보 제공 동의를 거부할 권리가 있으나, 동의 거부 시 국가하수도정보시스템 이용 서비스에 제한이 있을 수 있습니다.
|
||||
․ 귀하는 개인정보 제공 동의를 거부할 권리가 있으나, 동의 거부 시 국가하수도정보시스템 이용
|
||||
서비스에 제한이 있을 수 있습니다.
|
||||
</div>
|
||||
</PrivacyConsent>
|
||||
|
||||
@@ -1613,25 +1633,27 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
<div className="cnfm-card p-4">
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<h3 className="text-[1.5rem] font-bold text-gray-700">체크리스트</h3>
|
||||
<div className="flex gap-2 items-center">
|
||||
{Array.from(new Set((cklstTree ?? []).map((r) => (r as any).taskSeComCd).filter(Boolean))).map(
|
||||
(code) => {
|
||||
const name = TASK_CODE_LABELS[code] ?? code;
|
||||
const active = selectedTaskCode === code;
|
||||
return (
|
||||
<button
|
||||
key={code}
|
||||
type="button"
|
||||
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${
|
||||
active ? "border-blue-500 bg-blue-50 text-blue-700" : "border-gray-300 bg-white text-gray-600"
|
||||
}`}
|
||||
onClick={() => setSelectedTaskCode(code)}
|
||||
>
|
||||
{name}
|
||||
</button>
|
||||
);
|
||||
},
|
||||
)}
|
||||
<div className="flex items-center gap-2">
|
||||
{Array.from(
|
||||
new Set((cklstTree ?? []).map((r) => (r as any).taskSeComCd).filter(Boolean)),
|
||||
).map((code) => {
|
||||
const name = TASK_CODE_LABELS[code] ?? code;
|
||||
const active = selectedTaskCode === code;
|
||||
return (
|
||||
<button
|
||||
key={code}
|
||||
type="button"
|
||||
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${
|
||||
active
|
||||
? "border-blue-500 bg-blue-50 text-blue-700"
|
||||
: "border-gray-300 bg-white text-gray-600"
|
||||
}`}
|
||||
onClick={() => setSelectedTaskCode(code)}
|
||||
>
|
||||
{name}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
<div className="text-[1.1rem] text-gray-500">{`(${cklstStats.completed}/${cklstStats.total})`}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1663,8 +1685,9 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
)}
|
||||
</div>
|
||||
<div className="mb-2 text-[1.25rem] text-gray-500">
|
||||
체크리스트 진행상황 [{selectedReviewStep}] — 총합: <strong>{cklstStats.total}</strong> · 완료: {" "}
|
||||
<strong>{cklstStats.completed}</strong> · 진행률: <strong>{cklstStats.percent}%</strong>
|
||||
체크리스트 진행상황 [{selectedReviewStep}] — 총합: <strong>{cklstStats.total}</strong> ·
|
||||
완료: <strong>{cklstStats.completed}</strong> · 진행률:{" "}
|
||||
<strong>{cklstStats.percent}%</strong>
|
||||
</div>
|
||||
<div className="cnfm-table-wrap">
|
||||
<table className="cnfm-table">
|
||||
@@ -1729,7 +1752,7 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
cklstRows.map((row) => {
|
||||
const key = cklstKey(row, selectedReviewStep);
|
||||
const rvwPaddingLeft = `${Math.max(0, row.treeLevel - 1) * 16 + 8}px`;
|
||||
//bchckUseYn 의 값이 "Y"인 항목은 라디오 박스가 보이고 없으면 안보이게 처리
|
||||
//bchckUseYn 의 값이 "Y"인 항목은 라디오 박스가 보이고 없으면 안보이게 처리
|
||||
const showRadios = row.bchckUseYn === "Y";
|
||||
return (
|
||||
<tr
|
||||
@@ -1739,7 +1762,10 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
}}
|
||||
>
|
||||
<td className="text-center text-[1.2rem]">{row.cklstArtclNm}</td>
|
||||
<td className="!text-left pl-2 text-[1.2rem] text-gray-600" style={{ paddingLeft: rvwPaddingLeft }}>
|
||||
<td
|
||||
className="pl-2 !text-left text-[1.2rem] text-gray-600"
|
||||
style={{ paddingLeft: rvwPaddingLeft }}
|
||||
>
|
||||
{row.treeLevel > 1 ? "└ " : ""}
|
||||
{row.rvwCn}
|
||||
</td>
|
||||
@@ -1758,7 +1784,9 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
value="Y"
|
||||
checked={checkResults[key] === "Y"}
|
||||
disabled={editableReviewStep !== selectedReviewStep}
|
||||
onChange={() => setCheckResults((prev) => ({ ...prev, [key]: "Y" }))}
|
||||
onChange={() =>
|
||||
setCheckResults((prev) => ({ ...prev, [key]: "Y" }))
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
@@ -1770,14 +1798,16 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
value="N"
|
||||
checked={checkResults[key] === "N"}
|
||||
disabled={editableReviewStep !== selectedReviewStep}
|
||||
onChange={() => setCheckResults((prev) => ({ ...prev, [key]: "N" }))}
|
||||
onChange={() =>
|
||||
setCheckResults((prev) => ({ ...prev, [key]: "N" }))
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
|
||||
{showRadios && selectedReviewStep !== "LOCAL" ? (
|
||||
|
||||
{showRadios && selectedReviewStep !== "LOCAL" ? (
|
||||
<td className="text-left">
|
||||
<textarea
|
||||
className="cnfm-input w-full"
|
||||
@@ -1828,7 +1858,9 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
<td className="pl-2">
|
||||
<div className="w-full text-left">
|
||||
{item.esntlAtchFileNm}
|
||||
{item.esntlAtchYn === "Y" ? <span className="ml-1 text-red-500">*</span> : null}
|
||||
{item.esntlAtchYn === "Y" ? (
|
||||
<span className="ml-1 text-red-500">*</span>
|
||||
) : null}
|
||||
</div>
|
||||
</td>
|
||||
<td>{fileFormat}</td>
|
||||
@@ -1838,7 +1870,11 @@ function CnfmRegistPage({ initialData }: { initialData?: any } = {}) {
|
||||
type="text"
|
||||
placeholder="첨부문서를 올려주세요"
|
||||
className="cnfm-input flex-1"
|
||||
value={requiredFile?.uploading ? "업로드 중..." : requiredFile?.fileName || ""}
|
||||
value={
|
||||
requiredFile?.uploading
|
||||
? "업로드 중..."
|
||||
: requiredFile?.fileName || ""
|
||||
}
|
||||
readOnly
|
||||
/>
|
||||
<input
|
||||
+178
-84
@@ -12,9 +12,9 @@ import { PROXY_HOST } from "@/shared/config";
|
||||
import { formatFileSize } from "@/shared/lib/file-utils";
|
||||
import axios from "axios";
|
||||
import { processElaprPrgrs } from "@/entities/elapr/api/elapr-prgrs-service";
|
||||
import { ElaprDmndApi } from "@/entities/elapr/api/elapr-dmnd-service";
|
||||
import { elaprDmndService } from "@/entities/elapr";
|
||||
import { dayjs, useUserStore, useAlertStore } from "@/shared/lib";
|
||||
import { InstlSncnApi, type InstlSncnApplySaveRequestDto } from "@/entities/instl-sncn";
|
||||
import { instlSncnService, type InstlSncnApplySaveRequestDto } from "@/entities/instl-sncn";
|
||||
import { client } from "@/shared/api";
|
||||
|
||||
import "./cnfm-page.css";
|
||||
@@ -67,9 +67,7 @@ const TASK_CODE_LABELS: Record<string, string> = {
|
||||
SF: "하수처리시설",
|
||||
};
|
||||
|
||||
const normalizeChecklistResultMap = (
|
||||
raw: unknown,
|
||||
): Record<ReviewStepCode, any[]> => {
|
||||
const normalizeChecklistResultMap = (raw: unknown): Record<ReviewStepCode, any[]> => {
|
||||
const base: Record<ReviewStepCode, any[]> = { LOCAL: [], ENV: [], KECO: [] };
|
||||
if (!raw) return base;
|
||||
|
||||
@@ -101,7 +99,7 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ["instl-sncn-detail", id],
|
||||
queryFn: () => InstlSncnApi.getById(id),
|
||||
queryFn: () => instlSncnService.getById(id),
|
||||
});
|
||||
|
||||
const data = (query.data ?? {}) as any;
|
||||
@@ -138,20 +136,28 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-800", icon: "✔️" },
|
||||
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-800", icon: "✖️" },
|
||||
};
|
||||
const st = statusMap[status] ?? { label: status || "", badgeClass: "bg-gray-100 text-gray-700", icon: "" };
|
||||
const st = statusMap[status] ?? {
|
||||
label: status || "",
|
||||
badgeClass: "bg-gray-100 text-gray-700",
|
||||
icon: "",
|
||||
};
|
||||
return (
|
||||
<div className="text-center">
|
||||
<div className="font-semibold">{row.aprvrUuidNm ?? "-"}</div>
|
||||
<div className="text-[0.95rem] text-gray-500">
|
||||
{row.ognzNm ? `${row.ognzNm}` : ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm ? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}` : ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm
|
||||
? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}`
|
||||
: ""}
|
||||
</div>
|
||||
<div className="text-[0.9rem] mt-1 flex items-center justify-center gap-2">
|
||||
{row.atrzDt ? <span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span> : null}
|
||||
<div className="mt-1 flex items-center justify-center gap-2 text-[0.9rem]">
|
||||
{row.atrzDt ? (
|
||||
<span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span>
|
||||
) : null}
|
||||
{st.label ? (
|
||||
<span
|
||||
title={`${row.atrzPrgrsSttsComNm ?? st.label}${row.rjctRsn ? ` — 사유: ${row.rjctRsn}` : ""}${row.atrzDt ? ` · ${dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}` : ""}`}
|
||||
className={`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold ml-1 ${st.badgeClass}`}
|
||||
className={`ml-1 inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold ${st.badgeClass}`}
|
||||
>
|
||||
<span className="mr-1">{st.icon}</span>
|
||||
<span>{st.label}</span>
|
||||
@@ -184,7 +190,10 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("결재 처리 실패", err);
|
||||
const msg = axios.isAxiosError(err) && err.response?.data?.message ? err.response.data.message : "결재 처리 중 오류가 발생했습니다.";
|
||||
const msg =
|
||||
axios.isAxiosError(err) && err.response?.data?.message
|
||||
? err.response.data.message
|
||||
: "결재 처리 중 오류가 발생했습니다.";
|
||||
alert(msg);
|
||||
}
|
||||
};
|
||||
@@ -193,12 +202,11 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
try {
|
||||
const payload = {
|
||||
elaprDocNo: det.instlSncnDocNo,
|
||||
elaprTmpltId: elaprTmpltId, /* 팝업에서 선택된 전자결제 템플릿 */
|
||||
dmndTtl: det.bizNm, /* "구례 하수도 처리시설 2026", */
|
||||
dmndCn: det.bizCn /*"구례 발주 하수도 처리시설 사업 2026년도 진행분 결제 요청 입니다."*/
|
||||
elaprTmpltId: elaprTmpltId /* 팝업에서 선택된 전자결제 템플릿 */,
|
||||
dmndTtl: det.bizNm /* "구례 하수도 처리시설 2026", */,
|
||||
dmndCn: det.bizCn /*"구례 발주 하수도 처리시설 사업 2026년도 진행분 결제 요청 입니다."*/,
|
||||
};
|
||||
// ElaprDmndApi 서비스를 통해 백엔드 연동
|
||||
await ElaprDmndApi.create(payload);
|
||||
await elaprDmndService.save(payload);
|
||||
alert("결재자 지정(결재요청 등록)이 완료되었습니다.");
|
||||
try {
|
||||
await query.refetch();
|
||||
@@ -207,7 +215,10 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("결재자 지정 실패", err);
|
||||
const msg = axios.isAxiosError(err) && err.response?.data?.message ? err.response.data.message : "결재자 지정 중 오류가 발생했습니다.";
|
||||
const msg =
|
||||
axios.isAxiosError(err) && err.response?.data?.message
|
||||
? err.response.data.message
|
||||
: "결재자 지정 중 오류가 발생했습니다.";
|
||||
alert(msg);
|
||||
}
|
||||
};
|
||||
@@ -221,21 +232,29 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-800", icon: "✔️" },
|
||||
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-800", icon: "✖️" },
|
||||
};
|
||||
const st = statusMap[status] ?? { label: status || "", badgeClass: "bg-gray-100 text-gray-700", icon: "" };
|
||||
const st = statusMap[status] ?? {
|
||||
label: status || "",
|
||||
badgeClass: "bg-gray-100 text-gray-700",
|
||||
icon: "",
|
||||
};
|
||||
return (
|
||||
<div className="text-center">
|
||||
<div className="font-semibold">{row.aprvrUuidNm ?? "-"}</div>
|
||||
<div className="text-[0.95rem] text-gray-500">
|
||||
{row.ognzNm ? `${row.ognzNm}` : ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm ? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}` : ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm
|
||||
? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}`
|
||||
: ""}
|
||||
</div>
|
||||
<div className="text-[0.9rem] mt-1 flex items-center justify-center gap-2">
|
||||
{row.atrzDt ? <span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span> : null}
|
||||
<div className="mt-1 flex items-center justify-center gap-2 text-[0.9rem]">
|
||||
{row.atrzDt ? (
|
||||
<span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span>
|
||||
) : null}
|
||||
{st.label ? (
|
||||
<>
|
||||
<span
|
||||
title={`${row.atrzPrgrsSttsComNm ?? st.label}${row.rjctRsn ? ` — 사유: ${row.rjctRsn}` : ""}${row.atrzDt ? ` · ${dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}` : ""}`}
|
||||
className={`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold ml-1 ${st.badgeClass}`}
|
||||
className={`ml-1 inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold ${st.badgeClass}`}
|
||||
>
|
||||
<span className="mr-1">{st.icon}</span>
|
||||
<span>{st.label}</span>
|
||||
@@ -244,7 +263,7 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleApproveClick(row.elaprPrgrsId, row.atrzSeComCd)}
|
||||
className="ml-2 px-2 py-1 bg-blue-500 text-white text-xs rounded"
|
||||
className="ml-2 rounded bg-blue-500 px-2 py-1 text-xs text-white"
|
||||
>
|
||||
결제
|
||||
</button>
|
||||
@@ -269,7 +288,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
|
||||
// derive available task codes from checklist results
|
||||
const taskCodes = useMemo(() => {
|
||||
return Array.from(new Set((cklstAll ?? []).map((r: any) => (r as any).taskSeComCd).filter(Boolean)));
|
||||
return Array.from(
|
||||
new Set((cklstAll ?? []).map((r: any) => (r as any).taskSeComCd).filter(Boolean)),
|
||||
);
|
||||
}, [cklstAll]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -297,8 +318,11 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
);
|
||||
return rows
|
||||
.slice()
|
||||
.sort((a: any, b: any) =>
|
||||
(a.cklstArtclSn ?? 0) - (b.cklstArtclSn ?? 0) || (a.sortSeq ?? 0) - (b.sortSeq ?? 0) || (a.cklstRvwSn ?? 0) - (b.cklstRvwSn ?? 0),
|
||||
.sort(
|
||||
(a: any, b: any) =>
|
||||
(a.cklstArtclSn ?? 0) - (b.cklstArtclSn ?? 0) ||
|
||||
(a.sortSeq ?? 0) - (b.sortSeq ?? 0) ||
|
||||
(a.cklstRvwSn ?? 0) - (b.cklstRvwSn ?? 0),
|
||||
);
|
||||
}, [cklstResultMap, selectedReviewStep, visibleReviewStepCodes.length, selectedTaskCode]);
|
||||
|
||||
@@ -307,11 +331,15 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
|
||||
const cklstStats = useMemo(() => {
|
||||
if (!selectedReviewStep) return { total: 0, completed: 0, percent: 0 };
|
||||
const rows = (cklstResultMap[selectedReviewStep] ?? []).filter((r: any) => r.bchckUseYn === "Y" && (selectedTaskCode ? (r.taskSeComCd ?? "") === selectedTaskCode : true));
|
||||
const rows = (cklstResultMap[selectedReviewStep] ?? []).filter(
|
||||
(r: any) =>
|
||||
r.bchckUseYn === "Y" &&
|
||||
(selectedTaskCode ? (r.taskSeComCd ?? "") === selectedTaskCode : true),
|
||||
);
|
||||
const total = rows.length;
|
||||
const completed = rows.reduce((acc: number, row: any) => {
|
||||
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${selectedReviewStep}`;
|
||||
const val = (viewCheckResults[key] ?? row.rvwRsltAnmlyYn) ?? "";
|
||||
const val = viewCheckResults[key] ?? row.rvwRsltAnmlyYn ?? "";
|
||||
return acc + (val ? 1 : 0);
|
||||
}, 0);
|
||||
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
@@ -330,8 +358,8 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
.filter((r: any) => r.bchckUseYn === "Y")
|
||||
.map((row: any) => {
|
||||
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${selectedReviewStep}`;
|
||||
const rvwRsltAnmlyYn = (viewCheckResults[key] ?? row.rvwRsltAnmlyYn) ?? null;
|
||||
const picRvwCn = (viewCheckComments[key] ?? row.picRvwCn) ?? null;
|
||||
const rvwRsltAnmlyYn = viewCheckResults[key] ?? row.rvwRsltAnmlyYn ?? null;
|
||||
const picRvwCn = viewCheckComments[key] ?? row.picRvwCn ?? null;
|
||||
return {
|
||||
taskSeComCd: row.taskSeComCd ?? "",
|
||||
cklstSn: row.cklstSn,
|
||||
@@ -353,7 +381,7 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
} as unknown as InstlSncnApplySaveRequestDto;
|
||||
|
||||
try {
|
||||
const issuedDocNo = await InstlSncnApi.techReview(payload);
|
||||
const issuedDocNo = await instlSncnService.techReview(det.instlSncnDocNo, payload);
|
||||
alert(`기술검토 등록이 완료되었습니다. 문서번호: ${issuedDocNo}`);
|
||||
} catch (error) {
|
||||
console.error("기술검토 등록 API 호출 실패", error);
|
||||
@@ -370,7 +398,8 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
const comments: Record<string, string> = {};
|
||||
(selectedChecklistRows ?? []).forEach((row: any) => {
|
||||
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${row.rvwStpComCd ?? "LOCAL"}`;
|
||||
if (row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N") results[key] = row.rvwRsltAnmlyYn;
|
||||
if (row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N")
|
||||
results[key] = row.rvwRsltAnmlyYn;
|
||||
if (row.picRvwCn) comments[key] = String(row.picRvwCn);
|
||||
});
|
||||
setViewCheckResults(results);
|
||||
@@ -440,10 +469,7 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
</table>
|
||||
{/** 결제자 지정 버튼 */}
|
||||
<div className="mt-4 text-right">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => handleAssignApproverClick("TMPLT20260611000001")}
|
||||
>
|
||||
<Button type="button" onClick={() => handleAssignApproverClick("TMPLT20260611000001")}>
|
||||
결재자 지정
|
||||
</Button>
|
||||
</div>
|
||||
@@ -452,7 +478,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
{/* )} */}
|
||||
<div className="cnfm-card p-4">
|
||||
<h2 className="cnfm-section-title">설치인가 상세보기</h2>
|
||||
<p className="mt-2 text-[1.3rem] text-gray-600">문서번호: <strong>{det.instlSncnDocNo}</strong></p>
|
||||
<p className="mt-2 text-[1.3rem] text-gray-600">
|
||||
문서번호: <strong>{det.instlSncnDocNo}</strong>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="cnfm-card p-4">
|
||||
@@ -473,7 +501,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<th>구분</th>
|
||||
<td>{det.taskSeCdNm || det.taskSeComCd || "-"}</td>
|
||||
<th>신청지자체</th>
|
||||
<td>{det.sido || "-"} {det.gugun || "-"}</td>
|
||||
<td>
|
||||
{det.sido || "-"} {det.gugun || "-"}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>사업구분</th>
|
||||
@@ -485,7 +515,6 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<th>예산사업코드</th>
|
||||
<td>{det.bgtBizCd || "-"}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -559,7 +588,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<tbody>
|
||||
{bizSclList.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={5} className="cnfm-td-empty">조회된 사업규모 항목이 없습니다.</td>
|
||||
<td colSpan={5} className="cnfm-td-empty">
|
||||
조회된 사업규모 항목이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
bizSclList.map((node: any) => {
|
||||
@@ -569,12 +600,28 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
const tstmDesignQty = Number(node.tstmDesignQty) || 0;
|
||||
const diff = tstmDesignQty - budgetReflct;
|
||||
return (
|
||||
<tr key={node.cnstpSeCd} className={node.treeLevel === 1 ? "bg-gray-50 font-semibold" : ""}>
|
||||
<td className="bg-gray-50 pl-2 text-left" style={{ paddingLeft: `${pl + 8}px` }}>{node.cnstpSeCdNm}</td>
|
||||
<td><div className="text-right">{fmt(bscPlanQty)}</div></td>
|
||||
<td><div className="text-right">{fmt(budgetReflct)}</div></td>
|
||||
<td><div className="text-right">{fmt(tstmDesignQty)}</div></td>
|
||||
<td><div className="text-right">{diff > 0 ? `+${fmt(diff)}` : fmt(diff)}</div></td>
|
||||
<tr
|
||||
key={node.cnstpSeCd}
|
||||
className={node.treeLevel === 1 ? "bg-gray-50 font-semibold" : ""}
|
||||
>
|
||||
<td
|
||||
className="bg-gray-50 pl-2 text-left"
|
||||
style={{ paddingLeft: `${pl + 8}px` }}
|
||||
>
|
||||
{node.cnstpSeCdNm}
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{fmt(bscPlanQty)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{fmt(budgetReflct)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{fmt(tstmDesignQty)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{diff > 0 ? `+${fmt(diff)}` : fmt(diff)}</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
@@ -586,7 +633,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
|
||||
{/* 총사업비 */}
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">총사업비 <span className="text-[1.2rem] font-normal text-gray-400">(단위: 백만원)</span></h3>
|
||||
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">
|
||||
총사업비 <span className="text-[1.2rem] font-normal text-gray-400">(단위: 백만원)</span>
|
||||
</h3>
|
||||
<div className="cnfm-table-wrap">
|
||||
<table className="cnfm-table w-full table-fixed">
|
||||
<thead>
|
||||
@@ -606,7 +655,6 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
</thead>
|
||||
<tbody>
|
||||
{bizCstList.map((node: any) => {
|
||||
|
||||
const pl = indentPx(node.indAcntgSeCdNm);
|
||||
const bscPlanAmt = Number(node.bscPlanAmt) || 0;
|
||||
const budgetReflct = Number(node.bgtRfltAmt) || 0;
|
||||
@@ -626,7 +674,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
}
|
||||
>
|
||||
{node.treeLevel <= 2 ? (
|
||||
<td colSpan={2} className="pl-2 text-left">{node.acntgSeCdNm}</td>
|
||||
<td colSpan={2} className="pl-2 text-left">
|
||||
{node.acntgSeCdNm}
|
||||
</td>
|
||||
) : (
|
||||
<>
|
||||
<td className="w-[4rem]"></td>
|
||||
@@ -653,7 +703,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<div className="text-right">{diff > 0 ? `+${fmt(diff)}` : fmt(diff)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{budgetReflct !== 0 ? `${Math.round((diff / budgetReflct) * 100)}%` : "-"}</div>
|
||||
<div className="text-right">
|
||||
{budgetReflct !== 0 ? `${Math.round((diff / budgetReflct) * 100)}%` : "-"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
@@ -668,7 +720,7 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<h3 className="text-[1.5rem] font-bold text-gray-700">체크리스트</h3>
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex items-center gap-2">
|
||||
{Array.from(new Set(taskCodes)).map((code) => {
|
||||
const name = TASK_CODE_LABELS[code] ?? code;
|
||||
const active = selectedTaskCode === code;
|
||||
@@ -676,8 +728,11 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<button
|
||||
key={code}
|
||||
type="button"
|
||||
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${active ? "border-blue-500 bg-blue-50 text-blue-700" : "border-gray-300 bg-white text-gray-600"
|
||||
}`}
|
||||
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${
|
||||
active
|
||||
? "border-blue-500 bg-blue-50 text-blue-700"
|
||||
: "border-gray-300 bg-white text-gray-600"
|
||||
}`}
|
||||
onClick={() => setSelectedTaskCode(code)}
|
||||
>
|
||||
{name}
|
||||
@@ -698,10 +753,11 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<button
|
||||
key={stepCode}
|
||||
type="button"
|
||||
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${selectedReviewStep === stepCode
|
||||
? "border-blue-500 bg-blue-50 text-blue-700"
|
||||
: "border-gray-300 bg-white text-gray-600"
|
||||
}`}
|
||||
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${
|
||||
selectedReviewStep === stepCode
|
||||
? "border-blue-500 bg-blue-50 text-blue-700"
|
||||
: "border-gray-300 bg-white text-gray-600"
|
||||
}`}
|
||||
onClick={() => setSelectedReviewStep(stepCode)}
|
||||
>
|
||||
{stepCode}
|
||||
@@ -710,40 +766,40 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
)}
|
||||
</div>
|
||||
<div className="mb-2 text-[1.25rem] text-gray-500">
|
||||
체크리스트 진행상황 [{selectedReviewStep}] — 총합: <strong>{cklstStats.total}</strong> · 완료: <strong>{cklstStats.completed}</strong> · 진행률: <strong>{cklstStats.percent}%</strong>
|
||||
체크리스트 진행상황 [{selectedReviewStep}] — 총합: <strong>{cklstStats.total}</strong> ·
|
||||
완료: <strong>{cklstStats.completed}</strong> · 진행률:{" "}
|
||||
<strong>{cklstStats.percent}%</strong>
|
||||
</div>
|
||||
<div className="cnfm-table-wrap mt-3">
|
||||
<table className="cnfm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="w-[20rem]" rowSpan={2}>검토항목</th>
|
||||
<th className="w-[20rem]" rowSpan={2}>
|
||||
검토항목
|
||||
</th>
|
||||
<th rowSpan={2}>주요 검토내용</th>
|
||||
<th colSpan={2}>검토 결과(✓)</th>
|
||||
{selectedReviewStep !== "LOCAL" ? (
|
||||
<th rowSpan={2} className="w-[20rem]">기술검토 의견</th>
|
||||
<th rowSpan={2} className="w-[20rem]">
|
||||
기술검토 의견
|
||||
</th>
|
||||
) : null}
|
||||
</tr>
|
||||
<tr>
|
||||
<th className="w-[9rem]">
|
||||
<button
|
||||
type="button"
|
||||
>
|
||||
예
|
||||
</button>
|
||||
<button type="button">예</button>
|
||||
</th>
|
||||
<th className="w-[9rem]">
|
||||
<button
|
||||
type="button"
|
||||
>
|
||||
아니오
|
||||
</button>
|
||||
<button type="button">아니오</button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{selectedChecklistRows.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={5} className="cnfm-td-empty">조회된 체크리스트 항목이 없습니다.</td>
|
||||
<td colSpan={5} className="cnfm-td-empty">
|
||||
조회된 체크리스트 항목이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
selectedChecklistRows.map((row: any) => {
|
||||
@@ -754,7 +810,13 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
return (
|
||||
<tr key={key}>
|
||||
<td className="text-center text-[1.2rem]">{row.cklstArtclNm}</td>
|
||||
<td className="!text-left pl-2 text-[1.2rem] text-gray-600" style={{ paddingLeft: `${Math.max(0, row.treeLevel - 1) * 16 + 8}px` }}>{row.treeLevel > 1 ? "└ " : ""}{row.rvwCn}</td>
|
||||
<td
|
||||
className="pl-2 !text-left text-[1.2rem] text-gray-600"
|
||||
style={{ paddingLeft: `${Math.max(0, row.treeLevel - 1) * 16 + 8}px` }}
|
||||
>
|
||||
{row.treeLevel > 1 ? "└ " : ""}
|
||||
{row.rvwCn}
|
||||
</td>
|
||||
{!showRadios ? (
|
||||
<>
|
||||
<td className="text-center">-</td>
|
||||
@@ -769,7 +831,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
value="Y"
|
||||
checked={(viewCheckResults[key] ?? "") === "Y"}
|
||||
disabled={selectedReviewStep === "LOCAL"}
|
||||
onChange={() => setViewCheckResults((prev) => ({ ...prev, [key]: "Y" }))}
|
||||
onChange={() =>
|
||||
setViewCheckResults((prev) => ({ ...prev, [key]: "Y" }))
|
||||
}
|
||||
/>
|
||||
</td>
|
||||
<td className="text-center">
|
||||
@@ -779,7 +843,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
value="N"
|
||||
checked={(viewCheckResults[key] ?? "") === "N"}
|
||||
disabled={selectedReviewStep === "LOCAL"}
|
||||
onChange={() => setViewCheckResults((prev) => ({ ...prev, [key]: "N" }))}
|
||||
onChange={() =>
|
||||
setViewCheckResults((prev) => ({ ...prev, [key]: "N" }))
|
||||
}
|
||||
/>
|
||||
</td>
|
||||
</>
|
||||
@@ -789,7 +855,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<textarea
|
||||
className="cnfm-input w-full"
|
||||
value={viewCheckComments[key] ?? ""}
|
||||
onChange={(e) => setViewCheckComments((prev) => ({ ...prev, [key]: e.target.value }))}
|
||||
onChange={(e) =>
|
||||
setViewCheckComments((prev) => ({ ...prev, [key]: e.target.value }))
|
||||
}
|
||||
/>
|
||||
</td>
|
||||
) : null}
|
||||
@@ -817,7 +885,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<tbody>
|
||||
{esntlFileList.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={3} className="cnfm-td-empty">조회된 필수 첨부파일 항목이 없습니다.</td>
|
||||
<td colSpan={3} className="cnfm-td-empty">
|
||||
조회된 필수 첨부파일 항목이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
esntlFileList.map((f: any) => (
|
||||
@@ -825,17 +895,28 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<td className="pl-2">
|
||||
<div className="w-full text-left">
|
||||
{f.esntlAtchFileNm}
|
||||
{f.esntlAtchYn === "Y" ? <span className="ml-1 text-red-500">*</span> : null}
|
||||
{f.esntlAtchYn === "Y" ? (
|
||||
<span className="ml-1 text-red-500">*</span>
|
||||
) : null}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{f.atflCd ? (
|
||||
<a className="text-blue-600" href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${f.atflCd}`} target="_blank" rel="noreferrer">{f.orgnlFileNm || "다운로드"}</a>
|
||||
<a
|
||||
className="text-blue-600"
|
||||
href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${f.atflCd}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{f.orgnlFileNm || "다운로드"}
|
||||
</a>
|
||||
) : (
|
||||
<span className="text-gray-500">첨부없음</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="w-[8rem] text-right"><div className="text-right">{formatFileSize(f.atflFlieSz)}</div></td>
|
||||
<td className="w-[8rem] text-right">
|
||||
<div className="text-right">{formatFileSize(f.atflFlieSz)}</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)}
|
||||
@@ -858,19 +939,30 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
<tbody>
|
||||
{etcFileList.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={2} className="cnfm-td-empty">등록된 기타첨부파일이 없습니다.</td>
|
||||
<td colSpan={2} className="cnfm-td-empty">
|
||||
등록된 기타첨부파일이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
etcFileList.map((f: any) => (
|
||||
<tr key={f.atflId}>
|
||||
<td>
|
||||
{f.orgnlFileNm ? (
|
||||
<a className="text-blue-600" href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${f.atflCd}`} target="_blank" rel="noreferrer">{f.orgnlFileNm}</a>
|
||||
<a
|
||||
className="text-blue-600"
|
||||
href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${f.atflCd}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{f.orgnlFileNm}
|
||||
</a>
|
||||
) : (
|
||||
<span className="text-gray-700">{f.physFileNm || f.atflId}</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="w-[8rem] text-right text-gray-500">{formatFileSize(f.atflFlieSz)}</td>
|
||||
<td className="w-[8rem] text-right text-gray-500">
|
||||
{formatFileSize(f.atflFlieSz)}
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
)}
|
||||
@@ -880,7 +972,9 @@ function CnfmViewPage({ id }: { id: string }) {
|
||||
</div>
|
||||
|
||||
<div className="cnfm-action-row">
|
||||
<Button color="white" onClick={() => router.push("/instl-sncn")}>목록</Button>
|
||||
<Button color="white" onClick={() => router.push("/instl-sncn")}>
|
||||
목록
|
||||
</Button>
|
||||
<Button onClick={() => router.push(`/instl-sncn/${id}/modify`)}>수정</Button>
|
||||
<Button onClick={() => void hadleTechReviewSubmit()}>기술검토등록</Button>
|
||||
</div>
|
||||
@@ -1,4 +1,5 @@
|
||||
export { CnfmListPage } from "./ui/cnfm-list-page";
|
||||
export { CnfmViewPage } from "./ui/cnfm-view-page";
|
||||
export { CnfmRegistPage } from "./ui/cnfm-regist-page";
|
||||
export { CnfmModifyPage } from "./ui/cnfm-modify-page";
|
||||
export { InstlEditPage } from "./ui/instl-edit-page";
|
||||
export { InstlFormPage } from "./ui/instl-form-page";
|
||||
export { InstlListPage } from "./ui/instl-list-page";
|
||||
export { InstlRegistPage } from "./ui/instl-regist-page";
|
||||
export { InstlViewPage } from "./ui/instl-view-page";
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { ElaprDocPrgrsClientResponseDto } from "@/entities/instl-sncn";
|
||||
|
||||
export interface ApproverStatusConfig {
|
||||
label: string;
|
||||
badgeClass: string;
|
||||
}
|
||||
|
||||
export const APPROVER_STATUS_MAP: Record<string, ApproverStatusConfig> = {
|
||||
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700" },
|
||||
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-800" },
|
||||
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-800" },
|
||||
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-800" },
|
||||
};
|
||||
|
||||
export function sortByAtrzSeqNo(
|
||||
list: ElaprDocPrgrsClientResponseDto[],
|
||||
): ElaprDocPrgrsClientResponseDto[] {
|
||||
return list.slice().sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
}
|
||||
|
||||
export function getApproverStatus(status: string | undefined): ApproverStatusConfig {
|
||||
return (
|
||||
APPROVER_STATUS_MAP[status ?? ""] ?? {
|
||||
label: status || "-",
|
||||
badgeClass: "bg-gray-100 text-gray-700",
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
import type { InstlSncnBizCstSaveRequestDto } from "@/entities/instl-sncn";
|
||||
|
||||
export interface CostItemDef {
|
||||
code: string;
|
||||
readonly?: boolean;
|
||||
children?: string[];
|
||||
}
|
||||
|
||||
function sumChildAmounts(list: InstlSncnBizCstSaveRequestDto[], childCodes: string[]) {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
childCodes.forEach((childCode) => {
|
||||
const child = list.find((c) => c.acntgSeCd === childCode);
|
||||
if (child) {
|
||||
bscPlanAmt += child.bscPlanAmt || 0;
|
||||
bgtRfltAmt += child.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += child.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return { bscPlanAmt, bgtRfltAmt, tstmDesignAmt };
|
||||
}
|
||||
|
||||
export function recalculateBizCstTotals(
|
||||
list: InstlSncnBizCstSaveRequestDto[],
|
||||
items: CostItemDef[],
|
||||
): InstlSncnBizCstSaveRequestDto[] {
|
||||
const newList = [...list];
|
||||
let hasChanges = false;
|
||||
|
||||
for (let i = items.length - 1; i >= 0; i--) {
|
||||
const item = items[i];
|
||||
if (!item.readonly || !item.children) continue;
|
||||
|
||||
const idx = newList.findIndex((c) => c.acntgSeCd === item.code);
|
||||
if (idx < 0) continue;
|
||||
|
||||
const { bscPlanAmt, bgtRfltAmt, tstmDesignAmt } = sumChildAmounts(newList, item.children);
|
||||
const current = newList[idx];
|
||||
|
||||
if (
|
||||
(current.bscPlanAmt || 0) !== bscPlanAmt ||
|
||||
(current.bgtRfltAmt || 0) !== bgtRfltAmt ||
|
||||
(current.tstmDesignAmt || 0) !== tstmDesignAmt
|
||||
) {
|
||||
newList[idx] = { ...current, bscPlanAmt, bgtRfltAmt, tstmDesignAmt };
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges ? newList : list;
|
||||
}
|
||||
|
||||
export function calculateSewerPipeCost(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
newPipeCode: string,
|
||||
replaceCode: string,
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
const newPipe = bizCstList.find((item) => item.acntgSeCd === newPipeCode);
|
||||
const replace = bizCstList.find((item) => item.acntgSeCd === replaceCode);
|
||||
|
||||
const bscPlanAmt = (newPipe?.bscPlanAmt || 0) + (replace?.bscPlanAmt || 0);
|
||||
const bgtRfltAmt = (newPipe?.bgtRfltAmt || 0) + (replace?.bgtRfltAmt || 0);
|
||||
const tstmDesignAmt = (newPipe?.tstmDesignAmt || 0) + (replace?.tstmDesignAmt || 0);
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateConstructionCost(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
codes: string[],
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
codes.forEach((code) => {
|
||||
const item = bizCstList.find((i) => i.acntgSeCd === code);
|
||||
if (item) {
|
||||
bscPlanAmt += item.bscPlanAmt || 0;
|
||||
bgtRfltAmt += item.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += item.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateIncidentalExpenses(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
codes: string[],
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
codes.forEach((code) => {
|
||||
const item = bizCstList.find((i) => i.acntgSeCd === code);
|
||||
if (item) {
|
||||
bscPlanAmt += item.bscPlanAmt || 0;
|
||||
bgtRfltAmt += item.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += item.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateTotalCost(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
codes: string[],
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
codes.forEach((code) => {
|
||||
const item = bizCstList.find((i) => i.acntgSeCd === code);
|
||||
if (item) {
|
||||
bscPlanAmt += item.bscPlanAmt || 0;
|
||||
bgtRfltAmt += item.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += item.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateDiffPercent(diff: number, baseline: number): string {
|
||||
if (baseline === 0) return "-";
|
||||
return `${Math.round((diff / baseline) * 100)}%`;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { BizCstTreeDto } from "@/entities/instl-sncn";
|
||||
|
||||
const ACNTG_TREE_PATH_SEPARATOR = "|";
|
||||
|
||||
/** treePath를 회계구분 코드 배열로 파싱 */
|
||||
export function parseAcntgTreePath(treePath: string): string[] {
|
||||
return treePath.split(ACNTG_TREE_PATH_SEPARATOR).filter(Boolean);
|
||||
}
|
||||
|
||||
/** treePath에서 직계 부모 acntgSeCd 반환 (루트면 null) */
|
||||
export function getParentAcntgSeCd(node: Pick<BizCstTreeDto, "treePath">): string | null {
|
||||
const segments = parseAcntgTreePath(node.treePath);
|
||||
if (segments.length <= 1) return null;
|
||||
return segments[segments.length - 2];
|
||||
}
|
||||
|
||||
/** treePath 기준으로 bizCstList 정렬 (원본 불변) */
|
||||
export function sortBizCstListByTreePath(list: BizCstTreeDto[]): BizCstTreeDto[] {
|
||||
return [...list].sort((a, b) => {
|
||||
const byPath = a.treePath.localeCompare(b.treePath);
|
||||
if (byPath !== 0) return byPath;
|
||||
return a.acntgSeCd.localeCompare(b.acntgSeCd);
|
||||
});
|
||||
}
|
||||
|
||||
/** 자식 노드가 없는 leaf 여부 (treePath | 구분자 기준) */
|
||||
export function isBizCstLeafNode(
|
||||
node: Pick<BizCstTreeDto, "acntgSeCd" | "treePath">,
|
||||
allNodes: Pick<BizCstTreeDto, "acntgSeCd" | "treePath">[],
|
||||
): boolean {
|
||||
const childPrefix = `${node.treePath}${ACNTG_TREE_PATH_SEPARATOR}`;
|
||||
return !allNodes.some(
|
||||
(other) => other.acntgSeCd !== node.acntgSeCd && other.treePath.startsWith(childPrefix),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
export const INSTL_SNCN_VIEW_BUTTON_ACTION = {
|
||||
strg: "strg",
|
||||
aply: "aply",
|
||||
del: "del",
|
||||
splmntCmptn: "splmntCmptn",
|
||||
instlSncnAncmnt: "instlSncnAncmnt",
|
||||
envoSbmsn: "envoSbmsn",
|
||||
rjct: "rjct",
|
||||
sncnAprv: "sncnAprv",
|
||||
rvwRply: "rvwRply",
|
||||
rqstTechRvw: "rqstTechRvw",
|
||||
dsgntRvwr: "dsgntRvwr",
|
||||
rvwStrg: "rvwStrg",
|
||||
rvwCmptn: "rvwCmptn",
|
||||
dmndSplmnt: "dmndSplmnt",
|
||||
atrzAprv: "atrzAprv",
|
||||
atrzRply: "atrzRply",
|
||||
grndsChck: "grndsChck",
|
||||
} as const;
|
||||
|
||||
export type InstlSncnViewButtonAction =
|
||||
(typeof INSTL_SNCN_VIEW_BUTTON_ACTION)[keyof typeof INSTL_SNCN_VIEW_BUTTON_ACTION];
|
||||
|
||||
const ROLE_STATUS_BUTTON_ACTIONS: Record<string, Record<string, InstlSncnViewButtonAction[]>> = {
|
||||
ROLE_USER05: {
|
||||
"": [
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.strg,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.aply,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.del,
|
||||
],
|
||||
SV: [
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.strg,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.aply,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.del,
|
||||
],
|
||||
SL: [INSTL_SNCN_VIEW_BUTTON_ACTION.splmntCmptn],
|
||||
TA: [INSTL_SNCN_VIEW_BUTTON_ACTION.instlSncnAncmnt],
|
||||
},
|
||||
ROLE_USER04: {
|
||||
ST: [INSTL_SNCN_VIEW_BUTTON_ACTION.envoSbmsn, INSTL_SNCN_VIEW_BUTTON_ACTION.rjct],
|
||||
EP: [INSTL_SNCN_VIEW_BUTTON_ACTION.sncnAprv],
|
||||
},
|
||||
ROLE_USER03: {
|
||||
LE: [INSTL_SNCN_VIEW_BUTTON_ACTION.rvwRply, INSTL_SNCN_VIEW_BUTTON_ACTION.rqstTechRvw],
|
||||
TP: [INSTL_SNCN_VIEW_BUTTON_ACTION.rvwRply],
|
||||
},
|
||||
ROLE_USER01: {
|
||||
TE: [INSTL_SNCN_VIEW_BUTTON_ACTION.grndsChck],
|
||||
SL: [INSTL_SNCN_VIEW_BUTTON_ACTION.splmntCmptn],
|
||||
},
|
||||
};
|
||||
|
||||
const ROLE_USER01_ATRZ_STATUS_CODES = ["ER", "TE"] as const;
|
||||
|
||||
const ROLE_USER01_ATRZ_STATUS_ACTIONS: Record<
|
||||
string,
|
||||
Record<string, InstlSncnViewButtonAction[]>
|
||||
> = {
|
||||
ER: {
|
||||
ATRZ01: [INSTL_SNCN_VIEW_BUTTON_ACTION.dsgntRvwr],
|
||||
},
|
||||
TE: {
|
||||
ATRZ02: [
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.rvwStrg,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.rvwCmptn,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
],
|
||||
ATRZ03: [INSTL_SNCN_VIEW_BUTTON_ACTION.atrzAprv],
|
||||
ATRZ99: [INSTL_SNCN_VIEW_BUTTON_ACTION.atrzRply],
|
||||
},
|
||||
};
|
||||
|
||||
function resolveButtonConfigs(actions: InstlSncnViewButtonAction[]): InstlSncnViewButtonAction[] {
|
||||
return actions.map((action) => INSTL_SNCN_VIEW_BUTTON_ACTION[action]);
|
||||
}
|
||||
|
||||
function resolveRoleUser01AtrzButtonActions(
|
||||
prgrsSttsComCd: string,
|
||||
atrzSeComCdList: string[],
|
||||
): InstlSncnViewButtonAction[] {
|
||||
const atrzStatusMap = ROLE_USER01_ATRZ_STATUS_ACTIONS[prgrsSttsComCd];
|
||||
if (!atrzStatusMap || atrzSeComCdList.length === 0) return [];
|
||||
|
||||
const seen = new Set<InstlSncnViewButtonAction>();
|
||||
const actions: InstlSncnViewButtonAction[] = [];
|
||||
|
||||
for (const atrzSeComCd of atrzSeComCdList) {
|
||||
const mappedActions = atrzStatusMap[atrzSeComCd];
|
||||
if (!mappedActions) continue;
|
||||
|
||||
for (const action of mappedActions) {
|
||||
if (seen.has(action)) continue;
|
||||
seen.add(action);
|
||||
actions.push(action);
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
export function needsRoleUser01AtrzResolve(
|
||||
dtlInstCd: string | undefined,
|
||||
prgrsSttsComCd: string,
|
||||
): boolean {
|
||||
return (
|
||||
dtlInstCd === "ROLE_USER01" &&
|
||||
ROLE_USER01_ATRZ_STATUS_CODES.includes(
|
||||
prgrsSttsComCd as (typeof ROLE_USER01_ATRZ_STATUS_CODES)[number],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function getButtonConfigs(
|
||||
dtlInstCd: string | undefined,
|
||||
prgrsSttsComCd: string,
|
||||
atrzSeComCdList?: string[],
|
||||
): InstlSncnViewButtonAction[] {
|
||||
if (!dtlInstCd) return [];
|
||||
|
||||
if (needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd)) {
|
||||
return resolveButtonConfigs(
|
||||
resolveRoleUser01AtrzButtonActions(prgrsSttsComCd, atrzSeComCdList ?? []),
|
||||
);
|
||||
}
|
||||
|
||||
const statusMap = ROLE_STATUS_BUTTON_ACTIONS[dtlInstCd];
|
||||
if (!statusMap) return [];
|
||||
|
||||
const actions = statusMap[prgrsSttsComCd];
|
||||
if (!actions) return [];
|
||||
|
||||
return resolveButtonConfigs(actions);
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import type { CklstTreeNode } from "@/entities/cklst";
|
||||
|
||||
interface CklstResultListItem {
|
||||
cklstSn: number;
|
||||
cklstArtclSn: number;
|
||||
cklstRvwSn: number;
|
||||
rvwStpComCd: string;
|
||||
selected: "Y" | "N" | null;
|
||||
picRvwCn?: string | null;
|
||||
}
|
||||
|
||||
function compareCklstSiblings(a: CklstTreeNode, b: CklstTreeNode): number {
|
||||
if (a.cklstArtclSn !== b.cklstArtclSn) {
|
||||
return a.cklstArtclSn - b.cklstArtclSn;
|
||||
}
|
||||
if (a.sortSeq !== b.sortSeq) {
|
||||
return b.sortSeq - a.sortSeq;
|
||||
}
|
||||
return a.cklstRvwSn - b.cklstRvwSn;
|
||||
}
|
||||
|
||||
export function orderCklstTreeNodes(rows: CklstTreeNode[]): CklstTreeNode[] {
|
||||
const childMap = new Map<number | null, CklstTreeNode[]>();
|
||||
|
||||
rows.forEach((row) => {
|
||||
const parent = row.upCklstRvwSn ?? null;
|
||||
if (!childMap.has(parent)) childMap.set(parent, []);
|
||||
childMap.get(parent)!.push(row);
|
||||
});
|
||||
|
||||
childMap.forEach((siblings) => siblings.sort(compareCklstSiblings));
|
||||
|
||||
const ordered: CklstTreeNode[] = [];
|
||||
|
||||
function walk(parent: number | null) {
|
||||
(childMap.get(parent) ?? []).forEach((child) => {
|
||||
ordered.push(child);
|
||||
walk(child.cklstRvwSn);
|
||||
});
|
||||
}
|
||||
|
||||
walk(null);
|
||||
|
||||
return ordered;
|
||||
}
|
||||
|
||||
function groupCklstTreeByTaskSeComCd(cklstTree: CklstTreeNode[]): Map<string, CklstTreeNode[]> {
|
||||
const grouped = new Map<string, CklstTreeNode[]>();
|
||||
|
||||
cklstTree.forEach((node) => {
|
||||
const taskCode = node.taskSeComCd ?? "";
|
||||
if (!taskCode) return;
|
||||
if (!grouped.has(taskCode)) grouped.set(taskCode, []);
|
||||
grouped.get(taskCode)!.push(node);
|
||||
});
|
||||
|
||||
return grouped;
|
||||
}
|
||||
|
||||
function getOrderedSelectableNodes(
|
||||
cklstTree: CklstTreeNode[],
|
||||
taskSeComCdArray: string[],
|
||||
): CklstTreeNode[] {
|
||||
const grouped = groupCklstTreeByTaskSeComCd(cklstTree);
|
||||
|
||||
return taskSeComCdArray.flatMap((code) =>
|
||||
orderCklstTreeNodes(grouped.get(code) ?? []).filter((node) => node.bchckUseYn === "Y"),
|
||||
);
|
||||
}
|
||||
|
||||
export function isSameCklstResultList(
|
||||
prev: CklstResultListItem[],
|
||||
next: CklstResultListItem[],
|
||||
): boolean {
|
||||
if (prev.length !== next.length) return false;
|
||||
|
||||
return prev.every((item, index) => {
|
||||
const candidate = next[index];
|
||||
return (
|
||||
item.cklstRvwSn === candidate.cklstRvwSn &&
|
||||
item.cklstSn === candidate.cklstSn &&
|
||||
item.cklstArtclSn === candidate.cklstArtclSn &&
|
||||
item.rvwStpComCd === candidate.rvwStpComCd &&
|
||||
item.selected === candidate.selected &&
|
||||
(item.picRvwCn ?? null) === (candidate.picRvwCn ?? null)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function syncCklstResultListFromTree(
|
||||
cklstTree: CklstTreeNode[],
|
||||
taskSeComCdArray: string[],
|
||||
prev: CklstResultListItem[],
|
||||
): CklstResultListItem[] {
|
||||
if (!taskSeComCdArray.length) {
|
||||
return prev.length === 0 ? prev : [];
|
||||
}
|
||||
|
||||
const prevByRvwSn = new Map(prev.map((item) => [item.cklstRvwSn, item]));
|
||||
const orderedSelectable = getOrderedSelectableNodes(cklstTree, taskSeComCdArray);
|
||||
|
||||
const next = orderedSelectable.map((node) => {
|
||||
const existing = prevByRvwSn.get(node.cklstRvwSn);
|
||||
return (
|
||||
existing ?? {
|
||||
cklstSn: node.cklstSn,
|
||||
cklstArtclSn: node.cklstArtclSn,
|
||||
cklstRvwSn: node.cklstRvwSn,
|
||||
rvwStpComCd: "LOCAL",
|
||||
selected: null,
|
||||
picRvwCn: null,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
if (isSameCklstResultList(prev, next)) return prev;
|
||||
return next;
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
import type {
|
||||
CklstRvwRsltTreeDto,
|
||||
InstlSncnCklstResultSaveDto,
|
||||
ReviewStepCode,
|
||||
} from "@/entities/instl-sncn";
|
||||
|
||||
import {
|
||||
type ChecklistFormState,
|
||||
type ChecklistProgress,
|
||||
type ChecklistRowKey,
|
||||
type ChecklistStepMap,
|
||||
REVIEW_STEP_CODES,
|
||||
} from "../model/view-types";
|
||||
|
||||
export function buildChecklistRowKey(
|
||||
row: CklstRvwRsltTreeDto,
|
||||
reviewStep?: ReviewStepCode,
|
||||
): ChecklistRowKey {
|
||||
const step = reviewStep ?? (row.rvwStpComCd as ReviewStepCode) ?? "LOCAL";
|
||||
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[] {
|
||||
return Array.from(new Set(rows.map((row) => row.taskSeComCd).filter(Boolean)));
|
||||
}
|
||||
|
||||
export function filterChecklistRows(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
taskCode: string | null,
|
||||
): CklstRvwRsltTreeDto[] {
|
||||
return rows.filter((row) => (taskCode ? row.taskSeComCd === taskCode : true)).slice();
|
||||
}
|
||||
|
||||
export function getChecklistDisplayRows(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
taskCode?: string | null,
|
||||
): CklstRvwRsltTreeDto[] {
|
||||
const filtered = filterChecklistRows(rows, taskCode ?? null);
|
||||
const seen = new Set<string>();
|
||||
const deduped: CklstRvwRsltTreeDto[] = [];
|
||||
|
||||
for (const row of filtered) {
|
||||
const dedupeKey = `${row.taskSeComCd}_${row.cklstRvwSn}`;
|
||||
if (seen.has(dedupeKey)) continue;
|
||||
seen.add(dedupeKey);
|
||||
deduped.push(row);
|
||||
}
|
||||
|
||||
return deduped;
|
||||
}
|
||||
|
||||
export function computeChecklistProgress(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
results: ChecklistFormState["results"],
|
||||
): ChecklistProgress {
|
||||
const activeRows = rows.filter((row) => row.bchckUseYn === "Y");
|
||||
const total = activeRows.length;
|
||||
const completed = activeRows.reduce((acc, row) => {
|
||||
const key = buildChecklistRowKey(row);
|
||||
const val = results[key] ?? row.rvwRsltAnmlyYn ?? "";
|
||||
return acc + (val ? 1 : 0);
|
||||
}, 0);
|
||||
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
return { total, completed, percent };
|
||||
}
|
||||
|
||||
export function filterChecklistRowsByReviewStep(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
reviewStep: ReviewStepCode,
|
||||
): CklstRvwRsltTreeDto[] {
|
||||
return rows.filter((row) => row.rvwStpComCd === reviewStep);
|
||||
}
|
||||
|
||||
export function computeReviewStepChecklistProgress(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
results: ChecklistFormState["results"],
|
||||
reviewStep: ReviewStepCode,
|
||||
): ChecklistProgress {
|
||||
const activeRows = getChecklistDisplayRows(rows).filter((row) => row.bchckUseYn === "Y");
|
||||
const total = activeRows.length;
|
||||
const completed = activeRows.reduce((acc, row) => {
|
||||
const key = buildChecklistRowKey(row, reviewStep);
|
||||
const val = results[key];
|
||||
return acc + (val === "Y" || val === "N" ? 1 : 0);
|
||||
}, 0);
|
||||
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
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(
|
||||
prev: ChecklistFormState,
|
||||
allRows: CklstRvwRsltTreeDto[],
|
||||
): ChecklistFormState {
|
||||
const results = { ...prev.results };
|
||||
const comments = { ...prev.comments };
|
||||
|
||||
for (const row of allRows) {
|
||||
const step = row.rvwStpComCd as ReviewStepCode | undefined;
|
||||
if (!step || !REVIEW_STEP_CODES.includes(step)) continue;
|
||||
|
||||
const key = buildChecklistRowKey(row);
|
||||
if ((row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N") && results[key] === undefined) {
|
||||
results[key] = row.rvwRsltAnmlyYn;
|
||||
}
|
||||
if (row.picRvwCn && !comments[key]) {
|
||||
comments[key] = row.picRvwCn;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
results,
|
||||
comments,
|
||||
progress: computeChecklistProgress(getChecklistDisplayRows(allRows), results),
|
||||
};
|
||||
}
|
||||
|
||||
export function patchChecklistFormState(
|
||||
prev: ChecklistFormState,
|
||||
patch: Partial<Pick<ChecklistFormState, "results" | "comments">>,
|
||||
allRows: CklstRvwRsltTreeDto[],
|
||||
reviewStep?: ReviewStepCode,
|
||||
): ChecklistFormState {
|
||||
const results = patch.results ?? prev.results;
|
||||
const comments = patch.comments ?? prev.comments;
|
||||
const progress = reviewStep
|
||||
? computeReviewStepChecklistProgress(allRows, results, reviewStep)
|
||||
: computeChecklistProgress(getChecklistDisplayRows(allRows), results);
|
||||
|
||||
return {
|
||||
results,
|
||||
comments,
|
||||
progress,
|
||||
};
|
||||
}
|
||||
|
||||
export function toCklstSaveDto(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
formState: ChecklistFormState,
|
||||
reviewStep: ReviewStepCode,
|
||||
): InstlSncnCklstResultSaveDto[] {
|
||||
return getChecklistDisplayRows(rows)
|
||||
.filter((row) => row.bchckUseYn === "Y")
|
||||
.map((row) => {
|
||||
const key = buildChecklistRowKey(row, reviewStep);
|
||||
const selected = formState.results[key] ?? null;
|
||||
return {
|
||||
cklstSn: row.cklstSn,
|
||||
cklstArtclSn: row.cklstArtclSn,
|
||||
cklstRvwSn: row.cklstRvwSn,
|
||||
rvwStpComCd: reviewStep,
|
||||
selected,
|
||||
picRvwCn: formState.comments[key] ?? null,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const cnfmRegistSchema = z.object({
|
||||
instlSncnMng: z.object({
|
||||
bizNm: z.string().min(1, "사업명은 필수입니다"),
|
||||
bizBgngYr: z.string().min(1, "사업시작연도는 필수입니다"),
|
||||
bizEndYr: z.string().min(1, "사업종료연도는 필수입니다"),
|
||||
bizCn: z.string().min(1, "사업내용은 필수입니다"),
|
||||
taskSeComCd: z.array(z.string()).min(1, "구분은 필수입니다"),
|
||||
sncnSeComCd: z.string().min(1, "사업구분은 필수입니다"),
|
||||
dsgnrNm: z.string().min(1, "설계자 이름은 필수입니다"),
|
||||
dsgnrTelno: z.string().min(1, "설계자 전화번호는 필수입니다"),
|
||||
dsgnrOgdpNm: z.string().min(1, "설계자 소속은 필수입니다"),
|
||||
dsgnrEmlAddr: z
|
||||
.string()
|
||||
.min(1, "설계자 이메일은 필수입니다")
|
||||
.email("올바른 이메일 형식이 아닙니다"),
|
||||
bgtBizCd: z.string().optional(),
|
||||
bgtAplyYr: z.string().optional(),
|
||||
aplcntNm: z.string().optional(),
|
||||
aplcntMblTelno: z.string().optional(),
|
||||
aplcntOgdpNm: z.string().optional(),
|
||||
aplcntEmlAddr: z.string().optional(),
|
||||
instlSncnDocNo: z.string().optional(),
|
||||
admdstCd: z.string().optional(),
|
||||
envoSeComCd: z.string().optional(),
|
||||
prgrsSttsComCd: z.string().optional(),
|
||||
atchFileGroupId: z.string().optional(),
|
||||
rtlztnFcltSeComCd: z.string().optional(),
|
||||
rtlztnUsgSeComCd: z.string().optional(),
|
||||
envoSeCdNm: z.string().optional(),
|
||||
sncnSeCdNm: z.string().optional(),
|
||||
taskSeCdNm: z.string().optional(),
|
||||
prgrsSttsCdNm: z.string().optional(),
|
||||
sido: z.string().optional(),
|
||||
gugun: z.string().optional(),
|
||||
regDt: z.string().optional(),
|
||||
rgtr: z.string().optional(),
|
||||
rgtrNm: z.string().optional(),
|
||||
mdfcnDt: z.string().optional(),
|
||||
}),
|
||||
bzScaleList: z.array(
|
||||
z.object({
|
||||
cnstpSeCd: z.string(),
|
||||
bscPl: z.number(),
|
||||
budgetReflct: z.number(),
|
||||
thtiDsgn: z.number(),
|
||||
diff: z.number(),
|
||||
}),
|
||||
),
|
||||
bizCstList: z.array(
|
||||
z.object({
|
||||
acntgSeCd: z.string(),
|
||||
bscPlanAmt: z.number(),
|
||||
bgtRfltAmt: z.number(),
|
||||
tstmDesignAmt: z.number(),
|
||||
}),
|
||||
),
|
||||
cklstResultList: z.array(
|
||||
z.object({
|
||||
cklstSn: z.number(),
|
||||
cklstArtclSn: z.number(),
|
||||
cklstRvwSn: z.number(),
|
||||
rvwStpComCd: z.string(),
|
||||
selected: z.enum(["Y", "N"]).nullable(),
|
||||
picRvwCn: z.string().nullable().optional(),
|
||||
}),
|
||||
),
|
||||
esntlAtchFileList: z.array(
|
||||
z.object({
|
||||
esntlAtchFileId: z.string(),
|
||||
atchFileGroupId: z.string(),
|
||||
}),
|
||||
),
|
||||
privacyConsent: z.enum(["Y", "N"], {
|
||||
required_error: "개인정보 수집/이용 동의는 필수입니다",
|
||||
}),
|
||||
});
|
||||
|
||||
export type CnfmRegistFormData = z.infer<typeof cnfmRegistSchema>;
|
||||
|
||||
export function formatTaskSeComCdForApi(taskSeComCd: string[]): string {
|
||||
return taskSeComCd.join(",");
|
||||
}
|
||||
|
||||
export function parseTaskSeComCdFromApi(taskSeComCd?: string): string[] {
|
||||
if (!taskSeComCd) return [];
|
||||
return taskSeComCd.split(",").filter(Boolean);
|
||||
}
|
||||
|
||||
export const cnfmRegistSaveSchema = cnfmRegistSchema.pick({
|
||||
instlSncnMng: true,
|
||||
bzScaleList: true,
|
||||
bizCstList: true,
|
||||
});
|
||||
|
||||
export const cnfmRegistSubmitSchema = cnfmRegistSchema.refine(
|
||||
(data) => data.privacyConsent === "Y",
|
||||
{
|
||||
message: "개인정보 수집/이용에 동의해야 제출할 수 있습니다",
|
||||
path: ["privacyConsent"],
|
||||
},
|
||||
);
|
||||
@@ -0,0 +1,121 @@
|
||||
import type { IUserInfo } from "@/shared/store/user-store";
|
||||
import type { InstlSncnMngDetResponse } from "@/entities/instl-sncn";
|
||||
|
||||
import type { CnfmRegistFormData } from "./cnfm-regist-schema";
|
||||
import { parseTaskSeComCdFromApi } from "./cnfm-regist-schema";
|
||||
|
||||
function mapSelectedValue(value?: string | null): "Y" | "N" | null {
|
||||
if (value === "Y" || value === "N") return value;
|
||||
return null;
|
||||
}
|
||||
|
||||
function mapEsntlAtchFileList(esntlFileList: InstlSncnMngDetResponse["esntlFileList"]) {
|
||||
const esntlMap = new Map<string, string>();
|
||||
|
||||
for (const item of esntlFileList) {
|
||||
if (!item.esntlAtchFileId || !item.atflCd) continue;
|
||||
esntlMap.set(item.esntlAtchFileId, item.atflCd);
|
||||
}
|
||||
|
||||
return Array.from(esntlMap.entries()).map(([esntlAtchFileId, atchFileGroupId]) => ({
|
||||
esntlAtchFileId,
|
||||
atchFileGroupId,
|
||||
}));
|
||||
}
|
||||
|
||||
export function mapDetailToFormData(data: InstlSncnMngDetResponse): CnfmRegistFormData {
|
||||
const { detDto, bizSclList, bizCstList, cklstResultList, esntlFileList } = data;
|
||||
|
||||
return {
|
||||
instlSncnMng: {
|
||||
instlSncnDocNo: detDto.instlSncnDocNo,
|
||||
bizNm: detDto.bizNm,
|
||||
bizBgngYr: detDto.bizBgngYr,
|
||||
bizEndYr: detDto.bizEndYr,
|
||||
bizCn: detDto.bizCn,
|
||||
taskSeComCd: parseTaskSeComCdFromApi(detDto.taskSeComCd),
|
||||
sncnSeComCd: detDto.sncnSeComCd,
|
||||
dsgnrNm: detDto.dsgnrNm,
|
||||
dsgnrTelno: detDto.dsgnrTelno,
|
||||
dsgnrOgdpNm: detDto.dsgnrOgdpNm,
|
||||
dsgnrEmlAddr: detDto.dsgnrEmlAddr,
|
||||
aplcntNm: detDto.aplcntNm ?? "",
|
||||
aplcntMblTelno: detDto.aplcntMblTelno ?? "",
|
||||
aplcntOgdpNm: detDto.aplcntOgdpNm ?? "",
|
||||
aplcntEmlAddr: detDto.aplcntEmlAddr ?? "",
|
||||
bgtBizCd: detDto.bgtBizCd,
|
||||
bgtAplyYr: detDto.bgtAplyYr,
|
||||
admdstCd: detDto.admdstCd,
|
||||
envoSeComCd: detDto.envoSeComCd,
|
||||
prgrsSttsComCd: detDto.prgrsSttsComCd,
|
||||
atchFileGroupId: detDto.atchFileGroupId ?? "",
|
||||
rtlztnFcltSeComCd: detDto.rtlztnFcltSeComCd ?? "",
|
||||
rtlztnUsgSeComCd: detDto.rtlztnUsgSeComCd ?? "",
|
||||
envoSeCdNm: detDto.envoSeCdNm,
|
||||
sncnSeCdNm: detDto.sncnSeCdNm,
|
||||
taskSeCdNm: detDto.taskSeCdNm,
|
||||
prgrsSttsCdNm: detDto.prgrsSttsCdNm,
|
||||
sido: detDto.sido,
|
||||
gugun: detDto.gugun,
|
||||
regDt: detDto.regDt,
|
||||
rgtr: detDto.rgtr,
|
||||
rgtrNm: detDto.rgtrNm,
|
||||
mdfcnDt: detDto.mdfcnDt,
|
||||
},
|
||||
bzScaleList: bizSclList.map((item) => ({
|
||||
cnstpSeCd: item.cnstpSeCd,
|
||||
bscPl: item.bscPlanQty,
|
||||
budgetReflct: item.bgtRfltQty,
|
||||
thtiDsgn: item.tstmDesignQty,
|
||||
diff: item.tstmDesignQty - item.bgtRfltQty,
|
||||
})),
|
||||
bizCstList: bizCstList.map((item) => ({
|
||||
acntgSeCd: item.acntgSeCd,
|
||||
bscPlanAmt: item.bscPlanAmt,
|
||||
bgtRfltAmt: item.bgtRfltAmt,
|
||||
tstmDesignAmt: item.tstmDesignAmt,
|
||||
})),
|
||||
cklstResultList:
|
||||
cklstResultList?.map((item) => ({
|
||||
cklstSn: item.cklstSn,
|
||||
cklstArtclSn: item.cklstArtclSn,
|
||||
cklstRvwSn: item.cklstRvwSn,
|
||||
rvwStpComCd: item.rvwStpComCd,
|
||||
selected: mapSelectedValue(item.rvwRsltAnmlyYn),
|
||||
picRvwCn: item.picRvwCn,
|
||||
})) ?? [],
|
||||
esntlAtchFileList: mapEsntlAtchFileList(esntlFileList),
|
||||
privacyConsent: "Y",
|
||||
};
|
||||
}
|
||||
|
||||
export function getCreateDefaultValues(
|
||||
userInfo: IUserInfo | null,
|
||||
taskSeComCd?: string[],
|
||||
): CnfmRegistFormData {
|
||||
return {
|
||||
instlSncnMng: {
|
||||
bizNm: "",
|
||||
bizBgngYr: "",
|
||||
bizEndYr: "",
|
||||
bizCn: "",
|
||||
taskSeComCd: taskSeComCd ?? [],
|
||||
sncnSeComCd: "",
|
||||
dsgnrNm: "",
|
||||
dsgnrTelno: "",
|
||||
dsgnrOgdpNm: "",
|
||||
dsgnrEmlAddr: "",
|
||||
aplcntNm: userInfo?.userName ?? "",
|
||||
aplcntMblTelno: userInfo?.mphn ?? "",
|
||||
aplcntOgdpNm: userInfo?.ogdpSeNm ?? "",
|
||||
aplcntEmlAddr: userInfo?.email ?? "",
|
||||
prgrsSttsComCd: "SV",
|
||||
atchFileGroupId: "",
|
||||
},
|
||||
bzScaleList: [],
|
||||
bizCstList: [],
|
||||
cklstResultList: [],
|
||||
esntlAtchFileList: [],
|
||||
privacyConsent: "N",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export function fmtNumber(value: number | null | undefined): string {
|
||||
if (typeof value === "number") return value.toLocaleString();
|
||||
if (value === null || value === undefined) return "";
|
||||
return String(value);
|
||||
}
|
||||
|
||||
export function indentPx(indNm: string | undefined): number {
|
||||
if (!indNm) return 0;
|
||||
const spaces = indNm.length - indNm.trimStart().length;
|
||||
return (spaces / 4) * 16;
|
||||
}
|
||||
|
||||
export function calcDiffPercent(diff: number, baseline: number): string {
|
||||
if (baseline === 0) return "-";
|
||||
return `${Math.round((diff / baseline) * 100)}%`;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import type {
|
||||
InstlSncnMngDetResponse,
|
||||
InstlSncnRvwOpnnSaveRequestDto,
|
||||
} from "@/entities/instl-sncn";
|
||||
|
||||
export interface ReviewOpinionFormData {
|
||||
rvwRsltCn: string;
|
||||
rvwRsltAnmlyYn: "Y" | "N" | "";
|
||||
atchFileGroupId: string;
|
||||
opnrSeComCd: string;
|
||||
}
|
||||
|
||||
export function toRvwOpnnSaveDto(
|
||||
data: InstlSncnMngDetResponse,
|
||||
reviewOpinionFormData: ReviewOpinionFormData | null | undefined,
|
||||
opnrNm?: string,
|
||||
): InstlSncnRvwOpnnSaveRequestDto[] | undefined {
|
||||
if (!reviewOpinionFormData) return undefined;
|
||||
|
||||
const hasContent =
|
||||
reviewOpinionFormData.rvwRsltCn.trim() ||
|
||||
reviewOpinionFormData.rvwRsltAnmlyYn ||
|
||||
reviewOpinionFormData.atchFileGroupId;
|
||||
|
||||
if (!hasContent) return undefined;
|
||||
|
||||
return [
|
||||
{
|
||||
instlSncnDocNo: data.detDto.instlSncnDocNo,
|
||||
opnrSeComCd: reviewOpinionFormData.opnrSeComCd,
|
||||
opnrNm: opnrNm ?? "",
|
||||
rvwRsltCn: reviewOpinionFormData.rvwRsltCn,
|
||||
rvwRsltAnmlyYn: reviewOpinionFormData.rvwRsltAnmlyYn || undefined,
|
||||
atchFileGroupId: reviewOpinionFormData.atchFileGroupId || undefined,
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { ReviewStepCode } from "@/entities/instl-sncn";
|
||||
|
||||
import {
|
||||
INSTL_PROGRESS_ORDER,
|
||||
REVIEW_STEP_CODES,
|
||||
REVIEW_STEP_ROLE_RANK,
|
||||
ROLE_TO_REVIEW_STEP,
|
||||
} from "../model/view-types";
|
||||
|
||||
export function getProgressStepCount(prgrsSttsComCd?: string): number {
|
||||
const idx = INSTL_PROGRESS_ORDER.indexOf(prgrsSttsComCd as (typeof INSTL_PROGRESS_ORDER)[number]);
|
||||
if (idx <= INSTL_PROGRESS_ORDER.indexOf("SV")) return 1;
|
||||
if (idx <= INSTL_PROGRESS_ORDER.indexOf("LE")) return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
export function getRoleStepCount(dtlInstCd?: string): number {
|
||||
const mapped = dtlInstCd ? ROLE_TO_REVIEW_STEP[dtlInstCd] : undefined;
|
||||
return mapped ? REVIEW_STEP_ROLE_RANK[mapped] : 0;
|
||||
}
|
||||
|
||||
export function getVisibleReviewSteps(
|
||||
prgrsSttsComCd: string,
|
||||
userRoleCode?: string,
|
||||
): ReviewStepCode[] {
|
||||
const count = Math.min(getProgressStepCount(prgrsSttsComCd), getRoleStepCount(userRoleCode));
|
||||
return REVIEW_STEP_CODES.slice(0, count);
|
||||
}
|
||||
|
||||
export function getEditableReviewStep(
|
||||
dtlInstCd?: string,
|
||||
prgrsSttsComCd?: string,
|
||||
): ReviewStepCode | undefined {
|
||||
if (dtlInstCd === "ROLE_USER03" && (prgrsSttsComCd === "LE" || prgrsSttsComCd === "TP")) {
|
||||
return "ENV";
|
||||
}
|
||||
|
||||
if (dtlInstCd === "ROLE_USER01" && prgrsSttsComCd === "TE") {
|
||||
return "KECO";
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
import type {
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
InstlSncnApplySaveRequestDto,
|
||||
InstlSncnBizCstSaveRequestDto,
|
||||
InstlSncnBzScaleSaveDto,
|
||||
InstlSncnCklstResultSaveDto,
|
||||
InstlSncnEsntlAtchFileSaveDto,
|
||||
InstlSncnMngDetResponse,
|
||||
InstlSncnMngResponseDto,
|
||||
ReviewStepCode,
|
||||
} from "@/entities/instl-sncn";
|
||||
|
||||
import type { ChecklistFormState } from "../model/view-types";
|
||||
|
||||
import { toCklstSaveDto } from "./checklist-utils";
|
||||
import { type ReviewOpinionFormData, toRvwOpnnSaveDto } from "./review-opinion-utils";
|
||||
|
||||
export function toBzScaleSaveDto(bizSclList: BizSclTreeDto[]): InstlSncnBzScaleSaveDto[] {
|
||||
return bizSclList
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => ({
|
||||
cnstpSeCd: node.cnstpSeCd,
|
||||
bscPl: node.bscPlanQty,
|
||||
budgetReflct: node.bgtRfltQty,
|
||||
thtiDsgn: node.tstmDesignQty,
|
||||
diff: node.tstmDesignQty - node.bgtRfltQty,
|
||||
}));
|
||||
}
|
||||
|
||||
export function toBizCstSaveDto(bizCstList: BizCstTreeDto[]): InstlSncnBizCstSaveRequestDto[] {
|
||||
return bizCstList
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => ({
|
||||
acntgSeCd: node.acntgSeCd,
|
||||
bscPlanAmt: node.bscPlanAmt,
|
||||
bgtRfltAmt: node.bgtRfltAmt,
|
||||
tstmDesignAmt: node.tstmDesignAmt,
|
||||
}));
|
||||
}
|
||||
|
||||
export function toEsntlAtchFileSaveDto(
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[],
|
||||
): InstlSncnEsntlAtchFileSaveDto[] {
|
||||
const esntlMap = new Map<string, string>();
|
||||
|
||||
for (const item of esntlFileList) {
|
||||
if (!item.esntlAtchFileId || !item.atflCd) continue;
|
||||
esntlMap.set(item.esntlAtchFileId, item.atflCd);
|
||||
}
|
||||
|
||||
return Array.from(esntlMap.entries()).map(([esntlAtchFileId, atchFileGroupId]) => ({
|
||||
esntlAtchFileId,
|
||||
atchFileGroupId,
|
||||
}));
|
||||
}
|
||||
|
||||
export function buildSavePayload(
|
||||
data: InstlSncnMngDetResponse,
|
||||
checklistFormState: ChecklistFormState,
|
||||
reviewStep: ReviewStepCode,
|
||||
prgrsSttsComCd: string,
|
||||
): InstlSncnApplySaveRequestDto {
|
||||
const { detDto, bizSclList, bizCstList, cklstResultList = [], esntlFileList } = data;
|
||||
|
||||
return {
|
||||
instlSncnMng: { ...detDto, prgrsSttsComCd },
|
||||
bzScaleList: toBzScaleSaveDto(bizSclList),
|
||||
bizCstList: toBizCstSaveDto(bizCstList),
|
||||
cklstResultList: toCklstSaveDto(cklstResultList, checklistFormState, reviewStep),
|
||||
esntlAtchFileList: toEsntlAtchFileSaveDto(esntlFileList),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildTechReviewReplyPayload(
|
||||
data: InstlSncnMngDetResponse,
|
||||
checklistFormState: ChecklistFormState,
|
||||
reviewStep: ReviewStepCode,
|
||||
prgrsSttsComCd: string,
|
||||
techReViewSaveCd: string,
|
||||
reviewOpinionFormData?: ReviewOpinionFormData | null,
|
||||
opnrNm?: string,
|
||||
): InstlSncnApplySaveRequestDto {
|
||||
return {
|
||||
...buildSavePayload(data, checklistFormState, reviewStep, prgrsSttsComCd),
|
||||
techReViewSaveCd,
|
||||
rvwStpCd: reviewStep,
|
||||
rvwOpnnList: toRvwOpnnSaveDto(data, reviewOpinionFormData, opnrNm),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildTechReviewPayload(
|
||||
det: InstlSncnMngResponseDto,
|
||||
cklstResultList: InstlSncnCklstResultSaveDto[],
|
||||
): InstlSncnApplySaveRequestDto {
|
||||
return {
|
||||
instlSncnMng: { ...det, prgrsSttsComCd: "ER" },
|
||||
bzScaleList: [],
|
||||
bizCstList: [],
|
||||
cklstResultList,
|
||||
esntlAtchFileList: [],
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
import type { BnsListResponseDto, BnsListResponseWrapperDto } from "@/entities/bns-if";
|
||||
|
||||
const EMPTY_SORT = { empty: true, sorted: false, unsorted: true };
|
||||
|
||||
export const BNS_LIST_PAGE_SIZE = 10;
|
||||
|
||||
export function toBnsListPageResponse(
|
||||
wrapper: BnsListResponseWrapperDto,
|
||||
cPage: number,
|
||||
pageSize: number = BNS_LIST_PAGE_SIZE,
|
||||
): PageResponse<BnsListResponseDto> {
|
||||
const content = wrapper.list ?? [];
|
||||
const pageIndex = cPage - 1;
|
||||
const totalPages = pageSize > 0 ? Math.ceil(wrapper.cnt / pageSize) : 0;
|
||||
|
||||
return {
|
||||
content,
|
||||
totalElements: wrapper.cnt,
|
||||
number: pageIndex,
|
||||
numberOfElements: content.length,
|
||||
size: pageSize,
|
||||
totalPages,
|
||||
first: cPage <= 1,
|
||||
last: cPage >= totalPages || content.length === 0,
|
||||
empty: content.length === 0,
|
||||
pageable: {
|
||||
sort: EMPTY_SORT,
|
||||
offset: pageIndex * pageSize,
|
||||
pageNumber: pageIndex,
|
||||
pageSize,
|
||||
paged: true,
|
||||
unpaged: false,
|
||||
},
|
||||
sort: EMPTY_SORT,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import type { CklstRvwRsltTreeDto, ReviewStepCode } from "@/entities/instl-sncn";
|
||||
|
||||
import { type ChecklistFormState, DEFAULT_CHECKLIST_PROGRESS } from "../model/view-types";
|
||||
|
||||
import { mergeChecklistFormStateFromServer, patchChecklistFormState } from "./checklist-utils";
|
||||
|
||||
const EMPTY_CKLST_RESULT_LIST: CklstRvwRsltTreeDto[] = [];
|
||||
|
||||
function isSameChecklistFormState(a: ChecklistFormState, b: ChecklistFormState): boolean {
|
||||
if (
|
||||
a.progress.total !== b.progress.total ||
|
||||
a.progress.completed !== b.progress.completed ||
|
||||
a.progress.percent !== b.progress.percent
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const aResultKeys = Object.keys(a.results);
|
||||
if (aResultKeys.length !== Object.keys(b.results).length) return false;
|
||||
if (!aResultKeys.every((key) => a.results[key] === b.results[key])) return false;
|
||||
|
||||
const aCommentKeys = Object.keys(a.comments);
|
||||
if (aCommentKeys.length !== Object.keys(b.comments).length) return false;
|
||||
|
||||
return aCommentKeys.every((key) => a.comments[key] === b.comments[key]);
|
||||
}
|
||||
|
||||
function useChecklistFormState(cklstResultList: CklstRvwRsltTreeDto[] = EMPTY_CKLST_RESULT_LIST) {
|
||||
const [formState, setFormState] = useState<ChecklistFormState>({
|
||||
results: {},
|
||||
comments: {},
|
||||
progress: DEFAULT_CHECKLIST_PROGRESS,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setFormState((prev) => {
|
||||
const next = mergeChecklistFormStateFromServer(prev, cklstResultList);
|
||||
return isSameChecklistFormState(prev, next) ? prev : next;
|
||||
});
|
||||
}, [cklstResultList]);
|
||||
|
||||
const patchFormState = useCallback(
|
||||
(
|
||||
patch: Partial<Pick<ChecklistFormState, "results" | "comments">>,
|
||||
reviewStep?: ReviewStepCode,
|
||||
) => {
|
||||
setFormState((prev) => patchChecklistFormState(prev, patch, cklstResultList, reviewStep));
|
||||
},
|
||||
[cklstResultList],
|
||||
);
|
||||
|
||||
return { formState, setFormState, patchFormState };
|
||||
}
|
||||
|
||||
export { EMPTY_CKLST_RESULT_LIST, useChecklistFormState };
|
||||
@@ -0,0 +1,74 @@
|
||||
"use client";
|
||||
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
|
||||
import type { BnsListResponseDto } from "@/entities/bns-if";
|
||||
|
||||
const columnHelper = createColumnHelper<BnsListResponseDto>();
|
||||
|
||||
function formatOptional(value: string | undefined) {
|
||||
return value?.trim() ? value : "-";
|
||||
}
|
||||
|
||||
export function getBnsListRowKey(row: BnsListResponseDto) {
|
||||
return `${row.gbn}-${row.seqNo}-${row.yr}`;
|
||||
}
|
||||
|
||||
export function createBnsListColumns() {
|
||||
return [
|
||||
columnHelper.display({
|
||||
id: "select",
|
||||
header: "선택",
|
||||
meta: { align: "center" },
|
||||
cell: ({ row }) => (
|
||||
<input
|
||||
type="radio"
|
||||
checked={row.getIsSelected()}
|
||||
onChange={() => row.toggleSelected(true)}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
aria-label="사업 선택"
|
||||
/>
|
||||
),
|
||||
}),
|
||||
columnHelper.accessor("rgnNm", {
|
||||
header: "환경청",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("sido", {
|
||||
header: "시도",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("gugun", {
|
||||
header: "시군구",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("bzNm", {
|
||||
header: "사업명",
|
||||
meta: { align: "left" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("yr", {
|
||||
header: "예산신청년도",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("strtYr", {
|
||||
header: "사업시작년도",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("edYr", {
|
||||
header: "사업종료년도",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("totBzamt", {
|
||||
header: "총사업비",
|
||||
meta: { align: "right" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
"use client";
|
||||
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
|
||||
import { dayjs } from "@/shared/lib";
|
||||
import type { InstlSncnMngResponseDto } from "@/entities/instl-sncn";
|
||||
import { Badge } from "@common/components";
|
||||
|
||||
const columnHelper = createColumnHelper<InstlSncnMngResponseDto>();
|
||||
|
||||
const MAIN_STEP_LABELS = {
|
||||
save: "저장",
|
||||
apply: "신청완료",
|
||||
techReview: "기술검토",
|
||||
reply: "검토결과 회신",
|
||||
} as const;
|
||||
|
||||
const TECH_REVIEW_STATUS_CODES = new Set(["LE", "ER", "EE", "TE", "TS", "TR", "TP"]);
|
||||
|
||||
type BadgeState = "completed" | "current" | "pending" | "action";
|
||||
|
||||
interface ProgressBadge {
|
||||
label: string;
|
||||
state: BadgeState;
|
||||
}
|
||||
|
||||
function buildProgressBadges(prgrsSttsComCd: string, prgrsSttsCdNm: string): ProgressBadge[] {
|
||||
const techReviewLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.techReview;
|
||||
const replyLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.reply;
|
||||
|
||||
if (prgrsSttsComCd === "SV") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "current" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "ST") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "current" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (TECH_REVIEW_STATUS_CODES.has(prgrsSttsComCd)) {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: techReviewLabel, state: "action" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "EP") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "completed" },
|
||||
{ label: replyLabel, state: "action" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "TA" || prgrsSttsComCd === "TB") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "completed" },
|
||||
];
|
||||
}
|
||||
|
||||
return [{ label: prgrsSttsCdNm || prgrsSttsComCd || "-", state: "current" }];
|
||||
}
|
||||
|
||||
function getBadgeColor(state: BadgeState) {
|
||||
switch (state) {
|
||||
case "completed":
|
||||
return "green";
|
||||
case "current":
|
||||
return "blue";
|
||||
case "pending":
|
||||
return "lightGray";
|
||||
case "action":
|
||||
return "orange";
|
||||
}
|
||||
}
|
||||
|
||||
function formatOptional(value: string | undefined) {
|
||||
return value?.trim() ? value : "-";
|
||||
}
|
||||
|
||||
interface ProgressStepBadgeProps {
|
||||
prgrsSttsComCd: string;
|
||||
prgrsSttsCdNm: string;
|
||||
}
|
||||
|
||||
function ProgressStepBadge({ prgrsSttsComCd, prgrsSttsCdNm }: ProgressStepBadgeProps) {
|
||||
const badges = buildProgressBadges(prgrsSttsComCd, prgrsSttsCdNm);
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-center justify-start">
|
||||
{badges.map((badge, index) => (
|
||||
<Fragment key={badge.label}>
|
||||
{index > 0 && <span className="mx-2">></span>}
|
||||
<Badge color={getBadgeColor(badge.state)}>{badge.label}</Badge>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function createInstlSncnColumns() {
|
||||
return [
|
||||
columnHelper.accessor("sido", {
|
||||
header: "시도",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("gugun", {
|
||||
header: "시군구",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("bizNm", {
|
||||
header: "사업명",
|
||||
meta: { align: "left" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("taskSeCdNm", {
|
||||
header: "업무구분",
|
||||
meta: { align: "center" },
|
||||
cell: ({ row }) => formatOptional(row.original.taskSeCdNm || row.original.taskSeComCd),
|
||||
}),
|
||||
columnHelper.accessor("aplcntNm", {
|
||||
header: "담당자",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("envoSeCdNm", {
|
||||
header: "해당기관",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.display({
|
||||
id: "progress",
|
||||
header: "진행상황",
|
||||
meta: { align: "center" },
|
||||
cell: ({ row }) => (
|
||||
<ProgressStepBadge
|
||||
prgrsSttsComCd={row.original.prgrsSttsComCd || ""}
|
||||
prgrsSttsCdNm={row.original.prgrsSttsCdNm || ""}
|
||||
/>
|
||||
),
|
||||
}),
|
||||
columnHelper.accessor("regDt", {
|
||||
header: "신청일",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue();
|
||||
return value ? dayjs(value).format("YYYY-MM-DD") : "-";
|
||||
},
|
||||
}),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
CklstRvwRsltTreeDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
InstlSncnMngDetResponse,
|
||||
InstlSncnMngResponseDto,
|
||||
InstlSncnRvwOpnnResponseDto,
|
||||
ReviewStepCode,
|
||||
} from "@/entities/instl-sncn";
|
||||
|
||||
export type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
CklstRvwRsltTreeDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
InstlSncnMngResponseDto as InstlSncnMng,
|
||||
InstlSncnMngDetResponse,
|
||||
InstlSncnRvwOpnnResponseDto,
|
||||
ReviewStepCode,
|
||||
};
|
||||
|
||||
export type ChecklistRowKey = string;
|
||||
|
||||
export interface ChecklistProgress {
|
||||
total: number;
|
||||
completed: number;
|
||||
percent: number;
|
||||
}
|
||||
|
||||
export const DEFAULT_CHECKLIST_PROGRESS: ChecklistProgress = {
|
||||
total: 0,
|
||||
completed: 0,
|
||||
percent: 0,
|
||||
};
|
||||
|
||||
export interface ChecklistFormState {
|
||||
results: Record<ChecklistRowKey, "Y" | "N">;
|
||||
comments: Record<ChecklistRowKey, string>;
|
||||
progress: ChecklistProgress;
|
||||
}
|
||||
|
||||
export type ChecklistStepMap = Record<ReviewStepCode, CklstRvwRsltTreeDto[]>;
|
||||
|
||||
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||
|
||||
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
||||
LOCAL: "지자체",
|
||||
ENV: "환경청",
|
||||
KECO: "환경공단",
|
||||
};
|
||||
|
||||
export const TASK_CODE_LABELS: Record<string, string> = {
|
||||
RE: "재이용수",
|
||||
SP: "하수관로",
|
||||
SF: "하수처리시설",
|
||||
};
|
||||
|
||||
export const INSTL_PROGRESS_ORDER = [
|
||||
// ROLE_USER05
|
||||
"SV",
|
||||
"SL",
|
||||
"TA",
|
||||
|
||||
// ROLE_USER04
|
||||
"ST",
|
||||
"EP",
|
||||
|
||||
// ROLE_USER03
|
||||
"LE",
|
||||
"TP",
|
||||
|
||||
// ROLE_USER01
|
||||
"ER",
|
||||
"TE",
|
||||
|
||||
"TB",
|
||||
] as const;
|
||||
|
||||
export const ROLE_TO_REVIEW_STEP: Record<string, ReviewStepCode> = {
|
||||
ROLE_USER05: "LOCAL",
|
||||
ROLE_USER03: "ENV",
|
||||
ROLE_USER01: "KECO",
|
||||
};
|
||||
|
||||
export const REVIEW_STEP_ROLE_RANK: Record<ReviewStepCode, number> = {
|
||||
LOCAL: 1,
|
||||
ENV: 2,
|
||||
KECO: 3,
|
||||
};
|
||||
@@ -0,0 +1,511 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import type { UseQueryResult } from "@tanstack/react-query";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
type PaginationState,
|
||||
type RowSelectionState,
|
||||
} from "@tanstack/react-table";
|
||||
|
||||
import { useDataTable } from "@/shared/lib";
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
import { NoData } from "@/shared/ui/no-data";
|
||||
import type { CmCdAdstDstrComboResponseDto } from "@/entities/adstdstr";
|
||||
import { useFindGugunCombo, useFindSidoCombo } from "@/entities/adstdstr";
|
||||
import type { BnsDetailResponseDto, BnsListResponseDto, BnsSearchDto } from "@/entities/bns-if";
|
||||
import { buildBnsSearchDto, useBnsDetail, useBnsList } from "@/entities/bns-if";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Label,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import { BNS_LIST_PAGE_SIZE, toBnsListPageResponse } from "../../lib/to-bns-list-page-response";
|
||||
import { createBnsListColumns, getBnsListRowKey } from "../../model/bns-picker-columns";
|
||||
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
|
||||
const EMPTY_ADST_LIST: CmCdAdstDstrComboResponseDto[] = [];
|
||||
const YEAR_START = 1995;
|
||||
|
||||
interface BnsApplyData {
|
||||
bizNm: string;
|
||||
bizBgngYr: string;
|
||||
bizEndYr: string;
|
||||
bizCn: string;
|
||||
bgtBizCd: string;
|
||||
bgtAplyYr: string;
|
||||
}
|
||||
|
||||
interface BnsPickerDialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSelect: (data: BnsApplyData) => void;
|
||||
}
|
||||
|
||||
function BnsPickerDialog({ open, onClose, onSelect }: BnsPickerDialogProps) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const yearOptions = useMemo(
|
||||
() =>
|
||||
Array.from({ length: currentYear + 1 - YEAR_START + 1 }, (_, index) => YEAR_START + index),
|
||||
[currentYear],
|
||||
);
|
||||
|
||||
const { confirm } = useConfirm();
|
||||
const [sido, setSido] = useState("");
|
||||
const [gugun, setGugun] = useState("");
|
||||
const [year, setYear] = useState(String(currentYear));
|
||||
const [searchParams, setSearchParams] = useState<BnsSearchDto | null>(null);
|
||||
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
||||
|
||||
const { data: sidoData } = useFindSidoCombo();
|
||||
const { data: gugunData } = useFindGugunCombo(sido);
|
||||
const sidoOptions = sidoData ?? EMPTY_ADST_LIST;
|
||||
const gugunOptions = gugunData ?? EMPTY_ADST_LIST;
|
||||
|
||||
const listQueryParams = searchParams ?? { cPage: 1 };
|
||||
|
||||
const listQuery = useBnsList(listQueryParams, {
|
||||
enabled: searchParams !== null,
|
||||
});
|
||||
|
||||
const pageQuery = useMemo(
|
||||
() =>
|
||||
({
|
||||
isPending: listQuery.isPending,
|
||||
isError: listQuery.isError,
|
||||
data:
|
||||
listQuery.data && searchParams
|
||||
? toBnsListPageResponse(listQuery.data, searchParams.cPage)
|
||||
: undefined,
|
||||
}) as UseQueryResult<PageResponse<BnsListResponseDto>>,
|
||||
[listQuery.isPending, listQuery.isError, listQuery.data, searchParams],
|
||||
);
|
||||
|
||||
const columns = useMemo(() => createBnsListColumns(), []);
|
||||
|
||||
const pagination = useMemo<PaginationState>(
|
||||
() => ({
|
||||
pageIndex: Math.max(0, (searchParams?.cPage ?? 1) - 1),
|
||||
pageSize: BNS_LIST_PAGE_SIZE,
|
||||
}),
|
||||
[searchParams?.cPage],
|
||||
);
|
||||
|
||||
const { tableComponent } = useDataTable({
|
||||
query: pageQuery,
|
||||
tableOptions: {
|
||||
columns,
|
||||
state: { pagination, rowSelection },
|
||||
enableRowSelection: true,
|
||||
enableMultiRowSelection: false,
|
||||
getRowId: (row) => getBnsListRowKey(row),
|
||||
onRowSelectionChange: (updater) => {
|
||||
const next = typeof updater === "function" ? updater(rowSelection) : updater;
|
||||
setRowSelection(next);
|
||||
},
|
||||
onPaginationChange: (updater) => {
|
||||
if (!searchParams) return;
|
||||
const next = typeof updater === "function" ? updater(pagination) : updater;
|
||||
setRowSelection({});
|
||||
setSearchParams({
|
||||
...searchParams,
|
||||
cPage: next.pageIndex + 1,
|
||||
});
|
||||
},
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
viewPagination: true,
|
||||
onRowClick: (row) => {
|
||||
setRowSelection({ [getBnsListRowKey(row)]: true });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const selectedRow = useMemo(() => {
|
||||
const selectedId = Object.keys(rowSelection)[0];
|
||||
if (!selectedId) return null;
|
||||
return listQuery.data?.list?.find((row) => getBnsListRowKey(row) === selectedId) ?? null;
|
||||
}, [rowSelection, listQuery.data?.list]);
|
||||
|
||||
const detailGbn = selectedRow ? String(selectedRow.gbn) : "";
|
||||
const detailYr = selectedRow?.yr ?? "";
|
||||
const detailSeqNo = selectedRow?.seqNo ?? "";
|
||||
|
||||
const {
|
||||
data: detailData,
|
||||
isPending: isDetailPending,
|
||||
isError: isDetailError,
|
||||
} = useBnsDetail(detailGbn, detailYr, detailSeqNo);
|
||||
|
||||
const detail = detailData?.detail;
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
resetState();
|
||||
}
|
||||
}, [open]);
|
||||
|
||||
function resetState() {
|
||||
setSido("");
|
||||
setGugun("");
|
||||
setYear(String(currentYear));
|
||||
setSearchParams(null);
|
||||
setRowSelection({});
|
||||
}
|
||||
|
||||
function handleOpenChange(nextOpen: boolean) {
|
||||
if (!nextOpen) {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
setRowSelection({});
|
||||
setSearchParams(
|
||||
buildBnsSearchDto({
|
||||
cPage: 1,
|
||||
searchStartYear: year,
|
||||
searchSido: sido || undefined,
|
||||
searchGugun: gugun || undefined,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
if (!selectedRow || !detail) return;
|
||||
|
||||
if (
|
||||
!(await confirm(
|
||||
"해당 사업은 예산신청 당시의 정보로\n확정예산 정보와는 다를 수 있습니다.\n적용하시겠습니까?",
|
||||
))
|
||||
)
|
||||
return;
|
||||
|
||||
onSelect({
|
||||
bizNm: selectedRow.bzNm,
|
||||
bizBgngYr: selectedRow.strtYr,
|
||||
bizEndYr: selectedRow.edYr,
|
||||
bizCn: detail.bssCont,
|
||||
bgtBizCd: selectedRow.bzCd,
|
||||
bgtAplyYr: selectedRow.yr,
|
||||
});
|
||||
onClose();
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="max-w-[120rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>사업찾기</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="card card-border mx-4 flex flex-wrap items-end gap-4 p-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="bns-picker-sido">시도</Label>
|
||||
<Select
|
||||
value={sido}
|
||||
onValueChange={(value) => {
|
||||
setSido(value);
|
||||
setGugun("");
|
||||
}}
|
||||
>
|
||||
<SelectTrigger id="bns-picker-sido" className="w-[12rem]">
|
||||
<SelectValue placeholder="선택" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{sidoOptions.map((option) => (
|
||||
<SelectItem key={option.adstDstrCd} value={option.adstDstrCd}>
|
||||
{option.adstDstrNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="bns-picker-gugun">구군</Label>
|
||||
<Select value={gugun} onValueChange={setGugun} disabled={!sido}>
|
||||
<SelectTrigger id="bns-picker-gugun" className="w-[12rem]">
|
||||
<SelectValue placeholder="선택" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{gugunOptions.map((option) => (
|
||||
<SelectItem key={option.adstDstrCd} value={option.adstDstrCd}>
|
||||
{option.adstDstrNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="bns-picker-year">년도</Label>
|
||||
<Select value={year} onValueChange={setYear}>
|
||||
<SelectTrigger id="bns-picker-year" className="w-[10rem]">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{yearOptions.map((optionYear) => (
|
||||
<SelectItem key={optionYear} value={String(optionYear)}>
|
||||
{optionYear}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<Button type="button" onClick={handleSearch}>
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="max-h-[64rem] overflow-auto">
|
||||
<div className="mx-4">
|
||||
{searchParams === null ? (
|
||||
<NoData message="조회 조건을 선택한 후 조회해 주세요." />
|
||||
) : listQuery.isError ? (
|
||||
<NoData message="사업 목록을 불러오지 못했습니다." />
|
||||
) : (
|
||||
tableComponent
|
||||
)}
|
||||
</div>
|
||||
|
||||
{selectedRow && (
|
||||
<div className="mt-10 space-y-4">
|
||||
<SectionCollapsible title="기본정보" defaultOpen>
|
||||
{isDetailPending ? (
|
||||
<DetailSkeleton />
|
||||
) : isDetailError || !detail ? (
|
||||
<NoData message="기본정보를 불러오지 못했습니다." />
|
||||
) : (
|
||||
<BnsBasicInfoTable detail={detail} />
|
||||
)}
|
||||
</SectionCollapsible>
|
||||
|
||||
<SectionCollapsible title="운영현황 및 사업효과" defaultOpen>
|
||||
{isDetailPending ? (
|
||||
<DetailSkeleton />
|
||||
) : isDetailError || !detail ? (
|
||||
<NoData message="운영현황 및 사업효과를 불러오지 못했습니다." />
|
||||
) : (
|
||||
<BnsOperationTable detail={detail} />
|
||||
)}
|
||||
</SectionCollapsible>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" onClick={handleApply} disabled={!selectedRow || !detail}>
|
||||
적용
|
||||
</Button>
|
||||
<Button type="button" color="white" onClick={onClose}>
|
||||
닫기
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
function BnsBasicInfoTable({ detail }: { detail: BnsDetailResponseDto }) {
|
||||
return (
|
||||
<Table variant="secondary" className="w-full">
|
||||
<TableBody>
|
||||
<DetailPairRow
|
||||
leftLabel="시도"
|
||||
leftValue={detail.sido}
|
||||
rightLabel="구군"
|
||||
rightValue={detail.gugun}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="대권역"
|
||||
leftValue={detail.rvbsnNm}
|
||||
rightLabel="단위유역"
|
||||
rightValue={detail.lgbsnNm}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="중권역"
|
||||
leftValue={detail.mdmbsnNm}
|
||||
rightLabel="환경청"
|
||||
rightValue={detail.lclgvrnmntNm}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="회계구분"
|
||||
leftValue={detail.accKdNm}
|
||||
rightLabel="단위사업"
|
||||
rightValue={detail.bzKdNm}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="세부사업"
|
||||
leftValue={detail.untBzNm}
|
||||
rightLabel="내역사업"
|
||||
rightValue={detail.dtlBzNm}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="세부내역"
|
||||
leftValue={detail.mevBzNm}
|
||||
rightLabel="세세부내역"
|
||||
rightValue={detail.ddtlBzNm}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="사업시작년도"
|
||||
leftValue={detail.strtYr}
|
||||
rightLabel="사업종료년도"
|
||||
rightValue={detail.edYr}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="보조율(%)"
|
||||
leftValue={detail.aidRt}
|
||||
rightLabel="사업상태"
|
||||
rightValue={detail.bzStatus}
|
||||
/>
|
||||
<DetailFullRow label="사업명" value={detail.bzNm} />
|
||||
<DetailFullRow label="사업위치" value={detail.bzLoc} />
|
||||
<DetailPairRow
|
||||
leftLabel="기본계획상의 목표년도"
|
||||
leftValue={detail.goalYear}
|
||||
rightLabel="사업추진현황"
|
||||
rightValue={detail.bssProm}
|
||||
/>
|
||||
<DetailFullRow label="상위계획" value={detail.uppPlan} />
|
||||
<DetailPairRow
|
||||
leftLabel="기술진단"
|
||||
leftValue={detail.techInsp}
|
||||
rightLabel="사업내용"
|
||||
rightValue={detail.bssCont}
|
||||
/>
|
||||
<DetailFullRow label="비고" value={detail.rmk} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
|
||||
function BnsOperationTable({ detail }: { detail: BnsDetailResponseDto }) {
|
||||
return (
|
||||
<Table variant="secondary" className="w-full">
|
||||
<TableBody>
|
||||
<DetailPairRow
|
||||
leftLabel="유입하수처리장"
|
||||
leftValue={detail.inflBscFctNm}
|
||||
rightLabel="처리방식"
|
||||
rightValue={detail.trtMtd}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="시설용량(현행)"
|
||||
leftValue={detail.fctCpc}
|
||||
rightLabel="시설용량(사업후)"
|
||||
rightValue={detail.fctCpcAfr}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="처리구역면적(현행)"
|
||||
leftValue={detail.trtDstrArea}
|
||||
rightLabel="처리구역면적(사업후)"
|
||||
rightValue={detail.trtDstrAreaAfr}
|
||||
/>
|
||||
<DetailFullRow label="총인구(현행)" value={detail.adstPopl} />
|
||||
<DetailPairRow
|
||||
leftLabel="처리인구(현행)"
|
||||
leftValue={detail.swrTrtPopl}
|
||||
rightLabel="처리인구(사업후)"
|
||||
rightValue={detail.swrTrtPoplAfr}
|
||||
/>
|
||||
<DetailFullRow
|
||||
label="하수관로"
|
||||
value={`신규: ${detail.swrExtns || "-"} / 교체: ${detail.swrChng || "-"} / 개보수: ${detail.swrRnvt || "-"} (Km)`}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="배수설비 총가구수"
|
||||
leftValue={detail.totFamNum}
|
||||
rightLabel="펌프장(개소)"
|
||||
rightValue={detail.pumpCnt}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="방류수계"
|
||||
leftValue={detail.rvWbsn}
|
||||
rightLabel="방류하천"
|
||||
rightValue={detail.rvText}
|
||||
/>
|
||||
<DetailPairRow
|
||||
leftLabel="사업후 예상유입하수량"
|
||||
leftValue={detail.imprvExpctFlw}
|
||||
rightLabel="사업후 유입수질(예상BOD)"
|
||||
rightValue={detail.imprvExpctWqlt}
|
||||
/>
|
||||
<DetailFullRow label="계획방류수질" value={detail.trtplntPlEfflWqlt} />
|
||||
<DetailFullRow
|
||||
label="하천수질"
|
||||
value={`평균: ${detail.wqltAvg || "-"} / 최저: ${detail.wqltLow || "-"} / 최고: ${detail.wqltHgh || "-"} (BOD, mg/L)`}
|
||||
/>
|
||||
<DetailFullRow label="표준사업비" value={detail.stdCost} />
|
||||
<DetailFullRow label="기타사업물량" value={detail.bzEtc} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
|
||||
interface DetailPairRowProps {
|
||||
leftLabel: string;
|
||||
leftValue?: string;
|
||||
rightLabel: string;
|
||||
rightValue?: string;
|
||||
}
|
||||
|
||||
function DetailPairRow({ leftLabel, leftValue, rightLabel, rightValue }: DetailPairRowProps) {
|
||||
return (
|
||||
<TableRow>
|
||||
<TableHead className="w-[20%]">{leftLabel}</TableHead>
|
||||
<TableCell className="w-[30%]">{leftValue || "-"}</TableCell>
|
||||
<TableHead className="w-[20%]">{rightLabel}</TableHead>
|
||||
<TableCell className="w-[30%]">{rightValue || "-"}</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
interface DetailFullRowProps {
|
||||
label: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
function DetailFullRow({ label, value }: DetailFullRowProps) {
|
||||
return (
|
||||
<TableRow>
|
||||
<TableHead className="w-[20%]">{label}</TableHead>
|
||||
<TableCell colSpan={3}>{value || "-"}</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
function DetailSkeleton() {
|
||||
return (
|
||||
<div className="flex flex-col gap-2 py-2">
|
||||
<Skeleton className="h-[3rem]" />
|
||||
<Skeleton className="h-[3rem]" />
|
||||
<Skeleton className="h-[3rem]" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { BnsPickerDialog };
|
||||
export type { BnsApplyData };
|
||||
@@ -0,0 +1,163 @@
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
|
||||
import type { CklstRvwRsltTreeDto, ReviewStepCode } from "@/entities/instl-sncn";
|
||||
import {
|
||||
cn,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
import { buildChecklistRowKey, patchChecklistFormState } from "../../lib/checklist-utils";
|
||||
import { type ChecklistFormState, ROLE_TO_REVIEW_STEP } from "../../model/view-types";
|
||||
|
||||
interface ChecklistTaskPanelProps {
|
||||
selectedReviewStep: ReviewStepCode;
|
||||
selectedRows: CklstRvwRsltTreeDto[];
|
||||
allRows: CklstRvwRsltTreeDto[];
|
||||
formState: ChecklistFormState;
|
||||
setFormState: Dispatch<SetStateAction<ChecklistFormState>>;
|
||||
userRoleCode?: string;
|
||||
}
|
||||
|
||||
function ChecklistTaskPanel({
|
||||
selectedReviewStep,
|
||||
selectedRows,
|
||||
allRows,
|
||||
formState,
|
||||
setFormState,
|
||||
userRoleCode,
|
||||
}: ChecklistTaskPanelProps) {
|
||||
const currentUserReviewStep = userRoleCode ? ROLE_TO_REVIEW_STEP[userRoleCode] : undefined;
|
||||
const isStepEditable = currentUserReviewStep === selectedReviewStep;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" rowSpan={2}>
|
||||
검토항목
|
||||
</TableHead>
|
||||
<TableHead rowSpan={2}>주요 검토내용</TableHead>
|
||||
<TableHead colSpan={2}>검토 결과</TableHead>
|
||||
{selectedReviewStep !== "LOCAL" ? (
|
||||
<TableHead rowSpan={2} className="w-[20rem]">
|
||||
기술검토 의견
|
||||
</TableHead>
|
||||
) : null}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead className="w-[9rem]">예</TableHead>
|
||||
<TableHead className="w-[9rem]">아니오</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{selectedRows.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={5} className="py-12 text-center text-muted-foreground">
|
||||
조회된 체크리스트 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
selectedRows.map((row) => {
|
||||
const key = buildChecklistRowKey(row, selectedReviewStep);
|
||||
const isFieldVisible = row.bchckUseYn === "Y";
|
||||
const isLocalReviewStep = selectedReviewStep === "LOCAL";
|
||||
|
||||
return (
|
||||
<TableRow key={key}>
|
||||
<TableCell className="text-center text-[1.2rem]">{row.cklstArtclNm}</TableCell>
|
||||
<TableCell
|
||||
className="pl-2 !text-left text-[1.2rem] text-gray-600"
|
||||
style={{ paddingLeft: `${Math.max(0, row.treeLevel - 1) * 16 + 8}px` }}
|
||||
colSpan={isFieldVisible ? 0 : isLocalReviewStep ? 3 : 4}
|
||||
>
|
||||
{row.rvwCn}
|
||||
</TableCell>
|
||||
{isFieldVisible && (
|
||||
<>
|
||||
<TableCell className="text-center">
|
||||
<input
|
||||
type="radio"
|
||||
name={`chk_${key}`}
|
||||
value="Y"
|
||||
checked={formState.results[key] === "Y"}
|
||||
readOnly={!isStepEditable}
|
||||
onChange={() => {
|
||||
if (!isStepEditable) return;
|
||||
setFormState((prev) =>
|
||||
patchChecklistFormState(
|
||||
prev,
|
||||
{ results: { ...prev.results, [key]: "Y" } },
|
||||
allRows,
|
||||
selectedReviewStep,
|
||||
),
|
||||
);
|
||||
}}
|
||||
className={cn(isStepEditable ? "cursor-pointer" : "cursor-not-allowed")}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className="text-center">
|
||||
<input
|
||||
type="radio"
|
||||
name={`chk_${key}`}
|
||||
value="N"
|
||||
checked={formState.results[key] === "N"}
|
||||
readOnly={!isStepEditable}
|
||||
onChange={() => {
|
||||
if (!isStepEditable) return;
|
||||
setFormState((prev) =>
|
||||
patchChecklistFormState(
|
||||
prev,
|
||||
{ results: { ...prev.results, [key]: "N" } },
|
||||
allRows,
|
||||
selectedReviewStep,
|
||||
),
|
||||
);
|
||||
}}
|
||||
className={cn(isStepEditable ? "cursor-pointer" : "cursor-not-allowed")}
|
||||
/>
|
||||
</TableCell>
|
||||
</>
|
||||
)}
|
||||
{!isLocalReviewStep && isFieldVisible && (
|
||||
<TableCell className="text-left">
|
||||
<Textarea
|
||||
className={cn(
|
||||
"min-h-[6rem] !text-xl",
|
||||
isStepEditable ? "cursor-pointer" : "cursor-not-allowed",
|
||||
)}
|
||||
value={formState.comments[key] ?? ""}
|
||||
readOnly={!isStepEditable}
|
||||
onChange={(event) => {
|
||||
if (!isStepEditable) return;
|
||||
setFormState((prev) =>
|
||||
patchChecklistFormState(
|
||||
prev,
|
||||
{ comments: { ...prev.comments, [key]: event.target.value } },
|
||||
allRows,
|
||||
selectedReviewStep,
|
||||
),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
)}
|
||||
</TableRow>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { ChecklistTaskPanel };
|
||||
@@ -0,0 +1,223 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { useElaprDocPrgrsByDocNo } from "@/entities/elapr";
|
||||
import { processElaprPrgrs } from "@/entities/elapr/api/elapr-prgrs-service";
|
||||
import {
|
||||
Button,
|
||||
cn,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
import { getApproverStatus, sortByAtrzSeqNo } from "../../lib/approval-utils";
|
||||
|
||||
interface ElaprApprovalDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
elaprDocNo: string;
|
||||
currentUserUuid: string;
|
||||
onSuccess: () => void;
|
||||
}
|
||||
|
||||
function ElaprApprovalDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
elaprDocNo,
|
||||
currentUserUuid,
|
||||
onSuccess,
|
||||
}: ElaprApprovalDialogProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [rjctRsn, setRjctRsn] = useState("");
|
||||
const [isProcessing, setIsProcessing] = useState(false);
|
||||
|
||||
const { data: elaprDocPrgrsList = [], isLoading } = useElaprDocPrgrsByDocNo(
|
||||
open ? elaprDocNo : null,
|
||||
);
|
||||
|
||||
const orderedApprovers = sortByAtrzSeqNo(elaprDocPrgrsList);
|
||||
|
||||
const currentUserPrgrs = elaprDocPrgrsList.find(
|
||||
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
);
|
||||
const canApprove = Boolean(currentUserPrgrs?.elaprPrgrsId);
|
||||
|
||||
async function handleApprove() {
|
||||
if (!currentUserPrgrs?.elaprPrgrsId) return;
|
||||
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await processElaprPrgrs(currentUserPrgrs.elaprPrgrsId, "ATRZ_PRGRS_003");
|
||||
alert("결재가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||
});
|
||||
onSuccess();
|
||||
onOpenChange(false);
|
||||
} catch (error: unknown) {
|
||||
let errorMessage = "";
|
||||
if (error instanceof AxiosError) {
|
||||
errorMessage = error.response?.data?.message ?? "";
|
||||
} else {
|
||||
errorMessage = "결재 처리 중 오류가 발생했습니다.";
|
||||
}
|
||||
alert(errorMessage);
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReject() {
|
||||
if (!currentUserPrgrs?.elaprPrgrsId) return;
|
||||
if (!rjctRsn.trim()) {
|
||||
alert("반려 사유를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await processElaprPrgrs(currentUserPrgrs.elaprPrgrsId, "ATRZ_PRGRS_004");
|
||||
alert("반려 처리가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||
});
|
||||
onSuccess();
|
||||
onOpenChange(false);
|
||||
} catch (error: unknown) {
|
||||
let errorMessage = "";
|
||||
if (error instanceof AxiosError) {
|
||||
errorMessage = error.response?.data?.message ?? "";
|
||||
} else {
|
||||
errorMessage = "반려 처리 중 오류가 발생했습니다.";
|
||||
}
|
||||
alert(errorMessage);
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
setRjctRsn("");
|
||||
onOpenChange(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleClose}>
|
||||
<DialogContent className="max-w-[72rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>전자결재</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h4 className="mb-3 text-xl font-semibold">결재 진행 단계</h4>
|
||||
{isLoading ? (
|
||||
<div className="space-y-3">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
</div>
|
||||
) : orderedApprovers.length === 0 ? (
|
||||
<div className="text-center text-gray-500">결재 정보가 없습니다.</div>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="line">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
{orderedApprovers.map((row) => (
|
||||
<TableHead key={String(row.elaprPrgrsId ?? row.atrzSeComCd)}>
|
||||
{row.atrzSeComNm ?? row.atrzSeComCd}
|
||||
</TableHead>
|
||||
))}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
{orderedApprovers.map((row) => {
|
||||
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||
const st = getApproverStatus(status);
|
||||
|
||||
return (
|
||||
<TableCell
|
||||
key={String(row.elaprPrgrsId ?? row.atrzSeComCd)}
|
||||
align="center"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center rounded-md px-2 py-1 text-base font-semibold",
|
||||
st.badgeClass,
|
||||
)}
|
||||
>
|
||||
{st.label}
|
||||
</span>
|
||||
<span className="font-semibold">{row.aprvrUuidNm ?? "-"}</span>
|
||||
</div>
|
||||
<div className="mt-2 text-base text-gray-500">
|
||||
{row.ognzNm ?? ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm
|
||||
? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}`
|
||||
: ""}
|
||||
</div>
|
||||
</TableCell>
|
||||
);
|
||||
})}
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{canApprove && (
|
||||
<div>
|
||||
<h4 className="mb-3 text-xl font-semibold">반려 의견</h4>
|
||||
<Textarea
|
||||
value={rjctRsn}
|
||||
onChange={(event) => setRjctRsn(event.target.value)}
|
||||
placeholder="반려 시 사유를 입력하세요"
|
||||
rows={4}
|
||||
className="!text-xl"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={handleClose} disabled={isProcessing}>
|
||||
취소
|
||||
</Button>
|
||||
{canApprove && (
|
||||
<>
|
||||
<Button color="red" onClick={handleReject} disabled={isProcessing}>
|
||||
반려
|
||||
</Button>
|
||||
<Button onClick={handleApprove} disabled={isProcessing}>
|
||||
결재
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { ElaprApprovalDialog };
|
||||
@@ -0,0 +1,137 @@
|
||||
"use client";
|
||||
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { type ElaprTmplt, useElaprAplnPage, useElaprTmpltPage } from "@/entities/elapr";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
|
||||
interface ElaprTmpltPickerDialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSelect: (tmplt: ElaprTmplt) => void;
|
||||
}
|
||||
|
||||
function ElaprTmpltPickerDialog({ open, onClose, onSelect }: ElaprTmpltPickerDialogProps) {
|
||||
const { data, isPending, isError } = useElaprTmpltPage({
|
||||
page: 0,
|
||||
size: PAGE_SIZE,
|
||||
sort: "regDt,desc",
|
||||
docSeComCd: "INSTL",
|
||||
});
|
||||
|
||||
const items = data?.content ?? [];
|
||||
|
||||
function handleSelect(tmplt: ElaprTmplt) {
|
||||
onSelect(tmplt);
|
||||
onClose();
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onClose}>
|
||||
<DialogContent className="max-w-[80rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>결재선 선택</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="max-h-[36rem] overflow-auto">
|
||||
{isPending ? (
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem]" />
|
||||
<Skeleton className="h-[16rem]" />
|
||||
</div>
|
||||
) : isError ? (
|
||||
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||
결재서식 목록을 불러오지 못했습니다.
|
||||
</p>
|
||||
) : items.length === 0 ? (
|
||||
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||
선택 가능한 결재서식이 없습니다.
|
||||
</p>
|
||||
) : (
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="25%" />
|
||||
<col width="25%" />
|
||||
<col width="40%" />
|
||||
<col width="10%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>결재서식명</TableHead>
|
||||
<TableHead>서식 설명</TableHead>
|
||||
<TableHead>검토자</TableHead>
|
||||
<TableHead>선택</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{items.map((item) => (
|
||||
<TableRow key={item.elaprTmpltId}>
|
||||
<TableCell align="center">{item.elaprTmpltNm}</TableCell>
|
||||
<TableCell align="center">{item.elaprTmpltExpln || "-"}</TableCell>
|
||||
<TableCell align="center">
|
||||
<ElaprAplnCell elaprTmpltId={item.elaprTmpltId} />
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
<Button type="button" size="sm" onClick={() => handleSelect(item)}>
|
||||
선택
|
||||
</Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={onClose}>
|
||||
닫기
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
function ElaprAplnCell({ elaprTmpltId }: { elaprTmpltId: string }) {
|
||||
const { data } = useElaprAplnPage({
|
||||
elaprTmpltId,
|
||||
page: 0,
|
||||
size: PAGE_SIZE,
|
||||
sort: "atrzSeqNo,asc",
|
||||
});
|
||||
|
||||
const items = data?.content ?? [];
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{items.map((item) => (
|
||||
<Fragment key={item.aplnId}>
|
||||
<div className="flex items-center gap-1">
|
||||
<Badge color="gray">{item.atrzSeComNm}</Badge>
|
||||
{item.aprvrNm}
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { ElaprTmpltPickerDialog };
|
||||
@@ -0,0 +1,622 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { type ElaprDmndSaveRequestDto, elaprDmndService, type ElaprTmplt } from "@/entities/elapr";
|
||||
import {
|
||||
type DocPrgrsUpdateRequestDto,
|
||||
type InstlSncnApplySaveRequestDto,
|
||||
instlSncnKeys,
|
||||
type InstlSncnMngDetResponse,
|
||||
instlSncnService,
|
||||
} from "@/entities/instl-sncn";
|
||||
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import {
|
||||
getButtonConfigs,
|
||||
INSTL_SNCN_VIEW_BUTTON_ACTION,
|
||||
type InstlSncnViewButtonAction,
|
||||
needsRoleUser01AtrzResolve,
|
||||
} from "../../lib/button-config";
|
||||
import { computeReviewStepChecklistProgress } from "../../lib/checklist-utils";
|
||||
import { buildSavePayload, buildTechReviewReplyPayload } from "../../lib/save-payload-utils";
|
||||
import { type ChecklistFormState } from "../../model/view-types";
|
||||
import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opinion-section";
|
||||
|
||||
import { ElaprApprovalDialog } from "./elapr-approval-dialog";
|
||||
import { ElaprTmpltPickerDialog } from "./elapr-tmplt-picker-dialog";
|
||||
import { TextInputDialog } from "./text-input-dialog";
|
||||
|
||||
interface FloatingActionButtonsProps {
|
||||
data: InstlSncnMngDetResponse;
|
||||
docSeComCd: string;
|
||||
instlSncnDocNo: string;
|
||||
prgrsSttsComCd: string;
|
||||
dtlInstCd: string | undefined;
|
||||
checklistFormState: ChecklistFormState;
|
||||
techReviewOpinionRef?: React.RefObject<TechReviewOpinionSectionHandle | null>;
|
||||
opnrNm?: string;
|
||||
}
|
||||
|
||||
type ActiveDialog = "elaprTmplt" | "rjct" | "dmndSplmnt" | "elaprApproval" | null;
|
||||
|
||||
function FloatingActionButtons({
|
||||
data,
|
||||
docSeComCd,
|
||||
instlSncnDocNo,
|
||||
prgrsSttsComCd,
|
||||
dtlInstCd,
|
||||
checklistFormState,
|
||||
techReviewOpinionRef,
|
||||
opnrNm,
|
||||
}: FloatingActionButtonsProps) {
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
const queryClient = useQueryClient();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [isProcessing, setIsProcessing] = useState(false);
|
||||
const [activeDialog, setActiveDialog] = useState<ActiveDialog>(null);
|
||||
|
||||
const docNo = data.detDto.instlSncnDocNo;
|
||||
const isRegister = data.detDto.rgtr === userInfo?.userUnqId;
|
||||
|
||||
const needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
|
||||
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
|
||||
{},
|
||||
{ enabled: needsAtrzResolve },
|
||||
);
|
||||
|
||||
const atrzSeComCdList = useMemo(
|
||||
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
|
||||
[rvwLoginUserData],
|
||||
);
|
||||
|
||||
const actionButtons = useMemo(() => {
|
||||
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
||||
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, atrzSeComCdList);
|
||||
}, [atrzSeComCdList, dtlInstCd, isRvwLoginUserLoading, needsAtrzResolve, prgrsSttsComCd]);
|
||||
|
||||
const canEdit =
|
||||
isRegister && actionButtons.some((button) => button === INSTL_SNCN_VIEW_BUTTON_ACTION.strg);
|
||||
|
||||
function handleGoToList() {
|
||||
router.push("/instl-sncn");
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
router.push(`/instl-sncn/${instlSncnDocNo}/edit`);
|
||||
}
|
||||
|
||||
function shouldShowButton(action: InstlSncnViewButtonAction) {
|
||||
return actionButtons.some((button) => button === action);
|
||||
}
|
||||
|
||||
async function executeAction({
|
||||
action,
|
||||
request,
|
||||
successMessage,
|
||||
}: {
|
||||
action: InstlSncnViewButtonAction;
|
||||
request?: unknown;
|
||||
successMessage?: string;
|
||||
}) {
|
||||
const handler = buttonActionHandlers[action];
|
||||
if (!handler) return;
|
||||
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await handler({
|
||||
request,
|
||||
data,
|
||||
onSuccess: () => {
|
||||
alert(successMessage ?? "처리가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.detail(instlSncnDocNo),
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
let errorMessage = "";
|
||||
if (error instanceof AxiosError) {
|
||||
errorMessage = error.response?.data?.message ?? "";
|
||||
} else {
|
||||
errorMessage = error.message ?? "처리 중 오류가 발생했습니다.";
|
||||
}
|
||||
alert(errorMessage);
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleStrgClick() {
|
||||
const payload: InstlSncnApplySaveRequestDto = buildSavePayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"LOCAL",
|
||||
"SV",
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.strg,
|
||||
request: payload,
|
||||
successMessage: "저장되었습니다.",
|
||||
});
|
||||
}
|
||||
|
||||
async function handleAplyClick() {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"LOCAL",
|
||||
);
|
||||
const payload: InstlSncnApplySaveRequestDto = buildSavePayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"LOCAL",
|
||||
"ST",
|
||||
);
|
||||
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 신청이 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.aply,
|
||||
request: payload,
|
||||
successMessage: "신청 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.list(),
|
||||
});
|
||||
}
|
||||
|
||||
async function handleDelClick() {
|
||||
if (!(await confirm("삭제하시겠습니까?"))) return;
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.del,
|
||||
successMessage: "삭제되었습니다.",
|
||||
});
|
||||
router.push("/instl-sncn");
|
||||
}
|
||||
|
||||
async function handleInstlSncnAncmntClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "TB",
|
||||
};
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.instlSncnAncmnt,
|
||||
request: payload,
|
||||
successMessage: "고시되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.list(),
|
||||
});
|
||||
}
|
||||
|
||||
async function handleEnvoSbmsnClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "LE",
|
||||
};
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.envoSbmsn,
|
||||
request: payload,
|
||||
successMessage: "제출되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.list(),
|
||||
});
|
||||
}
|
||||
|
||||
async function handleRjctClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "SV",
|
||||
};
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.rjct,
|
||||
request: payload,
|
||||
successMessage: "반려되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.list(),
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSncnAprvClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "TA",
|
||||
};
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.sncnAprv,
|
||||
request: payload,
|
||||
successMessage: "인가승인되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.list(),
|
||||
});
|
||||
}
|
||||
|
||||
function getReviewOpinionFormData() {
|
||||
return techReviewOpinionRef?.current?.getFormData() ?? null;
|
||||
}
|
||||
|
||||
async function handleRvwRplyClick() {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"ENV",
|
||||
);
|
||||
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 검토결과 회신이 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = buildTechReviewReplyPayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"ENV",
|
||||
"EP",
|
||||
"CP",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.rvwRply,
|
||||
request: payload,
|
||||
successMessage: "검토결과 회신이 완료되었습니다.",
|
||||
});
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
async function handleRqstTechRvwClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "ER",
|
||||
};
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.rqstTechRvw,
|
||||
request: payload,
|
||||
successMessage: "기술검토 의뢰가 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.list(),
|
||||
});
|
||||
}
|
||||
|
||||
async function handleElaprTmpltSelect(tmplt: ElaprTmplt) {
|
||||
const payload = {
|
||||
elaprDocNo: data.detDto.instlSncnDocNo,
|
||||
elaprTmpltId: tmplt.elaprTmpltId,
|
||||
dmndTtl: data.detDto.bizNm,
|
||||
dmndCn: data.detDto.bizCn,
|
||||
};
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.dsgntRvwr,
|
||||
request: payload,
|
||||
successMessage: "검토자가 지정되었습니다.",
|
||||
});
|
||||
}
|
||||
|
||||
async function handleRvwStrgClick() {
|
||||
const payload = buildTechReviewReplyPayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"KECO",
|
||||
"TE",
|
||||
"SV",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.rvwStrg,
|
||||
request: payload,
|
||||
successMessage: "저장되었습니다.",
|
||||
});
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
async function handleRvwCmptnClick() {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"KECO",
|
||||
);
|
||||
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 검토완료가 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = buildTechReviewReplyPayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"KECO",
|
||||
"TE",
|
||||
"CP",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.rvwCmptn,
|
||||
request: payload,
|
||||
successMessage: "검토완료 처리되었습니다.",
|
||||
});
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
function handleDmndSplmntClick() {
|
||||
setActiveDialog("dmndSplmnt");
|
||||
}
|
||||
|
||||
async function handleDmndSplmntConfirm(splmntCn: string) {
|
||||
setActiveDialog(null);
|
||||
await executeAction({
|
||||
action: INSTL_SNCN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
request: splmntCn,
|
||||
successMessage: "보완요청이 처리되었습니다.",
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<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">
|
||||
<Button color="white" type="button" onClick={handleGoToList} disabled={isProcessing}>
|
||||
목록
|
||||
</Button>
|
||||
{canEdit && (
|
||||
<Button color="gray" onClick={handleEdit} disabled={isProcessing}>
|
||||
수정
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.strg) && (
|
||||
<Button onClick={handleStrgClick} disabled={isProcessing}>
|
||||
저장
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.aply) && (
|
||||
<Button color="green" onClick={handleAplyClick} disabled={isProcessing}>
|
||||
신청완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.del) && (
|
||||
<Button color="red" onClick={handleDelClick} disabled={isProcessing}>
|
||||
삭제
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.splmntCmptn) && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
void executeAction({ action: INSTL_SNCN_VIEW_BUTTON_ACTION.splmntCmptn })
|
||||
}
|
||||
disabled={isProcessing}
|
||||
>
|
||||
보완완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.instlSncnAncmnt) && (
|
||||
<Button onClick={handleInstlSncnAncmntClick} disabled={isProcessing}>
|
||||
설치인가 고시
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.envoSbmsn) && (
|
||||
<Button onClick={handleEnvoSbmsnClick} disabled={isProcessing}>
|
||||
환경청제출
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.rjct) && (
|
||||
<Button color="red" onClick={handleRjctClick} disabled={isProcessing}>
|
||||
반려
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.sncnAprv) && (
|
||||
<Button onClick={handleSncnAprvClick} disabled={isProcessing}>
|
||||
인가승인
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.rvwRply) && (
|
||||
<Button color="green" onClick={handleRvwRplyClick} disabled={isProcessing}>
|
||||
검토결과 회신
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.rqstTechRvw) && (
|
||||
<Button onClick={handleRqstTechRvwClick} disabled={isProcessing}>
|
||||
기술검토 의뢰
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.dsgntRvwr) && (
|
||||
<Button onClick={() => setActiveDialog("elaprTmplt")} disabled={isProcessing}>
|
||||
검토자지정
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.rvwStrg) && (
|
||||
<Button onClick={handleRvwStrgClick} disabled={isProcessing}>
|
||||
저장
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.rvwCmptn) && (
|
||||
<Button color="green" onClick={handleRvwCmptnClick} disabled={isProcessing}>
|
||||
검토완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.dmndSplmnt) && (
|
||||
<Button color="gray" onClick={handleDmndSplmntClick} disabled={isProcessing}>
|
||||
보완요청
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.atrzAprv) && (
|
||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isProcessing}>
|
||||
결재(승인)
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.atrzRply) && (
|
||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isProcessing}>
|
||||
결재(회신)
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ElaprTmpltPickerDialog
|
||||
open={activeDialog === "elaprTmplt"}
|
||||
onClose={() => setActiveDialog(null)}
|
||||
onSelect={handleElaprTmpltSelect}
|
||||
/>
|
||||
|
||||
<TextInputDialog
|
||||
open={activeDialog === "dmndSplmnt"}
|
||||
onOpenChange={() => setActiveDialog(null)}
|
||||
title="보완요청 내용 입력"
|
||||
placeholder="보완요청 내용을 입력하세요."
|
||||
isSubmitting={isProcessing}
|
||||
onConfirm={(value) => void handleDmndSplmntConfirm(value)}
|
||||
/>
|
||||
|
||||
<ElaprApprovalDialog
|
||||
open={activeDialog === "elaprApproval"}
|
||||
onOpenChange={(open) => setActiveDialog(open ? "elaprApproval" : null)}
|
||||
elaprDocNo={data.detDto.instlSncnDocNo}
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
setActiveDialog(null);
|
||||
alert("결재가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: instlSncnKeys.detail(instlSncnDocNo),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { FloatingActionButtons };
|
||||
|
||||
async function handleSaveApply(
|
||||
context: ActionHandlerContext<InstlSncnApplySaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await instlSncnService.saveApply(context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDel(context: ActionHandlerContext): Promise<void> {
|
||||
try {
|
||||
await instlSncnService.remove(context.data.detDto.instlSncnDocNo);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSplmntCmptn(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 보완완료 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
async function handleChangePrgrsSttsComCd(
|
||||
context: ActionHandlerContext<DocPrgrsUpdateRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await instlSncnService.changePrgrsSttsComCd(context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleTechReview(
|
||||
context: ActionHandlerContext<InstlSncnApplySaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await instlSncnService.techReview(context.data.detDto.instlSncnDocNo, context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDsgntRvwr(
|
||||
context: ActionHandlerContext<ElaprDmndSaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await elaprDmndService.save(context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDmndSplmnt(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 보완요청 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
async function handleAtrzAprv(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 결재 승인 처리 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
async function handleAtrzRply(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 결재 회신 처리 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
async function handleGrndsChck(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 현장점검 등록 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
const buttonActionHandlers: Record<InstlSncnViewButtonAction, ActionHandler> = {
|
||||
strg: handleSaveApply,
|
||||
aply: handleSaveApply,
|
||||
del: handleDel,
|
||||
splmntCmptn: handleSplmntCmptn,
|
||||
instlSncnAncmnt: handleChangePrgrsSttsComCd,
|
||||
envoSbmsn: handleChangePrgrsSttsComCd,
|
||||
rjct: handleChangePrgrsSttsComCd,
|
||||
sncnAprv: handleChangePrgrsSttsComCd,
|
||||
rvwRply: handleTechReview,
|
||||
rqstTechRvw: handleChangePrgrsSttsComCd,
|
||||
dsgntRvwr: handleDsgntRvwr,
|
||||
rvwStrg: handleTechReview,
|
||||
rvwCmptn: handleTechReview,
|
||||
dmndSplmnt: handleDmndSplmnt,
|
||||
atrzAprv: handleAtrzAprv,
|
||||
atrzRply: handleAtrzRply,
|
||||
grndsChck: handleGrndsChck,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
interface ActionHandlerContext<T = any> {
|
||||
request: T;
|
||||
data: InstlSncnMngDetResponse;
|
||||
onSuccess?: () => void;
|
||||
onError?: (error: Error) => void;
|
||||
}
|
||||
|
||||
type ActionHandler = (context: ActionHandlerContext) => Promise<void>;
|
||||
@@ -0,0 +1,111 @@
|
||||
"use client";
|
||||
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { Badge } from "@common/components";
|
||||
|
||||
interface ProgressStepIndicatorProps {
|
||||
prgrsSttsComCd: string;
|
||||
prgrsSttsCdNm: string;
|
||||
}
|
||||
|
||||
const MAIN_STEP_LABELS = {
|
||||
save: "저장",
|
||||
apply: "신청완료",
|
||||
techReview: "기술검토",
|
||||
reply: "검토결과 회신",
|
||||
} as const;
|
||||
|
||||
const TECH_REVIEW_STATUS_CODES = new Set(["LE", "ER", "EE", "TE", "TS", "TR", "TP"]);
|
||||
|
||||
type BadgeState = "completed" | "current" | "pending" | "action";
|
||||
|
||||
interface ProgressBadge {
|
||||
label: string;
|
||||
state: BadgeState;
|
||||
}
|
||||
|
||||
function buildProgressBadges(prgrsSttsComCd: string, prgrsSttsCdNm: string): ProgressBadge[] {
|
||||
const techReviewLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.techReview;
|
||||
const replyLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.reply;
|
||||
|
||||
if (prgrsSttsComCd === "SV") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "current" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "ST") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "current" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (TECH_REVIEW_STATUS_CODES.has(prgrsSttsComCd)) {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: techReviewLabel, state: "action" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "EP") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "completed" },
|
||||
{ label: replyLabel, state: "action" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "TA" || prgrsSttsComCd === "TB") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "completed" },
|
||||
];
|
||||
}
|
||||
|
||||
return [{ label: prgrsSttsCdNm || prgrsSttsComCd || "-", state: "current" }];
|
||||
}
|
||||
|
||||
function getBadgeColor(state: BadgeState) {
|
||||
switch (state) {
|
||||
case "completed":
|
||||
return "green";
|
||||
case "current":
|
||||
return "blue";
|
||||
case "pending":
|
||||
return "lightGray";
|
||||
case "action":
|
||||
return "orange";
|
||||
}
|
||||
}
|
||||
|
||||
function ProgressStepIndicator({ prgrsSttsComCd, prgrsSttsCdNm }: ProgressStepIndicatorProps) {
|
||||
const badges = buildProgressBadges(prgrsSttsComCd, prgrsSttsCdNm);
|
||||
|
||||
return (
|
||||
<div className="cnfm-card">
|
||||
<h3 className="text-[1.5rem] font-semibold">진행 단계</h3>
|
||||
<div className="cnfm-step-wrap mt-3">
|
||||
{badges.map((badge, index) => (
|
||||
<Fragment key={badge.label}>
|
||||
{index > 0 && <span className="cnfm-step-separator">></span>}
|
||||
<Badge color={getBadgeColor(badge.state)}>{badge.label}</Badge>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { ProgressStepIndicator };
|
||||
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { ChevronDown } from "lucide-react";
|
||||
|
||||
import { cn, Collapsible, CollapsibleContent, CollapsibleTrigger } from "@common/components";
|
||||
|
||||
interface SectionCollapsibleProps {
|
||||
title: ReactNode;
|
||||
defaultOpen?: boolean;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
function SectionCollapsible({ title, defaultOpen = true, children }: SectionCollapsibleProps) {
|
||||
return (
|
||||
<Collapsible defaultOpen={defaultOpen} className="mx-4 rounded-sm border bg-background">
|
||||
<CollapsibleTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="group flex w-full cursor-pointer items-center justify-between border-b p-4 text-left data-[state=closed]:border-b-0"
|
||||
>
|
||||
<h2 className="text-2xl font-bold">{title}</h2>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
"size-6 shrink-0 text-muted-foreground transition-transform",
|
||||
"group-data-[state=open]:rotate-180",
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent className="p-2">{children}</CollapsibleContent>
|
||||
</Collapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { SectionCollapsible };
|
||||
@@ -0,0 +1,107 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { Field, FieldGroup, FieldLabel, FieldSet } from "@/shared/ui/field";
|
||||
import { useCodeList } from "@/entities/code";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
interface TaskSePickerDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onConfirm: (selectedCodes: string[]) => void;
|
||||
}
|
||||
|
||||
function TaskSePickerDialog({ open, onOpenChange, onConfirm }: TaskSePickerDialogProps) {
|
||||
const [selectedCodes, setSelectedCodes] = useState<string[]>([]);
|
||||
const { data: taskOptions, isPending } = useCodeList("INSTL");
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
setSelectedCodes([]);
|
||||
}, [open]);
|
||||
|
||||
function handleCheckedChange(code: string, checked: boolean) {
|
||||
setSelectedCodes((prev) =>
|
||||
checked ? [...prev, code] : prev.filter((value) => value !== code),
|
||||
);
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
onConfirm(selectedCodes);
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>설치인가 신청</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{isPending ? (
|
||||
<Skeleton className="h-[16rem] w-full" />
|
||||
) : (
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>업무구분</TableHead>
|
||||
<TableCell>
|
||||
<FieldSet className="px-2">
|
||||
<FieldGroup data-slot="checkbox-group" className="flex-row flex-wrap">
|
||||
{taskOptions?.map((option) => (
|
||||
<Field key={option.lwpoCd} orientation="horizontal" className="w-auto">
|
||||
<Checkbox
|
||||
id={`task-se-picker-${option.lwpoCd}`}
|
||||
checked={selectedCodes.includes(option.lwpoCd)}
|
||||
onCheckedChange={(checked) =>
|
||||
handleCheckedChange(option.lwpoCd, checked === true)
|
||||
}
|
||||
/>
|
||||
<FieldLabel
|
||||
htmlFor={`task-se-picker-${option.lwpoCd}`}
|
||||
className="font-normal"
|
||||
>
|
||||
{option.lwpoCdNm}
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
))}
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
</Table>
|
||||
)}
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={() => onOpenChange(false)}>
|
||||
취소
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={handleConfirm}
|
||||
disabled={isPending || selectedCodes.length === 0}
|
||||
>
|
||||
확인
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { TaskSePickerDialog };
|
||||
@@ -0,0 +1,77 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
interface TextInputDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
title: string;
|
||||
placeholder?: string;
|
||||
defaultValue?: string;
|
||||
isSubmitting?: boolean;
|
||||
onConfirm: (text: string) => void;
|
||||
}
|
||||
|
||||
function TextInputDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
title,
|
||||
placeholder,
|
||||
defaultValue,
|
||||
isSubmitting,
|
||||
onConfirm,
|
||||
}: TextInputDialogProps) {
|
||||
const [value, setValue] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
setValue(defaultValue ?? "");
|
||||
}, [defaultValue, open]);
|
||||
|
||||
function handleConfirm() {
|
||||
onConfirm(value.trim());
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-[44rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<Textarea
|
||||
value={value}
|
||||
onChange={(event) => setValue(event.target.value)}
|
||||
placeholder={placeholder}
|
||||
rows={6}
|
||||
className="!text-xl"
|
||||
/>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={() => onOpenChange(false)}>
|
||||
취소
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={handleConfirm}
|
||||
disabled={isSubmitting || value.trim().length === 0}
|
||||
>
|
||||
확인
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { TextInputDialog };
|
||||
@@ -0,0 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { useInstlSncnDetail } from "@/entities/instl-sncn";
|
||||
|
||||
import { InstlFormPage } from "./instl-form-page";
|
||||
|
||||
interface InstlEditPageProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
function InstlEditPage({ id }: InstlEditPageProps) {
|
||||
const { data, isError } = useInstlSncnDetail(id);
|
||||
|
||||
if (isError || !data) {
|
||||
return <div className="mt-6 text-xl">수정 대상을 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <InstlFormPage id={id} mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { InstlEditPage };
|
||||
@@ -0,0 +1,128 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import {
|
||||
instlSncnKeys,
|
||||
type InstlSncnMngDetResponse,
|
||||
instlSncnService,
|
||||
} from "@/entities/instl-sncn";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import {
|
||||
type CnfmRegistFormData,
|
||||
cnfmRegistSchema,
|
||||
formatTaskSeComCdForApi,
|
||||
} from "../lib/cnfm-regist-schema";
|
||||
import { getCreateDefaultValues, mapDetailToFormData } from "../lib/form-data-mapper";
|
||||
|
||||
import { AttachmentsFormSection } from "./sections/attachments-form-section";
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
import { BusinessCostFormSection } from "./sections/business-cost-form-section";
|
||||
import { BusinessScaleFormSection } from "./sections/business-scale-form-section";
|
||||
import { ChecklistFormSection } from "./sections/checklist-form-section";
|
||||
import { ContactInfoFormSection } from "./sections/contact-info-form-section";
|
||||
import { PrivacyConsentSection } from "./sections/privacy-consent-section";
|
||||
|
||||
interface InstlFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: InstlSncnMngDetResponse;
|
||||
taskSeComCd?: string[];
|
||||
}
|
||||
|
||||
function InstlFormPage({ id, mode, initialData, taskSeComCd }: InstlFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const isEditMode = mode === "edit";
|
||||
|
||||
const form = useForm<CnfmRegistFormData>({
|
||||
resolver: zodResolver(cnfmRegistSchema),
|
||||
mode: "onChange",
|
||||
defaultValues:
|
||||
isEditMode && initialData
|
||||
? mapDetailToFormData(initialData)
|
||||
: getCreateDefaultValues(userInfo, taskSeComCd),
|
||||
});
|
||||
|
||||
async function onSave(data: CnfmRegistFormData) {
|
||||
if (isSubmitting) return;
|
||||
|
||||
try {
|
||||
setIsSubmitting(true);
|
||||
|
||||
const { taskSeComCd, ...instlSncnMngRest } = data.instlSncnMng;
|
||||
|
||||
const payload = {
|
||||
instlSncnMng: {
|
||||
...instlSncnMngRest,
|
||||
instlSncnDocNo: isEditMode ? initialData?.detDto.instlSncnDocNo : undefined,
|
||||
taskSeComCd: formatTaskSeComCdForApi(taskSeComCd),
|
||||
prgrsSttsComCd: "SV",
|
||||
},
|
||||
bzScaleList: data.bzScaleList,
|
||||
bizCstList: data.bizCstList,
|
||||
cklstResultList: data.cklstResultList,
|
||||
esntlAtchFileList: data.esntlAtchFileList,
|
||||
};
|
||||
|
||||
const instlSncnDocNo = await instlSncnService.saveApply(payload);
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/instl-sncn/${instlSncnDocNo}`);
|
||||
if (isEditMode && id) queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(id) });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="mt-6 space-y-4">
|
||||
<BasicInfoFormSection />
|
||||
<ContactInfoFormSection />
|
||||
<PrivacyConsentSection />
|
||||
<BusinessScaleFormSection />
|
||||
<BusinessCostFormSection />
|
||||
<ChecklistFormSection docSeComCd="INSTL" />
|
||||
<AttachmentsFormSection
|
||||
docSeComCd="INSTL"
|
||||
initialEsntlFiles={isEditMode ? initialData?.esntlFileList : undefined}
|
||||
initialEtcFiles={isEditMode ? initialData?.etcFileList : undefined}
|
||||
/>
|
||||
|
||||
<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">
|
||||
<Button
|
||||
color="white"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
router.back();
|
||||
}}
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
목록
|
||||
</Button>
|
||||
<Button type="submit" disabled={isSubmitting}>
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export { InstlFormPage };
|
||||
@@ -0,0 +1,141 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import type { PaginationState } from "@tanstack/react-table";
|
||||
|
||||
import type { CmCdAdstDstrComboResponseDto } from "@/entities/adstdstr";
|
||||
import { useFindGugunCombo, useFindSidoCombo } from "@/entities/adstdstr";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
import type { InstlSncnMngSearchParams } from "@/entities/instl-sncn";
|
||||
import {
|
||||
Button,
|
||||
Input,
|
||||
Label,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@common/components";
|
||||
|
||||
import { InstlList } from "./instl-list";
|
||||
|
||||
const DEFAULT_PAGE_INDEX = 0;
|
||||
const DEFAULT_PAGE_SIZE = 10;
|
||||
const DEFAULT_SORT = "instlSncnDocNo,desc";
|
||||
const EMPTY_ADST_LIST: CmCdAdstDstrComboResponseDto[] = [];
|
||||
|
||||
const DEFAULT_SEARCH_PARAMS: InstlSncnMngSearchParams = {
|
||||
bizNm: "",
|
||||
taskSeComCd: "",
|
||||
sidoComCd: "",
|
||||
sggComCd: "",
|
||||
page: DEFAULT_PAGE_INDEX,
|
||||
size: DEFAULT_PAGE_SIZE,
|
||||
sort: DEFAULT_SORT,
|
||||
};
|
||||
|
||||
function InstlListPage() {
|
||||
const [bizNm, setBizNm] = useState("");
|
||||
const [taskSeComCd, setTaskSeComCd] = useState("");
|
||||
const [sidoComCd, setSidoComCd] = useState("");
|
||||
const [sggComCd, setSggComCd] = useState("");
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
pageIndex: DEFAULT_PAGE_INDEX,
|
||||
pageSize: DEFAULT_PAGE_SIZE,
|
||||
});
|
||||
const [searchParams, setSearchParams] = useState<InstlSncnMngSearchParams>(DEFAULT_SEARCH_PARAMS);
|
||||
|
||||
const { data: sidoData } = useFindSidoCombo();
|
||||
const { data: gugunData } = useFindGugunCombo(sidoComCd);
|
||||
const sidoOptions = sidoData ?? EMPTY_ADST_LIST;
|
||||
const gugunOptions = gugunData ?? EMPTY_ADST_LIST;
|
||||
|
||||
const handleSearch = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
setPagination((prev) => ({ ...prev, pageIndex: DEFAULT_PAGE_INDEX }));
|
||||
setSearchParams({
|
||||
...DEFAULT_SEARCH_PARAMS,
|
||||
bizNm,
|
||||
taskSeComCd,
|
||||
sidoComCd,
|
||||
sggComCd,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4 px-[1.8rem] pb-6">
|
||||
<section className="card card-border mx-0 bg-background">
|
||||
<form className="flex flex-wrap items-center gap-4 p-2" onSubmit={handleSearch}>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="sidoComCd" className="whitespace-nowrap">
|
||||
시도
|
||||
</Label>
|
||||
<Select
|
||||
value={sidoComCd}
|
||||
onValueChange={(value) => {
|
||||
setSidoComCd(value);
|
||||
setSggComCd("");
|
||||
}}
|
||||
>
|
||||
<SelectTrigger id="sidoComCd" className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{sidoOptions.map((option) => (
|
||||
<SelectItem key={option.adstDstrCd} value={option.adstDstrCd}>
|
||||
{option.adstDstrNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="sggComCd" className="whitespace-nowrap">
|
||||
시군구
|
||||
</Label>
|
||||
<Select value={sggComCd} onValueChange={setSggComCd} disabled={!sidoComCd}>
|
||||
<SelectTrigger id="sggComCd" className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{gugunOptions.map((option) => (
|
||||
<SelectItem key={option.adstDstrCd} value={option.adstDstrCd}>
|
||||
{option.adstDstrNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="taskSeComCd" className="whitespace-nowrap">
|
||||
구분
|
||||
</Label>
|
||||
<CodeSelect upCd="INSTL" value={taskSeComCd} onValueChange={setTaskSeComCd} />
|
||||
</div>
|
||||
<div className="flex w-[24rem] items-center gap-2">
|
||||
<Label htmlFor="bizNm" className="whitespace-nowrap">
|
||||
사업명
|
||||
</Label>
|
||||
<Input
|
||||
id="bizNm"
|
||||
value={bizNm}
|
||||
onChange={(event) => setBizNm(event.target.value)}
|
||||
placeholder="사업명"
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit">조회</Button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<InstlList
|
||||
searchParams={searchParams}
|
||||
pagination={pagination}
|
||||
onPaginationChange={setPagination}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { InstlListPage };
|
||||
@@ -0,0 +1,90 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { getCoreRowModel, type PaginationState } from "@tanstack/react-table";
|
||||
|
||||
import { useDataTable } from "@/shared/lib";
|
||||
import { type InstlSncnMngSearchParams, useInstlSncnList } from "@/entities/instl-sncn";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import { createInstlSncnColumns } from "../model/columns";
|
||||
|
||||
import { TaskSePickerDialog } from "./components/task-se-picker-dialog";
|
||||
|
||||
interface InstlListProps {
|
||||
searchParams: InstlSncnMngSearchParams;
|
||||
pagination: PaginationState;
|
||||
onPaginationChange: (pagination: PaginationState) => void;
|
||||
}
|
||||
|
||||
function InstlList({ searchParams, pagination, onPaginationChange }: InstlListProps) {
|
||||
const router = useRouter();
|
||||
const [isTaskSeDialogOpen, setIsTaskSeDialogOpen] = useState(false);
|
||||
|
||||
const queryParams = useMemo(
|
||||
() => ({
|
||||
bizNm: searchParams.bizNm,
|
||||
taskSeComCd: searchParams.taskSeComCd,
|
||||
sidoComCd: searchParams.sidoComCd,
|
||||
sggComCd: searchParams.sggComCd,
|
||||
page: pagination.pageIndex,
|
||||
size: pagination.pageSize,
|
||||
sort: searchParams.sort ?? "regDt,desc",
|
||||
}),
|
||||
[searchParams, pagination],
|
||||
);
|
||||
|
||||
const pageQuery = useInstlSncnList(queryParams);
|
||||
const columns = useMemo(() => createInstlSncnColumns(), []);
|
||||
|
||||
const { tableComponent } = useDataTable({
|
||||
query: pageQuery,
|
||||
tableOptions: {
|
||||
columns,
|
||||
state: { pagination },
|
||||
onPaginationChange: (updater) => {
|
||||
const next = typeof updater === "function" ? updater(pagination) : updater;
|
||||
onPaginationChange(next);
|
||||
},
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
viewPagination: true,
|
||||
onRowClick: (row) => router.push(`/instl-sncn/${row.instlSncnDocNo}`),
|
||||
},
|
||||
});
|
||||
|
||||
const handleRegisterClick = () => {
|
||||
setIsTaskSeDialogOpen(true);
|
||||
};
|
||||
|
||||
const handleConfirmTaskSe = (selectedCodes: string[]) => {
|
||||
setIsTaskSeDialogOpen(false);
|
||||
const query = selectedCodes.join(",");
|
||||
router.push(`/instl-sncn/regist?taskSeComCd=${query}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="card card-border mx-0 bg-background pb-8 pt-0">
|
||||
<div className="card-header flex items-center justify-between">
|
||||
<h3 className="text-2xl font-semibold">설치인가 목록</h3>
|
||||
<Button type="button" color="green" onClick={handleRegisterClick}>
|
||||
신청
|
||||
</Button>
|
||||
</div>
|
||||
{tableComponent}
|
||||
</section>
|
||||
<TaskSePickerDialog
|
||||
open={isTaskSeDialogOpen}
|
||||
onOpenChange={setIsTaskSeDialogOpen}
|
||||
onConfirm={handleConfirmTaskSe}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { InstlList };
|
||||
@@ -0,0 +1,11 @@
|
||||
import { InstlFormPage } from "./instl-form-page";
|
||||
|
||||
interface InstlRegistPageProps {
|
||||
taskSeComCd?: string[];
|
||||
}
|
||||
|
||||
function InstlRegistPage({ taskSeComCd }: InstlRegistPageProps) {
|
||||
return <InstlFormPage mode="create" taskSeComCd={taskSeComCd} />;
|
||||
}
|
||||
|
||||
export { InstlRegistPage };
|
||||
@@ -0,0 +1,106 @@
|
||||
"use client";
|
||||
|
||||
import { useRef } from "react";
|
||||
|
||||
import { useUserStore } from "@/shared/lib";
|
||||
import { useInstlSncnDetail } from "@/entities/instl-sncn";
|
||||
import { Skeleton } from "@common/components";
|
||||
|
||||
import { getEditableReviewStep } from "../lib/review-step-utils";
|
||||
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
||||
|
||||
import { FloatingActionButtons } from "./components/floating-action-buttons";
|
||||
import { AttachmentsSection } from "./sections/attachments-section";
|
||||
import { BasicInfoSection } from "./sections/basic-info-section";
|
||||
import { BusinessCostSection } from "./sections/business-cost-section";
|
||||
import { BusinessScaleSection } from "./sections/business-scale-section";
|
||||
import { ChecklistSection } from "./sections/checklist-section";
|
||||
import { ContactInfoSection } from "./sections/contact-info-section";
|
||||
import {
|
||||
TechReviewOpinionSection,
|
||||
type TechReviewOpinionSectionHandle,
|
||||
} from "./sections/tech-review-opinion-section";
|
||||
|
||||
interface InstlViewPageProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
function InstlViewPage({ id }: InstlViewPageProps) {
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const techReviewOpinionRef = useRef<TechReviewOpinionSectionHandle>(null);
|
||||
const { data, isLoading, isError } = useInstlSncnDetail(id);
|
||||
const { formState: checklistFormState, setFormState: setChecklistFormState } =
|
||||
useChecklistFormState(data?.cklstResultList ?? EMPTY_CKLST_RESULT_LIST);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="mt-6 flex flex-col gap-4 px-6">
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem] rounded-xl" />
|
||||
<Skeleton className="h-[16rem] rounded-xl" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem] rounded-xl" />
|
||||
<Skeleton className="h-[16rem] rounded-xl" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem] rounded-xl" />
|
||||
<Skeleton className="h-[32rem] rounded-xl" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isError || !data) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
const {
|
||||
detDto,
|
||||
bizSclList,
|
||||
bizCstList,
|
||||
cklstResultList = [],
|
||||
esntlFileList,
|
||||
etcFileList,
|
||||
rvwList = [],
|
||||
} = data;
|
||||
|
||||
const editableReviewStep = getEditableReviewStep(
|
||||
userInfo?.dtlInstCd,
|
||||
detDto.prgrsSttsComCd || "",
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="mt-6 space-y-4">
|
||||
<BasicInfoSection det={detDto} />
|
||||
<ContactInfoSection det={detDto} />
|
||||
<BusinessScaleSection bizSclList={bizSclList} />
|
||||
<BusinessCostSection bizCstList={bizCstList} />
|
||||
<ChecklistSection
|
||||
cklstResultList={cklstResultList}
|
||||
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
|
||||
userRoleCode={userInfo?.dtlInstCd}
|
||||
formState={checklistFormState}
|
||||
setFormState={setChecklistFormState}
|
||||
/>
|
||||
<AttachmentsSection esntlFileList={esntlFileList} etcFileList={etcFileList} />
|
||||
<TechReviewOpinionSection
|
||||
ref={techReviewOpinionRef}
|
||||
rvwList={rvwList}
|
||||
editableReviewStep={editableReviewStep}
|
||||
/>
|
||||
<FloatingActionButtons
|
||||
data={data}
|
||||
docSeComCd="INSTL"
|
||||
instlSncnDocNo={detDto.instlSncnDocNo}
|
||||
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
|
||||
dtlInstCd={userInfo?.dtlInstCd}
|
||||
checklistFormState={checklistFormState}
|
||||
techReviewOpinionRef={techReviewOpinionRef}
|
||||
opnrNm={userInfo?.userName}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { InstlViewPage };
|
||||
@@ -0,0 +1,151 @@
|
||||
"use client";
|
||||
|
||||
import { dayjs, useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { elaprDmndService } from "@/entities/elapr";
|
||||
import { processElaprPrgrs } from "@/entities/elapr/api/elapr-prgrs-service";
|
||||
import type { ElaprDocPrgrsClientResponseDto } from "@/entities/instl-sncn";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import { getApproverStatus, sortByAtrzSeqNo } from "../../lib/approval-utils";
|
||||
|
||||
interface ApprovalInfoSectionProps {
|
||||
docNo: string;
|
||||
docTitle: string;
|
||||
docContent: string;
|
||||
elaprDocPrgrsList: ElaprDocPrgrsClientResponseDto[];
|
||||
onRefresh: () => Promise<void>;
|
||||
}
|
||||
|
||||
const DEFAULT_APPROVER_COLUMNS = [
|
||||
{ code: "ATRZ01", label: "접수자" },
|
||||
{ code: "ATRZ02", label: "검토자" },
|
||||
{ code: "ATRZ03", label: "승인자" },
|
||||
{ code: "ATRZ99", label: "최종승인자" },
|
||||
] as const;
|
||||
|
||||
function ApprovalInfoSection({
|
||||
docNo,
|
||||
docTitle,
|
||||
docContent,
|
||||
elaprDocPrgrsList,
|
||||
onRefresh,
|
||||
}: ApprovalInfoSectionProps) {
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
|
||||
const orderedApprovers = sortByAtrzSeqNo(elaprDocPrgrsList);
|
||||
|
||||
const renderApproverCell = (row: ElaprDocPrgrsClientResponseDto | undefined) => {
|
||||
if (!row) return <div className="text-center">-</div>;
|
||||
|
||||
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||
const st = getApproverStatus(status);
|
||||
const canApprove =
|
||||
status === "ATRZ_PRGRS_002" && row.elaprPrgrsId && userInfo?.userUnqId === row.aprvrUuid;
|
||||
|
||||
return (
|
||||
<div className="text-center">
|
||||
<div className="font-semibold">{row.aprvrUuidNm ?? "-"}</div>
|
||||
<div className="text-[0.95rem] text-gray-500">
|
||||
{row.ognzNm ?? ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm
|
||||
? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}`
|
||||
: ""}
|
||||
</div>
|
||||
<div className="mt-1 flex flex-wrap items-center justify-center gap-2 text-[0.9rem]">
|
||||
{row.atrzDt ? (
|
||||
<span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span>
|
||||
) : null}
|
||||
<span
|
||||
className={`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold ${st.badgeClass}`}
|
||||
>
|
||||
{st.label}
|
||||
</span>
|
||||
{canApprove ? (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
onClick={() => void handleApprove(String(row.elaprPrgrsId))}
|
||||
>
|
||||
결재
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const handleApprove = async (elaprPrgrsId: string) => {
|
||||
try {
|
||||
await processElaprPrgrs(elaprPrgrsId, "ATRZ_PRGRS_003");
|
||||
alert("결재가 완료되었습니다.");
|
||||
await onRefresh();
|
||||
} catch {
|
||||
alert("결재 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
};
|
||||
|
||||
const handleAssignApprover = async () => {
|
||||
try {
|
||||
await elaprDmndService.save({
|
||||
elaprDocNo: docNo,
|
||||
elaprTmpltId: "TMPLT20260611000001",
|
||||
dmndTtl: docTitle,
|
||||
dmndCn: docContent,
|
||||
});
|
||||
alert("결재자 지정(결재요청 등록)이 완료되었습니다.");
|
||||
await onRefresh();
|
||||
} catch {
|
||||
alert("결재자 지정 중 오류가 발생했습니다.");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="cnfm-card">
|
||||
<h3 className="text-[1.5rem] font-semibold">결재 정보</h3>
|
||||
<div className="cnfm-table-wrap mt-3">
|
||||
<table className="cnfm-table w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
{orderedApprovers.length === 0
|
||||
? DEFAULT_APPROVER_COLUMNS.map((col) => (
|
||||
<th key={col.code} className="text-center">
|
||||
{col.label}
|
||||
</th>
|
||||
))
|
||||
: orderedApprovers.map((row) => (
|
||||
<th key={String(row.elaprPrgrsId ?? row.atrzSeComCd)} className="text-center">
|
||||
{row.atrzSeComNm ?? row.atrzSeComCd}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
{orderedApprovers.length === 0
|
||||
? DEFAULT_APPROVER_COLUMNS.map((col) => (
|
||||
<td key={col.code}>
|
||||
{renderApproverCell(
|
||||
elaprDocPrgrsList.find((row) => row.atrzSeComCd === col.code),
|
||||
)}
|
||||
</td>
|
||||
))
|
||||
: orderedApprovers.map((row) => (
|
||||
<td key={String(row.elaprPrgrsId ?? row.atrzSeComCd)}>
|
||||
{renderApproverCell(row)}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="mt-4 text-right">
|
||||
<Button type="button" onClick={() => void handleAssignApprover()}>
|
||||
결재자 지정
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { ApprovalInfoSection };
|
||||
@@ -0,0 +1,502 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Controller, useFormContext } from "react-hook-form";
|
||||
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { getDefaultFileKey, useTus } from "@/shared/lib";
|
||||
import { attachService } from "@/entities/attach";
|
||||
import { useEsntlAtchFileMngTree } from "@/entities/esntl";
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/entities/instl-sncn";
|
||||
import {
|
||||
Button,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface AttachmentsFormSectionProps {
|
||||
docSeComCd: string;
|
||||
initialEsntlFiles?: EsntlAtchFileMngTreeResponseDto[];
|
||||
initialEtcFiles?: AtflMngClientResponseDto[];
|
||||
}
|
||||
|
||||
interface UploadedFileItem {
|
||||
file?: File;
|
||||
fileName: string;
|
||||
fileKey: string;
|
||||
atflId?: string;
|
||||
atflCd?: string;
|
||||
}
|
||||
|
||||
interface EtcFileItem {
|
||||
file?: File;
|
||||
fileName: string;
|
||||
fileKey: string;
|
||||
atflId?: string;
|
||||
atflCd?: string;
|
||||
}
|
||||
|
||||
interface UploadMapping {
|
||||
esntlAtchFileId: string;
|
||||
file: File;
|
||||
}
|
||||
|
||||
const ETC_FILE_KEY_PREFIX = "etc::";
|
||||
|
||||
function createUploadKey(esntlAtchFileId: string, file: File) {
|
||||
return `${esntlAtchFileId}::${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
function createEtcUploadKey(file: File) {
|
||||
return `${ETC_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
function isEtcFileKey(fileKey: string) {
|
||||
return fileKey.startsWith(ETC_FILE_KEY_PREFIX);
|
||||
}
|
||||
|
||||
function AttachmentsFormSection({
|
||||
docSeComCd,
|
||||
initialEsntlFiles,
|
||||
initialEtcFiles,
|
||||
}: AttachmentsFormSectionProps) {
|
||||
const { control, getValues, setValue } = useFormContext<CnfmRegistFormData>();
|
||||
const queryClient = useQueryClient();
|
||||
const [uploadedFiles, setUploadedFiles] = useState<Record<string, UploadedFileItem[]>>({});
|
||||
const [etcFiles, setEtcFiles] = useState<EtcFileItem[]>([]);
|
||||
const initialFilesMappedRef = useRef(false);
|
||||
|
||||
const uploadMappingRef = useRef<Map<string, UploadMapping>>(new Map());
|
||||
const atflCdBySlotRef = useRef<Record<string, string>>({});
|
||||
|
||||
useEffect(() => {
|
||||
if (initialFilesMappedRef.current) return;
|
||||
if (!initialEsntlFiles?.length && !initialEtcFiles?.length) return;
|
||||
|
||||
if (initialEsntlFiles?.length) {
|
||||
const nextUploadedFiles: Record<string, UploadedFileItem[]> = {};
|
||||
|
||||
for (const file of initialEsntlFiles) {
|
||||
if (!file.esntlAtchFileId || !file.atflCd || !file.atflId) continue;
|
||||
|
||||
const fileKey = `server::${file.esntlAtchFileId}::${file.atflId}`;
|
||||
const fileName = file.orgnlFileNm ?? "첨부파일";
|
||||
|
||||
nextUploadedFiles[file.esntlAtchFileId] = [
|
||||
...(nextUploadedFiles[file.esntlAtchFileId] ?? []),
|
||||
{
|
||||
fileName,
|
||||
fileKey,
|
||||
atflId: file.atflId,
|
||||
atflCd: file.atflCd,
|
||||
},
|
||||
];
|
||||
atflCdBySlotRef.current[file.esntlAtchFileId] = file.atflCd;
|
||||
}
|
||||
|
||||
setUploadedFiles(nextUploadedFiles);
|
||||
}
|
||||
|
||||
if (initialEtcFiles?.length) {
|
||||
setEtcFiles(
|
||||
initialEtcFiles.map((file) => ({
|
||||
fileName: file.orgnlFileNm ?? "첨부파일",
|
||||
fileKey: `server::etc::${file.atflId}`,
|
||||
atflId: file.atflId,
|
||||
atflCd: file.atflCd,
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
initialFilesMappedRef.current = true;
|
||||
}, [initialEsntlFiles, initialEtcFiles]);
|
||||
|
||||
const { uploadFileAsync, isUploading, uploads } = useTus({
|
||||
onSuccess: (atflCd, atflId, _file, fileKey) => {
|
||||
if (!atflCd || !atflId) return;
|
||||
|
||||
if (isEtcFileKey(fileKey)) {
|
||||
if (!getValues("instlSncnMng.atchFileGroupId")) {
|
||||
setValue("instlSncnMng.atchFileGroupId", atflCd, { shouldDirty: true });
|
||||
}
|
||||
|
||||
setEtcFiles((prev) =>
|
||||
prev.map((item) => (item.fileKey === fileKey ? { ...item, atflCd, atflId } : item)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const mapping = uploadMappingRef.current.get(fileKey);
|
||||
if (!mapping) return;
|
||||
|
||||
const { esntlAtchFileId } = mapping;
|
||||
atflCdBySlotRef.current[esntlAtchFileId] = atflCd;
|
||||
|
||||
setUploadedFiles((prev) => ({
|
||||
...prev,
|
||||
[esntlAtchFileId]: (prev[esntlAtchFileId] ?? []).map((item) =>
|
||||
item.fileKey === fileKey ? { ...item, atflCd, atflId } : item,
|
||||
),
|
||||
}));
|
||||
|
||||
const currentList = getValues("esntlAtchFileList");
|
||||
const existingIndex = currentList.findIndex(
|
||||
(item) => item.esntlAtchFileId === esntlAtchFileId,
|
||||
);
|
||||
|
||||
if (existingIndex >= 0) {
|
||||
const nextList = [...currentList];
|
||||
nextList[existingIndex] = { esntlAtchFileId, atchFileGroupId: atflCd };
|
||||
setValue("esntlAtchFileList", nextList, { shouldDirty: true });
|
||||
} else {
|
||||
setValue(
|
||||
"esntlAtchFileList",
|
||||
[...currentList, { esntlAtchFileId, atchFileGroupId: atflCd }],
|
||||
{ shouldDirty: true },
|
||||
);
|
||||
}
|
||||
|
||||
uploadMappingRef.current.delete(fileKey);
|
||||
},
|
||||
onError: (_error, _file, fileKey) => {
|
||||
if (isEtcFileKey(fileKey)) {
|
||||
setEtcFiles((prev) => prev.filter((item) => item.fileKey !== fileKey));
|
||||
return;
|
||||
}
|
||||
|
||||
uploadMappingRef.current.delete(fileKey);
|
||||
|
||||
setUploadedFiles((prev) => {
|
||||
const next = { ...prev };
|
||||
|
||||
Object.keys(next).forEach((esntlAtchFileId) => {
|
||||
next[esntlAtchFileId] = next[esntlAtchFileId].filter((item) => item.fileKey !== fileKey);
|
||||
if (next[esntlAtchFileId].length === 0) {
|
||||
delete next[esntlAtchFileId];
|
||||
}
|
||||
});
|
||||
|
||||
return next;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const { data: essentialFiles = [], isPending: isLoadingEssentialFiles } = useEsntlAtchFileMngTree(
|
||||
{ docSeComCd },
|
||||
);
|
||||
|
||||
async function invalidateAttachmentQueries() {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_SERVICE.ESNTL_ATCH_FILE, "tree", { docSeComCd }],
|
||||
});
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.ATTACH_SERVICE.ATTACHMENTS],
|
||||
});
|
||||
}
|
||||
|
||||
async function handleEtcFileUpload(files: FileList | null) {
|
||||
if (!files || files.length === 0) return;
|
||||
|
||||
const fileArray = Array.from(files);
|
||||
let etcAtflCd = getValues("instlSncnMng.atchFileGroupId") ?? "";
|
||||
|
||||
for (const file of fileArray) {
|
||||
const fileKey = createEtcUploadKey(file);
|
||||
|
||||
setEtcFiles((prev) => [...prev, { file, fileName: file.name, fileKey }]);
|
||||
|
||||
try {
|
||||
const atflCd = await uploadFileAsync(file, {
|
||||
fileKey,
|
||||
metadata: etcAtflCd ? { atflCd: etcAtflCd } : undefined,
|
||||
});
|
||||
|
||||
if (!etcAtflCd) {
|
||||
etcAtflCd = atflCd;
|
||||
setValue("instlSncnMng.atchFileGroupId", atflCd, { shouldDirty: true });
|
||||
}
|
||||
} catch {
|
||||
// onError callback handles cleanup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function removeEtcFile(fileIndex: number) {
|
||||
const fileToRemove = etcFiles[fileIndex];
|
||||
if (!fileToRemove) return;
|
||||
|
||||
uploads[fileToRemove.fileKey]?.abort();
|
||||
|
||||
if (fileToRemove.atflId) {
|
||||
try {
|
||||
await attachService.deleteAttachmentByAtflId(fileToRemove.atflId);
|
||||
await invalidateAttachmentQueries();
|
||||
} catch (error) {
|
||||
console.error("기타 첨부 파일 삭제 실패:", error);
|
||||
}
|
||||
}
|
||||
|
||||
const nextFiles = etcFiles.filter((_, index) => index !== fileIndex);
|
||||
setEtcFiles(nextFiles);
|
||||
|
||||
if (nextFiles.length === 0) {
|
||||
setValue("instlSncnMng.atchFileGroupId", "", { shouldDirty: true });
|
||||
}
|
||||
}
|
||||
|
||||
async function removeEssentialFile(esntlAtchFileId: string, fileIndex: number) {
|
||||
const target = uploadedFiles[esntlAtchFileId]?.[fileIndex];
|
||||
if (!target) return;
|
||||
|
||||
const { fileKey, atflId } = target;
|
||||
uploads[fileKey]?.abort();
|
||||
uploadMappingRef.current.delete(fileKey);
|
||||
|
||||
if (atflId) {
|
||||
try {
|
||||
await attachService.deleteAttachmentByAtflId(atflId);
|
||||
await invalidateAttachmentQueries();
|
||||
} catch (error) {
|
||||
console.error("파일 삭제 실패:", error);
|
||||
}
|
||||
}
|
||||
|
||||
const updatedList = (uploadedFiles[esntlAtchFileId] ?? []).filter(
|
||||
(_, index) => index !== fileIndex,
|
||||
);
|
||||
const isSlotEmpty = updatedList.length === 0;
|
||||
|
||||
setUploadedFiles((prev) => {
|
||||
const next = { ...prev };
|
||||
|
||||
if (isSlotEmpty) {
|
||||
delete next[esntlAtchFileId];
|
||||
} else {
|
||||
next[esntlAtchFileId] = updatedList;
|
||||
}
|
||||
|
||||
return next;
|
||||
});
|
||||
|
||||
if (isSlotEmpty) {
|
||||
delete atflCdBySlotRef.current[esntlAtchFileId];
|
||||
|
||||
const currentList = getValues("esntlAtchFileList");
|
||||
setValue(
|
||||
"esntlAtchFileList",
|
||||
currentList.filter((item) => item.esntlAtchFileId !== esntlAtchFileId),
|
||||
{ shouldDirty: true },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleEssentialFileUpload(esntlAtchFileId: string, files: FileList | null) {
|
||||
if (!files || files.length === 0) return;
|
||||
|
||||
const fileArray = Array.from(files);
|
||||
|
||||
for (const file of fileArray) {
|
||||
const fileKey = createUploadKey(esntlAtchFileId, file);
|
||||
const existingAtflCd = atflCdBySlotRef.current[esntlAtchFileId] ?? "";
|
||||
|
||||
setUploadedFiles((prev) => ({
|
||||
...prev,
|
||||
[esntlAtchFileId]: [
|
||||
...(prev[esntlAtchFileId] ?? []),
|
||||
{ file, fileName: file.name, fileKey },
|
||||
],
|
||||
}));
|
||||
|
||||
uploadMappingRef.current.set(fileKey, { esntlAtchFileId, file });
|
||||
|
||||
try {
|
||||
const atflCd = await uploadFileAsync(file, {
|
||||
fileKey,
|
||||
metadata: existingAtflCd ? { atflCd: existingAtflCd } : undefined,
|
||||
});
|
||||
|
||||
if (!existingAtflCd) {
|
||||
atflCdBySlotRef.current[esntlAtchFileId] = atflCd;
|
||||
}
|
||||
} catch {
|
||||
// onError callback handles cleanup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isLoadingEssentialFiles) {
|
||||
return (
|
||||
<SectionCollapsible title="첨부파일">
|
||||
<div className="space-y-4 p-4">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-24 w-full" />
|
||||
<Skeleton className="h-24 w-full" />
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="첨부파일">
|
||||
<div className="space-y-6">
|
||||
<Controller
|
||||
name="esntlAtchFileList"
|
||||
control={control}
|
||||
render={() => (
|
||||
<div className="px-2">
|
||||
<h3 className="mb-4 text-xl font-semibold">필수 첨부파일</h3>
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="60%" />
|
||||
<col width="40%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]" align="left">
|
||||
파일명
|
||||
</TableHead>
|
||||
<TableHead>업로드된 파일</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{essentialFiles.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} className="py-12 text-center text-muted-foreground">
|
||||
조회된 필수 첨부파일 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
essentialFiles.map((file) => (
|
||||
<TableRow key={file.esntlAtchFileId}>
|
||||
<TableHead
|
||||
className="break-keep font-medium"
|
||||
data-required={file.esntlAtchYn === "Y"}
|
||||
align="left"
|
||||
>
|
||||
{file.esntlAtchFileNm}
|
||||
</TableHead>
|
||||
<TableCell className="space-y-2">
|
||||
{uploadedFiles[file.esntlAtchFileId]?.length > 0 ? (
|
||||
<div className="space-y-1">
|
||||
{uploadedFiles[file.esntlAtchFileId].map((item, idx) => {
|
||||
const uploading = isUploading[item.fileKey] ?? false;
|
||||
|
||||
return (
|
||||
<div key={item.fileKey} className="flex items-center gap-2">
|
||||
<span className="text-xl">
|
||||
{item.file?.name ?? item.fileName}
|
||||
</span>
|
||||
<Button
|
||||
size="icon"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void removeEssentialFile(file.esntlAtchFileId, idx);
|
||||
}}
|
||||
disabled={uploading}
|
||||
className="size-8 !bg-destructive"
|
||||
>
|
||||
<i className="diveicon di-x text-xs" aria-label="삭제" />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<label>
|
||||
<input
|
||||
type="file"
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
void handleEssentialFileUpload(
|
||||
file.esntlAtchFileId,
|
||||
e.target.files,
|
||||
);
|
||||
e.target.value = "";
|
||||
}}
|
||||
/>
|
||||
<Button size="sm" variant="outline" asChild>
|
||||
<span>파일 선택</span>
|
||||
</Button>
|
||||
</label>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="px-2">
|
||||
<div className="mb-4 flex items-center justify-between">
|
||||
<h3 className="text-xl font-semibold">기타 첨부파일</h3>
|
||||
<label>
|
||||
<input
|
||||
type="file"
|
||||
multiple
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
void handleEtcFileUpload(e.target.files);
|
||||
e.target.value = "";
|
||||
}}
|
||||
/>
|
||||
<Button size="sm" variant="outline" asChild>
|
||||
<span>파일 추가</span>
|
||||
</Button>
|
||||
</label>
|
||||
</div>
|
||||
<div className="rounded border p-4">
|
||||
{etcFiles.length > 0 ? (
|
||||
<div className="space-y-2">
|
||||
{etcFiles.map((item, idx) => {
|
||||
const uploading = isUploading[item.fileKey] ?? false;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={item.fileKey}
|
||||
className="flex items-center justify-between rounded-sm border p-2"
|
||||
>
|
||||
<span className="px-2 text-xl">{item.file?.name ?? item.fileName}</span>
|
||||
<Button
|
||||
size="sm"
|
||||
color="gray"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void removeEtcFile(idx);
|
||||
}}
|
||||
disabled={uploading}
|
||||
>
|
||||
삭제
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center justify-center py-6 text-center text-xl text-muted-foreground">
|
||||
파일을 추가해주세요
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { AttachmentsFormSection };
|
||||
@@ -0,0 +1,119 @@
|
||||
"use client";
|
||||
|
||||
import { formatFileSize } from "@/shared/lib/file-utils";
|
||||
import { useDownloadAttachmentByAtflCd } from "@/entities/attach";
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/entities/instl-sncn";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface AttachmentsSectionProps {
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList: AtflMngClientResponseDto[];
|
||||
}
|
||||
|
||||
function AttachmentsSection({ esntlFileList, etcFileList }: AttachmentsSectionProps) {
|
||||
const { mutate: downloadAttachment } = useDownloadAttachmentByAtflCd();
|
||||
|
||||
return (
|
||||
<>
|
||||
<SectionCollapsible title="필수 첨부파일">
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>필수 자료명</TableHead>
|
||||
<TableHead>파일명</TableHead>
|
||||
<TableHead className="w-[8rem] text-right">크기</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{esntlFileList.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} className="py-12 text-center text-muted-foreground">
|
||||
조회된 필수 첨부파일 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
esntlFileList.map((file) => (
|
||||
<TableRow key={file.esntlAtchFileId}>
|
||||
<TableCell className="pl-2 text-left">
|
||||
{file.esntlAtchFileNm}
|
||||
{file.esntlAtchYn === "Y" ? (
|
||||
<span className="ml-1 text-red-500">*</span>
|
||||
) : null}
|
||||
</TableCell>
|
||||
<TableCell className="text-left">
|
||||
{file.atflCd ? (
|
||||
<a
|
||||
className="cursor-pointer text-blue-600 hover:underline"
|
||||
onClick={() => downloadAttachment(file.atflCd ?? "")}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{file.orgnlFileNm || "다운로드"}
|
||||
</a>
|
||||
) : (
|
||||
<span className="text-gray-500">첨부없음</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-right">{formatFileSize(file.atflFlieSz)}</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
|
||||
<SectionCollapsible title="기타 첨부파일">
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>파일명</TableHead>
|
||||
<TableHead className="w-[8rem] text-right">크기</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{etcFileList.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={2} className="py-12 text-center text-muted-foreground">
|
||||
등록된 기타첨부파일이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
etcFileList.map((file) => (
|
||||
<TableRow key={file.atflId}>
|
||||
<TableCell className="text-left">
|
||||
{file.atflCd ? (
|
||||
<a
|
||||
className="cursor-pointer text-blue-600 hover:underline"
|
||||
onClick={() => downloadAttachment(file.atflCd)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{file.orgnlFileNm || file.physFileNm || file.atflId}
|
||||
</a>
|
||||
) : (
|
||||
<span>{file.orgnlFileNm || file.physFileNm || file.atflId}</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-right text-gray-500">
|
||||
{formatFileSize(file.atflFlieSz)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { AttachmentsSection };
|
||||
@@ -0,0 +1,302 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Controller, useFormContext } from "react-hook-form";
|
||||
|
||||
import { Field, FieldError, FieldGroup, FieldLabel, FieldSet } from "@/shared/ui/field";
|
||||
import { findCodeLabel, useCodeList } from "@/entities/code";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Input,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
Table,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { type BnsApplyData, BnsPickerDialog } from "../components/bns-picker-dialog";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
function BasicInfoFormSection() {
|
||||
const { control, watch, setValue } = useFormContext<CnfmRegistFormData>();
|
||||
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
||||
const taskSeComCd = watch("instlSncnMng.taskSeComCd");
|
||||
|
||||
function handleBnsSelect(data: BnsApplyData) {
|
||||
setValue("instlSncnMng.bizNm", data.bizNm);
|
||||
setValue("instlSncnMng.bizBgngYr", data.bizBgngYr);
|
||||
setValue("instlSncnMng.bizEndYr", data.bizEndYr);
|
||||
setValue("instlSncnMng.bizCn", data.bizCn);
|
||||
setValue("instlSncnMng.bgtBizCd", data.bgtBizCd);
|
||||
setValue("instlSncnMng.bgtAplyYr", data.bgtAplyYr);
|
||||
}
|
||||
|
||||
const { data: taskOptions } = useCodeList("INSTL");
|
||||
const { data: sncnOptions } = useCodeList("SNCNSE");
|
||||
const { data: rtlztnFcltOptions } = useCodeList("RTLZTNFCLTSE");
|
||||
const { data: rtlztnUsgOptions } = useCodeList("RTLZTNUSGSE");
|
||||
|
||||
const taskSeComCdLabel =
|
||||
taskSeComCd
|
||||
.map((code) => findCodeLabel(taskOptions, code))
|
||||
.filter(Boolean)
|
||||
.join(", ") || "-";
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" data-required>
|
||||
사업명
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.bizNm"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="사업명 입력"
|
||||
aria-invalid={fieldState.invalid}
|
||||
className="w-[40rem]"
|
||||
/>
|
||||
<Button type="button" onClick={() => setIsPickerOpen(true)}>
|
||||
사업찾기
|
||||
</Button>
|
||||
</div>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>사업기간</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<FieldGroup className="flex-row items-center gap-2">
|
||||
<Controller
|
||||
name="instlSncnMng.bizBgngYr"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid} className="w-auto">
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="시작연도"
|
||||
className="max-w-[12rem]"
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<span>~</span>
|
||||
<Controller
|
||||
name="instlSncnMng.bizEndYr"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid} className="w-auto">
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="종료연도"
|
||||
className="max-w-[12rem]"
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</FieldGroup>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.bizCn"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="사업내용 입력"
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>구분</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.taskSeComCd"
|
||||
control={control}
|
||||
render={({ fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
<span>{taskSeComCdLabel}</span>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell colSpan={3}>서울특별시 강남구</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>사업구분</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.sncnSeComCd"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<FieldSet>
|
||||
<RadioGroup
|
||||
name={field.name}
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{sncnOptions?.map((option) => (
|
||||
<FieldLabel
|
||||
key={option.lwpoCd}
|
||||
htmlFor={`sncn-${option.lwpoCd}`}
|
||||
className="!w-auto border-none"
|
||||
>
|
||||
<Field
|
||||
orientation="horizontal"
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-auto"
|
||||
>
|
||||
<RadioGroupItem
|
||||
value={option.lwpoCd}
|
||||
id={`sncn-${option.lwpoCd}`}
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<span className="font-normal">{option.lwpoCdNm}</span>
|
||||
</Field>
|
||||
</FieldLabel>
|
||||
))}
|
||||
</RadioGroup>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</FieldSet>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{taskSeComCd.includes("RE") && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead>시설종류</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.rtlztnFcltSeComCd"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<FieldSet>
|
||||
<RadioGroup
|
||||
name={field.name}
|
||||
value={field.value || ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{rtlztnFcltOptions?.map((option) => (
|
||||
<FieldLabel
|
||||
key={option.lwpoCd}
|
||||
htmlFor={`rtlztn-fclt-${option.lwpoCd}`}
|
||||
className="!w-auto border-none"
|
||||
>
|
||||
<Field
|
||||
orientation="horizontal"
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-auto"
|
||||
>
|
||||
<RadioGroupItem
|
||||
value={option.lwpoCd}
|
||||
id={`rtlztn-fclt-${option.lwpoCd}`}
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<span className="font-normal">{option.lwpoCdNm}</span>
|
||||
</Field>
|
||||
</FieldLabel>
|
||||
))}
|
||||
</RadioGroup>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</FieldSet>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>재이용용도</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.rtlztnUsgSeComCd"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<FieldSet>
|
||||
<FieldGroup data-slot="checkbox-group" className="flex-row">
|
||||
{rtlztnUsgOptions?.map((option) => (
|
||||
<Field
|
||||
key={option.lwpoCd}
|
||||
orientation="horizontal"
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-auto"
|
||||
>
|
||||
<Checkbox
|
||||
id={`rtlztn-usg-${option.lwpoCd}`}
|
||||
name={field.name}
|
||||
aria-invalid={fieldState.invalid}
|
||||
checked={field.value?.includes(option.lwpoCd) ?? false}
|
||||
onCheckedChange={(checked) => {
|
||||
const currentValue = field.value || "";
|
||||
const values = currentValue ? currentValue.split(",") : [];
|
||||
const newValue = checked
|
||||
? [...values, option.lwpoCd]
|
||||
: values.filter((value) => value !== option.lwpoCd);
|
||||
field.onChange(newValue.join(","));
|
||||
}}
|
||||
/>
|
||||
<FieldLabel
|
||||
htmlFor={`rtlztn-usg-${option.lwpoCd}`}
|
||||
className="font-normal"
|
||||
>
|
||||
{option.lwpoCdNm}
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
))}
|
||||
</FieldGroup>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</FieldSet>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
)}
|
||||
</TableHeader>
|
||||
</Table>
|
||||
|
||||
<BnsPickerDialog
|
||||
open={isPickerOpen}
|
||||
onClose={() => setIsPickerOpen(false)}
|
||||
onSelect={handleBnsSelect}
|
||||
/>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { BasicInfoFormSection };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user