From 97d74250a5c4332a2fbda464649d4ef2a0daba08 Mon Sep 17 00:00:00 2001 From: yschoi Date: Tue, 11 Mar 2025 12:04:36 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B4=80=EB=A1=9C=EC=8B=9C=EC=84=A4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/bnss/oldPP/page.tsx | 60 ++++++++ apps/sn/app/layout.tsx | 8 +- apps/sn/app/oper/diag/page.tsx | 59 ++++++++ apps/sn/app/oper/pplines/page.tsx | 55 +++++++ apps/sn/app/oper/soil/page.tsx | 60 ++++++++ apps/sn/app/store/index.tsx | 45 ++++++ apps/sn/app/store/oper/index.tsx | 233 +++++++++++++++++++++++++++++ apps/sn/app/store/oper/pplines.tsx | 233 +++++++++++++++++++++++++++++ apps/sn/app/store/store.tsx | 13 ++ apps/sn/package.json | 10 +- 10 files changed, 771 insertions(+), 5 deletions(-) create mode 100644 apps/sn/app/bnss/oldPP/page.tsx create mode 100644 apps/sn/app/oper/diag/page.tsx create mode 100644 apps/sn/app/oper/pplines/page.tsx create mode 100644 apps/sn/app/oper/soil/page.tsx create mode 100644 apps/sn/app/store/index.tsx create mode 100644 apps/sn/app/store/oper/index.tsx create mode 100644 apps/sn/app/store/oper/pplines.tsx create mode 100644 apps/sn/app/store/store.tsx diff --git a/apps/sn/app/bnss/oldPP/page.tsx b/apps/sn/app/bnss/oldPP/page.tsx new file mode 100644 index 000000000..66f51e184 --- /dev/null +++ b/apps/sn/app/bnss/oldPP/page.tsx @@ -0,0 +1,60 @@ +'use client' + +import { SearchDiv, SelectBox, UiTable } from '@common/business_components'; +import { Button, TableRow, Input, Label } from '@common/components'; +import { TableHead } from '@common/components'; +import { useSnStore } from '../../store'; +import type { TableUpperProps } from '../../store/oper'; + + const headMakeColSpan = (upHeadList: TableUpperProps[]) => { + return ( <> + { + upHeadList.map((head: TableUpperProps) => + (!head.upSequnce?{head.title}: + head.upName === 'upChangeRe'&& head.upSequnce=== 1?{'중축 개축 증축 '}:null))} + + + {upHeadList.map((head: TableUpperProps) => + (head.upName === 'upChangeRe'?{head.title}:null))} + + ) + } + + export default function PublicReuseFaciltyInsert() { + const { upHeadList, publicReuseFacilityUper} = useSnStore((state) => state); + const nodeList= headMakeColSpan(upHeadList); + const total = 100; + const headName= ()=>{ + return( +

현황정보

+ ) + } + return ( <> +
+

현황정보 조회

+ +
+ + + + + + + + + +
+
+
+
+
+ + {nodeList} + +
+
+ ) +} + + + diff --git a/apps/sn/app/layout.tsx b/apps/sn/app/layout.tsx index c0f756c09..843d3ff1f 100644 --- a/apps/sn/app/layout.tsx +++ b/apps/sn/app/layout.tsx @@ -1,4 +1,6 @@ import './styles/base.css' +import {StoreProvider} from './store' +import { BaseLayout } from "@common/components"; export default function RootLayout({ children, }: { @@ -6,7 +8,11 @@ export default function RootLayout({ }) { return ( - {children} + + + {children} + + ) } diff --git a/apps/sn/app/oper/diag/page.tsx b/apps/sn/app/oper/diag/page.tsx new file mode 100644 index 000000000..e34cedf76 --- /dev/null +++ b/apps/sn/app/oper/diag/page.tsx @@ -0,0 +1,59 @@ +'use client' + +import { SearchDiv, SelectBox, UiTable } from '@common/business_components'; +import { Button, TableRow, Input, Label } from '@common/components'; +import { TableHead } from '@common/components'; +import { useSnStore } from '../../store'; +import type { TableUpperProps } from '../../store/oper/pplines'; + + const headMakeColSpan = (upHeadList: TableUpperProps[]) => { + return ( <> + { + upHeadList.map((head: TableUpperProps) => + ({head.title}))} + + + {upHeadList.map((head: TableUpperProps) => + (head.upName === 'upChangeRe'?{head.title}:null))} + + ) + } + + export default function PublicReuseFaciltyInsert() { + const { upHeadList, publicReuseFacilityUper} = useSnStore((state) => state); + const nodeList= headMakeColSpan(upHeadList); + const total = 100; + const headName= ()=>{ + return( +

점검 및 진단 현황

+ ) + } + return ( <> +
+

점검 및 진단 조회

+ +
+ + + + + + + + + +
+
+
+
+
+ + + +
+
+ ) +} + + + diff --git a/apps/sn/app/oper/pplines/page.tsx b/apps/sn/app/oper/pplines/page.tsx new file mode 100644 index 000000000..3f68ca06b --- /dev/null +++ b/apps/sn/app/oper/pplines/page.tsx @@ -0,0 +1,55 @@ +'use client' + +import { SearchDiv, SelectBox, UiTable } from '@common/business_components'; +import { Button, TableRow, Input, Label } from '@common/components'; +import { TableHead } from '@common/components'; +import { useSnStore } from '../../store'; +import type { TableUpperProps } from '../../store/oper/pplines'; + + const headMakeColSpan = (upHeadList: TableUpperProps[]) => { + return ( <> + { + upHeadList.map((head: TableUpperProps) => + ({head.title}))} + + ) + } + + export default function PublicReuseFaciltyInsert() { + const { upHeadList, publicReuseFacilityUper} = useSnStore((state) => state); + const nodeList= headMakeColSpan(upHeadList); + const total = 100; + const headName= ()=>{ + return( +

현황정보

+ ) + } + return ( <> +
+

현황정보 조회

+ +
+ + + + + + + + + +
+
+
+
+
+ + + +
+
+ ) +} + + + diff --git a/apps/sn/app/oper/soil/page.tsx b/apps/sn/app/oper/soil/page.tsx new file mode 100644 index 000000000..66f51e184 --- /dev/null +++ b/apps/sn/app/oper/soil/page.tsx @@ -0,0 +1,60 @@ +'use client' + +import { SearchDiv, SelectBox, UiTable } from '@common/business_components'; +import { Button, TableRow, Input, Label } from '@common/components'; +import { TableHead } from '@common/components'; +import { useSnStore } from '../../store'; +import type { TableUpperProps } from '../../store/oper'; + + const headMakeColSpan = (upHeadList: TableUpperProps[]) => { + return ( <> + { + upHeadList.map((head: TableUpperProps) => + (!head.upSequnce?{head.title}: + head.upName === 'upChangeRe'&& head.upSequnce=== 1?{'중축 개축 증축 '}:null))} + + + {upHeadList.map((head: TableUpperProps) => + (head.upName === 'upChangeRe'?{head.title}:null))} + + ) + } + + export default function PublicReuseFaciltyInsert() { + const { upHeadList, publicReuseFacilityUper} = useSnStore((state) => state); + const nodeList= headMakeColSpan(upHeadList); + const total = 100; + const headName= ()=>{ + return( +

현황정보

+ ) + } + return ( <> +
+

현황정보 조회

+ +
+ + + + + + + + + +
+
+
+
+
+ + {nodeList} + +
+
+ ) +} + + + diff --git a/apps/sn/app/store/index.tsx b/apps/sn/app/store/index.tsx new file mode 100644 index 000000000..0ec18eeee --- /dev/null +++ b/apps/sn/app/store/index.tsx @@ -0,0 +1,45 @@ +'use client' + +import { type ReactNode, createContext, useContext, useRef } from 'react' +import { useStore } from 'zustand' +import { type SnStore, StoreZus } from './store' + + +export type StoreApi = ReturnType + +export const StoreContext = createContext( + undefined, +) + +export interface StoreProviderProps { + children: ReactNode +} + +export const StoreProvider = ({ + children, +}: StoreProviderProps) => { + const storeRef = useRef(null) + console.log("StoreProvider"); + + if (!storeRef.current) { + storeRef.current = StoreZus() + } + + return ( + + {children} + + ) +} + +export const useSnStore = ( + selector: (store: SnStore) => T, +): T => { + const storeContext = useContext(StoreContext) + + if (!storeContext) { + throw new Error(`useStore must be used within StoreProvider`) + } + + return useStore(storeContext, selector) +} \ No newline at end of file diff --git a/apps/sn/app/store/oper/index.tsx b/apps/sn/app/store/oper/index.tsx new file mode 100644 index 000000000..76f045aef --- /dev/null +++ b/apps/sn/app/store/oper/index.tsx @@ -0,0 +1,233 @@ +export type TableUpperProps = { + id: string; + title: string; + upName?: string; + upSequnce?: number; +} +type PublicReuseFacility = { + sido: string, + sigungo: string, + facilityName: string, + location: string, + locationgubun: string, + facilityCapacity: string, + yn?: string, + authoDay?: string, + area?: string, + reuse?: string +} +const upHeadList:TableUpperProps[] = [ + { id: "sido", title: "자산ID"}, + { id: "sigungo", title: "설비시설"}, + { id: "facilityName", title: "주소"}, + { id: "location", title: "자산코드"}, + { id: "locationgubun", title: "자산명"}, + { id: "facilityCapacity", title: "용도"}, + { id: "yn", title: '신설/교체'}, + { id: "authoDay", title: '처리구역'}, + { id: "area", title: '내용연수' }, + { id: "reuse", title: '취득금액' }, +]; + +const publicReuseFacilityUper:PublicReuseFacility[] = [ + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + + +] + +export type tableState = { + isInit: boolean; + upHeadList: TableUpperProps[]; + publicReuseFacilityUper: PublicReuseFacility[]; +} +type tableActions = { + decrementList: () => void +} + +export type tableType = tableState & tableActions; + +export const tableStateExport:tableState= { + isInit:false, + upHeadList: upHeadList, + publicReuseFacilityUper: publicReuseFacilityUper, +} +export const tableActionsExport:(set:any)=>tableActions=(set: any) => { + return { + decrementList:()=>set( + (state:tableState) => { + return ( + { + upHeadList: state.upHeadList, + publicReuseFacilityUper: + state.publicReuseFacilityUper.slice(0, state.publicReuseFacilityUper.length - 1) + })} + ) + } +} diff --git a/apps/sn/app/store/oper/pplines.tsx b/apps/sn/app/store/oper/pplines.tsx new file mode 100644 index 000000000..b9515ba22 --- /dev/null +++ b/apps/sn/app/store/oper/pplines.tsx @@ -0,0 +1,233 @@ +export type TableUpperProps = { + id: string; + title: string; + upName?: string; + upSequnce?: number; +} +type PublicReuseFacility = { + sido: string, + sigungo: string, + facilityName: string, + location: string, + locationgubun: string, + facilityCapacity: string, + yn?: string, + authoDay?: string, + area?: string, + reuse?: string +} +const upHeadList:TableUpperProps[] = [ + { id: "sido", title: "자산ID121212"}, + { id: "sigungo", title: "설비시설"}, + { id: "facilityName", title: "주소"}, + { id: "location", title: "자산코드"}, + { id: "locationgubun", title: "자산명"}, + { id: "facilityCapacity", title: "용도"}, + { id: "yn", title: '신설/교체'}, + { id: "authoDay", title: '처리구역'}, + { id: "area", title: '내용연수' }, + { id: "reuse", title: '취득금액' }, +]; + +const publicReuseFacilityUper:PublicReuseFacility[] = [ + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + { + sido: "1048967", + sigungo: "관로", + facilityName: "양평군 양평읍 백안리 25-5전", + location: "S-T-S-2018000675", + locationgubun: "2018000675", + facilityCapacity: "오수관", + yn: "신설", + authoDay: "양평하수처리구역", + area: "30", + reuse: "28,313,220" + }, + + +] + +export type tableState = { + isInit: boolean; + upHeadList: TableUpperProps[]; + publicReuseFacilityUper: PublicReuseFacility[]; +} +type tableActions = { + decrementList: () => void +} + +export type tableType = tableState & tableActions; + +export const tableStateExport:tableState= { + isInit:false, + upHeadList: upHeadList, + publicReuseFacilityUper: publicReuseFacilityUper, +} +export const tableActionsExport:(set:any)=>tableActions=(set: any) => { + return { + decrementList:()=>set( + (state:tableState) => { + return ( + { + upHeadList: state.upHeadList, + publicReuseFacilityUper: + state.publicReuseFacilityUper.slice(0, state.publicReuseFacilityUper.length - 1) + })} + ) + } +} diff --git a/apps/sn/app/store/store.tsx b/apps/sn/app/store/store.tsx new file mode 100644 index 000000000..c6fd46f02 --- /dev/null +++ b/apps/sn/app/store/store.tsx @@ -0,0 +1,13 @@ +import { createStore } from 'zustand/vanilla'; +import { tableActionsExport, tableStateExport, type tableState, type tableType } from './oper/index'; +//import { upHeadList as pplinesUpHeadList, publicReuseFacilityUper as pplinesData } from './oper/pplines'; +export type SnStore = tableType; +export const StoreZus = (initState: tableState = tableStateExport) => { + return createStore()((set) => { + return { + ...initState, + ...tableActionsExport(set) + } + }) +} +//store 등록하는 부분 diff --git a/apps/sn/package.json b/apps/sn/package.json index 0c125f73e..5414d5b13 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -3,18 +3,20 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "NODE_OPTIONS='--inspect' next dev", + "dev": "next dev --turbopack", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { + "@common/assets": "workspace:*", "@common/business_components": "workspace:*", "@common/components": "workspace:*", - "next": "15.1.7", - "zod": "^3.24.2", "@hookform/resolvers": "^4.1.3", - "react-hook-form": "^7.54.2" + "next": "15.1.7", + "react-hook-form": "^7.54.2", + "zod": "^3.24.2", + "zustand": "^5.0.3" }, "devDependencies": { "@eslint/eslintrc": "^3",