Compare commits
14
Commits
deploy
...
0ce35d4c38
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ce35d4c38 | ||
|
|
f220904742 | ||
|
|
dc74c07ef4 | ||
|
|
9a77e9c52a | ||
|
|
42dc2dc027 | ||
|
|
14803b2625 | ||
|
|
1a5180551e | ||
|
|
e697881581 | ||
|
|
dd4ee1dcb5 | ||
|
|
6c71bccc27 | ||
|
|
9a33663f1e | ||
|
|
b088918cd9 | ||
|
|
3f2938df1c | ||
|
|
c39d1f433a |
Vendored
+119
-11
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
|
|
||||||
// 기존 특성에 대한 설명을 보려면 가리킵니다.
|
|
||||||
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
|
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
@@ -14,13 +12,91 @@
|
|||||||
"dev:as"
|
"dev:as"
|
||||||
],
|
],
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**"
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
|
],
|
||||||
|
"resolveSourceMapLocations": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"!**/node_modules/**"
|
||||||
],
|
],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"env": {
|
"env": {
|
||||||
"NODE_OPTIONS": "--inspect"
|
"NODE_OPTIONS": "--inspect --max-old-space-size=8192"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "dev:as 서버 컴포넌트 디버그 (node-terminal)",
|
||||||
|
"command": "pnpm --filter as dev",
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "dev:as 통합 디버그 (Server + Client)",
|
||||||
|
"command": "pnpm --filter as dev",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"serverReadyAction": {
|
||||||
|
"action": "debugWithChrome",
|
||||||
|
"pattern": "- Local:\\s+(https?://.+)",
|
||||||
|
"uriFormat": "%s",
|
||||||
|
"webRoot": "${workspaceFolder}/apps/as"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Playwright: 현재 활성화된 테스트 디버그",
|
||||||
|
"runtimeExecutable": "pnpm",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--filter",
|
||||||
|
"cs",
|
||||||
|
"exec",
|
||||||
|
"playwright",
|
||||||
|
"test",
|
||||||
|
"${relativeFile}"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Playwright: cs 로그인 테스트 디버그",
|
||||||
|
"runtimeExecutable": "pnpm",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--filter",
|
||||||
|
"cs",
|
||||||
|
"exec",
|
||||||
|
"playwright",
|
||||||
|
"test",
|
||||||
|
"tests/login.spec.ts"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "dev:cs 통합 디버그 (Server + Client)",
|
||||||
|
"command": "pnpm --filter cs dev",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"serverReadyAction": {
|
||||||
|
"action": "debugWithChrome",
|
||||||
|
"pattern": "- Local:\\s+(https?://.+)",
|
||||||
|
"uriFormat": "%s",
|
||||||
|
"webRoot": "${workspaceFolder}/apps/cs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -33,13 +109,18 @@
|
|||||||
"dev:cs"
|
"dev:cs"
|
||||||
],
|
],
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**"
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
|
],
|
||||||
|
"resolveSourceMapLocations": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"!**/node_modules/**"
|
||||||
],
|
],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"env": {
|
"env": {
|
||||||
"NODE_OPTIONS": "--inspect"
|
"NODE_OPTIONS": "--inspect --max-old-space-size=8192"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -49,7 +130,8 @@
|
|||||||
"port": 9229,
|
"port": 9229,
|
||||||
"restart": true,
|
"restart": true,
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**"
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
],
|
],
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"resolveSourceMapLocations": [
|
"resolveSourceMapLocations": [
|
||||||
@@ -63,7 +145,15 @@
|
|||||||
"name": "dev:cs 클라이언트 디버그 (Chrome)",
|
"name": "dev:cs 클라이언트 디버그 (Chrome)",
|
||||||
"url": "http://localhost:3000",
|
"url": "http://localhost:3000",
|
||||||
"webRoot": "${workspaceFolder}/apps/cs",
|
"webRoot": "${workspaceFolder}/apps/cs",
|
||||||
"sourceMaps": true
|
"skipFiles": [
|
||||||
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
|
],
|
||||||
|
"sourceMaps": true,
|
||||||
|
"resolveSourceMapLocations": [
|
||||||
|
"${workspaceFolder}/apps/cs/**",
|
||||||
|
"!**/node_modules/**"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
@@ -75,13 +165,31 @@
|
|||||||
"dev:st"
|
"dev:st"
|
||||||
],
|
],
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**"
|
"<node_internals>/**",
|
||||||
|
"**/node_modules/**"
|
||||||
|
],
|
||||||
|
"resolveSourceMapLocations": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"!**/node_modules/**"
|
||||||
],
|
],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"env": {
|
"env": {
|
||||||
"NODE_OPTIONS": "--inspect"
|
"NODE_OPTIONS": "--inspect --max-old-space-size=8192"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "dev:st 통합 디버그 (Server + Client)",
|
||||||
|
"command": "pnpm --filter st dev",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"serverReadyAction": {
|
||||||
|
"action": "debugWithChrome",
|
||||||
|
"pattern": "- Local:\\s+(https?://.+)",
|
||||||
|
"uriFormat": "%s",
|
||||||
|
"webRoot": "${workspaceFolder}/apps/st"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Vendored
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"chat.tools.terminal.autoApprove": {
|
"chat.tools.terminal.autoApprove": {
|
||||||
"pnpm": true
|
"pnpm": true
|
||||||
}
|
},
|
||||||
|
"playwright.configs": [
|
||||||
|
"apps/cs/playwright.config.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 3003",
|
"dev": "next dev -p 3004",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start -p 3003",
|
"start": "next start -p 3004",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"lint:fsd": "steiger ."
|
"lint:fsd": "steiger ."
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"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,15 @@
|
|||||||
|
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,6 +23,7 @@ import type {
|
|||||||
} from "../model/elapr-tmplt-interface";
|
} from "../model/elapr-tmplt-interface";
|
||||||
|
|
||||||
import { elaprAplnService } from "./elapr-apln-service";
|
import { elaprAplnService } from "./elapr-apln-service";
|
||||||
|
import { elaprBranchService } from "./elapr-branch-service";
|
||||||
import { elaprDmndService } from "./elapr-dmnd-service";
|
import { elaprDmndService } from "./elapr-dmnd-service";
|
||||||
import { elaprPrgrsSttsService } from "./elapr-prgrs-stts-service";
|
import { elaprPrgrsSttsService } from "./elapr-prgrs-stts-service";
|
||||||
import { elaprTmpltService } from "./elapr-tmplt-service";
|
import { elaprTmpltService } from "./elapr-tmplt-service";
|
||||||
@@ -31,6 +32,7 @@ const elaprTmpltBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT] as const;
|
|||||||
const elaprAplnBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN] as const;
|
const elaprAplnBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN] as const;
|
||||||
const elaprDmndBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND] as const;
|
const elaprDmndBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND] as const;
|
||||||
const elaprPrgrsSttsBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_PRGRS_STTS] 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>) {
|
function invalidateElaprPrgrsSttsQueries(queryClient: ReturnType<typeof useQueryClient>) {
|
||||||
queryClient.invalidateQueries({ queryKey: elaprPrgrsSttsBaseKey });
|
queryClient.invalidateQueries({ queryKey: elaprPrgrsSttsBaseKey });
|
||||||
@@ -360,3 +362,16 @@ 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,4 +1,5 @@
|
|||||||
export { elaprAplnService } from "./api/elapr-apln-service";
|
export { elaprAplnService } from "./api/elapr-apln-service";
|
||||||
|
export { elaprBranchService } from "./api/elapr-branch-service";
|
||||||
export { elaprDmndService } from "./api/elapr-dmnd-service";
|
export { elaprDmndService } from "./api/elapr-dmnd-service";
|
||||||
export { elaprPrgrsSttsService } from "./api/elapr-prgrs-stts-service";
|
export { elaprPrgrsSttsService } from "./api/elapr-prgrs-stts-service";
|
||||||
export { elaprTmpltService } from "./api/elapr-tmplt-service";
|
export { elaprTmpltService } from "./api/elapr-tmplt-service";
|
||||||
@@ -9,6 +10,7 @@ export {
|
|||||||
useDeleteElaprTmplt,
|
useDeleteElaprTmplt,
|
||||||
useElaprApln,
|
useElaprApln,
|
||||||
useElaprAplnPage,
|
useElaprAplnPage,
|
||||||
|
useElaprBranchesByDocNo,
|
||||||
useElaprDmnd,
|
useElaprDmnd,
|
||||||
useElaprDmndPage,
|
useElaprDmndPage,
|
||||||
useElaprDocPrgrsByDocNo,
|
useElaprDocPrgrsByDocNo,
|
||||||
@@ -59,6 +61,11 @@ export {
|
|||||||
buildElaprPrgrsSttsListFromAplnRows,
|
buildElaprPrgrsSttsListFromAplnRows,
|
||||||
} from "./lib/dmnd-save-utils";
|
} from "./lib/dmnd-save-utils";
|
||||||
export { mapDocPrgrsToAplnRows } from "./lib/doc-prgrs-to-apln-rows";
|
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 type { ElaprPrgrsSttsRow } from "./lib/prgrs-stts-save-utils";
|
||||||
export {
|
export {
|
||||||
assignPrgrsSttsAtrzSeqNumbers,
|
assignPrgrsSttsAtrzSeqNumbers,
|
||||||
@@ -91,6 +98,14 @@ export type {
|
|||||||
ElaprDmndService,
|
ElaprDmndService,
|
||||||
ElaprDocPrgrsResponseDto,
|
ElaprDocPrgrsResponseDto,
|
||||||
} from "./model/elapr-dmnd-interface";
|
} from "./model/elapr-dmnd-interface";
|
||||||
|
export type {
|
||||||
|
AtrzSttsComCd,
|
||||||
|
BranchSeCd,
|
||||||
|
BranchSttsCd,
|
||||||
|
ElaprBranchDto,
|
||||||
|
ElaprForkJoinDataMap,
|
||||||
|
ElaprForkJoinStepDto,
|
||||||
|
} from "./model/elapr-forkjoin-types";
|
||||||
export type {
|
export type {
|
||||||
ElaprApproverChangeRequestDto,
|
ElaprApproverChangeRequestDto,
|
||||||
ElaprApproverInsertRequestDto,
|
ElaprApproverInsertRequestDto,
|
||||||
@@ -115,11 +130,17 @@ export type { ReviewerOption } from "./model/reviewer-option";
|
|||||||
export { AprvrPickerDialog } from "./ui/aprvr-picker-dialog";
|
export { AprvrPickerDialog } from "./ui/aprvr-picker-dialog";
|
||||||
export { ElaprAplnPickerGrid } from "./ui/elapr-apln-picker-grid";
|
export { ElaprAplnPickerGrid } from "./ui/elapr-apln-picker-grid";
|
||||||
export { ElaprApprovalDialog } from "./ui/elapr-approval-dialog";
|
export { ElaprApprovalDialog } from "./ui/elapr-approval-dialog";
|
||||||
|
export { ElaprDocPrgrsForkJoinStep } from "./ui/elapr-doc-prgrs-forkjoin-step";
|
||||||
export {
|
export {
|
||||||
type ElaprDocPrgrsPickerConfirmPayload,
|
type ElaprDocPrgrsPickerConfirmPayload,
|
||||||
ElaprDocPrgrsPickerDialog,
|
ElaprDocPrgrsPickerDialog,
|
||||||
} from "./ui/elapr-doc-prgrs-picker-dialog";
|
} 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 { ElaprDocPrgrsStatus } from "./ui/elapr-doc-prgrs-status";
|
||||||
|
export { ElaprForkJoinPickerGrid } from "./ui/elapr-forkjoin-picker-grid";
|
||||||
export {
|
export {
|
||||||
type ElaprTmpltPickerConfirmPayload,
|
type ElaprTmpltPickerConfirmPayload,
|
||||||
ElaprTmpltPickerDialog,
|
ElaprTmpltPickerDialog,
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ export function hasCurrentUserPendingApprovalRequest(
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (!currentUserUuid) return false;
|
if (!currentUserUuid) return false;
|
||||||
|
|
||||||
|
const normalizedUserUuid = currentUserUuid.toLowerCase();
|
||||||
return list.some(
|
return list.some(
|
||||||
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
(row) =>
|
||||||
|
row.aprvrUuid?.toLowerCase() === normalizedUserUuid &&
|
||||||
|
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +20,10 @@ export function findCurrentUserPendingApprovalRequest(
|
|||||||
): ElaprDocPrgrsResponseDto | undefined {
|
): ElaprDocPrgrsResponseDto | undefined {
|
||||||
if (!currentUserUuid) return undefined;
|
if (!currentUserUuid) return undefined;
|
||||||
|
|
||||||
|
const normalizedUserUuid = currentUserUuid.toLowerCase();
|
||||||
return list?.find(
|
return list?.find(
|
||||||
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
(row) =>
|
||||||
|
row.aprvrUuid?.toLowerCase() === normalizedUserUuid &&
|
||||||
|
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ function toPrgrsSttsItem(
|
|||||||
aprvrUuid: string | undefined,
|
aprvrUuid: string | undefined,
|
||||||
atrzSeComCd: string | undefined,
|
atrzSeComCd: string | undefined,
|
||||||
atrzSeqNo: number | undefined,
|
atrzSeqNo: number | undefined,
|
||||||
|
branchId?: string,
|
||||||
|
branchSeCd?: string,
|
||||||
|
aprvrDeptNm?: string,
|
||||||
): ElaprPrgrsSttsSaveRequestDto {
|
): ElaprPrgrsSttsSaveRequestDto {
|
||||||
if (!aprvrUuid?.trim()) {
|
if (!aprvrUuid?.trim()) {
|
||||||
throw new Error("결재자가 지정되지 않은 행이 있습니다.");
|
throw new Error("결재자가 지정되지 않은 행이 있습니다.");
|
||||||
@@ -23,6 +26,9 @@ function toPrgrsSttsItem(
|
|||||||
aprvrUuid,
|
aprvrUuid,
|
||||||
atrzSeComCd,
|
atrzSeComCd,
|
||||||
atrzSeqNo,
|
atrzSeqNo,
|
||||||
|
branchId,
|
||||||
|
branchSeCd,
|
||||||
|
aprvrDeptNm,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +44,13 @@ export function buildElaprPrgrsSttsListFromAplnRows(
|
|||||||
rows: ElaprAplnRow[],
|
rows: ElaprAplnRow[],
|
||||||
): ElaprPrgrsSttsSaveRequestDto[] {
|
): ElaprPrgrsSttsSaveRequestDto[] {
|
||||||
return getVisibleRows(rows).map((row) =>
|
return getVisibleRows(rows).map((row) =>
|
||||||
toPrgrsSttsItem(row.aprvrUuid, row.atrzSeComCd, row.atrzSeqNo),
|
toPrgrsSttsItem(
|
||||||
|
row.aprvrUuid,
|
||||||
|
row.atrzSeComCd,
|
||||||
|
row.atrzSeqNo,
|
||||||
|
row.branchId,
|
||||||
|
row.branchSeCd,
|
||||||
|
row.aprvrDeptNm,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
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,6 +13,8 @@ export interface PrgrsSttsServerRow {
|
|||||||
atrzSeComCd?: string;
|
atrzSeComCd?: string;
|
||||||
atrzSeqNo?: number;
|
atrzSeqNo?: number;
|
||||||
dcarbYn?: string;
|
dcarbYn?: string;
|
||||||
|
branchId?: string;
|
||||||
|
branchSeCd?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 결재선 그리드 로컬 행 — 진행상태 API 응답 + UI 보조 필드 */
|
/** 결재선 그리드 로컬 행 — 진행상태 API 응답 + UI 보조 필드 */
|
||||||
@@ -20,6 +22,9 @@ export interface ElaprPrgrsSttsRow {
|
|||||||
rowKey: string;
|
rowKey: string;
|
||||||
elaprPrgrsId?: string;
|
elaprPrgrsId?: string;
|
||||||
elaprDmndId?: string;
|
elaprDmndId?: string;
|
||||||
|
branchId?: string;
|
||||||
|
branchSeCd?: string;
|
||||||
|
branchNm?: string;
|
||||||
aprvrUuid?: string;
|
aprvrUuid?: string;
|
||||||
aprvrNm?: string;
|
aprvrNm?: string;
|
||||||
atrzSeComCd?: string;
|
atrzSeComCd?: string;
|
||||||
@@ -52,8 +57,22 @@ function getVisibleRows(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
|||||||
return rows.filter((row) => !row.isDeleted);
|
return rows.filter((row) => !row.isDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 그리드 행 순서(1-based)로 결재순서번호 일괄 채번 */
|
/** 그리드 행 순서(1-based)로 결재순서번호 채번 (브랜치가 분기된 Fork-Join의 경우 각 브랜치별 독립 순번 채번) */
|
||||||
export function assignPrgrsSttsAtrzSeqNumbers(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
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 }));
|
return rows.map((row, index) => ({ ...row, atrzSeqNo: index + 1 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +111,7 @@ function rowDiffersFromServer(row: ElaprPrgrsSttsRow, serverRow: PrgrsSttsServer
|
|||||||
return (
|
return (
|
||||||
row.aprvrUuid !== serverRow.aprvrUuid ||
|
row.aprvrUuid !== serverRow.aprvrUuid ||
|
||||||
row.atrzSeComCd !== serverRow.atrzSeComCd ||
|
row.atrzSeComCd !== serverRow.atrzSeComCd ||
|
||||||
row.atrzSeqNo !== serverRow.atrzSeqNo ||
|
Number(row.atrzSeqNo) !== Number(serverRow.atrzSeqNo) ||
|
||||||
(row.dcarbYn ?? "N") !== (serverRow.dcarbYn ?? "N")
|
(row.dcarbYn ?? "N") !== (serverRow.dcarbYn ?? "N")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ function toRow(item: ElaprDocPrgrsClientResponseDto): ElaprPrgrsSttsRow {
|
|||||||
rowKey: item.elaprPrgrsId ?? createDraftRowKey(),
|
rowKey: item.elaprPrgrsId ?? createDraftRowKey(),
|
||||||
elaprPrgrsId: item.elaprPrgrsId,
|
elaprPrgrsId: item.elaprPrgrsId,
|
||||||
elaprDmndId: item.elaprDmndId,
|
elaprDmndId: item.elaprDmndId,
|
||||||
|
branchId: item.branchId,
|
||||||
|
branchSeCd: item.branchSeCd,
|
||||||
|
branchNm: item.branchNm,
|
||||||
aprvrUuid: item.aprvrUuid,
|
aprvrUuid: item.aprvrUuid,
|
||||||
aprvrNm: item.aprvrNm,
|
aprvrNm: item.aprvrNm,
|
||||||
atrzSeComCd: item.atrzSeComCd,
|
atrzSeComCd: item.atrzSeComCd,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { BranchSeCd } from "./elapr-forkjoin-types";
|
||||||
import type { ElaprApln } from "./elapr-apln-interface";
|
import type { ElaprApln } from "./elapr-apln-interface";
|
||||||
|
|
||||||
/** 그리드 로컬 행 — API 응답 + UI 보조 필드 */
|
/** 그리드 로컬 행 — API 응답 + UI 보조 필드 */
|
||||||
@@ -7,6 +8,11 @@ export interface ElaprAplnRow extends Omit<ElaprApln, "aplnId"> {
|
|||||||
aplnId?: string;
|
aplnId?: string;
|
||||||
/** 결재자 표시명 — 응답 DTO 또는 선택 시 로컬 유지 */
|
/** 결재자 표시명 — 응답 DTO 또는 선택 시 로컬 유지 */
|
||||||
aprvrNm?: string;
|
aprvrNm?: string;
|
||||||
|
/** 소속 브랜치 ID 및 구분코드 */
|
||||||
|
branchId?: string;
|
||||||
|
branchSeCd?: BranchSeCd;
|
||||||
|
aprvrDeptNm?: string;
|
||||||
|
dcarbYn?: string;
|
||||||
isNew?: boolean;
|
isNew?: boolean;
|
||||||
isDirty?: boolean;
|
isDirty?: boolean;
|
||||||
/** 소프트 삭제 — 최종 저장 시 mode:D */
|
/** 소프트 삭제 — 최종 저장 시 mode:D */
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { ElaprDocPrgrsClientResponseDto, PageableParams, PageResponse } from "@/shared/model";
|
import type { ElaprDocPrgrsClientResponseDto, PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type { ElaprBranchDto } from "./elapr-forkjoin-types";
|
||||||
import type { ElaprPrgrsSttsSaveRequestDto } from "./elapr-prgrs-stts-interface";
|
import type { ElaprPrgrsSttsSaveRequestDto } from "./elapr-prgrs-stts-interface";
|
||||||
|
|
||||||
/** 백엔드 ElaprDmndSaveRequestDto */
|
/** 백엔드 ElaprDmndSaveRequestDto */
|
||||||
@@ -7,6 +8,9 @@ export interface ElaprDmndSaveRequestDto {
|
|||||||
elaprDocNo: string;
|
elaprDocNo: string;
|
||||||
dmndTtl: string;
|
dmndTtl: string;
|
||||||
dmndCn: string;
|
dmndCn: string;
|
||||||
|
taskSeComCd?: string | null;
|
||||||
|
forkJoinSeCd?: string | null;
|
||||||
|
crntStageNo?: number | null;
|
||||||
elaprCycl?: number | null;
|
elaprCycl?: number | null;
|
||||||
docPrgrsSttsComCd?: string | null;
|
docPrgrsSttsComCd?: string | null;
|
||||||
elaprPrgrsSttsList?: ElaprPrgrsSttsSaveRequestDto[];
|
elaprPrgrsSttsList?: ElaprPrgrsSttsSaveRequestDto[];
|
||||||
@@ -19,8 +23,13 @@ export interface ElaprDmndResponseDto {
|
|||||||
elaprDocNo: string;
|
elaprDocNo: string;
|
||||||
dmndTtl: string;
|
dmndTtl: string;
|
||||||
dmndCn: string;
|
dmndCn: string;
|
||||||
|
taskSeComCd?: string;
|
||||||
|
forkJoinSeCd?: string;
|
||||||
|
crntStageNo?: number;
|
||||||
|
elaprBranchList?: ElaprBranchDto[];
|
||||||
atrzSttsComCd: string;
|
atrzSttsComCd: string;
|
||||||
atrzSttsComNm?: string;
|
atrzSttsComNm?: string;
|
||||||
|
elaprCycl?: number;
|
||||||
dmndDt?: string;
|
dmndDt?: string;
|
||||||
updtDt?: string;
|
updtDt?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* 공공하수도 재원협의 복합사업(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,6 +14,9 @@ export type ElaprPrgrsSttsSaveMode =
|
|||||||
export interface ElaprPrgrsSttsResponseDto {
|
export interface ElaprPrgrsSttsResponseDto {
|
||||||
elaprPrgrsId: string;
|
elaprPrgrsId: string;
|
||||||
elaprDmndId?: string;
|
elaprDmndId?: string;
|
||||||
|
branchId?: string;
|
||||||
|
branchSeCd?: string;
|
||||||
|
aprvrDeptNm?: string;
|
||||||
aprvrUuid?: string;
|
aprvrUuid?: string;
|
||||||
atrzSeComCd?: string;
|
atrzSeComCd?: string;
|
||||||
atrzSeComNm?: string;
|
atrzSeComNm?: string;
|
||||||
@@ -30,6 +33,9 @@ export interface ElaprPrgrsSttsSaveRequestDto {
|
|||||||
mode?: ElaprPrgrsSttsSaveMode;
|
mode?: ElaprPrgrsSttsSaveMode;
|
||||||
elaprPrgrsId?: string;
|
elaprPrgrsId?: string;
|
||||||
elaprDmndId?: string;
|
elaprDmndId?: string;
|
||||||
|
branchId?: string;
|
||||||
|
branchSeCd?: string;
|
||||||
|
aprvrDeptNm?: string;
|
||||||
aprvrUuid?: string;
|
aprvrUuid?: string;
|
||||||
atrzSeComCd?: string;
|
atrzSeComCd?: string;
|
||||||
atrzSeqNo?: number;
|
atrzSeqNo?: number;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ interface ElaprApprovalDialogProps {
|
|||||||
elaprDocNo: string;
|
elaprDocNo: string;
|
||||||
currentUserUuid: string;
|
currentUserUuid: string;
|
||||||
elaprCycl?: number;
|
elaprCycl?: number;
|
||||||
|
taskSeComCd?: string | null;
|
||||||
onSuccess: () => void;
|
onSuccess: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +61,7 @@ function ElaprApprovalDialog({
|
|||||||
elaprDocNo,
|
elaprDocNo,
|
||||||
currentUserUuid,
|
currentUserUuid,
|
||||||
elaprCycl,
|
elaprCycl,
|
||||||
|
taskSeComCd,
|
||||||
onSuccess,
|
onSuccess,
|
||||||
}: ElaprApprovalDialogProps) {
|
}: ElaprApprovalDialogProps) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -104,7 +106,29 @@ function ElaprApprovalDialog({
|
|||||||
const currentUserPrgrs = findCurrentUserPendingApprovalRequest(cyclDocPrgrsList, currentUserUuid);
|
const currentUserPrgrs = findCurrentUserPendingApprovalRequest(cyclDocPrgrsList, currentUserUuid);
|
||||||
const canApprove = Boolean(currentUserPrgrs?.elaprPrgrsId);
|
const canApprove = Boolean(currentUserPrgrs?.elaprPrgrsId);
|
||||||
const canReject =
|
const canReject =
|
||||||
currentUserPrgrs?.atrzSeComCd === "ATRZ03" || currentUserPrgrs?.atrzSeComCd === "ATRZ99";
|
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]);
|
||||||
|
|
||||||
const pickingRow = pickingRowKey ? rows.find((r) => r.rowKey === pickingRowKey) : undefined;
|
const pickingRow = pickingRowKey ? rows.find((r) => r.rowKey === pickingRowKey) : undefined;
|
||||||
const isBusy = isProcessing || savePrgrsSttsMutation.isPending;
|
const isBusy = isProcessing || savePrgrsSttsMutation.isPending;
|
||||||
@@ -239,7 +263,11 @@ function ElaprApprovalDialog({
|
|||||||
atrzPrgrsSttsComCd: "ATRZ_PRGRS_004",
|
atrzPrgrsSttsComCd: "ATRZ_PRGRS_004",
|
||||||
rjctRsn: rjctRsn.trim(),
|
rjctRsn: rjctRsn.trim(),
|
||||||
});
|
});
|
||||||
alert("반려 처리가 완료되었습니다.");
|
alert(
|
||||||
|
isForkJoin
|
||||||
|
? "결재가 반려 처리되었습니다.\n직전 결재자가 '결재 대기중'으로 변경되었습니다. 상대 부서 결재는 정상 진행됩니다."
|
||||||
|
: "반려 처리가 완료되었습니다.",
|
||||||
|
);
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||||
});
|
});
|
||||||
@@ -272,6 +300,42 @@ function ElaprApprovalDialog({
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="space-y-6">
|
<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>
|
||||||
<div className="mb-3 flex flex-wrap items-center justify-between gap-3">
|
<div className="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||||
<h4 className="text-xl font-semibold">결재 진행 단계</h4>
|
<h4 className="text-xl font-semibold">결재 진행 단계</h4>
|
||||||
@@ -280,7 +344,7 @@ function ElaprApprovalDialog({
|
|||||||
size="sm"
|
size="sm"
|
||||||
type="button"
|
type="button"
|
||||||
color="white"
|
color="white"
|
||||||
disabled={!elaprDmndId || isEditingLocked || isBusy}
|
disabled={isForkJoin || !elaprDmndId || isEditingLocked || isBusy}
|
||||||
onClick={addRow}
|
onClick={addRow}
|
||||||
>
|
>
|
||||||
결재선 추가
|
결재선 추가
|
||||||
@@ -345,11 +409,11 @@ function ElaprApprovalDialog({
|
|||||||
<SortablePrgrsSttsRow
|
<SortablePrgrsSttsRow
|
||||||
key={row.rowKey}
|
key={row.rowKey}
|
||||||
row={row}
|
row={row}
|
||||||
displaySeqNo={index + 1}
|
displaySeqNo={isForkJoin ? Number(row.atrzSeqNo ?? index + 1) : index + 1}
|
||||||
isEditing={editingRowKey === row.rowKey}
|
isEditing={editingRowKey === row.rowKey}
|
||||||
isLocked={isEditingLocked}
|
isLocked={isEditingLocked}
|
||||||
dragDisabled={
|
dragDisabled={
|
||||||
isEditingLocked || !isPrgrsSttsRowEditable(row) || !row.atrzSeComCd
|
isForkJoin || isEditingLocked || !isPrgrsSttsRowEditable(row) || !row.atrzSeComCd
|
||||||
}
|
}
|
||||||
onStartEdit={() => startEdit(row.rowKey)}
|
onStartEdit={() => startEdit(row.rowKey)}
|
||||||
onSave={() => handleRowSave(row.rowKey)}
|
onSave={() => handleRowSave(row.rowKey)}
|
||||||
@@ -372,6 +436,17 @@ function ElaprApprovalDialog({
|
|||||||
|
|
||||||
{canApprove && (
|
{canApprove && (
|
||||||
<div>
|
<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>
|
<h4 className="mb-3 text-xl font-semibold">반려 의견</h4>
|
||||||
<Textarea
|
<Textarea
|
||||||
value={rjctRsn}
|
value={rjctRsn}
|
||||||
@@ -392,7 +467,7 @@ function ElaprApprovalDialog({
|
|||||||
{canApprove && (
|
{canApprove && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Button onClick={handleApprove} disabled={isBusy}>
|
<Button onClick={handleApprove} disabled={isBusy}>
|
||||||
결재
|
{approveButtonLabel}
|
||||||
</Button>
|
</Button>
|
||||||
{canReject && (
|
{canReject && (
|
||||||
<Button color="red" onClick={handleReject} disabled={isBusy}>
|
<Button color="red" onClick={handleReject} disabled={isBusy}>
|
||||||
|
|||||||
@@ -0,0 +1,190 @@
|
|||||||
|
"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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
"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,10 +13,13 @@ import { cn, Skeleton, Tabs, TabsContent, TabsList, TabsTrigger } from "@common/
|
|||||||
import { useElaprDocPrgrsByDocNo } from "../api/queries";
|
import { useElaprDocPrgrsByDocNo } from "../api/queries";
|
||||||
import { getApproverStatus, sortByAtrzSeqNo } from "../lib/approval-utils";
|
import { getApproverStatus, sortByAtrzSeqNo } from "../lib/approval-utils";
|
||||||
|
|
||||||
|
import { ElaprDocPrgrsForkJoinStep } from "./elapr-doc-prgrs-forkjoin-step";
|
||||||
|
|
||||||
const REJECT_STATUS_CD = "ATRZ_PRGRS_004";
|
const REJECT_STATUS_CD = "ATRZ_PRGRS_004";
|
||||||
|
|
||||||
interface ElaprDocPrgrsStatusProps {
|
interface ElaprDocPrgrsStatusProps {
|
||||||
elaprDocNo: string | null | undefined;
|
elaprDocNo: string | null | undefined;
|
||||||
|
taskSeComCd?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ElaprDocPrgrsStep({ item }: { item: ElaprDocPrgrsClientResponseDto }) {
|
function ElaprDocPrgrsStep({ item }: { item: ElaprDocPrgrsClientResponseDto }) {
|
||||||
@@ -88,21 +91,33 @@ function ElaprDocPrgrsStepList({ steps }: { steps: ElaprDocPrgrsClientResponseDt
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ElaprDocPrgrsStatus({ elaprDocNo }: ElaprDocPrgrsStatusProps) {
|
function ElaprDocPrgrsStatus({ elaprDocNo, taskSeComCd }: ElaprDocPrgrsStatusProps) {
|
||||||
const userInfo = useUserStore((state) => state.userInfo);
|
const userInfo = useUserStore((state) => state.userInfo);
|
||||||
const { data, isLoading } = useElaprDocPrgrsByDocNo(elaprDocNo);
|
const { data, isLoading } = useElaprDocPrgrsByDocNo(elaprDocNo);
|
||||||
const [activeCycl, setActiveCycl] = useState<"1" | "2">("1");
|
const [activeCycl, setActiveCycl] = useState<"1" | "2">("1");
|
||||||
|
|
||||||
const { cycl1Steps, cycl2Steps, hasCycl2 } = useMemo(() => {
|
const { cycl1Steps, cycl2Steps, hasCycl2, isForkJoin1, isForkJoin2 } = useMemo(() => {
|
||||||
const rows = data ?? [];
|
const rows = data ?? [];
|
||||||
const cycl1 = sortByAtrzSeqNo(rows.filter((item) => Number(item.elaprCycl ?? 1) !== 2));
|
const cycl1 = sortByAtrzSeqNo(rows.filter((item) => Number(item.elaprCycl ?? 1) !== 2));
|
||||||
const cycl2 = sortByAtrzSeqNo(rows.filter((item) => Number(item.elaprCycl) === 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 {
|
return {
|
||||||
cycl1Steps: cycl1,
|
cycl1Steps: cycl1,
|
||||||
cycl2Steps: cycl2,
|
cycl2Steps: cycl2,
|
||||||
hasCycl2: cycl2.length > 0,
|
hasCycl2: cycl2.length > 0,
|
||||||
|
isForkJoin1: checkForkJoin(cycl1),
|
||||||
|
isForkJoin2: checkForkJoin(cycl2),
|
||||||
};
|
};
|
||||||
}, [data]);
|
}, [data, taskSeComCd]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setActiveCycl(hasCycl2 ? "2" : "1");
|
setActiveCycl(hasCycl2 ? "2" : "1");
|
||||||
@@ -138,23 +153,33 @@ function ElaprDocPrgrsStatus({ elaprDocNo }: ElaprDocPrgrsStatusProps) {
|
|||||||
>
|
>
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value="1" className="!px-6 !py-3 text-xl">
|
<TabsTrigger value="1" className="!px-6 !py-3 text-xl">
|
||||||
재원협의
|
1차 실무협의 (기술검토)
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="2" className="!px-6 !py-3 text-xl">
|
<TabsTrigger value="2" className="!px-6 !py-3 text-xl">
|
||||||
실무협의서
|
2차 조치결과 검토 (종결)
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
<TabsContent value="1" className="mt-2 border-none p-0 shadow-none">
|
<TabsContent value="1" className="mt-2 border-none p-0 shadow-none">
|
||||||
<div className="-mx-2">
|
<div className="-mx-2">
|
||||||
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
{isForkJoin1 ? (
|
||||||
|
<ElaprDocPrgrsForkJoinStep steps={cycl1Steps} />
|
||||||
|
) : (
|
||||||
|
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
<TabsContent value="2" className="mt-2 border-none p-0 shadow-none">
|
<TabsContent value="2" className="mt-2 border-none p-0 shadow-none">
|
||||||
<div className="-mx-2">
|
<div className="-mx-2">
|
||||||
<ElaprDocPrgrsStepList steps={cycl2Steps} />
|
{isForkJoin2 ? (
|
||||||
|
<ElaprDocPrgrsForkJoinStep steps={cycl2Steps} />
|
||||||
|
) : (
|
||||||
|
<ElaprDocPrgrsStepList steps={cycl2Steps} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
) : isForkJoin1 ? (
|
||||||
|
<ElaprDocPrgrsForkJoinStep steps={cycl1Steps} />
|
||||||
) : (
|
) : (
|
||||||
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
<ElaprDocPrgrsStepList steps={cycl1Steps} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -0,0 +1,472 @@
|
|||||||
|
"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,6 +24,7 @@ import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
|||||||
import type { ElaprTmplt } from "../model/elapr-tmplt-interface";
|
import type { ElaprTmplt } from "../model/elapr-tmplt-interface";
|
||||||
|
|
||||||
import { ElaprAplnPickerGrid } from "./elapr-apln-picker-grid";
|
import { ElaprAplnPickerGrid } from "./elapr-apln-picker-grid";
|
||||||
|
import { ElaprForkJoinPickerGrid } from "./elapr-forkjoin-picker-grid";
|
||||||
import { ElaprTmpltSelectTable } from "./elapr-tmplt-select-table";
|
import { ElaprTmpltSelectTable } from "./elapr-tmplt-select-table";
|
||||||
|
|
||||||
const PAGE_SIZE = 100;
|
const PAGE_SIZE = 100;
|
||||||
@@ -37,6 +38,7 @@ interface ElaprTmpltPickerDialogProps {
|
|||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
docSeComCd: string;
|
docSeComCd: string;
|
||||||
|
taskSeComCd?: string | null;
|
||||||
onSelect?: (tmplt: ElaprTmplt) => void;
|
onSelect?: (tmplt: ElaprTmplt) => void;
|
||||||
onConfirm?: (payload: ElaprTmpltPickerConfirmPayload) => void;
|
onConfirm?: (payload: ElaprTmpltPickerConfirmPayload) => void;
|
||||||
}
|
}
|
||||||
@@ -45,6 +47,7 @@ function ElaprTmpltPickerDialog({
|
|||||||
open,
|
open,
|
||||||
onClose,
|
onClose,
|
||||||
docSeComCd,
|
docSeComCd,
|
||||||
|
taskSeComCd,
|
||||||
onSelect,
|
onSelect,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
}: ElaprTmpltPickerDialogProps) {
|
}: ElaprTmpltPickerDialogProps) {
|
||||||
@@ -53,6 +56,8 @@ function ElaprTmpltPickerDialog({
|
|||||||
const [aplnRows, setAplnRows] = useState<ElaprAplnRow[]>([]);
|
const [aplnRows, setAplnRows] = useState<ElaprAplnRow[]>([]);
|
||||||
const [isEditingLocked, setIsEditingLocked] = useState(false);
|
const [isEditingLocked, setIsEditingLocked] = useState(false);
|
||||||
|
|
||||||
|
const isForkJoinMode = docSeComCd === "FNRS" && taskSeComCd === "SF_SP";
|
||||||
|
|
||||||
const tmpltQuery = useElaprTmpltPage({
|
const tmpltQuery = useElaprTmpltPage({
|
||||||
page: 0,
|
page: 0,
|
||||||
size: PAGE_SIZE,
|
size: PAGE_SIZE,
|
||||||
@@ -70,7 +75,9 @@ function ElaprTmpltPickerDialog({
|
|||||||
|
|
||||||
function handleSelectTmplt(tmplt: ElaprTmplt | null) {
|
function handleSelectTmplt(tmplt: ElaprTmplt | null) {
|
||||||
setSelectedTmplt(tmplt);
|
setSelectedTmplt(tmplt);
|
||||||
setAplnRows([]);
|
if (!isForkJoinMode) {
|
||||||
|
setAplnRows([]);
|
||||||
|
}
|
||||||
setIsEditingLocked(false);
|
setIsEditingLocked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +91,110 @@ function ElaprTmpltPickerDialog({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleConfirm() {
|
function handleConfirm() {
|
||||||
if (!selectedTmplt) {
|
if (!selectedTmplt && !isForkJoinMode) {
|
||||||
alert("결재서식을 선택해 주세요.");
|
alert("결재서식을 선택해 주세요.");
|
||||||
return;
|
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);
|
const rowsError = validateAllRowsForSave(aplnRows, isEditingLocked);
|
||||||
if (rowsError) {
|
if (rowsError) {
|
||||||
alert(rowsError);
|
alert(rowsError);
|
||||||
@@ -116,14 +222,14 @@ function ElaprTmpltPickerDialog({
|
|||||||
const visibleRows = getVisibleRows(aplnRows);
|
const visibleRows = getVisibleRows(aplnRows);
|
||||||
|
|
||||||
const payload: ElaprTmpltPickerConfirmPayload = {
|
const payload: ElaprTmpltPickerConfirmPayload = {
|
||||||
tmplt: selectedTmplt,
|
tmplt: selectedTmplt!,
|
||||||
aplnRows: visibleRows,
|
aplnRows: visibleRows,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (onConfirm) {
|
if (onConfirm) {
|
||||||
onConfirm(payload);
|
onConfirm(payload);
|
||||||
} else {
|
} else {
|
||||||
onSelect?.(selectedTmplt);
|
onSelect?.(selectedTmplt!);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedTmplt(null);
|
setSelectedTmplt(null);
|
||||||
@@ -134,9 +240,16 @@ function ElaprTmpltPickerDialog({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||||
<DialogContent className="max-w-[120rem]" aria-describedby={undefined}>
|
<DialogContent
|
||||||
|
className={isForkJoinMode ? "max-w-[140rem]" : "max-w-[120rem]"}
|
||||||
|
aria-describedby={undefined}
|
||||||
|
>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>결재선 선택</DialogTitle>
|
<DialogTitle>
|
||||||
|
{isForkJoinMode
|
||||||
|
? "결재선 선택 (복합사업 처리시설+하수관로 Fork-Join 3트랙)"
|
||||||
|
: "결재선 선택"}
|
||||||
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="flex gap-6">
|
<div className="flex gap-6">
|
||||||
@@ -145,11 +258,19 @@ function ElaprTmpltPickerDialog({
|
|||||||
selectedTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
selectedTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||||
onSelectTmplt={handleSelectTmplt}
|
onSelectTmplt={handleSelectTmplt}
|
||||||
/>
|
/>
|
||||||
<ElaprAplnPickerGrid
|
|
||||||
elaprTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
{isForkJoinMode ? (
|
||||||
onRowsChange={handleRowsChange}
|
<ElaprForkJoinPickerGrid
|
||||||
onEditingLockedChange={handleEditingLockedChange}
|
onRowsChange={handleRowsChange}
|
||||||
/>
|
onEditingLockedChange={handleEditingLockedChange}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<ElaprAplnPickerGrid
|
||||||
|
elaprTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||||
|
onRowsChange={handleRowsChange}
|
||||||
|
onEditingLockedChange={handleEditingLockedChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
@@ -158,7 +279,7 @@ function ElaprTmpltPickerDialog({
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!selectedTmplt || isEditingLocked}
|
disabled={(!selectedTmplt && !isForkJoinMode) || isEditingLocked}
|
||||||
onClick={handleConfirm}
|
onClick={handleConfirm}
|
||||||
>
|
>
|
||||||
확인
|
확인
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ export const fnrsSharItemSchema = z.object({
|
|||||||
export const fnrsCnsltnApplySaveSchema = z.object({
|
export const fnrsCnsltnApplySaveSchema = z.object({
|
||||||
techReViewSaveCd: z.string().nullish(),
|
techReViewSaveCd: z.string().nullish(),
|
||||||
rvwStpCd: z.string().nullish(),
|
rvwStpCd: z.string().nullish(),
|
||||||
|
branchSeCd: z.string().nullish(),
|
||||||
fnrsCnsltnMng: fnrsCnsltnMngSaveSchema,
|
fnrsCnsltnMng: fnrsCnsltnMngSaveSchema,
|
||||||
bzScaleList: z.array(fnrsCnsltnBzScaleItemSchema).nullish(),
|
bzScaleList: z.array(fnrsCnsltnBzScaleItemSchema).nullish(),
|
||||||
bizCstList: z.array(fnrsCnsltnBizCstItemSchema).nullish(),
|
bizCstList: z.array(fnrsCnsltnBizCstItemSchema).nullish(),
|
||||||
|
|||||||
+13
-3
@@ -11,27 +11,34 @@ const BASE = ENDPOINT.AS_SERVICE.PWRK_CNSLTN_DOC_CRT_RSLT;
|
|||||||
|
|
||||||
async function findLatestByCrtDmndUuid(
|
async function findLatestByCrtDmndUuid(
|
||||||
crtDmndUuid: string,
|
crtDmndUuid: string,
|
||||||
|
branchSeCd?: string,
|
||||||
): Promise<PwrkCnsltnDocCrtRsltResponseDto> {
|
): Promise<PwrkCnsltnDocCrtRsltResponseDto> {
|
||||||
const response = await client.get<PwrkCnsltnDocCrtRsltResponseDto>(
|
const response = await client.get<PwrkCnsltnDocCrtRsltResponseDto>(
|
||||||
`${BASE}/${crtDmndUuid}/latest`,
|
`${BASE}/${crtDmndUuid}/latest`,
|
||||||
|
{
|
||||||
|
params: branchSeCd ? { branchSeCd } : undefined,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openWebHwpLatest(crtDmndUuid: string) {
|
async function openWebHwpLatest(crtDmndUuid: string, branchSeCd?: string) {
|
||||||
return client.get<Blob>(`${BASE}/${crtDmndUuid}/webhwp/open`, {
|
return client.get<Blob>(`${BASE}/${crtDmndUuid}/webhwp/open`, {
|
||||||
|
params: branchSeCd ? { branchSeCd } : undefined,
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function download(crtDmndUuid: string, verSn: number) {
|
async function download(crtDmndUuid: string, verSn: number, branchSeCd?: string) {
|
||||||
return client.get<Blob>(`${BASE}/${crtDmndUuid}/${verSn}/download`, {
|
return client.get<Blob>(`${BASE}/${crtDmndUuid}/${verSn}/download`, {
|
||||||
|
params: branchSeCd ? { branchSeCd } : undefined,
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadLatest(crtDmndUuid: string) {
|
async function downloadLatest(crtDmndUuid: string, branchSeCd?: string) {
|
||||||
return client.get<Blob>(`${BASE}/${crtDmndUuid}/download`, {
|
return client.get<Blob>(`${BASE}/${crtDmndUuid}/download`, {
|
||||||
|
params: branchSeCd ? { branchSeCd } : undefined,
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -47,6 +54,9 @@ async function saveMultipart(
|
|||||||
if (saveDto.atchFileGroupId) {
|
if (saveDto.atchFileGroupId) {
|
||||||
formData.append("atchFileGroupId", saveDto.atchFileGroupId);
|
formData.append("atchFileGroupId", saveDto.atchFileGroupId);
|
||||||
}
|
}
|
||||||
|
if (saveDto.branchSeCd) {
|
||||||
|
formData.append("branchSeCd", saveDto.branchSeCd);
|
||||||
|
}
|
||||||
if (file) {
|
if (file) {
|
||||||
const resolvedFileName = fileName ?? (file instanceof File ? file.name : "document.hwpx");
|
const resolvedFileName = fileName ?? (file instanceof File ? file.name : "document.hwpx");
|
||||||
formData.append("file", file, resolvedFileName);
|
formData.append("file", file, resolvedFileName);
|
||||||
|
|||||||
+13
-4
@@ -5,6 +5,7 @@ import type { PwrkCnsltnDocCrtRsltSaveRequestDto } from "./pwrk-cnsltn-doc-crt-r
|
|||||||
export interface PwrkCnsltnDocCrtRsltResponseDto {
|
export interface PwrkCnsltnDocCrtRsltResponseDto {
|
||||||
crtDmndUuid: string;
|
crtDmndUuid: string;
|
||||||
verSn: number;
|
verSn: number;
|
||||||
|
branchSeCd?: string;
|
||||||
rgtrUuid?: string;
|
rgtrUuid?: string;
|
||||||
rgtrNm?: string;
|
rgtrNm?: string;
|
||||||
orgnlOtptDocCn: null;
|
orgnlOtptDocCn: null;
|
||||||
@@ -14,15 +15,23 @@ export interface PwrkCnsltnDocCrtRsltResponseDto {
|
|||||||
/** 백엔드 PwrkCnsltnDocCrtRsltUpdateRequestDto (모두 optional) */
|
/** 백엔드 PwrkCnsltnDocCrtRsltUpdateRequestDto (모두 optional) */
|
||||||
export interface PwrkCnsltnDocCrtRsltUpdateRequestDto {
|
export interface PwrkCnsltnDocCrtRsltUpdateRequestDto {
|
||||||
rgtrUuid?: string;
|
rgtrUuid?: string;
|
||||||
|
branchSeCd?: string;
|
||||||
orgnlOtptDocCn?: string;
|
orgnlOtptDocCn?: string;
|
||||||
crtCmptnDt?: string;
|
crtCmptnDt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PwrkCnsltnDocCrtRsltService {
|
export interface PwrkCnsltnDocCrtRsltService {
|
||||||
findLatestByCrtDmndUuid(crtDmndUuid: string): Promise<PwrkCnsltnDocCrtRsltResponseDto>;
|
findLatestByCrtDmndUuid(
|
||||||
openWebHwpLatest(crtDmndUuid: string): Promise<AxiosResponse<Blob>>;
|
crtDmndUuid: string,
|
||||||
download(crtDmndUuid: string, verSn: number): Promise<AxiosResponse<Blob>>;
|
branchSeCd?: string,
|
||||||
downloadLatest(crtDmndUuid: string): Promise<AxiosResponse<Blob>>;
|
): 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>>;
|
||||||
saveMultipart(
|
saveMultipart(
|
||||||
saveDto: PwrkCnsltnDocCrtRsltSaveRequestDto,
|
saveDto: PwrkCnsltnDocCrtRsltSaveRequestDto,
|
||||||
file?: Blob | File,
|
file?: Blob | File,
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@ export const pwrkCnsltnDocCrtRsltSaveRequestSchema = z.object({
|
|||||||
crtDmndUuid: z.string().uuid(),
|
crtDmndUuid: z.string().uuid(),
|
||||||
pwrkCnsltnDocNo: z.string().min(1).max(100),
|
pwrkCnsltnDocNo: z.string().min(1).max(100),
|
||||||
atchFileGroupId: z.string().max(30).nullish(),
|
atchFileGroupId: z.string().max(30).nullish(),
|
||||||
|
branchSeCd: z.string().max(20).nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type PwrkCnsltnDocCrtRsltSaveRequestDto = z.infer<
|
export type PwrkCnsltnDocCrtRsltSaveRequestDto = z.infer<
|
||||||
|
|||||||
@@ -188,16 +188,148 @@ 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[] {
|
function resolveButtonConfigs(actions: FnrsCnsltnViewButtonAction[]): FnrsCnsltnViewButtonAction[] {
|
||||||
return actions.map((action) => FNRS_CNSLTN_VIEW_BUTTON_ACTION[action]);
|
return actions.map((action) => FNRS_CNSLTN_VIEW_BUTTON_ACTION[action]);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GetButtonConfigsOptions {
|
export interface GetButtonConfigsOptions {
|
||||||
hasPendingApprovalRequest?: boolean;
|
hasPendingApprovalRequest?: boolean;
|
||||||
hasCompletedDraft?: boolean;
|
hasCompletedDraft?: boolean;
|
||||||
canRetryFileVrfc?: boolean;
|
canRetryFileVrfc?: boolean;
|
||||||
canRetryDraftGen?: boolean;
|
canRetryDraftGen?: boolean;
|
||||||
canRetryCostVrfc?: 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>([
|
const PENDING_APPROVAL_ACTIONS = new Set<FnrsCnsltnViewButtonAction>([
|
||||||
@@ -214,7 +346,30 @@ function resolveRoleUser01AtrzButtonActions(
|
|||||||
atrzSeComCdList: string[],
|
atrzSeComCdList: string[],
|
||||||
options?: GetButtonConfigsOptions,
|
options?: GetButtonConfigsOptions,
|
||||||
): FnrsCnsltnViewButtonAction[] {
|
): FnrsCnsltnViewButtonAction[] {
|
||||||
const atrzStatusMap = ROLE_USER01_ATRZ_STATUS_ACTIONS[prgrsSttsComCd];
|
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];
|
||||||
if (!atrzStatusMap || atrzSeComCdList.length === 0) return [];
|
if (!atrzStatusMap || atrzSeComCdList.length === 0) return [];
|
||||||
|
|
||||||
const seen = new Set<FnrsCnsltnViewButtonAction>();
|
const seen = new Set<FnrsCnsltnViewButtonAction>();
|
||||||
@@ -249,12 +404,12 @@ function resolveRoleUser01AtrzButtonActions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options?.hasCompletedDraft != null) {
|
if (options?.hasCompletedDraft != null) {
|
||||||
if (prgrsSttsComCd === "SL" || prgrsSttsComCd === "TE" || prgrsSttsComCd === "RK") {
|
if (effectiveStatus === "SL" || effectiveStatus === "TE" || effectiveStatus === "RK") {
|
||||||
if (action === FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng) {
|
if (action === FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng) {
|
||||||
return options.hasCompletedDraft;
|
return options.hasCompletedDraft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prgrsSttsComCd === "TE") {
|
if (effectiveStatus === "TE") {
|
||||||
if (action === FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) {
|
if (action === FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) {
|
||||||
return options.hasCompletedDraft;
|
return options.hasCompletedDraft;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { BranchSeCd } from "@/entities/elapr";
|
||||||
import type { CklstResultItem, CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
import type { CklstResultItem, CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -142,3 +143,108 @@ 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,3 +98,27 @@ export function parseTaskSeComCdFromApi(taskSeComCd?: string | null): string[] {
|
|||||||
if (!taskSeComCd) return [];
|
if (!taskSeComCd) return [];
|
||||||
return taskSeComCd.split(",").filter(Boolean);
|
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,6 +93,7 @@ export function buildSupplementReqPayload(
|
|||||||
data: FnrsCnsltnMngDetResponseDto,
|
data: FnrsCnsltnMngDetResponseDto,
|
||||||
payload: SplmntDmndDialogConfirmPayload,
|
payload: SplmntDmndDialogConfirmPayload,
|
||||||
checklistFormState: ChecklistFormState,
|
checklistFormState: ChecklistFormState,
|
||||||
|
branchSeCd?: string,
|
||||||
): FnrsCnsltnApplySaveRequestDto {
|
): FnrsCnsltnApplySaveRequestDto {
|
||||||
const existingItems: FnrsCnsltnSplmntDmndItem[] = (data.splmntDmndList ?? []).map((item) =>
|
const existingItems: FnrsCnsltnSplmntDmndItem[] = (data.splmntDmndList ?? []).map((item) =>
|
||||||
toSplmntDmndSaveItem(item),
|
toSplmntDmndSaveItem(item),
|
||||||
@@ -111,6 +112,7 @@ export function buildSupplementReqPayload(
|
|||||||
return fnrsCnsltnApplySaveSchema.parse({
|
return fnrsCnsltnApplySaveSchema.parse({
|
||||||
...buildSavePayload(data, checklistFormState, "LOCAL", "SL"),
|
...buildSavePayload(data, checklistFormState, "LOCAL", "SL"),
|
||||||
splmntDmndList: [...existingItems, ...newItems],
|
splmntDmndList: [...existingItems, ...newItems],
|
||||||
|
branchSeCd,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,14 @@ import {
|
|||||||
ElaprApprovalDialog,
|
ElaprApprovalDialog,
|
||||||
type ElaprDmndSaveRequestDto,
|
type ElaprDmndSaveRequestDto,
|
||||||
elaprDmndService,
|
elaprDmndService,
|
||||||
|
type ElaprDocPrgrsForkJoinPickerConfirmPayload,
|
||||||
|
ElaprDocPrgrsForkJoinPickerDialog,
|
||||||
type ElaprDocPrgrsPickerConfirmPayload,
|
type ElaprDocPrgrsPickerConfirmPayload,
|
||||||
ElaprDocPrgrsPickerDialog,
|
ElaprDocPrgrsPickerDialog,
|
||||||
type ElaprTmpltPickerConfirmPayload,
|
type ElaprTmpltPickerConfirmPayload,
|
||||||
ElaprTmpltPickerDialog,
|
ElaprTmpltPickerDialog,
|
||||||
hasCurrentUserPendingApprovalRequest,
|
hasCurrentUserPendingApprovalRequest,
|
||||||
|
useElaprBranchesByDocNo,
|
||||||
useElaprDocPrgrsByDocNo,
|
useElaprDocPrgrsByDocNo,
|
||||||
} from "@/entities/elapr";
|
} from "@/entities/elapr";
|
||||||
import {
|
import {
|
||||||
@@ -54,7 +57,11 @@ import {
|
|||||||
getButtonConfigs,
|
getButtonConfigs,
|
||||||
needsRoleUser01AtrzResolve,
|
needsRoleUser01AtrzResolve,
|
||||||
} from "../../lib/button-config";
|
} from "../../lib/button-config";
|
||||||
import { computeReviewStepChecklistProgress } from "../../lib/checklist-utils";
|
import type { BranchSeCd } from "@/entities/elapr";
|
||||||
|
import {
|
||||||
|
computeReviewStepChecklistProgress,
|
||||||
|
validateChecklistFormStateByBranch,
|
||||||
|
} from "../../lib/checklist-utils";
|
||||||
import {
|
import {
|
||||||
buildFileSplmntReqPayload,
|
buildFileSplmntReqPayload,
|
||||||
buildRvwRsltSplmntReqPayload,
|
buildRvwRsltSplmntReqPayload,
|
||||||
@@ -63,6 +70,10 @@ import {
|
|||||||
buildTechReviewReplyPayload,
|
buildTechReviewReplyPayload,
|
||||||
toSplmntDmndSaveItem,
|
toSplmntDmndSaveItem,
|
||||||
} from "../../lib/save-payload-utils";
|
} from "../../lib/save-payload-utils";
|
||||||
|
import {
|
||||||
|
isForkJoinTask,
|
||||||
|
normalizeTaskSeComCdForElapr,
|
||||||
|
} from "../../lib/fnrs-cnsltn-regist-schema";
|
||||||
import { type ChecklistFormState } from "../../model/view-types";
|
import { type ChecklistFormState } from "../../model/view-types";
|
||||||
import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opinion-section";
|
import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opinion-section";
|
||||||
|
|
||||||
@@ -96,6 +107,7 @@ interface FloatingActionButtonsProps {
|
|||||||
type ActiveDialog =
|
type ActiveDialog =
|
||||||
| "elaprTmplt"
|
| "elaprTmplt"
|
||||||
| "elaprDocPrgrs"
|
| "elaprDocPrgrs"
|
||||||
|
| "elaprDocPrgrsForkJoin"
|
||||||
| "rjct"
|
| "rjct"
|
||||||
| "fileSplmnt"
|
| "fileSplmnt"
|
||||||
| "elaprApproval"
|
| "elaprApproval"
|
||||||
@@ -128,8 +140,13 @@ function FloatingActionButtons({
|
|||||||
const docNo = data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo;
|
const docNo = data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo;
|
||||||
const isRegister = data.detDto?.rgtr === userInfo?.userUnqId;
|
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 needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
|
||||||
const needsElaprPrgrsCheck = needsAtrzResolve && ["TE", "RK"].includes(prgrsSttsComCd);
|
const needsElaprPrgrsCheck =
|
||||||
|
needsAtrzResolve &&
|
||||||
|
(["TE", "RK"].includes(prgrsSttsComCd) || (isForkJoin && prgrsSttsComCd === "SL"));
|
||||||
const needsPwrkDraftCheck =
|
const needsPwrkDraftCheck =
|
||||||
dtlInstCd === "ROLE_USER01" && ["SL", "TE", "RK"].includes(prgrsSttsComCd);
|
dtlInstCd === "ROLE_USER01" && ["SL", "TE", "RK"].includes(prgrsSttsComCd);
|
||||||
const needsPwrkForRb = dtlInstCd === "ROLE_USER05" && prgrsSttsComCd === "RB";
|
const needsPwrkForRb = dtlInstCd === "ROLE_USER05" && prgrsSttsComCd === "RB";
|
||||||
@@ -140,6 +157,10 @@ function FloatingActionButtons({
|
|||||||
const { data: elaprDocPrgrsList = [], isLoading: isElaprDocPrgrsLoading } =
|
const { data: elaprDocPrgrsList = [], isLoading: isElaprDocPrgrsLoading } =
|
||||||
useElaprDocPrgrsByDocNo(needsElaprPrgrsCheck ? docNo : null);
|
useElaprDocPrgrsByDocNo(needsElaprPrgrsCheck ? docNo : null);
|
||||||
|
|
||||||
|
const { data: elaprBranchList = [], isLoading: isElaprBranchLoading } = useElaprBranchesByDocNo(
|
||||||
|
isForkJoin && (needsElaprPrgrsCheck || prgrsSttsComCd === "SL") ? docNo : null,
|
||||||
|
);
|
||||||
|
|
||||||
const { data: pwrkCnsltnData, isLoading: isPwrkCnsltnLoading } = usePwrkCnsltnMngByUpDocNo(
|
const { data: pwrkCnsltnData, isLoading: isPwrkCnsltnLoading } = usePwrkCnsltnMngByUpDocNo(
|
||||||
docNo,
|
docNo,
|
||||||
needsPwrkLookup,
|
needsPwrkLookup,
|
||||||
@@ -179,33 +200,137 @@ function FloatingActionButtons({
|
|||||||
elaprPrgrsForPending,
|
elaprPrgrsForPending,
|
||||||
userInfo?.userUnqId,
|
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 =
|
const viewOnlyPwrkCnsltnDoc =
|
||||||
prgrsSttsComCd === "SL" ||
|
(prgrsSttsComCd === "SL" && dtlInstCd !== "ROLE_USER05" && !isBranchInProgress) ||
|
||||||
(prgrsSttsComCd === "RB" && dtlInstCd !== "ROLE_USER05") ||
|
(prgrsSttsComCd === "RB" && dtlInstCd !== "ROLE_USER05") ||
|
||||||
(prgrsSttsComCd === "RK" && dtlInstCd === "ROLE_USER03");
|
(prgrsSttsComCd === "RK" && dtlInstCd === "ROLE_USER03");
|
||||||
|
|
||||||
const actionButtons = useMemo(() => {
|
const actionButtons = useMemo(() => {
|
||||||
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
||||||
if (needsElaprPrgrsCheck && isElaprDocPrgrsLoading) return [];
|
if (needsElaprPrgrsCheck && isElaprDocPrgrsLoading) return [];
|
||||||
|
if (isForkJoin && isElaprBranchLoading) return [];
|
||||||
if (needsPwrkDraftCheck && isPwrkCnsltnLoading) return [];
|
if (needsPwrkDraftCheck && isPwrkCnsltnLoading) return [];
|
||||||
if (needsAiAutoLatest && isAiAutoLatestLoading) return [];
|
if (needsAiAutoLatest && isAiAutoLatestLoading) return [];
|
||||||
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, atrzSeComCdList, {
|
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, effectiveAtrzSeComCdList, {
|
||||||
hasPendingApprovalRequest: needsElaprPrgrsCheck ? hasPendingApprovalRequest : undefined,
|
hasPendingApprovalRequest: needsElaprPrgrsCheck ? hasPendingApprovalRequest : undefined,
|
||||||
hasCompletedDraft: needsPwrkDraftCheck ? hasCompletedDraft : undefined,
|
hasCompletedDraft: needsPwrkDraftCheck ? hasCompletedDraft : undefined,
|
||||||
canRetryFileVrfc: needsAiAutoLatest ? canRetryFileVrfc : undefined,
|
canRetryFileVrfc: needsAiAutoLatest ? canRetryFileVrfc : undefined,
|
||||||
canRetryDraftGen: needsAiAutoLatest ? canRetryDraftGen : undefined,
|
canRetryDraftGen: needsAiAutoLatest ? canRetryDraftGen : undefined,
|
||||||
canRetryCostVrfc: needsAiAutoLatest ? canRetryCostVrfc : undefined,
|
canRetryCostVrfc: needsAiAutoLatest ? canRetryCostVrfc : undefined,
|
||||||
|
isForkJoin,
|
||||||
|
branchSeCd: userBranchSeCd,
|
||||||
|
branchSttsCd: userBranchSttsCd,
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
atrzSeComCdList,
|
|
||||||
canRetryCostVrfc,
|
canRetryCostVrfc,
|
||||||
canRetryDraftGen,
|
canRetryDraftGen,
|
||||||
canRetryFileVrfc,
|
canRetryFileVrfc,
|
||||||
dtlInstCd,
|
dtlInstCd,
|
||||||
|
effectiveAtrzSeComCdList,
|
||||||
hasCompletedDraft,
|
hasCompletedDraft,
|
||||||
hasPendingApprovalRequest,
|
hasPendingApprovalRequest,
|
||||||
isAiAutoLatestLoading,
|
isAiAutoLatestLoading,
|
||||||
|
isElaprBranchLoading,
|
||||||
isElaprDocPrgrsLoading,
|
isElaprDocPrgrsLoading,
|
||||||
|
isForkJoin,
|
||||||
isPwrkCnsltnLoading,
|
isPwrkCnsltnLoading,
|
||||||
isRvwLoginUserLoading,
|
isRvwLoginUserLoading,
|
||||||
needsAiAutoLatest,
|
needsAiAutoLatest,
|
||||||
@@ -213,13 +338,15 @@ function FloatingActionButtons({
|
|||||||
needsElaprPrgrsCheck,
|
needsElaprPrgrsCheck,
|
||||||
needsPwrkDraftCheck,
|
needsPwrkDraftCheck,
|
||||||
prgrsSttsComCd,
|
prgrsSttsComCd,
|
||||||
|
userBranchSeCd,
|
||||||
|
userBranchSttsCd,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const canEdit =
|
const canEdit =
|
||||||
isRegister && actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg);
|
isRegister && actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg);
|
||||||
const canDmndSplmntInPwrkCnsltnDoc =
|
const canDmndSplmntInPwrkCnsltnDoc =
|
||||||
prgrsSttsComCd === "RK" &&
|
prgrsSttsComCd === "RK" &&
|
||||||
atrzSeComCdList.includes("ATRZ02") &&
|
effectiveAtrzSeComCdList.includes("ATRZ02") &&
|
||||||
actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt);
|
actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt);
|
||||||
|
|
||||||
function handleGoToList() {
|
function handleGoToList() {
|
||||||
@@ -256,6 +383,9 @@ function FloatingActionButtons({
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||||
});
|
});
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_BRANCH],
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
let errorMessage = "";
|
let errorMessage = "";
|
||||||
@@ -449,6 +579,9 @@ function FloatingActionButtons({
|
|||||||
elaprDocNo: docNo,
|
elaprDocNo: docNo,
|
||||||
dmndTtl: data.detDto?.bizNm ?? "",
|
dmndTtl: data.detDto?.bizNm ?? "",
|
||||||
dmndCn: data.detDto?.bizCn ?? "",
|
dmndCn: data.detDto?.bizCn ?? "",
|
||||||
|
taskSeComCd: normalizedTaskSeComCd || undefined,
|
||||||
|
forkJoinSeCd: isForkJoin ? "FORK_JOIN" : "NONE",
|
||||||
|
crntStageNo: isForkJoin ? 2 : 1,
|
||||||
elaprCycl: 1,
|
elaprCycl: 1,
|
||||||
docPrgrsSttsComCd: "AC",
|
docPrgrsSttsComCd: "AC",
|
||||||
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
|
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
|
||||||
@@ -463,11 +596,16 @@ function FloatingActionButtons({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleElaprDocPrgrsConfirm({ aplnRows }: ElaprDocPrgrsPickerConfirmPayload) {
|
async function handleElaprDocPrgrsConfirm({
|
||||||
|
aplnRows,
|
||||||
|
}: ElaprDocPrgrsPickerConfirmPayload | ElaprDocPrgrsForkJoinPickerConfirmPayload) {
|
||||||
const payload: ElaprDmndSaveRequestDto = {
|
const payload: ElaprDmndSaveRequestDto = {
|
||||||
elaprDocNo: docNo,
|
elaprDocNo: docNo,
|
||||||
dmndTtl: data.detDto?.bizNm ?? "",
|
dmndTtl: data.detDto?.bizNm ?? "",
|
||||||
dmndCn: data.detDto?.bizCn ?? "",
|
dmndCn: data.detDto?.bizCn ?? "",
|
||||||
|
taskSeComCd: normalizedTaskSeComCd || undefined,
|
||||||
|
forkJoinSeCd: isForkJoin ? "FORK_JOIN" : "NONE",
|
||||||
|
crntStageNo: isForkJoin ? 2 : 1,
|
||||||
elaprCycl: 2,
|
elaprCycl: 2,
|
||||||
docPrgrsSttsComCd: "RK",
|
docPrgrsSttsComCd: "RK",
|
||||||
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
|
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
|
||||||
@@ -487,7 +625,7 @@ function FloatingActionButtons({
|
|||||||
data,
|
data,
|
||||||
checklistFormState,
|
checklistFormState,
|
||||||
"KECO",
|
"KECO",
|
||||||
"TE",
|
prgrsSttsComCd === "SL" ? "SL" : prgrsSttsComCd === "RK" ? "RK" : "TE",
|
||||||
"SV",
|
"SV",
|
||||||
getReviewOpinionFormData(),
|
getReviewOpinionFormData(),
|
||||||
opnrNm,
|
opnrNm,
|
||||||
@@ -501,16 +639,40 @@ function FloatingActionButtons({
|
|||||||
techReviewOpinionRef?.current?.resetForm();
|
techReviewOpinionRef?.current?.resetForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleRvwCmptnClick() {
|
function handleApprovalOpen() {
|
||||||
if (prgrsSttsComCd === "TE") {
|
const isTeStep = prgrsSttsComCd === "TE" || (isForkJoin && prgrsSttsComCd === "SL");
|
||||||
const { percent } = computeReviewStepChecklistProgress(
|
if (isTeStep && (userBranchSeCd || userPendingBranchSeCd)) {
|
||||||
data.cklstResultList ?? [],
|
const branchCd = (userBranchSeCd as BranchSeCd) || (userPendingBranchSeCd as BranchSeCd) || (isForkJoin ? "SP" : "MAIN");
|
||||||
checklistFormState.results,
|
const validation = validateChecklistFormStateByBranch({
|
||||||
"KECO",
|
rows: data.cklstResultList ?? [],
|
||||||
);
|
formState: checklistFormState,
|
||||||
|
reviewStep: "KECO",
|
||||||
|
approverBranchSeCd: branchCd,
|
||||||
|
docTaskSeComCd: normalizedTaskSeComCd || data.detDto?.taskSeComCd || "MAIN",
|
||||||
|
});
|
||||||
|
|
||||||
if (percent !== 100) {
|
if (!validation.isValid) {
|
||||||
alert("모든 체크리스트 항목을 체크해야 검토완료가 가능합니다.");
|
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 (!validation.isValid) {
|
||||||
|
alert(validation.errorMessage || "모든 체크리스트 항목을 체크해야 검토완료가 가능합니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -539,7 +701,8 @@ function FloatingActionButtons({
|
|||||||
async function handleDmndSplmntConfirm(payload: SplmntDmndDialogConfirmPayload) {
|
async function handleDmndSplmntConfirm(payload: SplmntDmndDialogConfirmPayload) {
|
||||||
setIsDmndSplmntDialogOpen(false);
|
setIsDmndSplmntDialogOpen(false);
|
||||||
setActiveDialog(null);
|
setActiveDialog(null);
|
||||||
const requestPayload = buildSupplementReqPayload(data, payload, checklistFormState);
|
const branchSeCd = userBranchSeCd ?? userPendingBranchSeCd;
|
||||||
|
const requestPayload = buildSupplementReqPayload(data, payload, checklistFormState, branchSeCd);
|
||||||
await executeAction({
|
await executeAction({
|
||||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||||
request: requestPayload,
|
request: requestPayload,
|
||||||
@@ -563,7 +726,11 @@ function FloatingActionButtons({
|
|||||||
|
|
||||||
async function handleRvwRsltSplmntConfirm(selected: PwrkCnsltnCnsltnResponseDto[]) {
|
async function handleRvwRsltSplmntConfirm(selected: PwrkCnsltnCnsltnResponseDto[]) {
|
||||||
setActiveDialog(null);
|
setActiveDialog(null);
|
||||||
const requestPayload = buildRvwRsltSplmntReqPayload(data, selected, checklistFormState);
|
const branchSeCd = userBranchSeCd ?? userPendingBranchSeCd;
|
||||||
|
const requestPayload = {
|
||||||
|
...buildRvwRsltSplmntReqPayload(data, selected, checklistFormState),
|
||||||
|
branchSeCd,
|
||||||
|
};
|
||||||
await executeAction({
|
await executeAction({
|
||||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||||
request: requestPayload,
|
request: requestPayload,
|
||||||
@@ -738,7 +905,13 @@ function FloatingActionButtons({
|
|||||||
!isRagIndexingInProgress(prgrsSttsComCd, data.ragIndexingInfo) && (
|
!isRagIndexingInProgress(prgrsSttsComCd, data.ragIndexingInfo) && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setActiveDialog(prgrsSttsComCd === "EV" ? "elaprDocPrgrs" : "elaprTmplt")
|
setActiveDialog(
|
||||||
|
prgrsSttsComCd === "EV"
|
||||||
|
? isForkJoin
|
||||||
|
? "elaprDocPrgrsForkJoin"
|
||||||
|
: "elaprDocPrgrs"
|
||||||
|
: "elaprTmplt",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
disabled={isBusy}
|
disabled={isBusy}
|
||||||
>
|
>
|
||||||
@@ -750,11 +923,15 @@ function FloatingActionButtons({
|
|||||||
조치 완료
|
조치 완료
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) && (
|
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRsltInq) &&
|
||||||
<Button color="sky" onClick={() => setActiveDialog("rvwRsltInq")} disabled={isBusy}>
|
!(
|
||||||
검토 결과 조회
|
isForkJoin &&
|
||||||
</Button>
|
(userPendingBranchSeCd === "TOTAL_AGG" || userPendingAtrzSeComCd === "ATRZ04")
|
||||||
)}
|
) && (
|
||||||
|
<Button color="sky" onClick={() => setActiveDialog("rvwRsltInq")} disabled={isBusy}>
|
||||||
|
검토 결과 조회
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg) && (
|
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg) && (
|
||||||
<Button onClick={handleRvwStrgClick} disabled={isBusy}>
|
<Button onClick={handleRvwStrgClick} disabled={isBusy}>
|
||||||
저장
|
저장
|
||||||
@@ -774,16 +951,33 @@ function FloatingActionButtons({
|
|||||||
보완 요청
|
보완 요청
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv) && (
|
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv) &&
|
||||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isBusy}>
|
(!isForkJoin ||
|
||||||
결재(승인)
|
(userPendingBranchSeCd === "TOTAL_AGG" && userPendingAtrzSeComCd === "ATRZ04")) && (
|
||||||
</Button>
|
<Button onClick={handleApprovalOpen} disabled={isBusy}>
|
||||||
)}
|
{isForkJoin ? "결재 (병합)" : "결재(승인)"}
|
||||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply) && (
|
</Button>
|
||||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isBusy}>
|
)}
|
||||||
결재(회신)
|
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply) &&
|
||||||
</Button>
|
(!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>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -795,6 +989,7 @@ function FloatingActionButtons({
|
|||||||
open={activeDialog === "elaprTmplt"}
|
open={activeDialog === "elaprTmplt"}
|
||||||
onClose={() => setActiveDialog(null)}
|
onClose={() => setActiveDialog(null)}
|
||||||
docSeComCd={docSeComCd}
|
docSeComCd={docSeComCd}
|
||||||
|
taskSeComCd={normalizedTaskSeComCd || undefined}
|
||||||
onConfirm={handleElaprTmpltConfirm}
|
onConfirm={handleElaprTmpltConfirm}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -805,6 +1000,13 @@ function FloatingActionButtons({
|
|||||||
onConfirm={handleElaprDocPrgrsConfirm}
|
onConfirm={handleElaprDocPrgrsConfirm}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ElaprDocPrgrsForkJoinPickerDialog
|
||||||
|
open={activeDialog === "elaprDocPrgrsForkJoin"}
|
||||||
|
elaprDocNo={docNo}
|
||||||
|
onClose={() => setActiveDialog(null)}
|
||||||
|
onConfirm={handleElaprDocPrgrsConfirm}
|
||||||
|
/>
|
||||||
|
|
||||||
<SplmntDmndDialog
|
<SplmntDmndDialog
|
||||||
splmntArtclUpCd="SPLMNTARTCL"
|
splmntArtclUpCd="SPLMNTARTCL"
|
||||||
open={isDmndSplmntDialogOpen}
|
open={isDmndSplmntDialogOpen}
|
||||||
@@ -827,20 +1029,29 @@ function FloatingActionButtons({
|
|||||||
elaprDocNo={data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo}
|
elaprDocNo={data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo}
|
||||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||||
elaprCycl={prgrsSttsComCd === "RK" ? 2 : undefined}
|
elaprCycl={prgrsSttsComCd === "RK" ? 2 : undefined}
|
||||||
|
taskSeComCd={normalizedTaskSeComCd || undefined}
|
||||||
onSuccess={() => {
|
onSuccess={() => {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||||
});
|
});
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_BRANCH],
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PwrkCnsltnDocMngDialog
|
<PwrkCnsltnDocMngDialog
|
||||||
open={activeDialog === "pwrkCnsltnDocMng"}
|
open={activeDialog === "pwrkCnsltnDocMng"}
|
||||||
fnrsCnsltnDocNo={docNo}
|
fnrsCnsltnDocNo={docNo}
|
||||||
atrzSeComCdList={atrzSeComCdList}
|
atrzSeComCdList={effectiveAtrzSeComCdList}
|
||||||
prgrsSttsComCd={prgrsSttsComCd}
|
prgrsSttsComCd={prgrsSttsComCd}
|
||||||
|
branchSeCd={userBranchSeCd ?? userPendingBranchSeCd}
|
||||||
|
isForkJoin={isForkJoin}
|
||||||
|
userRole={dtlInstCd}
|
||||||
|
supplementDmndBranch={supplementDmndBranch}
|
||||||
canSave={
|
canSave={
|
||||||
(needsElaprPrgrsCheck && !hasPendingApprovalRequest) || viewOnlyPwrkCnsltnDoc
|
(needsElaprPrgrsCheck && !hasPendingApprovalRequest && !isBranchInProgress) ||
|
||||||
|
viewOnlyPwrkCnsltnDoc
|
||||||
? false
|
? false
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useContext, useEffect, useMemo, useState } from "react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { PanelRightClose, PanelRightOpen } from "lucide-react";
|
import { PanelRightClose, PanelRightOpen } from "lucide-react";
|
||||||
|
import { useStore } from "zustand";
|
||||||
|
|
||||||
import { getDefaultFileKey, useAlertStore, useTus } from "@/shared/lib";
|
import { getDefaultFileKey, useAlertStore, useTus } from "@/shared/lib";
|
||||||
|
import { StoreContext } from "@/shared/providers";
|
||||||
import { AttachmentFileField } from "@/shared/ui";
|
import { AttachmentFileField } from "@/shared/ui";
|
||||||
import {
|
import {
|
||||||
attachService,
|
attachService,
|
||||||
@@ -18,6 +20,7 @@ import {
|
|||||||
pwrkCnsltnDocCrtRsltService,
|
pwrkCnsltnDocCrtRsltService,
|
||||||
} from "@/entities/pwrk-cnsltn-doc-crt-rslt";
|
} from "@/entities/pwrk-cnsltn-doc-crt-rslt";
|
||||||
import { usePwrkCnsltnDocPjtcoAjmtMngPage } from "@/entities/pwrk-cnsltn-doc-pjtco-ajmt-mng";
|
import { usePwrkCnsltnDocPjtcoAjmtMngPage } from "@/entities/pwrk-cnsltn-doc-pjtco-ajmt-mng";
|
||||||
|
import { useElaprBranchesByDocNo, useElaprDocPrgrsByDocNo } from "@/entities/elapr";
|
||||||
import {
|
import {
|
||||||
findCompletedPwrkDraft,
|
findCompletedPwrkDraft,
|
||||||
pwrkCnsltnMngKeys,
|
pwrkCnsltnMngKeys,
|
||||||
@@ -31,6 +34,7 @@ import {
|
|||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
|
cn,
|
||||||
} from "@common/components";
|
} from "@common/components";
|
||||||
|
|
||||||
import { PwrkCnsltnDocEvlDialog } from "./pwrk-cnsltn-doc-evl-dialog";
|
import { PwrkCnsltnDocEvlDialog } from "./pwrk-cnsltn-doc-evl-dialog";
|
||||||
@@ -60,6 +64,10 @@ interface PwrkCnsltnDocMngDialogProps {
|
|||||||
canSave?: boolean | null;
|
canSave?: boolean | null;
|
||||||
onDmndSplmnt?: () => void;
|
onDmndSplmnt?: () => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
branchSeCd?: string;
|
||||||
|
isForkJoin?: boolean;
|
||||||
|
userRole?: string;
|
||||||
|
supplementDmndBranch?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UploadedAtchFile {
|
interface UploadedAtchFile {
|
||||||
@@ -73,6 +81,65 @@ function createPwrkAtchUploadKey(file: File) {
|
|||||||
return `${PWRK_ATCH_FILE_KEY_PREFIX}${getDefaultFileKey(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({
|
function PwrkCnsltnDocMngDialog({
|
||||||
open,
|
open,
|
||||||
fnrsCnsltnDocNo,
|
fnrsCnsltnDocNo,
|
||||||
@@ -81,13 +148,174 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
canSave: canSaveProp,
|
canSave: canSaveProp,
|
||||||
onDmndSplmnt,
|
onDmndSplmnt,
|
||||||
onClose,
|
onClose,
|
||||||
|
branchSeCd,
|
||||||
|
isForkJoin,
|
||||||
|
userRole,
|
||||||
|
supplementDmndBranch,
|
||||||
}: PwrkCnsltnDocMngDialogProps) {
|
}: PwrkCnsltnDocMngDialogProps) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const alert = useAlertStore((state) => state.setMessage);
|
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 [atchFileGroupId, setAtchFileGroupId] = useState("");
|
||||||
const [uploadedFiles, setUploadedFiles] = useState<UploadedAtchFile[]>([]);
|
const [uploadedFiles, setUploadedFiles] = useState<UploadedAtchFile[]>([]);
|
||||||
const [isPjtcoAjmtTableOpen, setIsPjtcoAjmtTableOpen] = useState(false);
|
const [isPjtcoAjmtTableOpen, setIsPjtcoAjmtTableOpen] = useState(false);
|
||||||
const [isEvlDialogOpen, setIsEvlDialogOpen] = 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 { mutate: downloadByAtflId } = useDownloadAttachmentByAtflId();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -98,18 +326,27 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
const completedDraft = findCompletedPwrkDraft(pwrkCnsltnData);
|
const completedDraft = findCompletedPwrkDraft(pwrkCnsltnData);
|
||||||
const crtDmndUuid = completedDraft?.crtDmndUuid;
|
const crtDmndUuid = completedDraft?.crtDmndUuid;
|
||||||
|
|
||||||
|
const targetBranchForApi = isForkJoin ? currentBranchSeCd : undefined;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: documentBlob,
|
data: documentBlob,
|
||||||
isLoading: isDocumentLoading,
|
isLoading: isDocumentLoading,
|
||||||
isError: isDocumentError,
|
isError: isDocumentError,
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["pwrk-cnsltn-doc-crt-rslt", "open-latest", crtDmndUuid],
|
queryKey: ["pwrk-cnsltn-doc-crt-rslt", "open-latest", crtDmndUuid, targetBranchForApi],
|
||||||
queryFn: () => pwrkCnsltnDocCrtRsltService.openWebHwpLatest(crtDmndUuid!),
|
queryFn: () => pwrkCnsltnDocCrtRsltService.openWebHwpLatest(crtDmndUuid!, targetBranchForApi),
|
||||||
select: (response) => response.data,
|
select: (response) => response.data,
|
||||||
enabled: open && Boolean(crtDmndUuid),
|
enabled: open && Boolean(crtDmndUuid),
|
||||||
});
|
});
|
||||||
|
|
||||||
const documentFileName = `실무협의서_${pwrkCnsltnData?.pwrkCnsltnDocNo ?? crtDmndUuid}.hwpx`;
|
const branchLabel = isForkJoin
|
||||||
|
? currentBranchSeCd === "SP"
|
||||||
|
? "_관로"
|
||||||
|
: currentBranchSeCd === "SF"
|
||||||
|
? "_시설"
|
||||||
|
: "_종합"
|
||||||
|
: "";
|
||||||
|
const documentFileName = `실무협의서${branchLabel}_${pwrkCnsltnData?.pwrkCnsltnDocNo ?? crtDmndUuid}.hwpx`;
|
||||||
const isLoading = isPwrkCnsltnLoading || isDocumentLoading;
|
const isLoading = isPwrkCnsltnLoading || isDocumentLoading;
|
||||||
const isError = isPwrkCnsltnError || isDocumentError;
|
const isError = isPwrkCnsltnError || isDocumentError;
|
||||||
const pjtcoAjmtSearchParams = useMemo(
|
const pjtcoAjmtSearchParams = useMemo(
|
||||||
@@ -172,7 +409,7 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
};
|
};
|
||||||
}, [open, pwrkCnsltnData?.atchFileGroupId]);
|
}, [open, pwrkCnsltnData?.atchFileGroupId, fnrsCnsltnDocNo, isForkJoin]);
|
||||||
|
|
||||||
function handleOpenChange(nextOpen: boolean) {
|
function handleOpenChange(nextOpen: boolean) {
|
||||||
if (!nextOpen) onClose();
|
if (!nextOpen) onClose();
|
||||||
@@ -181,10 +418,18 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
async function handleSaveDocument(file: Blob) {
|
async function handleSaveDocument(file: Blob) {
|
||||||
if (!completedDraft) throw new Error("저장할 실무협의서 초안이 없습니다.");
|
if (!completedDraft) throw new Error("저장할 실무협의서 초안이 없습니다.");
|
||||||
|
|
||||||
|
const saveBranch =
|
||||||
|
branchSeCd === "TOTAL_AGG" || currentBranchSeCd === "MAIN"
|
||||||
|
? "MAIN"
|
||||||
|
: isForkJoin
|
||||||
|
? currentBranchSeCd
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const saveDto = pwrkCnsltnDocCrtRsltSaveRequestSchema.parse({
|
const saveDto = pwrkCnsltnDocCrtRsltSaveRequestSchema.parse({
|
||||||
crtDmndUuid: completedDraft.crtDmndUuid,
|
crtDmndUuid: completedDraft.crtDmndUuid,
|
||||||
pwrkCnsltnDocNo: completedDraft.pwrkCnsltnDocNo,
|
pwrkCnsltnDocNo: completedDraft.pwrkCnsltnDocNo,
|
||||||
atchFileGroupId: atchFileGroupId || undefined,
|
atchFileGroupId: atchFileGroupId || undefined,
|
||||||
|
branchSeCd: saveBranch,
|
||||||
});
|
});
|
||||||
|
|
||||||
const savedDocument = await pwrkCnsltnDocCrtRsltService.saveMultipart(
|
const savedDocument = await pwrkCnsltnDocCrtRsltService.saveMultipart(
|
||||||
@@ -210,7 +455,10 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
async function handleDownload() {
|
async function handleDownload() {
|
||||||
if (!completedDraft) throw new Error("다운로드할 실무협의서 초안이 없습니다.");
|
if (!completedDraft) throw new Error("다운로드할 실무협의서 초안이 없습니다.");
|
||||||
|
|
||||||
const response = await pwrkCnsltnDocCrtRsltService.downloadLatest(completedDraft.crtDmndUuid);
|
const response = await pwrkCnsltnDocCrtRsltService.downloadLatest(
|
||||||
|
completedDraft.crtDmndUuid,
|
||||||
|
targetBranchForApi,
|
||||||
|
);
|
||||||
const objectUrl = window.URL.createObjectURL(response.data);
|
const objectUrl = window.URL.createObjectURL(response.data);
|
||||||
const anchor = document.createElement("a");
|
const anchor = document.createElement("a");
|
||||||
anchor.href = objectUrl;
|
anchor.href = objectUrl;
|
||||||
@@ -277,20 +525,167 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
const canSaveByAtrz = atrzSeComCdList
|
const canSaveByAtrz = atrzSeComCdList
|
||||||
? !atrzSeComCdList.some((code) => APPROVER_ATRZ_SE_COM_CDS.has(code))
|
? !atrzSeComCdList.some((code) => APPROVER_ATRZ_SE_COM_CDS.has(code))
|
||||||
: true;
|
: true;
|
||||||
const canSave = !viewOnly && (canSaveProp ?? canSaveByAtrz);
|
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)]";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
className="max-h-[96vh] max-w-[80vw] overflow-y-auto"
|
className="flex max-h-[96vh] max-w-[80vw] flex-col gap-4 overflow-y-auto"
|
||||||
aria-describedby={undefined}
|
aria-describedby={undefined}
|
||||||
>
|
>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>실무협의서 관리</DialogTitle>
|
<DialogTitle>실무협의서 관리</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
{isLoading ? <Skeleton className="h-[70vh] min-h-[40rem] w-full" /> : null}
|
{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}
|
||||||
{isError ? (
|
{isError ? (
|
||||||
<p className="py-16 text-center text-lg text-muted-foreground">
|
<p className="py-16 text-center text-lg text-muted-foreground">
|
||||||
실무협의서 정보를 불러오지 못했습니다.
|
실무협의서 정보를 불러오지 못했습니다.
|
||||||
@@ -302,13 +697,14 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
{completedDraft && documentBlob ? (
|
{completedDraft && documentBlob ? (
|
||||||
<div className="flex min-h-[40rem] items-stretch gap-2">
|
<div className={cn("flex items-stretch gap-2", editorContainerMinHeight)}>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<HangulGiangi
|
<HangulGiangi
|
||||||
documentBlob={documentBlob}
|
documentBlob={documentBlob}
|
||||||
documentKey={completedDraft.crtDmndUuid}
|
documentKey={`${completedDraft.crtDmndUuid}_${currentBranchSeCd}`}
|
||||||
documentFileName={documentFileName}
|
documentFileName={documentFileName}
|
||||||
canSave={canSave}
|
canSave={canSaveCurrentBranch}
|
||||||
|
iframeClassName={editorIframeHeight}
|
||||||
onSaveDocument={handleSaveDocument}
|
onSaveDocument={handleSaveDocument}
|
||||||
onDownload={handleDownload}
|
onDownload={handleDownload}
|
||||||
onDmndSplmnt={onDmndSplmnt}
|
onDmndSplmnt={onDmndSplmnt}
|
||||||
@@ -316,7 +712,12 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
</div>
|
</div>
|
||||||
{pjtcoAjmtPage?.content?.length ? (
|
{pjtcoAjmtPage?.content?.length ? (
|
||||||
isPjtcoAjmtTableOpen ? (
|
isPjtcoAjmtTableOpen ? (
|
||||||
<section className="flex h-[calc(64vh+4rem)] w-0 flex-[0.4] flex-col overflow-hidden rounded-md border border-border">
|
<section
|
||||||
|
className={cn(
|
||||||
|
"flex w-0 flex-[0.4] flex-col overflow-hidden rounded-md border border-border",
|
||||||
|
pjtcoTableHeight,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<header className="flex items-center justify-between gap-2 border-b border-border px-3 py-2">
|
<header className="flex items-center justify-between gap-2 border-b border-border px-3 py-2">
|
||||||
<h3 className="text-xl font-semibold">금액검증결과</h3>
|
<h3 className="text-xl font-semibold">금액검증결과</h3>
|
||||||
<button
|
<button
|
||||||
@@ -366,10 +767,10 @@ function PwrkCnsltnDocMngDialog({
|
|||||||
}))}
|
}))}
|
||||||
inputId="pwrk-cnsltn-doc-atch-file-input"
|
inputId="pwrk-cnsltn-doc-atch-file-input"
|
||||||
isUploadingByKey={isUploading}
|
isUploadingByKey={isUploading}
|
||||||
addDisabled={!canSave || isAnyAtchUploading}
|
addDisabled={!canSaveCurrentBranch || isAnyAtchUploading}
|
||||||
showAddButton={canSave}
|
showAddButton={canSaveCurrentBranch}
|
||||||
onAdd={(files) => void handleAtchFileUpload(files)}
|
onAdd={(files) => void handleAtchFileUpload(files)}
|
||||||
onRemove={canSave ? (index) => void handleAtchFileRemove(index) : undefined}
|
onRemove={canSaveCurrentBranch ? (index) => void handleAtchFileRemove(index) : undefined}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import { Button } from "@common/components";
|
|||||||
import {
|
import {
|
||||||
type FnrsCnsltnRegistFormData,
|
type FnrsCnsltnRegistFormData,
|
||||||
fnrsCnsltnRegistSchema,
|
fnrsCnsltnRegistSchema,
|
||||||
|
isForkJoinTask,
|
||||||
} from "../lib/fnrs-cnsltn-regist-schema";
|
} from "../lib/fnrs-cnsltn-regist-schema";
|
||||||
import {
|
import {
|
||||||
buildFormPayload,
|
buildFormPayload,
|
||||||
@@ -349,7 +350,10 @@ function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps)
|
|||||||
<PwrkCnsltnDocMngDialog
|
<PwrkCnsltnDocMngDialog
|
||||||
open={isPwrkCnsltnDocMngOpen}
|
open={isPwrkCnsltnDocMngOpen}
|
||||||
fnrsCnsltnDocNo={fnrsCnsltnDocNo}
|
fnrsCnsltnDocNo={fnrsCnsltnDocNo}
|
||||||
canSave
|
isForkJoin={isForkJoinTask(initialData?.detDto?.taskSeComCd)}
|
||||||
|
userRole={userInfo?.dtlInstCd}
|
||||||
|
prgrsSttsComCd={initialData?.detDto?.prgrsSttsComCd ?? undefined}
|
||||||
|
canSave={isSplmntPrgrsStts && userInfo?.dtlInstCd === "ROLE_USER05" ? null : !isSplmntPrgrsStts}
|
||||||
onClose={() => setIsPwrkCnsltnDocMngOpen(false)}
|
onClose={() => setIsPwrkCnsltnDocMngOpen(false)}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
} from "../lib/ai-pending-utils";
|
} from "../lib/ai-pending-utils";
|
||||||
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
|
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
|
||||||
import { getEditableReviewStep } from "../lib/review-step-utils";
|
import { getEditableReviewStep } from "../lib/review-step-utils";
|
||||||
|
import { normalizeTaskSeComCdForElapr } from "../lib/fnrs-cnsltn-regist-schema";
|
||||||
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
||||||
import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||||
|
|
||||||
@@ -130,7 +131,10 @@ function FnrsViewPage({ id }: FnrsViewPageProps) {
|
|||||||
/>
|
/>
|
||||||
<BasicInfoSection det={detDto} />
|
<BasicInfoSection det={detDto} />
|
||||||
<ContactInfoSection det={detDto} />
|
<ContactInfoSection det={detDto} />
|
||||||
<ElaprDocPrgrsStatus elaprDocNo={detDto.fnrsCnsltnDocNo} />
|
<ElaprDocPrgrsStatus
|
||||||
|
elaprDocNo={detDto.fnrsCnsltnDocNo}
|
||||||
|
taskSeComCd={normalizeTaskSeComCdForElapr(detDto.taskSeComCd)}
|
||||||
|
/>
|
||||||
<BusinessScaleSection bizSclList={bizSclList} />
|
<BusinessScaleSection bizSclList={bizSclList} />
|
||||||
<BusinessCostSection bizCstList={bizCstList} />
|
<BusinessCostSection bizCstList={bizCstList} />
|
||||||
<FnrsSharSection fnrsSharList={fnrsSharList} />
|
<FnrsSharSection fnrsSharList={fnrsSharList} />
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export const RVW_MNPW_BLOCKS: RvwMnpwBlockConfig[] = [
|
|||||||
{ id: "receiver", title: "접수", atrzSeComCd: "ATRZ01" },
|
{ id: "receiver", title: "접수", atrzSeComCd: "ATRZ01" },
|
||||||
{ id: "reviewer", title: "검토", atrzSeComCd: "ATRZ02" },
|
{ id: "reviewer", title: "검토", atrzSeComCd: "ATRZ02" },
|
||||||
{ id: "approver", title: "승인", atrzSeComCd: "ATRZ03" },
|
{ id: "approver", title: "승인", atrzSeComCd: "ATRZ03" },
|
||||||
|
{ id: "merger", title: "병합", atrzSeComCd: "ATRZ04" },
|
||||||
{ id: "final", title: "최종승인", atrzSeComCd: "ATRZ99" },
|
{ id: "final", title: "최종승인", atrzSeComCd: "ATRZ99" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ function RvwMnpwAsmtPanel({ selectedPerson }: RvwMnpwAsmtPanelProps) {
|
|||||||
<Skeleton className="h-[8rem]" />
|
<Skeleton className="h-[8rem]" />
|
||||||
<Skeleton className="h-[8rem]" />
|
<Skeleton className="h-[8rem]" />
|
||||||
<Skeleton className="h-[8rem]" />
|
<Skeleton className="h-[8rem]" />
|
||||||
|
<Skeleton className="h-[8rem]" />
|
||||||
</div>
|
</div>
|
||||||
) : pageQuery.isError ? (
|
) : pageQuery.isError ? (
|
||||||
<p className="py-8 text-center text-lg text-muted-foreground">
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export const ENDPOINT = {
|
|||||||
ELAPR_APLN: "/as-elapr-service/api/v1/elapr-apln",
|
ELAPR_APLN: "/as-elapr-service/api/v1/elapr-apln",
|
||||||
ELAPR_DMND: "/as-elapr-service/api/v1/elapr-dmnd",
|
ELAPR_DMND: "/as-elapr-service/api/v1/elapr-dmnd",
|
||||||
ELAPR_PRGRS_STTS: "/as-elapr-service/api/v1/elapr-prgrs-stts",
|
ELAPR_PRGRS_STTS: "/as-elapr-service/api/v1/elapr-prgrs-stts",
|
||||||
|
ELAPR_BRANCH: "/as-elapr-service/api/v1/elapr-branch",
|
||||||
},
|
},
|
||||||
CMS_SERVICE: {
|
CMS_SERVICE: {
|
||||||
CODE: "/cms-service/api/v1/code/cache",
|
CODE: "/cms-service/api/v1/code/cache",
|
||||||
|
|||||||
@@ -149,9 +149,13 @@ export interface ElaprDocPrgrsClientResponseDto {
|
|||||||
atrzDt?: string | null;
|
atrzDt?: string | null;
|
||||||
jbpsSeNm?: string;
|
jbpsSeNm?: string;
|
||||||
jbgdSeNm?: string;
|
jbgdSeNm?: string;
|
||||||
|
aprvrDeptNm?: string;
|
||||||
ognzNm?: string;
|
ognzNm?: string;
|
||||||
dcarbYn?: string;
|
dcarbYn?: string;
|
||||||
elaprCycl?: number;
|
elaprCycl?: number;
|
||||||
|
branchId?: string;
|
||||||
|
branchSeCd?: string;
|
||||||
|
branchNm?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 문서 상태 변경 이력 응답 DTO */
|
/** 문서 상태 변경 이력 응답 DTO */
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function HangulGiangi({
|
|||||||
bridgeUrl = DEFAULT_BRIDGE_URL,
|
bridgeUrl = DEFAULT_BRIDGE_URL,
|
||||||
ctrlBaseUrl = WEBHYP_CTRL_URL,
|
ctrlBaseUrl = WEBHYP_CTRL_URL,
|
||||||
className,
|
className,
|
||||||
|
iframeClassName,
|
||||||
onReady,
|
onReady,
|
||||||
}: HangulGiangiProps) {
|
}: HangulGiangiProps) {
|
||||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||||
@@ -216,7 +217,10 @@ function HangulGiangi({
|
|||||||
name={HWP_CTRL_IFRAME_NAME}
|
name={HWP_CTRL_IFRAME_NAME}
|
||||||
title="웹한글 기안기"
|
title="웹한글 기안기"
|
||||||
src={iframeSrc}
|
src={iframeSrc}
|
||||||
className="fullscreen:h-screen fullscreen:min-h-0 fullscreen:w-screen h-[64vh] min-h-[40rem] w-full border-0 bg-background"
|
className={cn(
|
||||||
|
"fullscreen:h-screen fullscreen:min-h-0 fullscreen:w-screen w-full border-0 bg-background",
|
||||||
|
iframeClassName ?? "h-[64vh] min-h-[40rem]",
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -323,6 +327,7 @@ interface HangulGiangiProps {
|
|||||||
bridgeUrl?: string;
|
bridgeUrl?: string;
|
||||||
ctrlBaseUrl?: string;
|
ctrlBaseUrl?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
iframeClassName?: string;
|
||||||
onReady?: () => void;
|
onReady?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export { buildCnstpScaleItems, recalculateBzScaleTotals } from "./lib/business-s
|
|||||||
export { canEditPbadmsDoc, type CanEditPbadmsDocParams } from "./lib/can-edit-pbadms-doc";
|
export { canEditPbadmsDoc, type CanEditPbadmsDocParams } from "./lib/can-edit-pbadms-doc";
|
||||||
export {
|
export {
|
||||||
buildChecklistTabs,
|
buildChecklistTabs,
|
||||||
|
isBranchChecklistComplete,
|
||||||
isFormChecklistComplete,
|
isFormChecklistComplete,
|
||||||
normalizeTaskSeComCdArray,
|
normalizeTaskSeComCdArray,
|
||||||
syncCklstResultListFromTree,
|
syncCklstResultListFromTree,
|
||||||
|
|||||||
@@ -138,3 +138,32 @@ export function isFormChecklistComplete(cklstResultList: CklstResultListItem[]):
|
|||||||
if (cklstResultList.length === 0) return true;
|
if (cklstResultList.length === 0) return true;
|
||||||
return cklstResultList.every((item) => item.selected === "Y" || item.selected === "N");
|
return cklstResultList.every((item) => item.selected === "Y" || item.selected === "N");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 결재자 브랜치별 체크리스트 완료 여부 검증 (병렬 결재 지원)
|
||||||
|
* - branchSeCd가 주어지면 해당 브랜치의 항목만 필수 검증 (SP 또는 SF)
|
||||||
|
* - branchSeCd가 없거나 TOTAL_AGG, MAIN 등인 경우 전체 항목 검증
|
||||||
|
*/
|
||||||
|
export function isBranchChecklistComplete(
|
||||||
|
cklstResultList: CklstResultListItem[],
|
||||||
|
cklstTree: CklstTreeNode[],
|
||||||
|
branchSeCd?: string | null,
|
||||||
|
): boolean {
|
||||||
|
if (cklstResultList.length === 0) return true;
|
||||||
|
if (!branchSeCd || branchSeCd === "TOTAL_AGG" || branchSeCd === "MAIN") {
|
||||||
|
return isFormChecklistComplete(cklstResultList);
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetRvwSns = new Set(
|
||||||
|
cklstTree
|
||||||
|
.filter((node) => node.taskSeComCd === branchSeCd && node.bchckUseYn === "Y")
|
||||||
|
.map((node) => node.cklstRvwSn),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (targetRvwSns.size === 0) return true;
|
||||||
|
|
||||||
|
return cklstResultList
|
||||||
|
.filter((item) => targetRvwSns.has(item.cklstRvwSn))
|
||||||
|
.every((item) => item.selected === "Y" || item.selected === "N");
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ module.exports = {
|
|||||||
cwd: './apps/as',
|
cwd: './apps/as',
|
||||||
|
|
||||||
script: 'node_modules/next/dist/bin/next',
|
script: 'node_modules/next/dist/bin/next',
|
||||||
args: 'start -p 3003',
|
args: 'start -p 3004',
|
||||||
|
|
||||||
error_file: './logs/cm-error.log',
|
error_file: './logs/cm-error.log',
|
||||||
out_file: './logs/cm-out.log',
|
out_file: './logs/cm-out.log',
|
||||||
|
|||||||
Reference in New Issue
Block a user