Compare commits
220
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1a67f549f | ||
|
|
c0888ea2a4 | ||
|
|
1ead18b53c | ||
|
|
07db5b1fbd | ||
|
|
6110abebb4 | ||
|
|
05e9082831 | ||
|
|
76a634cf9a | ||
|
|
793c673414 | ||
|
|
2a76c279eb | ||
|
|
5d1ba3fd87 | ||
|
|
99db9a0b77 | ||
|
|
4126bc2234 | ||
|
|
d4f1ec095e | ||
|
|
bbf3ce3948 | ||
|
|
fb5b8356c7 | ||
|
|
1333bd040a | ||
|
|
013c07ef59 | ||
|
|
29fd59a321 | ||
|
|
3bc152c341 | ||
|
|
ea274f8f7d | ||
|
|
7ac53e56d7 | ||
|
|
7b1c12e952 | ||
|
|
17dafe6530 | ||
|
|
ef331363f7 | ||
|
|
4f10864c2c | ||
|
|
4b5ceb0e0a | ||
|
|
4fa50161fd | ||
|
|
3d27e07ccb | ||
|
|
ca1ca71a62 | ||
|
|
bdd6c7b804 | ||
|
|
04b8082f04 | ||
|
|
7bf8ec1d35 | ||
|
|
3451b19b96 | ||
|
|
ae7c1ea1c4 | ||
|
|
9c76b955e2 | ||
|
|
6c4bfe2798 | ||
|
|
98189cd14a | ||
|
|
823ce262bb | ||
|
|
34358400e8 | ||
|
|
da9d069a9a | ||
|
|
58a03678e4 | ||
|
|
f5c281cf86 | ||
|
|
c72bcea7d9 | ||
|
|
49cd160e76 | ||
|
|
5ca93a25ca | ||
|
|
55554fc781 | ||
|
|
8e78c10304 | ||
|
|
0eb74b46ba | ||
|
|
f21dde8f7d | ||
|
|
1fc6707bb3 | ||
|
|
44c5d66afa | ||
|
|
04edb49c9f | ||
|
|
e3eb542e59 | ||
|
|
428b199dd3 | ||
|
|
3c4a6efeea | ||
|
|
dae7024043 | ||
|
|
64e5c26e8c | ||
|
|
84ae60edd6 | ||
|
|
d4c9989069 | ||
|
|
6cda413913 | ||
|
|
a11eaf031d | ||
|
|
3c701359fd | ||
|
|
85ba9fe0ab | ||
|
|
71077f4c8e | ||
|
|
4c7ff53d78 | ||
|
|
bdc3a94ef1 | ||
|
|
b31691dd9c | ||
|
|
0647df733a | ||
|
|
0131cae0d7 | ||
|
|
f37b19eab6 | ||
|
|
7c1db5e0e0 | ||
|
|
2c495ab8fd | ||
|
|
ced1b7084d | ||
|
|
b0c871eff7 | ||
|
|
4148a87f32 | ||
|
|
bd83fa3417 | ||
|
|
c0b63a655e | ||
|
|
cc21aaede1 | ||
|
|
0c71c80a25 | ||
|
|
49e42757bc | ||
|
|
0964f442be | ||
|
|
73ceeb1b38 | ||
|
|
06f68ec392 | ||
|
|
e5dc347276 | ||
|
|
7c6c43b334 | ||
|
|
abf53afafc | ||
|
|
fc70963fa9 | ||
|
|
814365d7de | ||
|
|
8c1a976b5b | ||
|
|
66db81071e | ||
|
|
6df6e612bc | ||
|
|
84013993c9 | ||
|
|
3fee2a781f | ||
|
|
acaf2dd9f4 | ||
|
|
55839f0913 | ||
|
|
f68131fc13 | ||
|
|
7b9081a125 | ||
|
|
0947b76a6e | ||
|
|
23c18da399 | ||
|
|
ec18f17c79 | ||
|
|
cdfa1e56e5 | ||
|
|
434c3cfc08 | ||
|
|
aee3449578 | ||
|
|
54d3a35b38 | ||
|
|
b640fffd0d | ||
|
|
981e4aab54 | ||
|
|
6b68894d23 | ||
|
|
97a8b2811e | ||
|
|
2c3839fc5f | ||
|
|
e9caa1b84d | ||
|
|
d2d5502f8d | ||
|
|
77f2546cc4 | ||
|
|
4df353518f | ||
|
|
ee114dec7e | ||
|
|
d58b2db786 | ||
|
|
1c2eaef5a4 | ||
|
|
bb7cce47ac | ||
|
|
ba910d6bfe | ||
|
|
2a8c2ae542 | ||
|
|
56f52194a6 | ||
|
|
a71b20ba6f | ||
|
|
b2282accb1 | ||
|
|
5def2ec5ee | ||
|
|
9a8350dae8 | ||
|
|
77fd719f96 | ||
|
|
aa831141f6 | ||
|
|
fb148a77c1 | ||
|
|
d8d98aee6d | ||
|
|
87f9b90dbf | ||
|
|
b704db99b1 | ||
|
|
f231564548 | ||
|
|
db04b13310 | ||
|
|
9958ea72b8 | ||
|
|
35f765d870 | ||
|
|
b6afaba02a | ||
|
|
9b9edec627 | ||
|
|
d4302550b4 | ||
|
|
6432b9f44a | ||
|
|
98f24d8a96 | ||
|
|
887549c755 | ||
|
|
d3ca402e4a | ||
|
|
9ca0e96525 | ||
|
|
4c28db79df | ||
|
|
6e2a957e99 | ||
|
|
b5eea1a476 | ||
|
|
5d31c70e16 | ||
|
|
a6f05b3850 | ||
|
|
49ec6423bd | ||
|
|
68ac1168e9 | ||
|
|
e875df1e55 | ||
|
|
69bd924cd2 | ||
|
|
164bffc5de | ||
|
|
613f2a36d9 | ||
|
|
0eee6bf338 | ||
|
|
c2fdc3aa71 | ||
|
|
e98fe69d68 | ||
|
|
426e3ffcdf | ||
|
|
2e25a0311c | ||
|
|
97df2c47de | ||
|
|
f7c1cf0718 | ||
|
|
4d0e39721f | ||
|
|
668e750b03 | ||
|
|
7e152cacd2 | ||
|
|
ac00f978be | ||
|
|
c313c1d6cc | ||
|
|
215d742270 | ||
|
|
4eb031ae67 | ||
|
|
b0cd0c772f | ||
|
|
e75e38a0b8 | ||
|
|
86a95ca6e4 | ||
|
|
99fe41b41d | ||
|
|
a78059ec67 | ||
|
|
7cbde80466 | ||
|
|
357dce2161 | ||
|
|
430148d843 | ||
|
|
641132dd56 | ||
|
|
9b4d2d410d | ||
|
|
4783bbacbd | ||
|
|
3eb028b075 | ||
|
|
c1a03fcabc | ||
|
|
48172aa3f0 | ||
|
|
adf5e288d3 | ||
|
|
d8d5755849 | ||
|
|
9f803fd4ad | ||
|
|
cc4b2ca084 | ||
|
|
75e619a997 | ||
|
|
02f5fae903 | ||
|
|
a9d78a7e0d | ||
|
|
d93157b10a | ||
|
|
ad18cf1c16 | ||
|
|
90834f3493 | ||
|
|
535a6f1ef2 | ||
|
|
ad5fc8a2de | ||
|
|
e2cf4f3f34 | ||
|
|
8272093e07 | ||
|
|
ba42b74578 | ||
|
|
fba84202f0 | ||
|
|
f70a20c0c7 | ||
|
|
ac75188980 | ||
|
|
404624a583 | ||
|
|
696fdf84d2 | ||
|
|
91e505f37f | ||
|
|
294fea4f71 | ||
|
|
148275626c | ||
|
|
7a0a8f23b7 | ||
|
|
45bf7b10f3 | ||
|
|
246f6472a3 | ||
|
|
965b8f3feb | ||
|
|
c37696dee3 | ||
|
|
fb61080d8d | ||
|
|
d4f46ca344 | ||
|
|
50ed22b4bc | ||
|
|
b508568e86 | ||
|
|
8384743a30 | ||
|
|
9661369708 | ||
|
|
4e8f492006 | ||
|
|
12e9c2a30c | ||
|
|
6539e5bb80 | ||
|
|
e19057d026 | ||
|
|
f4c64168d1 |
@@ -19,7 +19,7 @@
|
|||||||
"@tanstack/react-table": "^8.21.2",
|
"@tanstack/react-table": "^8.21.2",
|
||||||
"axios": "^1.8.1",
|
"axios": "^1.8.1",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"next": "15.3.8",
|
"next": "15.5.18",
|
||||||
"react-hook-form": "^7.54.2",
|
"react-hook-form": "^7.54.2",
|
||||||
"zod": "^3.24.2"
|
"zod": "^3.24.2"
|
||||||
},
|
},
|
||||||
@@ -33,4 +33,4 @@
|
|||||||
"tailwindcss": "^3.4.14",
|
"tailwindcss": "^3.4.14",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { AcntgCodeManagementPage as default } from "@/pages/acntg-code-management";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { CnstpCodeManagementPage as default } from "@/pages/cnstp-code-management";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { EsntlAtchFileMngPage as default } from "@/pages/esntl-atch-file-mng";
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
import { CnfmRegistPage } from "@/pages/instl-sncn";
|
import { CnfmRegistPage } from "@/pages/instl-sncn";
|
||||||
|
|
||||||
export default CnfmRegistPage;
|
export default function Page(props: any) {
|
||||||
|
return <CnfmRegistPage {...props} />;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { RvwMnpwMngPage as default } from "@/pages/rvw-mnpw-mng";
|
||||||
@@ -0,0 +1,385 @@
|
|||||||
|
# 화면설계서: 코드관리
|
||||||
|
|
||||||
|
## 1. 기본 정보
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ---------- | -------------------------------------------- |
|
||||||
|
| 버전 | 0.1 |
|
||||||
|
| 프로세스명 | UI설계 |
|
||||||
|
| 화면명 | 코드관리 |
|
||||||
|
| 화면 유형 | [v] 조회 [v] 입력 [v] 수정 [v] 삭제 [ ] 출력 |
|
||||||
|
| 메뉴 경로 | 디지털행정지원 > 사이트관리 > 코드관리 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 화면 목적
|
||||||
|
|
||||||
|
설치인가 등 AS 업무에서 참조하는 **공종구분코드**(공종코드)와 **회계구분코드**(회계코드)를 한 화면에서 조회·등록·수정·삭제한다. 좌측 **공종코드 관리**와 우측 **회계코드 관리**는 독립된 목록·CRUD 영역이며, 각 섹션은 자체 API(`cnstp-se`, `acntg-se`)와 연동한다.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 화면 구성
|
||||||
|
|
||||||
|
### 3-1. 전체 레이아웃
|
||||||
|
|
||||||
|
```
|
||||||
|
┌───────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ 페이지 타이틀: 코드관리 브레드크럼: 디지털행정지원 > 사이트관리 > 코드관리 │
|
||||||
|
├──────────────────────────────────────────────────┬────────────────────────────────────────────────┤
|
||||||
|
│ [영역 A] 공종코드 관리 │ [영역 B] 회계코드 관리 │
|
||||||
|
│ [등록] │ [등록] │
|
||||||
|
│ ┌────────────────────────────────────────────┐ │ ┌──────────────────────────────────────────┐ │
|
||||||
|
│ │ 코드 | 코드명 | 설명 | 사용여부 | 관리 │ │ │ 코드 | 코드명 | 설명 | 사용여부 | 관리 │ │
|
||||||
|
│ ├────────────────────────────────────────────┤ │ ├──────────────────────────────────────────┤ │
|
||||||
|
│ │ WC001 공공하수처리시설 … 사용 [수정][삭제]│ │ │ AC101 시설비 … 사용 [수정][삭제] │ │
|
||||||
|
│ │ WC002 하수관로정비 … 사용 [수정][삭제]│ │ │ AC102 용역비 … 사용 [수정][삭제] │ │
|
||||||
|
│ │ WC003 재이용시설 … 사용 [수정][삭제]│ │ │ AC103 운영비 … 미사용 [수정][삭제] │ │
|
||||||
|
│ └────────────────────────────────────────────┘ │ └──────────────────────────────────────────┘ │
|
||||||
|
│ « 1 2 3 … » │ « 1 2 3 … » │
|
||||||
|
└──────────────────────────────────────────────────┴────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3-2. 화면 데이터 흐름
|
||||||
|
|
||||||
|
```
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
// 최초 진입 — 좌·우 독립 조회
|
||||||
|
CALL cnstpSeMngService.findAll({ page, size })
|
||||||
|
DISPLAY 공종코드 그리드 (영역 A)
|
||||||
|
|
||||||
|
CALL acntgSeMngService.findAll({ page, size })
|
||||||
|
DISPLAY 회계코드 그리드 (영역 B)
|
||||||
|
|
||||||
|
// 영역 A: 공종코드 등록
|
||||||
|
ON 영역 A [등록] 버튼 CLICK DO
|
||||||
|
OPEN 공종코드 등록 다이얼로그
|
||||||
|
ON [저장] DO
|
||||||
|
VALIDATE cnstpSeCd
|
||||||
|
CALL cnstpSeMngService.save(CnstpSeMngSaveRequestDto)
|
||||||
|
CALL cnstpSeMngService.findAll
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
ON [취소] / [닫기] DO
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 A: 공종코드 수정
|
||||||
|
ON 영역 A 행 [수정] CLICK DO
|
||||||
|
CALL cnstpSeMngService.findById(cnstpSeCd)
|
||||||
|
OPEN 공종코드 수정 다이얼로그 (기존 값 초기화)
|
||||||
|
ON [저장] DO
|
||||||
|
CALL cnstpSeMngService.update(cnstpSeCd, CnstpSeMngSaveRequestDto)
|
||||||
|
CALL cnstpSeMngService.findAll
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 A: 공종코드 삭제
|
||||||
|
ON 영역 A 행 [삭제] CLICK DO
|
||||||
|
CONFIRM "선택한 공종코드를 삭제하시겠습니까?"
|
||||||
|
CALL cnstpSeMngService.delete(cnstpSeCd)
|
||||||
|
CALL cnstpSeMngService.findAll
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B: 회계코드 등록
|
||||||
|
ON 영역 B [등록] 버튼 CLICK DO
|
||||||
|
OPEN 회계코드 등록 다이얼로그
|
||||||
|
ON [저장] DO
|
||||||
|
VALIDATE acntgSeCd, acntgSeCdNm
|
||||||
|
CALL acntgSeMngService.save(AcntgSeMngSaveRequestDto)
|
||||||
|
CALL acntgSeMngService.findAll
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
ON [취소] / [닫기] DO
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B: 회계코드 수정
|
||||||
|
ON 영역 B 행 [수정] CLICK DO
|
||||||
|
CALL acntgSeMngService.findById(acntgSeCd)
|
||||||
|
OPEN 회계코드 수정 다이얼로그 (기존 값 초기화)
|
||||||
|
ON [저장] DO
|
||||||
|
CALL acntgSeMngService.update(acntgSeCd, AcntgSeMngSaveRequestDto)
|
||||||
|
CALL acntgSeMngService.findAll
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B: 회계코드 삭제
|
||||||
|
ON 영역 B 행 [삭제] CLICK DO
|
||||||
|
CONFIRM "선택한 회계코드를 삭제하시겠습니까?"
|
||||||
|
CALL acntgSeMngService.delete(acntgSeCd)
|
||||||
|
CALL acntgSeMngService.findAll
|
||||||
|
END ON
|
||||||
|
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 영역 A: 공종코드 관리
|
||||||
|
|
||||||
|
백엔드 **공종구분코드**(`CnstpSeMng`) CRUD. 계층 구조(`upCnstpCd`, `cdLvNo`)를 지원하나, 본 화면은 **평면 목록**으로 표시.
|
||||||
|
|
||||||
|
### 4-1. 헤더 / 툴바
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ------------------------------------- |
|
||||||
|
| 섹션 타이틀 | 공종코드 관리 |
|
||||||
|
| 우측 버튼 | **[등록]** — 공종코드 등록 다이얼로그 |
|
||||||
|
|
||||||
|
### 4-2. 그리드 컬럼
|
||||||
|
|
||||||
|
| 컬럼명 | Field | 타입 | 비고 |
|
||||||
|
| -------- | ------------- | ------ | ------------------------ |
|
||||||
|
| 코드 | `cnstpSeCd` | string | PK, 최대 10자 |
|
||||||
|
| 코드명 | `cnstpSeCdNm` | string | 최대 100자 |
|
||||||
|
| 설명 | `expln` | string | 최대 1000자, 선택 |
|
||||||
|
| 사용여부 | `useYn` | string | `Y`→사용, `N`→미사용 |
|
||||||
|
| 관리 | — | — | 행별 **[수정] · [삭제]** |
|
||||||
|
|
||||||
|
- 행 클릭 시 별도 상세 이동 없음. 수정은 **[수정]** 버튼으로 다이얼로그 진입.
|
||||||
|
- 페이지네이션: Spring `Pageable` (`page`, `size`, `sort`) — **UI 노출**. 기본 `size: 10`, `@common/components` 공통 페이지네이션 컴포넌트 사용.
|
||||||
|
|
||||||
|
### 4-3. 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 위치 | 동작 |
|
||||||
|
| ------ | -------------- | ---------------------------------------- |
|
||||||
|
| 등록 | 섹션 우측 상단 | 공종코드 등록 다이얼로그 오픈 |
|
||||||
|
| 수정 | 행별 | 상세 조회 후 수정 다이얼로그 (값 초기화) |
|
||||||
|
| 삭제 | 행별 | 확인 후 삭제, 목록 갱신 |
|
||||||
|
|
||||||
|
### 4-4. 다이얼로그: 공종코드 등록 / 수정
|
||||||
|
|
||||||
|
다이얼로그 입력 필드는 **코드 · 코드명 · 설명 · 사용여부** 4개만 노출한다.
|
||||||
|
|
||||||
|
| 표시명 | 입력 유형 | 필수 | 기본값 | API 파라미터 매핑 | 비고 |
|
||||||
|
| -------- | --------- | ---- | ------ | ----------------- | ------------------------------- |
|
||||||
|
| 코드 | Input | Y | — | `cnstpSeCd` | 등록 시 입력, 수정 시 읽기 전용 |
|
||||||
|
| 코드명 | Input | N | — | `cnstpSeCdNm` | 최대 100자 |
|
||||||
|
| 설명 | Input | N | — | `expln` | 최대 1000자 |
|
||||||
|
| 사용여부 | Radio | N | Y | `useYn` | `Y`→사용, `N`→미사용 |
|
||||||
|
|
||||||
|
> UI에 노출하지 않는 API 필드(`upCnstpCd`, `cdLvNo`): 등록 시 `cdLvNo: 1` 등 기본값 전송, 수정 시 `findById` 응답값 유지.
|
||||||
|
|
||||||
|
| 버튼명 | 동작 |
|
||||||
|
| ------ | ------------------------------------------------ |
|
||||||
|
| 저장 | POST(등록) 또는 PUT(수정) 후 `findAll` 목록 갱신 |
|
||||||
|
| 취소 | 다이얼로그 닫기, 입력값 폐기 |
|
||||||
|
| 닫기 | 다이얼로그 닫기 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 영역 B: 회계코드 관리
|
||||||
|
|
||||||
|
백엔드 **회계구분관리**(`AcntgSeMng`) CRUD. 영역 A와 동일한 **평면 목록** UI 패턴을 따른다.
|
||||||
|
|
||||||
|
### 5-1. 헤더 / 툴바
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ------------------------------------- |
|
||||||
|
| 섹션 타이틀 | 회계코드 관리 |
|
||||||
|
| 우측 버튼 | **[등록]** — 회계코드 등록 다이얼로그 |
|
||||||
|
|
||||||
|
### 5-2. 그리드 컬럼
|
||||||
|
|
||||||
|
| 컬럼명 | Field | 타입 | 비고 |
|
||||||
|
| -------- | ------------- | ------ | ------------------------ |
|
||||||
|
| 코드 | `acntgSeCd` | string | PK, 최대 10자 |
|
||||||
|
| 코드명 | `acntgSeCdNm` | string | 최대 100자 |
|
||||||
|
| 설명 | `expln` | string | 최대 1000자, 선택 |
|
||||||
|
| 사용여부 | `useYn` | string | `Y`→사용, `N`→미사용 |
|
||||||
|
| 관리 | — | — | 행별 **[수정] · [삭제]** |
|
||||||
|
|
||||||
|
- 페이지네이션: 영역 A와 동일 — **UI 노출**, 기본 `size: 10`.
|
||||||
|
|
||||||
|
### 5-3. 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 위치 | 동작 |
|
||||||
|
| ------ | -------------- | ---------------------------------------- |
|
||||||
|
| 등록 | 섹션 우측 상단 | 회계코드 등록 다이얼로그 오픈 |
|
||||||
|
| 수정 | 행별 | 상세 조회 후 수정 다이얼로그 (값 초기화) |
|
||||||
|
| 삭제 | 행별 | 확인 후 삭제, 목록 갱신 |
|
||||||
|
|
||||||
|
### 5-4. 다이얼로그: 회계코드 등록 / 수정
|
||||||
|
|
||||||
|
다이얼로그 입력 필드는 **코드 · 코드명 · 설명 · 사용여부** 4개만 노출한다. (영역 A와 동일 패턴)
|
||||||
|
|
||||||
|
| 표시명 | 입력 유형 | 필수 | 기본값 | API 파라미터 매핑 | 비고 |
|
||||||
|
| -------- | --------- | ---- | ------ | ----------------- | ------------------------------- |
|
||||||
|
| 코드 | Input | Y | — | `acntgSeCd` | 등록 시 입력, 수정 시 읽기 전용 |
|
||||||
|
| 코드명 | Input | Y | — | `acntgSeCdNm` | 최대 100자 |
|
||||||
|
| 설명 | Input | N | — | `expln` | 최대 1000자 |
|
||||||
|
| 사용여부 | Radio | N | Y | `useYn` | `Y`→사용, `N`→미사용 |
|
||||||
|
|
||||||
|
> UI에 노출하지 않는 API 필드(`upAcntgSeCd`, `cdLvNo`): 등록 시 `cdLvNo: 1` 등 기본값 전송, 수정 시 `findById` 응답값 유지.
|
||||||
|
|
||||||
|
| 버튼명 | 동작 |
|
||||||
|
| ------ | ------------------------------------------------ |
|
||||||
|
| 저장 | POST(등록) 또는 PUT(수정) 후 `findAll` 목록 갱신 |
|
||||||
|
| 취소 | 다이얼로그 닫기, 입력값 폐기 |
|
||||||
|
| 닫기 | 다이얼로그 닫기 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. API/DTO 명세
|
||||||
|
|
||||||
|
### 6-1. 공통
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ---------------------------------------------------------------------------------- |
|
||||||
|
| 서비스 | `as-service` |
|
||||||
|
| Base prefix | `/as-service/api/v1` (`ENDPOINT.AS_COMMON_SERVICE`) |
|
||||||
|
| 인증 | JWT (`Authorization` 헤더), `X-Site-Id`, `token-id` |
|
||||||
|
| 페이징 | Spring `Pageable`: `page`, `size`, `sort` → `PageResponse<T>` |
|
||||||
|
| 엔티티 | `@/entities/cnstp` (`cnstpSeMngService`), `@/entities/acntg` (`acntgSeMngService`) |
|
||||||
|
|
||||||
|
**부가 API (본 화면 목록 외 참조용)**
|
||||||
|
|
||||||
|
| 리소스 | Method | URL | Response | 용도 |
|
||||||
|
| ------------ | ------ | --------------------- | --------------------- | --------------------------------- |
|
||||||
|
| 공종구분코드 | GET | `/cnstp-se/list/tree` | `CnstpSeMngTreeDto[]` | 계층 트리 (타 화면·상위코드 선택) |
|
||||||
|
| 회계구분관리 | GET | `/acntg-se/list/tree` | `AcntgSeMngTreeDto[]` | 계층 트리 (타 화면·상위코드 선택) |
|
||||||
|
|
||||||
|
### 6-2. 공종구분코드 (영역 A) — `cnstp-se`
|
||||||
|
|
||||||
|
| 기능 | Method | URL | Request / Query | Response | 클라이언트 |
|
||||||
|
| --------- | ------ | ----------------------- | -------------------------------- | ----------------------------- | ---------------------------- |
|
||||||
|
| 목록 조회 | GET | `/cnstp-se` | `CnstpSeMngSearchDto` + Pageable | `Page<CnstpSeMngResponseDto>` | `cnstpSeMngService.findAll` |
|
||||||
|
| 트리 조회 | GET | `/cnstp-se/list/tree` | — | `CnstpSeMngTreeDto[]` | `cnstpSeMngService.findTree` |
|
||||||
|
| 상세 조회 | GET | `/cnstp-se/{cnstpSeCd}` | — | `CnstpSeMngResponseDto` | `cnstpSeMngService.findById` |
|
||||||
|
| 등록 | POST | `/cnstp-se` | `CnstpSeMngSaveRequestDto` | `string` (cnstpSeCd) | `cnstpSeMngService.save` |
|
||||||
|
| 수정 | PUT | `/cnstp-se/{cnstpSeCd}` | `CnstpSeMngSaveRequestDto` | `string` (cnstpSeCd) | `cnstpSeMngService.update` |
|
||||||
|
| 삭제 | DELETE | `/cnstp-se/{cnstpSeCd}` | — | `string` (cnstpSeCd) | `cnstpSeMngService.delete` |
|
||||||
|
|
||||||
|
**CnstpSeMngResponseDto**
|
||||||
|
|
||||||
|
| Field | 타입 | 설명 |
|
||||||
|
| ------------- | ------- | ------------------ |
|
||||||
|
| `cnstpSeCd` | string | 공종구분코드 |
|
||||||
|
| `cnstpSeCdNm` | string | 공종구분코드명 |
|
||||||
|
| `upCnstpCd` | string? | 상위공종코드 |
|
||||||
|
| `cdLvNo` | number | 코드레벨번호 |
|
||||||
|
| `useYn` | string | 사용여부 |
|
||||||
|
| `expln` | string? | 설명 (최대 1000자) |
|
||||||
|
| `rgtr` | string? | 등록자 UUID |
|
||||||
|
| `rgtrNm` | string? | 등록자명 |
|
||||||
|
| `mdfr` | string? | 수정자 UUID |
|
||||||
|
| `regDt` | string? | 등록일시 |
|
||||||
|
| `mdfcnDt` | string? | 수정일시 |
|
||||||
|
|
||||||
|
**CnstpSeMngSaveRequestDto**: `cnstpSeCd`, `cnstpSeCdNm?`, `upCnstpCd?`, `cdLvNo?`, `useYn?`, `expln?`
|
||||||
|
|
||||||
|
**CnstpSeMngSearchDto**: `cnstpSeCd?`, `cnstpSeCdNm?`, `useYn?` + `page`, `size`, `sort`
|
||||||
|
|
||||||
|
**React Query hooks**: `useCnstpSeMngPage`, `useCnstpSeMngTree`, `useCnstpSeMng`, `useSaveCnstpSeMng`, `useUpdateCnstpSeMng`, `useDeleteCnstpSeMng`
|
||||||
|
|
||||||
|
### 6-3. 회계구분관리 (영역 B) — `acntg-se`
|
||||||
|
|
||||||
|
| 기능 | Method | URL | Request / Query | Response | 클라이언트 |
|
||||||
|
| --------- | ------ | ----------------------- | -------------------------------- | ----------------------------- | ---------------------------- |
|
||||||
|
| 목록 조회 | GET | `/acntg-se` | `AcntgSeMngSearchDto` + Pageable | `Page<AcntgSeMngResponseDto>` | `acntgSeMngService.findAll` |
|
||||||
|
| 트리 조회 | GET | `/acntg-se/list/tree` | — | `AcntgSeMngTreeDto[]` | `acntgSeMngService.findTree` |
|
||||||
|
| 상세 조회 | GET | `/acntg-se/{acntgSeCd}` | — | `AcntgSeMngResponseDto` | `acntgSeMngService.findById` |
|
||||||
|
| 등록 | POST | `/acntg-se` | `AcntgSeMngSaveRequestDto` | `string` (acntgSeCd) | `acntgSeMngService.save` |
|
||||||
|
| 수정 | PUT | `/acntg-se/{acntgSeCd}` | `AcntgSeMngSaveRequestDto` | `string` (acntgSeCd) | `acntgSeMngService.update` |
|
||||||
|
| 삭제 | DELETE | `/acntg-se/{acntgSeCd}` | — | `string` (acntgSeCd) | `acntgSeMngService.delete` |
|
||||||
|
|
||||||
|
**AcntgSeMngResponseDto**
|
||||||
|
|
||||||
|
| Field | 타입 | 설명 |
|
||||||
|
| ------------- | ------- | ------------------ |
|
||||||
|
| `acntgSeCd` | string | 회계구분코드 |
|
||||||
|
| `acntgSeCdNm` | string | 회계구분코드명 |
|
||||||
|
| `upAcntgSeCd` | string? | 상위회계구분코드 |
|
||||||
|
| `cdLvNo` | number | 코드레벨번호 |
|
||||||
|
| `useYn` | string | 사용여부 |
|
||||||
|
| `expln` | string? | 설명 (최대 1000자) |
|
||||||
|
| `rgtr` | string? | 등록자 UUID |
|
||||||
|
| `rgtrNm` | string? | 등록자명 |
|
||||||
|
| `mdfr` | string? | 수정자 UUID |
|
||||||
|
| `regDt` | string? | 등록일시 |
|
||||||
|
| `mdfcnDt` | string? | 수정일시 |
|
||||||
|
|
||||||
|
**AcntgSeMngSaveRequestDto**: `acntgSeCd`, `acntgSeCdNm`, `upAcntgSeCd?`, `cdLvNo`, `useYn?`, `expln?`
|
||||||
|
|
||||||
|
**AcntgSeMngSearchDto**: `acntgSeCd?`, `acntgSeCdNm?`, `useYn?` + `page`, `size`, `sort`
|
||||||
|
|
||||||
|
**React Query hooks**: `useAcntgSeMngPage`, `useAcntgSeMngTree`, `useAcntgSeMng`, `useSaveAcntgSeMng`, `useUpdateAcntgSeMng`, `useDeleteAcntgSeMng`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. UI 구현 가이드
|
||||||
|
|
||||||
|
### 7-1. 기술 스택·원칙
|
||||||
|
|
||||||
|
- Next.js App Router, React Query (`@tanstack/react-query`)
|
||||||
|
- `@common/components` — `Card`, `Button`, `Dialog`, `DataTable` / `useDataTable`
|
||||||
|
- `@tanstack/react-table` — 컬럼 정의는 `model/*-table-columns.tsx` 분리
|
||||||
|
- 기존 entity 레이어 재사용: `@/entities/cnstp`, `@/entities/acntg` (service·queries·interface 구현 완료)
|
||||||
|
- 좌·우 2열 레이아웃: `grid grid-cols-1 lg:grid-cols-2 gap-4` (모바일 1열 스택)
|
||||||
|
- 삭제 전 `confirm` / Toast 피드백 — 프로젝트 공통 패턴 준수
|
||||||
|
- 목록 하단 **페이지네이션 UI 노출** — 영역 A·B 각각 독립 page state
|
||||||
|
- **검색 필터 UI 미제공** — `findAll` 호출 시 `page`, `size`만 전달
|
||||||
|
- **등록/수정 다이얼로그** — 코드·코드명·설명은 `Input`, 사용여부는 `Radio` (4필드만 노출)
|
||||||
|
- 상위 코드 삭제 시 **하위 코드 연쇄 삭제 UI·로직 미구현** — 단건 삭제만 수행
|
||||||
|
|
||||||
|
### 7-2. 모듈·파일 배치
|
||||||
|
|
||||||
|
| 구분 | 경로 (제안) |
|
||||||
|
| ----------------- | -------------------------------------------------------------------- |
|
||||||
|
| 라우트 | `apps/as/src/app/(authenticated)/site/code-management/page.tsx` |
|
||||||
|
| 페이지 컴포넌트 | `apps/as/src/pages/code-management/ui/code-management-page.tsx` |
|
||||||
|
| 공종 그리드 컬럼 | `apps/as/src/pages/code-management/model/cnstp-se-table-columns.tsx` |
|
||||||
|
| 회계 그리드 컬럼 | `apps/as/src/pages/code-management/model/acntg-se-table-columns.tsx` |
|
||||||
|
| 공종 등록/수정 폼 | `apps/as/src/pages/code-management/ui/cnstp-se-form-dialog.tsx` |
|
||||||
|
| 회계 등록/수정 폼 | `apps/as/src/pages/code-management/ui/acntg-se-form-dialog.tsx` |
|
||||||
|
| API·타입 (기존) | `@/entities/cnstp`, `@/entities/acntg` |
|
||||||
|
|
||||||
|
### 7-3. 영역별 UI 매핑
|
||||||
|
|
||||||
|
| 영역 | UI 컴포넌트 | 데이터 소스 | 비고 |
|
||||||
|
| ------------ | ------------------------------------- | ------------------------------------------- | ------------------------------ |
|
||||||
|
| A | `CnstpSeSection` + Table + Pagination | `useCnstpSeMngPage({ page, size })` | 독립 page state·mutation |
|
||||||
|
| B | `AcntgSeSection` + Table + Pagination | `useAcntgSeMngPage({ page, size })` | A와 상호 의존 없음 |
|
||||||
|
| A 다이얼로그 | `CnstpSeFormDialog` | `useCnstpSeMng`, `useSave/UpdateCnstpSeMng` | Input 4필드 + Radio 사용여부 |
|
||||||
|
| B 다이얼로그 | `AcntgSeFormDialog` | `useAcntgSeMng`, `useSave/UpdateAcntgSeMng` | Input 4필드 + Radio 사용여부 |
|
||||||
|
|
||||||
|
### 7-4. 다이얼로그·라우팅
|
||||||
|
|
||||||
|
| 다이얼로그 | 트리거 | 라우팅 |
|
||||||
|
| ------------- | ---------------- | -------------------- |
|
||||||
|
| 공종코드 등록 | 영역 A [등록] | URL 변경 없음 (모달) |
|
||||||
|
| 공종코드 수정 | 영역 A 행 [수정] | URL 변경 없음 (모달) |
|
||||||
|
| 회계코드 등록 | 영역 B [등록] | URL 변경 없음 (모달) |
|
||||||
|
| 회계코드 수정 | 영역 B 행 [수정] | URL 변경 없음 (모달) |
|
||||||
|
|
||||||
|
### 7-5. 데이터 흐름 (구현 관점)
|
||||||
|
|
||||||
|
```
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
// 페이지 마운트 — 검색 조건 없이 page·size만 전달
|
||||||
|
const cnstpQuery = useCnstpSeMngPage({ page: 0, size: 20 })
|
||||||
|
const acntgQuery = useAcntgSeMngPage({ page: 0, size: 20 })
|
||||||
|
|
||||||
|
DISPLAY CodeManagementPage
|
||||||
|
├─ CnstpSeSection(data=cnstpQuery.data, pagination)
|
||||||
|
└─ AcntgSeSection(data=acntgQuery.data, pagination)
|
||||||
|
|
||||||
|
// 페이지 변경
|
||||||
|
ON pagination page/size CHANGE DO
|
||||||
|
refetch cnstpQuery | acntgQuery with new page, size
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// mutation 성공 시
|
||||||
|
ON save/update/delete SUCCESS DO
|
||||||
|
invalidateQueries cnstp-se | acntg-se baseKey
|
||||||
|
TOAST "저장되었습니다." | "삭제되었습니다."
|
||||||
|
END ON
|
||||||
|
|
||||||
|
END
|
||||||
|
```
|
||||||
@@ -0,0 +1,284 @@
|
|||||||
|
# 화면설계서: 필수첨부파일관리
|
||||||
|
|
||||||
|
## 1. 기본 정보
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ---------- | ---------------------------------------------- |
|
||||||
|
| 버전 | 0.1 |
|
||||||
|
| 프로세스명 | UI설계 |
|
||||||
|
| 화면명 | 필수첨부파일관리 |
|
||||||
|
| 화면 유형 | [v] 조회 [v] 입력 [v] 수정 [v] 삭제 [ ] 출력 |
|
||||||
|
| 메뉴 경로 | 디지털행정지원 > 사이트관리 > 필수첨부파일관리 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 화면 목적
|
||||||
|
|
||||||
|
문서(업무) 구분별로 **필수 첨부파일** 항목을 등록·조회·수정·삭제한다. 상단 검색 영역에서 **문서구분**으로 목록을 필터링하고, **등록** 또는 행별 **수정**·**삭제**로 마스터 데이터를 유지한다. 등록·수정 시 **필수첨부파일아이디**는 클라이언트에서 입력(또는 생성)하여 요청 본문에 포함한다.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 화면 구성
|
||||||
|
|
||||||
|
### 3-1. 전체 레이아웃
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ 페이지 타이틀: 필수첨부파일관리 브레드크럼: 디지털행정지원 > … > │
|
||||||
|
├──────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ [영역 A] 검색 / 액션 │
|
||||||
|
│ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │
|
||||||
|
│ │ 문서구분 [전체 ▼] [조회] [등록] │ │
|
||||||
|
│ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │
|
||||||
|
├──────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
│ [영역 B] 필수첨부파일 목록 │
|
||||||
|
│ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │
|
||||||
|
│ │ 필수첨부파일아이디 | 문서구분 | 필수첨부파일명 | 필수첨부여부 | 비고 | 등록일시 | 수정일시 | 관리 │
|
||||||
|
│ ├────────────────────────────────────────────────────────────────────────────────────────────────┤ │
|
||||||
|
│ │ EAF-0001 | 설치인가 | 사업계획서 | 예 | 서명본 첨부 | 2026-04-22 10:10:00 | — | [수정][삭제] │ │
|
||||||
|
│ │ EAF-0002 | 기본계획 | 변경사유서 | 예 | — | 2026-04-22 11:00:00 | — | [수정][삭제] │ │
|
||||||
|
│ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │
|
||||||
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
(모달) [다이얼로그 C] 필수첨부파일 등록 / 수정
|
||||||
|
┌──────────────────────────────────────────────────────┐
|
||||||
|
│ 필수첨부파일 등록 [닫기] │
|
||||||
|
├──────────────────────────────────────────────────────┤
|
||||||
|
│ 필수첨부파일아이디(자동발급) [EAF-0004] │
|
||||||
|
│ 문서구분 [설치인가 ▼] │
|
||||||
|
│ 필수첨부파일명 [예: 사업계획서] │
|
||||||
|
│ 필수첨부여부 [ ] 예 [ ] 아니오 │
|
||||||
|
│ 비고 [비고를 입력하세요] │
|
||||||
|
├──────────────────────────────────────────────────────┤
|
||||||
|
│ [취소] [저장] │
|
||||||
|
└──────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3-2. 화면 데이터 흐름
|
||||||
|
|
||||||
|
```
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
// 최초 진입
|
||||||
|
CALL 필수첨부파일 목록 조회 (findPage)
|
||||||
|
DISPLAY 필수첨부파일 그리드 (영역 B)
|
||||||
|
|
||||||
|
// 영역 A: 검색
|
||||||
|
ON [조회] 버튼 CLICK DO
|
||||||
|
CALL 필수첨부파일 목록 조회 (문서구분 = 선택값, findPage)
|
||||||
|
DISPLAY 필수첨부파일 그리드 (영역 B)
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 A: 등록
|
||||||
|
ON [등록] 버튼 CLICK DO
|
||||||
|
OPEN 필수첨부파일 등록 다이얼로그 (다이얼로그 C)
|
||||||
|
ON [저장] DO
|
||||||
|
CONFIRM "등록하시겠습니까?"
|
||||||
|
VALIDATE 문서구분, 필수첨부파일명, 필수첨부여부
|
||||||
|
CALL 필수첨부파일 등록 (create)
|
||||||
|
CALL 필수첨부파일 목록 조회
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
TOAST "저장되었습니다."
|
||||||
|
END ON
|
||||||
|
ON [취소] / [닫기] DO
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B: 수정
|
||||||
|
ON 행 [수정] CLICK DO
|
||||||
|
OPEN 필수첨부파일 수정 다이얼로그 (기존 값 초기화)
|
||||||
|
ON [저장] DO
|
||||||
|
VALIDATE 문서구분, 필수첨부파일명, 필수첨부여부
|
||||||
|
CALL 필수첨부파일 수정 (update)
|
||||||
|
CALL 필수첨부파일 목록 조회
|
||||||
|
CLOSE 다이얼로그
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B: 삭제
|
||||||
|
ON 행 [삭제] CLICK DO
|
||||||
|
CONFIRM "삭제하시겠습니까?"
|
||||||
|
CALL 필수첨부파일 삭제 (remove)
|
||||||
|
CALL 필수첨부파일 목록 조회
|
||||||
|
END ON
|
||||||
|
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 영역 A: 검색 / 액션
|
||||||
|
|
||||||
|
문서구분 조건으로 목록을 조회하고, 신규 등록 다이얼로그를 연다.
|
||||||
|
|
||||||
|
### 4-1. 검색 필드
|
||||||
|
|
||||||
|
| 표시명 | 입력 유형 | 필수 | 기본값 | API 파라미터 매핑 | 비고 |
|
||||||
|
| -------- | ---------- | ---- | ------ | ----------------- | ------------------------------ |
|
||||||
|
| 문서구분 | CodeSelect | N | 전체 | `docSeComCd?` | "전체" 선택 시 파라미터 미전송 |
|
||||||
|
|
||||||
|
### 4-2. 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 위치 | 동작 |
|
||||||
|
| ------ | -------------- | ----------------------------------------------- |
|
||||||
|
| 조회 | 검색 필드 우측 | 현재 검색 조건으로 영역 B 목록 갱신 |
|
||||||
|
| 등록 | 영역 우측 끝 | 필수첨부파일 등록 다이얼로그(다이얼로그 C) 오픈 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 영역 B: 필수첨부파일 목록
|
||||||
|
|
||||||
|
필수 첨부파일 마스터를 테이블로 표시한다. 페이지네이션 UI 적용.
|
||||||
|
|
||||||
|
### 5-1. 헤더
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ----------------- |
|
||||||
|
| 섹션 타이틀 | 필수첨부파일 목록 |
|
||||||
|
|
||||||
|
### 5-2. 그리드 컬럼
|
||||||
|
|
||||||
|
| 컬럼명 | Field | 타입 | 비고 |
|
||||||
|
| ------------------ | ------------------- | ------ | ------------------------------------- |
|
||||||
|
| 필수첨부파일아이디 | `esntlAtchFileId` | string | 예: `EAF-0001`, 클라이언트 생성/입력 |
|
||||||
|
| 문서구분 | `docSeComCd` | string | 코드명 표시 — 공통코드 (TBD 상위코드) |
|
||||||
|
| 필수첨부파일명 | `esntlAtchFileNm` | string | |
|
||||||
|
| 필수첨부여부 | `esntlAtchYn` | string | `Y`→예, `N`→아니오 |
|
||||||
|
| 비고 | `esntlAtchFileRmrk` | string | 없으면 `—` 표시 |
|
||||||
|
| 등록일시 | `regDt` | string | `yyyy-MM-dd HH:mm:ss` |
|
||||||
|
| 수정일시 | `mdfcnDt` | string | 미수정 시 빈 값 또는 `—` |
|
||||||
|
| 관리 | — | — | 행별 **[수정] · [삭제]** |
|
||||||
|
|
||||||
|
- 행 클릭 시 별도 상세 화면 없음. 편집은 **[수정]** 버튼으로 다이얼로그 C를 연다.
|
||||||
|
|
||||||
|
### 5-3. 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 위치 | 동작 |
|
||||||
|
| ------ | ---- | -------------------------------------- |
|
||||||
|
| 수정 | 행별 | 필수첨부파일 수정 다이얼로그 (기존 값) |
|
||||||
|
| 삭제 | 행별 | 확인 후 삭제 API 호출 → 목록 갱신 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. 다이얼로그 C: 필수첨부파일 등록 / 수정
|
||||||
|
|
||||||
|
등록·수정 공용 폼 다이얼로그. 등록 시 제목 **「필수첨부파일 등록」**, 수정 시 **「필수첨부파일 수정」**.
|
||||||
|
|
||||||
|
### 6-1. 폼 필드
|
||||||
|
|
||||||
|
| 표시명 | 입력 유형 | 필수 | 기본값 | API 파라미터 매핑 | 비고 |
|
||||||
|
| ------------------ | ---------- | ---- | ------ | ------------------- | -------------------------------- |
|
||||||
|
| 필수첨부파일아이디 | (Readonly) | Y | — | `esntlAtchFileId` | 등록 시 미노출 |
|
||||||
|
| 문서구분 | CodeSelect | Y | — | `docSeComCd` | 예: 설치인가, 기본계획 |
|
||||||
|
| 필수첨부파일명 | Text | Y | — | `esntlAtchFileNm` | placeholder: "예: 사업계획서" |
|
||||||
|
| 필수첨부여부 | RadioGroup | Y | Y | `esntlAtchYn` | Y/N, UI 표시: 예/아니오 |
|
||||||
|
| 비고 | Textarea | N | — | `esntlAtchFileRmrk` | placeholder: "비고를 입력하세요" |
|
||||||
|
|
||||||
|
### 6-2. 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 동작 |
|
||||||
|
| ------ | -------------------------------------- |
|
||||||
|
| 저장 | POST(등록) 또는 PUT(수정) 후 목록 갱신 |
|
||||||
|
| 취소 | 다이얼로그 닫기, 입력값 폐기 |
|
||||||
|
| 닫기 | 다이얼로그 닫기 (헤더 우측) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. API/DTO 명세
|
||||||
|
|
||||||
|
### 7-1. 공통
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ----------------------------------------------------- |
|
||||||
|
| 서비스 | AS Common Service |
|
||||||
|
| Base prefix | `/as-service/api/v1/esntl-atch-file` |
|
||||||
|
| 인증 | JWT (`Authorization`), `X-Site-Id` 등 |
|
||||||
|
| 페이징 | Spring `Pageable` 사용 (`page`, `size`, `sort`) |
|
||||||
|
| 엔티티 | `@/entities/esntl` (`esntl-service.ts`, `queries.ts`) |
|
||||||
|
|
||||||
|
### 7-2. 필수첨부파일 API
|
||||||
|
|
||||||
|
| 기능 | Method | URL | Request DTO | Response DTO | API (클라이언트 함수명) |
|
||||||
|
| --------- | ------ | -------------------- | ----------------------------- | ----------------------------------- | ----------------------- |
|
||||||
|
| 트리 조회 | GET | `/list/tree` | Query: `docSeComCd`(필수) | `EsntlAtchFileMngTreeResponseDto[]` | `findTree` |
|
||||||
|
| 목록 조회 | GET | `/` | Query: Search + Pageable | `PageResponse<EsntlAtchFileMng>` | `findPage` |
|
||||||
|
| 단건 조회 | GET | `/{esntlAtchFileId}` | Path: `esntlAtchFileId` | `EsntlAtchFileMng` | `findById` |
|
||||||
|
| 등록 | POST | `/` | `EsntlAtchFileMngSaveRequest` | `string` (생성된 ID) | `create` |
|
||||||
|
| 수정 | PUT | `/{esntlAtchFileId}` | `EsntlAtchFileMngSaveRequest` | `string` (수정된 ID) | `update` |
|
||||||
|
| 삭제 | DELETE | `/{esntlAtchFileId}` | Path: `esntlAtchFileId` | `string` (삭제된 ID) | `remove` |
|
||||||
|
|
||||||
|
**응답 DTO**
|
||||||
|
|
||||||
|
| Field | 타입 | 설명 |
|
||||||
|
| ------------------- | ------- | -------------------------------- |
|
||||||
|
| `esntlAtchFileId` | string | 필수첨부파일아이디 |
|
||||||
|
| `docSeComCd` | string | 문서구분공통코드 |
|
||||||
|
| `esntlAtchFileNm` | string | 필수첨부파일명 |
|
||||||
|
| `esntlAtchYn` | string | 필수첨부여부 (Y/N) |
|
||||||
|
| `esntlAtchFileRmrk` | string? | 필수첨부파일비고 |
|
||||||
|
| `rgtr` | string? | 등록자 UUID |
|
||||||
|
| `rgtrNm` | string? | 등록자명 |
|
||||||
|
| `mdfr` | string? | 수정자 UUID |
|
||||||
|
| `regDt` | string? | 등록일시 (`yyyy-MM-dd HH:mm:ss`) |
|
||||||
|
| `mdfcnDt` | string? | 수정일시 |
|
||||||
|
|
||||||
|
**저장 Request**
|
||||||
|
|
||||||
|
| Field | 필수 | 설명 |
|
||||||
|
| ------------------- | ---- | ------------------ |
|
||||||
|
| `esntlAtchFileId` | Y | 필수첨부파일아이디 |
|
||||||
|
| `docSeComCd` | N | 문서구분 |
|
||||||
|
| `esntlAtchFileNm` | N | 필수첨부파일명 |
|
||||||
|
| `esntlAtchYn` | N | 필수첨부여부 |
|
||||||
|
| `esntlAtchFileRmrk` | N | 비고 |
|
||||||
|
|
||||||
|
**검색 Query**
|
||||||
|
|
||||||
|
| Field | 필수 | 설명 |
|
||||||
|
| ----------------- | ---- | ----------------------------- |
|
||||||
|
| `docSeComCd` | N | 문서구분 (전체 시 미전송) |
|
||||||
|
| `esntlAtchFileNm` | N | 필수첨부파일명 부분/일치 검색 |
|
||||||
|
| `esntlAtchYn` | N | 필수첨부여부 (`Y`/`N`) |
|
||||||
|
| `page` | N | 페이지 번호 (0-base) |
|
||||||
|
| `size` | N | 페이지 크기 (기본값: 100) |
|
||||||
|
| `sort` | N | 정렬 조건 (예: `regDt,desc`) |
|
||||||
|
|
||||||
|
### 7-3. 공통코드
|
||||||
|
|
||||||
|
| UI 필드 | 코드 그룹 | 예시 값 |
|
||||||
|
| ------------ | --------- | ------------------ |
|
||||||
|
| 문서구분 | ASDOCSECD | 설치인가, 기본계획 |
|
||||||
|
| 필수첨부여부 | 고정 | Y(예), N(아니오) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. UI 구현 가이드
|
||||||
|
|
||||||
|
### 8-1. 기술 스택·원칙
|
||||||
|
|
||||||
|
- **공통 컴포넌트**: `@common/components` (`Dialog`, `Button`, `Input`, `Select`, `Textarea`, `Label` 등)
|
||||||
|
- **테이블**: `@tanstack/react-table` + `useDataTable`
|
||||||
|
- **폼**: `react-hook-form`
|
||||||
|
- **데이터**: React Query — `@/entities/esntl/api/queries.ts` 훅 사용
|
||||||
|
- **공통코드**: `@/entities/code` — `CodeSelect`, `findCodeLabel`
|
||||||
|
- **확인**: `@frontend-opensource/use-react-hooks` — `useConfirm` (등록·삭제 확인)
|
||||||
|
|
||||||
|
### 8-2. 모듈·파일 배치
|
||||||
|
|
||||||
|
| 구분 | 경로 |
|
||||||
|
| ------ | ---------------------------------------------------------------------------------------------------- |
|
||||||
|
| 라우트 | `apps/as/app/(with-base-layout)/esntl-atch-file-mng/page.tsx` |
|
||||||
|
| 페이지 | `apps/as/src/pages/esntl-atch-file-mng/` (Public API: page만 export) |
|
||||||
|
| UI | `.../ui/esntl-atch-file-mng-page.tsx`, `esntl-atch-file-list.tsx`, `esntl-atch-file-form-dialog.tsx` |
|
||||||
|
| model | `.../model/esntl-atch-file-columns.tsx`, `esntl-atch-file-search-params.ts` |
|
||||||
|
| 엔티티 | `apps/as/src/entities/esntl/` (`esntl-service.ts`, `queries.ts`, `esntl-interface.ts`) |
|
||||||
|
| 문서 | `apps/as/docs/essential-attachment-file-management/SPEC.md` |
|
||||||
|
|
||||||
|
### 8-3. 데이터 흐름(요약)
|
||||||
|
|
||||||
|
- **진입**: 검색 params 기본값(`docSeComCd` = 전체) → 목록 query → 영역 B DataTable.
|
||||||
|
- **조회**: [조회] 클릭 시 search state 반영 → 목록 query refetch.
|
||||||
|
- **등록**: [등록] → Dialog `mode=create` → [저장] → POST → 목록 invalidate.
|
||||||
|
- **수정**: [수정] → Dialog `mode=edit` + row 초기값 → [저장] → PUT → 목록 invalidate.
|
||||||
|
- **삭제**: confirm → DELETE → 목록 invalidate.
|
||||||
@@ -0,0 +1,370 @@
|
|||||||
|
# 화면설계서: 검토인력관리
|
||||||
|
|
||||||
|
## 1. 기본 정보
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ---------- | -------------------------------------------- |
|
||||||
|
| 버전 | 0.2 |
|
||||||
|
| 프로세스명 | UI설계 |
|
||||||
|
| 화면명 | 검토인력관리 |
|
||||||
|
| 화면 유형 | [v] 조회 [v] 입력 [ ] 수정 [v] 삭제 [ ] 출력 |
|
||||||
|
| 메뉴 경로 | 디지털행정지원 > 사이트관리 > 검토인력관리 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 화면 목적
|
||||||
|
|
||||||
|
조직도에서 **한 명의 사용자**를 선택한 뒤, 결재 단계(접수·검토·승인·최종승인)별 **인원 배치** 영역에 즉시 등록한다. 등록·목록 갱신은 별도 저장 버튼 없이 **[선택 인원 배치]** 클릭 시 `rvw-mnpw` API로 바로 반영한다. 좌측 조직도는 CMS 조직·사용자 트리 API를, 우측 배치 목록은 검토인력관리 API를 사용한다.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 화면 구성
|
||||||
|
|
||||||
|
### 3-1. 전체 레이아웃
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ 페이지 타이틀: 검토인력관리 브레드크럼: 디지털행정지원 > 사이트관리 > 검토인력관리 │
|
||||||
|
├─────────────────────────────────┬──────────────────────────────────────────────────────────────────┤
|
||||||
|
│ [영역 A] 조직도 │ [영역 B] 인원 배치 (결재구분별 4블록, 세로 스택) │
|
||||||
|
│ 제목: 조직도 │ │
|
||||||
|
│ [A-1] 검색: │ ┌─ [B-1] 접수 ───────────── count ─ [선택 인원 배치] ─┐ │
|
||||||
|
│ [성명·부서 검색] [조회][초기화]│ │ (배치 목록 또는 빈 상태 문구) │ │
|
||||||
|
│ 선택 안내: │ └──────────────────────────────────────────────────────┘ │
|
||||||
|
│ "선택된 인원: {이름} │ ┌─ [B-2] 검토 ───────────── count ─ [선택 인원 배치] ──┐ │
|
||||||
|
│ ({부서} / {직급})" │ └──────────────────────────────────────────────────────┘ │
|
||||||
|
│ [A-2] 조직 트리 + 사용자 행 │ ┌─ [B-3] 승인 ───────────── count ─ [선택 인원 배치] ──┐ │
|
||||||
|
│ ┌────────────────────┐ │ └──────────────────────────────────────────────────────┘ │
|
||||||
|
│ │ 조직 트리 + 사용자 │ │ ┌─ [B-4] 최종승인 ───────── count ─ [선택 인원 배치] ──┐ │
|
||||||
|
│ │ (단일 선택 강조) │ │ └──────────────────────────────────────────────────────┘ │
|
||||||
|
│ └────────────────────┘ │ │
|
||||||
|
└─────────────────────────────────┴──────────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3-2. 화면 데이터 흐름
|
||||||
|
|
||||||
|
```
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
// 최초 진입
|
||||||
|
CALL userOgnzService.findOgnzUserTree()
|
||||||
|
DISPLAY 조직도 트리 (영역 A)
|
||||||
|
|
||||||
|
CALL rvwMnpwMngService.findPage({ size: 충분히 큰 값 }) // 또는 atrzSeComCd별 분할 조회
|
||||||
|
GROUP BY atrzSeComCd
|
||||||
|
DISPLAY 인원 배치 4블록 (영역 B-1 ~ B-4) + 건수 뱃지
|
||||||
|
|
||||||
|
// 영역 A-1: 조직도 검색 (클라이언트 필터 — 서버 API 없음)
|
||||||
|
ON [조회] 버튼 CLICK / 검색 폼 SUBMIT DO
|
||||||
|
SET displayTree = filterOgnzUserTree(원본트리, keyword)
|
||||||
|
SET expandedOgnzSnIds = collectExpandedOgnzSnIds(displayTree) // 매칭 노드 자동 펼침
|
||||||
|
DISPLAY 필터된 트리 (영역 A-2)
|
||||||
|
END ON
|
||||||
|
|
||||||
|
ON [초기화] 버튼 CLICK DO
|
||||||
|
RESET keyword = ""
|
||||||
|
RESET displayTree = 원본트리
|
||||||
|
RESET expandedOgnzSnIds = 빈 Set (또는 기본 접힘)
|
||||||
|
DISPLAY 전체 트리 (영역 A-2)
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 A-2: 사용자 단일 선택
|
||||||
|
ON 조직도 사용자 행 CLICK DO
|
||||||
|
VALIDATE 동일 행 재클릭이 아닌 경우만 변경
|
||||||
|
SET selectedPerson = { userUuid, userNm, ognzSn, ognzNm, jbgdSeCd, ... }
|
||||||
|
DISPLAY "선택된 인원: {userNm} ({ognzNm} / {직급명})"
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B-k: 선택 인원 즉시 배치
|
||||||
|
ON [B-k] [선택 인원 배치] 버튼 CLICK DO
|
||||||
|
VALIDATE selectedPerson 존재
|
||||||
|
SET targetAtrzSeComCd = 블록 k 에 매핑된 결재구분 코드 (§4-2 표)
|
||||||
|
CALL rvwMnpwMngService.save({
|
||||||
|
atrzSeComCd: targetAtrzSeComCd,
|
||||||
|
ognzSn: selectedPerson.ognzSn,
|
||||||
|
userUuid: selectedPerson.userUuid
|
||||||
|
})
|
||||||
|
ON 성공 DO
|
||||||
|
CALL rvwMnpwMngService.findPage (또는 해당 블록 목록만 갱신)
|
||||||
|
DISPLAY [B-k] 배치 목록·건수 뱃지 갱신
|
||||||
|
TOAST "배치되었습니다."
|
||||||
|
END ON
|
||||||
|
ON 실패(이미 존재) DO
|
||||||
|
TOAST (백엔드 메시지 연동)
|
||||||
|
END ON
|
||||||
|
END ON
|
||||||
|
|
||||||
|
// 영역 B-k: 배치 인원 제거 (UI 상 삭제 UX — 스크린샷 미표기, API는 제공됨)
|
||||||
|
ON 배치 인원 [삭제] / [제거] CLICK DO
|
||||||
|
CONFIRM "해당 인원을 배치에서 제거하시겠습니까?"
|
||||||
|
CALL rvwMnpwMngService.delete(atrzSeComCd, ognzSn, userUuid)
|
||||||
|
CALL rvwMnpwMngService.findPage
|
||||||
|
DISPLAY [B-k] 목록·뱃지 갱신
|
||||||
|
END ON
|
||||||
|
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 영역 A — 조직도
|
||||||
|
|
||||||
|
### 4-1. 표시·상호작용
|
||||||
|
|
||||||
|
| 요소 | 내용 |
|
||||||
|
| ---------------- | --------------------------------------------------------------------- |
|
||||||
|
| 섹션 제목 | 조직도 |
|
||||||
|
| 검색 폼 (A-1) | 성명·부서 키워드 입력 + **[조회]** + **[초기화]** — §4-3 |
|
||||||
|
| 선택 안내 문구 | `선택된 인원: {userNm} ({ognzNm} / {직급표시})` — 미선택 시 안내 문구 |
|
||||||
|
| 트리 (A-2) | 본부 → 팀 계층 + 팀 소속 사용자 목록 (`displayTree` 기준 표시) |
|
||||||
|
| 선택 규칙 | **사용자 1명만** 선택 가능 (라디오형 단일 선택) |
|
||||||
|
| 선택 시각 피드백 | 선택된 사용자 행 강조(배경·테두리) |
|
||||||
|
| 로딩/오류/빈값 | Skeleton / 오류 문구 / "등록된 조직/사용자가 없습니다." |
|
||||||
|
| 검색 결과 없음 | 필터 후 매칭 노드·사용자 0건. "조회된 인원이 없습니다." 문구 노출 |
|
||||||
|
|
||||||
|
### 4-2. 조직도 데이터 매핑
|
||||||
|
|
||||||
|
| UI 표시 | 트리 DTO 필드 (`OgnzUserTreeResponseDto`) | 비고 |
|
||||||
|
| --------------- | ----------------------------------------- | ----------------------------------------- |
|
||||||
|
| 조직명 | `ognzNm` | 접기/펼치기 노드 |
|
||||||
|
| 사용자명 | `users[].userNm` | 클릭 시 선택 |
|
||||||
|
| 부서(안내 문구) | `ognzNm` (소속 팀 노드) | 선택 시 `selectedPerson.ognzNm` |
|
||||||
|
| 직급(안내 문구) | `users[].jbgdSeCd` 또는 `jbpsSeCd` | 공통코드 라벨 변환 |
|
||||||
|
| 저장용 조직 SN | `ognzSn` | 사용자가 속한 **리프/팀 노드**의 `ognzSn` |
|
||||||
|
| 저장용 사용자 | `users[].userUnqId` | API body `userUuid`로 전달 (§6-3) |
|
||||||
|
|
||||||
|
### 4-3. 조직도 검색 (영역 A-1)
|
||||||
|
|
||||||
|
결재선 관리 `AprvrPickerDialog`와 동일한 **클라이언트 사이드 필터** 패턴을 사용한다. 별도 검색 API는 없으며, `useOgnzUserTree`로 받은 **원본 트리**를 `filterOgnzUserTree`로 가공해 `displayTree`에 반영한다.
|
||||||
|
|
||||||
|
#### 필드 정의
|
||||||
|
|
||||||
|
| 표시명 | 입력 유형 | 필수 | 기본값 | API 파라미터 매핑 | 비고 |
|
||||||
|
| -------------- | --------- | ---- | ------ | ----------------- | ----------------------------------------- |
|
||||||
|
| 성명·부서 검색 | Text | N | (빈값) | — (클라이언트만) | `placeholder="성명·부서 검색"` |
|
||||||
|
| 조회 | Button | — | — | — | `type="submit"` — 폼 제출 시 필터 적용 |
|
||||||
|
| 초기화 | Button | — | — | — | `type="button"` — 키워드·트리·펼침 초기화 |
|
||||||
|
|
||||||
|
#### 필터 규칙 (`filterOgnzUserTree`)
|
||||||
|
|
||||||
|
| 대상 | 매칭 조건 |
|
||||||
|
| ---------------- | ----------------------------------------------------- |
|
||||||
|
| 조직명 | `ognzNm`에 키워드 포함 (대소문자 무시) |
|
||||||
|
| 사용자명 | `userNm`에 키워드 포함 (대소문자 무시) |
|
||||||
|
| 조직 매칭 시 | 해당 노드 **소속 사용자 전원** 유지 |
|
||||||
|
| 사용자만 매칭 시 | 매칭 사용자만 남기고 상위 조직 노드는 유지(경로 보존) |
|
||||||
|
| 하위 조직 | 재귀 필터 — 자식·손자 노드 매칭 시 상위도 표시 |
|
||||||
|
| 키워드 빈값 | 원본 트리 전체 반환 |
|
||||||
|
|
||||||
|
#### 조회 후 트리 펼침 (`collectExpandedOgnzSnIds`)
|
||||||
|
|
||||||
|
- **[조회]** 성공 후 필터 결과 트리의 **모든 노드** `ognzSn`을 `expandedOgnzSnIds`에 넣어 자동 펼침
|
||||||
|
- 검색 결과에서 사용자·하위 조직을 바로 확인할 수 있도록 함
|
||||||
|
|
||||||
|
#### 초기화 동작
|
||||||
|
|
||||||
|
| 상태 | 초기화 후 값 |
|
||||||
|
| ------------------- | --------------------------------------- |
|
||||||
|
| `keyword` | `""` |
|
||||||
|
| `displayTree` | `useOgnzUserTree` 원본 `data` |
|
||||||
|
| `expandedOgnzSnIds` | `new Set()` (전체 접힘) |
|
||||||
|
| `selectedPerson` | **유지** — 검색 초기화와 선택 해제 분리 |
|
||||||
|
|
||||||
|
#### 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 동작 |
|
||||||
|
| ------ | --------------------------------------------------------- |
|
||||||
|
| 조회 | `filterOgnzUserTree(data, keyword)` → `displayTree` 갱신 |
|
||||||
|
| 초기화 | 키워드·표시 트리·펼침 상태 리셋 (§3-2 `ON [초기화]` 블록) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 영역 B — 인원 배치
|
||||||
|
|
||||||
|
### 5-1. 블록 공통
|
||||||
|
|
||||||
|
| 요소 | 내용 |
|
||||||
|
| ------------------ | ------------------------------------------------- |
|
||||||
|
| 블록 제목 | 접수 / 검토 / 승인 / 최종승인 |
|
||||||
|
| 건수 뱃지 | 해당 `atrzSeComCd`에 배치된 인원 수 |
|
||||||
|
| 액션 버튼 | **[선택 인원 배치]** — 클릭 시 즉시 `save` (§3-2) |
|
||||||
|
| 빈 상태 | "배치된 인원이 없습니다." |
|
||||||
|
| 배치 목록(있을 때) | 인원명·부서·직급 등 |
|
||||||
|
|
||||||
|
### 5-2. 결재구분 ↔ 블록 매핑
|
||||||
|
|
||||||
|
| 블록 | UI 제목 | `atrzSeComCd` | 비고 |
|
||||||
|
| ---- | -------- | ------------- | -------------------------------------------------------------- |
|
||||||
|
| B-1 | 접수 | `ATRZ00` | 결재선 관리 `ATRZ_RECEIVER_CD`와 동일 |
|
||||||
|
| B-2 | 검토 | `ATRZ01` | 결재선 `ATRZ_REVIEWER_1_CD`. `ATRZ02` 별도 블록 여부 — **TBD** |
|
||||||
|
| B-3 | 승인 | `ATRZ03` | 결재선 `ATRZ_APPROVER_CD` |
|
||||||
|
| B-4 | 최종승인 | `ATRZ99` | 결재선 `ATRZ_FINAL_CD` |
|
||||||
|
|
||||||
|
공통코드 마스터 `ATRZSE` / 화면 셀렉트용 `ATRZSECD`와 정합성은 배포 환경 코드표로 최종 확인.
|
||||||
|
|
||||||
|
### 5-3. 배치 목록 항목 (표시)
|
||||||
|
|
||||||
|
| 표시명 | Field (응답 DTO) | 비고 |
|
||||||
|
| -------- | ---------------- | ---------------------------- |
|
||||||
|
| 사용자명 | `userUuidNm` | `@CodeName` 미적용 시 TBD |
|
||||||
|
| 결재구분 | `atrzSeComCdNm` | 블록 제목과 중복 — 생략 가능 |
|
||||||
|
| 조직 SN | `ognzSn` | 삭제 API path에 사용 |
|
||||||
|
| 사용자 | `userUuid` | 삭제 API path에 사용 |
|
||||||
|
|
||||||
|
### 5-4. 버튼
|
||||||
|
|
||||||
|
| 버튼명 | 위치 | 동작 |
|
||||||
|
| -------------- | ----------- | --------------------------------- |
|
||||||
|
| 선택 인원 배치 | 각 B-k 헤더 | `save` 후 목록·뱃지 갱신 (§3-2) |
|
||||||
|
| 제거 | 목록 항목 | `delete` 후 목록·뱃지 갱신 (§3-2) |
|
||||||
|
|
||||||
|
### 5-5. 검증·제약
|
||||||
|
|
||||||
|
| 규칙 | 내용 |
|
||||||
|
| ------------- | ------------------------------------------------------------------- |
|
||||||
|
| 선택 필수 | `[선택 인원 배치]` 시 `selectedPerson` 없으면 버튼 비활성 또는 안내 |
|
||||||
|
| 단일 선택 | 조직도에서 사용자 1명만 `selectedPerson` 유지 |
|
||||||
|
| 중복 등록 | 동일 PK `(atrzSeComCd, ognzSn, userUuid)` 재등록 시 서버 오류 |
|
||||||
|
| 다건 배치 | 동일 블록에 서로 다른 사용자·조직은 **복수 행** 가능 (PK가 다름) |
|
||||||
|
| 결재구분 변경 | 본 화면 주 흐름은 `save`만 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. API/DTO 명세
|
||||||
|
|
||||||
|
### 6-1. 공통
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ------------- | ------------------------------------------------------------- |
|
||||||
|
| 인증 | JWT (`Authorization` 헤더) |
|
||||||
|
| 페이징 | Spring `Pageable`: `page`, `size`, `sort` → `PageResponse<T>` |
|
||||||
|
| 프론트 엔티티 | `@/entities/user-organization`, `@/entities/rvw-mnpw` |
|
||||||
|
|
||||||
|
### 6-2. 조직·사용자 트리 (영역 A) — `user-ognz`
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ------------------------------- |
|
||||||
|
| 서비스 | `cms-service` |
|
||||||
|
| Base prefix | `/cms-service/api/v1/user-ognz` |
|
||||||
|
|
||||||
|
| 기능 | Method | URL | Request DTO | Response DTO | API |
|
||||||
|
| ---------------- | ------ | ----------- | ----------- | --------------------------- | ---------------------------------- |
|
||||||
|
| 조직·사용자 트리 | GET | `/treeuser` | — | `OgnzUserTreeResponseDto[]` | `userOgnzService.findOgnzUserTree` |
|
||||||
|
|
||||||
|
**`OgnzUserTreeResponseDto`**: `ognzSn`, `upOgnzSn`, `ognzNm`, `users[]`, `children[]`
|
||||||
|
|
||||||
|
**`OgnzUserTreeUserDto`**: `userUnqId`, `userNm`, `jbpsSeCd`, `jbgdSeCd`
|
||||||
|
|
||||||
|
**React Query**: `useOgnzUserTree`
|
||||||
|
|
||||||
|
### 6-3. 검토인력관리 (영역 B) — `rvw-mnpw`
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ----------- | ------------------------------------- |
|
||||||
|
| 서비스 | `as-service` |
|
||||||
|
| Base prefix | `/as-service/api/v1/rvw-mnpw` |
|
||||||
|
| ENDPOINT | `ENDPOINT.AS_COMMON_SERVICE.RVW_MNPW` |
|
||||||
|
|
||||||
|
| 기능 | Method | URL | Request DTO / Query | Response DTO | API |
|
||||||
|
| --------------- | ------ | ------------------------------------ | -------------------------------- | ----------------------------- | ---------------------------- |
|
||||||
|
| 목록 조회 | GET | `/` | `RvwMnpwMngSearchDto` + Pageable | `Page<RvwMnpwMngResponseDto>` | `rvwMnpwMngService.findPage` |
|
||||||
|
| 상세 조회 | GET | `/{atrzSeComCd}/{ognzSn}/{userUuid}` | Path | `RvwMnpwMngResponseDto` | `rvwMnpwMngService.findById` |
|
||||||
|
| 등록(즉시 배치) | POST | `/` | `RvwMnpwMngSaveRequestDto` | `RvwMnpwMngResponseDto` (201) | `rvwMnpwMngService.save` |
|
||||||
|
| 결재구분 변경 | PUT | `/{atrzSeComCd}/{ognzSn}/{userUuid}` | `RvwMnpwMngUpdateRequestDto` | `RvwMnpwMngResponseDto` | `rvwMnpwMngService.update` |
|
||||||
|
| 삭제 | DELETE | `/{atrzSeComCd}/{ognzSn}/{userUuid}` | Path | `string` | `rvwMnpwMngService.delete` |
|
||||||
|
|
||||||
|
**`RvwMnpwMngSearchDto`**: `atrzSeComCd?`, `ognzSn?`, `userUuid?` + `page`, `size`, `sort`
|
||||||
|
|
||||||
|
**`RvwMnpwMngSaveRequestDto`**: `atrzSeComCd*`, `ognzSn*`, `userUuid*`
|
||||||
|
|
||||||
|
**`RvwMnpwMngUpdateRequestDto`**: `newAtrzSeComCd*` — 본 화면 기본 흐름에서는 미사용
|
||||||
|
|
||||||
|
**`RvwMnpwMngResponseDto`**: `atrzSeComCd`, `atrzSeComCdNm?`, `ognzSn`, `userUuid`, `userUuidNm?`, `rgtr?`, `regDt?`
|
||||||
|
|
||||||
|
### 6-4. 조직도 ↔ 검토인력 필드 매핑 (저장 시)
|
||||||
|
|
||||||
|
| 조직도 (`OgnzUserTreeUserDto` + 노드) | `RvwMnpwMngSaveRequestDto` | 비고 |
|
||||||
|
| ------------------------------------- | -------------------------- | --------------------- |
|
||||||
|
| (블록 k의 `atrzSeComCd`) | `atrzSeComCd` | §5-2 표 |
|
||||||
|
| 소속 팀 `ognzSn` | `ognzSn` | |
|
||||||
|
| `userUnqId` | `userUuid` | 문자열(UUID)로 직렬화 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. UI 구현 가이드
|
||||||
|
|
||||||
|
### 7-1. 기술 스택·원칙
|
||||||
|
|
||||||
|
- **공통 컴포넌트**: `@common/components` (`Button`, `Badge`, `Card` 또는 섹션 레이아웃)
|
||||||
|
- **데이터**: React Query — `useOgnzUserTree`, `useRvwMnpwMngPage`, `useSaveRvwMnpwMng`, `useDeleteRvwMnpwMng`
|
||||||
|
- **상태**: `selectedPerson`(단일), `keyword`, `displayTree`, `expandedOgnzSnIds`, 블록별 배치 목록(서버 데이터 파생)
|
||||||
|
- **조직도 검색**: `filterOgnzUserTree`, `collectExpandedOgnzSnIds` (`widgets/ognz-user-tree/lib` 또는 페이지 `lib`)
|
||||||
|
- **저장 UX**: 별도 화면 저장 없음 — **[선택 인원 배치]** = `save` mutation 즉시 호출
|
||||||
|
- **조직도 UI**: 결재선 관리 `ognz-user-tree.tsx`를 **widgets**로 승격해 공통화
|
||||||
|
|
||||||
|
### 7-2. 모듈·파일 배치(제안)
|
||||||
|
|
||||||
|
| 구분 | 경로 |
|
||||||
|
| -------- | ---------------------------------------------------------------------------------- |
|
||||||
|
| 라우트 | `apps/as/app/(with-base-layout)/rvw-mnpw-mng/page.tsx` |
|
||||||
|
| 페이지 | `apps/as/src/pages/rvw-mnpw-mng/` |
|
||||||
|
| UI | `.../ui/rvw-mnpw-mng-page.tsx`, `rvw-mnpw-assignment-panel.tsx` 등 |
|
||||||
|
| model | `.../model/selected-ognz-user.ts`, `rvw-mnpw-block-config.ts` (`atrzSeComCd` 상수) |
|
||||||
|
| lib | `.../lib/group-rvw-mnpw-by-atrz-se.ts` (목록 → B-1~B-4 분배) |
|
||||||
|
| **위젯** | `apps/as/src/widgets/ognz-user-tree/` — 아래 이전 대상 |
|
||||||
|
| 엔티티 | `entities/user-organization/`, `entities/rvw-mnpw/` (구현 완료) |
|
||||||
|
|
||||||
|
#### widgets/ognz-user-tree 이전 (결재선 → 공통)
|
||||||
|
|
||||||
|
| 현재 (결재선 관리) | 이전 후 (widgets) |
|
||||||
|
| ------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||||
|
| `pages/approval-line-management/ui/ognz-user-tree.tsx` | `widgets/ognz-user-tree/ui/ognz-user-tree.tsx` |
|
||||||
|
| `pages/.../ui/ognz-user-tree-node.tsx` | `widgets/ognz-user-tree/ui/ognz-user-tree-node.tsx` |
|
||||||
|
| `pages/.../model/reviewer-option.ts` | `widgets/ognz-user-tree/model/selected-ognz-user.ts` (이름·필드 확장: `ognzSn` 필수) |
|
||||||
|
| `pages/.../lib/filter-ognz-user-tree.ts` | `widgets/ognz-user-tree/lib/filter-ognz-user-tree.ts` (**필수** — 검색 공통화) |
|
||||||
|
| `widgets/ognz-user-tree/index.ts` | `OgnzUserTree`, `OgnzUserTreeNode`, 타입 export |
|
||||||
|
|
||||||
|
결재선 `AprvrPickerDialog`는 `@/widgets/ognz-user-tree` import로 교체. 검토인력관리 페이지는 **인라인 조직도**(다이얼로그 없음)로 동일 위젯 사용.
|
||||||
|
|
||||||
|
**`SelectedOgnzUser`** — `ReviewerOption` 확장:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export interface SelectedOgnzUser {
|
||||||
|
userUuid: string; // OgnzUserTreeUserDto.userUnqId
|
||||||
|
userNm: string;
|
||||||
|
ognzSn: number;
|
||||||
|
ognzNm: string;
|
||||||
|
jbgdSeCd?: string;
|
||||||
|
jbpsSeCd?: string;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7-3. 영역별 UI 매핑
|
||||||
|
|
||||||
|
| 영역 | 주요 UI |
|
||||||
|
| ---- | -------------------------------------------------------------------- |
|
||||||
|
| A-1 | 검색 폼 (`Input` + 조회/초기화) — `AprvrPickerDialog` 90~103행 패턴 |
|
||||||
|
| A-2 | `OgnzUserTree(nodes={displayTree})` + 선택 안내 + `useOgnzUserTree` |
|
||||||
|
| B-k | 제목·Badge(count)·`선택 인원 배치`·배치 목록(또는 empty) |
|
||||||
|
| 공통 | 페이지 헤더·브레드크럼·2열 레이아웃 (`grid` / `flex`, 모바일은 스택) |
|
||||||
|
|
||||||
|
### 7-4. 다이얼로그·라우팅
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| ---------- | ----------------------------------- |
|
||||||
|
| 다이얼로그 | **없음** (조직도 인라인, 즉시 저장) |
|
||||||
|
| 라우팅 | 메뉴 `검토인력관리` 단일 페이지 |
|
||||||
|
|
||||||
|
### 7-5. 데이터 흐름(구현 요약)
|
||||||
|
|
||||||
|
- **진입**: `useOgnzUserTree` → `displayTree = data` + `useRvwMnpwMngPage({ page: 0, size: N })` → 4패널.
|
||||||
|
- **검색**: `keyword` 로컬 상태 → **[조회]** 시 `filterOgnzUserTree` + `collectExpandedOgnzSnIds` → `OgnzUserTree`에 `displayTree` 전달.
|
||||||
|
- **초기화**: `keyword`·`displayTree`·`expandedOgnzSnIds` 리셋 (`selectedPerson` 유지).
|
||||||
|
- **선택**: 트리 `onSelect` → `selectedPerson` (반드시 `ognzSn` 포함).
|
||||||
|
- **배치**: `useSaveRvwMnpwMng().mutate({ atrzSeComCd, ognzSn, userUuid })` → `onSuccess`에서 `rvw-mnpw` query invalidate.
|
||||||
|
- **삭제**: 목록 항목에서 `useDeleteRvwMnpwMng` — UI 확정 후 연결.
|
||||||
|
|
||||||
|
### 7-6. 미확정 / 검증 필요
|
||||||
|
|
||||||
|
- [ ] `ATRZ02`(검토2) 별도 블록 필요 여부
|
||||||
|
- [ ] 권한(역할별 CRUD)
|
||||||
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
/// <reference types="next" />
|
|
||||||
/// <reference types="next/image-types/global" />
|
|
||||||
/// <reference types="next/navigation-types/compat/navigation" />
|
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@common/assets": "workspace:*",
|
"@common/assets": "workspace:*",
|
||||||
|
"@common/auth": "workspace:*",
|
||||||
"@common/components": "workspace:*",
|
"@common/components": "workspace:*",
|
||||||
"@common/network": "workspace:*",
|
"@common/network": "workspace:*",
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"lucide-react": "^0.474.0",
|
"lucide-react": "^0.474.0",
|
||||||
"next": "15.3.8",
|
"next": "15.5.18",
|
||||||
"react-hook-form": "^7.54.2",
|
"react-hook-form": "^7.54.2",
|
||||||
"tus-js-client": "^4.3.1",
|
"tus-js-client": "^4.3.1",
|
||||||
"zod": "^3.24.2"
|
"zod": "^3.24.2"
|
||||||
|
|||||||
@@ -1,15 +1,58 @@
|
|||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import { ENDPOINT } from "@/shared/config";
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
import type { AcntgSeMngTreeDto, AcntgService } from "../model/acntg-interface";
|
import {
|
||||||
|
ACNTG_SE_SAVE_MODE,
|
||||||
|
type AcntgSeMngPutRequestDto,
|
||||||
|
type AcntgSeMngResponseDto,
|
||||||
|
type AcntgSeMngSaveRequestDto,
|
||||||
|
type AcntgSeMngSearchDto,
|
||||||
|
type AcntgSeMngService,
|
||||||
|
type AcntgSeMngTreeDto,
|
||||||
|
} from "../model/acntg-interface";
|
||||||
|
|
||||||
async function findTree(): Promise<AcntgSeMngTreeDto[]> {
|
const BASE = ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE;
|
||||||
const response = await client.get<AcntgSeMngTreeDto[]>(
|
|
||||||
`${ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE}/list/tree`,
|
async function findAll(params: AcntgSeMngSearchDto): Promise<PageResponse<AcntgSeMngResponseDto>> {
|
||||||
);
|
const response = await client.get<PageResponse<AcntgSeMngResponseDto>>(BASE, { params });
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const acntgService = {
|
async function findTree(): Promise<AcntgSeMngTreeDto[]> {
|
||||||
|
const response = await client.get<AcntgSeMngTreeDto[]>(`${BASE}/list/tree`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(acntgSeCd: string): Promise<AcntgSeMngResponseDto> {
|
||||||
|
const response = await client.get<AcntgSeMngResponseDto>(`${BASE}/${acntgSeCd}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveMulti(body: AcntgSeMngSaveRequestDto[]): Promise<AcntgSeMngResponseDto[]> {
|
||||||
|
const response = await client.post<AcntgSeMngResponseDto[]>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(acntgSeCd: string, body: AcntgSeMngPutRequestDto): Promise<string> {
|
||||||
|
const response = await client.put<string>(`${BASE}/${acntgSeCd}`, {
|
||||||
|
...body,
|
||||||
|
acntgSeCd,
|
||||||
|
mode: ACNTG_SE_SAVE_MODE.UPDATE,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteAcntgSeCd(acntgSeCd: string): Promise<string> {
|
||||||
|
const response = await client.delete<string>(`${BASE}/${acntgSeCd}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const acntgSeMngService = {
|
||||||
|
findAll,
|
||||||
findTree,
|
findTree,
|
||||||
} satisfies AcntgService;
|
findById,
|
||||||
|
saveMulti,
|
||||||
|
update,
|
||||||
|
delete: deleteAcntgSeCd,
|
||||||
|
} satisfies AcntgSeMngService;
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
AcntgSeMngPutRequestDto,
|
||||||
|
AcntgSeMngSaveRequestDto,
|
||||||
|
AcntgSeMngSearchDto,
|
||||||
|
} from "../model/acntg-interface";
|
||||||
|
|
||||||
|
import { acntgSeMngService } from "./acntg-service";
|
||||||
|
|
||||||
|
const acntgSeMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE] as const;
|
||||||
|
|
||||||
|
export function useAcntgSeMngPage(params: AcntgSeMngSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...acntgSeMngBaseKey, "findAll", params],
|
||||||
|
queryFn: () => acntgSeMngService.findAll(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAcntgSeMngTree() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...acntgSeMngBaseKey, "findTree"],
|
||||||
|
queryFn: () => acntgSeMngService.findTree(),
|
||||||
|
staleTime: Infinity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAcntgSeMng(acntgSeCd: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...acntgSeMngBaseKey, "findById", acntgSeCd],
|
||||||
|
queryFn: () => acntgSeMngService.findById(acntgSeCd!),
|
||||||
|
enabled: Boolean(acntgSeCd),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveMultiAcntgSeMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: AcntgSeMngSaveRequestDto[]) => acntgSeMngService.saveMulti(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: acntgSeMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateAcntgSeMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ acntgSeCd, body }: { acntgSeCd: string; body: AcntgSeMngPutRequestDto }) =>
|
||||||
|
acntgSeMngService.update(acntgSeCd, body),
|
||||||
|
onSuccess: (_data, { acntgSeCd }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: acntgSeMngBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...acntgSeMngBaseKey, "findById", acntgSeCd],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteAcntgSeMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (acntgSeCd: string) => acntgSeMngService.delete(acntgSeCd),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: acntgSeMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,2 +1,19 @@
|
|||||||
export type { AcntgSeMngTreeDto, AcntgService } from "./model/acntg-interface";
|
export { acntgSeMngService } from "./api/acntg-service";
|
||||||
export { acntgService } from "./api/acntg-service";
|
export {
|
||||||
|
useAcntgSeMng,
|
||||||
|
useAcntgSeMngPage,
|
||||||
|
useAcntgSeMngTree,
|
||||||
|
useDeleteAcntgSeMng,
|
||||||
|
useSaveMultiAcntgSeMng,
|
||||||
|
useUpdateAcntgSeMng,
|
||||||
|
} from "./api/queries";
|
||||||
|
export type {
|
||||||
|
AcntgSeMngResponseDto,
|
||||||
|
AcntgSeMngSaveRequestDto,
|
||||||
|
AcntgSeMngSearchDto,
|
||||||
|
AcntgSeMngService,
|
||||||
|
AcntgSeMngTreeDto,
|
||||||
|
AcntgSeSaveMode,
|
||||||
|
BizCstTreeDto,
|
||||||
|
} from "./model/acntg-interface";
|
||||||
|
export { ACNTG_SE_SAVE_MODE } from "./model/acntg-interface";
|
||||||
|
|||||||
@@ -1,23 +1,86 @@
|
|||||||
/** 회계구분 트리 노드 DTO */
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
export interface AcntgSeMngTreeDto {
|
|
||||||
/** 들여쓰기 포함 표시명 (앞 공백 수 = 레벨 인디케이터) */
|
export const ACNTG_SE_SAVE_MODE = {
|
||||||
indAcntgSeCdNm: string;
|
CREATE: "C",
|
||||||
/** 회계구분코드 */
|
UPDATE: "U",
|
||||||
|
DELETE: "D",
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type AcntgSeSaveMode = (typeof ACNTG_SE_SAVE_MODE)[keyof typeof ACNTG_SE_SAVE_MODE];
|
||||||
|
|
||||||
|
/** 백엔드 AcntgSeMngResponseDto */
|
||||||
|
export interface AcntgSeMngResponseDto {
|
||||||
acntgSeCd: string;
|
acntgSeCd: string;
|
||||||
/** 회계구분코드명 */
|
|
||||||
acntgSeCdNm: string;
|
acntgSeCdNm: string;
|
||||||
/** 상위 회계구분코드 (null = 최상위) */
|
upAcntgSeCd?: string;
|
||||||
upAcntgSeCd: string | null;
|
cdLvNo: number;
|
||||||
/** 사용여부 */
|
useYn: string;
|
||||||
|
expln?: string;
|
||||||
|
rgtr?: string;
|
||||||
|
rgtrNm?: string;
|
||||||
|
mdfr?: string;
|
||||||
|
regDt?: string;
|
||||||
|
mdfcnDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 AcntgSeMngSearchDto + Pageable */
|
||||||
|
export interface AcntgSeMngSearchDto extends PageableParams {
|
||||||
|
acntgSeCd?: string;
|
||||||
|
acntgSeCdNm?: string;
|
||||||
|
useYn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 AcntgSeMngSaveRequestDto */
|
||||||
|
export interface AcntgSeMngSaveRequestDto {
|
||||||
|
acntgSeCd: string;
|
||||||
|
mode: AcntgSeSaveMode;
|
||||||
|
acntgSeCdNm: string;
|
||||||
|
upAcntgSeCd?: string;
|
||||||
|
cdLvNo: number;
|
||||||
|
useYn?: string;
|
||||||
|
expln?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PUT /{acntgSeCd} 요청 (mode는 서비스에서 U로 설정) */
|
||||||
|
export interface AcntgSeMngPutRequestDto {
|
||||||
|
acntgSeCd: string;
|
||||||
|
acntgSeCdNm: string;
|
||||||
|
upAcntgSeCd?: string;
|
||||||
|
cdLvNo: number;
|
||||||
|
useYn?: string;
|
||||||
|
expln?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 AcntgSeMngTreeDto */
|
||||||
|
export interface AcntgSeMngTreeDto {
|
||||||
|
indAcntgSeCdNm: string;
|
||||||
|
acntgSeCd: string;
|
||||||
|
acntgSeCdNm: string;
|
||||||
|
upAcntgSeCd?: string;
|
||||||
useYn: string;
|
useYn: string;
|
||||||
/** 트리 레벨 (1 = 총사업비, 2 = 1.공사비/2.보상비/3.부대경비, …) */
|
|
||||||
treeLevel: number;
|
treeLevel: number;
|
||||||
/** 최상위~현재 노드까지 "|" 구분 경로 */
|
|
||||||
treePath: string;
|
treePath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 회계구분 서비스 인터페이스 */
|
/** 백엔드 BizCstTreeDto (InstlSncnMngDetResponseDto 등에서 참조) */
|
||||||
export interface AcntgService {
|
export interface BizCstTreeDto {
|
||||||
/** 회계구분 트리 전체 조회 */
|
indAcntgSeCdNm: string;
|
||||||
findTree(): Promise<AcntgSeMngTreeDto[]>;
|
acntgSeCd: string;
|
||||||
|
acntgSeCdNm: string;
|
||||||
|
useYn: string;
|
||||||
|
treeLevel: number;
|
||||||
|
treePath: string;
|
||||||
|
bscPlanAmt?: number;
|
||||||
|
bgtRfltAmt?: number;
|
||||||
|
tstmDesignAmt?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface AcntgSeMngService {
|
||||||
|
findAll(params: AcntgSeMngSearchDto): Promise<PageResponse<AcntgSeMngResponseDto>>;
|
||||||
|
findTree(): Promise<AcntgSeMngTreeDto[]>;
|
||||||
|
findById(acntgSeCd: string): Promise<AcntgSeMngResponseDto>;
|
||||||
|
saveMulti(body: AcntgSeMngSaveRequestDto[]): Promise<AcntgSeMngResponseDto[]>;
|
||||||
|
update(acntgSeCd: string, body: AcntgSeMngPutRequestDto): Promise<string>;
|
||||||
|
delete(acntgSeCd: string): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME, ENDPOINT } from "@/shared/config";
|
||||||
|
import { getRemainingMs } from "@common/auth";
|
||||||
|
|
||||||
|
import { clearAuthToken, setToken, setupRefreshTimer } from "../lib/token-manager";
|
||||||
|
import type { AuthPayload, AuthService } from "../model/auth-interface";
|
||||||
|
|
||||||
|
async function login(payload: AuthPayload): Promise<void> {
|
||||||
|
const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.LOGIN}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
const accessToken = data[ACCESS_TOKEN];
|
||||||
|
const tokenId = data[AUTH_USER_ID];
|
||||||
|
|
||||||
|
if (!accessToken || !tokenId) {
|
||||||
|
throw new Error("인증 토큰을 받지 못했습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
setToken(CLAIM_NAME, accessToken);
|
||||||
|
setToken(AUTH_USER_ID, tokenId);
|
||||||
|
|
||||||
|
const remainingMs = getRemainingMs(accessToken);
|
||||||
|
if (remainingMs > 0) {
|
||||||
|
setupRefreshTimer(silentRefresh, remainingMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function silentRefresh(): Promise<void> {
|
||||||
|
console.log(`[silentRefresh] Called at ${new Date().toISOString()}`);
|
||||||
|
try {
|
||||||
|
const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.SILENT_REFRESH}`, {
|
||||||
|
method: "PUT",
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data?.message ?? "토큰 갱신에 실패했습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const accessToken = data[ACCESS_TOKEN];
|
||||||
|
const tokenId = data[AUTH_USER_ID];
|
||||||
|
|
||||||
|
if (!accessToken || !tokenId) {
|
||||||
|
throw new Error("갱신된 인증 토큰을 받지 못했습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
setToken(CLAIM_NAME, accessToken);
|
||||||
|
setToken(AUTH_USER_ID, tokenId);
|
||||||
|
|
||||||
|
const remainingMs = getRemainingMs(accessToken);
|
||||||
|
if (remainingMs > 0) {
|
||||||
|
setupRefreshTimer(silentRefresh, remainingMs);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[silentRefresh] Failed at ${new Date().toISOString()}`, error);
|
||||||
|
clearAuthToken();
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
window.dispatchEvent(new CustomEvent("auth:logout"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function logout(): Promise<void> {
|
||||||
|
clearAuthToken();
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
window.dispatchEvent(new CustomEvent("auth:logout"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const authService: AuthService = {
|
||||||
|
login,
|
||||||
|
silentRefresh,
|
||||||
|
logout,
|
||||||
|
};
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
import { AxiosError } from "axios";
|
|
||||||
|
|
||||||
import {
|
|
||||||
ACCESS_TOKEN,
|
|
||||||
AUTH_USER_ID,
|
|
||||||
CLAIM_NAME,
|
|
||||||
ENDPOINT,
|
|
||||||
JWT_EXPIRATION_TIME,
|
|
||||||
} from "@/shared/config";
|
|
||||||
|
|
||||||
import { tokenManager } from "../lib/token-manager";
|
|
||||||
import type { ILogin, LoginService } from "../model/login-interface";
|
|
||||||
|
|
||||||
export class LoginApiService implements LoginService {
|
|
||||||
private static instance: LoginApiService;
|
|
||||||
|
|
||||||
private constructor() {}
|
|
||||||
|
|
||||||
public static getInstance(): LoginApiService {
|
|
||||||
if (!LoginApiService.instance) {
|
|
||||||
LoginApiService.instance = new LoginApiService();
|
|
||||||
}
|
|
||||||
return LoginApiService.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async login(payload: ILogin): Promise<void> {
|
|
||||||
try {
|
|
||||||
const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.LOGIN}`, {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
userId: payload.userId,
|
|
||||||
password: payload.password,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
console.log("data ", data);
|
|
||||||
const accessToken = data[ACCESS_TOKEN];
|
|
||||||
const tokenId = data[AUTH_USER_ID];
|
|
||||||
|
|
||||||
if (!accessToken || !tokenId) {
|
|
||||||
if (data.message == "Invalid Credentials") {
|
|
||||||
throw new Error("아이디와 비밀번호가 일치하지 않습니다.");
|
|
||||||
} else if (data.message == "User not found") {
|
|
||||||
throw new Error("존재하지 않는 아이디입니다.");
|
|
||||||
} else if (data.message == "User is not active") {
|
|
||||||
throw new Error("활성화되지 않은 계정입니다.");
|
|
||||||
} else if (data.message == "User is not verified") {
|
|
||||||
throw new Error("이메일 인증이 필요합니다.");
|
|
||||||
} else {
|
|
||||||
throw new Error(data.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tokenManager.setToken(CLAIM_NAME, accessToken);
|
|
||||||
tokenManager.setToken(AUTH_USER_ID, tokenId);
|
|
||||||
tokenManager.setupRefreshTimer(() => this.silentRefresh(), JWT_EXPIRATION_TIME);
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof AxiosError) {
|
|
||||||
throw new Error(`Login 실패 ${error.response?.data?.message}`);
|
|
||||||
}
|
|
||||||
throw new Error(`Login 실패 ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async silentRefresh(): Promise<void> {
|
|
||||||
try {
|
|
||||||
const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.SILENT_REFRESH}`, {
|
|
||||||
method: "PUT",
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
const accessToken = data[ACCESS_TOKEN];
|
|
||||||
const tokenId = data[AUTH_USER_ID];
|
|
||||||
|
|
||||||
if (!accessToken || !tokenId) {
|
|
||||||
throw new Error("Missing required authentication tokens");
|
|
||||||
}
|
|
||||||
|
|
||||||
tokenManager.setToken(CLAIM_NAME, accessToken);
|
|
||||||
tokenManager.setToken(AUTH_USER_ID, tokenId);
|
|
||||||
} catch (error) {
|
|
||||||
tokenManager.clearAuthToken();
|
|
||||||
if (error instanceof AxiosError) {
|
|
||||||
throw new Error(`Silent refresh failed: ${error.response?.data?.message}`);
|
|
||||||
}
|
|
||||||
throw new Error(`Silent refresh failed: ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const LoginApi = LoginApiService.getInstance();
|
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
export { LoginApi } from "./api/login-service";
|
export { authService } from "./api/auth-service";
|
||||||
export { AuthWrapper } from "./lib/auth-wrapper";
|
export { AuthWrapper } from "./lib/auth-wrapper";
|
||||||
|
export { tokenManager } from "./lib/token-manager";
|
||||||
|
|||||||
@@ -1,42 +1,71 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
import { isAxiosError } from "axios";
|
||||||
|
|
||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import { AUTH_LOGIN_REDIRECT_URL, AUTH_USER_ID, ENDPOINT } from "@/shared/config";
|
import { AUTH_LOGIN_REDIRECT_URL, AUTH_USER_ID, CLAIM_NAME, ENDPOINT } from "@/shared/config";
|
||||||
import { getCookie, useUserStore } from "@/shared/lib";
|
import { useUserStore } from "@/shared/lib";
|
||||||
import type { IUserInfo } from "@/shared/store";
|
import type { IUserInfo } from "@/shared/store";
|
||||||
|
import { getRemainingMs } from "@common/auth";
|
||||||
import { isAtLoginRedirectUrl } from "@common/network";
|
import { isAtLoginRedirectUrl } from "@common/network";
|
||||||
|
|
||||||
|
import { authService } from "../api/auth-service";
|
||||||
|
|
||||||
|
import { getToken, setupRefreshTimer } from "./token-manager";
|
||||||
|
|
||||||
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||||
const { userInfo, setUserInfo } = useUserStore((state) => state);
|
const router = useRouter();
|
||||||
|
const userInfo = useUserStore((state) => state.userInfo);
|
||||||
async function authCheck() {
|
const setUserInfo = useUserStore((state) => state.setUserInfo);
|
||||||
if (isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const userId = getCookie(AUTH_USER_ID);
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("Missing required authentication tokens");
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await client.get<IUserInfo>(`${ENDPOINT.USER_SERVICE.USERS}/info/me`);
|
|
||||||
if (!userInfo) setUserInfo(response.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
const token = getToken(CLAIM_NAME);
|
||||||
try {
|
if (token) {
|
||||||
await authCheck();
|
const remainingMs = getRemainingMs(token);
|
||||||
} catch (error) {
|
if (remainingMs > 0) {
|
||||||
console.error(error);
|
console.log(`[AuthWrapper] Refresh timer set: ${remainingMs}ms (${remainingMs / 1000}s)`);
|
||||||
setUserInfo(null);
|
setupRefreshTimer(authService.silentRefresh, remainingMs);
|
||||||
if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
|
||||||
window.location.assign(AUTH_LOGIN_REDIRECT_URL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})();
|
}
|
||||||
|
|
||||||
|
if (isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) return;
|
||||||
|
|
||||||
|
async function authCheck() {
|
||||||
|
const userId = getToken(AUTH_USER_ID);
|
||||||
|
if (!userId) {
|
||||||
|
router.replace(AUTH_LOGIN_REDIRECT_URL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userInfo) return;
|
||||||
|
|
||||||
|
const response = await client.get<IUserInfo>(`${ENDPOINT.USER_SERVICE.USERS}/info/me`);
|
||||||
|
setUserInfo(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
authCheck().catch((error) => {
|
||||||
|
if (isAxiosError(error) && error.response?.status === 401) return;
|
||||||
|
console.error(error);
|
||||||
|
setUserInfo(null);
|
||||||
|
if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
||||||
|
router.replace(AUTH_LOGIN_REDIRECT_URL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function handleAuthLogout() {
|
||||||
|
setUserInfo(null);
|
||||||
|
if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) {
|
||||||
|
router.replace(AUTH_LOGIN_REDIRECT_URL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("auth:logout", handleAuthLogout);
|
||||||
|
return () => window.removeEventListener("auth:logout", handleAuthLogout);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
|
|||||||
@@ -1,82 +1,15 @@
|
|||||||
import { AUTH_USER_ID, CLAIM_NAME } from "@/shared/config";
|
import { authConfig } from "@/shared/config/auth";
|
||||||
import { getCookie, removeCookie,setCookie } from "@/shared/lib";
|
import { createTokenManager } from "@common/auth";
|
||||||
|
|
||||||
export class TokenManager {
|
export const tokenManager = createTokenManager(authConfig);
|
||||||
private static instance: TokenManager;
|
|
||||||
private refreshTimer: NodeJS.Timeout | null = null;
|
|
||||||
|
|
||||||
private constructor() {}
|
export const {
|
||||||
|
getToken,
|
||||||
public static getInstance(): TokenManager {
|
setToken,
|
||||||
if (!TokenManager.instance) {
|
removeToken,
|
||||||
TokenManager.instance = new TokenManager();
|
setupRefreshTimer,
|
||||||
}
|
clearAuthToken,
|
||||||
return TokenManager.instance;
|
getAccessToken,
|
||||||
}
|
getRefreshToken,
|
||||||
|
getUserId,
|
||||||
public getToken(key: string): string | undefined {
|
} = tokenManager;
|
||||||
return getCookie(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setToken(key: string, value: string): void {
|
|
||||||
const domain = this.getCookieDomain();
|
|
||||||
|
|
||||||
setCookie(key, value, {
|
|
||||||
secure: window.location.protocol === "https:",
|
|
||||||
sameSite: "lax",
|
|
||||||
domain: domain,
|
|
||||||
path: "/", // 모든 경로에서 접근 가능
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private getCookieDomain(): string | undefined {
|
|
||||||
const hostname = window.location.hostname;
|
|
||||||
|
|
||||||
// 개발 환경에서는 localhost 도메인 사용
|
|
||||||
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
||||||
return undefined; // localhost에서는 도메인 설정하지 않음
|
|
||||||
}
|
|
||||||
|
|
||||||
// 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용
|
|
||||||
if (hostname.includes("hasuon.or.kr")) {
|
|
||||||
return ".hasuon.or.kr";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 기타 환경에서는 현재 호스트명 사용
|
|
||||||
return hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public removeToken(key: string): void {
|
|
||||||
const domain = this.getCookieDomain();
|
|
||||||
removeCookie(key, { domain, path: "/" });
|
|
||||||
}
|
|
||||||
|
|
||||||
public setupRefreshTimer(
|
|
||||||
callback: () => Promise<void>,
|
|
||||||
expirationTime: number,
|
|
||||||
): void {
|
|
||||||
if (this.refreshTimer) {
|
|
||||||
clearTimeout(this.refreshTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.refreshTimer = setTimeout(() => {
|
|
||||||
callback().catch((error) => {
|
|
||||||
console.error("Silent refresh failed:", error);
|
|
||||||
this.clearAuthToken();
|
|
||||||
});
|
|
||||||
}, expirationTime - 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public clearAuthToken(): void {
|
|
||||||
if (this.refreshTimer) {
|
|
||||||
clearTimeout(this.refreshTimer);
|
|
||||||
this.refreshTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.removeToken(CLAIM_NAME);
|
|
||||||
this.removeToken(AUTH_USER_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const tokenManager = TokenManager.getInstance();
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export interface AuthPayload {
|
||||||
|
userId: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AuthService {
|
||||||
|
login(payload: AuthPayload): Promise<void>;
|
||||||
|
silentRefresh(): Promise<void>;
|
||||||
|
logout(): Promise<void>;
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export interface ILogin {
|
|
||||||
userId: string;
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoginService {
|
|
||||||
login(payload: ILogin): Promise<void>;
|
|
||||||
silentRefresh(): Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -24,6 +24,8 @@ export interface CklstTreeNode {
|
|||||||
rvwCn: string;
|
rvwCn: string;
|
||||||
bchckUseYn: "Y" | "N";
|
bchckUseYn: "Y" | "N";
|
||||||
sortSeq: number;
|
sortSeq: number;
|
||||||
|
// optional: backend may include the taskSeComCd per node
|
||||||
|
taskSeComCd?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CklstTreeSearchParams {
|
export interface CklstTreeSearchParams {
|
||||||
|
|||||||
@@ -1,15 +1,58 @@
|
|||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import { ENDPOINT } from "@/shared/config";
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
import type { CnstpSeMngTreeDto, CnstpService } from "../model/cnstp-interface";
|
import {
|
||||||
|
CNSTP_SE_SAVE_MODE,
|
||||||
|
type CnstpSeMngPutRequestDto,
|
||||||
|
type CnstpSeMngResponseDto,
|
||||||
|
type CnstpSeMngSaveRequestDto,
|
||||||
|
type CnstpSeMngSearchDto,
|
||||||
|
type CnstpSeMngService,
|
||||||
|
type CnstpSeMngTreeDto,
|
||||||
|
} from "../model/cnstp-interface";
|
||||||
|
|
||||||
async function findTree(): Promise<CnstpSeMngTreeDto[]> {
|
const BASE = ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE;
|
||||||
const response = await client.get<CnstpSeMngTreeDto[]>(
|
|
||||||
`${ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE}/list/tree`,
|
async function findAll(params: CnstpSeMngSearchDto): Promise<PageResponse<CnstpSeMngResponseDto>> {
|
||||||
);
|
const response = await client.get<PageResponse<CnstpSeMngResponseDto>>(BASE, { params });
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const cnstpService = {
|
async function findTree(): Promise<CnstpSeMngTreeDto[]> {
|
||||||
|
const response = await client.get<CnstpSeMngTreeDto[]>(`${BASE}/list/tree`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(cnstpSeCd: string): Promise<CnstpSeMngResponseDto> {
|
||||||
|
const response = await client.get<CnstpSeMngResponseDto>(`${BASE}/${cnstpSeCd}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveMulti(body: CnstpSeMngSaveRequestDto[]): Promise<CnstpSeMngResponseDto[]> {
|
||||||
|
const response = await client.post<CnstpSeMngResponseDto[]>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(cnstpSeCd: string, body: CnstpSeMngPutRequestDto): Promise<string> {
|
||||||
|
const response = await client.put<string>(`${BASE}/${cnstpSeCd}`, {
|
||||||
|
...body,
|
||||||
|
cnstpSeCd,
|
||||||
|
mode: CNSTP_SE_SAVE_MODE.UPDATE,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteCnstpSeCd(cnstpSeCd: string): Promise<string> {
|
||||||
|
const response = await client.delete<string>(`${BASE}/${cnstpSeCd}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const cnstpSeMngService = {
|
||||||
|
findAll,
|
||||||
findTree,
|
findTree,
|
||||||
} satisfies CnstpService;
|
findById,
|
||||||
|
saveMulti,
|
||||||
|
update,
|
||||||
|
delete: deleteCnstpSeCd,
|
||||||
|
} satisfies CnstpSeMngService;
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
CnstpSeMngPutRequestDto,
|
||||||
|
CnstpSeMngSaveRequestDto,
|
||||||
|
CnstpSeMngSearchDto,
|
||||||
|
} from "../model/cnstp-interface";
|
||||||
|
|
||||||
|
import { cnstpSeMngService } from "./cnstp-service";
|
||||||
|
|
||||||
|
const cnstpSeMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE] as const;
|
||||||
|
|
||||||
|
export function useCnstpSeMngPage(params: CnstpSeMngSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...cnstpSeMngBaseKey, "findAll", params],
|
||||||
|
queryFn: () => cnstpSeMngService.findAll(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCnstpSeMngTree() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...cnstpSeMngBaseKey, "findTree"],
|
||||||
|
queryFn: () => cnstpSeMngService.findTree(),
|
||||||
|
staleTime: Infinity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCnstpSeMng(cnstpSeCd: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...cnstpSeMngBaseKey, "findById", cnstpSeCd],
|
||||||
|
queryFn: () => cnstpSeMngService.findById(cnstpSeCd!),
|
||||||
|
enabled: Boolean(cnstpSeCd),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveMultiCnstpSeMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: CnstpSeMngSaveRequestDto[]) => cnstpSeMngService.saveMulti(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: cnstpSeMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateCnstpSeMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ cnstpSeCd, body }: { cnstpSeCd: string; body: CnstpSeMngPutRequestDto }) =>
|
||||||
|
cnstpSeMngService.update(cnstpSeCd, body),
|
||||||
|
onSuccess: (_data, { cnstpSeCd }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: cnstpSeMngBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...cnstpSeMngBaseKey, "findById", cnstpSeCd],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteCnstpSeMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (cnstpSeCd: string) => cnstpSeMngService.delete(cnstpSeCd),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: cnstpSeMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,2 +1,19 @@
|
|||||||
export type { CnstpSeMngTreeDto, CnstpService } from "./model/cnstp-interface";
|
export { cnstpSeMngService } from "./api/cnstp-service";
|
||||||
export { cnstpService } from "./api/cnstp-service";
|
export {
|
||||||
|
useCnstpSeMng,
|
||||||
|
useCnstpSeMngPage,
|
||||||
|
useCnstpSeMngTree,
|
||||||
|
useDeleteCnstpSeMng,
|
||||||
|
useSaveMultiCnstpSeMng,
|
||||||
|
useUpdateCnstpSeMng,
|
||||||
|
} from "./api/queries";
|
||||||
|
export type {
|
||||||
|
BizSclTreeDto,
|
||||||
|
CnstpSeMngResponseDto,
|
||||||
|
CnstpSeMngSaveRequestDto,
|
||||||
|
CnstpSeMngSearchDto,
|
||||||
|
CnstpSeMngService,
|
||||||
|
CnstpSeMngTreeDto,
|
||||||
|
CnstpSeSaveMode,
|
||||||
|
} from "./model/cnstp-interface";
|
||||||
|
export { CNSTP_SE_SAVE_MODE } from "./model/cnstp-interface";
|
||||||
|
|||||||
@@ -1,23 +1,86 @@
|
|||||||
/** 공종구분 트리 노드 DTO */
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
export interface CnstpSeMngTreeDto {
|
|
||||||
/** 들여쓰기 포함 표시명 */
|
export const CNSTP_SE_SAVE_MODE = {
|
||||||
indCnstpSeCdNm: string;
|
CREATE: "C",
|
||||||
/** 공종구분코드 */
|
UPDATE: "U",
|
||||||
|
DELETE: "D",
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type CnstpSeSaveMode = (typeof CNSTP_SE_SAVE_MODE)[keyof typeof CNSTP_SE_SAVE_MODE];
|
||||||
|
|
||||||
|
/** 백엔드 CnstpSeMngResponseDto */
|
||||||
|
export interface CnstpSeMngResponseDto {
|
||||||
cnstpSeCd: string;
|
cnstpSeCd: string;
|
||||||
/** 공종구분코드명 */
|
|
||||||
cnstpSeCdNm: string;
|
cnstpSeCdNm: string;
|
||||||
/** 상위 공종구분코드 (null = 최상위) */
|
upCnstpCd?: string;
|
||||||
upCnstpCd: string | null;
|
cdLvNo: number;
|
||||||
/** 사용여부 */
|
useYn: string;
|
||||||
|
expln?: string;
|
||||||
|
rgtr?: string;
|
||||||
|
rgtrNm?: string;
|
||||||
|
mdfr?: string;
|
||||||
|
regDt?: string;
|
||||||
|
mdfcnDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 CnstpSeMngSearchDto + Pageable */
|
||||||
|
export interface CnstpSeMngSearchDto extends PageableParams {
|
||||||
|
cnstpSeCd?: string;
|
||||||
|
cnstpSeCdNm?: string;
|
||||||
|
useYn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 CnstpSeMngSaveRequestDto */
|
||||||
|
export interface CnstpSeMngSaveRequestDto {
|
||||||
|
cnstpSeCd: string;
|
||||||
|
mode: CnstpSeSaveMode;
|
||||||
|
cnstpSeCdNm?: string;
|
||||||
|
upCnstpCd?: string;
|
||||||
|
cdLvNo?: number;
|
||||||
|
useYn?: string;
|
||||||
|
expln?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PUT /{cnstpSeCd} 요청 (mode는 서비스에서 U로 설정) */
|
||||||
|
export interface CnstpSeMngPutRequestDto {
|
||||||
|
cnstpSeCd: string;
|
||||||
|
cnstpSeCdNm?: string;
|
||||||
|
upCnstpCd?: string;
|
||||||
|
cdLvNo?: number;
|
||||||
|
useYn?: string;
|
||||||
|
expln?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 CnstpSeMngTreeDto */
|
||||||
|
export interface CnstpSeMngTreeDto {
|
||||||
|
indCnstpSeCdNm: string;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
cnstpSeCdNm: string;
|
||||||
|
upCnstpCd?: string;
|
||||||
useYn: string;
|
useYn: string;
|
||||||
/** 트리 레벨 */
|
|
||||||
treeLevel: number;
|
treeLevel: number;
|
||||||
/** 최상위~현재 노드까지 "|" 구분 경로 */
|
|
||||||
treePath: string;
|
treePath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 공종구분 서비스 인터페이스 */
|
/** 백엔드 BizSclTreeDto */
|
||||||
export interface CnstpService {
|
export interface BizSclTreeDto {
|
||||||
/** 공종구분 트리 전체 조회 */
|
indCnstpSeCdNm: string;
|
||||||
findTree(): Promise<CnstpSeMngTreeDto[]>;
|
cnstpSeCd: string;
|
||||||
|
cnstpSeCdNm: string;
|
||||||
|
useYn: string;
|
||||||
|
treeLevel: number;
|
||||||
|
treePath: string;
|
||||||
|
bscPlanQty?: number;
|
||||||
|
bgtRfltQty?: number;
|
||||||
|
tstmDesignQty?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface CnstpSeMngService {
|
||||||
|
findAll(params: CnstpSeMngSearchDto): Promise<PageResponse<CnstpSeMngResponseDto>>;
|
||||||
|
findTree(): Promise<CnstpSeMngTreeDto[]>;
|
||||||
|
findById(cnstpSeCd: string): Promise<CnstpSeMngResponseDto>;
|
||||||
|
saveMulti(body: CnstpSeMngSaveRequestDto[]): Promise<CnstpSeMngResponseDto[]>;
|
||||||
|
update(cnstpSeCd: string, body: CnstpSeMngPutRequestDto): Promise<string>;
|
||||||
|
delete(cnstpSeCd: string): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ElaprDmndResponse,
|
||||||
|
ElaprDmndSaveRequest,
|
||||||
|
ElaprDmndService,
|
||||||
|
} from "../model/elapr-dmnd-interface";
|
||||||
|
|
||||||
|
async function create(body: ElaprDmndSaveRequest): Promise<ElaprDmndResponse> {
|
||||||
|
const response = await client.post<ElaprDmndResponse>(ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ElaprDmndApi: ElaprDmndService = {
|
||||||
|
create,
|
||||||
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
|
||||||
|
export async function processElaprPrgrs(elaprPrgrsId: string, atrzPrgrsSttsComCd = "ATRZ_STTS_003"): Promise<void> {
|
||||||
|
await client.put(`/as-elapr-service/api/v1/elapr-prgrs-stts/${elaprPrgrsId}/process`, {
|
||||||
|
atrzPrgrsSttsComCd,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
export interface ElaprDmndSaveRequest {
|
||||||
|
elaprDocNo: string;
|
||||||
|
elaprTmpltId: string;
|
||||||
|
dmndTtl: string;
|
||||||
|
dmndCn: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ElaprDmndResponse {
|
||||||
|
elaprDmndId: string;
|
||||||
|
elaprDocNo: string;
|
||||||
|
elaprTmpltId: string;
|
||||||
|
dmndTtl: string;
|
||||||
|
dmndCn: string;
|
||||||
|
atrzSttsComCd: string;
|
||||||
|
rqstrUuid: string;
|
||||||
|
regDt: string;
|
||||||
|
updtDt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ElaprDmndService {
|
||||||
|
create(body: ElaprDmndSaveRequest): Promise<ElaprDmndResponse>;
|
||||||
|
}
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
import { client } from "@/shared/api";
|
import { client } from "@/shared/api";
|
||||||
import { ENDPOINT } from "@/shared/config";
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
EsntlAtchFileMng,
|
||||||
|
EsntlAtchFileMngSaveRequest,
|
||||||
EsntlAtchFileMngSearchParams,
|
EsntlAtchFileMngSearchParams,
|
||||||
EsntlAtchFileMngService,
|
EsntlAtchFileMngService,
|
||||||
EsntlAtchFileMngTreeResponseDto,
|
EsntlAtchFileMngTreeResponseDto,
|
||||||
|
EsntlAtchFileMngTreeSearchParams,
|
||||||
} from "../model/esntl-interface";
|
} from "../model/esntl-interface";
|
||||||
|
|
||||||
async function findTree(
|
async function findTree(
|
||||||
params: EsntlAtchFileMngSearchParams,
|
params: EsntlAtchFileMngTreeSearchParams,
|
||||||
): Promise<EsntlAtchFileMngTreeResponseDto[]> {
|
): Promise<EsntlAtchFileMngTreeResponseDto[]> {
|
||||||
const response = await client.get<EsntlAtchFileMngTreeResponseDto[]>(
|
const response = await client.get<EsntlAtchFileMngTreeResponseDto[]>(
|
||||||
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/list/tree`,
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/list/tree`,
|
||||||
@@ -17,6 +21,48 @@ async function findTree(
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function findPage(
|
||||||
|
params: EsntlAtchFileMngSearchParams,
|
||||||
|
): Promise<PageResponse<EsntlAtchFileMng>> {
|
||||||
|
const response = await client.get<PageResponse<EsntlAtchFileMng>>(
|
||||||
|
ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE,
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(esntlAtchFileId: string): Promise<EsntlAtchFileMng> {
|
||||||
|
const response = await client.get<EsntlAtchFileMng>(
|
||||||
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function create(body: EsntlAtchFileMngSaveRequest): Promise<string> {
|
||||||
|
const response = await client.post<string>(ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(esntlAtchFileId: string, body: EsntlAtchFileMngSaveRequest): Promise<string> {
|
||||||
|
const response = await client.put<string>(
|
||||||
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function remove(esntlAtchFileId: string): Promise<string> {
|
||||||
|
const response = await client.delete<string>(
|
||||||
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
export const esntlAtchFileMngService = {
|
export const esntlAtchFileMngService = {
|
||||||
findTree,
|
findTree,
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
create,
|
||||||
|
update,
|
||||||
|
remove,
|
||||||
} satisfies EsntlAtchFileMngService;
|
} satisfies EsntlAtchFileMngService;
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
EsntlAtchFileMngSaveRequest,
|
||||||
|
EsntlAtchFileMngSearchParams,
|
||||||
|
EsntlAtchFileMngTreeSearchParams,
|
||||||
|
} from "../model/esntl-interface";
|
||||||
|
|
||||||
|
import { esntlAtchFileMngService } from "./esntl-service";
|
||||||
|
|
||||||
|
const esntlAtchFileMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE] as const;
|
||||||
|
|
||||||
|
export function useEsntlAtchFileMngTree(params: EsntlAtchFileMngTreeSearchParams) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...esntlAtchFileMngBaseKey, "tree", params],
|
||||||
|
queryFn: () => esntlAtchFileMngService.findTree(params),
|
||||||
|
enabled: Boolean(params.docSeComCd),
|
||||||
|
staleTime: Infinity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useEsntlAtchFileMngPage(params: EsntlAtchFileMngSearchParams) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...esntlAtchFileMngBaseKey, "page", params],
|
||||||
|
queryFn: () => esntlAtchFileMngService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useEsntlAtchFileMng(esntlAtchFileId: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...esntlAtchFileMngBaseKey, esntlAtchFileId],
|
||||||
|
queryFn: () => esntlAtchFileMngService.findById(esntlAtchFileId!),
|
||||||
|
enabled: Boolean(esntlAtchFileId),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCreateEsntlAtchFileMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: EsntlAtchFileMngSaveRequest) => esntlAtchFileMngService.create(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: esntlAtchFileMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateEsntlAtchFileMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
esntlAtchFileId,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
body: EsntlAtchFileMngSaveRequest;
|
||||||
|
}) => esntlAtchFileMngService.update(esntlAtchFileId, body),
|
||||||
|
onSuccess: (_data, { esntlAtchFileId }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: esntlAtchFileMngBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...esntlAtchFileMngBaseKey, esntlAtchFileId],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteEsntlAtchFileMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (esntlAtchFileId: string) => esntlAtchFileMngService.remove(esntlAtchFileId),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: esntlAtchFileMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,6 +1,17 @@
|
|||||||
|
export { esntlAtchFileMngService } from "./api/esntl-service";
|
||||||
|
export {
|
||||||
|
useCreateEsntlAtchFileMng,
|
||||||
|
useDeleteEsntlAtchFileMng,
|
||||||
|
useEsntlAtchFileMng,
|
||||||
|
useEsntlAtchFileMngPage,
|
||||||
|
useEsntlAtchFileMngTree,
|
||||||
|
useUpdateEsntlAtchFileMng,
|
||||||
|
} from "./api/queries";
|
||||||
export type {
|
export type {
|
||||||
|
EsntlAtchFileMng,
|
||||||
|
EsntlAtchFileMngSaveRequest,
|
||||||
EsntlAtchFileMngSearchParams,
|
EsntlAtchFileMngSearchParams,
|
||||||
EsntlAtchFileMngService,
|
EsntlAtchFileMngService,
|
||||||
EsntlAtchFileMngTreeResponseDto,
|
EsntlAtchFileMngTreeResponseDto,
|
||||||
|
EsntlAtchFileMngTreeSearchParams,
|
||||||
} from "./model/esntl-interface";
|
} from "./model/esntl-interface";
|
||||||
export { esntlAtchFileMngService } from "./api/esntl-service";
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
/** 필수첨부파일관리 트리 조회 응답 DTO */
|
/** 필수첨부파일관리 트리 조회 응답 DTO */
|
||||||
export interface EsntlAtchFileMngTreeResponseDto {
|
export interface EsntlAtchFileMngTreeResponseDto {
|
||||||
/** 필수첨부파일아이디 */
|
/** 필수첨부파일아이디 */
|
||||||
@@ -12,14 +14,70 @@ export interface EsntlAtchFileMngTreeResponseDto {
|
|||||||
esntlAtchFileRmrk: string;
|
esntlAtchFileRmrk: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 필수첨부파일관리 조회 파라미터 */
|
/** 필수첨부파일관리 엔티티 (목록/상세 공용 응답 DTO) */
|
||||||
export interface EsntlAtchFileMngSearchParams {
|
export interface EsntlAtchFileMng {
|
||||||
|
/** 필수첨부파일아이디 */
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
/** 문서구분공통코드 */
|
||||||
|
docSeComCd: string;
|
||||||
|
/** 필수첨부파일명 */
|
||||||
|
esntlAtchFileNm: string;
|
||||||
|
/** 필수첨부여부 ("Y" | "N") */
|
||||||
|
esntlAtchYn: "Y" | "N";
|
||||||
|
/** 필수첨부파일비고 */
|
||||||
|
esntlAtchFileRmrk?: string;
|
||||||
|
/** 등록자UUID */
|
||||||
|
rgtr?: string;
|
||||||
|
/** 등록자명 */
|
||||||
|
rgtrNm?: string;
|
||||||
|
/** 수정자UUID */
|
||||||
|
mdfr?: string;
|
||||||
|
/** 등록일시 (yyyy-MM-dd HH:mm:ss) */
|
||||||
|
regDt?: string;
|
||||||
|
/** 수정일시 */
|
||||||
|
mdfcnDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 필수첨부파일관리 트리 조회 파라미터 */
|
||||||
|
export interface EsntlAtchFileMngTreeSearchParams {
|
||||||
/** 문서구분공통코드 (예: "INSTL") */
|
/** 문서구분공통코드 (예: "INSTL") */
|
||||||
docSeComCd: string;
|
docSeComCd: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 필수첨부파일관리 목록 조회 파라미터 (페이징 포함) */
|
||||||
|
export interface EsntlAtchFileMngSearchParams extends PageableParams {
|
||||||
|
/** 문서구분공통코드 (예: "INSTL") */
|
||||||
|
docSeComCd?: string;
|
||||||
|
/** 필수첨부파일명 */
|
||||||
|
esntlAtchFileNm?: string;
|
||||||
|
/** 필수첨부여부 ("Y" | "N") */
|
||||||
|
esntlAtchYn?: "Y" | "N";
|
||||||
|
}
|
||||||
|
|
||||||
/** 필수첨부파일관리 서비스 인터페이스 */
|
/** 필수첨부파일관리 서비스 인터페이스 */
|
||||||
export interface EsntlAtchFileMngService {
|
export interface EsntlAtchFileMngService {
|
||||||
/** 필수첨부파일 트리 조회 */
|
/** 필수첨부파일 트리 조회 */
|
||||||
findTree(params: EsntlAtchFileMngSearchParams): Promise<EsntlAtchFileMngTreeResponseDto[]>;
|
findTree(params: EsntlAtchFileMngTreeSearchParams): Promise<EsntlAtchFileMngTreeResponseDto[]>;
|
||||||
|
/** 필수첨부파일관리 목록 조회 (페이징) */
|
||||||
|
findPage(params: EsntlAtchFileMngSearchParams): Promise<PageResponse<EsntlAtchFileMng>>;
|
||||||
|
/** 필수첨부파일관리 상세 조회 */
|
||||||
|
findById(esntlAtchFileId: string): Promise<EsntlAtchFileMng>;
|
||||||
|
/** 필수첨부파일관리 등록 */
|
||||||
|
create(body: EsntlAtchFileMngSaveRequest): Promise<string>;
|
||||||
|
/** 필수첨부파일관리 수정 */
|
||||||
|
update(esntlAtchFileId: string, body: EsntlAtchFileMngSaveRequest): Promise<string>;
|
||||||
|
/** 필수첨부파일관리 삭제 */
|
||||||
|
remove(esntlAtchFileId: string): Promise<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 필수첨부파일관리 저장 요청 DTO */
|
||||||
|
export interface EsntlAtchFileMngSaveRequest {
|
||||||
|
/** 문서구분공통코드 */
|
||||||
|
docSeComCd: string;
|
||||||
|
/** 필수첨부파일명 */
|
||||||
|
esntlAtchFileNm?: string;
|
||||||
|
/** 필수첨부여부 ("Y" | "N") */
|
||||||
|
esntlAtchYn?: "Y" | "N";
|
||||||
|
/** 필수첨부파일비고 */
|
||||||
|
esntlAtchFileRmrk?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type {
|
|||||||
InstlSncnMngSearchParams,
|
InstlSncnMngSearchParams,
|
||||||
InstlSncnMngService,
|
InstlSncnMngService,
|
||||||
SpringPage,
|
SpringPage,
|
||||||
|
InstlSncnMngDetResponse,
|
||||||
} from "../model/instl-sncn-interface";
|
} from "../model/instl-sncn-interface";
|
||||||
|
|
||||||
export class InstlSncnApiService implements InstlSncnMngService {
|
export class InstlSncnApiService implements InstlSncnMngService {
|
||||||
@@ -16,8 +17,8 @@ export class InstlSncnApiService implements InstlSncnMngService {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getById(id: string): Promise<InstlSncnMng> {
|
public async getById(id: string): Promise<InstlSncnMngDetResponse> {
|
||||||
const response = await client.get<InstlSncnMng>(`${ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN}/${id}`);
|
const response = await client.get<InstlSncnMngDetResponse>(`${ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN}/${id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +29,13 @@ export class InstlSncnApiService implements InstlSncnMngService {
|
|||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
public async techReview(payload: InstlSncnApplySaveRequestDto): Promise<string> {
|
||||||
|
const response = await client.post<string>(
|
||||||
|
`${ENDPOINT.AS_INSTL_SERVICE.INSTL_SNCN}/tech-review`,
|
||||||
|
payload,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const InstlSncnApi = new InstlSncnApiService();
|
export const InstlSncnApi = new InstlSncnApiService();
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ export {
|
|||||||
type InstlSncnMng,
|
type InstlSncnMng,
|
||||||
type InstlSncnMngSearchParams,
|
type InstlSncnMngSearchParams,
|
||||||
type SpringPage,
|
type SpringPage,
|
||||||
|
type ElaprDocPrgrsClientResponseDto,
|
||||||
} from "./model/instl-sncn-interface";
|
} from "./model/instl-sncn-interface";
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export interface InstlSncnMngSearchParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface InstlSncnMng {
|
export interface InstlSncnMng {
|
||||||
|
gugun: string;
|
||||||
|
sido: string;
|
||||||
instlSncnDocNo: string;
|
instlSncnDocNo: string;
|
||||||
admdstCd: string;
|
admdstCd: string;
|
||||||
sidoNm?: string;
|
sidoNm?: string;
|
||||||
@@ -29,6 +31,7 @@ export interface InstlSncnMng {
|
|||||||
chrgrNm?: string;
|
chrgrNm?: string;
|
||||||
instNm?: string;
|
instNm?: string;
|
||||||
envoSeComCd: string;
|
envoSeComCd: string;
|
||||||
|
sncnSeComCd: string;
|
||||||
envoSeCdNm: string;
|
envoSeCdNm: string;
|
||||||
taskSeComCd: string;
|
taskSeComCd: string;
|
||||||
taskSeCdNm: string;
|
taskSeCdNm: string;
|
||||||
@@ -85,7 +88,9 @@ export interface InstlSncnCklstResultSaveDto {
|
|||||||
cklstSn: number;
|
cklstSn: number;
|
||||||
cklstArtclSn: number;
|
cklstArtclSn: number;
|
||||||
cklstRvwSn: number;
|
cklstRvwSn: number;
|
||||||
|
rvwStpComCd: string;
|
||||||
selected: "Y" | "N" | null;
|
selected: "Y" | "N" | null;
|
||||||
|
picRvwCn?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 설치인가 신청 - 필수첨부파일 저장 DTO(배열 원소) */
|
/** 설치인가 신청 - 필수첨부파일 저장 DTO(배열 원소) */
|
||||||
@@ -103,8 +108,42 @@ export interface InstlSncnApplySaveRequestDto {
|
|||||||
esntlAtchFileList: InstlSncnEsntlAtchFileSaveDto[];
|
esntlAtchFileList: InstlSncnEsntlAtchFileSaveDto[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** 전자결재 진행상태 (클라이언트 응답용) */
|
||||||
|
export interface ElaprDocPrgrsClientResponseDto {
|
||||||
|
elaprDocNo?: string;
|
||||||
|
elaprDmndId?: string;
|
||||||
|
elaprPrgrsId?: string;
|
||||||
|
atrzSeqNo?: number;
|
||||||
|
atrzSeComCd?: string;
|
||||||
|
atrzSeComNm?: string;
|
||||||
|
aprvrUuid?: string;
|
||||||
|
aprvrUuidNm?: string;
|
||||||
|
atrzPrgrsSttsComCd?: string;
|
||||||
|
atrzPrgrsSttsComNm?: string;
|
||||||
|
rjctRsn?: string | null;
|
||||||
|
atrzDt?: string | null;
|
||||||
|
jbpsSeNm?: string;
|
||||||
|
jbgdSeNm?: string;
|
||||||
|
ognzNm?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// det 응답에 전자결재 진행상태 목록을 포함
|
||||||
|
export interface InstlSncnMngDetResponse {
|
||||||
|
detDto: InstlSncnMng;
|
||||||
|
bizSclList: any[];
|
||||||
|
bizCstList: any[];
|
||||||
|
cklstResultList?: any[];
|
||||||
|
esntlFileList: any[];
|
||||||
|
etcFileList: any[];
|
||||||
|
elaprDocPrgrsList?: ElaprDocPrgrsClientResponseDto[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface InstlSncnMngService {
|
export interface InstlSncnMngService {
|
||||||
getPage: (params: InstlSncnMngSearchParams) => Promise<SpringPage<InstlSncnMng>>;
|
getPage: (params: InstlSncnMngSearchParams) => Promise<SpringPage<InstlSncnMng>>;
|
||||||
getById: (id: string) => Promise<InstlSncnMng>;
|
getById: (id: string) => Promise<InstlSncnMngDetResponse>;
|
||||||
saveApply: (payload: InstlSncnApplySaveRequestDto) => Promise<string>;
|
saveApply: (payload: InstlSncnApplySaveRequestDto) => Promise<string>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
RvwMnpwMngSaveRequestDto,
|
||||||
|
RvwMnpwMngSearchDto,
|
||||||
|
RvwMnpwMngUpdateRequestDto,
|
||||||
|
} from "../model/rvw-mnpw-interface";
|
||||||
|
|
||||||
|
import { rvwMnpwMngService } from "./rvw-mnpw-service";
|
||||||
|
|
||||||
|
const rvwMnpwMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.RVW_MNPW] as const;
|
||||||
|
|
||||||
|
export function useRvwMnpwMngPage(params: RvwMnpwMngSearchDto, options?: { enabled?: boolean }) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...rvwMnpwMngBaseKey, "findPage", params],
|
||||||
|
queryFn: () => rvwMnpwMngService.findPage(params),
|
||||||
|
enabled: options?.enabled,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useRvwMnpwMng(
|
||||||
|
atrzSeComCd: string | null | undefined,
|
||||||
|
ognzSn: number | null | undefined,
|
||||||
|
userUuid: string | null | undefined,
|
||||||
|
) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...rvwMnpwMngBaseKey, "findById", atrzSeComCd, ognzSn, userUuid],
|
||||||
|
queryFn: () => rvwMnpwMngService.findById(atrzSeComCd!, ognzSn!, userUuid!),
|
||||||
|
enabled: Boolean(atrzSeComCd && ognzSn != null && userUuid),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveRvwMnpwMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: RvwMnpwMngSaveRequestDto) => rvwMnpwMngService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: rvwMnpwMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateRvwMnpwMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
atrzSeComCd,
|
||||||
|
ognzSn,
|
||||||
|
userUuid,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
atrzSeComCd: string;
|
||||||
|
ognzSn: number;
|
||||||
|
userUuid: string;
|
||||||
|
body: RvwMnpwMngUpdateRequestDto;
|
||||||
|
}) => rvwMnpwMngService.update(atrzSeComCd, ognzSn, userUuid, body),
|
||||||
|
onSuccess: (_data, { atrzSeComCd, ognzSn, userUuid }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: rvwMnpwMngBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...rvwMnpwMngBaseKey, "findById", atrzSeComCd, ognzSn, userUuid],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteRvwMnpwMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
atrzSeComCd,
|
||||||
|
ognzSn,
|
||||||
|
userUuid,
|
||||||
|
}: {
|
||||||
|
atrzSeComCd: string;
|
||||||
|
ognzSn: number;
|
||||||
|
userUuid: string;
|
||||||
|
}) => rvwMnpwMngService.delete(atrzSeComCd, ognzSn, userUuid),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: rvwMnpwMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
RvwMnpwMngResponseDto,
|
||||||
|
RvwMnpwMngSaveRequestDto,
|
||||||
|
RvwMnpwMngSearchDto,
|
||||||
|
RvwMnpwMngService,
|
||||||
|
RvwMnpwMngUpdateRequestDto,
|
||||||
|
} from "../model/rvw-mnpw-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_COMMON_SERVICE.RVW_MNPW;
|
||||||
|
|
||||||
|
function pkPath(atrzSeComCd: string, ognzSn: number, userUuid: string): string {
|
||||||
|
return `${BASE}/${atrzSeComCd}/${ognzSn}/${userUuid}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findPage(params: RvwMnpwMngSearchDto): Promise<PageResponse<RvwMnpwMngResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<RvwMnpwMngResponseDto>>(BASE, { params });
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(
|
||||||
|
atrzSeComCd: string,
|
||||||
|
ognzSn: number,
|
||||||
|
userUuid: string,
|
||||||
|
): Promise<RvwMnpwMngResponseDto> {
|
||||||
|
const response = await client.get<RvwMnpwMngResponseDto>(pkPath(atrzSeComCd, ognzSn, userUuid));
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(body: RvwMnpwMngSaveRequestDto): Promise<RvwMnpwMngResponseDto> {
|
||||||
|
const response = await client.post<RvwMnpwMngResponseDto>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(
|
||||||
|
atrzSeComCd: string,
|
||||||
|
ognzSn: number,
|
||||||
|
userUuid: string,
|
||||||
|
body: RvwMnpwMngUpdateRequestDto,
|
||||||
|
): Promise<RvwMnpwMngResponseDto> {
|
||||||
|
const response = await client.put<RvwMnpwMngResponseDto>(
|
||||||
|
pkPath(atrzSeComCd, ognzSn, userUuid),
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteRvwMnpw(
|
||||||
|
atrzSeComCd: string,
|
||||||
|
ognzSn: number,
|
||||||
|
userUuid: string,
|
||||||
|
): Promise<string> {
|
||||||
|
const response = await client.delete<string>(pkPath(atrzSeComCd, ognzSn, userUuid));
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const rvwMnpwMngService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
update,
|
||||||
|
delete: deleteRvwMnpw,
|
||||||
|
} satisfies RvwMnpwMngService;
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
export {
|
||||||
|
useDeleteRvwMnpwMng,
|
||||||
|
useRvwMnpwMng,
|
||||||
|
useRvwMnpwMngPage,
|
||||||
|
useSaveRvwMnpwMng,
|
||||||
|
useUpdateRvwMnpwMng,
|
||||||
|
} from "./api/queries";
|
||||||
|
export { rvwMnpwMngService } from "./api/rvw-mnpw-service";
|
||||||
|
export type {
|
||||||
|
RvwMnpwMngResponseDto,
|
||||||
|
RvwMnpwMngSaveRequestDto,
|
||||||
|
RvwMnpwMngSearchDto,
|
||||||
|
RvwMnpwMngService,
|
||||||
|
RvwMnpwMngUpdateRequestDto,
|
||||||
|
} from "./model/rvw-mnpw-interface";
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
/** 백엔드 RvwMnpwMngResponseDto */
|
||||||
|
export interface RvwMnpwMngResponseDto {
|
||||||
|
atrzSeComCd: string;
|
||||||
|
atrzSeComCdNm?: string;
|
||||||
|
ognzSn: number;
|
||||||
|
userUuid: string;
|
||||||
|
userUuidNm?: string;
|
||||||
|
ognzNm?: string;
|
||||||
|
jbpsSeNm?: string;
|
||||||
|
jbgdSeNm?: string;
|
||||||
|
rgtr?: string;
|
||||||
|
regDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 RvwMnpwMngSearchDto + Pageable */
|
||||||
|
export interface RvwMnpwMngSearchDto extends PageableParams {
|
||||||
|
atrzSeComCd?: string;
|
||||||
|
ognzSn?: number;
|
||||||
|
userUuid?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 RvwMnpwMngSaveRequestDto */
|
||||||
|
export interface RvwMnpwMngSaveRequestDto {
|
||||||
|
atrzSeComCd: string;
|
||||||
|
ognzSn: number;
|
||||||
|
userUuid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 RvwMnpwMngUpdateRequestDto */
|
||||||
|
export interface RvwMnpwMngUpdateRequestDto {
|
||||||
|
newAtrzSeComCd: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface RvwMnpwMngService {
|
||||||
|
findPage(params: RvwMnpwMngSearchDto): Promise<PageResponse<RvwMnpwMngResponseDto>>;
|
||||||
|
findById(atrzSeComCd: string, ognzSn: number, userUuid: string): Promise<RvwMnpwMngResponseDto>;
|
||||||
|
save(body: RvwMnpwMngSaveRequestDto): Promise<RvwMnpwMngResponseDto>;
|
||||||
|
update(
|
||||||
|
atrzSeComCd: string,
|
||||||
|
ognzSn: number,
|
||||||
|
userUuid: string,
|
||||||
|
body: RvwMnpwMngUpdateRequestDto,
|
||||||
|
): Promise<RvwMnpwMngResponseDto>;
|
||||||
|
delete(atrzSeComCd: string, ognzSn: number, userUuid: string): Promise<string>;
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ export interface OgnzUserTreeUserDto {
|
|||||||
userNm: string;
|
userNm: string;
|
||||||
jbpsSeCd: string;
|
jbpsSeCd: string;
|
||||||
jbgdSeCd: string;
|
jbgdSeCd: string;
|
||||||
|
jbpsSeNm: string;
|
||||||
|
jbgdSeNm: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** OgnzUserTreeResponseDto */
|
/** OgnzUserTreeResponseDto */
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { AcntgCodeManagementPage } from "./ui/acntg-code-management-page";
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
import type { AcntgSeMngResponseDto } from "@/entities/acntg";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
AcntgDisplaySlot,
|
||||||
|
AcntgSeBaseEntry,
|
||||||
|
AcntgSeGridState,
|
||||||
|
} from "../model/acntg-se-grid-types";
|
||||||
|
import type { AcntgSeRow } from "../model/acntg-se-row-types";
|
||||||
|
import { buildAcntgDisplayRows } from "../model/build-acntg-display-rows";
|
||||||
|
|
||||||
|
export function createLoadedRowKey(index: number, acntgSeCd: string): string {
|
||||||
|
return `loaded-${index}-${acntgSeCd}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createDraftRowKey(): string {
|
||||||
|
return `draft-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createEmptyGridState(): AcntgSeGridState {
|
||||||
|
return {
|
||||||
|
baseByKey: {},
|
||||||
|
structure: [],
|
||||||
|
drafts: {},
|
||||||
|
patches: {},
|
||||||
|
deletedKeys: new Set(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function toInitialRow(entry: AcntgSeBaseEntry): AcntgSeRow {
|
||||||
|
return {
|
||||||
|
...entry,
|
||||||
|
isNew: false,
|
||||||
|
isDirty: false,
|
||||||
|
isDeleted: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildStructureFromBaseRows(
|
||||||
|
baseByKey: Record<string, AcntgSeBaseEntry>,
|
||||||
|
): AcntgDisplaySlot[] {
|
||||||
|
const rows = Object.values(baseByKey).map(toInitialRow);
|
||||||
|
const display = buildAcntgDisplayRows(rows);
|
||||||
|
const cdToRowKey = new Map(rows.map((row) => [row.acntgSeCd, row.rowKey]));
|
||||||
|
|
||||||
|
return display.map(({ row, depth }) => ({
|
||||||
|
rowKey: row.rowKey,
|
||||||
|
depth,
|
||||||
|
parentRowKey: row.upAcntgSeCd?.trim() ? (cdToRowKey.get(row.upAcntgSeCd.trim()) ?? null) : null,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hydrateGridFromServer(content: AcntgSeMngResponseDto[]): AcntgSeGridState {
|
||||||
|
const baseByKey: Record<string, AcntgSeBaseEntry> = {};
|
||||||
|
|
||||||
|
content.forEach((item, index) => {
|
||||||
|
const rowKey = createLoadedRowKey(index, item.acntgSeCd);
|
||||||
|
baseByKey[rowKey] = { ...item, rowKey };
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
baseByKey,
|
||||||
|
structure: buildStructureFromBaseRows(baseByKey),
|
||||||
|
drafts: {},
|
||||||
|
patches: {},
|
||||||
|
deletedKeys: new Set(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveParentAcntgSeCd(
|
||||||
|
state: AcntgSeGridState,
|
||||||
|
parentRowKey: string | null,
|
||||||
|
): string | undefined {
|
||||||
|
if (!parentRowKey) return undefined;
|
||||||
|
const parent = mergeAcntgRow(state, parentRowKey);
|
||||||
|
const cd = parent?.acntgSeCd?.trim();
|
||||||
|
return cd || undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mergeAcntgRow(state: AcntgSeGridState, rowKey: string): AcntgSeRow | null {
|
||||||
|
const draft = state.drafts[rowKey];
|
||||||
|
if (draft) {
|
||||||
|
return {
|
||||||
|
rowKey,
|
||||||
|
acntgSeCd: draft.acntgSeCd,
|
||||||
|
acntgSeCdNm: draft.acntgSeCdNm,
|
||||||
|
expln: draft.expln,
|
||||||
|
useYn: draft.useYn,
|
||||||
|
cdLvNo: draft.cdLvNo,
|
||||||
|
upAcntgSeCd: resolveParentAcntgSeCd(state, draft.parentRowKey),
|
||||||
|
isNew: true,
|
||||||
|
isDirty: true,
|
||||||
|
isDeleted: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const base = state.baseByKey[rowKey];
|
||||||
|
if (!base) return null;
|
||||||
|
|
||||||
|
const patch = state.patches[rowKey] ?? {};
|
||||||
|
const hasPatch = Object.keys(patch).length > 0;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
...patch,
|
||||||
|
rowKey,
|
||||||
|
isNew: false,
|
||||||
|
isDirty: hasPatch,
|
||||||
|
isDeleted: state.deletedKeys.has(rowKey),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mergeAllAcntgRows(state: AcntgSeGridState): AcntgSeRow[] {
|
||||||
|
const keys = new Set([...Object.keys(state.baseByKey), ...Object.keys(state.drafts)]);
|
||||||
|
|
||||||
|
return [...keys]
|
||||||
|
.map((rowKey) => mergeAcntgRow(state, rowKey))
|
||||||
|
.filter((row): row is AcntgSeRow => row != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasAcntgGridPendingChanges(state: AcntgSeGridState): boolean {
|
||||||
|
return (
|
||||||
|
state.deletedKeys.size > 0 ||
|
||||||
|
Object.keys(state.drafts).length > 0 ||
|
||||||
|
Object.keys(state.patches).length > 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function collectDescendantRowKeys(
|
||||||
|
structure: AcntgDisplaySlot[],
|
||||||
|
rootRowKey: string,
|
||||||
|
): Set<string> {
|
||||||
|
const result = new Set<string>([rootRowKey]);
|
||||||
|
const queue = [rootRowKey];
|
||||||
|
|
||||||
|
while (queue.length > 0) {
|
||||||
|
const parentKey = queue.shift()!;
|
||||||
|
for (const slot of structure) {
|
||||||
|
if (slot.parentRowKey === parentKey && !result.has(slot.rowKey)) {
|
||||||
|
result.add(slot.rowKey);
|
||||||
|
queue.push(slot.rowKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertRootSlot(
|
||||||
|
structure: AcntgDisplaySlot[],
|
||||||
|
slot: AcntgDisplaySlot,
|
||||||
|
): AcntgDisplaySlot[] {
|
||||||
|
const firstRootIndex = structure.findIndex((item) => item.parentRowKey === null);
|
||||||
|
if (firstRootIndex === -1) return [slot, ...structure];
|
||||||
|
return [...structure.slice(0, firstRootIndex), slot, ...structure.slice(firstRootIndex)];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertChildSlot(
|
||||||
|
structure: AcntgDisplaySlot[],
|
||||||
|
parentRowKey: string,
|
||||||
|
slot: AcntgDisplaySlot,
|
||||||
|
): AcntgDisplaySlot[] {
|
||||||
|
const parentIndex = structure.findIndex((item) => item.rowKey === parentRowKey);
|
||||||
|
if (parentIndex === -1) return [...structure, slot];
|
||||||
|
|
||||||
|
const insertAt = parentIndex + 1;
|
||||||
|
return [...structure.slice(0, insertAt), slot, ...structure.slice(insertAt)];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeSlotsFromStructure(
|
||||||
|
structure: AcntgDisplaySlot[],
|
||||||
|
rowKeysToRemove: Set<string>,
|
||||||
|
): AcntgDisplaySlot[] {
|
||||||
|
return structure.filter((slot) => !rowKeysToRemove.has(slot.rowKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function patchAcntgGridRow(
|
||||||
|
state: AcntgSeGridState,
|
||||||
|
rowKey: string,
|
||||||
|
patch: Partial<AcntgSeRow>,
|
||||||
|
): AcntgSeGridState {
|
||||||
|
const draft = state.drafts[rowKey];
|
||||||
|
if (draft) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
drafts: {
|
||||||
|
...state.drafts,
|
||||||
|
[rowKey]: {
|
||||||
|
...draft,
|
||||||
|
...(patch.acntgSeCd !== undefined ? { acntgSeCd: patch.acntgSeCd } : {}),
|
||||||
|
...(patch.acntgSeCdNm !== undefined ? { acntgSeCdNm: patch.acntgSeCdNm ?? "" } : {}),
|
||||||
|
...(patch.expln !== undefined ? { expln: patch.expln ?? "" } : {}),
|
||||||
|
...(patch.useYn !== undefined ? { useYn: patch.useYn } : {}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const { rowKey: _rk, isNew: _n, isDirty: _d, isDeleted: _del, ...dtoPatch } = patch;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
patches: {
|
||||||
|
...state.patches,
|
||||||
|
[rowKey]: { ...state.patches[rowKey], ...dtoPatch },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function markAcntgRowsDeleted(
|
||||||
|
state: AcntgSeGridState,
|
||||||
|
rootRowKey: string,
|
||||||
|
): AcntgSeGridState {
|
||||||
|
const keysToDelete = collectDescendantRowKeys(state.structure, rootRowKey);
|
||||||
|
const deletedKeys = new Set(state.deletedKeys);
|
||||||
|
for (const key of keysToDelete) {
|
||||||
|
deletedKeys.add(key);
|
||||||
|
}
|
||||||
|
return { ...state, deletedKeys };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validateDraftParentAcntgSeCd(
|
||||||
|
state: AcntgSeGridState,
|
||||||
|
rowKey: string,
|
||||||
|
): string | null {
|
||||||
|
const draft = state.drafts[rowKey];
|
||||||
|
if (!draft?.parentRowKey) return null;
|
||||||
|
|
||||||
|
const parent = mergeAcntgRow(state, draft.parentRowKey);
|
||||||
|
if (!parent?.acntgSeCd?.trim()) {
|
||||||
|
return "하위 항목을 추가하려면 상위 코드를 먼저 입력하세요.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeDraftFromGrid(state: AcntgSeGridState, rowKey: string): AcntgSeGridState {
|
||||||
|
const { [rowKey]: _removed, ...restDrafts } = state.drafts;
|
||||||
|
const keysToRemove = collectDescendantRowKeys(state.structure, rowKey);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
drafts: restDrafts,
|
||||||
|
structure: removeSlotsFromStructure(state.structure, keysToRemove),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { ACNTG_SE_SAVE_MODE, type AcntgSeMngSaveRequestDto } from "@/entities/acntg";
|
||||||
|
|
||||||
|
import type { AcntgSeRow } from "../model/acntg-se-row-types";
|
||||||
|
|
||||||
|
import { getVisibleRows } from "./row-state";
|
||||||
|
|
||||||
|
function compareCdLvNoDesc(a: AcntgSeRow, b: AcntgSeRow): number {
|
||||||
|
return (b.cdLvNo ?? 1) - (a.cdLvNo ?? 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareCdLvNoAsc(a: AcntgSeRow, b: AcntgSeRow): number {
|
||||||
|
return (a.cdLvNo ?? 1) - (b.cdLvNo ?? 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildSaveMultiPayload(rows: AcntgSeRow[]): AcntgSeMngSaveRequestDto[] {
|
||||||
|
const payload: AcntgSeMngSaveRequestDto[] = [];
|
||||||
|
|
||||||
|
const deletedRows = rows.filter((row) => row.isDeleted && !row.isNew).sort(compareCdLvNoDesc);
|
||||||
|
|
||||||
|
for (const row of deletedRows) {
|
||||||
|
payload.push({
|
||||||
|
mode: ACNTG_SE_SAVE_MODE.DELETE,
|
||||||
|
acntgSeCd: row.acntgSeCd,
|
||||||
|
acntgSeCdNm: row.acntgSeCdNm?.trim() || "",
|
||||||
|
upAcntgSeCd: row.upAcntgSeCd,
|
||||||
|
cdLvNo: row.cdLvNo,
|
||||||
|
useYn: row.useYn,
|
||||||
|
expln: row.expln?.trim() || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const visibleRows = getVisibleRows(rows).sort(compareCdLvNoAsc);
|
||||||
|
|
||||||
|
for (const row of visibleRows) {
|
||||||
|
if (row.isNew) {
|
||||||
|
payload.push({
|
||||||
|
mode: ACNTG_SE_SAVE_MODE.CREATE,
|
||||||
|
acntgSeCd: row.acntgSeCd.trim(),
|
||||||
|
acntgSeCdNm: row.acntgSeCdNm.trim(),
|
||||||
|
upAcntgSeCd: row.upAcntgSeCd,
|
||||||
|
cdLvNo: row.cdLvNo,
|
||||||
|
useYn: row.useYn,
|
||||||
|
expln: row.expln?.trim() || undefined,
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.isDirty) {
|
||||||
|
payload.push({
|
||||||
|
mode: ACNTG_SE_SAVE_MODE.UPDATE,
|
||||||
|
acntgSeCd: row.acntgSeCd.trim(),
|
||||||
|
acntgSeCdNm: row.acntgSeCdNm.trim(),
|
||||||
|
upAcntgSeCd: row.upAcntgSeCd,
|
||||||
|
cdLvNo: row.cdLvNo,
|
||||||
|
useYn: row.useYn,
|
||||||
|
expln: row.expln?.trim() || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import type { AcntgSeRow } from "../model/acntg-se-row-types";
|
||||||
|
|
||||||
|
export function getVisibleRows(rows: AcntgSeRow[]): AcntgSeRow[] {
|
||||||
|
return rows.filter((row) => !row.isDeleted);
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
|
||||||
|
import type { AcntgSeMngResponseDto } from "@/entities/acntg";
|
||||||
|
|
||||||
|
import type { AcntgSeGridState } from "../model/acntg-se-grid-types";
|
||||||
|
import type { AcntgSeRow } from "../model/acntg-se-row-types";
|
||||||
|
|
||||||
|
import {
|
||||||
|
createDraftRowKey,
|
||||||
|
createEmptyGridState,
|
||||||
|
hasAcntgGridPendingChanges,
|
||||||
|
hydrateGridFromServer,
|
||||||
|
insertChildSlot,
|
||||||
|
insertRootSlot,
|
||||||
|
markAcntgRowsDeleted,
|
||||||
|
mergeAcntgRow,
|
||||||
|
mergeAllAcntgRows,
|
||||||
|
patchAcntgGridRow,
|
||||||
|
removeDraftFromGrid,
|
||||||
|
validateDraftParentAcntgSeCd,
|
||||||
|
} from "./acntg-se-grid";
|
||||||
|
import { buildSaveMultiPayload } from "./build-save-multi-payload";
|
||||||
|
|
||||||
|
function validateAcntgSeRow(row: AcntgSeRow): string | null {
|
||||||
|
if (!row.acntgSeCd.trim()) return "코드를 입력하세요.";
|
||||||
|
if (!row.acntgSeCdNm?.trim()) return "코드명을 입력하세요.";
|
||||||
|
const parentCd = row.upAcntgSeCd?.trim();
|
||||||
|
if (parentCd && row.acntgSeCd.trim() === parentCd) {
|
||||||
|
return "상위 코드와 동일한 코드는 사용할 수 없습니다.";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UseAcntgSeRowsOptions {
|
||||||
|
serverContent: AcntgSeMngResponseDto[] | undefined;
|
||||||
|
onAlert: (message: string) => void;
|
||||||
|
onSave: (payload: ReturnType<typeof buildSaveMultiPayload>) => Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAcntgSeRows({ serverContent, onAlert, onSave }: UseAcntgSeRowsOptions) {
|
||||||
|
const [grid, setGrid] = useState<AcntgSeGridState>(createEmptyGridState);
|
||||||
|
const hasPendingRef = useRef(false);
|
||||||
|
|
||||||
|
hasPendingRef.current = hasAcntgGridPendingChanges(grid);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (serverContent == null) return;
|
||||||
|
if (hasPendingRef.current) return;
|
||||||
|
setGrid(hydrateGridFromServer(serverContent));
|
||||||
|
}, [serverContent]);
|
||||||
|
|
||||||
|
const displayRows = useMemo(() => {
|
||||||
|
return grid.structure
|
||||||
|
.filter((slot) => !grid.deletedKeys.has(slot.rowKey))
|
||||||
|
.map((slot) => {
|
||||||
|
const row = mergeAcntgRow(grid, slot.rowKey);
|
||||||
|
return row ? { row, depth: slot.depth } : null;
|
||||||
|
})
|
||||||
|
.filter((item): item is { row: AcntgSeRow; depth: number } => item != null);
|
||||||
|
}, [grid]);
|
||||||
|
|
||||||
|
const canSave = hasAcntgGridPendingChanges(grid);
|
||||||
|
|
||||||
|
const updateRow = useCallback((rowKey: string, patch: Partial<AcntgSeRow>) => {
|
||||||
|
setGrid((prev) => patchAcntgGridRow(prev, rowKey, patch));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const addRootRow = useCallback(() => {
|
||||||
|
const rowKey = createDraftRowKey();
|
||||||
|
setGrid((prev) => ({
|
||||||
|
...prev,
|
||||||
|
drafts: {
|
||||||
|
...prev.drafts,
|
||||||
|
[rowKey]: {
|
||||||
|
rowKey,
|
||||||
|
parentRowKey: null,
|
||||||
|
cdLvNo: 1,
|
||||||
|
acntgSeCd: "",
|
||||||
|
acntgSeCdNm: "",
|
||||||
|
expln: "",
|
||||||
|
useYn: "Y",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
structure: insertRootSlot(prev.structure, { rowKey, depth: 0, parentRowKey: null }),
|
||||||
|
}));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const addChildRow = useCallback((parent: AcntgSeRow) => {
|
||||||
|
const rowKey = createDraftRowKey();
|
||||||
|
const slot = {
|
||||||
|
rowKey,
|
||||||
|
depth: 0,
|
||||||
|
parentRowKey: parent.rowKey,
|
||||||
|
};
|
||||||
|
|
||||||
|
setGrid((prev) => {
|
||||||
|
const parentSlot = prev.structure.find((item) => item.rowKey === parent.rowKey);
|
||||||
|
const depth = (parentSlot?.depth ?? 0) + 1;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...prev,
|
||||||
|
drafts: {
|
||||||
|
...prev.drafts,
|
||||||
|
[rowKey]: {
|
||||||
|
rowKey,
|
||||||
|
parentRowKey: parent.rowKey,
|
||||||
|
cdLvNo: (parent.cdLvNo ?? 1) + 1,
|
||||||
|
acntgSeCd: "",
|
||||||
|
acntgSeCdNm: "",
|
||||||
|
expln: "",
|
||||||
|
useYn: "Y",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
structure: insertChildSlot(prev.structure, parent.rowKey, {
|
||||||
|
...slot,
|
||||||
|
depth,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const removeDraft = useCallback((rowKey: string) => {
|
||||||
|
setGrid((prev) => removeDraftFromGrid(prev, rowKey));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const markDeleted = useCallback((rowKey: string) => {
|
||||||
|
setGrid((prev) => markAcntgRowsDeleted(prev, rowKey));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const resetFromServer = useCallback((content: AcntgSeMngResponseDto[]) => {
|
||||||
|
setGrid(hydrateGridFromServer(content));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const save = useCallback(async () => {
|
||||||
|
const mergedRows = mergeAllAcntgRows(grid);
|
||||||
|
const payload = buildSaveMultiPayload(mergedRows);
|
||||||
|
if (payload.length === 0) return false;
|
||||||
|
|
||||||
|
for (const row of mergedRows) {
|
||||||
|
if (!row.isDeleted && (row.isNew || row.isDirty)) {
|
||||||
|
const parentCodeError = validateDraftParentAcntgSeCd(grid, row.rowKey);
|
||||||
|
if (parentCodeError) {
|
||||||
|
onAlert(parentCodeError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldError = validateAcntgSeRow(row);
|
||||||
|
if (fieldError) {
|
||||||
|
onAlert(fieldError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await onSave(payload);
|
||||||
|
return true;
|
||||||
|
}, [grid, onAlert, onSave]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
displayRows,
|
||||||
|
canSave,
|
||||||
|
updateRow,
|
||||||
|
addRootRow,
|
||||||
|
addChildRow,
|
||||||
|
removeDraft,
|
||||||
|
markDeleted,
|
||||||
|
resetFromServer,
|
||||||
|
save,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import type { AcntgSeMngResponseDto } from "@/entities/acntg";
|
||||||
|
|
||||||
|
export interface AcntgDisplaySlot {
|
||||||
|
rowKey: string;
|
||||||
|
depth: number;
|
||||||
|
parentRowKey: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AcntgSeDraft {
|
||||||
|
rowKey: string;
|
||||||
|
parentRowKey: string | null;
|
||||||
|
cdLvNo: number;
|
||||||
|
acntgSeCd: string;
|
||||||
|
acntgSeCdNm: string;
|
||||||
|
expln: string;
|
||||||
|
useYn: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AcntgSeBaseEntry extends AcntgSeMngResponseDto {
|
||||||
|
rowKey: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AcntgSeGridState {
|
||||||
|
baseByKey: Record<string, AcntgSeBaseEntry>;
|
||||||
|
structure: AcntgDisplaySlot[];
|
||||||
|
drafts: Record<string, AcntgSeDraft>;
|
||||||
|
patches: Record<string, Partial<AcntgSeMngResponseDto>>;
|
||||||
|
deletedKeys: Set<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AcntgSeDisplayItem {
|
||||||
|
rowKey: string;
|
||||||
|
depth: number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import type { AcntgSeMngResponseDto } from "@/entities/acntg";
|
||||||
|
|
||||||
|
export interface AcntgSeRow extends AcntgSeMngResponseDto {
|
||||||
|
rowKey: string;
|
||||||
|
isNew: boolean;
|
||||||
|
isDirty: boolean;
|
||||||
|
isDeleted: boolean;
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import type { AcntgSeRow } from "./acntg-se-row-types";
|
||||||
|
|
||||||
|
export interface AcntgSeDisplayRow {
|
||||||
|
row: AcntgSeRow;
|
||||||
|
depth: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatCdLvNo(lvNo?: number): string {
|
||||||
|
return `${lvNo ?? 1}단계`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canAddChildRow(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatTreeBranchPrefix(depth: number): string {
|
||||||
|
if (depth <= 0) return "";
|
||||||
|
const vertical = "\u2502 ";
|
||||||
|
const branch = "\u251C\u2500";
|
||||||
|
return vertical.repeat(depth - 1) + branch;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRootRow(row: AcntgSeRow): boolean {
|
||||||
|
return (row.cdLvNo ?? 1) === 1 && !row.upAcntgSeCd?.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowOrderIndex(rows: AcntgSeRow[], row: AcntgSeRow): number {
|
||||||
|
return rows.findIndex((candidate) => candidate.rowKey === row.rowKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushDisplayRow(
|
||||||
|
result: AcntgSeDisplayRow[],
|
||||||
|
displayedRowKeys: Set<string>,
|
||||||
|
row: AcntgSeRow,
|
||||||
|
depth: number,
|
||||||
|
) {
|
||||||
|
if (displayedRowKeys.has(row.rowKey)) return;
|
||||||
|
displayedRowKeys.add(row.rowKey);
|
||||||
|
result.push({ row, depth });
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildAcntgDisplayRows(rows: AcntgSeRow[]): AcntgSeDisplayRow[] {
|
||||||
|
const result: AcntgSeDisplayRow[] = [];
|
||||||
|
const displayedRowKeys = new Set<string>();
|
||||||
|
|
||||||
|
const roots = rows.filter(isRootRow);
|
||||||
|
|
||||||
|
function appendSubtree(parent: AcntgSeRow, depth: number) {
|
||||||
|
const children = rows
|
||||||
|
.filter(
|
||||||
|
(row) =>
|
||||||
|
row.rowKey !== parent.rowKey &&
|
||||||
|
row.upAcntgSeCd != null &&
|
||||||
|
row.upAcntgSeCd === parent.acntgSeCd &&
|
||||||
|
row.acntgSeCd !== parent.acntgSeCd,
|
||||||
|
)
|
||||||
|
.sort((a, b) => rowOrderIndex(rows, a) - rowOrderIndex(rows, b));
|
||||||
|
|
||||||
|
for (const child of children) {
|
||||||
|
pushDisplayRow(result, displayedRowKeys, child, depth);
|
||||||
|
appendSubtree(child, depth + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const root of roots) {
|
||||||
|
pushDisplayRow(result, displayedRowKeys, root, 0);
|
||||||
|
appendSubtree(root, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const orphans = rows.filter((row) => !displayedRowKeys.has(row.rowKey));
|
||||||
|
|
||||||
|
for (const orphan of orphans) {
|
||||||
|
pushDisplayRow(result, displayedRowKeys, orphan, Math.max(0, (orphan.cdLvNo ?? 1) - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback } from "react";
|
||||||
|
|
||||||
|
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||||
|
|
||||||
|
import { useAlertStore } from "@/shared/lib";
|
||||||
|
import { useAcntgSeMngPage, useSaveMultiAcntgSeMng } from "@/entities/acntg";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Skeleton,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { useAcntgSeRows } from "../lib/use-acntg-se-rows";
|
||||||
|
import type { AcntgSeRow } from "../model/acntg-se-row-types";
|
||||||
|
|
||||||
|
import { AcntgSeRowComponent } from "./acntg-se-row";
|
||||||
|
|
||||||
|
function AcntgCodeManagementPage() {
|
||||||
|
const { confirm } = useConfirm();
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
|
||||||
|
const pageQuery = useAcntgSeMngPage({
|
||||||
|
page: 0,
|
||||||
|
size: 500,
|
||||||
|
sort: "cdLvNo,asc",
|
||||||
|
});
|
||||||
|
|
||||||
|
const saveMultiMutation = useSaveMultiAcntgSeMng();
|
||||||
|
|
||||||
|
const handlePersist = useCallback(
|
||||||
|
async (payload: Parameters<typeof saveMultiMutation.mutateAsync>[0]) => {
|
||||||
|
await saveMultiMutation.mutateAsync(payload);
|
||||||
|
},
|
||||||
|
[saveMultiMutation],
|
||||||
|
);
|
||||||
|
|
||||||
|
const {
|
||||||
|
displayRows,
|
||||||
|
canSave,
|
||||||
|
updateRow,
|
||||||
|
addRootRow,
|
||||||
|
addChildRow,
|
||||||
|
removeDraft,
|
||||||
|
markDeleted,
|
||||||
|
resetFromServer,
|
||||||
|
save,
|
||||||
|
} = useAcntgSeRows({
|
||||||
|
serverContent: pageQuery.data?.content,
|
||||||
|
onAlert: alert,
|
||||||
|
onSave: handlePersist,
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDelete = async (row: AcntgSeRow) => {
|
||||||
|
if (!(await confirm("삭제하시겠습니까?"))) return;
|
||||||
|
|
||||||
|
if (row.isNew) {
|
||||||
|
removeDraft(row.rowKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
markDeleted(row.rowKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSave = async () => {
|
||||||
|
if (!(await confirm("저장하시겠습니까?"))) return;
|
||||||
|
|
||||||
|
const saved = await save();
|
||||||
|
if (!saved) return;
|
||||||
|
|
||||||
|
alert("저장되었습니다.");
|
||||||
|
const result = await pageQuery.refetch();
|
||||||
|
resetFromServer(result.data?.content ?? []);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isSaving = saveMultiMutation.isPending;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 px-[1.8rem] pb-6">
|
||||||
|
<section className="card card-border mx-0 bg-background pb-6 pt-0">
|
||||||
|
<div className="card-header flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<h3 className="text-2xl font-semibold">회계코드 관리</h3>
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<Button type="button" color="green" onClick={addRootRow}>
|
||||||
|
코드 추가
|
||||||
|
</Button>
|
||||||
|
<Button type="button" disabled={!canSave || isSaving} onClick={handleSave}>
|
||||||
|
저장
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{pageQuery.isPending ? (
|
||||||
|
<div className="flex flex-col gap-2 px-4 pb-4">
|
||||||
|
<Skeleton className="h-[4rem]" />
|
||||||
|
<Skeleton className="h-[16rem]" />
|
||||||
|
</div>
|
||||||
|
) : displayRows.length === 0 ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
등록된 코드가 없습니다. [코드 추가]로 1단계 코드를 등록하세요.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<div className="max-h-[60rem] overflow-y-auto pt-3">
|
||||||
|
<Table className="w-full">
|
||||||
|
<colgroup>
|
||||||
|
<col width="15%" />
|
||||||
|
<col width="20%" />
|
||||||
|
<col width="35%" />
|
||||||
|
<col width="12%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="10%" />
|
||||||
|
</colgroup>
|
||||||
|
<TableHeader>
|
||||||
|
<TableRow>
|
||||||
|
<TableHead>코드</TableHead>
|
||||||
|
<TableHead>코드명</TableHead>
|
||||||
|
<TableHead>설명</TableHead>
|
||||||
|
<TableHead>사용 여부</TableHead>
|
||||||
|
<TableHead>구분</TableHead>
|
||||||
|
<TableHead>관리</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{displayRows.map(({ row, depth }) => (
|
||||||
|
<AcntgSeRowComponent
|
||||||
|
key={row.rowKey}
|
||||||
|
row={row}
|
||||||
|
depth={depth}
|
||||||
|
onChange={(patch) => updateRow(row.rowKey, patch)}
|
||||||
|
onAddChild={() => addChildRow(row)}
|
||||||
|
onDelete={() => handleDelete(row)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AcntgCodeManagementPage };
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Input,
|
||||||
|
Label,
|
||||||
|
RadioGroup,
|
||||||
|
RadioGroupItem,
|
||||||
|
TableCell,
|
||||||
|
TableRow,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import type { AcntgSeRow } from "../model/acntg-se-row-types";
|
||||||
|
import {
|
||||||
|
canAddChildRow,
|
||||||
|
formatCdLvNo,
|
||||||
|
formatTreeBranchPrefix,
|
||||||
|
} from "../model/build-acntg-display-rows";
|
||||||
|
|
||||||
|
interface AcntgSeRowProps {
|
||||||
|
row: AcntgSeRow;
|
||||||
|
depth: number;
|
||||||
|
onChange: (patch: Partial<AcntgSeRow>) => void;
|
||||||
|
onAddChild: () => void;
|
||||||
|
onDelete: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AcntgSeRowComponent({ row, depth, onChange, onAddChild, onDelete }: AcntgSeRowProps) {
|
||||||
|
const levelLabel = formatCdLvNo(row.cdLvNo);
|
||||||
|
const branchPrefix = formatTreeBranchPrefix(depth);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>
|
||||||
|
<div className="flex min-w-[10rem] items-center gap-1">
|
||||||
|
{branchPrefix ? (
|
||||||
|
<span className="shrink-0 font-mono text-muted">{branchPrefix}</span>
|
||||||
|
) : null}
|
||||||
|
<Input
|
||||||
|
value={row.acntgSeCd}
|
||||||
|
onChange={(e) => onChange({ acntgSeCd: e.target.value })}
|
||||||
|
placeholder="코드"
|
||||||
|
maxLength={10}
|
||||||
|
disabled={!row.isNew}
|
||||||
|
className="flex-1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Input
|
||||||
|
value={row.acntgSeCdNm ?? ""}
|
||||||
|
onChange={(e) => onChange({ acntgSeCdNm: e.target.value })}
|
||||||
|
placeholder="코드명"
|
||||||
|
maxLength={100}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Input
|
||||||
|
value={row.expln ?? ""}
|
||||||
|
onChange={(e) => onChange({ expln: e.target.value })}
|
||||||
|
placeholder="설명"
|
||||||
|
maxLength={1000}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<RadioGroup
|
||||||
|
value={row.useYn === "N" ? "N" : "Y"}
|
||||||
|
onValueChange={(v) => onChange({ useYn: v })}
|
||||||
|
className="flex justify-center gap-4"
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<RadioGroupItem value="Y" id={`${row.rowKey}-use-y`} />
|
||||||
|
<Label htmlFor={`${row.rowKey}-use-y`}>예</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<RadioGroupItem value="N" id={`${row.rowKey}-use-n`} />
|
||||||
|
<Label htmlFor={`${row.rowKey}-use-n`}>아니오</Label>
|
||||||
|
</div>
|
||||||
|
</RadioGroup>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">{levelLabel}</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<div className="flex justify-center gap-2">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
color="white"
|
||||||
|
disabled={!canAddChildRow()}
|
||||||
|
onClick={onAddChild}
|
||||||
|
>
|
||||||
|
하위추가
|
||||||
|
</Button>
|
||||||
|
<Button type="button" size="sm" color="gray" onClick={onDelete}>
|
||||||
|
삭제
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AcntgSeRowComponent };
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
import type { ElaprAplnRow } from "../model/apln-row-types";
|
import type { ElaprAplnRow } from "../model/apln-row-types";
|
||||||
|
|
||||||
export const ATRZ_RECEIVER_CD = "ATRZ00";
|
const ATRZ_RECEIVER_CD = "ATRZ01";
|
||||||
export const ATRZ_REVIEWER_1_CD = "ATRZ01";
|
const ATRZ_FINAL_CD = "ATRZ99";
|
||||||
export const ATRZ_REVIEWER_2_CD = "ATRZ02";
|
|
||||||
export const ATRZ_APPROVER_CD = "ATRZ03";
|
|
||||||
export const ATRZ_FINAL_CD = "ATRZ99";
|
|
||||||
|
|
||||||
export function getVisibleRows(rows: ElaprAplnRow[]): ElaprAplnRow[] {
|
export function getVisibleRows(rows: ElaprAplnRow[]): ElaprAplnRow[] {
|
||||||
return rows.filter((row) => !row.isDeleted);
|
return rows.filter((row) => !row.isDeleted);
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ export function createTmpltColumns({ onEdit, onDelete }: CreateTmpltColumnsOptio
|
|||||||
header: "관리",
|
header: "관리",
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div className="flex justify-center gap-2" onClick={(e) => e.stopPropagation()}>
|
<div className="flex justify-center gap-2" onClick={(e) => e.stopPropagation()}>
|
||||||
<Button type="button" size="sm" onClick={() => onEdit(row.original)}>
|
<Button type="button" size="sm" color="white" onClick={() => onEdit(row.original)}>
|
||||||
수정
|
수정
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" size="sm" color="red" onClick={() => onDelete(row.original)}>
|
<Button type="button" size="sm" color="gray" onClick={() => onDelete(row.original)}>
|
||||||
삭제
|
삭제
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OgnzUserTreeUserDto } from "@/entities/user-organization";
|
import type { RvwMnpwMngResponseDto } from "@/entities/rvw-mnpw";
|
||||||
|
|
||||||
export interface ReviewerOption {
|
export interface ReviewerOption {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
@@ -6,10 +6,10 @@ export interface ReviewerOption {
|
|||||||
deptNm: string;
|
deptNm: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toReviewerOption(user: OgnzUserTreeUserDto, ognzNm: string): ReviewerOption {
|
export function fromRvwMnpwMng(item: RvwMnpwMngResponseDto): ReviewerOption {
|
||||||
return {
|
return {
|
||||||
uuid: user.userUnqId,
|
uuid: item.userUuid,
|
||||||
name: user.userNm,
|
name: item.userUuidNm ?? "",
|
||||||
deptNm: ognzNm,
|
deptNm: item.ognzNm ?? "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useRvwMnpwMngPage } from "@/entities/rvw-mnpw";
|
||||||
|
|
||||||
import { useOgnzUserTree } from "@/entities/user-organization";
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -10,110 +8,109 @@ import {
|
|||||||
DialogFooter,
|
DialogFooter,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Input,
|
Skeleton,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
} from "@common/components";
|
} from "@common/components";
|
||||||
|
|
||||||
import { collectExpandedOgnzSnIds, filterOgnzUserTree } from "../lib/filter-ognz-user-tree";
|
import { fromRvwMnpwMng, type ReviewerOption } from "../model/reviewer-option";
|
||||||
import type { ReviewerOption } from "../model/reviewer-option";
|
|
||||||
|
|
||||||
import { OgnzUserTree } from "./ognz-user-tree";
|
const PAGE_SIZE = 500;
|
||||||
|
|
||||||
interface AprvrPickerDialogProps {
|
interface AprvrPickerDialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
|
atrzSeComCd: string;
|
||||||
onSelect: (reviewer: ReviewerOption) => void;
|
onSelect: (reviewer: ReviewerOption) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AprvrPickerDialog({ open, onOpenChange, onSelect }: AprvrPickerDialogProps) {
|
function AprvrPickerDialog({
|
||||||
const [keyword, setKeyword] = useState("");
|
open,
|
||||||
const [displayTree, setDisplayTree] = useState<ReturnType<typeof filterOgnzUserTree>>([]);
|
onOpenChange,
|
||||||
const [expandedOgnzSnIds, setExpandedOgnzSnIds] = useState<Set<number>>(new Set());
|
atrzSeComCd,
|
||||||
const [selectedUserId, setSelectedUserId] = useState<string>();
|
onSelect,
|
||||||
|
}: AprvrPickerDialogProps) {
|
||||||
|
const { data, isPending, isError } = useRvwMnpwMngPage(
|
||||||
|
{
|
||||||
|
atrzSeComCd,
|
||||||
|
page: 0,
|
||||||
|
size: PAGE_SIZE,
|
||||||
|
sort: "userUuidNm,asc",
|
||||||
|
},
|
||||||
|
{ enabled: open },
|
||||||
|
);
|
||||||
|
|
||||||
const { data, isPending, isError } = useOgnzUserTree({ enabled: open });
|
const items = data?.content ?? [];
|
||||||
|
|
||||||
const resetState = useCallback(() => {
|
const handleSelect = (item: (typeof items)[number]) => {
|
||||||
setKeyword("");
|
onSelect(fromRvwMnpwMng(item));
|
||||||
setSelectedUserId(undefined);
|
|
||||||
setExpandedOgnzSnIds(new Set());
|
|
||||||
setDisplayTree(data ?? []);
|
|
||||||
}, [data]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!open) {
|
|
||||||
setKeyword("");
|
|
||||||
setSelectedUserId(undefined);
|
|
||||||
setExpandedOgnzSnIds(new Set());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setDisplayTree(data ?? []);
|
|
||||||
}, [open, data]);
|
|
||||||
|
|
||||||
const handleToggle = (ognzSn: number, isExpanded: boolean) => {
|
|
||||||
setExpandedOgnzSnIds((prev) => {
|
|
||||||
const next = new Set(prev);
|
|
||||||
if (isExpanded) next.add(ognzSn);
|
|
||||||
else next.delete(ognzSn);
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
const filtered = filterOgnzUserTree(data ?? [], keyword);
|
|
||||||
setDisplayTree(filtered);
|
|
||||||
setExpandedOgnzSnIds(collectExpandedOgnzSnIds(filtered));
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleReset = () => {
|
|
||||||
resetState();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSelect = (reviewer: ReviewerOption) => {
|
|
||||||
setSelectedUserId(reviewer.uuid);
|
|
||||||
onSelect(reviewer);
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
<DialogContent className="max-w-[30rem]" aria-describedby={undefined}>
|
<DialogContent className="max-w-[56rem]" aria-describedby={undefined}>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>검토인력 선택</DialogTitle>
|
<DialogTitle>검토인력 선택</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="flex flex-col gap-4">
|
<div className="h-[36rem] overflow-auto">
|
||||||
<div className="card card-border !m-0 w-full">
|
{isPending ? (
|
||||||
<form onSubmit={handleSubmit} className="flex items-center gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<Input
|
<Skeleton className="h-[4rem]" />
|
||||||
className="h-[2.5rem] !text-[1.3rem]"
|
<Skeleton className="h-[16rem]" />
|
||||||
placeholder="성명·부서 검색"
|
</div>
|
||||||
value={keyword}
|
) : isError ? (
|
||||||
onChange={(e) => setKeyword(e.target.value)}
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
/>
|
검토인력 목록을 불러오지 못했습니다.
|
||||||
<Button type="submit" size="sm">
|
</p>
|
||||||
조회
|
) : items.length === 0 ? (
|
||||||
</Button>
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
<Button type="button" size="sm" color="white" onClick={handleReset}>
|
배치된 검토인력이 없습니다.
|
||||||
초기화
|
</p>
|
||||||
</Button>
|
) : (
|
||||||
</form>
|
<Table className="w-full">
|
||||||
</div>
|
<colgroup>
|
||||||
|
<col width="25%" />
|
||||||
<div className="h-[36rem] overflow-auto">
|
<col width="25%" />
|
||||||
<OgnzUserTree
|
<col width="15%" />
|
||||||
nodes={displayTree}
|
<col width="15%" />
|
||||||
isPending={isPending}
|
<col width="20%" />
|
||||||
isError={isError}
|
</colgroup>
|
||||||
expandedOgnzSnIds={expandedOgnzSnIds}
|
<TableHeader>
|
||||||
selectedUserId={selectedUserId}
|
<TableRow>
|
||||||
onToggle={handleToggle}
|
<TableHead>성명</TableHead>
|
||||||
onSelect={handleSelect}
|
<TableHead>부서</TableHead>
|
||||||
/>
|
<TableHead>직위</TableHead>
|
||||||
</div>
|
<TableHead>직급</TableHead>
|
||||||
|
<TableHead>선택</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{items.map((item) => (
|
||||||
|
<TableRow
|
||||||
|
key={`${item.atrzSeComCd}-${item.ognzSn}-${item.userUuid}`}
|
||||||
|
>
|
||||||
|
<TableCell align="center">
|
||||||
|
{item.userUuidNm || item.userUuid}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">{item.ognzNm || "-"}</TableCell>
|
||||||
|
<TableCell align="center">{item.jbpsSeNm || "-"}</TableCell>
|
||||||
|
<TableCell align="center">{item.jbgdSeNm || "-"}</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<Button type="button" size="sm" onClick={() => handleSelect(item)}>
|
||||||
|
선택
|
||||||
|
</Button>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ function ElaprAplnGrid({ elaprTmpltId }: ElaprAplnGridProps) {
|
|||||||
const isDisabled = !elaprTmpltId;
|
const isDisabled = !elaprTmpltId;
|
||||||
const serverRows = aplnQuery.data?.content ?? [];
|
const serverRows = aplnQuery.data?.content ?? [];
|
||||||
const canSave = hasUnsavedChanges(rows, serverRows);
|
const canSave = hasUnsavedChanges(rows, serverRows);
|
||||||
|
const pickingRow = pickingRowKey ? rows.find((r) => r.rowKey === pickingRowKey) : undefined;
|
||||||
|
|
||||||
const handleDragEnd = (event: DragEndEvent) => {
|
const handleDragEnd = (event: DragEndEvent) => {
|
||||||
const { active, over } = event;
|
const { active, over } = event;
|
||||||
@@ -151,11 +152,11 @@ function ElaprAplnGrid({ elaprTmpltId }: ElaprAplnGridProps) {
|
|||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
color="white"
|
color="green"
|
||||||
disabled={isDisabled || isEditingLocked}
|
disabled={isDisabled || isEditingLocked}
|
||||||
onClick={addRow}
|
onClick={addRow}
|
||||||
>
|
>
|
||||||
+ 결재선 추가
|
결재선 추가
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -236,6 +237,7 @@ function ElaprAplnGrid({ elaprTmpltId }: ElaprAplnGridProps) {
|
|||||||
<AprvrPickerDialog
|
<AprvrPickerDialog
|
||||||
open={pickerOpen}
|
open={pickerOpen}
|
||||||
onOpenChange={setPickerOpen}
|
onOpenChange={setPickerOpen}
|
||||||
|
atrzSeComCd={pickingRow?.atrzSeComCd ?? ""}
|
||||||
onSelect={handleReviewerSelect}
|
onSelect={handleReviewerSelect}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function ElaprTmpltList({ selectedTmpltId, onSelectTmplt }: ElaprTmpltListProps)
|
|||||||
<section className="card card-border mx-0 bg-background pt-0">
|
<section className="card card-border mx-0 bg-background pt-0">
|
||||||
<div className="card-header flex items-center justify-between">
|
<div className="card-header flex items-center justify-between">
|
||||||
<h3 className="text-2xl font-semibold">전자결재선 관리 목록</h3>
|
<h3 className="text-2xl font-semibold">전자결재선 관리 목록</h3>
|
||||||
<Button type="button" onClick={() => setDialogMode("create")}>
|
<Button type="button" color="green" onClick={() => setDialogMode("create")}>
|
||||||
서식 등록
|
서식 등록
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function SortableAplnRow({
|
|||||||
onChange,
|
onChange,
|
||||||
onPickAprvr,
|
onPickAprvr,
|
||||||
}: SortableAplnRowProps) {
|
}: SortableAplnRowProps) {
|
||||||
const { data: atrzSeCodes } = useCodeList("ATRZSECD");
|
const { data: atrzSeCodes } = useCodeList("ATRZSE");
|
||||||
|
|
||||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
||||||
id: row.rowKey,
|
id: row.rowKey,
|
||||||
@@ -50,7 +50,7 @@ function SortableAplnRow({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const rowDisabled = isLocked && !isEditing;
|
const rowDisabled = isLocked && !isEditing;
|
||||||
const atrzSeLabel = row.atrzSeComNm ?? findCodeLabel(atrzSeCodes, row.atrzSeComCd);
|
const atrzSeLabel = row.atrzSeComNm || findCodeLabel(atrzSeCodes, row.atrzSeComCd);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow ref={setNodeRef} style={style} className={isEditing ? "bg-accent/30" : undefined}>
|
<TableRow ref={setNodeRef} style={style} className={isEditing ? "bg-accent/30" : undefined}>
|
||||||
@@ -72,7 +72,7 @@ function SortableAplnRow({
|
|||||||
<TableCell align="center">
|
<TableCell align="center">
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
<CodeSelect
|
<CodeSelect
|
||||||
upCd="ATRZSECD"
|
upCd="ATRZSE"
|
||||||
className="min-w-[120px]"
|
className="min-w-[120px]"
|
||||||
value={row.atrzSeComCd ?? ""}
|
value={row.atrzSeComCd ?? ""}
|
||||||
onValueChange={(v) =>
|
onValueChange={(v) =>
|
||||||
@@ -111,10 +111,22 @@ function SortableAplnRow({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Button type="button" size="sm" disabled={rowDisabled} onClick={onStartEdit}>
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
color="white"
|
||||||
|
disabled={rowDisabled}
|
||||||
|
onClick={onStartEdit}
|
||||||
|
>
|
||||||
수정
|
수정
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" size="sm" color="red" disabled={rowDisabled} onClick={onDelete}>
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
color="gray"
|
||||||
|
disabled={rowDisabled}
|
||||||
|
onClick={onDelete}
|
||||||
|
>
|
||||||
삭제
|
삭제
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
|
||||||
import { LoginApi } from "@/entities/auth";
|
import { authService } from "@/entities/auth";
|
||||||
import { images } from "@common/assets";
|
import { images } from "@common/assets";
|
||||||
|
|
||||||
import "./login.css";
|
import "./login.css";
|
||||||
@@ -20,7 +20,7 @@ function LoginPage() {
|
|||||||
const password = formData.get("password") as string;
|
const password = formData.get("password") as string;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await LoginApi.login({ userId, password });
|
await authService.login({ userId, password });
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = error instanceof Error ? error.message : "로그인에 실패했습니다.";
|
const message = error instanceof Error ? error.message : "로그인에 실패했습니다.";
|
||||||
|
|||||||
@@ -20,28 +20,28 @@ export function createCklstArtclColumns({ onEdit, onDelete }: CreateCklstArtclCo
|
|||||||
}),
|
}),
|
||||||
columnHelper.accessor("cklstArtclNm", {
|
columnHelper.accessor("cklstArtclNm", {
|
||||||
header: "점검항목명",
|
header: "점검항목명",
|
||||||
cell: ({ getValue }) => getValue() ?? "—",
|
cell: ({ getValue }) => getValue() ?? "-",
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor("useYn", {
|
columnHelper.accessor("useYn", {
|
||||||
header: "사용여부",
|
header: "사용여부",
|
||||||
cell: ({ getValue }) => {
|
cell: ({ getValue }) => {
|
||||||
const value = getValue();
|
const value = getValue();
|
||||||
return value === "Y" ? "예" : value === "N" ? "아니오" : "—";
|
return value === "Y" ? "예" : value === "N" ? "아니오" : "-";
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor("regDt", {
|
columnHelper.accessor("regDt", {
|
||||||
header: "등록일시",
|
header: "등록일시",
|
||||||
cell: ({ getValue }) => getValue() ?? "—",
|
cell: ({ getValue }) => getValue() ?? "-",
|
||||||
}),
|
}),
|
||||||
columnHelper.display({
|
columnHelper.display({
|
||||||
id: "actions",
|
id: "actions",
|
||||||
header: "관리",
|
header: "관리",
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div className="flex justify-center gap-2">
|
<div className="flex justify-center gap-2">
|
||||||
<Button type="button" size="sm" onClick={() => onEdit(row.original)}>
|
<Button type="button" size="sm" color="white" onClick={() => onEdit(row.original)}>
|
||||||
관리
|
관리
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" size="sm" color="red" onClick={() => onDelete(row.original)}>
|
<Button type="button" size="sm" color="gray" onClick={() => onDelete(row.original)}>
|
||||||
삭제
|
삭제
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,32 +29,32 @@ export function createCklstMngColumns({ onEdit, onDelete }: CreateCklstMngColumn
|
|||||||
}),
|
}),
|
||||||
columnHelper.accessor("docSeComNm", {
|
columnHelper.accessor("docSeComNm", {
|
||||||
header: "문서구분",
|
header: "문서구분",
|
||||||
cell: ({ getValue, row }) => getValue() ?? row.original.docSeComCd ?? "—",
|
cell: ({ getValue, row }) => getValue() ?? row.original.docSeComCd ?? "-",
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor("taskSeCdNm", {
|
columnHelper.accessor("taskSeCdNm", {
|
||||||
header: "업무구분",
|
header: "업무구분",
|
||||||
cell: ({ getValue, row }) => getValue() ?? row.original.taskSeComCd ?? "—",
|
cell: ({ getValue, row }) => getValue() ?? row.original.taskSeComCd ?? "-",
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor("useYn", {
|
columnHelper.accessor("useYn", {
|
||||||
header: "사용여부",
|
header: "사용여부",
|
||||||
cell: ({ getValue }) => {
|
cell: ({ getValue }) => {
|
||||||
const value = getValue();
|
const value = getValue();
|
||||||
return value === "Y" ? "예" : value === "N" ? "아니오" : "—";
|
return value === "Y" ? "예" : value === "N" ? "아니오" : "-";
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor("regDt", {
|
columnHelper.accessor("regDt", {
|
||||||
header: "등록일시",
|
header: "등록일시",
|
||||||
cell: ({ getValue }) => getValue() ?? "—",
|
cell: ({ getValue }) => getValue() ?? "-",
|
||||||
}),
|
}),
|
||||||
columnHelper.display({
|
columnHelper.display({
|
||||||
id: "actions",
|
id: "actions",
|
||||||
header: "관리",
|
header: "관리",
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div className="flex justify-center gap-2" onClick={(e) => e.stopPropagation()}>
|
<div className="flex justify-center gap-2" onClick={(e) => e.stopPropagation()}>
|
||||||
<Button type="button" size="sm" onClick={() => onEdit(row.original)}>
|
<Button type="button" size="sm" color="white" onClick={() => onEdit(row.original)}>
|
||||||
관리
|
관리
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" size="sm" color="red" onClick={() => onDelete(row.original)}>
|
<Button type="button" size="sm" color="gray" onClick={() => onDelete(row.original)}>
|
||||||
삭제
|
삭제
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,7 +100,12 @@ function CklstArtclList({ cklstSn }: CklstArtclListProps) {
|
|||||||
<section className="card card-border mx-0 bg-background pt-0">
|
<section className="card card-border mx-0 bg-background pt-0">
|
||||||
<div className="card-header flex items-center justify-between">
|
<div className="card-header flex items-center justify-between">
|
||||||
<h3 className="text-2xl font-semibold">점검항목 관리</h3>
|
<h3 className="text-2xl font-semibold">점검항목 관리</h3>
|
||||||
<Button type="button" disabled={isDisabled} onClick={() => setDialogMode("create")}>
|
<Button
|
||||||
|
type="button"
|
||||||
|
color="green"
|
||||||
|
disabled={isDisabled}
|
||||||
|
onClick={() => setDialogMode("create")}
|
||||||
|
>
|
||||||
점검항목 추가
|
점검항목 추가
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ function CklstMngList({ selectedCklstSn, onSelectCklst }: CklstMngListProps) {
|
|||||||
<section className="card card-border mx-0 bg-background pt-0">
|
<section className="card card-border mx-0 bg-background pt-0">
|
||||||
<div className="card-header flex items-center justify-between">
|
<div className="card-header flex items-center justify-between">
|
||||||
<h3 className="text-2xl font-semibold">점검표 관리</h3>
|
<h3 className="text-2xl font-semibold">점검표 관리</h3>
|
||||||
<Button type="button" onClick={() => setDialogMode("create")}>
|
<Button type="button" color="green" onClick={() => setDialogMode("create")}>
|
||||||
점검표 추가
|
점검표 추가
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -248,8 +248,8 @@ function CklstRvwGrid({ selectedCklst }: CklstRvwGridProps) {
|
|||||||
>
|
>
|
||||||
미리보기
|
미리보기
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" color="white" disabled={isDisabled} onClick={addRootRow}>
|
<Button type="button" color="green" disabled={isDisabled} onClick={addRootRow}>
|
||||||
+ 체크리스트 추가
|
체크리스트 추가
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ function CklstRvwRowComponent({
|
|||||||
>
|
>
|
||||||
하위추가
|
하위추가
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" size="sm" color="red" onClick={onDelete}>
|
<Button type="button" size="sm" color="gray" onClick={onDelete}>
|
||||||
삭제
|
삭제
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { CnstpCodeManagementPage } from "./ui/cnstp-code-management-page";
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { CNSTP_SE_SAVE_MODE, type CnstpSeMngSaveRequestDto } from "@/entities/cnstp";
|
||||||
|
|
||||||
|
import type { CnstpSeRow } from "../model/cnstp-se-row-types";
|
||||||
|
|
||||||
|
import { getVisibleRows } from "./row-state";
|
||||||
|
|
||||||
|
function compareCdLvNoDesc(a: CnstpSeRow, b: CnstpSeRow): number {
|
||||||
|
return (b.cdLvNo ?? 1) - (a.cdLvNo ?? 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareCdLvNoAsc(a: CnstpSeRow, b: CnstpSeRow): number {
|
||||||
|
return (a.cdLvNo ?? 1) - (b.cdLvNo ?? 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildSaveMultiPayload(rows: CnstpSeRow[]): CnstpSeMngSaveRequestDto[] {
|
||||||
|
const payload: CnstpSeMngSaveRequestDto[] = [];
|
||||||
|
|
||||||
|
const deletedRows = rows.filter((row) => row.isDeleted && !row.isNew).sort(compareCdLvNoDesc);
|
||||||
|
|
||||||
|
for (const row of deletedRows) {
|
||||||
|
payload.push({
|
||||||
|
mode: CNSTP_SE_SAVE_MODE.DELETE,
|
||||||
|
cnstpSeCd: row.cnstpSeCd,
|
||||||
|
cnstpSeCdNm: row.cnstpSeCdNm?.trim() || undefined,
|
||||||
|
upCnstpCd: row.upCnstpCd,
|
||||||
|
cdLvNo: row.cdLvNo,
|
||||||
|
useYn: row.useYn,
|
||||||
|
expln: row.expln?.trim() || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const visibleRows = getVisibleRows(rows).sort(compareCdLvNoAsc);
|
||||||
|
|
||||||
|
for (const row of visibleRows) {
|
||||||
|
if (row.isNew) {
|
||||||
|
payload.push({
|
||||||
|
mode: CNSTP_SE_SAVE_MODE.CREATE,
|
||||||
|
cnstpSeCd: row.cnstpSeCd.trim(),
|
||||||
|
cnstpSeCdNm: row.cnstpSeCdNm?.trim() || undefined,
|
||||||
|
upCnstpCd: row.upCnstpCd,
|
||||||
|
cdLvNo: row.cdLvNo,
|
||||||
|
useYn: row.useYn,
|
||||||
|
expln: row.expln?.trim() || undefined,
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.isDirty) {
|
||||||
|
payload.push({
|
||||||
|
mode: CNSTP_SE_SAVE_MODE.UPDATE,
|
||||||
|
cnstpSeCd: row.cnstpSeCd.trim(),
|
||||||
|
cnstpSeCdNm: row.cnstpSeCdNm?.trim() || undefined,
|
||||||
|
upCnstpCd: row.upCnstpCd,
|
||||||
|
cdLvNo: row.cdLvNo,
|
||||||
|
useYn: row.useYn,
|
||||||
|
expln: row.expln?.trim() || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
import type { CnstpSeMngResponseDto } from "@/entities/cnstp";
|
||||||
|
|
||||||
|
import { buildCnstpDisplayRows } from "../model/build-cnstp-display-rows";
|
||||||
|
import type {
|
||||||
|
CnstpDisplaySlot,
|
||||||
|
CnstpSeBaseEntry,
|
||||||
|
CnstpSeGridState,
|
||||||
|
} from "../model/cnstp-se-grid-types";
|
||||||
|
import type { CnstpSeRow } from "../model/cnstp-se-row-types";
|
||||||
|
|
||||||
|
export function createLoadedRowKey(index: number, cnstpSeCd: string): string {
|
||||||
|
return `loaded-${index}-${cnstpSeCd}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createDraftRowKey(): string {
|
||||||
|
return `draft-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createEmptyGridState(): CnstpSeGridState {
|
||||||
|
return {
|
||||||
|
baseByKey: {},
|
||||||
|
structure: [],
|
||||||
|
drafts: {},
|
||||||
|
patches: {},
|
||||||
|
deletedKeys: new Set(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function toInitialRow(entry: CnstpSeBaseEntry): CnstpSeRow {
|
||||||
|
return {
|
||||||
|
...entry,
|
||||||
|
isNew: false,
|
||||||
|
isDirty: false,
|
||||||
|
isDeleted: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildStructureFromBaseRows(
|
||||||
|
baseByKey: Record<string, CnstpSeBaseEntry>,
|
||||||
|
): CnstpDisplaySlot[] {
|
||||||
|
const rows = Object.values(baseByKey).map(toInitialRow);
|
||||||
|
const display = buildCnstpDisplayRows(rows);
|
||||||
|
const cdToRowKey = new Map(rows.map((row) => [row.cnstpSeCd, row.rowKey]));
|
||||||
|
|
||||||
|
return display.map(({ row, depth }) => ({
|
||||||
|
rowKey: row.rowKey,
|
||||||
|
depth,
|
||||||
|
parentRowKey: row.upCnstpCd?.trim() ? (cdToRowKey.get(row.upCnstpCd.trim()) ?? null) : null,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hydrateGridFromServer(content: CnstpSeMngResponseDto[]): CnstpSeGridState {
|
||||||
|
const baseByKey: Record<string, CnstpSeBaseEntry> = {};
|
||||||
|
|
||||||
|
content.forEach((item, index) => {
|
||||||
|
const rowKey = createLoadedRowKey(index, item.cnstpSeCd);
|
||||||
|
baseByKey[rowKey] = { ...item, rowKey };
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
baseByKey,
|
||||||
|
structure: buildStructureFromBaseRows(baseByKey),
|
||||||
|
drafts: {},
|
||||||
|
patches: {},
|
||||||
|
deletedKeys: new Set(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveParentCnstpSeCd(
|
||||||
|
state: CnstpSeGridState,
|
||||||
|
parentRowKey: string | null,
|
||||||
|
): string | undefined {
|
||||||
|
if (!parentRowKey) return undefined;
|
||||||
|
const parent = mergeCnstpRow(state, parentRowKey);
|
||||||
|
const cd = parent?.cnstpSeCd?.trim();
|
||||||
|
return cd || undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mergeCnstpRow(state: CnstpSeGridState, rowKey: string): CnstpSeRow | null {
|
||||||
|
const draft = state.drafts[rowKey];
|
||||||
|
if (draft) {
|
||||||
|
return {
|
||||||
|
rowKey,
|
||||||
|
cnstpSeCd: draft.cnstpSeCd,
|
||||||
|
cnstpSeCdNm: draft.cnstpSeCdNm,
|
||||||
|
expln: draft.expln,
|
||||||
|
useYn: draft.useYn,
|
||||||
|
cdLvNo: draft.cdLvNo,
|
||||||
|
upCnstpCd: resolveParentCnstpSeCd(state, draft.parentRowKey),
|
||||||
|
isNew: true,
|
||||||
|
isDirty: true,
|
||||||
|
isDeleted: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const base = state.baseByKey[rowKey];
|
||||||
|
if (!base) return null;
|
||||||
|
|
||||||
|
const patch = state.patches[rowKey] ?? {};
|
||||||
|
const hasPatch = Object.keys(patch).length > 0;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
...patch,
|
||||||
|
rowKey,
|
||||||
|
isNew: false,
|
||||||
|
isDirty: hasPatch,
|
||||||
|
isDeleted: state.deletedKeys.has(rowKey),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mergeAllCnstpRows(state: CnstpSeGridState): CnstpSeRow[] {
|
||||||
|
const keys = new Set([...Object.keys(state.baseByKey), ...Object.keys(state.drafts)]);
|
||||||
|
|
||||||
|
return [...keys]
|
||||||
|
.map((rowKey) => mergeCnstpRow(state, rowKey))
|
||||||
|
.filter((row): row is CnstpSeRow => row != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasCnstpGridPendingChanges(state: CnstpSeGridState): boolean {
|
||||||
|
return (
|
||||||
|
state.deletedKeys.size > 0 ||
|
||||||
|
Object.keys(state.drafts).length > 0 ||
|
||||||
|
Object.keys(state.patches).length > 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function collectDescendantRowKeys(
|
||||||
|
structure: CnstpDisplaySlot[],
|
||||||
|
rootRowKey: string,
|
||||||
|
): Set<string> {
|
||||||
|
const result = new Set<string>([rootRowKey]);
|
||||||
|
const queue = [rootRowKey];
|
||||||
|
|
||||||
|
while (queue.length > 0) {
|
||||||
|
const parentKey = queue.shift()!;
|
||||||
|
for (const slot of structure) {
|
||||||
|
if (slot.parentRowKey === parentKey && !result.has(slot.rowKey)) {
|
||||||
|
result.add(slot.rowKey);
|
||||||
|
queue.push(slot.rowKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertRootSlot(
|
||||||
|
structure: CnstpDisplaySlot[],
|
||||||
|
slot: CnstpDisplaySlot,
|
||||||
|
): CnstpDisplaySlot[] {
|
||||||
|
const firstRootIndex = structure.findIndex((item) => item.parentRowKey === null);
|
||||||
|
if (firstRootIndex === -1) return [slot, ...structure];
|
||||||
|
return [...structure.slice(0, firstRootIndex), slot, ...structure.slice(firstRootIndex)];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertChildSlot(
|
||||||
|
structure: CnstpDisplaySlot[],
|
||||||
|
parentRowKey: string,
|
||||||
|
slot: CnstpDisplaySlot,
|
||||||
|
): CnstpDisplaySlot[] {
|
||||||
|
const parentIndex = structure.findIndex((item) => item.rowKey === parentRowKey);
|
||||||
|
if (parentIndex === -1) return [...structure, slot];
|
||||||
|
|
||||||
|
const insertAt = parentIndex + 1;
|
||||||
|
return [...structure.slice(0, insertAt), slot, ...structure.slice(insertAt)];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeSlotsFromStructure(
|
||||||
|
structure: CnstpDisplaySlot[],
|
||||||
|
rowKeysToRemove: Set<string>,
|
||||||
|
): CnstpDisplaySlot[] {
|
||||||
|
return structure.filter((slot) => !rowKeysToRemove.has(slot.rowKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function patchCnstpGridRow(
|
||||||
|
state: CnstpSeGridState,
|
||||||
|
rowKey: string,
|
||||||
|
patch: Partial<CnstpSeRow>,
|
||||||
|
): CnstpSeGridState {
|
||||||
|
const draft = state.drafts[rowKey];
|
||||||
|
if (draft) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
drafts: {
|
||||||
|
...state.drafts,
|
||||||
|
[rowKey]: {
|
||||||
|
...draft,
|
||||||
|
...(patch.cnstpSeCd !== undefined ? { cnstpSeCd: patch.cnstpSeCd } : {}),
|
||||||
|
...(patch.cnstpSeCdNm !== undefined ? { cnstpSeCdNm: patch.cnstpSeCdNm ?? "" } : {}),
|
||||||
|
...(patch.expln !== undefined ? { expln: patch.expln ?? "" } : {}),
|
||||||
|
...(patch.useYn !== undefined ? { useYn: patch.useYn } : {}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const { rowKey: _rk, isNew: _n, isDirty: _d, isDeleted: _del, ...dtoPatch } = patch;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
patches: {
|
||||||
|
...state.patches,
|
||||||
|
[rowKey]: { ...state.patches[rowKey], ...dtoPatch },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function markCnstpRowsDeleted(
|
||||||
|
state: CnstpSeGridState,
|
||||||
|
rootRowKey: string,
|
||||||
|
): CnstpSeGridState {
|
||||||
|
const keysToDelete = collectDescendantRowKeys(state.structure, rootRowKey);
|
||||||
|
const deletedKeys = new Set(state.deletedKeys);
|
||||||
|
for (const key of keysToDelete) {
|
||||||
|
deletedKeys.add(key);
|
||||||
|
}
|
||||||
|
return { ...state, deletedKeys };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validateDraftParentCnstpSeCd(
|
||||||
|
state: CnstpSeGridState,
|
||||||
|
rowKey: string,
|
||||||
|
): string | null {
|
||||||
|
const draft = state.drafts[rowKey];
|
||||||
|
if (!draft?.parentRowKey) return null;
|
||||||
|
|
||||||
|
const parent = mergeCnstpRow(state, draft.parentRowKey);
|
||||||
|
if (!parent?.cnstpSeCd?.trim()) {
|
||||||
|
return "하위 항목을 추가하려면 상위 코드를 먼저 입력하세요.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeDraftFromGrid(state: CnstpSeGridState, rowKey: string): CnstpSeGridState {
|
||||||
|
const { [rowKey]: _removed, ...restDrafts } = state.drafts;
|
||||||
|
const keysToRemove = collectDescendantRowKeys(state.structure, rowKey);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
drafts: restDrafts,
|
||||||
|
structure: removeSlotsFromStructure(state.structure, keysToRemove),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import type { CnstpSeRow } from "../model/cnstp-se-row-types";
|
||||||
|
|
||||||
|
export function getVisibleRows(rows: CnstpSeRow[]): CnstpSeRow[] {
|
||||||
|
return rows.filter((row) => !row.isDeleted);
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
|
||||||
|
import type { CnstpSeMngResponseDto } from "@/entities/cnstp";
|
||||||
|
|
||||||
|
import type { CnstpSeGridState } from "../model/cnstp-se-grid-types";
|
||||||
|
import type { CnstpSeRow } from "../model/cnstp-se-row-types";
|
||||||
|
|
||||||
|
import { buildSaveMultiPayload } from "./build-save-multi-payload";
|
||||||
|
import {
|
||||||
|
createDraftRowKey,
|
||||||
|
createEmptyGridState,
|
||||||
|
hasCnstpGridPendingChanges,
|
||||||
|
hydrateGridFromServer,
|
||||||
|
insertChildSlot,
|
||||||
|
insertRootSlot,
|
||||||
|
markCnstpRowsDeleted,
|
||||||
|
mergeAllCnstpRows,
|
||||||
|
mergeCnstpRow,
|
||||||
|
patchCnstpGridRow,
|
||||||
|
removeDraftFromGrid,
|
||||||
|
validateDraftParentCnstpSeCd,
|
||||||
|
} from "./cnstp-se-grid";
|
||||||
|
|
||||||
|
function validateCnstpSeRow(row: CnstpSeRow): string | null {
|
||||||
|
if (!row.cnstpSeCd.trim()) return "코드를 입력하세요.";
|
||||||
|
const parentCd = row.upCnstpCd?.trim();
|
||||||
|
if (parentCd && row.cnstpSeCd.trim() === parentCd) {
|
||||||
|
return "상위 코드와 동일한 코드는 사용할 수 없습니다.";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UseCnstpSeRowsOptions {
|
||||||
|
serverContent: CnstpSeMngResponseDto[] | undefined;
|
||||||
|
onAlert: (message: string) => void;
|
||||||
|
onSave: (payload: ReturnType<typeof buildSaveMultiPayload>) => Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCnstpSeRows({ serverContent, onAlert, onSave }: UseCnstpSeRowsOptions) {
|
||||||
|
const [grid, setGrid] = useState<CnstpSeGridState>(createEmptyGridState);
|
||||||
|
const hasPendingRef = useRef(false);
|
||||||
|
|
||||||
|
hasPendingRef.current = hasCnstpGridPendingChanges(grid);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (serverContent == null) return;
|
||||||
|
if (hasPendingRef.current) return;
|
||||||
|
setGrid(hydrateGridFromServer(serverContent));
|
||||||
|
}, [serverContent]);
|
||||||
|
|
||||||
|
const displayRows = useMemo(() => {
|
||||||
|
return grid.structure
|
||||||
|
.filter((slot) => !grid.deletedKeys.has(slot.rowKey))
|
||||||
|
.map((slot) => {
|
||||||
|
const row = mergeCnstpRow(grid, slot.rowKey);
|
||||||
|
return row ? { row, depth: slot.depth } : null;
|
||||||
|
})
|
||||||
|
.filter((item): item is { row: CnstpSeRow; depth: number } => item != null);
|
||||||
|
}, [grid]);
|
||||||
|
|
||||||
|
const canSave = hasCnstpGridPendingChanges(grid);
|
||||||
|
|
||||||
|
const updateRow = useCallback((rowKey: string, patch: Partial<CnstpSeRow>) => {
|
||||||
|
setGrid((prev) => patchCnstpGridRow(prev, rowKey, patch));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const addRootRow = useCallback(() => {
|
||||||
|
const rowKey = createDraftRowKey();
|
||||||
|
setGrid((prev) => ({
|
||||||
|
...prev,
|
||||||
|
drafts: {
|
||||||
|
...prev.drafts,
|
||||||
|
[rowKey]: {
|
||||||
|
rowKey,
|
||||||
|
parentRowKey: null,
|
||||||
|
cdLvNo: 1,
|
||||||
|
cnstpSeCd: "",
|
||||||
|
cnstpSeCdNm: "",
|
||||||
|
expln: "",
|
||||||
|
useYn: "Y",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
structure: insertRootSlot(prev.structure, { rowKey, depth: 0, parentRowKey: null }),
|
||||||
|
}));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const addChildRow = useCallback((parent: CnstpSeRow) => {
|
||||||
|
const rowKey = createDraftRowKey();
|
||||||
|
|
||||||
|
setGrid((prev) => {
|
||||||
|
const parentSlot = prev.structure.find((item) => item.rowKey === parent.rowKey);
|
||||||
|
const depth = (parentSlot?.depth ?? 0) + 1;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...prev,
|
||||||
|
drafts: {
|
||||||
|
...prev.drafts,
|
||||||
|
[rowKey]: {
|
||||||
|
rowKey,
|
||||||
|
parentRowKey: parent.rowKey,
|
||||||
|
cdLvNo: (parent.cdLvNo ?? 1) + 1,
|
||||||
|
cnstpSeCd: "",
|
||||||
|
cnstpSeCdNm: "",
|
||||||
|
expln: "",
|
||||||
|
useYn: "Y",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
structure: insertChildSlot(prev.structure, parent.rowKey, {
|
||||||
|
rowKey,
|
||||||
|
depth,
|
||||||
|
parentRowKey: parent.rowKey,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const removeDraft = useCallback((rowKey: string) => {
|
||||||
|
setGrid((prev) => removeDraftFromGrid(prev, rowKey));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const markDeleted = useCallback((rowKey: string) => {
|
||||||
|
setGrid((prev) => markCnstpRowsDeleted(prev, rowKey));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const resetFromServer = useCallback((content: CnstpSeMngResponseDto[]) => {
|
||||||
|
setGrid(hydrateGridFromServer(content));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const save = useCallback(async () => {
|
||||||
|
const mergedRows = mergeAllCnstpRows(grid);
|
||||||
|
const payload = buildSaveMultiPayload(mergedRows);
|
||||||
|
if (payload.length === 0) return false;
|
||||||
|
|
||||||
|
for (const row of mergedRows) {
|
||||||
|
if (!row.isDeleted && (row.isNew || row.isDirty)) {
|
||||||
|
const parentCodeError = validateDraftParentCnstpSeCd(grid, row.rowKey);
|
||||||
|
if (parentCodeError) {
|
||||||
|
onAlert(parentCodeError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldError = validateCnstpSeRow(row);
|
||||||
|
if (fieldError) {
|
||||||
|
onAlert(fieldError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await onSave(payload);
|
||||||
|
return true;
|
||||||
|
}, [grid, onAlert, onSave]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
displayRows,
|
||||||
|
canSave,
|
||||||
|
updateRow,
|
||||||
|
addRootRow,
|
||||||
|
addChildRow,
|
||||||
|
removeDraft,
|
||||||
|
markDeleted,
|
||||||
|
resetFromServer,
|
||||||
|
save,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import type { CnstpSeRow } from "./cnstp-se-row-types";
|
||||||
|
|
||||||
|
export interface CnstpSeDisplayRow {
|
||||||
|
row: CnstpSeRow;
|
||||||
|
depth: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatCdLvNo(lvNo?: number): string {
|
||||||
|
return `${lvNo ?? 1}단계`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canAddChildRow(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatTreeBranchPrefix(depth: number): string {
|
||||||
|
if (depth <= 0) return "";
|
||||||
|
const vertical = "\u2502 ";
|
||||||
|
const branch = "\u251C\u2500";
|
||||||
|
return vertical.repeat(depth - 1) + branch;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRootRow(row: CnstpSeRow): boolean {
|
||||||
|
return (row.cdLvNo ?? 1) === 1 && !row.upCnstpCd?.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowOrderIndex(rows: CnstpSeRow[], row: CnstpSeRow): number {
|
||||||
|
return rows.findIndex((candidate) => candidate.rowKey === row.rowKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushDisplayRow(
|
||||||
|
result: CnstpSeDisplayRow[],
|
||||||
|
displayedRowKeys: Set<string>,
|
||||||
|
row: CnstpSeRow,
|
||||||
|
depth: number,
|
||||||
|
) {
|
||||||
|
if (displayedRowKeys.has(row.rowKey)) return;
|
||||||
|
displayedRowKeys.add(row.rowKey);
|
||||||
|
result.push({ row, depth });
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildCnstpDisplayRows(rows: CnstpSeRow[]): CnstpSeDisplayRow[] {
|
||||||
|
const result: CnstpSeDisplayRow[] = [];
|
||||||
|
const displayedRowKeys = new Set<string>();
|
||||||
|
|
||||||
|
const roots = rows.filter(isRootRow);
|
||||||
|
|
||||||
|
function appendSubtree(parent: CnstpSeRow, depth: number) {
|
||||||
|
const children = rows
|
||||||
|
.filter(
|
||||||
|
(row) =>
|
||||||
|
row.rowKey !== parent.rowKey &&
|
||||||
|
row.upCnstpCd != null &&
|
||||||
|
row.upCnstpCd === parent.cnstpSeCd &&
|
||||||
|
row.cnstpSeCd !== parent.cnstpSeCd,
|
||||||
|
)
|
||||||
|
.sort((a, b) => rowOrderIndex(rows, a) - rowOrderIndex(rows, b));
|
||||||
|
|
||||||
|
for (const child of children) {
|
||||||
|
pushDisplayRow(result, displayedRowKeys, child, depth);
|
||||||
|
appendSubtree(child, depth + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const root of roots) {
|
||||||
|
pushDisplayRow(result, displayedRowKeys, root, 0);
|
||||||
|
appendSubtree(root, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const orphans = rows.filter((row) => !displayedRowKeys.has(row.rowKey));
|
||||||
|
|
||||||
|
for (const orphan of orphans) {
|
||||||
|
pushDisplayRow(result, displayedRowKeys, orphan, Math.max(0, (orphan.cdLvNo ?? 1) - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import type { CnstpSeMngResponseDto } from "@/entities/cnstp";
|
||||||
|
|
||||||
|
export interface CnstpDisplaySlot {
|
||||||
|
rowKey: string;
|
||||||
|
depth: number;
|
||||||
|
parentRowKey: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CnstpSeDraft {
|
||||||
|
rowKey: string;
|
||||||
|
parentRowKey: string | null;
|
||||||
|
cdLvNo: number;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
cnstpSeCdNm: string;
|
||||||
|
expln: string;
|
||||||
|
useYn: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CnstpSeBaseEntry extends CnstpSeMngResponseDto {
|
||||||
|
rowKey: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CnstpSeGridState {
|
||||||
|
baseByKey: Record<string, CnstpSeBaseEntry>;
|
||||||
|
structure: CnstpDisplaySlot[];
|
||||||
|
drafts: Record<string, CnstpSeDraft>;
|
||||||
|
patches: Record<string, Partial<CnstpSeMngResponseDto>>;
|
||||||
|
deletedKeys: Set<string>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import type { CnstpSeMngResponseDto } from "@/entities/cnstp";
|
||||||
|
|
||||||
|
export interface CnstpSeRow extends CnstpSeMngResponseDto {
|
||||||
|
rowKey: string;
|
||||||
|
isNew: boolean;
|
||||||
|
isDirty: boolean;
|
||||||
|
isDeleted: boolean;
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback } from "react";
|
||||||
|
|
||||||
|
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||||
|
|
||||||
|
import { useAlertStore } from "@/shared/lib";
|
||||||
|
import { useCnstpSeMngPage, useSaveMultiCnstpSeMng } from "@/entities/cnstp";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Skeleton,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { useCnstpSeRows } from "../lib/use-cnstp-se-rows";
|
||||||
|
import type { CnstpSeRow } from "../model/cnstp-se-row-types";
|
||||||
|
|
||||||
|
import { CnstpSeRowComponent } from "./cnstp-se-row";
|
||||||
|
|
||||||
|
function CnstpCodeManagementPage() {
|
||||||
|
const { confirm } = useConfirm();
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
|
||||||
|
const pageQuery = useCnstpSeMngPage({
|
||||||
|
page: 0,
|
||||||
|
size: 500,
|
||||||
|
sort: "cdLvNo,asc",
|
||||||
|
});
|
||||||
|
|
||||||
|
const saveMultiMutation = useSaveMultiCnstpSeMng();
|
||||||
|
|
||||||
|
const handlePersist = useCallback(
|
||||||
|
async (payload: Parameters<typeof saveMultiMutation.mutateAsync>[0]) => {
|
||||||
|
await saveMultiMutation.mutateAsync(payload);
|
||||||
|
},
|
||||||
|
[saveMultiMutation],
|
||||||
|
);
|
||||||
|
|
||||||
|
const {
|
||||||
|
displayRows,
|
||||||
|
canSave,
|
||||||
|
updateRow,
|
||||||
|
addRootRow,
|
||||||
|
addChildRow,
|
||||||
|
removeDraft,
|
||||||
|
markDeleted,
|
||||||
|
resetFromServer,
|
||||||
|
save,
|
||||||
|
} = useCnstpSeRows({
|
||||||
|
serverContent: pageQuery.data?.content,
|
||||||
|
onAlert: alert,
|
||||||
|
onSave: handlePersist,
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDelete = async (row: CnstpSeRow) => {
|
||||||
|
if (!(await confirm("삭제하시겠습니까?"))) return;
|
||||||
|
|
||||||
|
if (row.isNew) {
|
||||||
|
removeDraft(row.rowKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
markDeleted(row.rowKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSave = async () => {
|
||||||
|
if (!(await confirm("저장하시겠습니까?"))) return;
|
||||||
|
|
||||||
|
const saved = await save();
|
||||||
|
if (!saved) return;
|
||||||
|
|
||||||
|
alert("저장되었습니다.");
|
||||||
|
const result = await pageQuery.refetch();
|
||||||
|
resetFromServer(result.data?.content ?? []);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isSaving = saveMultiMutation.isPending;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 px-[1.8rem] pb-6">
|
||||||
|
<section className="card card-border mx-0 bg-background pb-6 pt-0">
|
||||||
|
<div className="card-header flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<h3 className="text-2xl font-semibold">공종코드 관리</h3>
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<Button type="button" color="green" onClick={addRootRow}>
|
||||||
|
코드 추가
|
||||||
|
</Button>
|
||||||
|
<Button type="button" disabled={!canSave || isSaving} onClick={handleSave}>
|
||||||
|
저장
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{pageQuery.isPending ? (
|
||||||
|
<div className="flex flex-col gap-2 px-4 pb-4">
|
||||||
|
<Skeleton className="h-[4rem]" />
|
||||||
|
<Skeleton className="h-[16rem]" />
|
||||||
|
</div>
|
||||||
|
) : displayRows.length === 0 ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
등록된 코드가 없습니다. [코드 추가]로 1단계 코드를 등록하세요.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<div className="max-h-[60rem] overflow-y-auto pt-3">
|
||||||
|
<Table className="w-full">
|
||||||
|
<colgroup>
|
||||||
|
<col width="15%" />
|
||||||
|
<col width="20%" />
|
||||||
|
<col width="35%" />
|
||||||
|
<col width="12%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="10%" />
|
||||||
|
</colgroup>
|
||||||
|
<TableHeader>
|
||||||
|
<TableRow>
|
||||||
|
<TableHead>코드</TableHead>
|
||||||
|
<TableHead>코드명</TableHead>
|
||||||
|
<TableHead>설명</TableHead>
|
||||||
|
<TableHead>사용 여부</TableHead>
|
||||||
|
<TableHead>구분</TableHead>
|
||||||
|
<TableHead>관리</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{displayRows.map(({ row, depth }) => (
|
||||||
|
<CnstpSeRowComponent
|
||||||
|
key={row.rowKey}
|
||||||
|
row={row}
|
||||||
|
depth={depth}
|
||||||
|
onChange={(patch) => updateRow(row.rowKey, patch)}
|
||||||
|
onAddChild={() => addChildRow(row)}
|
||||||
|
onDelete={() => handleDelete(row)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CnstpCodeManagementPage };
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Input,
|
||||||
|
Label,
|
||||||
|
RadioGroup,
|
||||||
|
RadioGroupItem,
|
||||||
|
TableCell,
|
||||||
|
TableRow,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import {
|
||||||
|
canAddChildRow,
|
||||||
|
formatCdLvNo,
|
||||||
|
formatTreeBranchPrefix,
|
||||||
|
} from "../model/build-cnstp-display-rows";
|
||||||
|
import type { CnstpSeRow } from "../model/cnstp-se-row-types";
|
||||||
|
|
||||||
|
interface CnstpSeRowProps {
|
||||||
|
row: CnstpSeRow;
|
||||||
|
depth: number;
|
||||||
|
onChange: (patch: Partial<CnstpSeRow>) => void;
|
||||||
|
onAddChild: () => void;
|
||||||
|
onDelete: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CnstpSeRowComponent({ row, depth, onChange, onAddChild, onDelete }: CnstpSeRowProps) {
|
||||||
|
const levelLabel = formatCdLvNo(row.cdLvNo);
|
||||||
|
const branchPrefix = formatTreeBranchPrefix(depth);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>
|
||||||
|
<div className="flex min-w-[10rem] items-center gap-1">
|
||||||
|
{branchPrefix ? (
|
||||||
|
<span className="shrink-0 font-mono text-muted">{branchPrefix}</span>
|
||||||
|
) : null}
|
||||||
|
<Input
|
||||||
|
value={row.cnstpSeCd}
|
||||||
|
onChange={(e) => onChange({ cnstpSeCd: e.target.value })}
|
||||||
|
placeholder="코드"
|
||||||
|
maxLength={10}
|
||||||
|
disabled={!row.isNew}
|
||||||
|
className="flex-1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Input
|
||||||
|
value={row.cnstpSeCdNm ?? ""}
|
||||||
|
onChange={(e) => onChange({ cnstpSeCdNm: e.target.value })}
|
||||||
|
placeholder="코드명"
|
||||||
|
maxLength={100}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Input
|
||||||
|
value={row.expln ?? ""}
|
||||||
|
onChange={(e) => onChange({ expln: e.target.value })}
|
||||||
|
placeholder="설명"
|
||||||
|
maxLength={1000}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<RadioGroup
|
||||||
|
value={row.useYn === "N" ? "N" : "Y"}
|
||||||
|
onValueChange={(v) => onChange({ useYn: v })}
|
||||||
|
className="flex justify-center gap-4"
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<RadioGroupItem value="Y" id={`${row.rowKey}-use-y`} />
|
||||||
|
<Label htmlFor={`${row.rowKey}-use-y`}>예</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<RadioGroupItem value="N" id={`${row.rowKey}-use-n`} />
|
||||||
|
<Label htmlFor={`${row.rowKey}-use-n`}>아니오</Label>
|
||||||
|
</div>
|
||||||
|
</RadioGroup>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="center">{levelLabel}</TableCell>
|
||||||
|
<TableCell align="center">
|
||||||
|
<div className="flex justify-center gap-2">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
color="white"
|
||||||
|
disabled={!canAddChildRow()}
|
||||||
|
onClick={onAddChild}
|
||||||
|
>
|
||||||
|
하위추가
|
||||||
|
</Button>
|
||||||
|
<Button type="button" size="sm" color="gray" onClick={onDelete}>
|
||||||
|
삭제
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CnstpSeRowComponent };
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { EsntlAtchFileMngPage } from "./ui/esntl-atch-file-mng-page";
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { createColumnHelper } from "@tanstack/react-table";
|
||||||
|
|
||||||
|
import type { Code } from "@/entities/code";
|
||||||
|
import { findCodeLabel } from "@/entities/code";
|
||||||
|
import type { EsntlAtchFileMng } from "@/entities/esntl";
|
||||||
|
import { Button } from "@common/components";
|
||||||
|
|
||||||
|
const columnHelper = createColumnHelper<EsntlAtchFileMng>();
|
||||||
|
|
||||||
|
interface CreateEsntlAtchFileColumnsOptions {
|
||||||
|
docSeCodes: Code[] | undefined;
|
||||||
|
onEdit: (row: EsntlAtchFileMng) => void;
|
||||||
|
onDelete: (row: EsntlAtchFileMng) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatYn(value: string | undefined) {
|
||||||
|
if (value === "Y") return "예";
|
||||||
|
if (value === "N") return "아니오";
|
||||||
|
return "—";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatOptional(value: string | undefined) {
|
||||||
|
return value?.trim() ? value : "—";
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createEsntlAtchFileColumns({
|
||||||
|
docSeCodes,
|
||||||
|
onEdit,
|
||||||
|
onDelete,
|
||||||
|
}: CreateEsntlAtchFileColumnsOptions) {
|
||||||
|
return [
|
||||||
|
columnHelper.accessor("esntlAtchFileId", {
|
||||||
|
header: "필수첨부파일아이디",
|
||||||
|
meta: { align: "center" },
|
||||||
|
}),
|
||||||
|
columnHelper.accessor("docSeComCd", {
|
||||||
|
header: "문서구분",
|
||||||
|
cell: ({ getValue }) => findCodeLabel(docSeCodes, getValue()) || getValue() || "—",
|
||||||
|
}),
|
||||||
|
columnHelper.accessor("esntlAtchFileNm", {
|
||||||
|
header: "필수첨부파일명",
|
||||||
|
meta: { align: "left" },
|
||||||
|
}),
|
||||||
|
columnHelper.accessor("esntlAtchYn", {
|
||||||
|
header: "필수첨부여부",
|
||||||
|
meta: { align: "center" },
|
||||||
|
cell: ({ getValue }) => formatYn(getValue()),
|
||||||
|
}),
|
||||||
|
columnHelper.accessor("esntlAtchFileRmrk", {
|
||||||
|
header: "비고",
|
||||||
|
meta: { align: "left" },
|
||||||
|
cell: ({ getValue }) => formatOptional(getValue()),
|
||||||
|
}),
|
||||||
|
columnHelper.accessor("regDt", {
|
||||||
|
header: "등록일시",
|
||||||
|
meta: { align: "center" },
|
||||||
|
cell: ({ getValue }) => formatOptional(getValue()),
|
||||||
|
}),
|
||||||
|
columnHelper.accessor("mdfcnDt", {
|
||||||
|
header: "수정일시",
|
||||||
|
meta: { align: "center" },
|
||||||
|
cell: ({ getValue }) => formatOptional(getValue()),
|
||||||
|
}),
|
||||||
|
columnHelper.display({
|
||||||
|
id: "actions",
|
||||||
|
header: "관리",
|
||||||
|
cell: ({ row }) => (
|
||||||
|
<div className="flex justify-center gap-2" onClick={(e) => e.stopPropagation()}>
|
||||||
|
<Button type="button" size="sm" color="white" onClick={() => onEdit(row.original)}>
|
||||||
|
수정
|
||||||
|
</Button>
|
||||||
|
<Button type="button" size="sm" color="gray" onClick={() => onDelete(row.original)}>
|
||||||
|
삭제
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
|
||||||
|
import { CodeSelect } from "@/entities/code";
|
||||||
|
import type { EsntlAtchFileMng } from "@/entities/esntl";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
Input,
|
||||||
|
Label,
|
||||||
|
RadioGroup,
|
||||||
|
RadioGroupItem,
|
||||||
|
Textarea,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
export interface EsntlAtchFileFormValues {
|
||||||
|
docSeComCd: string;
|
||||||
|
esntlAtchFileNm: string;
|
||||||
|
esntlAtchYn: "Y" | "N";
|
||||||
|
esntlAtchFileRmrk: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EsntlAtchFileFormDialogProps {
|
||||||
|
mode: "create" | "edit";
|
||||||
|
open: boolean;
|
||||||
|
onOpenChange: (open: boolean) => void;
|
||||||
|
initial?: EsntlAtchFileMng | null;
|
||||||
|
isSubmitting?: boolean;
|
||||||
|
onSubmit: (values: EsntlAtchFileFormValues) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function EsntlAtchFileFormDialog({
|
||||||
|
mode,
|
||||||
|
open,
|
||||||
|
onOpenChange,
|
||||||
|
initial,
|
||||||
|
isSubmitting,
|
||||||
|
onSubmit,
|
||||||
|
}: EsntlAtchFileFormDialogProps) {
|
||||||
|
const { register, handleSubmit, reset, setValue, watch } = useForm<EsntlAtchFileFormValues>({
|
||||||
|
defaultValues: {
|
||||||
|
docSeComCd: "",
|
||||||
|
esntlAtchFileNm: "",
|
||||||
|
esntlAtchYn: "Y",
|
||||||
|
esntlAtchFileRmrk: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const docSeComCd = watch("docSeComCd");
|
||||||
|
const esntlAtchYn = watch("esntlAtchYn");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
|
||||||
|
if (mode === "edit" && initial) {
|
||||||
|
reset({
|
||||||
|
docSeComCd: initial.docSeComCd ?? "",
|
||||||
|
esntlAtchFileNm: initial.esntlAtchFileNm ?? "",
|
||||||
|
esntlAtchYn: initial.esntlAtchYn ?? "Y",
|
||||||
|
esntlAtchFileRmrk: initial.esntlAtchFileRmrk ?? "",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset({
|
||||||
|
docSeComCd: "",
|
||||||
|
esntlAtchFileNm: "",
|
||||||
|
esntlAtchYn: "Y",
|
||||||
|
esntlAtchFileRmrk: "",
|
||||||
|
});
|
||||||
|
}, [open, mode, initial, reset]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
|
<DialogContent className="max-w-[52rem]">
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>{mode === "create" ? "필수첨부파일 등록" : "필수첨부파일 수정"}</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
<form className="space-y-6" onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
{mode === "edit" && initial ? (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="esntlAtchFileId">필수첨부파일아이디</Label>
|
||||||
|
<p id="esntlAtchFileId" className="p-1 text-[1.3rem]">
|
||||||
|
{initial.esntlAtchFileId}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label>문서구분</Label>
|
||||||
|
<CodeSelect
|
||||||
|
upCd="ASDOCSECD"
|
||||||
|
value={docSeComCd}
|
||||||
|
onValueChange={(v) => setValue("docSeComCd", v, { shouldValidate: true })}
|
||||||
|
placeholder="문서구분 선택"
|
||||||
|
className="w-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="esntlAtchFileNm">필수첨부파일명</Label>
|
||||||
|
<Input
|
||||||
|
id="esntlAtchFileNm"
|
||||||
|
placeholder="예: 사업계획서"
|
||||||
|
{...register("esntlAtchFileNm", { required: true })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label>필수첨부여부</Label>
|
||||||
|
<RadioGroup
|
||||||
|
value={esntlAtchYn}
|
||||||
|
onValueChange={(v) =>
|
||||||
|
setValue("esntlAtchYn", v as "Y" | "N", { shouldValidate: true })
|
||||||
|
}
|
||||||
|
className="flex gap-6"
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<RadioGroupItem value="Y" id="esntlAtchYn-y" />
|
||||||
|
<Label htmlFor="esntlAtchYn-y">예</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<RadioGroupItem value="N" id="esntlAtchYn-n" />
|
||||||
|
<Label htmlFor="esntlAtchYn-n">아니오</Label>
|
||||||
|
</div>
|
||||||
|
</RadioGroup>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="esntlAtchFileRmrk">비고</Label>
|
||||||
|
<Textarea
|
||||||
|
id="esntlAtchFileRmrk"
|
||||||
|
rows={3}
|
||||||
|
placeholder="비고를 입력하세요"
|
||||||
|
{...register("esntlAtchFileRmrk")}
|
||||||
|
className="!text-xl"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<DialogFooter>
|
||||||
|
<Button type="button" color="white" onClick={() => onOpenChange(false)}>
|
||||||
|
취소
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={isSubmitting}>
|
||||||
|
저장
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</form>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { EsntlAtchFileFormDialog };
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback, useMemo, useState } from "react";
|
||||||
|
|
||||||
|
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||||
|
import { getCoreRowModel, type PaginationState } from "@tanstack/react-table";
|
||||||
|
|
||||||
|
import { useDataTable } from "@/shared/lib";
|
||||||
|
import { useCodeList } from "@/entities/code";
|
||||||
|
import {
|
||||||
|
type EsntlAtchFileMng,
|
||||||
|
type EsntlAtchFileMngSearchParams,
|
||||||
|
useCreateEsntlAtchFileMng,
|
||||||
|
useDeleteEsntlAtchFileMng,
|
||||||
|
useEsntlAtchFileMngPage,
|
||||||
|
useUpdateEsntlAtchFileMng,
|
||||||
|
} from "@/entities/esntl";
|
||||||
|
import { Button } from "@common/components";
|
||||||
|
|
||||||
|
import { createEsntlAtchFileColumns } from "../model/esntl-atch-file-columns";
|
||||||
|
|
||||||
|
import {
|
||||||
|
EsntlAtchFileFormDialog,
|
||||||
|
type EsntlAtchFileFormValues,
|
||||||
|
} from "./esntl-atch-file-form-dialog";
|
||||||
|
|
||||||
|
interface EsntlAtchFileListProps {
|
||||||
|
searchParams: EsntlAtchFileMngSearchParams;
|
||||||
|
pagination: PaginationState;
|
||||||
|
onPaginationChange: (pagination: PaginationState) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function EsntlAtchFileList({
|
||||||
|
searchParams,
|
||||||
|
pagination,
|
||||||
|
onPaginationChange,
|
||||||
|
}: EsntlAtchFileListProps) {
|
||||||
|
const { confirm } = useConfirm();
|
||||||
|
const { data: docSeCodes } = useCodeList("ASDOCSECD");
|
||||||
|
|
||||||
|
const [dialogMode, setDialogMode] = useState<"create" | "edit" | null>(null);
|
||||||
|
const [editingRow, setEditingRow] = useState<EsntlAtchFileMng | null>(null);
|
||||||
|
|
||||||
|
const createMutation = useCreateEsntlAtchFileMng();
|
||||||
|
const updateMutation = useUpdateEsntlAtchFileMng();
|
||||||
|
const deleteMutation = useDeleteEsntlAtchFileMng();
|
||||||
|
|
||||||
|
const queryParams = useMemo(() => {
|
||||||
|
return {
|
||||||
|
docSeComCd: searchParams.docSeComCd,
|
||||||
|
page: pagination.pageIndex,
|
||||||
|
size: pagination.pageSize,
|
||||||
|
sort: searchParams.sort,
|
||||||
|
};
|
||||||
|
}, [searchParams, pagination]);
|
||||||
|
|
||||||
|
const pageQuery = useEsntlAtchFileMngPage(queryParams);
|
||||||
|
|
||||||
|
const handleDelete = useCallback(
|
||||||
|
async (row: EsntlAtchFileMng) => {
|
||||||
|
if (!(await confirm("삭제하시겠습니까?"))) return;
|
||||||
|
await deleteMutation.mutateAsync(row.esntlAtchFileId);
|
||||||
|
},
|
||||||
|
[confirm, deleteMutation],
|
||||||
|
);
|
||||||
|
|
||||||
|
const columns = useMemo(
|
||||||
|
() =>
|
||||||
|
createEsntlAtchFileColumns({
|
||||||
|
docSeCodes,
|
||||||
|
onEdit: (row) => {
|
||||||
|
setEditingRow(row);
|
||||||
|
setDialogMode("edit");
|
||||||
|
},
|
||||||
|
onDelete: handleDelete,
|
||||||
|
}),
|
||||||
|
[docSeCodes, handleDelete],
|
||||||
|
);
|
||||||
|
|
||||||
|
const { tableComponent } = useDataTable({
|
||||||
|
query: pageQuery,
|
||||||
|
tableOptions: {
|
||||||
|
columns,
|
||||||
|
state: { pagination },
|
||||||
|
onPaginationChange: (updater) => {
|
||||||
|
const next = typeof updater === "function" ? updater(pagination) : updater;
|
||||||
|
onPaginationChange(next);
|
||||||
|
},
|
||||||
|
getCoreRowModel: getCoreRowModel(),
|
||||||
|
manualPagination: true,
|
||||||
|
},
|
||||||
|
dataTableOptions: {
|
||||||
|
viewPagination: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleFormSubmit = async (values: EsntlAtchFileFormValues) => {
|
||||||
|
if (!values.docSeComCd || !values.esntlAtchFileNm || !values.esntlAtchYn) return;
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
docSeComCd: values.docSeComCd,
|
||||||
|
esntlAtchFileNm: values.esntlAtchFileNm,
|
||||||
|
esntlAtchYn: values.esntlAtchYn,
|
||||||
|
esntlAtchFileRmrk: values.esntlAtchFileRmrk || undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dialogMode === "create") {
|
||||||
|
if (!(await confirm("등록하시겠습니까?"))) return;
|
||||||
|
await createMutation.mutateAsync(body);
|
||||||
|
} else if (dialogMode === "edit" && editingRow) {
|
||||||
|
await updateMutation.mutateAsync({
|
||||||
|
esntlAtchFileId: editingRow.esntlAtchFileId,
|
||||||
|
body,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setDialogMode(null);
|
||||||
|
setEditingRow(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleOpenCreate = () => {
|
||||||
|
setEditingRow(null);
|
||||||
|
setDialogMode("create");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="card card-border mx-0 bg-background pt-0">
|
||||||
|
<div className="card-header flex items-center justify-between">
|
||||||
|
<h3 className="text-2xl font-semibold">필수첨부파일 목록</h3>
|
||||||
|
<Button type="button" color="green" onClick={handleOpenCreate}>
|
||||||
|
등록
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{tableComponent}
|
||||||
|
{dialogMode ? (
|
||||||
|
<EsntlAtchFileFormDialog
|
||||||
|
mode={dialogMode}
|
||||||
|
open={Boolean(dialogMode)}
|
||||||
|
onOpenChange={(open) => {
|
||||||
|
if (!open) {
|
||||||
|
setDialogMode(null);
|
||||||
|
setEditingRow(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
initial={dialogMode === "edit" ? editingRow : null}
|
||||||
|
isSubmitting={createMutation.isPending || updateMutation.isPending}
|
||||||
|
onSubmit={handleFormSubmit}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { EsntlAtchFileList };
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
import type { PaginationState } from "@tanstack/react-table";
|
||||||
|
|
||||||
|
import { useCodeList } from "@/entities/code";
|
||||||
|
import type { EsntlAtchFileMngSearchParams } from "@/entities/esntl";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Label,
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { EsntlAtchFileList } from "./esntl-atch-file-list";
|
||||||
|
|
||||||
|
const ALL_DOC_SE_VALUE = "__ALL__";
|
||||||
|
const ESNTL_ATCH_FILE_ALL_DOC_SE = "";
|
||||||
|
|
||||||
|
const DEFAULT_ESNTL_ATCH_FILE_PAGE_INDEX = 0;
|
||||||
|
const DEFAULT_ESNTL_ATCH_FILE_PAGE_SIZE = 10;
|
||||||
|
const DEFAULT_ESNTL_ATCH_FILE_SORT = "regDt,desc";
|
||||||
|
|
||||||
|
const DEFAULT_SEARCH_PARAMS = {
|
||||||
|
page: DEFAULT_ESNTL_ATCH_FILE_PAGE_INDEX,
|
||||||
|
size: DEFAULT_ESNTL_ATCH_FILE_PAGE_SIZE,
|
||||||
|
sort: DEFAULT_ESNTL_ATCH_FILE_SORT,
|
||||||
|
};
|
||||||
|
|
||||||
|
function EsntlAtchFileMngPage() {
|
||||||
|
const { data: docSeCodes, isPending: isDocSeLoading } = useCodeList("ASDOCSECD");
|
||||||
|
|
||||||
|
const [docSeComCd, setDocSeComCd] = useState(ESNTL_ATCH_FILE_ALL_DOC_SE);
|
||||||
|
const [pagination, setPagination] = useState<PaginationState>({
|
||||||
|
pageIndex: DEFAULT_ESNTL_ATCH_FILE_PAGE_INDEX,
|
||||||
|
pageSize: DEFAULT_ESNTL_ATCH_FILE_PAGE_SIZE,
|
||||||
|
});
|
||||||
|
const [searchParams, setSearchParams] =
|
||||||
|
useState<EsntlAtchFileMngSearchParams>(DEFAULT_SEARCH_PARAMS);
|
||||||
|
|
||||||
|
const handleSearch = (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
|
event.preventDefault();
|
||||||
|
setPagination((prev) => ({ ...prev, pageIndex: DEFAULT_ESNTL_ATCH_FILE_PAGE_INDEX }));
|
||||||
|
setSearchParams({
|
||||||
|
...DEFAULT_SEARCH_PARAMS,
|
||||||
|
docSeComCd,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 px-[1.8rem] pb-6">
|
||||||
|
<section className="card card-border mx-0 bg-background">
|
||||||
|
<form className="flex flex-wrap items-end gap-4 p-4" onSubmit={handleSearch}>
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<Label htmlFor="docSeComCd">문서구분</Label>
|
||||||
|
<Select
|
||||||
|
value={docSeComCd || ALL_DOC_SE_VALUE}
|
||||||
|
onValueChange={(value) =>
|
||||||
|
setDocSeComCd(value === ALL_DOC_SE_VALUE ? ESNTL_ATCH_FILE_ALL_DOC_SE : value)
|
||||||
|
}
|
||||||
|
disabled={isDocSeLoading}
|
||||||
|
>
|
||||||
|
<SelectTrigger id="docSeComCd" className="w-[20rem]">
|
||||||
|
<SelectValue placeholder={isDocSeLoading ? "로딩 중…" : "전체"} />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value={ALL_DOC_SE_VALUE}>전체</SelectItem>
|
||||||
|
{docSeCodes?.map((item) => (
|
||||||
|
<SelectItem key={item.lwpoCd} value={item.lwpoCd}>
|
||||||
|
{item.lwpoCdNm}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<Button type="submit">조회</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<EsntlAtchFileList
|
||||||
|
searchParams={searchParams}
|
||||||
|
pagination={pagination}
|
||||||
|
onPaginationChange={setPagination}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { EsntlAtchFileMngPage };
|
||||||
@@ -71,15 +71,15 @@ function CnfmListPage() {
|
|||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [pageSize, setPageSize] = useState(10);
|
const [pageSize, setPageSize] = useState(10);
|
||||||
const [taskDialogOpen, setTaskDialogOpen] = useState(false);
|
const [taskDialogOpen, setTaskDialogOpen] = useState(false);
|
||||||
const [selectedTaskSeComCd, setSelectedTaskSeComCd] = useState("");
|
const [selectedTaskSeComCd, setSelectedTaskSeComCd] = useState<string[]>([]);
|
||||||
|
|
||||||
const { data: fnrsCodeList = [] } = useCodeList("INSTL");
|
const { data: fnrsCodeList = [] } = useCodeList("INSTL");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!taskDialogOpen) return;
|
if (!taskDialogOpen) return;
|
||||||
if (selectedTaskSeComCd) return;
|
if (selectedTaskSeComCd.length) return;
|
||||||
if (fnrsCodeList.length === 0) return;
|
if (fnrsCodeList.length === 0) return;
|
||||||
setSelectedTaskSeComCd(fnrsCodeList[0].lwpoCd);
|
// setSelectedTaskSeComCd([fnrsCodeList[0].lwpoCd]);
|
||||||
}, [taskDialogOpen, selectedTaskSeComCd, fnrsCodeList]);
|
}, [taskDialogOpen, selectedTaskSeComCd, fnrsCodeList]);
|
||||||
|
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
@@ -108,20 +108,25 @@ function CnfmListPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleOpenTaskDialog = () => {
|
const handleOpenTaskDialog = () => {
|
||||||
setSelectedTaskSeComCd((prev) => prev || fnrsCodeList[0]?.lwpoCd || "");
|
//setSelectedTaskSeComCd((prev) => (prev && prev.length ? prev : [fnrsCodeList[0]?.lwpoCd || ""]));
|
||||||
setTaskDialogOpen(true);
|
setTaskDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirmTaskDialog = () => {
|
const handleConfirmTaskDialog = () => {
|
||||||
const selected = fnrsCodeList.find((item) => item.lwpoCd === selectedTaskSeComCd);
|
if (!selectedTaskSeComCd || selectedTaskSeComCd.length === 0) {
|
||||||
if (!selected) return;
|
alert("하나 이상의 업무구분을 선택하세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepare arrays of selected codes and names
|
||||||
|
const selectedCodes = selectedTaskSeComCd;
|
||||||
|
const selectedNames = selectedTaskSeComCd.map((code) => fnrsCodeList.find((item) => item.lwpoCd === code)?.lwpoCdNm || "");
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
INSTL_SNCN_REGISTER_SELECTION_KEY,
|
INSTL_SNCN_REGISTER_SELECTION_KEY,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
taskSeComCd: selected.lwpoCd,
|
taskSeComCdList: selectedCodes,
|
||||||
taskSeComCdNm: selected.lwpoCdNm,
|
taskSeComCdNmList: selectedNames
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
setTaskDialogOpen(false);
|
setTaskDialogOpen(false);
|
||||||
router.push("/instl-sncn/register");
|
router.push("/instl-sncn/register");
|
||||||
@@ -226,7 +231,7 @@ function CnfmListPage() {
|
|||||||
<th>담당자</th>
|
<th>담당자</th>
|
||||||
<th>해당기관</th>
|
<th>해당기관</th>
|
||||||
<th>진행상황</th>
|
<th>진행상황</th>
|
||||||
<th>시행일</th>
|
<th>신청일</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -248,12 +253,12 @@ function CnfmListPage() {
|
|||||||
className="cnfm-row-clickable"
|
className="cnfm-row-clickable"
|
||||||
onClick={() => router.push(`/instl-sncn/${row.instlSncnDocNo}`)}
|
onClick={() => router.push(`/instl-sncn/${row.instlSncnDocNo}`)}
|
||||||
>
|
>
|
||||||
<td>{row.sidoNm || "-"}</td>
|
<td>{row.sido || "-"}</td>
|
||||||
<td>{row.sggNm || "-"}</td>
|
<td>{row.gugun|| "-"}</td>
|
||||||
<td className="text-left">{row.bizNm || "-"}</td>
|
<td className="text-left">{row.bizNm || "-"}</td>
|
||||||
<td>{row.taskSeCdNm || row.taskSeComCd || "-"}</td>
|
<td>{row.taskSeCdNm || row.taskSeComCd || "-"}</td>
|
||||||
<td>{row.chrgrNm || row.aplcntNm || "-"}</td>
|
<td>{row.aplcntNm || "-"}</td>
|
||||||
<td>{row.instNm || row.aplcntOgdpNm || "-"}</td>
|
<td>{row.envoSeCdNm || "-"}</td>
|
||||||
<td>
|
<td>
|
||||||
<div className="cnfm-step-wrap">
|
<div className="cnfm-step-wrap">
|
||||||
<div className="cnfm-step-row">
|
<div className="cnfm-step-row">
|
||||||
@@ -367,11 +372,15 @@ function CnfmListPage() {
|
|||||||
{fnrsCodeList.map((item) => (
|
{fnrsCodeList.map((item) => (
|
||||||
<label key={item.lwpoCd} className="flex cursor-pointer items-center gap-2">
|
<label key={item.lwpoCd} className="flex cursor-pointer items-center gap-2">
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="checkbox"
|
||||||
name="taskSeComCdSelect"
|
name="taskSeComCdSelect"
|
||||||
value={item.lwpoCd}
|
value={item.lwpoCd}
|
||||||
checked={selectedTaskSeComCd === item.lwpoCd}
|
checked={selectedTaskSeComCd.includes(item.lwpoCd)}
|
||||||
onChange={() => setSelectedTaskSeComCd(item.lwpoCd)}
|
onChange={() => {
|
||||||
|
setSelectedTaskSeComCd((prev) =>
|
||||||
|
prev.includes(item.lwpoCd) ? prev.filter((v) => v !== item.lwpoCd) : [...prev, item.lwpoCd],
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{item.lwpoCdNm}
|
{item.lwpoCdNm}
|
||||||
</label>
|
</label>
|
||||||
@@ -387,11 +396,11 @@ function CnfmListPage() {
|
|||||||
>
|
>
|
||||||
취소
|
취소
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="rounded bg-blue-500 px-5 py-2 text-[1.3rem] font-semibold text-white hover:bg-blue-600 disabled:cursor-not-allowed disabled:bg-gray-300"
|
className="rounded bg-blue-500 px-5 py-2 text-[1.3rem] font-semibold text-white hover:bg-blue-600 disabled:cursor-not-allowed disabled:bg-gray-300"
|
||||||
onClick={handleConfirmTaskDialog}
|
onClick={handleConfirmTaskDialog}
|
||||||
disabled={!selectedTaskSeComCd}
|
disabled={!selectedTaskSeComCd || selectedTaskSeComCd.length === 0}
|
||||||
>
|
>
|
||||||
확인
|
확인
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { Button, Input } from "@common/components";
|
import { CnfmRegistPage } from "./cnfm-regist-page";
|
||||||
|
|
||||||
import { InstlSncnApi } from "@/entities/instl-sncn";
|
import { InstlSncnApi } from "@/entities/instl-sncn";
|
||||||
|
|
||||||
import "./cnfm-page.css";
|
import "./cnfm-page.css";
|
||||||
|
|
||||||
function CnfmModifyPage({ id }: { id: string }) {
|
function CnfmModifyPage({ id }: { id: string }) {
|
||||||
const router = useRouter();
|
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
queryKey: ["instl-sncn-modify", id],
|
// share cache with view page
|
||||||
|
queryKey: ["instl-sncn-detail", id],
|
||||||
queryFn: () => InstlSncnApi.getById(id),
|
queryFn: () => InstlSncnApi.getById(id),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -25,53 +24,11 @@ function CnfmModifyPage({ id }: { id: string }) {
|
|||||||
|
|
||||||
const data = query.data;
|
const data = query.data;
|
||||||
|
|
||||||
|
if (!data) return <div className="mt-6 text-[1.4rem]">수정 대상을 찾을 수 없습니다.</div>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-6 space-y-4">
|
<div className="mt-6">
|
||||||
<div className="cnfm-card p-4">
|
<CnfmRegistPage initialData={data} />
|
||||||
<h2 className="cnfm-section-title">설치인가 수정</h2>
|
|
||||||
<p className="mt-2 text-[1.3rem] text-gray-600">
|
|
||||||
상세 조회 API 데이터를 기반으로 수정 화면을 구성했습니다.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="cnfm-card p-4">
|
|
||||||
<h3 className="text-[1.5rem] font-semibold">기본 정보</h3>
|
|
||||||
<table className="cnfm-form-table mt-3">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>문서번호</th>
|
|
||||||
<td>{data.instlSncnDocNo}</td>
|
|
||||||
<th>진행상태</th>
|
|
||||||
<td>{data.prgrsSttsCdNm || data.prgrsSttsComCd || "-"}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>사업명</th>
|
|
||||||
<td>
|
|
||||||
<Input defaultValue={data.bizNm || ""} className="!text-[1.3rem]" />
|
|
||||||
</td>
|
|
||||||
<th>사업내용</th>
|
|
||||||
<td>
|
|
||||||
<Input defaultValue={data.bizCn || ""} className="!text-[1.3rem]" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>설계자명</th>
|
|
||||||
<td>
|
|
||||||
<Input defaultValue={data.dsgnrNm || ""} className="!text-[1.3rem]" />
|
|
||||||
</td>
|
|
||||||
<th>설계자 연락처</th>
|
|
||||||
<td>
|
|
||||||
<Input defaultValue={data.dsgnrTelno || ""} className="!text-[1.3rem]" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="cnfm-action-row">
|
|
||||||
<Button color="white" onClick={() => router.push(`/instl-sncn/${id}`)}>상세로</Button>
|
|
||||||
<Button type="button" onClick={() => window.alert("수정 API 연동은 추후 확장 가능합니다.")}>저장</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +1,382 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useRouter } from "next/navigation";
|
/* eslint-disable @typescript-eslint/no-explicit-any, simple-import-sort/imports */
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { Button } from "@common/components";
|
|
||||||
|
|
||||||
import { InstlSncnApi } from "@/entities/instl-sncn";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { dayjs } from "@/shared/lib";
|
import { Button } from "@common/components";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
// InstlSncnApi imported below with types
|
||||||
|
import { PROXY_HOST } from "@/shared/config";
|
||||||
|
import { formatFileSize } from "@/shared/lib/file-utils";
|
||||||
|
import axios from "axios";
|
||||||
|
import { processElaprPrgrs } from "@/entities/elapr/api/elapr-prgrs-service";
|
||||||
|
import { ElaprDmndApi } from "@/entities/elapr/api/elapr-dmnd-service";
|
||||||
|
import { dayjs, useUserStore, useAlertStore } from "@/shared/lib";
|
||||||
|
import { InstlSncnApi, type InstlSncnApplySaveRequestDto } from "@/entities/instl-sncn";
|
||||||
|
import { client } from "@/shared/api";
|
||||||
|
|
||||||
import "./cnfm-page.css";
|
import "./cnfm-page.css";
|
||||||
|
|
||||||
|
type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
|
||||||
|
const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||||
|
const ROLE_TO_REVIEW_STEP: Record<string, ReviewStepCode> = {
|
||||||
|
ROLE_USER05: "LOCAL",
|
||||||
|
ROLE_USER04: "LOCAL",
|
||||||
|
ROLE_USER03: "ENV",
|
||||||
|
ROLE_USER02: "KECO",
|
||||||
|
ROLE_USER01: "KECO",
|
||||||
|
};
|
||||||
|
const REVIEW_STEP_ROLE_RANK: Record<ReviewStepCode, number> = {
|
||||||
|
LOCAL: 1,
|
||||||
|
ENV: 2,
|
||||||
|
KECO: 3,
|
||||||
|
};
|
||||||
|
const INSTL_PROGRESS_ORDER = [
|
||||||
|
"SV",
|
||||||
|
"ST",
|
||||||
|
"LE",
|
||||||
|
"ER",
|
||||||
|
"EE",
|
||||||
|
"TE",
|
||||||
|
"TS",
|
||||||
|
"TR",
|
||||||
|
"TP",
|
||||||
|
"EP",
|
||||||
|
"TA",
|
||||||
|
"TB",
|
||||||
|
];
|
||||||
|
|
||||||
|
const getProgressStepCount = (prgrsSttsComCd?: string): number => {
|
||||||
|
const idx = INSTL_PROGRESS_ORDER.indexOf(prgrsSttsComCd ?? "ST");
|
||||||
|
if (idx <= INSTL_PROGRESS_ORDER.indexOf("ST")) return 1;
|
||||||
|
if (idx <= INSTL_PROGRESS_ORDER.indexOf("TP")) return 2;
|
||||||
|
return 3;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRoleStepCount = (dtlInstCd?: string): number => {
|
||||||
|
const mapped = dtlInstCd ? ROLE_TO_REVIEW_STEP[dtlInstCd] : undefined;
|
||||||
|
return mapped ? REVIEW_STEP_ROLE_RANK[mapped] : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 업무구분 코드 -> 표시명 매핑 (체크리스트 그룹 표시용)
|
||||||
|
const TASK_CODE_LABELS: Record<string, string> = {
|
||||||
|
RE: "재이용수",
|
||||||
|
SP: "하수관로",
|
||||||
|
SF: "하수처리시설",
|
||||||
|
};
|
||||||
|
|
||||||
|
const normalizeChecklistResultMap = (
|
||||||
|
raw: unknown,
|
||||||
|
): Record<ReviewStepCode, any[]> => {
|
||||||
|
const base: Record<ReviewStepCode, any[]> = { LOCAL: [], ENV: [], KECO: [] };
|
||||||
|
if (!raw) return base;
|
||||||
|
|
||||||
|
if (Array.isArray(raw)) {
|
||||||
|
raw.forEach((row: any) => {
|
||||||
|
const step = (row?.rvwStpComCd ?? "LOCAL") as ReviewStepCode;
|
||||||
|
if (REVIEW_STEP_CODES.includes(step)) {
|
||||||
|
base[step].push(row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof raw === "object") {
|
||||||
|
REVIEW_STEP_CODES.forEach((step) => {
|
||||||
|
const rows = (raw as Record<string, unknown>)[step];
|
||||||
|
base[step] = Array.isArray(rows) ? (rows as any[]) : [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return base;
|
||||||
|
};
|
||||||
|
|
||||||
function CnfmViewPage({ id }: { id: string }) {
|
function CnfmViewPage({ id }: { id: string }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const userInfo = useUserStore((state) => state.userInfo);
|
||||||
|
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
queryKey: ["instl-sncn-detail", id],
|
queryKey: ["instl-sncn-detail", id],
|
||||||
queryFn: () => InstlSncnApi.getById(id),
|
queryFn: () => InstlSncnApi.getById(id),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const data = (query.data ?? {}) as any;
|
||||||
|
|
||||||
|
// support API shape where payload includes detDto + lists
|
||||||
|
const det = data.detDto ?? data;
|
||||||
|
const bizSclList = data.bizSclList ?? [];
|
||||||
|
const bizCstList = data.bizCstList ?? [];
|
||||||
|
// API now provides a flat checklist result list: `cklstResultList`
|
||||||
|
const rawCklst = useMemo(() => data.cklstResultList ?? [], [data.cklstResultList]);
|
||||||
|
|
||||||
|
// ensure we have a flat array
|
||||||
|
const cklstAll = useMemo(() => (Array.isArray(rawCklst) ? (rawCklst as any[]) : []), [rawCklst]);
|
||||||
|
|
||||||
|
// build a step-keyed map from the flat list so the rest of the view can use same access pattern
|
||||||
|
const cklstResultMap = useMemo(() => {
|
||||||
|
const base: Record<ReviewStepCode, any[]> = { LOCAL: [], ENV: [], KECO: [] };
|
||||||
|
(cklstAll ?? []).forEach((row: any) => {
|
||||||
|
const step = (row?.rvwStpComCd ?? "LOCAL") as ReviewStepCode;
|
||||||
|
if (REVIEW_STEP_CODES.includes(step)) base[step].push(row);
|
||||||
|
});
|
||||||
|
return base;
|
||||||
|
}, [cklstAll]);
|
||||||
|
const esntlFileList = data.esntlFileList ?? [];
|
||||||
|
const etcFileList = data.etcFileList ?? [];
|
||||||
|
const elaprDocPrgrsList = (data.elaprDocPrgrsList ?? []) as any[];
|
||||||
|
const renderApproverCell = (code: string) => {
|
||||||
|
const row = elaprDocPrgrsList.find((r) => r.atrzSeComCd === code);
|
||||||
|
if (!row) return <div className="text-center">-</div>;
|
||||||
|
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||||
|
const statusMap: Record<string, { label: string; badgeClass: string; icon: string }> = {
|
||||||
|
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700", icon: "⏳" },
|
||||||
|
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-800", icon: "📨" },
|
||||||
|
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-800", icon: "✔️" },
|
||||||
|
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-800", icon: "✖️" },
|
||||||
|
};
|
||||||
|
const st = statusMap[status] ?? { label: status || "", badgeClass: "bg-gray-100 text-gray-700", icon: "" };
|
||||||
|
return (
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="font-semibold">{row.aprvrUuidNm ?? "-"}</div>
|
||||||
|
<div className="text-[0.95rem] text-gray-500">
|
||||||
|
{row.ognzNm ? `${row.ognzNm}` : ""}
|
||||||
|
{row.jbpsSeNm || row.jbgdSeNm ? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}` : ""}
|
||||||
|
</div>
|
||||||
|
<div className="text-[0.9rem] mt-1 flex items-center justify-center gap-2">
|
||||||
|
{row.atrzDt ? <span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span> : null}
|
||||||
|
{st.label ? (
|
||||||
|
<span
|
||||||
|
title={`${row.atrzPrgrsSttsComNm ?? st.label}${row.rjctRsn ? ` — 사유: ${row.rjctRsn}` : ""}${row.atrzDt ? ` · ${dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}` : ""}`}
|
||||||
|
className={`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold ml-1 ${st.badgeClass}`}
|
||||||
|
>
|
||||||
|
<span className="mr-1">{st.icon}</span>
|
||||||
|
<span>{st.label}</span>
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const orderedApprovers = useMemo(() => {
|
||||||
|
return (elaprDocPrgrsList ?? []).slice().sort((a: any, b: any) => {
|
||||||
|
const A = Number(a?.atrzSeqNo ?? 0);
|
||||||
|
const B = Number(b?.atrzSeqNo ?? 0);
|
||||||
|
return A - B;
|
||||||
|
});
|
||||||
|
}, [elaprDocPrgrsList]);
|
||||||
|
|
||||||
|
const handleApproveClick = async (elaprPrgrsId: any, atrzSeComCd: any) => {
|
||||||
|
if (!elaprPrgrsId) {
|
||||||
|
alert("결재 정보가 올바르지 않습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await processElaprPrgrs(String(elaprPrgrsId), "ATRZ_PRGRS_003"); //진행상태를 승인으로 업데이트
|
||||||
|
alert("결재가 완료되었습니다.");
|
||||||
|
try {
|
||||||
|
await query.refetch();
|
||||||
|
} catch (e) {
|
||||||
|
/* ignore refetch errors */
|
||||||
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error("결재 처리 실패", err);
|
||||||
|
const msg = axios.isAxiosError(err) && err.response?.data?.message ? err.response.data.message : "결재 처리 중 오류가 발생했습니다.";
|
||||||
|
alert(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAssignApproverClick = async (elaprTmpltId: string) => {
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
elaprDocNo: det.instlSncnDocNo,
|
||||||
|
elaprTmpltId: elaprTmpltId, /* 팝업에서 선택된 전자결제 템플릿 */
|
||||||
|
dmndTtl: det.bizNm, /* "구례 하수도 처리시설 2026", */
|
||||||
|
dmndCn: det.bizCn /*"구례 발주 하수도 처리시설 사업 2026년도 진행분 결제 요청 입니다."*/
|
||||||
|
};
|
||||||
|
// ElaprDmndApi 서비스를 통해 백엔드 연동
|
||||||
|
await ElaprDmndApi.create(payload);
|
||||||
|
alert("결재자 지정(결재요청 등록)이 완료되었습니다.");
|
||||||
|
try {
|
||||||
|
await query.refetch();
|
||||||
|
} catch (e) {
|
||||||
|
/* ignore refetch errors */
|
||||||
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error("결재자 지정 실패", err);
|
||||||
|
const msg = axios.isAxiosError(err) && err.response?.data?.message ? err.response.data.message : "결재자 지정 중 오류가 발생했습니다.";
|
||||||
|
alert(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderApproverRow = (row: any) => {
|
||||||
|
if (!row) return <div className="text-center">-</div>;
|
||||||
|
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||||
|
const statusMap: Record<string, { label: string; badgeClass: string; icon: string }> = {
|
||||||
|
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700", icon: "⏳" },
|
||||||
|
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-800", icon: "📨" },
|
||||||
|
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-800", icon: "✔️" },
|
||||||
|
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-800", icon: "✖️" },
|
||||||
|
};
|
||||||
|
const st = statusMap[status] ?? { label: status || "", badgeClass: "bg-gray-100 text-gray-700", icon: "" };
|
||||||
|
return (
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="font-semibold">{row.aprvrUuidNm ?? "-"}</div>
|
||||||
|
<div className="text-[0.95rem] text-gray-500">
|
||||||
|
{row.ognzNm ? `${row.ognzNm}` : ""}
|
||||||
|
{row.jbpsSeNm || row.jbgdSeNm ? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}` : ""}
|
||||||
|
</div>
|
||||||
|
<div className="text-[0.9rem] mt-1 flex items-center justify-center gap-2">
|
||||||
|
{row.atrzDt ? <span className="text-gray-400">{dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}</span> : null}
|
||||||
|
{st.label ? (
|
||||||
|
<>
|
||||||
|
<span
|
||||||
|
title={`${row.atrzPrgrsSttsComNm ?? st.label}${row.rjctRsn ? ` — 사유: ${row.rjctRsn}` : ""}${row.atrzDt ? ` · ${dayjs(row.atrzDt).format("YYYY-MM-DD HH:mm:ss")}` : ""}`}
|
||||||
|
className={`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-semibold ml-1 ${st.badgeClass}`}
|
||||||
|
>
|
||||||
|
<span className="mr-1">{st.icon}</span>
|
||||||
|
<span>{st.label}</span>
|
||||||
|
</span>
|
||||||
|
{status === "ATRZ_PRGRS_002" && userInfo?.userUnqId === row.aprvrUuid ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => handleApproveClick(row.elaprPrgrsId, row.atrzSeComCd)}
|
||||||
|
className="ml-2 px-2 py-1 bg-blue-500 text-white text-xs rounded"
|
||||||
|
>
|
||||||
|
결제
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const currentPrgrsSttsComCd = (det.prgrsSttsComCd as string | undefined) ?? "ST";
|
||||||
|
const roleBasedMaxStepCount = getRoleStepCount(userInfo?.dtlInstCd);
|
||||||
|
const progressBasedMaxStepCount = getProgressStepCount(currentPrgrsSttsComCd);
|
||||||
|
const visibleStepCount = Math.min(progressBasedMaxStepCount, roleBasedMaxStepCount);
|
||||||
|
const visibleReviewStepCodes = useMemo(
|
||||||
|
() => REVIEW_STEP_CODES.slice(0, visibleStepCount),
|
||||||
|
[visibleStepCount],
|
||||||
|
);
|
||||||
|
const [selectedReviewStep, setSelectedReviewStep] = useState<ReviewStepCode>("LOCAL");
|
||||||
|
// selected task code for header filtering (null = none selected)
|
||||||
|
const [selectedTaskCode, setSelectedTaskCode] = useState<string | null>(null);
|
||||||
|
|
||||||
|
// derive available task codes from checklist results
|
||||||
|
const taskCodes = useMemo(() => {
|
||||||
|
return Array.from(new Set((cklstAll ?? []).map((r: any) => (r as any).taskSeComCd).filter(Boolean)));
|
||||||
|
}, [cklstAll]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (visibleReviewStepCodes.length === 0) return;
|
||||||
|
if (!visibleReviewStepCodes.includes(selectedReviewStep)) {
|
||||||
|
setSelectedReviewStep(visibleReviewStepCodes[visibleReviewStepCodes.length - 1]);
|
||||||
|
}
|
||||||
|
}, [selectedReviewStep, visibleReviewStepCodes]);
|
||||||
|
|
||||||
|
// when checklist result task codes change, default selectedTaskCode to first available code
|
||||||
|
useEffect(() => {
|
||||||
|
if (!taskCodes || taskCodes.length === 0) {
|
||||||
|
if (selectedTaskCode !== null) setSelectedTaskCode(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!selectedTaskCode || !taskCodes.includes(selectedTaskCode)) {
|
||||||
|
setSelectedTaskCode(taskCodes[0]);
|
||||||
|
}
|
||||||
|
}, [taskCodes, selectedTaskCode]);
|
||||||
|
|
||||||
|
const selectedChecklistRows = useMemo(() => {
|
||||||
|
if (visibleReviewStepCodes.length === 0) return [];
|
||||||
|
const rows = (cklstResultMap[selectedReviewStep] ?? []).filter((r: any) =>
|
||||||
|
selectedTaskCode ? (r.taskSeComCd ?? "") === selectedTaskCode : true,
|
||||||
|
);
|
||||||
|
return rows
|
||||||
|
.slice()
|
||||||
|
.sort((a: any, b: any) =>
|
||||||
|
(a.cklstArtclSn ?? 0) - (b.cklstArtclSn ?? 0) || (a.sortSeq ?? 0) - (b.sortSeq ?? 0) || (a.cklstRvwSn ?? 0) - (b.cklstRvwSn ?? 0),
|
||||||
|
);
|
||||||
|
}, [cklstResultMap, selectedReviewStep, visibleReviewStepCodes.length, selectedTaskCode]);
|
||||||
|
|
||||||
|
const [viewCheckResults, setViewCheckResults] = useState<Record<string, string>>({});
|
||||||
|
const [viewCheckComments, setViewCheckComments] = useState<Record<string, string>>({});
|
||||||
|
|
||||||
|
const cklstStats = useMemo(() => {
|
||||||
|
if (!selectedReviewStep) return { total: 0, completed: 0, percent: 0 };
|
||||||
|
const rows = (cklstResultMap[selectedReviewStep] ?? []).filter((r: any) => r.bchckUseYn === "Y" && (selectedTaskCode ? (r.taskSeComCd ?? "") === selectedTaskCode : true));
|
||||||
|
const total = rows.length;
|
||||||
|
const completed = rows.reduce((acc: number, row: any) => {
|
||||||
|
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${selectedReviewStep}`;
|
||||||
|
const val = (viewCheckResults[key] ?? row.rvwRsltAnmlyYn) ?? "";
|
||||||
|
return acc + (val ? 1 : 0);
|
||||||
|
}, 0);
|
||||||
|
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||||
|
return { total, completed, percent };
|
||||||
|
}, [cklstResultMap, viewCheckResults, selectedReviewStep, selectedTaskCode]);
|
||||||
|
|
||||||
|
const fnValidation = (mode: "SAVE" | "SUBMIT") => {
|
||||||
|
// 기본 검증: 필요하면 확장
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const hadleTechReviewSubmit = async () => {
|
||||||
|
if (!fnValidation("SAVE")) return;
|
||||||
|
|
||||||
|
const cklstResultList = (cklstAll ?? [])
|
||||||
|
.filter((r: any) => r.bchckUseYn === "Y")
|
||||||
|
.map((row: any) => {
|
||||||
|
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${selectedReviewStep}`;
|
||||||
|
const rvwRsltAnmlyYn = (viewCheckResults[key] ?? row.rvwRsltAnmlyYn) ?? null;
|
||||||
|
const picRvwCn = (viewCheckComments[key] ?? row.picRvwCn) ?? null;
|
||||||
|
return {
|
||||||
|
taskSeComCd: row.taskSeComCd ?? "",
|
||||||
|
cklstSn: row.cklstSn,
|
||||||
|
cklstArtclSn: row.cklstArtclSn,
|
||||||
|
cklstRvwSn: row.cklstRvwSn,
|
||||||
|
rvwStpComCd: selectedReviewStep,
|
||||||
|
rvwRsltAnmlyYn,
|
||||||
|
picRvwCn,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const payload: InstlSncnApplySaveRequestDto = {
|
||||||
|
// only map core management DTO and checklist results; other lists empty per request
|
||||||
|
instlSncnMng: { ...(det ?? {}), prgrsSttsComCd: "ER" } as any,
|
||||||
|
bzScaleList: [],
|
||||||
|
bizCstList: [],
|
||||||
|
cklstResultList,
|
||||||
|
esntlAtchFileList: [],
|
||||||
|
} as unknown as InstlSncnApplySaveRequestDto;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const issuedDocNo = await InstlSncnApi.techReview(payload);
|
||||||
|
alert(`기술검토 등록이 완료되었습니다. 문서번호: ${issuedDocNo}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("기술검토 등록 API 호출 실패", error);
|
||||||
|
const serverMessage =
|
||||||
|
axios.isAxiosError(error) && error.response?.data?.message
|
||||||
|
? (error.response.data as { message: string }).message
|
||||||
|
: "저장 중 오류가 발생했습니다.";
|
||||||
|
alert(serverMessage);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const results: Record<string, string> = {};
|
||||||
|
const comments: Record<string, string> = {};
|
||||||
|
(selectedChecklistRows ?? []).forEach((row: any) => {
|
||||||
|
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${row.rvwStpComCd ?? "LOCAL"}`;
|
||||||
|
if (row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N") results[key] = row.rvwRsltAnmlyYn;
|
||||||
|
if (row.picRvwCn) comments[key] = String(row.picRvwCn);
|
||||||
|
});
|
||||||
|
setViewCheckResults(results);
|
||||||
|
setViewCheckComments(comments);
|
||||||
|
}, [selectedChecklistRows]);
|
||||||
|
|
||||||
if (query.isLoading) {
|
if (query.isLoading) {
|
||||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 불러오는 중입니다...</div>;
|
return <div className="mt-6 text-[1.4rem]">상세 정보를 불러오는 중입니다...</div>;
|
||||||
}
|
}
|
||||||
@@ -25,15 +385,74 @@ function CnfmViewPage({ id }: { id: string }) {
|
|||||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = query.data;
|
const fmt = (v: number | null | undefined) =>
|
||||||
|
typeof v === "number" ? v.toLocaleString() : v === null || v === undefined ? "" : String(v);
|
||||||
|
|
||||||
|
const indentPx = (indNm: string | undefined) => {
|
||||||
|
if (!indNm) return 0;
|
||||||
|
const spaces = indNm.length - indNm.trimStart().length;
|
||||||
|
return (spaces / 4) * 16;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* formatFileSize moved to shared lib: @/shared/lib/file-utils */
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-6 space-y-4">
|
<div className="mt-6 space-y-4">
|
||||||
|
{/* orderedApprovers.length > 0 && ( */}
|
||||||
|
<div className="cnfm-card p-4">
|
||||||
|
<h3 className="text-[1.5rem] font-semibold">결재 정보</h3>
|
||||||
|
<div className="cnfm-table-wrap mt-3">
|
||||||
|
<table className="cnfm-table w-full">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
{orderedApprovers.length === 0 ? (
|
||||||
|
<>
|
||||||
|
<th className="text-center">접수자</th>
|
||||||
|
<th className="text-center">검토자</th>
|
||||||
|
<th className="text-center">승인자</th>
|
||||||
|
<th className="text-center">최종승인자</th>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
orderedApprovers.map((r: any) => (
|
||||||
|
<th key={String(r.elaprPrgrsId ?? r.atrzSeComCd)} className="text-center">
|
||||||
|
{r.atrzSeComNm ?? r.atrzSeComCd}
|
||||||
|
</th>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
{orderedApprovers.length === 0 ? (
|
||||||
|
<>
|
||||||
|
<td>{renderApproverCell("ATRZ01")}</td>
|
||||||
|
<td>{renderApproverCell("ATRZ02")}</td>
|
||||||
|
<td>{renderApproverCell("ATRZ03")}</td>
|
||||||
|
<td>{renderApproverCell("ATRZ99")}</td>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
orderedApprovers.map((r: any) => (
|
||||||
|
<td key={String(r.elaprPrgrsId ?? r.atrzSeComCd)}>{renderApproverRow(r)}</td>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{/** 결제자 지정 버튼 */}
|
||||||
|
<div className="mt-4 text-right">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => handleAssignApproverClick("TMPLT20260611000001")}
|
||||||
|
>
|
||||||
|
결재자 지정
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* )} */}
|
||||||
<div className="cnfm-card p-4">
|
<div className="cnfm-card p-4">
|
||||||
<h2 className="cnfm-section-title">설치인가 상세보기</h2>
|
<h2 className="cnfm-section-title">설치인가 상세보기</h2>
|
||||||
<p className="mt-2 text-[1.3rem] text-gray-600">
|
<p className="mt-2 text-[1.3rem] text-gray-600">문서번호: <strong>{det.instlSncnDocNo}</strong></p>
|
||||||
문서번호: <strong>{data.instlSncnDocNo}</strong>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="cnfm-card p-4">
|
<div className="cnfm-card p-4">
|
||||||
@@ -42,28 +461,31 @@ function CnfmViewPage({ id }: { id: string }) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>사업명</th>
|
<th>사업명</th>
|
||||||
<td>{data.bizNm || "-"}</td>
|
<td>{det.bizNm || "-"}</td>
|
||||||
<th>업무구분</th>
|
|
||||||
<td>{data.taskSeCdNm || data.taskSeComCd || "-"}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>사업기간</th>
|
<th>사업기간</th>
|
||||||
<td>
|
<td>{(det.bizBgngYr || "-") + " ~ " + (det.bizEndYr || "-")}</td>
|
||||||
{(data.bizBgngYr || "-") + " ~ " + (data.bizEndYr || "-")}
|
|
||||||
</td>
|
|
||||||
<th>진행상태</th>
|
|
||||||
<td>{data.prgrsSttsCdNm || data.prgrsSttsComCd || "-"}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>행정동ID</th>
|
|
||||||
<td>{data.dongId || "-"}</td>
|
|
||||||
<th>예산사업코드</th>
|
|
||||||
<td>{data.bgtBizCd || "-"}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>사업내용</th>
|
<th>사업내용</th>
|
||||||
<td colSpan={3}>{data.bizCn || "-"}</td>
|
<td colSpan={3}>{det.bizCn || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>구분</th>
|
||||||
|
<td>{det.taskSeCdNm || det.taskSeComCd || "-"}</td>
|
||||||
|
<th>신청지자체</th>
|
||||||
|
<td>{det.sido || "-"} {det.gugun || "-"}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>사업구분</th>
|
||||||
|
<td colSpan={3}>{det.sncnSeCdNm || "-"}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>진행상태</th>
|
||||||
|
<td>{det.prgrsSttsCdNm || det.prgrsSttsComCd || "-"}</td>
|
||||||
|
<th>예산사업코드</th>
|
||||||
|
<td>{det.bgtBizCd || "-"}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,27 +496,27 @@ function CnfmViewPage({ id }: { id: string }) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>신청자명</th>
|
<th>신청자명</th>
|
||||||
<td>{data.aplcntNm || "-"}</td>
|
<td>{det.aplcntNm || "-"}</td>
|
||||||
<th>신청자 연락처</th>
|
<th>신청자 연락처</th>
|
||||||
<td>{data.aplcntMblTelno || "-"}</td>
|
<td>{det.aplcntMblTelno || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>신청자 소속</th>
|
<th>신청자 소속</th>
|
||||||
<td>{data.aplcntOgdpNm || "-"}</td>
|
<td>{det.aplcntOgdpNm || "-"}</td>
|
||||||
<th>신청자 이메일</th>
|
<th>신청자 이메일</th>
|
||||||
<td>{data.aplcntEmlAddr || "-"}</td>
|
<td>{det.aplcntEmlAddr || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>설계자명</th>
|
<th>설계자명</th>
|
||||||
<td>{data.dsgnrNm || "-"}</td>
|
<td>{det.dsgnrNm || "-"}</td>
|
||||||
<th>설계자 연락처</th>
|
<th>설계자 연락처</th>
|
||||||
<td>{data.dsgnrTelno || "-"}</td>
|
<td>{det.dsgnrTelno || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>설계자 소속</th>
|
<th>설계자 소속</th>
|
||||||
<td>{data.dsgnrOgdpNm || "-"}</td>
|
<td>{det.dsgnrOgdpNm || "-"}</td>
|
||||||
<th>설계자 이메일</th>
|
<th>설계자 이메일</th>
|
||||||
<td>{data.dsgnrEmlAddr || "-"}</td>
|
<td>{det.dsgnrEmlAddr || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -106,23 +528,361 @@ function CnfmViewPage({ id }: { id: string }) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>등록일시</th>
|
<th>등록일시</th>
|
||||||
<td>{data.regDt ? dayjs(data.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}</td>
|
<td>{det.regDt ? dayjs(det.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}</td>
|
||||||
<th>수정일시</th>
|
<th>수정일시</th>
|
||||||
<td>{data.mdfcnDt ? dayjs(data.mdfcnDt).format("YYYY-MM-DD HH:mm:ss") : "-"}</td>
|
<td>{det.mdfcnDt ? dayjs(det.mdfcnDt).format("YYYY-MM-DD HH:mm:ss") : "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>등록자명</th>
|
<th>등록자명</th>
|
||||||
<td>{data.rgtrNm || "-"}</td>
|
<td>{det.rgtrNm || "-"}</td>
|
||||||
<th>첨부파일그룹ID</th>
|
<th>첨부파일그룹ID</th>
|
||||||
<td>{data.atchFileGroupId || "-"}</td>
|
<td>{det.atchFileGroupId || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 사업규모 */}
|
||||||
|
<div className="cnfm-card p-4">
|
||||||
|
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">사업규모</h3>
|
||||||
|
<div className="cnfm-table-wrap">
|
||||||
|
<table className="cnfm-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th className="w-[30rem]">구분</th>
|
||||||
|
<th>기본계획(A)</th>
|
||||||
|
<th>예산반영(B)</th>
|
||||||
|
<th>금회설계시(C)</th>
|
||||||
|
<th>증감(C-B)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{bizSclList.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={5} className="cnfm-td-empty">조회된 사업규모 항목이 없습니다.</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
bizSclList.map((node: any) => {
|
||||||
|
const pl = indentPx(node.indCnstpSeCdNm);
|
||||||
|
const bscPlanQty = Number(node.bscPlanQty) || 0;
|
||||||
|
const budgetReflct = Number(node.bgtRfltQty) || 0;
|
||||||
|
const tstmDesignQty = Number(node.tstmDesignQty) || 0;
|
||||||
|
const diff = tstmDesignQty - budgetReflct;
|
||||||
|
return (
|
||||||
|
<tr key={node.cnstpSeCd} className={node.treeLevel === 1 ? "bg-gray-50 font-semibold" : ""}>
|
||||||
|
<td className="bg-gray-50 pl-2 text-left" style={{ paddingLeft: `${pl + 8}px` }}>{node.cnstpSeCdNm}</td>
|
||||||
|
<td><div className="text-right">{fmt(bscPlanQty)}</div></td>
|
||||||
|
<td><div className="text-right">{fmt(budgetReflct)}</div></td>
|
||||||
|
<td><div className="text-right">{fmt(tstmDesignQty)}</div></td>
|
||||||
|
<td><div className="text-right">{diff > 0 ? `+${fmt(diff)}` : fmt(diff)}</div></td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 총사업비 */}
|
||||||
|
<div className="cnfm-card p-4">
|
||||||
|
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">총사업비 <span className="text-[1.2rem] font-normal text-gray-400">(단위: 백만원)</span></h3>
|
||||||
|
<div className="cnfm-table-wrap">
|
||||||
|
<table className="cnfm-table w-full table-fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colSpan={2} className="w-[30rem]" rowSpan={2}>
|
||||||
|
구분
|
||||||
|
</th>
|
||||||
|
<th rowSpan={2}>예산반영(A)</th>
|
||||||
|
<th rowSpan={2}>표준사업비(B)</th>
|
||||||
|
<th rowSpan={2}>금회설계시(C)</th>
|
||||||
|
<th colSpan={2}>증감</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th className="w-[12rem]">(C-B)</th>
|
||||||
|
<th className="w-[6rem]">%</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{bizCstList.map((node: any) => {
|
||||||
|
|
||||||
|
const pl = indentPx(node.indAcntgSeCdNm);
|
||||||
|
const bscPlanAmt = Number(node.bscPlanAmt) || 0;
|
||||||
|
const budgetReflct = Number(node.bgtRfltAmt) || 0;
|
||||||
|
const tstmDesignAmt = Number(node.tstmDesignAmt) || 0;
|
||||||
|
const diff = tstmDesignAmt - budgetReflct;
|
||||||
|
const showSubIcon = node.treeLevel >= 4;
|
||||||
|
const isLeaf = !bizCstList.some((n: any) => n.upAcntgSeCd === node.acntgSeCd);
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={node.acntgSeCd}
|
||||||
|
className={
|
||||||
|
node.treeLevel === 1
|
||||||
|
? "bg-blue-50 font-bold"
|
||||||
|
: node.treeLevel === 2
|
||||||
|
? "bg-gray-100 font-semibold"
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{node.treeLevel <= 2 ? (
|
||||||
|
<td colSpan={2} className="pl-2 text-left">{node.acntgSeCdNm}</td>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<td className="w-[4rem]"></td>
|
||||||
|
<td
|
||||||
|
className={`bg-gray-50 text-left ${isLeaf ? "text-gray-700" : ""}`}
|
||||||
|
style={{ paddingLeft: `${pl + 8}px` }}
|
||||||
|
>
|
||||||
|
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||||
|
{node.acntgSeCdNm}
|
||||||
|
</td>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<div className="text-right">{fmt(bscPlanAmt)}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div className="text-right">{fmt(budgetReflct)}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div className="text-right">{fmt(tstmDesignAmt)}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div className="text-right">{diff > 0 ? `+${fmt(diff)}` : fmt(diff)}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div className="text-right">{budgetReflct !== 0 ? `${Math.round((diff / budgetReflct) * 100)}%` : "-"}</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 체크리스트 */}
|
||||||
|
<div className="cnfm-card p-4">
|
||||||
|
<div className="mb-3 flex items-center justify-between">
|
||||||
|
<h3 className="text-[1.5rem] font-bold text-gray-700">체크리스트</h3>
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
<div className="flex gap-2 items-center">
|
||||||
|
{Array.from(new Set(taskCodes)).map((code) => {
|
||||||
|
const name = TASK_CODE_LABELS[code] ?? code;
|
||||||
|
const active = selectedTaskCode === code;
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={code}
|
||||||
|
type="button"
|
||||||
|
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${active ? "border-blue-500 bg-blue-50 text-blue-700" : "border-gray-300 bg-white text-gray-600"
|
||||||
|
}`}
|
||||||
|
onClick={() => setSelectedTaskCode(code)}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<div className="text-[1.1rem] text-gray-500">{`(${cklstStats.completed}/${cklstStats.total})`}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="mb-3 flex flex-wrap gap-2">
|
||||||
|
{visibleReviewStepCodes.length === 0 ? (
|
||||||
|
<span className="text-[1.2rem] text-gray-500">
|
||||||
|
현재 사용자 권한/진행상태 조합에서 표시 가능한 체크리스트 단계가 없습니다.
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
visibleReviewStepCodes.map((stepCode) => (
|
||||||
|
<button
|
||||||
|
key={stepCode}
|
||||||
|
type="button"
|
||||||
|
className={`rounded border px-3 py-1 text-[1.2rem] font-semibold ${selectedReviewStep === stepCode
|
||||||
|
? "border-blue-500 bg-blue-50 text-blue-700"
|
||||||
|
: "border-gray-300 bg-white text-gray-600"
|
||||||
|
}`}
|
||||||
|
onClick={() => setSelectedReviewStep(stepCode)}
|
||||||
|
>
|
||||||
|
{stepCode}
|
||||||
|
</button>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="mb-2 text-[1.25rem] text-gray-500">
|
||||||
|
체크리스트 진행상황 [{selectedReviewStep}] — 총합: <strong>{cklstStats.total}</strong> · 완료: <strong>{cklstStats.completed}</strong> · 진행률: <strong>{cklstStats.percent}%</strong>
|
||||||
|
</div>
|
||||||
|
<div className="cnfm-table-wrap mt-3">
|
||||||
|
<table className="cnfm-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th className="w-[20rem]" rowSpan={2}>검토항목</th>
|
||||||
|
<th rowSpan={2}>주요 검토내용</th>
|
||||||
|
<th colSpan={2}>검토 결과(✓)</th>
|
||||||
|
{selectedReviewStep !== "LOCAL" ? (
|
||||||
|
<th rowSpan={2} className="w-[20rem]">기술검토 의견</th>
|
||||||
|
) : null}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th className="w-[9rem]">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
예
|
||||||
|
</button>
|
||||||
|
</th>
|
||||||
|
<th className="w-[9rem]">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
아니오
|
||||||
|
</button>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{selectedChecklistRows.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={5} className="cnfm-td-empty">조회된 체크리스트 항목이 없습니다.</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
selectedChecklistRows.map((row: any) => {
|
||||||
|
const key = `${row.taskSeComCd ?? ""}_${row.cklstSn}_${row.cklstArtclSn ?? ""}_${row.cklstRvwSn}_${row.rvwStpComCd ?? "LOCAL"}`;
|
||||||
|
const hasResult = row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N";
|
||||||
|
const showRadios = row.bchckUseYn === "Y";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<tr key={key}>
|
||||||
|
<td className="text-center text-[1.2rem]">{row.cklstArtclNm}</td>
|
||||||
|
<td className="!text-left pl-2 text-[1.2rem] text-gray-600" style={{ paddingLeft: `${Math.max(0, row.treeLevel - 1) * 16 + 8}px` }}>{row.treeLevel > 1 ? "└ " : ""}{row.rvwCn}</td>
|
||||||
|
{!showRadios ? (
|
||||||
|
<>
|
||||||
|
<td className="text-center">-</td>
|
||||||
|
<td className="text-center">-</td>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<td className="text-center">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name={`chk_${key}`}
|
||||||
|
value="Y"
|
||||||
|
checked={(viewCheckResults[key] ?? "") === "Y"}
|
||||||
|
disabled={selectedReviewStep === "LOCAL"}
|
||||||
|
onChange={() => setViewCheckResults((prev) => ({ ...prev, [key]: "Y" }))}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td className="text-center">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name={`chk_${key}`}
|
||||||
|
value="N"
|
||||||
|
checked={(viewCheckResults[key] ?? "") === "N"}
|
||||||
|
disabled={selectedReviewStep === "LOCAL"}
|
||||||
|
onChange={() => setViewCheckResults((prev) => ({ ...prev, [key]: "N" }))}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{showRadios && selectedReviewStep !== "LOCAL" ? (
|
||||||
|
<td className="text-left">
|
||||||
|
<textarea
|
||||||
|
className="cnfm-input w-full"
|
||||||
|
value={viewCheckComments[key] ?? ""}
|
||||||
|
onChange={(e) => setViewCheckComments((prev) => ({ ...prev, [key]: e.target.value }))}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
) : null}
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 필수 첨부파일 */}
|
||||||
|
<div className="cnfm-card p-4">
|
||||||
|
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">필수 첨부파일</h3>
|
||||||
|
<div className="cnfm-table-wrap">
|
||||||
|
<table className="cnfm-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>필수 자료명</th>
|
||||||
|
<th>파일명</th>
|
||||||
|
<th className="w-[8rem] text-right">크기</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{esntlFileList.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={3} className="cnfm-td-empty">조회된 필수 첨부파일 항목이 없습니다.</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
esntlFileList.map((f: any) => (
|
||||||
|
<tr key={f.esntlAtchFileId}>
|
||||||
|
<td className="pl-2">
|
||||||
|
<div className="w-full text-left">
|
||||||
|
{f.esntlAtchFileNm}
|
||||||
|
{f.esntlAtchYn === "Y" ? <span className="ml-1 text-red-500">*</span> : null}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{f.atflCd ? (
|
||||||
|
<a className="text-blue-600" href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${f.atflCd}`} target="_blank" rel="noreferrer">{f.orgnlFileNm || "다운로드"}</a>
|
||||||
|
) : (
|
||||||
|
<span className="text-gray-500">첨부없음</span>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td className="w-[8rem] text-right"><div className="text-right">{formatFileSize(f.atflFlieSz)}</div></td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 기타 첨부파일 */}
|
||||||
|
<div className="cnfm-card p-4">
|
||||||
|
<h3 className="mb-3 border-b pb-2 text-[1.5rem] font-bold text-gray-700">기타 첨부파일</h3>
|
||||||
|
<div className="cnfm-table-wrap">
|
||||||
|
<table className="cnfm-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>파일명</th>
|
||||||
|
<th className="w-[8rem] text-right">크기</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{etcFileList.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={2} className="cnfm-td-empty">등록된 기타첨부파일이 없습니다.</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
etcFileList.map((f: any) => (
|
||||||
|
<tr key={f.atflId}>
|
||||||
|
<td>
|
||||||
|
{f.orgnlFileNm ? (
|
||||||
|
<a className="text-blue-600" href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${f.atflCd}`} target="_blank" rel="noreferrer">{f.orgnlFileNm}</a>
|
||||||
|
) : (
|
||||||
|
<span className="text-gray-700">{f.physFileNm || f.atflId}</span>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td className="w-[8rem] text-right text-gray-500">{formatFileSize(f.atflFlieSz)}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="cnfm-action-row">
|
<div className="cnfm-action-row">
|
||||||
<Button color="white" onClick={() => router.push("/instl-sncn")}>목록</Button>
|
<Button color="white" onClick={() => router.push("/instl-sncn")}>목록</Button>
|
||||||
<Button onClick={() => router.push(`/instl-sncn/${id}/modify`)}>수정</Button>
|
<Button onClick={() => router.push(`/instl-sncn/${id}/modify`)}>수정</Button>
|
||||||
|
<Button onClick={() => void hadleTechReviewSubmit()}>기술검토등록</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { RvwMnpwMngPage } from "./ui/rvw-mnpw-mng-page";
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import type { RvwMnpwMngResponseDto } from "@/entities/rvw-mnpw";
|
||||||
|
|
||||||
|
import type { RvwMnpwBlockConfig } from "../model/rvw-mnpw-block-config";
|
||||||
|
|
||||||
|
export function groupRvwMnpwByAtrzSe(
|
||||||
|
items: RvwMnpwMngResponseDto[],
|
||||||
|
blocks: RvwMnpwBlockConfig[],
|
||||||
|
): Record<string, RvwMnpwMngResponseDto[]> {
|
||||||
|
const grouped = Object.fromEntries(
|
||||||
|
blocks.map((block) => [block.atrzSeComCd, [] as RvwMnpwMngResponseDto[]]),
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
grouped[item.atrzSeComCd]?.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return grouped;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
export interface RvwMnpwBlockConfig {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
atrzSeComCd: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 결재선 관리 validators.ts ATRZ 코드와 동일 */
|
||||||
|
export const RVW_MNPW_BLOCKS: RvwMnpwBlockConfig[] = [
|
||||||
|
{ id: "receiver", title: "접수", atrzSeComCd: "ATRZ01" },
|
||||||
|
{ id: "reviewer", title: "검토", atrzSeComCd: "ATRZ02" },
|
||||||
|
{ id: "approver", title: "승인", atrzSeComCd: "ATRZ03" },
|
||||||
|
{ id: "final", title: "최종승인", atrzSeComCd: "ATRZ99" },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const RVW_MNPW_PAGE_SIZE = 500;
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import { useOgnzUserTree } from "@/entities/user-organization";
|
||||||
|
import {
|
||||||
|
collectExpandedOgnzSnIds,
|
||||||
|
filterOgnzUserTree,
|
||||||
|
OgnzUserTree,
|
||||||
|
type SelectedOgnzUser,
|
||||||
|
} from "@/widgets/ognz-user-tree";
|
||||||
|
import { Button, Input } from "@common/components";
|
||||||
|
|
||||||
|
interface OgnzPanelProps {
|
||||||
|
selectedPerson: SelectedOgnzUser | null;
|
||||||
|
onSelectPerson: (person: SelectedOgnzUser) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function OgnzPanel({ selectedPerson, onSelectPerson }: OgnzPanelProps) {
|
||||||
|
const [keyword, setKeyword] = useState("");
|
||||||
|
const [displayTree, setDisplayTree] = useState<ReturnType<typeof filterOgnzUserTree>>([]);
|
||||||
|
const [expandedOgnzSnIds, setExpandedOgnzSnIds] = useState<Set<number>>(new Set());
|
||||||
|
const [isSearchActive, setIsSearchActive] = useState(false);
|
||||||
|
|
||||||
|
const { data, isPending, isError } = useOgnzUserTree();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setDisplayTree(data ?? []);
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
const handleToggle = useCallback((ognzSn: number, isExpanded: boolean) => {
|
||||||
|
setExpandedOgnzSnIds((prev) => {
|
||||||
|
const next = new Set(prev);
|
||||||
|
if (isExpanded) next.add(ognzSn);
|
||||||
|
else next.delete(ognzSn);
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const filtered = filterOgnzUserTree(data ?? [], keyword);
|
||||||
|
setDisplayTree(filtered);
|
||||||
|
setExpandedOgnzSnIds(collectExpandedOgnzSnIds(filtered));
|
||||||
|
setIsSearchActive(keyword.trim().length > 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
setKeyword("");
|
||||||
|
setDisplayTree(data ?? []);
|
||||||
|
setExpandedOgnzSnIds(new Set());
|
||||||
|
setIsSearchActive(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSelect = (person: SelectedOgnzUser) => {
|
||||||
|
if (selectedPerson?.userUuid === person.userUuid) return;
|
||||||
|
onSelectPerson(person);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="card card-border mx-0 flex h-full flex-col pt-0">
|
||||||
|
<div className="card-header">
|
||||||
|
<h3 className="text-2xl font-semibold">조직도</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col gap-4 p-4">
|
||||||
|
<form onSubmit={handleSubmit} className="flex items-center gap-2">
|
||||||
|
<Input
|
||||||
|
className="!text-[1.3rem]"
|
||||||
|
placeholder="성명·부서 검색"
|
||||||
|
value={keyword}
|
||||||
|
onChange={(e) => setKeyword(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Button type="submit">조회</Button>
|
||||||
|
<Button type="button" color="white" onClick={handleReset}>
|
||||||
|
초기화
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div className="min-h-[32rem] flex-1 overflow-auto">
|
||||||
|
<OgnzUserTree
|
||||||
|
nodes={displayTree}
|
||||||
|
isPending={isPending}
|
||||||
|
isError={isError}
|
||||||
|
isSearchActive={isSearchActive}
|
||||||
|
expandedOgnzSnIds={expandedOgnzSnIds}
|
||||||
|
selectedUserId={selectedPerson?.userUuid}
|
||||||
|
onToggle={handleToggle}
|
||||||
|
onSelect={handleSelect}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { OgnzPanel };
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useMemo } from "react";
|
||||||
|
|
||||||
|
import { useRvwMnpwMngPage } from "@/entities/rvw-mnpw";
|
||||||
|
import type { SelectedOgnzUser } from "@/widgets/ognz-user-tree";
|
||||||
|
import { Skeleton } from "@common/components";
|
||||||
|
|
||||||
|
import { groupRvwMnpwByAtrzSe } from "../lib/group-rvw-mnpw-by-atrz-se";
|
||||||
|
import { RVW_MNPW_BLOCKS, RVW_MNPW_PAGE_SIZE } from "../model/rvw-mnpw-block-config";
|
||||||
|
|
||||||
|
import { RvwMnpwBlock } from "./rvw-mnpw-block";
|
||||||
|
|
||||||
|
interface RvwMnpwAsmtPanelProps {
|
||||||
|
selectedPerson: SelectedOgnzUser | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function RvwMnpwAsmtPanel({ selectedPerson }: RvwMnpwAsmtPanelProps) {
|
||||||
|
const pageQuery = useRvwMnpwMngPage({
|
||||||
|
page: 0,
|
||||||
|
size: RVW_MNPW_PAGE_SIZE,
|
||||||
|
sort: "atrzSeComCd,asc",
|
||||||
|
});
|
||||||
|
|
||||||
|
const groupedItems = useMemo(
|
||||||
|
() => groupRvwMnpwByAtrzSe(pageQuery.data?.content ?? [], RVW_MNPW_BLOCKS),
|
||||||
|
[pageQuery.data?.content],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="card card-border mx-0 flex h-full flex-col pt-0">
|
||||||
|
<div className="card-header">
|
||||||
|
<h3 className="text-2xl font-semibold">인원 배치</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col gap-4 p-4">
|
||||||
|
{pageQuery.isPending ? (
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<Skeleton className="h-[8rem]" />
|
||||||
|
<Skeleton className="h-[8rem]" />
|
||||||
|
<Skeleton className="h-[8rem]" />
|
||||||
|
<Skeleton className="h-[8rem]" />
|
||||||
|
</div>
|
||||||
|
) : pageQuery.isError ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
인원 배치 목록을 불러오지 못했습니다.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
RVW_MNPW_BLOCKS.map((block) => (
|
||||||
|
<RvwMnpwBlock
|
||||||
|
key={block.id}
|
||||||
|
block={block}
|
||||||
|
items={groupedItems[block.atrzSeComCd] ?? []}
|
||||||
|
selectedPerson={selectedPerson}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { RvwMnpwAsmtPanel };
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||||
|
|
||||||
|
import { useAlertStore } from "@/shared/lib";
|
||||||
|
import type { RvwMnpwMngResponseDto } from "@/entities/rvw-mnpw";
|
||||||
|
import { useDeleteRvwMnpwMng, useSaveRvwMnpwMng } from "@/entities/rvw-mnpw";
|
||||||
|
import type { SelectedOgnzUser } from "@/widgets/ognz-user-tree";
|
||||||
|
import { Badge, Button } from "@common/components";
|
||||||
|
|
||||||
|
import type { RvwMnpwBlockConfig } from "../model/rvw-mnpw-block-config";
|
||||||
|
|
||||||
|
interface RvwMnpwBlockProps {
|
||||||
|
block: RvwMnpwBlockConfig;
|
||||||
|
items: RvwMnpwMngResponseDto[];
|
||||||
|
selectedPerson: SelectedOgnzUser | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function RvwMnpwBlock({ block, items, selectedPerson }: RvwMnpwBlockProps) {
|
||||||
|
const { confirm } = useConfirm();
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
const saveMutation = useSaveRvwMnpwMng();
|
||||||
|
const deleteMutation = useDeleteRvwMnpwMng();
|
||||||
|
|
||||||
|
const handleAssign = async () => {
|
||||||
|
if (!selectedPerson) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await saveMutation.mutateAsync({
|
||||||
|
atrzSeComCd: block.atrzSeComCd,
|
||||||
|
ognzSn: selectedPerson.ognzSn,
|
||||||
|
userUuid: selectedPerson.userUuid,
|
||||||
|
});
|
||||||
|
alert("배치되었습니다.");
|
||||||
|
} catch (error) {
|
||||||
|
const message = error instanceof Error ? error.message : "배치에 실패했습니다.";
|
||||||
|
alert(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRemove = async (item: RvwMnpwMngResponseDto) => {
|
||||||
|
if (!(await confirm("해당 인원을 배치에서 제거하시겠습니까?"))) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await deleteMutation.mutateAsync({
|
||||||
|
atrzSeComCd: item.atrzSeComCd,
|
||||||
|
ognzSn: item.ognzSn,
|
||||||
|
userUuid: item.userUuid,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
const message = error instanceof Error ? error.message : "제거에 실패했습니다.";
|
||||||
|
alert(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isAssigning = saveMutation.isPending;
|
||||||
|
const isRemoving = deleteMutation.isPending;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="rounded-md border border-border bg-background p-4">
|
||||||
|
<div className="mb-3 flex flex-wrap items-center justify-between gap-2">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<h4 className="text-xl font-semibold">{block.title}</h4>
|
||||||
|
<Badge color="gray">{items.length}</Badge>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
color="green"
|
||||||
|
disabled={!selectedPerson || isAssigning}
|
||||||
|
onClick={handleAssign}
|
||||||
|
>
|
||||||
|
선택 인원 배치
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{items.length === 0 ? (
|
||||||
|
<p className="py-4 text-center text-lg text-muted-foreground">배치된 인원이 없습니다.</p>
|
||||||
|
) : (
|
||||||
|
<ul className="grid grid-cols-4 gap-2">
|
||||||
|
{items.map((item) => (
|
||||||
|
<li
|
||||||
|
key={`${item.atrzSeComCd}-${item.ognzSn}-${item.userUuid}`}
|
||||||
|
className="flex items-center justify-between gap-3 rounded-sm border border-border px-3 py-2"
|
||||||
|
>
|
||||||
|
<div className="flex min-w-0 flex-1 items-center gap-2">
|
||||||
|
<p className="text-[1.4rem] font-medium text-label">
|
||||||
|
{item.userUuidNm || item.userUuid}
|
||||||
|
</p>
|
||||||
|
{item.ognzNm && item.jbpsSeNm && (
|
||||||
|
<span className="text-lg text-muted-foreground">
|
||||||
|
({item.ognzNm} · {item.jbpsSeNm})
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
color="white"
|
||||||
|
disabled={isRemoving}
|
||||||
|
onClick={() => handleRemove(item)}
|
||||||
|
>
|
||||||
|
제거
|
||||||
|
</Button>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { RvwMnpwBlock };
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
import type { SelectedOgnzUser } from "@/widgets/ognz-user-tree";
|
||||||
|
|
||||||
|
import { OgnzPanel } from "./ognz-panel";
|
||||||
|
import { RvwMnpwAsmtPanel } from "./rvw-mnpw-asmt-panel";
|
||||||
|
|
||||||
|
function RvwMnpwMngPage() {
|
||||||
|
const [selectedPerson, setSelectedPerson] = useState<SelectedOgnzUser | null>(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 px-[1.8rem] pb-6">
|
||||||
|
{/* TBD: 역할별 CRUD 권한 — 메뉴·API 권한 연동 후 버튼 비활성 처리 */}
|
||||||
|
<div className="grid grid-cols-1 gap-6 xl:grid-cols-[minmax(280px,1fr)_minmax(0,2.5fr)]">
|
||||||
|
<OgnzPanel selectedPerson={selectedPerson} onSelectPerson={setSelectedPerson} />
|
||||||
|
<RvwMnpwAsmtPanel selectedPerson={selectedPerson} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { RvwMnpwMngPage };
|
||||||
@@ -7,6 +7,7 @@ export const ENDPOINT = {
|
|||||||
ACNTG_SE: "/as-service/api/v1/acntg-se",
|
ACNTG_SE: "/as-service/api/v1/acntg-se",
|
||||||
CNSTP_SE: "/as-service/api/v1/cnstp-se",
|
CNSTP_SE: "/as-service/api/v1/cnstp-se",
|
||||||
ESNTL_ATCH_FILE: "/as-service/api/v1/esntl-atch-file",
|
ESNTL_ATCH_FILE: "/as-service/api/v1/esntl-atch-file",
|
||||||
|
RVW_MNPW: "/as-service/api/v1/rvw-mnpw",
|
||||||
},
|
},
|
||||||
AS_INSTL_SERVICE: {
|
AS_INSTL_SERVICE: {
|
||||||
INSTL_SNCN: "/as-service/api/v1/instl-sncn",
|
INSTL_SNCN: "/as-service/api/v1/instl-sncn",
|
||||||
@@ -19,6 +20,7 @@ export const ENDPOINT = {
|
|||||||
AS_ELAPR_SERVICE: {
|
AS_ELAPR_SERVICE: {
|
||||||
ELAPR_TMPLT: "/as-elapr-service/api/v1/elapr-tmplt",
|
ELAPR_TMPLT: "/as-elapr-service/api/v1/elapr-tmplt",
|
||||||
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",
|
||||||
},
|
},
|
||||||
AS_CHECKLIST_SERVICE: {
|
AS_CHECKLIST_SERVICE: {
|
||||||
CKLST: "/as-service/api/v1/cklst",
|
CKLST: "/as-service/api/v1/cklst",
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import type { AuthConfig } from "@common/auth";
|
||||||
|
|
||||||
|
import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME, COOKIE_DOMAIN, REFRESH_TOKEN } from "./env";
|
||||||
|
|
||||||
|
export const authConfig: AuthConfig = {
|
||||||
|
authUserId: AUTH_USER_ID || "token-id",
|
||||||
|
claimName: CLAIM_NAME || "Authorization",
|
||||||
|
cookieDomain: COOKIE_DOMAIN,
|
||||||
|
accessToken: ACCESS_TOKEN || "access-token",
|
||||||
|
refreshToken: REFRESH_TOKEN || "refresh-token",
|
||||||
|
};
|
||||||
@@ -8,3 +8,4 @@ export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
|||||||
export const ACCESS_TOKEN = process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token";
|
export const ACCESS_TOKEN = process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token";
|
||||||
export const REFRESH_TOKEN = process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token";
|
export const REFRESH_TOKEN = process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token";
|
||||||
export const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
export const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
||||||
|
export const COOKIE_DOMAIN = process.env.NEXT_PUBLIC_COOKIE_DOMAIN;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/* Shared file utilities for apps/as */
|
||||||
|
|
||||||
|
/** 파일 크기는 byte 단위로 제공된다고 가정하고 크기에 따라서 KB, MB 단위로 표시 */
|
||||||
|
export const formatFileSize = (bytes?: number | null): string => {
|
||||||
|
if (bytes === null || bytes === undefined) return "-";
|
||||||
|
const b = Number(bytes) || 0;
|
||||||
|
if (b >= 1024 * 1024) return `${(b / 1024 / 1024).toFixed(1)}MB`;
|
||||||
|
if (b >= 1024) return `${Math.round(b / 1024)}KB`;
|
||||||
|
return `${b}B`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default { formatFileSize };
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './ui';
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { formatFileSize } from "@/shared/lib/file-utils";
|
||||||
|
|
||||||
|
type EtcFile = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
ext: string;
|
||||||
|
size: string;
|
||||||
|
uploader: string;
|
||||||
|
atflCd: string;
|
||||||
|
atflId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
etcFiles: EtcFile[];
|
||||||
|
etcUploading: boolean;
|
||||||
|
onFilesChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
onDelete: (fileId: string, atflId: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function EtcAttachments({ etcFiles, etcUploading, onFilesChange, onDelete }: Props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="mb-3 flex flex-nowrap items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="cnfm-input min-w-0 flex-1"
|
||||||
|
placeholder="첨부문서를 등록해주세요"
|
||||||
|
value={
|
||||||
|
etcUploading ? "업로드 중..." : etcFiles.length > 0 ? `${etcFiles.length}개 파일 등록됨` : ""
|
||||||
|
}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
<label className="cnfm-btn-search shrink-0 cursor-pointer whitespace-nowrap text-[1.2rem] flex items-center">
|
||||||
|
{etcUploading ? "업로드중" : "첨부파일"}
|
||||||
|
<input type="file" className="hidden" multiple onChange={onFilesChange} disabled={etcUploading} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="cnfm-table-wrap">
|
||||||
|
<table className="cnfm-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>파일명</th>
|
||||||
|
<th>확장자</th>
|
||||||
|
<th>크기</th>
|
||||||
|
<th>등록자</th>
|
||||||
|
<th>액션</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{etcFiles.map((f) => (
|
||||||
|
<tr key={f.id}>
|
||||||
|
<td className="pr-2">{f.name}</td>
|
||||||
|
<td className="text-center">{f.ext}</td>
|
||||||
|
<td className="text-right">{(() => {
|
||||||
|
const raw = f.size;
|
||||||
|
if (typeof raw === "number") return formatFileSize(raw);
|
||||||
|
const s = String(raw ?? "").trim();
|
||||||
|
return /^[0-9]+$/.test(s) ? formatFileSize(Number(s)) : s;
|
||||||
|
})()}</td>
|
||||||
|
<td className="text-center">{f.uploader}</td>
|
||||||
|
<td className="text-center">
|
||||||
|
<button className="cnfm-btn-delete" onClick={() => onDelete(f.id, f.atflId)}>
|
||||||
|
삭제
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EtcAttachments;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export const NumCell = ({ value, onChange }: { value: string; onChange: (v: string) => void }) => (
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="cnfm-input w-full min-w-0 text-right"
|
||||||
|
value={value}
|
||||||
|
onChange={(e) => onChange(e.target.value)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
);
|
||||||
|
|
||||||
|
export const ReadCell = ({ value }: { value: string | number }) => (
|
||||||
|
<td className="bg-gray-50 pr-2 text-right text-[1.25rem] font-semibold">{value}</td>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default { NumCell, ReadCell };
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export { NumCell, ReadCell } from './cells';
|
||||||
|
export { PrivacyConsent } from './privacy-consent';
|
||||||
|
export { EtcAttachments } from './attachments';
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user