Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6af7676e6 | ||
|
|
a4f8cf6670 | ||
|
|
694aee4804 | ||
|
|
454b9e474f | ||
|
|
66bca69578 | ||
|
|
cb9267c57f | ||
|
|
1ff10de59f | ||
|
|
3bf21064e2 | ||
|
|
eb8cd58093 | ||
|
|
3390fe810b | ||
|
|
797b2c3b63 | ||
|
|
21df3bbfe0 | ||
|
|
dd074aec94 | ||
|
|
1d1d4af572 | ||
|
|
5519606876 | ||
|
|
25653f2d4f | ||
|
|
e93a83163e | ||
|
|
0f7c74726e | ||
|
|
a5495b4572 | ||
|
|
7a12d269bc | ||
|
|
f5bae39fba | ||
|
|
8b3fa32d1e | ||
|
|
993a9f4ff2 | ||
|
|
2b509246e8 | ||
|
|
a615158812 | ||
|
|
16b88c8c04 | ||
|
|
299ce3f1fe | ||
|
|
b65c50c5f9 | ||
|
|
eb37728532 | ||
|
|
c41a7bf3d3 | ||
|
|
774f3a5507 | ||
|
|
6e95e372a8 | ||
|
|
1ccd502e3a |
Vendored
+3
-1
@@ -1,5 +1,7 @@
|
||||
{
|
||||
|
||||
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
|
||||
// 기존 특성에 대한 설명을 보려면 가리킵니다.
|
||||
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
|
||||
|
||||
const isSentryEnabled =
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd";
|
||||
|
||||
const getSentryHost = (dsn?: string) => {
|
||||
if (!dsn) return null;
|
||||
try {
|
||||
const url = new URL(dsn);
|
||||
return url.host;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const sentryHost = getSentryHost(process.env.NEXT_PUBLIC_SENTRY_DSN);
|
||||
|
||||
Sentry.init({
|
||||
enabled: isSentryEnabled,
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local",
|
||||
tracesSampleRate: 1.0,
|
||||
replaysSessionSampleRate: 1.0,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
integrations: [
|
||||
Sentry.replayIntegration({
|
||||
networkDetailAllowUrls: sentryHost
|
||||
? [
|
||||
new RegExp(
|
||||
`^(?!.*${sentryHost.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}).*(?:/api/|/server/).*$`,
|
||||
),
|
||||
]
|
||||
: [/\/(?:api|server)\//],
|
||||
networkRequestHeaders: ["X-Custom-Header"],
|
||||
networkResponseHeaders: ["X-Custom-Header"],
|
||||
}),
|
||||
],
|
||||
debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true",
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
export async function register() {
|
||||
if (process.env.NEXT_RUNTIME === "nodejs") {
|
||||
await import("./sentry.server.config");
|
||||
}
|
||||
|
||||
if (process.env.NEXT_RUNTIME === "edge") {
|
||||
await import("./sentry.edge.config");
|
||||
}
|
||||
}
|
||||
|
||||
export const onRequestError = Sentry.captureRequestError;
|
||||
+25
-44
@@ -1,53 +1,34 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const subDomain = process.env.NEXT_PUBLIC_SUB_DOMAIN || "http://localhost:13000";
|
||||
|
||||
const webhwpCtrlBase = (
|
||||
process.env.NEXT_PUBLIC_WEBHYP_CTRL_URL || "http://hwp.onasys.co.kr/webhwpctrl"
|
||||
).replace(/\/$/, "");
|
||||
|
||||
const webhwpAssetPrefixes = ["js", "hwpsdk", "dist", "commonFrame", "wasm"] as const;
|
||||
import { withSentryConfig } from "@sentry/nextjs";
|
||||
import path from "path";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
reactStrictMode: true,
|
||||
transpilePackages: ["@common/assets"],
|
||||
experimental: {
|
||||
globalNotFound: true,
|
||||
},
|
||||
|
||||
async rewrites() {
|
||||
return {
|
||||
beforeFiles: [
|
||||
{
|
||||
source: "/_next/static/:path*",
|
||||
destination: `${subDomain}/_next/static/:path*`,
|
||||
has: [
|
||||
{
|
||||
type: "header",
|
||||
key: "referer",
|
||||
value: "(.*)/cms(.*)",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
afterFiles: [
|
||||
{
|
||||
source: "/cms/:path*",
|
||||
destination: `${subDomain}/cms/:path*`,
|
||||
},
|
||||
...webhwpAssetPrefixes.map((prefix) => ({
|
||||
source: `/webhwpctrl/${prefix}/:path*`,
|
||||
destination: `${webhwpCtrlBase}/${prefix}/:path*`,
|
||||
})),
|
||||
{
|
||||
source: "/webhwpctrl/file/:path*",
|
||||
destination: `${webhwpCtrlBase}/file/:path*`,
|
||||
},
|
||||
],
|
||||
fallback: [],
|
||||
};
|
||||
outputFileTracingRoot: path.join(__dirname, "../../"),
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
const isSentryEnabled =
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd";
|
||||
|
||||
export default withSentryConfig(nextConfig, {
|
||||
org: process.env.SENTRY_ORG,
|
||||
project: process.env.SENTRY_PROJECT,
|
||||
silent: true,
|
||||
widenClientFileUpload: true,
|
||||
tunnelRoute: "/monitoring",
|
||||
...(!isSentryEnabled ? { disable: true } : {}),
|
||||
webpack: {
|
||||
treeshake: {
|
||||
removeDebugLogging: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true" ? false : true,
|
||||
},
|
||||
automaticVercelMonitors: false,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+15
-4
@@ -3,11 +3,13 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3004",
|
||||
"dev": "next dev --turbo -p 3003",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3004",
|
||||
"start": "next start -p 3003",
|
||||
"lint": "next lint",
|
||||
"lint:fsd": "steiger ."
|
||||
"lint:fsd": "steiger .",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@common/assets": "workspace:*",
|
||||
@@ -21,6 +23,13 @@
|
||||
"@frontend-opensource/use-react-hooks": "^1.1.4",
|
||||
"@hookform/resolvers": "^4.1.3",
|
||||
"@radix-ui/react-tooltip": "^1.2.8",
|
||||
"@opentelemetry/api": "^1.9.1",
|
||||
"@opentelemetry/context-zone": "^2.8.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
|
||||
"@opentelemetry/instrumentation-fetch": "^0.219.0",
|
||||
"@opentelemetry/instrumentation-xml-http-request": "^0.219.0",
|
||||
"@opentelemetry/sdk-trace-web": "^2.8.0",
|
||||
"@sentry/nextjs": "^10.57.0",
|
||||
"@tanstack/react-query": "^5.75.5",
|
||||
"@tanstack/react-query-devtools": "^5.75.5",
|
||||
"@tanstack/react-table": "^8.21.2",
|
||||
@@ -46,6 +55,8 @@
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"steiger": "^0.5.11",
|
||||
"tailwindcss": "^3.4.14",
|
||||
"typescript": "^5.7.2"
|
||||
"typescript": "^5.7.2",
|
||||
"vite-tsconfig-paths": "5.1.4",
|
||||
"vitest": "^4.1.10"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"name": "as",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3004",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3004",
|
||||
"lint": "next lint",
|
||||
"lint:fsd": "steiger .",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"test:e2e": "playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@common/assets": "workspace:*",
|
||||
"@common/auth": "workspace:*",
|
||||
"@common/components": "workspace:*",
|
||||
"@common/network": "workspace:*",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@faker-js/faker": "^9.9.0",
|
||||
"@frontend-opensource/use-react-hooks": "^1.1.4",
|
||||
"@hookform/resolvers": "^4.1.3",
|
||||
"@radix-ui/react-tooltip": "^1.2.8",
|
||||
"@tanstack/react-query": "^5.75.5",
|
||||
"@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",
|
||||
"next": "15.5.18",
|
||||
"react-hook-form": "^7.54.2",
|
||||
"tus-js-client": "^4.3.1",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3",
|
||||
"@hookform/devtools": "^4.4.0",
|
||||
"@playwright/test": "^1.61.1",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@vitejs/plugin-react": "^4.7.0",
|
||||
"@vitejs/plugin-react-oxc": "^0.4.3",
|
||||
"eslint": "^9.0.0",
|
||||
"eslint-config-next": "15.3.8",
|
||||
"eslint-plugin-react-hooks": "^5.0.0",
|
||||
"jsdom": "^30.1.2",
|
||||
"postcss": "^8.4.49",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"steiger": "^0.5.11",
|
||||
"tailwindcss": "^3.4.14",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^8.3.3",
|
||||
"vitest": "^5.0.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
const isSentryEnabled =
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd";
|
||||
|
||||
Sentry.init({
|
||||
enabled: isSentryEnabled,
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local",
|
||||
tracesSampleRate: 1.0,
|
||||
debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true",
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
const isSentryEnabled =
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" &&
|
||||
process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd";
|
||||
|
||||
Sentry.init({
|
||||
enabled: isSentryEnabled,
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT ?? "local",
|
||||
tracesSampleRate: 1.0,
|
||||
debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true",
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { ElaprBranchDto } from "../model/elapr-forkjoin-types";
|
||||
|
||||
const BASE = ENDPOINT.AS_ELAPR_SERVICE.ELAPR_BRANCH;
|
||||
|
||||
async function getBranchesByDocNo(elaprDocNo: string): Promise<ElaprBranchDto[]> {
|
||||
const response = await client.get<ElaprBranchDto[]>(`${BASE}/doc/${elaprDocNo}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const elaprBranchService = {
|
||||
getBranchesByDocNo,
|
||||
};
|
||||
@@ -23,7 +23,6 @@ import type {
|
||||
} from "../model/elapr-tmplt-interface";
|
||||
|
||||
import { elaprAplnService } from "./elapr-apln-service";
|
||||
import { elaprBranchService } from "./elapr-branch-service";
|
||||
import { elaprDmndService } from "./elapr-dmnd-service";
|
||||
import { elaprPrgrsSttsService } from "./elapr-prgrs-stts-service";
|
||||
import { elaprTmpltService } from "./elapr-tmplt-service";
|
||||
@@ -32,7 +31,6 @@ 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;
|
||||
const elaprPrgrsSttsBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_PRGRS_STTS] as const;
|
||||
const elaprBranchBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_BRANCH] as const;
|
||||
|
||||
function invalidateElaprPrgrsSttsQueries(queryClient: ReturnType<typeof useQueryClient>) {
|
||||
queryClient.invalidateQueries({ queryKey: elaprPrgrsSttsBaseKey });
|
||||
@@ -362,16 +360,3 @@ export function useInsertElaprPrgrsSttsApprover() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useElaprBranchesByDocNo(
|
||||
elaprDocNo: string | null | undefined,
|
||||
options?: { enabled?: boolean; structuralSharing?: boolean },
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...elaprBranchBaseKey, "getBranchesByDocNo", elaprDocNo],
|
||||
queryFn: () => elaprBranchService.getBranchesByDocNo(elaprDocNo!),
|
||||
enabled: Boolean(elaprDocNo) && (options?.enabled ?? true),
|
||||
structuralSharing: options?.structuralSharing ?? true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export { elaprAplnService } from "./api/elapr-apln-service";
|
||||
export { elaprBranchService } from "./api/elapr-branch-service";
|
||||
export { elaprDmndService } from "./api/elapr-dmnd-service";
|
||||
export { elaprPrgrsSttsService } from "./api/elapr-prgrs-stts-service";
|
||||
export { elaprTmpltService } from "./api/elapr-tmplt-service";
|
||||
@@ -10,7 +9,6 @@ export {
|
||||
useDeleteElaprTmplt,
|
||||
useElaprApln,
|
||||
useElaprAplnPage,
|
||||
useElaprBranchesByDocNo,
|
||||
useElaprDmnd,
|
||||
useElaprDmndPage,
|
||||
useElaprDocPrgrsByDocNo,
|
||||
@@ -61,11 +59,6 @@ export {
|
||||
buildElaprPrgrsSttsListFromAplnRows,
|
||||
} from "./lib/dmnd-save-utils";
|
||||
export { mapDocPrgrsToAplnRows } from "./lib/doc-prgrs-to-apln-rows";
|
||||
export {
|
||||
type ForkJoinTrackKey,
|
||||
createDefaultForkJoinRow,
|
||||
mapDocPrgrsToForkJoinTrackRows,
|
||||
} from "./lib/doc-prgrs-to-forkjoin-rows";
|
||||
export type { ElaprPrgrsSttsRow } from "./lib/prgrs-stts-save-utils";
|
||||
export {
|
||||
assignPrgrsSttsAtrzSeqNumbers,
|
||||
@@ -98,14 +91,6 @@ export type {
|
||||
ElaprDmndService,
|
||||
ElaprDocPrgrsResponseDto,
|
||||
} from "./model/elapr-dmnd-interface";
|
||||
export type {
|
||||
AtrzSttsComCd,
|
||||
BranchSeCd,
|
||||
BranchSttsCd,
|
||||
ElaprBranchDto,
|
||||
ElaprForkJoinDataMap,
|
||||
ElaprForkJoinStepDto,
|
||||
} from "./model/elapr-forkjoin-types";
|
||||
export type {
|
||||
ElaprApproverChangeRequestDto,
|
||||
ElaprApproverInsertRequestDto,
|
||||
@@ -130,17 +115,11 @@ export type { ReviewerOption } from "./model/reviewer-option";
|
||||
export { AprvrPickerDialog } from "./ui/aprvr-picker-dialog";
|
||||
export { ElaprAplnPickerGrid } from "./ui/elapr-apln-picker-grid";
|
||||
export { ElaprApprovalDialog } from "./ui/elapr-approval-dialog";
|
||||
export { ElaprDocPrgrsForkJoinStep } from "./ui/elapr-doc-prgrs-forkjoin-step";
|
||||
export {
|
||||
type ElaprDocPrgrsPickerConfirmPayload,
|
||||
ElaprDocPrgrsPickerDialog,
|
||||
} from "./ui/elapr-doc-prgrs-picker-dialog";
|
||||
export {
|
||||
type ElaprDocPrgrsForkJoinPickerConfirmPayload,
|
||||
ElaprDocPrgrsForkJoinPickerDialog,
|
||||
} from "./ui/elapr-doc-prgrs-forkjoin-picker-dialog";
|
||||
export { ElaprDocPrgrsStatus } from "./ui/elapr-doc-prgrs-status";
|
||||
export { ElaprForkJoinPickerGrid } from "./ui/elapr-forkjoin-picker-grid";
|
||||
export {
|
||||
type ElaprTmpltPickerConfirmPayload,
|
||||
ElaprTmpltPickerDialog,
|
||||
|
||||
@@ -6,11 +6,8 @@ export function hasCurrentUserPendingApprovalRequest(
|
||||
): boolean {
|
||||
if (!currentUserUuid) return false;
|
||||
|
||||
const normalizedUserUuid = currentUserUuid.toLowerCase();
|
||||
return list.some(
|
||||
(row) =>
|
||||
row.aprvrUuid?.toLowerCase() === normalizedUserUuid &&
|
||||
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,10 +17,7 @@ export function findCurrentUserPendingApprovalRequest(
|
||||
): ElaprDocPrgrsResponseDto | undefined {
|
||||
if (!currentUserUuid) return undefined;
|
||||
|
||||
const normalizedUserUuid = currentUserUuid.toLowerCase();
|
||||
return list?.find(
|
||||
(row) =>
|
||||
row.aprvrUuid?.toLowerCase() === normalizedUserUuid &&
|
||||
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@ function toPrgrsSttsItem(
|
||||
aprvrUuid: string | undefined,
|
||||
atrzSeComCd: string | undefined,
|
||||
atrzSeqNo: number | undefined,
|
||||
branchId?: string,
|
||||
branchSeCd?: string,
|
||||
aprvrDeptNm?: string,
|
||||
): ElaprPrgrsSttsSaveRequestDto {
|
||||
if (!aprvrUuid?.trim()) {
|
||||
throw new Error("결재자가 지정되지 않은 행이 있습니다.");
|
||||
@@ -26,9 +23,6 @@ function toPrgrsSttsItem(
|
||||
aprvrUuid,
|
||||
atrzSeComCd,
|
||||
atrzSeqNo,
|
||||
branchId,
|
||||
branchSeCd,
|
||||
aprvrDeptNm,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,13 +38,6 @@ export function buildElaprPrgrsSttsListFromAplnRows(
|
||||
rows: ElaprAplnRow[],
|
||||
): ElaprPrgrsSttsSaveRequestDto[] {
|
||||
return getVisibleRows(rows).map((row) =>
|
||||
toPrgrsSttsItem(
|
||||
row.aprvrUuid,
|
||||
row.atrzSeComCd,
|
||||
row.atrzSeqNo,
|
||||
row.branchId,
|
||||
row.branchSeCd,
|
||||
row.aprvrDeptNm,
|
||||
),
|
||||
toPrgrsSttsItem(row.aprvrUuid, row.atrzSeComCd, row.atrzSeqNo),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
import type { ElaprDocPrgrsClientResponseDto } from "@/shared/model";
|
||||
|
||||
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||
|
||||
export type ForkJoinTrackKey = "SP" | "SF" | "TOTAL_AGG";
|
||||
|
||||
function normalizeBranchKey(
|
||||
rawBranchSeCd?: string,
|
||||
atrzSeComCd?: string,
|
||||
): ForkJoinTrackKey | null {
|
||||
if (rawBranchSeCd) {
|
||||
const upper = rawBranchSeCd.toUpperCase().trim();
|
||||
if (upper === "SP" || upper.includes("관로")) return "SP";
|
||||
if (upper === "SF" || upper.includes("시설")) return "SF";
|
||||
if (upper.includes("AGG") || upper.includes("정책") || upper.includes("TOTAL"))
|
||||
return "TOTAL_AGG";
|
||||
}
|
||||
if (atrzSeComCd === "ATRZ04") return "TOTAL_AGG";
|
||||
return null;
|
||||
}
|
||||
|
||||
export function createDefaultForkJoinRow(
|
||||
branchSeCd: ForkJoinTrackKey,
|
||||
deptNm: string,
|
||||
seq: number,
|
||||
seComCd: string,
|
||||
): ElaprAplnRow {
|
||||
return {
|
||||
rowKey: `forkjoin-${branchSeCd}-${seq}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
||||
elaprTmpltId: "TMPLT_SF_SP_FORKJOIN",
|
||||
atrzSeqNo: seq,
|
||||
atrzSeComCd: seComCd,
|
||||
aprvrDeptNm: deptNm,
|
||||
branchSeCd,
|
||||
isNew: true,
|
||||
isDirty: false,
|
||||
dcarbYn: seComCd === "ATRZ99" ? "Y" : "N",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 1차 결재선(elaprCycl=1)의 진행상태 목록을 Fork-Join 3트랙(관로, 시설, 정책) 결재선 행으로 매핑합니다.
|
||||
*/
|
||||
export function mapDocPrgrsToForkJoinTrackRows(
|
||||
list: ElaprDocPrgrsClientResponseDto[] | undefined,
|
||||
): Record<ForkJoinTrackKey, ElaprAplnRow[]> {
|
||||
const tracks: Record<ForkJoinTrackKey, ElaprAplnRow[]> = {
|
||||
SP: [],
|
||||
SF: [],
|
||||
TOTAL_AGG: [],
|
||||
};
|
||||
|
||||
if (list && list.length > 0) {
|
||||
list.forEach((item, index) => {
|
||||
const branchKey = normalizeBranchKey(item.branchSeCd, item.atrzSeComCd);
|
||||
if (branchKey) {
|
||||
const seq = Number(item.atrzSeqNo ?? tracks[branchKey].length + 1);
|
||||
const defaultDept =
|
||||
branchKey === "SP"
|
||||
? "하수관로부"
|
||||
: branchKey === "SF"
|
||||
? "하수처리시설부"
|
||||
: "정책총괄부";
|
||||
|
||||
const defaultSeComCd =
|
||||
branchKey === "TOTAL_AGG"
|
||||
? seq === 1
|
||||
? "ATRZ04"
|
||||
: "ATRZ99"
|
||||
: seq === 1
|
||||
? "ATRZ02"
|
||||
: "ATRZ03";
|
||||
|
||||
tracks[branchKey].push({
|
||||
rowKey: `forkjoin-docprgrs-${branchKey}-${seq}-${item.elaprPrgrsId ?? item.aprvrUuid ?? index}`,
|
||||
elaprTmpltId: "TMPLT_SF_SP_FORKJOIN",
|
||||
atrzSeqNo: seq,
|
||||
atrzSeComCd: item.atrzSeComCd || defaultSeComCd,
|
||||
atrzSeComNm: item.atrzSeComNm,
|
||||
aprvrUuid: item.aprvrUuid,
|
||||
aprvrNm: item.aprvrNm,
|
||||
aprvrUserId: item.aprvrUserId,
|
||||
aprvrDeptNm: item.aprvrDeptNm || item.ognzNm || defaultDept,
|
||||
branchId: item.branchId,
|
||||
branchSeCd: branchKey,
|
||||
dcarbYn: item.dcarbYn ?? (item.atrzSeComCd === "ATRZ99" ? "Y" : "N"),
|
||||
isNew: false,
|
||||
isDirty: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 각 트랙별 atrzSeqNo 오름차순 정렬
|
||||
tracks.SP.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
tracks.SF.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
tracks.TOTAL_AGG.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
}
|
||||
|
||||
// 트랙 데이터가 없는 경우 기본 2행 채우기
|
||||
if (tracks.SP.length === 0) {
|
||||
tracks.SP = [
|
||||
createDefaultForkJoinRow("SP", "하수관로부", 1, "ATRZ02"),
|
||||
createDefaultForkJoinRow("SP", "하수관로부", 2, "ATRZ03"),
|
||||
];
|
||||
}
|
||||
if (tracks.SF.length === 0) {
|
||||
tracks.SF = [
|
||||
createDefaultForkJoinRow("SF", "하수처리시설부", 1, "ATRZ02"),
|
||||
createDefaultForkJoinRow("SF", "하수처리시설부", 2, "ATRZ03"),
|
||||
];
|
||||
}
|
||||
if (tracks.TOTAL_AGG.length === 0) {
|
||||
tracks.TOTAL_AGG = [
|
||||
createDefaultForkJoinRow("TOTAL_AGG", "정책총괄부", 1, "ATRZ04"),
|
||||
createDefaultForkJoinRow("TOTAL_AGG", "정책총괄부", 2, "ATRZ99"),
|
||||
];
|
||||
}
|
||||
|
||||
return tracks;
|
||||
}
|
||||
@@ -13,8 +13,6 @@ export interface PrgrsSttsServerRow {
|
||||
atrzSeComCd?: string;
|
||||
atrzSeqNo?: number;
|
||||
dcarbYn?: string;
|
||||
branchId?: string;
|
||||
branchSeCd?: string;
|
||||
}
|
||||
|
||||
/** 결재선 그리드 로컬 행 — 진행상태 API 응답 + UI 보조 필드 */
|
||||
@@ -22,9 +20,6 @@ export interface ElaprPrgrsSttsRow {
|
||||
rowKey: string;
|
||||
elaprPrgrsId?: string;
|
||||
elaprDmndId?: string;
|
||||
branchId?: string;
|
||||
branchSeCd?: string;
|
||||
branchNm?: string;
|
||||
aprvrUuid?: string;
|
||||
aprvrNm?: string;
|
||||
atrzSeComCd?: string;
|
||||
@@ -57,22 +52,8 @@ function getVisibleRows(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
||||
return rows.filter((row) => !row.isDeleted);
|
||||
}
|
||||
|
||||
/** 그리드 행 순서(1-based)로 결재순서번호 채번 (브랜치가 분기된 Fork-Join의 경우 각 브랜치별 독립 순번 채번) */
|
||||
/** 그리드 행 순서(1-based)로 결재순서번호 일괄 채번 */
|
||||
export function assignPrgrsSttsAtrzSeqNumbers(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
||||
const branchKeys = new Set(rows.map((r) => r.branchId || r.branchSeCd).filter(Boolean));
|
||||
if (branchKeys.size > 1) {
|
||||
const branchCounters = new Map<string, number>();
|
||||
return rows.map((row) => {
|
||||
const key = row.branchId || row.branchSeCd;
|
||||
if (key) {
|
||||
const current = (branchCounters.get(key) ?? 0) + 1;
|
||||
branchCounters.set(key, current);
|
||||
return { ...row, atrzSeqNo: current };
|
||||
}
|
||||
return row;
|
||||
});
|
||||
}
|
||||
|
||||
return rows.map((row, index) => ({ ...row, atrzSeqNo: index + 1 }));
|
||||
}
|
||||
|
||||
@@ -111,7 +92,7 @@ function rowDiffersFromServer(row: ElaprPrgrsSttsRow, serverRow: PrgrsSttsServer
|
||||
return (
|
||||
row.aprvrUuid !== serverRow.aprvrUuid ||
|
||||
row.atrzSeComCd !== serverRow.atrzSeComCd ||
|
||||
Number(row.atrzSeqNo) !== Number(serverRow.atrzSeqNo) ||
|
||||
row.atrzSeqNo !== serverRow.atrzSeqNo ||
|
||||
(row.dcarbYn ?? "N") !== (serverRow.dcarbYn ?? "N")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ function toRow(item: ElaprDocPrgrsClientResponseDto): ElaprPrgrsSttsRow {
|
||||
rowKey: item.elaprPrgrsId ?? createDraftRowKey(),
|
||||
elaprPrgrsId: item.elaprPrgrsId,
|
||||
elaprDmndId: item.elaprDmndId,
|
||||
branchId: item.branchId,
|
||||
branchSeCd: item.branchSeCd,
|
||||
branchNm: item.branchNm,
|
||||
aprvrUuid: item.aprvrUuid,
|
||||
aprvrNm: item.aprvrNm,
|
||||
atrzSeComCd: item.atrzSeComCd,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { BranchSeCd } from "./elapr-forkjoin-types";
|
||||
import type { ElaprApln } from "./elapr-apln-interface";
|
||||
|
||||
/** 그리드 로컬 행 — API 응답 + UI 보조 필드 */
|
||||
@@ -8,11 +7,6 @@ export interface ElaprAplnRow extends Omit<ElaprApln, "aplnId"> {
|
||||
aplnId?: string;
|
||||
/** 결재자 표시명 — 응답 DTO 또는 선택 시 로컬 유지 */
|
||||
aprvrNm?: string;
|
||||
/** 소속 브랜치 ID 및 구분코드 */
|
||||
branchId?: string;
|
||||
branchSeCd?: BranchSeCd;
|
||||
aprvrDeptNm?: string;
|
||||
dcarbYn?: string;
|
||||
isNew?: boolean;
|
||||
isDirty?: boolean;
|
||||
/** 소프트 삭제 — 최종 저장 시 mode:D */
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { ElaprDocPrgrsClientResponseDto, PageableParams, PageResponse } from "@/shared/model";
|
||||
|
||||
import type { ElaprBranchDto } from "./elapr-forkjoin-types";
|
||||
import type { ElaprPrgrsSttsSaveRequestDto } from "./elapr-prgrs-stts-interface";
|
||||
|
||||
/** 백엔드 ElaprDmndSaveRequestDto */
|
||||
@@ -8,9 +7,6 @@ export interface ElaprDmndSaveRequestDto {
|
||||
elaprDocNo: string;
|
||||
dmndTtl: string;
|
||||
dmndCn: string;
|
||||
taskSeComCd?: string | null;
|
||||
forkJoinSeCd?: string | null;
|
||||
crntStageNo?: number | null;
|
||||
elaprCycl?: number | null;
|
||||
docPrgrsSttsComCd?: string | null;
|
||||
elaprPrgrsSttsList?: ElaprPrgrsSttsSaveRequestDto[];
|
||||
@@ -23,13 +19,8 @@ export interface ElaprDmndResponseDto {
|
||||
elaprDocNo: string;
|
||||
dmndTtl: string;
|
||||
dmndCn: string;
|
||||
taskSeComCd?: string;
|
||||
forkJoinSeCd?: string;
|
||||
crntStageNo?: number;
|
||||
elaprBranchList?: ElaprBranchDto[];
|
||||
atrzSttsComCd: string;
|
||||
atrzSttsComNm?: string;
|
||||
elaprCycl?: number;
|
||||
dmndDt?: string;
|
||||
updtDt?: string;
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/**
|
||||
* 공공하수도 재원협의 복합사업(SF+SP) Fork-Join 병렬결재 모델 및 타입 정의 (10월 12일 개정: 6인 체제)
|
||||
*/
|
||||
|
||||
/** 전자결재 마스터 진행상태 공통코드 (ATRZSTTS: tb_as_elapr_dmnd.atrz_stts_com_cd) */
|
||||
export type AtrzSttsComCd =
|
||||
| "ATRZ_STTS_001" // 대기중
|
||||
| "ATRZ_STTS_002" // 결재진행중
|
||||
| "ATRZ_STTS_003" // 결재완료
|
||||
| "ATRZ_STTS_004" // 반려
|
||||
| "ATRZ_STTS_005" // 회수
|
||||
| "ATRZ_STTS_006"; // 취소
|
||||
|
||||
/** 결재 구분 공통코드 (ATRZSE: tb_as_elapr_prgrs_stts.atrz_se_com_cd) */
|
||||
export type AtrzSeComCd =
|
||||
| "ATRZ01" // 접수 (민원/신청 접수)
|
||||
| "ATRZ02" // 검토 (실무 기술검토)
|
||||
| "ATRZ03" // 승인 (부서 승인 / 병합에 회신)
|
||||
| "ATRZ04" // 병합 (정책총괄 AI 병합의견 종합 심의 - 10-12 신설)
|
||||
| "ATRZ99"; // 최종승인(회신) (환경청에 회신)
|
||||
|
||||
/** 브랜치 구분코드 (10월 14일 개정: SP 하수관로, SF 하수처리시설, TOTAL_AGG 정책부 종합병합, MAIN 주결재선) */
|
||||
export type BranchSeCd = "MAIN" | "SP" | "SF" | "TOTAL_AGG";
|
||||
|
||||
/** 브랜치 진행상태코드 */
|
||||
export type BranchSttsCd =
|
||||
| "WAITING"
|
||||
| "IN_PROGRESS"
|
||||
| "COMPLETED"
|
||||
| "SUPPLEMENT"
|
||||
| "REJECTED"
|
||||
| "CANCELLED";
|
||||
|
||||
/** 브랜치 단위 정보 DTO */
|
||||
export interface ElaprBranchDto {
|
||||
branchId: string;
|
||||
elaprDmndId: string;
|
||||
stageSeqNo: number; // 2: 병렬검토, 3: 합류취합
|
||||
branchSeCd: BranchSeCd;
|
||||
branchNm: string;
|
||||
branchSttsCd: BranchSttsCd;
|
||||
joinReqYn: "Y" | "N";
|
||||
strtDt?: string;
|
||||
endDt?: string;
|
||||
}
|
||||
|
||||
/** 결재 진행 스텝 DTO (브랜치 확장) */
|
||||
export interface ElaprForkJoinStepDto {
|
||||
elaprPrgrsId: string;
|
||||
elaprDmndId?: string;
|
||||
branchId?: string;
|
||||
branchSeCd?: BranchSeCd;
|
||||
aprvrUuid: string;
|
||||
aprvrNm?: string;
|
||||
aprvrDeptNm?: string;
|
||||
ognzNm?: string;
|
||||
jbpsSeNm?: string;
|
||||
atrzSeComCd: AtrzSeComCd | string; // ATRZ01: 접수, ATRZ02: 검토, ATRZ03: 승인, ATRZ04: 병합, ATRZ99: 최종승인(회신)
|
||||
atrzSeComNm?: string;
|
||||
atrzSeqNo: number;
|
||||
atrzPrgrsSttsComCd: string; // ATRZ_PRGRS_001: 대기, ATRZ_PRGRS_002: 요청, ATRZ_PRGRS_003: 완료, ATRZ_PRGRS_004: 반려, ATRZ_PRGRS_999: 결재안함
|
||||
atrzPrgrsSttsComNm?: string;
|
||||
rjctRsn?: string;
|
||||
atrzDt?: string;
|
||||
dcarbYn?: string;
|
||||
elaprCycl?: number;
|
||||
}
|
||||
|
||||
/** 3개 트랙으로 분할된 결재선 데이터 맵 (총 6인 체제: SP, SF, TOTAL_AGG) */
|
||||
export interface ElaprForkJoinDataMap {
|
||||
spTrack: ElaprForkJoinStepDto[]; // 관로부 (2명: 검토(02) ➔ 승인(03))
|
||||
sfTrack: ElaprForkJoinStepDto[]; // 시설부 (2명: 검토(02) ➔ 승인(03))
|
||||
aggTrack: ElaprForkJoinStepDto[]; // 정책부 종합병합 (2명: 병합(04) ➔ 최종승인(99))
|
||||
}
|
||||
|
||||
/** 결재 승인 요청 DTO */
|
||||
export interface ElaprApproveRequestDto {
|
||||
elaprDmndId: string;
|
||||
branchId: string;
|
||||
elaprPrgrsId: string;
|
||||
atrzOpnn?: string;
|
||||
}
|
||||
|
||||
/** 결재 단계별 반려 요청 DTO (10-12 개정) */
|
||||
export interface ElaprRejectRequestDto {
|
||||
elaprDmndId: string;
|
||||
branchId: string;
|
||||
elaprPrgrsId: string;
|
||||
rjctRsn: string; // 반려 사유 필수
|
||||
}
|
||||
@@ -14,9 +14,6 @@ export type ElaprPrgrsSttsSaveMode =
|
||||
export interface ElaprPrgrsSttsResponseDto {
|
||||
elaprPrgrsId: string;
|
||||
elaprDmndId?: string;
|
||||
branchId?: string;
|
||||
branchSeCd?: string;
|
||||
aprvrDeptNm?: string;
|
||||
aprvrUuid?: string;
|
||||
atrzSeComCd?: string;
|
||||
atrzSeComNm?: string;
|
||||
@@ -33,9 +30,6 @@ export interface ElaprPrgrsSttsSaveRequestDto {
|
||||
mode?: ElaprPrgrsSttsSaveMode;
|
||||
elaprPrgrsId?: string;
|
||||
elaprDmndId?: string;
|
||||
branchId?: string;
|
||||
branchSeCd?: string;
|
||||
aprvrDeptNm?: string;
|
||||
aprvrUuid?: string;
|
||||
atrzSeComCd?: string;
|
||||
atrzSeqNo?: number;
|
||||
|
||||
@@ -76,7 +76,7 @@ function AprvrPickerDialog({ open, onOpenChange, atrzSeComCd, onSelect }: AprvrP
|
||||
배치된 검토인력이 없습니다.
|
||||
</p>
|
||||
) : (
|
||||
<Table caption="결재자 선택 목록으로 성명, 부서, 직위, 직급, 선택 정보 제공" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="25%" />
|
||||
<col width="25%" />
|
||||
|
||||
@@ -162,7 +162,7 @@ function ElaprAplnPickerGrid({
|
||||
</p>
|
||||
) : (
|
||||
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
|
||||
<Table caption="결재선 선택 목록으로 결재순서, 결재구분, 결재자 정보 제공" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="10%" />
|
||||
|
||||
@@ -49,7 +49,6 @@ interface ElaprApprovalDialogProps {
|
||||
elaprDocNo: string;
|
||||
currentUserUuid: string;
|
||||
elaprCycl?: number;
|
||||
taskSeComCd?: string | null;
|
||||
onSuccess: () => void;
|
||||
}
|
||||
|
||||
@@ -61,7 +60,6 @@ function ElaprApprovalDialog({
|
||||
elaprDocNo,
|
||||
currentUserUuid,
|
||||
elaprCycl,
|
||||
taskSeComCd,
|
||||
onSuccess,
|
||||
}: ElaprApprovalDialogProps) {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -106,29 +104,7 @@ function ElaprApprovalDialog({
|
||||
const currentUserPrgrs = findCurrentUserPendingApprovalRequest(cyclDocPrgrsList, currentUserUuid);
|
||||
const canApprove = Boolean(currentUserPrgrs?.elaprPrgrsId);
|
||||
const canReject =
|
||||
currentUserPrgrs?.atrzSeComCd === "ATRZ03" ||
|
||||
currentUserPrgrs?.atrzSeComCd === "ATRZ04" ||
|
||||
currentUserPrgrs?.atrzSeComCd === "ATRZ99" ||
|
||||
(currentUserPrgrs?.atrzSeqNo ?? 1) > 1;
|
||||
|
||||
const branchSeCd = (currentUserPrgrs as { branchSeCd?: string } | undefined)?.branchSeCd;
|
||||
const isForkJoin =
|
||||
taskSeComCd === "SF_SP" ||
|
||||
branchSeCd === "SP" ||
|
||||
branchSeCd === "SF" ||
|
||||
branchSeCd === "TOTAL_AGG";
|
||||
|
||||
const isLastInBranch =
|
||||
currentUserPrgrs?.atrzSeComCd === "ATRZ99" || currentUserPrgrs?.atrzSeComCd === "ATRZ03";
|
||||
|
||||
const approveButtonLabel = useMemo(() => {
|
||||
if (!isForkJoin) return "결재";
|
||||
if (branchSeCd === "TOTAL_AGG" && isLastInBranch) return "결재 (환경청에 회신)";
|
||||
if (branchSeCd === "TOTAL_AGG") return "결재 (병합)";
|
||||
if ((branchSeCd === "SP" || branchSeCd === "SF") && isLastInBranch)
|
||||
return "결재 (병합에 회신)";
|
||||
return "결재 (검토)";
|
||||
}, [isForkJoin, branchSeCd, isLastInBranch]);
|
||||
currentUserPrgrs?.atrzSeComCd === "ATRZ03" || currentUserPrgrs?.atrzSeComCd === "ATRZ99";
|
||||
|
||||
const pickingRow = pickingRowKey ? rows.find((r) => r.rowKey === pickingRowKey) : undefined;
|
||||
const isBusy = isProcessing || savePrgrsSttsMutation.isPending;
|
||||
@@ -263,11 +239,7 @@ function ElaprApprovalDialog({
|
||||
atrzPrgrsSttsComCd: "ATRZ_PRGRS_004",
|
||||
rjctRsn: rjctRsn.trim(),
|
||||
});
|
||||
alert(
|
||||
isForkJoin
|
||||
? "결재가 반려 처리되었습니다.\n직전 결재자가 '결재 대기중'으로 변경되었습니다. 상대 부서 결재는 정상 진행됩니다."
|
||||
: "반려 처리가 완료되었습니다.",
|
||||
);
|
||||
alert("반려 처리가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||
});
|
||||
@@ -300,42 +272,6 @@ function ElaprApprovalDialog({
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6">
|
||||
{isForkJoin && (
|
||||
<div className="rounded-lg border border-blue-200 bg-blue-50/70 p-4 text-sm text-blue-900">
|
||||
<div className="mb-1 flex items-center gap-2 font-bold">
|
||||
<span className="rounded-sm bg-blue-200 px-2 py-0.5 text-xs text-blue-950">
|
||||
{branchSeCd === "SP"
|
||||
? "🌊 하수관로 전문기술검토 (Stage 2)"
|
||||
: branchSeCd === "SF"
|
||||
? "🏭 하수처리시설 전문기술검토 (Stage 2)"
|
||||
: branchSeCd === "TOTAL_AGG"
|
||||
? isLastInBranch
|
||||
? "⚖️ 정책총괄 최종승인 및 회신 (Stage 3)"
|
||||
: "⚖️ 정책총괄 AI 종합병합 (Stage 3)"
|
||||
: "복합사업 결재"}
|
||||
</span>
|
||||
<span>
|
||||
{branchSeCd === "TOTAL_AGG"
|
||||
? isLastInBranch
|
||||
? "환경청 대외 최종 회신 단계"
|
||||
: "AI 의견 종합 및 병합 심의 단계"
|
||||
: isLastInBranch
|
||||
? "병합부서(정책총괄) 내부 회신(이관) 단계"
|
||||
: "실무 기술검토 단계"}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-blue-800">
|
||||
{branchSeCd === "TOTAL_AGG"
|
||||
? isLastInBranch
|
||||
? "ℹ️ [중요] 본 승인은 환경청에 최종 회신하는 결재입니다. 승인 즉시 공문이 대외 발송되며 원천문서 상태가 TP(기술검토회신) 또는 TR(최종실무협의완료)로 전이됩니다."
|
||||
: "ℹ️ [안내] 본 승인은 'AI의견 종합 및 병합 심의' 단계입니다. 양 부서 검토의견을 종합 반영하여 정책실장(최종 전결권자)에게 이관됩니다."
|
||||
: isLastInBranch
|
||||
? "ℹ️ [안내] 본 승인은 '병합에 회신'하는 내부 이관 단계입니다. 환경청으로 직접 공문이 나가지 않으며, 상대방 부서 검토 완료 시 종합병합 단계로 자동 합류(Join)됩니다."
|
||||
: "ℹ️ [안내] 본 단계는 실무 기술검토 단계입니다. 검토 완료 후 부서 승인자에게 이관됩니다."}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<div className="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||
<h4 className="text-xl font-semibold">결재 진행 단계</h4>
|
||||
@@ -344,7 +280,7 @@ function ElaprApprovalDialog({
|
||||
size="sm"
|
||||
type="button"
|
||||
color="white"
|
||||
disabled={isForkJoin || !elaprDmndId || isEditingLocked || isBusy}
|
||||
disabled={!elaprDmndId || isEditingLocked || isBusy}
|
||||
onClick={addRow}
|
||||
>
|
||||
결재선 추가
|
||||
@@ -379,7 +315,7 @@ function ElaprApprovalDialog({
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
>
|
||||
<Table caption="결재 진행 현황 목록으로 결재순서, 결재구분, 결재자, 전결자 지정, 결재상태, 관리 정보 제공" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="8%" />
|
||||
@@ -409,11 +345,11 @@ function ElaprApprovalDialog({
|
||||
<SortablePrgrsSttsRow
|
||||
key={row.rowKey}
|
||||
row={row}
|
||||
displaySeqNo={isForkJoin ? Number(row.atrzSeqNo ?? index + 1) : index + 1}
|
||||
displaySeqNo={index + 1}
|
||||
isEditing={editingRowKey === row.rowKey}
|
||||
isLocked={isEditingLocked}
|
||||
dragDisabled={
|
||||
isForkJoin || isEditingLocked || !isPrgrsSttsRowEditable(row) || !row.atrzSeComCd
|
||||
isEditingLocked || !isPrgrsSttsRowEditable(row) || !row.atrzSeComCd
|
||||
}
|
||||
onStartEdit={() => startEdit(row.rowKey)}
|
||||
onSave={() => handleRowSave(row.rowKey)}
|
||||
@@ -436,17 +372,6 @@ function ElaprApprovalDialog({
|
||||
|
||||
{canApprove && (
|
||||
<div>
|
||||
{isForkJoin && canReject && (
|
||||
<div className="mb-2 space-y-1 rounded-md border border-amber-300 bg-amber-50 p-3 text-xs text-amber-900">
|
||||
<div className="font-bold">⚠️ [단계별 반려 안내 (10월 12일 개정)]</div>
|
||||
<p>현재 복합사업 병렬 검토가 진행 중입니다. 본 단계에서 반려 처리 시:</p>
|
||||
<ul className="list-disc pl-4 space-y-0.5">
|
||||
<li>귀하(현재 결재자)는 반려(ATRZ_PRGRS_004) 처리됩니다.</li>
|
||||
<li>이전(직전) 결재자만 '결재 대기중(ATRZ_PRGRS_002)'으로 변경되어 보완 및 재상신 기회가 부여됩니다.</li>
|
||||
<li>동시에 진행 중인 상대방 부서 결재는 중단되지 않고 독립 정상 진행됩니다.</li>
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
<h4 className="mb-3 text-xl font-semibold">반려 의견</h4>
|
||||
<Textarea
|
||||
value={rjctRsn}
|
||||
@@ -467,7 +392,7 @@ function ElaprApprovalDialog({
|
||||
{canApprove && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Button onClick={handleApprove} disabled={isBusy}>
|
||||
{approveButtonLabel}
|
||||
결재
|
||||
</Button>
|
||||
{canReject && (
|
||||
<Button color="red" onClick={handleReject} disabled={isBusy}>
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@common/components";
|
||||
|
||||
import { useElaprDocPrgrsByDocNo } from "../api/queries";
|
||||
import { getVisibleRows } from "../lib/apln-validators";
|
||||
import { mapDocPrgrsToForkJoinTrackRows } from "../lib/doc-prgrs-to-forkjoin-rows";
|
||||
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||
|
||||
import { ElaprForkJoinPickerGrid } from "./elapr-forkjoin-picker-grid";
|
||||
|
||||
export interface ElaprDocPrgrsForkJoinPickerConfirmPayload {
|
||||
aplnRows: ElaprAplnRow[];
|
||||
}
|
||||
|
||||
export interface ElaprDocPrgrsForkJoinPickerDialogProps {
|
||||
open: boolean;
|
||||
elaprDocNo: string;
|
||||
onClose: () => void;
|
||||
onConfirm?: (payload: ElaprDocPrgrsForkJoinPickerConfirmPayload) => void;
|
||||
}
|
||||
|
||||
export function ElaprDocPrgrsForkJoinPickerDialog({
|
||||
open,
|
||||
elaprDocNo,
|
||||
onClose,
|
||||
onConfirm,
|
||||
}: ElaprDocPrgrsForkJoinPickerDialogProps) {
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [aplnRows, setAplnRows] = useState<ElaprAplnRow[]>([]);
|
||||
const [isEditingLocked, setIsEditingLocked] = useState(false);
|
||||
|
||||
// 1차 결재(elaprCycl=1)에서 지정된 6인 결재선 조회
|
||||
const docPrgrsQuery = useElaprDocPrgrsByDocNo(elaprDocNo, {
|
||||
elaprCycl: 1,
|
||||
enabled: open && Boolean(elaprDocNo),
|
||||
});
|
||||
|
||||
// 1차 결재선 데이터를 3개 트랙(관로, 시설, 정책)으로 매핑
|
||||
const initialTrackRows = useMemo(
|
||||
() => mapDocPrgrsToForkJoinTrackRows(docPrgrsQuery.data),
|
||||
[docPrgrsQuery.data],
|
||||
);
|
||||
|
||||
const handleRowsChange = useCallback((rows: ElaprAplnRow[]) => {
|
||||
setAplnRows(rows);
|
||||
}, []);
|
||||
|
||||
const handleEditingLockedChange = useCallback((locked: boolean) => {
|
||||
setIsEditingLocked(locked);
|
||||
}, []);
|
||||
|
||||
function handleOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
setAplnRows([]);
|
||||
setIsEditingLocked(false);
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
if (isEditingLocked) {
|
||||
alert("편집 중인 결재선이 있습니다. 저장을 완료해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const unassigned = aplnRows.find((r) => !r.aprvrUuid);
|
||||
if (unassigned) {
|
||||
alert("지정되지 않은 결재자가 있습니다. 모든 트랙의 결재자를 선택해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const pipeRows = aplnRows
|
||||
.filter((r) => r.branchSeCd === "SP")
|
||||
.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
const facRows = aplnRows
|
||||
.filter((r) => r.branchSeCd === "SF")
|
||||
.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
const aggRows = aplnRows
|
||||
.filter((r) => r.branchSeCd === "TOTAL_AGG")
|
||||
.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
|
||||
// 1. 부서별 인원 수 (각각 최소 2명 이상, 최대 5명)
|
||||
if (pipeRows.length < 2 || pipeRows.length > 5) {
|
||||
alert("하수관로 검토 결재선에 결재자를 최소 2명 이상(최대 5명) 지정해 주세요.");
|
||||
return;
|
||||
}
|
||||
if (facRows.length < 2 || facRows.length > 5) {
|
||||
alert("하수처리시설 검토 결재선에 결재자를 최소 2명 이상(최대 5명) 지정해 주세요.");
|
||||
return;
|
||||
}
|
||||
if (aggRows.length < 2 || aggRows.length > 5) {
|
||||
alert("정책부 종합병합 결재선에 결재자를 최소 2명 이상(최대 5명) 지정해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 정책부 1순번 병합자(ATRZ04) 지정 검증
|
||||
if (aggRows[0]?.atrzSeComCd !== "ATRZ04") {
|
||||
alert("[정책부] 첫 번째 결재구분은 '병합(ATRZ04)'이어야 합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 정책부 최종 결재구분(ATRZ99) 지정 검증
|
||||
const lastAggRow = aggRows[aggRows.length - 1];
|
||||
if (lastAggRow?.atrzSeComCd !== "ATRZ99") {
|
||||
alert("[정책부] 최종 결재구분은 '최종승인(ATRZ99)'이어야 합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. 동일 브랜치 내 중복 결재자 검증
|
||||
const checkDuplicateInBranch = (rows: typeof pipeRows, branchName: string) => {
|
||||
const uuids = rows.map((r) => r.aprvrUuid).filter(Boolean);
|
||||
const uniqueUuids = new Set(uuids);
|
||||
if (uniqueUuids.size !== uuids.length) {
|
||||
const dupRow = rows.find((r, i) => uuids.indexOf(r.aprvrUuid) !== i);
|
||||
return `[${dupRow?.aprvrNm || "결재자"}] 결재자가 ${branchName} 결재선에 중복 지정되었습니다.`;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const pipeDup = checkDuplicateInBranch(pipeRows, "관로부");
|
||||
if (pipeDup) {
|
||||
alert(pipeDup);
|
||||
return;
|
||||
}
|
||||
const facDup = checkDuplicateInBranch(facRows, "시설부");
|
||||
if (facDup) {
|
||||
alert(facDup);
|
||||
return;
|
||||
}
|
||||
const aggDup = checkDuplicateInBranch(aggRows, "정책부");
|
||||
if (aggDup) {
|
||||
alert(aggDup);
|
||||
return;
|
||||
}
|
||||
|
||||
const visibleRows = getVisibleRows(aplnRows);
|
||||
onConfirm?.({ aplnRows: visibleRows });
|
||||
|
||||
setAplnRows([]);
|
||||
setIsEditingLocked(false);
|
||||
onClose();
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="max-w-[100rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>2차 결재선 선택 (복합사업 처리시설+하수관로 Fork-Join 3트랙)</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{/* 1차 결재자 자동 매핑 안내 배너 */}
|
||||
<div className="rounded-lg border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-900">
|
||||
<p className="font-semibold">
|
||||
ℹ️ 1차 기술검토 시 지정된 결재자(6인) 정보가 자동으로 매핑되었습니다.
|
||||
</p>
|
||||
<p className="mt-0.5 text-xs text-emerald-700">
|
||||
동일 결재선으로 진행하거나 필요 시 결재자 변경/순서 조정한 후 하단의 [확인] 버튼을 눌러
|
||||
2차 결재선을 확정해 주세요.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ElaprForkJoinPickerGrid
|
||||
initialTrackRows={initialTrackRows}
|
||||
onRowsChange={handleRowsChange}
|
||||
onEditingLockedChange={handleEditingLockedChange}
|
||||
/>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={() => handleOpenChange(false)}>
|
||||
닫기
|
||||
</Button>
|
||||
<Button type="button" disabled={isEditingLocked} onClick={handleConfirm}>
|
||||
확인
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { ArrowDown, ArrowRight, CheckCircle2, ChevronRight, GitFork, GitMerge } from "lucide-react";
|
||||
|
||||
import { dayjs } from "@/shared/lib";
|
||||
import type { ElaprDocPrgrsClientResponseDto } from "@/shared/model";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
|
||||
import { cn } from "@common/components";
|
||||
|
||||
import { getApproverStatus } from "../lib/approval-utils";
|
||||
|
||||
const REJECT_STATUS_CD = "ATRZ_PRGRS_004";
|
||||
|
||||
interface ElaprDocPrgrsForkJoinStepProps {
|
||||
steps: ElaprDocPrgrsClientResponseDto[];
|
||||
}
|
||||
|
||||
function ApproverCard({ item }: { item: ElaprDocPrgrsClientResponseDto }) {
|
||||
const status = getApproverStatus(item.atrzPrgrsSttsComCd, item.atrzSeComCd);
|
||||
const isRejected = item.atrzPrgrsSttsComCd === REJECT_STATUS_CD;
|
||||
const isCurrent = item.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002";
|
||||
const rjctRsn = item.rjctRsn?.trim();
|
||||
const metaParts = [item.ognzNm, item.jbpsSeNm].filter(Boolean);
|
||||
|
||||
const statusBadge = (
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center rounded-sm px-3 py-1 text-sm font-semibold",
|
||||
status.badgeClass,
|
||||
isCurrent && "animate-pulse ring-2 ring-blue-400",
|
||||
isRejected && rjctRsn && "cursor-help underline decoration-dotted underline-offset-4",
|
||||
)}
|
||||
>
|
||||
{status.label}
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex min-w-[13rem] flex-1 flex-col items-center gap-2 rounded-lg border border-gray-200 bg-white p-4 text-center shadow-xs">
|
||||
{isRejected && rjctRsn ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{statusBadge}</TooltipTrigger>
|
||||
<TooltipContent sideOffset={4} className="max-w-md whitespace-pre-wrap">
|
||||
{rjctRsn}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
statusBadge
|
||||
)}
|
||||
<div className="flex flex-col items-center gap-1">
|
||||
<p className="text-base font-semibold text-gray-900">
|
||||
<span className="text-muted-foreground">[{item.atrzSeComNm || "-"}]</span>{" "}
|
||||
{item.aprvrNm || item.aprvrUuid || "-"}
|
||||
</p>
|
||||
{metaParts.length > 0 && (
|
||||
<span className="text-xs text-gray-500">{metaParts.join(" · ")}</span>
|
||||
)}
|
||||
{item.atrzDt && (
|
||||
<span className="text-xs text-gray-400">{dayjs(item.atrzDt).format("MM-DD HH:mm")}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ElaprDocPrgrsForkJoinStep({ steps }: ElaprDocPrgrsForkJoinStepProps) {
|
||||
// 브랜치별 분할 (branchSeCd 우선, 없으면 seqNo fallback)
|
||||
const { pipeSteps, facSteps, aggSteps } = useMemo(() => {
|
||||
const pipe: ElaprDocPrgrsClientResponseDto[] = [];
|
||||
const fac: ElaprDocPrgrsClientResponseDto[] = [];
|
||||
const agg: ElaprDocPrgrsClientResponseDto[] = [];
|
||||
|
||||
steps.forEach((step) => {
|
||||
const seCd = step.branchSeCd;
|
||||
if (seCd === "SP") {
|
||||
pipe.push(step);
|
||||
} else if (seCd === "SF") {
|
||||
fac.push(step);
|
||||
} else if (seCd === "TOTAL_AGG") {
|
||||
agg.push(step);
|
||||
} else {
|
||||
// 순번 fallback (6인 체제: 2/2/2)
|
||||
const seq = Number(step.atrzSeqNo ?? 1);
|
||||
if (seq <= 2) pipe.push(step);
|
||||
else if (seq <= 4) fac.push(step);
|
||||
else agg.push(step);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
pipeSteps: pipe.sort((a, b) => Number(a.atrzSeqNo) - Number(b.atrzSeqNo)),
|
||||
facSteps: fac.sort((a, b) => Number(a.atrzSeqNo) - Number(b.atrzSeqNo)),
|
||||
aggSteps: agg.sort((a, b) => Number(a.atrzSeqNo) - Number(b.atrzSeqNo)),
|
||||
};
|
||||
}, [steps]);
|
||||
|
||||
// 완료 상태 및 결재 완료 수 동적 판정
|
||||
const pipeCompletedCount = pipeSteps.filter((s) => s.atrzPrgrsSttsComCd === "ATRZ_PRGRS_003").length;
|
||||
const isPipeCompleted =
|
||||
pipeSteps.length > 0 && pipeCompletedCount === pipeSteps.length;
|
||||
|
||||
const facCompletedCount = facSteps.filter((s) => s.atrzPrgrsSttsComCd === "ATRZ_PRGRS_003").length;
|
||||
const isFacCompleted =
|
||||
facSteps.length > 0 && facCompletedCount === facSteps.length;
|
||||
const isJoinReady = isPipeCompleted && isFacCompleted;
|
||||
|
||||
const stage2CountText =
|
||||
pipeSteps.length === facSteps.length
|
||||
? `(각 ${pipeSteps.length}인)`
|
||||
: `(관로 ${pipeSteps.length}인 / 시설 ${facSteps.length}인)`;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6 p-2">
|
||||
<div className="flex flex-col gap-6 lg:flex-row lg:items-stretch">
|
||||
{/* Stage 2: 상/하 2열 병렬 트랙 */}
|
||||
<div className="flex flex-1 flex-col gap-4 rounded-xl border border-blue-100 bg-blue-50/40 p-4">
|
||||
<div className="flex items-center gap-2 border-b border-blue-200/60 pb-2">
|
||||
<GitFork className="size-5 text-blue-600" />
|
||||
<h4 className="text-base font-bold text-blue-950">
|
||||
Stage 2: 부서별 병렬 전문검토 {stage2CountText}
|
||||
</h4>
|
||||
<span className="rounded-full bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-800">
|
||||
동시 진행
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 1) 관로부 트랙 */}
|
||||
<div className="rounded-lg border border-cyan-200 bg-cyan-50/50 p-3">
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<span className="text-sm font-bold text-cyan-900">🌊 하수관로 전문검토</span>
|
||||
<span
|
||||
className={`text-xs font-semibold px-2 py-0.5 rounded-full ${
|
||||
isPipeCompleted
|
||||
? "bg-emerald-100 text-emerald-800"
|
||||
: "bg-cyan-100 text-cyan-800"
|
||||
}`}
|
||||
>
|
||||
{isPipeCompleted
|
||||
? `병합에 회신 완료 (${pipeCompletedCount}/${pipeSteps.length})`
|
||||
: `진행중 (${pipeCompletedCount}/${pipeSteps.length})`}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{pipeSteps.map((item, idx) => (
|
||||
<div key={item.elaprPrgrsId ?? idx} className="flex items-center gap-2">
|
||||
<ApproverCard item={item} />
|
||||
{idx < pipeSteps.length - 1 && (
|
||||
<ChevronRight className="size-5 text-cyan-400" />
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 2) 시설부 트랙 */}
|
||||
<div className="rounded-lg border border-indigo-200 bg-indigo-50/50 p-3">
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<span className="text-sm font-bold text-indigo-900">🏭 하수처리시설 전문검토</span>
|
||||
<span
|
||||
className={`text-xs font-semibold px-2 py-0.5 rounded-full ${
|
||||
isFacCompleted
|
||||
? "bg-emerald-100 text-emerald-800"
|
||||
: "bg-indigo-100 text-indigo-800"
|
||||
}`}
|
||||
>
|
||||
{isFacCompleted
|
||||
? `병합에 회신 완료 (${facCompletedCount}/${facSteps.length})`
|
||||
: `진행중 (${facCompletedCount}/${facSteps.length})`}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{facSteps.map((item, idx) => (
|
||||
<div key={item.elaprPrgrsId ?? idx} className="flex items-center gap-2">
|
||||
<ApproverCard item={item} />
|
||||
{idx < facSteps.length - 1 && (
|
||||
<ChevronRight className="size-5 text-indigo-400" />
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* JOIN 합류 다이어그램 연결 */}
|
||||
<div className="flex items-center justify-center px-2">
|
||||
<div className="flex flex-col items-center gap-2 rounded-xl border border-emerald-200 bg-emerald-50/80 p-4 text-center shadow-xs">
|
||||
<GitMerge className="size-6 text-emerald-600" />
|
||||
<span className="text-xs font-bold text-emerald-900">JOIN 합류</span>
|
||||
<div className="flex flex-col gap-1 text-[11px] text-emerald-800">
|
||||
<span className="flex items-center gap-1">
|
||||
{isPipeCompleted ? "🟢" : "⏳"} 관로 {isPipeCompleted ? "완료" : "대기"}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
{isFacCompleted ? "🟢" : "⏳"} 시설 {isFacCompleted ? "완료" : "대기"}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className={`mt-1 rounded-sm px-2 py-1 text-xs font-bold ${
|
||||
isJoinReady
|
||||
? "bg-emerald-200 text-emerald-900"
|
||||
: "bg-gray-200 text-gray-700"
|
||||
}`}
|
||||
>
|
||||
{isJoinReady ? "Stage 3 활성화됨" : "병렬 대기중"}
|
||||
</div>
|
||||
<ArrowRight className="hidden size-5 text-emerald-600 lg:block" />
|
||||
<ArrowDown className="size-5 text-emerald-600 lg:hidden" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stage 3: 정책총괄부 종합취합 및 환경청 회신 트랙 */}
|
||||
<div className="flex flex-1 flex-col gap-4 rounded-xl border border-purple-100 bg-purple-50/40 p-4">
|
||||
<div className="flex items-center gap-2 border-b border-purple-200/60 pb-2">
|
||||
<CheckCircle2 className="size-5 text-purple-600" />
|
||||
<h4 className="text-base font-bold text-purple-950">
|
||||
Stage 3: 정책총괄 종합병합 및 환경청 회신 ({aggSteps.length}인)
|
||||
</h4>
|
||||
<span
|
||||
className={`rounded-full px-2 py-0.5 text-xs font-semibold ${
|
||||
isJoinReady
|
||||
? "bg-purple-100 text-purple-800"
|
||||
: "bg-gray-100 text-gray-600"
|
||||
}`}
|
||||
>
|
||||
{isJoinReady ? "진행 가능" : "대기"}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2 rounded-lg border border-purple-200 bg-purple-50/50 p-3">
|
||||
{aggSteps.map((item, idx) => (
|
||||
<div key={item.elaprPrgrsId ?? idx} className="flex items-center gap-2">
|
||||
<ApproverCard item={item} />
|
||||
{idx < aggSteps.length - 1 && (
|
||||
<ChevronRight className="size-5 text-purple-400" />
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -13,13 +13,10 @@ import { cn, Skeleton, Tabs, TabsContent, TabsList, TabsTrigger } from "@common/
|
||||
import { useElaprDocPrgrsByDocNo } from "../api/queries";
|
||||
import { getApproverStatus, sortByAtrzSeqNo } from "../lib/approval-utils";
|
||||
|
||||
import { ElaprDocPrgrsForkJoinStep } from "./elapr-doc-prgrs-forkjoin-step";
|
||||
|
||||
const REJECT_STATUS_CD = "ATRZ_PRGRS_004";
|
||||
|
||||
interface ElaprDocPrgrsStatusProps {
|
||||
elaprDocNo: string | null | undefined;
|
||||
taskSeComCd?: string | null;
|
||||
}
|
||||
|
||||
function ElaprDocPrgrsStep({ item }: { item: ElaprDocPrgrsClientResponseDto }) {
|
||||
@@ -91,33 +88,21 @@ function ElaprDocPrgrsStepList({ steps }: { steps: ElaprDocPrgrsClientResponseDt
|
||||
);
|
||||
}
|
||||
|
||||
function ElaprDocPrgrsStatus({ elaprDocNo, taskSeComCd }: ElaprDocPrgrsStatusProps) {
|
||||
function ElaprDocPrgrsStatus({ elaprDocNo }: ElaprDocPrgrsStatusProps) {
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const { data, isLoading } = useElaprDocPrgrsByDocNo(elaprDocNo);
|
||||
const [activeCycl, setActiveCycl] = useState<"1" | "2">("1");
|
||||
|
||||
const { cycl1Steps, cycl2Steps, hasCycl2, isForkJoin1, isForkJoin2 } = useMemo(() => {
|
||||
const { cycl1Steps, cycl2Steps, hasCycl2 } = useMemo(() => {
|
||||
const rows = data ?? [];
|
||||
const cycl1 = sortByAtrzSeqNo(rows.filter((item) => Number(item.elaprCycl ?? 1) !== 2));
|
||||
const cycl2 = sortByAtrzSeqNo(rows.filter((item) => Number(item.elaprCycl) === 2));
|
||||
|
||||
const checkForkJoin = (list: typeof rows) =>
|
||||
taskSeComCd === "SF_SP" ||
|
||||
list.some(
|
||||
(s) =>
|
||||
(s as { branchSeCd?: string }).branchSeCd === "SP" ||
|
||||
(s as { branchSeCd?: string }).branchSeCd === "SF",
|
||||
) ||
|
||||
list.length >= 6;
|
||||
|
||||
return {
|
||||
cycl1Steps: cycl1,
|
||||
cycl2Steps: cycl2,
|
||||
hasCycl2: cycl2.length > 0,
|
||||
isForkJoin1: checkForkJoin(cycl1),
|
||||
isForkJoin2: checkForkJoin(cycl2),
|
||||
};
|
||||
}, [data, taskSeComCd]);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
setActiveCycl(hasCycl2 ? "2" : "1");
|
||||
@@ -153,33 +138,23 @@ function ElaprDocPrgrsStatus({ elaprDocNo, taskSeComCd }: ElaprDocPrgrsStatusPro
|
||||
>
|
||||
<TabsList>
|
||||
<TabsTrigger value="1" className="!px-6 !py-3 text-xl">
|
||||
1차 실무협의 (기술검토)
|
||||
재원협의
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="2" className="!px-6 !py-3 text-xl">
|
||||
2차 조치결과 검토 (종결)
|
||||
실무협의서
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="1" className="mt-2 border-none p-0 shadow-none">
|
||||
<div className="-mx-2">
|
||||
{isForkJoin1 ? (
|
||||
<ElaprDocPrgrsForkJoinStep steps={cycl1Steps} />
|
||||
) : (
|
||||
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
||||
)}
|
||||
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="2" className="mt-2 border-none p-0 shadow-none">
|
||||
<div className="-mx-2">
|
||||
{isForkJoin2 ? (
|
||||
<ElaprDocPrgrsForkJoinStep steps={cycl2Steps} />
|
||||
) : (
|
||||
<ElaprDocPrgrsStepList steps={cycl2Steps} />
|
||||
)}
|
||||
<ElaprDocPrgrsStepList steps={cycl2Steps} />
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
) : isForkJoin1 ? (
|
||||
<ElaprDocPrgrsForkJoinStep steps={cycl1Steps} />
|
||||
) : (
|
||||
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
||||
)}
|
||||
|
||||
@@ -1,472 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { closestCenter, DndContext, type DragEndEvent } from "@dnd-kit/core";
|
||||
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import {
|
||||
Button,
|
||||
Table,
|
||||
TableBody,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Tabs,
|
||||
TabsContent,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
} from "@common/components";
|
||||
|
||||
import { useDndSensors } from "../lib/use-dnd-sensors";
|
||||
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||
import type { ReviewerOption } from "../model/reviewer-option";
|
||||
|
||||
import { AprvrPickerDialog } from "./aprvr-picker-dialog";
|
||||
import { SortableAplnPickerRow } from "./sortable-apln-picker-row";
|
||||
|
||||
type ForkJoinTrackKey = "SP" | "SF" | "TOTAL_AGG";
|
||||
|
||||
interface TrackConfig {
|
||||
key: ForkJoinTrackKey;
|
||||
label: string;
|
||||
defaultDeptNm: string;
|
||||
guideText: string;
|
||||
minCount: number;
|
||||
maxCount: number;
|
||||
}
|
||||
|
||||
const TRACK_CONFIGS: TrackConfig[] = [
|
||||
{
|
||||
key: "SP",
|
||||
label: "하수관로 검토",
|
||||
defaultDeptNm: "하수관로부",
|
||||
guideText: "ℹ️ 하수관로 부서 검토·승인 완료 시 종합병합부서로 내부 회신(이관)됩니다.",
|
||||
minCount: 2,
|
||||
maxCount: 5,
|
||||
},
|
||||
{
|
||||
key: "SF",
|
||||
label: "하수처리시설 검토",
|
||||
defaultDeptNm: "하수처리시설부",
|
||||
guideText: "ℹ️ 하수처리시설 부서 검토·승인 완료 시 종합병합부서로 내부 회신(이관)됩니다.",
|
||||
minCount: 2,
|
||||
maxCount: 5,
|
||||
},
|
||||
{
|
||||
key: "TOTAL_AGG",
|
||||
label: "정책부 종합병합",
|
||||
defaultDeptNm: "정책총괄부",
|
||||
guideText: "ℹ️ 두 부서(관로+시설) Join 완료 후 정책취합 및 환경청 회신 단계로 진행됩니다.",
|
||||
minCount: 2,
|
||||
maxCount: 5,
|
||||
},
|
||||
];
|
||||
|
||||
function createDefaultRow(
|
||||
branchSeCd: ForkJoinTrackKey,
|
||||
deptNm: string,
|
||||
seq: number,
|
||||
seComCd: string,
|
||||
): ElaprAplnRow {
|
||||
return {
|
||||
rowKey: `forkjoin-${branchSeCd}-${seq}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
||||
elaprTmpltId: "TMPLT_SF_SP_FORKJOIN",
|
||||
atrzSeqNo: seq,
|
||||
atrzSeComCd: seComCd,
|
||||
aprvrDeptNm: deptNm,
|
||||
branchSeCd,
|
||||
isNew: true,
|
||||
isDirty: false,
|
||||
dcarbYn: seComCd === "ATRZ99" ? "Y" : "N",
|
||||
};
|
||||
}
|
||||
|
||||
export function createDefaultTrackRows(
|
||||
perTrackCount: number = 2,
|
||||
): Record<ForkJoinTrackKey, ElaprAplnRow[]> {
|
||||
const safeCount = Math.max(2, Math.min(5, perTrackCount));
|
||||
const sp: ElaprAplnRow[] = [];
|
||||
const sf: ElaprAplnRow[] = [];
|
||||
const totalAgg: ElaprAplnRow[] = [];
|
||||
|
||||
for (let seq = 1; seq <= safeCount; seq++) {
|
||||
sp.push(
|
||||
createDefaultRow(
|
||||
"SP",
|
||||
"하수관로부",
|
||||
seq,
|
||||
seq === 1 ? "ATRZ02" : "ATRZ03",
|
||||
),
|
||||
);
|
||||
sf.push(
|
||||
createDefaultRow(
|
||||
"SF",
|
||||
"하수처리시설부",
|
||||
seq,
|
||||
seq === 1 ? "ATRZ02" : "ATRZ03",
|
||||
),
|
||||
);
|
||||
totalAgg.push(
|
||||
createDefaultRow(
|
||||
"TOTAL_AGG",
|
||||
"정책총괄부",
|
||||
seq,
|
||||
seq === 1 ? "ATRZ04" : seq === safeCount ? "ATRZ99" : "ATRZ03",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return { SP: sp, SF: sf, TOTAL_AGG: totalAgg };
|
||||
}
|
||||
|
||||
export interface ElaprForkJoinPickerGridProps {
|
||||
onRowsChange?: (rows: ElaprAplnRow[]) => void;
|
||||
onEditingLockedChange?: (locked: boolean) => void;
|
||||
initialTrackRows?: Record<ForkJoinTrackKey, ElaprAplnRow[]> | null;
|
||||
/** 트랙당 기본 초기 결재자 수 (기본 2명, 필요 시 3명 지원) */
|
||||
defaultPerTrack?: number;
|
||||
}
|
||||
|
||||
export function ElaprForkJoinPickerGrid({
|
||||
onRowsChange,
|
||||
onEditingLockedChange,
|
||||
initialTrackRows,
|
||||
defaultPerTrack = 2,
|
||||
}: ElaprForkJoinPickerGridProps) {
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [activeTab, setActiveTab] = useState<ForkJoinTrackKey>("SP");
|
||||
|
||||
// 3개 트랙별 결재선 상태 (기본 2인 또는 3인 초기화 지원)
|
||||
const [trackRows, setTrackRows] = useState<Record<ForkJoinTrackKey, ElaprAplnRow[]>>(() => {
|
||||
if (initialTrackRows) {
|
||||
return {
|
||||
SP: initialTrackRows.SP ?? [],
|
||||
SF: initialTrackRows.SF ?? [],
|
||||
TOTAL_AGG: initialTrackRows.TOTAL_AGG ?? [],
|
||||
};
|
||||
}
|
||||
return createDefaultTrackRows(defaultPerTrack);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (initialTrackRows) {
|
||||
setTrackRows({
|
||||
SP: initialTrackRows.SP ?? [],
|
||||
SF: initialTrackRows.SF ?? [],
|
||||
TOTAL_AGG: initialTrackRows.TOTAL_AGG ?? [],
|
||||
});
|
||||
}
|
||||
}, [initialTrackRows]);
|
||||
|
||||
const [editingRowKey, setEditingRowKey] = useState<string | null>(null);
|
||||
const [pickerOpen, setPickerOpen] = useState(false);
|
||||
const [pickingRowKey, setPickingRowKey] = useState<string | null>(null);
|
||||
|
||||
const sensors = useDndSensors();
|
||||
|
||||
// 통합 전체 결재선 목록
|
||||
const allRows = useMemo(() => {
|
||||
return [...(trackRows.SP ?? []), ...(trackRows.SF ?? []), ...(trackRows.TOTAL_AGG ?? [])];
|
||||
}, [trackRows]);
|
||||
|
||||
useEffect(() => {
|
||||
onRowsChange?.(allRows);
|
||||
}, [allRows, onRowsChange]);
|
||||
|
||||
useEffect(() => {
|
||||
onEditingLockedChange?.(editingRowKey !== null);
|
||||
}, [editingRowKey, onEditingLockedChange]);
|
||||
|
||||
const currentTrackConfig = useMemo(() => {
|
||||
return TRACK_CONFIGS.find((c) => c.key === activeTab) ?? TRACK_CONFIGS[0];
|
||||
}, [activeTab]);
|
||||
|
||||
const currentRows = trackRows[activeTab] ?? [];
|
||||
|
||||
const pickingRow = useMemo(() => {
|
||||
if (!pickingRowKey) return undefined;
|
||||
return allRows.find((r) => r.rowKey === pickingRowKey);
|
||||
}, [pickingRowKey, allRows]);
|
||||
|
||||
// 행 추가 (부서별 최대 5명 제한)
|
||||
const handleAddRow = useCallback(() => {
|
||||
if (editingRowKey) {
|
||||
alert("편집 중인 결재선이 있습니다. 저장 또는 취소 후 추가해 주세요.");
|
||||
return;
|
||||
}
|
||||
if (currentRows.length >= currentTrackConfig.maxCount) {
|
||||
alert(`[${currentTrackConfig.label}] 결재선은 최대 ${currentTrackConfig.maxCount}명까지 지정 가능합니다.`);
|
||||
return;
|
||||
}
|
||||
const newSeq = currentRows.length + 1;
|
||||
let defaultSeComCd = "ATRZ02";
|
||||
if (activeTab === "TOTAL_AGG") {
|
||||
defaultSeComCd = newSeq === 1 ? "ATRZ04" : "ATRZ99";
|
||||
} else {
|
||||
defaultSeComCd = newSeq === 1 ? "ATRZ02" : "ATRZ03";
|
||||
}
|
||||
|
||||
const newRow = createDefaultRow(
|
||||
activeTab,
|
||||
currentTrackConfig.defaultDeptNm,
|
||||
newSeq,
|
||||
defaultSeComCd,
|
||||
);
|
||||
setTrackRows((prev) => {
|
||||
const list = [...prev[activeTab]];
|
||||
if (activeTab === "TOTAL_AGG" && list.length > 0) {
|
||||
const lastIdx = list.length - 1;
|
||||
if (list[lastIdx].atrzSeComCd === "ATRZ99") {
|
||||
list[lastIdx] = {
|
||||
...list[lastIdx],
|
||||
atrzSeComCd: "ATRZ03",
|
||||
dcarbYn: "N",
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
...prev,
|
||||
[activeTab]: [...list, newRow],
|
||||
};
|
||||
});
|
||||
setEditingRowKey(newRow.rowKey);
|
||||
}, [activeTab, currentRows.length, currentTrackConfig, editingRowKey, alert]);
|
||||
|
||||
// 편집 시작
|
||||
const handleStartEdit = useCallback((rowKey: string) => {
|
||||
const target = currentRows.find((r) => r.rowKey === rowKey);
|
||||
if (!target) return;
|
||||
target.snapshot = { ...target };
|
||||
setEditingRowKey(rowKey);
|
||||
}, [currentRows]);
|
||||
|
||||
// 편집 취소
|
||||
const handleCancelEdit = useCallback(() => {
|
||||
if (!editingRowKey) return;
|
||||
setTrackRows((prev) => {
|
||||
const list = prev[activeTab];
|
||||
const target = list.find((r) => r.rowKey === editingRowKey);
|
||||
if (target?.isNew && !target.aprvrUuid) {
|
||||
return {
|
||||
...prev,
|
||||
[activeTab]: list.filter((r) => r.rowKey !== editingRowKey),
|
||||
};
|
||||
}
|
||||
if (target?.snapshot) {
|
||||
return {
|
||||
...prev,
|
||||
[activeTab]: list.map((r) =>
|
||||
r.rowKey === editingRowKey ? { ...r.snapshot!, snapshot: undefined } : r,
|
||||
),
|
||||
};
|
||||
}
|
||||
return prev;
|
||||
});
|
||||
setEditingRowKey(null);
|
||||
}, [activeTab, editingRowKey]);
|
||||
|
||||
// 행 필드 수정
|
||||
const handleUpdateRow = useCallback(
|
||||
(rowKey: string, patch: Partial<ElaprAplnRow>) => {
|
||||
setTrackRows((prev) => ({
|
||||
...prev,
|
||||
[activeTab]: prev[activeTab].map((r) =>
|
||||
r.rowKey === rowKey ? { ...r, ...patch, isDirty: true } : r,
|
||||
),
|
||||
}));
|
||||
},
|
||||
[activeTab],
|
||||
);
|
||||
|
||||
// 저장 (커밋)
|
||||
const handleCommitEdit = useCallback((rowKey: string) => {
|
||||
setTrackRows((prev) => ({
|
||||
...prev,
|
||||
[activeTab]: prev[activeTab].map((r) =>
|
||||
r.rowKey === rowKey ? { ...r, isDirty: false, isNew: false, snapshot: undefined } : r,
|
||||
),
|
||||
}));
|
||||
setEditingRowKey(null);
|
||||
}, [activeTab]);
|
||||
|
||||
// 행 삭제
|
||||
const handleDeleteRow = useCallback(
|
||||
(rowKey: string) => {
|
||||
setTrackRows((prev) => {
|
||||
const nextList = prev[activeTab]
|
||||
.filter((r) => r.rowKey !== rowKey)
|
||||
.map((r, idx) => ({ ...r, atrzSeqNo: idx + 1 }));
|
||||
return {
|
||||
...prev,
|
||||
[activeTab]: nextList,
|
||||
};
|
||||
});
|
||||
if (editingRowKey === rowKey) {
|
||||
setEditingRowKey(null);
|
||||
}
|
||||
},
|
||||
[activeTab, editingRowKey],
|
||||
);
|
||||
|
||||
// 드래그 순서 재정렬
|
||||
const handleDragEnd = useCallback(
|
||||
(event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
if (!over || active.id === over.id) return;
|
||||
|
||||
setTrackRows((prev) => {
|
||||
const items = [...prev[activeTab]];
|
||||
const oldIndex = items.findIndex((r) => r.rowKey === active.id);
|
||||
const newIndex = items.findIndex((r) => r.rowKey === over.id);
|
||||
if (oldIndex === -1 || newIndex === -1) return prev;
|
||||
|
||||
const [moved] = items.splice(oldIndex, 1);
|
||||
items.splice(newIndex, 0, moved);
|
||||
|
||||
const reordered = items.map((r, idx) => ({
|
||||
...r,
|
||||
atrzSeqNo: idx + 1,
|
||||
isDirty: true,
|
||||
}));
|
||||
|
||||
return {
|
||||
...prev,
|
||||
[activeTab]: reordered,
|
||||
};
|
||||
});
|
||||
},
|
||||
[activeTab],
|
||||
);
|
||||
|
||||
// 결재자 선택 팝업 오픈
|
||||
const handlePickApprover = useCallback((rowKey: string) => {
|
||||
setPickingRowKey(rowKey);
|
||||
setPickerOpen(true);
|
||||
}, []);
|
||||
|
||||
// 결재자 선택 완료
|
||||
const handleSelectReviewer = useCallback(
|
||||
(reviewer: ReviewerOption) => {
|
||||
if (!pickingRowKey) return;
|
||||
handleUpdateRow(pickingRowKey, {
|
||||
aprvrUuid: reviewer.uuid,
|
||||
aprvrNm: reviewer.name,
|
||||
aprvrDeptNm: reviewer.deptNm ?? currentTrackConfig.defaultDeptNm,
|
||||
});
|
||||
setPickingRowKey(null);
|
||||
setPickerOpen(false);
|
||||
},
|
||||
[pickingRowKey, handleUpdateRow, currentTrackConfig.defaultDeptNm],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex flex-1 flex-col gap-4">
|
||||
{/* 3트랙 탭 헤더 */}
|
||||
<Tabs value={activeTab} onValueChange={(val) => setActiveTab(val as ForkJoinTrackKey)}>
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
{TRACK_CONFIGS.map((track) => {
|
||||
const count = trackRows[track.key].filter((r) => Boolean(r.aprvrUuid)).length;
|
||||
const total = trackRows[track.key].length;
|
||||
const isFull = count >= track.minCount;
|
||||
return (
|
||||
<TabsTrigger
|
||||
key={track.key}
|
||||
value={track.key}
|
||||
className="flex items-center gap-2 py-3 text-lg font-semibold"
|
||||
>
|
||||
<span>{track.label}</span>
|
||||
<span
|
||||
className={`rounded-full px-2 py-0.5 text-xs font-bold ${
|
||||
isFull
|
||||
? "bg-emerald-100 text-emerald-700"
|
||||
: "bg-amber-100 text-amber-700"
|
||||
}`}
|
||||
>
|
||||
{count}/{total}
|
||||
</span>
|
||||
</TabsTrigger>
|
||||
);
|
||||
})}
|
||||
</TabsList>
|
||||
|
||||
{TRACK_CONFIGS.map((track) => (
|
||||
<TabsContent key={track.key} value={track.key} className="mt-3">
|
||||
<div className="mb-3 flex items-center justify-between rounded-lg bg-blue-50 p-3 text-blue-900">
|
||||
<span className="text-sm font-medium">{track.guideText}</span>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color="white"
|
||||
onClick={handleAddRow}
|
||||
disabled={Boolean(editingRowKey) || trackRows[track.key].length >= track.maxCount}
|
||||
>
|
||||
+ 결재자 추가
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* 해당 탭 결재선 테이블 */}
|
||||
<div className="rounded-lg border border-gray-200">
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
>
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="6%" />
|
||||
<col width="10%" />
|
||||
<col width="24%" />
|
||||
<col width="44%" />
|
||||
<col width="16%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-8" />
|
||||
<TableHead>순서</TableHead>
|
||||
<TableHead>결재구분</TableHead>
|
||||
<TableHead>결재자 (성명/부서)</TableHead>
|
||||
<TableHead>관리</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<SortableContext
|
||||
items={trackRows[track.key].map((r) => r.rowKey)}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
{trackRows[track.key].map((row, index) => (
|
||||
<SortableAplnPickerRow
|
||||
key={row.rowKey}
|
||||
row={row}
|
||||
displaySeqNo={index + 1}
|
||||
dragDisabled={Boolean(editingRowKey)}
|
||||
isEditing={editingRowKey === row.rowKey}
|
||||
isLocked={Boolean(editingRowKey && editingRowKey !== row.rowKey)}
|
||||
onStartEdit={() => handleStartEdit(row.rowKey)}
|
||||
onSave={() => handleCommitEdit(row.rowKey)}
|
||||
onCancel={handleCancelEdit}
|
||||
onDelete={() => handleDeleteRow(row.rowKey)}
|
||||
onChange={(patch) => handleUpdateRow(row.rowKey, patch)}
|
||||
onPickAprvr={() => handlePickApprover(row.rowKey)}
|
||||
/>
|
||||
))}
|
||||
</SortableContext>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</DndContext>
|
||||
</div>
|
||||
</TabsContent>
|
||||
))}
|
||||
</Tabs>
|
||||
|
||||
{/* 결재자 검색 팝업 */}
|
||||
<AprvrPickerDialog
|
||||
open={pickerOpen}
|
||||
onOpenChange={setPickerOpen}
|
||||
atrzSeComCd={pickingRow?.atrzSeComCd ?? ""}
|
||||
onSelect={handleSelectReviewer}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||
import type { ElaprTmplt } from "../model/elapr-tmplt-interface";
|
||||
|
||||
import { ElaprAplnPickerGrid } from "./elapr-apln-picker-grid";
|
||||
import { ElaprForkJoinPickerGrid } from "./elapr-forkjoin-picker-grid";
|
||||
import { ElaprTmpltSelectTable } from "./elapr-tmplt-select-table";
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
@@ -38,7 +37,6 @@ interface ElaprTmpltPickerDialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
docSeComCd: string;
|
||||
taskSeComCd?: string | null;
|
||||
onSelect?: (tmplt: ElaprTmplt) => void;
|
||||
onConfirm?: (payload: ElaprTmpltPickerConfirmPayload) => void;
|
||||
}
|
||||
@@ -47,7 +45,6 @@ function ElaprTmpltPickerDialog({
|
||||
open,
|
||||
onClose,
|
||||
docSeComCd,
|
||||
taskSeComCd,
|
||||
onSelect,
|
||||
onConfirm,
|
||||
}: ElaprTmpltPickerDialogProps) {
|
||||
@@ -56,8 +53,6 @@ function ElaprTmpltPickerDialog({
|
||||
const [aplnRows, setAplnRows] = useState<ElaprAplnRow[]>([]);
|
||||
const [isEditingLocked, setIsEditingLocked] = useState(false);
|
||||
|
||||
const isForkJoinMode = docSeComCd === "FNRS" && taskSeComCd === "SF_SP";
|
||||
|
||||
const tmpltQuery = useElaprTmpltPage({
|
||||
page: 0,
|
||||
size: PAGE_SIZE,
|
||||
@@ -75,9 +70,7 @@ function ElaprTmpltPickerDialog({
|
||||
|
||||
function handleSelectTmplt(tmplt: ElaprTmplt | null) {
|
||||
setSelectedTmplt(tmplt);
|
||||
if (!isForkJoinMode) {
|
||||
setAplnRows([]);
|
||||
}
|
||||
setAplnRows([]);
|
||||
setIsEditingLocked(false);
|
||||
}
|
||||
|
||||
@@ -91,110 +84,11 @@ function ElaprTmpltPickerDialog({
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
if (!selectedTmplt && !isForkJoinMode) {
|
||||
if (!selectedTmplt) {
|
||||
alert("결재서식을 선택해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isForkJoinMode) {
|
||||
if (isEditingLocked) {
|
||||
alert("편집 중인 결재선이 있습니다. 저장을 완료해 주세요.");
|
||||
return;
|
||||
}
|
||||
const unassigned = aplnRows.find((r) => !r.aprvrUuid);
|
||||
if (unassigned) {
|
||||
alert("지정되지 않은 결재자가 있습니다. 모든 트랙의 결재자를 선택해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const pipeRows = aplnRows
|
||||
.filter((r) => r.branchSeCd === "SP")
|
||||
.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
const facRows = aplnRows
|
||||
.filter((r) => r.branchSeCd === "SF")
|
||||
.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
const aggRows = aplnRows
|
||||
.filter((r) => r.branchSeCd === "TOTAL_AGG")
|
||||
.sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
|
||||
// 1. 부서별 인원 수 (각각 최소 2명 이상, 최대 5명)
|
||||
if (pipeRows.length < 2 || pipeRows.length > 5) {
|
||||
alert("하수관로 검토 결재선에 결재자를 최소 2명 이상(최대 5명) 지정해 주세요.");
|
||||
return;
|
||||
}
|
||||
if (facRows.length < 2 || facRows.length > 5) {
|
||||
alert("하수처리시설 검토 결재선에 결재자를 최소 2명 이상(최대 5명) 지정해 주세요.");
|
||||
return;
|
||||
}
|
||||
if (aggRows.length < 2 || aggRows.length > 5) {
|
||||
alert("정책부 종합병합 결재선에 결재자를 최소 2명 이상(최대 5명) 지정해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 정책부 1순번 병합자(ATRZ04) 지정 검증
|
||||
if (aggRows[0]?.atrzSeComCd !== "ATRZ04") {
|
||||
alert("[정책부] 첫 번째 결재구분은 '병합(ATRZ04)'이어야 합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 정책부 최종 결재구분(ATRZ99) 지정 검증
|
||||
const lastAggRow = aggRows[aggRows.length - 1];
|
||||
if (lastAggRow?.atrzSeComCd !== "ATRZ99") {
|
||||
alert("[정책부] 최종 결재구분은 '최종승인(ATRZ99)'이어야 합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. 동일 브랜치 내 중복 결재자 검증
|
||||
const checkDuplicateInBranch = (rows: typeof pipeRows, branchName: string) => {
|
||||
const uuids = rows.map((r) => r.aprvrUuid).filter(Boolean);
|
||||
const uniqueUuids = new Set(uuids);
|
||||
if (uniqueUuids.size !== uuids.length) {
|
||||
const dupRow = rows.find((r, i) => uuids.indexOf(r.aprvrUuid) !== i);
|
||||
return `[${dupRow?.aprvrNm || "결재자"}] 결재자가 ${branchName} 결재선에 중복 지정되었습니다.`;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const pipeDup = checkDuplicateInBranch(pipeRows, "관로부");
|
||||
if (pipeDup) {
|
||||
alert(pipeDup);
|
||||
return;
|
||||
}
|
||||
const facDup = checkDuplicateInBranch(facRows, "시설부");
|
||||
if (facDup) {
|
||||
alert(facDup);
|
||||
return;
|
||||
}
|
||||
const aggDup = checkDuplicateInBranch(aggRows, "정책부");
|
||||
if (aggDup) {
|
||||
alert(aggDup);
|
||||
return;
|
||||
}
|
||||
|
||||
const defaultTmplt: ElaprTmplt = selectedTmplt ?? {
|
||||
elaprTmpltId: "TMPLT_SF_SP_FORKJOIN",
|
||||
elaprTmpltNm: "[복합] 시설+관로 병렬 결재선 (6인)",
|
||||
docSeComCd: "FNRS",
|
||||
};
|
||||
|
||||
const payload: ElaprTmpltPickerConfirmPayload = {
|
||||
tmplt: defaultTmplt,
|
||||
aplnRows,
|
||||
};
|
||||
|
||||
if (onConfirm) {
|
||||
onConfirm(payload);
|
||||
} else {
|
||||
onSelect?.(defaultTmplt);
|
||||
}
|
||||
|
||||
setSelectedTmplt(null);
|
||||
setAplnRows([]);
|
||||
setIsEditingLocked(false);
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
const rowsError = validateAllRowsForSave(aplnRows, isEditingLocked);
|
||||
if (rowsError) {
|
||||
alert(rowsError);
|
||||
@@ -222,14 +116,14 @@ function ElaprTmpltPickerDialog({
|
||||
const visibleRows = getVisibleRows(aplnRows);
|
||||
|
||||
const payload: ElaprTmpltPickerConfirmPayload = {
|
||||
tmplt: selectedTmplt!,
|
||||
tmplt: selectedTmplt,
|
||||
aplnRows: visibleRows,
|
||||
};
|
||||
|
||||
if (onConfirm) {
|
||||
onConfirm(payload);
|
||||
} else {
|
||||
onSelect?.(selectedTmplt!);
|
||||
onSelect?.(selectedTmplt);
|
||||
}
|
||||
|
||||
setSelectedTmplt(null);
|
||||
@@ -240,16 +134,9 @@ function ElaprTmpltPickerDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent
|
||||
className={isForkJoinMode ? "max-w-[140rem]" : "max-w-[120rem]"}
|
||||
aria-describedby={undefined}
|
||||
>
|
||||
<DialogContent className="max-w-[120rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>
|
||||
{isForkJoinMode
|
||||
? "결재선 선택 (복합사업 처리시설+하수관로 Fork-Join 3트랙)"
|
||||
: "결재선 선택"}
|
||||
</DialogTitle>
|
||||
<DialogTitle>결재선 선택</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex gap-6">
|
||||
@@ -258,19 +145,11 @@ function ElaprTmpltPickerDialog({
|
||||
selectedTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||
onSelectTmplt={handleSelectTmplt}
|
||||
/>
|
||||
|
||||
{isForkJoinMode ? (
|
||||
<ElaprForkJoinPickerGrid
|
||||
onRowsChange={handleRowsChange}
|
||||
onEditingLockedChange={handleEditingLockedChange}
|
||||
/>
|
||||
) : (
|
||||
<ElaprAplnPickerGrid
|
||||
elaprTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||
onRowsChange={handleRowsChange}
|
||||
onEditingLockedChange={handleEditingLockedChange}
|
||||
/>
|
||||
)}
|
||||
<ElaprAplnPickerGrid
|
||||
elaprTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||
onRowsChange={handleRowsChange}
|
||||
onEditingLockedChange={handleEditingLockedChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
@@ -279,7 +158,7 @@ function ElaprTmpltPickerDialog({
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={(!selectedTmplt && !isForkJoinMode) || isEditingLocked}
|
||||
disabled={!selectedTmplt || isEditingLocked}
|
||||
onClick={handleConfirm}
|
||||
>
|
||||
확인
|
||||
|
||||
@@ -66,7 +66,6 @@ function ElaprTmpltSelectTable({
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "결재서식 선택 목록",
|
||||
onRowClick: (row) => {
|
||||
setRowSelection({ [row.elaprTmpltId]: true });
|
||||
onSelectTmplt(row);
|
||||
|
||||
@@ -98,7 +98,6 @@ export const fnrsSharItemSchema = z.object({
|
||||
export const fnrsCnsltnApplySaveSchema = z.object({
|
||||
techReViewSaveCd: z.string().nullish(),
|
||||
rvwStpCd: z.string().nullish(),
|
||||
branchSeCd: z.string().nullish(),
|
||||
fnrsCnsltnMng: fnrsCnsltnMngSaveSchema,
|
||||
bzScaleList: z.array(fnrsCnsltnBzScaleItemSchema).nullish(),
|
||||
bizCstList: z.array(fnrsCnsltnBizCstItemSchema).nullish(),
|
||||
|
||||
+3
-13
@@ -11,34 +11,27 @@ const BASE = ENDPOINT.AS_SERVICE.PWRK_CNSLTN_DOC_CRT_RSLT;
|
||||
|
||||
async function findLatestByCrtDmndUuid(
|
||||
crtDmndUuid: string,
|
||||
branchSeCd?: string,
|
||||
): Promise<PwrkCnsltnDocCrtRsltResponseDto> {
|
||||
const response = await client.get<PwrkCnsltnDocCrtRsltResponseDto>(
|
||||
`${BASE}/${crtDmndUuid}/latest`,
|
||||
{
|
||||
params: branchSeCd ? { branchSeCd } : undefined,
|
||||
},
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function openWebHwpLatest(crtDmndUuid: string, branchSeCd?: string) {
|
||||
async function openWebHwpLatest(crtDmndUuid: string) {
|
||||
return client.get<Blob>(`${BASE}/${crtDmndUuid}/webhwp/open`, {
|
||||
params: branchSeCd ? { branchSeCd } : undefined,
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
||||
|
||||
async function download(crtDmndUuid: string, verSn: number, branchSeCd?: string) {
|
||||
async function download(crtDmndUuid: string, verSn: number) {
|
||||
return client.get<Blob>(`${BASE}/${crtDmndUuid}/${verSn}/download`, {
|
||||
params: branchSeCd ? { branchSeCd } : undefined,
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadLatest(crtDmndUuid: string, branchSeCd?: string) {
|
||||
async function downloadLatest(crtDmndUuid: string) {
|
||||
return client.get<Blob>(`${BASE}/${crtDmndUuid}/download`, {
|
||||
params: branchSeCd ? { branchSeCd } : undefined,
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
||||
@@ -54,9 +47,6 @@ async function saveMultipart(
|
||||
if (saveDto.atchFileGroupId) {
|
||||
formData.append("atchFileGroupId", saveDto.atchFileGroupId);
|
||||
}
|
||||
if (saveDto.branchSeCd) {
|
||||
formData.append("branchSeCd", saveDto.branchSeCd);
|
||||
}
|
||||
if (file) {
|
||||
const resolvedFileName = fileName ?? (file instanceof File ? file.name : "document.hwpx");
|
||||
formData.append("file", file, resolvedFileName);
|
||||
|
||||
+4
-13
@@ -5,7 +5,6 @@ import type { PwrkCnsltnDocCrtRsltSaveRequestDto } from "./pwrk-cnsltn-doc-crt-r
|
||||
export interface PwrkCnsltnDocCrtRsltResponseDto {
|
||||
crtDmndUuid: string;
|
||||
verSn: number;
|
||||
branchSeCd?: string;
|
||||
rgtrUuid?: string;
|
||||
rgtrNm?: string;
|
||||
orgnlOtptDocCn: null;
|
||||
@@ -15,23 +14,15 @@ export interface PwrkCnsltnDocCrtRsltResponseDto {
|
||||
/** 백엔드 PwrkCnsltnDocCrtRsltUpdateRequestDto (모두 optional) */
|
||||
export interface PwrkCnsltnDocCrtRsltUpdateRequestDto {
|
||||
rgtrUuid?: string;
|
||||
branchSeCd?: string;
|
||||
orgnlOtptDocCn?: string;
|
||||
crtCmptnDt?: string;
|
||||
}
|
||||
|
||||
export interface PwrkCnsltnDocCrtRsltService {
|
||||
findLatestByCrtDmndUuid(
|
||||
crtDmndUuid: string,
|
||||
branchSeCd?: string,
|
||||
): Promise<PwrkCnsltnDocCrtRsltResponseDto>;
|
||||
openWebHwpLatest(crtDmndUuid: string, branchSeCd?: string): Promise<AxiosResponse<Blob>>;
|
||||
download(
|
||||
crtDmndUuid: string,
|
||||
verSn: number,
|
||||
branchSeCd?: string,
|
||||
): Promise<AxiosResponse<Blob>>;
|
||||
downloadLatest(crtDmndUuid: string, branchSeCd?: string): Promise<AxiosResponse<Blob>>;
|
||||
findLatestByCrtDmndUuid(crtDmndUuid: string): Promise<PwrkCnsltnDocCrtRsltResponseDto>;
|
||||
openWebHwpLatest(crtDmndUuid: string): Promise<AxiosResponse<Blob>>;
|
||||
download(crtDmndUuid: string, verSn: number): Promise<AxiosResponse<Blob>>;
|
||||
downloadLatest(crtDmndUuid: string): Promise<AxiosResponse<Blob>>;
|
||||
saveMultipart(
|
||||
saveDto: PwrkCnsltnDocCrtRsltSaveRequestDto,
|
||||
file?: Blob | File,
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ export const pwrkCnsltnDocCrtRsltSaveRequestSchema = z.object({
|
||||
crtDmndUuid: z.string().uuid(),
|
||||
pwrkCnsltnDocNo: z.string().min(1).max(100),
|
||||
atchFileGroupId: z.string().max(30).nullish(),
|
||||
branchSeCd: z.string().max(20).nullish(),
|
||||
});
|
||||
|
||||
export type PwrkCnsltnDocCrtRsltSaveRequestDto = z.infer<
|
||||
|
||||
@@ -73,7 +73,7 @@ function AprvrPickerDialog({
|
||||
배치된 검토인력이 없습니다.
|
||||
</p>
|
||||
) : (
|
||||
<Table caption="검토인력 목록으로 성명, 부서, 직위, 직급, 선택 정보 제공" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="25%" />
|
||||
<col width="25%" />
|
||||
|
||||
@@ -185,7 +185,7 @@ function ElaprAplnGrid({ elaprTmpltId }: ElaprAplnGridProps) {
|
||||
</p>
|
||||
) : (
|
||||
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
|
||||
<Table caption="결재선 목록으로 결재순서, 결재구분, 결재자 정보 제공" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="5%" />
|
||||
<col width="10%" />
|
||||
|
||||
@@ -90,7 +90,6 @@ function ElaprTmpltList({ selectedTmpltId, onSelectTmplt }: ElaprTmpltListProps)
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "결재서식 목록으로 결재서식명 정보 제공",
|
||||
onRowClick: (row) => {
|
||||
setRowSelection({ [row.elaprTmpltId]: true });
|
||||
onSelectTmplt(row);
|
||||
|
||||
@@ -67,12 +67,7 @@ function CklstArtclList({ cklstSn }: CklstArtclListProps) {
|
||||
</div>
|
||||
),
|
||||
Empty: <NoData />,
|
||||
Success: () => (
|
||||
<DataTable
|
||||
table={table}
|
||||
caption="체크리스트 항목 목록: 항목명, 검토내용, 검토결과 정보 제공"
|
||||
/>
|
||||
),
|
||||
Success: () => <DataTable table={table} />,
|
||||
});
|
||||
|
||||
const handleFormSubmit = async (values: CklstArtclFormValues) => {
|
||||
|
||||
@@ -83,7 +83,6 @@ function CklstMngList({ selectedCklstSn, onSelectCklst }: CklstMngListProps) {
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "체크리스트 목록",
|
||||
onRowClick: (row) => {
|
||||
setRowSelection({ [String(row.cklstSn)]: true });
|
||||
onSelectCklst(row);
|
||||
|
||||
@@ -51,7 +51,7 @@ function CklstPreviewDialog({
|
||||
{displayRows.length === 0 ? (
|
||||
<p className="py-6 text-center text-muted-foreground">표시할 항목이 없습니다.</p>
|
||||
) : (
|
||||
<Table caption={`체크리스트 ${cklstNm} 미리보기`}>
|
||||
<Table>
|
||||
<colgroup>
|
||||
<col width="25%" />
|
||||
<col width="50%" />
|
||||
|
||||
@@ -277,7 +277,7 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
||||
등록된 항목이 없습니다. [추가]로 1단계 항목을 등록하세요.
|
||||
</p>
|
||||
) : (
|
||||
<Table caption="체크리스트 항목 목록" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="16%" />
|
||||
<col width="36%" />
|
||||
|
||||
@@ -103,7 +103,7 @@ function AcntgCodeTabPanel() {
|
||||
</p>
|
||||
) : (
|
||||
<div className="max-h-[60rem] overflow-y-auto px-4 pb-4 pt-1">
|
||||
<Table caption="회계구분 코드 목록" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="14%" />
|
||||
<col width="16%" />
|
||||
|
||||
@@ -103,7 +103,7 @@ function CnstpCodeTabPanel() {
|
||||
</p>
|
||||
) : (
|
||||
<div className="max-h-[60rem] overflow-y-auto px-4 pb-4 pt-1">
|
||||
<Table caption="공종구분 코드 목록" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="14%" />
|
||||
<col width="16%" />
|
||||
|
||||
@@ -103,7 +103,7 @@ function FnrsSharCodeTabPanel() {
|
||||
</p>
|
||||
) : (
|
||||
<div className="max-h-[60rem] overflow-y-auto px-4 pb-4 pt-1">
|
||||
<Table caption="재원분담 코드 목록" className="w-full">
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="14%" />
|
||||
<col width="16%" />
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
}
|
||||
|
||||
.basinLabel.active {
|
||||
background: #0056b3;
|
||||
background: #006bf8;
|
||||
color: #fff;
|
||||
border-color: #96c3ff;
|
||||
box-shadow: 0 4px 12px rgba(0, 107, 248, 0.3);
|
||||
|
||||
@@ -40,18 +40,18 @@ export function DashboardNotiList({
|
||||
);
|
||||
|
||||
return (
|
||||
<section className="card card-border m-0 bg-[#FAFBFC]">
|
||||
<section className="card card-border m-0 bg-background">
|
||||
<div className="card-header flex items-center justify-between gap-4">
|
||||
<h3 className="text-2xl font-semibold">
|
||||
알림이력
|
||||
{dataUpdatedAt > 0 ? (
|
||||
<span className="pl-2 text-lg font-medium text-[#4A4A4A]">
|
||||
<span className="pl-2 text-lg font-medium text-muted-foreground">
|
||||
(업데이트 일시: {dayjs(dataUpdatedAt).format("YYYY-MM-DD HH:mm")})
|
||||
</span>
|
||||
) : null}
|
||||
</h3>
|
||||
<div className="flex items-center gap-4">
|
||||
<Button type="button" size="sm" color="white" className="!text-[#0056B3]" onClick={() => router.push("/nti-hstry")}>
|
||||
<Button type="button" size="sm" color="white" onClick={() => router.push("/nti-hstry")}>
|
||||
전체보기
|
||||
</Button>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@ export function DashboardNotiList({
|
||||
<div className="flex flex-col gap-4 p-2">
|
||||
<div className="flex flex-wrap gap-2 pt-2">
|
||||
{NOTI_STAT_CHIPS.map((chip) => (
|
||||
<Badge key={chip.field} color={chip.color} className={chip.className}>
|
||||
<Badge key={chip.field} color={chip.color}>
|
||||
{chip.label} {isPending ? "-" : (notiStats?.[chip.field] ?? 0)}건
|
||||
</Badge>
|
||||
))}
|
||||
@@ -75,7 +75,7 @@ export function DashboardNotiList({
|
||||
) : null}
|
||||
|
||||
{isError ? (
|
||||
<p className="flex min-h-[12rem] items-center justify-center text-[#4A4A4A]">
|
||||
<p className="flex min-h-[12rem] items-center justify-center text-muted-foreground">
|
||||
알림이력을 불러오지 못했습니다.
|
||||
</p>
|
||||
) : null}
|
||||
@@ -110,11 +110,11 @@ interface DashboardNotiRowProps {
|
||||
function DashboardNotiRow({ row, isActionPending, onAction }: DashboardNotiRowProps) {
|
||||
return (
|
||||
<div className="grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-4 border-b px-2 py-4 last:border-b-0">
|
||||
<span className="text-lg text-[#4A4A4A]">
|
||||
<span className="text-lg text-muted-foreground">
|
||||
{row.regDt ? dayjs(row.regDt).format("YYYY-MM-DD") : "-"}
|
||||
</span>
|
||||
<p className="min-w-0 line-clamp-2 text-xl sm:line-clamp-1">{row.notiTtl}</p>
|
||||
<Button type="button" size="sm" color="white" className="!text-[#0056B3]" disabled={isActionPending} onClick={onAction}>
|
||||
<Button type="button" size="sm" color="white" disabled={isActionPending} onClick={onAction}>
|
||||
처리하기
|
||||
</Button>
|
||||
</div>
|
||||
@@ -137,7 +137,7 @@ function resolveNotiUrl(row: NotiAsUserResponseDto) {
|
||||
}
|
||||
|
||||
const NOTI_STAT_CHIPS = [
|
||||
{ field: "todayCount", label: "오늘", color: "green", className: "!bg-[#188038]" },
|
||||
{ field: "delayCount", label: "지연", color: "orange", className: "!bg-[#C5221F]" },
|
||||
{ field: "pendingCount", label: "완료대기", color: "gray", className: "!bg-[#5F6368]" },
|
||||
{ field: "todayCount", label: "오늘", color: "green" },
|
||||
{ field: "delayCount", label: "지연", color: "orange" },
|
||||
{ field: "pendingCount", label: "완료대기", color: "gray" },
|
||||
] as const;
|
||||
|
||||
@@ -39,17 +39,16 @@ export function DashboardNoticeTable() {
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "공지사항 목록",
|
||||
variant: "line",
|
||||
onRowClick: handleRowClick,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<section className="card card-border m-0 bg-[#FAFBFC]">
|
||||
<section className="card card-border m-0 bg-background">
|
||||
<div className="card-header flex items-center justify-between">
|
||||
<h3 className="text-2xl font-semibold">공지사항</h3>
|
||||
<Button type="button" size="sm" color="white" className="!text-[#0056B3]" onClick={handleMoreClick}>
|
||||
<Button type="button" size="sm" color="white" onClick={handleMoreClick}>
|
||||
더보기
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@ export function DashboardPage() {
|
||||
const { data, isPending, isError, dataUpdatedAt } = useGetMainDashboard();
|
||||
|
||||
return (
|
||||
<div className="flex min-h-full gap-4 bg-[#E9EDF2] px-[1.8rem] pb-6 pt-4 text-[#1E1E1E]">
|
||||
<div className="mt-4 flex gap-4 px-[1.8rem] pb-6">
|
||||
<div className="hidden flex-[0.5] sm:block">
|
||||
<NationalAsMap basinDocPrgrsList={data?.basinDocPrgrsList} />
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@ export function DocPrgrsSttsCards({ items, isPending, isError }: DocPrgrsSttsCar
|
||||
|
||||
if (isError) {
|
||||
return (
|
||||
<div className="card card-border m-0 flex min-h-[14rem] items-center justify-center bg-[#FAFBFC] text-[#4A4A4A]">
|
||||
<div className="card card-border m-0 flex min-h-[14rem] items-center justify-center bg-background text-muted-foreground">
|
||||
진행상황을 불러오지 못했습니다.
|
||||
</div>
|
||||
);
|
||||
@@ -39,7 +39,7 @@ export function DocPrgrsSttsCards({ items, isPending, isError }: DocPrgrsSttsCar
|
||||
return (
|
||||
<div
|
||||
key={slot.docSeComCd}
|
||||
className="card card-border hover:bg-muted/40 m-0 block bg-[#FAFBFC] transition-colors"
|
||||
className="card card-border hover:bg-muted/40 m-0 block bg-background transition-colors"
|
||||
>
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-semibold">{slot.title}</h3>
|
||||
@@ -90,7 +90,7 @@ function DocPrgrsSttsMetric({
|
||||
>
|
||||
<Icon className="size-6" />
|
||||
</span>
|
||||
<span className="text-xl text-[#4A4A4A]">{label}</span>
|
||||
<span className="text-xl text-muted-foreground">{label}</span>
|
||||
<span className="text-3xl font-semibold tabular-nums">{count}</span>
|
||||
</div>
|
||||
);
|
||||
@@ -107,21 +107,21 @@ const STAT_METRICS = [
|
||||
{
|
||||
field: "reqCnt",
|
||||
label: "신청",
|
||||
iconClassName: "bg-[#4285F4]",
|
||||
iconClassName: "bg-blue-500",
|
||||
bgColor: "bg-blue-100",
|
||||
Icon: FilePlus,
|
||||
},
|
||||
{
|
||||
field: "prgrsCnt",
|
||||
label: "진행",
|
||||
iconClassName: "bg-[#34A853]",
|
||||
iconClassName: "bg-emerald-500",
|
||||
bgColor: "bg-emerald-100",
|
||||
Icon: RefreshCw,
|
||||
},
|
||||
{
|
||||
field: "cmptnCnt",
|
||||
label: "완료",
|
||||
iconClassName: "bg-[#EA4335]",
|
||||
iconClassName: "bg-orange-500",
|
||||
bgColor: "bg-orange-100",
|
||||
Icon: CircleCheck,
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@ export function NationalAsMap({ basinDocPrgrsList }: NationalAsMapProps) {
|
||||
const popupColumnSpan = Math.max(1, popupContent.items.length);
|
||||
|
||||
return (
|
||||
<section className="card card-border m-0 flex h-full min-h-[40rem] flex-col bg-[#FAFBFC]">
|
||||
<section className="card card-border m-0 flex h-full min-h-[40rem] flex-col bg-background">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-semibold">전국 행정지원 지도</h3>
|
||||
</div>
|
||||
|
||||
@@ -165,11 +165,8 @@ function DesignFormPage({ mode, initialData, createDefaults }: DesignFormPagePro
|
||||
<FormProvider {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="mt-6 space-y-4">
|
||||
<SectionCollapsibleGroup>
|
||||
<div className="sticky top-[6rem] z-30 flex items-center justify-between bg-container px-4 py-2">
|
||||
<div className="sticky top-[6rem] z-30 bg-container px-4 py-2">
|
||||
<SectionCollapsibleToggle />
|
||||
<p className="text-sm text-muted-foreground">
|
||||
<span className="text-red-600">*</span>은 필수입력 항목입니다.
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{initialData?.detDto?.designCnstnDocNo && (
|
||||
|
||||
@@ -59,7 +59,6 @@ function DesignList({ searchParams, pagination, onPaginationChange }: DesignList
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "설계검토 목록",
|
||||
viewPagination: true,
|
||||
onRowClick: handleRowClick,
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ function BasicInfoFormSection() {
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table caption="사업 기본 정보 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -45,7 +45,7 @@ function BasicInfoFormSection() {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row" className="w-[20rem]" data-required>
|
||||
<TableHead className="w-[20rem]" data-required>
|
||||
사업명
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
@@ -73,7 +73,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업기간</TableHead>
|
||||
<TableHead data-required>사업기간</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<FieldGroup className="flex-row items-center gap-2">
|
||||
<Controller
|
||||
@@ -117,7 +117,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업내용</TableHead>
|
||||
<TableHead data-required>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="designCnstnMng.bizCn"
|
||||
@@ -137,9 +137,9 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>구분</TableHead>
|
||||
<TableHead data-required>구분</TableHead>
|
||||
<TableCell>{taskSeComCdLabel}</TableCell>
|
||||
<TableHead scope="row">신청 지자체</TableHead>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell>{localGovLabel}</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
|
||||
@@ -11,7 +11,7 @@ interface BasicInfoSectionProps {
|
||||
function BasicInfoSection({ det }: BasicInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table caption="사업 기본 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
|
||||
@@ -13,7 +13,7 @@ function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="사업규모">
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="사업규모 목록: 구분, 기본계획, 예산반영, 금회설계, 증감 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]">구분</TableHead>
|
||||
@@ -36,7 +36,7 @@ function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
|
||||
return (
|
||||
<TableRow key={node.cnstpSeCd}>
|
||||
<TableHead scope="row" className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{node.cnstpSeCdNm}
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
|
||||
@@ -11,21 +11,21 @@ interface ContactInfoSectionProps {
|
||||
function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="담당자 정보">
|
||||
<Table caption="사업 담당자 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
{det.aplcntNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row" rowSpan={2}>신청자</TableHead>
|
||||
<TableHead scope="row">이름</TableHead>
|
||||
<TableHead rowSpan={2}>신청자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.aplcntNm || "-"}</TableCell>
|
||||
<TableHead scope="row">연락처</TableHead>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.aplcntMblTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">소속</TableHead>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.aplcntOgdpNm || "-"}</TableCell>
|
||||
<TableHead scope="row">이메일</TableHead>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.aplcntEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
@@ -33,16 +33,16 @@ function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
{det.dsgnrNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row" rowSpan={2}>설계자</TableHead>
|
||||
<TableHead scope="row">이름</TableHead>
|
||||
<TableHead rowSpan={2}>설계자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.dsgnrNm || "-"}</TableCell>
|
||||
<TableHead scope="row">연락처</TableHead>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.dsgnrTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">소속</TableHead>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.dsgnrOgdpNm || "-"}</TableCell>
|
||||
<TableHead scope="row">이메일</TableHead>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.dsgnrEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
|
||||
@@ -180,10 +180,10 @@ const TechReviewOpinionSection = forwardRef<
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-xl font-semibold">검토의견 작성</h4>
|
||||
<Table caption="검토의견 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row" className="w-[12rem]">의견내용</TableHead>
|
||||
<TableHead className="w-[12rem]">의견내용</TableHead>
|
||||
<TableCell>
|
||||
<Textarea
|
||||
value={formData.rvwRsltCn}
|
||||
@@ -197,7 +197,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">검토결과</TableHead>
|
||||
<TableHead>검토결과</TableHead>
|
||||
<TableCell>
|
||||
<FieldSet>
|
||||
<RadioGroup
|
||||
@@ -234,7 +234,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">첨부파일</TableHead>
|
||||
<TableHead>첨부파일</TableHead>
|
||||
<TableCell>
|
||||
{uploadedFile ? (
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -289,7 +289,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) {
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="검토의견 목록: 의견자, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="55%" />
|
||||
|
||||
@@ -100,7 +100,6 @@ function EsntlAtchFileList({
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "필수 첨부파일 관리 목록",
|
||||
viewPagination: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -188,148 +188,16 @@ const ROLE_USER01_ATRZ_STATUS_ACTIONS: Record<
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Fork-Join (병렬 결재 6인 체제: 관로2 + 시설2 + 정책병합2) 전용 상태별 버튼 액션 매핑
|
||||
* - Stage 2: 관로/시설 실무검토자(ATRZ02), 부서승인자(ATRZ03)
|
||||
* - Stage 3: 정책총괄 종합병합자(ATRZ04), 최종회신자(ATRZ99)
|
||||
* - 일반 순차 결재 라인과 분리하여 독립적으로 관리
|
||||
*/
|
||||
const ROLE_USER01_FORK_JOIN_ATRZ_STATUS_ACTIONS: Record<
|
||||
string,
|
||||
Record<string, FnrsCnsltnViewButtonAction[]>
|
||||
> = {
|
||||
ER: {
|
||||
ATRZ01: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.fileSplmnt,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.fileVrfc,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.dsgntRvwr,
|
||||
],
|
||||
},
|
||||
SL: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
TE: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocCrt,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwCmptn,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
],
|
||||
ATRZ03: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply,
|
||||
],
|
||||
ATRZ04: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv,
|
||||
],
|
||||
ATRZ99: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply,
|
||||
],
|
||||
},
|
||||
TP: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
RB: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
RA: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
AV: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
EV: {
|
||||
ATRZ01: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.dsgntRvwr,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.costVrfc,
|
||||
],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
RK: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwCmptn,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
],
|
||||
ATRZ03: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply,
|
||||
],
|
||||
ATRZ04: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv,
|
||||
],
|
||||
ATRZ99: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply,
|
||||
],
|
||||
},
|
||||
RR: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
EP: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
TA: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ04: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
};
|
||||
|
||||
function resolveButtonConfigs(actions: FnrsCnsltnViewButtonAction[]): FnrsCnsltnViewButtonAction[] {
|
||||
return actions.map((action) => FNRS_CNSLTN_VIEW_BUTTON_ACTION[action]);
|
||||
}
|
||||
|
||||
export interface GetButtonConfigsOptions {
|
||||
interface GetButtonConfigsOptions {
|
||||
hasPendingApprovalRequest?: boolean;
|
||||
hasCompletedDraft?: boolean;
|
||||
canRetryFileVrfc?: boolean;
|
||||
canRetryDraftGen?: boolean;
|
||||
canRetryCostVrfc?: boolean;
|
||||
isForkJoin?: boolean;
|
||||
branchSeCd?: "SP" | "SF" | "TOTAL_AGG" | "MAIN" | string;
|
||||
branchSttsCd?: "WAITING" | "IN_PROGRESS" | "COMPLETED" | "SUPPLEMENT" | "REJECTED" | string;
|
||||
}
|
||||
|
||||
const PENDING_APPROVAL_ACTIONS = new Set<FnrsCnsltnViewButtonAction>([
|
||||
@@ -346,30 +214,7 @@ function resolveRoleUser01AtrzButtonActions(
|
||||
atrzSeComCdList: string[],
|
||||
options?: GetButtonConfigsOptions,
|
||||
): FnrsCnsltnViewButtonAction[] {
|
||||
let effectiveStatus = prgrsSttsComCd;
|
||||
|
||||
if (options?.isForkJoin && options?.branchSttsCd) {
|
||||
switch (options.branchSttsCd) {
|
||||
case "SUPPLEMENT":
|
||||
// 본인 브랜치가 보완요청 중이면 'SL' 맵핑 적용 (검토/승인 버튼 숨김, 실무협의서관리만 노출)
|
||||
effectiveStatus = "SL";
|
||||
break;
|
||||
case "IN_PROGRESS":
|
||||
// 본인 브랜치가 정상 진행 중이면 원천 상태('TE' 또는 'RK') 정상 적용!
|
||||
effectiveStatus = prgrsSttsComCd === "RK" ? "RK" : "TE";
|
||||
break;
|
||||
case "COMPLETED":
|
||||
// 본인 브랜치 승인 완료 후 타 브랜치 대기 중이면 조회 전용 맵 적용
|
||||
effectiveStatus = prgrsSttsComCd === "RK" ? "RR" : "TP";
|
||||
break;
|
||||
case "WAITING":
|
||||
return [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng];
|
||||
}
|
||||
}
|
||||
|
||||
const atrzStatusMap = options?.isForkJoin
|
||||
? ROLE_USER01_FORK_JOIN_ATRZ_STATUS_ACTIONS[effectiveStatus]
|
||||
: ROLE_USER01_ATRZ_STATUS_ACTIONS[effectiveStatus];
|
||||
const atrzStatusMap = ROLE_USER01_ATRZ_STATUS_ACTIONS[prgrsSttsComCd];
|
||||
if (!atrzStatusMap || atrzSeComCdList.length === 0) return [];
|
||||
|
||||
const seen = new Set<FnrsCnsltnViewButtonAction>();
|
||||
@@ -404,12 +249,12 @@ function resolveRoleUser01AtrzButtonActions(
|
||||
}
|
||||
|
||||
if (options?.hasCompletedDraft != null) {
|
||||
if (effectiveStatus === "SL" || effectiveStatus === "TE" || effectiveStatus === "RK") {
|
||||
if (prgrsSttsComCd === "SL" || prgrsSttsComCd === "TE" || prgrsSttsComCd === "RK") {
|
||||
if (action === FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng) {
|
||||
return options.hasCompletedDraft;
|
||||
}
|
||||
}
|
||||
if (effectiveStatus === "TE") {
|
||||
if (prgrsSttsComCd === "TE") {
|
||||
if (action === FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) {
|
||||
return options.hasCompletedDraft;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { BranchSeCd } from "@/entities/elapr";
|
||||
import type { CklstResultItem, CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
import {
|
||||
@@ -143,108 +142,3 @@ export function toCklstSaveDto(
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 결재자 branch_se_cd 기반 체크리스트 독립 Validation 유틸리티 (10월 14일 개정)
|
||||
* 결재자의 branch_se_cd('SP', 'SF', 'TOTAL_AGG', 'MAIN')에 따라 해당 탭 항목만 검증합니다.
|
||||
*/
|
||||
export function validateChecklistByBranch(
|
||||
checklistItems: {
|
||||
taskSeComCd: string;
|
||||
bchckUseYn: string;
|
||||
selected?: string; // 'Y' | 'N'
|
||||
picRvwCn?: string; // 검토자의견
|
||||
cklstRvwItemNm: string;
|
||||
cklstRvwSn: number;
|
||||
}[],
|
||||
approverBranchSeCd: BranchSeCd,
|
||||
docTaskSeComCd: string,
|
||||
): { isValid: boolean; errorMessage?: string; errorItemSn?: number } {
|
||||
// TOTAL_AGG(종합병합): 관로/시설 병렬 검토 완료 후 총괄취합 단계이므로 체크리스트 검증 생략
|
||||
if (approverBranchSeCd === "TOTAL_AGG") {
|
||||
return { isValid: true };
|
||||
}
|
||||
|
||||
let targetTaskCodes: string[] = [];
|
||||
if (approverBranchSeCd === "SP") {
|
||||
targetTaskCodes = ["SP"]; // 관로부: SP 탭만 검증 (시설부 미작성 무관)
|
||||
} else if (approverBranchSeCd === "SF") {
|
||||
targetTaskCodes = ["SF"]; // 시설부: SF 탭만 검증 (관로부 미작성 무관)
|
||||
} else {
|
||||
// 단일/순차 결재 (MAIN 등): 콤마 분리, 또는 "MAIN"/누락 시 체크리스트 실제 공종 전체 자동 추출
|
||||
const parsedCodes =
|
||||
docTaskSeComCd && docTaskSeComCd !== "MAIN"
|
||||
? docTaskSeComCd.split(",").map((s) => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
|
||||
targetTaskCodes =
|
||||
parsedCodes.length > 0
|
||||
? parsedCodes
|
||||
: Array.from(new Set(checklistItems.map((i) => i.taskSeComCd).filter(Boolean)));
|
||||
}
|
||||
|
||||
const activeItems = checklistItems.filter(
|
||||
(item) => targetTaskCodes.includes(item.taskSeComCd) && item.bchckUseYn === "Y",
|
||||
);
|
||||
|
||||
for (const item of activeItems) {
|
||||
const taskName =
|
||||
item.taskSeComCd === "SP"
|
||||
? "하수관로"
|
||||
: item.taskSeComCd === "RE"
|
||||
? "재이용수"
|
||||
: "하수처리시설";
|
||||
|
||||
// 1. 적합/부적합 미선택 검증
|
||||
if (!item.selected || !["Y", "N"].includes(item.selected)) {
|
||||
return {
|
||||
isValid: false,
|
||||
errorMessage: `[${taskName}] 체크리스트 '${item.cklstRvwItemNm}' 항목의 적합 여부를 선택해주세요.`,
|
||||
errorItemSn: item.cklstRvwSn,
|
||||
};
|
||||
}
|
||||
// 2. 부적합('N') 시 검토자 검토의견 필수 검증
|
||||
if (item.selected === "N" && (!item.picRvwCn || item.picRvwCn.trim() === "")) {
|
||||
return {
|
||||
isValid: false,
|
||||
errorMessage: `[${taskName}] 체크리스트 '${item.cklstRvwItemNm}' 항목이 '부적합'입니다. 검토자 검토의견을 반드시 입력해주세요.`,
|
||||
errorItemSn: item.cklstRvwSn,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return { isValid: true };
|
||||
}
|
||||
|
||||
/**
|
||||
* ChecklistFormState와 CklstRvwRsltTreeDto[]를 받아 결재자 브랜치별 체크리스트 검증을 실행하는 헬퍼
|
||||
*/
|
||||
export function validateChecklistFormStateByBranch({
|
||||
rows,
|
||||
formState,
|
||||
reviewStep = "KECO",
|
||||
approverBranchSeCd,
|
||||
docTaskSeComCd,
|
||||
}: {
|
||||
rows: CklstRvwRsltTreeDto[];
|
||||
formState: ChecklistFormState;
|
||||
reviewStep?: ReviewStepCode;
|
||||
approverBranchSeCd: BranchSeCd;
|
||||
docTaskSeComCd: string;
|
||||
}): { isValid: boolean; errorMessage?: string; errorItemSn?: number } {
|
||||
const displayRows = getChecklistDisplayRows(rows);
|
||||
const checklistItems = displayRows.map((row) => {
|
||||
const key = buildChecklistRowKey(row, reviewStep);
|
||||
return {
|
||||
taskSeComCd: row.taskSeComCd,
|
||||
bchckUseYn: row.bchckUseYn,
|
||||
selected: formState.results[key] ?? (row.rvwRsltAnmlyYn as string | undefined),
|
||||
picRvwCn: formState.comments[key] ?? row.picRvwCn,
|
||||
cklstRvwItemNm: row.cklstArtclNm ?? "검토항목",
|
||||
cklstRvwSn: row.cklstRvwSn,
|
||||
};
|
||||
});
|
||||
|
||||
return validateChecklistByBranch(checklistItems, approverBranchSeCd, docTaskSeComCd);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,27 +98,3 @@ export function parseTaskSeComCdFromApi(taskSeComCd?: string | null): string[] {
|
||||
if (!taskSeComCd) return [];
|
||||
return taskSeComCd.split(",").filter(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 재원업무협의 저장 시 코드가 "SF,SP", "SP,SF" 등의 복수 코드로 분리 저장된 경우,
|
||||
* 전자결재 복합병렬결재(Fork-Join) 화면 및 프로세스 규격에 맞춰 "SF_SP"로 정규화합니다.
|
||||
*/
|
||||
export function normalizeTaskSeComCdForElapr(taskSeComCd?: string | null): string {
|
||||
if (!taskSeComCd) return "";
|
||||
const trimmed = taskSeComCd.trim();
|
||||
if (trimmed === "SF_SP") return "SF_SP";
|
||||
|
||||
const codes = trimmed.split(",").map((c) => c.trim()).filter(Boolean);
|
||||
if (codes.includes("SF") && codes.includes("SP")) {
|
||||
return "SF_SP";
|
||||
}
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 전자결재 복합병렬결재(Fork-Join) 대상 업무 여부 판단
|
||||
*/
|
||||
export function isForkJoinTask(taskSeComCd?: string | null): boolean {
|
||||
return normalizeTaskSeComCdForElapr(taskSeComCd) === "SF_SP";
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ export function buildSupplementReqPayload(
|
||||
data: FnrsCnsltnMngDetResponseDto,
|
||||
payload: SplmntDmndDialogConfirmPayload,
|
||||
checklistFormState: ChecklistFormState,
|
||||
branchSeCd?: string,
|
||||
): FnrsCnsltnApplySaveRequestDto {
|
||||
const existingItems: FnrsCnsltnSplmntDmndItem[] = (data.splmntDmndList ?? []).map((item) =>
|
||||
toSplmntDmndSaveItem(item),
|
||||
@@ -112,7 +111,6 @@ export function buildSupplementReqPayload(
|
||||
return fnrsCnsltnApplySaveSchema.parse({
|
||||
...buildSavePayload(data, checklistFormState, "LOCAL", "SL"),
|
||||
splmntDmndList: [...existingItems, ...newItems],
|
||||
branchSeCd,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function ChecklistTaskPanel({
|
||||
return (
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="체크리스트 검토 입력: 검토항목, 주요 검토내용, 검토결과 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" rowSpan={2}>
|
||||
|
||||
@@ -115,7 +115,6 @@ function FileVrfcSplmntDialog({
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "파일 검증 보완요청 목록",
|
||||
viewPagination: false,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -20,14 +20,11 @@ import {
|
||||
ElaprApprovalDialog,
|
||||
type ElaprDmndSaveRequestDto,
|
||||
elaprDmndService,
|
||||
type ElaprDocPrgrsForkJoinPickerConfirmPayload,
|
||||
ElaprDocPrgrsForkJoinPickerDialog,
|
||||
type ElaprDocPrgrsPickerConfirmPayload,
|
||||
ElaprDocPrgrsPickerDialog,
|
||||
type ElaprTmpltPickerConfirmPayload,
|
||||
ElaprTmpltPickerDialog,
|
||||
hasCurrentUserPendingApprovalRequest,
|
||||
useElaprBranchesByDocNo,
|
||||
useElaprDocPrgrsByDocNo,
|
||||
} from "@/entities/elapr";
|
||||
import {
|
||||
@@ -57,11 +54,7 @@ import {
|
||||
getButtonConfigs,
|
||||
needsRoleUser01AtrzResolve,
|
||||
} from "../../lib/button-config";
|
||||
import type { BranchSeCd } from "@/entities/elapr";
|
||||
import {
|
||||
computeReviewStepChecklistProgress,
|
||||
validateChecklistFormStateByBranch,
|
||||
} from "../../lib/checklist-utils";
|
||||
import { computeReviewStepChecklistProgress } from "../../lib/checklist-utils";
|
||||
import {
|
||||
buildFileSplmntReqPayload,
|
||||
buildRvwRsltSplmntReqPayload,
|
||||
@@ -70,10 +63,6 @@ import {
|
||||
buildTechReviewReplyPayload,
|
||||
toSplmntDmndSaveItem,
|
||||
} from "../../lib/save-payload-utils";
|
||||
import {
|
||||
isForkJoinTask,
|
||||
normalizeTaskSeComCdForElapr,
|
||||
} from "../../lib/fnrs-cnsltn-regist-schema";
|
||||
import { type ChecklistFormState } from "../../model/view-types";
|
||||
import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opinion-section";
|
||||
|
||||
@@ -107,7 +96,6 @@ interface FloatingActionButtonsProps {
|
||||
type ActiveDialog =
|
||||
| "elaprTmplt"
|
||||
| "elaprDocPrgrs"
|
||||
| "elaprDocPrgrsForkJoin"
|
||||
| "rjct"
|
||||
| "fileSplmnt"
|
||||
| "elaprApproval"
|
||||
@@ -140,13 +128,8 @@ function FloatingActionButtons({
|
||||
const docNo = data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo;
|
||||
const isRegister = data.detDto?.rgtr === userInfo?.userUnqId;
|
||||
|
||||
const isForkJoin = isForkJoinTask(data.detDto?.taskSeComCd);
|
||||
const normalizedTaskSeComCd = normalizeTaskSeComCdForElapr(data.detDto?.taskSeComCd);
|
||||
|
||||
const needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
|
||||
const needsElaprPrgrsCheck =
|
||||
needsAtrzResolve &&
|
||||
(["TE", "RK"].includes(prgrsSttsComCd) || (isForkJoin && prgrsSttsComCd === "SL"));
|
||||
const needsElaprPrgrsCheck = needsAtrzResolve && ["TE", "RK"].includes(prgrsSttsComCd);
|
||||
const needsPwrkDraftCheck =
|
||||
dtlInstCd === "ROLE_USER01" && ["SL", "TE", "RK"].includes(prgrsSttsComCd);
|
||||
const needsPwrkForRb = dtlInstCd === "ROLE_USER05" && prgrsSttsComCd === "RB";
|
||||
@@ -157,10 +140,6 @@ function FloatingActionButtons({
|
||||
const { data: elaprDocPrgrsList = [], isLoading: isElaprDocPrgrsLoading } =
|
||||
useElaprDocPrgrsByDocNo(needsElaprPrgrsCheck ? docNo : null);
|
||||
|
||||
const { data: elaprBranchList = [], isLoading: isElaprBranchLoading } = useElaprBranchesByDocNo(
|
||||
isForkJoin && (needsElaprPrgrsCheck || prgrsSttsComCd === "SL") ? docNo : null,
|
||||
);
|
||||
|
||||
const { data: pwrkCnsltnData, isLoading: isPwrkCnsltnLoading } = usePwrkCnsltnMngByUpDocNo(
|
||||
docNo,
|
||||
needsPwrkLookup,
|
||||
@@ -200,137 +179,33 @@ function FloatingActionButtons({
|
||||
elaprPrgrsForPending,
|
||||
userInfo?.userUnqId,
|
||||
);
|
||||
const currentUserPrgrsRow = elaprPrgrsForPending.find(
|
||||
(row) => row.aprvrUuid?.toLowerCase() === userInfo?.userUnqId?.toLowerCase(),
|
||||
);
|
||||
const userPendingPrgrs = elaprPrgrsForPending.find(
|
||||
(row) =>
|
||||
row.aprvrUuid?.toLowerCase() === userInfo?.userUnqId?.toLowerCase() &&
|
||||
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
);
|
||||
const userBranchId = userPendingPrgrs?.branchId ?? currentUserPrgrsRow?.branchId;
|
||||
const userBranchSeCd = (userPendingPrgrs?.branchSeCd ?? currentUserPrgrsRow?.branchSeCd) as
|
||||
| "SP"
|
||||
| "SF"
|
||||
| "TOTAL_AGG"
|
||||
| "MAIN"
|
||||
| undefined;
|
||||
const userPendingBranchSeCd = userPendingPrgrs?.branchSeCd ?? userBranchSeCd;
|
||||
const userPendingAtrzSeComCd = userPendingPrgrs?.atrzSeComCd;
|
||||
|
||||
const effectiveAtrzSeComCdList = useMemo(() => {
|
||||
if (isForkJoin && userPendingAtrzSeComCd) {
|
||||
return [userPendingAtrzSeComCd];
|
||||
}
|
||||
if (isForkJoin && currentUserPrgrsRow?.atrzSeComCd) {
|
||||
return [currentUserPrgrsRow.atrzSeComCd];
|
||||
}
|
||||
return atrzSeComCdList;
|
||||
}, [atrzSeComCdList, currentUserPrgrsRow?.atrzSeComCd, isForkJoin, userPendingAtrzSeComCd]);
|
||||
|
||||
const supplementDmndBranch = useMemo(() => {
|
||||
if (!isForkJoin) return undefined;
|
||||
|
||||
// 1순위: 전자결재 브랜치(tb_as_elapr_branch) 테이블에서 상태가 SUPPLEMENT인 부서 직접 확인
|
||||
const splmntBranch = elaprBranchList.find((b) => b.branchSttsCd === "SUPPLEMENT");
|
||||
if (splmntBranch?.branchSeCd && ["SP", "SF"].includes(splmntBranch.branchSeCd)) {
|
||||
return splmntBranch.branchSeCd as "SP" | "SF";
|
||||
}
|
||||
|
||||
// 2순위: 미완료 보완요청 항목의 등록자 UUID 매칭
|
||||
const uncompletedItems = data?.splmntDmndList?.filter((item) => item.cmptnYn !== "Y") ?? [];
|
||||
if (uncompletedItems.length > 0) {
|
||||
for (const splmnt of uncompletedItems) {
|
||||
const matchedPrgrs = elaprDocPrgrsList.find(
|
||||
(p) => p.aprvrUuid?.toLowerCase() === splmnt.rgtr?.toLowerCase(),
|
||||
);
|
||||
if (matchedPrgrs?.branchSeCd && ["SP", "SF"].includes(matchedPrgrs.branchSeCd)) {
|
||||
return matchedPrgrs.branchSeCd as "SP" | "SF";
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}, [data?.splmntDmndList, elaprBranchList, elaprDocPrgrsList, isForkJoin]);
|
||||
|
||||
const userBranchSttsCd = useMemo<string | undefined>(() => {
|
||||
if (!isForkJoin || !userBranchSeCd) return undefined;
|
||||
|
||||
// 1. elaprBranchList API 응답에서 사용자 브랜치 상태 확인
|
||||
// 현재 결재선(2차 차수 등)의 고유 branchId로 우선 매칭하고, 없으면 findLast로 최신 차수 브랜치 매칭
|
||||
const matchedBranch = userBranchId
|
||||
? elaprBranchList.find((b) => b.branchId === userBranchId)
|
||||
: elaprBranchList.findLast((b) => b.branchSeCd === userBranchSeCd);
|
||||
if (matchedBranch?.branchSttsCd) {
|
||||
return matchedBranch.branchSttsCd;
|
||||
}
|
||||
|
||||
// 2. Fallback: 문서 상태가 SL일 때 보완요청 발생 부서(supplementDmndBranch)와 비교
|
||||
if (prgrsSttsComCd === "SL") {
|
||||
if (supplementDmndBranch && userBranchSeCd === supplementDmndBranch) {
|
||||
return "SUPPLEMENT";
|
||||
}
|
||||
const branchRows = elaprPrgrsForPending.filter((row) => row.branchSeCd === userBranchSeCd);
|
||||
const hasUnfinished = branchRows.some(
|
||||
(row) =>
|
||||
row.atrzPrgrsSttsComCd !== "ATRZ_PRGRS_003" && row.atrzPrgrsSttsComCd !== "ATRZ_PRGRS_999",
|
||||
);
|
||||
return hasUnfinished ? "IN_PROGRESS" : "COMPLETED";
|
||||
}
|
||||
|
||||
if (["TE", "RK"].includes(prgrsSttsComCd)) {
|
||||
return "IN_PROGRESS";
|
||||
}
|
||||
if (["TP", "RR"].includes(prgrsSttsComCd)) {
|
||||
return "COMPLETED";
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}, [
|
||||
elaprBranchList,
|
||||
elaprPrgrsForPending,
|
||||
isForkJoin,
|
||||
prgrsSttsComCd,
|
||||
supplementDmndBranch,
|
||||
userBranchId,
|
||||
userBranchSeCd,
|
||||
]);
|
||||
|
||||
const isBranchInProgress =
|
||||
isForkJoin && userBranchSttsCd === "IN_PROGRESS" && dtlInstCd === "ROLE_USER01";
|
||||
|
||||
const viewOnlyPwrkCnsltnDoc =
|
||||
(prgrsSttsComCd === "SL" && dtlInstCd !== "ROLE_USER05" && !isBranchInProgress) ||
|
||||
prgrsSttsComCd === "SL" ||
|
||||
(prgrsSttsComCd === "RB" && dtlInstCd !== "ROLE_USER05") ||
|
||||
(prgrsSttsComCd === "RK" && dtlInstCd === "ROLE_USER03");
|
||||
|
||||
const actionButtons = useMemo(() => {
|
||||
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
||||
if (needsElaprPrgrsCheck && isElaprDocPrgrsLoading) return [];
|
||||
if (isForkJoin && isElaprBranchLoading) return [];
|
||||
if (needsPwrkDraftCheck && isPwrkCnsltnLoading) return [];
|
||||
if (needsAiAutoLatest && isAiAutoLatestLoading) return [];
|
||||
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, effectiveAtrzSeComCdList, {
|
||||
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, atrzSeComCdList, {
|
||||
hasPendingApprovalRequest: needsElaprPrgrsCheck ? hasPendingApprovalRequest : undefined,
|
||||
hasCompletedDraft: needsPwrkDraftCheck ? hasCompletedDraft : undefined,
|
||||
canRetryFileVrfc: needsAiAutoLatest ? canRetryFileVrfc : undefined,
|
||||
canRetryDraftGen: needsAiAutoLatest ? canRetryDraftGen : undefined,
|
||||
canRetryCostVrfc: needsAiAutoLatest ? canRetryCostVrfc : undefined,
|
||||
isForkJoin,
|
||||
branchSeCd: userBranchSeCd,
|
||||
branchSttsCd: userBranchSttsCd,
|
||||
});
|
||||
}, [
|
||||
atrzSeComCdList,
|
||||
canRetryCostVrfc,
|
||||
canRetryDraftGen,
|
||||
canRetryFileVrfc,
|
||||
dtlInstCd,
|
||||
effectiveAtrzSeComCdList,
|
||||
hasCompletedDraft,
|
||||
hasPendingApprovalRequest,
|
||||
isAiAutoLatestLoading,
|
||||
isElaprBranchLoading,
|
||||
isElaprDocPrgrsLoading,
|
||||
isForkJoin,
|
||||
isPwrkCnsltnLoading,
|
||||
isRvwLoginUserLoading,
|
||||
needsAiAutoLatest,
|
||||
@@ -338,15 +213,13 @@ function FloatingActionButtons({
|
||||
needsElaprPrgrsCheck,
|
||||
needsPwrkDraftCheck,
|
||||
prgrsSttsComCd,
|
||||
userBranchSeCd,
|
||||
userBranchSttsCd,
|
||||
]);
|
||||
|
||||
const canEdit =
|
||||
isRegister && actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg);
|
||||
const canDmndSplmntInPwrkCnsltnDoc =
|
||||
prgrsSttsComCd === "RK" &&
|
||||
effectiveAtrzSeComCdList.includes("ATRZ02") &&
|
||||
atrzSeComCdList.includes("ATRZ02") &&
|
||||
actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt);
|
||||
|
||||
function handleGoToList() {
|
||||
@@ -383,9 +256,6 @@ function FloatingActionButtons({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_BRANCH],
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
let errorMessage = "";
|
||||
@@ -579,9 +449,6 @@ function FloatingActionButtons({
|
||||
elaprDocNo: docNo,
|
||||
dmndTtl: data.detDto?.bizNm ?? "",
|
||||
dmndCn: data.detDto?.bizCn ?? "",
|
||||
taskSeComCd: normalizedTaskSeComCd || undefined,
|
||||
forkJoinSeCd: isForkJoin ? "FORK_JOIN" : "NONE",
|
||||
crntStageNo: isForkJoin ? 2 : 1,
|
||||
elaprCycl: 1,
|
||||
docPrgrsSttsComCd: "AC",
|
||||
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
|
||||
@@ -596,16 +463,11 @@ function FloatingActionButtons({
|
||||
});
|
||||
}
|
||||
|
||||
async function handleElaprDocPrgrsConfirm({
|
||||
aplnRows,
|
||||
}: ElaprDocPrgrsPickerConfirmPayload | ElaprDocPrgrsForkJoinPickerConfirmPayload) {
|
||||
async function handleElaprDocPrgrsConfirm({ aplnRows }: ElaprDocPrgrsPickerConfirmPayload) {
|
||||
const payload: ElaprDmndSaveRequestDto = {
|
||||
elaprDocNo: docNo,
|
||||
dmndTtl: data.detDto?.bizNm ?? "",
|
||||
dmndCn: data.detDto?.bizCn ?? "",
|
||||
taskSeComCd: normalizedTaskSeComCd || undefined,
|
||||
forkJoinSeCd: isForkJoin ? "FORK_JOIN" : "NONE",
|
||||
crntStageNo: isForkJoin ? 2 : 1,
|
||||
elaprCycl: 2,
|
||||
docPrgrsSttsComCd: "RK",
|
||||
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
|
||||
@@ -625,7 +487,7 @@ function FloatingActionButtons({
|
||||
data,
|
||||
checklistFormState,
|
||||
"KECO",
|
||||
prgrsSttsComCd === "SL" ? "SL" : prgrsSttsComCd === "RK" ? "RK" : "TE",
|
||||
"TE",
|
||||
"SV",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
@@ -639,40 +501,16 @@ function FloatingActionButtons({
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
function handleApprovalOpen() {
|
||||
const isTeStep = prgrsSttsComCd === "TE" || (isForkJoin && prgrsSttsComCd === "SL");
|
||||
if (isTeStep && (userBranchSeCd || userPendingBranchSeCd)) {
|
||||
const branchCd = (userBranchSeCd as BranchSeCd) || (userPendingBranchSeCd as BranchSeCd) || (isForkJoin ? "SP" : "MAIN");
|
||||
const validation = validateChecklistFormStateByBranch({
|
||||
rows: data.cklstResultList ?? [],
|
||||
formState: checklistFormState,
|
||||
reviewStep: "KECO",
|
||||
approverBranchSeCd: branchCd,
|
||||
docTaskSeComCd: normalizedTaskSeComCd || data.detDto?.taskSeComCd || "MAIN",
|
||||
});
|
||||
|
||||
if (!validation.isValid) {
|
||||
alert(validation.errorMessage || "체크리스트 항목을 모두 검토해야 결재가 가능합니다.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
setActiveDialog("elaprApproval");
|
||||
}
|
||||
|
||||
async function handleRvwCmptnClick() {
|
||||
const isTeStep = prgrsSttsComCd === "TE" || (isForkJoin && prgrsSttsComCd === "SL");
|
||||
if (isTeStep) {
|
||||
const branchCd = (userBranchSeCd as BranchSeCd) || (userPendingBranchSeCd as BranchSeCd) || (isForkJoin ? "SP" : "MAIN");
|
||||
const validation = validateChecklistFormStateByBranch({
|
||||
rows: data.cklstResultList ?? [],
|
||||
formState: checklistFormState,
|
||||
reviewStep: "KECO",
|
||||
approverBranchSeCd: branchCd,
|
||||
docTaskSeComCd: normalizedTaskSeComCd || data.detDto?.taskSeComCd || "MAIN",
|
||||
});
|
||||
if (prgrsSttsComCd === "TE") {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"KECO",
|
||||
);
|
||||
|
||||
if (!validation.isValid) {
|
||||
alert(validation.errorMessage || "모든 체크리스트 항목을 체크해야 검토완료가 가능합니다.");
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 검토완료가 가능합니다.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -701,8 +539,7 @@ function FloatingActionButtons({
|
||||
async function handleDmndSplmntConfirm(payload: SplmntDmndDialogConfirmPayload) {
|
||||
setIsDmndSplmntDialogOpen(false);
|
||||
setActiveDialog(null);
|
||||
const branchSeCd = userBranchSeCd ?? userPendingBranchSeCd;
|
||||
const requestPayload = buildSupplementReqPayload(data, payload, checklistFormState, branchSeCd);
|
||||
const requestPayload = buildSupplementReqPayload(data, payload, checklistFormState);
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
request: requestPayload,
|
||||
@@ -726,11 +563,7 @@ function FloatingActionButtons({
|
||||
|
||||
async function handleRvwRsltSplmntConfirm(selected: PwrkCnsltnCnsltnResponseDto[]) {
|
||||
setActiveDialog(null);
|
||||
const branchSeCd = userBranchSeCd ?? userPendingBranchSeCd;
|
||||
const requestPayload = {
|
||||
...buildRvwRsltSplmntReqPayload(data, selected, checklistFormState),
|
||||
branchSeCd,
|
||||
};
|
||||
const requestPayload = buildRvwRsltSplmntReqPayload(data, selected, checklistFormState);
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
request: requestPayload,
|
||||
@@ -905,13 +738,7 @@ function FloatingActionButtons({
|
||||
!isRagIndexingInProgress(prgrsSttsComCd, data.ragIndexingInfo) && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
setActiveDialog(
|
||||
prgrsSttsComCd === "EV"
|
||||
? isForkJoin
|
||||
? "elaprDocPrgrsForkJoin"
|
||||
: "elaprDocPrgrs"
|
||||
: "elaprTmplt",
|
||||
)
|
||||
setActiveDialog(prgrsSttsComCd === "EV" ? "elaprDocPrgrs" : "elaprTmplt")
|
||||
}
|
||||
disabled={isBusy}
|
||||
>
|
||||
@@ -923,15 +750,11 @@ function FloatingActionButtons({
|
||||
조치 완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) &&
|
||||
!(
|
||||
isForkJoin &&
|
||||
(userPendingBranchSeCd === "TOTAL_AGG" || userPendingAtrzSeComCd === "ATRZ04")
|
||||
) && (
|
||||
<Button color="sky" onClick={() => setActiveDialog("rvwRsltInq")} disabled={isBusy}>
|
||||
검토 결과 조회
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) && (
|
||||
<Button color="sky" onClick={() => setActiveDialog("rvwRsltInq")} disabled={isBusy}>
|
||||
검토 결과 조회
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg) && (
|
||||
<Button onClick={handleRvwStrgClick} disabled={isBusy}>
|
||||
저장
|
||||
@@ -951,33 +774,16 @@ function FloatingActionButtons({
|
||||
보완 요청
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv) &&
|
||||
(!isForkJoin ||
|
||||
(userPendingBranchSeCd === "TOTAL_AGG" && userPendingAtrzSeComCd === "ATRZ04")) && (
|
||||
<Button onClick={handleApprovalOpen} disabled={isBusy}>
|
||||
{isForkJoin ? "결재 (병합)" : "결재(승인)"}
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply) &&
|
||||
(!isForkJoin ||
|
||||
(userPendingBranchSeCd !== "TOTAL_AGG" && userPendingAtrzSeComCd === "ATRZ03") ||
|
||||
(userPendingBranchSeCd === "TOTAL_AGG" && userPendingAtrzSeComCd === "ATRZ99")) && (
|
||||
<Button
|
||||
color={
|
||||
isForkJoin && userPendingBranchSeCd !== "TOTAL_AGG"
|
||||
? "green"
|
||||
: undefined
|
||||
}
|
||||
onClick={handleApprovalOpen}
|
||||
disabled={isBusy}
|
||||
>
|
||||
{isForkJoin
|
||||
? userPendingBranchSeCd === "TOTAL_AGG"
|
||||
? "결재 (환경청에 회신)"
|
||||
: "결재 (병합에 회신)"
|
||||
: "결재(회신)"}
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv) && (
|
||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isBusy}>
|
||||
결재(승인)
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply) && (
|
||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isBusy}>
|
||||
결재(회신)
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
@@ -989,7 +795,6 @@ function FloatingActionButtons({
|
||||
open={activeDialog === "elaprTmplt"}
|
||||
onClose={() => setActiveDialog(null)}
|
||||
docSeComCd={docSeComCd}
|
||||
taskSeComCd={normalizedTaskSeComCd || undefined}
|
||||
onConfirm={handleElaprTmpltConfirm}
|
||||
/>
|
||||
|
||||
@@ -1000,13 +805,6 @@ function FloatingActionButtons({
|
||||
onConfirm={handleElaprDocPrgrsConfirm}
|
||||
/>
|
||||
|
||||
<ElaprDocPrgrsForkJoinPickerDialog
|
||||
open={activeDialog === "elaprDocPrgrsForkJoin"}
|
||||
elaprDocNo={docNo}
|
||||
onClose={() => setActiveDialog(null)}
|
||||
onConfirm={handleElaprDocPrgrsConfirm}
|
||||
/>
|
||||
|
||||
<SplmntDmndDialog
|
||||
splmntArtclUpCd="SPLMNTARTCL"
|
||||
open={isDmndSplmntDialogOpen}
|
||||
@@ -1029,29 +827,20 @@ function FloatingActionButtons({
|
||||
elaprDocNo={data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo}
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
elaprCycl={prgrsSttsComCd === "RK" ? 2 : undefined}
|
||||
taskSeComCd={normalizedTaskSeComCd || undefined}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_BRANCH],
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<PwrkCnsltnDocMngDialog
|
||||
open={activeDialog === "pwrkCnsltnDocMng"}
|
||||
fnrsCnsltnDocNo={docNo}
|
||||
atrzSeComCdList={effectiveAtrzSeComCdList}
|
||||
atrzSeComCdList={atrzSeComCdList}
|
||||
prgrsSttsComCd={prgrsSttsComCd}
|
||||
branchSeCd={userBranchSeCd ?? userPendingBranchSeCd}
|
||||
isForkJoin={isForkJoin}
|
||||
userRole={dtlInstCd}
|
||||
supplementDmndBranch={supplementDmndBranch}
|
||||
canSave={
|
||||
(needsElaprPrgrsCheck && !hasPendingApprovalRequest && !isBranchInProgress) ||
|
||||
viewOnlyPwrkCnsltnDoc
|
||||
(needsElaprPrgrsCheck && !hasPendingApprovalRequest) || viewOnlyPwrkCnsltnDoc
|
||||
? false
|
||||
: null
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { useContext, useEffect, useMemo, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { PanelRightClose, PanelRightOpen } from "lucide-react";
|
||||
import { useStore } from "zustand";
|
||||
|
||||
import { getDefaultFileKey, useAlertStore, useTus } from "@/shared/lib";
|
||||
import { StoreContext } from "@/shared/providers";
|
||||
import { AttachmentFileField } from "@/shared/ui";
|
||||
import {
|
||||
attachService,
|
||||
@@ -20,7 +18,6 @@ import {
|
||||
pwrkCnsltnDocCrtRsltService,
|
||||
} from "@/entities/pwrk-cnsltn-doc-crt-rslt";
|
||||
import { usePwrkCnsltnDocPjtcoAjmtMngPage } from "@/entities/pwrk-cnsltn-doc-pjtco-ajmt-mng";
|
||||
import { useElaprBranchesByDocNo, useElaprDocPrgrsByDocNo } from "@/entities/elapr";
|
||||
import {
|
||||
findCompletedPwrkDraft,
|
||||
pwrkCnsltnMngKeys,
|
||||
@@ -34,7 +31,6 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Skeleton,
|
||||
cn,
|
||||
} from "@common/components";
|
||||
|
||||
import { PwrkCnsltnDocEvlDialog } from "./pwrk-cnsltn-doc-evl-dialog";
|
||||
@@ -64,10 +60,6 @@ interface PwrkCnsltnDocMngDialogProps {
|
||||
canSave?: boolean | null;
|
||||
onDmndSplmnt?: () => void;
|
||||
onClose: () => void;
|
||||
branchSeCd?: string;
|
||||
isForkJoin?: boolean;
|
||||
userRole?: string;
|
||||
supplementDmndBranch?: string;
|
||||
}
|
||||
|
||||
interface UploadedAtchFile {
|
||||
@@ -81,65 +73,6 @@ function createPwrkAtchUploadKey(file: File) {
|
||||
return `${PWRK_ATCH_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
function resolveDefaultBranchSeCd({
|
||||
branchSeCd,
|
||||
isForkJoin,
|
||||
userRole,
|
||||
prgrsSttsComCd,
|
||||
supplementDmndBranch,
|
||||
supplementBranches,
|
||||
isFinalApproverAfterMerger,
|
||||
}: {
|
||||
branchSeCd?: string;
|
||||
isForkJoin?: boolean;
|
||||
userRole?: string;
|
||||
prgrsSttsComCd?: string;
|
||||
supplementDmndBranch?: string;
|
||||
supplementBranches?: Set<string>;
|
||||
isFinalApproverAfterMerger?: boolean;
|
||||
}): string {
|
||||
// 0. 순차 결재(!isForkJoin)인 경우: 무조건 "MAIN" 고정 (SP, SF 부서 분기가 없으므로 단일 종합본 처리)
|
||||
if (!isForkJoin) {
|
||||
return "MAIN";
|
||||
}
|
||||
|
||||
// 1. TE, SL, RK 상태가 아닌 경우 (예: RB 등): SP, SF 부서 탭이 노출되지 않고 MAIN 탭만 노출되므로 무조건 "MAIN" 고정
|
||||
// RK 상태는 1차 결재진행상태인 TE 상태와 논리적으로 동일하게 취급되어 부서별(SP, SF) 탭 선택이 유지됨
|
||||
if (prgrsSttsComCd !== "TE" && prgrsSttsComCd !== "SL" && prgrsSttsComCd !== "RK") {
|
||||
return "MAIN";
|
||||
}
|
||||
|
||||
// 2. 병합자 후의 최종 승인자는 무조건 MAIN 탭으로 고정
|
||||
if (isFinalApproverAfterMerger) {
|
||||
return "MAIN";
|
||||
}
|
||||
|
||||
// 3. 공단 사용자 등 본인 부서(branchSeCd)가 있는 경우 본인 부서 탭을 1순위로 지정
|
||||
if (branchSeCd === "TOTAL_AGG") {
|
||||
return "MAIN";
|
||||
}
|
||||
if (branchSeCd && ["SP", "SF", "MAIN"].includes(branchSeCd)) {
|
||||
return branchSeCd;
|
||||
}
|
||||
|
||||
// 4. 지자체 사용자(ROLE_USER05) 또는 본인 부서가 없는 경우: 보완요청 부서 우선 선택 (TE, SL 상태일 때)
|
||||
if (supplementBranches && supplementBranches.size > 0) {
|
||||
if (supplementBranches.size > 1) {
|
||||
return "SP";
|
||||
}
|
||||
if (supplementBranches.has("SP")) return "SP";
|
||||
if (supplementBranches.has("SF")) return "SF";
|
||||
}
|
||||
if (supplementDmndBranch && ["SP", "SF"].includes(supplementDmndBranch)) {
|
||||
return supplementDmndBranch;
|
||||
}
|
||||
if (userRole === "ROLE_USER05" && prgrsSttsComCd === "SL") {
|
||||
return supplementDmndBranch || "SP";
|
||||
}
|
||||
|
||||
return "SP";
|
||||
}
|
||||
|
||||
function PwrkCnsltnDocMngDialog({
|
||||
open,
|
||||
fnrsCnsltnDocNo,
|
||||
@@ -148,174 +81,13 @@ function PwrkCnsltnDocMngDialog({
|
||||
canSave: canSaveProp,
|
||||
onDmndSplmnt,
|
||||
onClose,
|
||||
branchSeCd,
|
||||
isForkJoin,
|
||||
userRole,
|
||||
supplementDmndBranch,
|
||||
}: PwrkCnsltnDocMngDialogProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const storeContext = useContext(StoreContext);
|
||||
const userInfo = storeContext ? useStore(storeContext.userStore, (state) => state.userInfo) : null;
|
||||
const [atchFileGroupId, setAtchFileGroupId] = useState("");
|
||||
const [uploadedFiles, setUploadedFiles] = useState<UploadedAtchFile[]>([]);
|
||||
const [isPjtcoAjmtTableOpen, setIsPjtcoAjmtTableOpen] = useState(false);
|
||||
const [isEvlDialogOpen, setIsEvlDialogOpen] = useState(false);
|
||||
|
||||
// 전자결재 브랜치 목록 직접 조회 (Single Source of Truth)
|
||||
const { data: elaprBranchList = [] } = useElaprBranchesByDocNo(
|
||||
fnrsCnsltnDocNo,
|
||||
open && Boolean(isForkJoin),
|
||||
);
|
||||
|
||||
// 전자결재 결재선 목록 직접 조회 (병합자 / 최종승인자 식별용)
|
||||
const { data: elaprDocPrgrsList = [] } = useElaprDocPrgrsByDocNo(
|
||||
open && Boolean(isForkJoin) ? fnrsCnsltnDocNo : null,
|
||||
);
|
||||
|
||||
const elaprPrgrsForCycl = useMemo(() => {
|
||||
if (!elaprDocPrgrsList.length) return [];
|
||||
if (prgrsSttsComCd === "RK") {
|
||||
const cycl2 = elaprDocPrgrsList.filter((row) => Number(row.elaprCycl) === 2);
|
||||
return cycl2.length > 0 ? cycl2 : elaprDocPrgrsList;
|
||||
}
|
||||
return elaprDocPrgrsList;
|
||||
}, [elaprDocPrgrsList, prgrsSttsComCd]);
|
||||
|
||||
const currentUserPrgrs = useMemo(() => {
|
||||
if (!userInfo?.userUnqId || !elaprPrgrsForCycl.length) return undefined;
|
||||
return (
|
||||
elaprPrgrsForCycl.find(
|
||||
(row) => row.aprvrUuid === userInfo.userUnqId && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
) ?? elaprPrgrsForCycl.find((row) => row.aprvrUuid === userInfo.userUnqId)
|
||||
);
|
||||
}, [userInfo?.userUnqId, elaprPrgrsForCycl]);
|
||||
|
||||
const effectiveBranchSeCd = branchSeCd ?? currentUserPrgrs?.branchSeCd;
|
||||
const effectiveAtrzSeList = useMemo(() => {
|
||||
if (atrzSeComCdList && atrzSeComCdList.length > 0) return atrzSeComCdList;
|
||||
if (currentUserPrgrs?.atrzSeComCd) return [currentUserPrgrs.atrzSeComCd];
|
||||
return [];
|
||||
}, [atrzSeComCdList, currentUserPrgrs?.atrzSeComCd]);
|
||||
|
||||
const isTeOrRk = prgrsSttsComCd === "TE" || prgrsSttsComCd === "RK";
|
||||
|
||||
// 1. 병합자 여부 (TE/RK 상태에서 TOTAL_AGG 브랜치이거나 ATRZ04 권한을 가진 병합자)
|
||||
const isMerger = useMemo(() => {
|
||||
if (!isForkJoin || !isTeOrRk) return false;
|
||||
if (effectiveAtrzSeList.includes("ATRZ04")) return true;
|
||||
if (effectiveBranchSeCd === "TOTAL_AGG" && !effectiveAtrzSeList.some((cd) => APPROVER_ATRZ_SE_COM_CDS.has(cd))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, [isForkJoin, isTeOrRk, effectiveAtrzSeList, effectiveBranchSeCd]);
|
||||
|
||||
// 2. 병합자 후의 최종 승인자 여부 (TE/RK 상태에서 TOTAL_AGG 브랜치이면서 ATRZ04가 아니고 ATRZ03 또는 ATRZ99 등 후속 결재/승인자)
|
||||
const isFinalApproverAfterMerger = useMemo(() => {
|
||||
if (!isForkJoin || !isTeOrRk) return false;
|
||||
if (effectiveBranchSeCd === "TOTAL_AGG") {
|
||||
if (effectiveAtrzSeList.includes("ATRZ04")) return false;
|
||||
if (effectiveAtrzSeList.some((cd) => APPROVER_ATRZ_SE_COM_CDS.has(cd))) return true;
|
||||
if (currentUserPrgrs?.atrzSeq && Number(currentUserPrgrs.atrzSeq) > 1) return true;
|
||||
if (effectiveAtrzSeList.length > 0 && !effectiveAtrzSeList.includes("ATRZ04")) return true;
|
||||
}
|
||||
return false;
|
||||
}, [isForkJoin, isTeOrRk, effectiveBranchSeCd, effectiveAtrzSeList, currentUserPrgrs?.atrzSeq]);
|
||||
|
||||
// 3. 병합 완료(결재 후) 여부
|
||||
// 병합자가 이미 결재(승인)를 진행한 경우 (ATRZ_PRGRS_003 등) MAIN 탭 저장 불가
|
||||
const isMergerApproved = useMemo(() => {
|
||||
if (!isForkJoin || !isMerger) return false;
|
||||
|
||||
// 1순위: 현재 로그인 사용자의 결재선 행 확인
|
||||
if (userInfo?.userUnqId) {
|
||||
const userRows = elaprPrgrsForCycl.filter((row) => row.aprvrUuid === userInfo.userUnqId);
|
||||
const mergerRow = userRows.find(
|
||||
(row) =>
|
||||
row.atrzSeComCd === "ATRZ04" ||
|
||||
(row.branchSeCd === "TOTAL_AGG" && Number(row.atrzSeq) === 1),
|
||||
);
|
||||
if (mergerRow) {
|
||||
return (
|
||||
mergerRow.atrzPrgrsSttsComCd === "ATRZ_PRGRS_003" ||
|
||||
mergerRow.atrzPrgrsSttsComCd === "ATRZ_PRGRS_999"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 2순위: 결재선 상에서 TOTAL_AGG 브랜치 1순번(병합자)의 결재 완료 여부 확인
|
||||
const aggMergerRow = elaprPrgrsForCycl.find(
|
||||
(row) =>
|
||||
row.branchSeCd === "TOTAL_AGG" &&
|
||||
(row.atrzSeComCd === "ATRZ04" || Number(row.atrzSeq) === 1),
|
||||
);
|
||||
if (aggMergerRow) {
|
||||
return (
|
||||
aggMergerRow.atrzPrgrsSttsComCd === "ATRZ_PRGRS_003" ||
|
||||
aggMergerRow.atrzPrgrsSttsComCd === "ATRZ_PRGRS_999"
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}, [isForkJoin, isMerger, userInfo?.userUnqId, elaprPrgrsForCycl]);
|
||||
|
||||
// 전자결재 브랜치 테이블(tb_as_elapr_branch)에서 branchSttsCd === 'SUPPLEMENT'인 부서들을 모두 수집 (SP, SF)
|
||||
const supplementBranches = useMemo<Set<string>>(() => {
|
||||
const branches = new Set<string>();
|
||||
if (!isForkJoin) return branches;
|
||||
|
||||
// 1순위: elaprBranchList에서 SUPPLEMENT 상태인 브랜치들을 모두 수집
|
||||
for (const b of elaprBranchList) {
|
||||
if (b.branchSttsCd === "SUPPLEMENT" && b.branchSeCd && ["SP", "SF"].includes(b.branchSeCd)) {
|
||||
branches.add(b.branchSeCd);
|
||||
}
|
||||
}
|
||||
|
||||
// 2순위: props로 전달된 supplementDmndBranch 추가
|
||||
if (supplementDmndBranch && ["SP", "SF"].includes(supplementDmndBranch)) {
|
||||
branches.add(supplementDmndBranch);
|
||||
}
|
||||
|
||||
return branches;
|
||||
}, [elaprBranchList, isForkJoin, supplementDmndBranch]);
|
||||
|
||||
const [currentBranchSeCd, setCurrentBranchSeCd] = useState<string>(() =>
|
||||
resolveDefaultBranchSeCd({
|
||||
branchSeCd: effectiveBranchSeCd,
|
||||
isForkJoin,
|
||||
userRole,
|
||||
prgrsSttsComCd,
|
||||
supplementDmndBranch,
|
||||
supplementBranches,
|
||||
isFinalApproverAfterMerger,
|
||||
}),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setCurrentBranchSeCd(
|
||||
resolveDefaultBranchSeCd({
|
||||
branchSeCd: effectiveBranchSeCd,
|
||||
isForkJoin,
|
||||
userRole,
|
||||
prgrsSttsComCd,
|
||||
supplementDmndBranch,
|
||||
supplementBranches,
|
||||
isFinalApproverAfterMerger,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}, [
|
||||
open,
|
||||
effectiveBranchSeCd,
|
||||
isForkJoin,
|
||||
userRole,
|
||||
prgrsSttsComCd,
|
||||
supplementBranches,
|
||||
supplementDmndBranch,
|
||||
isFinalApproverAfterMerger,
|
||||
]);
|
||||
|
||||
const { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
|
||||
|
||||
const {
|
||||
@@ -326,27 +98,18 @@ function PwrkCnsltnDocMngDialog({
|
||||
const completedDraft = findCompletedPwrkDraft(pwrkCnsltnData);
|
||||
const crtDmndUuid = completedDraft?.crtDmndUuid;
|
||||
|
||||
const targetBranchForApi = isForkJoin ? currentBranchSeCd : undefined;
|
||||
|
||||
const {
|
||||
data: documentBlob,
|
||||
isLoading: isDocumentLoading,
|
||||
isError: isDocumentError,
|
||||
} = useQuery({
|
||||
queryKey: ["pwrk-cnsltn-doc-crt-rslt", "open-latest", crtDmndUuid, targetBranchForApi],
|
||||
queryFn: () => pwrkCnsltnDocCrtRsltService.openWebHwpLatest(crtDmndUuid!, targetBranchForApi),
|
||||
queryKey: ["pwrk-cnsltn-doc-crt-rslt", "open-latest", crtDmndUuid],
|
||||
queryFn: () => pwrkCnsltnDocCrtRsltService.openWebHwpLatest(crtDmndUuid!),
|
||||
select: (response) => response.data,
|
||||
enabled: open && Boolean(crtDmndUuid),
|
||||
});
|
||||
|
||||
const branchLabel = isForkJoin
|
||||
? currentBranchSeCd === "SP"
|
||||
? "_관로"
|
||||
: currentBranchSeCd === "SF"
|
||||
? "_시설"
|
||||
: "_종합"
|
||||
: "";
|
||||
const documentFileName = `실무협의서${branchLabel}_${pwrkCnsltnData?.pwrkCnsltnDocNo ?? crtDmndUuid}.hwpx`;
|
||||
const documentFileName = `실무협의서_${pwrkCnsltnData?.pwrkCnsltnDocNo ?? crtDmndUuid}.hwpx`;
|
||||
const isLoading = isPwrkCnsltnLoading || isDocumentLoading;
|
||||
const isError = isPwrkCnsltnError || isDocumentError;
|
||||
const pjtcoAjmtSearchParams = useMemo(
|
||||
@@ -409,7 +172,7 @@ function PwrkCnsltnDocMngDialog({
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [open, pwrkCnsltnData?.atchFileGroupId, fnrsCnsltnDocNo, isForkJoin]);
|
||||
}, [open, pwrkCnsltnData?.atchFileGroupId]);
|
||||
|
||||
function handleOpenChange(nextOpen: boolean) {
|
||||
if (!nextOpen) onClose();
|
||||
@@ -418,18 +181,10 @@ function PwrkCnsltnDocMngDialog({
|
||||
async function handleSaveDocument(file: Blob) {
|
||||
if (!completedDraft) throw new Error("저장할 실무협의서 초안이 없습니다.");
|
||||
|
||||
const saveBranch =
|
||||
branchSeCd === "TOTAL_AGG" || currentBranchSeCd === "MAIN"
|
||||
? "MAIN"
|
||||
: isForkJoin
|
||||
? currentBranchSeCd
|
||||
: undefined;
|
||||
|
||||
const saveDto = pwrkCnsltnDocCrtRsltSaveRequestSchema.parse({
|
||||
crtDmndUuid: completedDraft.crtDmndUuid,
|
||||
pwrkCnsltnDocNo: completedDraft.pwrkCnsltnDocNo,
|
||||
atchFileGroupId: atchFileGroupId || undefined,
|
||||
branchSeCd: saveBranch,
|
||||
});
|
||||
|
||||
const savedDocument = await pwrkCnsltnDocCrtRsltService.saveMultipart(
|
||||
@@ -455,10 +210,7 @@ function PwrkCnsltnDocMngDialog({
|
||||
async function handleDownload() {
|
||||
if (!completedDraft) throw new Error("다운로드할 실무협의서 초안이 없습니다.");
|
||||
|
||||
const response = await pwrkCnsltnDocCrtRsltService.downloadLatest(
|
||||
completedDraft.crtDmndUuid,
|
||||
targetBranchForApi,
|
||||
);
|
||||
const response = await pwrkCnsltnDocCrtRsltService.downloadLatest(completedDraft.crtDmndUuid);
|
||||
const objectUrl = window.URL.createObjectURL(response.data);
|
||||
const anchor = document.createElement("a");
|
||||
anchor.href = objectUrl;
|
||||
@@ -525,167 +277,20 @@ function PwrkCnsltnDocMngDialog({
|
||||
const canSaveByAtrz = atrzSeComCdList
|
||||
? !atrzSeComCdList.some((code) => APPROVER_ATRZ_SE_COM_CDS.has(code))
|
||||
: true;
|
||||
const baseCanSave = !viewOnly && (canSaveProp ?? canSaveByAtrz);
|
||||
|
||||
const canSaveCurrentBranch = useMemo(() => {
|
||||
// 1. 지자체 사용자 (ROLE_USER05)
|
||||
if (userRole === "ROLE_USER05") {
|
||||
// 1-1. RB(조치결과작성) 상태: 병렬결재에서도 프로세스상 한 개의 MAIN만 남아 처리되므로 MAIN 탭 저장 허용!
|
||||
if (prgrsSttsComCd === "RB") {
|
||||
return currentBranchSeCd === "MAIN";
|
||||
}
|
||||
|
||||
// 1-2. SL(보완요청/조치결과요청) 상태: 보완요청 부서(SP, SF) 초안만 저장 허용
|
||||
if (prgrsSttsComCd === "SL") {
|
||||
if (isForkJoin) {
|
||||
// 보완요청 부서(supplementBranches)가 존재하는 경우 해당 부서만 저장 허용
|
||||
if (supplementBranches.size > 0) {
|
||||
return supplementBranches.has(currentBranchSeCd);
|
||||
}
|
||||
return currentBranchSeCd === "SP" || currentBranchSeCd === "SF";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. 공단 사용자 등 일반 사용자 (검토자, 결재자 등)
|
||||
if (!baseCanSave) return false;
|
||||
|
||||
if (isForkJoin) {
|
||||
// 2-1. 병합자 후의 최종 승인자 또는 병합 완료(결재 후)된 병합자: 저장 불가 (읽기 전용)
|
||||
if (isFinalApproverAfterMerger || isMergerApproved) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2-2. 종합병합자 (ATRZ04 또는 TOTAL_AGG):
|
||||
// 웹기안기의 한글문서 저장 버튼은 MAIN 탭의 것만 저장 버튼이 보이고 SP, SF 탭의 저장 버튼은 보이지 않음!
|
||||
if (isMerger || effectiveBranchSeCd === "TOTAL_AGG") {
|
||||
return currentBranchSeCd === "MAIN";
|
||||
}
|
||||
|
||||
// 2-3. 관로 검토자: 관로(SP) 탭만 저장 가능 (타 부서 보완요청 여부와 무관하게 본인 부서 작성/수정 가능)
|
||||
if (effectiveBranchSeCd === "SP") {
|
||||
return currentBranchSeCd === "SP";
|
||||
}
|
||||
|
||||
// 2-4. 시설 검토자: 시설(SF) 탭만 저장 가능 (타 부서 보완요청 여부와 무관하게 본인 부서 작성/수정 가능)
|
||||
if (effectiveBranchSeCd === "SF") {
|
||||
return currentBranchSeCd === "SF";
|
||||
}
|
||||
|
||||
// 특정 부서가 지정되지 않은 일반 관리자/사용자
|
||||
return baseCanSave;
|
||||
}
|
||||
|
||||
return baseCanSave;
|
||||
}, [
|
||||
baseCanSave,
|
||||
userRole,
|
||||
prgrsSttsComCd,
|
||||
isForkJoin,
|
||||
isFinalApproverAfterMerger,
|
||||
isMerger,
|
||||
isMergerApproved,
|
||||
effectiveBranchSeCd,
|
||||
currentBranchSeCd,
|
||||
supplementBranches,
|
||||
]);
|
||||
|
||||
const editorIframeHeight = isForkJoin
|
||||
? "h-[50vh] min-h-[26rem]"
|
||||
: "h-[58vh] min-h-[32rem]";
|
||||
const editorContainerMinHeight = isForkJoin ? "min-h-[26rem]" : "min-h-[32rem]";
|
||||
const pjtcoTableHeight = isForkJoin
|
||||
? "h-[calc(50vh+4rem)]"
|
||||
: "h-[calc(58vh+4rem)]";
|
||||
const canSave = !viewOnly && (canSaveProp ?? canSaveByAtrz);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent
|
||||
className="flex max-h-[96vh] max-w-[80vw] flex-col gap-4 overflow-y-auto"
|
||||
className="max-h-[96vh] max-w-[80vw] overflow-y-auto"
|
||||
aria-describedby={undefined}
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle>실무협의서 관리</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{isForkJoin ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/40 px-3 py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-semibold text-muted-foreground">부서별 문서 탭:</span>
|
||||
{!isFinalApproverAfterMerger &&
|
||||
(prgrsSttsComCd === "TE" || prgrsSttsComCd === "SL" || prgrsSttsComCd === "RK") && (
|
||||
<>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color={currentBranchSeCd === "SP" ? "primary" : "white"}
|
||||
onClick={() => setCurrentBranchSeCd("SP")}
|
||||
>
|
||||
관로 초안 (SP)
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color={currentBranchSeCd === "SF" ? "primary" : "white"}
|
||||
onClick={() => setCurrentBranchSeCd("SF")}
|
||||
>
|
||||
시설 초안 (SF)
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color={currentBranchSeCd === "MAIN" ? "primary" : "white"}
|
||||
onClick={() => setCurrentBranchSeCd("MAIN")}
|
||||
>
|
||||
종합 실무협의서 (MAIN)
|
||||
</Button>
|
||||
</div>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{userRole === "ROLE_USER05"
|
||||
? prgrsSttsComCd === "RB"
|
||||
? "지자체 담당자: 종합 실무협의서(MAIN) 조치결과 작성 모드 (저장 가능)"
|
||||
: isForkJoin && supplementBranches.size > 0
|
||||
? supplementBranches.has(currentBranchSeCd)
|
||||
? supplementBranches.size > 1
|
||||
? `[보완 수정 모드] 관로·시설 부서 모두 보완요청 상태이며, ${currentBranchSeCd === "SP" ? "관로" : "시설"} 초안을 수정 및 저장할 수 있습니다.`
|
||||
: `[보완 수정 모드] ${supplementBranches.has("SP") ? "관로" : "시설"} 초안만 수정 및 저장 가능합니다.`
|
||||
: `[읽기 전용 모드] ${currentBranchSeCd === "MAIN" ? "종합본" : currentBranchSeCd === "SP" ? "관로 초안" : "시설 초안"}은 보완 비대상으로 저장 불가합니다.`
|
||||
: prgrsSttsComCd === "SL"
|
||||
? `지자체 담당자: ${currentBranchSeCd === "MAIN" ? "종합본 열람 전용" : `${currentBranchSeCd === "SP" ? "관로" : "시설"} 초안 보완 수정 모드 (저장 가능)`}`
|
||||
: "지자체 사용자: 문서 열람 모드"
|
||||
: isFinalApproverAfterMerger
|
||||
? "최종 승인자: MAIN 종합 실무협의서 열람 모드"
|
||||
: isMerger || effectiveBranchSeCd === "TOTAL_AGG"
|
||||
? isMergerApproved
|
||||
? "종합병합자: 병합 결재 완료 (읽기 전용 모드)"
|
||||
: currentBranchSeCd === "MAIN"
|
||||
? "종합병합자: SP/SF를 참조하여 MAIN 종합본을 수동 병합 저장합니다."
|
||||
: "종합병합자: 타 문서 열람 모드 (읽기 전용)"
|
||||
: effectiveBranchSeCd === "SP"
|
||||
? currentBranchSeCd === "SP"
|
||||
? "관로 검토자: 관로 초안(SP) 편집 모드 (저장 가능)"
|
||||
: "관로 검토자: 타 문서 열람 모드 (읽기 전용)"
|
||||
: effectiveBranchSeCd === "SF"
|
||||
? currentBranchSeCd === "SF"
|
||||
? "시설 검토자: 시설 초안(SF) 편집 모드 (저장 가능)"
|
||||
: "시설 검토자: 타 문서 열람 모드 (읽기 전용)"
|
||||
: isForkJoin && supplementBranches.size > 0
|
||||
? `[보완 진행 중] ${Array.from(supplementBranches).join(", ")} 부서 보완요청 진행 중`
|
||||
: "문서 열람 모드"}
|
||||
</span>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{isLoading ? (
|
||||
<Skeleton
|
||||
className={cn("w-full", isForkJoin ? "h-[56vh] min-h-[26rem]" : "h-[64vh] min-h-[32rem]")}
|
||||
/>
|
||||
) : null}
|
||||
{isLoading ? <Skeleton className="h-[70vh] min-h-[40rem] w-full" /> : null}
|
||||
{isError ? (
|
||||
<p className="py-16 text-center text-lg text-muted-foreground">
|
||||
실무협의서 정보를 불러오지 못했습니다.
|
||||
@@ -697,14 +302,13 @@ function PwrkCnsltnDocMngDialog({
|
||||
</p>
|
||||
) : null}
|
||||
{completedDraft && documentBlob ? (
|
||||
<div className={cn("flex items-stretch gap-2", editorContainerMinHeight)}>
|
||||
<div className="flex min-h-[40rem] items-stretch gap-2">
|
||||
<div className="min-w-0 flex-1">
|
||||
<HangulGiangi
|
||||
documentBlob={documentBlob}
|
||||
documentKey={`${completedDraft.crtDmndUuid}_${currentBranchSeCd}`}
|
||||
documentKey={completedDraft.crtDmndUuid}
|
||||
documentFileName={documentFileName}
|
||||
canSave={canSaveCurrentBranch}
|
||||
iframeClassName={editorIframeHeight}
|
||||
canSave={canSave}
|
||||
onSaveDocument={handleSaveDocument}
|
||||
onDownload={handleDownload}
|
||||
onDmndSplmnt={onDmndSplmnt}
|
||||
@@ -712,12 +316,7 @@ function PwrkCnsltnDocMngDialog({
|
||||
</div>
|
||||
{pjtcoAjmtPage?.content?.length ? (
|
||||
isPjtcoAjmtTableOpen ? (
|
||||
<section
|
||||
className={cn(
|
||||
"flex w-0 flex-[0.4] flex-col overflow-hidden rounded-md border border-border",
|
||||
pjtcoTableHeight,
|
||||
)}
|
||||
>
|
||||
<section className="flex h-[calc(64vh+4rem)] w-0 flex-[0.4] flex-col overflow-hidden rounded-md border border-border">
|
||||
<header className="flex items-center justify-between gap-2 border-b border-border px-3 py-2">
|
||||
<h3 className="text-xl font-semibold">금액검증결과</h3>
|
||||
<button
|
||||
@@ -767,10 +366,10 @@ function PwrkCnsltnDocMngDialog({
|
||||
}))}
|
||||
inputId="pwrk-cnsltn-doc-atch-file-input"
|
||||
isUploadingByKey={isUploading}
|
||||
addDisabled={!canSaveCurrentBranch || isAnyAtchUploading}
|
||||
showAddButton={canSaveCurrentBranch}
|
||||
addDisabled={!canSave || isAnyAtchUploading}
|
||||
showAddButton={canSave}
|
||||
onAdd={(files) => void handleAtchFileUpload(files)}
|
||||
onRemove={canSaveCurrentBranch ? (index) => void handleAtchFileRemove(index) : undefined}
|
||||
onRemove={canSave ? (index) => void handleAtchFileRemove(index) : undefined}
|
||||
/>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
@@ -42,7 +42,7 @@ function PwrkCnsltnDocPjtcoAjmtTable({
|
||||
}
|
||||
|
||||
return (
|
||||
<Table caption="사업비 조정 내역: 구분, 검증결과, 검증금액 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="30%" />
|
||||
<col width="50%" />
|
||||
|
||||
@@ -157,7 +157,7 @@ function CnsltnListTable({
|
||||
const isSomeSelected = selectedCount > 0 && !isAllSelected;
|
||||
|
||||
return (
|
||||
<Table caption="자문 검토결과 목록: 구분, 검토의견 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="4%" />
|
||||
<col width="4%" />
|
||||
|
||||
@@ -39,7 +39,6 @@ import { Button } from "@common/components";
|
||||
import {
|
||||
type FnrsCnsltnRegistFormData,
|
||||
fnrsCnsltnRegistSchema,
|
||||
isForkJoinTask,
|
||||
} from "../lib/fnrs-cnsltn-regist-schema";
|
||||
import {
|
||||
buildFormPayload,
|
||||
@@ -249,11 +248,8 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
||||
<FormProvider {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="mt-4">
|
||||
<SectionCollapsibleGroup>
|
||||
<div className="sticky top-[6rem] z-30 flex items-center justify-between bg-container px-4 py-2">
|
||||
<div className="sticky top-[6rem] z-30 bg-container px-4 py-2">
|
||||
<SectionCollapsibleToggle />
|
||||
<p className="text-sm text-muted-foreground">
|
||||
<span className="text-red-600">*</span>은 필수입력 항목입니다.
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{initialData?.detDto?.fnrsCnsltnDocNo && (
|
||||
@@ -350,10 +346,7 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
||||
<PwrkCnsltnDocMngDialog
|
||||
open={isPwrkCnsltnDocMngOpen}
|
||||
fnrsCnsltnDocNo={fnrsCnsltnDocNo}
|
||||
isForkJoin={isForkJoinTask(initialData?.detDto?.taskSeComCd)}
|
||||
userRole={userInfo?.dtlInstCd}
|
||||
prgrsSttsComCd={initialData?.detDto?.prgrsSttsComCd ?? undefined}
|
||||
canSave={isSplmntPrgrsStts && userInfo?.dtlInstCd === "ROLE_USER05" ? null : !isSplmntPrgrsStts}
|
||||
canSave
|
||||
onClose={() => setIsPwrkCnsltnDocMngOpen(false)}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -59,7 +59,6 @@ function FnrsList({ searchParams, pagination, onPaginationChange }: FnrsListProp
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "재원협의 목록",
|
||||
viewPagination: true,
|
||||
onRowClick: handleRowClick,
|
||||
},
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
} from "../lib/ai-pending-utils";
|
||||
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
|
||||
import { getEditableReviewStep } from "../lib/review-step-utils";
|
||||
import { normalizeTaskSeComCdForElapr } from "../lib/fnrs-cnsltn-regist-schema";
|
||||
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
||||
import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||
|
||||
@@ -131,10 +130,7 @@ function FnrsViewPage({ id }: FnrsViewPageProps) {
|
||||
/>
|
||||
<BasicInfoSection det={detDto} />
|
||||
<ContactInfoSection det={detDto} />
|
||||
<ElaprDocPrgrsStatus
|
||||
elaprDocNo={detDto.fnrsCnsltnDocNo}
|
||||
taskSeComCd={normalizeTaskSeComCdForElapr(detDto.taskSeComCd)}
|
||||
/>
|
||||
<ElaprDocPrgrsStatus elaprDocNo={detDto.fnrsCnsltnDocNo} />
|
||||
<BusinessScaleSection bizSclList={bizSclList} />
|
||||
<BusinessCostSection bizCstList={bizCstList} />
|
||||
<FnrsSharSection fnrsSharList={fnrsSharList} />
|
||||
|
||||
@@ -49,7 +49,7 @@ function BasicInfoFormSection() {
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table caption="재원협의 기본 정보 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -58,7 +58,7 @@ function BasicInfoFormSection() {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row" className="w-[20rem]" data-required>
|
||||
<TableHead className="w-[20rem]" data-required>
|
||||
사업명
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
@@ -86,7 +86,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업기간</TableHead>
|
||||
<TableHead data-required>사업기간</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<FieldGroup className="flex-row items-center gap-2">
|
||||
<Controller
|
||||
@@ -130,7 +130,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업내용</TableHead>
|
||||
<TableHead data-required>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.bizCn"
|
||||
@@ -150,15 +150,15 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>구분</TableHead>
|
||||
<TableHead data-required>구분</TableHead>
|
||||
<TableCell>{taskSeComCdLabel}</TableCell>
|
||||
<TableHead scope="row">신청 지자체</TableHead>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell>{localGovLabel}</TableCell>
|
||||
</TableRow>
|
||||
{taskSeComCd.includes("RE") && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row">시설종류</TableHead>
|
||||
<TableHead>시설종류</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.rtlztnFcltSeComCd"
|
||||
@@ -198,7 +198,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">재이용용도</TableHead>
|
||||
<TableHead>재이용용도</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.rtlztnUsgSeComCd"
|
||||
|
||||
@@ -11,7 +11,7 @@ interface BasicInfoSectionProps {
|
||||
function BasicInfoSection({ det }: BasicInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table caption="재원협의 기본 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -20,31 +20,31 @@ function BasicInfoSection({ det }: BasicInfoSectionProps) {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row">사업명</TableHead>
|
||||
<TableHead>사업명</TableHead>
|
||||
<TableCell>{det.bizNm || "-"}</TableCell>
|
||||
<TableHead scope="row">사업기간</TableHead>
|
||||
<TableHead>사업기간</TableHead>
|
||||
<TableCell>{(det.bizBgngYr || "-") + " ~ " + (det.bizEndYr || "-")}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">사업내용</TableHead>
|
||||
<TableHead>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>{det.bizCn || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">환경청구분</TableHead>
|
||||
<TableHead>환경청구분</TableHead>
|
||||
<TableCell>{det.envoSeCdNm || "-"}</TableCell>
|
||||
<TableHead scope="row">구분</TableHead>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableCell>{det.taskSeCdNm || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">신청지자체</TableHead>
|
||||
<TableHead>신청지자체</TableHead>
|
||||
<TableCell>
|
||||
{det.sido || "-"} {det.gugun || "-"}
|
||||
</TableCell>
|
||||
<TableHead scope="row">확정예산사업번호</TableHead>
|
||||
<TableHead>확정예산사업번호</TableHead>
|
||||
<TableCell>{det.cfmtnBgtBizNo || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">예산신청연도</TableHead>
|
||||
<TableHead>예산신청연도</TableHead>
|
||||
<TableCell colSpan={3}>{det.bgtAplyYr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
|
||||
@@ -20,7 +20,7 @@ function BusinessCostSection({ bizCstList }: BusinessCostSectionProps) {
|
||||
<SectionCollapsible title="총사업비">
|
||||
<div className="overflow-x-auto">
|
||||
<p className="mb-2 text-right font-normal text-muted-foreground">(단위: 백만원)</p>
|
||||
<Table caption="총사업비 내역: 구분, 예산반영, 표준사업비, 금회설계, 증감 정보 제공" variant="secondary" className="table-fixed">
|
||||
<Table variant="secondary" className="table-fixed">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]" rowSpan={2}>
|
||||
@@ -51,9 +51,9 @@ function BusinessCostSection({ bizCstList }: BusinessCostSectionProps) {
|
||||
return (
|
||||
<TableRow key={node.acntgSeCd}>
|
||||
{node.treeLevel <= 1 ? (
|
||||
<TableHead scope="row" className="!px-[0.8rem] text-left">{node.acntgSeCdNm}</TableHead>
|
||||
<TableHead className="!px-[0.8rem] text-left">{node.acntgSeCdNm}</TableHead>
|
||||
) : (
|
||||
<TableHead scope="row" className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||
{node.acntgSeCdNm}
|
||||
</TableHead>
|
||||
|
||||
@@ -13,7 +13,7 @@ function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="사업규모">
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="사업규모 내역: 구분, 기본계획, 예산반영, 금회설계, 증감 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]">구분</TableHead>
|
||||
@@ -36,7 +36,7 @@ function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
|
||||
return (
|
||||
<TableRow key={node.cnstpSeCd}>
|
||||
<TableHead scope="row" className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{node.cnstpSeCdNm}
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
|
||||
@@ -11,21 +11,21 @@ interface ContactInfoSectionProps {
|
||||
function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="담당자 정보">
|
||||
<Table caption="재원협의 담당자 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
{det.aplcntNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row" rowSpan={2}>신청자</TableHead>
|
||||
<TableHead scope="row">이름</TableHead>
|
||||
<TableHead rowSpan={2}>신청자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.aplcntNm || "-"}</TableCell>
|
||||
<TableHead scope="row">연락처</TableHead>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.aplcntMblTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">소속</TableHead>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.aplcntOgdpNm || "-"}</TableCell>
|
||||
<TableHead scope="row">이메일</TableHead>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.aplcntEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
@@ -33,16 +33,16 @@ function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
{det.dsgnrNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row" rowSpan={2}>설계자</TableHead>
|
||||
<TableHead scope="row">이름</TableHead>
|
||||
<TableHead rowSpan={2}>설계자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.dsgnrNm || "-"}</TableCell>
|
||||
<TableHead scope="row">연락처</TableHead>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.dsgnrTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">소속</TableHead>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.dsgnrOgdpNm || "-"}</TableCell>
|
||||
<TableHead scope="row">이메일</TableHead>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.dsgnrEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
|
||||
@@ -21,7 +21,7 @@ function FnrsSharSection({ fnrsSharList }: FnrsSharSectionProps) {
|
||||
<SectionCollapsible title="재원분담">
|
||||
<div className="overflow-x-auto">
|
||||
<p className="mb-2 text-right font-normal text-muted-foreground">(단위: 백만원)</p>
|
||||
<Table caption="재원분담 내역: 구분, 현행, 변경요구, 증감, 비고 정보 제공" variant="secondary" className="table-fixed">
|
||||
<Table variant="secondary" className="table-fixed">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[24rem]" rowSpan={2}>
|
||||
@@ -51,7 +51,7 @@ function FnrsSharSection({ fnrsSharList }: FnrsSharSectionProps) {
|
||||
|
||||
return (
|
||||
<TableRow key={node.fnrsSharSeCd}>
|
||||
<TableHead scope="row" className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||
{node.fnrsSharSeCdNm}
|
||||
</TableHead>
|
||||
|
||||
@@ -189,7 +189,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-xl font-semibold">검토의견 작성</h4>
|
||||
<Table caption="검토의견 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[12rem]">의견내용</TableHead>
|
||||
@@ -303,7 +303,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) {
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="검토의견 목록: 의견자, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="55%" />
|
||||
|
||||
@@ -0,0 +1,891 @@
|
||||
"use client";
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any, simple-import-sort/imports */
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Button } from "@common/components";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
// InstlSncnApi imported below with types
|
||||
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 { dayjs, useUserStore, useAlertStore } from "@/shared/lib";
|
||||
import { InstlSncnApi, type InstlSncnApplySaveRequestDto } from "@/entities/instl-sncn";
|
||||
import { client } from "@/shared/api";
|
||||
|
||||
import "./cnfm-page.css";
|
||||
|
||||
type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
|
||||
const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||
const ROLE_TO_REVIEW_STEP: Record<string, ReviewStepCode> = {
|
||||
ROLE_USER05: "LOCAL",
|
||||
ROLE_USER04: "LOCAL",
|
||||
ROLE_USER03: "ENV",
|
||||
ROLE_USER02: "KECO",
|
||||
ROLE_USER01: "KECO",
|
||||
};
|
||||
const REVIEW_STEP_ROLE_RANK: Record<ReviewStepCode, number> = {
|
||||
LOCAL: 1,
|
||||
ENV: 2,
|
||||
KECO: 3,
|
||||
};
|
||||
const INSTL_PROGRESS_ORDER = [
|
||||
"SV",
|
||||
"ST",
|
||||
"LE",
|
||||
"ER",
|
||||
"EE",
|
||||
"TE",
|
||||
"TS",
|
||||
"TR",
|
||||
"TP",
|
||||
"EP",
|
||||
"TA",
|
||||
"TB",
|
||||
];
|
||||
|
||||
const getProgressStepCount = (prgrsSttsComCd?: string): number => {
|
||||
const idx = INSTL_PROGRESS_ORDER.indexOf(prgrsSttsComCd ?? "ST");
|
||||
if (idx <= INSTL_PROGRESS_ORDER.indexOf("ST")) return 1;
|
||||
if (idx <= INSTL_PROGRESS_ORDER.indexOf("TP")) return 2;
|
||||
return 3;
|
||||
};
|
||||
|
||||
const getRoleStepCount = (dtlInstCd?: string): number => {
|
||||
const mapped = dtlInstCd ? ROLE_TO_REVIEW_STEP[dtlInstCd] : undefined;
|
||||
return mapped ? REVIEW_STEP_ROLE_RANK[mapped] : 0;
|
||||
};
|
||||
|
||||
// 업무구분 코드 -> 표시명 매핑 (체크리스트 그룹 표시용)
|
||||
const TASK_CODE_LABELS: Record<string, string> = {
|
||||
RE: "재이용수",
|
||||
SP: "하수관로",
|
||||
SF: "하수처리시설",
|
||||
};
|
||||
|
||||
const normalizeChecklistResultMap = (
|
||||
raw: unknown,
|
||||
): Record<ReviewStepCode, any[]> => {
|
||||
const base: Record<ReviewStepCode, any[]> = { LOCAL: [], ENV: [], KECO: [] };
|
||||
if (!raw) return base;
|
||||
|
||||
if (Array.isArray(raw)) {
|
||||
raw.forEach((row: any) => {
|
||||
const step = (row?.rvwStpComCd ?? "LOCAL") as ReviewStepCode;
|
||||
if (REVIEW_STEP_CODES.includes(step)) {
|
||||
base[step].push(row);
|
||||
}
|
||||
});
|
||||
return base;
|
||||
}
|
||||
|
||||
if (typeof raw === "object") {
|
||||
REVIEW_STEP_CODES.forEach((step) => {
|
||||
const rows = (raw as Record<string, unknown>)[step];
|
||||
base[step] = Array.isArray(rows) ? (rows as any[]) : [];
|
||||
});
|
||||
}
|
||||
|
||||
return base;
|
||||
};
|
||||
|
||||
function CnfmViewPage({ id }: { id: string }) {
|
||||
const router = useRouter();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ["instl-sncn-detail", id],
|
||||
queryFn: () => InstlSncnApi.getById(id),
|
||||
});
|
||||
|
||||
const data = (query.data ?? {}) as any;
|
||||
|
||||
// support API shape where payload includes detDto + lists
|
||||
const det = data.detDto ?? data;
|
||||
const bizSclList = data.bizSclList ?? [];
|
||||
const bizCstList = data.bizCstList ?? [];
|
||||
// API now provides a flat checklist result list: `cklstResultList`
|
||||
const rawCklst = useMemo(() => data.cklstResultList ?? [], [data.cklstResultList]);
|
||||
|
||||
// ensure we have a flat array
|
||||
const cklstAll = useMemo(() => (Array.isArray(rawCklst) ? (rawCklst as any[]) : []), [rawCklst]);
|
||||
|
||||
// build a step-keyed map from the flat list so the rest of the view can use same access pattern
|
||||
const cklstResultMap = useMemo(() => {
|
||||
const base: Record<ReviewStepCode, any[]> = { LOCAL: [], ENV: [], KECO: [] };
|
||||
(cklstAll ?? []).forEach((row: any) => {
|
||||
const step = (row?.rvwStpComCd ?? "LOCAL") as ReviewStepCode;
|
||||
if (REVIEW_STEP_CODES.includes(step)) base[step].push(row);
|
||||
});
|
||||
return base;
|
||||
}, [cklstAll]);
|
||||
const esntlFileList = data.esntlFileList ?? [];
|
||||
const etcFileList = data.etcFileList ?? [];
|
||||
const elaprDocPrgrsList = (data.elaprDocPrgrsList ?? []) as any[];
|
||||
const renderApproverCell = (code: string) => {
|
||||
const row = elaprDocPrgrsList.find((r) => r.atrzSeComCd === code);
|
||||
if (!row) return <div className="text-center">-</div>;
|
||||
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||
const statusMap: Record<string, { label: string; badgeClass: string; icon: string }> = {
|
||||
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700", icon: "⏳" },
|
||||
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-800", icon: "📨" },
|
||||
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: "" };
|
||||
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}` : ""}` : ""}
|
||||
</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}
|
||||
{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}`}
|
||||
>
|
||||
<span className="mr-1">{st.icon}</span>
|
||||
<span>{st.label}</span>
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const orderedApprovers = useMemo(() => {
|
||||
return (elaprDocPrgrsList ?? []).slice().sort((a: any, b: any) => {
|
||||
const A = Number(a?.atrzSeqNo ?? 0);
|
||||
const B = Number(b?.atrzSeqNo ?? 0);
|
||||
return A - B;
|
||||
});
|
||||
}, [elaprDocPrgrsList]);
|
||||
|
||||
const handleApproveClick = async (elaprPrgrsId: any, atrzSeComCd: any) => {
|
||||
if (!elaprPrgrsId) {
|
||||
alert("결재 정보가 올바르지 않습니다.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await processElaprPrgrs(String(elaprPrgrsId), "ATRZ_PRGRS_003"); //진행상태를 승인으로 업데이트
|
||||
alert("결재가 완료되었습니다.");
|
||||
try {
|
||||
await query.refetch();
|
||||
} catch (e) {
|
||||
/* ignore refetch errors */
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("결재 처리 실패", err);
|
||||
const msg = axios.isAxiosError(err) && err.response?.data?.message ? err.response.data.message : "결재 처리 중 오류가 발생했습니다.";
|
||||
alert(msg);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAssignApproverClick = async (elaprTmpltId: string) => {
|
||||
try {
|
||||
const payload = {
|
||||
elaprDocNo: det.instlSncnDocNo,
|
||||
elaprTmpltId: elaprTmpltId, /* 팝업에서 선택된 전자결제 템플릿 */
|
||||
dmndTtl: det.bizNm, /* "구례 하수도 처리시설 2026", */
|
||||
dmndCn: det.bizCn /*"구례 발주 하수도 처리시설 사업 2026년도 진행분 결제 요청 입니다."*/
|
||||
};
|
||||
// ElaprDmndApi 서비스를 통해 백엔드 연동
|
||||
await ElaprDmndApi.create(payload);
|
||||
alert("결재자 지정(결재요청 등록)이 완료되었습니다.");
|
||||
try {
|
||||
await query.refetch();
|
||||
} catch (e) {
|
||||
/* ignore refetch errors */
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("결재자 지정 실패", err);
|
||||
const msg = axios.isAxiosError(err) && err.response?.data?.message ? err.response.data.message : "결재자 지정 중 오류가 발생했습니다.";
|
||||
alert(msg);
|
||||
}
|
||||
};
|
||||
|
||||
const renderApproverRow = (row: any) => {
|
||||
if (!row) return <div className="text-center">-</div>;
|
||||
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||
const statusMap: Record<string, { label: string; badgeClass: string; icon: string }> = {
|
||||
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700", icon: "⏳" },
|
||||
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-800", icon: "📨" },
|
||||
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: "" };
|
||||
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}` : ""}` : ""}
|
||||
</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}
|
||||
{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}`}
|
||||
>
|
||||
<span className="mr-1">{st.icon}</span>
|
||||
<span>{st.label}</span>
|
||||
</span>
|
||||
{status === "ATRZ_PRGRS_002" && userInfo?.userUnqId === row.aprvrUuid ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleApproveClick(row.elaprPrgrsId, row.atrzSeComCd)}
|
||||
className="ml-2 px-2 py-1 bg-blue-500 text-white text-xs rounded"
|
||||
>
|
||||
결제
|
||||
</button>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const currentPrgrsSttsComCd = (det.prgrsSttsComCd as string | undefined) ?? "ST";
|
||||
const roleBasedMaxStepCount = getRoleStepCount(userInfo?.dtlInstCd);
|
||||
const progressBasedMaxStepCount = getProgressStepCount(currentPrgrsSttsComCd);
|
||||
const visibleStepCount = Math.min(progressBasedMaxStepCount, roleBasedMaxStepCount);
|
||||
const visibleReviewStepCodes = useMemo(
|
||||
() => REVIEW_STEP_CODES.slice(0, visibleStepCount),
|
||||
[visibleStepCount],
|
||||
);
|
||||
const [selectedReviewStep, setSelectedReviewStep] = useState<ReviewStepCode>("LOCAL");
|
||||
// selected task code for header filtering (null = none selected)
|
||||
const [selectedTaskCode, setSelectedTaskCode] = useState<string | null>(null);
|
||||
|
||||
// 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)));
|
||||
}, [cklstAll]);
|
||||
|
||||
useEffect(() => {
|
||||
if (visibleReviewStepCodes.length === 0) return;
|
||||
if (!visibleReviewStepCodes.includes(selectedReviewStep)) {
|
||||
setSelectedReviewStep(visibleReviewStepCodes[visibleReviewStepCodes.length - 1]);
|
||||
}
|
||||
}, [selectedReviewStep, visibleReviewStepCodes]);
|
||||
|
||||
// when checklist result task codes change, default selectedTaskCode to first available code
|
||||
useEffect(() => {
|
||||
if (!taskCodes || taskCodes.length === 0) {
|
||||
if (selectedTaskCode !== null) setSelectedTaskCode(null);
|
||||
return;
|
||||
}
|
||||
if (!selectedTaskCode || !taskCodes.includes(selectedTaskCode)) {
|
||||
setSelectedTaskCode(taskCodes[0]);
|
||||
}
|
||||
}, [taskCodes, selectedTaskCode]);
|
||||
|
||||
const selectedChecklistRows = useMemo(() => {
|
||||
if (visibleReviewStepCodes.length === 0) return [];
|
||||
const rows = (cklstResultMap[selectedReviewStep] ?? []).filter((r: any) =>
|
||||
selectedTaskCode ? (r.taskSeComCd ?? "") === selectedTaskCode : true,
|
||||
);
|
||||
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),
|
||||
);
|
||||
}, [cklstResultMap, selectedReviewStep, visibleReviewStepCodes.length, selectedTaskCode]);
|
||||
|
||||
const [viewCheckResults, setViewCheckResults] = useState<Record<string, string>>({});
|
||||
const [viewCheckComments, setViewCheckComments] = useState<Record<string, 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 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) ?? "";
|
||||
return acc + (val ? 1 : 0);
|
||||
}, 0);
|
||||
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
return { total, completed, percent };
|
||||
}, [cklstResultMap, viewCheckResults, selectedReviewStep, selectedTaskCode]);
|
||||
|
||||
const fnValidation = (mode: "SAVE" | "SUBMIT") => {
|
||||
// 기본 검증: 필요하면 확장
|
||||
return true;
|
||||
};
|
||||
|
||||
const hadleTechReviewSubmit = async () => {
|
||||
if (!fnValidation("SAVE")) return;
|
||||
|
||||
const cklstResultList = (cklstAll ?? [])
|
||||
.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;
|
||||
return {
|
||||
taskSeComCd: row.taskSeComCd ?? "",
|
||||
cklstSn: row.cklstSn,
|
||||
cklstArtclSn: row.cklstArtclSn,
|
||||
cklstRvwSn: row.cklstRvwSn,
|
||||
rvwStpComCd: selectedReviewStep,
|
||||
rvwRsltAnmlyYn,
|
||||
picRvwCn,
|
||||
};
|
||||
});
|
||||
|
||||
const payload: InstlSncnApplySaveRequestDto = {
|
||||
// only map core management DTO and checklist results; other lists empty per request
|
||||
instlSncnMng: { ...(det ?? {}), prgrsSttsComCd: "ER" } as any,
|
||||
bzScaleList: [],
|
||||
bizCstList: [],
|
||||
cklstResultList,
|
||||
esntlAtchFileList: [],
|
||||
} as unknown as InstlSncnApplySaveRequestDto;
|
||||
|
||||
try {
|
||||
const issuedDocNo = await InstlSncnApi.techReview(payload);
|
||||
alert(`기술검토 등록이 완료되었습니다. 문서번호: ${issuedDocNo}`);
|
||||
} catch (error) {
|
||||
console.error("기술검토 등록 API 호출 실패", error);
|
||||
const serverMessage =
|
||||
axios.isAxiosError(error) && error.response?.data?.message
|
||||
? (error.response.data as { message: string }).message
|
||||
: "저장 중 오류가 발생했습니다.";
|
||||
alert(serverMessage);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const results: Record<string, 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.picRvwCn) comments[key] = String(row.picRvwCn);
|
||||
});
|
||||
setViewCheckResults(results);
|
||||
setViewCheckComments(comments);
|
||||
}, [selectedChecklistRows]);
|
||||
|
||||
if (query.isLoading) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 불러오는 중입니다...</div>;
|
||||
}
|
||||
|
||||
if (!query.data) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
const fmt = (v: number | null | undefined) =>
|
||||
typeof v === "number" ? v.toLocaleString() : v === null || v === undefined ? "" : String(v);
|
||||
|
||||
const indentPx = (indNm: string | undefined) => {
|
||||
if (!indNm) return 0;
|
||||
const spaces = indNm.length - indNm.trimStart().length;
|
||||
return (spaces / 4) * 16;
|
||||
};
|
||||
|
||||
/* formatFileSize moved to shared lib: @/shared/lib/file-utils */
|
||||
|
||||
return (
|
||||
<div className="mt-6 space-y-4">
|
||||
{/* orderedApprovers.length > 0 && ( */}
|
||||
<div className="cnfm-card p-4">
|
||||
<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 ? (
|
||||
<>
|
||||
<th className="text-center">접수자</th>
|
||||
<th className="text-center">검토자</th>
|
||||
<th className="text-center">승인자</th>
|
||||
<th className="text-center">최종승인자</th>
|
||||
</>
|
||||
) : (
|
||||
orderedApprovers.map((r: any) => (
|
||||
<th key={String(r.elaprPrgrsId ?? r.atrzSeComCd)} className="text-center">
|
||||
{r.atrzSeComNm ?? r.atrzSeComCd}
|
||||
</th>
|
||||
))
|
||||
)}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
{orderedApprovers.length === 0 ? (
|
||||
<>
|
||||
<td>{renderApproverCell("ATRZ01")}</td>
|
||||
<td>{renderApproverCell("ATRZ02")}</td>
|
||||
<td>{renderApproverCell("ATRZ03")}</td>
|
||||
<td>{renderApproverCell("ATRZ99")}</td>
|
||||
</>
|
||||
) : (
|
||||
orderedApprovers.map((r: any) => (
|
||||
<td key={String(r.elaprPrgrsId ?? r.atrzSeComCd)}>{renderApproverRow(r)}</td>
|
||||
))
|
||||
)}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{/** 결제자 지정 버튼 */}
|
||||
<div className="mt-4 text-right">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => handleAssignApproverClick("TMPLT20260611000001")}
|
||||
>
|
||||
결재자 지정
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* )} */}
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="text-[1.5rem] font-semibold">기본 정보</h3>
|
||||
<table className="cnfm-form-table mt-3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>사업명</th>
|
||||
<td>{det.bizNm || "-"}</td>
|
||||
<th>사업기간</th>
|
||||
<td>{(det.bizBgngYr || "-") + " ~ " + (det.bizEndYr || "-")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>사업내용</th>
|
||||
<td colSpan={3}>{det.bizCn || "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>구분</th>
|
||||
<td>{det.taskSeCdNm || det.taskSeComCd || "-"}</td>
|
||||
<th>신청지자체</th>
|
||||
<td>{det.sido || "-"} {det.gugun || "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>사업구분</th>
|
||||
<td colSpan={3}>{det.sncnSeCdNm || "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>진행상태</th>
|
||||
<td>{det.prgrsSttsCdNm || det.prgrsSttsComCd || "-"}</td>
|
||||
<th>예산사업코드</th>
|
||||
<td>{det.bgtBizCd || "-"}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="text-[1.5rem] font-semibold">담당자 정보</h3>
|
||||
<table className="cnfm-form-table mt-3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>신청자명</th>
|
||||
<td>{det.aplcntNm || "-"}</td>
|
||||
<th>신청자 연락처</th>
|
||||
<td>{det.aplcntMblTelno || "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>신청자 소속</th>
|
||||
<td>{det.aplcntOgdpNm || "-"}</td>
|
||||
<th>신청자 이메일</th>
|
||||
<td>{det.aplcntEmlAddr || "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>설계자명</th>
|
||||
<td>{det.dsgnrNm || "-"}</td>
|
||||
<th>설계자 연락처</th>
|
||||
<td>{det.dsgnrTelno || "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>설계자 소속</th>
|
||||
<td>{det.dsgnrOgdpNm || "-"}</td>
|
||||
<th>설계자 이메일</th>
|
||||
<td>{det.dsgnrEmlAddr || "-"}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="text-[1.5rem] font-semibold">이력 정보</h3>
|
||||
<table className="cnfm-form-table mt-3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>등록일시</th>
|
||||
<td>{det.regDt ? dayjs(det.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}</td>
|
||||
<th>수정일시</th>
|
||||
<td>{det.mdfcnDt ? dayjs(det.mdfcnDt).format("YYYY-MM-DD HH:mm:ss") : "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>등록자명</th>
|
||||
<td>{det.rgtrNm || "-"}</td>
|
||||
<th>첨부파일그룹ID</th>
|
||||
<td>{det.atchFileGroupId || "-"}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/* 사업규모 */}
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">사업규모</h3>
|
||||
<div className="cnfm-table-wrap">
|
||||
<table className="cnfm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="w-[30rem]">구분</th>
|
||||
<th>기본계획(A)</th>
|
||||
<th>예산반영(B)</th>
|
||||
<th>금회설계시(C)</th>
|
||||
<th>증감(C-B)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{bizSclList.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={5} className="cnfm-td-empty">조회된 사업규모 항목이 없습니다.</td>
|
||||
</tr>
|
||||
) : (
|
||||
bizSclList.map((node: any) => {
|
||||
const pl = indentPx(node.indCnstpSeCdNm);
|
||||
const bscPlanQty = Number(node.bscPlanQty) || 0;
|
||||
const budgetReflct = Number(node.bgtRfltQty) || 0;
|
||||
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>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 총사업비 */}
|
||||
<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>
|
||||
<div className="cnfm-table-wrap">
|
||||
<table className="cnfm-table w-full table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colSpan={2} className="w-[30rem]" rowSpan={2}>
|
||||
구분
|
||||
</th>
|
||||
<th rowSpan={2}>예산반영(A)</th>
|
||||
<th rowSpan={2}>표준사업비(B)</th>
|
||||
<th rowSpan={2}>금회설계시(C)</th>
|
||||
<th colSpan={2}>증감</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th className="w-[12rem]">(C-B)</th>
|
||||
<th className="w-[6rem]">%</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{bizCstList.map((node: any) => {
|
||||
|
||||
const pl = indentPx(node.indAcntgSeCdNm);
|
||||
const bscPlanAmt = Number(node.bscPlanAmt) || 0;
|
||||
const budgetReflct = Number(node.bgtRfltAmt) || 0;
|
||||
const tstmDesignAmt = Number(node.tstmDesignAmt) || 0;
|
||||
const diff = tstmDesignAmt - budgetReflct;
|
||||
const showSubIcon = node.treeLevel >= 4;
|
||||
const isLeaf = !bizCstList.some((n: any) => n.upAcntgSeCd === node.acntgSeCd);
|
||||
return (
|
||||
<tr
|
||||
key={node.acntgSeCd}
|
||||
className={
|
||||
node.treeLevel === 1
|
||||
? "bg-blue-50 font-bold"
|
||||
: node.treeLevel === 2
|
||||
? "bg-gray-100 font-semibold"
|
||||
: ""
|
||||
}
|
||||
>
|
||||
{node.treeLevel <= 2 ? (
|
||||
<td colSpan={2} className="pl-2 text-left">{node.acntgSeCdNm}</td>
|
||||
) : (
|
||||
<>
|
||||
<td className="w-[4rem]"></td>
|
||||
<td
|
||||
className={`bg-gray-50 text-left ${isLeaf ? "text-gray-700" : ""}`}
|
||||
style={{ paddingLeft: `${pl + 8}px` }}
|
||||
>
|
||||
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||
{node.acntgSeCdNm}
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
|
||||
<td>
|
||||
<div className="text-right">{fmt(bscPlanAmt)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{fmt(budgetReflct)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div className="text-right">{fmt(tstmDesignAmt)}</div>
|
||||
</td>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 체크리스트 */}
|
||||
<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 items-center gap-4">
|
||||
<div className="flex gap-2 items-center">
|
||||
{Array.from(new Set(taskCodes)).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>
|
||||
<div className="text-[1.1rem] text-gray-500">{`(${cklstStats.completed}/${cklstStats.total})`}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-3 flex flex-wrap gap-2">
|
||||
{visibleReviewStepCodes.length === 0 ? (
|
||||
<span className="text-[1.2rem] text-gray-500">
|
||||
현재 사용자 권한/진행상태 조합에서 표시 가능한 체크리스트 단계가 없습니다.
|
||||
</span>
|
||||
) : (
|
||||
visibleReviewStepCodes.map((stepCode) => (
|
||||
<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"
|
||||
}`}
|
||||
onClick={() => setSelectedReviewStep(stepCode)}
|
||||
>
|
||||
{stepCode}
|
||||
</button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
<div className="mb-2 text-[1.25rem] text-gray-500">
|
||||
체크리스트 진행상황 [{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 rowSpan={2}>주요 검토내용</th>
|
||||
<th colSpan={2}>검토 결과(✓)</th>
|
||||
{selectedReviewStep !== "LOCAL" ? (
|
||||
<th rowSpan={2} className="w-[20rem]">기술검토 의견</th>
|
||||
) : null}
|
||||
</tr>
|
||||
<tr>
|
||||
<th className="w-[9rem]">
|
||||
<button
|
||||
type="button"
|
||||
>
|
||||
예
|
||||
</button>
|
||||
</th>
|
||||
<th className="w-[9rem]">
|
||||
<button
|
||||
type="button"
|
||||
>
|
||||
아니오
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{selectedChecklistRows.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={5} className="cnfm-td-empty">조회된 체크리스트 항목이 없습니다.</td>
|
||||
</tr>
|
||||
) : (
|
||||
selectedChecklistRows.map((row: any) => {
|
||||
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${row.rvwStpComCd ?? "LOCAL"}`;
|
||||
const hasResult = row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N";
|
||||
const showRadios = row.bchckUseYn === "Y";
|
||||
|
||||
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>
|
||||
{!showRadios ? (
|
||||
<>
|
||||
<td className="text-center">-</td>
|
||||
<td className="text-center">-</td>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<td className="text-center">
|
||||
<input
|
||||
type="radio"
|
||||
name={`chk_${key}`}
|
||||
value="Y"
|
||||
checked={(viewCheckResults[key] ?? "") === "Y"}
|
||||
disabled={selectedReviewStep === "LOCAL"}
|
||||
onChange={() => setViewCheckResults((prev) => ({ ...prev, [key]: "Y" }))}
|
||||
/>
|
||||
</td>
|
||||
<td className="text-center">
|
||||
<input
|
||||
type="radio"
|
||||
name={`chk_${key}`}
|
||||
value="N"
|
||||
checked={(viewCheckResults[key] ?? "") === "N"}
|
||||
disabled={selectedReviewStep === "LOCAL"}
|
||||
onChange={() => setViewCheckResults((prev) => ({ ...prev, [key]: "N" }))}
|
||||
/>
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
{showRadios && selectedReviewStep !== "LOCAL" ? (
|
||||
<td className="text-left">
|
||||
<textarea
|
||||
className="cnfm-input w-full"
|
||||
value={viewCheckComments[key] ?? ""}
|
||||
onChange={(e) => setViewCheckComments((prev) => ({ ...prev, [key]: e.target.value }))}
|
||||
/>
|
||||
</td>
|
||||
) : null}
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 필수 첨부파일 */}
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">필수 첨부파일</h3>
|
||||
<div className="cnfm-table-wrap">
|
||||
<table className="cnfm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>필수 자료명</th>
|
||||
<th>파일명</th>
|
||||
<th className="w-[8rem] text-right">크기</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{esntlFileList.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={3} className="cnfm-td-empty">조회된 필수 첨부파일 항목이 없습니다.</td>
|
||||
</tr>
|
||||
) : (
|
||||
esntlFileList.map((f: any) => (
|
||||
<tr key={f.esntlAtchFileId}>
|
||||
<td className="pl-2">
|
||||
<div className="w-full text-left">
|
||||
{f.esntlAtchFileNm}
|
||||
{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>
|
||||
) : (
|
||||
<span className="text-gray-500">첨부없음</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="w-[8rem] text-right"><div className="text-right">{formatFileSize(f.atflFlieSz)}</div></td>
|
||||
</tr>
|
||||
))
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 기타 첨부파일 */}
|
||||
<div className="cnfm-card p-4">
|
||||
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">기타 첨부파일</h3>
|
||||
<div className="cnfm-table-wrap">
|
||||
<table className="cnfm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>파일명</th>
|
||||
<th className="w-[8rem] text-right">크기</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{etcFileList.length === 0 ? (
|
||||
<tr>
|
||||
<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/download/${f.atflId}`} 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>
|
||||
</tr>
|
||||
))
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="cnfm-action-row">
|
||||
<Button color="white" onClick={() => router.push("/instl-sncn")}>목록</Button>
|
||||
<Button onClick={() => router.push(`/instl-sncn/${id}/modify`)}>수정</Button>
|
||||
<Button onClick={() => void hadleTechReviewSubmit()}>기술검토등록</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { CnfmViewPage };
|
||||
@@ -52,7 +52,7 @@ function ChecklistTaskPanel({
|
||||
return (
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="체크리스트 검토 입력: 검토항목, 주요 검토내용, 검토결과 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" rowSpan={2}>
|
||||
|
||||
@@ -209,11 +209,8 @@ function InstlFormPage({ mode, initialData, createDefaults }: InstlFormPageProps
|
||||
<FormProvider {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="mt-4">
|
||||
<SectionCollapsibleGroup>
|
||||
<div className="sticky top-[6rem] z-30 flex items-center justify-between bg-container px-4 py-2">
|
||||
<div className="sticky top-[6rem] z-30 bg-container px-4 py-2">
|
||||
<SectionCollapsibleToggle />
|
||||
<p className="text-sm text-muted-foreground">
|
||||
<span className="text-red-600">*</span>은 필수입력 항목입니다.
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{initialData?.detDto.instlSncnDocNo && (
|
||||
|
||||
@@ -59,7 +59,6 @@ function InstlList({ searchParams, pagination, onPaginationChange }: InstlListPr
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "설치승인 목록",
|
||||
viewPagination: true,
|
||||
onRowClick: handleRowClick,
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@ function BasicInfoFormSection() {
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table caption="설치승인 기본 정보 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -62,7 +62,7 @@ function BasicInfoFormSection() {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row" className="w-[20rem]" data-required>
|
||||
<TableHead className="w-[20rem]" data-required>
|
||||
사업명
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
@@ -90,7 +90,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업기간</TableHead>
|
||||
<TableHead data-required>사업기간</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<FieldGroup className="flex-row items-center gap-2">
|
||||
<Controller
|
||||
@@ -134,7 +134,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업내용</TableHead>
|
||||
<TableHead data-required>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.bizCn"
|
||||
@@ -154,13 +154,13 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>구분</TableHead>
|
||||
<TableHead data-required>구분</TableHead>
|
||||
<TableCell>{taskSeComCdLabel}</TableCell>
|
||||
<TableHead scope="row">신청 지자체</TableHead>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell>{localGovLabel}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>사업구분</TableHead>
|
||||
<TableHead data-required>사업구분</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.sncnSeComCd"
|
||||
@@ -202,7 +202,7 @@ function BasicInfoFormSection() {
|
||||
{taskSeComCd.includes("RE") && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row">시설종류</TableHead>
|
||||
<TableHead>시설종류</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.rtlztnFcltSeComCd"
|
||||
@@ -242,7 +242,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">재이용용도</TableHead>
|
||||
<TableHead>재이용용도</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.rtlztnUsgSeComCd"
|
||||
|
||||
@@ -11,7 +11,7 @@ interface BasicInfoSectionProps {
|
||||
function BasicInfoSection({ det }: BasicInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table caption="설치승인 기본 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -20,25 +20,25 @@ function BasicInfoSection({ det }: BasicInfoSectionProps) {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row">사업명</TableHead>
|
||||
<TableHead>사업명</TableHead>
|
||||
<TableCell>{det.bizNm || "-"}</TableCell>
|
||||
<TableHead scope="row">사업기간</TableHead>
|
||||
<TableHead>사업기간</TableHead>
|
||||
<TableCell>{(det.bizBgngYr || "-") + " ~ " + (det.bizEndYr || "-")}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">사업내용</TableHead>
|
||||
<TableHead>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>{det.bizCn || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">구분</TableHead>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableCell>{det.taskSeCdNm || "-"}</TableCell>
|
||||
<TableHead scope="row">신청지자체</TableHead>
|
||||
<TableHead>신청지자체</TableHead>
|
||||
<TableCell>
|
||||
{det.sido || "-"} {det.gugun || "-"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">사업구분</TableHead>
|
||||
<TableHead>사업구분</TableHead>
|
||||
<TableCell colSpan={3}>{det.sncnSeCdNm || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
|
||||
@@ -20,7 +20,7 @@ function BusinessCostSection({ bizCstList }: BusinessCostSectionProps) {
|
||||
<SectionCollapsible title="총사업비">
|
||||
<div className="overflow-x-auto">
|
||||
<p className="mb-2 text-right font-normal text-muted-foreground">(단위: 백만원)</p>
|
||||
<Table caption="총사업비 내역: 구분, 예산반영, 표준사업비, 금회설계, 증감 정보 제공" variant="secondary" className="table-fixed">
|
||||
<Table variant="secondary" className="table-fixed">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]" rowSpan={2}>
|
||||
@@ -51,9 +51,9 @@ function BusinessCostSection({ bizCstList }: BusinessCostSectionProps) {
|
||||
return (
|
||||
<TableRow key={node.acntgSeCd}>
|
||||
{node.treeLevel <= 1 ? (
|
||||
<TableHead scope="row" className="!px-[0.8rem] text-left">{node.acntgSeCdNm}</TableHead>
|
||||
<TableHead className="!px-[0.8rem] text-left">{node.acntgSeCdNm}</TableHead>
|
||||
) : (
|
||||
<TableHead scope="row" className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||
{node.acntgSeCdNm}
|
||||
</TableHead>
|
||||
|
||||
@@ -13,7 +13,7 @@ function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="사업규모">
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="사업규모 내역: 구분, 기본계획, 예산반영, 금회설계, 증감 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]">구분</TableHead>
|
||||
@@ -36,7 +36,7 @@ function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
|
||||
return (
|
||||
<TableRow key={node.cnstpSeCd}>
|
||||
<TableHead scope="row" className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{node.cnstpSeCdNm}
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
|
||||
@@ -11,21 +11,21 @@ interface ContactInfoSectionProps {
|
||||
function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="담당자 정보">
|
||||
<Table caption="설치승인 담당자 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
{det.aplcntNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row" rowSpan={2}>신청자</TableHead>
|
||||
<TableHead scope="row">이름</TableHead>
|
||||
<TableHead rowSpan={2}>신청자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.aplcntNm || "-"}</TableCell>
|
||||
<TableHead scope="row">연락처</TableHead>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.aplcntMblTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">소속</TableHead>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.aplcntOgdpNm || "-"}</TableCell>
|
||||
<TableHead scope="row">이메일</TableHead>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.aplcntEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
@@ -33,16 +33,16 @@ function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
{det.dsgnrNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead scope="row" rowSpan={2}>설계자</TableHead>
|
||||
<TableHead scope="row">이름</TableHead>
|
||||
<TableHead rowSpan={2}>설계자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.dsgnrNm || "-"}</TableCell>
|
||||
<TableHead scope="row">연락처</TableHead>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.dsgnrTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">소속</TableHead>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.dsgnrOgdpNm || "-"}</TableCell>
|
||||
<TableHead scope="row">이메일</TableHead>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.dsgnrEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
|
||||
@@ -180,10 +180,10 @@ const TechReviewOpinionSection = forwardRef<
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-xl font-semibold">검토의견 작성</h4>
|
||||
<Table caption="검토의견 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row" className="w-[12rem]">의견내용</TableHead>
|
||||
<TableHead className="w-[12rem]">의견내용</TableHead>
|
||||
<TableCell>
|
||||
<Textarea
|
||||
value={formData.rvwRsltCn}
|
||||
@@ -197,7 +197,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">검토결과</TableHead>
|
||||
<TableHead>검토결과</TableHead>
|
||||
<TableCell>
|
||||
<FieldSet>
|
||||
<RadioGroup
|
||||
@@ -234,7 +234,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">첨부파일</TableHead>
|
||||
<TableHead>첨부파일</TableHead>
|
||||
<TableCell>
|
||||
{uploadedFile ? (
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -301,7 +301,7 @@ const TechReviewOpinionSection = forwardRef<
|
||||
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) {
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="검토의견 목록: 의견자, 의견내용, 검토결과, 첨부파일, 등록일시 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="55%" />
|
||||
|
||||
@@ -70,7 +70,6 @@ function MyPbadmsSprtList({ searchParams, pagination, onPaginationChange }: MyPb
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "나의 행정지원 목록",
|
||||
viewPagination: true,
|
||||
onRowClick: handleRowClick,
|
||||
},
|
||||
|
||||
@@ -97,7 +97,6 @@ function NtiHstryList({ searchParams, pagination, onPaginationChange }: NtiHstry
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
caption: "알림톡 발송 이력 목록",
|
||||
viewPagination: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -33,7 +33,6 @@ function InPrgrsDocRcvrList({ selectedRcvrKeys, onRcvrSelectionChange }: InPrgrs
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
...rowSelectionOptions,
|
||||
},
|
||||
dataTableOptions: { caption: "진행중 문서 담당자 수신자 목록" },
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -34,7 +34,6 @@ function RvwMnpwRcvrList({ selectedRcvrKeys, onRcvrSelectionChange }: RvwMnpwRcv
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
...rowSelectionOptions,
|
||||
},
|
||||
dataTableOptions: { caption: "검토인력 수신자 목록" },
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,7 +35,7 @@ function SndngList({
|
||||
|
||||
return (
|
||||
<div className="max-h-[40rem] overflow-auto rounded-md border">
|
||||
<Table caption="알림톡 발송 대상 목록: 이름, 전화번호, 변수, 버튼 정보 제공" variant="line" className="text-sm">
|
||||
<Table variant="line" className="text-sm">
|
||||
<TableHeader className="top-0">
|
||||
<TableRow>
|
||||
<TableHead className="min-w-[100px]">이름</TableHead>
|
||||
|
||||
@@ -9,7 +9,6 @@ export const RVW_MNPW_BLOCKS: RvwMnpwBlockConfig[] = [
|
||||
{ id: "receiver", title: "접수", atrzSeComCd: "ATRZ01" },
|
||||
{ id: "reviewer", title: "검토", atrzSeComCd: "ATRZ02" },
|
||||
{ id: "approver", title: "승인", atrzSeComCd: "ATRZ03" },
|
||||
{ id: "merger", title: "병합", atrzSeComCd: "ATRZ04" },
|
||||
{ id: "final", title: "최종승인", atrzSeComCd: "ATRZ99" },
|
||||
];
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ function RvwMnpwAsmtPanel({ selectedPerson }: RvwMnpwAsmtPanelProps) {
|
||||
<Skeleton className="h-[8rem]" />
|
||||
<Skeleton className="h-[8rem]" />
|
||||
<Skeleton className="h-[8rem]" />
|
||||
<Skeleton className="h-[8rem]" />
|
||||
</div>
|
||||
) : pageQuery.isError ? (
|
||||
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||
|
||||
@@ -52,7 +52,7 @@ function ChecklistTaskPanel({
|
||||
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<Table caption="체크리스트 검토 입력: 검토항목, 주요 검토내용, 검토결과 정보 제공" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" rowSpan={2}>
|
||||
|
||||
@@ -35,7 +35,7 @@ function PreviousPlanAreaTable({ data }: PreviousPlanAreaTableProps) {
|
||||
const yearCells = getPlanYearCells(data);
|
||||
|
||||
return (
|
||||
<Table caption="이전 기본계획 처리구역 현황" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="16%" />
|
||||
<col width="9.3%" />
|
||||
@@ -86,7 +86,7 @@ function PreviousPlanAreaTable({ data }: PreviousPlanAreaTableProps) {
|
||||
const cells = getMetricCells(data, row.field);
|
||||
return (
|
||||
<TableRow key={row.field}>
|
||||
<TableHead scope="row">{row.label}</TableHead>
|
||||
<TableHead>{row.label}</TableHead>
|
||||
{cells.map((cell, index) => (
|
||||
<TableCell key={index} className="text-right">
|
||||
{cell}
|
||||
|
||||
@@ -202,7 +202,7 @@ function PreviousPlanFileSection({ clsfSystmNm }: PreviousPlanFileSectionProps)
|
||||
) : files.length === 0 ? (
|
||||
<p className="py-8 text-center text-lg text-muted-foreground">파일이 없습니다.</p>
|
||||
) : (
|
||||
<Table caption="이전 기본계획 첨부파일 목록" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="!py-2 !text-xl">번호</TableHead>
|
||||
|
||||
@@ -13,7 +13,7 @@ function PreviousPlanSummaryTable({ data }: PreviousPlanSummaryTableProps) {
|
||||
const yearCells = getPlanYearCells(data);
|
||||
|
||||
return (
|
||||
<Table caption="이전 기본계획 목표연도" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="10%" />
|
||||
@@ -54,7 +54,7 @@ function PreviousPlanSummaryTable({ data }: PreviousPlanSummaryTableProps) {
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableHead scope="row">계획목표년도</TableHead>
|
||||
<TableHead>계획목표년도</TableHead>
|
||||
{yearCells.map((cell, index) => (
|
||||
<TableCell key={index} className="text-center">
|
||||
{cell}
|
||||
|
||||
@@ -57,7 +57,7 @@ function BasicInfoFormSection() {
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본계획 신청">
|
||||
<Table caption="기본계획 정보 입력" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -66,7 +66,7 @@ function BasicInfoFormSection() {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row" className="w-[20rem]" data-required>
|
||||
<TableHead className="w-[20rem]" data-required>
|
||||
기본계획명
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
@@ -89,7 +89,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>계획년도</TableHead>
|
||||
<TableHead data-required>계획년도</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.planYr"
|
||||
@@ -113,7 +113,7 @@ function BasicInfoFormSection() {
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableHead scope="row" data-required>기준년도</TableHead>
|
||||
<TableHead data-required>기준년도</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.crtrYr"
|
||||
@@ -139,7 +139,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>1단계 목표연도</TableHead>
|
||||
<TableHead data-required>1단계 목표연도</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.frlvlGoalYr"
|
||||
@@ -166,7 +166,7 @@ function BasicInfoFormSection() {
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableHead scope="row" data-required>2단계 목표연도</TableHead>
|
||||
<TableHead data-required>2단계 목표연도</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.sclvlGoalYr"
|
||||
@@ -192,7 +192,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>3단계 목표연도</TableHead>
|
||||
<TableHead data-required>3단계 목표연도</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.thlvlGoalYr"
|
||||
@@ -216,7 +216,7 @@ function BasicInfoFormSection() {
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableHead scope="row" data-required>4단계 목표연도</TableHead>
|
||||
<TableHead data-required>4단계 목표연도</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.folvlGoalYr"
|
||||
@@ -242,7 +242,7 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>계획개요</TableHead>
|
||||
<TableHead data-required>계획개요</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="sewerBscPlanDtl.bizOtlnCn"
|
||||
@@ -264,9 +264,9 @@ function BasicInfoFormSection() {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">구분</TableHead>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableCell>{sewerBscPlanSeLabel}</TableCell>
|
||||
<TableHead scope="row">신청 지자체</TableHead>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell>{localGovLabel || userInfo?.laeSeNm}</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
|
||||
@@ -18,7 +18,7 @@ function BasicInfoSection({ det, dtl }: BasicInfoSectionProps) {
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본계획 신청">
|
||||
<Table caption="기본계획 정보" variant="secondary">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="15%" />
|
||||
<col width="35%" />
|
||||
@@ -27,37 +27,37 @@ function BasicInfoSection({ det, dtl }: BasicInfoSectionProps) {
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead scope="row">기본계획명</TableHead>
|
||||
<TableHead>기본계획명</TableHead>
|
||||
<TableCell colSpan={3}>{det.sewerBscPlanNm || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">계획년도</TableHead>
|
||||
<TableHead>계획년도</TableHead>
|
||||
<TableCell>{dtl?.planYr || "-"}</TableCell>
|
||||
<TableHead scope="row">기준년도</TableHead>
|
||||
<TableHead>기준년도</TableHead>
|
||||
<TableCell>{dtl?.crtrYr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">1단계 목표연도</TableHead>
|
||||
<TableHead>1단계 목표연도</TableHead>
|
||||
<TableCell>{dtl?.frlvlGoalYr || "-"}</TableCell>
|
||||
<TableHead scope="row">2단계 목표연도</TableHead>
|
||||
<TableHead>2단계 목표연도</TableHead>
|
||||
<TableCell>{dtl?.sclvlGoalYr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">3단계 목표연도</TableHead>
|
||||
<TableHead>3단계 목표연도</TableHead>
|
||||
<TableCell>{dtl?.thlvlGoalYr || "-"}</TableCell>
|
||||
<TableHead scope="row">4단계 목표연도</TableHead>
|
||||
<TableHead>4단계 목표연도</TableHead>
|
||||
<TableCell>{dtl?.folvlGoalYr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">계획개요</TableHead>
|
||||
<TableHead>계획개요</TableHead>
|
||||
<TableCell colSpan={3} className="whitespace-pre-wrap">
|
||||
{dtl?.bizOtlnCn || "-"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead scope="row">구분</TableHead>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableCell>{sewerBscPlanSeLabel || "-"}</TableCell>
|
||||
<TableHead scope="row">신청 지자체</TableHead>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell>{localGovLabel || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user