Compare commits
118
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96e0df4e0b | ||
|
|
6cc600a8db | ||
|
|
c054d635b1 | ||
|
|
f25686da46 | ||
|
|
f68f164f64 | ||
|
|
e4dda6e50b | ||
|
|
52560d4b1b | ||
|
|
22209fb426 | ||
|
|
5898d454aa | ||
|
|
7cab00c198 | ||
|
|
1422319f4e | ||
|
|
690907364e | ||
|
|
dc4c1e93b1 | ||
|
|
95b048110a | ||
|
|
5f5c27fcca | ||
|
|
0a5ea76971 | ||
|
|
d21bde8748 | ||
|
|
18d7698c03 | ||
|
|
02a3a47ad0 | ||
|
|
55370f21d2 | ||
|
|
c1540030a5 | ||
|
|
1ac35dfc33 | ||
|
|
e62ddf2877 | ||
|
|
741b9b64b3 | ||
|
|
7c1cc6df65 | ||
|
|
23d8425858 | ||
|
|
6e390199b3 | ||
|
|
6454ae1330 | ||
|
|
6e10389b33 | ||
|
|
965accac4a | ||
|
|
07442cd458 | ||
|
|
3551bc0196 | ||
|
|
4b864019df | ||
|
|
f66bbed334 | ||
|
|
0528abb25b | ||
|
|
b1833d4aa5 | ||
|
|
b2891234ab | ||
|
|
8fd441bcbf | ||
|
|
ea4a4504ee | ||
|
|
677c6501f3 | ||
|
|
8019660593 | ||
|
|
da723e74b9 | ||
|
|
2323c67131 | ||
|
|
46de361f3c | ||
|
|
05b3b0675f | ||
|
|
54f47afaee | ||
|
|
f88e582b5e | ||
|
|
b8d93f1b8b | ||
|
|
5afc8da9a8 | ||
|
|
fb338598ef | ||
|
|
27499977d7 | ||
|
|
554ad2c5a8 | ||
|
|
ca30fc9a33 | ||
|
|
fa9f971226 | ||
|
|
a4350c9788 | ||
|
|
2919d7d637 | ||
|
|
ec89b1fbf3 | ||
|
|
a764bde899 | ||
|
|
4c2d069b59 | ||
|
|
4667e535e9 | ||
|
|
750baa59c1 | ||
|
|
4856e7fc17 | ||
|
|
a6993773a7 | ||
|
|
a263ec0961 | ||
|
|
01612302ba | ||
|
|
33d82eff22 | ||
|
|
44b836f3a2 | ||
|
|
94a05453f8 | ||
|
|
fa209d0c5d | ||
|
|
9c0ca52036 | ||
|
|
5fc4bbdacd | ||
|
|
1624b44c0d | ||
|
|
65419a4d88 | ||
|
|
e781af3209 | ||
|
|
8346f59f45 | ||
|
|
20442392ac | ||
|
|
4b13eb4280 | ||
|
|
f8daea7fcf | ||
|
|
c966581a99 | ||
|
|
850653b442 | ||
|
|
cf518a46c3 | ||
|
|
a147d972b8 | ||
|
|
ea7cb87c7b | ||
|
|
131ceec61e | ||
|
|
e92f36f739 | ||
|
|
8f1bb4b5f2 | ||
|
|
4e7f40d848 | ||
|
|
489be4ce19 | ||
|
|
18e9708af1 | ||
|
|
27ea503260 | ||
|
|
54803e4061 | ||
|
|
076516fdbf | ||
|
|
ac5573a296 | ||
|
|
6fccf422ea | ||
|
|
0a29570cda | ||
|
|
cc727045e1 | ||
|
|
deeb670150 | ||
|
|
f0f2665981 | ||
|
|
8d904d6714 | ||
|
|
96828c175e | ||
|
|
4e0e05ea78 | ||
|
|
9ea9dc5e32 | ||
|
|
c31a6ea8bf | ||
|
|
23bc71b275 | ||
|
|
c972dffa6e | ||
|
|
9e84a452ff | ||
|
|
78c7770834 | ||
|
|
1d71bbf942 | ||
|
|
d51318431c | ||
|
|
c90aabed50 | ||
|
|
81141e0971 | ||
|
|
20a133119c | ||
|
|
e7f2b3e3ee | ||
|
|
4933fc164a | ||
|
|
c29017fb51 | ||
|
|
ccf20ee7eb | ||
|
|
c620a84ee3 | ||
|
|
b7164a0542 |
+2
-1
@@ -14,7 +14,8 @@ dist
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
apps/wr/.next/**/*
|
||||
apps/fo/.next/**/*
|
||||
|
||||
# env
|
||||
.env*
|
||||
.qodo
|
||||
|
||||
@@ -44,6 +44,12 @@ npx create-next-app@latest ./apps/as --typescript --eslint --tailwind --app
|
||||
```json
|
||||
{
|
||||
// 기타 설정 ...
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@common/components": "workspace:*", // 추가
|
||||
"react": "^19.0.0", // 제거
|
||||
@@ -143,7 +149,9 @@ export default nextConfig;
|
||||
### 6. globals.css(또는 전역 css) 수정
|
||||
|
||||
```css
|
||||
@import "@common/assets/index.css";
|
||||
@import "@common/assets/styles/base.css";
|
||||
@import "@common/assets/styles/diveicon.css";
|
||||
@import "@common/assets/styles/components.css";
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
NEXT_PUBLIC_PORT=3000
|
||||
NEXT_PUBLIC_SERVER_API_URL=http://localhost:8000
|
||||
NEXT_PUBLIC_SERVER_API_URL=http://192.168.0.102:8000
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
import { ImagePage } from "@/pages/image";
|
||||
export default ImagePage;
|
||||
@@ -1,27 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import type { MenuItem } from "@common/components/api";
|
||||
import { BaseLayout } from "@common/components/ui";
|
||||
import { MenuWrapper } from "@/entities/menu";
|
||||
import { useMenuStore } from "@/shared/lib";
|
||||
|
||||
export default function WithBaseLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const { setCurrentMenuInfo } = useMenuStore((state) => state);
|
||||
|
||||
const handleMenuClick = (item: MenuItem) => {
|
||||
setCurrentMenuInfo(item);
|
||||
router.push(item.urlPath);
|
||||
};
|
||||
|
||||
return (
|
||||
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={handleMenuClick}>
|
||||
<MenuWrapper>{children}</MenuWrapper>
|
||||
</BaseLayout>
|
||||
);
|
||||
return <BaseLayout>{children}</BaseLayout>;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,7 @@ export function middleware(req: NextRequest) {
|
||||
const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${
|
||||
queryParams ? `?${queryParams}` : ""
|
||||
}`;
|
||||
return NextResponse.rewrite(new URL(newUrl));
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/attach-service")) {
|
||||
const newUrl = `${serverApiUrl}${pathname}`;
|
||||
console.log("Rewriting to: ", newUrl);
|
||||
return NextResponse.rewrite(new URL(newUrl));
|
||||
}
|
||||
|
||||
@@ -24,5 +20,5 @@ export function middleware(req: NextRequest) {
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/server/:path*", "/attach-service/:path*"],
|
||||
matcher: "/server/:path*",
|
||||
};
|
||||
|
||||
+33
-1
@@ -1,5 +1,37 @@
|
||||
import type { NextConfig } from "next";
|
||||
import webpack from "webpack";
|
||||
|
||||
const nextConfig: NextConfig = {};
|
||||
const nextConfig: NextConfig = {
|
||||
webpack: (config) => {
|
||||
config.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
"import.meta.env.VITE_PORT": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_PORT,
|
||||
),
|
||||
"import.meta.env.VITE_PROXY_HOST": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_PROXY_HOST,
|
||||
),
|
||||
"import.meta.env.VITE_SERVER_API_URL": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_SERVER_API_URL,
|
||||
),
|
||||
"import.meta.env.VITE_SITE_ID": JSON.stringify(process.env.SITE_ID),
|
||||
"import.meta.env.VITE_CLAIM_NAME": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_CLAIM_NAME,
|
||||
),
|
||||
"import.meta.env.VITE_ACCESS_TOKEN": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_ACCESS_TOKEN,
|
||||
),
|
||||
"import.meta.env.VITE_REFRESH_TOKEN": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_REFRESH_TOKEN,
|
||||
),
|
||||
"import.meta.env.VITE_AUTH_USER_ID": JSON.stringify(
|
||||
process.env.NEXT_PUBLIC_AUTH_USER_ID,
|
||||
),
|
||||
}),
|
||||
);
|
||||
|
||||
return config;
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
"react-dnd": "^16.0.1",
|
||||
"react-hook-form": "^7.54.2",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"tus-js-client": "^4.3.1",
|
||||
"zod": "^3.24.2",
|
||||
"zustand": "^5.0.3"
|
||||
},
|
||||
|
||||
@@ -9,84 +9,43 @@
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.card_width10 {
|
||||
width: calc(10% - 12px);
|
||||
}
|
||||
.card_width10 {width:calc(10% - 12px);}
|
||||
|
||||
.card_width20 {
|
||||
width: calc(20% - 12px);
|
||||
}
|
||||
.card_width20 {width:calc(20% - 12px);}
|
||||
|
||||
.card_width25 {
|
||||
width: calc(25% - 12px);
|
||||
}
|
||||
.card_width25 {width:calc(25% - 12px);}
|
||||
|
||||
.card_width30 {
|
||||
width: calc(30% - 12px);
|
||||
}
|
||||
.card_width30 {width:calc(30% - 12px);}
|
||||
|
||||
.card_width33 {
|
||||
width: calc(33.333% - 12px);
|
||||
}
|
||||
.card_width33 {width:calc(33.333% - 12px);}
|
||||
|
||||
.card_width40 {
|
||||
width: calc(40% - 12px);
|
||||
}
|
||||
.card_width40 {width:calc(40% - 12px);}
|
||||
|
||||
.card_width45 {
|
||||
width: calc(45% - 12px);
|
||||
}
|
||||
.card_width45 {width:calc(45% - 12px);}
|
||||
|
||||
.card_width50 {
|
||||
width: calc(50% - 12px);
|
||||
}
|
||||
.card_width50 {width:calc(50% - 12px);}
|
||||
|
||||
.card_width60 {
|
||||
width: calc(60% - 12px);
|
||||
}
|
||||
.card_width60 {width:calc(60% - 12px);}
|
||||
|
||||
.card_width66 {
|
||||
width: calc(66.666% - 12px);
|
||||
}
|
||||
.card_width66 {width:calc(66.666% - 12px);}
|
||||
|
||||
.card_width70 {
|
||||
width: calc(70% - 12px);
|
||||
}
|
||||
.card_width70 {width:calc(70% - 12px);}
|
||||
|
||||
.card_width75 {
|
||||
width: calc(75% - 12px);
|
||||
}
|
||||
.card_width75 {width:calc(75% - 12px);}
|
||||
|
||||
.card_width80 {
|
||||
width: calc(80% - 12px);
|
||||
}
|
||||
.card_width80 {width:calc(80% - 12px);}
|
||||
|
||||
.card_width90 {
|
||||
width: calc(90% - 12px);
|
||||
}
|
||||
.card_width90 {width:calc(90% - 12px);}
|
||||
|
||||
.card_width100 {
|
||||
width: calc(100% - 12px);
|
||||
}
|
||||
.card_width100 {width:calc(100% - 12px);}
|
||||
|
||||
.card_nopadding {
|
||||
padding: 0 !important;
|
||||
}
|
||||
.card_nopadding {padding:0 !important;}
|
||||
|
||||
.card_nomargin {
|
||||
width: 100%;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.card_nomargin {width:100%;margin:0 !important;padding:0 !important;}
|
||||
|
||||
.topline {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
.topline {border-top: 1px solid #ccc;}
|
||||
|
||||
.bottomline {
|
||||
border-bottom: 1px solid #e6eef3;
|
||||
background: #fff;
|
||||
}
|
||||
.bottomline {border-bottom: 1px solid #e6eef3;background: #fff;}
|
||||
|
||||
.card-border {
|
||||
border: 1px solid #dbe2e6;
|
||||
@@ -95,7 +54,6 @@
|
||||
}
|
||||
|
||||
.card-header {
|
||||
margin-top: -0.6rem;
|
||||
margin-left: -0.6rem;
|
||||
margin-right: -0.6rem;
|
||||
display: flex;
|
||||
@@ -120,8 +78,8 @@
|
||||
/* 블랙 테마 */
|
||||
[data-theme="black"] {
|
||||
.card-border {
|
||||
border-color: #3f4042;
|
||||
background-color: rgba(255, 255, 255, 0.065);
|
||||
border-color: #38383a;
|
||||
}
|
||||
.card-header {
|
||||
border-bottom-color: #3f4042;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { LoginApi } from "./api/login-service";
|
||||
export { AuthWrapper } from "./lib/auth-wrapper";
|
||||
export { AuthWrapper } from "./ui/auth-wrapper";
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
BoardPopupList,
|
||||
BoardPopupParams,
|
||||
BoardService,
|
||||
} from "../model/board-interface";
|
||||
|
||||
export class BoardApiService implements BoardService {
|
||||
public async getBoardPopupList(
|
||||
params: BoardPopupParams,
|
||||
): Promise<BoardPopupList> {
|
||||
const response = await client.get<BoardPopupList>(
|
||||
`${ENDPOINT.BOARD_SERVICE.BBS}`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const BoardApi = new BoardApiService();
|
||||
@@ -1,2 +0,0 @@
|
||||
export { BoardApi } from "./api/board-service";
|
||||
export { type BoardPopup } from "./model/board-interface";
|
||||
@@ -1,42 +0,0 @@
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
export const BOARD_TYPE = {
|
||||
BBSNORMAL: "BBSNORMAL",
|
||||
BBSFAQ: "BBSFAQ",
|
||||
BBSIMAGE: "BBSIMAGE",
|
||||
BBSMOVIE: "BBSMOVIE",
|
||||
} as const;
|
||||
|
||||
export type BoardType = (typeof BOARD_TYPE)[keyof typeof BOARD_TYPE];
|
||||
|
||||
export interface BoardPopupParams extends PageableParams {
|
||||
bbsNm?: string;
|
||||
}
|
||||
|
||||
export interface BoardPopup {
|
||||
bbsId: number;
|
||||
bbsTypeCd: BoardType;
|
||||
bbsTypeNm: string;
|
||||
bbsNm: string;
|
||||
bbsExpln: string;
|
||||
rfrncUseYn: string;
|
||||
atflUseYn: string;
|
||||
atflMaxCnt: number;
|
||||
atflMaxFileSz: number;
|
||||
ansUseYn: string;
|
||||
cmntUseYn: string;
|
||||
dgstfnEvlUseYn: string;
|
||||
smsUseYn: string;
|
||||
upndFixUseYn: string;
|
||||
pstgPrdUseYn: string;
|
||||
popupUseYn: string;
|
||||
delYn: string;
|
||||
regDt: string;
|
||||
pstCnt: number;
|
||||
}
|
||||
|
||||
export type BoardPopupList = PageableList<BoardPopup>;
|
||||
|
||||
export interface BoardService {
|
||||
getBoardPopupList: (params: BoardPopupParams) => Promise<BoardPopupList>;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { client } from "@common/components/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { MenuItem, MenuService } from "../model/menu-interface";
|
||||
|
||||
export class MenuApiService implements MenuService {
|
||||
async getMenuRoles(siteId: string): Promise<MenuItem[]> {
|
||||
const response = await client.get<MenuItem[]>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const MenuApi = new MenuApiService();
|
||||
@@ -1 +0,0 @@
|
||||
export { MenuWrapper } from "./lib/menu-wrapper";
|
||||
@@ -1,30 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ENDPOINT, SITE_ID } from "@/shared/config";
|
||||
import { useMenuStore } from "@/shared/lib";
|
||||
import { MenuApi } from "../api/menu-service";
|
||||
import { getCurrentMenu } from "./utils";
|
||||
|
||||
const MenuWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
const pathname = usePathname();
|
||||
const { data: menuRoles } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENU_ROLES],
|
||||
queryFn: () => MenuApi.getMenuRoles(SITE_ID),
|
||||
});
|
||||
const { setCurrentMenuInfo } = useMenuStore((state) => state);
|
||||
|
||||
useEffect(() => {
|
||||
if (!menuRoles) return;
|
||||
const currentMenu = getCurrentMenu(menuRoles, pathname ?? "");
|
||||
|
||||
if (!currentMenu) return;
|
||||
setCurrentMenuInfo(currentMenu);
|
||||
}, [menuRoles]);
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
export { MenuWrapper };
|
||||
@@ -1,14 +0,0 @@
|
||||
import type { MenuItem } from "../model/menu-interface";
|
||||
|
||||
export const getCurrentMenu = (
|
||||
menus: MenuItem[],
|
||||
pathname: string,
|
||||
): MenuItem | null => {
|
||||
for (const menu of menus) {
|
||||
if (menu.children) {
|
||||
return getCurrentMenu(menu.children, pathname);
|
||||
}
|
||||
if (menu.urlPath === pathname) return menu;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
export interface MenuItem {
|
||||
menuCd: number;
|
||||
menuKornNm: string;
|
||||
menuEngNm: string;
|
||||
parentId: number | null;
|
||||
sortSeq: number;
|
||||
iconNm?: string;
|
||||
children: MenuItem[] | null;
|
||||
levelNo: number;
|
||||
urlPath: string;
|
||||
menuLnkgTypeCd: string;
|
||||
menuLnkgSn: number;
|
||||
menuPath: string;
|
||||
qrcd: string;
|
||||
useYn: string;
|
||||
otptYn: string;
|
||||
newWndwYn: string;
|
||||
requiredUrlPath: boolean;
|
||||
}
|
||||
|
||||
export interface MenuService {
|
||||
getMenuRoles(siteId: string): Promise<MenuItem[]>;
|
||||
}
|
||||
@@ -4,13 +4,13 @@ import {
|
||||
siteFormSchema,
|
||||
type SiteService,
|
||||
type SiteList,
|
||||
type SiteDetail,
|
||||
type SiteParams,
|
||||
type ISiteDetail,
|
||||
type ISiteParams,
|
||||
type SiteFormData,
|
||||
} from "../model/site-interface";
|
||||
|
||||
export class SiteApiService implements SiteService {
|
||||
public async getSiteList(params: SiteParams): Promise<SiteList> {
|
||||
public async getSiteList(params: ISiteParams): Promise<SiteList> {
|
||||
const response = await client.get<SiteList>(
|
||||
`${ENDPOINT.CMS_SERVICE.SITES}`,
|
||||
{ params },
|
||||
@@ -18,8 +18,8 @@ export class SiteApiService implements SiteService {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async siteDetail(siteId: string): Promise<SiteDetail> {
|
||||
const response = await client.get<SiteDetail>(
|
||||
public async siteDetail(siteId: string): Promise<ISiteDetail> {
|
||||
const response = await client.get<ISiteDetail>(
|
||||
`${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`,
|
||||
);
|
||||
return response.data;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export { SiteApi } from "./api/site-service";
|
||||
export {
|
||||
siteFormSchema,
|
||||
type SiteParams,
|
||||
type Site,
|
||||
type ISiteParams,
|
||||
type ISite,
|
||||
type SiteFormData,
|
||||
} from "./model/site-interface";
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { z } from "zod";
|
||||
import type { PageableParams, PageableList } from "@/shared/model";
|
||||
import type { IPageableParams, PageableList } from "@/shared/model";
|
||||
|
||||
export interface SiteParams extends PageableParams {
|
||||
export interface ISiteParams extends IPageableParams {
|
||||
siteNm?: string;
|
||||
siteKndCd?: string;
|
||||
useYn?: string;
|
||||
}
|
||||
|
||||
export interface Site {
|
||||
export interface ISite {
|
||||
siteId: string;
|
||||
siteNm: string;
|
||||
siteKindCode: string;
|
||||
@@ -19,7 +19,7 @@ export interface Site {
|
||||
dmnAddr: string;
|
||||
}
|
||||
|
||||
export interface SiteDetail extends SiteFormData {
|
||||
export interface ISiteDetail extends SiteFormData {
|
||||
siteId: string;
|
||||
siteKindNm: string;
|
||||
basicSiteYn: string;
|
||||
@@ -49,11 +49,11 @@ export const siteFormSchema = z.object({
|
||||
});
|
||||
|
||||
export type SiteFormData = z.infer<typeof siteFormSchema>;
|
||||
export type SiteList = PageableList<Site>;
|
||||
export type SiteList = PageableList<ISite[]>;
|
||||
|
||||
export interface SiteService {
|
||||
getSiteList(params: SiteParams): Promise<SiteList>;
|
||||
siteDetail(siteId: string): Promise<SiteDetail>;
|
||||
getSiteList(params: ISiteParams): Promise<SiteList>;
|
||||
siteDetail(siteId: string): Promise<ISiteDetail>;
|
||||
modifySite(siteId: string, data: SiteFormData): Promise<void>;
|
||||
createSite(data: SiteFormData): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { ImagePage } from "./ui/image-page";
|
||||
@@ -1,80 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { Upload } from "tus-js-client";
|
||||
import { FileUploader } from "@common/components/ui";
|
||||
import { PageLayout } from "@/shared/ui/page-layout";
|
||||
import { AUTH_USER_ID, CLAIM_NAME, ENDPOINT } from "@/shared/config";
|
||||
import { getCookie } from "@/shared/lib";
|
||||
|
||||
function ImagePage() {
|
||||
const handleUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.item(0);
|
||||
if (!file) return;
|
||||
|
||||
//const p_atflCd = store.getState().upload.atflCd; // Redux 스토어에서 atflCd 가져오기
|
||||
|
||||
|
||||
const upload = new Upload(file, {
|
||||
endpoint: `${ENDPOINT.ATTACH_SERVICE.TUS_UPLOAD}`,
|
||||
chunkSize: 10 * 1024 * 1024, // 5MB chunk size
|
||||
headers: {
|
||||
[CLAIM_NAME]: getCookie(CLAIM_NAME) ?? "",
|
||||
[AUTH_USER_ID]: getCookie(AUTH_USER_ID) ?? "",
|
||||
},
|
||||
retryDelays: [0, 3000, 5000, 10000, 20000],
|
||||
metadata: {
|
||||
filename: file.name,
|
||||
filetype: file.type
|
||||
// atflCd: p_atflCd,
|
||||
},
|
||||
onError: function (error) {
|
||||
console.log("Failed because: " + error);
|
||||
},
|
||||
onProgress: function (bytesUploaded, bytesTotal) {
|
||||
const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
|
||||
console.log(bytesUploaded, bytesTotal, percentage + "%");
|
||||
},
|
||||
onSuccess: function () {
|
||||
console.log(
|
||||
"Download %s from %s",
|
||||
(upload.file as File).name,
|
||||
upload.url,
|
||||
);
|
||||
console.log("upload._req:", upload._req);
|
||||
|
||||
if(upload._req){
|
||||
const xhr = upload._req._xhr; // 업로드에 사용된 XMLHttpRequest 객체
|
||||
const xFileInfo = xhr.getResponseHeader('X-file-info'); // X-file-info 헤더 가져오기
|
||||
if (xFileInfo) {
|
||||
const fileInfo = JSON.parse(xFileInfo);
|
||||
console.log('fileInfo :', fileInfo);
|
||||
const downloadUrl = `${ENDPOINT.ATTACH_SERVICE.TUS_DOWNLOAD}/${fileInfo.atflId}`;
|
||||
console.log('Download URL:', downloadUrl);
|
||||
// store.dispatch(setAtflCd(fileInfo.atflCd)); // atflCd 저장
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
upload.findPreviousUploads().then(function (previousUploads) {
|
||||
if (previousUploads.length) {
|
||||
upload.resumeFromPreviousUpload(previousUploads[0]!);
|
||||
}
|
||||
upload.start();
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<div className="card card-border">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">이미지 목록</h3>
|
||||
</div>
|
||||
<FileUploader id="image-uploader" onUpload={handleUpload} />
|
||||
</div>
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export { ImagePage };
|
||||
@@ -1,80 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { Upload } from "tus-js-client";
|
||||
import { FileUploader } from "@common/components/ui";
|
||||
import { PageLayout } from "@/shared/ui/page-layout";
|
||||
import { AUTH_USER_ID, CLAIM_NAME, ENDPOINT } from "@/shared/config";
|
||||
import { getCookie } from "@/shared/lib";
|
||||
|
||||
function ImagePage() {
|
||||
const handleUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.item(0);
|
||||
if (!file) return;
|
||||
|
||||
//const p_atflCd = store.getState().upload.atflCd; // Redux 스토어에서 atflCd 가져오기
|
||||
|
||||
|
||||
const upload = new Upload(file, {
|
||||
endpoint: `${ENDPOINT.ATTACH_SERVICE.TUS_UPLOAD}`,
|
||||
chunkSize: 10 * 1024 * 1024, // 5MB chunk size
|
||||
headers: {
|
||||
[CLAIM_NAME]: getCookie(CLAIM_NAME) ?? "",
|
||||
[AUTH_USER_ID]: getCookie(AUTH_USER_ID) ?? "",
|
||||
},
|
||||
retryDelays: [0, 3000, 5000, 10000, 20000],
|
||||
metadata: {
|
||||
filename: file.name,
|
||||
filetype: file.type
|
||||
// atflCd: p_atflCd,
|
||||
},
|
||||
onError: function (error) {
|
||||
console.log("Failed because: " + error);
|
||||
},
|
||||
onProgress: function (bytesUploaded, bytesTotal) {
|
||||
const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
|
||||
console.log(bytesUploaded, bytesTotal, percentage + "%");
|
||||
},
|
||||
onSuccess: function () {
|
||||
console.log(
|
||||
"Download %s from %s",
|
||||
(upload.file as File).name,
|
||||
upload.url,
|
||||
);
|
||||
console.log("upload._req:", upload._req);
|
||||
|
||||
if(upload._req){
|
||||
const xhr = upload._req._xhr; // 업로드에 사용된 XMLHttpRequest 객체
|
||||
const xFileInfo = xhr.getResponseHeader('X-file-info'); // X-file-info 헤더 가져오기
|
||||
if (xFileInfo) {
|
||||
const fileInfo = JSON.parse(xFileInfo);
|
||||
console.log('fileInfo :', fileInfo);
|
||||
const downloadUrl = `${ENDPOINT.ATTACH_SERVICE.TUS_DOWNLOAD}/${fileInfo.atflId}`;
|
||||
console.log('Download URL:', downloadUrl);
|
||||
// store.dispatch(setAtflCd(fileInfo.atflCd)); // atflCd 저장
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
upload.findPreviousUploads().then(function (previousUploads) {
|
||||
if (previousUploads.length) {
|
||||
upload.resumeFromPreviousUpload(previousUploads[0]!);
|
||||
}
|
||||
upload.start();
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<div className="card card-border">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">이미지 목록</h3>
|
||||
</div>
|
||||
<FileUploader id="image-uploader" onUpload={handleUpload} />
|
||||
</div>
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export { ImagePage };
|
||||
@@ -1,19 +0,0 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
ContentService,
|
||||
ContentParams,
|
||||
ContentList,
|
||||
} from "../model/content-interface";
|
||||
|
||||
export class ContentApiService implements ContentService {
|
||||
public async getContentList(params: ContentParams): Promise<ContentList> {
|
||||
const response = await client.get<ContentList>(
|
||||
`${ENDPOINT.CMS_SERVICE.CONTENTS}`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const ContentApi = new ContentApiService();
|
||||
@@ -1,55 +1,16 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
Menu,
|
||||
MenuFormData,
|
||||
MenuService,
|
||||
TreeMenu,
|
||||
TreeNode,
|
||||
} from "../model/menu-interface";
|
||||
import type { Menu, MenuService, TreeMenu } from "../model/menu-interface";
|
||||
|
||||
export class MenuApiService implements MenuService {
|
||||
public async getMenuInfo(menuCd: number): Promise<Menu> {
|
||||
const response = await client.get<Menu>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENUS}/${menuCd}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async createMenu(data: MenuFormData): Promise<void> {
|
||||
const response = await client.post<void>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENUS}`,
|
||||
data,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async modifyMenu(
|
||||
menuCd: number,
|
||||
data: Omit<MenuFormData, "siteId">,
|
||||
): Promise<void> {
|
||||
const response = await client.put<void>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENUS}/${menuCd}`,
|
||||
data,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async deleteMenu(menuCd: number): Promise<void> {
|
||||
const response = await client.delete<void>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENUS}/${menuCd}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getTreeMenuList(siteId: string): Promise<TreeMenu[]> {
|
||||
const response = await client.get<TreeMenu[]>(
|
||||
public async getTreeMenuList(siteId: string): Promise<Menu[]> {
|
||||
const response = await client.get<Menu[]>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENUS}/${siteId}/tree`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async modifyTreeMenu(siteId: string, data: TreeNode[]): Promise<void> {
|
||||
public async modifyTreeMenu(siteId: string, data: TreeMenu[]): Promise<void> {
|
||||
const response = await client.put<void>(
|
||||
`${ENDPOINT.CMS_SERVICE.MENUS}/${siteId}/tree`,
|
||||
data,
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
Organization,
|
||||
OrganizationService,
|
||||
} from "../model/organization-interface";
|
||||
|
||||
export class OrganizationApiService implements OrganizationService {
|
||||
public async getOrganizationUserTreeList(): Promise<Organization[]> {
|
||||
const response = await client.get<Organization[]>(
|
||||
`${ENDPOINT.CMS_SERVICE.USER_OGNZ}/treeuser`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const OrganizationApi = new OrganizationApiService();
|
||||
@@ -1,12 +1,9 @@
|
||||
import type { DropOptions, NodeModel } from "@minoru/react-dnd-treeview";
|
||||
import type { TreeMenu, TreeNode } from "../model/menu-interface";
|
||||
import type { Organization, User } from "../model/organization-interface";
|
||||
import type { Menu, TreeMenu } from "../model/menu-interface";
|
||||
|
||||
export const generateMenuTreeData = (
|
||||
data: TreeMenu[],
|
||||
): NodeModel<TreeMenu>[] => {
|
||||
return data.reduce<NodeModel<TreeMenu>[]>((acc, menu) => {
|
||||
const node: NodeModel<TreeMenu> = {
|
||||
export const generateTreeData = (data: Menu[]): NodeModel<Menu>[] => {
|
||||
return data.reduce<NodeModel<Menu>[]>((acc, menu) => {
|
||||
const node: NodeModel<Menu> = {
|
||||
id: menu.menuCd ?? 0,
|
||||
parent: menu.parentId ?? 0,
|
||||
text: menu.menuKornNm,
|
||||
@@ -17,37 +14,31 @@ export const generateMenuTreeData = (
|
||||
acc.push(node);
|
||||
|
||||
if (menu.children?.length) {
|
||||
acc.push(...generateMenuTreeData(menu.children));
|
||||
acc.push(...generateTreeData(menu.children));
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
};
|
||||
|
||||
export const generateNewMenuTreeData = (
|
||||
treeData: NodeModel<TreeMenu>[],
|
||||
options: DropOptions<TreeMenu>,
|
||||
): TreeNode | null => {
|
||||
export const generateNewTreeData = (
|
||||
treeData: NodeModel<Menu>[],
|
||||
options: DropOptions<Menu>,
|
||||
): TreeMenu | null => {
|
||||
const { dragSourceId, dragSource, dropTargetId, dropTarget } = options;
|
||||
|
||||
if (!dragSource?.data) return null;
|
||||
|
||||
const siblings = treeData.filter((node) => node.parent === dropTargetId);
|
||||
|
||||
const dragSourceIndex = siblings.findIndex(
|
||||
(node) => node.id === dragSourceId,
|
||||
);
|
||||
|
||||
const prevSibling = siblings[dragSourceIndex - 1];
|
||||
|
||||
const newSortSeq =
|
||||
dragSourceIndex === 0 ? 1 : (prevSibling?.data?.sortSeq ?? 0) + 1;
|
||||
siblings.findIndex((sibling) => sibling.id === dragSourceId) + 1;
|
||||
|
||||
const childNodes = treeData.filter(
|
||||
(node) => node.parent === dragSourceId && node.data,
|
||||
);
|
||||
|
||||
const baseNode = (node: NodeModel<TreeMenu>): TreeNode => {
|
||||
const baseNode = (node: NodeModel<Menu>): TreeMenu => {
|
||||
if (!node.data) return {};
|
||||
return {
|
||||
menuCd: node.data?.menuCd,
|
||||
@@ -56,20 +47,20 @@ export const generateNewMenuTreeData = (
|
||||
};
|
||||
};
|
||||
|
||||
const treeNode: TreeNode = {
|
||||
const treeMenu: TreeMenu = {
|
||||
...baseNode(dragSource),
|
||||
parentId: dropTargetId === 0 ? null : (dropTargetId as number),
|
||||
sortSeq: newSortSeq,
|
||||
levelNo: (dropTarget?.data?.levelNo ?? 0) + 1,
|
||||
};
|
||||
|
||||
const result: TreeNode = {
|
||||
...treeNode,
|
||||
const result: TreeMenu = {
|
||||
...treeMenu,
|
||||
children: childNodes.map((child) => ({
|
||||
...baseNode(child),
|
||||
parentId: child.data?.parentId === 0 ? null : (dropTargetId as number),
|
||||
sortSeq: child.data?.sortSeq,
|
||||
levelNo: (treeNode?.levelNo ?? 0) + 1,
|
||||
levelNo: (treeMenu?.levelNo ?? 0) + 1,
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -77,22 +68,21 @@ export const generateNewMenuTreeData = (
|
||||
};
|
||||
|
||||
export const handleSelectNode =
|
||||
(callback: (node: NodeModel<TreeMenu>) => void) =>
|
||||
(node: NodeModel<TreeMenu>) => {
|
||||
(callback: (node: NodeModel<Menu>) => void) => (node: NodeModel<Menu>) => {
|
||||
callback(node);
|
||||
};
|
||||
|
||||
export const handleDropNode =
|
||||
(callback: (newTree: TreeNode) => void) =>
|
||||
(newTree: NodeModel<TreeMenu>[], options: DropOptions<TreeMenu>) => {
|
||||
const newTreeData = generateNewMenuTreeData(newTree, options);
|
||||
(callback: (newTree: TreeMenu) => void) =>
|
||||
(newTree: NodeModel<Menu>[], options: DropOptions<Menu>) => {
|
||||
const newTreeData = generateNewTreeData(newTree, options);
|
||||
if (!newTreeData) return;
|
||||
callback(newTreeData);
|
||||
};
|
||||
|
||||
export const handleNodeTextChange =
|
||||
(treeData: NodeModel<TreeMenu>[]) =>
|
||||
(callback: (newTree: NodeModel<TreeMenu>[]) => void) =>
|
||||
(treeData: NodeModel<Menu>[]) =>
|
||||
(callback: (newTree: NodeModel<Menu>[]) => void) =>
|
||||
(id: NodeModel["id"], value: string) => {
|
||||
const newTree = treeData.map((node) => {
|
||||
if (node.id === id) {
|
||||
@@ -106,60 +96,3 @@ export const handleNodeTextChange =
|
||||
});
|
||||
callback(newTree);
|
||||
};
|
||||
|
||||
export const generateOrganizationTreeData = (
|
||||
organizations: Organization[],
|
||||
): NodeModel<Organization | User>[] => {
|
||||
return organizations.reduce<NodeModel<Organization | User>[]>((acc, org) => {
|
||||
const orgNode: NodeModel<Organization> = {
|
||||
id: org.ognzId,
|
||||
parent: org.upOgnzId ?? 0,
|
||||
text: org.ognzNm,
|
||||
data: org,
|
||||
droppable: false,
|
||||
};
|
||||
|
||||
acc.push(orgNode);
|
||||
|
||||
if (org.children?.length) {
|
||||
acc.push(...generateOrganizationTreeData(org.children));
|
||||
}
|
||||
|
||||
if (org.users?.length) {
|
||||
acc.push(
|
||||
...org.users.map((user) => ({
|
||||
id: user.userUnqId,
|
||||
parent: org.ognzId,
|
||||
text: user.userNm,
|
||||
data: user,
|
||||
droppable: false,
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
};
|
||||
|
||||
export const filterOrganizationTreeDataByKeyword = (
|
||||
treeData: NodeModel<Organization | User>[],
|
||||
keyword: string,
|
||||
): NodeModel<Organization | User>[] => {
|
||||
return Array.from(
|
||||
treeData.reduce((matchedNodes, node) => {
|
||||
if (!node.text.includes(keyword)) return matchedNodes;
|
||||
|
||||
matchedNodes.add(node);
|
||||
|
||||
let parentId = node.parent;
|
||||
while (parentId) {
|
||||
const parentNode = treeData.find((n) => n.id === parentId);
|
||||
if (!parentNode) break;
|
||||
matchedNodes.add(parentNode);
|
||||
parentId = parentNode.parent;
|
||||
}
|
||||
|
||||
return matchedNodes;
|
||||
}, new Set<NodeModel<Organization | User>>()),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
import { Checkbox } from "@common/components/ui";
|
||||
import type { BoardPopup } from "@/entities/board";
|
||||
|
||||
const columnHelper = createColumnHelper<BoardPopup>();
|
||||
|
||||
const columns = [
|
||||
columnHelper.accessor((_, index) => index + 1, {
|
||||
id: "no",
|
||||
header: "NO",
|
||||
}),
|
||||
columnHelper.accessor("bbsNm", {
|
||||
id: "bbsNm",
|
||||
header: "게시판명",
|
||||
}),
|
||||
columnHelper.accessor("bbsTypeNm", {
|
||||
id: "bbsTypeNm",
|
||||
header: "게시판유형",
|
||||
}),
|
||||
columnHelper.accessor("regDt", {
|
||||
id: "regDt",
|
||||
header: "최초생성일",
|
||||
}),
|
||||
columnHelper.accessor("pstCnt", {
|
||||
id: "pstCnt",
|
||||
header: "게시물건수",
|
||||
}),
|
||||
columnHelper.display({
|
||||
id: "select",
|
||||
header: "선택",
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<Checkbox
|
||||
checked={row.getIsSelected()}
|
||||
onCheckedChange={row.getToggleSelectedHandler()}
|
||||
className="mx-4 flex justify-center"
|
||||
/>
|
||||
);
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export { columns };
|
||||
@@ -1,22 +0,0 @@
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
export interface ContentParams extends PageableParams {
|
||||
contsTtl?: string;
|
||||
aprvContsVer?: number;
|
||||
useYn?: string;
|
||||
}
|
||||
|
||||
export interface Content {
|
||||
contsSn: number;
|
||||
contsTtl: string;
|
||||
aprvContsVer: number;
|
||||
useYn: string;
|
||||
rgtr: string;
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
export type ContentList = PageableList<Content>;
|
||||
|
||||
export interface ContentService {
|
||||
getContentList(params: ContentParams): Promise<ContentList>;
|
||||
}
|
||||
@@ -11,28 +11,28 @@ export const MENU_TYPE = {
|
||||
|
||||
export type MenuType = (typeof MENU_TYPE)[keyof typeof MENU_TYPE];
|
||||
|
||||
export interface TreeNode {
|
||||
export interface TreeMenu {
|
||||
menuCd?: number;
|
||||
name?: string;
|
||||
sortSeq?: number;
|
||||
parentId?: number | null;
|
||||
levelNo?: number;
|
||||
icon?: string;
|
||||
children?: TreeNode[];
|
||||
children?: TreeMenu[];
|
||||
}
|
||||
|
||||
export interface TreeMenu extends Omit<TreeNode, "name" | "icon" | "children"> {
|
||||
export interface Menu extends Omit<TreeMenu, "name" | "icon" | "children"> {
|
||||
menuKornNm: string;
|
||||
menuEngNm?: string;
|
||||
iconNm?: string;
|
||||
children?: TreeMenu[];
|
||||
urlPath?: string;
|
||||
menuEngNm: string;
|
||||
iconNm: string;
|
||||
children: Menu[];
|
||||
urlPath: string;
|
||||
menuLnkgTypeCd: string;
|
||||
menuLnkgSn?: number;
|
||||
qrcd?: string;
|
||||
menuLnkgSn: number;
|
||||
qrcd: string;
|
||||
useYn: string;
|
||||
otptYn: string;
|
||||
requiredUrlPath?: boolean;
|
||||
requiredUrlPath: boolean;
|
||||
}
|
||||
|
||||
export const menuFormSchema = z.object({
|
||||
@@ -53,34 +53,18 @@ export const menuFormSchema = z.object({
|
||||
MENU_TYPE.BOTTOM,
|
||||
]),
|
||||
menuLnkgSn: z.number().nullish(),
|
||||
otptYn: z.string().default("Y"),
|
||||
otptYn: z.enum(["Y", "N"]).default("Y").nullish(),
|
||||
prntMenuCd: z.number().nullish(),
|
||||
sortSeq: z.number(),
|
||||
evlUseYn: z.string().default("Y"),
|
||||
evlUseYn: z.enum(["Y", "N"]).nullish(),
|
||||
qrcd: z.string().nullish(),
|
||||
useYn: z.string().default("Y"),
|
||||
newWndwYn: z.string().nullish(),
|
||||
menuLnkgSnNm: z.string().nullish(),
|
||||
menuPicUserUnqId: z.string().nullish(),
|
||||
menuPicUserUnqIdNm: z.string().nullish(),
|
||||
menuPicDsgnYmd: z.string().nullish(),
|
||||
useYn: z.enum(["Y", "N"]).default("Y").nullish(),
|
||||
});
|
||||
|
||||
export type MenuFormData = z.infer<typeof menuFormSchema>;
|
||||
export type Menu = Omit<MenuFormData, "iconNm"> & {
|
||||
menuCd: number;
|
||||
iconName?: string;
|
||||
};
|
||||
|
||||
export interface MenuService {
|
||||
getMenuInfo: (menuCd: number) => Promise<Menu>;
|
||||
createMenu: (data: MenuFormData) => Promise<void>;
|
||||
modifyMenu: (
|
||||
menuCd: number,
|
||||
data: Omit<MenuFormData, "siteId">,
|
||||
) => Promise<void>;
|
||||
deleteMenu: (menuCd: number) => Promise<void>;
|
||||
getTreeMenuList: (siteId: string) => Promise<TreeMenu[]>;
|
||||
modifyTreeMenu: (siteId: string, data: TreeNode[]) => Promise<void>;
|
||||
getTreeMenuList: (siteId: string) => Promise<Menu[]>;
|
||||
modifyTreeMenu: (siteId: string, data: TreeMenu[]) => Promise<void>;
|
||||
modifyMenuName: (menuCd: number, name: string) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
export interface User {
|
||||
userUnqId: string;
|
||||
userNm: string;
|
||||
jbpsSeCd: string;
|
||||
jbgdSeCd: string;
|
||||
}
|
||||
|
||||
export interface Organization {
|
||||
ognzId: string;
|
||||
upOgnzId: string;
|
||||
ognzNm: string;
|
||||
users: User[];
|
||||
children: Organization[];
|
||||
}
|
||||
|
||||
export interface OrganizationService {
|
||||
getOrganizationUserTreeList(): Promise<Organization[]>;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
import { Checkbox } from "@common/components/ui";
|
||||
import type { Content } from "../model/content-interface";
|
||||
|
||||
const columnHelper = createColumnHelper<Content>();
|
||||
|
||||
const columns = [
|
||||
columnHelper.accessor((_, index) => index + 1, {
|
||||
id: "no",
|
||||
header: "NO",
|
||||
}),
|
||||
columnHelper.accessor("contsTtl", {
|
||||
id: "contsTtl",
|
||||
header: "콘텐츠명",
|
||||
}),
|
||||
// TODO: 최종수정자, 최종수정일, 승인일시 추가
|
||||
columnHelper.display({
|
||||
id: "select",
|
||||
header: "선택",
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<Checkbox
|
||||
checked={row.getIsSelected()}
|
||||
onCheckedChange={row.getToggleSelectedHandler()}
|
||||
className="mx-4 flex justify-center"
|
||||
/>
|
||||
);
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export { columns };
|
||||
@@ -0,0 +1,130 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import {
|
||||
IconFinder,
|
||||
Input,
|
||||
Label,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
import {
|
||||
FormItem,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormMessage,
|
||||
} from "@/shared/ui/form";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
|
||||
export function BaseBottomMenuForm({
|
||||
form,
|
||||
}: {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
}) {
|
||||
const handleIconClick = (icon: string) => {
|
||||
form.setValue("iconNm", icon);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead>메뉴 서브명</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="menuSubKornNm"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
className="!text-[1.3rem]"
|
||||
placeholder="메뉴 서브명을 입력하십시오."
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>메뉴 아이콘</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="flex gap-2">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{form.watch("iconNm")}
|
||||
</div>
|
||||
<IconFinder handleClick={handleIconClick} />
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>출력 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="otptYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="otptY" />
|
||||
<Label htmlFor="otptY">출력</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="otptN" />
|
||||
<Label htmlFor="otptN">출력안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>사용 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="useYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="useY" />
|
||||
<Label htmlFor="useY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="useN" />
|
||||
<Label htmlFor="useN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -20,10 +20,10 @@ import { MENU_TYPE, type MenuFormData } from "../model/menu-interface";
|
||||
|
||||
interface BaseMenuFormProps {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
menuCd?: number;
|
||||
menuId?: number;
|
||||
}
|
||||
|
||||
function BaseMenuForm({ form, menuCd }: BaseMenuFormProps) {
|
||||
export function BaseMenuForm({ form, menuId }: BaseMenuFormProps) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
@@ -31,16 +31,14 @@ function BaseMenuForm({ form, menuCd }: BaseMenuFormProps) {
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
{menuCd && (
|
||||
<TableRow>
|
||||
<TableHead>메뉴ID</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{menuCd}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
<TableRow>
|
||||
<TableHead>메뉴ID</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{menuId}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>메뉴명</TableHead>
|
||||
<TableCell className="border">
|
||||
@@ -52,7 +50,6 @@ function BaseMenuForm({ form, menuCd }: BaseMenuFormProps) {
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
className="!text-[1.3rem]"
|
||||
placeholder="메뉴명을 입력하십시오."
|
||||
/>
|
||||
@@ -104,8 +101,11 @@ function BaseMenuForm({ form, menuCd }: BaseMenuFormProps) {
|
||||
key={key}
|
||||
className="flex items-center space-x-2"
|
||||
>
|
||||
<RadioGroupItem value={value} id={key} />
|
||||
<Label htmlFor={key}>
|
||||
<RadioGroupItem
|
||||
value={value}
|
||||
id={`menuType${key}`}
|
||||
/>
|
||||
<Label htmlFor={`menuType${key}`}>
|
||||
{key === "EMPTY" && "빈메뉴"}
|
||||
{key === "CONTENTS" && "콘텐츠"}
|
||||
{key === "BOARD" && "게시판"}
|
||||
@@ -128,5 +128,3 @@ function BaseMenuForm({ form, menuCd }: BaseMenuFormProps) {
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
|
||||
export { BaseMenuForm };
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import {
|
||||
Label,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
import {
|
||||
FormItem,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormMessage,
|
||||
} from "@/shared/ui/form";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { BaseBottomMenuForm } from "./base-bottom-menu-form";
|
||||
|
||||
export function BoardMenuForm({ form }: { form: UseFormReturn<MenuFormData> }) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableHead>게시판</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{form.watch("menuLnkgSn")}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>연결 형태</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="evlUseYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="self" id="self" />
|
||||
<Label htmlFor="self">현재창</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="blank" id="blank" />
|
||||
<Label htmlFor="blank">새창</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>메뉴 평가 사용 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="evlUseYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="evlUseY" />
|
||||
<Label htmlFor="evlUseY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="evlUseN" />
|
||||
<Label htmlFor="evlUseN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<BaseBottomMenuForm form={form} />
|
||||
|
||||
<TableRow>
|
||||
<TableHead>QR코드</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="qrcd"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="qrcdY" />
|
||||
<Label htmlFor="qrcdY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="qrcdN" />
|
||||
<Label htmlFor="qrcdN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>담당자</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{form.watch("menuLnkgSn")}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
type RowSelectionState,
|
||||
} from "@tanstack/react-table";
|
||||
import {
|
||||
Button,
|
||||
DataTable,
|
||||
Dialog,
|
||||
DialogTrigger,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Input,
|
||||
} from "@common/components/ui";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { BoardApi, type BoardPopup } from "@/entities/board";
|
||||
import { columns } from "../model/board-table-columns";
|
||||
|
||||
type BoardSearchDialogProps = {
|
||||
handleBoardSelect: (board: BoardPopup) => void;
|
||||
} & React.ComponentProps<typeof Dialog>;
|
||||
|
||||
function BoardSearchDialog({
|
||||
handleBoardSelect,
|
||||
...props
|
||||
}: BoardSearchDialogProps) {
|
||||
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
||||
const [bbsNm, setBbsNm] = useState("");
|
||||
|
||||
const { data: boardList, refetch } = useQuery({
|
||||
queryKey: [ENDPOINT.BOARD_SERVICE.BBS],
|
||||
queryFn: () => BoardApi.getBoardPopupList({ bbsNm }),
|
||||
enabled: false,
|
||||
});
|
||||
|
||||
const table = useReactTable({
|
||||
data: boardList?.content ?? [],
|
||||
columns,
|
||||
state: {
|
||||
rowSelection,
|
||||
},
|
||||
enableMultiRowSelection: false,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
onRowSelectionChange: setRowSelection,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const boardData = table.getSelectedRowModel().rows[0]
|
||||
?.original as BoardPopup;
|
||||
if (!boardData) return;
|
||||
handleBoardSelect(boardData);
|
||||
}, [table.getSelectedRowModel().rows]);
|
||||
|
||||
useEffect(() => {
|
||||
refetch();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Dialog {...props}>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="gap-3">
|
||||
<i className="diveicon di-search" />
|
||||
조회
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>게시판 조회</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="card card-border !m-0 flex w-full items-center gap-2">
|
||||
<Input
|
||||
placeholder="검색어를 입력하세요."
|
||||
className="!text-[1.3rem]"
|
||||
value={bbsNm}
|
||||
onChange={(e) => setBbsNm(e.target.value)}
|
||||
/>
|
||||
<Button onClick={() => refetch()}>
|
||||
<i className="diveicon di-search" />
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
<div className="h-[40rem] w-full overflow-y-auto">
|
||||
<DataTable table={table} />
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { BoardSearchDialog };
|
||||
@@ -0,0 +1,22 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import { Table, TableBody } from "@common/components";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { BaseBottomMenuForm } from "./base-bottom-menu-form";
|
||||
|
||||
export function BottomMenuForm({
|
||||
form,
|
||||
}: {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
}) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
<BaseBottomMenuForm form={form} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import {
|
||||
Label,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
import {
|
||||
FormItem,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormMessage,
|
||||
} from "@/shared/ui/form";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { BaseBottomMenuForm } from "./base-bottom-menu-form";
|
||||
|
||||
export function ContentMenuForm({
|
||||
form,
|
||||
}: {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
}) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableHead>콘텐츠</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{form.watch("menuLnkgSn")}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>연결 형태</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="evlUseYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="self" id="self" />
|
||||
<Label htmlFor="self">현재창</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="blank" id="blank" />
|
||||
<Label htmlFor="blank">새창</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>메뉴 평가 사용 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="evlUseYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="evlUseY" />
|
||||
<Label htmlFor="evlUseY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="evlUseN" />
|
||||
<Label htmlFor="evlUseN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<BaseBottomMenuForm form={form} />
|
||||
|
||||
<TableRow>
|
||||
<TableHead>QR코드</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="qrcd"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="qrcdY" />
|
||||
<Label htmlFor="qrcdY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="qrcdN" />
|
||||
<Label htmlFor="qrcdN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>담당자</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{form.watch("menuLnkgSn")}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
type RowSelectionState,
|
||||
} from "@tanstack/react-table";
|
||||
import {
|
||||
Button,
|
||||
DataTable,
|
||||
Dialog,
|
||||
DialogTrigger,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Input,
|
||||
} from "@common/components/ui";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { ContentApi } from "../api/content-service";
|
||||
import type { Content } from "../model/content-interface";
|
||||
import { columns } from "../model/table-colums";
|
||||
|
||||
type ContentSearchDialogProps = {
|
||||
handleContentSelect: (content: Content) => void;
|
||||
} & React.ComponentProps<typeof Dialog>;
|
||||
|
||||
function ContentSearchDialog({
|
||||
handleContentSelect,
|
||||
...props
|
||||
}: ContentSearchDialogProps) {
|
||||
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
||||
const [contsTtl, setContsTtl] = useState("");
|
||||
|
||||
const { data: contentList, refetch } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS],
|
||||
queryFn: () =>
|
||||
ContentApi.getContentList({ contsTtl, useYn: "Y", page: 0, size: 100 }),
|
||||
enabled: false,
|
||||
});
|
||||
|
||||
const table = useReactTable({
|
||||
data: contentList?.content ?? [],
|
||||
columns,
|
||||
state: {
|
||||
rowSelection,
|
||||
},
|
||||
enableMultiRowSelection: false,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
onRowSelectionChange: setRowSelection,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const contentData = table.getSelectedRowModel().rows[0]
|
||||
?.original as Content;
|
||||
if (!contentData) return;
|
||||
handleContentSelect(contentData);
|
||||
}, [table.getSelectedRowModel().rows]);
|
||||
|
||||
useEffect(() => {
|
||||
refetch();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Dialog {...props}>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="gap-3">
|
||||
<i className="diveicon di-search" />
|
||||
조회
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>콘텐츠 조회</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="card card-border !m-0 flex w-full items-center gap-2">
|
||||
<Input
|
||||
placeholder="검색어를 입력하세요."
|
||||
className="!text-[1.3rem]"
|
||||
value={contsTtl}
|
||||
onChange={(e) => setContsTtl(e.target.value)}
|
||||
/>
|
||||
<Button onClick={() => refetch()}>
|
||||
<i className="diveicon di-search" />
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
<div className="h-[40rem] w-full overflow-y-auto">
|
||||
<DataTable table={table} />
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { ContentSearchDialog };
|
||||
@@ -1,44 +0,0 @@
|
||||
import type { ComponentProps } from "react";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
|
||||
type EditableNodeProps = {
|
||||
depth?: number;
|
||||
onSave: () => void;
|
||||
onCancel: () => void;
|
||||
} & ComponentProps<typeof Input>;
|
||||
|
||||
function EditableNode({
|
||||
depth,
|
||||
onSave,
|
||||
onCancel,
|
||||
...props
|
||||
}: EditableNodeProps) {
|
||||
return (
|
||||
<div
|
||||
className="flex items-center gap-2 rounded-sm bg-accent p-2"
|
||||
style={{ marginInlineStart: !depth ? 0 : depth * 5 + 5 }}
|
||||
>
|
||||
<Input {...props} className="h-[2.5rem] !text-[1.3rem] text-foreground" />
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-8 !bg-transparent"
|
||||
onClick={onSave}
|
||||
>
|
||||
<i className="diveicon di-check text-2xl" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-8 !bg-transparent"
|
||||
onClick={onCancel}
|
||||
>
|
||||
<i className="diveicon di-x" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { EditableNode };
|
||||
@@ -0,0 +1,18 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import { Table, TableBody } from "@common/components";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { BaseBottomMenuForm } from "./base-bottom-menu-form";
|
||||
|
||||
export function EmptyMenuForm({ form }: { form: UseFormReturn<MenuFormData> }) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
<BaseBottomMenuForm form={form} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import { Table, TableBody } from "@common/components";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { BaseBottomMenuForm } from "./base-bottom-menu-form";
|
||||
|
||||
export function InsideMenuForm({
|
||||
form,
|
||||
}: {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
}) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
<BaseBottomMenuForm form={form} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
@@ -1,80 +1,58 @@
|
||||
import { useState } from "react";
|
||||
import type { UseFormReturn } from "react-hook-form";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import { Button } from "@common/components";
|
||||
import { Form } from "@/shared/ui/form";
|
||||
import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { MENU_TYPE, type MenuFormData } from "../model/menu-interface";
|
||||
import { BaseMenuForm } from "./base-menu-form";
|
||||
import { TypeMenuForm } from "./type-menu-form";
|
||||
import { PermissionsManagementDialog } from "./permissions-management-dialog";
|
||||
import { EmptyMenuForm } from "./empty-menu-form";
|
||||
import { ContentMenuForm } from "./content-menu-form";
|
||||
import { BoardMenuForm } from "./board-menu-form";
|
||||
import { InsideMenuForm } from "./inside-menu-form";
|
||||
import { OutsideMenuForm } from "./outside-menu-form";
|
||||
import { BottomMenuForm } from "./bottom-menu-form";
|
||||
|
||||
interface MenuFormProps {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
menuCd?: number;
|
||||
handleCreate: (data: MenuFormData) => void;
|
||||
handleModify: ({
|
||||
menuCd,
|
||||
data,
|
||||
}: {
|
||||
menuCd: number;
|
||||
data: Omit<MenuFormData, "siteId">;
|
||||
}) => void;
|
||||
handleDelete?: (menuCd: number) => void;
|
||||
menuId?: number;
|
||||
handleSave: (data: MenuFormData) => Promise<void>;
|
||||
handleDelete?: () => Promise<void>;
|
||||
}
|
||||
|
||||
function MenuForm({
|
||||
export function MenuForm({
|
||||
form,
|
||||
menuCd,
|
||||
handleCreate,
|
||||
handleModify,
|
||||
menuId,
|
||||
handleSave,
|
||||
handleDelete,
|
||||
}: MenuFormProps) {
|
||||
const isModifyMode = !!menuCd;
|
||||
|
||||
const isModifyMode = !!menuId;
|
||||
const { confirm } = useConfirm();
|
||||
const [onConfirm, setOnConfirm] = useState(false);
|
||||
|
||||
const handleConfirm = async (fn: () => Promise<void>) => {
|
||||
const onSubmit = async (data: MenuFormData) => {
|
||||
const confirmMessage = isModifyMode
|
||||
? "수정하시겠습니까?"
|
||||
: "저장하시겠습니까?";
|
||||
|
||||
setOnConfirm(true);
|
||||
await fn();
|
||||
if (await confirm(confirmMessage)) {
|
||||
setOnConfirm(false);
|
||||
handleSave(data);
|
||||
}
|
||||
setOnConfirm(false);
|
||||
};
|
||||
|
||||
const onSubmit = async (data: MenuFormData) => {
|
||||
if (isModifyMode) {
|
||||
await onModify(data);
|
||||
} else {
|
||||
await onCreate(data);
|
||||
const onDelete = async () => {
|
||||
setOnConfirm(true);
|
||||
if (await confirm("삭제하시겠습니까?")) {
|
||||
setOnConfirm(false);
|
||||
handleDelete?.();
|
||||
}
|
||||
};
|
||||
|
||||
const onCreate = async (data: MenuFormData) => {
|
||||
await handleConfirm(async () => {
|
||||
if (await confirm("저장하시겠습니까?")) {
|
||||
handleCreate(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const onModify = async (data: MenuFormData) => {
|
||||
await handleConfirm(async () => {
|
||||
if (await confirm("수정하시겠습니까?")) {
|
||||
handleModify({ menuCd: menuCd!, data });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const onDelete = () => {
|
||||
handleConfirm(async () => {
|
||||
if (await confirm("삭제하시겠습니까?")) {
|
||||
handleDelete?.(menuCd!);
|
||||
}
|
||||
});
|
||||
setOnConfirm(false);
|
||||
};
|
||||
|
||||
const menuType = form.watch("menuLnkgTypeCd");
|
||||
const isSubmitDisabled = !form.watch("siteId");
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -83,17 +61,18 @@ function MenuForm({
|
||||
<div className="card card-border">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{isModifyMode ? "메뉴 수정" : "메뉴 등록"}
|
||||
메뉴 등록/수정
|
||||
</h3>
|
||||
<PermissionsManagementDialog menuCd={menuCd} />
|
||||
</div>
|
||||
<div className="card">
|
||||
<BaseMenuForm form={form} menuCd={menuCd} />
|
||||
<TypeMenuForm form={form} menuType={menuType} />
|
||||
<BaseMenuForm form={form} menuId={menuId} />
|
||||
<div className="-mt-[0.1rem]">
|
||||
{renderMenuTypeComponent(menuType, form)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-center gap-4 pb-12 pt-10">
|
||||
<Button size="lg" type="submit" disabled={isSubmitDisabled}>
|
||||
<Button size="lg" type="submit">
|
||||
저장
|
||||
</Button>
|
||||
{isModifyMode && (
|
||||
@@ -109,4 +88,24 @@ function MenuForm({
|
||||
);
|
||||
}
|
||||
|
||||
export { MenuForm };
|
||||
function renderMenuTypeComponent(
|
||||
menuType: string,
|
||||
form: UseFormReturn<MenuFormData>,
|
||||
) {
|
||||
switch (menuType) {
|
||||
case MENU_TYPE.EMPTY:
|
||||
return <EmptyMenuForm form={form} />;
|
||||
case MENU_TYPE.CONTENTS:
|
||||
return <ContentMenuForm form={form} />;
|
||||
case MENU_TYPE.BOARD:
|
||||
return <BoardMenuForm form={form} />;
|
||||
case MENU_TYPE.INSIDE:
|
||||
return <InsideMenuForm form={form} />;
|
||||
case MENU_TYPE.OUTSIDE:
|
||||
return <OutsideMenuForm form={form} />;
|
||||
case MENU_TYPE.BOTTOM:
|
||||
return <BottomMenuForm form={form} />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import type { NodeModel, TreeMethods } from "@minoru/react-dnd-treeview";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useState } from "react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import type { NodeModel } from "@minoru/react-dnd-treeview";
|
||||
import { cn } from "@common/components/lib";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import type { Menu } from "../model/menu-interface";
|
||||
import { MenuApi } from "../api/menu-service";
|
||||
import type { TreeMenu } from "../model/menu-interface";
|
||||
import { EditableNode } from "./editable-node";
|
||||
|
||||
type MenuNodeProps = {
|
||||
node: NodeModel<TreeMenu>;
|
||||
node: NodeModel<Menu>;
|
||||
depth: number;
|
||||
isOpen: boolean;
|
||||
isSelected: boolean;
|
||||
isAdditionalParent: boolean;
|
||||
treeMethods: TreeMethods | null;
|
||||
onToggle: (id: NodeModel["id"]) => void;
|
||||
onSelect: (node: NodeModel<TreeMenu>) => void;
|
||||
onSelect: (node: NodeModel<Menu>) => void;
|
||||
};
|
||||
|
||||
function MenuNode({
|
||||
@@ -24,26 +20,17 @@ function MenuNode({
|
||||
depth,
|
||||
isOpen,
|
||||
isSelected,
|
||||
isAdditionalParent,
|
||||
treeMethods,
|
||||
onToggle,
|
||||
onSelect,
|
||||
}: MenuNodeProps) {
|
||||
const { id, text, data } = node;
|
||||
const indent = depth * 10 + 5;
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const { mutateAsync: modifyMenuName } = useMutation({
|
||||
mutationFn: (nodeName: string) => {
|
||||
const encodedName = encodeURIComponent(nodeName);
|
||||
return MenuApi.modifyMenuName(id as number, encodedName);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENUS],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const [editMode, setEditMode] = useState(false);
|
||||
@@ -57,15 +44,6 @@ function MenuNode({
|
||||
setEditMode(false);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
setEditMode(false);
|
||||
setNodeName(text);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (isAdditionalParent) treeMethods?.open(id);
|
||||
}, [isAdditionalParent]);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{ paddingInlineStart: indent }}
|
||||
@@ -73,40 +51,63 @@ function MenuNode({
|
||||
"group flex cursor-pointer items-center justify-between gap-2 rounded-sm p-2 hover:bg-accent",
|
||||
isSelected && "!bg-[rgba(32,148,250,0.2)]",
|
||||
)}
|
||||
onClick={handleSelect}
|
||||
>
|
||||
{editMode ? (
|
||||
<EditableNode
|
||||
value={nodeName}
|
||||
onChange={(e) => setNodeName(e.target.value)}
|
||||
onSave={handleSave}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<div className="flex items-center" onClick={handleSelect}>
|
||||
<div className="flex items-center">
|
||||
{editMode ? (
|
||||
<>
|
||||
<Input
|
||||
value={nodeName}
|
||||
onChange={(e) => setNodeName(e.target.value)}
|
||||
className="h-[2.5rem] !text-[1.3rem] text-foreground"
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{data?.children?.length && (
|
||||
<i
|
||||
className={cn(
|
||||
"diveicon di-arrow-forward mr-2 text-base text-label",
|
||||
isOpen && "rotate-90",
|
||||
)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleToggle();
|
||||
}}
|
||||
onClick={handleToggle}
|
||||
/>
|
||||
)}
|
||||
<span className="text-[1.4rem] font-medium text-label">{text}</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{editMode ? (
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="invisible !bg-transparent group-hover:visible"
|
||||
onClick={() => setEditMode(true)}
|
||||
className="size-8 !bg-transparent"
|
||||
onClick={handleSave}
|
||||
>
|
||||
<i className="diveicon di-pencil" />
|
||||
<i className="diveicon di-check text-2xl" />
|
||||
</Button>
|
||||
</>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-8 !bg-transparent"
|
||||
onClick={() => {
|
||||
setEditMode(false);
|
||||
setNodeName(text);
|
||||
}}
|
||||
>
|
||||
<i className="diveicon di-x" />
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="invisible !bg-transparent group-hover:visible"
|
||||
onClick={() => setEditMode(true)}
|
||||
>
|
||||
<i className="diveicon di-pencil" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import type { NodeModel } from "@minoru/react-dnd-treeview";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
Button,
|
||||
Select,
|
||||
@@ -17,9 +15,6 @@ import {
|
||||
import { SiteApi } from "@/entities/site";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { PageLayout } from "@/shared/ui/page-layout";
|
||||
import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
import type { TreeMenu } from "../model/menu-interface";
|
||||
import { MenuApi } from "../api/menu-service";
|
||||
import {
|
||||
MENU_TYPE,
|
||||
@@ -28,36 +23,15 @@ import {
|
||||
} from "../model/menu-interface";
|
||||
import { MenuTree } from "./menu-tree";
|
||||
import { MenuForm } from "./menu-form";
|
||||
import { generateMenuTreeData } from "../lib/utils";
|
||||
import { generateTreeData } from "../lib/utils";
|
||||
|
||||
function MenuPage() {
|
||||
const queryClient = useQueryClient();
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const { confirm } = useConfirm();
|
||||
|
||||
const [siteId, setSiteId] = useState("");
|
||||
const [onConfirm, setOnConfirm] = useState(false);
|
||||
const [selectedMenu, setSelectedMenu] = useState<TreeMenu | null>(null);
|
||||
const [additionalNode, setAdditionalNode] =
|
||||
useState<NodeModel<TreeMenu> | null>(null);
|
||||
|
||||
const { data: menuInfo } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, selectedMenu?.menuCd],
|
||||
queryFn: () => MenuApi.getMenuInfo(selectedMenu?.menuCd ?? 0),
|
||||
enabled: !!selectedMenu?.menuCd,
|
||||
});
|
||||
|
||||
const { data: treeData } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, siteId],
|
||||
queryFn: () => MenuApi.getTreeMenuList(siteId),
|
||||
select: (data) => {
|
||||
const treeData = generateMenuTreeData(data);
|
||||
const defaultSortSeq =
|
||||
treeData.filter((node) => node.data?.levelNo === 1).length + 1;
|
||||
form.setValue("sortSeq", defaultSortSeq);
|
||||
|
||||
return treeData;
|
||||
},
|
||||
select: (data) => generateTreeData(data),
|
||||
enabled: !!siteId,
|
||||
});
|
||||
|
||||
@@ -71,195 +45,60 @@ function MenuPage() {
|
||||
})),
|
||||
});
|
||||
|
||||
const { mutateAsync: createMenu } = useMutation({
|
||||
mutationFn: (data: MenuFormData) => MenuApi.createMenu(data),
|
||||
onSuccess: () => {
|
||||
alert("저장되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, siteId],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: modifyMenu } = useMutation({
|
||||
mutationFn: ({
|
||||
menuCd,
|
||||
data,
|
||||
}: {
|
||||
menuCd: number;
|
||||
data: Omit<MenuFormData, "siteId">;
|
||||
}) => MenuApi.modifyMenu(menuCd, data),
|
||||
onSuccess: () => {
|
||||
alert("수정되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, siteId],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: deleteMenu } = useMutation({
|
||||
mutationFn: (menuCd: number) => MenuApi.deleteMenu(menuCd),
|
||||
onSuccess: () => {
|
||||
alert("삭제되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, siteId],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const form = useForm<MenuFormData>({
|
||||
resolver: zodResolver(menuFormSchema),
|
||||
defaultValues: {
|
||||
menuLnkgTypeCd: MENU_TYPE.EMPTY,
|
||||
},
|
||||
values: {
|
||||
...menuInfo,
|
||||
siteId,
|
||||
levelNo: menuInfo?.levelNo ?? 1,
|
||||
sortSeq: menuInfo?.sortSeq ?? 1,
|
||||
menuKornNm: menuInfo?.menuKornNm ?? "",
|
||||
menuLnkgTypeCd: menuInfo?.menuLnkgTypeCd ?? MENU_TYPE.EMPTY,
|
||||
iconNm: menuInfo?.iconName,
|
||||
otptYn: menuInfo?.otptYn ?? "Y",
|
||||
evlUseYn: menuInfo?.evlUseYn ?? "Y",
|
||||
useYn: menuInfo?.useYn ?? "Y",
|
||||
},
|
||||
});
|
||||
|
||||
const additionalNodeForm = useForm<MenuFormData>({
|
||||
resolver: zodResolver(menuFormSchema),
|
||||
defaultValues: {
|
||||
menuLnkgTypeCd: MENU_TYPE.EMPTY,
|
||||
levelNo: 1,
|
||||
sortSeq: 1,
|
||||
otptYn: "Y",
|
||||
evlUseYn: "Y",
|
||||
useYn: "Y",
|
||||
},
|
||||
});
|
||||
|
||||
const handleAdditionalNodeSave = async () => {
|
||||
const prntMenuCd = !additionalNode?.parent
|
||||
? null
|
||||
: (additionalNode?.parent as number);
|
||||
|
||||
await createMenu({
|
||||
...additionalNodeForm.getValues(),
|
||||
prntMenuCd,
|
||||
});
|
||||
resetAdditionalNode();
|
||||
const handleSave = async (data: MenuFormData) => {
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
const resetAdditionalNode = () => {
|
||||
additionalNodeForm.setValue("menuKornNm", "");
|
||||
setAdditionalNode(null);
|
||||
};
|
||||
|
||||
const handleSiteIdChange = (value: string) => {
|
||||
form.setValue("siteId", value);
|
||||
additionalNodeForm.setValue("siteId", value);
|
||||
|
||||
setSiteId(value);
|
||||
setSelectedMenu(null);
|
||||
};
|
||||
|
||||
const handleNodeSelect = (node: NodeModel<TreeMenu>) => {
|
||||
if (!node.data) return;
|
||||
if (node.data.menuCd === selectedMenu?.menuCd) {
|
||||
setSelectedMenu(null);
|
||||
additionalNodeForm.setValue("levelNo", 1);
|
||||
return;
|
||||
}
|
||||
setSelectedMenu(node.data);
|
||||
additionalNodeForm.setValue("levelNo", (node.data.levelNo ?? 0) + 1);
|
||||
};
|
||||
|
||||
const handleNodeDelete = async () => {
|
||||
setOnConfirm(true);
|
||||
if (await confirm("삭제하시겠습니까?")) {
|
||||
setOnConfirm(false);
|
||||
deleteMenu(selectedMenu!.menuCd!);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAddMenu = () => {
|
||||
if (additionalNode) return;
|
||||
setAdditionalNode({
|
||||
id: -1,
|
||||
parent: selectedMenu?.menuCd ?? 0,
|
||||
text: "",
|
||||
});
|
||||
};
|
||||
|
||||
const tree = additionalNode
|
||||
? [...(additionalNode ? [additionalNode] : []), ...(treeData ?? [])]
|
||||
: (treeData ?? []);
|
||||
const handleDelete = async () => {};
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageLayout>
|
||||
<div className="card !mb-0 flex !min-h-[calc(100vh-16.8rem)] gap-2">
|
||||
<div className="card card-border w-[24rem]">
|
||||
<Select value={siteId} onValueChange={handleSiteIdChange}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="선택하세요" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{options?.map((option) => (
|
||||
<SelectItem key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{siteId && (
|
||||
<>
|
||||
<div className="my-4 flex gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
color="primary"
|
||||
className="flex-1"
|
||||
onClick={handleAddMenu}
|
||||
>
|
||||
메뉴 추가
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
color="red"
|
||||
className="flex-1"
|
||||
onClick={handleNodeDelete}
|
||||
disabled={!selectedMenu}
|
||||
>
|
||||
메뉴 삭제
|
||||
</Button>
|
||||
</div>
|
||||
<div className="card card-border !mx-0">
|
||||
<MenuTree
|
||||
tree={tree}
|
||||
siteId={siteId}
|
||||
selectedMenu={selectedMenu}
|
||||
additionalNodeForm={additionalNodeForm}
|
||||
onSelectNode={handleNodeSelect}
|
||||
onAdditionalNodeSave={handleAdditionalNodeSave}
|
||||
onAdditionalNodeCancel={resetAdditionalNode}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="card card-border flex-1">
|
||||
<MenuForm
|
||||
form={form}
|
||||
menuCd={selectedMenu?.menuCd}
|
||||
handleCreate={createMenu}
|
||||
handleModify={modifyMenu}
|
||||
handleDelete={deleteMenu}
|
||||
/>
|
||||
</div>
|
||||
<PageLayout pageTitle="메뉴 관리">
|
||||
<div className="card flex gap-2">
|
||||
<div className="card card-border w-[24rem]">
|
||||
<Select value={siteId} onValueChange={setSiteId}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="선택하세요" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{options?.map((option) => (
|
||||
<SelectItem key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{treeData && (
|
||||
<>
|
||||
<div className="my-4 flex gap-2">
|
||||
<Button size="sm" color="primary" className="flex-1">
|
||||
메뉴 추가
|
||||
</Button>
|
||||
<Button size="sm" color="red" className="flex-1">
|
||||
메뉴 삭제
|
||||
</Button>
|
||||
</div>
|
||||
<div className="card card-border !mx-0">
|
||||
<MenuTree treeData={treeData ?? []} siteId={siteId} />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</PageLayout>
|
||||
<ConfirmDialog open={onConfirm} />
|
||||
</>
|
||||
<div className="card card-border flex-1">
|
||||
<MenuForm
|
||||
form={form}
|
||||
handleSave={handleSave}
|
||||
handleDelete={handleDelete}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,48 +1,30 @@
|
||||
"use client";
|
||||
|
||||
import { useRef } from "react";
|
||||
import { useState } from "react";
|
||||
import { DndProvider } from "react-dnd";
|
||||
import type { UseFormReturn } from "react-hook-form";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
Tree,
|
||||
MultiBackend,
|
||||
getBackendOptions,
|
||||
type NodeModel,
|
||||
type TreeMethods,
|
||||
} from "@minoru/react-dnd-treeview";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { MenuApi } from "../api/menu-service";
|
||||
import type { MenuFormData, TreeMenu, TreeNode } from "../model/menu-interface";
|
||||
import type { Menu, TreeMenu } from "../model/menu-interface";
|
||||
import { handleDropNode, handleSelectNode } from "../lib/utils";
|
||||
import { MenuNode } from "./menu-node";
|
||||
import { EditableNode } from "./editable-node";
|
||||
|
||||
type MenuTreeProps = {
|
||||
tree: NodeModel<TreeMenu>[];
|
||||
treeData: NodeModel<Menu>[];
|
||||
siteId: string;
|
||||
selectedMenu: TreeMenu | null;
|
||||
additionalNodeForm: UseFormReturn<MenuFormData>;
|
||||
onSelectNode: (node: NodeModel<TreeMenu>) => void;
|
||||
onAdditionalNodeSave: () => void;
|
||||
onAdditionalNodeCancel: () => void;
|
||||
};
|
||||
|
||||
function MenuTree({
|
||||
tree,
|
||||
siteId,
|
||||
selectedMenu,
|
||||
additionalNodeForm,
|
||||
onSelectNode,
|
||||
onAdditionalNodeSave,
|
||||
onAdditionalNodeCancel,
|
||||
}: MenuTreeProps) {
|
||||
function MenuTree({ treeData, siteId }: MenuTreeProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const treeMethods = useRef<TreeMethods>(null);
|
||||
|
||||
const { mutate: modifyTreeMenu } = useMutation({
|
||||
mutationFn: (newTree: TreeNode) =>
|
||||
mutationFn: (newTree: TreeMenu) =>
|
||||
MenuApi.modifyTreeMenu(siteId, [newTree]),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
@@ -51,100 +33,50 @@ function MenuTree({
|
||||
},
|
||||
});
|
||||
|
||||
const additionalNode = tree.find((n) => n.id === -1);
|
||||
|
||||
const isAdditionalParent = (node: NodeModel<TreeMenu>): boolean => {
|
||||
if (!additionalNode) return false;
|
||||
return additionalNode?.parent === node.id;
|
||||
};
|
||||
const [selectedNode, setSelectedNode] = useState<NodeModel<Menu> | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="max-h-[calc(100vh-33.5rem)] overflow-auto">
|
||||
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
|
||||
<Tree
|
||||
tree={tree}
|
||||
rootId={0}
|
||||
ref={treeMethods}
|
||||
render={(
|
||||
node: NodeModel<TreeMenu>,
|
||||
{ depth, isOpen, onToggle },
|
||||
) => {
|
||||
if (node.id === -1) {
|
||||
return (
|
||||
<EditableNode
|
||||
value={additionalNodeForm.watch("menuKornNm") ?? ""}
|
||||
onChange={(e) =>
|
||||
additionalNodeForm.setValue("menuKornNm", e.target.value)
|
||||
}
|
||||
depth={depth}
|
||||
onSave={onAdditionalNodeSave}
|
||||
onCancel={onAdditionalNodeCancel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<MenuNode
|
||||
node={node}
|
||||
depth={depth}
|
||||
treeMethods={treeMethods.current}
|
||||
isOpen={isOpen}
|
||||
isSelected={selectedMenu?.menuCd === node.id}
|
||||
isAdditionalParent={isAdditionalParent(node)}
|
||||
onToggle={onToggle}
|
||||
onSelect={handleSelectNode(onSelectNode)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
onDrop={handleDropNode(modifyTreeMenu)}
|
||||
classes={{
|
||||
root: "p-4",
|
||||
container: "flex flex-col",
|
||||
dropTarget: "!bg-[rgba(32,148,250,0.5)] rounded-sm",
|
||||
placeholder: "relative",
|
||||
}}
|
||||
sort={false}
|
||||
dropTargetOffset={5}
|
||||
insertDroppableFirst={false}
|
||||
canDrop={(_, { dragSource, dropTargetId }) => {
|
||||
if (dragSource?.parent === dropTargetId) {
|
||||
return true;
|
||||
}
|
||||
}}
|
||||
placeholderRender={(_, { depth }) => {
|
||||
return (
|
||||
<div
|
||||
className="absolute right-0 top-0 h-[0.2rem] bg-primary"
|
||||
style={{ left: depth * 10 + 5 }}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
|
||||
<Tree
|
||||
tree={treeData}
|
||||
rootId={0}
|
||||
render={(node: NodeModel<Menu>, { depth, isOpen, onToggle }) => (
|
||||
<MenuNode
|
||||
node={node}
|
||||
depth={depth}
|
||||
isOpen={isOpen}
|
||||
isSelected={selectedNode?.id === node.id}
|
||||
onToggle={onToggle}
|
||||
onSelect={handleSelectNode(setSelectedNode)}
|
||||
/>
|
||||
</DndProvider>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
color="lightGray"
|
||||
className="flex-1 items-center px-0"
|
||||
onClick={() => {
|
||||
treeMethods.current?.openAll();
|
||||
}}
|
||||
>
|
||||
<i className="diveicon di-arrows-angle-expand" />
|
||||
전체펼침
|
||||
</Button>
|
||||
<Button
|
||||
color="lightGray"
|
||||
className="flex-1 items-center px-0"
|
||||
onClick={() => {
|
||||
treeMethods.current?.closeAll();
|
||||
}}
|
||||
>
|
||||
<i className="diveicon di-arrows-angle-contract" />
|
||||
전체접기
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
onDrop={handleDropNode(modifyTreeMenu)}
|
||||
classes={{
|
||||
root: "p-4",
|
||||
container: "flex flex-col",
|
||||
dropTarget: "!bg-[rgba(32,148,250,0.5)] rounded-sm",
|
||||
placeholder: "relative",
|
||||
}}
|
||||
sort={false}
|
||||
dropTargetOffset={5}
|
||||
insertDroppableFirst={false}
|
||||
canDrop={(_, { dragSource, dropTargetId }) => {
|
||||
if (dragSource?.parent === dropTargetId) {
|
||||
return true;
|
||||
}
|
||||
}}
|
||||
placeholderRender={(_, { depth }) => {
|
||||
return (
|
||||
<div
|
||||
className="absolute right-0 top-0 h-[0.2rem] bg-primary"
|
||||
style={{ left: depth * 10 + 5 }}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</DndProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { DndProvider } from "react-dnd";
|
||||
import {
|
||||
Tree,
|
||||
MultiBackend,
|
||||
getBackendOptions,
|
||||
type NodeModel,
|
||||
} from "@minoru/react-dnd-treeview";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
Input,
|
||||
} from "@common/components/ui";
|
||||
import { cn } from "@common/components/lib";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { OrganizationApi } from "../api/organization-service";
|
||||
import type { Organization, User } from "../model/organization-interface";
|
||||
import {
|
||||
filterOrganizationTreeDataByKeyword,
|
||||
generateOrganizationTreeData,
|
||||
} from "../lib/utils";
|
||||
|
||||
type TreeModel = Organization | User;
|
||||
|
||||
interface OrganizationSearchDialogProps {
|
||||
handleUserSelect: (user: User) => void;
|
||||
}
|
||||
|
||||
function OrganizationSearchDialog({
|
||||
handleUserSelect,
|
||||
}: OrganizationSearchDialogProps) {
|
||||
const [keyword, setKeyword] = useState("");
|
||||
const [tree, setTree] = useState<NodeModel<TreeModel>[]>([]);
|
||||
const [selectedNode, setSelectedNode] = useState<NodeModel<TreeModel> | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
const { data: treeData } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.USER_OGNZ],
|
||||
queryFn: () => OrganizationApi.getOrganizationUserTreeList(),
|
||||
select: (data) => generateOrganizationTreeData(data),
|
||||
});
|
||||
|
||||
const handleSelectNode = (node: NodeModel<TreeModel>) => {
|
||||
setSelectedNode(node);
|
||||
handleUserSelect(node.data as User);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setTree(treeData ?? []);
|
||||
}, [treeData]);
|
||||
|
||||
return (
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="gap-3">
|
||||
<i className="diveicon di-search" />
|
||||
조회
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-[30rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>담당자 조회</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="card card-border !m-0 flex w-full items-center gap-2">
|
||||
<Input
|
||||
className="h-[2.5rem] !text-[1.3rem]"
|
||||
value={keyword}
|
||||
onChange={(e) => setKeyword(e.target.value)}
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
setTree(filterOrganizationTreeDataByKeyword(tree, keyword))
|
||||
}
|
||||
>
|
||||
<i className="diveicon di-search text-base" />
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
<div className="h-[36rem] overflow-auto">
|
||||
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
|
||||
<Tree
|
||||
tree={tree}
|
||||
rootId={0}
|
||||
render={(
|
||||
node: NodeModel<TreeModel>,
|
||||
{ depth, isOpen, onToggle },
|
||||
) => (
|
||||
<TreeNode
|
||||
node={node}
|
||||
depth={depth}
|
||||
isOpen={isOpen}
|
||||
selectedNode={selectedNode}
|
||||
onToggle={onToggle}
|
||||
onSelect={handleSelectNode}
|
||||
/>
|
||||
)}
|
||||
classes={{
|
||||
container: "flex flex-col",
|
||||
}}
|
||||
sort={false}
|
||||
onDrop={() => {}}
|
||||
/>
|
||||
</DndProvider>
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
interface TreeNodeProps {
|
||||
node: NodeModel<TreeModel>;
|
||||
depth: number;
|
||||
isOpen: boolean;
|
||||
selectedNode: NodeModel<TreeModel> | null;
|
||||
onToggle: (id: NodeModel["id"]) => void;
|
||||
onSelect: (node: NodeModel<TreeModel>) => void;
|
||||
}
|
||||
|
||||
const ORGANIZATION_PREFIX = "OGNZ";
|
||||
|
||||
function TreeNode({
|
||||
node,
|
||||
depth,
|
||||
isOpen,
|
||||
selectedNode,
|
||||
onToggle,
|
||||
onSelect,
|
||||
}: TreeNodeProps) {
|
||||
const { id, text, data } = node;
|
||||
const indent = depth * 15 + 5;
|
||||
|
||||
const handleToggle = () => onToggle(id);
|
||||
const handleSelect = () => {
|
||||
if (id.toString().startsWith(ORGANIZATION_PREFIX)) return;
|
||||
onSelect(node);
|
||||
};
|
||||
|
||||
const isSelected = selectedNode?.id === id;
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{ paddingInlineStart: indent }}
|
||||
className="group flex cursor-pointer items-center justify-between gap-2 rounded-sm p-2 hover:bg-accent"
|
||||
onClick={handleSelect}
|
||||
>
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div>
|
||||
{data && ("children" in data || "users" in data) && (
|
||||
<Button
|
||||
size="icon"
|
||||
className="h-6 w-6 !bg-transparent"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleToggle();
|
||||
}}
|
||||
>
|
||||
<i
|
||||
className={cn(
|
||||
"diveicon di-arrow-forward mr-2 text-base text-label",
|
||||
isOpen && "rotate-90",
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
)}
|
||||
<span className="text-[1.4rem] font-medium text-label">{text}</span>
|
||||
</div>
|
||||
{isSelected && <i className="diveicon di-check text-xl text-primary" />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { OrganizationSearchDialog };
|
||||
@@ -0,0 +1,22 @@
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import { Table, TableBody } from "@common/components";
|
||||
import type { MenuFormData } from "../model/menu-interface";
|
||||
import { BaseBottomMenuForm } from "./base-bottom-menu-form";
|
||||
|
||||
export function OutsideMenuForm({
|
||||
form,
|
||||
}: {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
}) {
|
||||
return (
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
<BaseBottomMenuForm form={form} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { Button, Dialog, DialogTrigger } from "@common/components/ui";
|
||||
|
||||
type PermissionsManagementDialogProps = {
|
||||
menuCd?: number;
|
||||
} & React.ComponentProps<typeof Dialog>;
|
||||
|
||||
function PermissionsManagementDialog({
|
||||
...props
|
||||
}: PermissionsManagementDialogProps) {
|
||||
return (
|
||||
<Dialog {...props}>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="gap-3">
|
||||
<i className="diveicon di-personal-information" />
|
||||
권한관리
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { PermissionsManagementDialog };
|
||||
@@ -1,380 +0,0 @@
|
||||
import dayjs from "dayjs";
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import {
|
||||
DatePicker,
|
||||
IconFinder,
|
||||
Input,
|
||||
Label,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
import {
|
||||
FormItem,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormMessage,
|
||||
} from "@/shared/ui/form";
|
||||
import type { BoardPopup } from "@/entities/board";
|
||||
import type { Content } from "../model/content-interface";
|
||||
import type { User } from "../model/organization-interface";
|
||||
import type { MenuFormData, MenuType } from "../model/menu-interface";
|
||||
import { OrganizationSearchDialog } from "./organization-search-dialog";
|
||||
import { ContentSearchDialog } from "./content-search-dialog";
|
||||
import { BoardSearchDialog } from "./board-search-dialog";
|
||||
|
||||
type TypeMenuFormProps = {
|
||||
form: UseFormReturn<MenuFormData>;
|
||||
menuType: MenuType;
|
||||
};
|
||||
|
||||
function TypeMenuForm({ form, menuType }: TypeMenuFormProps) {
|
||||
const handleIconClick = (icon: string) => {
|
||||
form.setValue("iconNm", icon);
|
||||
};
|
||||
|
||||
const handleContentSelect = (content: Content) => {
|
||||
form.setValue("menuLnkgSn", content.contsSn);
|
||||
form.setValue("menuLnkgSnNm", content.contsTtl);
|
||||
};
|
||||
|
||||
const handleUserSelect = (user: User) => {
|
||||
form.setValue("menuPicUserUnqId", user.userUnqId);
|
||||
form.setValue("menuPicUserUnqIdNm", user.userNm);
|
||||
};
|
||||
|
||||
const handleBoardSelect = (board: BoardPopup) => {
|
||||
form.setValue("menuLnkgSn", board.bbsId);
|
||||
form.setValue("menuLnkgSnNm", board.bbsNm);
|
||||
};
|
||||
|
||||
const handleDateSelect = (date: Date | undefined) => {
|
||||
if (!date) return;
|
||||
form.setValue("menuPicDsgnYmd", dayjs(date).format("YYYYMMDD"));
|
||||
};
|
||||
|
||||
return (
|
||||
<Table variant="secondary" className="-mt-[0.1rem]">
|
||||
<colgroup>
|
||||
<col width="20%" />
|
||||
<col width="80%" />
|
||||
</colgroup>
|
||||
<TableBody>
|
||||
{menuType === "CONTENTS" && (
|
||||
<TableRow>
|
||||
<TableHead>콘텐츠</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-[3.2rem] w-1/2 cursor-not-allowed overflow-hidden whitespace-nowrap break-keep rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{!form.watch("menuLnkgSnNm") &&
|
||||
"메뉴에 표시될 콘텐츠를 조회 후 선택하십시오."}
|
||||
{form.watch("menuLnkgSnNm")}
|
||||
</div>
|
||||
<ContentSearchDialog
|
||||
handleContentSelect={handleContentSelect}
|
||||
/>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{menuType === "BOARD" && (
|
||||
<TableRow>
|
||||
<TableHead>게시판</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-[3.2rem] w-1/2 cursor-not-allowed overflow-hidden whitespace-nowrap break-keep rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{!form.watch("menuLnkgSnNm") &&
|
||||
"메뉴에 표시될 게시판을 조회 후 선택하십시오."}
|
||||
{form.watch("menuLnkgSnNm")}
|
||||
</div>
|
||||
<BoardSearchDialog handleBoardSelect={handleBoardSelect} />
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{(menuType === "INSIDE" || menuType === "OUTSIDE") && (
|
||||
<TableRow>
|
||||
<TableHead>연결 URL</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="urlPath"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
className="!text-[1.3rem]"
|
||||
placeholder={
|
||||
menuType === "INSIDE"
|
||||
? "메뉴에 연결된 페이지의 경로를 입력하십시오."
|
||||
: "'http://' 또는 'https://'를 포함하여 입력하십시오."
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{(menuType === "CONTENTS" ||
|
||||
menuType === "BOARD" ||
|
||||
menuType === "INSIDE" ||
|
||||
menuType === "OUTSIDE") && (
|
||||
<TableRow>
|
||||
<TableHead>연결 형태</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="newWndwYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="newWndwY" />
|
||||
<Label htmlFor="newWndwY">새창</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="newWndwN" />
|
||||
<Label htmlFor="newWndwN">현재창</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{(menuType === "CONTENTS" || menuType === "BOARD") && (
|
||||
<TableRow>
|
||||
<TableHead>메뉴 평가 사용 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="evlUseYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="evlUseY" />
|
||||
<Label htmlFor="evlUseY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="evlUseN" />
|
||||
<Label htmlFor="evlUseN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
|
||||
{/* 메뉴 유형 공통 폼 S */}
|
||||
<TableRow>
|
||||
<TableHead>메뉴 서브명</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="menuSubKornNm"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
className="!text-[1.3rem]"
|
||||
placeholder="사이트맵에서 다른 이름으로 사용할 경우 입력하십시오."
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>메뉴 아이콘</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="flex gap-2">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{!form.watch("iconNm") && "아이콘을 조회 후 선택하십시오."}
|
||||
{form.watch("iconNm")}
|
||||
</div>
|
||||
<IconFinder handleClick={handleIconClick} />
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>출력 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="otptYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="otptY" />
|
||||
<Label htmlFor="otptY">출력</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="otptN" />
|
||||
<Label htmlFor="otptN">출력안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>사용 여부</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="useYn"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="useY" />
|
||||
<Label htmlFor="useY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="useN" />
|
||||
<Label htmlFor="useN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/* 메뉴 유형 공통 폼 E */}
|
||||
|
||||
{(menuType === "CONTENTS" || menuType === "BOARD") && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead>QR코드</TableHead>
|
||||
<TableCell className="border">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="qrcd"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<RadioGroup
|
||||
value={field.value ?? ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="Y" id="qrcdY" />
|
||||
<Label htmlFor="qrcdY">사용</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RadioGroupItem value="N" id="qrcdN" />
|
||||
<Label htmlFor="qrcdN">사용안함</Label>
|
||||
</div>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>담당자</TableHead>
|
||||
<TableCell className="border">
|
||||
<div className="flex items-center gap-6">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-[3.2rem] w-[21.5rem] cursor-not-allowed rounded-md border border-input bg-form px-3 py-2 text-[1.3rem] opacity-50">
|
||||
{!form.watch("menuPicUserUnqIdNm") &&
|
||||
"메뉴 담당자를 조회 후 선택하십시오."}
|
||||
{form.watch("menuPicUserUnqIdNm")}
|
||||
</div>
|
||||
<OrganizationSearchDialog
|
||||
handleUserSelect={handleUserSelect}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<b>지정일:</b>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="menuPicDsgnYmd"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<DatePicker
|
||||
mode="single"
|
||||
selected={
|
||||
field.value
|
||||
? dayjs(field.value).toDate()
|
||||
: undefined
|
||||
}
|
||||
onSelect={(date) => {
|
||||
field.onChange(date);
|
||||
handleDateSelect(date);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
|
||||
export { TypeMenuForm };
|
||||
@@ -4,11 +4,11 @@ import type {
|
||||
Domain,
|
||||
DomainService,
|
||||
DomainList,
|
||||
DomainParams,
|
||||
IDomainParams,
|
||||
} from "../model/domain-interface";
|
||||
|
||||
export class DomainApiService implements DomainService {
|
||||
public async getDomainList(params: DomainParams): Promise<DomainList> {
|
||||
public async getDomainList(params: IDomainParams): Promise<DomainList> {
|
||||
const response = await client.get<DomainList>(
|
||||
`${ENDPOINT.CMS_SERVICE.DOMAINS}`,
|
||||
{ params },
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { IpParams, IP, IpList, IpService } from "../model/ip-interface";
|
||||
import type { IIpParams, IP, IpList, IpService } from "../model/ip-interface";
|
||||
|
||||
export class IpApiService implements IpService {
|
||||
public async getIpList(params: IpParams): Promise<IpList> {
|
||||
public async getIpList(params: IIpParams): Promise<IpList> {
|
||||
const response = await client.get<IpList>(`${ENDPOINT.CMS_SERVICE.IPS}`, {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import type { PageableParams, PageableList } from "@/shared/model";
|
||||
import type { IPageableParams, PageableList } from "@/shared/model";
|
||||
|
||||
export interface DomainParams extends PageableParams {
|
||||
export interface IDomainParams extends IPageableParams {
|
||||
keywordType?: string;
|
||||
keyword?: string;
|
||||
siteId?: string;
|
||||
@@ -23,9 +23,9 @@ export const domainFormSchema = z.object({
|
||||
|
||||
export type Domain = z.infer<typeof domainSchema>;
|
||||
export type DomainFormData = z.infer<typeof domainFormSchema>;
|
||||
export type DomainList = PageableList<Domain>;
|
||||
export type DomainList = PageableList<Domain[]>;
|
||||
|
||||
export interface DomainService {
|
||||
getDomainList(params: DomainParams): Promise<DomainList>;
|
||||
getDomainList(params: IDomainParams): Promise<DomainList>;
|
||||
saveDomainList(body: Domain[]): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import type { PageableParams, PageableList } from "@/shared/model";
|
||||
import type { IPageableParams, PageableList } from "@/shared/model";
|
||||
|
||||
export interface IpParams extends PageableParams {
|
||||
export interface IIpParams extends IPageableParams {
|
||||
siteId: string;
|
||||
ipAddr?: string;
|
||||
prmYn?: string;
|
||||
@@ -21,9 +21,9 @@ export const ipFormSchema = z.object({
|
||||
|
||||
export type IP = z.infer<typeof ipSchema>;
|
||||
export type IPFormData = z.infer<typeof ipFormSchema>;
|
||||
export type IpList = PageableList<IP>;
|
||||
export type IpList = PageableList<IP[]>;
|
||||
|
||||
export interface IpService {
|
||||
getIpList(params: IpParams): Promise<IpList>;
|
||||
getIpList(params: IIpParams): Promise<IpList>;
|
||||
saveIpList(body: IP[]): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import dayjs from "dayjs";
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
import type { Site } from "@/entities/site";
|
||||
import type { ISite } from "@/entities/site";
|
||||
|
||||
const columnHelper = createColumnHelper<Site>();
|
||||
const columnHelper = createColumnHelper<ISite>();
|
||||
|
||||
const columns = [
|
||||
columnHelper.accessor((_, index) => index + 1, {
|
||||
|
||||
@@ -38,7 +38,7 @@ function CreatePage() {
|
||||
});
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageLayout pageTitle="사이트 관리">
|
||||
<SiteForm form={form} handleSave={createSite} />
|
||||
</PageLayout>
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ function ModifyPage({ siteId }: { siteId: string }) {
|
||||
});
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageLayout pageTitle="사이트 관리">
|
||||
<SiteForm
|
||||
form={form}
|
||||
siteId={siteId}
|
||||
|
||||
@@ -80,7 +80,7 @@ function SiteForm({ form, siteId, handleSave, handleDelete }: SiteFormProps) {
|
||||
<div className="card card-border !mt-6">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{isModifyMode ? "사이트 수정" : "사이트 등록"}
|
||||
사이트 등록/수정
|
||||
</h3>
|
||||
</div>
|
||||
<div className="card">
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
import "@common/assets/styles/grid.css";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
||||
import { Button, DataTable, Input } from "@common/components";
|
||||
import { SiteApi, type Site, type SiteParams } from "@/entities/site";
|
||||
import { SiteApi, type ISite, type ISiteParams } from "@/entities/site";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { PageLayout } from "@/shared/ui/page-layout";
|
||||
import { columns } from "../model/table-columns";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
function SitePage() {
|
||||
const router = useRouter();
|
||||
@@ -20,7 +20,7 @@ function SitePage() {
|
||||
enabled: false,
|
||||
});
|
||||
|
||||
const [siteQuery, setSiteQuery] = useState<SiteParams>({
|
||||
const [siteQuery, setSiteQuery] = useState<ISiteParams>({
|
||||
siteNm: "",
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ function SitePage() {
|
||||
refetch();
|
||||
};
|
||||
|
||||
const handleRowClick = (row: Site) => {
|
||||
const handleRowClick = (row: ISite) => {
|
||||
router.push(`/site/register/${row.siteId}`);
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ function SitePage() {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageLayout pageTitle="사이트 관리">
|
||||
<div className="card card-border !mt-6">
|
||||
<div className="card card-border">
|
||||
<form onSubmit={handleSubmit} className="flex items-center gap-2 p-2">
|
||||
|
||||
@@ -3,9 +3,6 @@ import { PROXY_HOST } from "./env";
|
||||
export const BASE_URL = `${PROXY_HOST}/server`;
|
||||
|
||||
export const ENDPOINT = {
|
||||
ATTACH_SERVICE: {
|
||||
TUS_UPLOAD: "/attach-service/api/v1/tus/upload",
|
||||
},
|
||||
USER_SERVICE: {
|
||||
LOGIN: "/user-service/login",
|
||||
USERS: "/user-service/api/v1/users",
|
||||
@@ -17,12 +14,6 @@ export const ENDPOINT = {
|
||||
IPS: "/cms-service/api/v1/site-ips",
|
||||
DOMAINS: "/cms-service/api/v1/site-dmns",
|
||||
MENUS: "/cms-service/api/v1/menus",
|
||||
MENU_ROLES: "/cms-service/api/v1/menu-roles",
|
||||
CONTENTS: "/cms-service/api/v1/contents",
|
||||
USER_OGNZ: "/cms-service/api/v1/user-ognz",
|
||||
},
|
||||
BOARD_SERVICE: {
|
||||
BBS: "/board-service/api/v1/bbs",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export { getCookie, setCookie, removeCookie } from "./cookie";
|
||||
export { useMenuStore } from "./use-menu-store";
|
||||
export { useUserStore } from "./use-user-store";
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { useStore } from "zustand";
|
||||
import { useContext } from "react";
|
||||
import type { MenuStore } from "../store/menu-store";
|
||||
import { StoreContext } from "../providers/store-provider";
|
||||
|
||||
export const useMenuStore = <T>(selector: (store: MenuStore) => T): T => {
|
||||
const storeContext = useContext(StoreContext);
|
||||
|
||||
if (!storeContext) {
|
||||
throw new Error("useMenuStore must be used within StoreProvider");
|
||||
}
|
||||
|
||||
return useStore(storeContext.menuStore, selector);
|
||||
};
|
||||
@@ -14,7 +14,7 @@ interface PageableConfig {
|
||||
}
|
||||
|
||||
export interface PageableList<T> {
|
||||
content: T[];
|
||||
content: T;
|
||||
pageable: PageableConfig;
|
||||
sort: SortConfig;
|
||||
totalPages: number;
|
||||
@@ -27,7 +27,7 @@ export interface PageableList<T> {
|
||||
empty: boolean;
|
||||
}
|
||||
|
||||
export interface PageableParams {
|
||||
export interface IPageableParams {
|
||||
page?: number;
|
||||
size?: number;
|
||||
sort?: string[];
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useRef } from "react";
|
||||
import { createAlertStore, createMenuStore, createUserStore } from "../store";
|
||||
import { createAlertStore } from "../store/alert-store";
|
||||
import { createUserStore } from "../store/user-store";
|
||||
|
||||
type StoreContextType = {
|
||||
alertStore: ReturnType<typeof createAlertStore>;
|
||||
menuStore: ReturnType<typeof createMenuStore>;
|
||||
userStore: ReturnType<typeof createUserStore>;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,6 @@ export const StoreProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
if (storeRef.current === null) {
|
||||
storeRef.current = {
|
||||
alertStore: createAlertStore(),
|
||||
menuStore: createMenuStore(),
|
||||
userStore: createUserStore(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
export { createAlertStore } from "./alert-store";
|
||||
export { createMenuStore } from "./menu-store";
|
||||
export { createUserStore, type IUserInfo } from "./user-store";
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { createStore } from "zustand/vanilla";
|
||||
import type { MenuItem } from "@common/components/api";
|
||||
|
||||
export type MenuState = {
|
||||
currentMenuInfo: MenuItem | null;
|
||||
};
|
||||
|
||||
export type MenuActions = {
|
||||
setCurrentMenuInfo: (menu: MenuItem) => void;
|
||||
};
|
||||
|
||||
export type MenuStore = MenuState & MenuActions;
|
||||
|
||||
export const defaultInitState: MenuState = {
|
||||
currentMenuInfo: null,
|
||||
};
|
||||
|
||||
export const createMenuStore = (initState: MenuState = defaultInitState) => {
|
||||
return createStore<MenuStore>()((set) => ({
|
||||
...initState,
|
||||
setCurrentMenuInfo: (menu: MenuItem) => set({ currentMenuInfo: menu }),
|
||||
}));
|
||||
};
|
||||
@@ -1,19 +1,15 @@
|
||||
import { PageTitle } from "@common/components";
|
||||
import { useMenuStore } from "../lib/use-menu-store";
|
||||
|
||||
function PageLayout({ children }: { children: React.ReactNode }) {
|
||||
const { currentMenuInfo } = useMenuStore((state) => state);
|
||||
|
||||
const menuPaths = currentMenuInfo?.menuPath
|
||||
?.split(">")
|
||||
.map((path) => path.trim());
|
||||
|
||||
function PageLayout({
|
||||
children,
|
||||
pageTitle,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
pageTitle: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="h-auto min-h-full bg-container">
|
||||
<PageTitle
|
||||
title={currentMenuInfo?.menuKornNm ?? ""}
|
||||
menuPaths={menuPaths ?? []}
|
||||
/>
|
||||
<h2 className="px-[1.8rem] pt-[2rem] text-[2.4rem] font-semibold text-title">
|
||||
{pageTitle}
|
||||
</h2>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
+7
-67
@@ -1,70 +1,10 @@
|
||||
@import "../../../packages/common/components/src/base.css";
|
||||
@import "@common/assets/styles/base.css";
|
||||
@import "@common/assets/styles/diveicon.css";
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
@layer base {
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 0 0% 3.9%;
|
||||
--card: 0 0% 100%;
|
||||
--card-foreground: 0 0% 3.9%;
|
||||
--popover: 0 0% 100%;
|
||||
--popover-foreground: 0 0% 3.9%;
|
||||
--primary: 0 0% 9%;
|
||||
--primary-foreground: 0 0% 98%;
|
||||
--secondary: 0 0% 96.1%;
|
||||
--secondary-foreground: 0 0% 9%;
|
||||
--muted: 0 0% 96.1%;
|
||||
--muted-foreground: 0 0% 45.1%;
|
||||
--accent: 0 0% 96.1%;
|
||||
--accent-foreground: 0 0% 9%;
|
||||
--destructive: 0 84.2% 60.2%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 0 0% 89.8%;
|
||||
--input: 0 0% 89.8%;
|
||||
--ring: 0 0% 3.9%;
|
||||
--chart-1: 12 76% 61%;
|
||||
--chart-2: 173 58% 39%;
|
||||
--chart-3: 197 37% 24%;
|
||||
--chart-4: 43 74% 66%;
|
||||
--chart-5: 27 87% 67%;
|
||||
--radius: 0.5rem
|
||||
}
|
||||
.dark {
|
||||
--background: 0 0% 3.9%;
|
||||
--foreground: 0 0% 98%;
|
||||
--card: 0 0% 3.9%;
|
||||
--card-foreground: 0 0% 98%;
|
||||
--popover: 0 0% 3.9%;
|
||||
--popover-foreground: 0 0% 98%;
|
||||
--primary: 0 0% 98%;
|
||||
--primary-foreground: 0 0% 9%;
|
||||
--secondary: 0 0% 14.9%;
|
||||
--secondary-foreground: 0 0% 98%;
|
||||
--muted: 0 0% 14.9%;
|
||||
--muted-foreground: 0 0% 63.9%;
|
||||
--accent: 0 0% 14.9%;
|
||||
--accent-foreground: 0 0% 98%;
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 0 0% 14.9%;
|
||||
--input: 0 0% 14.9%;
|
||||
--ring: 0 0% 83.1%;
|
||||
--chart-1: 220 70% 50%;
|
||||
--chart-2: 160 60% 45%;
|
||||
--chart-3: 30 80% 55%;
|
||||
--chart-4: 280 65% 60%;
|
||||
--chart-5: 340 75% 55%
|
||||
}
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
html,
|
||||
body {
|
||||
font-family: "Noto Sans KR", sans-serif;
|
||||
font-size: 10px;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
'use client'
|
||||
import { BaseLayout } from "@common/components";
|
||||
import "./globals.css";
|
||||
import { StoreProvider } from "./store";
|
||||
import { MainDiv } from "@common/business_components";
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
@@ -12,7 +14,9 @@ export default function RootLayout({
|
||||
<body>
|
||||
<StoreProvider>
|
||||
<BaseLayout>
|
||||
<MainDiv>
|
||||
{children}
|
||||
</MainDiv>
|
||||
</BaseLayout>
|
||||
</StoreProvider>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export default function Loading() {
|
||||
return <div>페이지 불러오는 중입니다...</div>;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import {
|
||||
SelectBox,
|
||||
} from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { CoRegForm } from "@/components/ui/matDmd/coRegForm/component";
|
||||
import { CoRegForm } from "@/components/ui/form/matDmd/coRegForm/component";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { ToastFormUi } from "@/components/toastFromUi";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
|
||||
const formSchema = z.object({
|
||||
ctpv: z.string(),
|
||||
|
||||
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import * as z from "zod";
|
||||
import { Form } from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { DmdRegForm } from "@/components/ui/matDmd/dmdRegform/component";
|
||||
import { DmdRegForm } from "@/components/ui/form/matDmd/dmdRegform/component";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
|
||||
+74
-18
@@ -1,26 +1,82 @@
|
||||
import Link from 'next/link';
|
||||
import { Button } from '@common/components/ui';
|
||||
|
||||
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
import { Button } from "@common/components/ui";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<div className='flex'>
|
||||
<Button className='place-self-auto'>
|
||||
<Link href="reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert"> 하수재이용 시설 등록</Link>
|
||||
</Button>
|
||||
<Button className='place-self-auto'>
|
||||
<Link href="reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert"> 빗물재이용 시설 등록</Link>
|
||||
</Button>
|
||||
<Button className='place-self-auto'>
|
||||
<Link href="reuseFaciltyManage/reuseFacilityInsert/rswtReuseFacilityInsert"> 중수도시설 등록</Link>
|
||||
</Button>
|
||||
<div className="flex flex-col gap-8 p-6">
|
||||
{/* 시설 등록 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">시설 등록</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/pbnstReg">
|
||||
하수재이용 시설 등록
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/rainReg">
|
||||
빗물재이용 시설 등록
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/rswtReg">중수도시설 등록</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/htdflReg">온배수 등록</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button className='place-self-auto'>
|
||||
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
|
||||
</Button>
|
||||
{/* 지도점검 결과 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">지도점검 결과</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/prfmncReg/chkgdnReg">
|
||||
지도점검 결과 등록
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 시설 현황 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">시설 현황</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltSttn/pbnstSttn">
|
||||
하수재이용시설현황
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 수요처 관리 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">수요처 관리</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { ScrollArea, SearchDiv, SelectBox, UiTable } from '@common/business_components';
|
||||
import { Button } from '@common/components';
|
||||
import { PublicReuseFaciltyFormInsert } from '../../../../components/ui/publicReuseInsertForm';
|
||||
import { useWrStore } from '../../../store';
|
||||
|
||||
|
||||
|
||||
export default function PublicReuseFaciltyInsert() {
|
||||
const {pubFac} = useWrStore((state) => state);
|
||||
const { pubFacHeadList, publicReuseFacilityData} = pubFac;
|
||||
const searchDiv = '하수재이용시설 '
|
||||
const selectBox = [{ text: '서울하수처리시설', val: "1_hasu" }, { text: '서울1하수처리시설', val: "2_hasu" }, { text: '서울2하수처리시설', val: "3_hasu" }]
|
||||
const headName = () => {
|
||||
return (
|
||||
<h1 className="pl-3 text-xl">○공공 하수처리시설 등록</h1>
|
||||
)
|
||||
}
|
||||
const onSelectValue = (val: string) => {
|
||||
console.log(val)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-4 h-full">
|
||||
<div className='col-span-4'>
|
||||
<h1 className="pl-3 text-xl" > 하수재이용시설 등록</h1>
|
||||
<div className="m-8">
|
||||
<SearchDiv>
|
||||
<div className='w-4/5 grid grid-cols-12 gap-1 mx-4'>
|
||||
<SelectBox className='col-span-4' label={searchDiv} selectArray={selectBox} onSelectValue={onSelectValue} />
|
||||
</div>
|
||||
<div className='w-1/5 flex items-center justify-end'>
|
||||
<Button className='mr-4 rounded-lg'>조회</Button>
|
||||
<Button className='mr-4 rounded-lg'>신규추가</Button>
|
||||
</div>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-1 pl-11">
|
||||
<UiTable tableData={publicReuseFacilityData} headlist={pubFacHeadList} pageSize={100} total={10} headName={headName()} children={undefined}/>
|
||||
</div>
|
||||
<div className="col-span-1 pr-6 max-h-full overflow-y-scroll">
|
||||
<ScrollArea>
|
||||
<PublicReuseFaciltyFormInsert />
|
||||
{/* <ScrollBar orientation="vertical"></ScrollBar> */}
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
'use client'
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/rainReuseFacilityInsert"
|
||||
import { RainReuseFaciltyInsertForm } from "@/components/ui/rainReuseInsertForm";
|
||||
import { ScrollArea, SearchDiv, SearchInput, UiTable } from "@common/business_components";
|
||||
import { Button, TableHead, TableRow } from "@common/components";
|
||||
|
||||
|
||||
export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return (<>
|
||||
<TableRow>{
|
||||
upHeadList.map((head: TableUpperProps) =>
|
||||
(!head.upSequnce ? <TableHead rowSpan={2} key={head.id}>{head.title}</TableHead> :
|
||||
head.upName === 'upChangeRe' && head.upSequnce === 1 ? <TableHead key={head.id} rowSpan={1} colSpan={3}>{'중축 개축 증축 '}</TableHead> : null))}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
(head.upName === 'upChangeRe' ? <TableHead key={head.id}>{head.title}</TableHead> : null))}
|
||||
</TableRow>
|
||||
</>)
|
||||
}
|
||||
|
||||
|
||||
export default function Home() {
|
||||
const { rain } = useWrStore((state) => state);
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
|
||||
|
||||
const headName = () => {
|
||||
return (
|
||||
<h1 className="pl-3 text-xl">○건축물 목록</h1>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-4 ">
|
||||
<div className='col-span-2'>
|
||||
<h1 className="pl-3 text-2xl" >빗물이용시설 등록 </h1>
|
||||
<div className="m-8">
|
||||
<SearchDiv >
|
||||
<div className='w-4/5 grid grid-cols-12 gap-1 mx-4'>
|
||||
<SearchInput className='col-span-3 my-7' label="건물명" />
|
||||
</div>
|
||||
<div className='w-1/5 flex items-center justify-end'>
|
||||
<Button className='mr-4 rounded-lg'>조회</Button>
|
||||
<Button className='mr-4 rounded-lg'>저장</Button>
|
||||
<Button className='mr-4 rounded-lg'>신규등록</Button>
|
||||
</div>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="colsapn-1 pl-11">
|
||||
<UiTable tableData={rain.rainOfObject} headlist={rain.upHeadList} pageSize={100} total={10} headName={headName()}>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
<div className="colsapn-1 pr-11 max-h-full ovreflow-y-scroll">
|
||||
<ScrollArea>
|
||||
<RainReuseFaciltyInsertForm></RainReuseFaciltyInsertForm>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
'use client'
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/rainReuseFacilityInsert";
|
||||
import { RswtrReuseFaciltyInsertForm } from "@/components/ui/rswtrReuseInsetForm";
|
||||
import { ScrollArea, SearchDiv, SearchInput, UiTable } from "@common/business_components";
|
||||
import { Button, TableHead, TableRow } from "@common/components";
|
||||
|
||||
|
||||
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return (<>
|
||||
<TableRow>{
|
||||
upHeadList.map((head: TableUpperProps) =>
|
||||
(!head.upSequnce ? <TableHead rowSpan={2} key={head.id}>{head.title}</TableHead> :
|
||||
head.upName === 'upChangeRe' && head.upSequnce === 1 ? <TableHead key={head.id} rowSpan={1} colSpan={3}>{'중축 개축 증축 '}</TableHead> : null))}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
(head.upName === 'upChangeRe' ? <TableHead key={head.id}>{head.title}</TableHead> : null))}
|
||||
</TableRow>
|
||||
</>)
|
||||
}
|
||||
|
||||
|
||||
export default function Home() {
|
||||
const {rswt} = useWrStore((state) => state);
|
||||
const nodeList = headMakeColSpan(rswt.upHeadList);
|
||||
const total = 100;
|
||||
|
||||
|
||||
const headName = () => {
|
||||
return (
|
||||
<h1 className="pl-3 text-xl">○건축물 목록</h1>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-4 ">
|
||||
<div className='col-span-2'>
|
||||
<h1 className="pl-3 text-2xl" >중수도시설 등록 </h1>
|
||||
<div className="m-8">
|
||||
<SearchDiv >
|
||||
<div className='w-4/5 grid grid-cols-6 gap-1 mx-4'>
|
||||
<SearchInput className='col-span-1 my-7 text-2xl' label="건물명:" />
|
||||
</div>
|
||||
<div className='w-1/5 flex items-center justify-end'>
|
||||
<Button className='mr-4 rounded-lg'>조회</Button>
|
||||
<Button className='mr-4 rounded-lg'>저장</Button>
|
||||
<Button className='mr-4 rounded-lg'>신규등록</Button>
|
||||
</div>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="colsapn-1 pl-11">
|
||||
<UiTable tableData={rswt.rswtOfObject} headlist={rswt.upHeadList} pageSize={100} total={10} headName={headName()}>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
<div className="colsapn-1 pr-11 max-h-full ovreflow-y-scroll">
|
||||
<ScrollArea>
|
||||
<RswtrReuseFaciltyInsertForm></RswtrReuseFaciltyInsertForm>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
ContentsDiv,
|
||||
ScrollArea,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import { Button } from "@common/components";
|
||||
import { headMakeColSpan } from "../rainReg/page";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useEffect, useState } from "react";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { HtdflRegForm } from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
|
||||
export default function Home() {
|
||||
const { code, htdfl, initHtdfl } = useWrStore((state) => state);
|
||||
const nodeList = headMakeColSpan(htdfl.upHeadList);
|
||||
const [searchTxt, setSearchTxt] = useState("");
|
||||
const [htdflForm, setHtdflForm] = useState<customHtdflBdst>();
|
||||
const [bdstTable, setbdstTable] = useState<customHtdflBdst[]>();
|
||||
const [issNewReg,setIsNewReg] = useState<boolean>( false);
|
||||
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
const { htdflRes } = htdfl;
|
||||
|
||||
useEffect(() => {
|
||||
if (!htdfl.isInit) {
|
||||
initHtdfl(undefined);
|
||||
}
|
||||
}, [htdfl.isInit, initHtdfl]);
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
setbdstTable(tableData(htdflRes, { code }));
|
||||
}
|
||||
}, [code, htdflRes]);
|
||||
|
||||
const cellClick: (val: number|undefined ,headId: string) => void = (
|
||||
val
|
||||
,headId) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
setHtdflForm(htdflRes[val]);
|
||||
}
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
htdflRes[val]?.bdstInfoPk != null &&
|
||||
htdflRes[val]?.chgBuilding?.length > 0
|
||||
) {
|
||||
bdstChgModal(htdflRes[val]?.chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-2 gap-4 ">
|
||||
<div className="col-span-2">
|
||||
<Title title={"온배수시설 등록 "} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label="건물명:"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg" onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={htdfl.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={(val,headId)=>{cellClick(val||undefined , headId)}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<HtdflRegForm
|
||||
htdflForm={htdflForm ?? ({} as customHtdflBdst)}
|
||||
isModal={false}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
body={<BdstReg moType="HTB"></BdstReg>}
|
||||
bodyClass="w-[90vw] max-w-none"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
"use client";
|
||||
import {
|
||||
ScrollArea,
|
||||
SearchDiv,
|
||||
SelectBox,
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import { Button } from "@common/components";
|
||||
import { useWrStore } from "../../../store";
|
||||
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/component";
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
|
||||
import { PbnstMngForm} from "@/components/ui/form/fcltReg/pbnstReg/mngReg/component";
|
||||
import { useEffect, useState } from "react";
|
||||
import type { ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
|
||||
|
||||
|
||||
export default function PublicReuseFaciltyInsert() {
|
||||
const { pubFac , pubMng,mngMainValue} = useWrStore((state) => state);
|
||||
const { pubFacHeadList, publicReuseFacilityData } = pubFac;
|
||||
const { ruseFclt } = pubMng;
|
||||
|
||||
const [currentTab, setCurrentTab] = useState<string>('mng');
|
||||
const [fcltMng, setFcltMng] = useState<ruseFcltType[]>();
|
||||
|
||||
const searchDiv = "하수재이용시설 ";
|
||||
const selectBox = [
|
||||
{ text: "서울하수처리시설", val: "1_hasu" },
|
||||
{ text: "서울1하수처리시설", val: "2_hasu" },
|
||||
{ text: "서울2하수처리시설", val: "3_hasu" },
|
||||
];
|
||||
const headName = () => {
|
||||
return <h1 className="pl-3 text-xl">○공공 하수처리시설 등록</h1>;
|
||||
};
|
||||
const onSelectValue = (val: string) => {
|
||||
console.log(val);
|
||||
};
|
||||
const cellClick = (val: number | undefined) => {
|
||||
if (val === undefined) return;
|
||||
let data;
|
||||
if (publicReuseFacilityData[val]) {
|
||||
data = ruseFclt.filter(
|
||||
(item) => item.swtrmtFcltFk === publicReuseFacilityData[val]?.swtrmtFcltFk
|
||||
);
|
||||
setFcltMng(data);
|
||||
}
|
||||
};
|
||||
const resetContents = () => {
|
||||
setFcltMng([]); // 빈 배열로 설정하여 신규 모드로 전환
|
||||
};
|
||||
|
||||
const handleTabChange = (value: string) => {
|
||||
setCurrentTab(value);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-4 h-full">
|
||||
<div className="col-span-4 ">
|
||||
<h1 className="pl-3 text-xl"> 하수재이용시설 등록</h1>
|
||||
<div className="m-8">
|
||||
<SearchDiv>
|
||||
<div className="w-4/5 grid grid-cols-12 gap-1 mx-4">
|
||||
<SelectBox
|
||||
className="col-span-4"
|
||||
label={searchDiv}
|
||||
selectArray={selectBox}
|
||||
onSelectValue={onSelectValue}
|
||||
selectClass={undefined}
|
||||
/>
|
||||
</div>
|
||||
<div className="w-1/5 flex items-center justify-end">
|
||||
<Button className="mr-16 rounded-lg">조회</Button>
|
||||
</div>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-1 pl-11 max-h-full">
|
||||
<UiTable
|
||||
tableData={publicReuseFacilityData}
|
||||
headlist={pubFacHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={headName()}
|
||||
children={undefined} cellClick={cellClick} />
|
||||
</div>
|
||||
<div className="col-span-1 pr-6 max-h-full overflow-y-scroll">
|
||||
|
||||
|
||||
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<div className="flex justify-between items-center">
|
||||
<TabsList>
|
||||
<TabsTrigger value="mng">시설정보</TabsTrigger>
|
||||
<TabsTrigger value="buse">차수별정보</TabsTrigger>
|
||||
</TabsList>
|
||||
<Button className="rounded-lg" onClick={resetContents}>
|
||||
신규등록
|
||||
</Button>
|
||||
</div>
|
||||
<TabsContent className="max-h-full" value="mng">
|
||||
<ScrollArea>
|
||||
<PbnstMngForm
|
||||
data={fcltMng || []}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</TabsContent>
|
||||
<TabsContent value="buse">
|
||||
<ScrollArea>
|
||||
<PbnstBuseForm />
|
||||
</ScrollArea>
|
||||
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type {
|
||||
chgBuilding,
|
||||
customRainBdst,
|
||||
TableUpperProps,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
|
||||
import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
ScrollArea,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, TableHead, TableRow } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return (
|
||||
<>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
!head.upSequnce ? (
|
||||
<TableHead rowSpan={2} key={head.id}>
|
||||
{head.title}
|
||||
</TableHead>
|
||||
) : head.upName === "upChangeRe" && head.upSequnce === 1 ? (
|
||||
<TableHead key={head.id} rowSpan={1} colSpan={3}>
|
||||
{"중축 개축 재축 "}
|
||||
</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
head.upName === "upChangeRe" ? (
|
||||
<TableHead key={head.id}>{head.title}</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
export default function Home() {
|
||||
const { rain, code, init } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
const { rainRes } = rain;
|
||||
const [rainForm, setRainForm] = useState<customRainBdst>();
|
||||
const [issNewReg, setIsNewReg] = useState<boolean>(false);
|
||||
|
||||
const [bdstTable, setbdstTable] = useState<customRainBdst[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
useEffect(() => {
|
||||
if (!rain.isInit) {
|
||||
init(undefined);
|
||||
}
|
||||
}, [rain.isInit, init]);
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
setbdstTable(tableData(rainRes, { code }));
|
||||
}
|
||||
}, [code, rainRes]);
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
) => {
|
||||
if (val !== undefined) {
|
||||
setRainForm(rainRes[val]);
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
rainRes[val]?.bdstInfoPk != null &&
|
||||
rainRes[val]?.chgBuilding.length > 0
|
||||
) {
|
||||
bdstChgModal(rainRes[val].chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log("rainForm", rainForm);
|
||||
}, [rainForm]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"빗물이용시설 등록"} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label="건물명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={(e) => {
|
||||
init(searchTxt || "");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="h-screen grid grid-cols-6 gap-4 !overflow-y-scroll">
|
||||
<div className="col-span-4 h-full min-h-0">
|
||||
<ListDiv className="h-full min-h-0">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rain.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full overflow-y-scroll">
|
||||
<ListDiv className="">
|
||||
<RainRegForm
|
||||
rainForm={rainForm ?? ({} as customRainBdst)}
|
||||
isModal={false}
|
||||
></RainRegForm>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
body={<BdstReg moType="RNB"></BdstReg>}
|
||||
bodyClass="w-[90vw] max-w-none"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
ScrollArea,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components";
|
||||
import { headMakeColSpan } from "../rainReg/page";
|
||||
import { useEffect, useState } from "react";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { RswtrRegForm } from "@/components/ui/form/fcltReg/rswtrReg/RswtrRegForm";
|
||||
import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
|
||||
export default function Home() {
|
||||
const { code, rswt, initRswt } = useWrStore((state) => state);
|
||||
const nodeList = headMakeColSpan(rswt.upHeadList);
|
||||
const [rswtForm, setRswtForm] = useState<customRswtBdst>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [issNewReg, setIsNewReg] = useState<boolean>(false);
|
||||
|
||||
const [bdstTable, setbdstTable] = useState<customRswtBdst[]>();
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
const { rswtRes } = rswt;
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswt.isInit) {
|
||||
initRswt(undefined);
|
||||
}
|
||||
}, [rswt.isInit, initRswt]);
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
setbdstTable(tableData(rswtRes, { code }));
|
||||
}
|
||||
}, [code, rswtRes]);
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
setRswtForm(rswtRes[val]);
|
||||
}
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
rswtRes[val]?.bdstInfoPk != null &&
|
||||
rswtRes[val]?.chgBuilding?.length > 0
|
||||
) {
|
||||
bdstChgModal(rswtRes[val].chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"중수도시설 등록 "} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label="건물명:"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={(e) => {
|
||||
initRswt(searchTxt || "");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rswt.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={cellClick}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<RswtrRegForm
|
||||
rswtForm={rswtForm ?? ({} as customRswtBdst)}
|
||||
isModal={false}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<UiModal
|
||||
body={<BdstReg moType="RST"></BdstReg>}
|
||||
bodyClass="w-[90vw] max-w-none"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/page";
|
||||
import HeadChModal from "@/components/ui/modal/headChModal/headChModal";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function PbnstSttn() {
|
||||
const { code,pbnStt } = useWrStore((state) => state);
|
||||
|
||||
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const nodeList = headMakeprfmnc(pbnStt.pbnSttHeadList, pbnStt.pbnSttHeadNm);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"하수재이용 시설 현황"} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SelectBox
|
||||
className={"col-span-2 w-full h-full text-2xl"}
|
||||
label={"권역"}
|
||||
selectClass={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={() => {}}
|
||||
value={""}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-2 w-full h-full text-2xl"}
|
||||
label={"단위유역"}
|
||||
selectClass={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={() => {}}
|
||||
value={""}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-2 w-full h-full text-2xl"}
|
||||
label={"중권역"}
|
||||
selectClass={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={() => {}}
|
||||
value={""}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-2 w-full h-full text-2xl"}
|
||||
label={"환경청"}
|
||||
selectClass={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={() => {}}
|
||||
value={""}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-2 w-full h-full text-2xl"}
|
||||
label={"시도"}
|
||||
selectClass={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={() => {}}
|
||||
value={""}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-2 w-full h-full text-2xl"}
|
||||
label={"시군구"}
|
||||
selectClass={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={() => {}}
|
||||
value={""}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg" onClick={(e) => {}}>
|
||||
조회
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
다운로드
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {
|
||||
// setIsChHead(true)
|
||||
}}>
|
||||
조회항목설정
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-6">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={[]}
|
||||
headlist={pbnStt.pbnSttHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal open ={isChHead} onOpenChange ={()=>{setIsChHead(!isChHead)}} bodyClass={""} body={<HeadChModal/>}/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
fcltDiv,
|
||||
type chHeadType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { useState } from "react";
|
||||
import { TableRow, TableHead } from "@common/components";
|
||||
import React from "react";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import RainChkgdTable from "@/components/ui/table/rainChkgd/rainChkgdTable";
|
||||
import RswtChkgdTable from "@/components/ui/table/rswtChkgd/rswtChkgdTable";
|
||||
import ChkgdModal from "@/components/ui/modal/chkgdModal/chkgdModal";
|
||||
import ChkgdExcel from "@/components/ui/modal/chkgdExcel/chkgdExcel";
|
||||
|
||||
export const headMakeprfmnc = (
|
||||
upHeadList: TableUpperProps[],
|
||||
makeHeadNm: chHeadType[]
|
||||
) => {
|
||||
return (
|
||||
<>
|
||||
<TableRow>
|
||||
{upHeadList
|
||||
.filter((data) => data.visible !=false)
|
||||
.map((head: TableUpperProps) =>
|
||||
!head.upSequnce ? (
|
||||
<TableHead
|
||||
className={ `border border-gray-600 px-2 py-1 `}
|
||||
rowSpan={2} key={head.id}>
|
||||
{head.title}
|
||||
</TableHead>
|
||||
) : head.upSequnce === 1 ? (
|
||||
<TableHead
|
||||
className={ `border border-gray-600 px-2 py-1 `}
|
||||
key={head.id}
|
||||
rowSpan={1}
|
||||
colSpan={
|
||||
makeHeadNm.find((ch) => ch.headNm === head.upName)?.length
|
||||
}
|
||||
>
|
||||
{makeHeadNm.find((ch) => ch.headNm === head.upName)?.text}
|
||||
</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList
|
||||
.filter((data) => data.visible !=false)
|
||||
.map((head: TableUpperProps) =>
|
||||
makeHeadNm.find((ch) => ch.headNm === head.upName) ? (
|
||||
<TableHead
|
||||
className={ `border border-gray-600 px-2 py-1 `}
|
||||
key={head.id}>{head.title}</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
</>
|
||||
);
|
||||
};
|
||||
//-----------------------
|
||||
export default function Page() {
|
||||
const [isDetail, setIsDetail] = useState(false);
|
||||
const [isExcel, setIsExcel] = useState(false);
|
||||
|
||||
|
||||
|
||||
const [testObj, setTestObj] = useState({});
|
||||
|
||||
const [selFcltDiv, setSelFcltDiv] = useState("RST");
|
||||
|
||||
const cellClick = () => {
|
||||
const ch = { bdstNm: "test", chckYmd: "2022-10-10" };
|
||||
setTestObj(ch);
|
||||
};
|
||||
|
||||
return (
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"지도점검 결과 등록 "} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label=" 지도점검년도"
|
||||
textValue={""}
|
||||
setText={(e) => {}}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-3 w-full h-full text-2xl"}
|
||||
label={"시설구분"}
|
||||
selectClass={""}
|
||||
selectArray={fcltDiv}
|
||||
onSelectValue={setSelFcltDiv}
|
||||
value={selFcltDiv ?? fcltDiv[0]?.val}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={(e) => {
|
||||
cellClick()
|
||||
setIsDetail(!isDetail);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
삭제
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
저장
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
결과등록
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg"
|
||||
onClick={() => {
|
||||
setIsExcel(!isDetail);
|
||||
}}>
|
||||
양식받기
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-6">
|
||||
<ListDiv>
|
||||
{selFcltDiv === "RNB" ? <RainChkgdTable /> : <RswtChkgdTable />}
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<UiModal
|
||||
open={isDetail}
|
||||
onOpenChange={setIsDetail}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<ChkgdModal type={selFcltDiv} obj={testObj}></ChkgdModal>}
|
||||
/>
|
||||
|
||||
<UiModal open={isExcel}
|
||||
onOpenChange={setIsExcel}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
import { getFectch } from "@/components/lib/api";
|
||||
|
||||
// Description: 공통코드
|
||||
export type selectArray = {
|
||||
text: string;
|
||||
val: string | number;
|
||||
};
|
||||
|
||||
export const yn :selectArray[]=[
|
||||
{val:'Y', text:'Y'},
|
||||
{val:'N', text:'N'},
|
||||
]
|
||||
|
||||
//공통 건축물 용도
|
||||
export const bdstUsgCd: selectArray[] = [
|
||||
{ val: 1, text: "운동장" },
|
||||
{ val: 2, text: "체육관" },
|
||||
{ val: 3, text: "공공업무시설" },
|
||||
{ val: 4, text: "공공기관의청사" },
|
||||
{ val: 5, text: "아파트" },
|
||||
{ val: 6, text: "연립주택" },
|
||||
{ val: 7, text: "다세대주택" },
|
||||
{ val: 8, text: "기숙사" },
|
||||
{ val: 9, text: "초등학교" },
|
||||
{ val: 10, text: "중학교" },
|
||||
{ val: 11, text: "고등학교" },
|
||||
{ val: 12, text: "전문대학" },
|
||||
{ val: 13, text: "대학및대학교" },
|
||||
{ val: 14, text: "골프장" },
|
||||
{ val: 15, text: "대규모점포" },
|
||||
{ val: 16, text: "기타" },
|
||||
];
|
||||
//빗물 집수면 종류 용도
|
||||
export const rainFcltCd = [
|
||||
{ val: "1", text: "지붕" },
|
||||
{ val: "2", text: "건물옥상" },
|
||||
{ val: "3", text: "골프장 연못" },
|
||||
{ val: "4", text: "운동장 바닥" },
|
||||
{ val: "5", text: "운동장 지붕" },
|
||||
{ val: "6", text: "주차장" },
|
||||
{ val: "7", text: "태양광패널" },
|
||||
{ val: "8", text: "연못" },
|
||||
{ val: "9", text: "기타" },
|
||||
{ val: "10", text: "확인불가" },
|
||||
];
|
||||
// 중수도 필수 원수종류
|
||||
export const rswtBdstType: selectArray[] = [
|
||||
{ text: "숙박업", val: 17 },
|
||||
{ text: "목욕장업", val: 18 },
|
||||
{ text: "공장", val: 19 },
|
||||
{ text: "발전시설", val: 20 },
|
||||
{ text: "관광단지개발사업", val: 21 },
|
||||
{ text: "도시개발사업", val: 22 },
|
||||
{ text: "산업단지개발사업", val: 23 },
|
||||
{ text: "택지개발사업", val: 24 },
|
||||
{ text: "대규모점포(대형마트)", val: 25 },
|
||||
{ text: "대규모점포(전문점)", val: 26 },
|
||||
{ text: "대규모점포(백화점)", val: 27 },
|
||||
{ text: "대규모점포(쇼핑센터)", val: 28 },
|
||||
{ text: "대규모점포(복합쇼핑몰)", val: 29 },
|
||||
{ text: "물류시설", val: 30 },
|
||||
{ text: "운수시설(여객자동차터미널)", val: 31 },
|
||||
{ text: "운수시설(철도시설)", val: 32 },
|
||||
{ text: "운수시설(공항시설)", val: 33 },
|
||||
{ text: "운수시설(항만시설)", val: 34 },
|
||||
{ text: "업무시설(공공업무시설)", val: 35 },
|
||||
{ text: "업무시설(금융업소)", val: 36 },
|
||||
{ text: "업무시설(사무소)", val: 37 },
|
||||
{ text: "업무시설(결혼상담소 등 소개업소)", val: 38 },
|
||||
{ text: "업무시설(출판사)", val: 39 },
|
||||
{ text: "업무시설(신문사)", val: 40 },
|
||||
{ text: "업무시설(오피스텔)", val: 41 },
|
||||
{ text: "교정시설", val: 42 },
|
||||
{ text: "방송국", val: 43 },
|
||||
{ text: "전신전화국", val: 44 },
|
||||
{ text: "기타", val: 45 },
|
||||
];
|
||||
|
||||
const orgwtKndCd = [
|
||||
{ text: "오수(변기 오수 제외)", val: "1" },
|
||||
{ text: "오수", val: "2" },
|
||||
{ text: "폐수", val: "3" },
|
||||
{ text: "오수 및 폐수", val: "4" },
|
||||
{ text: "기타", val: "5" },
|
||||
];
|
||||
|
||||
export const chBuCd = [
|
||||
{ val: "증축", text: "증축" },
|
||||
{ val: "개축", text: "개축" },
|
||||
{ val: "재축", text: "재축" },
|
||||
]
|
||||
|
||||
|
||||
|
||||
export type comCodeState = {
|
||||
code: {
|
||||
isInit: boolean;
|
||||
chBuCd:selectArray[]
|
||||
rainFcltCd: selectArray[];
|
||||
bdstUsgCd: selectArray[];
|
||||
cityCd: selectArray[];
|
||||
sggCd: selectArray[];
|
||||
orgwtKndCd:selectArray[];
|
||||
yn:selectArray[];
|
||||
};
|
||||
};
|
||||
|
||||
export type comCodeType = comCodeState & comCodeActions;
|
||||
|
||||
export const getSggCd = async (set: any) => {
|
||||
const sgg = await getFectch("common", "/addr/sgg");
|
||||
const sggCd = sgg.map((item: any) => ({
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.gugun,
|
||||
}));
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
sggCd: sggCd,
|
||||
},
|
||||
}));
|
||||
};
|
||||
export const getCityCd = async (set: any) => {
|
||||
const city = await getFectch("common", "/addr/city");
|
||||
const cityCd = city.map((item: any) => ({
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.sido,
|
||||
}));
|
||||
cityCd.unshift({val:0,text:'전체'})
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
cityCd: cityCd,
|
||||
},
|
||||
}));
|
||||
};
|
||||
|
||||
export const comCodeStateExport: comCodeState = {
|
||||
code: {
|
||||
isInit: false,
|
||||
rainFcltCd: rainFcltCd,
|
||||
bdstUsgCd: bdstUsgCd,
|
||||
chBuCd:chBuCd,
|
||||
orgwtKndCd:orgwtKndCd,
|
||||
cityCd: [],
|
||||
sggCd: [],
|
||||
yn:yn
|
||||
},
|
||||
};
|
||||
|
||||
export type comCodeActions = {
|
||||
codeInit: () => void;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
|
||||
return {
|
||||
codeInit: async () => {
|
||||
const sgg = await getFectch("common", "/addr/sgg");
|
||||
|
||||
const sggCd = sgg.map((item: any) => ({
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.gugun,
|
||||
}));
|
||||
|
||||
const city = await getFectch("common", "/addr/city");
|
||||
const cityCd = city.map((item: any) => ({
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.sido,
|
||||
}));
|
||||
|
||||
return set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
sggCd: sggCd,
|
||||
cityCd: cityCd,
|
||||
},
|
||||
}));
|
||||
},
|
||||
|
||||
divCityCd: async(cd: number) => {
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
sggCd:state.code.sggCd.filter((item) => { return Number(item.val.toString().slice(0,2)) === cd }),
|
||||
},
|
||||
}));
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,4 +1,3 @@
|
||||
'use client'
|
||||
|
||||
import { type ReactNode, createContext, useContext, useRef } from 'react'
|
||||
import { useStore } from 'zustand'
|
||||
@@ -15,12 +14,12 @@ export interface StoreProviderProps {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export const StoreProvider = ({
|
||||
export const StoreProvider = ({
|
||||
children,
|
||||
}: StoreProviderProps) => {
|
||||
const storeRef = useRef<StoreApi>(null)
|
||||
if (!storeRef.current) {
|
||||
storeRef.current = StoreZus()
|
||||
storeRef.current = StoreZus()
|
||||
}
|
||||
return (
|
||||
<StoreContext.Provider value={storeRef.current}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { selectArray } from "../rainReuseFacilityInsert";
|
||||
import type { selectArray } from "../ruseFcltMng/fcltReg/rainReg";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { text } from "stream/consumers";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const rainRegExcel =z.object({
|
||||
bdstInfoPk:z.number().default(111111111),
|
||||
chckYmd:z.date().default(new Date()),
|
||||
file: z.instanceof(File).optional()
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
export const fcltDiv=[
|
||||
{val:'RST', text:'중수도시설'},
|
||||
{val:'RNB', text:'빗물이용시설'},
|
||||
]
|
||||
|
||||
|
||||
export type chHeadType={
|
||||
headNm: string;
|
||||
text: string;
|
||||
length: number;
|
||||
}
|
||||
|
||||
export const rainHeadNm:chHeadType[] = [
|
||||
{headNm:"useQuilty", text:"이용수질(필요시)" , length: 4},
|
||||
{headNm:"feeHist", text:"과태료 부과내역" , length: 3},
|
||||
{headNm:"subWater", text:"연간보급수 이용량(m³)" , length: 13},
|
||||
{headNm:"detailQulity", text:"분기" , length: 11}
|
||||
]
|
||||
|
||||
export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "operMngCd", title: "운영관리형태" },
|
||||
{ id: "flowCheck", title: "유량측정방법" },
|
||||
{ id: "yearFee", title: "연간운영비(원/년)" },
|
||||
{ id: "rainDtnbaOpct", title: "빗물저류조용량(m³)" },
|
||||
{ id: "checkDay", title: "점검일" },
|
||||
{ id: "utztnUsg", title: "이용용도" },
|
||||
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
|
||||
{ id: "rainUsg", title: "연간빗물이용량(m³)" },
|
||||
{ id: "ph", title: "PH", upName: "useQuilty", upSequnce: 1 },
|
||||
{ id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 2 },
|
||||
{ id: "grssClfg", title: "총대장균군수", upName: "useQuilty", upSequnce: 3 },
|
||||
{ id: "etc", title: "기타", upName: "useQuilty", upSequnce: 4 },
|
||||
{ id: "dayFee", title: "부과일(위반일)", upName: "feeHist", upSequnce: 1 },
|
||||
{ id: "guilty", title: "위반사항", upName: "feeHist", upSequnce: 2 },
|
||||
{ id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
];
|
||||
|
||||
export const supWaterHeadList:TableUpperProps[] = [
|
||||
{ id: "utztnUsgTest", title: "이용용도" },
|
||||
{ id: "total", title: "계" ,upName: "subWater", upSequnce: 1 , edit:true},
|
||||
{ id: "sub1", title: "1월" , upName: "subWater", upSequnce: 2 , edit:true},
|
||||
{ id: "sub2", title: "2월", upName: "subWater", upSequnce: 3 , edit:true},
|
||||
{ id: "sub3", title: "3월", upName: "subWater", upSequnce: 4 , edit:true},
|
||||
{ id: "sub4", title: "4월", upName: "subWater", upSequnce: 5 , edit:true},
|
||||
{ id: "sub5", title: "5월", upName: "subWater", upSequnce: 6 , edit:true},
|
||||
{ id: "sub6", title: "6월", upName: "subWater", upSequnce: 7 , edit:true},
|
||||
{ id: "sub7", title: "7월", upName: "subWater", upSequnce: 8 , edit:true},
|
||||
{ id: "sub8", title: "8월", upName: "subWater", upSequnce: 9 , edit:true},
|
||||
{ id: "sub9", title: "9월", upName: "subWater", upSequnce: 10, edit:true },
|
||||
{ id: "sub10", title: "10월", upName: "subWater", upSequnce: 11 , edit:true},
|
||||
{ id: "sub11", title: "11월", upName: "subWater", upSequnce: 12 , edit:true},
|
||||
{ id: "sub12", title: "12월", upName: "subWater", upSequnce: 13 , edit:true},
|
||||
]
|
||||
|
||||
|
||||
export const rswtDetailHeadList:TableUpperProps[] = [
|
||||
{ id: "utztnUsgTest", title: "이용용도" },
|
||||
{ id: "avre", title: "평균" ,upName: "detailQulity", upSequnce: 1 , edit:true},
|
||||
{ id: "grssClfg", title: "총대장균군수" , upName: "detailQulity", upSequnce: 2 , edit:true},
|
||||
{ id: "combResdch", title: "결합잔류염소", upName: "detailQulity", upSequnce: 3 , edit:true},
|
||||
{ id: "trbt", title: "탁도", upName: "detailQulity", upSequnce: 4 , edit:true},
|
||||
{ id: "bod", title: "BOD", upName: "detailQulity", upSequnce: 5 , edit:true},
|
||||
{ id: "smll", title: "냄새", upName: "detailQulity", upSequnce: 6 , edit:true},
|
||||
{ id: "crmty", title: "색도", upName: "detailQulity", upSequnce: 7 , edit:true},
|
||||
{ id: "tn", title: "T-N", upName: "detailQulity", upSequnce: 8 , edit:true},
|
||||
{ id: "tph", title: "T-P", upName: "detailQulity", upSequnce: 9 , edit:true},
|
||||
{ id: "ph", title: "PH", upName: "detailQulity", upSequnce: 10, edit:true },
|
||||
{ id: "clIonQnt", title: "염화물", upName: "detailQulity", upSequnce: 11 , edit:true},
|
||||
]
|
||||
|
||||
|
||||
export const supWaterData =[{
|
||||
utztnUsgTest:'test',
|
||||
total:100,
|
||||
sub1:10,
|
||||
sub2:10,
|
||||
sub3:10,
|
||||
sub4:10,
|
||||
sub5:10,
|
||||
sub6:10,
|
||||
sub7:10,
|
||||
sub8:10,
|
||||
sub9:10,
|
||||
sub10:10,
|
||||
sub11:10,
|
||||
sub12:10,
|
||||
},
|
||||
{
|
||||
utztnUsgTest:'test22',
|
||||
total:10011,
|
||||
sub1:101,
|
||||
sub2:101,
|
||||
sub3:101,
|
||||
sub4:101,
|
||||
sub5:101,
|
||||
sub6:101,
|
||||
sub7:101,
|
||||
sub8:101,
|
||||
sub9:101,
|
||||
sub10:101,
|
||||
sub11:101,
|
||||
sub12:101,
|
||||
}
|
||||
]
|
||||
|
||||
type supWaterDataType ={
|
||||
utztnUsgTest:string,
|
||||
total:number,
|
||||
sub1:number,
|
||||
sub2:number,
|
||||
sub3:number,
|
||||
sub4:number,
|
||||
sub5:number,
|
||||
sub6:number,
|
||||
sub7:number,
|
||||
sub8:number,
|
||||
sub9:number,
|
||||
sub10:number,
|
||||
sub11:number,
|
||||
sub12:number,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
// { id: "cityText", title: "시도" },
|
||||
// { id: "sggText", title: "시군구" },
|
||||
// { id: "bdstNm", title: "시설명" },
|
||||
// { id: "operMngCd", title: "운영관리형태" },
|
||||
// { id: "flowCheck", title: "유량측정방법" },
|
||||
// { id: "yearFee", title: "연간운영비(원/년)" },
|
||||
// { id: "rainDtnbaOpct", title: "빗물저류조용량(m³)" },
|
||||
// { id: "checkDay", title: "점검일" },
|
||||
// { id: "utztnUsg", title: "이용용도" },
|
||||
// { id: "sub1", title: "1월" , upName: "subWater", upSequnce: 1 },
|
||||
// { id: "sub2", title: "2월", upName: "subWater", upSequnce: 2 },
|
||||
// { id: "sub3", title: "3월", upName: "subWater", upSequnce: 3 },
|
||||
// { id: "sub4", title: "4월", upName: "subWater", upSequnce: 4 },
|
||||
// { id: "sub5", title: "5월", upName: "subWater", upSequnce: 5 },
|
||||
// { id: "sub6", title: "6월", upName: "subWater", upSequnce: 6 },
|
||||
// { id: "sub7", title: "7월", upName: "subWater", upSequnce: 7 },
|
||||
// { id: "sub8", title: "8월", upName: "subWater", upSequnce: 8 },
|
||||
// { id: "sub9", title: "9월", upName: "subWater", upSequnce: 9 },
|
||||
// { id: "sub10", title: "10월", upName: "subWater", upSequnce: 10 },
|
||||
// { id: "sub11", title: "11월", upName: "subWater", upSequnce: 11 },
|
||||
// { id: "sub12", title: "12월", upName: "subWater", upSequnce: 12 },
|
||||
|
||||
// { id: "rain1", title: "1월", upName: "yearRainWater", upSequnce: 1 },
|
||||
// { id: "rain2", title: "2월", upName: "yearRainWater", upSequnce: 2 },
|
||||
// { id: "rain3", title: "3월", upName: "yearRainWater", upSequnce: 3 },
|
||||
// { id: "rain4", title: "4월", upName: "yearRainWater", upSequnce: 4 },
|
||||
// { id: "rain5", title: "5월", upName: "yearRainWater", upSequnce: 5 },
|
||||
// { id: "rain6", title: "6월", upName: "yearRainWater", upSequnce: 6 },
|
||||
// { id: "rain7", title: "7월", upName: "yearRainWater", upSequnce: 7 },
|
||||
// { id: "rain8", title: "8월", upName: "yearRainWater", upSequnce: 8 },
|
||||
// { id: "rain9", title: "9월", upName: "yearRainWater", upSequnce: 9 },
|
||||
// { id: "rain10", title: "10월", upName: "yearRainWater", upSequnce: 10 },
|
||||
// { id: "rain11", title: "11월", upName: "yearRainWater", upSequnce: 11 },
|
||||
// { id: "rain12", title: "12월", upName: "yearRainWater", upSequnce: 12 },
|
||||
|
||||
// { id: "ph", title: "PH", upName: "useQuilty", upSequnce: 1 },
|
||||
// { id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 2 },
|
||||
// { id: "grssClfg", title: "총대장균군수", upName: "useQuilty", upSequnce: 3 },
|
||||
// { id: "etc", title: "기타", upName: "useQuilty", upSequnce: 4 },
|
||||
|
||||
// { id: "dayFee", title: "부과일(위반일)", upName: "feeHist", upSequnce: 1 },
|
||||
// { id: "guilty", title: "위반사항", upName: "feeHist", upSequnce: 2 },
|
||||
// { id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
// ];
|
||||
|
||||
|
||||
export type rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList:TableUpperProps[]
|
||||
rainHeadNm:chHeadType[]
|
||||
supWaterHeadList:TableUpperProps[]
|
||||
supWaterData:supWaterDataType[]
|
||||
rswtDetailHeadList:TableUpperProps[]
|
||||
};
|
||||
};
|
||||
|
||||
type rainChkgdnActions = {
|
||||
rainChkgdnInit: (sggCd:string, searchTxt:string, flag:string) => void ;
|
||||
};
|
||||
|
||||
|
||||
export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
|
||||
|
||||
|
||||
export const rainChkgdnStateExport: rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList:rainChkgdnHeadList,
|
||||
rainHeadNm:rainHeadNm,
|
||||
supWaterHeadList:supWaterHeadList,
|
||||
supWaterData:supWaterData,
|
||||
rswtDetailHeadList:rswtDetailHeadList,
|
||||
},
|
||||
};
|
||||
|
||||
export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
|
||||
rainChkgdnInit: async(sggCd:string, searchTxt:string ,flg:string ) =>{
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { chHeadType } from "../rainChkgdn";
|
||||
|
||||
|
||||
|
||||
export const rswtHeadNm:chHeadType[] = [
|
||||
{headNm:"useQuilty", text:"연간 평균 이용수질" , length: 10},
|
||||
{headNm:"feeHist", text:"과태료 부과내역" , length: 3},
|
||||
]
|
||||
export const rswtChkgdnHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "operMngCd", title: "운영관리형태" },
|
||||
{ id: "yearFee", title: "연간운영비(원/년)" },
|
||||
{ id: "rainDtnbaOpct", title: "처리용량(m³)" },
|
||||
{ id: "checkDay", title: "점검일" },
|
||||
{id: "checkPoint", title: "채수지점"},
|
||||
{ id: "utztnUsg", title: "이용용도" },
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
|
||||
{ id: "rswtUsg", title: "연간중수도이용량(m³)" },
|
||||
|
||||
|
||||
{ id: "grssClfgUswtr", title: "총대장균군수", upName: "useQuilty", upSequnce: 1 },
|
||||
{ id: "combResdch", title: "결합잔류염소", upName: "useQuilty", upSequnce: 2 },
|
||||
{ id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 3 },
|
||||
{ id: "bod", title: "BOD", upName: "useQuilty", upSequnce: 4 },
|
||||
{ id: "smll", title: "냄새", upName: "useQuilty", upSequnce: 5 },
|
||||
{ id: "crmty", title: "색도", upName: "useQuilty", upSequnce: 6 },
|
||||
{ id: "tn", title: "T-N", upName: "useQuilty", upSequnce: 7 },
|
||||
{ id: "tph", title: "T-P", upName: "useQuilty", upSequnce: 8 },
|
||||
{ id: "ph", title: "PH", upName: "useQuilty", upSequnce: 9 },
|
||||
{ id: "clIonQnt", title: "염화물", upName: "useQuilty", upSequnce: 10 },
|
||||
|
||||
|
||||
|
||||
{ id: "dayFee", title: "부과일(위반일)", upName: "feeHist", upSequnce: 1 },
|
||||
{ id: "guilty", title: "위반사항", upName: "feeHist", upSequnce: 2 },
|
||||
{ id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
|
||||
|
||||
];
|
||||
|
||||
export type rswtChkgdnState = {
|
||||
rswtChkgdn: {
|
||||
rswtChkgdnHeadList: TableUpperProps[];
|
||||
rswtHeadNm:chHeadType[];
|
||||
};
|
||||
};
|
||||
|
||||
type rswtChkgdnActions = {
|
||||
rswtChkgdnInit: (sggCd: string, searchTxt: string, flag: string) => void;
|
||||
};
|
||||
|
||||
export type rswtChkgdnType = rswtChkgdnState & rswtChkgdnActions;
|
||||
|
||||
export const rswtChkgdnStateExport: rswtChkgdnState = {
|
||||
rswtChkgdn: {
|
||||
rswtChkgdnHeadList: rswtChkgdnHeadList,
|
||||
rswtHeadNm:rswtHeadNm
|
||||
},
|
||||
};
|
||||
|
||||
export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rswtChkgdnInit: async (sggCd: string, searchTxt: string, flg: string) => {
|
||||
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,178 +0,0 @@
|
||||
import type { TableUpperProps } from "../rainReuseFacilityInsert";
|
||||
|
||||
export type TableProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export type selectLabel={
|
||||
text:string,
|
||||
val:string
|
||||
}
|
||||
|
||||
|
||||
type publicReuseFacilityData = {
|
||||
sido: string,
|
||||
sigungo: string,
|
||||
facilityName: string,
|
||||
location: string,
|
||||
locationgubun: string,
|
||||
facilityCapacity: string,
|
||||
yn?: string,
|
||||
authoDay?: string,
|
||||
area?: string,
|
||||
reuse?: string,
|
||||
register?: string
|
||||
|
||||
|
||||
}
|
||||
type pubMngFacData = {
|
||||
mng: string,
|
||||
subCo: string,
|
||||
startDay: string,
|
||||
endDay: string,
|
||||
}
|
||||
const selectLabel:selectLabel[]=[
|
||||
{text:'test',val:'1'}
|
||||
]
|
||||
|
||||
|
||||
const pubFacHeadList:TableProps[] = [
|
||||
{ id: "sido", title: "시도"},
|
||||
{ id: "sigungo", title: "시군구"},
|
||||
{ id: "facilityName", title: "시설명"},
|
||||
{ id: "location", title: "위치"},
|
||||
{ id: "locationgubun", title: "지역구분"},
|
||||
{ id: "facilityCapacity", title: "시설용량"},
|
||||
{ id: "yn", title: '재이용여부' },
|
||||
{ id: "authoDay", title: '등록여부'}];
|
||||
|
||||
|
||||
const pubMngUpHeadList:TableUpperProps[] = [
|
||||
{ id: "mng", title: "운영방식"},
|
||||
{ id: "subCo", title: "대행업체"},
|
||||
{ id: "startDay", title: "시작일", upName:'upChangeRe' , upSequnce:1 },
|
||||
{ id: "endDay", title: "종료일", upName:'upChangeRe' , upSequnce:2 },
|
||||
];
|
||||
const date = new Date()
|
||||
const pubMngFacData:pubMngFacData[] = [
|
||||
{ mng:"자체운영", subCo:"-",startDay: '2024-11-11' ,endDay:'2024-11-20'},
|
||||
{ mng:"자체운영", subCo:"한국수자원공사",startDay: '2022-11-11' ,endDay:'2024-09-13'},
|
||||
{ mng:"자체운영", subCo:"스타벅스",startDay: '2023-11-11' ,endDay:'2024-02-19'},
|
||||
];
|
||||
const publicReuseFacilityData:publicReuseFacilityData[] = [
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
facilityName: "난지",
|
||||
location: "경기도 고양시 덕양구 대차로 4가",
|
||||
locationgubun: "500",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
register: "Y"
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
facilityName: "난지",
|
||||
location: "경기도 고양시 덕양구 대차로 4가",
|
||||
locationgubun: "500",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
register: "Y"
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
facilityName: "난지",
|
||||
location: "경기도 고양시 덕양구 대차로 4가",
|
||||
locationgubun: "500",
|
||||
facilityCapacity: "800,000",
|
||||
yn: "Y",
|
||||
authoDay: "2012",
|
||||
area:"123"
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
const erctUswtrCd:selectLabel[]=[
|
||||
{text:'처리장연계',val:'1_erct'},
|
||||
{text:'자체/연계',val:'2_erct'},
|
||||
{text:'자체처리',val:'3_erct'},
|
||||
]
|
||||
|
||||
const cyclCd :selectLabel[]= [
|
||||
{ text: "1차", val: "1_cyc" },
|
||||
{ text: "2차", val: "2_cyc" },
|
||||
];
|
||||
const seCd :selectLabel[] = [
|
||||
{ text: "신규", val: "1_Se" },
|
||||
{ text: "진행", val: "2_Se" },
|
||||
];
|
||||
const buseCd :selectLabel[]= [
|
||||
{ text: "재정", val: "1_bus" },
|
||||
{ text: "만루", val: "2_bus" },
|
||||
];
|
||||
const rprcsCd :selectLabel[] = [
|
||||
{ text: "물리적처리", val: "1_rprc" },
|
||||
{ text: "생물학적처리", val: "2_rprc" },
|
||||
];
|
||||
const buseMet :selectLabel[] = [
|
||||
{ text: "재정", val: "1_busemet" },
|
||||
{ text: "민간투자", val: "2_busemet" },
|
||||
{ text: "자체", val: "3_busemet" },
|
||||
];
|
||||
const rprcLoCd :selectLabel[] = [
|
||||
{ text: "내부", val: "1_rprc" },
|
||||
{ text: "외부", val: "2_rprc" },
|
||||
];
|
||||
|
||||
export type pubFacState = {pubFac:{
|
||||
isInit: boolean;
|
||||
pubFacHeadList: TableProps[];
|
||||
pubMngUpHeadList:TableUpperProps[]
|
||||
publicReuseFacilityData: publicReuseFacilityData[];
|
||||
selectLabel:selectLabel[];
|
||||
pubMngFacData:pubMngFacData[];
|
||||
erctUswtrCd:selectLabel[];
|
||||
cyclCd:selectLabel[];
|
||||
seCd:selectLabel[];
|
||||
buseCd :selectLabel[]
|
||||
rprcsCd :selectLabel[]
|
||||
buseMet :selectLabel[]
|
||||
rprcLoCd:selectLabel[]
|
||||
}}
|
||||
type pubFacActions = {
|
||||
decrementList: () => void
|
||||
}
|
||||
|
||||
export type pubFacType = pubFacState & pubFacActions;
|
||||
|
||||
export const pubFacStateExport:pubFacState= {pubFac:{
|
||||
isInit:false,
|
||||
pubFacHeadList: pubFacHeadList,
|
||||
pubMngUpHeadList:pubMngUpHeadList,
|
||||
publicReuseFacilityData: publicReuseFacilityData,
|
||||
selectLabel:selectLabel,
|
||||
pubMngFacData:pubMngFacData,
|
||||
erctUswtrCd:erctUswtrCd,
|
||||
cyclCd:cyclCd,
|
||||
seCd:seCd,
|
||||
buseCd:buseCd,
|
||||
rprcsCd:rprcsCd,
|
||||
buseMet:buseMet,
|
||||
rprcLoCd:rprcLoCd
|
||||
}}
|
||||
export const pubFacActionsExport:(set:any)=>pubFacActions=(set: any) => {
|
||||
return {
|
||||
decrementList:()=>set(
|
||||
(state:pubFacState) => {
|
||||
return (
|
||||
{pubFac:{
|
||||
pubFacheadList: state.pubFac.pubFacHeadList,
|
||||
publicReuseFacilityUper:
|
||||
state.pubFac.publicReuseFacilityData.slice(0, state.pubFac.publicReuseFacilityData.length - 1)
|
||||
}})}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
|
||||
export type TableUpperProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
}
|
||||
export type rainFacOfType = {
|
||||
sido: string,
|
||||
sigungo: string,
|
||||
facilityName: string,
|
||||
location: string,
|
||||
locationgubun: string,
|
||||
firstConstructionPermission:string,
|
||||
facilityCapacity: string,
|
||||
buildingArea:string,
|
||||
yn?: string,
|
||||
permissionDay:string;
|
||||
authoDay?: string,
|
||||
area?: string,
|
||||
reuse?: string,
|
||||
register?: string,
|
||||
legalTargetYn:string,
|
||||
}
|
||||
|
||||
export const upHeadList:TableUpperProps[] = [
|
||||
{ id: "sido", title: "시도"},
|
||||
{ id: "sigungo", title: "시군구"},
|
||||
{ id: "facilityName", title: "시설명"},
|
||||
{ id: "location", title: "위치"},
|
||||
{ id: "locationgubun", title: "지역구분"},
|
||||
{ id: "facilityCapacity", title: "시설용량"},
|
||||
{ id: "yn", title: '여부', upName:'upChangeRe' , upSequnce:1 },
|
||||
{ id: "authoDay", title: '허가일',upName:'upChangeRe', upSequnce:2 },
|
||||
{ id: "area", title: '면적' ,upName:'upChangeRe',upSequnce:3 }];
|
||||
|
||||
const rainOfObject:rainFacOfType[] = [
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "종로구",
|
||||
facilityName: "그랑서울",
|
||||
location: "종로 33",
|
||||
locationgubun: "업무시설",
|
||||
firstConstructionPermission : '2024-10-10',
|
||||
buildingArea: "50",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
permissionDay:'2024-10-10',
|
||||
register: "Y",
|
||||
legalTargetYn:"Y"
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "종로구",
|
||||
facilityName: "그랑서울",
|
||||
location: "종로 33",
|
||||
locationgubun: "업무시설",
|
||||
firstConstructionPermission : '2024-10-10',
|
||||
buildingArea: "50",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
permissionDay:'2024-10-10',
|
||||
register: "Y",
|
||||
legalTargetYn:"Y"
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "종로구",
|
||||
facilityName: "그랑서울",
|
||||
location: "종로 33",
|
||||
locationgubun: "업무시설",
|
||||
firstConstructionPermission : '2024-10-10',
|
||||
buildingArea: "50",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
permissionDay:'2024-10-10',
|
||||
register: "Y",
|
||||
legalTargetYn:"Y"
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
export type selectArray ={
|
||||
text:string,
|
||||
val:string
|
||||
|
||||
}
|
||||
|
||||
export const selectClass ="w-full h-full text-2xl";
|
||||
const selectHomeWater = [
|
||||
{ text: '집수면', val: "1" },
|
||||
{ text: "종류", val: "2" },
|
||||
];
|
||||
|
||||
const selectYN= [
|
||||
{ text: 'Y', val: "1" },
|
||||
{ text: 'N', val: "2" },
|
||||
];
|
||||
|
||||
export type rainFacState ={ rain:{
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
rainOfObject: rainFacOfType[];
|
||||
selectHomeWater:selectArray[];
|
||||
selectYN:selectArray[];
|
||||
}}
|
||||
type rainFacSActions = {
|
||||
decrementList: () => void
|
||||
}
|
||||
|
||||
export type rainFacType = rainFacState & rainFacSActions;
|
||||
|
||||
export const rainFacStateExport:rainFacState= {rain:{
|
||||
isInit:false,
|
||||
upHeadList: upHeadList,
|
||||
rainOfObject: rainOfObject,
|
||||
selectHomeWater:selectHomeWater,
|
||||
selectYN:selectYN
|
||||
|
||||
|
||||
}}
|
||||
export const rainFacActionsExport:(set:any)=>rainFacSActions=(set: any) => {
|
||||
return {
|
||||
decrementList:()=>set(
|
||||
(state:rainFacState) => {
|
||||
return (
|
||||
{rain:{
|
||||
upHeadList: state.rain.upHeadList,
|
||||
rainOfObject:
|
||||
state.rain.rainOfObject.slice(0, state.rain.rainOfObject.length - 1)
|
||||
}})}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
import { upHeadList, type rainFacOfType, type selectArray, type TableUpperProps } from "../rainReuseFacilityInsert";
|
||||
|
||||
|
||||
const rswtOfObject:rainFacOfType[] = [
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "종로구",
|
||||
facilityName: "그랑서울",
|
||||
location: "종로 33",
|
||||
locationgubun: "업무시설",
|
||||
firstConstructionPermission : '2024-10-10',
|
||||
buildingArea: "50",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
permissionDay:'2024-10-10',
|
||||
register: "Y",
|
||||
legalTargetYn:"Y"
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "종로구",
|
||||
facilityName: "그랑서울",
|
||||
location: "종로 33",
|
||||
locationgubun: "업무시설",
|
||||
firstConstructionPermission : '2024-10-10',
|
||||
buildingArea: "50",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
permissionDay:'2024-10-10',
|
||||
register: "Y",
|
||||
legalTargetYn:"Y"
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "종로구",
|
||||
facilityName: "그랑서울",
|
||||
location: "종로 33",
|
||||
locationgubun: "업무시설",
|
||||
firstConstructionPermission : '2024-10-10',
|
||||
buildingArea: "50",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
permissionDay:'2024-10-10',
|
||||
register: "Y",
|
||||
legalTargetYn:"Y"
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
const selectHomeWater = [
|
||||
{ text: '집수면', val: "1" },
|
||||
{ text: "종류", val: "2" },
|
||||
];
|
||||
|
||||
const selectYN= [
|
||||
{ text: 'Y', val: "1" },
|
||||
{ text: 'N', val: "2" },
|
||||
];
|
||||
|
||||
export type rswtFacState ={ rswt:{
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
rswtOfObject: rainFacOfType[];
|
||||
selectHomeWater:selectArray[];
|
||||
selectYN:selectArray[];
|
||||
}}
|
||||
type rswtFacSActions = {
|
||||
decrementList: () => void
|
||||
}
|
||||
|
||||
export type rswtFacType = rswtFacState & rswtFacSActions;
|
||||
|
||||
export const rswtFacStateExport:rswtFacState= {rswt:{
|
||||
isInit:false,
|
||||
upHeadList: upHeadList,
|
||||
rswtOfObject: rswtOfObject,
|
||||
selectHomeWater:selectHomeWater,
|
||||
selectYN:selectYN
|
||||
|
||||
|
||||
}}
|
||||
export const rswtFacActionsExport:(set:any)=>rswtFacSActions=(set: any) => {
|
||||
return {
|
||||
decrementList:()=>set(
|
||||
(state:rswtFacState) => {
|
||||
return (
|
||||
{rain:{
|
||||
upHeadList: state.rswt.upHeadList,
|
||||
rainOfObject:
|
||||
state.rswt.rswtOfObject.slice(0, state.rswt.rswtOfObject.length - 1)
|
||||
}})}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import { getFectch } from "@/components/lib/api";
|
||||
import type { bdstAll } from "../rainReg";
|
||||
import type { TableProps } from "../pbnstReg";
|
||||
|
||||
type TableUpperProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
};
|
||||
const moUpHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "daddr", title: "위치" },
|
||||
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
|
||||
{ id: "archArea", title: "건축면적", },
|
||||
{ id: "archChgYn", title: "여부", upName: "upChangeRe", upSequnce: 1 },
|
||||
{ id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 },
|
||||
{ id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
|
||||
];
|
||||
|
||||
|
||||
const bdstChgHeadList: TableProps[] = [
|
||||
{ id: "bdstChgNm", title: "구분" },
|
||||
{ id: "archChgPrmsnDt", title: "허가일" },
|
||||
{ id: "archChgArea", title: "변경면적" },
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
const bdstBase: bdstAll[] = [];
|
||||
|
||||
|
||||
|
||||
export type bdstFulType = bdstState & bdstActions;
|
||||
|
||||
|
||||
export type bdstState = {
|
||||
bdst: {
|
||||
bdstBase: any[];
|
||||
moUpHeadList:TableUpperProps[]
|
||||
bdstChgHeadList:TableProps[]
|
||||
};
|
||||
};
|
||||
|
||||
type bdstActions = {
|
||||
findBdst: (sggCd:string, searchTxt:string, flag:string) => void ;
|
||||
};
|
||||
|
||||
|
||||
const findBdstInfo = async(sggCd:string, searchTxt:string ,flg:string)=>{
|
||||
return await getFectch('wr', `/reuseFc/building/${flg}/${sggCd}`+(searchTxt?`/${searchTxt}`:'' ))
|
||||
|
||||
}
|
||||
|
||||
export const bdstStateExport: bdstState = {
|
||||
bdst: {
|
||||
bdstBase: bdstBase, // Updated to match the array type
|
||||
moUpHeadList:moUpHeadList,
|
||||
bdstChgHeadList:bdstChgHeadList,
|
||||
},
|
||||
};
|
||||
|
||||
export const bdstActionsExport: (set: any) => bdstActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
|
||||
findBdst: async(sggCd:string, searchTxt:string ,flg:string ) =>{
|
||||
try{
|
||||
|
||||
const bdst = await findBdstInfo(sggCd, searchTxt, flg);
|
||||
const makeBdst = bdst.map((item:any) => {
|
||||
return {
|
||||
...item,
|
||||
reuseBuilding:[]
|
||||
};
|
||||
})
|
||||
return set((state:bdstState) =>({
|
||||
...state,
|
||||
bdst:{
|
||||
...state.bdst,
|
||||
bdstBase:makeBdst
|
||||
}
|
||||
|
||||
}))
|
||||
}catch(error1){
|
||||
console.log("error ", error1)
|
||||
|
||||
}finally{
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,271 @@
|
||||
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
export const hdtflZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(" "),
|
||||
bdstNm: z.string().default(" "),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
archChgPrmsnDt: z.date().default(() => new Date()).nullish() ,
|
||||
archArea: z.number().default(0),
|
||||
archChgArea: z.number().nullish().default(0),
|
||||
|
||||
reuseBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().nullish().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().nullish().default(0),
|
||||
grntchBdstCertYn: z.string().default(""),
|
||||
grntchBdstCertYr: z
|
||||
.string()
|
||||
.nullish(),
|
||||
grntchBdstCertNo: z.string().nullish().default(""),
|
||||
grntchBdstCertGrd: z.string().nullish().default(""),
|
||||
crgRdctYn: z.string().default(""),
|
||||
crgRdctBss: z.string().nullish().default(""),
|
||||
crgRdctAmt: z.number().nullish().default(0),
|
||||
ruseFcltFlg: z.string().nullish().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default(""),
|
||||
|
||||
// htdflObj 매핑
|
||||
htdflObj: z
|
||||
.object({
|
||||
htdflFcltPk: z.number().nullish(),
|
||||
bdstRuseFcltFk: z.number().nullish(),
|
||||
etgtType: z.string().default(""),
|
||||
fclCpct: z.number().default(0),
|
||||
plwtYn: z.string().default(""),
|
||||
orgwtWtritSpt: z.number().default(0),
|
||||
orgwtOcrnProcs: z.string().default(""),
|
||||
wtritEntrcTp: z.number().max(4, "온도는 100이상이 될 수 없습니다.")
|
||||
.default(0),
|
||||
amtgnr: z.number().default(0),
|
||||
prcsProcsYn: z.string().default(""),
|
||||
prcsFcltCpct: z.number().default(0),
|
||||
fmYn: z.string().default(""),
|
||||
utztnCpct: z.number().default(0),
|
||||
utztnUsg: z.string().default(""),
|
||||
grssClfg: z.number().default(0),
|
||||
combResdch: z.number().default(0),
|
||||
trbt: z.number().default(0),
|
||||
bod: z.number().default(0),
|
||||
smll: z.number().default(0),
|
||||
crmty: z.number().default(0),
|
||||
tn: z.number().default(0),
|
||||
tph: z.number().default(0),
|
||||
ph: z.number().default(0),
|
||||
clIonQnt: z.number().default(0),
|
||||
cdtnv: z.number().default(0),
|
||||
emsnExitTp: z.number().default(0),
|
||||
})
|
||||
.default({}),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
chgBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date() ,
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
});
|
||||
|
||||
export type customHtdflBdst = Omit<bdstAll, 'reuseBuilding'> & {
|
||||
reuseBuilding: htdflReuseBuilding[];
|
||||
};
|
||||
|
||||
//export type customHtdflBdst = z.infer<typeof hdtflZod>;
|
||||
|
||||
// 타입을 조드로 만들어가 하는ㅓㄹ로 테트
|
||||
export type htdflReuseBuilding = {
|
||||
bdstRuseFcltPk: number | undefined;
|
||||
bdstInfoFk: number | undefined;
|
||||
instlCmptnDt: Date | undefined;
|
||||
instlCst: number | undefined;
|
||||
operMngCd: string;
|
||||
anlOperCst: number | undefined;
|
||||
instlCstSprtYn: string | undefined;
|
||||
instlCstSprtAmt: number | undefined;
|
||||
grntchBdstCertYn: string | undefined;
|
||||
grntchBdstCertYr: string | undefined;
|
||||
grntchBdstCertNo: string | undefined;
|
||||
grntchBdstCertGrd: string | undefined;
|
||||
crgRdctYn: string;
|
||||
crgRdctBss: string | undefined;
|
||||
crgRdctAmt: number | undefined;
|
||||
ruseFcltFlg: string;
|
||||
bdstUsgCd: number | undefined;
|
||||
lawTrgtYn: string;
|
||||
htdflObj: htdflObj;
|
||||
};
|
||||
|
||||
export type htdflObj = {
|
||||
htdflFcltPk: number;
|
||||
bdstRuseFcltFk: number;
|
||||
etgtType: string;
|
||||
fclCpct: number | undefined;
|
||||
plwtYn: string;
|
||||
orgwtWtritSpt: number | undefined;
|
||||
orgwtOcrnProcs: string;
|
||||
wtritEntrcTp: number | undefined;
|
||||
amtgnr: number | undefined;
|
||||
prcsProcsYn: string;
|
||||
prcsFcltCpct: number | undefined;
|
||||
fmYn: string;
|
||||
utztnCpct: number | undefined;
|
||||
utztnUsg: string;
|
||||
grssClfg: number | undefined;
|
||||
combResdch: number | undefined;
|
||||
trbt: number | undefined;
|
||||
bod: number | undefined;
|
||||
smll: number | undefined;
|
||||
crmty: number | undefined;
|
||||
tn: number | undefined;
|
||||
tph: number | undefined;
|
||||
ph: number | undefined;
|
||||
clIonQnt: number | undefined;
|
||||
cdtnv: number | undefined;
|
||||
emsnExitTp: number | undefined;
|
||||
};
|
||||
|
||||
export type htdflFacState = {
|
||||
htdfl: {
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
htdflRes: customHtdflBdst[];
|
||||
};
|
||||
};
|
||||
type htdflFacSActions = {
|
||||
initHtdfl: (txt: string | undefined) => void;
|
||||
htdflUpdate:(data: customHtdflBdst) => void;
|
||||
htdflReg:(data: customHtdflBdst) => void;
|
||||
};
|
||||
|
||||
const htdflRes: customHtdflBdst[] = [];
|
||||
|
||||
export type htdflFacType = htdflFacState & htdflFacSActions;
|
||||
|
||||
export const htdflFacStateExport: htdflFacState = {
|
||||
htdfl: {
|
||||
isInit: false,
|
||||
upHeadList: upHeadList,
|
||||
htdflRes: htdflRes,
|
||||
},
|
||||
};
|
||||
|
||||
const initFetch = async (txt: string | undefined) => {
|
||||
const htdflRes = await getFectch(
|
||||
"wr",
|
||||
`/drain/facilityList/1/20/0` + (txt ? `/${txt}` : "")
|
||||
);
|
||||
const chHtdflRes = htdflRes.map((item: customHtdflBdst) => {
|
||||
return {
|
||||
...item,
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
};
|
||||
});
|
||||
return chHtdflRes;
|
||||
};
|
||||
export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
initHtdfl: async (txt: string | undefined) => {
|
||||
try {
|
||||
const htdflRes = await initFetch(txt);
|
||||
set((state: htdflFacState) => {
|
||||
return {
|
||||
...state,
|
||||
htdfl: {
|
||||
...state.htdfl,
|
||||
htdflRes: htdflRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
htdflUpdate: async (data: customHtdflBdst) => {
|
||||
try {
|
||||
const res = await putFectch("/drain/facility", data);
|
||||
if (res.ok) {
|
||||
alert(" 수정이 완료되었습니다.");
|
||||
}
|
||||
|
||||
const htdflRes = await initFetch(undefined);
|
||||
set((state: htdflFacState) => ({
|
||||
...state,
|
||||
htdfl: {
|
||||
...state.htdfl,
|
||||
htdflRes: htdflRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (errorUpdate) {
|
||||
alert(
|
||||
"업데이트 오류입니다. " +
|
||||
(errorUpdate instanceof Error ? errorUpdate.message : "")
|
||||
);
|
||||
}
|
||||
},
|
||||
htdflReg: async (data: customHtdflBdst) => {
|
||||
try {
|
||||
const res = await postFectch("/drain/facility", data);
|
||||
if (res.ok) {
|
||||
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res
|
||||
.json()
|
||||
.then((resData: any) => {
|
||||
const chPK = resData?.data?.bdstInfoPk;
|
||||
const makeCh = resData.data.chgBuilding.map(
|
||||
(item: chgBuilding) => ({
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch = postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
})
|
||||
.then((chch: any) => {
|
||||
if (chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
const htdflRes = await initFetch(undefined);
|
||||
set((state: htdflFacState) => ({
|
||||
...state,
|
||||
htdfl: {
|
||||
...state.htdfl,
|
||||
htdflRes: htdflRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (errorReg) {
|
||||
alert("등록 오류입니다.");
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,258 @@
|
||||
import type { TableUpperProps } from "../rainReg";
|
||||
|
||||
export type TableProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
};
|
||||
|
||||
export type selectLabel = {
|
||||
text: string;
|
||||
val: string;
|
||||
};
|
||||
|
||||
export type publicReuseFacilityType = {
|
||||
sido: string;
|
||||
sigungo: string;
|
||||
facilityName: string;
|
||||
location: string;
|
||||
locationgubun: string;
|
||||
facilityCapacity: string;
|
||||
yn?: string;
|
||||
authoDay?: string;
|
||||
area?: string;
|
||||
reuse?: string;
|
||||
register?: string;
|
||||
swtrmtFcltFk: string;
|
||||
};
|
||||
export type fcltOperInfoType = {
|
||||
mng: string;
|
||||
subCo: string;
|
||||
startDay: string;
|
||||
endDay: string;
|
||||
pbnstRuseFcltPk: string;
|
||||
};
|
||||
|
||||
export type ruseFcltType = {
|
||||
swtrmtFcltFk: string;
|
||||
pbnstRuseFcltPk:string;
|
||||
fcltNm:string;
|
||||
fcltCpct: number;
|
||||
swtrmtCpct: number;
|
||||
ruseCpct:number;
|
||||
splyExtraCpct:number;
|
||||
};
|
||||
const selectLabel: selectLabel[] = [{ text: "test", val: "1" }];
|
||||
|
||||
const pubFacHeadList: TableProps[] = [
|
||||
{ id: "sido", title: "시도" },
|
||||
{ id: "sigungo", title: "시군구" },
|
||||
{ id: "facilityName", title: "시설명" },
|
||||
{ id: "location", title: "위치" },
|
||||
{ id: "locationgubun", title: "지역구분" },
|
||||
{ id: "facilityCapacity", title: "시설용량" },
|
||||
{ id: "yn", title: "재이용여부" },
|
||||
{ id: "authoDay", title: "등록여부" },
|
||||
];
|
||||
|
||||
const ruseFclt: ruseFcltType[] = [
|
||||
{ swtrmtFcltFk: "a", fcltCpct: 1000000, swtrmtCpct: 1000000 ,pbnstRuseFcltPk:'aa',fcltNm:'하수1',ruseCpct: 1, splyExtraCpct: 2 },
|
||||
{ swtrmtFcltFk: "a", fcltCpct: 1300000, swtrmtCpct: 1300000 ,pbnstRuseFcltPk:'ab',fcltNm:'하수2',ruseCpct: 3, splyExtraCpct: 4 },
|
||||
|
||||
{ swtrmtFcltFk: "b", fcltCpct: 2000000, swtrmtCpct: 2000000 ,pbnstRuseFcltPk:'bb',fcltNm:'재이용1',ruseCpct: 1, splyExtraCpct: 2 },
|
||||
{ swtrmtFcltFk: "b", fcltCpct: 2300000, swtrmtCpct: 2300000 ,pbnstRuseFcltPk:'ba',fcltNm:'재이용2' ,ruseCpct: 3, splyExtraCpct: 4 },
|
||||
];
|
||||
const pubMngUpHeadList: TableUpperProps[] = [
|
||||
{ id: "mng", title: "운영방식" },
|
||||
{ id: "subCo", title: "대행업체" },
|
||||
{ id: "startDay", title: "시작일", upName: "upChangeRe", upSequnce: 1 },
|
||||
{ id: "endDay", title: "종료일", upName: "upChangeRe", upSequnce: 2 },
|
||||
];
|
||||
const date = new Date();
|
||||
const fcltOperInfo: fcltOperInfoType[] = [
|
||||
{
|
||||
mng: "자체운영",
|
||||
subCo: "-",
|
||||
startDay: "2024-11-11",
|
||||
endDay: "2024-11-20",
|
||||
pbnstRuseFcltPk: "aa",
|
||||
},
|
||||
{
|
||||
mng: "자체운영",
|
||||
subCo: "한국수자원공사",
|
||||
startDay: "2022-11-11",
|
||||
endDay: "2024-09-13",
|
||||
pbnstRuseFcltPk: "aa",
|
||||
},
|
||||
{
|
||||
mng: "자체운영",
|
||||
subCo: "스타벅스",
|
||||
startDay: "2023-11-11",
|
||||
endDay: "2024-02-19",
|
||||
pbnstRuseFcltPk: "bb",
|
||||
},
|
||||
];
|
||||
const publicReuseFacilityData: publicReuseFacilityType[] = [
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
facilityName: "난지",
|
||||
location: "경기도 고양시 덕양구 대차로 4가",
|
||||
locationgubun: "500",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
register: "Y",
|
||||
swtrmtFcltFk: "a",
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
facilityName: "여의도 중앙",
|
||||
location: "경기도 고양시 덕양구 대차로 4가",
|
||||
locationgubun: "500",
|
||||
facilityCapacity: "800,000",
|
||||
reuse: "Y",
|
||||
register: "Y",
|
||||
swtrmtFcltFk: "b",
|
||||
},
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
facilityName: "너의 마음속",
|
||||
location: "경기도 고양시 덕양구 대차로 4가",
|
||||
locationgubun: "500",
|
||||
facilityCapacity: "800,000",
|
||||
yn: "Y",
|
||||
authoDay: "2012",
|
||||
area: "123",
|
||||
swtrmtFcltFk: "c",
|
||||
},
|
||||
];
|
||||
|
||||
const erctUswtrCd: selectLabel[] = [
|
||||
{ text: "처리장연계", val: "1_erct" },
|
||||
{ text: "자체/연계", val: "2_erct" },
|
||||
{ text: "자체처리", val: "3_erct" },
|
||||
];
|
||||
|
||||
|
||||
const cyclCd: selectLabel[] = [
|
||||
{ text: "1차", val: "1_cyc" },
|
||||
{ text: "2차", val: "2_cyc" },
|
||||
];
|
||||
const seCd: selectLabel[] = [
|
||||
{ text: "신규", val: "1_Se" },
|
||||
{ text: "진행", val: "2_Se" },
|
||||
];
|
||||
const buseCd: selectLabel[] = [
|
||||
{ text: "재정", val: "1_bus" },
|
||||
{ text: "만루", val: "2_bus" },
|
||||
];
|
||||
const rprcsCd: selectLabel[] = [
|
||||
{ text: "물리적처리", val: "1_rprc" },
|
||||
{ text: "생물학적처리", val: "2_rprc" },
|
||||
];
|
||||
const buseMet: selectLabel[] = [
|
||||
{ text: "재정", val: "1_busemet" },
|
||||
{ text: "민간투자", val: "2_busemet" },
|
||||
{ text: "자체", val: "3_busemet" },
|
||||
];
|
||||
const rprcLoCd: selectLabel[] = [
|
||||
{ text: "내부", val: "1_rprc" },
|
||||
{ text: "외부", val: "2_rprc" },
|
||||
];
|
||||
|
||||
export type pubFacState = {
|
||||
pubFac: {
|
||||
isInit: boolean;
|
||||
pubFacHeadList: TableProps[];
|
||||
pubMngUpHeadList: TableUpperProps[];
|
||||
publicReuseFacilityData: publicReuseFacilityType[];
|
||||
selectLabel: selectLabel[];
|
||||
erctUswtrCd: selectLabel[];
|
||||
cyclCd: selectLabel[];
|
||||
seCd: selectLabel[];
|
||||
buseCd: selectLabel[];
|
||||
rprcsCd: selectLabel[];
|
||||
buseMet: selectLabel[];
|
||||
rprcLoCd: selectLabel[];
|
||||
|
||||
ruseFclt:ruseFcltType[];
|
||||
};
|
||||
pubMng:{
|
||||
//isInit:boolean;
|
||||
fcltOperInfo: fcltOperInfoType[];
|
||||
ruseFclt:ruseFcltType[];
|
||||
}
|
||||
};
|
||||
type pubFacActions = {
|
||||
decrementList: () => void;
|
||||
mngMainValue:(swtrmtFcltFk:string)=> void;
|
||||
mngTableValue:(swtrmtFcltFk:string)=> void;
|
||||
};
|
||||
|
||||
export type pubFacType = pubFacState & pubFacActions;
|
||||
|
||||
export const pubFacStateExport: pubFacState = {
|
||||
pubFac: {
|
||||
isInit: false,
|
||||
pubFacHeadList: pubFacHeadList,
|
||||
pubMngUpHeadList: pubMngUpHeadList,
|
||||
publicReuseFacilityData: publicReuseFacilityData,
|
||||
selectLabel: selectLabel,
|
||||
erctUswtrCd: erctUswtrCd,
|
||||
cyclCd: cyclCd,
|
||||
seCd: seCd,
|
||||
buseCd: buseCd,
|
||||
rprcsCd: rprcsCd,
|
||||
buseMet: buseMet,
|
||||
rprcLoCd: rprcLoCd,
|
||||
ruseFclt:ruseFclt,
|
||||
},
|
||||
pubMng:{
|
||||
// isInit: false,
|
||||
fcltOperInfo: fcltOperInfo,
|
||||
ruseFclt:ruseFclt
|
||||
}
|
||||
};
|
||||
export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
return {
|
||||
decrementList: () =>
|
||||
set((state: pubFacState) => {
|
||||
return {
|
||||
pubFac: {
|
||||
pubFacheadList: state.pubFac.pubFacHeadList,
|
||||
publicReuseFacilityUper: state.pubFac.publicReuseFacilityData.slice(
|
||||
0,
|
||||
state.pubFac.publicReuseFacilityData.length - 1
|
||||
),
|
||||
},
|
||||
};
|
||||
}),
|
||||
mngMainValue:(swtrmtFcltFk:string)=>
|
||||
set((state:pubFacState)=>{
|
||||
return{
|
||||
|
||||
pubMng:{
|
||||
...state.pubMng,
|
||||
ruseFclt:state.pubMng.ruseFclt.filter((item)=>
|
||||
|
||||
item.swtrmtFcltFk===swtrmtFcltFk
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
}),
|
||||
mngTableValue:(pbnstRuseFcltPk:string)=>
|
||||
set((state:pubFacState)=>{
|
||||
return{
|
||||
pubMng:{
|
||||
...state.pubMng,
|
||||
fcltOperInfo:state.pubMng.fcltOperInfo.filter((item)=>item.pbnstRuseFcltPk===pbnstRuseFcltPk)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,363 @@
|
||||
import type { selectArray } from "@/app/store/common/code";
|
||||
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
export const rainZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
archChgPrmsnDt: z.coerce.date().nullish().default(null),
|
||||
archArea: z.number().default(0),
|
||||
archChgArea: z.number().default(0),
|
||||
|
||||
reuseBuilding: z.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk:z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().default(0),
|
||||
grntchBdstCertYn: z.string().default(""),
|
||||
grntchBdstCertYr: z.string()
|
||||
.max(4, "4자리 연도를 입력하세요")
|
||||
.regex(/^\d{4}$/, "4자리 연도를 입력하세요")
|
||||
.default(""),
|
||||
grntchBdstCertNo: z.string().default(""),
|
||||
grntchBdstCertGrd: z.string().default(""),
|
||||
crgRdctYn: z.string().default("").nullish(),
|
||||
crgRdctBss: z.string().default("").nullish(),
|
||||
crgRdctAmt: z.number().default(0),
|
||||
ruseFcltFlg: z.string().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default(""),
|
||||
|
||||
rainyObj: z.object({
|
||||
bdstReuseFcltFk: z.number().nullish(),
|
||||
pntfColKnd: z.string().default(""),
|
||||
pntfColArea: z.number().default(0),
|
||||
dtfcltCpct: z.number().default(0),
|
||||
filtrTrtmfctCpct: z.number().default(0),
|
||||
filtrTrtmfctYn: z.string().default(""),
|
||||
filtrTrtmfctPrs: z.string().default(""),
|
||||
annRnwtQty: z.number().default(0),
|
||||
oilqMeasMthd: z.string().default("").nullish()
|
||||
}).default({})
|
||||
})
|
||||
).default([]),
|
||||
|
||||
chgBuilding: z.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date(),
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
).default([])
|
||||
});
|
||||
|
||||
|
||||
|
||||
export type chgBuilding={
|
||||
bdstInfoFk: number|null,
|
||||
archChgPrmsnDt: Date,
|
||||
archChgArea: string,
|
||||
bdstChgNm: string
|
||||
}
|
||||
|
||||
|
||||
export type bdstAll = {
|
||||
bdstInfoPk: number|null;
|
||||
ctpvCd: number;
|
||||
sggCd: number;
|
||||
bdstNm: string;
|
||||
daddr: string;
|
||||
frstArchPrmsnDt: Date;
|
||||
archArea: string;
|
||||
archChgArea: number;
|
||||
reuseBuilding: rainReuseBuilding[];
|
||||
chgBuilding:chgBuilding[]
|
||||
};
|
||||
|
||||
export type customRainBdst = Omit<bdstAll, 'reuseBuilding'> & {
|
||||
reuseBuilding: rainReuseBuilding[];
|
||||
};
|
||||
|
||||
|
||||
export type rainReuseBuilding = {
|
||||
lawTrgtYn: string|undefined;
|
||||
bdstUsgCd: number|undefined;
|
||||
bdstRuseFcltPk: number;
|
||||
bdstInfoFk: number;
|
||||
operMngCd: number;
|
||||
anlOperCst: number;
|
||||
instlCmptnDt: Date|undefined;
|
||||
instlCst: number|undefined;
|
||||
//archChgPrmsnDt: string;
|
||||
instlCstSprtYn: string|undefined;
|
||||
instlCstSprtAmt: number|undefined;
|
||||
grntchBdstCertYn: string|undefined;
|
||||
grntchBdstCertNo: string|undefined;
|
||||
grntchBdstCertGrd: string|undefined;
|
||||
grntchBdstCertYr: string|undefined;
|
||||
rainyObj: rainyObj | null;
|
||||
};
|
||||
export type rainyObj = {
|
||||
bdstReuseFcltFk: number;
|
||||
pntfColKnd: string | undefined;
|
||||
pntfColArea: number | undefined;
|
||||
dtfcltCpct: number;
|
||||
filtrTrtmfctCpct: number | undefined;
|
||||
filtrTrtmfctYn: string | undefined;
|
||||
filtrTrtmfctPrs: string | undefined;
|
||||
annRnwtQty: number;
|
||||
oilqMeasMthd: string | undefined;
|
||||
};
|
||||
|
||||
export type TableUpperProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
edit?:boolean;
|
||||
visible?:boolean;
|
||||
};
|
||||
|
||||
|
||||
export const upHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "daddr", title: "위치" },
|
||||
{ id: "bdsgUsgText", title: "건축물용도" },
|
||||
// { id: "bdstUsgCd", title: "건축물용도" },
|
||||
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
|
||||
{ id: "archArea", title: "건축면적" },
|
||||
{ id: "lawTrgtYn", title: "법적의무대상여부" },
|
||||
{ id: "bdstChgYn", title: "건축물변경여부" },
|
||||
// { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 },
|
||||
// { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
|
||||
];
|
||||
|
||||
const rainRes: customRainBdst[] = [];
|
||||
|
||||
|
||||
const regRainForm:customRainBdst = {
|
||||
ctpvCd: 0,
|
||||
sggCd: 0,
|
||||
bdstNm: "",
|
||||
daddr: "",
|
||||
frstArchPrmsnDt:new Date(),
|
||||
archArea: "",
|
||||
archChgArea: 0,
|
||||
bdstInfoPk: 0,
|
||||
reuseBuilding: [{
|
||||
rainyObj: {
|
||||
bdstReuseFcltFk: 0,
|
||||
pntfColKnd: undefined,
|
||||
pntfColArea: undefined,
|
||||
dtfcltCpct: 0,
|
||||
filtrTrtmfctCpct: undefined,
|
||||
filtrTrtmfctYn: undefined,
|
||||
filtrTrtmfctPrs: undefined,
|
||||
annRnwtQty: 0,
|
||||
oilqMeasMthd: undefined
|
||||
},
|
||||
lawTrgtYn: undefined,
|
||||
bdstUsgCd: undefined,
|
||||
bdstRuseFcltPk: 0,
|
||||
bdstInfoFk: 0,
|
||||
operMngCd: 0,
|
||||
anlOperCst: 0,
|
||||
instlCmptnDt: undefined,
|
||||
instlCst: undefined,
|
||||
// archChgPrmsnDt: "",
|
||||
instlCstSprtYn: undefined,
|
||||
instlCstSprtAmt: undefined,
|
||||
grntchBdstCertYn: undefined,
|
||||
grntchBdstCertNo: undefined,
|
||||
grntchBdstCertGrd: undefined,
|
||||
grntchBdstCertYr: undefined
|
||||
}],
|
||||
//추가됨
|
||||
chgBuilding:[{
|
||||
bdstInfoFk: 0,
|
||||
archChgPrmsnDt: new Date(),
|
||||
archChgArea: "-",
|
||||
bdstChgNm: ""
|
||||
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const selectClass = "w-full h-full text-2xl";
|
||||
const selectYN = [
|
||||
{ text: "Y", val: "1" },
|
||||
{ text: "N", val: "2" },
|
||||
];
|
||||
export type rainFacState = {
|
||||
rain: {
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
selectYN: selectArray[];
|
||||
rainRes: customRainBdst[];
|
||||
regRainForm:customRainBdst,
|
||||
|
||||
};
|
||||
};
|
||||
type rainFacSActions = {
|
||||
init: (txt:string|undefined) => void;
|
||||
rainSearTxt: (txt:string) => void;
|
||||
rainReg: (data: customRainBdst) => void;
|
||||
rainUpdate: (data: customRainBdst) => void;
|
||||
};
|
||||
|
||||
export type rainFacType = rainFacState & rainFacSActions;
|
||||
|
||||
export const rainFacStateExport: rainFacState = {
|
||||
rain: {
|
||||
isInit: false,
|
||||
rainRes: rainRes,
|
||||
upHeadList: upHeadList,
|
||||
selectYN: selectYN,
|
||||
regRainForm:regRainForm,
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
const initFetch = async (txt:string|undefined) => {
|
||||
|
||||
const rainRes =await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''));
|
||||
const chRainRes = rainRes.map((item: customRainBdst) => {
|
||||
return {
|
||||
...item,
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
} })
|
||||
return chRainRes;
|
||||
|
||||
|
||||
};
|
||||
export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
init: async (txt:string|undefined) => {
|
||||
try {
|
||||
// 파라이터 수정 통합관리자 =0, 시관리자=시코드, 시군구 관리자= 시군구 코드 를 세번째 파라미터로 지정 / 건축물 서치가 있을경우 4번째 파라미터로 던지기 즉 1/20/42(서울시)/영현빌딩 이런식으로)
|
||||
const rainRes = await initFetch(txt);
|
||||
|
||||
|
||||
// 여기서 상태 업데이트
|
||||
return set((state: rainFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log("error", error);
|
||||
} finally {
|
||||
console.log("finally");
|
||||
}
|
||||
},
|
||||
rainSearTxt: async(txt:string) =>{
|
||||
try{
|
||||
|
||||
const rainRes = await getFectch('wr' , `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''))
|
||||
set((state: rainFacState) => {
|
||||
return {
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
})}
|
||||
catch(erTxt){
|
||||
console.log("error", erTxt)
|
||||
}
|
||||
},
|
||||
rainReg: async (data: customRainBdst) => {
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/rainyInfo", data);
|
||||
if(res.ok){
|
||||
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res.json().then((resData: any) => {
|
||||
|
||||
const chPK = resData?.data?.bdstInfoPk
|
||||
const makeCh= resData.data.chgBuilding.map((item: chgBuilding) =>
|
||||
( {
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch= postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
}).then((chch: any) => {
|
||||
if(chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
})
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rainFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
console.log("e", e);
|
||||
alert("등록 오류입니다.");
|
||||
} finally {
|
||||
}
|
||||
},
|
||||
rainUpdate: async (data: customRainBdst) => {
|
||||
try {
|
||||
console.log("data ", data)
|
||||
const res = await putFectch("/reuseFc/rainyInfo", data);
|
||||
console.log('rainUpdate', res);
|
||||
if(res.ok){
|
||||
alert(" 수정이 완료되었습니다.")
|
||||
}
|
||||
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rainFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
console.log("e", e);
|
||||
alert("업데이트 오류입니다.");
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg";
|
||||
import { rswtBdstType } from "@/app/store/common/code";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
export const rswtZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
archChgPrmsnDt: z.coerce.date().nullish().default(null),
|
||||
|
||||
archArea: z.number().default(0),
|
||||
archChgArea: z.number().default(0),
|
||||
|
||||
reuseBuilding: z.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().default(0),
|
||||
|
||||
grntchBdstCertYn: z.string().default(""),
|
||||
grntchBdstCertYr: z.string().max(4, "4자리 연도를 입력하세요")
|
||||
.regex(/^\d{4}$/, "4자리 연도를 입력하세요")
|
||||
.default(""),
|
||||
grntchBdstCertNo: z.string().default(""),
|
||||
grntchBdstCertGrd: z.string().default(""),
|
||||
|
||||
crgRdctYn: z.string().default(""),
|
||||
crgRdctBss: z.string().default(""),
|
||||
crgRdctAmt: z.number().default(0),
|
||||
ruseFcltFlg: z.string().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default(""),
|
||||
|
||||
rswtrObj: z.object({
|
||||
bdstRuseFcltFk: z.number().nullish(),
|
||||
wtrUsqty: z.number().default(0),
|
||||
oblgTrgtWtrUsqty: z.number().default(0),
|
||||
orgwtKndCd: z.string().default(""),
|
||||
filtrTrtmfctProcs: z.string().default(""),
|
||||
filtrTrtmfctUsgCd: z.string().default(""),
|
||||
rswtrUsqty: z.number().default(0),
|
||||
altUswtrUtztnYn: z.string().default(""),
|
||||
altUswtrKndCd: z.string().default(""),
|
||||
altUswtrUtztnQnt: z.number().default(0),
|
||||
altUswtrIdntyMthdCd: z.string().default("")
|
||||
}).default({})
|
||||
})
|
||||
).default([]),
|
||||
|
||||
chgBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date() ,
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
export type customRswtBdst = Omit<bdstAll, 'reuseBuilding'> & {
|
||||
reuseBuilding: rswtReuseBuilding[];
|
||||
};
|
||||
|
||||
|
||||
|
||||
export type rswtReuseBuilding = {
|
||||
bdstRuseFcltPk: number;
|
||||
bdstInfoFk: number;
|
||||
instlCmptnDt: Date | undefined;
|
||||
instlCst: number | undefined;
|
||||
operMngCd: number;
|
||||
lawTrgtYn: string | undefined;
|
||||
anlOperCst: number;
|
||||
instlCstSprtYn: string | undefined;
|
||||
instlCstSprtAmt: number | undefined;
|
||||
bdstUsgCd: number | undefined;
|
||||
grntchBdstCertYn: string | undefined;
|
||||
grntchBdstCertNo: string | undefined;
|
||||
grntchBdstCertGrd: string | undefined;
|
||||
grntchBdstCertYr: string | undefined;
|
||||
rswtrObj: rswtrObj | null;
|
||||
};
|
||||
export type rswtrObj = {
|
||||
bdstRuseFcltFk: number | undefined;
|
||||
wtrUsqty: number | undefined;
|
||||
oblgTrgtWtrUsqty: number | undefined;
|
||||
orgwtKndCd: string | undefined;
|
||||
filtrTrtmfctProcs: string | undefined;
|
||||
filtrTrtmfctUsgCd: string | undefined;
|
||||
rswtrUsqty: number;
|
||||
altUswtrUtztnYn: string;
|
||||
altUswtrKndCd: string;
|
||||
altUswtrUtztnQnt: number;
|
||||
altUswtrIdntyMthdCd: string;
|
||||
};
|
||||
|
||||
|
||||
const rswtRes: customRswtBdst[] = [];
|
||||
|
||||
export type rswtFacState = {
|
||||
rswt: {
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
rswtRes: customRswtBdst[];
|
||||
};
|
||||
};
|
||||
type rswtFacSActions = {
|
||||
initRswt: (txt: string | undefined) => void;
|
||||
rswtUpdate: (data: customRswtBdst) => void;
|
||||
rswtReg: (data: customRswtBdst) => void;
|
||||
};
|
||||
|
||||
export type rswtFacType = rswtFacState & rswtFacSActions;
|
||||
|
||||
export const rswtFacStateExport: rswtFacState = {
|
||||
rswt: {
|
||||
isInit: false,
|
||||
upHeadList: upHeadList,
|
||||
rswtRes: rswtRes,
|
||||
},
|
||||
};
|
||||
|
||||
const initFetch = async (txt: string | undefined) => {
|
||||
const rswtRes =await getFectch(
|
||||
"wr",
|
||||
`/reuseFc/waterreuseFc/1/20/41` + (txt ? `/${txt}` : "")
|
||||
);
|
||||
const chRswtRes = rswtRes.map((item: customRswtBdst) => {
|
||||
return {
|
||||
...item,
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
} })
|
||||
return chRswtRes;
|
||||
};
|
||||
export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
initRswt: async (txt: string | undefined) => {
|
||||
try {
|
||||
const rswtRes = await initFetch(txt);
|
||||
return set((state: rswtFacState) => ({
|
||||
...state,
|
||||
rswt: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
rswtUpdate: async (data: customRswtBdst) => {
|
||||
try {
|
||||
const res = await putFectch("/reuseFc/waterreuseFc", data);
|
||||
if (res.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
const rswtRes = await initFetch(undefined);
|
||||
set((state: rswtFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (errorUpdate) {
|
||||
alert("업데이트 오류입니다. " + (errorUpdate instanceof Error ? errorUpdate.message : ""));
|
||||
} finally {
|
||||
}
|
||||
},
|
||||
rswtReg: async (data: customRswtBdst) => {
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/waterreuseFc", data);
|
||||
if(res.ok){
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res
|
||||
.json()
|
||||
.then((resData: any) => {
|
||||
const chPK = resData?.data?.bdstInfoPk;
|
||||
const makeCh = resData.data.chgBuilding.map(
|
||||
(item: chgBuilding) => ({
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch = postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
})
|
||||
.then((chch: any) => {
|
||||
if (chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rswtFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
console.log("e", e);
|
||||
alert("등록 오류입니다.");
|
||||
} finally {
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { TableUpperProps } from "../../fcltReg/rainReg";
|
||||
import { z } from "zod";
|
||||
|
||||
export const pbnSttHeadNm:chHeadType[] = [
|
||||
{headNm:"catchment", text:"유역" , length: 3},
|
||||
{headNm:"adminDiv", text:"행정구역" , length: 2},
|
||||
{headNm:"rusSup", text:"재이용수공급가능량" , length: 3},
|
||||
{headNm:"yearResult", text:"연간실적정보(m³)" , length: 3},
|
||||
{headNm:"mngInfo", text:"운영정보" , length: 4}
|
||||
]
|
||||
|
||||
// id는 다확인해야함
|
||||
export const pbnSttHeadList:TableUpperProps[] = [
|
||||
{ id: "a", title: "권역" ,upName:"catchment" ,upSequnce:1,visible:false},
|
||||
{ id: "aaa", title: "단위유역" ,upName:"catchment" ,upSequnce:2 ,visible:false},
|
||||
{ id: "aaaa", title: "중권역" ,upName:"catchment" ,upSequnce:3,visible:false},
|
||||
{ id: "operMngCd", title: "환경청" ,visible:false },
|
||||
{ id: "cityText", title: "시도" ,upName:"adminDiv" ,upSequnce:1,visible:false},
|
||||
{ id: "sggText", title: "시군구" ,upName:"adminDiv" ,upSequnce:2,visible:false},
|
||||
{ id: "bdnstNm", title: "시설명" ,visible:false },
|
||||
{ id: "locDiv", title: "지역구분" ,visible:false },
|
||||
{ id: "phone" , title: "전화번호" ,visible:false },
|
||||
|
||||
{ id: "fcltQuantity", title: "시설용량(톤/일)" ,visible:false},
|
||||
{ id: "rusNm", title: "재이용시설명" ,visible:false},
|
||||
|
||||
|
||||
{ id: "fcltCpct", title: "시설용량(m³/일)", upName: "rusSup", upSequnce: 1 ,visible:false},
|
||||
{ id: "trbt", title: "하수처리량(m³/일)", upName: "rusSup", upSequnce: 2 ,visible:false},
|
||||
{ id: "ruseCpct", title: "재이용량(m³/일)", upName: "rusSup", upSequnce: 3 ,visible:false},
|
||||
|
||||
{ id: "total", title: "합계", upName: "yearResult", upSequnce: 1 ,visible:false},
|
||||
{ id: "ithlWtr", title: "장내용수", upName: "yearResult", upSequnce: 2 ,visible:false},
|
||||
{ id: "othlWtr", title: "장외용수", upName: "yearResult", upSequnce: 3 ,visible:false},
|
||||
|
||||
{ id: "mngMeth", title: "운영방식", upName: "mngInfo", upSequnce: 1 ,visible:false},
|
||||
{ id: "rprtvBzenty", title: "대행업체", upName: "mngInfo", upSequnce: 2 ,visible:false},
|
||||
{ id: "firstDay", title: "시작일", upName: "mngInfo", upSequnce: 3 ,visible:false },
|
||||
{ id: "LastDay", title: "종료일", upName: "mngInfo", upSequnce: 4 ,visible:false},
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export type pbnstSttnState = {
|
||||
pbnStt: {
|
||||
pbnSttHeadList:TableUpperProps[],
|
||||
pbnSttHeadNm:chHeadType[]
|
||||
|
||||
};
|
||||
};
|
||||
type pbnSttActions = {
|
||||
};
|
||||
|
||||
export type pbnSttType = pbnstSttnState & pbnSttActions;
|
||||
|
||||
export const pbnSttStateExport: pbnstSttnState = {
|
||||
pbnStt: {
|
||||
pbnSttHeadList:pbnSttHeadList,
|
||||
pbnSttHeadNm:pbnSttHeadNm
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const pbnSttActionsExport: (set: any) => pbnSttActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
|
||||
pbnSttnInit: async(sggCd:string, searchTxt:string ,flg:string ) =>{
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
+84
-17
@@ -1,25 +1,92 @@
|
||||
import { createStore } from 'zustand/vanilla';
|
||||
import { pubFacActionsExport, pubFacStateExport, type pubFacState } from './publicReuseFaciltyInsert/index';
|
||||
import { rainFacActionsExport, rainFacStateExport, type rainFacState, type rainFacType } from './rainReuseFacilityInsert';
|
||||
import { rswtFacActionsExport, rswtFacStateExport, type rswtFacState, type rswtFacType } from './rswtrReuseFaciltyInsert';
|
||||
import { matDmdActionsExport, matDmdStateExport, type matDmdState, type matDmdType } from './matDmd';
|
||||
import { createStore } from "zustand/vanilla";
|
||||
import {
|
||||
pubFacActionsExport,
|
||||
pubFacStateExport,
|
||||
type pubFacState,
|
||||
type pubFacType,
|
||||
} from "./ruseFcltMng/fcltReg/pbnstReg";
|
||||
import {
|
||||
rainFacActionsExport,
|
||||
rainFacStateExport,
|
||||
type rainFacState,
|
||||
type rainFacType,
|
||||
} from "./ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
rswtFacActionsExport,
|
||||
rswtFacStateExport,
|
||||
type rswtFacState,
|
||||
type rswtFacType,
|
||||
} from "./ruseFcltMng/fcltReg/rswtReg";
|
||||
import {
|
||||
matDmdActionsExport,
|
||||
matDmdStateExport,
|
||||
type matDmdState,
|
||||
type matDmdType,
|
||||
} from "./matDmd";
|
||||
import {
|
||||
htdflFacActionsExport,
|
||||
htdflFacStateExport,
|
||||
type htdflFacState,
|
||||
type htdflFacType,
|
||||
} from "./ruseFcltMng/fcltReg/htdflReg";
|
||||
import { codeActionExport, comCodeStateExport, getCityCd, getSggCd, type comCodeState, type comCodeType } from "./common/code";
|
||||
import { bdstActionsExport, bdstStateExport, type bdstFulType, type bdstState } from "./ruseFcltMng/fcltReg/bdstReg";
|
||||
import { rainChkgdnActionsExport, rainChkgdnStateExport, type rainChkgdnState, type rainChkgdnType } from "./prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import { rswtChkgdnActionsExport, rswtChkgdnStateExport, type rswtChkgdnState, type rswtChkgdnType } from "./prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import { pbnSttActionsExport, pbnSttStateExport, type pbnstSttnState, type pbnSttType } from "./ruseFcltMng/fcltSttn/pbnstSttn";
|
||||
|
||||
export type WrStore = comCodeType&
|
||||
pubFacType &
|
||||
rainFacType &
|
||||
rswtFacType &
|
||||
matDmdType &
|
||||
htdflFacType&
|
||||
bdstFulType&
|
||||
rainChkgdnType&
|
||||
rswtChkgdnType&
|
||||
pbnSttType
|
||||
;
|
||||
|
||||
export type WrStore = pubFacState & rainFacType &rswtFacType &matDmdType;
|
||||
export const StoreZus = (initState: rainFacState& pubFacState & rswtFacState &matDmdState= {
|
||||
...pubFacStateExport,
|
||||
...rainFacStateExport,
|
||||
...rswtFacStateExport ,
|
||||
...matDmdStateExport
|
||||
}) => {
|
||||
export const StoreZus = (
|
||||
initState: comCodeState&
|
||||
rainFacState &
|
||||
pubFacState &
|
||||
rswtFacState &
|
||||
matDmdState &
|
||||
htdflFacState &
|
||||
bdstState &
|
||||
rainChkgdnState&
|
||||
rswtChkgdnState&
|
||||
pbnstSttnState
|
||||
= {
|
||||
...comCodeStateExport,
|
||||
...pubFacStateExport,
|
||||
...rainFacStateExport,
|
||||
...rswtFacStateExport,
|
||||
...matDmdStateExport,
|
||||
...htdflFacStateExport,
|
||||
...bdstStateExport,
|
||||
...rainChkgdnStateExport,
|
||||
...rswtChkgdnStateExport,
|
||||
...pbnSttStateExport
|
||||
}
|
||||
) => {
|
||||
return createStore<WrStore>()((set) => {
|
||||
getSggCd(set),
|
||||
getCityCd(set)
|
||||
return {
|
||||
...initState,
|
||||
...pubFacActionsExport(set),
|
||||
...rainFacActionsExport(set),
|
||||
...rswtFacActionsExport(set),
|
||||
...matDmdActionsExport(set)
|
||||
}
|
||||
})
|
||||
}
|
||||
//store 등록하는 부분
|
||||
...matDmdActionsExport(set),
|
||||
...htdflFacActionsExport(set),
|
||||
...codeActionExport(set),
|
||||
...bdstActionsExport(set),
|
||||
...rainChkgdnActionsExport(set),
|
||||
...rswtChkgdnActionsExport(set),
|
||||
...pbnSttActionsExport(set)
|
||||
};
|
||||
});
|
||||
};
|
||||
//store 등록하는 부분
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user