Compare commits
514
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70db7662bb | ||
|
|
bb57ff72e7 | ||
|
|
9eef99a435 | ||
|
|
daff1610e3 | ||
|
|
5e3d263750 | ||
|
|
ced62ec0c4 | ||
|
|
3c65e6f8f5 | ||
|
|
1efe2dbe89 | ||
|
|
36e56dcaef | ||
|
|
e42e28d062 | ||
|
|
0786053022 | ||
|
|
791ec1ae2d | ||
|
|
4e4942313a | ||
|
|
e6fcbfbde4 | ||
|
|
ed4d1b73cb | ||
|
|
e3dac52d7e | ||
|
|
d1d8a1eff3 | ||
|
|
4502d55ce1 | ||
|
|
3d3b978070 | ||
|
|
117082c862 | ||
|
|
bfa03aabc0 | ||
|
|
f535cd1010 | ||
|
|
2f6d4ebec1 | ||
|
|
1c3cc5b61b | ||
|
|
db7584cb01 | ||
|
|
b842408f41 | ||
|
|
6e33a62ed9 | ||
|
|
36231a5eca | ||
|
|
b41a317788 | ||
|
|
84fb81b245 | ||
|
|
e18f759fab | ||
|
|
ce9c7b17a2 | ||
|
|
c2d6f7fe37 | ||
|
|
9b18aa9cef | ||
|
|
5eccb58aa9 | ||
|
|
acce1364fa | ||
|
|
625c5f5fe2 | ||
|
|
dffa9d74a0 | ||
|
|
668a8ef844 | ||
|
|
df4d708981 | ||
|
|
c48a46c7ab | ||
|
|
da844fb3a7 | ||
|
|
3e1f89d90f | ||
|
|
559e4ee352 | ||
|
|
a1d43dc65c | ||
|
|
d26cd90b02 | ||
|
|
45f72f7333 | ||
|
|
196d31a084 | ||
|
|
aaf898fb4c | ||
|
|
533e89c919 | ||
|
|
2f0448a98e | ||
|
|
aab8cf9622 | ||
|
|
88113fca1c | ||
|
|
81fc947c9d | ||
|
|
c684440e65 | ||
|
|
4c6222acf1 | ||
|
|
2131ecc315 | ||
|
|
f53c72f31f | ||
|
|
1d3910c157 | ||
|
|
3b2f5c2d5d | ||
|
|
903cdaad45 | ||
|
|
386fc61a3f | ||
|
|
6e354690c5 | ||
|
|
adae670318 | ||
|
|
bdbefbf600 | ||
|
|
939089a79c | ||
|
|
f8354344ff | ||
|
|
e596c1f0a6 | ||
|
|
7f53badcf3 | ||
|
|
1dcf01bb0e | ||
|
|
eec25ab1c4 | ||
|
|
f90f093385 | ||
|
|
befe56fd44 | ||
|
|
47d91424c5 | ||
|
|
ddd72f71d2 | ||
|
|
1a1ff2ec30 | ||
|
|
10d89279bc | ||
|
|
a6f9ba7526 | ||
|
|
19dfe45b0b | ||
|
|
f584e21480 | ||
|
|
6acacbfcf4 | ||
|
|
52a79eca60 | ||
|
|
70faadb27e | ||
|
|
2eb1809f36 | ||
|
|
d9febf8010 | ||
|
|
d4c5787360 | ||
|
|
c8c461e8e8 | ||
|
|
9e2da003f1 | ||
|
|
ae41483bb7 | ||
|
|
d062b8a7d4 | ||
|
|
18825dd0c3 | ||
|
|
6b2ea58b66 | ||
|
|
fdfb37d4d0 | ||
|
|
450de39f8c | ||
|
|
c87ad8ea1b | ||
|
|
b336651503 | ||
|
|
7a1949fc6f | ||
|
|
35a63d7c5c | ||
|
|
031f5e2ed8 | ||
|
|
189b4b7599 | ||
|
|
6ada32cb9f | ||
|
|
5491c524c5 | ||
|
|
8d29f25101 | ||
|
|
28d4b2d831 | ||
|
|
399645a80a | ||
|
|
9d13809d01 | ||
|
|
e8c8db7383 | ||
|
|
b41814ed0c | ||
|
|
d71f2043de | ||
|
|
87ba3e8fa2 | ||
|
|
eabbbf456f | ||
|
|
ebfba7ac8c | ||
|
|
fe4a4a420e | ||
|
|
14ae432833 | ||
|
|
009a38f3ca | ||
|
|
cfc73e4094 | ||
|
|
748be6faa5 | ||
|
|
330e2e5c69 | ||
|
|
343a3f81bf | ||
|
|
13c7d5a0c5 | ||
|
|
a9c38b356a | ||
|
|
4181257afd | ||
|
|
0141ed56c2 | ||
|
|
35dc205810 | ||
|
|
d10a17eaf6 | ||
|
|
a623c53fa5 | ||
|
|
3db8babee7 | ||
|
|
ca7ac992e2 | ||
|
|
a956c9894e | ||
|
|
6c84ba6aeb | ||
|
|
e99b7d8162 | ||
|
|
09bb613929 | ||
|
|
761b0dd502 | ||
|
|
8c72cb3b72 | ||
|
|
35b6f4ae54 | ||
|
|
cf5ade639a | ||
|
|
0dfd5efa97 | ||
|
|
e6cbb9dfd8 | ||
|
|
52c7215cd8 | ||
|
|
fe88732a80 | ||
|
|
aa5f85a3c1 | ||
|
|
843519c3b5 | ||
|
|
c74917d1d9 | ||
|
|
9dca199d78 | ||
|
|
4fa7542aca | ||
|
|
1cd24b5dd5 | ||
|
|
34f1bf5e6a | ||
|
|
675e5f58d1 | ||
|
|
127fb41145 | ||
|
|
8abf32bb53 | ||
|
|
b567e5df13 | ||
|
|
40acdafed2 | ||
|
|
7f6b05e4e5 | ||
|
|
0d4a698c11 | ||
|
|
5bacfb04b5 | ||
|
|
1e8514a0bc | ||
|
|
b6714dd8a4 | ||
|
|
e05c2a03e0 | ||
|
|
914df505ae | ||
|
|
7e59ae6b66 | ||
|
|
eb84a23d7e | ||
|
|
1076120516 | ||
|
|
54ce26adbc | ||
|
|
28d54b615b | ||
|
|
424fa576fb | ||
|
|
7f8e5fe9f9 | ||
|
|
47f1bd012c | ||
|
|
0c2e762cee | ||
|
|
68124e6abb | ||
|
|
5587e6b6a3 | ||
|
|
ac1e98fbaa | ||
|
|
d25f9f3a01 | ||
|
|
fb638752eb | ||
|
|
8c3dd62f6d | ||
|
|
e79635b81a | ||
|
|
e3a9851de6 | ||
|
|
34811d4571 | ||
|
|
3167a9a6e3 | ||
|
|
a29d1f0cc2 | ||
|
|
e76cddd45b | ||
|
|
3c214f4725 | ||
|
|
80861938f3 | ||
|
|
401f2dba13 | ||
|
|
c4d7c516ef | ||
|
|
2f11b1185b | ||
|
|
42274a71b7 | ||
|
|
f1fcfa9ee4 | ||
|
|
afcfbbbf61 | ||
|
|
defba2962d | ||
|
|
4c7666169c | ||
|
|
5580b4301f | ||
|
|
421ff8cb40 | ||
|
|
96b95e0eb9 | ||
|
|
cea2d39df8 | ||
|
|
f4eae0d33e | ||
|
|
716a20cc22 | ||
|
|
873a74492a | ||
|
|
516d93d6fa | ||
|
|
958a8ffe2c | ||
|
|
0286e2a92e | ||
|
|
01e339cc61 | ||
|
|
0e7c9b4a96 | ||
|
|
d5814043d9 | ||
|
|
e81210ec04 | ||
|
|
8d17623d3a | ||
|
|
ba9d7c8172 | ||
|
|
06f5a3cde0 | ||
|
|
25417dcda1 | ||
|
|
9a3b332130 | ||
|
|
1236a24b61 | ||
|
|
f50de743e3 | ||
|
|
0c2568aad0 | ||
|
|
b15cbeb568 | ||
|
|
afdc06638f | ||
|
|
6fb610d9aa | ||
|
|
c14d536133 | ||
|
|
3008ae2eeb | ||
|
|
3b4d9df0e8 | ||
|
|
48d4a5e135 | ||
|
|
ff33565513 | ||
|
|
b40bae1b50 | ||
|
|
0533d229e6 | ||
|
|
bbb755bf56 | ||
|
|
31caee87db | ||
|
|
87cda451f3 | ||
|
|
e2b8f901a3 | ||
|
|
951e2c1f89 | ||
|
|
20fd291cc3 | ||
|
|
ee3ddce41d | ||
|
|
fb160e712b | ||
|
|
9a6cc1779f | ||
|
|
b459d0fbcb | ||
|
|
9816a9c46a | ||
|
|
f4b8f9d65d | ||
|
|
08e8d7343c | ||
|
|
5505791b6e | ||
|
|
1862477641 | ||
|
|
ff9daa2bfd | ||
|
|
23b13e3fdc | ||
|
|
f93f2674df | ||
|
|
1d7d34b7c1 | ||
|
|
9837a7af71 | ||
|
|
d3ef4094c6 | ||
|
|
bf86291016 | ||
|
|
37ace8b34c | ||
|
|
e170790e4c | ||
|
|
c0888ea2a4 | ||
|
|
0fe1aa983c | ||
|
|
180eb1f59d | ||
|
|
1ead18b53c | ||
|
|
9ca61dd60d | ||
|
|
52a0635810 | ||
|
|
2337b4cce2 | ||
|
|
6f51b90178 | ||
|
|
07db5b1fbd | ||
|
|
162e18142c | ||
|
|
6110abebb4 | ||
|
|
05e9082831 | ||
|
|
76a634cf9a | ||
|
|
d4797617a6 | ||
|
|
be67395f13 | ||
|
|
793c673414 | ||
|
|
20e17861e1 | ||
|
|
deb7375d6b | ||
|
|
2a76c279eb | ||
|
|
2767260505 | ||
|
|
bba4a8eeba | ||
|
|
5d1ba3fd87 | ||
|
|
c9786adc77 | ||
|
|
407051287d | ||
|
|
3d178dd6bc | ||
|
|
8ddedc60ac | ||
|
|
ddb8031e55 | ||
|
|
99db9a0b77 | ||
|
|
4126bc2234 | ||
|
|
d4f1ec095e | ||
|
|
bbf3ce3948 | ||
|
|
46cf24c193 | ||
|
|
fb5b8356c7 | ||
|
|
1333bd040a | ||
|
|
013c07ef59 | ||
|
|
29fd59a321 | ||
|
|
3bc152c341 | ||
|
|
ea274f8f7d | ||
|
|
7ac53e56d7 | ||
|
|
7b1c12e952 | ||
|
|
17dafe6530 | ||
|
|
ef331363f7 | ||
|
|
4f10864c2c | ||
|
|
4b5ceb0e0a | ||
|
|
4fa50161fd | ||
|
|
3d27e07ccb | ||
|
|
ca1ca71a62 | ||
|
|
bdd6c7b804 | ||
|
|
04b8082f04 | ||
|
|
82ab1376cc | ||
|
|
2c27a67cc3 | ||
|
|
3451b19b96 | ||
|
|
ae7c1ea1c4 | ||
|
|
9c76b955e2 | ||
|
|
6c4bfe2798 | ||
|
|
98189cd14a | ||
|
|
823ce262bb | ||
|
|
34358400e8 | ||
|
|
da9d069a9a | ||
|
|
58a03678e4 | ||
|
|
5ea68435ed | ||
|
|
58ca85ce90 | ||
|
|
f5c281cf86 | ||
|
|
c72bcea7d9 | ||
|
|
49cd160e76 | ||
|
|
5ca93a25ca | ||
|
|
2ea207a63a | ||
|
|
55554fc781 | ||
|
|
8e78c10304 | ||
|
|
0eb74b46ba | ||
|
|
f21dde8f7d | ||
|
|
e47c00f0b6 | ||
|
|
1fc6707bb3 | ||
|
|
44c5d66afa | ||
|
|
04edb49c9f | ||
|
|
7483d351c3 | ||
|
|
e3eb542e59 | ||
|
|
428b199dd3 | ||
|
|
3c4a6efeea | ||
|
|
dae7024043 | ||
|
|
64e5c26e8c | ||
|
|
84ae60edd6 | ||
|
|
d4c9989069 | ||
|
|
6cda413913 | ||
|
|
a11eaf031d | ||
|
|
3c701359fd | ||
|
|
85ba9fe0ab | ||
|
|
71077f4c8e | ||
|
|
4c7ff53d78 | ||
|
|
bdc3a94ef1 | ||
|
|
83a3810301 | ||
|
|
b31691dd9c | ||
|
|
0647df733a | ||
|
|
0131cae0d7 | ||
|
|
f37b19eab6 | ||
|
|
7c1db5e0e0 | ||
|
|
c6309bf14d | ||
|
|
2c495ab8fd | ||
|
|
ced1b7084d | ||
|
|
c10a2ae1c8 | ||
|
|
3dd09d9fc7 | ||
|
|
46f05dbfa0 | ||
|
|
b0c871eff7 | ||
|
|
4148a87f32 | ||
|
|
bd83fa3417 | ||
|
|
c0b63a655e | ||
|
|
cc21aaede1 | ||
|
|
0c71c80a25 | ||
|
|
823d1d7812 | ||
|
|
a274b5a261 | ||
|
|
49e42757bc | ||
|
|
0964f442be | ||
|
|
73ceeb1b38 | ||
|
|
06f68ec392 | ||
|
|
e5dc347276 | ||
|
|
7c6c43b334 | ||
|
|
8737d1eb0a | ||
|
|
abf53afafc | ||
|
|
fc70963fa9 | ||
|
|
814365d7de | ||
|
|
8c1a976b5b | ||
|
|
66db81071e | ||
|
|
6df6e612bc | ||
|
|
84013993c9 | ||
|
|
a123588e32 | ||
|
|
3fee2a781f | ||
|
|
acaf2dd9f4 | ||
|
|
55839f0913 | ||
|
|
f68131fc13 | ||
|
|
7b9081a125 | ||
|
|
0947b76a6e | ||
|
|
23c18da399 | ||
|
|
ec18f17c79 | ||
|
|
cdfa1e56e5 | ||
|
|
434c3cfc08 | ||
|
|
aee3449578 | ||
|
|
54d3a35b38 | ||
|
|
b640fffd0d | ||
|
|
981e4aab54 | ||
|
|
6b68894d23 | ||
|
|
cc91225b01 | ||
|
|
97a8b2811e | ||
|
|
af8db9457f | ||
|
|
2c3839fc5f | ||
|
|
e9caa1b84d | ||
|
|
5860cf3a22 | ||
|
|
d2d5502f8d | ||
|
|
77f2546cc4 | ||
|
|
4df353518f | ||
|
|
ee114dec7e | ||
|
|
d58b2db786 | ||
|
|
1c2eaef5a4 | ||
|
|
bb7cce47ac | ||
|
|
ba910d6bfe | ||
|
|
2a8c2ae542 | ||
|
|
56f52194a6 | ||
|
|
a71b20ba6f | ||
|
|
b2282accb1 | ||
|
|
5def2ec5ee | ||
|
|
9d6cc405a9 | ||
|
|
1c37591bab | ||
|
|
9a8350dae8 | ||
|
|
77fd719f96 | ||
|
|
aa831141f6 | ||
|
|
fb148a77c1 | ||
|
|
d8d98aee6d | ||
|
|
87f9b90dbf | ||
|
|
b704db99b1 | ||
|
|
f231564548 | ||
|
|
db04b13310 | ||
|
|
9958ea72b8 | ||
|
|
35f765d870 | ||
|
|
b6afaba02a | ||
|
|
c7c69ea5a7 | ||
|
|
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 | ||
|
|
cdaaa34569 | ||
|
|
17637146be | ||
|
|
b4033071a1 | ||
|
|
9b4d2d410d | ||
|
|
4783bbacbd | ||
|
|
3eb028b075 | ||
|
|
c1a03fcabc | ||
|
|
48172aa3f0 | ||
|
|
adf5e288d3 | ||
|
|
d8d5755849 | ||
|
|
9f803fd4ad | ||
|
|
cc4b2ca084 | ||
|
|
0c66a8f3b7 | ||
|
|
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 | ||
|
|
ef7bae98d4 | ||
|
|
9661369708 | ||
|
|
4e8f492006 | ||
|
|
d2a1f5e48b | ||
|
|
69b717f517 | ||
|
|
6d0461eaef | ||
|
|
12e9c2a30c | ||
|
|
6539e5bb80 | ||
|
|
be72a594d7 | ||
|
|
8cc4f58076 | ||
|
|
3f07739756 |
@@ -29,4 +29,5 @@ settings.json
|
|||||||
.agent
|
.agent
|
||||||
|
|
||||||
apps/**/tsconfig.tsbuildinfo
|
apps/**/tsconfig.tsbuildinfo
|
||||||
|
packages/**/tsconfig.tsbuildinfo
|
||||||
logs/
|
logs/
|
||||||
|
|||||||
@@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,15 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"],
|
"@/*": ["./src/*"]
|
||||||
"@common/components": ["../../packages/common/components/dist/"],
|
|
||||||
"@common/network": ["../../packages/common/network/"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": [
|
||||||
"exclude": ["node_modules"]
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts",
|
||||||
|
"../../packages/common/types/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules", ".next", "dist", "coverage", "storybook-static", "public"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { CodeManagementPage as default } from "@/pages/code-management";
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { DesignEditPage } from "@/pages/design-cnstn";
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ params }: PageProps) {
|
||||||
|
const { id } = await params;
|
||||||
|
return <DesignEditPage id={id} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { DesignViewPage } from "@/pages/design-cnstn";
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ params }: PageProps) {
|
||||||
|
const { id } = await params;
|
||||||
|
return <DesignViewPage id={id} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { DesignListPage } from "@/pages/design-cnstn";
|
||||||
|
|
||||||
|
export default DesignListPage;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { DesignRegistPage } from "@/pages/design-cnstn";
|
||||||
|
import { parseTaskSeComCdFromApi } from "@/pages/design-cnstn/lib/design-cnstn-regist-schema";
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
searchParams: Promise<{ taskSeComCd?: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ searchParams }: PageProps) {
|
||||||
|
const params = await searchParams;
|
||||||
|
const taskSeComCd = parseTaskSeComCdFromApi(params.taskSeComCd);
|
||||||
|
return <DesignRegistPage taskSeComCd={taskSeComCd.length ? taskSeComCd : undefined} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { EsntlAtchFileMngPage as default } from "@/pages/esntl-atch-file-mng";
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { FnrsEditPage } from "@/pages/fnrs-cnsltn";
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ params }: PageProps) {
|
||||||
|
const { id } = await params;
|
||||||
|
return <FnrsEditPage id={id} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { FnrsViewPage } from "@/pages/fnrs-cnsltn";
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ params }: PageProps) {
|
||||||
|
const { id } = await params;
|
||||||
|
return <FnrsViewPage id={id} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { FnrsListPage } from "@/pages/fnrs-cnsltn";
|
||||||
|
|
||||||
|
export default FnrsListPage;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { FnrsRegistPage } from "@/pages/fnrs-cnsltn";
|
||||||
|
import { parseTaskSeComCdFromApi } from "@/pages/fnrs-cnsltn/lib/fnrs-cnsltn-regist-schema";
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
searchParams: Promise<{ taskSeComCd?: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ searchParams }: PageProps) {
|
||||||
|
const params = await searchParams;
|
||||||
|
const taskSeComCd = parseTaskSeComCdFromApi(params.taskSeComCd);
|
||||||
|
return <FnrsRegistPage taskSeComCd={taskSeComCd.length ? taskSeComCd : undefined} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { InstlEditPage } from "@/pages/instl-sncn";
|
||||||
|
|
||||||
|
interface InstlSncnEditRouteProps {
|
||||||
|
params: Promise<{ id: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ params }: InstlSncnEditRouteProps) {
|
||||||
|
const { id } = await params;
|
||||||
|
return <InstlEditPage id={id} />;
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { CnfmModifyPage } from "@/pages/instl-sncn";
|
|
||||||
|
|
||||||
export default async function InstlSncnModifyPage({
|
|
||||||
params,
|
|
||||||
}: {
|
|
||||||
params: Promise<{ id: string }>;
|
|
||||||
}) {
|
|
||||||
const { id } = await params;
|
|
||||||
return <CnfmModifyPage id={id} />;
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
import { CnfmViewPage } from "@/pages/instl-sncn";
|
import { InstlViewPage } from "@/pages/instl-sncn";
|
||||||
|
|
||||||
export default async function InstlSncnViewPage({
|
export default async function InstlSncnDetailPage({ params }: { params: Promise<{ id: string }> }) {
|
||||||
params,
|
const { id } = await params;
|
||||||
}: {
|
return <InstlViewPage id={id} />;
|
||||||
params: Promise<{ id: string }>;
|
}
|
||||||
}) {
|
|
||||||
const { id } = await params;
|
|
||||||
return <CnfmViewPage id={id} />;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import { CnfmListPage } from "@/pages/instl-sncn";
|
import { InstlListPage } from "@/pages/instl-sncn";
|
||||||
|
|
||||||
export default CnfmListPage;
|
export default InstlListPage;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { InstlRegistPage } from "@/pages/instl-sncn";
|
||||||
|
|
||||||
|
interface InstlSncnRegistRouteProps {
|
||||||
|
searchParams: Promise<{ taskSeComCd?: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Page({ searchParams }: InstlSncnRegistRouteProps) {
|
||||||
|
const params = await searchParams;
|
||||||
|
const taskSeComCd = params.taskSeComCd
|
||||||
|
? params.taskSeComCd.split(",").filter(Boolean)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
return <InstlRegistPage taskSeComCd={taskSeComCd} />;
|
||||||
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import { CnfmRegistPage } from "@/pages/instl-sncn";
|
|
||||||
|
|
||||||
export default CnfmRegistPage;
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { RvwMnpwMngPage as default } from "@/pages/rvw-mnpw-mng";
|
||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
ACCESS_TOKEN,
|
ACCESS_TOKEN,
|
||||||
AUTH_USER_ID,
|
AUTH_USER_ID,
|
||||||
CLAIM_NAME,
|
CLAIM_NAME,
|
||||||
|
COOKIE_DOMAIN,
|
||||||
REFRESH_TOKEN,
|
REFRESH_TOKEN,
|
||||||
SERVER_API_URL,
|
SERVER_API_URL,
|
||||||
SITE_ID,
|
SITE_ID,
|
||||||
@@ -20,6 +21,10 @@ async function handler(
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"X-Site-Id": SITE_ID,
|
"X-Site-Id": SITE_ID,
|
||||||
};
|
};
|
||||||
|
const deviceId = request.headers.get("X-Device-Id");
|
||||||
|
if (deviceId) {
|
||||||
|
headers["X-Device-Id"] = deviceId;
|
||||||
|
}
|
||||||
let body = {};
|
let body = {};
|
||||||
const isRefreshHandler = params.url.includes("refresh");
|
const isRefreshHandler = params.url.includes("refresh");
|
||||||
|
|
||||||
@@ -39,27 +44,13 @@ async function handler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const targetUrl = `${SERVER_API_URL}/${params.url.join("/")}`;
|
const targetUrl = `${SERVER_API_URL}/${params.url.join("/")}`;
|
||||||
console.log(`[Proxy API] ${method} ${params.url.join("/")} -> ${targetUrl}`);
|
|
||||||
console.log(`[Proxy API] Headers:`, headers);
|
|
||||||
if (!isRefreshHandler) {
|
|
||||||
console.log(`[Proxy API] Body:`, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await fetch(targetUrl, {
|
const result = await fetch(targetUrl, {
|
||||||
method,
|
method,
|
||||||
headers,
|
headers,
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`[Proxy API] Response Status: ${result.status}`);
|
|
||||||
console.log(`[Proxy API] Response Headers:`, {
|
|
||||||
[ACCESS_TOKEN]: result.headers.get(ACCESS_TOKEN),
|
|
||||||
[REFRESH_TOKEN]: result.headers.get(REFRESH_TOKEN) ? '***hidden***' : undefined,
|
|
||||||
[AUTH_USER_ID]: result.headers.get(AUTH_USER_ID),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
console.error(`[Proxy API] Request failed with status ${result.status}`);
|
|
||||||
return NextResponse.json({ message: "Invalid Credentials" }, { status: 401 });
|
return NextResponse.json({ message: "Invalid Credentials" }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,24 +59,16 @@ async function handler(
|
|||||||
const userId = result.headers.get(AUTH_USER_ID);
|
const userId = result.headers.get(AUTH_USER_ID);
|
||||||
|
|
||||||
if (accessToken && userId) {
|
if (accessToken && userId) {
|
||||||
console.log(`[Proxy API] Login successful for user: ${userId}`);
|
|
||||||
const response = NextResponse.json({
|
const response = NextResponse.json({
|
||||||
[ACCESS_TOKEN]: accessToken,
|
[ACCESS_TOKEN]: accessToken,
|
||||||
[AUTH_USER_ID]: userId,
|
[AUTH_USER_ID]: userId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const forwardedHost = request.headers.get("x-forwarded-host");
|
|
||||||
const host = request.headers.get("host");
|
|
||||||
const actualHost = forwardedHost || host || new URL(request.url).hostname.toString();
|
|
||||||
|
|
||||||
// 운영 환경에서 domain 설정
|
|
||||||
const domain = actualHost.includes("hasuon.or.kr") ? ".hasuon.or.kr" : actualHost;
|
|
||||||
|
|
||||||
if (refreshToken) {
|
if (refreshToken) {
|
||||||
cookieStore.set(REFRESH_TOKEN, refreshToken, {
|
cookieStore.set(REFRESH_TOKEN, refreshToken, {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: "strict",
|
sameSite: "strict",
|
||||||
domain: domain,
|
domain: COOKIE_DOMAIN,
|
||||||
path: "/",
|
path: "/",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,367 @@
|
|||||||
|
# 재원협의(fnrs-cnsltn) vs 설치인가(instl-sncn) 차이 분석
|
||||||
|
|
||||||
|
| 항목 | 내용 |
|
||||||
|
| --------- | ----------------------------------------------------------------------------- |
|
||||||
|
| 작성일 | 2026-07-09 |
|
||||||
|
| 기준 구현 | `fnrs-cnsltn` (추가 요구사항 반영 완료) |
|
||||||
|
| 비교 대상 | `instl-sncn` |
|
||||||
|
| 목적 | 두 페이지의 동작·구조 차이를 정리하고, 설치인가 정렬 시 이식 대상을 명확히 함 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 요약
|
||||||
|
|
||||||
|
두 모듈은 **동일한 PBADMS(공공행정 지원) 업무 패턴**을 따르는 형제 페이지다.
|
||||||
|
|
||||||
|
공통 흐름:
|
||||||
|
|
||||||
|
```
|
||||||
|
목록 → TaskSe 선택 후 신청 → 저장(SV) → 신청완료(ST)
|
||||||
|
→ 환경청제출(LE) → 기술검토 → 검토결과 회신(EP)
|
||||||
|
→ 인가승인(TA) → 고시(TB)
|
||||||
|
```
|
||||||
|
|
||||||
|
| 구분 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------- | ----------------- | ---------------- |
|
||||||
|
| 업무명 | 재원협의 | 설치인가 |
|
||||||
|
| 문서번호 | `fnrsCnsltnDocNo` | `instlSncnDocNo` |
|
||||||
|
| docSeComCd | `FNRS` | `INSTL` |
|
||||||
|
| 라우트 | `/fnrs-cnsltn/*` | `/instl-sncn/*` |
|
||||||
|
| pages 파일 수 | 39 | 32 |
|
||||||
|
|
||||||
|
**결론:** `fnrs-cnsltn`이 추가 요구사항이 반영된 기준(reference) 구현이고, `instl-sncn`은 동일 골격이지만 보완요청·결재선 편집·등록/수정 폼 완성도 등에서 미반영·TODO·단순화 상태다.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 파일/폴더 구조
|
||||||
|
|
||||||
|
### 2-1. fnrs-cnsltn에만 존재
|
||||||
|
|
||||||
|
| 경로 | 역할 |
|
||||||
|
| -------------------------------------------- | ------------------------- |
|
||||||
|
| `ui/sections/fnrs-shar-section.tsx` | 재원분담 조회 섹션 |
|
||||||
|
| `ui/sections/supplement-demand-section.tsx` | 보완요청 이력 섹션 |
|
||||||
|
| `ui/components/sortable-prgrs-stts-row.tsx` | 결재선 DnD 편집 행 |
|
||||||
|
| `ui/components/sortable-apln-picker-row.tsx` | 결재선 템플릿 피커 DnD 행 |
|
||||||
|
| `ui/components/aprvr-picker-dialog.tsx` | 결재자 선택 다이얼로그 |
|
||||||
|
| `ui/components/elapr-apln-picker-grid.tsx` | 결재선 편집 그리드 |
|
||||||
|
| `ui/components/elapr-tmplt-select-table.tsx` | 결재서식 선택 테이블 |
|
||||||
|
| `model/reviewer-option.ts` | 결재자 옵션 타입 |
|
||||||
|
|
||||||
|
### 2-2. instl-sncn에만 존재
|
||||||
|
|
||||||
|
| 경로 | 역할 | 비고 |
|
||||||
|
| -------------------------------------- | ------------------- | ------------------------------------------ |
|
||||||
|
| `ui/sections/history-info-section.tsx` | 등록/수정 이력 표시 | **어디에서도 import되지 않음 (dead code)** |
|
||||||
|
|
||||||
|
### 2-3. 공통 구조
|
||||||
|
|
||||||
|
```
|
||||||
|
index.ts
|
||||||
|
ui/
|
||||||
|
{list,view,form,regist,edit}-page.tsx
|
||||||
|
sections/ (basic-info, contact, scale, cost, checklist, attachments, tech-review)
|
||||||
|
components/ (floating-action-buttons, elapr-approval-dialog, elapr-tmplt-picker-dialog, checklist-task-panel)
|
||||||
|
lib/ button-config, save-payload-utils, form-data-mapper, regist-schema, checklist/review utils
|
||||||
|
model/ columns.tsx, view-types.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
App Router도 동일: `page.tsx`, `regist/page.tsx`, `[id]/page.tsx`, `[id]/edit/page.tsx`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 목록 페이지
|
||||||
|
|
||||||
|
### 3-1. 검색 필터
|
||||||
|
|
||||||
|
| 항목 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------------ | ----------------------------------------- | --------------------------------- |
|
||||||
|
| 시도/시군구 API | `@/entities/adstdstr` | 동일 |
|
||||||
|
| 지역 검색 파라미터 | **`admdstCd`** (시군구 우선, 없으면 시도) | **`sidoComCd` + `sggComCd`** 분리 |
|
||||||
|
| "전체" 옵션 | `ALL_SELECT_VALUE = "__ALL__"` SelectItem | 없음 (placeholder만) |
|
||||||
|
| 구분 CodeSelect | `upCd="INSTL"` ※ | `upCd="INSTL"` |
|
||||||
|
| 사업명 | 동일 | 동일 |
|
||||||
|
|
||||||
|
> ※ fnrs 목록의 구분 필터가 `INSTL` 코드를 사용 중이며, TaskSePickerDialog는 `codeUpCd="FNRS"`를 쓴다. **불일치 가능성**이 있어 확인이 필요하다.
|
||||||
|
|
||||||
|
### 3-2. 정렬·페이지네이션
|
||||||
|
|
||||||
|
| 항목 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------------------ | ---------------------- | ------------------------------------- |
|
||||||
|
| 기본 sort (list-page) | `fnrsCnsltnDocNo,desc` | `instlSncnDocNo,desc` |
|
||||||
|
| fallback sort (list.tsx) | `fnrsCnsltnDocNo,desc` | **`regDt,desc`** (list-page와 불일치) |
|
||||||
|
| 페이지 크기 | 10 | 10 |
|
||||||
|
| URL 동기화 | 없음 (`useState` 로컬) | 없음 |
|
||||||
|
|
||||||
|
### 3-3. 테이블 컬럼
|
||||||
|
|
||||||
|
`model/columns.tsx` 로직은 사실상 동일하다. DTO 타입명만 다르다.
|
||||||
|
|
||||||
|
컬럼: 시도, 시군구, 사업명, 업무구분, 담당자, 해당기관, 진행상황, 신청일
|
||||||
|
|
||||||
|
### 3-4. 행 클릭·신청
|
||||||
|
|
||||||
|
| 항목 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------ | ------------------------------------------------------------------ | ------------------ |
|
||||||
|
| 행 클릭 | **조건부 라우팅**: `SV`/`SL` + 등록자 본인 → `/edit`, 그 외 → view | **항상 view** |
|
||||||
|
| useUserStore | 사용 | 미사용 |
|
||||||
|
| 신청 버튼 | TaskSePickerDialog `codeUpCd="FNRS"` | `codeUpCd="INSTL"` |
|
||||||
|
|
||||||
|
```46:54:apps/as/src/pages/fnrs-cnsltn/ui/fnrs-list.tsx
|
||||||
|
const handleRowClick = (row: FnrsCnsltnMngResponseDto) => {
|
||||||
|
const canEdit =
|
||||||
|
(row.prgrsSttsComCd === "SV" || row.prgrsSttsComCd === "SL") &&
|
||||||
|
row.rgtr === userInfo?.userUnqId;
|
||||||
|
|
||||||
|
router.push(
|
||||||
|
canEdit ? `/fnrs-cnsltn/${row.fnrsCnsltnDocNo}/edit` : `/fnrs-cnsltn/${row.fnrsCnsltnDocNo}`,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 상세(View) 페이지
|
||||||
|
|
||||||
|
### 4-1. 섹션 구성
|
||||||
|
|
||||||
|
| 섹션 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------------------------- | ------------------------------------------ | -------------------------- |
|
||||||
|
| BasicInfo | 환경청구분, 확정예산사업번호, 예산신청연도 | **사업구분(`sncnSeCdNm`)** |
|
||||||
|
| ContactInfo | 동일 패턴 | 동일 |
|
||||||
|
| BusinessScale / Cost | 동일 | 동일 |
|
||||||
|
| **FnrsShar (재원분담)** | **있음** | **없음** (도메인 고유) |
|
||||||
|
| Checklist | 동일 | 동일 |
|
||||||
|
| Attachments | 동일 | 동일 |
|
||||||
|
| **SupplementDemand (보완요청)** | **있음** | **없음** |
|
||||||
|
| TechReviewOpinion | 동일 | 동일 |
|
||||||
|
| HistoryInfo | 없음 | 파일만 존재, view 미연결 |
|
||||||
|
| FloatingActionButtons | `docSeComCd="FNRS"` | `docSeComCd="INSTL"` |
|
||||||
|
|
||||||
|
### 4-2. 데이터 훅
|
||||||
|
|
||||||
|
| 항목 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| --------- | ---------------------------- | -------------------- |
|
||||||
|
| 상세 훅 | `useFnrsCnsltnMng` | `useInstlSncnDetail` |
|
||||||
|
| 에러 판정 | `isError \|\| !data?.detDto` | `isError \|\| !data` |
|
||||||
|
| 로딩 | Skeleton | Skeleton |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 등록/수정(Form) 페이지
|
||||||
|
|
||||||
|
### 5-1. 폼 완성도
|
||||||
|
|
||||||
|
| 항목 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------- | --------------------------------- | --------------- |
|
||||||
|
| 저장(SV) | O | O (SV 고정) |
|
||||||
|
| 신청완료(ST) | O (edit 모드) | **없음** |
|
||||||
|
| 삭제 | O (edit 모드, `useConfirm`) | **없음** |
|
||||||
|
| 재원분담 섹션 | `FnrsSharFormSection` + 잔액 검증 | 없음 |
|
||||||
|
| 저장 후 이동 | **`/edit` 유지** | **view로 이동** |
|
||||||
|
| 목록 버튼 | `/fnrs-cnsltn` 고정 | `router.back()` |
|
||||||
|
|
||||||
|
### 5-2. 기본정보 Form 필드
|
||||||
|
|
||||||
|
| 필드 | fnrs | instl |
|
||||||
|
| ----------------- | ---------------- | --------------------------------------- |
|
||||||
|
| taskSe 코드 | `FNRS` | `INSTL` |
|
||||||
|
| 사업구분 | 없음 | **`sncnSeComCd` (SNCNSE 라디오, 필수)** |
|
||||||
|
| BnsPicker 연동 | bizNm ~ bizCn | + **`bgtBizCd`, `bgtAplyYr`** |
|
||||||
|
| 재이용(RE) 조건부 | rtlztnFclt / Usg | 동일 |
|
||||||
|
|
||||||
|
### 5-3. Schema
|
||||||
|
|
||||||
|
| 항목 | fnrs | instl |
|
||||||
|
| ------------------- | ------------------- | -------------- |
|
||||||
|
| 관리 객체 | `fnrsCnsltnMng` | `instlSncnMng` |
|
||||||
|
| 예산 필드 | `cfmtnBgtBizNo` | `bgtBizCd` |
|
||||||
|
| 재원분담 | `fnrsSharList` 배열 | 없음 |
|
||||||
|
| sharAtchFileGroupId | 있음 | 없음 |
|
||||||
|
| privacyConsent | 있음 | 있음 |
|
||||||
|
|
||||||
|
### 5-4. Edit 페이지 래퍼
|
||||||
|
|
||||||
|
| 항목 | fnrs | instl |
|
||||||
|
| ------------------ | ------------------------------- | ------------------------------- |
|
||||||
|
| 로딩 Skeleton | 있음 | **없음** |
|
||||||
|
| 데이터 없음 메시지 | "상세 정보를 찾을 수 없습니다." | "수정 대상을 찾을 수 없습니다." |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. FloatingActionButtons / 결재 / 보완
|
||||||
|
|
||||||
|
### 6-1. FAB 동작 차이
|
||||||
|
|
||||||
|
공통: 역할×상태 기반 버튼(`button-config.ts`), checklist 진행률 검증, elapr pending approval 체크
|
||||||
|
|
||||||
|
| 기능 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| ------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
||||||
|
| 보완완료 (`splmntCmptn`) | **`submitSupplement` API 연동** | **`// TODO` stub** |
|
||||||
|
| 보완요청 (`dmndSplmnt`) | **`buildSupplementReqPayload` + `submitReqSupplement`** | **`// TODO` stub** (문자열만 전달) |
|
||||||
|
| 검토완료 (`rvwCmptn`) | `techReViewSaveCd: "SV"` 후 **결재 다이얼로그 오픈** | `techReViewSaveCd: "CP"`, **다이얼로그 없이 즉시 완료** |
|
||||||
|
| 검토자지정 | `buildElaprPrgrsSttsListFromAplnRows(aplnRows)` | `buildElaprPrgrsSttsListFromApln(aplnPage.content)` |
|
||||||
|
| atrzAprv / atrzRply / grndsChck | TODO handler | TODO handler |
|
||||||
|
|
||||||
|
```576:617:apps/as/src/pages/instl-sncn/ui/components/floating-action-buttons.tsx
|
||||||
|
async function handleSplmntCmptn(context: ActionHandlerContext): Promise<void> {
|
||||||
|
// TODO: 보완완료 API 호출
|
||||||
|
context.onSuccess?.();
|
||||||
|
}
|
||||||
|
// ...
|
||||||
|
async function handleDmndSplmnt(context: ActionHandlerContext): Promise<void> {
|
||||||
|
// TODO: 보완요청 API 호출
|
||||||
|
context.onSuccess?.();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6-2. ElaprApprovalDialog (가장 큰 UX 격차)
|
||||||
|
|
||||||
|
| 항목 | fnrs (419줄) | instl (231줄) |
|
||||||
|
| ---------------- | ------------------------------------------------------ | -------------------------------- |
|
||||||
|
| 결재선 표시 | DnD sortable 편집 테이블 | **읽기 전용** 테이블 |
|
||||||
|
| 결재선 추가/저장 | **지원** (`usePrgrsSttsRows`, `useSaveElaprPrgrsStts`) | 없음 |
|
||||||
|
| 결재자 변경 | **AprvrPickerDialog** | 없음 |
|
||||||
|
| 전결 체크박스 | **있음** (`finalApprovalYn`) | 없음 |
|
||||||
|
| 반려 사유 | API에 `rjctRsn` 전달 | UI는 있으나 **payload에 미전달** |
|
||||||
|
| 저장 전 검증 | `hasUnsavedPrgrsSttsChanges` | 없음 |
|
||||||
|
|
||||||
|
### 6-3. ElaprTmpltPickerDialog
|
||||||
|
|
||||||
|
| 항목 | fnrs | instl |
|
||||||
|
| --------------- | -------------------------------------------------------------------- | ----------------------- |
|
||||||
|
| UI | 2-pane: 서식 테이블 + **결재선 편집 그리드** | 단일 테이블 + 선택 버튼 |
|
||||||
|
| docSeComCd 필터 | `FNRS` | `INSTL` |
|
||||||
|
| onConfirm | `{ tmplt, aplnRows }` 편집 결과 | `onSelect(tmplt)`만 |
|
||||||
|
| 검증 | `validateAllRowsForSave`, `validateAtrzOrder`, `validateUniqueSeqNo` | 없음 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Entity / API / Hook
|
||||||
|
|
||||||
|
### 7-1. Service 메서드
|
||||||
|
|
||||||
|
| 메서드 | fnrs | instl |
|
||||||
|
| ----------------------- | --------------------------- | --------- |
|
||||||
|
| 목록 | `findPage` | `getPage` |
|
||||||
|
| 상세 | `findById` | `getById` |
|
||||||
|
| saveApply | O | O |
|
||||||
|
| techReview | O | O |
|
||||||
|
| changePrgrsSttsComCd | O | O |
|
||||||
|
| remove | O | O |
|
||||||
|
| **submitSupplement** | **O** (`/submitsupplement`) | **X** |
|
||||||
|
| **submitReqSupplement** | **O** (`/reqsupplement`) | **X** |
|
||||||
|
|
||||||
|
### 7-2. 상세 DTO 확장
|
||||||
|
|
||||||
|
**fnrs 추가 필드**
|
||||||
|
|
||||||
|
- `fnrsSharList`, `sharAtchFileList`
|
||||||
|
- `splmntDmndList` (typed)
|
||||||
|
|
||||||
|
**instl 추가 필드**
|
||||||
|
|
||||||
|
- `sncnSeComCd` / `sncnSeCdNm` (인가구분)
|
||||||
|
- `bgtBizCd` (예산사업코드)
|
||||||
|
- `rtlztnFcltSeComNm`, `rtlztnUsgSeComNm`
|
||||||
|
- `splmntDmndList` 타입은 base에 존재하나 view/API 미연결
|
||||||
|
- `instlSncnRegionService` (시도/시군구 — 목록은 adstdstr 사용, 미활용)
|
||||||
|
|
||||||
|
### 7-3. save-payload-utils
|
||||||
|
|
||||||
|
| 함수 | fnrs | instl |
|
||||||
|
| -------------------------------- | ---------------- | --------- |
|
||||||
|
| buildSavePayload | + `fnrsSharList` | shar 없음 |
|
||||||
|
| buildTechReviewReplyPayload | O | O |
|
||||||
|
| **buildSupplementReqPayload** | **O** | **X** |
|
||||||
|
| **buildSupplementSubmitPayload** | **O** | **X** |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. 비즈니스 도메인 차이
|
||||||
|
|
||||||
|
| 영역 | fnrs-cnsltn | instl-sncn |
|
||||||
|
| -------------- | ----------------------------------------- | ------------------------ |
|
||||||
|
| 업무 코드 | `FNRS` | `INSTL` |
|
||||||
|
| TaskSe | FNRS 하위 | INSTL 하위 |
|
||||||
|
| 고시 버튼 라벨 | "재원협의 고시" | "설치인가 고시" |
|
||||||
|
| 재원분담 | **핵심 도메인** (`fnrs-shar-se`) | 해당 없음 |
|
||||||
|
| 인가구분 | 없음 | **`SNCNSE` 코드 (필수)** |
|
||||||
|
| 예산 식별 | `cfmtnBgtBizNo` | `bgtBizCd` |
|
||||||
|
| 진행상태 코드 | SV, ST, LE, ER, TE, EP, TA, TB, SL, TP 등 | **동일 세트 공유** |
|
||||||
|
| 역할 매핑 | ROLE_USER05/04/03/01 | 동일 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. fnrs-cnsltn에만 있는 기능 (추가 요구사항 후보)
|
||||||
|
|
||||||
|
instl-sncn 정렬 시 **우선 이식 대상**:
|
||||||
|
|
||||||
|
1. 목록 행 클릭 조건부 edit 라우팅 (`SV`/`SL` + 등록자)
|
||||||
|
2. 보완요청 전체 플로우 — view 섹션, payload builder, API, FAB handler
|
||||||
|
3. 보완완료 API 연동 (`submitSupplement`)
|
||||||
|
4. 등록/수정 폼 완성 — 신청완료, 삭제, 저장 후 edit 유지
|
||||||
|
5. 결재선 DnD 편집형 `ElaprApprovalDialog` (+ aprvr-picker, sortable rows)
|
||||||
|
6. 결재선 편집형 `ElaprTmpltPickerDialog` (+ apln grid, validation)
|
||||||
|
7. 검토완료 → 결재 다이얼로그 연계 흐름
|
||||||
|
8. 검색 필터 "전체" 옵션 및 `admdstCd` 통합 방식 (백엔드 API에 맞게)
|
||||||
|
9. Edit 페이지 로딩 Skeleton
|
||||||
|
10. entity에 supplement API/hooks 추가
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. instl-sncn에만 있는 기능 (유지 필요)
|
||||||
|
|
||||||
|
1. **`sncnSeComCd` (사업구분/인가구분)** — 도메인 고유
|
||||||
|
2. **`bgtBizCd` / `bgtAplyYr`** BnsPicker 연동
|
||||||
|
3. **`history-info-section.tsx`** — 구현만 있고 view 미연결 (활성화 또는 삭제 결정 필요)
|
||||||
|
4. entity **`instlSncnRegionService`** — 목록은 adstdstr 사용 중이라 중복/레거시 가능
|
||||||
|
5. **`INSTL_SNCN_REGISTER_SELECTION_KEY`** sessionStorage 키
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. 동일·거의 동일 패턴
|
||||||
|
|
||||||
|
| 영역 | 동일도 |
|
||||||
|
| ----------------------------------------------------- | --------------------- |
|
||||||
|
| App Router 4-route 구조 | 100% |
|
||||||
|
| `button-config.ts` 역할×상태 매트릭스 | ~99% (액션명만 다름) |
|
||||||
|
| `columns.tsx` 진행상황 Badge | ~100% |
|
||||||
|
| checklist / contact / scale / cost / attachments 섹션 | ~95% (import 경로만) |
|
||||||
|
| review-step-utils 로직 | ~100% (상수명만 다름) |
|
||||||
|
| TaskSePickerDialog 신청 플로우 | 100% |
|
||||||
|
| FAB 전체 구조·대부분 handler | ~85% |
|
||||||
|
| checklist-form-state, business-cost-utils | 거의 동일 |
|
||||||
|
| shared widgets (`@/widgets/pbadms-sprt`) | 동일 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 12. instl-sncn 정렬 권장 우선순위
|
||||||
|
|
||||||
|
| 우선순위 | 항목 | 근거 |
|
||||||
|
| -------- | ------------------------------------------------------- | ---------------------------- |
|
||||||
|
| P0 | 보완요청/보완완료 API + UI | fnrs 완전 구현 vs instl TODO |
|
||||||
|
| P0 | ElaprApprovalDialog 고도화 | 결재선 편집·전결·반려사유 |
|
||||||
|
| P0 | ElaprTmpltPickerDialog 2-pane | 검토자지정 품질 |
|
||||||
|
| P1 | Form 신청완료/삭제 + 저장 후 edit 유지 | 등록 UX parity |
|
||||||
|
| P1 | 목록 행 클릭 edit 라우팅 | fnrs 추가 요구사항 |
|
||||||
|
| P1 | 검토완료 → 결재 다이얼로그 연계 | 흐름 통일 |
|
||||||
|
| P2 | sort fallback 불일치 수정 (`regDt` vs `instlSncnDocNo`) | instl 내부 버그성 |
|
||||||
|
| P2 | history-info-section 연결 또는 삭제 | dead code 정리 |
|
||||||
|
| P3 | URL search params 동기화 | 양쪽 모두 미구현 (공통 개선) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 13. 참고 코드 위치
|
||||||
|
|
||||||
|
| 주제 | 경로 |
|
||||||
|
| ---------------------------- | ------------------------------------------------------------ |
|
||||||
|
| 목록 edit 라우팅 (fnrs) | `pages/fnrs-cnsltn/ui/fnrs-list.tsx` |
|
||||||
|
| 목록 항상 view (instl) | `pages/instl-sncn/ui/instl-list.tsx` |
|
||||||
|
| view 추가 섹션 (fnrs) | `pages/fnrs-cnsltn/ui/fnrs-view-page.tsx` |
|
||||||
|
| FAB 보완 TODO (instl) | `pages/instl-sncn/ui/components/floating-action-buttons.tsx` |
|
||||||
|
| 결재 다이얼로그 (fnrs) | `pages/fnrs-cnsltn/ui/components/elapr-approval-dialog.tsx` |
|
||||||
|
| 결재 다이얼로그 (instl) | `pages/instl-sncn/ui/components/elapr-approval-dialog.tsx` |
|
||||||
|
| 폼 완성도 (fnrs) | `pages/fnrs-cnsltn/ui/fnrs-form-page.tsx` |
|
||||||
|
| 폼 단순화 (instl) | `pages/instl-sncn/ui/instl-form-page.tsx` |
|
||||||
|
| supplement API (fnrs entity) | `entities/fnrs-cnsltn/api/fnrs-cnsltn-service.ts` |
|
||||||
@@ -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.
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
|
output: "standalone",
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
transpilePackages: ["@common/assets"],
|
transpilePackages: ["@common/assets"],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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",
|
||||||
@@ -19,14 +20,16 @@
|
|||||||
"@faker-js/faker": "^9.9.0",
|
"@faker-js/faker": "^9.9.0",
|
||||||
"@frontend-opensource/use-react-hooks": "^1.1.4",
|
"@frontend-opensource/use-react-hooks": "^1.1.4",
|
||||||
"@hookform/resolvers": "^4.1.3",
|
"@hookform/resolvers": "^4.1.3",
|
||||||
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
"@tanstack/react-query": "^5.75.5",
|
"@tanstack/react-query": "^5.75.5",
|
||||||
"@tanstack/react-query-devtools": "^5.75.5",
|
"@tanstack/react-query-devtools": "^5.75.5",
|
||||||
"@tanstack/react-table": "^8.21.2",
|
"@tanstack/react-table": "^8.21.2",
|
||||||
"axios": "^1.8.1",
|
"axios": "^1.8.1",
|
||||||
|
"class-variance-authority": "^0.7.1",
|
||||||
"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"
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -7,6 +7,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
|||||||
|
|
||||||
import { useMenuStore } from "@/shared/lib";
|
import { useMenuStore } from "@/shared/lib";
|
||||||
import { PageLayout } from "@/shared/ui/page-layout";
|
import { PageLayout } from "@/shared/ui/page-layout";
|
||||||
|
import { authService } from "@/entities/auth";
|
||||||
import type { MenuItem } from "@/entities/menu";
|
import type { MenuItem } from "@/entities/menu";
|
||||||
import { BaseLayout } from "@common/components";
|
import { BaseLayout } from "@common/components";
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ export function BaseLayoutWrapper({ children }: BaseLayoutWrapperProps) {
|
|||||||
return (
|
return (
|
||||||
<BaseLayout
|
<BaseLayout
|
||||||
queryClient={queryClient}
|
queryClient={queryClient}
|
||||||
|
authService={authService}
|
||||||
currentPath={pathname ?? ""}
|
currentPath={pathname ?? ""}
|
||||||
handleMenuClick={handleMenuClick}
|
handleMenuClick={handleMenuClick}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ export function Providers({ children }: ProvidersProps) {
|
|||||||
</AuthWrapper>
|
</AuthWrapper>
|
||||||
</ConfirmProvider>
|
</ConfirmProvider>
|
||||||
</StoreProvider>
|
</StoreProvider>
|
||||||
<ReactQueryDevtools initialIsOpen={false} />
|
<div style={{ fontSize: "1.4rem" }}>
|
||||||
|
<ReactQueryDevtools initialIsOpen={false} />
|
||||||
|
</div>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_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_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,88 @@
|
|||||||
/** 회계구분 트리 노드 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;
|
||||||
|
sortSeq?: number;
|
||||||
|
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;
|
||||||
|
sortSeq?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 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,26 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
CmCdAdstDstrComboResponseDto,
|
||||||
|
CmCdAdstDstrService,
|
||||||
|
} from "../model/adstdstr-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.ADSTDSTR;
|
||||||
|
|
||||||
|
async function findSidoCombo(): Promise<CmCdAdstDstrComboResponseDto[]> {
|
||||||
|
const response = await client.get<CmCdAdstDstrComboResponseDto[]>(`${BASE}/sido`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findGugunCombo(sido: string): Promise<CmCdAdstDstrComboResponseDto[]> {
|
||||||
|
const response = await client.get<CmCdAdstDstrComboResponseDto[]>(`${BASE}/gugun`, {
|
||||||
|
params: { sido },
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const cmCdAdstDstrService = {
|
||||||
|
findSidoCombo,
|
||||||
|
findGugunCombo,
|
||||||
|
} satisfies CmCdAdstDstrService;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import { cmCdAdstDstrService } from "./adstdstr-service";
|
||||||
|
|
||||||
|
const cmCdAdstDstrBaseKey = [ENDPOINT.AS_SERVICE.ADSTDSTR] as const;
|
||||||
|
|
||||||
|
export function useFindSidoCombo() {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...cmCdAdstDstrBaseKey, "findSidoCombo"],
|
||||||
|
queryFn: () => cmCdAdstDstrService.findSidoCombo(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useFindGugunCombo(sido: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...cmCdAdstDstrBaseKey, "findGugunCombo", sido],
|
||||||
|
queryFn: () => cmCdAdstDstrService.findGugunCombo(sido),
|
||||||
|
enabled: Boolean(sido),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export { cmCdAdstDstrService } from "./api/adstdstr-service";
|
||||||
|
export { useFindGugunCombo, useFindSidoCombo } from "./api/queries";
|
||||||
|
export type {
|
||||||
|
CmCdAdstDstrComboResponseDto,
|
||||||
|
CmCdAdstDstrService,
|
||||||
|
} from "./model/adstdstr-interface";
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/** 백엔드 CmCdAdstDstrComboResponseDto */
|
||||||
|
export interface CmCdAdstDstrComboResponseDto {
|
||||||
|
adstDstrCd: string;
|
||||||
|
adstDstrNm: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface CmCdAdstDstrService {
|
||||||
|
findSidoCombo(): Promise<CmCdAdstDstrComboResponseDto[]>;
|
||||||
|
findGugunCombo(sido: string): Promise<CmCdAdstDstrComboResponseDto[]>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { AxiosResponse } from "axios";
|
||||||
|
|
||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type { AttachService } from "../model/attach-interface";
|
||||||
|
|
||||||
|
async function deleteAttachmentByAtflId(atflId: string): Promise<void> {
|
||||||
|
if (!atflId) return;
|
||||||
|
await client.delete(`${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}/${atflId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadAttachmentByAtflCd(atflCd: string): Promise<AxiosResponse> {
|
||||||
|
return await client.get<Blob>(`${ENDPOINT.ATTACH_SERVICE.DOWNLOAD}/${atflCd}`, {
|
||||||
|
responseType: "blob",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const attachService = {
|
||||||
|
deleteAttachmentByAtflId,
|
||||||
|
downloadAttachmentByAtflCd,
|
||||||
|
} satisfies AttachService;
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import { parseFilenameFromResponse } from "../lib/parse-filename-from-response";
|
||||||
|
|
||||||
|
import { attachService } from "./attach-service";
|
||||||
|
|
||||||
|
const attachBaseKey = [ENDPOINT.ATTACH_SERVICE.ATTACHMENTS] as const;
|
||||||
|
const attachDownloadBaseKey = [ENDPOINT.ATTACH_SERVICE.DOWNLOAD] as const;
|
||||||
|
|
||||||
|
export function useDeleteAttachment() {
|
||||||
|
return useMutation({
|
||||||
|
mutationKey: [...attachBaseKey, "delete"],
|
||||||
|
mutationFn: (atflId: string) => attachService.deleteAttachmentByAtflId(atflId),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDownloadAttachmentByAtflCd() {
|
||||||
|
return useMutation({
|
||||||
|
mutationKey: [...attachDownloadBaseKey, "download"],
|
||||||
|
mutationFn: async (atflCd: string) => {
|
||||||
|
const response = await attachService.downloadAttachmentByAtflCd(atflCd);
|
||||||
|
const filename = parseFilenameFromResponse(response);
|
||||||
|
|
||||||
|
const blob = new Blob([response.data]);
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
const link = document.createElement("a");
|
||||||
|
|
||||||
|
link.href = url;
|
||||||
|
link.download = filename;
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
document.body.removeChild(link);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export { attachService } from "./api/attach-service";
|
||||||
|
export { useDeleteAttachment, useDownloadAttachmentByAtflCd } from "./api/queries";
|
||||||
|
export type { Attach, AttachService } from "./model/attach-interface";
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import type { AxiosResponse } from "axios";
|
||||||
|
|
||||||
|
export function parseFilenameFromResponse(response: AxiosResponse): string {
|
||||||
|
const contentDisposition = response.headers["content-disposition"];
|
||||||
|
if (!contentDisposition) return "download";
|
||||||
|
|
||||||
|
const filenameMatch = contentDisposition.match(/filename\*=UTF-8''([^;]+)/);
|
||||||
|
if (!filenameMatch?.[1]) return "download";
|
||||||
|
|
||||||
|
return decodeURIComponent(filenameMatch[1]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { AxiosResponse } from "axios";
|
||||||
|
|
||||||
|
/** 백엔드 AtflMngResponseDto */
|
||||||
|
export interface Attach {
|
||||||
|
atflCd: string;
|
||||||
|
atflSn: number;
|
||||||
|
atflId: string;
|
||||||
|
physFileNm: string;
|
||||||
|
orgnlFileNm: string;
|
||||||
|
atflFlieSz: number;
|
||||||
|
atflType: string;
|
||||||
|
dwnldNocs: number;
|
||||||
|
delYn: string;
|
||||||
|
lnkgDmnId: string;
|
||||||
|
lnkgDmnNm: string;
|
||||||
|
regDt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AttachService {
|
||||||
|
deleteAttachmentByAtflId: (atflId: string) => Promise<void>;
|
||||||
|
downloadAttachmentByAtflCd: (atflCd: string) => Promise<AxiosResponse>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME, ENDPOINT } from "@/shared/config";
|
||||||
|
import {
|
||||||
|
type AuthPayload,
|
||||||
|
type AuthService,
|
||||||
|
clearDeviceId,
|
||||||
|
getOrCreateDeviceId,
|
||||||
|
} from "@common/auth";
|
||||||
|
|
||||||
|
import { clearRefreshTimer, setToken, tokenManager } from "../lib/token-manager";
|
||||||
|
|
||||||
|
async function login(payload: AuthPayload): Promise<void> {
|
||||||
|
const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.LOGIN}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Device-Id": getOrCreateDeviceId(),
|
||||||
|
},
|
||||||
|
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",
|
||||||
|
headers: {
|
||||||
|
"X-Device-Id": getOrCreateDeviceId(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
tokenManager.clearAuthToken();
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
window.dispatchEvent(new CustomEvent("auth:logout"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function logout(): Promise<void> {
|
||||||
|
tokenManager.clearAuthToken();
|
||||||
|
clearDeviceId();
|
||||||
|
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
window.dispatchEvent(new CustomEvent("auth:logout"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const authService: AuthService = {
|
||||||
|
login,
|
||||||
|
silentRefresh,
|
||||||
|
declineSessionExtend: clearRefreshTimer,
|
||||||
|
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,
|
||||||
}
|
clearRefreshTimer,
|
||||||
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();
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
export interface ILogin {
|
|
||||||
userId: string;
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoginService {
|
|
||||||
login(payload: ILogin): Promise<void>;
|
|
||||||
silentRefresh(): Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import { buildBnsSearchDto } from "../lib/build-bns-search-dto";
|
||||||
|
import type {
|
||||||
|
BnsDetailResponseWrapperDto,
|
||||||
|
BnsIfService,
|
||||||
|
BnsListResponseWrapperDto,
|
||||||
|
BnsSearchDto,
|
||||||
|
EmCodeListResponseDto,
|
||||||
|
} from "../model/bns-if-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.BNS_IF;
|
||||||
|
|
||||||
|
async function getBnsList(params: BnsSearchDto): Promise<BnsListResponseWrapperDto> {
|
||||||
|
const response = await client.get<BnsListResponseWrapperDto>(`${BASE}/bns`, {
|
||||||
|
params: buildBnsSearchDto(params),
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getBnsDetail(
|
||||||
|
gbn: string,
|
||||||
|
yr: string,
|
||||||
|
seqNo: string,
|
||||||
|
): Promise<BnsDetailResponseWrapperDto> {
|
||||||
|
const response = await client.get<BnsDetailResponseWrapperDto>(`${BASE}/bns/detail`, {
|
||||||
|
params: { gbn, yr, seqNo },
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getEmCodeList(
|
||||||
|
dpmCd?: string,
|
||||||
|
lclgvrnmntCd?: string,
|
||||||
|
): Promise<EmCodeListResponseDto> {
|
||||||
|
const response = await client.get<EmCodeListResponseDto>(`${BASE}/emCodeList`, {
|
||||||
|
params: { dpmCd, lclgvrnmntCd },
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const bnsIfService = {
|
||||||
|
getBnsList,
|
||||||
|
getBnsDetail,
|
||||||
|
getEmCodeList,
|
||||||
|
} satisfies BnsIfService;
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type { BnsSearchDto } from "../model/bns-if-interface";
|
||||||
|
|
||||||
|
import { bnsIfService } from "./bns-if-service";
|
||||||
|
|
||||||
|
const bnsIfBaseKey = [ENDPOINT.AS_SERVICE.BNS_IF] as const;
|
||||||
|
|
||||||
|
export function useBnsList(params: BnsSearchDto, options?: { enabled?: boolean }) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...bnsIfBaseKey, "getBnsList", params],
|
||||||
|
queryFn: () => bnsIfService.getBnsList(params),
|
||||||
|
enabled: options?.enabled,
|
||||||
|
placeholderData: keepPreviousData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useBnsDetail(gbn: string, yr: string, seqNo: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...bnsIfBaseKey, "getBnsDetail", gbn, yr, seqNo],
|
||||||
|
queryFn: () => bnsIfService.getBnsDetail(gbn, yr, seqNo),
|
||||||
|
enabled: Boolean(gbn && yr && seqNo),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useEmCodeList(dpmCd?: string, lclgvrnmntCd?: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...bnsIfBaseKey, "getEmCodeList", dpmCd, lclgvrnmntCd],
|
||||||
|
queryFn: () => bnsIfService.getEmCodeList(dpmCd, lclgvrnmntCd),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
export { bnsIfService } from "./api/bns-if-service";
|
||||||
|
export { useBnsDetail, useBnsList, useEmCodeList } from "./api/queries";
|
||||||
|
export { buildBnsSearchDto } from "./lib/build-bns-search-dto";
|
||||||
|
export type {
|
||||||
|
BnsDetailResponseDto,
|
||||||
|
BnsDetailResponseWrapperDto,
|
||||||
|
BnsIfService,
|
||||||
|
BnsListResponseDto,
|
||||||
|
BnsListResponseWrapperDto,
|
||||||
|
BnsSearchDto,
|
||||||
|
EmCodeItemDto,
|
||||||
|
EmCodeListResponseDto,
|
||||||
|
} from "./model/bns-if-interface";
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import type { BnsSearchDto } from "../model/bns-if-interface";
|
||||||
|
|
||||||
|
export function buildBnsSearchDto(input: {
|
||||||
|
cPage: number;
|
||||||
|
searchStartYear?: string;
|
||||||
|
searchSido?: string;
|
||||||
|
searchGugun?: string;
|
||||||
|
}): BnsSearchDto {
|
||||||
|
const dto: BnsSearchDto = { cPage: input.cPage };
|
||||||
|
|
||||||
|
const year = input.searchStartYear?.trim();
|
||||||
|
const sido = input.searchSido?.trim();
|
||||||
|
const gugun = input.searchGugun?.trim();
|
||||||
|
|
||||||
|
if (year) dto.searchStartYear = year;
|
||||||
|
if (sido) dto.searchSido = sido;
|
||||||
|
if (gugun) dto.searchGugun = gugun;
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
/** 백엔드 BnsSearchDto */
|
||||||
|
export interface BnsSearchDto {
|
||||||
|
searchStartYear?: string;
|
||||||
|
cPage: number;
|
||||||
|
searchSido?: string;
|
||||||
|
searchGugun?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 BnsListResponseWrapperDto */
|
||||||
|
export interface BnsListResponseWrapperDto {
|
||||||
|
list: BnsListResponseDto[];
|
||||||
|
cnt: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 BnsListResponseDto */
|
||||||
|
export interface BnsListResponseDto {
|
||||||
|
cPage: number;
|
||||||
|
gbn: number;
|
||||||
|
chk: number;
|
||||||
|
seqNo: string;
|
||||||
|
rgnNm: string;
|
||||||
|
sido: string;
|
||||||
|
gugun: string;
|
||||||
|
bzCd: string;
|
||||||
|
bzNm: string;
|
||||||
|
yr: string;
|
||||||
|
strtYr: string;
|
||||||
|
edYr: string;
|
||||||
|
totBzamt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 BnsDetailResponseWrapperDto */
|
||||||
|
export interface BnsDetailResponseWrapperDto {
|
||||||
|
saup: unknown;
|
||||||
|
detail: BnsDetailResponseDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 BnsDetailResponseDto */
|
||||||
|
export interface BnsDetailResponseDto {
|
||||||
|
cPage: number;
|
||||||
|
seqNo: string;
|
||||||
|
confBzCd: string;
|
||||||
|
chngDgr: string;
|
||||||
|
yr: string;
|
||||||
|
sido: string;
|
||||||
|
gugun: string;
|
||||||
|
rvbsnNm: string;
|
||||||
|
lgbsnNm: string;
|
||||||
|
mdmbsnNm: string;
|
||||||
|
lclgvrnmntNm: string;
|
||||||
|
accKdNm: string;
|
||||||
|
bzKdNm: string;
|
||||||
|
untBzNm: string;
|
||||||
|
dtlBzNm: string;
|
||||||
|
mevBzNm: string;
|
||||||
|
ddtlBzNm: string;
|
||||||
|
strtYr: string;
|
||||||
|
edYr: string;
|
||||||
|
aidRt: string;
|
||||||
|
bzStatus: string;
|
||||||
|
bzCd: string;
|
||||||
|
bzNm: string;
|
||||||
|
bzLoc: string;
|
||||||
|
efflWqltStndrdNm: string;
|
||||||
|
goalYear: string;
|
||||||
|
bssProm: string;
|
||||||
|
uppPlan: string;
|
||||||
|
techInsp: string;
|
||||||
|
bssCont: string;
|
||||||
|
rmk: string;
|
||||||
|
inflBscFctNm: string;
|
||||||
|
inflBscFctCd: string;
|
||||||
|
trtMtd: string;
|
||||||
|
swrExtns: string;
|
||||||
|
swrChng: string;
|
||||||
|
swrRnvt: string;
|
||||||
|
totFamNum: string;
|
||||||
|
pumpCnt: string;
|
||||||
|
rvWbsn: string;
|
||||||
|
rvText: string;
|
||||||
|
imprvExpctFlw: string;
|
||||||
|
imprvExpctWqlt: string;
|
||||||
|
trtplntPlEfflWqlt: string;
|
||||||
|
wqltAvg: string;
|
||||||
|
wqltHgh: string;
|
||||||
|
wqltLow: string;
|
||||||
|
stdCost: string;
|
||||||
|
bzEtc: string;
|
||||||
|
bscFctCd: string;
|
||||||
|
bscFctNm: string;
|
||||||
|
fctCpc: string;
|
||||||
|
fctCpcAfr: string;
|
||||||
|
trtDstrArea: string;
|
||||||
|
trtDstrAreaAfr: string;
|
||||||
|
swrTrtPopl: string;
|
||||||
|
swrTrtPoplAfr: string;
|
||||||
|
adstPopl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 EmCodeItemDto */
|
||||||
|
export interface EmCodeItemDto {
|
||||||
|
code: string;
|
||||||
|
data: string;
|
||||||
|
upCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 EmCodeListResponseDto */
|
||||||
|
export interface EmCodeListResponseDto {
|
||||||
|
rvbsnList: EmCodeItemDto[];
|
||||||
|
lgbsnList: EmCodeItemDto[];
|
||||||
|
mdmbsnList: EmCodeItemDto[];
|
||||||
|
accList: EmCodeItemDto[];
|
||||||
|
bzList: EmCodeItemDto[];
|
||||||
|
untList: EmCodeItemDto[];
|
||||||
|
dtlList: EmCodeItemDto[];
|
||||||
|
mevList: EmCodeItemDto[];
|
||||||
|
ddtlList: EmCodeItemDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface BnsIfService {
|
||||||
|
getBnsList(params: BnsSearchDto): Promise<BnsListResponseWrapperDto>;
|
||||||
|
getBnsDetail(gbn: string, yr: string, seqNo: string): Promise<BnsDetailResponseWrapperDto>;
|
||||||
|
getEmCodeList(dpmCd?: string, lclgvrnmntCd?: string): Promise<EmCodeListResponseDto>;
|
||||||
|
}
|
||||||
@@ -11,33 +11,25 @@ import type {
|
|||||||
CklstArtclUpdateRequest,
|
CklstArtclUpdateRequest,
|
||||||
} from "../model/cklst-artcl-interface";
|
} from "../model/cklst-artcl-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.CKLST_ARTCL;
|
||||||
|
|
||||||
async function findPage(params: CklstArtclSearchParams): Promise<PageResponse<CklstArtcl>> {
|
async function findPage(params: CklstArtclSearchParams): Promise<PageResponse<CklstArtcl>> {
|
||||||
const response = await client.get<PageResponse<CklstArtcl>>(
|
const response = await client.get<PageResponse<CklstArtcl>>(BASE, { params });
|
||||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL,
|
|
||||||
{ params },
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findByCklstSn(cklstSn: number): Promise<CklstArtcl[]> {
|
async function findByCklstSn(cklstSn: number): Promise<CklstArtcl[]> {
|
||||||
const response = await client.get<CklstArtcl[]>(
|
const response = await client.get<CklstArtcl[]>(`${BASE}/by-cklst/${cklstSn}`);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/by-cklst/${cklstSn}`,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findById(cklstArtclSn: number, cklstSn: number): Promise<CklstArtcl> {
|
async function findById(cklstArtclSn: number, cklstSn: number): Promise<CklstArtcl> {
|
||||||
const response = await client.get<CklstArtcl>(
|
const response = await client.get<CklstArtcl>(`${BASE}/${cklstArtclSn}/${cklstSn}`);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function create(body: CklstArtclSaveRequest): Promise<CklstArtclId> {
|
async function create(body: CklstArtclSaveRequest): Promise<CklstArtclId> {
|
||||||
const response = await client.post<CklstArtclId>(
|
const response = await client.post<CklstArtclId>(BASE, body);
|
||||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL,
|
|
||||||
body,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,17 +38,12 @@ async function update(
|
|||||||
cklstSn: number,
|
cklstSn: number,
|
||||||
body: CklstArtclUpdateRequest,
|
body: CklstArtclUpdateRequest,
|
||||||
): Promise<CklstArtclId> {
|
): Promise<CklstArtclId> {
|
||||||
const response = await client.put<CklstArtclId>(
|
const response = await client.put<CklstArtclId>(`${BASE}/${cklstArtclSn}/${cklstSn}`, body);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
|
|
||||||
body,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function remove(cklstArtclSn: number, cklstSn: number): Promise<CklstArtclId> {
|
async function remove(cklstArtclSn: number, cklstSn: number): Promise<CklstArtclId> {
|
||||||
const response = await client.delete<CklstArtclId>(
|
const response = await client.delete<CklstArtclId>(`${BASE}/${cklstArtclSn}/${cklstSn}`);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,40 +11,39 @@ import type {
|
|||||||
CklstTreeSearchParams,
|
CklstTreeSearchParams,
|
||||||
} from "../model/cklst-mng-interface";
|
} from "../model/cklst-mng-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.CKLST;
|
||||||
|
|
||||||
async function findPage(params: CklstMngSearchParams): Promise<PageResponse<CklstMng>> {
|
async function findPage(params: CklstMngSearchParams): Promise<PageResponse<CklstMng>> {
|
||||||
const response = await client.get<PageResponse<CklstMng>>(ENDPOINT.AS_CHECKLIST_SERVICE.CKLST, {
|
const response = await client.get<PageResponse<CklstMng>>(BASE, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findById(cklstSn: number): Promise<CklstMng> {
|
async function findById(cklstSn: number): Promise<CklstMng> {
|
||||||
const response = await client.get<CklstMng>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`);
|
const response = await client.get<CklstMng>(`${BASE}/${cklstSn}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findTree(params: CklstTreeSearchParams): Promise<CklstTreeNode[]> {
|
async function findTree(params: CklstTreeSearchParams): Promise<CklstTreeNode[]> {
|
||||||
const response = await client.get<CklstTreeNode[]>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/list/tree`, {
|
const response = await client.get<CklstTreeNode[]>(`${BASE}/list/tree`, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function create(body: CklstMngSaveRequest): Promise<number> {
|
async function create(body: CklstMngSaveRequest): Promise<number> {
|
||||||
const response = await client.post<number>(ENDPOINT.AS_CHECKLIST_SERVICE.CKLST, body);
|
const response = await client.post<number>(BASE, body);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function update(cklstSn: number, body: CklstMngSaveRequest): Promise<number> {
|
async function update(cklstSn: number, body: CklstMngSaveRequest): Promise<number> {
|
||||||
const response = await client.put<number>(
|
const response = await client.put<number>(`${BASE}/${cklstSn}`, body);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`,
|
|
||||||
body,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function remove(cklstSn: number): Promise<number> {
|
async function remove(cklstSn: number): Promise<number> {
|
||||||
const response = await client.delete<number>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`);
|
const response = await client.delete<number>(`${BASE}/${cklstSn}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,18 +11,15 @@ import type {
|
|||||||
CklstRvwUpdateRequest,
|
CklstRvwUpdateRequest,
|
||||||
} from "../model/cklst-rvw-interface";
|
} from "../model/cklst-rvw-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.CKLST_RVW;
|
||||||
|
|
||||||
async function findPage(params: CklstRvwSearchParams): Promise<PageResponse<CklstRvw>> {
|
async function findPage(params: CklstRvwSearchParams): Promise<PageResponse<CklstRvw>> {
|
||||||
const response = await client.get<PageResponse<CklstRvw>>(
|
const response = await client.get<PageResponse<CklstRvw>>(BASE, { params });
|
||||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW,
|
|
||||||
{ params },
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findByArtcl(cklstSn: number, cklstArtclSn: number): Promise<CklstRvw[]> {
|
async function findByArtcl(cklstSn: number, cklstArtclSn: number): Promise<CklstRvw[]> {
|
||||||
const response = await client.get<CklstRvw[]>(
|
const response = await client.get<CklstRvw[]>(`${BASE}/by-artcl/${cklstSn}/${cklstArtclSn}`);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/by-artcl/${cklstSn}/${cklstArtclSn}`,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,17 +28,12 @@ async function findById(
|
|||||||
cklstArtclSn: number,
|
cklstArtclSn: number,
|
||||||
cklstSn: number,
|
cklstSn: number,
|
||||||
): Promise<CklstRvw> {
|
): Promise<CklstRvw> {
|
||||||
const response = await client.get<CklstRvw>(
|
const response = await client.get<CklstRvw>(`${BASE}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`);
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function create(body: CklstRvwSaveRequest): Promise<CklstRvwId> {
|
async function create(body: CklstRvwSaveRequest): Promise<CklstRvwId> {
|
||||||
const response = await client.post<CklstRvwId>(
|
const response = await client.post<CklstRvwId>(BASE, body);
|
||||||
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW,
|
|
||||||
body,
|
|
||||||
);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +44,7 @@ async function update(
|
|||||||
body: CklstRvwUpdateRequest,
|
body: CklstRvwUpdateRequest,
|
||||||
): Promise<CklstRvwId> {
|
): Promise<CklstRvwId> {
|
||||||
const response = await client.put<CklstRvwId>(
|
const response = await client.put<CklstRvwId>(
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
`${BASE}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
@@ -64,7 +56,7 @@ async function remove(
|
|||||||
cklstSn: number,
|
cklstSn: number,
|
||||||
): Promise<CklstRvwId> {
|
): Promise<CklstRvwId> {
|
||||||
const response = await client.delete<CklstRvwId>(
|
const response = await client.delete<CklstRvwId>(
|
||||||
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
`${BASE}/${cklstRvwSn}/${cklstArtclSn}/${cklstSn}`,
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import { cklstArtclService } from "./cklst-artcl-service";
|
|||||||
import { cklstMngService } from "./cklst-mng-service";
|
import { cklstMngService } from "./cklst-mng-service";
|
||||||
import { cklstRvwService } from "./cklst-rvw-service";
|
import { cklstRvwService } from "./cklst-rvw-service";
|
||||||
|
|
||||||
const cklstMngBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST] as const;
|
const cklstMngBaseKey = [ENDPOINT.AS_SERVICE.CKLST] as const;
|
||||||
const cklstArtclBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL] as const;
|
const cklstArtclBaseKey = [ENDPOINT.AS_SERVICE.CKLST_ARTCL] as const;
|
||||||
const cklstRvwBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_RVW] as const;
|
const cklstRvwBaseKey = [ENDPOINT.AS_SERVICE.CKLST_RVW] as const;
|
||||||
|
|
||||||
export function useCklstMngPage(params: CklstMngSearchParams) {
|
export function useCklstMngPage(params: CklstMngSearchParams) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
|
|||||||
@@ -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_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_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,88 @@
|
|||||||
/** 공종구분 트리 노드 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;
|
||||||
|
sortSeq?: number;
|
||||||
|
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;
|
||||||
|
sortSeq?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 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>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,7 @@ interface CodeSelectProps extends React.ComponentPropsWithoutRef<typeof Select>
|
|||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CodeSelect({
|
function CodeSelect({ upCd, useYn, placeholder = "선택", className, ...props }: CodeSelectProps) {
|
||||||
upCd,
|
|
||||||
useYn,
|
|
||||||
placeholder = "선택",
|
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: CodeSelectProps) {
|
|
||||||
const listQuery = useCodeList(useYn ? undefined : upCd);
|
const listQuery = useCodeList(useYn ? undefined : upCd);
|
||||||
const listByUseYnQuery = useCodeListByUseYn(useYn ? upCd : undefined, useYn ?? "");
|
const listByUseYnQuery = useCodeListByUseYn(useYn ? upCd : undefined, useYn ?? "");
|
||||||
|
|
||||||
@@ -34,7 +28,7 @@ function CodeSelect({
|
|||||||
return (
|
return (
|
||||||
<Select {...props} disabled={props.disabled || isLoading}>
|
<Select {...props} disabled={props.disabled || isLoading}>
|
||||||
<SelectTrigger className={cn("w-[12rem]", className)}>
|
<SelectTrigger className={cn("w-[12rem]", className)}>
|
||||||
<SelectValue placeholder={isLoading ? "로딩 중…" : placeholder} />
|
<SelectValue placeholder={placeholder} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{codes?.map((item) => (
|
{codes?.map((item) => (
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnBizCstId,
|
||||||
|
DesignCnstnBizCstResponseDto,
|
||||||
|
DesignCnstnBizCstSaveRequestDto,
|
||||||
|
DesignCnstnBizCstSearchDto,
|
||||||
|
DesignCnstnBizCstService,
|
||||||
|
DesignCnstnBizCstUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-biz-cst-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_CST;
|
||||||
|
|
||||||
|
async function findPage(
|
||||||
|
searchDto: DesignCnstnBizCstSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnBizCstResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<DesignCnstnBizCstResponseDto>>(BASE, {
|
||||||
|
params: searchDto,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
acntgSeCd: string,
|
||||||
|
): Promise<DesignCnstnBizCstResponseDto> {
|
||||||
|
const response = await client.get<DesignCnstnBizCstResponseDto>(
|
||||||
|
`${BASE}/${designCnstnDocNo}/${acntgSeCd}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(body: DesignCnstnBizCstSaveRequestDto): Promise<DesignCnstnBizCstId> {
|
||||||
|
const response = await client.post<DesignCnstnBizCstId>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
acntgSeCd: string,
|
||||||
|
body: DesignCnstnBizCstUpdateRequestDto,
|
||||||
|
): Promise<void> {
|
||||||
|
await client.put<void>(`${BASE}/${designCnstnDocNo}/${acntgSeCd}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteDesignCnstnBizCst(designCnstnDocNo: string, acntgSeCd: string): Promise<void> {
|
||||||
|
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${acntgSeCd}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const designCnstnBizCstService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
update,
|
||||||
|
delete: deleteDesignCnstnBizCst,
|
||||||
|
} satisfies DesignCnstnBizCstService;
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnBizSclId,
|
||||||
|
DesignCnstnBizSclResponseDto,
|
||||||
|
DesignCnstnBizSclSaveRequestDto,
|
||||||
|
DesignCnstnBizSclSearchDto,
|
||||||
|
DesignCnstnBizSclService,
|
||||||
|
DesignCnstnBizSclUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-biz-scl-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_SCL;
|
||||||
|
|
||||||
|
async function findPage(
|
||||||
|
searchDto: DesignCnstnBizSclSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnBizSclResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<DesignCnstnBizSclResponseDto>>(BASE, {
|
||||||
|
params: searchDto,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
cnstpSeCd: string,
|
||||||
|
): Promise<DesignCnstnBizSclResponseDto> {
|
||||||
|
const response = await client.get<DesignCnstnBizSclResponseDto>(
|
||||||
|
`${BASE}/${designCnstnDocNo}/${cnstpSeCd}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(body: DesignCnstnBizSclSaveRequestDto): Promise<DesignCnstnBizSclId> {
|
||||||
|
const response = await client.post<DesignCnstnBizSclId>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
cnstpSeCd: string,
|
||||||
|
body: DesignCnstnBizSclUpdateRequestDto,
|
||||||
|
): Promise<void> {
|
||||||
|
await client.put<void>(`${BASE}/${designCnstnDocNo}/${cnstpSeCd}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteDesignCnstnBizScl(designCnstnDocNo: string, cnstpSeCd: string): Promise<void> {
|
||||||
|
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${cnstpSeCd}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const designCnstnBizSclService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
update,
|
||||||
|
delete: deleteDesignCnstnBizScl,
|
||||||
|
} satisfies DesignCnstnBizSclService;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnEsntlAtchFileId,
|
||||||
|
DesignCnstnEsntlAtchFileResponseDto,
|
||||||
|
DesignCnstnEsntlAtchFileSaveRequestDto,
|
||||||
|
DesignCnstnEsntlAtchFileSearchDto,
|
||||||
|
DesignCnstnEsntlAtchFileService,
|
||||||
|
DesignCnstnEsntlAtchFileUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-esntl-atch-file-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_ESNTL_ATCH_FILE;
|
||||||
|
|
||||||
|
async function findPage(
|
||||||
|
searchDto: DesignCnstnEsntlAtchFileSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnEsntlAtchFileResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<DesignCnstnEsntlAtchFileResponseDto>>(BASE, {
|
||||||
|
params: searchDto,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
esntlAtchFileId: string,
|
||||||
|
): Promise<DesignCnstnEsntlAtchFileResponseDto> {
|
||||||
|
const response = await client.get<DesignCnstnEsntlAtchFileResponseDto>(
|
||||||
|
`${BASE}/${designCnstnDocNo}/${esntlAtchFileId}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(
|
||||||
|
body: DesignCnstnEsntlAtchFileSaveRequestDto,
|
||||||
|
): Promise<DesignCnstnEsntlAtchFileId> {
|
||||||
|
const response = await client.post<DesignCnstnEsntlAtchFileId>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
esntlAtchFileId: string,
|
||||||
|
body: DesignCnstnEsntlAtchFileUpdateRequestDto,
|
||||||
|
): Promise<void> {
|
||||||
|
await client.put<void>(`${BASE}/${designCnstnDocNo}/${esntlAtchFileId}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteDesignCnstnEsntlAtchFile(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
esntlAtchFileId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${esntlAtchFileId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const designCnstnEsntlAtchFileService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
update,
|
||||||
|
delete: deleteDesignCnstnEsntlAtchFile,
|
||||||
|
} satisfies DesignCnstnEsntlAtchFileService;
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnApplySaveRequestDto,
|
||||||
|
DesignCnstnMngDetResponseDto,
|
||||||
|
DesignCnstnMngResponseDto,
|
||||||
|
DesignCnstnMngSaveRequestDto,
|
||||||
|
DesignCnstnMngSearchDto,
|
||||||
|
DesignCnstnMngService,
|
||||||
|
DesignCnstnMngUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-mng-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN;
|
||||||
|
|
||||||
|
async function findPage(
|
||||||
|
searchDto: DesignCnstnMngSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnMngResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<DesignCnstnMngResponseDto>>(BASE, {
|
||||||
|
params: searchDto,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(id: string): Promise<DesignCnstnMngDetResponseDto> {
|
||||||
|
const response = await client.get<DesignCnstnMngDetResponseDto>(`${BASE}/${id}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(body: DesignCnstnMngSaveRequestDto): Promise<string> {
|
||||||
|
const response = await client.post<string>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveApply(body: DesignCnstnApplySaveRequestDto): Promise<string> {
|
||||||
|
const response = await client.post<string>(`${BASE}/save-apply`, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(id: string, body: DesignCnstnMngUpdateRequestDto): Promise<void> {
|
||||||
|
await client.put<void>(`${BASE}/${id}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function techReview(id: string, body: DesignCnstnApplySaveRequestDto): Promise<void> {
|
||||||
|
await client.post<void>(`${BASE}/${id}/tech-review`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteDesignCnstnMng(id: string): Promise<void> {
|
||||||
|
await client.delete<void>(`${BASE}/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const designCnstnMngService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
saveApply,
|
||||||
|
update,
|
||||||
|
techReview,
|
||||||
|
delete: deleteDesignCnstnMng,
|
||||||
|
} satisfies DesignCnstnMngService;
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnRvwOpnnId,
|
||||||
|
DesignCnstnRvwOpnnResponseDto,
|
||||||
|
DesignCnstnRvwOpnnSaveRequestDto,
|
||||||
|
DesignCnstnRvwOpnnSearchDto,
|
||||||
|
DesignCnstnRvwOpnnService,
|
||||||
|
DesignCnstnRvwOpnnUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-rvw-opnn-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_RVW_OPNN;
|
||||||
|
|
||||||
|
async function findPage(
|
||||||
|
searchDto: DesignCnstnRvwOpnnSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnRvwOpnnResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<DesignCnstnRvwOpnnResponseDto>>(BASE, {
|
||||||
|
params: searchDto,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
rvwOpnnSn: number,
|
||||||
|
): Promise<DesignCnstnRvwOpnnResponseDto> {
|
||||||
|
const response = await client.get<DesignCnstnRvwOpnnResponseDto>(
|
||||||
|
`${BASE}/${designCnstnDocNo}/${rvwOpnnSn}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(body: DesignCnstnRvwOpnnSaveRequestDto): Promise<DesignCnstnRvwOpnnId> {
|
||||||
|
const response = await client.post<DesignCnstnRvwOpnnId>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
rvwOpnnSn: number,
|
||||||
|
body: DesignCnstnRvwOpnnUpdateRequestDto,
|
||||||
|
): Promise<void> {
|
||||||
|
await client.put<void>(`${BASE}/${designCnstnDocNo}/${rvwOpnnSn}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteDesignCnstnRvwOpnn(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
rvwOpnnSn: number,
|
||||||
|
): Promise<void> {
|
||||||
|
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${rvwOpnnSn}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const designCnstnRvwOpnnService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
update,
|
||||||
|
delete: deleteDesignCnstnRvwOpnn,
|
||||||
|
} satisfies DesignCnstnRvwOpnnService;
|
||||||
@@ -0,0 +1,411 @@
|
|||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnBizCstSaveRequestDto,
|
||||||
|
DesignCnstnBizCstSearchDto,
|
||||||
|
DesignCnstnBizCstUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-biz-cst-interface";
|
||||||
|
import type {
|
||||||
|
DesignCnstnBizSclSaveRequestDto,
|
||||||
|
DesignCnstnBizSclSearchDto,
|
||||||
|
DesignCnstnBizSclUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-biz-scl-interface";
|
||||||
|
import type {
|
||||||
|
DesignCnstnEsntlAtchFileSaveRequestDto,
|
||||||
|
DesignCnstnEsntlAtchFileSearchDto,
|
||||||
|
DesignCnstnEsntlAtchFileUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-esntl-atch-file-interface";
|
||||||
|
import type {
|
||||||
|
DesignCnstnApplySaveRequestDto,
|
||||||
|
DesignCnstnMngSaveRequestDto,
|
||||||
|
DesignCnstnMngSearchDto,
|
||||||
|
DesignCnstnMngUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-mng-interface";
|
||||||
|
import type {
|
||||||
|
DesignCnstnRvwOpnnSaveRequestDto,
|
||||||
|
DesignCnstnRvwOpnnSearchDto,
|
||||||
|
DesignCnstnRvwOpnnUpdateRequestDto,
|
||||||
|
} from "../model/design-cnstn-rvw-opnn-interface";
|
||||||
|
|
||||||
|
import { designCnstnBizCstService } from "./design-cnstn-biz-cst-service";
|
||||||
|
import { designCnstnBizSclService } from "./design-cnstn-biz-scl-service";
|
||||||
|
import { designCnstnEsntlAtchFileService } from "./design-cnstn-esntl-atch-file-service";
|
||||||
|
import { designCnstnMngService } from "./design-cnstn-mng-service";
|
||||||
|
import { designCnstnRvwOpnnService } from "./design-cnstn-rvw-opnn-service";
|
||||||
|
|
||||||
|
export const designCnstnMngBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN] as const;
|
||||||
|
export const designCnstnBizCstBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_CST] as const;
|
||||||
|
export const designCnstnBizSclBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_SCL] as const;
|
||||||
|
export const designCnstnEsntlAtchFileBaseKey = [
|
||||||
|
ENDPOINT.AS_SERVICE.DESIGN_CNSTN_ESNTL_ATCH_FILE,
|
||||||
|
] as const;
|
||||||
|
export const designCnstnRvwOpnnBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_RVW_OPNN] as const;
|
||||||
|
|
||||||
|
/* ─── DesignCnstnMng ─── */
|
||||||
|
|
||||||
|
export function useDesignCnstnMngPage(params: DesignCnstnMngSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnMngBaseKey, "findPage", params],
|
||||||
|
queryFn: () => designCnstnMngService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDesignCnstnMng(id: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||||
|
queryFn: () => designCnstnMngService.findById(id!),
|
||||||
|
enabled: Boolean(id),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveDesignCnstnMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: DesignCnstnMngSaveRequestDto) => designCnstnMngService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveApplyDesignCnstnMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: DesignCnstnApplySaveRequestDto) => designCnstnMngService.saveApply(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateDesignCnstnMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ id, body }: { id: string; body: DesignCnstnMngUpdateRequestDto }) =>
|
||||||
|
designCnstnMngService.update(id, body),
|
||||||
|
onSuccess: (_data, { id }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useTechReviewDesignCnstnMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ id, body }: { id: string; body: DesignCnstnApplySaveRequestDto }) =>
|
||||||
|
designCnstnMngService.techReview(id, body),
|
||||||
|
onSuccess: (_data, { id }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteDesignCnstnMng() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (id: string) => designCnstnMngService.delete(id),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── DesignCnstnBizCst ─── */
|
||||||
|
|
||||||
|
export function useDesignCnstnBizCstPage(params: DesignCnstnBizCstSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnBizCstBaseKey, "findPage", params],
|
||||||
|
queryFn: () => designCnstnBizCstService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDesignCnstnBizCst(
|
||||||
|
designCnstnDocNo: string | null | undefined,
|
||||||
|
acntgSeCd: string | null | undefined,
|
||||||
|
) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnBizCstBaseKey, "findById", designCnstnDocNo, acntgSeCd],
|
||||||
|
queryFn: () => designCnstnBizCstService.findById(designCnstnDocNo!, acntgSeCd!),
|
||||||
|
enabled: Boolean(designCnstnDocNo && acntgSeCd),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveDesignCnstnBizCst() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: DesignCnstnBizCstSaveRequestDto) => designCnstnBizCstService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateDesignCnstnBizCst() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
acntgSeCd,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
acntgSeCd: string;
|
||||||
|
body: DesignCnstnBizCstUpdateRequestDto;
|
||||||
|
}) => designCnstnBizCstService.update(designCnstnDocNo, acntgSeCd, body),
|
||||||
|
onSuccess: (_data, { designCnstnDocNo, acntgSeCd }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...designCnstnBizCstBaseKey, "findById", designCnstnDocNo, acntgSeCd],
|
||||||
|
});
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteDesignCnstnBizCst() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
acntgSeCd,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
acntgSeCd: string;
|
||||||
|
}) => designCnstnBizCstService.delete(designCnstnDocNo, acntgSeCd),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── DesignCnstnBizScl ─── */
|
||||||
|
|
||||||
|
export function useDesignCnstnBizSclPage(params: DesignCnstnBizSclSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnBizSclBaseKey, "findPage", params],
|
||||||
|
queryFn: () => designCnstnBizSclService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDesignCnstnBizScl(
|
||||||
|
designCnstnDocNo: string | null | undefined,
|
||||||
|
cnstpSeCd: string | null | undefined,
|
||||||
|
) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnBizSclBaseKey, "findById", designCnstnDocNo, cnstpSeCd],
|
||||||
|
queryFn: () => designCnstnBizSclService.findById(designCnstnDocNo!, cnstpSeCd!),
|
||||||
|
enabled: Boolean(designCnstnDocNo && cnstpSeCd),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveDesignCnstnBizScl() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: DesignCnstnBizSclSaveRequestDto) => designCnstnBizSclService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateDesignCnstnBizScl() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
cnstpSeCd,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
body: DesignCnstnBizSclUpdateRequestDto;
|
||||||
|
}) => designCnstnBizSclService.update(designCnstnDocNo, cnstpSeCd, body),
|
||||||
|
onSuccess: (_data, { designCnstnDocNo, cnstpSeCd }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...designCnstnBizSclBaseKey, "findById", designCnstnDocNo, cnstpSeCd],
|
||||||
|
});
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteDesignCnstnBizScl() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
cnstpSeCd,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
}) => designCnstnBizSclService.delete(designCnstnDocNo, cnstpSeCd),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── DesignCnstnEsntlAtchFile ─── */
|
||||||
|
|
||||||
|
export function useDesignCnstnEsntlAtchFilePage(params: DesignCnstnEsntlAtchFileSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnEsntlAtchFileBaseKey, "findPage", params],
|
||||||
|
queryFn: () => designCnstnEsntlAtchFileService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDesignCnstnEsntlAtchFile(
|
||||||
|
designCnstnDocNo: string | null | undefined,
|
||||||
|
esntlAtchFileId: string | null | undefined,
|
||||||
|
) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [
|
||||||
|
...designCnstnEsntlAtchFileBaseKey,
|
||||||
|
"findById",
|
||||||
|
designCnstnDocNo,
|
||||||
|
esntlAtchFileId,
|
||||||
|
],
|
||||||
|
queryFn: () =>
|
||||||
|
designCnstnEsntlAtchFileService.findById(designCnstnDocNo!, esntlAtchFileId!),
|
||||||
|
enabled: Boolean(designCnstnDocNo && esntlAtchFileId),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveDesignCnstnEsntlAtchFile() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: DesignCnstnEsntlAtchFileSaveRequestDto) =>
|
||||||
|
designCnstnEsntlAtchFileService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateDesignCnstnEsntlAtchFile() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
esntlAtchFileId,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
body: DesignCnstnEsntlAtchFileUpdateRequestDto;
|
||||||
|
}) => designCnstnEsntlAtchFileService.update(designCnstnDocNo, esntlAtchFileId, body),
|
||||||
|
onSuccess: (_data, { designCnstnDocNo, esntlAtchFileId }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [
|
||||||
|
...designCnstnEsntlAtchFileBaseKey,
|
||||||
|
"findById",
|
||||||
|
designCnstnDocNo,
|
||||||
|
esntlAtchFileId,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteDesignCnstnEsntlAtchFile() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
esntlAtchFileId,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
}) => designCnstnEsntlAtchFileService.delete(designCnstnDocNo, esntlAtchFileId),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ─── DesignCnstnRvwOpnn ─── */
|
||||||
|
|
||||||
|
export function useDesignCnstnRvwOpnnPage(params: DesignCnstnRvwOpnnSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnRvwOpnnBaseKey, "findPage", params],
|
||||||
|
queryFn: () => designCnstnRvwOpnnService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDesignCnstnRvwOpnn(
|
||||||
|
designCnstnDocNo: string | null | undefined,
|
||||||
|
rvwOpnnSn: number | null | undefined,
|
||||||
|
) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...designCnstnRvwOpnnBaseKey, "findById", designCnstnDocNo, rvwOpnnSn],
|
||||||
|
queryFn: () => designCnstnRvwOpnnService.findById(designCnstnDocNo!, rvwOpnnSn!),
|
||||||
|
enabled: Boolean(designCnstnDocNo && rvwOpnnSn != null),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveDesignCnstnRvwOpnn() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: DesignCnstnRvwOpnnSaveRequestDto) => designCnstnRvwOpnnService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateDesignCnstnRvwOpnn() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
rvwOpnnSn,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
rvwOpnnSn: number;
|
||||||
|
body: DesignCnstnRvwOpnnUpdateRequestDto;
|
||||||
|
}) => designCnstnRvwOpnnService.update(designCnstnDocNo, rvwOpnnSn, body),
|
||||||
|
onSuccess: (_data, { designCnstnDocNo, rvwOpnnSn }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...designCnstnRvwOpnnBaseKey, "findById", designCnstnDocNo, rvwOpnnSn],
|
||||||
|
});
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteDesignCnstnRvwOpnn() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
designCnstnDocNo,
|
||||||
|
rvwOpnnSn,
|
||||||
|
}: {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
rvwOpnnSn: number;
|
||||||
|
}) => designCnstnRvwOpnnService.delete(designCnstnDocNo, rvwOpnnSn),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
export { designCnstnBizCstService } from "./api/design-cnstn-biz-cst-service";
|
||||||
|
export { designCnstnBizSclService } from "./api/design-cnstn-biz-scl-service";
|
||||||
|
export { designCnstnEsntlAtchFileService } from "./api/design-cnstn-esntl-atch-file-service";
|
||||||
|
export { designCnstnMngService } from "./api/design-cnstn-mng-service";
|
||||||
|
export { designCnstnRvwOpnnService } from "./api/design-cnstn-rvw-opnn-service";
|
||||||
|
export {
|
||||||
|
designCnstnBizCstBaseKey,
|
||||||
|
designCnstnBizSclBaseKey,
|
||||||
|
designCnstnEsntlAtchFileBaseKey,
|
||||||
|
designCnstnMngBaseKey,
|
||||||
|
designCnstnRvwOpnnBaseKey,
|
||||||
|
useDeleteDesignCnstnBizCst,
|
||||||
|
useDeleteDesignCnstnBizScl,
|
||||||
|
useDeleteDesignCnstnEsntlAtchFile,
|
||||||
|
useDeleteDesignCnstnMng,
|
||||||
|
useDeleteDesignCnstnRvwOpnn,
|
||||||
|
useDesignCnstnBizCst,
|
||||||
|
useDesignCnstnBizCstPage,
|
||||||
|
useDesignCnstnBizScl,
|
||||||
|
useDesignCnstnBizSclPage,
|
||||||
|
useDesignCnstnEsntlAtchFile,
|
||||||
|
useDesignCnstnEsntlAtchFilePage,
|
||||||
|
useDesignCnstnMng,
|
||||||
|
useDesignCnstnMngPage,
|
||||||
|
useDesignCnstnRvwOpnn,
|
||||||
|
useDesignCnstnRvwOpnnPage,
|
||||||
|
useSaveApplyDesignCnstnMng,
|
||||||
|
useSaveDesignCnstnBizCst,
|
||||||
|
useSaveDesignCnstnBizScl,
|
||||||
|
useSaveDesignCnstnEsntlAtchFile,
|
||||||
|
useSaveDesignCnstnMng,
|
||||||
|
useSaveDesignCnstnRvwOpnn,
|
||||||
|
useTechReviewDesignCnstnMng,
|
||||||
|
useUpdateDesignCnstnBizCst,
|
||||||
|
useUpdateDesignCnstnBizScl,
|
||||||
|
useUpdateDesignCnstnEsntlAtchFile,
|
||||||
|
useUpdateDesignCnstnMng,
|
||||||
|
useUpdateDesignCnstnRvwOpnn,
|
||||||
|
} from "./api/queries";
|
||||||
|
export type {
|
||||||
|
DesignCnstnBizCstId,
|
||||||
|
DesignCnstnBizCstResponseDto,
|
||||||
|
DesignCnstnBizCstSaveRequestDto,
|
||||||
|
DesignCnstnBizCstSearchDto,
|
||||||
|
DesignCnstnBizCstService,
|
||||||
|
DesignCnstnBizCstUpdateRequestDto,
|
||||||
|
} from "./model/design-cnstn-biz-cst-interface";
|
||||||
|
export type {
|
||||||
|
DesignCnstnBizSclId,
|
||||||
|
DesignCnstnBizSclResponseDto,
|
||||||
|
DesignCnstnBizSclSaveRequestDto,
|
||||||
|
DesignCnstnBizSclSearchDto,
|
||||||
|
DesignCnstnBizSclService,
|
||||||
|
DesignCnstnBizSclUpdateRequestDto,
|
||||||
|
} from "./model/design-cnstn-biz-scl-interface";
|
||||||
|
export type {
|
||||||
|
DesignCnstnEsntlAtchFileId,
|
||||||
|
DesignCnstnEsntlAtchFileResponseDto,
|
||||||
|
DesignCnstnEsntlAtchFileSaveRequestDto,
|
||||||
|
DesignCnstnEsntlAtchFileSearchDto,
|
||||||
|
DesignCnstnEsntlAtchFileService,
|
||||||
|
DesignCnstnEsntlAtchFileUpdateRequestDto,
|
||||||
|
} from "./model/design-cnstn-esntl-atch-file-interface";
|
||||||
|
export type {
|
||||||
|
AtflMngClientResponseDto,
|
||||||
|
BizCstItem,
|
||||||
|
BizCstTreeDto,
|
||||||
|
BizSclTreeDto,
|
||||||
|
BzScaleItem,
|
||||||
|
DesignCnstnApplySaveRequestDto,
|
||||||
|
DesignCnstnMngDetResponseDto,
|
||||||
|
DesignCnstnMngResponseDto,
|
||||||
|
DesignCnstnMngSaveRequestDto,
|
||||||
|
DesignCnstnMngSearchDto,
|
||||||
|
DesignCnstnMngService,
|
||||||
|
DesignCnstnMngUpdateRequestDto,
|
||||||
|
DesignCnstnRvwOpnnResponseDto,
|
||||||
|
DesignCnstnRvwOpnnSaveRequestDto,
|
||||||
|
ElaprDocPrgrsClientResponseDto,
|
||||||
|
EsntlAtchFileItem,
|
||||||
|
EsntlAtchFileMngTreeResponseDto,
|
||||||
|
} from "./model/design-cnstn-mng-interface";
|
||||||
|
export type {
|
||||||
|
DesignCnstnRvwOpnnId,
|
||||||
|
DesignCnstnRvwOpnnSearchDto,
|
||||||
|
DesignCnstnRvwOpnnService,
|
||||||
|
DesignCnstnRvwOpnnUpdateRequestDto,
|
||||||
|
} from "./model/design-cnstn-rvw-opnn-interface";
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizCstId */
|
||||||
|
export interface DesignCnstnBizCstId {
|
||||||
|
designCnstnMng: string;
|
||||||
|
acntgSeCd: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizCstSaveRequestDto */
|
||||||
|
export interface DesignCnstnBizCstSaveRequestDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
acntgSeCd: string;
|
||||||
|
bscPlanAmt?: number;
|
||||||
|
bgtRfltAmt?: number;
|
||||||
|
tstmDesignAmt?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizCstUpdateRequestDto */
|
||||||
|
export interface DesignCnstnBizCstUpdateRequestDto {
|
||||||
|
bscPlanAmt?: number;
|
||||||
|
bgtRfltAmt?: number;
|
||||||
|
tstmDesignAmt?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizCstSearchDto + Pageable */
|
||||||
|
export interface DesignCnstnBizCstSearchDto extends PageableParams {
|
||||||
|
designCnstnDocNo?: string;
|
||||||
|
acntgSeCd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizCstResponseDto */
|
||||||
|
export interface DesignCnstnBizCstResponseDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
acntgSeCd: string;
|
||||||
|
bscPlanAmt?: number;
|
||||||
|
bgtRfltAmt?: number;
|
||||||
|
tstmDesignAmt?: number;
|
||||||
|
regDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface DesignCnstnBizCstService {
|
||||||
|
findPage(
|
||||||
|
searchDto: DesignCnstnBizCstSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnBizCstResponseDto>>;
|
||||||
|
findById(designCnstnDocNo: string, acntgSeCd: string): Promise<DesignCnstnBizCstResponseDto>;
|
||||||
|
save(body: DesignCnstnBizCstSaveRequestDto): Promise<DesignCnstnBizCstId>;
|
||||||
|
update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
acntgSeCd: string,
|
||||||
|
body: DesignCnstnBizCstUpdateRequestDto,
|
||||||
|
): Promise<void>;
|
||||||
|
delete(designCnstnDocNo: string, acntgSeCd: string): Promise<void>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizSclId */
|
||||||
|
export interface DesignCnstnBizSclId {
|
||||||
|
designCnstnMng: string;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizSclSaveRequestDto */
|
||||||
|
export interface DesignCnstnBizSclSaveRequestDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
bscPlanQty?: number;
|
||||||
|
bgtRfltQty?: number;
|
||||||
|
tstmDesignQty?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizSclUpdateRequestDto */
|
||||||
|
export interface DesignCnstnBizSclUpdateRequestDto {
|
||||||
|
bscPlanQty?: number;
|
||||||
|
bgtRfltQty?: number;
|
||||||
|
tstmDesignQty?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizSclSearchDto + Pageable */
|
||||||
|
export interface DesignCnstnBizSclSearchDto extends PageableParams {
|
||||||
|
designCnstnDocNo?: string;
|
||||||
|
cnstpSeCd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnBizSclResponseDto */
|
||||||
|
export interface DesignCnstnBizSclResponseDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
cnstpSeCd: string;
|
||||||
|
bscPlanQty?: number;
|
||||||
|
bgtRfltQty?: number;
|
||||||
|
tstmDesignQty?: number;
|
||||||
|
regDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface DesignCnstnBizSclService {
|
||||||
|
findPage(
|
||||||
|
searchDto: DesignCnstnBizSclSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnBizSclResponseDto>>;
|
||||||
|
findById(designCnstnDocNo: string, cnstpSeCd: string): Promise<DesignCnstnBizSclResponseDto>;
|
||||||
|
save(body: DesignCnstnBizSclSaveRequestDto): Promise<DesignCnstnBizSclId>;
|
||||||
|
update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
cnstpSeCd: string,
|
||||||
|
body: DesignCnstnBizSclUpdateRequestDto,
|
||||||
|
): Promise<void>;
|
||||||
|
delete(designCnstnDocNo: string, cnstpSeCd: string): Promise<void>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnEsntlAtchFileId */
|
||||||
|
export interface DesignCnstnEsntlAtchFileId {
|
||||||
|
designCnstnMng: string;
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnEsntlAtchFileSaveRequestDto */
|
||||||
|
export interface DesignCnstnEsntlAtchFileSaveRequestDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnEsntlAtchFileUpdateRequestDto */
|
||||||
|
export interface DesignCnstnEsntlAtchFileUpdateRequestDto {
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnEsntlAtchFileSearchDto + Pageable */
|
||||||
|
export interface DesignCnstnEsntlAtchFileSearchDto extends PageableParams {
|
||||||
|
designCnstnDocNo?: string;
|
||||||
|
esntlAtchFileId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnEsntlAtchFileResponseDto */
|
||||||
|
export interface DesignCnstnEsntlAtchFileResponseDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
esntlAtchFileId: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
regDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface DesignCnstnEsntlAtchFileService {
|
||||||
|
findPage(
|
||||||
|
searchDto: DesignCnstnEsntlAtchFileSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnEsntlAtchFileResponseDto>>;
|
||||||
|
findById(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
esntlAtchFileId: string,
|
||||||
|
): Promise<DesignCnstnEsntlAtchFileResponseDto>;
|
||||||
|
save(body: DesignCnstnEsntlAtchFileSaveRequestDto): Promise<DesignCnstnEsntlAtchFileId>;
|
||||||
|
update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
esntlAtchFileId: string,
|
||||||
|
body: DesignCnstnEsntlAtchFileUpdateRequestDto,
|
||||||
|
): Promise<void>;
|
||||||
|
delete(designCnstnDocNo: string, esntlAtchFileId: string): Promise<void>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
import type {
|
||||||
|
BizCstSaveBase,
|
||||||
|
BzScaleSaveBase,
|
||||||
|
EsntlAtchFileSaveBase,
|
||||||
|
PageableParams,
|
||||||
|
PageResponse,
|
||||||
|
PbadmsApplySaveHeader,
|
||||||
|
PbadmsMngDetResponseBase,
|
||||||
|
} from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
DesignCnstnRvwOpnnResponseDto,
|
||||||
|
DesignCnstnRvwOpnnSaveRequestDto,
|
||||||
|
} from "./design-cnstn-rvw-opnn-interface";
|
||||||
|
|
||||||
|
export type {
|
||||||
|
DesignCnstnRvwOpnnResponseDto,
|
||||||
|
DesignCnstnRvwOpnnSaveRequestDto,
|
||||||
|
} from "./design-cnstn-rvw-opnn-interface";
|
||||||
|
export type {
|
||||||
|
AtflMngClientResponseDto,
|
||||||
|
BizCstTreeDto,
|
||||||
|
BizSclTreeDto,
|
||||||
|
ElaprDocPrgrsClientResponseDto,
|
||||||
|
EsntlAtchFileMngTreeResponseDto,
|
||||||
|
} from "@/shared/model";
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnMngSaveRequestDto */
|
||||||
|
export interface DesignCnstnMngSaveRequestDto {
|
||||||
|
designCnstnDocNo?: string;
|
||||||
|
admdstCd?: string;
|
||||||
|
envoSeComCd?: string;
|
||||||
|
taskSeComCd?: string;
|
||||||
|
bizNm?: string;
|
||||||
|
bizBgngYr?: string;
|
||||||
|
bizEndYr?: string;
|
||||||
|
bizCn?: string;
|
||||||
|
aplcntNm?: string;
|
||||||
|
aplcntMblTelno?: string;
|
||||||
|
aplcntOgdpNm?: string;
|
||||||
|
aplcntEmlAddr?: string;
|
||||||
|
dsgnrNm?: string;
|
||||||
|
dsgnrTelno?: string;
|
||||||
|
dsgnrOgdpNm?: string;
|
||||||
|
dsgnrEmlAddr?: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
prgrsSttsComCd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnMngUpdateRequestDto */
|
||||||
|
export type DesignCnstnMngUpdateRequestDto = Omit<DesignCnstnMngSaveRequestDto, "designCnstnDocNo">;
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnMngSearchDto + Pageable */
|
||||||
|
export interface DesignCnstnMngSearchDto extends PageableParams {
|
||||||
|
designCnstnDocNo?: string;
|
||||||
|
admdstCd?: string;
|
||||||
|
envoSeComCd?: string;
|
||||||
|
taskSeComCd?: string;
|
||||||
|
bizNm?: string;
|
||||||
|
bizBgngYr?: string;
|
||||||
|
bizEndYr?: string;
|
||||||
|
bizCn?: string;
|
||||||
|
aplcntNm?: string;
|
||||||
|
aplcntMblTelno?: string;
|
||||||
|
aplcntOgdpNm?: string;
|
||||||
|
aplcntEmlAddr?: string;
|
||||||
|
dsgnrNm?: string;
|
||||||
|
dsgnrTelno?: string;
|
||||||
|
dsgnrOgdpNm?: string;
|
||||||
|
dsgnrEmlAddr?: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DesignCnstnMngResponseExtension {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
envoSeCdNm?: string;
|
||||||
|
taskSeCdNm?: string;
|
||||||
|
prgrsSttsCdNm?: string;
|
||||||
|
regDt?: string;
|
||||||
|
rgtr?: string;
|
||||||
|
rgtrNm?: string;
|
||||||
|
mdfcnDt?: string;
|
||||||
|
sido?: string;
|
||||||
|
gugun?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnMngResponseDto */
|
||||||
|
export type DesignCnstnMngResponseDto = Omit<DesignCnstnMngSaveRequestDto, "designCnstnDocNo"> &
|
||||||
|
DesignCnstnMngResponseExtension;
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnApplySaveRequestDto.BzScaleItem */
|
||||||
|
export type BzScaleItem = BzScaleSaveBase;
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnApplySaveRequestDto.BizCstItem */
|
||||||
|
export type BizCstItem = BizCstSaveBase;
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnApplySaveRequestDto.EsntlAtchFileItem */
|
||||||
|
export type EsntlAtchFileItem = EsntlAtchFileSaveBase;
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnMngDetResponseDto */
|
||||||
|
export type DesignCnstnMngDetResponseDto = PbadmsMngDetResponseBase<
|
||||||
|
DesignCnstnMngResponseDto,
|
||||||
|
DesignCnstnRvwOpnnResponseDto
|
||||||
|
>;
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnApplySaveRequestDto */
|
||||||
|
export interface DesignCnstnApplySaveRequestDto extends PbadmsApplySaveHeader {
|
||||||
|
designCnstnMng: DesignCnstnMngSaveRequestDto;
|
||||||
|
bzScaleList?: BzScaleItem[];
|
||||||
|
bizCstList?: BizCstItem[];
|
||||||
|
esntlAtchFileList?: EsntlAtchFileItem[];
|
||||||
|
rvwOpnnList?: DesignCnstnRvwOpnnSaveRequestDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface DesignCnstnMngService {
|
||||||
|
findPage(searchDto: DesignCnstnMngSearchDto): Promise<PageResponse<DesignCnstnMngResponseDto>>;
|
||||||
|
findById(id: string): Promise<DesignCnstnMngDetResponseDto>;
|
||||||
|
save(body: DesignCnstnMngSaveRequestDto): Promise<string>;
|
||||||
|
saveApply(body: DesignCnstnApplySaveRequestDto): Promise<string>;
|
||||||
|
update(id: string, body: DesignCnstnMngUpdateRequestDto): Promise<void>;
|
||||||
|
techReview(id: string, body: DesignCnstnApplySaveRequestDto): Promise<void>;
|
||||||
|
delete(id: string): Promise<void>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import type { PageableParams, PageResponse, RvwOpnnResponseExtension } from "@/shared/model";
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnRvwOpnnId */
|
||||||
|
export interface DesignCnstnRvwOpnnId {
|
||||||
|
designCnstnMng: string;
|
||||||
|
rvwOpnnSn: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnRvwOpnnSaveRequestDto */
|
||||||
|
export interface DesignCnstnRvwOpnnSaveRequestDto {
|
||||||
|
designCnstnDocNo: string;
|
||||||
|
rvwOpnnSn?: number;
|
||||||
|
opnrSeComCd?: string;
|
||||||
|
opnrNm?: string;
|
||||||
|
rvwRsltCn?: string;
|
||||||
|
rvwRsltAnmlyYn?: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnRvwOpnnUpdateRequestDto */
|
||||||
|
export interface DesignCnstnRvwOpnnUpdateRequestDto {
|
||||||
|
opnrSeComCd?: string;
|
||||||
|
opnrNm?: string;
|
||||||
|
rvwRsltCn?: string;
|
||||||
|
rvwRsltAnmlyYn?: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnRvwOpnnSearchDto + Pageable */
|
||||||
|
export interface DesignCnstnRvwOpnnSearchDto extends PageableParams {
|
||||||
|
designCnstnDocNo?: string;
|
||||||
|
opnrNm?: string;
|
||||||
|
opnrSeComCd?: string;
|
||||||
|
rvwRsltCn?: string;
|
||||||
|
rvwRsltAnmlyYn?: string;
|
||||||
|
atchFileGroupId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 DesignCnstnRvwOpnnResponseDto */
|
||||||
|
export type DesignCnstnRvwOpnnResponseDto = Partial<
|
||||||
|
Pick<DesignCnstnRvwOpnnSaveRequestDto, "designCnstnDocNo" | "rvwOpnnSn">
|
||||||
|
> &
|
||||||
|
Omit<DesignCnstnRvwOpnnSaveRequestDto, "designCnstnDocNo" | "rvwOpnnSn"> &
|
||||||
|
RvwOpnnResponseExtension;
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface DesignCnstnRvwOpnnService {
|
||||||
|
findPage(
|
||||||
|
searchDto: DesignCnstnRvwOpnnSearchDto,
|
||||||
|
): Promise<PageResponse<DesignCnstnRvwOpnnResponseDto>>;
|
||||||
|
findById(designCnstnDocNo: string, rvwOpnnSn: number): Promise<DesignCnstnRvwOpnnResponseDto>;
|
||||||
|
save(body: DesignCnstnRvwOpnnSaveRequestDto): Promise<DesignCnstnRvwOpnnId>;
|
||||||
|
update(
|
||||||
|
designCnstnDocNo: string,
|
||||||
|
rvwOpnnSn: number,
|
||||||
|
body: DesignCnstnRvwOpnnUpdateRequestDto,
|
||||||
|
): Promise<void>;
|
||||||
|
delete(designCnstnDocNo: string, rvwOpnnSn: number): Promise<void>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ElaprDmndResponseDto,
|
||||||
|
ElaprDmndSaveRequestDto,
|
||||||
|
ElaprDmndSearchDto,
|
||||||
|
ElaprDmndService,
|
||||||
|
ElaprDocPrgrsResponseDto,
|
||||||
|
} from "../model/elapr-dmnd-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND;
|
||||||
|
|
||||||
|
async function findPage(params: ElaprDmndSearchDto): Promise<PageResponse<ElaprDmndResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<ElaprDmndResponseDto>>(BASE, { params });
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(elaprDmndId: string): Promise<ElaprDmndResponseDto> {
|
||||||
|
const response = await client.get<ElaprDmndResponseDto>(`${BASE}/${elaprDmndId}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(body: ElaprDmndSaveRequestDto): Promise<ElaprDmndResponseDto> {
|
||||||
|
const response = await client.post<ElaprDmndResponseDto>(BASE, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(
|
||||||
|
elaprDmndId: string,
|
||||||
|
body: ElaprDmndSaveRequestDto,
|
||||||
|
): Promise<ElaprDmndResponseDto> {
|
||||||
|
const response = await client.put<ElaprDmndResponseDto>(`${BASE}/${elaprDmndId}`, body);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateStatus(
|
||||||
|
elaprDmndId: string,
|
||||||
|
atrzSttsComCd: string,
|
||||||
|
): Promise<ElaprDmndResponseDto> {
|
||||||
|
const response = await client.put<ElaprDmndResponseDto>(`${BASE}/${elaprDmndId}/status`, null, {
|
||||||
|
params: { atrzSttsComCd },
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function remove(elaprDmndId: string): Promise<void> {
|
||||||
|
await client.delete(`${BASE}/${elaprDmndId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findDocPrgrsByDocNo(elaprDocNo: string): Promise<ElaprDocPrgrsResponseDto[]> {
|
||||||
|
const response = await client.get<ElaprDocPrgrsResponseDto[]>(
|
||||||
|
`${BASE}/sanc/docprgrs/${elaprDocNo}`,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const elaprDmndService = {
|
||||||
|
findPage,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
update,
|
||||||
|
updateStatus,
|
||||||
|
remove,
|
||||||
|
findDocPrgrsByDocNo,
|
||||||
|
} satisfies ElaprDmndService;
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
import { client } from "@/shared/api";
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import type { PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ElaprApproverChangeRequestDto,
|
||||||
|
ElaprApproverInsertRequestDto,
|
||||||
|
ElaprPrgrsSttsMyDocSearchParams,
|
||||||
|
ElaprPrgrsSttsResponseDto,
|
||||||
|
ElaprPrgrsSttsSaveRequestDto,
|
||||||
|
ElaprPrgrsSttsService,
|
||||||
|
ElaprProcessRequestDto,
|
||||||
|
} from "../model/elapr-prgrs-stts-interface";
|
||||||
|
|
||||||
|
const BASE = ENDPOINT.AS_ELAPR_SERVICE.ELAPR_PRGRS_STTS;
|
||||||
|
|
||||||
|
async function findAllByDmndId(elaprDmndId?: string): Promise<ElaprPrgrsSttsResponseDto[]> {
|
||||||
|
const response = await client.get<ElaprPrgrsSttsResponseDto[]>(BASE, {
|
||||||
|
params: elaprDmndId ? { elaprDmndId } : undefined,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findById(elaprPrgrsId: string): Promise<ElaprPrgrsSttsResponseDto> {
|
||||||
|
const response = await client.get<ElaprPrgrsSttsResponseDto>(`${BASE}/${elaprPrgrsId}`);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save(
|
||||||
|
requestDtos: ElaprPrgrsSttsSaveRequestDto[],
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto[]> {
|
||||||
|
const response = await client.post<ElaprPrgrsSttsResponseDto[]>(BASE, requestDtos);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function process(
|
||||||
|
elaprPrgrsId: string,
|
||||||
|
body: ElaprProcessRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto> {
|
||||||
|
const response = await client.put<ElaprPrgrsSttsResponseDto>(
|
||||||
|
`${BASE}/${elaprPrgrsId}/process`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function processByDocNoAndAprvrUuid(
|
||||||
|
elaprDocNo: string,
|
||||||
|
aprvrUuid: string,
|
||||||
|
body: ElaprProcessRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto> {
|
||||||
|
const response = await client.put<ElaprPrgrsSttsResponseDto>(
|
||||||
|
`${BASE}/doc/${elaprDocNo}/aprvr/${aprvrUuid}/process`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deletePrgrsStts(elaprPrgrsId: string): Promise<void> {
|
||||||
|
await client.delete(`${BASE}/${elaprPrgrsId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateApprover(
|
||||||
|
elaprPrgrsId: string,
|
||||||
|
body: ElaprApproverChangeRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto> {
|
||||||
|
const response = await client.put<ElaprPrgrsSttsResponseDto>(
|
||||||
|
`${BASE}/${elaprPrgrsId}/approver`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function insertApprover(
|
||||||
|
elaprDmndId: string,
|
||||||
|
body: ElaprApproverInsertRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto> {
|
||||||
|
const response = await client.post<ElaprPrgrsSttsResponseDto>(
|
||||||
|
`${BASE}/${elaprDmndId}/approver/insert`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findMyElaperDocList(
|
||||||
|
params: ElaprPrgrsSttsMyDocSearchParams,
|
||||||
|
): Promise<PageResponse<ElaprPrgrsSttsResponseDto>> {
|
||||||
|
const response = await client.get<PageResponse<ElaprPrgrsSttsResponseDto>>(`${BASE}/my/doc`, {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const elaprPrgrsSttsService = {
|
||||||
|
findAllByDmndId,
|
||||||
|
findById,
|
||||||
|
save,
|
||||||
|
process,
|
||||||
|
processByDocNoAndAprvrUuid,
|
||||||
|
delete: deletePrgrsStts,
|
||||||
|
updateApprover,
|
||||||
|
insertApprover,
|
||||||
|
findMyElaperDocList,
|
||||||
|
} satisfies ElaprPrgrsSttsService;
|
||||||
@@ -8,6 +8,14 @@ import type {
|
|||||||
ElaprAplnSaveRequest,
|
ElaprAplnSaveRequest,
|
||||||
ElaprAplnUpdateRequest,
|
ElaprAplnUpdateRequest,
|
||||||
} from "../model/elapr-apln-interface";
|
} from "../model/elapr-apln-interface";
|
||||||
|
import type { ElaprDmndSaveRequestDto, ElaprDmndSearchDto } from "../model/elapr-dmnd-interface";
|
||||||
|
import type {
|
||||||
|
ElaprApproverChangeRequestDto,
|
||||||
|
ElaprApproverInsertRequestDto,
|
||||||
|
ElaprPrgrsSttsMyDocSearchParams,
|
||||||
|
ElaprPrgrsSttsSaveRequestDto,
|
||||||
|
ElaprProcessRequestDto,
|
||||||
|
} from "../model/elapr-prgrs-stts-interface";
|
||||||
import type {
|
import type {
|
||||||
ElaprTmpltSaveRequest,
|
ElaprTmpltSaveRequest,
|
||||||
ElaprTmpltSearchParams,
|
ElaprTmpltSearchParams,
|
||||||
@@ -15,10 +23,19 @@ import type {
|
|||||||
} from "../model/elapr-tmplt-interface";
|
} from "../model/elapr-tmplt-interface";
|
||||||
|
|
||||||
import { elaprAplnService } from "./elapr-apln-service";
|
import { elaprAplnService } from "./elapr-apln-service";
|
||||||
|
import { elaprDmndService } from "./elapr-dmnd-service";
|
||||||
|
import { elaprPrgrsSttsService } from "./elapr-prgrs-stts-service";
|
||||||
import { elaprTmpltService } from "./elapr-tmplt-service";
|
import { elaprTmpltService } from "./elapr-tmplt-service";
|
||||||
|
|
||||||
const elaprTmpltBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT] as const;
|
const elaprTmpltBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT] as const;
|
||||||
const elaprAplnBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN] as const;
|
const elaprAplnBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN] as const;
|
||||||
|
const elaprDmndBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND] as const;
|
||||||
|
const elaprPrgrsSttsBaseKey = [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_PRGRS_STTS] as const;
|
||||||
|
|
||||||
|
function invalidateElaprPrgrsSttsQueries(queryClient: ReturnType<typeof useQueryClient>) {
|
||||||
|
queryClient.invalidateQueries({ queryKey: elaprPrgrsSttsBaseKey });
|
||||||
|
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||||
|
}
|
||||||
|
|
||||||
export function useElaprTmpltPage(params: ElaprTmpltSearchParams) {
|
export function useElaprTmpltPage(params: ElaprTmpltSearchParams) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
@@ -50,13 +67,8 @@ export function useUpdateElaprTmplt() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ elaprTmpltId, body }: { elaprTmpltId: string; body: ElaprTmpltUpdateRequest }) =>
|
||||||
elaprTmpltId,
|
elaprTmpltService.update(elaprTmpltId, body),
|
||||||
body,
|
|
||||||
}: {
|
|
||||||
elaprTmpltId: string;
|
|
||||||
body: ElaprTmpltUpdateRequest;
|
|
||||||
}) => elaprTmpltService.update(elaprTmpltId, body),
|
|
||||||
onSuccess: (_data, { elaprTmpltId }) => {
|
onSuccess: (_data, { elaprTmpltId }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: elaprTmpltBaseKey });
|
queryClient.invalidateQueries({ queryKey: elaprTmpltBaseKey });
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
@@ -99,12 +111,8 @@ export function useSaveMultiElaprApln() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ body }: { body: ElaprAplnSaveRequest[]; elaprTmpltId: string }) =>
|
||||||
body,
|
elaprAplnService.saveMulti(body),
|
||||||
}: {
|
|
||||||
body: ElaprAplnSaveRequest[];
|
|
||||||
elaprTmpltId: string;
|
|
||||||
}) => elaprAplnService.saveMulti(body),
|
|
||||||
onSuccess: (_data, { elaprTmpltId }) => {
|
onSuccess: (_data, { elaprTmpltId }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
@@ -118,13 +126,8 @@ export function useUpdateElaprApln() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ aplnId, body }: { aplnId: string; body: ElaprAplnUpdateRequest }) =>
|
||||||
aplnId,
|
elaprAplnService.update(aplnId, body),
|
||||||
body,
|
|
||||||
}: {
|
|
||||||
aplnId: string;
|
|
||||||
body: ElaprAplnUpdateRequest;
|
|
||||||
}) => elaprAplnService.update(aplnId, body),
|
|
||||||
onSuccess: (_data, { body, aplnId }) => {
|
onSuccess: (_data, { body, aplnId }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
@@ -141,12 +144,8 @@ export function useDeleteElaprApln() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ aplnId }: { aplnId: string; elaprTmpltId: string }) =>
|
||||||
aplnId,
|
elaprAplnService.remove(aplnId),
|
||||||
}: {
|
|
||||||
aplnId: string;
|
|
||||||
elaprTmpltId: string;
|
|
||||||
}) => elaprAplnService.remove(aplnId),
|
|
||||||
onSuccess: (_data, { elaprTmpltId }) => {
|
onSuccess: (_data, { elaprTmpltId }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
@@ -160,12 +159,8 @@ export function useReorderElaprApln() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ body }: { body: ElaprAplnReorderRequest; elaprTmpltId: string }) =>
|
||||||
body,
|
elaprAplnService.reorder(body),
|
||||||
}: {
|
|
||||||
body: ElaprAplnReorderRequest;
|
|
||||||
elaprTmpltId: string;
|
|
||||||
}) => elaprAplnService.reorder(body),
|
|
||||||
onSuccess: (_data, { elaprTmpltId }) => {
|
onSuccess: (_data, { elaprTmpltId }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
queryClient.invalidateQueries({ queryKey: elaprAplnBaseKey });
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
@@ -174,3 +169,194 @@ export function useReorderElaprApln() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useElaprDmndPage(params: ElaprDmndSearchDto) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...elaprDmndBaseKey, "findPage", params],
|
||||||
|
queryFn: () => elaprDmndService.findPage(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useElaprDmnd(elaprDmndId: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...elaprDmndBaseKey, "findById", elaprDmndId],
|
||||||
|
queryFn: () => elaprDmndService.findById(elaprDmndId!),
|
||||||
|
enabled: Boolean(elaprDmndId),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useElaprDocPrgrsByDocNo(elaprDocNo: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...elaprDmndBaseKey, "findDocPrgrsByDocNo", elaprDocNo],
|
||||||
|
queryFn: () => elaprDmndService.findDocPrgrsByDocNo(elaprDocNo!),
|
||||||
|
enabled: Boolean(elaprDocNo),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveElaprDmnd() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (body: ElaprDmndSaveRequestDto) => elaprDmndService.save(body),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateElaprDmnd() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ elaprDmndId, body }: { elaprDmndId: string; body: ElaprDmndSaveRequestDto }) =>
|
||||||
|
elaprDmndService.update(elaprDmndId, body),
|
||||||
|
onSuccess: (_data, { elaprDmndId }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...elaprDmndBaseKey, "findById", elaprDmndId],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateElaprDmndStatus() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ elaprDmndId, atrzSttsComCd }: { elaprDmndId: string; atrzSttsComCd: string }) =>
|
||||||
|
elaprDmndService.updateStatus(elaprDmndId, atrzSttsComCd),
|
||||||
|
onSuccess: (_data, { elaprDmndId }) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [...elaprDmndBaseKey, "findById", elaprDmndId],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useRemoveElaprDmnd() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (elaprDmndId: string) => elaprDmndService.remove(elaprDmndId),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: elaprDmndBaseKey });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useElaprPrgrsSttsByDmndId(elaprDmndId: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...elaprPrgrsSttsBaseKey, "findAllByDmndId", elaprDmndId],
|
||||||
|
queryFn: () => elaprPrgrsSttsService.findAllByDmndId(elaprDmndId!),
|
||||||
|
enabled: Boolean(elaprDmndId),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useElaprPrgrsStts(elaprPrgrsId: string | null | undefined) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...elaprPrgrsSttsBaseKey, elaprPrgrsId],
|
||||||
|
queryFn: () => elaprPrgrsSttsService.findById(elaprPrgrsId!),
|
||||||
|
enabled: Boolean(elaprPrgrsId),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useElaprPrgrsSttsMyDocPage(params: ElaprPrgrsSttsMyDocSearchParams) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [...elaprPrgrsSttsBaseKey, "findMyElaperDocList", params],
|
||||||
|
queryFn: () => elaprPrgrsSttsService.findMyElaperDocList(params),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSaveElaprPrgrsStts() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (requestDtos: ElaprPrgrsSttsSaveRequestDto[]) =>
|
||||||
|
elaprPrgrsSttsService.save(requestDtos),
|
||||||
|
onSuccess: () => {
|
||||||
|
invalidateElaprPrgrsSttsQueries(queryClient);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useProcessElaprPrgrsStts() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
elaprPrgrsId,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
elaprPrgrsId: string;
|
||||||
|
body: ElaprProcessRequestDto;
|
||||||
|
}) => elaprPrgrsSttsService.process(elaprPrgrsId, body),
|
||||||
|
onSuccess: () => {
|
||||||
|
invalidateElaprPrgrsSttsQueries(queryClient);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useProcessElaprPrgrsSttsByDoc() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
elaprDocNo,
|
||||||
|
aprvrUuid,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
elaprDocNo: string;
|
||||||
|
aprvrUuid: string;
|
||||||
|
body: ElaprProcessRequestDto;
|
||||||
|
}) => elaprPrgrsSttsService.processByDocNoAndAprvrUuid(elaprDocNo, aprvrUuid, body),
|
||||||
|
onSuccess: () => {
|
||||||
|
invalidateElaprPrgrsSttsQueries(queryClient);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteElaprPrgrsStts() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (elaprPrgrsId: string) => elaprPrgrsSttsService.delete(elaprPrgrsId),
|
||||||
|
onSuccess: () => {
|
||||||
|
invalidateElaprPrgrsSttsQueries(queryClient);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateElaprPrgrsSttsApprover() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
elaprPrgrsId,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
elaprPrgrsId: string;
|
||||||
|
body: ElaprApproverChangeRequestDto;
|
||||||
|
}) => elaprPrgrsSttsService.updateApprover(elaprPrgrsId, body),
|
||||||
|
onSuccess: () => {
|
||||||
|
invalidateElaprPrgrsSttsQueries(queryClient);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useInsertElaprPrgrsSttsApprover() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
elaprDmndId,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
elaprDmndId: string;
|
||||||
|
body: ElaprApproverInsertRequestDto;
|
||||||
|
}) => elaprPrgrsSttsService.insertApprover(elaprDmndId, body),
|
||||||
|
onSuccess: () => {
|
||||||
|
invalidateElaprPrgrsSttsQueries(queryClient);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,33 +1,122 @@
|
|||||||
export { elaprAplnService } from "./api/elapr-apln-service";
|
export { elaprAplnService } from "./api/elapr-apln-service";
|
||||||
export { elaprTmpltService } from "./api/elapr-tmplt-service";
|
export { elaprDmndService } from "./api/elapr-dmnd-service";
|
||||||
export {
|
export { elaprPrgrsSttsService } from "./api/elapr-prgrs-stts-service";
|
||||||
useCreateElaprTmplt,
|
export { elaprTmpltService } from "./api/elapr-tmplt-service";
|
||||||
useDeleteElaprApln,
|
export {
|
||||||
useDeleteElaprTmplt,
|
useCreateElaprTmplt,
|
||||||
useElaprApln,
|
useDeleteElaprApln,
|
||||||
useElaprAplnPage,
|
useDeleteElaprPrgrsStts,
|
||||||
useElaprTmplt,
|
useDeleteElaprTmplt,
|
||||||
useElaprTmpltPage,
|
useElaprApln,
|
||||||
useReorderElaprApln,
|
useElaprAplnPage,
|
||||||
useSaveMultiElaprApln,
|
useElaprDmnd,
|
||||||
useUpdateElaprApln,
|
useElaprDmndPage,
|
||||||
useUpdateElaprTmplt,
|
useElaprDocPrgrsByDocNo,
|
||||||
} from "./api/queries";
|
useElaprPrgrsStts,
|
||||||
export {
|
useElaprPrgrsSttsByDmndId,
|
||||||
ELAPR_APLN_SAVE_MODE,
|
useElaprPrgrsSttsMyDocPage,
|
||||||
type ElaprApln,
|
useElaprTmplt,
|
||||||
type ElaprAplnListParams,
|
useElaprTmpltPage,
|
||||||
type ElaprAplnReorderItem,
|
useInsertElaprPrgrsSttsApprover,
|
||||||
type ElaprAplnReorderRequest,
|
useProcessElaprPrgrsStts,
|
||||||
type ElaprAplnSaveMode,
|
useProcessElaprPrgrsSttsByDoc,
|
||||||
type ElaprAplnSaveRequest,
|
useRemoveElaprDmnd,
|
||||||
type ElaprAplnService,
|
useReorderElaprApln,
|
||||||
type ElaprAplnUpdateRequest,
|
useSaveElaprDmnd,
|
||||||
} from "./model/elapr-apln-interface";
|
useSaveElaprPrgrsStts,
|
||||||
export type {
|
useSaveMultiElaprApln,
|
||||||
ElaprTmplt,
|
useUpdateElaprApln,
|
||||||
ElaprTmpltSaveRequest,
|
useUpdateElaprDmnd,
|
||||||
ElaprTmpltSearchParams,
|
useUpdateElaprDmndStatus,
|
||||||
ElaprTmpltService,
|
useUpdateElaprPrgrsSttsApprover,
|
||||||
ElaprTmpltUpdateRequest,
|
useUpdateElaprTmplt,
|
||||||
} from "./model/elapr-tmplt-interface";
|
} from "./api/queries";
|
||||||
|
export {
|
||||||
|
assignAtrzSeqNumbers,
|
||||||
|
buildSaveMultiPayload,
|
||||||
|
hasUnsavedChanges,
|
||||||
|
} from "./lib/apln-save-utils";
|
||||||
|
export {
|
||||||
|
getVisibleRows,
|
||||||
|
validateAllRowsForSave,
|
||||||
|
validateAplnRow,
|
||||||
|
validateAtrzOrder,
|
||||||
|
validateUniqueSeqNo,
|
||||||
|
} from "./lib/apln-validators";
|
||||||
|
export {
|
||||||
|
findCurrentUserPendingApprovalRequest,
|
||||||
|
hasCurrentUserPendingApprovalRequest,
|
||||||
|
} from "./lib/approval-request-utils";
|
||||||
|
export {
|
||||||
|
APPROVER_STATUS_MAP,
|
||||||
|
type ApproverStatusConfig,
|
||||||
|
getApproverStatus,
|
||||||
|
sortByAtrzSeqNo,
|
||||||
|
} from "./lib/approval-utils";
|
||||||
|
export {
|
||||||
|
buildElaprPrgrsSttsListFromApln,
|
||||||
|
buildElaprPrgrsSttsListFromAplnRows,
|
||||||
|
} from "./lib/dmnd-save-utils";
|
||||||
|
export type { ElaprPrgrsSttsRow } from "./lib/prgrs-stts-save-utils";
|
||||||
|
export {
|
||||||
|
assignPrgrsSttsAtrzSeqNumbers,
|
||||||
|
buildPrgrsSttsSavePayload,
|
||||||
|
hasUnsavedPrgrsSttsChanges,
|
||||||
|
isPrgrsSttsRowEditable,
|
||||||
|
PRGRS_STTS_WAITING_CD,
|
||||||
|
validateAllPrgrsSttsRows,
|
||||||
|
validatePrgrsSttsRow,
|
||||||
|
} from "./lib/prgrs-stts-save-utils";
|
||||||
|
export { createDraftRowKey, useAplnRows } from "./lib/use-apln-rows";
|
||||||
|
export { useDndSensors } from "./lib/use-dnd-sensors";
|
||||||
|
export { usePrgrsSttsRows } from "./lib/use-prgrs-stts-rows";
|
||||||
|
export {
|
||||||
|
ELAPR_APLN_SAVE_MODE,
|
||||||
|
type ElaprApln,
|
||||||
|
type ElaprAplnListParams,
|
||||||
|
type ElaprAplnReorderItem,
|
||||||
|
type ElaprAplnReorderRequest,
|
||||||
|
type ElaprAplnSaveMode,
|
||||||
|
type ElaprAplnSaveRequest,
|
||||||
|
type ElaprAplnService,
|
||||||
|
type ElaprAplnUpdateRequest,
|
||||||
|
} from "./model/elapr-apln-interface";
|
||||||
|
export type { ElaprAplnRow } from "./model/elapr-apln-row-types";
|
||||||
|
export type {
|
||||||
|
ElaprDmndResponseDto,
|
||||||
|
ElaprDmndSaveRequestDto,
|
||||||
|
ElaprDmndSearchDto,
|
||||||
|
ElaprDmndService,
|
||||||
|
ElaprDocPrgrsResponseDto,
|
||||||
|
} from "./model/elapr-dmnd-interface";
|
||||||
|
export type {
|
||||||
|
ElaprApproverChangeRequestDto,
|
||||||
|
ElaprApproverInsertRequestDto,
|
||||||
|
ElaprPrgrsSttsMyDocSearchParams,
|
||||||
|
ElaprPrgrsSttsResponseDto,
|
||||||
|
ElaprPrgrsSttsSaveMode,
|
||||||
|
ElaprPrgrsSttsSaveRequestDto,
|
||||||
|
ElaprPrgrsSttsSearchDto,
|
||||||
|
ElaprPrgrsSttsService,
|
||||||
|
ElaprProcessRequestDto,
|
||||||
|
} from "./model/elapr-prgrs-stts-interface";
|
||||||
|
export { ELAPR_PRGRS_STTS_SAVE_MODE } from "./model/elapr-prgrs-stts-interface";
|
||||||
|
export type {
|
||||||
|
ElaprTmplt,
|
||||||
|
ElaprTmpltSaveRequest,
|
||||||
|
ElaprTmpltSearchParams,
|
||||||
|
ElaprTmpltService,
|
||||||
|
ElaprTmpltUpdateRequest,
|
||||||
|
} from "./model/elapr-tmplt-interface";
|
||||||
|
export type { ReviewerOption } from "./model/reviewer-option";
|
||||||
|
export { AprvrPickerDialog } from "./ui/aprvr-picker-dialog";
|
||||||
|
export { ElaprAplnPickerGrid } from "./ui/elapr-apln-picker-grid";
|
||||||
|
export { ElaprApprovalDialog } from "./ui/elapr-approval-dialog";
|
||||||
|
export { ElaprDocPrgrsStatus } from "./ui/elapr-doc-prgrs-status";
|
||||||
|
export {
|
||||||
|
type ElaprTmpltPickerConfirmPayload,
|
||||||
|
ElaprTmpltPickerDialog,
|
||||||
|
} from "./ui/elapr-tmplt-picker-dialog";
|
||||||
|
export { ElaprTmpltSelectTable } from "./ui/elapr-tmplt-select-table";
|
||||||
|
export { SortableAplnPickerRow } from "./ui/sortable-apln-picker-row";
|
||||||
|
export { SortablePrgrsSttsRow } from "./ui/sortable-prgrs-stts-row";
|
||||||
|
|||||||
+31
-4
@@ -1,8 +1,16 @@
|
|||||||
import { ELAPR_APLN_SAVE_MODE, type ElaprApln, type ElaprAplnSaveRequest } from "@/entities/elapr";
|
import {
|
||||||
|
ELAPR_APLN_SAVE_MODE,
|
||||||
|
type ElaprApln,
|
||||||
|
type ElaprAplnSaveRequest,
|
||||||
|
} from "../model/elapr-apln-interface";
|
||||||
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
|
|
||||||
import { assignAtrzSeqNumbers } from "./assign-atrz-seq";
|
import { getVisibleRows } from "./apln-validators";
|
||||||
import { getVisibleRows } from "./validators";
|
|
||||||
import type { ElaprAplnRow } from "../model/apln-row-types";
|
/** 그리드 행 순서(1-based)로 결재순서번호 일괄 채번 */
|
||||||
|
export function assignAtrzSeqNumbers(rows: ElaprAplnRow[]): ElaprAplnRow[] {
|
||||||
|
return rows.map((row, index) => ({ ...row, atrzSeqNo: index + 1 }));
|
||||||
|
}
|
||||||
|
|
||||||
function rowDiffersFromServer(row: ElaprAplnRow, serverRow: ElaprApln): boolean {
|
function rowDiffersFromServer(row: ElaprAplnRow, serverRow: ElaprApln): boolean {
|
||||||
return (
|
return (
|
||||||
@@ -22,6 +30,25 @@ function shouldIncludeUpdate(row: ElaprAplnRow, serverRows: ElaprApln[]): boolea
|
|||||||
return rowDiffersFromServer(row, serverRow);
|
return rowDiffersFromServer(row, serverRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasUnsavedChanges(rows: ElaprAplnRow[], serverRows: ElaprApln[]): boolean {
|
||||||
|
if (rows.some((row) => row.isDeleted && row.aplnId)) return true;
|
||||||
|
if (rows.some((row) => row.isNew && !row.isDeleted)) return true;
|
||||||
|
|
||||||
|
const visibleWithSeq = assignAtrzSeqNumbers(getVisibleRows(rows));
|
||||||
|
|
||||||
|
for (const row of visibleWithSeq) {
|
||||||
|
if (row.isNew) continue;
|
||||||
|
if (!row.aplnId) continue;
|
||||||
|
if (row.isDirty) return true;
|
||||||
|
|
||||||
|
const serverRow = serverRows.find((s) => s.aplnId === row.aplnId);
|
||||||
|
if (!serverRow) continue;
|
||||||
|
if (rowDiffersFromServer(row, serverRow)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
export function buildSaveMultiPayload(
|
export function buildSaveMultiPayload(
|
||||||
rows: ElaprAplnRow[],
|
rows: ElaprAplnRow[],
|
||||||
elaprTmpltId: string,
|
elaprTmpltId: string,
|
||||||
+9
-20
@@ -1,26 +1,19 @@
|
|||||||
import type { ElaprAplnRow } from "../model/apln-row-types";
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
|
|
||||||
export const ATRZ_RECEIVER_CD = "ATRZ00";
|
const ATRZ_FINAL_CD = "ATRZ99";
|
||||||
export const ATRZ_REVIEWER_1_CD = "ATRZ01";
|
|
||||||
export const ATRZ_REVIEWER_2_CD = "ATRZ02";
|
interface AtrzOrderValidateRow {
|
||||||
export const ATRZ_APPROVER_CD = "ATRZ03";
|
atrzSeComCd?: string;
|
||||||
export const ATRZ_FINAL_CD = "ATRZ99";
|
isDeleted?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export function getVisibleRows(rows: ElaprAplnRow[]): ElaprAplnRow[] {
|
export function getVisibleRows(rows: ElaprAplnRow[]): ElaprAplnRow[] {
|
||||||
return rows.filter((row) => !row.isDeleted);
|
return rows.filter((row) => !row.isDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 접수자·최종승인자 위치·중복 검증 (최종 저장 시점) */
|
/** 접수자·최종승인자 위치·중복 검증 (최종 저장 시점) */
|
||||||
export function validateAtrzOrder(rows: ElaprAplnRow[]): string | null {
|
export function validateAtrzOrder(rows: AtrzOrderValidateRow[]): string | null {
|
||||||
const visibleRows = getVisibleRows(rows);
|
const visibleRows = rows.filter((row) => !row.isDeleted);
|
||||||
|
|
||||||
const receiverCount = visibleRows.filter((row) => row.atrzSeComCd === ATRZ_RECEIVER_CD).length;
|
|
||||||
if (receiverCount === 0) {
|
|
||||||
return "접수자는 반드시 등록해야 합니다.";
|
|
||||||
}
|
|
||||||
if (receiverCount > 1) {
|
|
||||||
return "접수자는 한 명만 등록할 수 있습니다.";
|
|
||||||
}
|
|
||||||
|
|
||||||
const finalCount = visibleRows.filter((row) => row.atrzSeComCd === ATRZ_FINAL_CD).length;
|
const finalCount = visibleRows.filter((row) => row.atrzSeComCd === ATRZ_FINAL_CD).length;
|
||||||
if (finalCount === 0) {
|
if (finalCount === 0) {
|
||||||
@@ -30,10 +23,6 @@ export function validateAtrzOrder(rows: ElaprAplnRow[]): string | null {
|
|||||||
return "최종승인자는 한 명만 등록할 수 있습니다.";
|
return "최종승인자는 한 명만 등록할 수 있습니다.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receiverCount === 1 && visibleRows[0]?.atrzSeComCd !== ATRZ_RECEIVER_CD) {
|
|
||||||
return "접수자는 결재선 첫 번째에 배치해야 합니다.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (finalCount === 1) {
|
if (finalCount === 1) {
|
||||||
const lastRow = visibleRows[visibleRows.length - 1];
|
const lastRow = visibleRows[visibleRows.length - 1];
|
||||||
if (lastRow?.atrzSeComCd !== ATRZ_FINAL_CD) {
|
if (lastRow?.atrzSeComCd !== ATRZ_FINAL_CD) {
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import type { ElaprDocPrgrsResponseDto } from "../model/elapr-dmnd-interface";
|
||||||
|
|
||||||
|
export function hasCurrentUserPendingApprovalRequest(
|
||||||
|
list: ElaprDocPrgrsResponseDto[],
|
||||||
|
currentUserUuid: string | undefined,
|
||||||
|
): boolean {
|
||||||
|
if (!currentUserUuid) return false;
|
||||||
|
|
||||||
|
return list.some(
|
||||||
|
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findCurrentUserPendingApprovalRequest(
|
||||||
|
list?: ElaprDocPrgrsResponseDto[],
|
||||||
|
currentUserUuid?: string | undefined,
|
||||||
|
): ElaprDocPrgrsResponseDto | undefined {
|
||||||
|
if (!currentUserUuid) return undefined;
|
||||||
|
|
||||||
|
return list?.find(
|
||||||
|
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import type { ElaprDocPrgrsClientResponseDto } from "@/shared/model";
|
||||||
|
|
||||||
|
export interface ApproverStatusConfig {
|
||||||
|
label: string;
|
||||||
|
badgeClass: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const APPROVER_STATUS_MAP: Record<string, ApproverStatusConfig> = {
|
||||||
|
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700" },
|
||||||
|
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-700" },
|
||||||
|
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-700" },
|
||||||
|
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-700" },
|
||||||
|
ATRZ_PRGRS_999: { label: "결재안함", badgeClass: "bg-blue-100 text-blue-700" },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function sortByAtrzSeqNo(
|
||||||
|
list: ElaprDocPrgrsClientResponseDto[],
|
||||||
|
): ElaprDocPrgrsClientResponseDto[] {
|
||||||
|
return list.slice().sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getApproverStatus(status: string | undefined): ApproverStatusConfig {
|
||||||
|
return (
|
||||||
|
APPROVER_STATUS_MAP[status ?? ""] ?? {
|
||||||
|
label: status || "-",
|
||||||
|
badgeClass: "bg-gray-100 text-gray-700",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import type { ElaprApln } from "../model/elapr-apln-interface";
|
||||||
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
|
import type { ElaprPrgrsSttsSaveRequestDto } from "../model/elapr-prgrs-stts-interface";
|
||||||
|
|
||||||
|
import { getVisibleRows } from "./apln-validators";
|
||||||
|
|
||||||
|
function toPrgrsSttsItem(
|
||||||
|
aprvrUuid: string | undefined,
|
||||||
|
atrzSeComCd: string | undefined,
|
||||||
|
atrzSeqNo: number | undefined,
|
||||||
|
): ElaprPrgrsSttsSaveRequestDto {
|
||||||
|
if (!aprvrUuid?.trim()) {
|
||||||
|
throw new Error("결재자가 지정되지 않은 행이 있습니다.");
|
||||||
|
}
|
||||||
|
if (!atrzSeComCd?.trim()) {
|
||||||
|
throw new Error("결재구분이 지정되지 않은 행이 있습니다.");
|
||||||
|
}
|
||||||
|
if (atrzSeqNo == null) {
|
||||||
|
throw new Error("결재순서번호가 지정되지 않은 행이 있습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
aprvrUuid,
|
||||||
|
atrzSeComCd,
|
||||||
|
atrzSeqNo,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 서식 결재선 API 응답 → 기안 요청용 진행상태 목록 */
|
||||||
|
export function buildElaprPrgrsSttsListFromApln(
|
||||||
|
items: ElaprApln[],
|
||||||
|
): ElaprPrgrsSttsSaveRequestDto[] {
|
||||||
|
return items.map((item) => toPrgrsSttsItem(item.aprvrUuid, item.atrzSeComCd, item.atrzSeqNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 결재선 그리드 행 → 기안 요청용 진행상태 목록 (서버가 seq 기준 상태 자동 결정) */
|
||||||
|
export function buildElaprPrgrsSttsListFromAplnRows(
|
||||||
|
rows: ElaprAplnRow[],
|
||||||
|
): ElaprPrgrsSttsSaveRequestDto[] {
|
||||||
|
return getVisibleRows(rows).map((row) =>
|
||||||
|
toPrgrsSttsItem(row.aprvrUuid, row.atrzSeComCd, row.atrzSeqNo),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
import {
|
||||||
|
ELAPR_PRGRS_STTS_SAVE_MODE,
|
||||||
|
type ElaprPrgrsSttsSaveRequestDto,
|
||||||
|
} from "../model/elapr-prgrs-stts-interface";
|
||||||
|
|
||||||
|
export const PRGRS_STTS_WAITING_CD = "ATRZ_PRGRS_001";
|
||||||
|
export const PRGRS_STTS_APPROVED_CD = "ATRZ_PRGRS_003";
|
||||||
|
|
||||||
|
/** 서버 행 비교용 최소 필드 */
|
||||||
|
export interface PrgrsSttsServerRow {
|
||||||
|
elaprPrgrsId?: string;
|
||||||
|
aprvrUuid?: string;
|
||||||
|
atrzSeComCd?: string;
|
||||||
|
atrzSeqNo?: number;
|
||||||
|
dcarbYn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 결재선 그리드 로컬 행 — 진행상태 API 응답 + UI 보조 필드 */
|
||||||
|
export interface ElaprPrgrsSttsRow {
|
||||||
|
rowKey: string;
|
||||||
|
elaprPrgrsId?: string;
|
||||||
|
elaprDmndId?: string;
|
||||||
|
aprvrUuid?: string;
|
||||||
|
aprvrNm?: string;
|
||||||
|
atrzSeComCd?: string;
|
||||||
|
atrzSeComNm?: string;
|
||||||
|
atrzSeqNo?: number;
|
||||||
|
atrzPrgrsSttsComCd?: string;
|
||||||
|
atrzPrgrsSttsComNm?: string;
|
||||||
|
rjctRsn?: string | null;
|
||||||
|
ognzNm?: string;
|
||||||
|
jbpsSeNm?: string;
|
||||||
|
jbgdSeNm?: string;
|
||||||
|
dcarbYn?: string;
|
||||||
|
isNew?: boolean;
|
||||||
|
isDirty?: boolean;
|
||||||
|
/** 소프트 삭제 — 최종 저장 시 mode:D */
|
||||||
|
isDeleted?: boolean;
|
||||||
|
/** 수정 취소용 스냅샷 */
|
||||||
|
snapshot?: ElaprPrgrsSttsRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isPrgrsSttsRowEditable(row: ElaprPrgrsSttsRow): boolean {
|
||||||
|
return row.isNew === true || row.atrzPrgrsSttsComCd === PRGRS_STTS_WAITING_CD;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isPrgrsSttsRowDcarbable(row: ElaprPrgrsSttsRow): boolean {
|
||||||
|
return row.atrzPrgrsSttsComCd !== PRGRS_STTS_APPROVED_CD;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVisibleRows(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
||||||
|
return rows.filter((row) => !row.isDeleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 그리드 행 순서(1-based)로 결재순서번호 일괄 채번 */
|
||||||
|
export function assignPrgrsSttsAtrzSeqNumbers(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
||||||
|
return rows.map((row, index) => ({ ...row, atrzSeqNo: index + 1 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validatePrgrsSttsRow(row: ElaprPrgrsSttsRow): string | null {
|
||||||
|
if (!row.atrzSeComCd?.trim()) {
|
||||||
|
return "결재구분을 선택해 주세요.";
|
||||||
|
}
|
||||||
|
if (!row.aprvrUuid?.trim()) {
|
||||||
|
return "결재자를 선택해 주세요.";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validateAllPrgrsSttsRows(
|
||||||
|
rows: ElaprPrgrsSttsRow[],
|
||||||
|
isEditingLocked: boolean,
|
||||||
|
): string | null {
|
||||||
|
if (isEditingLocked) {
|
||||||
|
return "편집 중인 행을 먼저 저장하거나 취소해 주세요.";
|
||||||
|
}
|
||||||
|
|
||||||
|
const visibleRows = getVisibleRows(rows);
|
||||||
|
if (visibleRows.length === 0) {
|
||||||
|
return "저장할 결재선이 없습니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const row of visibleRows) {
|
||||||
|
const fieldError = validatePrgrsSttsRow(row);
|
||||||
|
if (fieldError) return fieldError;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowDiffersFromServer(row: ElaprPrgrsSttsRow, serverRow: PrgrsSttsServerRow): boolean {
|
||||||
|
return (
|
||||||
|
row.aprvrUuid !== serverRow.aprvrUuid ||
|
||||||
|
row.atrzSeComCd !== serverRow.atrzSeComCd ||
|
||||||
|
row.atrzSeqNo !== serverRow.atrzSeqNo ||
|
||||||
|
(row.dcarbYn ?? "N") !== (serverRow.dcarbYn ?? "N")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldIncludeUpdate(row: ElaprPrgrsSttsRow, serverRows: PrgrsSttsServerRow[]): boolean {
|
||||||
|
if (row.isDirty) return true;
|
||||||
|
if (!row.elaprPrgrsId) return false;
|
||||||
|
|
||||||
|
const serverRow = serverRows.find((s) => s.elaprPrgrsId === row.elaprPrgrsId);
|
||||||
|
if (!serverRow) return false;
|
||||||
|
|
||||||
|
return rowDiffersFromServer(row, serverRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasUnsavedPrgrsSttsChanges(
|
||||||
|
rows: ElaprPrgrsSttsRow[],
|
||||||
|
serverRows: PrgrsSttsServerRow[],
|
||||||
|
): boolean {
|
||||||
|
if (rows.some((row) => row.isDeleted && row.elaprPrgrsId)) return true;
|
||||||
|
if (rows.some((row) => row.isNew && !row.isDeleted)) return true;
|
||||||
|
|
||||||
|
const visibleWithSeq = assignPrgrsSttsAtrzSeqNumbers(getVisibleRows(rows));
|
||||||
|
|
||||||
|
for (const row of visibleWithSeq) {
|
||||||
|
if (row.isNew) continue;
|
||||||
|
if (!row.elaprPrgrsId) continue;
|
||||||
|
if (row.isDirty) return true;
|
||||||
|
|
||||||
|
const serverRow = serverRows.find((s) => s.elaprPrgrsId === row.elaprPrgrsId);
|
||||||
|
if (!serverRow) continue;
|
||||||
|
if (rowDiffersFromServer(row, serverRow)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildPrgrsSttsSavePayload(
|
||||||
|
rows: ElaprPrgrsSttsRow[],
|
||||||
|
elaprDmndId: string,
|
||||||
|
serverRows: PrgrsSttsServerRow[],
|
||||||
|
): ElaprPrgrsSttsSaveRequestDto[] {
|
||||||
|
const payload: ElaprPrgrsSttsSaveRequestDto[] = [];
|
||||||
|
|
||||||
|
for (const row of rows) {
|
||||||
|
if (row.isDeleted && row.elaprPrgrsId) {
|
||||||
|
payload.push({
|
||||||
|
mode: ELAPR_PRGRS_STTS_SAVE_MODE.DELETE,
|
||||||
|
elaprPrgrsId: row.elaprPrgrsId,
|
||||||
|
elaprDmndId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const visibleWithSeq = assignPrgrsSttsAtrzSeqNumbers(getVisibleRows(rows));
|
||||||
|
|
||||||
|
for (const row of visibleWithSeq) {
|
||||||
|
if (row.isNew) {
|
||||||
|
payload.push({
|
||||||
|
mode: ELAPR_PRGRS_STTS_SAVE_MODE.CREATE,
|
||||||
|
elaprDmndId,
|
||||||
|
aprvrUuid: row.aprvrUuid,
|
||||||
|
atrzSeComCd: row.atrzSeComCd,
|
||||||
|
atrzSeqNo: row.atrzSeqNo,
|
||||||
|
atrzPrgrsSttsComCd: row.atrzPrgrsSttsComCd,
|
||||||
|
dcarbYn: row.dcarbYn ?? "N",
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!row.elaprPrgrsId) continue;
|
||||||
|
|
||||||
|
if (shouldIncludeUpdate(row, serverRows)) {
|
||||||
|
payload.push({
|
||||||
|
mode: ELAPR_PRGRS_STTS_SAVE_MODE.UPDATE,
|
||||||
|
elaprPrgrsId: row.elaprPrgrsId,
|
||||||
|
elaprDmndId,
|
||||||
|
aprvrUuid: row.aprvrUuid,
|
||||||
|
atrzSeComCd: row.atrzSeComCd,
|
||||||
|
atrzSeqNo: row.atrzSeqNo,
|
||||||
|
atrzPrgrsSttsComCd: row.atrzPrgrsSttsComCd,
|
||||||
|
dcarbYn: row.dcarbYn ?? "N",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
+25
-20
@@ -4,12 +4,11 @@ import { useCallback, useEffect, useState } from "react";
|
|||||||
|
|
||||||
import { arrayMove } from "@dnd-kit/sortable";
|
import { arrayMove } from "@dnd-kit/sortable";
|
||||||
|
|
||||||
import type { ElaprApln } from "@/entities/elapr";
|
import type { ElaprApln } from "../model/elapr-apln-interface";
|
||||||
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
|
|
||||||
import type { ElaprAplnRow } from "../model/apln-row-types";
|
import { assignAtrzSeqNumbers } from "./apln-save-utils";
|
||||||
|
import { getVisibleRows } from "./apln-validators";
|
||||||
import { assignAtrzSeqNumbers } from "./assign-atrz-seq";
|
|
||||||
import { getVisibleRows } from "./validators";
|
|
||||||
|
|
||||||
function toRow(item: ElaprApln): ElaprAplnRow {
|
function toRow(item: ElaprApln): ElaprAplnRow {
|
||||||
return {
|
return {
|
||||||
@@ -101,7 +100,13 @@ export function useAplnRows({ elaprTmpltId, serverRows }: UseAplnRowsOptions) {
|
|||||||
return prev.map((row) => {
|
return prev.map((row) => {
|
||||||
if (row.rowKey !== editingRowKey) return row;
|
if (row.rowKey !== editingRowKey) return row;
|
||||||
if (row.snapshot) {
|
if (row.snapshot) {
|
||||||
const { snapshot: _s, isNew: _n, isDirty: _d, isDeleted: _del, ...restored } = row.snapshot;
|
const {
|
||||||
|
snapshot: _s,
|
||||||
|
isNew: _n,
|
||||||
|
isDirty: _d,
|
||||||
|
isDeleted: _del,
|
||||||
|
...restored
|
||||||
|
} = row.snapshot;
|
||||||
return { ...restored, isNew: false, isDirty: false, isDeleted: false };
|
return { ...restored, isNew: false, isDirty: false, isDeleted: false };
|
||||||
}
|
}
|
||||||
return { ...row, isDirty: false };
|
return { ...row, isDirty: false };
|
||||||
@@ -110,19 +115,16 @@ export function useAplnRows({ elaprTmpltId, serverRows }: UseAplnRowsOptions) {
|
|||||||
setEditingRowKey(null);
|
setEditingRowKey(null);
|
||||||
}, [editingRowKey]);
|
}, [editingRowKey]);
|
||||||
|
|
||||||
const commitEdit = useCallback(
|
const commitEdit = useCallback((rowKey: string) => {
|
||||||
(rowKey: string) => {
|
setRows((prev) =>
|
||||||
setRows((prev) =>
|
prev.map((row) => {
|
||||||
prev.map((row) => {
|
if (row.rowKey !== rowKey) return row;
|
||||||
if (row.rowKey !== rowKey) return row;
|
const { snapshot: _s, ...committed } = row;
|
||||||
const { snapshot: _s, ...committed } = row;
|
return { ...committed, isDirty: true };
|
||||||
return { ...committed, isDirty: true };
|
}),
|
||||||
}),
|
);
|
||||||
);
|
setEditingRowKey(null);
|
||||||
setEditingRowKey(null);
|
}, []);
|
||||||
},
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
|
|
||||||
const markDeleted = useCallback((rowKey: string) => {
|
const markDeleted = useCallback((rowKey: string) => {
|
||||||
setRows((prev) => {
|
setRows((prev) => {
|
||||||
@@ -158,7 +160,10 @@ export function useAplnRows({ elaprTmpltId, serverRows }: UseAplnRowsOptions) {
|
|||||||
|
|
||||||
const visibleKeys = new Set(reorderedVisible.map((r) => r.rowKey));
|
const visibleKeys = new Set(reorderedVisible.map((r) => r.rowKey));
|
||||||
const deletedRows = prev.filter((r) => r.isDeleted);
|
const deletedRows = prev.filter((r) => r.isDeleted);
|
||||||
const merged = [...reorderedVisible, ...deletedRows.filter((r) => !visibleKeys.has(r.rowKey))];
|
const merged = [
|
||||||
|
...reorderedVisible,
|
||||||
|
...deletedRows.filter((r) => !visibleKeys.has(r.rowKey)),
|
||||||
|
];
|
||||||
|
|
||||||
payloadRows = reorderedVisible;
|
payloadRows = reorderedVisible;
|
||||||
return merged;
|
return merged;
|
||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
import { KeyboardSensor, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
import { KeyboardSensor, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
||||||
import { sortableKeyboardCoordinates } from "@dnd-kit/sortable";
|
import { sortableKeyboardCoordinates } from "@dnd-kit/sortable";
|
||||||
|
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import { arrayMove } from "@dnd-kit/sortable";
|
||||||
|
|
||||||
|
import type { ElaprDocPrgrsClientResponseDto } from "@/shared/model";
|
||||||
|
|
||||||
|
import {
|
||||||
|
assignPrgrsSttsAtrzSeqNumbers,
|
||||||
|
type ElaprPrgrsSttsRow,
|
||||||
|
isPrgrsSttsRowEditable,
|
||||||
|
PRGRS_STTS_WAITING_CD,
|
||||||
|
} from "./prgrs-stts-save-utils";
|
||||||
|
import { createDraftRowKey } from "./use-apln-rows";
|
||||||
|
|
||||||
|
function getVisibleRows(rows: ElaprPrgrsSttsRow[]): ElaprPrgrsSttsRow[] {
|
||||||
|
return rows.filter((row) => !row.isDeleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toRow(item: ElaprDocPrgrsClientResponseDto): ElaprPrgrsSttsRow {
|
||||||
|
return {
|
||||||
|
rowKey: item.elaprPrgrsId ?? createDraftRowKey(),
|
||||||
|
elaprPrgrsId: item.elaprPrgrsId,
|
||||||
|
elaprDmndId: item.elaprDmndId,
|
||||||
|
aprvrUuid: item.aprvrUuid,
|
||||||
|
aprvrNm: item.aprvrNm,
|
||||||
|
atrzSeComCd: item.atrzSeComCd,
|
||||||
|
atrzSeComNm: item.atrzSeComNm,
|
||||||
|
atrzSeqNo: item.atrzSeqNo,
|
||||||
|
atrzPrgrsSttsComCd: item.atrzPrgrsSttsComCd,
|
||||||
|
atrzPrgrsSttsComNm: item.atrzPrgrsSttsComNm,
|
||||||
|
rjctRsn: item.rjctRsn,
|
||||||
|
ognzNm: item.ognzNm,
|
||||||
|
jbpsSeNm: item.jbpsSeNm,
|
||||||
|
jbgdSeNm: item.jbgdSeNm,
|
||||||
|
dcarbYn: item.dcarbYn ?? "N",
|
||||||
|
isNew: false,
|
||||||
|
isDirty: false,
|
||||||
|
isDeleted: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UsePrgrsSttsRowsOptions {
|
||||||
|
serverRows?: ElaprDocPrgrsClientResponseDto[];
|
||||||
|
elaprDmndId?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function usePrgrsSttsRows({ serverRows, elaprDmndId }: UsePrgrsSttsRowsOptions) {
|
||||||
|
const [rows, setRows] = useState<ElaprPrgrsSttsRow[]>([]);
|
||||||
|
const [editingRowKey, setEditingRowKey] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setRows((serverRows ?? []).map(toRow));
|
||||||
|
setEditingRowKey(null);
|
||||||
|
}, [serverRows]);
|
||||||
|
|
||||||
|
const isEditingLocked = editingRowKey != null;
|
||||||
|
const visibleRows = getVisibleRows(rows);
|
||||||
|
|
||||||
|
const addRow = useCallback(() => {
|
||||||
|
if (!elaprDmndId || isEditingLocked) return;
|
||||||
|
|
||||||
|
const rowKey = createDraftRowKey();
|
||||||
|
|
||||||
|
setRows((prev) => [
|
||||||
|
...prev,
|
||||||
|
{
|
||||||
|
rowKey,
|
||||||
|
elaprDmndId,
|
||||||
|
atrzSeComCd: "",
|
||||||
|
aprvrUuid: "",
|
||||||
|
aprvrNm: "",
|
||||||
|
atrzPrgrsSttsComCd: PRGRS_STTS_WAITING_CD,
|
||||||
|
dcarbYn: "N",
|
||||||
|
isNew: true,
|
||||||
|
isDirty: true,
|
||||||
|
isDeleted: false,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
setEditingRowKey(rowKey);
|
||||||
|
}, [elaprDmndId, isEditingLocked]);
|
||||||
|
|
||||||
|
const startEdit = useCallback(
|
||||||
|
(rowKey: string) => {
|
||||||
|
if (isEditingLocked) return;
|
||||||
|
|
||||||
|
const target = rows.find((r) => r.rowKey === rowKey);
|
||||||
|
if (!target || !isPrgrsSttsRowEditable(target)) return;
|
||||||
|
|
||||||
|
setEditingRowKey(rowKey);
|
||||||
|
setRows((prev) =>
|
||||||
|
prev.map((row) => (row.rowKey === rowKey ? { ...row, snapshot: { ...row } } : row)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[isEditingLocked, rows],
|
||||||
|
);
|
||||||
|
|
||||||
|
const updateRow = useCallback(
|
||||||
|
(rowKey: string, patch: Partial<ElaprPrgrsSttsRow>) => {
|
||||||
|
if (editingRowKey !== rowKey) return;
|
||||||
|
setRows((prev) =>
|
||||||
|
prev.map((row) => (row.rowKey === rowKey ? { ...row, ...patch, isDirty: true } : row)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[editingRowKey],
|
||||||
|
);
|
||||||
|
|
||||||
|
const setDcarbYn = useCallback(
|
||||||
|
(rowKey: string, checked: boolean) => {
|
||||||
|
if (editingRowKey != null && editingRowKey !== rowKey) return;
|
||||||
|
|
||||||
|
setRows((prev) => {
|
||||||
|
const target = prev.find((r) => r.rowKey === rowKey);
|
||||||
|
if (!target || target.isDeleted) return prev;
|
||||||
|
|
||||||
|
const nextYn = checked ? "Y" : "N";
|
||||||
|
|
||||||
|
return prev.map((row) => {
|
||||||
|
if (row.isDeleted) return row;
|
||||||
|
|
||||||
|
if (row.rowKey === rowKey) {
|
||||||
|
if ((row.dcarbYn ?? "N") === nextYn) return row;
|
||||||
|
return { ...row, dcarbYn: nextYn, isDirty: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!checked) return row;
|
||||||
|
if ((row.dcarbYn ?? "N") === "N") return row;
|
||||||
|
return { ...row, dcarbYn: "N", isDirty: true };
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[editingRowKey],
|
||||||
|
);
|
||||||
|
|
||||||
|
const cancelEdit = useCallback(() => {
|
||||||
|
if (!editingRowKey) return;
|
||||||
|
|
||||||
|
setRows((prev) => {
|
||||||
|
const target = prev.find((r) => r.rowKey === editingRowKey);
|
||||||
|
if (target?.isNew) {
|
||||||
|
return prev.filter((r) => r.rowKey !== editingRowKey);
|
||||||
|
}
|
||||||
|
return prev.map((row) => {
|
||||||
|
if (row.rowKey !== editingRowKey) return row;
|
||||||
|
if (row.snapshot) {
|
||||||
|
const {
|
||||||
|
snapshot: _s,
|
||||||
|
isNew: _n,
|
||||||
|
isDirty: _d,
|
||||||
|
isDeleted: _del,
|
||||||
|
...restored
|
||||||
|
} = row.snapshot;
|
||||||
|
return { ...restored, isNew: false, isDirty: false, isDeleted: false };
|
||||||
|
}
|
||||||
|
return { ...row, isDirty: false };
|
||||||
|
});
|
||||||
|
});
|
||||||
|
setEditingRowKey(null);
|
||||||
|
}, [editingRowKey]);
|
||||||
|
|
||||||
|
const commitEdit = useCallback((rowKey: string) => {
|
||||||
|
setRows((prev) =>
|
||||||
|
prev.map((row) => {
|
||||||
|
if (row.rowKey !== rowKey) return row;
|
||||||
|
const { snapshot: _s, ...committed } = row;
|
||||||
|
return { ...committed, isDirty: true };
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setEditingRowKey(null);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const markDeleted = useCallback((rowKey: string) => {
|
||||||
|
setRows((prev) => {
|
||||||
|
const target = prev.find((r) => r.rowKey === rowKey);
|
||||||
|
if (!target || !isPrgrsSttsRowEditable(target)) return prev;
|
||||||
|
|
||||||
|
if (target.isNew) {
|
||||||
|
return prev.filter((r) => r.rowKey !== rowKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prev.map((row) =>
|
||||||
|
row.rowKey === rowKey ? { ...row, isDeleted: true, isDirty: true } : row,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
setEditingRowKey((key) => (key === rowKey ? null : key));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const reorderRows = useCallback(
|
||||||
|
(activeKey: string, overKey: string): ElaprPrgrsSttsRow[] => {
|
||||||
|
if (isEditingLocked) return [];
|
||||||
|
|
||||||
|
let payloadRows: ElaprPrgrsSttsRow[] = [];
|
||||||
|
|
||||||
|
setRows((prev) => {
|
||||||
|
const visible = getVisibleRows(prev);
|
||||||
|
const activeRow = visible.find((r) => r.rowKey === activeKey);
|
||||||
|
const overRow = visible.find((r) => r.rowKey === overKey);
|
||||||
|
if (!activeRow || !overRow) return prev;
|
||||||
|
if (!isPrgrsSttsRowEditable(activeRow) || !isPrgrsSttsRowEditable(overRow)) return prev;
|
||||||
|
|
||||||
|
const oldIndex = visible.findIndex((r) => r.rowKey === activeKey);
|
||||||
|
const newIndex = visible.findIndex((r) => r.rowKey === overKey);
|
||||||
|
if (oldIndex < 0 || newIndex < 0) return prev;
|
||||||
|
|
||||||
|
const reorderedVisible = assignPrgrsSttsAtrzSeqNumbers(
|
||||||
|
arrayMove(visible, oldIndex, newIndex),
|
||||||
|
).map((row) => (isPrgrsSttsRowEditable(row) ? { ...row, isDirty: true } : row));
|
||||||
|
|
||||||
|
const visibleKeys = new Set(reorderedVisible.map((r) => r.rowKey));
|
||||||
|
const deletedRows = prev.filter((r) => r.isDeleted);
|
||||||
|
const merged = [
|
||||||
|
...reorderedVisible,
|
||||||
|
...deletedRows.filter((r) => !visibleKeys.has(r.rowKey)),
|
||||||
|
];
|
||||||
|
|
||||||
|
payloadRows = reorderedVisible.filter(isPrgrsSttsRowEditable);
|
||||||
|
return merged;
|
||||||
|
});
|
||||||
|
|
||||||
|
return payloadRows;
|
||||||
|
},
|
||||||
|
[isEditingLocked],
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
rows,
|
||||||
|
visibleRows,
|
||||||
|
editingRowKey,
|
||||||
|
isEditingLocked,
|
||||||
|
addRow,
|
||||||
|
startEdit,
|
||||||
|
updateRow,
|
||||||
|
setDcarbYn,
|
||||||
|
cancelEdit,
|
||||||
|
commitEdit,
|
||||||
|
markDeleted,
|
||||||
|
reorderRows,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,14 +6,14 @@ export const ELAPR_APLN_SAVE_MODE = {
|
|||||||
DELETE: "D",
|
DELETE: "D",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type ElaprAplnSaveMode =
|
export type ElaprAplnSaveMode = (typeof ELAPR_APLN_SAVE_MODE)[keyof typeof ELAPR_APLN_SAVE_MODE];
|
||||||
(typeof ELAPR_APLN_SAVE_MODE)[keyof typeof ELAPR_APLN_SAVE_MODE];
|
|
||||||
|
|
||||||
export interface ElaprApln {
|
export interface ElaprApln {
|
||||||
aplnId: string;
|
aplnId: string;
|
||||||
elaprTmpltId: string;
|
elaprTmpltId: string;
|
||||||
aprvrUuid?: string;
|
aprvrUuid?: string;
|
||||||
aprvrNm?: string;
|
aprvrNm?: string;
|
||||||
|
aprvrUserId?: string;
|
||||||
atrzSeComCd?: string;
|
atrzSeComCd?: string;
|
||||||
atrzSeComNm?: string;
|
atrzSeComNm?: string;
|
||||||
atrzSeqNo?: number;
|
atrzSeqNo?: number;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { ElaprApln } from "@/entities/elapr";
|
import type { ElaprApln } from "./elapr-apln-interface";
|
||||||
|
|
||||||
/** 그리드 로컬 행 — API 응답 + UI 보조 필드 */
|
/** 그리드 로컬 행 — API 응답 + UI 보조 필드 */
|
||||||
export interface ElaprAplnRow extends Omit<ElaprApln, "aplnId"> {
|
export interface ElaprAplnRow extends Omit<ElaprApln, "aplnId"> {
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import type { ElaprDocPrgrsClientResponseDto, PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
import type { ElaprPrgrsSttsSaveRequestDto } from "./elapr-prgrs-stts-interface";
|
||||||
|
|
||||||
|
/** 백엔드 ElaprDmndSaveRequestDto */
|
||||||
|
export interface ElaprDmndSaveRequestDto {
|
||||||
|
elaprDocNo: string;
|
||||||
|
dmndTtl: string;
|
||||||
|
dmndCn: string;
|
||||||
|
elaprPrgrsSttsList?: ElaprPrgrsSttsSaveRequestDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprDmndResponseDto */
|
||||||
|
export interface ElaprDmndResponseDto {
|
||||||
|
elaprDmndId: string;
|
||||||
|
rqstrUuid?: string;
|
||||||
|
elaprDocNo: string;
|
||||||
|
dmndTtl: string;
|
||||||
|
dmndCn: string;
|
||||||
|
atrzSttsComCd: string;
|
||||||
|
atrzSttsComNm?: string;
|
||||||
|
dmndDt?: string;
|
||||||
|
updtDt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprDmndSearchDto + Pageable */
|
||||||
|
export interface ElaprDmndSearchDto extends PageableParams {
|
||||||
|
rqstrUuid?: string;
|
||||||
|
atrzSttsComCd?: string;
|
||||||
|
dmndTtl?: string;
|
||||||
|
dmndDtStart?: string;
|
||||||
|
dmndDtEnd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprDocPrgrsResponseDto */
|
||||||
|
export type ElaprDocPrgrsResponseDto = ElaprDocPrgrsClientResponseDto;
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface ElaprDmndService {
|
||||||
|
findPage(params: ElaprDmndSearchDto): Promise<PageResponse<ElaprDmndResponseDto>>;
|
||||||
|
findById(elaprDmndId: string): Promise<ElaprDmndResponseDto>;
|
||||||
|
save(body: ElaprDmndSaveRequestDto): Promise<ElaprDmndResponseDto>;
|
||||||
|
update(elaprDmndId: string, body: ElaprDmndSaveRequestDto): Promise<ElaprDmndResponseDto>;
|
||||||
|
updateStatus(elaprDmndId: string, atrzSttsComCd: string): Promise<ElaprDmndResponseDto>;
|
||||||
|
remove(elaprDmndId: string): Promise<void>;
|
||||||
|
findDocPrgrsByDocNo(elaprDocNo: string): Promise<ElaprDocPrgrsResponseDto[]>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||||
|
|
||||||
|
export const ELAPR_PRGRS_STTS_SAVE_MODE = {
|
||||||
|
CREATE: "C",
|
||||||
|
READ: "R",
|
||||||
|
UPDATE: "U",
|
||||||
|
DELETE: "D",
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ElaprPrgrsSttsSaveMode =
|
||||||
|
(typeof ELAPR_PRGRS_STTS_SAVE_MODE)[keyof typeof ELAPR_PRGRS_STTS_SAVE_MODE];
|
||||||
|
|
||||||
|
/** 백엔드 ElaprPrgrsSttsResponseDto */
|
||||||
|
export interface ElaprPrgrsSttsResponseDto {
|
||||||
|
elaprPrgrsId: string;
|
||||||
|
elaprDmndId?: string;
|
||||||
|
aprvrUuid?: string;
|
||||||
|
atrzSeComCd?: string;
|
||||||
|
atrzSeComNm?: string;
|
||||||
|
atrzSeqNo?: number;
|
||||||
|
atrzPrgrsSttsComCd?: string;
|
||||||
|
atrzPrgrsSttsComNm?: string;
|
||||||
|
rjctRsn?: string;
|
||||||
|
atrzDt?: string;
|
||||||
|
dcarbYn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprPrgrsSttsSaveRequestDto */
|
||||||
|
export interface ElaprPrgrsSttsSaveRequestDto {
|
||||||
|
mode?: ElaprPrgrsSttsSaveMode;
|
||||||
|
elaprPrgrsId?: string;
|
||||||
|
elaprDmndId?: string;
|
||||||
|
aprvrUuid?: string;
|
||||||
|
atrzSeComCd?: string;
|
||||||
|
atrzSeqNo?: number;
|
||||||
|
atrzPrgrsSttsComCd?: string;
|
||||||
|
dcarbYn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprPrgrsSttsSearchDto */
|
||||||
|
export interface ElaprPrgrsSttsSearchDto {
|
||||||
|
atrzSeComCd: string;
|
||||||
|
atrzSeqNo: number;
|
||||||
|
atrzPrgrsSttsComCd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprPrgrsSttsSearchDto + Pageable */
|
||||||
|
export interface ElaprPrgrsSttsMyDocSearchParams extends ElaprPrgrsSttsSearchDto, PageableParams {}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprProcessRequestDto */
|
||||||
|
export interface ElaprProcessRequestDto {
|
||||||
|
atrzPrgrsSttsComCd: string;
|
||||||
|
rjctRsn?: string;
|
||||||
|
finalApprovalYn?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprApproverChangeRequestDto */
|
||||||
|
export interface ElaprApproverChangeRequestDto {
|
||||||
|
aprvrUuid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 백엔드 ElaprApproverInsertRequestDto */
|
||||||
|
export interface ElaprApproverInsertRequestDto {
|
||||||
|
aprvrUuid: string;
|
||||||
|
atrzSeComCd: string;
|
||||||
|
atrzSeqNo: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Controller public 메서드명·시그니처와 동일 */
|
||||||
|
export interface ElaprPrgrsSttsService {
|
||||||
|
findAllByDmndId(elaprDmndId?: string): Promise<ElaprPrgrsSttsResponseDto[]>;
|
||||||
|
findById(elaprPrgrsId: string): Promise<ElaprPrgrsSttsResponseDto>;
|
||||||
|
save(requestDtos: ElaprPrgrsSttsSaveRequestDto[]): Promise<ElaprPrgrsSttsResponseDto[]>;
|
||||||
|
process(elaprPrgrsId: string, body: ElaprProcessRequestDto): Promise<ElaprPrgrsSttsResponseDto>;
|
||||||
|
processByDocNoAndAprvrUuid(
|
||||||
|
elaprDocNo: string,
|
||||||
|
aprvrUuid: string,
|
||||||
|
body: ElaprProcessRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto>;
|
||||||
|
delete(elaprPrgrsId: string): Promise<void>;
|
||||||
|
updateApprover(
|
||||||
|
elaprPrgrsId: string,
|
||||||
|
body: ElaprApproverChangeRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto>;
|
||||||
|
insertApprover(
|
||||||
|
elaprDmndId: string,
|
||||||
|
body: ElaprApproverInsertRequestDto,
|
||||||
|
): Promise<ElaprPrgrsSttsResponseDto>;
|
||||||
|
findMyElaperDocList(
|
||||||
|
params: ElaprPrgrsSttsMyDocSearchParams,
|
||||||
|
): Promise<PageResponse<ElaprPrgrsSttsResponseDto>>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export interface ReviewerOption {
|
||||||
|
uuid: string;
|
||||||
|
name: string;
|
||||||
|
deptNm: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RvwMnpwMngResponseDto, useRvwMnpwMngPage } from "@/entities/rvw-mnpw";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
Skeleton,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { type ReviewerOption } from "../model/reviewer-option";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 500;
|
||||||
|
|
||||||
|
interface AprvrPickerDialogProps {
|
||||||
|
open: boolean;
|
||||||
|
onOpenChange: (open: boolean) => void;
|
||||||
|
atrzSeComCd: string;
|
||||||
|
onSelect: (reviewer: ReviewerOption) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AprvrPickerDialog({ open, onOpenChange, atrzSeComCd, onSelect }: AprvrPickerDialogProps) {
|
||||||
|
const { data, isPending, isError } = useRvwMnpwMngPage(
|
||||||
|
{
|
||||||
|
atrzSeComCd,
|
||||||
|
page: 0,
|
||||||
|
size: PAGE_SIZE,
|
||||||
|
sort: "userUuidNm,asc",
|
||||||
|
},
|
||||||
|
{ enabled: open },
|
||||||
|
);
|
||||||
|
|
||||||
|
const items = data?.content ?? [];
|
||||||
|
|
||||||
|
function fromRvwMnpwMng(item: RvwMnpwMngResponseDto): ReviewerOption {
|
||||||
|
return {
|
||||||
|
uuid: item.userUuid,
|
||||||
|
name: item.userUuidNm ?? "",
|
||||||
|
deptNm: item.ognzNm ?? "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelect(item: (typeof items)[number]) {
|
||||||
|
onSelect(fromRvwMnpwMng(item));
|
||||||
|
onOpenChange(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
|
<DialogContent className="max-w-[56rem]" aria-describedby={undefined}>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>검토인력 선택</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
|
<div className="h-[36rem] overflow-auto">
|
||||||
|
{isPending ? (
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<Skeleton className="h-[4rem]" />
|
||||||
|
<Skeleton className="h-[16rem]" />
|
||||||
|
</div>
|
||||||
|
) : isError ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
검토인력 목록을 불러오지 못했습니다.
|
||||||
|
</p>
|
||||||
|
) : items.length === 0 ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
배치된 검토인력이 없습니다.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<Table className="w-full">
|
||||||
|
<colgroup>
|
||||||
|
<col width="25%" />
|
||||||
|
<col width="25%" />
|
||||||
|
<col width="15%" />
|
||||||
|
<col width="15%" />
|
||||||
|
<col width="20%" />
|
||||||
|
</colgroup>
|
||||||
|
<TableHeader>
|
||||||
|
<TableRow>
|
||||||
|
<TableHead>성명</TableHead>
|
||||||
|
<TableHead>부서</TableHead>
|
||||||
|
<TableHead>직위</TableHead>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<DialogFooter>
|
||||||
|
<Button type="button" color="white" onClick={() => onOpenChange(false)}>
|
||||||
|
닫기
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AprvrPickerDialog };
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import { closestCenter, DndContext, type DragEndEvent } from "@dnd-kit/core";
|
||||||
|
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
||||||
|
|
||||||
|
import { useAlertStore } from "@/shared/lib";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Skeleton,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { useElaprAplnPage } from "../api/queries";
|
||||||
|
import { validateAplnRow } from "../lib/apln-validators";
|
||||||
|
import { useAplnRows } from "../lib/use-apln-rows";
|
||||||
|
import { useDndSensors } from "../lib/use-dnd-sensors";
|
||||||
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
|
import type { ReviewerOption } from "../model/reviewer-option";
|
||||||
|
|
||||||
|
import { AprvrPickerDialog } from "./aprvr-picker-dialog";
|
||||||
|
import { SortableAplnPickerRow } from "./sortable-apln-picker-row";
|
||||||
|
|
||||||
|
interface ElaprAplnPickerGridProps {
|
||||||
|
elaprTmpltId: string | null;
|
||||||
|
onRowsChange?: (rows: ElaprAplnRow[]) => void;
|
||||||
|
onEditingLockedChange?: (locked: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ElaprAplnPickerGrid({
|
||||||
|
elaprTmpltId,
|
||||||
|
onRowsChange,
|
||||||
|
onEditingLockedChange,
|
||||||
|
}: ElaprAplnPickerGridProps) {
|
||||||
|
const [pickerOpen, setPickerOpen] = useState(false);
|
||||||
|
const [pickingRowKey, setPickingRowKey] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
|
||||||
|
const aplnQuery = useElaprAplnPage({
|
||||||
|
elaprTmpltId: elaprTmpltId ?? undefined,
|
||||||
|
page: 0,
|
||||||
|
size: 200,
|
||||||
|
sort: "atrzSeqNo,asc",
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
rows,
|
||||||
|
visibleRows,
|
||||||
|
editingRowKey,
|
||||||
|
isEditingLocked,
|
||||||
|
addRow,
|
||||||
|
startEdit,
|
||||||
|
updateRow,
|
||||||
|
cancelEdit,
|
||||||
|
commitEdit,
|
||||||
|
markDeleted,
|
||||||
|
reorderRows,
|
||||||
|
} = useAplnRows({
|
||||||
|
elaprTmpltId,
|
||||||
|
serverRows: aplnQuery.data?.content,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onRowsChange?.(rows);
|
||||||
|
}, [rows, onRowsChange]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onEditingLockedChange?.(isEditingLocked);
|
||||||
|
}, [isEditingLocked, onEditingLockedChange]);
|
||||||
|
|
||||||
|
const sensors = useDndSensors();
|
||||||
|
const isDisabled = !elaprTmpltId;
|
||||||
|
const pickingRow = pickingRowKey ? rows.find((r) => r.rowKey === pickingRowKey) : undefined;
|
||||||
|
|
||||||
|
function handleDragEnd(event: DragEndEvent) {
|
||||||
|
const { active, over } = event;
|
||||||
|
if (!over || active.id === over.id) return;
|
||||||
|
|
||||||
|
reorderRows(String(active.id), String(over.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRowChange(row: ElaprAplnRow, patch: Partial<ElaprAplnRow>) {
|
||||||
|
updateRow(row.rowKey, patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRowSave(row: ElaprAplnRow) {
|
||||||
|
const fieldError = validateAplnRow(row);
|
||||||
|
if (fieldError) {
|
||||||
|
alert(fieldError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
commitEdit(row.rowKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRowDelete(row: ElaprAplnRow) {
|
||||||
|
markDeleted(row.rowKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleReviewerSelect(reviewer: ReviewerOption) {
|
||||||
|
if (!pickingRowKey) return;
|
||||||
|
updateRow(pickingRowKey, {
|
||||||
|
aprvrUuid: reviewer.uuid,
|
||||||
|
aprvrNm: reviewer.name,
|
||||||
|
});
|
||||||
|
setPickingRowKey(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="card card-border mx-0 min-h-[32rem] flex-1 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
|
||||||
|
size="sm"
|
||||||
|
type="button"
|
||||||
|
color="green"
|
||||||
|
disabled={isDisabled || isEditingLocked}
|
||||||
|
onClick={addRow}
|
||||||
|
>
|
||||||
|
결재선 추가
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{aplnQuery.isPending && elaprTmpltId ? (
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<Skeleton className="h-[4rem]" />
|
||||||
|
<Skeleton className="h-[16rem]" />
|
||||||
|
</div>
|
||||||
|
) : !elaprTmpltId ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">결재서식을 선택하세요.</p>
|
||||||
|
) : visibleRows.length === 0 ? (
|
||||||
|
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||||
|
등록된 결재선이 없습니다. [결재선 추가]로 결재자를 등록하세요.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
|
||||||
|
<Table className="w-full">
|
||||||
|
<colgroup>
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="50%" />
|
||||||
|
<col width="20%" />
|
||||||
|
</colgroup>
|
||||||
|
<TableHeader>
|
||||||
|
<TableRow>
|
||||||
|
<TableHead className="w-10" />
|
||||||
|
<TableHead>결재순서</TableHead>
|
||||||
|
<TableHead>결재구분</TableHead>
|
||||||
|
<TableHead>결재자</TableHead>
|
||||||
|
<TableHead>관리</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
<SortableContext
|
||||||
|
items={visibleRows.map((r) => r.rowKey)}
|
||||||
|
strategy={verticalListSortingStrategy}
|
||||||
|
>
|
||||||
|
{visibleRows.map((row, index) => (
|
||||||
|
<SortableAplnPickerRow
|
||||||
|
key={row.rowKey}
|
||||||
|
row={row}
|
||||||
|
displaySeqNo={index + 1}
|
||||||
|
isEditing={editingRowKey === row.rowKey}
|
||||||
|
isLocked={isEditingLocked}
|
||||||
|
dragDisabled={isEditingLocked || !row.atrzSeComCd}
|
||||||
|
onStartEdit={() => startEdit(row.rowKey)}
|
||||||
|
onSave={() => handleRowSave(row)}
|
||||||
|
onCancel={cancelEdit}
|
||||||
|
onDelete={() => handleRowDelete(row)}
|
||||||
|
onChange={(patch) => handleRowChange(row, patch)}
|
||||||
|
onPickAprvr={() => {
|
||||||
|
setPickingRowKey(row.rowKey);
|
||||||
|
setPickerOpen(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</SortableContext>
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</DndContext>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<AprvrPickerDialog
|
||||||
|
open={pickerOpen}
|
||||||
|
onOpenChange={setPickerOpen}
|
||||||
|
atrzSeComCd={pickingRow?.atrzSeComCd ?? ""}
|
||||||
|
onSelect={handleReviewerSelect}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ElaprAplnPickerGrid };
|
||||||
@@ -0,0 +1,408 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
import { closestCenter, DndContext, type DragEndEvent } from "@dnd-kit/core";
|
||||||
|
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
||||||
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
|
import { AxiosError } from "axios";
|
||||||
|
|
||||||
|
import { ENDPOINT } from "@/shared/config";
|
||||||
|
import { useAlertStore } from "@/shared/lib";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
Skeleton,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
Textarea,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { elaprPrgrsSttsService } from "../api/elapr-prgrs-stts-service";
|
||||||
|
import { useElaprDocPrgrsByDocNo, useSaveElaprPrgrsStts } from "../api/queries";
|
||||||
|
import { validateAtrzOrder } from "../lib/apln-validators";
|
||||||
|
import { findCurrentUserPendingApprovalRequest } from "../lib/approval-request-utils";
|
||||||
|
import {
|
||||||
|
buildPrgrsSttsSavePayload,
|
||||||
|
hasUnsavedPrgrsSttsChanges,
|
||||||
|
isPrgrsSttsRowEditable,
|
||||||
|
validateAllPrgrsSttsRows,
|
||||||
|
validatePrgrsSttsRow,
|
||||||
|
} from "../lib/prgrs-stts-save-utils";
|
||||||
|
import { useDndSensors } from "../lib/use-dnd-sensors";
|
||||||
|
import { usePrgrsSttsRows } from "../lib/use-prgrs-stts-rows";
|
||||||
|
import type { ReviewerOption } from "../model/reviewer-option";
|
||||||
|
|
||||||
|
import { AprvrPickerDialog } from "./aprvr-picker-dialog";
|
||||||
|
import { SortablePrgrsSttsRow } from "./sortable-prgrs-stts-row";
|
||||||
|
|
||||||
|
interface ElaprApprovalDialogProps {
|
||||||
|
open: boolean;
|
||||||
|
onOpenChange: (open: boolean) => void;
|
||||||
|
elaprDocNo: string;
|
||||||
|
currentUserUuid: string;
|
||||||
|
onSuccess: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const UNSAVED_PRGRS_STTS_MESSAGE = "결재선 변경 이력이 있습니다.\n결재선 저장을 해 주세요.";
|
||||||
|
|
||||||
|
function ElaprApprovalDialog({
|
||||||
|
open,
|
||||||
|
onOpenChange,
|
||||||
|
elaprDocNo,
|
||||||
|
currentUserUuid,
|
||||||
|
onSuccess,
|
||||||
|
}: ElaprApprovalDialogProps) {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
const [rjctRsn, setRjctRsn] = useState("");
|
||||||
|
const [isProcessing, setIsProcessing] = useState(false);
|
||||||
|
const [pickerOpen, setPickerOpen] = useState(false);
|
||||||
|
const [pickingRowKey, setPickingRowKey] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const { data: elaprDocPrgrsList, isLoading } = useElaprDocPrgrsByDocNo(open ? elaprDocNo : null);
|
||||||
|
|
||||||
|
const elaprDmndId = elaprDocPrgrsList?.[0]?.elaprDmndId;
|
||||||
|
|
||||||
|
const {
|
||||||
|
rows,
|
||||||
|
visibleRows,
|
||||||
|
editingRowKey,
|
||||||
|
isEditingLocked,
|
||||||
|
addRow,
|
||||||
|
startEdit,
|
||||||
|
updateRow,
|
||||||
|
setDcarbYn,
|
||||||
|
cancelEdit,
|
||||||
|
commitEdit,
|
||||||
|
markDeleted,
|
||||||
|
reorderRows,
|
||||||
|
} = usePrgrsSttsRows({
|
||||||
|
serverRows: elaprDocPrgrsList,
|
||||||
|
elaprDmndId,
|
||||||
|
});
|
||||||
|
|
||||||
|
const savePrgrsSttsMutation = useSaveElaprPrgrsStts();
|
||||||
|
const sensors = useDndSensors();
|
||||||
|
|
||||||
|
const currentUserPrgrs = findCurrentUserPendingApprovalRequest(
|
||||||
|
elaprDocPrgrsList,
|
||||||
|
currentUserUuid,
|
||||||
|
);
|
||||||
|
const canApprove = Boolean(currentUserPrgrs?.elaprPrgrsId);
|
||||||
|
|
||||||
|
const pickingRow = pickingRowKey ? rows.find((r) => r.rowKey === pickingRowKey) : undefined;
|
||||||
|
const isBusy = isProcessing || savePrgrsSttsMutation.isPending;
|
||||||
|
const isPrgrsSttsUnsaved = hasUnsavedPrgrsSttsChanges(rows, elaprDocPrgrsList ?? []);
|
||||||
|
|
||||||
|
function handleDragEnd(event: DragEndEvent) {
|
||||||
|
const { active, over } = event;
|
||||||
|
if (!over || active.id === over.id) return;
|
||||||
|
|
||||||
|
reorderRows(String(active.id), String(over.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRowSave(rowKey: string) {
|
||||||
|
const row = rows.find((r) => r.rowKey === rowKey);
|
||||||
|
if (!row) return;
|
||||||
|
|
||||||
|
const fieldError = validatePrgrsSttsRow(row);
|
||||||
|
if (fieldError) {
|
||||||
|
alert(fieldError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
commitEdit(rowKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleReviewerSelect(reviewer: ReviewerOption) {
|
||||||
|
if (!pickingRowKey) return;
|
||||||
|
updateRow(pickingRowKey, {
|
||||||
|
aprvrUuid: reviewer.uuid,
|
||||||
|
aprvrNm: reviewer.name,
|
||||||
|
ognzNm: reviewer.deptNm,
|
||||||
|
});
|
||||||
|
setPickingRowKey(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertPrgrsSttsSaved(): boolean {
|
||||||
|
if (isEditingLocked) {
|
||||||
|
alert(UNSAVED_PRGRS_STTS_MESSAGE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPrgrsSttsUnsaved) {
|
||||||
|
alert(UNSAVED_PRGRS_STTS_MESSAGE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSavePrgrsStts() {
|
||||||
|
if (!elaprDmndId) {
|
||||||
|
alert("결재 요청 정보가 없습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const validationError = validateAllPrgrsSttsRows(rows, isEditingLocked);
|
||||||
|
if (validationError) {
|
||||||
|
alert(validationError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const orderError = validateAtrzOrder(rows);
|
||||||
|
if (orderError) {
|
||||||
|
alert(orderError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = buildPrgrsSttsSavePayload(rows, elaprDmndId, elaprDocPrgrsList ?? []);
|
||||||
|
if (payload.length === 0) {
|
||||||
|
alert("변경된 결재선이 없습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsProcessing(true);
|
||||||
|
try {
|
||||||
|
await savePrgrsSttsMutation.mutateAsync(payload);
|
||||||
|
alert("결재선이 저장되었습니다.");
|
||||||
|
await queryClient.invalidateQueries({
|
||||||
|
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||||
|
});
|
||||||
|
onSuccess();
|
||||||
|
} catch (error: unknown) {
|
||||||
|
let errorMessage = "결재선 저장 중 오류가 발생했습니다.";
|
||||||
|
if (error instanceof AxiosError) {
|
||||||
|
errorMessage = error.response?.data?.message ?? errorMessage;
|
||||||
|
}
|
||||||
|
alert(errorMessage);
|
||||||
|
} finally {
|
||||||
|
setIsProcessing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleApprove() {
|
||||||
|
if (!currentUserPrgrs?.elaprPrgrsId) return;
|
||||||
|
if (!assertPrgrsSttsSaved()) return;
|
||||||
|
|
||||||
|
setIsProcessing(true);
|
||||||
|
try {
|
||||||
|
await elaprPrgrsSttsService.process(currentUserPrgrs.elaprPrgrsId, {
|
||||||
|
atrzPrgrsSttsComCd: "ATRZ_PRGRS_003",
|
||||||
|
});
|
||||||
|
alert("결재가 완료되었습니다.");
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||||
|
});
|
||||||
|
onSuccess();
|
||||||
|
onOpenChange(false);
|
||||||
|
} catch (error: unknown) {
|
||||||
|
let errorMessage = "";
|
||||||
|
if (error instanceof AxiosError) {
|
||||||
|
errorMessage = error.response?.data?.message ?? "";
|
||||||
|
} else {
|
||||||
|
errorMessage = "결재 처리 중 오류가 발생했습니다.";
|
||||||
|
}
|
||||||
|
alert(errorMessage);
|
||||||
|
} finally {
|
||||||
|
setIsProcessing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleReject() {
|
||||||
|
if (!currentUserPrgrs?.elaprPrgrsId) return;
|
||||||
|
if (!rjctRsn.trim()) {
|
||||||
|
alert("반려 사유를 입력해주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!assertPrgrsSttsSaved()) return;
|
||||||
|
|
||||||
|
setIsProcessing(true);
|
||||||
|
try {
|
||||||
|
await elaprPrgrsSttsService.process(currentUserPrgrs.elaprPrgrsId, {
|
||||||
|
atrzPrgrsSttsComCd: "ATRZ_PRGRS_004",
|
||||||
|
rjctRsn: rjctRsn.trim(),
|
||||||
|
});
|
||||||
|
alert("반려 처리가 완료되었습니다.");
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||||
|
});
|
||||||
|
onSuccess();
|
||||||
|
onOpenChange(false);
|
||||||
|
} catch (error: unknown) {
|
||||||
|
let errorMessage = "";
|
||||||
|
if (error instanceof AxiosError) {
|
||||||
|
errorMessage = error.response?.data?.message ?? "";
|
||||||
|
} else {
|
||||||
|
errorMessage = "반려 처리 중 오류가 발생했습니다.";
|
||||||
|
}
|
||||||
|
alert(errorMessage);
|
||||||
|
} finally {
|
||||||
|
setIsProcessing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
setRjctRsn("");
|
||||||
|
setPickingRowKey(null);
|
||||||
|
onOpenChange(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onOpenChange={handleClose}>
|
||||||
|
<DialogContent className="max-w-[72rem]" aria-describedby={undefined}>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>전자결재</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
|
<div className="space-y-6">
|
||||||
|
<div>
|
||||||
|
<div className="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<h4 className="text-xl font-semibold">결재 진행 단계</h4>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
type="button"
|
||||||
|
color="white"
|
||||||
|
disabled={!elaprDmndId || isEditingLocked || isBusy}
|
||||||
|
onClick={addRow}
|
||||||
|
>
|
||||||
|
결재선 추가
|
||||||
|
</Button>
|
||||||
|
{elaprDmndId && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
type="button"
|
||||||
|
onClick={handleSavePrgrsStts}
|
||||||
|
disabled={!isPrgrsSttsUnsaved || isEditingLocked || isBusy}
|
||||||
|
>
|
||||||
|
결재선 저장
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="space-y-3">
|
||||||
|
<Skeleton className="h-12 w-full" />
|
||||||
|
<Skeleton className="h-32 w-full" />
|
||||||
|
</div>
|
||||||
|
) : visibleRows.length === 0 ? (
|
||||||
|
<div className="py-8 text-center text-gray-500">
|
||||||
|
{elaprDmndId
|
||||||
|
? "등록된 결재선이 없습니다. [결재선 추가]로 결재자를 등록하세요."
|
||||||
|
: "결재 정보가 없습니다."}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<DndContext
|
||||||
|
sensors={sensors}
|
||||||
|
collisionDetection={closestCenter}
|
||||||
|
onDragEnd={handleDragEnd}
|
||||||
|
>
|
||||||
|
<Table className="w-full">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="30%" />
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="10%" />
|
||||||
|
<col width="24%" />
|
||||||
|
</colgroup>
|
||||||
|
<TableHeader>
|
||||||
|
<TableRow>
|
||||||
|
<TableHead className="w-10" />
|
||||||
|
<TableHead>결재순서</TableHead>
|
||||||
|
<TableHead>결재구분</TableHead>
|
||||||
|
<TableHead>결재자</TableHead>
|
||||||
|
<TableHead>전결자 지정</TableHead>
|
||||||
|
<TableHead>결재상태</TableHead>
|
||||||
|
<TableHead>관리</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
<SortableContext
|
||||||
|
items={visibleRows.map((r) => r.rowKey)}
|
||||||
|
strategy={verticalListSortingStrategy}
|
||||||
|
>
|
||||||
|
{visibleRows.map((row, index) => (
|
||||||
|
<SortablePrgrsSttsRow
|
||||||
|
key={row.rowKey}
|
||||||
|
row={row}
|
||||||
|
displaySeqNo={index + 1}
|
||||||
|
isEditing={editingRowKey === row.rowKey}
|
||||||
|
isLocked={isEditingLocked}
|
||||||
|
dragDisabled={
|
||||||
|
isEditingLocked || !isPrgrsSttsRowEditable(row) || !row.atrzSeComCd
|
||||||
|
}
|
||||||
|
onStartEdit={() => startEdit(row.rowKey)}
|
||||||
|
onSave={() => handleRowSave(row.rowKey)}
|
||||||
|
onCancel={cancelEdit}
|
||||||
|
onDelete={() => markDeleted(row.rowKey)}
|
||||||
|
onChange={(patch) => updateRow(row.rowKey, patch)}
|
||||||
|
onPickAprvr={() => {
|
||||||
|
setPickingRowKey(row.rowKey);
|
||||||
|
setPickerOpen(true);
|
||||||
|
}}
|
||||||
|
onToggleDcarb={(checked) => setDcarbYn(row.rowKey, checked)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</SortableContext>
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</DndContext>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{canApprove && (
|
||||||
|
<div>
|
||||||
|
<h4 className="mb-3 text-xl font-semibold">반려 의견</h4>
|
||||||
|
<Textarea
|
||||||
|
value={rjctRsn}
|
||||||
|
onChange={(event) => setRjctRsn(event.target.value)}
|
||||||
|
placeholder="반려 시 사유를 입력하세요"
|
||||||
|
rows={4}
|
||||||
|
className="!text-xl"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DialogFooter>
|
||||||
|
<div className="flex w-full items-center justify-between">
|
||||||
|
<Button type="button" color="white" onClick={handleClose} disabled={isBusy}>
|
||||||
|
취소
|
||||||
|
</Button>
|
||||||
|
{canApprove && (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Button onClick={handleApprove} disabled={isBusy}>
|
||||||
|
결재
|
||||||
|
</Button>
|
||||||
|
<Button color="red" onClick={handleReject} disabled={isBusy}>
|
||||||
|
반려
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
|
||||||
|
<AprvrPickerDialog
|
||||||
|
open={pickerOpen}
|
||||||
|
onOpenChange={setPickerOpen}
|
||||||
|
atrzSeComCd={pickingRow?.atrzSeComCd ?? ""}
|
||||||
|
onSelect={handleReviewerSelect}
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ElaprApprovalDialog };
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Fragment } from "react";
|
||||||
|
|
||||||
|
import { ChevronRight } from "lucide-react";
|
||||||
|
|
||||||
|
import type { ElaprDocPrgrsClientResponseDto } from "@/shared/model";
|
||||||
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
|
||||||
|
import { cn, Skeleton } from "@common/components";
|
||||||
|
|
||||||
|
import { useElaprDocPrgrsByDocNo } from "../api/queries";
|
||||||
|
import { getApproverStatus, sortByAtrzSeqNo } from "../lib/approval-utils";
|
||||||
|
|
||||||
|
const REJECT_STATUS_CD = "ATRZ_PRGRS_004";
|
||||||
|
|
||||||
|
interface ElaprDocPrgrsStatusProps {
|
||||||
|
elaprDocNo: string | null | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ElaprDocPrgrsStep({ item }: { item: ElaprDocPrgrsClientResponseDto }) {
|
||||||
|
const status = getApproverStatus(item.atrzPrgrsSttsComCd);
|
||||||
|
const isRejected = item.atrzPrgrsSttsComCd === REJECT_STATUS_CD;
|
||||||
|
const rjctRsn = item.rjctRsn?.trim();
|
||||||
|
const metaParts = [item.ognzNm, item.jbpsSeNm].filter(Boolean);
|
||||||
|
|
||||||
|
const statusBadge = (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"inline-flex items-center rounded-sm px-2 py-1 text-lg font-medium",
|
||||||
|
status.badgeClass,
|
||||||
|
isRejected && rjctRsn && "cursor-help underline decoration-dotted underline-offset-4",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{status.label}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex min-w-[12rem] flex-1 flex-col items-center gap-3 p-4 text-center">
|
||||||
|
{isRejected && rjctRsn ? (
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>{statusBadge}</TooltipTrigger>
|
||||||
|
<TooltipContent sideOffset={4} className="max-w-md whitespace-pre-wrap">
|
||||||
|
{rjctRsn}
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
statusBadge
|
||||||
|
)}
|
||||||
|
<div className="flex flex-col items-center gap-1">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="text-xl text-muted-foreground">[{item.atrzSeComNm || "-"}]</span>
|
||||||
|
<span className="text-xl font-semibold">{item.aprvrNm || item.aprvrUuid || "-"}</span>
|
||||||
|
</div>
|
||||||
|
{metaParts.length > 0 && (
|
||||||
|
<span className="text-base text-gray-500">{metaParts.join(" · ")}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ElaprDocPrgrsStatus({ elaprDocNo }: ElaprDocPrgrsStatusProps) {
|
||||||
|
const { data, isLoading } = useElaprDocPrgrsByDocNo(elaprDocNo);
|
||||||
|
const steps = sortByAtrzSeqNo(data ?? []);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-3 px-4 py-6">
|
||||||
|
<Skeleton className="h-24 flex-1 rounded-sm" />
|
||||||
|
<Skeleton className="h-24 flex-1 rounded-sm" />
|
||||||
|
<Skeleton className="h-24 flex-1 rounded-sm" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (steps.length === 0) {
|
||||||
|
return <div className="py-8 text-center text-xl text-gray-500">결재 정보가 없습니다.</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-wrap items-stretch justify-start gap-4 overflow-x-auto">
|
||||||
|
{steps.map((item, index) => (
|
||||||
|
<Fragment key={item.elaprPrgrsId ?? `${item.atrzSeqNo}-${item.aprvrUuid ?? index}`}>
|
||||||
|
<div className="flex items-center">
|
||||||
|
{index > 0 && <ChevronRight className="size-8 text-muted-foreground" />}
|
||||||
|
</div>
|
||||||
|
<ElaprDocPrgrsStep item={item} />
|
||||||
|
</Fragment>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ElaprDocPrgrsStatus };
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
|
import { useAlertStore } from "@/shared/lib";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
} from "@common/components";
|
||||||
|
|
||||||
|
import { useElaprTmpltPage } from "../api/queries";
|
||||||
|
import {
|
||||||
|
getVisibleRows,
|
||||||
|
validateAllRowsForSave,
|
||||||
|
validateAtrzOrder,
|
||||||
|
validateUniqueSeqNo,
|
||||||
|
} from "../lib/apln-validators";
|
||||||
|
import type { ElaprAplnRow } from "../model/elapr-apln-row-types";
|
||||||
|
import type { ElaprTmplt } from "../model/elapr-tmplt-interface";
|
||||||
|
|
||||||
|
import { ElaprAplnPickerGrid } from "./elapr-apln-picker-grid";
|
||||||
|
import { ElaprTmpltSelectTable } from "./elapr-tmplt-select-table";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
interface ElaprTmpltPickerConfirmPayload {
|
||||||
|
tmplt: ElaprTmplt;
|
||||||
|
aplnRows: ElaprAplnRow[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ElaprTmpltPickerDialogProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
docSeComCd: string;
|
||||||
|
onSelect?: (tmplt: ElaprTmplt) => void;
|
||||||
|
onConfirm?: (payload: ElaprTmpltPickerConfirmPayload) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ElaprTmpltPickerDialog({
|
||||||
|
open,
|
||||||
|
onClose,
|
||||||
|
docSeComCd,
|
||||||
|
onSelect,
|
||||||
|
onConfirm,
|
||||||
|
}: ElaprTmpltPickerDialogProps) {
|
||||||
|
const alert = useAlertStore((state) => state.setMessage);
|
||||||
|
const [selectedTmplt, setSelectedTmplt] = useState<ElaprTmplt | null>(null);
|
||||||
|
const [aplnRows, setAplnRows] = useState<ElaprAplnRow[]>([]);
|
||||||
|
const [isEditingLocked, setIsEditingLocked] = useState(false);
|
||||||
|
|
||||||
|
const tmpltQuery = useElaprTmpltPage({
|
||||||
|
page: 0,
|
||||||
|
size: PAGE_SIZE,
|
||||||
|
sort: "regDt,desc",
|
||||||
|
docSeComCd,
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleRowsChange = useCallback((rows: ElaprAplnRow[]) => {
|
||||||
|
setAplnRows(rows);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleEditingLockedChange = useCallback((locked: boolean) => {
|
||||||
|
setIsEditingLocked(locked);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
function handleSelectTmplt(tmplt: ElaprTmplt | null) {
|
||||||
|
setSelectedTmplt(tmplt);
|
||||||
|
setAplnRows([]);
|
||||||
|
setIsEditingLocked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleOpenChange(isOpen: boolean) {
|
||||||
|
if (!isOpen) {
|
||||||
|
setSelectedTmplt(null);
|
||||||
|
setAplnRows([]);
|
||||||
|
setIsEditingLocked(false);
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConfirm() {
|
||||||
|
if (!selectedTmplt) {
|
||||||
|
alert("결재서식을 선택해 주세요.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowsError = validateAllRowsForSave(aplnRows, isEditingLocked);
|
||||||
|
if (rowsError) {
|
||||||
|
alert(rowsError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const orderError = validateAtrzOrder(aplnRows);
|
||||||
|
if (orderError) {
|
||||||
|
alert(orderError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const seqError = validateUniqueSeqNo(aplnRows);
|
||||||
|
if (seqError) {
|
||||||
|
alert(seqError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const visibleRows = getVisibleRows(aplnRows);
|
||||||
|
|
||||||
|
const payload: ElaprTmpltPickerConfirmPayload = {
|
||||||
|
tmplt: selectedTmplt,
|
||||||
|
aplnRows: visibleRows,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (onConfirm) {
|
||||||
|
onConfirm(payload);
|
||||||
|
} else {
|
||||||
|
onSelect?.(selectedTmplt);
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelectedTmplt(null);
|
||||||
|
setAplnRows([]);
|
||||||
|
setIsEditingLocked(false);
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||||
|
<DialogContent className="max-w-[120rem]" aria-describedby={undefined}>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>결재선 선택</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
|
<div className="flex gap-6">
|
||||||
|
<ElaprTmpltSelectTable
|
||||||
|
query={tmpltQuery}
|
||||||
|
selectedTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||||
|
onSelectTmplt={handleSelectTmplt}
|
||||||
|
/>
|
||||||
|
<ElaprAplnPickerGrid
|
||||||
|
elaprTmpltId={selectedTmplt?.elaprTmpltId ?? null}
|
||||||
|
onRowsChange={handleRowsChange}
|
||||||
|
onEditingLockedChange={handleEditingLockedChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DialogFooter>
|
||||||
|
<Button type="button" color="white" onClick={() => handleOpenChange(false)}>
|
||||||
|
닫기
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={!selectedTmplt || isEditingLocked}
|
||||||
|
onClick={handleConfirm}
|
||||||
|
>
|
||||||
|
확인
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ElaprTmpltPickerDialog };
|
||||||
|
export type { ElaprTmpltPickerConfirmPayload };
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user