From 7cab00c198b6705865c77593fd8ab18789c670d8 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 9 Apr 2025 10:10:05 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=EC=98=A8=EB=B0=B0=EC=88=98=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=EC=A4=91=20=EB=B3=80=EA=B2=BD=EC=9D=B4=EB=A0=A5?= =?UTF-8?q?=ED=95=B4=EC=95=BC=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/htdflReg/page.tsx | 2 +- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 99 +++++++--- .../app/ruseFcltMng/fcltReg/rswtReg/page.tsx | 165 ++++++++++------ apps/wr/app/store/common/code/index.ts | 16 +- .../ruseFcltMng/fcltReg/bdstReg/index.tsx | 13 ++ .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 18 +- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 146 +++++++------- .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 19 +- apps/wr/components/lib/api/index.ts | 4 +- apps/wr/components/lib/config/index.ts | 13 +- apps/wr/components/lib/func/commom.ts | 8 +- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 10 +- .../{component.tsx => htdflRegForm.tsx} | 0 .../ui/form/fcltReg/rainReg/component.tsx | 181 ++++++------------ .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 4 +- .../ui/modal/bdstChgModal/bdstChgModal.tsx | 36 ++++ .../bdstRegModal.tsx} | 22 ++- .../ui/modal/pbnstMng/component.tsx | 31 --- 18 files changed, 429 insertions(+), 358 deletions(-) rename apps/wr/components/ui/form/fcltReg/htdflReg/{component.tsx => htdflRegForm.tsx} (100%) create mode 100644 apps/wr/components/ui/modal/bdstChgModal/bdstChgModal.tsx rename apps/wr/components/ui/modal/{bdstReg/component.tsx => bdstRegModal/bdstRegModal.tsx} (89%) delete mode 100644 apps/wr/components/ui/modal/pbnstMng/component.tsx diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index ba5a691d1..bcdacf7ca 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -16,9 +16,9 @@ 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/component"; import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; +import { HtdflRegForm } from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm"; export default function Home() { const { code, htdfl, initHtdfl } = useWrStore((state) => state); diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index ef0281819..6b5db656c 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -1,12 +1,14 @@ "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/component"; -import { BdstReg } from "@/components/ui/modal/bdstReg/component"; +import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal"; +import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal"; import { ContentsDiv, ScrollArea, @@ -20,10 +22,9 @@ import { } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, TableHead, TableRow } from "@common/components"; +import exp from "constants"; import { useEffect, useState } from "react"; - - export const headMakeColSpan = (upHeadList: TableUpperProps[]) => { return ( <> @@ -53,15 +54,18 @@ export const headMakeColSpan = (upHeadList: TableUpperProps[]) => { //------------------------------------------------------------------------------------------------------- - export default function Home() { const { rain, code, init } = useWrStore((state) => { return state; }); const { rainRes } = rain; const [rainForm, setRainForm] = useState(); + const [issNewReg,setIsNewReg] = useState( false); + const [bdstTable, setbdstTable] = useState(); - const [searchTxt , setSearchTxt] = useState() + const [searchTxt, setSearchTxt] = useState(); + const [bdstChgProps, setBdstChgProps] = useState<{isOpen:boolean,chgBuilding:chgBuilding[]}>({isOpen:false,chgBuilding:[] }); + const nodeList = headMakeColSpan(rain.upHeadList); useEffect(() => { @@ -72,18 +76,36 @@ export default function Home() { useEffect(() => { if (code.sggCd.length > 0) { - - setbdstTable( tableData(rainRes, { code })); + setbdstTable(tableData(rainRes, { code })); } }, [code, rainRes]); - const cellClick: (val: number | undefined) => void = (val) => { - if ((bdstTable ?? []).length > 0 && val !== undefined) { - { + 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 ( <> @@ -96,31 +118,43 @@ export default function Home() { className="col-span-3 my-7" label="건물명" textValue={searchTxt || ""} - setText={(e)=>{setSearchTxt(e)}} + setText={(e) => { + setSearchTxt(e); + }} /> - - } - bodyClass="sm:max-w-7xl" - /> + + + -
+
- { + cellClick(val, headId); + }} > {nodeList} @@ -136,13 +170,26 @@ export default function Home() {
- -
+ } + bodyClass="w-[90vw] max-w-none" + open={issNewReg} + onOpenChange={(open) => { + setIsNewReg(open); + }} + /> + + } + onOpenChange={(open) => { + setBdstChgProps({ ...bdstChgProps, isOpen: open }); + } + } + /> ); } - - - diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx index 30b92fd4a..2a19993fb 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx @@ -1,6 +1,6 @@ "use client"; import { useWrStore } from "@/app/store"; -import { BdstReg } from "@/components/ui/modal/bdstReg/component"; +import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal"; import { ContentsDiv, ScrollArea, @@ -13,25 +13,29 @@ import { UiTable, } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button} from "@common/components"; +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 { code, rswt, initRswt } = useWrStore((state) => state); const nodeList = headMakeColSpan(rswt.upHeadList); const [rswtForm, setRswtForm] = useState(); - const [searchTxt , setSearchTxt] = useState() + const [searchTxt, setSearchTxt] = useState(); + const [issNewReg, setIsNewReg] = useState(false); const [bdstTable, setbdstTable] = useState(); + const [bdstChgProps, setBdstChgProps] = useState<{ + isOpen: boolean; + chgBuilding: chgBuilding[]; + }>({ isOpen: false, chgBuilding: [] }); - const {rswtRes} = rswt; - - + const { rswtRes } = rswt; useEffect(() => { if (!rswt.isInit) { @@ -40,20 +44,32 @@ export default function Home() { }, [rswt.isInit, initRswt]); useEffect(() => { if (code.sggCd.length > 0) { - - setbdstTable( tableData(rswtRes, { code })); + setbdstTable(tableData(rswtRes, { code })); } }, [code, rswtRes]); - const cellClick: (val: number | undefined) => void = (val) => { - console.log(" val ", val) + const cellClick: (val: number | undefined, headId: string) => void = ( + val, + headId + ) => { if ((bdstTable ?? []).length > 0 && val !== undefined) { { - console.log(" val ", val) + console.log(" val ", val); 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 ( <> @@ -61,55 +77,82 @@ export default function Home() {
- <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> - <UiModal - butNm="신규등록" - title="건축물 시설 등록(중수도시설)" - body={<BdstReg moType={"RST"}></BdstReg>} - bodyClass="sm:max-w-7xl" - /> - </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} + <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 || ""); + }} > - {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> + 조회 + </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> </> ); diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index c324e34c5..81a107718 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -110,8 +110,8 @@ 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: item.sggCd, - text: item.sggKornNm, + val: Number(item.adstDstrCd), + text: item.gugun, })); set((state: comCodeState) => ({ code: { @@ -123,8 +123,8 @@ export const getSggCd = async (set: any) => { export const getCityCd = async (set: any) => { const city = await getFectch("common", "/addr/city"); const cityCd = city.map((item: any) => ({ - val: item.mctpvCd, - text: item.mctpvKornNm, + val: Number(item.adstDstrCd), + text: item.sido, })); cityCd.unshift({val:0,text:'전체'}) set((state: comCodeState) => ({ @@ -161,14 +161,14 @@ export const codeActionExport: (set: any) => comCodeActions = (set: any) => { const sgg = await getFectch("common", "/addr/sgg"); const sggCd = sgg.map((item: any) => ({ - val: item.sggCd, - text: item.sggKornNm, + val: Number(item.adstDstrCd), + text: item.gugun, })); const city = await getFectch("common", "/addr/city"); const cityCd = city.map((item: any) => ({ - val: item.mctpvCd, - text: item.mctpvKornNm, + val: Number(item.adstDstrCd), + text: item.sido, })); return set((state: comCodeState) => ({ diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx index 375382e9c..27abc0b84 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx @@ -1,5 +1,6 @@ import { getFectch } from "@/components/lib/api"; import type { bdstAll } from "../rainReg"; +import type { TableProps } from "../pbnstReg"; type TableUpperProps = { id: string; @@ -19,6 +20,16 @@ type TableUpperProps = { { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 }, ]; + + const bdstChgHeadList: TableProps[] = [ + { id: "bdstChgNm", title: "구분" }, + { id: "archChgPrmsnDt", title: "허가일" }, + { id: "archChgArea", title: "변경면적" }, + + ]; + + + const bdstBase: bdstAll[] = []; @@ -30,6 +41,7 @@ export type bdstState = { bdst: { bdstBase: any[]; moUpHeadList:TableUpperProps[] + bdstChgHeadList:TableProps[] }; }; @@ -47,6 +59,7 @@ export const bdstStateExport: bdstState = { bdst: { bdstBase: bdstBase, // Updated to match the array type moUpHeadList:moUpHeadList, + bdstChgHeadList:bdstChgHeadList, }, }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index cbbc62163..ce6469ff3 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -74,6 +74,14 @@ export const hdtflZod = z.object({ }).default({}) }) ).default([]) + ,chgBuilding: z.array( + z.object({ + bdstInfoFk: z.number().nullish(), + archChgPrmsnDt: z.coerce.date(), + archChgArea: z.number().default(0), + bdstChgNm: z.string().default(""), + }) + ).default([]) }); // export type customHtdfBdst = Omit<bdstAll, 'reuseBuilding'> & { @@ -159,10 +167,18 @@ export const htdflFacStateExport: htdflFacState = { }; const initFetch = async (txt: string | undefined) => { - return await getFectch( + 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 diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index bb2d5b482..4741c40d7 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -5,83 +5,66 @@ 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(""), -export const rainZod = -{ ctpvCd: z.number(), - sggCd: z.number(), - bdstNm: z.string(), - daddr: z.string(), - frstArchPrmsnDt: z.date(), - archArea: z.number(), - bdstInfoPk: z.number().nullish() , - lawTrgtYn: z.string().nullish(), - bdstUsgCd: z.number(), - bdstRuseFcltPk: z.number().nullish(), - bdstInfoFk: z.number().nullish(), - operMngCd: z.number().nullish(), - anlOperCst: z.number().nullish(), - instlCmptnDt: z.date(), - instlCst: z.number(), - instlCstSprtYn: z.string(), - instlCstSprtAmt: z.number(), - grntchBdstCertYn: z.string().nullish(), - grntchBdstCertNo: z.string().nullish(), - grntchBdstCertGrd: z.string().nullish(), - grntchBdstCertYr: z.string().nullish(), - bdstReuseFcltFk:z.number().nullish(), - pntfColKnd: z.string(), - pntfColArea: z.number(), - dtfcltCpct:z.number().nullish(), - filtrTrtmfctCpct: z.number(), - filtrTrtmfctYn: z.string(), - filtrTrtmfctPrs: z.string(), - annRnwtQty:z.number().nullish(), - oilqMeasMthd:z.string().nullish(), - - chgBuilding: z.array( - z.object({ - archChgPrmsnDt: z.date().nullish(), - archChgArea: z.number().nullish(), - bdstChgNm: z.string().nullish(), - }) - ).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.number().default(0), + bdstChgNm: z.string().default(""), + }) + ).default([]) +}); -export const rainDefZod= { - instlCmptnDt: new Date(), - instlCst: 0, - pntfColKnd: "", - pntfColArea: 0, - filtrTrtmfctYn: "Y", - filtrTrtmfctCpct: 0, - filtrTrtmfctPrs: "", - instlCstSprtYn: "", - instlCstSprtAmt: 0, - grntchBdstCertYn: "", - grntchBdstCertYr: "", - grntchBdstCertNo: "", - grntchBdstCertGrd: "", -} - - -export const bdstDefZod={ - ctpvCd: 0, // 시도 - sggCd: 0, // 시군구 - daddr: '', // 위치 - bdstUsgCd: 0, // 건축물용도 - frstArchPrmsnDt: new Date(), // 최초건축허가일 - archArea: 0, // 건축면적 - lawTrgtYn: '', // 법적의무대상여부 - bdstNm: '', - - bdstChgnm:'', - archChgPrmsnDt: new Date(), // 건축변경 허가일시 - archChgArea: 0, // 변경 면적 -} - export type chgBuilding={ bdstInfoFk: number, @@ -156,9 +139,9 @@ export const upHeadList: TableUpperProps[] = [ { id: "frstArchPrmsnDt", title: "최초건축허가일" }, { id: "archArea", title: "건축면적" }, { id: "lawTrgtYn", title: "법적의무대상여부" }, - { id: "archChgYn", title: "여부", upName: "upChangeRe", upSequnce: 1 }, - { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 }, - { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 }, + { id: "bdstChgYn", title: "건축물변경여부" }, + // { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 }, + // { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 }, ]; const rainRes: customRainBdst[] = []; @@ -251,7 +234,16 @@ export const rainFacStateExport: rainFacState = { const initFetch = async (txt:string|undefined) => { - return await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:'')); + + 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 @@ -261,6 +253,8 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( try { // 파라이터 수정 통합관리자 =0, 시관리자=시코드, 시군구 관리자= 시군구 코드 를 세번째 파라미터로 지정 / 건축물 서치가 있을경우 4번째 파라미터로 던지기 즉 1/20/42(서울시)/영현빌딩 이런식으로) const rainRes = await initFetch(txt); + + // 여기서 상태 업데이트 return set((state: rainFacState) => ({ ...state, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 0694fcd2c..4a00e9d8f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -5,7 +5,7 @@ import { rswtBdstType } from "@/app/store/common/code"; import { z } from "zod"; export const rswtZod = z.object({ - bdstInfoPk: z.number().default(0), + bdstInfoPk: z.number().nullish(), ctpvCd: z.number().default(0), sggCd: z.number().default(0), daddr: z.string().default(""), @@ -18,8 +18,8 @@ export const rswtZod = z.object({ reuseBuilding: z.array( z.object({ - bdstRuseFcltPk: z.number().default(0), - bdstInfoFk: z.number().default(0), + 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(""), @@ -43,7 +43,7 @@ export const rswtZod = z.object({ lawTrgtYn: z.string().default(""), rswtrObj: z.object({ - bdstRuseFcltFk: z.number().default(0), + bdstRuseFcltFk: z.number().nullish(), wtrUsqty: z.number().default(0), oblgTrgtWtrUsqty: z.number().default(0), orgwtKndCd: z.string().default(""), @@ -57,6 +57,9 @@ export const rswtZod = z.object({ }).default({}) }) ).default([]) + + + }); @@ -125,10 +128,16 @@ export const rswtFacStateExport: rswtFacState = { }; const initFetch = async (txt: string | undefined) => { - return await getFectch( + 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 diff --git a/apps/wr/components/lib/api/index.ts b/apps/wr/components/lib/api/index.ts index 0f7e6c0ee..b466054be 100644 --- a/apps/wr/components/lib/api/index.ts +++ b/apps/wr/components/lib/api/index.ts @@ -1,11 +1,11 @@ //8880 -import { DEV_URL_COMMON, DEV_URL_WR } from "../config/"; +import { DEV_URL_FO, DEV_URL_WR } from "../config/"; export const getFectch = async( type:string , url: string) => { - const div = type === 'common' ? DEV_URL_COMMON : DEV_URL_WR + const div = type === 'common' ? DEV_URL_FO : DEV_URL_WR const response = await fetch( div+url , { method: "GET", headers: { diff --git a/apps/wr/components/lib/config/index.ts b/apps/wr/components/lib/config/index.ts index e6640eac0..6420b06f4 100644 --- a/apps/wr/components/lib/config/index.ts +++ b/apps/wr/components/lib/config/index.ts @@ -1,11 +1,16 @@ const LOCAL_PORT = "3000"; -const DEV_PORT = "8880"; +const DEV_PORT = "11080"; -const DEV_PORT_COMMON = "8882"; // common +const DEV_PORT_FO = "11082"; // common export const LOCAL_URL_WR = `http://localhost:${LOCAL_PORT}/api/v1`; -export const DEV_URL_WR = `http://192.168.1.193:${DEV_PORT}/api/v1`; +export const DEV_URL_WR = `http://con.mind-one.co.kr:${DEV_PORT}/api/v1`; + +export const DEV_URL_FO = `http://con.mind-one.co.kr:${DEV_PORT_FO}/api/v1`; + + + + -export const DEV_URL_COMMON = `http:///192.168.1.193:${DEV_PORT_COMMON}/api/v1`; diff --git a/apps/wr/components/lib/func/commom.ts b/apps/wr/components/lib/func/commom.ts index c5134324f..a6d3a94dc 100644 --- a/apps/wr/components/lib/func/commom.ts +++ b/apps/wr/components/lib/func/commom.ts @@ -9,7 +9,7 @@ export const getCity = (val: string, sggCd: selectArray[]) => { const data = sggCd .filter((item) => String(item.val).substring(0, 2) === val) .map((item) => ({ - val: String(item.val), + val: item.val, text: item.text // 한국어 텍스트 })); return data @@ -20,13 +20,14 @@ export const getCity = (val: string, sggCd: selectArray[]) => { // cd text 넣기 export const tableData = ( data: any,code:comCodeState)=>{ const chCode = code.code; + return data?.map((item: { sggCd: string; ctpvCd: string; reuseBuilding: { lawTrgtYn: any , bdstUsgCd:any}[]; }) => { let returnData = {}; const sggText = chCode.sggCd.find( - (cd) => cd.val === Number(item.sggCd) + (cd) => cd.val === item.sggCd )?.text; const cityText = chCode.cityCd.find( - (cd) => cd.val === Number(item.ctpvCd) + (cd) => cd.val === item.ctpvCd )?.text; if (item?.reuseBuilding?.length >0) { @@ -40,6 +41,7 @@ export const getCity = (val: string, sggCd: selectArray[]) => { returnData= { ...item, sggText: sggText, cityText: cityText}; } + // console.log(" returnData ", returnData) return returnData; }); diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 2062a2795..3a4aa3f09 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store"; import type { selectArray } from "@/app/store/common/code"; import { selectClass, type bdstAll } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { getCity } from "@/components/lib/func/commom"; -import type { objSearchType } from "@/components/ui/modal/bdstReg/component"; +import type { objSearchType } from "@/components/ui/modal/bdstRegModal/bdstRegModal"; import { FormField, FormUi, DatePicker, SelectBox } from "@common/business_components"; import { Button, Input } from "@common/components"; import { useEffect, useRef, useState } from "react"; @@ -164,7 +164,7 @@ export default function BdstReg({ form }: { form: any }) { <div className="col-span-2"> <FormField control={form.control} - name="bdstUsgCd" + name="reuseBuilding.0.bdstUsgCd" render={({ field }) => ( <FormUi label="건축물용도"> <SelectBox @@ -224,7 +224,7 @@ export default function BdstReg({ form }: { form: any }) { <div className="col-span-2"> <FormField control={form.control} - name="" + name="reuseBuilding.0.lawTrgtYn" render={({ field }) => ( <FormUi label="법정의무대상여부"> <SelectBox @@ -309,7 +309,9 @@ export default function BdstReg({ form }: { form: any }) { className="" placeholder="1,000,000" type="text" - {...field} + value={ field.value??""} + onChange={(e) => field.onChange(Number(e.target.value))} + /> </FormUi> )} diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/component.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx similarity index 100% rename from apps/wr/components/ui/form/fcltReg/htdflReg/component.tsx rename to apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx index ac5884f4b..bdde6bd3e 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx @@ -2,10 +2,8 @@ import { useWrStore } from "@/app/store"; import { - selectClass, - bdstDefZod, - rainDefZod, rainZod, + selectClass, type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { DatePicker, FormUi } from "@common/business_components"; @@ -17,26 +15,6 @@ import { useForm, type UseFormReturn } from "react-hook-form"; import { z } from "zod"; import BdstReg from "../bdstReg/bdstReg"; -export const formToObj = ( - isModal: boolean, - formSchema: z.ZodObject<any, "strip", z.ZodTypeAny, any, any> -) => { - return useForm<z.infer<typeof formSchema>>({ - resolver: zodResolver(formSchema), - defaultValues: isModal - ? { - ...rainDefZod, - ...bdstDefZod, - } - : { - ...rainDefZod, - }, - }); -}; - -const formSchema = z.object(rainZod); -export type RainFormType = UseFormReturn<z.infer<typeof formSchema>>; - export function RainRegForm({ rainForm, isModal, @@ -44,115 +22,59 @@ export function RainRegForm({ rainForm: customRainBdst; isModal: boolean; }) { - - const form = formToObj(isModal, formSchema); const { code, rainReg, rainUpdate, rain } = useWrStore((state) => state); const { rainFcltCd } = code; - useEffect(() => { - console.log(rainForm); - - if (rainForm != null) { - const data = rainForm; + const defaultValues: z.infer<typeof rainZod> = rainZod.parse({}); - const selectedOption = rainFcltCd.find( - (item) => - item.val === - String(data?.reuseBuilding?.at(0)?.rainyObj?.pntfColKnd ?? "") - ); - let formData; + const form = useForm<z.infer<typeof rainZod>>({ + resolver: zodResolver(rainZod), + defaultValues: defaultValues, + }); - - if (data?.reuseBuilding?.at(0)) { - const rb = data.reuseBuilding?.at(0); - formData = { - ...data, - ...rb?.rainyObj, - ...data.reuseBuilding?.at(0), - pntfColKnd: selectedOption ? String(selectedOption.val) : undefined, - frstArchPrmsnDt: new Date(data.frstArchPrmsnDt ||null), - instlCmptnDt: new Date(data?.instlCmptnDt ||null) - }; - form.reset(formData); - } else { - formData = { - ...data, - frstArchPrmsnDt: new Date(data.frstArchPrmsnDt||null) - }; - form.reset(formData); - } + + + + function cleanRainData(raw: any): z.infer<typeof rainZod> { + return { + ...raw, + frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt||null), + archChgPrmsnDt: raw?.archChgPrmsnDt ? new Date(raw?.archChgPrmsnDt) : null, + reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + ...item, + instlCmptnDt: new Date(item?.instlCmptnDt), + operMngCd: item?.operMngCd ?? "", // null → "" + grntchBdstCertYr: typeof item?.grntchBdstCertYr === "string" + ? item?.grntchBdstCertYr + : "", // null → "" + rainObj: { + ...item?.rainObj + } + })) + }; } - }, [rainForm]); + + + // form 값이 변경될 때마다 로그 출력 useEffect(() => { - const subscription = form.watch((value) => { - }); + const subscription = form.watch((value) => {}); return () => subscription.unsubscribe(); }, [form]); - const objToForm = (raw: z.infer<typeof formSchema>) => { - let regRainForm: customRainBdst; + - // 1. 기본 정보 정리 - const obj = !rainForm ? rain.regRainForm : rainForm; - regRainForm = { - ...obj, - ctpvCd: raw?.ctpvCd , - sggCd: raw?.sggCd, - daddr: raw?.daddr, - bdstNm: raw?.bdstNm, - frstArchPrmsnDt: raw?.frstArchPrmsnDt , - archArea: raw?.archArea + "", - // archChgArea: raw?.archChgArea || 0, // Ensure archChgArea is always a string - }; - const rainObj = regRainForm?.reuseBuilding?.at(0)?.rainyObj; - - if (!regRainForm.reuseBuilding) { - regRainForm.reuseBuilding = []; - } - - regRainForm.reuseBuilding[0] = { - ...rainForm?.reuseBuilding?.at(0), - - instlCmptnDt: raw.instlCmptnDt, - instlCst: raw.instlCst || rainForm?.reuseBuilding?.at(0)?.instlCst, - instlCstSprtYn: - raw.instlCstSprtYn || rainForm?.reuseBuilding?.at(0)?.instlCstSprtYn, - instlCstSprtAmt: - raw.instlCstSprtAmt || rainForm?.reuseBuilding?.at(0)?.instlCstSprtAmt, - grntchBdstCertYn: - raw.grntchBdstCertYn || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertYn, - grntchBdstCertYr: - raw.grntchBdstCertYr || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertYr, - grntchBdstCertNo: - raw.grntchBdstCertNo || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertNo, - grntchBdstCertGrd: - raw.grntchBdstCertGrd || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertGrd, - bdstUsgCd: raw.bdstUsgCd || rainForm?.reuseBuilding?.at(0)?.bdstUsgCd, - lawTrgtYn: raw.lawTrgtYn || rainForm?.reuseBuilding?.at(0)?.lawTrgtYn, - } - regRainForm.reuseBuilding[0].rainyObj = { - ...rainObj, - pntfColKnd: raw.pntfColKnd || rainObj?.pntfColKnd, - pntfColArea: raw.pntfColArea || rainObj?.pntfColArea, - filtrTrtmfctCpct: raw.filtrTrtmfctCpct || rainObj?.filtrTrtmfctCpct, - filtrTrtmfctYn: raw.filtrTrtmfctYn || rainObj?.filtrTrtmfctYn, - filtrTrtmfctPrs: raw.filtrTrtmfctPrs || rainObj?.filtrTrtmfctPrs, - }; + function onSubmit(values: z.infer<typeof rainZod>) { if (isModal) { - // regRainForm.bdstInfoPk = null; - rainReg(regRainForm); + // regRainForm.bdstInfoPk = null; + rainReg(values); } else { - rainUpdate(regRainForm); + rainUpdate(values); } - }; - - function onSubmit(values: z.infer<typeof formSchema>) { - objToForm(values); } useEffect(() => { @@ -160,6 +82,11 @@ export function RainRegForm({ }, [form.formState.errors]); + useEffect(() => { + if(rainZod) + form.reset( cleanRainData(rainForm)) + }, [rainForm]); + return ( <div className=""> @@ -175,7 +102,7 @@ export function RainRegForm({ </Button> </div> </div> - {isModal&&rainForm!=undefined ? <BdstReg form={form}/> : <></>} + {isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>} {isModal ? ( <h1 className="pl-3 text-xl col-span-10 mt-4 "> ○ 빗물이용시설 정보{" "} @@ -191,7 +118,7 @@ export function RainRegForm({ <div className="col-span-2"> <FormField control={form.control} - name="instlCmptnDt" + name="reuseBuilding.0.instlCmptnDt" render={({ field }) => ( <FormUi label="설치완료일"> <DatePicker @@ -211,7 +138,7 @@ export function RainRegForm({ <div className="col-span-2"> <FormField control={form.control} - name="instlCst" + name="reuseBuilding.0.instlCst" render={({ field }) => ( <FormUi label="설치비"> <Input @@ -241,7 +168,7 @@ export function RainRegForm({ <div className="col-span-5 pl-6"> <FormField control={form.control} - name="pntfColKnd" + name="reuseBuilding.0.rainyObj.pntfColKnd" render={({ field }) => ( <FormUi label="종류"> <SelectBox @@ -261,7 +188,7 @@ export function RainRegForm({ <div className="col-span-5"> <FormField control={form.control} - name="pntfColArea" + name="reuseBuilding.0.rainyObj.pntfColArea" render={({ field }) => ( <FormUi label="면적(m³)"> <Input @@ -287,7 +214,7 @@ export function RainRegForm({ <div className="col-span-4 pl-6"> <FormField control={form.control} - name="filtrTrtmfctYn" + name="reuseBuilding.0.rainyObj.filtrTrtmfctYn" render={({ field }) => ( <FormUi label="유무"> <SelectBox @@ -305,7 +232,7 @@ export function RainRegForm({ <div className="col-span-4"> <FormField control={form.control} - name="filtrTrtmfctCpct" + name="reuseBuilding.0.rainyObj.filtrTrtmfctCpct" render={({ field }) => ( <FormUi label="용량(m³/일)"> <Input @@ -325,7 +252,7 @@ export function RainRegForm({ <div className="col-span-4"> <FormField control={form.control} - name="filtrTrtmfctPrs" + name="reuseBuilding.0.rainyObj.filtrTrtmfctPrs" render={({ field }) => ( <FormUi label="처리공정"> <Input @@ -351,7 +278,7 @@ export function RainRegForm({ <div className="col-span-5"> <FormField control={form.control} - name="instlCstSprtYn" + name="reuseBuilding.0.instlCstSprtYn" render={({ field }) => ( <FormUi label="설치비 지원 여부"> <SelectBox @@ -369,7 +296,7 @@ export function RainRegForm({ <div className="col-span-5"> <FormField control={form.control} - name="instlCstSprtAmt" + name="reuseBuilding.0.instlCstSprtAmt" render={({ field }) => ( <FormUi label="지원금액(원)"> <Input @@ -395,7 +322,7 @@ export function RainRegForm({ <div className="col-span-3 pl-6"> <FormField control={form.control} - name="grntchBdstCertYn" + name="reuseBuilding.0.grntchBdstCertYn" render={({ field }) => ( <FormUi label="인증여부"> <SelectBox @@ -413,7 +340,7 @@ export function RainRegForm({ <div className="col-span-3"> <FormField control={form.control} - name="grntchBdstCertYr" + name="reuseBuilding.0.grntchBdstCertYr" render={({ field }) => ( <FormUi label="인증년도"> <Input className="" placeholder="2024" type="" {...field} /> @@ -424,7 +351,7 @@ export function RainRegForm({ <div className="col-span-3 pl-6"> <FormField control={form.control} - name="grntchBdstCertNo" + name="reuseBuilding.0.grntchBdstCertNo" render={({ field }) => ( <FormUi label="인증번호"> <Input @@ -440,7 +367,7 @@ export function RainRegForm({ <div className="col-span-3"> <FormField control={form.control} - name="grntchBdstCertGrd" + name="reuseBuilding.0.grntchBdstCertGrd" render={({ field }) => ( <FormUi label="인증등급"> <Input className="" placeholder="A" type="" {...field} /> diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index e6bbc0aaf..826579a08 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -40,7 +40,7 @@ export function RswtrRegForm({ }) // 2. Define a submit handler. - function onSubmit(values: z.infer<typeof rswtZod>) { + async function onSubmit(values: z.infer<typeof rswtZod>) { // Do something with the form values. // ✅ This will be type-safe and validated. console.log(values); @@ -48,7 +48,7 @@ export function RswtrRegForm({ if (isModal) { // regRainForm.bdstInfoPk = null; - rswtReg(values); + await rswtReg(values); } else { rswtUpdate(values); } diff --git a/apps/wr/components/ui/modal/bdstChgModal/bdstChgModal.tsx b/apps/wr/components/ui/modal/bdstChgModal/bdstChgModal.tsx new file mode 100644 index 000000000..03c257c59 --- /dev/null +++ b/apps/wr/components/ui/modal/bdstChgModal/bdstChgModal.tsx @@ -0,0 +1,36 @@ +import { useWrStore } from "@/app/store"; +import { UiTable } from "@common/business_components/ui"; +import ListDiv from "@common/business_components/ui/list_div"; +import { useEffect } from "react"; + + + +import type { + chgBuilding, + } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +export default function BdstChgModal({ chgBuilding }: { chgBuilding:chgBuilding[] }) { + +const {bdst,rain} = useWrStore((state) => { + return state; +}); +const { bdstChgHeadList } = bdst; + console.log("chgBuilding", chgBuilding); + + + return ( + <> + <ListDiv> + <UiTable + headlist={bdstChgHeadList} + pageSize={-1} + total={0} + onPageChange={() => {}} + headName={"○건축물 변경 이력"} + tableData={chgBuilding} + children={undefined} + cellClick={undefined} + /> + </ListDiv> + </> + ); +} diff --git a/apps/wr/components/ui/modal/bdstReg/component.tsx b/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx similarity index 89% rename from apps/wr/components/ui/modal/bdstReg/component.tsx rename to apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx index 9ea411248..a8a393b05 100644 --- a/apps/wr/components/ui/modal/bdstReg/component.tsx +++ b/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx @@ -12,9 +12,9 @@ import { useEffect, useState } from "react"; import { RainRegForm } from "../../form/fcltReg/rainReg/component"; import { getCityCd, type selectArray } from "@/app/store/common/code"; import { getCity, tableData } from "@/components/lib/func/commom"; -import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm"; -import { HtdflRegForm } from "../../form/fcltReg/htdflReg/component"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; +import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm"; +import { HtdflRegForm } from "../../form/fcltReg/htdflReg/htdflRegForm"; export type objSearchType = { sgg: string|number; @@ -76,18 +76,25 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) { setbdstTable( tableData(bdst.bdstBase, { code })); } - }, [code, bdst]); + }, [ bdst]); - const tableClick: (val: number | undefined) => void = (val) => { + const tableClick: (val: number | undefined , headId:string) => void = (val ,headId) => { if(val!==undefined && bdst?.bdstBase.length>0){ const data:BdstTypeMap[T] =bdst?.bdstBase[val] if (data) { setRainBdstForm(data); } + + } + } + + useEffect(()=>{ + setbdstTable([]) // 초기화 작업 + },[]) const nodeList = headMakeColSpan(bdst.moUpHeadList); return ( <> @@ -125,7 +132,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) { pageSize={-10} total={-1} headName={undefined} - cellClick={tableClick} + cellClick={(idx,headId)=> (tableClick(idx, headId||"" ))} > {nodeList} </UiTable> @@ -135,8 +142,9 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) { <ScrollArea className="h-[60vh]"> <div> { moType === 'RNB'? - <RainRegForm rainForm={rainBdstForm} isModal={true} /> - :moType==='RST'?<RswtrRegForm rswtForm={rainBdstForm } isModal={true}></RswtrRegForm> + <RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={true} /> + :moType==='RST' + ? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true}></RswtrRegForm> :<HtdflRegForm></HtdflRegForm> } diff --git a/apps/wr/components/ui/modal/pbnstMng/component.tsx b/apps/wr/components/ui/modal/pbnstMng/component.tsx deleted file mode 100644 index 3dcf3d3b1..000000000 --- a/apps/wr/components/ui/modal/pbnstMng/component.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@common/components"; - -export function PbnstMngModal(butNm:string,chldrn:React.ReactNode) { - return ( - <> - <Dialog> - <DialogTrigger asChild> - <Button variant="outline">{butNm}</Button> - </DialogTrigger> - <DialogContent className="sm:max-w-md"> - <DialogHeader> - <DialogTitle>Share link</DialogTitle> - <DialogDescription> - Anyone who has this link will be able to view this. - </DialogDescription> - </DialogHeader> - {chldrn} - - - <DialogFooter className="sm:justify-start"> - <DialogClose asChild> - <Button type="button" variant="secondary"> - 닫기 - </Button> - </DialogClose> - </DialogFooter> - </DialogContent> - </Dialog> - </> - ); -} From 5898d454aa5a0b0a78e5aaac7087ad58db7c5ff4 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Wed, 9 Apr 2025 10:14:07 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=EB=AA=A8=EB=8B=AC=20=ED=8A=B8=EB=A6=AC?= =?UTF-8?q?=EA=B1=B0=20=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=85=80?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=AF=B8=ED=84=B0=EC=B6=94=EA=B0=80(=EC=85=80=20head?= =?UTF-8?q?=EA=B0=92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/dialog_ui/index.tsx | 33 ++++--------------- .../src/ui/table/index.tsx | 19 +++++------ 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/packages/common/business_components/src/ui/dialog_ui/index.tsx b/packages/common/business_components/src/ui/dialog_ui/index.tsx index 7609e2908..ef611fa40 100644 --- a/packages/common/business_components/src/ui/dialog_ui/index.tsx +++ b/packages/common/business_components/src/ui/dialog_ui/index.tsx @@ -1,50 +1,29 @@ import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTrigger } from "@common/components"; +import { useState } from "react"; type ModalType = { bodyClass: string; - butNm: string; - title: string | undefined; body: React.ReactNode; open?: boolean; onOpenChange?: (open: boolean) => void; } -export function UiModal({ bodyClass, butNm, title, body, open, onOpenChange }: ModalType) { - const dialogProps = open !== undefined && onOpenChange !== undefined && title !== undefined - ? { open, onOpenChange, title } - : {}; - +export function UiModal({ bodyClass, body, open, onOpenChange }: ModalType) { + return ( <> - {!open && ( - <Dialog> - <DialogTrigger asChild> - <Button className="mr-4 rounded-lg">{butNm}</Button> - </DialogTrigger> + <Dialog open={open} onOpenChange={onOpenChange}> <DialogContent className={bodyClass}> <DialogHeader> <DialogDescription> </DialogDescription> + </DialogHeader> - {body} + {(open && body)} <DialogFooter className="sm:justify-start"> </DialogFooter> </DialogContent> </Dialog> - )} - {open && ( - <Dialog {...dialogProps}> - <DialogContent className={bodyClass}> - <DialogHeader> - <DialogDescription> - </DialogDescription> - </DialogHeader> - {body} - <DialogFooter className="sm:justify-start"> - </DialogFooter> - </DialogContent> - </Dialog> - )} </> ); } diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index 834db2347..802c59ac0 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -9,7 +9,7 @@ type UiTableProps = { pageSize: number; total: number; children: React.ReactNode | undefined; - cellClick : ((index:number|undefined)=>void) | undefined; + cellClick : ((index:number|undefined, headId:string)=>void )| undefined; onPageChange: (page: number) => void; className?: string; } @@ -26,20 +26,17 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa setCur(page); onPageChange(page); } - const handleCellClick = (index: number) => { + + + const handleCellClick = (index: number,headId:string )=> { if (cellClick) { - console.log("cellClick", index); - cellClick(index); + cellClick(index,headId); setIdx(index); } + + }; -useEffect(() => { - - console.log("idx", idx); - console.log("idx", idx); - - },[idx]) return ( <> {headName ? <div className="card-header"> @@ -59,7 +56,7 @@ useEffect(() => { <TableRow key={index + "row"} > {headlist?.map((head) => ( // <TableCell className={cellClick&&idx==index?"bg-black/10 cursor-pointer":cellClick?"cursor-pointer":""} onClick={()=>handleCellClick(index)} key={head.id + index}>{el[head.id]}</TableCell> - <TableCell className={cellClick&&idx==index?"opacity-40 cursor-pointer":cellClick?"cursor-pointer":""} onClick={()=>handleCellClick(index)} key={head.id + index}>{el[head.id]}</TableCell> + <TableCell className={cellClick&&idx==index?"opacity-40 cursor-pointer":cellClick?"cursor-pointer":""} onClick={(e)=>handleCellClick(index,head.id)} key={head.id + index}>{el[head.id]}</TableCell> ))} </TableRow> ))} From 52560d4b1ba59ac8677c9ea1198158923d49edc5 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Wed, 9 Apr 2025 17:23:04 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=EC=A4=91=EC=88=98=EB=8F=84=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=9E=91=EC=97=85=20=EC=A4=91=20api=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=95=B4=EC=95=BC=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/htdflReg/page.tsx | 67 +- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 4 +- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 3 +- .../app/ruseFcltMng/fcltReg/rswtReg/page.tsx | 1 - apps/wr/app/store/common/code/index.ts | 6 +- .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 312 +++--- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 6 +- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 5 +- .../ui/form/fcltReg/htdflReg/htdflRegForm.tsx | 885 ++++++++++-------- .../fcltReg/pbnstReg/buseReg/component.tsx | 37 +- .../{component.tsx => rainRegForm.tsx} | 65 +- .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 4 +- .../ui/modal/bdstRegModal/bdstRegModal.tsx | 12 +- 13 files changed, 804 insertions(+), 603 deletions(-) rename apps/wr/components/ui/form/fcltReg/rainReg/{component.tsx => rainRegForm.tsx} (87%) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index bcdacf7ca..c92eb8bd3 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -9,6 +9,7 @@ import { SearchFormRight, SearchInput, Title, + UiModal, UiTable, } from "@common/business_components"; import { Button } from "@common/components"; @@ -16,16 +17,25 @@ 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 type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; -import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; 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 [rswtForm, setRswtForm] = useState<customHtdflBdst>(); + 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(() => { @@ -40,12 +50,26 @@ export default function Home() { } }, [code, htdflRes]); - const cellClick: (val: number | undefined) => void = (val) => { + const cellClick: (val: number|undefined ,headId: string) => void = ( + val + ,headId) => { if ((bdstTable ?? []).length > 0 && val !== undefined) { { - setRswtForm(htdflRes[val]); + 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 ( <> @@ -65,8 +89,13 @@ export default function Home() { /> </SearchFormLeft> <SearchFormRight> - <Button className="mr-4 rounded-lg">조회</Button> - <Button className="mr-4 rounded-lg">신규등록</Button> + <Button className="mr-4 rounded-lg" onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button> + <Button + className="mr-4 rounded-lg" + onClick={() => setIsNewReg(!issNewReg)} + > + 신규등록 + </Button> </SearchFormRight> </SearchDiv> </div> @@ -81,7 +110,7 @@ export default function Home() { pageSize={100} total={10} headName={"○건축물 목록"} - cellClick={cellClick} + cellClick={(val,headId)=>{cellClick(val||undefined , headId)}} > {nodeList} </UiTable> @@ -91,13 +120,33 @@ export default function Home() { <ListDiv> <ScrollArea> <HtdflRegForm - htdflForm={rswtForm ?? ({} as customRswtBdst)} + 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> </> ); diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index df9fa8411..1db6b224b 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -90,8 +90,8 @@ const resetContents = () => { <Tabs defaultValue="mng" onValueChange={handleTabChange}> <div className="flex justify-between items-center"> <TabsList> - <TabsTrigger value="mng">운영정보</TabsTrigger> - <TabsTrigger value="buse">시설정보</TabsTrigger> + <TabsTrigger value="mng">시설정보</TabsTrigger> + <TabsTrigger value="buse">차수별정보</TabsTrigger> </TabsList> <Button className="rounded-lg" onClick={resetContents}> 신규등록 diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 6b5db656c..d41309f85 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -6,7 +6,7 @@ import type { TableUpperProps, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { tableData } from "@/components/lib/func/commom"; -import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/component"; +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 { @@ -22,7 +22,6 @@ import { } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, TableHead, TableRow } from "@common/components"; -import exp from "constants"; import { useEffect, useState } from "react"; export const headMakeColSpan = (upHeadList: TableUpperProps[]) => { diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx index 2a19993fb..8864989d3 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx @@ -53,7 +53,6 @@ export default function Home() { ) => { if ((bdstTable ?? []).length > 0 && val !== undefined) { { - console.log(" val ", val); setRswtForm(rswtRes[val]); } } diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index 81a107718..f0a160213 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -85,9 +85,9 @@ const orgwtKndCd = [ ]; export const chBuCd = [ - { val: "1", text: "증축" }, - { val: "2", text: "개축" }, - { val: "3", text: "재축" }, + { val: "증축", text: "증축" }, + { val: "개축", text: "개축" }, + { val: "재축", text: "재축" }, ] diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index ce6469ff3..1116cdd19 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -1,146 +1,146 @@ -import { getFectch } from "@/components/lib/api"; -import { - upHeadList, - type TableUpperProps, -} from "../rainReg"; - +import { getFectch, postFectch, putFectch } from "@/components/lib/api"; +import { upHeadList, type bdstAll, type TableUpperProps } from "../rainReg"; import { z } from "zod"; export const hdtflZod = z.object({ - bdstInfoPk: z.number().nullish().default(0), + 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), + 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().default(0), - bdstInfoFk: z.number().nullish().default(0), - 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() - .max(4, "4자리 연도를 입력하세요") - .regex(/^\d{4}$/, "4자리 연도를 입력하세요") - .nullish() - .default(""), - 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(""), + 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 매핑 - htdfObj: z.object({ - htdflFcltPk: z.number().nullish().default(0), - bdstRuseFcltFk: z.number().nullish().default(0), - 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().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.number().default(0), - bdstChgNm: z.string().default(""), - }) - ).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().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().nullable(), + archChgPrmsnDt: z.coerce.date() , + archChgArea: z.number().default(0), + bdstChgNm: z.string().default(""), + }) + ) + .default([]), }); -// export type customHtdfBdst = Omit<bdstAll, 'reuseBuilding'> & { -// reuseBuilding: htdfReuseBuilding[]; -// }; + export type customHtdflBdst = Omit<bdstAll, 'reuseBuilding'> & { + reuseBuilding: htdflReuseBuilding[]; + }; -export type customHtdflBdst =z.infer<typeof hdtflZod>; +//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 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 - } + 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: { @@ -150,12 +150,13 @@ export type htdflFacState = { }; }; type htdflFacSActions = { - initHtdfl: (txt:string|undefined) => void; + 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 = { @@ -167,41 +168,80 @@ export const htdflFacStateExport: htdflFacState = { }; const initFetch = async (txt: string | undefined) => { - const htdflRes = await getFectch( + const htdflRes = await getFectch( "wr", - `/drain/facilityList/1/20/0` //+ (txt ? `/${txt}` : "") + `/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) =>{ - + initHtdfl: async (txt: string | undefined) => { try { - const res = await initFetch(txt); + const htdflRes = await initFetch(txt); set((state: htdflFacState) => { return { ...state, htdfl: { ...state.htdfl, - htdflRes: res, + 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) { + alert(" 등록이 완료되었습니다."); + } + const htdflRes = await initFetch(undefined); + set((state: htdflFacState) => ({ + ...state, + htdfl: { + ...state.htdfl, + htdflRes: htdflRes, + isInit: false, + }, + })); + } catch (errorReg) { + alert("등록 오류입니다."); + } + }, }; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 4741c40d7..e2ab7c2f7 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -67,7 +67,7 @@ export const rainZod = z.object({ export type chgBuilding={ - bdstInfoFk: number, + bdstInfoFk: number|null, archChgPrmsnDt: Date, archChgArea: number, bdstChgNm: string @@ -291,7 +291,9 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( try { const res = await postFectch("/reuseFc/rainyInfo", data); if(res.ok){ - alert(" 등록이 완료되었습니다.") + + + // alert(" 등록이 완료되었습니다.") } const rainRes = await initFetch(undefined); set((state: rainFacState) => ({ diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 3a4aa3f09..bd9d0c460 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -271,10 +271,11 @@ export default function BdstReg({ form }: { form: any }) { selectClass={selectClass} label={""} selectArray={code.chBuCd} + onSelectValue={(val) => { field.onChange(val); }} - value={field.value} + value={field.value ?? code.chBuCd[0]?.val} /> </FormUi> )} @@ -309,7 +310,7 @@ export default function BdstReg({ form }: { form: any }) { className="" placeholder="1,000,000" type="text" - value={ field.value??""} + value={ field.value??0} onChange={(e) => field.onChange(Number(e.target.value))} /> diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index dff971bb9..f59791e80 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -12,436 +12,549 @@ import { useForm } from "react-hook-form"; import { z } from "zod"; import { useWrStore } from "@/app/store"; import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { hdtflZod, type customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; +import { + hdtflZod, + type customHtdflBdst, +} from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; import { useEffect } from "react"; - +import BdstReg from "../bdstReg/bdstReg"; export function HtdflRegForm({ htdflForm, - isModal -} :{ - htdflForm:customHtdflBdst; + isModal, +}: { + htdflForm: customHtdflBdst; isModal: boolean; -} ) { - const {code} = useWrStore((state) => state); +}) { + const { code, htdflUpdate, htdflReg } = useWrStore((state) => state); + + const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({}); - const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({}); - const form = useForm<z.infer<typeof hdtflZod>>({ resolver: zodResolver(hdtflZod), - defaultValues:defaultValues, + defaultValues: defaultValues, }); - // 2. Define a submit handler.hdtflZod function onSubmit(values: z.infer<typeof hdtflZod>) { - // Do something with the form values. - // ✅ This will be type-safe and validated. - console.log(values); + if (isModal) { + htdflReg(values); + } else { + htdflUpdate(values); + } } const onSelectValue = (val: string | number) => { console.log(val); }; -useEffect(() => { - if(hdtflZod) - console.log("hdtflZod", hdtflZod); - const parsedData = hdtflZod.safeParse(htdflForm); - if (parsedData.success) { - form.reset(parsedData.data); - } else { - console.error("Invalid data for form reset", parsedData.error); - } + function cleanHtdflData(raw: any): z.infer<typeof hdtflZod> { + return { + ...raw, + frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), + archChgPrmsnDt: raw?.archChgPrmsnDt + ? new Date(raw?.archChgPrmsnDt) + : null, + chgBuilding: (raw?.chgBuilding || []).map((item: any) => ({ + ...item, + archChgPrmsnDt: + item?.archChgPrmsnDt === null + ? new Date() + : new Date(item?.archChgPrmsnDt), + bdstChgNm: item?.bdstChgNm ?? "", // null → "" + })), + reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + ...item, + instlCmptnDt: new Date(item?.instlCmptnDt), + htdflObj: { + ...item?.htdflObj, + }, + })), + }; + } + useEffect(() => { + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); + + + useEffect(() => { + if (hdtflZod) form.reset(cleanHtdflData(htdflForm)); }, [htdflForm]); - - return ( - <Form {...form}> - <form onSubmit={form.handleSubmit(onSubmit)}> - {/* <div className="flex justify-between items-center mx-3"> */} - <div> - <div className="grid grid-cols-12"> - <h1 className="pl-3 text-xl col-span-10"> - ○온배수 시설 정보 - </h1> - <Button type="submit" className="mr-4 rounded-lg col-span-2"> - 저장 - </Button> - </div> + <Form {...form}> + <form onSubmit={form.handleSubmit(onSubmit)}> + {/* <div className="flex justify-between items-center mx-3"> */} + <div> + <div className="grid grid-cols-12"> + <h1 className="pl-3 text-xl col-span-10">○온배수 시설 정보</h1> + <Button type="submit" className="mr-4 rounded-lg col-span-2"> + 저장 + </Button> + </div> + </div> + + { isModal && htdflForm != undefined ? ( + <BdstReg form={form} /> + ) : ( + <></> + )} + {isModal ? ( + <h1 className="pl-3 text-xl col-span-10 mt-4 "> + ○ 중수도 시설 정보{" "} + </h1> + ) : ( + <></> + )} + + + + <div className="grid grid-cols-6 gap-2 mt-4 pl-6"> + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.etgtType" + render={({ field }) => ( + <FormUi label="발전유형(코드정비후 수정)"> + <Input + className="" + placeholder="1,000,000" + type="text" + value={field.value ?? ""} + onChange={field.onChange} + /> + </FormUi> + )} + /> </div> + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.fclCpct" // 이름 이상함. + render={({ field }) => ( + <FormUi label="설비용량"> + <Input + className="" + placeholder="1,000,000" + type="text" + value={field.value ?? 0} + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.plwtYn" + render={({ field }) => ( + <FormUi label="담수화 여부"> + <SelectBox + className={""} + label={""} + selectClass={selectClass} + selectArray={code.yn} + onSelectValue={onSelectValue} + value={field.value ?? code.yn[0]?.val} + /> + </FormUi> + )} + /> + </div> + </div> + <div className=" my-4"> + <h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6"> + 온배수 시설 운영현황 + </h1> + </div> - <div className="grid grid-cols-6 gap-2 mt-4 pl-6"> - <div className="col-span-2"> - <FormField - control={form.control} - name="reuseBuilding.0.htdflObj.etgtType" - render={({ field }) => ( - <FormUi label="발전유형"> - <SelectBox - selectClass={selectClass} - selectArray={code.yn} - onSelectValue={onSelectValue} - {...field} - /> - </FormUi> - )} - /> - </div> - - <div className="col-span-2"> - <FormField - control={form.control} - name="reuseBuilding.0.htdfObj.fclCpct" // 이름 이상함. - render={({ field }) => ( - <FormUi label="설비용량"> - <Input - className="" - placeholder="1,000,000" - type="text" - {...field} - value={field.value ?? ""} + <div className="grid grid-cols-10 gap-1 mt-4"> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.orgwtWtritSpt" + render={({ field }) => ( + <FormUi label="원수취수 지점(코드정비후 수정)"> + <Input + className="" + placeholder="1,000,000" + type="text" + value={field.value ?? 0} + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.orgwtOcrnProcs" + render={({ field }) => ( + <FormUi label="원수발생 공정"> + <Input + className="" + placeholder="1,000,000" + type="" + value={field.value ?? ""} + onChange={field.onChange} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.wtritEntrcTp" + render={({ field }) => ( + <FormUi label="취수구 온도"> + <Input + className="" + placeholder="1,000,000" + type="" + value={field.value ?? 0} + onChange={(e) => { + field.onChange(Number(e.target.value)); + }} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.amtgnr" + render={({ field }) => ( + <FormUi label="발생량(m³/년)"> + <Input + className="" + placeholder="1,000,000" + type="" + value={field.value ?? 0} onChange={(e) => field.onChange(Number(e.target.value))} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-2"> - <FormField - control={form.control} - name="reuseBuilding.0.htdfObj.plwtYn" - render={({ field }) => ( - <FormUi label="담수화 여부"> - <SelectBox - selectClass={selectClass} - selectArray={code.yn} - onSelectValue={onSelectValue} - {...field} - /> - </FormUi> - )} - /> + /> + </FormUi> + )} + /> </div> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.prcsProcsYn" + render={({ field }) => ( + <FormUi label="처리공정"> + <SelectBox + className={""} + label={""} + selectClass={selectClass} + selectArray={code.yn} + onSelectValue={onSelectValue} + value={field.value ?? code.yn[0]?.val} + /> + </FormUi> + )} + /> </div> - <div className=" my-4"> - <h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6"> - 온배수 시설 운영현황 - </h1> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.prcsFcltCpct" + render={({ field }) => ( + <FormUi label="처리시설 용량(m³/년)"> + <Input + className="" + placeholder="1,000,000" + type="" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.fmYn" + render={({ field }) => ( + <FormUi label="유량계유무"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={code.yn} + onSelectValue={onSelectValue} + value={field.value ?? code.yn[0]?.val} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.utztnCpct" + render={({ field }) => ( + <FormUi label="이용량(m³/년)"> + <Input + className="" + placeholder="1,000,000" + type="" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5 pl-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.utztnUsg" + render={({ field }) => ( + <FormUi label="이용용도"> + <Input + className="" + placeholder="1,000,000" + type="text" + value={field.value ?? ""} + onChange={field.onChange} + /> + </FormUi> + )} + /> + </div> + </div> - <div className="grid grid-cols-10 gap-1 mt-4"> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="reuseBuilding.0.htdfObj.orgwtwtritspt" - render={({ field }) => ( - <FormUi label="원수취수 지점"> - <SelectBox - selectClass={selectClass} - selectArray={code.yn} - onSelectValue={onSelectValue} - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5"> - <FormField - control={form.control} - name="orgwtocrnprocs" - render={({ field }) => ( - <FormUi label="원수발생 공정"> - <Input - className="" - placeholder="1,000,000" - type="" - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="wtritentrctp" - render={({ field }) => ( - <FormUi label="취수구 온도"> - <Input - className="" - placeholder="1,000,000" - type="" - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="wtritentrctp" - render={({ field }) => ( - <FormUi label="발생량(m³/년)"> - <Input - className="" - placeholder="1,000,000" - type="" - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="amtgnr" - render={({ field }) => ( - <FormUi label="처리공정"> - <Input - className="" - placeholder="1,000,000" - type="" - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="prcsfcltcpct" - render={({ field }) => ( - <FormUi label="처리시설 용량(m³/년)"> - <Input - className="" - placeholder="1,000,000" - type="" - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="fmyn" - render={({ field }) => ( - <FormUi label="유량계유무"> - <SelectBox - selectClass={selectClass} - label={""} - selectArray={code.yn} - onSelectValue={onSelectValue} - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="utztnqnt" - render={({ field }) => ( - <FormUi label="이용량(m³/년)"> - <Input - className="" - placeholder="1,000,000" - type="" - {...field} - /> - </FormUi> - )} - /> - </div> - <div className="col-span-5 pl-6"> - <FormField - control={form.control} - name="utztnusgcd" - render={({ field }) => ( - <FormUi label="이용용도"> - <SelectBox - selectClass={selectClass} - label={""} - selectArray={code.yn} - onSelectValue={onSelectValue} - {...field} - /> - </FormUi> - )} - /> - </div> - </div> - - <div className=" my-2"> - <h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 "> + <div className=" my-2"> + <h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 "> 요구수질 - </h1> - </div> - - <div className="grid grid-cols-12 gap-4 pl-6"> - <div className="col-span-6"> - <FormField - control={form.control} - name="grssClfg" - render={({ field }) => ( - <FormUi label="총대장균군"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + </h1> + </div> - <div className="col-span-6"> - <FormField - control={form.control} - name="tn" - render={({ field }) => ( - <FormUi label="총질소"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="grid grid-cols-12 gap-4 pl-6"> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.grssClfg" + render={({ field }) => ( + <FormUi label="총대장균군"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> - <div className="grid grid-cols-12 gap-4 pl-6"> - <div className="col-span-6"> - <FormField - control={form.control} - name="combResdch" - render={({ field }) => ( - <FormUi label="결합잔류염소"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.tn" + render={({ field }) => ( + <FormUi label="총질소"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + </div> - <div className="col-span-6 "> - <FormField - control={form.control} - name="tp" - render={({ field }) => ( - <FormUi label="총인"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="grid grid-cols-12 gap-4 pl-6"> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.combResdch" + render={({ field }) => ( + <FormUi label="결합잔류염소"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> - <div className="grid grid-cols-12 gap-4 pl-6"> - <div className="col-span-6"> - <FormField - control={form.control} - name="trbt" - render={({ field }) => ( - <FormUi label="탁도"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="col-span-6 "> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.tph" + render={({ field }) => ( + <FormUi label="총인"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + </div> - <div className="col-span-6"> - <FormField - control={form.control} - name="ph" - render={({ field }) => ( - <FormUi label="수소이온농도"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="grid grid-cols-12 gap-4 pl-6"> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.trbt" + render={({ field }) => ( + <FormUi label="탁도"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> - <div className="grid grid-cols-12 gap-4 pl-6"> - <div className="col-span-6"> - <FormField - control={form.control} - name="bod" - render={({ field }) => ( - <FormUi label="생물학적 산소요구량"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.ph" + render={({ field }) => ( + <FormUi label="수소이온농도"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + </div> - <div className="col-span-6"> - <FormField - control={form.control} - name="clIonQnt" - render={({ field }) => ( - <FormUi label="염화물"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="grid grid-cols-12 gap-4 pl-6"> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.bod" + render={({ field }) => ( + <FormUi label="생물학적 산소요구량"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> - <div className="grid grid-cols-12 gap-4 pl-6"> - <div className="col-span-6"> - <FormField - control={form.control} - name="smll" - render={({ field }) => ( - <FormUi label="냄새"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.clIonQnt" + render={({ field }) => ( + <FormUi label="염화물"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + </div> - <div className="col-span-6"> - <FormField - control={form.control} - name="cdtnv" - render={({ field }) => ( - <FormUi label="전기전도도"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="grid grid-cols-12 gap-4 pl-6"> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.smll" + render={({ field }) => ( + <FormUi label="냄새"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> - <div className="grid grid-cols-12 gap-4 pl-6"> - <div className="col-span-6"> - <FormField - control={form.control} - name="crmty" - render={({ field }) => ( - <FormUi label="색도"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> - - <div className="col-span-6"> - <FormField - control={form.control} - name="emsnexittp" - render={({ field }) => ( - <FormUi label="배출구온도"> - <Input placeholder="10" type="text" {...field} /> - </FormUi> - )} - /> - </div> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.cdtnv" + render={({ field }) => ( + <FormUi label="전기전도도"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> </div> - </form> - </Form> + </div> + + <div className="grid grid-cols-12 gap-4 pl-6"> + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.crmty" + render={({ field }) => ( + <FormUi label="색도"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-6"> + <FormField + control={form.control} + name="reuseBuilding.0.htdflObj.emsnExitTp" + render={({ field }) => ( + <FormUi label="배출구온도"> + <Input + placeholder="10" + type="text" + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> + </FormUi> + )} + /> + </div> + </div> + </form> + </Form> ); } diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx index 83766b8de..b358a98fc 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx @@ -120,25 +120,6 @@ const nodeList = headMakeColSpan(pubMngUpHeadList); )} /> </div> - - <div className="col-span-3"> - <FormField - control={form.control} - name="name_2450741594" - render={({ field }) => ( - <FormUi label="설치승인인가일"> - <DatePicker - - selectClass={'rounded-lg w-full bg-white'} field={{ - value: instlAprvDate, - onChange: (date: Date | undefined): void => { - if (date) setInstlAprvDate(date); - } - }} mode="single" {...field}/> - </FormUi> - )} - /> - </div> <div className="col-span-3"> <FormField control={form.control} @@ -157,6 +138,24 @@ const nodeList = headMakeColSpan(pubMngUpHeadList); )} /> </div> + <div className="col-span-3"> + <FormField + control={form.control} + name="name_2450741594" + render={({ field }) => ( + <FormUi label="설치승인인가일"> + <DatePicker + + selectClass={'rounded-lg w-full bg-white'} field={{ + value: instlAprvDate, + onChange: (date: Date | undefined): void => { + if (date) setInstlAprvDate(date); + } + }} mode="single" {...field}/> + </FormUi> + )} + /> + </div> </div> <h1 className="pl-4 text-xl">2. 사업비</h1> <div className="grid grid-cols-10 gap-4"> diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx similarity index 87% rename from apps/wr/components/ui/form/fcltReg/rainReg/component.tsx rename to apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index bdde6bd3e..36895009a 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -95,7 +95,7 @@ export function RainRegForm({ <div> <div className="grid grid-cols-12"> <h1 className="pl-3 text-xl col-span-10"> - {isModal ? "○건축물 운영정보" : "○ 빗물이용시설 운영정보"} + {isModal ? "○건축물 운영정보" : "○ 빗물이용시설 정보"} </h1> <Button type="submit" className="mr-4 rounded-lg col-span-2"> 저장 @@ -121,15 +121,17 @@ export function RainRegForm({ name="reuseBuilding.0.instlCmptnDt" render={({ field }) => ( <FormUi label="설치완료일"> - <DatePicker - mode={"single"} + <DatePicker + mode="single" field={{ - value: new Date(field.value), - onChange: (date: Date | undefined) => - field.onChange(date), + value: + field.value && !isNaN(new Date(field.value).getTime()) + ? new Date(field.value) + : new Date(), // Provide a default Date value + onChange: (date) => field.onChange(date), }} - selectClass={selectClass} - ></DatePicker> + selectClass={""} + /> </FormUi> )} /> @@ -145,10 +147,9 @@ export function RainRegForm({ className="" placeholder="1,000,000" type="" - {...field} + value={field.value ?? 0} onChange={(e) => { - const value = e.target.value; - field.onChange(value === "" ? "" : Number(value)); + field.onChange(e.target.value === "" ? "" : Number(e.target.value)); }} /> </FormUi> @@ -176,10 +177,9 @@ export function RainRegForm({ selectClass={selectClass} label={""} selectArray={rainFcltCd} - onSelectValue={(val) => { - field.onChange(val); - }} - value={field.value} + onSelectValue={field.onChange} + value={field.value ?? rainFcltCd[0]?.val} + /> </FormUi> )} @@ -195,11 +195,8 @@ export function RainRegForm({ className="" placeholder="1,000,000" type="" - {...field} - onChange={(e) => { - const value = e.target.value; - field.onChange(value === "" ? "" : Number(value)); - }} + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} /> </FormUi> )} @@ -223,7 +220,7 @@ export function RainRegForm({ label={""} selectArray={code.yn} onSelectValue={field.onChange} - {...field} + value={field.value ?? code.yn[0]?.val} /> </FormUi> )} @@ -239,11 +236,9 @@ export function RainRegForm({ className="" placeholder="1,000,000" type="" - {...field} - onChange={(e) => { - const value = e.target.value; - field.onChange(value === "" ? "" : Number(value)); - }} + value={field.value ?? 0} + onChange={(e) => field.onChange(Number(e.target.value))} + /> </FormUi> )} @@ -258,8 +253,9 @@ export function RainRegForm({ <Input className="" placeholder="1,000,000" - type="" - {...field} + type="" + value={field.value ?? ""} + onChange={field.onChange} /> </FormUi> )} @@ -287,7 +283,7 @@ export function RainRegForm({ label={""} selectArray={code.yn} onSelectValue={field.onChange} - value={field.value} + value={field.value ?? code.yn[0]?.val} /> </FormUi> )} @@ -331,7 +327,7 @@ export function RainRegForm({ label={""} selectArray={code.yn} onSelectValue={field.onChange} - value={field.value} + value={field.value ?? code.yn[0]?.val} /> </FormUi> )} @@ -343,7 +339,8 @@ export function RainRegForm({ name="reuseBuilding.0.grntchBdstCertYr" render={({ field }) => ( <FormUi label="인증년도"> - <Input className="" placeholder="2024" type="" {...field} /> + <Input className="" placeholder="2024" type="" value={field.value ?? ""} + onChange={field.onChange} /> </FormUi> )} /> @@ -358,7 +355,8 @@ export function RainRegForm({ className="" placeholder="ab1234678" type="" - {...field} + value={field.value ?? ""} + onChange={field.onChange} /> </FormUi> )} @@ -370,7 +368,8 @@ export function RainRegForm({ name="reuseBuilding.0.grntchBdstCertGrd" render={({ field }) => ( <FormUi label="인증등급"> - <Input className="" placeholder="A" type="" {...field} /> + <Input className="" placeholder="A" type="" value={field.value ?? ""} + onChange={field.onChange}/> </FormUi> )} /> diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index 826579a08..362248218 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -96,7 +96,7 @@ useEffect(() => { <div> <div className="grid grid-cols-12"> <h1 className="pl-3 text-xl col-span-10"> - ○ 중수도 시설 운영정보 + ○ 중수도 시설 정보 </h1> <Button type="submit" className="mr-4 rounded-lg col-span-2"> 저장 @@ -107,7 +107,7 @@ useEffect(() => { {isModal && rswtForm != undefined ? ( <BdstReg form={form} /> ) : ( - <></> + <></> )} {isModal ? ( <h1 className="pl-3 text-xl col-span-10 mt-4 "> diff --git a/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx index a8a393b05..32a0360d1 100644 --- a/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx @@ -3,18 +3,18 @@ import { headMakeColSpan } from "@/app/ruseFcltMng/fcltReg/rainReg/page"; import { useWrStore } from "@/app/store"; import { selectClass, - type bdstAll, type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { ScrollArea, SearchInput, SelectBox, UiTable } from "@common/business_components"; +import { ScrollArea, SelectBox, UiTable } from "@common/business_components"; import { Button, Input, Label } from "@common/components"; import { useEffect, useState } from "react"; -import { RainRegForm } from "../../form/fcltReg/rainReg/component"; -import { getCityCd, type selectArray } from "@/app/store/common/code"; +import { RainRegForm } from "../../form/fcltReg/rainReg/rainRegForm"; +import { type selectArray } from "@/app/store/common/code"; import { getCity, tableData } from "@/components/lib/func/commom"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; -import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm"; import { HtdflRegForm } from "../../form/fcltReg/htdflReg/htdflRegForm"; +import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; +import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm"; export type objSearchType = { sgg: string|number; @@ -145,7 +145,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) { <RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={true} /> :moType==='RST' ? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true}></RswtrRegForm> - :<HtdflRegForm></HtdflRegForm> + :<HtdflRegForm htdflForm={rainBdstForm as customHtdflBdst} isModal={true}></HtdflRegForm> } </div> From e4dda6e50b219e1bcb8daedd252dcecd4cca010f Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Wed, 9 Apr 2025 17:25:46 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=B4=88=EA=B8=B0=EA=B0=92=20-1=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/table/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index 802c59ac0..368abc5cc 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -21,7 +21,7 @@ type UiHeadProps = { export function UiTable({ tableData, headlist, pageSize, total, children, headName, cellClick, onPageChange, className = '' }: UiTableProps) { const [cur, setCur] = useState<number>(1); - const [idx, setIdx] = useState<number>(0); + const [idx, setIdx] = useState<number>(-1); const handlePageChange = (page: number) => { setCur(page); onPageChange(page); From f25686da46a0d9b88fa711710dd38a386db6a6ef Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Thu, 10 Apr 2025 18:13:40 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=EB=93=B1=EB=A1=9D=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/page.tsx | 28 ++-- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 114 ++++++++++++++++ .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 125 ++++++++++++++++++ .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 72 ++++++++++ .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 2 +- apps/wr/app/store/store.tsx | 19 ++- .../ui/modal/chkgdModal/chkgdModal.tsx | 15 +++ .../ui/table/rainChkgd/rainChkgdTable.tsx | 30 +++++ .../ui/table/rswtChkgd/rswtChkgdTable.tsx | 30 +++++ 9 files changed, 423 insertions(+), 12 deletions(-) create mode 100644 apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx create mode 100644 apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx create mode 100644 apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx create mode 100644 apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx create mode 100644 apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx create mode 100644 apps/wr/components/ui/table/rswtChkgd/rswtChkgdTable.tsx diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index b18914cdc..d9a01bd36 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -6,22 +6,34 @@ export default function Home() { return ( <> <div className="flex"> - <Button className="place-self-auto"> + + <div className="grid grid-cols-12 gap-4 "> + <Button className="col-span-3 place-self-auto"> <Link href="ruseFcltMng/fcltReg/pbnstReg"> 하수재이용 시설 등록</Link> </Button> - <Button className="place-self-auto"> + <Button className="col-span-3 place-self-auto"> <Link href="ruseFcltMng/fcltReg/rainReg"> 빗물재이용 시설 등록</Link> </Button> - <Button className="place-self-auto"> + <Button className="col-span-3 place-self-auto"> <Link href="ruseFcltMng/fcltReg/rswtReg"> 중수도시설 등록</Link> </Button> - - <Button className="place-self-auto"> - <Link href="matMng/matDmd/coReg">수요처 등록</Link> - </Button> - <Button className="place-self-auto"> + <Button className="col-span-3 place-self-auto"> <Link href="ruseFcltMng/fcltReg/htdflReg">온배수 등록</Link> </Button> + </div> + + + <div className="grid grid-cols-12 gap-4 "> + <Button className="col-span-3 place-self-auto"> + <Link href="ruseFcltMng/prfmncReg/chkgdnReg"> 지도점검 결과 등록</Link> + </Button> + </div> + + <div className="grid grid-cols-12 gap-4 "> + <Button className="col-span-3 place-self-auto"> + <Link href="matMng/matDmd/coReg">수요처 등록</Link> + </Button> + </div> </div> </> ); diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx new file mode 100644 index 000000000..52bd270e1 --- /dev/null +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -0,0 +1,114 @@ +"use client"; + +import { useWrStore } from "@/app/store"; +import { chHeadNm, fcltDiv, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { + ContentsDiv, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, + Title, + 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 { headMakeColSpan } from "../../fcltReg/rainReg/page"; +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"; + + +export const headMakeprfmnc = (upHeadList: TableUpperProps[] ,makeHeadNm:chHeadType[] ) => { + return ( + <> + <TableRow> + {upHeadList.map((head: TableUpperProps) => + !head.upSequnce ? ( + <TableHead rowSpan={2} key={head.id}> + {head.title} + </TableHead> + ) : head.upSequnce === 1 ? ( + <TableHead 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.map((head: TableUpperProps) => + makeHeadNm.find((ch)=> ch.headNm ===head.upName) ? ( + <TableHead key={head.id}>{head.title}</TableHead> + ) : null + )} + </TableRow> + </> + ); +}; +//----------------------- +export default function Page() { + + + + const [selFcltDiv, setSelFcltDiv] = useState("RST"); + + 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) => {}}> + 조회 + </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={() => {}}> + 양식받기 + </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> + </ContentsDiv> + ); +} diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx new file mode 100644 index 000000000..1bc9a624f --- /dev/null +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -0,0 +1,125 @@ +import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import type { text } from "stream/consumers"; + + + +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}, +] + +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 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: "yearSubWater", upSequnce: 1 }, +// { id: "sub2", title: "2월", upName: "yearSubWater", upSequnce: 2 }, +// { id: "sub3", title: "3월", upName: "yearSubWater", upSequnce: 3 }, +// { id: "sub4", title: "4월", upName: "yearSubWater", upSequnce: 4 }, +// { id: "sub5", title: "5월", upName: "yearSubWater", upSequnce: 5 }, +// { id: "sub6", title: "6월", upName: "yearSubWater", upSequnce: 6 }, +// { id: "sub7", title: "7월", upName: "yearSubWater", upSequnce: 7 }, +// { id: "sub8", title: "8월", upName: "yearSubWater", upSequnce: 8 }, +// { id: "sub9", title: "9월", upName: "yearSubWater", upSequnce: 9 }, +// { id: "sub10", title: "10월", upName: "yearSubWater", upSequnce: 10 }, +// { id: "sub11", title: "11월", upName: "yearSubWater", upSequnce: 11 }, +// { id: "sub12", title: "12월", upName: "yearSubWater", 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[] + }; +}; + +type rainChkgdnActions = { + rainChkgdnInit: (sggCd:string, searchTxt:string, flag:string) => void ; + }; + + +export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; + + +export const rainChkgdnStateExport: rainChkgdnState = { + rainChkgdn: { + rainChkgdnHeadList:rainChkgdnHeadList, + rainHeadNm:rainHeadNm + }, +}; + +export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( + set: any +) => { + return { + + rainChkgdnInit: async(sggCd:string, searchTxt:string ,flg:string ) =>{ + + }, + + }; +}; diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx new file mode 100644 index 000000000..7cfc37c65 --- /dev/null +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -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) => { + + }, + }; +}; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index 1116cdd19..9df44962f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -75,7 +75,7 @@ export const hdtflZod = z.object({ chgBuilding: z .array( z.object({ - bdstInfoFk: z.number().nullable(), + bdstInfoFk: z.number().nullish(), archChgPrmsnDt: z.coerce.date() , archChgArea: z.number().default(0), bdstChgNm: z.string().default(""), diff --git a/apps/wr/app/store/store.tsx b/apps/wr/app/store/store.tsx index 91f795ea4..07bc74685 100644 --- a/apps/wr/app/store/store.tsx +++ b/apps/wr/app/store/store.tsx @@ -31,6 +31,8 @@ import { } 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"; export type WrStore = comCodeType& pubFacType & @@ -38,7 +40,11 @@ export type WrStore = comCodeType& rswtFacType & matDmdType & htdflFacType& - bdstFulType; + bdstFulType& + rainChkgdnType& + rswtChkgdnType + ; + export const StoreZus = ( initState: comCodeState& rainFacState & @@ -46,7 +52,10 @@ export const StoreZus = ( rswtFacState & matDmdState & htdflFacState & - bdstState= { + bdstState & + rainChkgdnState& + rswtChkgdnState + = { ...comCodeStateExport, ...pubFacStateExport, ...rainFacStateExport, @@ -54,6 +63,8 @@ export const StoreZus = ( ...matDmdStateExport, ...htdflFacStateExport, ...bdstStateExport, + ...rainChkgdnStateExport, + ...rswtChkgdnStateExport } ) => { return createStore<WrStore>()((set) => { @@ -67,7 +78,9 @@ export const StoreZus = ( ...matDmdActionsExport(set), ...htdflFacActionsExport(set), ...codeActionExport(set), - ...bdstActionsExport(set) + ...bdstActionsExport(set), + ...rainChkgdnActionsExport(set), + ...rswtChkgdnActionsExport(set) }; }); }; diff --git a/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx new file mode 100644 index 000000000..e3c85465b --- /dev/null +++ b/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx @@ -0,0 +1,15 @@ +export default function ChkgdModal(){ + + + + + + return( + <> + </> + + + + ) + +} \ No newline at end of file diff --git a/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx new file mode 100644 index 000000000..9cdcd8152 --- /dev/null +++ b/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx @@ -0,0 +1,30 @@ +'use client' + +import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page"; +import { useWrStore } from "@/app/store"; +import { rainHeadNm } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { rswtHeadNm } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; +import { UiTable } from "@common/business_components/ui"; + +export default function RainChkgdTable() { + + const { code, rainChkgdn} = useWrStore((state) => state); + const nodeList = headMakeprfmnc(rainChkgdn?.rainChkgdnHeadList,rainChkgdn?.rainHeadNm ) ; + + + return( + + <> + <UiTable + tableData={[]} + headlist={rainChkgdn.rainChkgdnHeadList} + pageSize={100} + total={10} + headName={"지도점검 결과등록"} + cellClick={()=>{} } > + {nodeList} + </UiTable> + </> + ) + +} \ No newline at end of file diff --git a/apps/wr/components/ui/table/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/rswtChkgd/rswtChkgdTable.tsx new file mode 100644 index 000000000..376ab7a95 --- /dev/null +++ b/apps/wr/components/ui/table/rswtChkgd/rswtChkgdTable.tsx @@ -0,0 +1,30 @@ +'use client' + +import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page"; +import { useWrStore } from "@/app/store"; +import { UiTable } from "@common/business_components/ui"; + +export default function RswtChkgdTable() { + + const { rswtChkgdn} = useWrStore((state) => state); + const nodeList = headMakeprfmnc(rswtChkgdn?.rswtChkgdnHeadList , rswtChkgdn?.rswtHeadNm ); + + + return( + + <> + <UiTable + tableData={[]} + headlist={rswtChkgdn.rswtChkgdnHeadList} + pageSize={100} + total={10} + headName={"지도점검 결과등록"} + cellClick={() => { } } onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } } > + {nodeList} + </UiTable> + </> + ) + +} \ No newline at end of file From c054d635b11acaaa898b730fad69c6914f2e13a3 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Mon, 14 Apr 2025 18:10:26 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=8B=B1=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 10 +- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 84 ++++++++--- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 133 +++++++++++++++-- .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 36 ++++- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 31 +++- .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 42 +++++- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 7 +- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 4 +- .../ui/modal/chkgdExcel/chkgdExcel.tsx | 92 ++++++++++++ .../ui/modal/chkgdModal/chkgdModal.tsx | 140 +++++++++++++++++- .../ui/table/rainChkgd/rainChkgdTable.tsx | 2 - 11 files changed, 516 insertions(+), 65 deletions(-) create mode 100644 apps/wr/components/ui/modal/chkgdExcel/chkgdExcel.tsx diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index d41309f85..4dedd354f 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -107,7 +107,7 @@ export default function Home() { return ( <> - <ContentsDiv> + <ContentsDiv > <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"빗물이용시설 등록"} /> @@ -145,7 +145,8 @@ export default function Home() { <div className="grid grid-cols-6 gap-4 "> <div className="col-span-4 max-h-full ovreflow-y-scroll"> <ListDiv> - <UiTable + <ScrollArea className="h-full"> + <UiTable tableData={bdstTable || []} headlist={rain.upHeadList} pageSize={100} @@ -156,14 +157,15 @@ export default function Home() { }} > {nodeList} - </UiTable> + </UiTable> + </ScrollArea> </ListDiv> </div> <div className="col-span-2 max-h-full ovreflow-y-scroll"> <ListDiv> <ScrollArea> <RainRegForm - rainForm={rainForm || undefined} + rainForm={rainForm ?? {} as customRainBdst} isModal={false} ></RainRegForm> </ScrollArea> diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 52bd270e1..843a4682b 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -1,7 +1,10 @@ "use client"; import { useWrStore } from "@/app/store"; -import { chHeadNm, fcltDiv, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { + fcltDiv, + type chHeadType, +} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import { ContentsDiv, SearchDiv, @@ -10,20 +13,24 @@ import { 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 { headMakeColSpan } from "../../fcltReg/rainReg/page"; 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[] ) => { +export const headMakeprfmnc = ( + upHeadList: TableUpperProps[], + makeHeadNm: chHeadType[] +) => { return ( <> <TableRow> @@ -32,16 +39,22 @@ export const headMakeprfmnc = (upHeadList: TableUpperProps[] ,makeHeadNm:chHeadT <TableHead rowSpan={2} key={head.id}> {head.title} </TableHead> - ) : head.upSequnce === 1 ? ( - <TableHead key={head.id} rowSpan={1} colSpan={makeHeadNm.find((ch)=> ch.headNm ===head.upName)?.length}> - {makeHeadNm.find((ch)=> ch.headNm ===head.upName)?.text} + ) : head.upSequnce === 1 ? ( + <TableHead + 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.map((head: TableUpperProps) => - makeHeadNm.find((ch)=> ch.headNm ===head.upName) ? ( + makeHeadNm.find((ch) => ch.headNm === head.upName) ? ( <TableHead key={head.id}>{head.title}</TableHead> ) : null )} @@ -51,11 +64,20 @@ export const headMakeprfmnc = (upHeadList: TableUpperProps[] ,makeHeadNm:chHeadT }; //----------------------- 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 "> @@ -70,28 +92,37 @@ export default function Page() { setText={(e) => {}} /> <SelectBox - className={ "col-span-3 w-full h-full text-2xl"} + className={"col-span-3 w-full h-full text-2xl"} label={"시설구분"} selectClass={""} selectArray={fcltDiv} onSelectValue={setSelFcltDiv} - value={selFcltDiv??fcltDiv[0]?.val} + value={selFcltDiv ?? fcltDiv[0]?.val} /> </SearchFormLeft> <SearchFormRight> - <Button className="mr-4 rounded-lg" onClick={(e) => {}}> + <Button + className="mr-4 rounded-lg" + onClick={(e) => { + cellClick() + setIsDetail(!isDetail); + }} + > 조회 </Button> <Button className="mr-4 rounded-lg" onClick={() => {}}> 삭제 - </Button> + </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 className="mr-4 rounded-lg" + onClick={() => { + setIsExcel(!isDetail); + }}> 양식받기 </Button> </SearchFormRight> @@ -101,14 +132,23 @@ export default function Page() { <div className="grid grid-cols-6 gap-4 "> <div className="col-span-6"> <ListDiv> - {selFcltDiv === "RNB" ? ( - <RainChkgdTable /> - ) : ( - <RswtChkgdTable /> - )} + {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> ); } diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 1bc9a624f..6300e0108 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -1,8 +1,20 @@ 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:'빗물이용시설'}, @@ -18,6 +30,8 @@ export type chHeadType={ 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[] = [ @@ -42,6 +56,93 @@ export const rainChkgdnHeadList:TableUpperProps[] = [ { 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: "시도" }, @@ -53,18 +154,18 @@ export const rainChkgdnHeadList:TableUpperProps[] = [ // { id: "rainDtnbaOpct", title: "빗물저류조용량(m³)" }, // { id: "checkDay", title: "점검일" }, // { id: "utztnUsg", title: "이용용도" }, -// { id: "sub1", title: "1월" , upName: "yearSubWater", upSequnce: 1 }, -// { id: "sub2", title: "2월", upName: "yearSubWater", upSequnce: 2 }, -// { id: "sub3", title: "3월", upName: "yearSubWater", upSequnce: 3 }, -// { id: "sub4", title: "4월", upName: "yearSubWater", upSequnce: 4 }, -// { id: "sub5", title: "5월", upName: "yearSubWater", upSequnce: 5 }, -// { id: "sub6", title: "6월", upName: "yearSubWater", upSequnce: 6 }, -// { id: "sub7", title: "7월", upName: "yearSubWater", upSequnce: 7 }, -// { id: "sub8", title: "8월", upName: "yearSubWater", upSequnce: 8 }, -// { id: "sub9", title: "9월", upName: "yearSubWater", upSequnce: 9 }, -// { id: "sub10", title: "10월", upName: "yearSubWater", upSequnce: 10 }, -// { id: "sub11", title: "11월", upName: "yearSubWater", upSequnce: 11 }, -// { id: "sub12", title: "12월", upName: "yearSubWater", upSequnce: 12 }, +// { 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 }, @@ -94,6 +195,9 @@ export type rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList:TableUpperProps[] rainHeadNm:chHeadType[] + supWaterHeadList:TableUpperProps[] + supWaterData:supWaterDataType[] + rswtDetailHeadList:TableUpperProps[] }; }; @@ -108,7 +212,10 @@ export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; export const rainChkgdnStateExport: rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList:rainChkgdnHeadList, - rainHeadNm:rainHeadNm + rainHeadNm:rainHeadNm, + supWaterHeadList:supWaterHeadList, + supWaterData:supWaterData, + rswtDetailHeadList:rswtDetailHeadList, }, }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index 9df44962f..61cac7aa3 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -1,5 +1,5 @@ import { getFectch, postFectch, putFectch } from "@/components/lib/api"; -import { upHeadList, type bdstAll, type TableUpperProps } from "../rainReg"; +import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg"; import { z } from "zod"; @@ -7,8 +7,8 @@ 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(""), + 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), @@ -48,7 +48,8 @@ export const hdtflZod = z.object({ plwtYn: z.string().default(""), orgwtWtritSpt: z.number().default(0), orgwtOcrnProcs: z.string().default(""), - wtritEntrcTp: z.number().default(0), + wtritEntrcTp: z.number().max(4, "온도는 100이상이 될 수 없습니다.") + .default(0), amtgnr: z.number().default(0), prcsProcsYn: z.string().default(""), prcsFcltCpct: z.number().default(0), @@ -77,7 +78,7 @@ export const hdtflZod = z.object({ z.object({ bdstInfoFk: z.number().nullish(), archChgPrmsnDt: z.coerce.date() , - archChgArea: z.number().default(0), + archChgArea: z.string().default("-"), bdstChgNm: z.string().default(""), }) ) @@ -228,7 +229,30 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( try { const res = await postFectch("/drain/facility", data); if (res.ok) { - alert(" 등록이 완료되었습니다."); + + 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) => ({ diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index e2ab7c2f7..c978b36d9 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -58,7 +58,7 @@ export const rainZod = z.object({ z.object({ bdstInfoFk: z.number().nullish(), archChgPrmsnDt: z.coerce.date(), - archChgArea: z.number().default(0), + archChgArea: z.string().default("-"), bdstChgNm: z.string().default(""), }) ).default([]) @@ -69,7 +69,7 @@ export const rainZod = z.object({ export type chgBuilding={ bdstInfoFk: number|null, archChgPrmsnDt: Date, - archChgArea: number, + archChgArea: string, bdstChgNm: string } @@ -127,8 +127,10 @@ export type TableUpperProps = { title: string; upName?: string; upSequnce?: number; + edit?:boolean; }; + export const upHeadList: TableUpperProps[] = [ { id: "cityText", title: "시도" }, { id: "sggText", title: "시군구" }, @@ -188,7 +190,7 @@ const rainRes: customRainBdst[] = []; chgBuilding:[{ bdstInfoFk: 0, archChgPrmsnDt: new Date(), - archChgArea: 0, + archChgArea: "-", bdstChgNm: "" }] @@ -291,9 +293,28 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( try { const res = await postFectch("/reuseFc/rainyInfo", data); if(res.ok){ + + if(data.chgBuilding.length > 0){ + await res.json().then((resData: any) => { - - // alert(" 등록이 완료되었습니다.") + 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) => ({ diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 4a00e9d8f..73fa5206a 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -56,9 +56,18 @@ export const rswtZod = z.object({ altUswtrIdntyMthdCd: z.string().default("") }).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([]), }); @@ -161,10 +170,9 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( rswtUpdate: async (data: customRswtBdst) => { try { const res = await putFectch("/reuseFc/waterreuseFc", data); - if(res.ok){ - alert(" 수정이 완료되었습니다.") + if (res.ok) { + alert("등록이 완료되었습니다."); } - const rswtRes = await initFetch(undefined); set((state: rswtFacState) => ({ ...state, @@ -183,7 +191,29 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( try { const res = await postFectch("/reuseFc/waterreuseFc", data); if(res.ok){ - alert(" 등록이 완료되었습니다.") + 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) => ({ diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index bd9d0c460..c1a1a79ea 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -59,7 +59,6 @@ export default function BdstReg({ form }: { form: any }) { }, [selectSgg]) useEffect(() => { - console.log("form", form.getValues()); const subscription = form.form?.watch((value: any) => { console.log('vale', value) }); @@ -308,10 +307,10 @@ export default function BdstReg({ form }: { form: any }) { <FormUi label="면적"> <Input className="" - placeholder="1,000,000" + placeholder="-" type="text" - value={ field.value??0} - onChange={(e) => field.onChange(Number(e.target.value))} + value={ field.value??"-"} + onChange={(e) => field.onChange((e.target.value))} /> </FormUi> diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 36895009a..8e529d111 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -147,7 +147,7 @@ export function RainRegForm({ className="" placeholder="1,000,000" type="" - value={field.value ?? 0} + value={field.value ?? 0} onChange={(e) => { field.onChange(e.target.value === "" ? "" : Number(e.target.value)); }} @@ -299,11 +299,11 @@ export function RainRegForm({ className="" placeholder="1,000,000" type="" - {...field} onChange={(e) => { const value = e.target.value; field.onChange(value === "" ? "" : Number(value)); }} + value={field.value ?? 0} /> </FormUi> )} diff --git a/apps/wr/components/ui/modal/chkgdExcel/chkgdExcel.tsx b/apps/wr/components/ui/modal/chkgdExcel/chkgdExcel.tsx new file mode 100644 index 000000000..5e33a783e --- /dev/null +++ b/apps/wr/components/ui/modal/chkgdExcel/chkgdExcel.tsx @@ -0,0 +1,92 @@ +import { rainRegExcel } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { + DatePicker, + FileUpload, + Form, + FormField, + FormUi, + Title, +} from "@common/business_components/ui"; +import { Button } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import type { z } from "zod"; + +export default function ChkgdExcel({ type }: { type: string }) { + const [files, setFiles] = useState(null); + + const [dmdDate, setDmdDate] = useState(new Date()); + + const defaultValues: z.infer<typeof rainRegExcel> = rainRegExcel.parse({}); + + const form = useForm<z.infer<typeof rainRegExcel>>({ + resolver: zodResolver(rainRegExcel), + defaultValues: defaultValues, + }); + + const onChangeDate = (val: Date | undefined) => { + if (val) setDmdDate(val); + }; + return ( + <> + <div> + <Form {...form}> + <div> + <Title + title={ + type === "RNB" + ? "빗물 이용시설" + : "중수도 이용시설" + "점검 결과등록" + } + > +
+
+

+ {"○점검정보 입력"} +

+ + +
+ +
+ ( + + field.onChange(date), + }} + selectClass={selectClass} + /> + + )} + /> + + ( + + + + )} + /> +
+ +
+ + ); +} diff --git a/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx index e3c85465b..73e781487 100644 --- a/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgdModal/chkgdModal.tsx @@ -1,11 +1,149 @@ -export default function ChkgdModal(){ +import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page"; +import { useWrStore } from "@/app/store"; +import { ScrollArea, Title, UiTable } from "@common/business_components/ui"; +import { Button } from "@common/components/ui"; +import { useEffect } from "react"; + +export default function ChkgdModal({type, obj}:{type:string , obj:any} ){ + const { rainChkgdn} = useWrStore((state) => state); + + const nodeList = headMakeprfmnc(rainChkgdn?.supWaterHeadList,rainChkgdn?.rainHeadNm ) ; + const rswtnodeList = headMakeprfmnc(rainChkgdn?.rswtDetailHeadList,rainChkgdn?.rainHeadNm ) ; + + + useEffect(() =>{ + + },[rainChkgdn]) + + + const cellClick =(val:number|undefined, headId:string)=>{ + if(val!=undefined) + console.log(rainChkgdn.supWaterData[val]) + + + } return( <> + +
+
+ +
+
+

{"○"+ obj.bdstNm + `(${obj.chckYmd})`}

+ + +
+ + + { + cellClick(val, headId); + }} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } }> + + {nodeList} + + + + { + cellClick(val, headId); + }} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } }> + {nodeList} + + + + {type !=='RNB'? +
+ { + cellClick(val, headId); + }} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } }> + {rswtnodeList} + + + + { + cellClick(val, headId); + }} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } }> + {rswtnodeList} + + + + { + cellClick(val, headId); + }} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } }> + {rswtnodeList} + + + + { + cellClick(val, headId); + }} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } }> + {rswtnodeList} + + +
+ :<>} + +
+
diff --git a/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx index 9cdcd8152..c663bf95b 100644 --- a/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/rainChkgd/rainChkgdTable.tsx @@ -2,8 +2,6 @@ import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page"; import { useWrStore } from "@/app/store"; -import { rainHeadNm } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import { rswtHeadNm } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { UiTable } from "@common/business_components/ui"; export default function RainChkgdTable() { From 6cc600a8db85c07887cce74bac34b448be3b4510 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Tue, 15 Apr 2025 15:12:17 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EB=93=B1=EB=A1=9D=20=ED=98=84=ED=99=A9=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/page.tsx | 94 +++++++++++---- .../ruseFcltMng/fcltSttn/pbnstSttn/page.tsx | 114 ++++++++++++++++++ .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 17 ++- apps/wr/app/store/common/searchCode/index.ts | 0 .../ruseFcltMng/fcltReg/rainReg/index.tsx | 1 + .../ruseFcltMng/fcltSttn/pbnstSttn/index.tsx | 88 ++++++++++++++ apps/wr/app/store/store.tsx | 13 +- 7 files changed, 293 insertions(+), 34 deletions(-) create mode 100644 apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx create mode 100644 apps/wr/app/store/common/searchCode/index.ts create mode 100644 apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index d9a01bd36..2140a7eb6 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -1,39 +1,81 @@ -'use client' +"use client"; import Link from "next/link"; import { Button } from "@common/components/ui"; export default function Home() { return ( <> -
- -
- - - - +
+ {/* 시설 등록 */} +
+

시설 등록

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ {/* 지도점검 결과 */} +
+

지도점검 결과

+
+
+ +
+
+
-
- -
+ {/* 시설 현황 */} +
+

시설 현황

+
+
+ +
+
+
-
- -
+ {/* 수요처 관리 */} +
+

수요처 관리

+
+
+ +
+
+
); diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx new file mode 100644 index 000000000..b0ce1a124 --- /dev/null +++ b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -0,0 +1,114 @@ +"use client"; +import { useWrStore } from "@/app/store"; +import { + ContentsDiv, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SelectBox, + Title, + 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"; + +export default function PbnstSttn() { + const { code,pbnStt } = useWrStore((state) => state); + + const nodeList = headMakeprfmnc(pbnStt.pbnSttHeadList, pbnStt.pbnSttHeadNm); + + return ( + <> + +
+
+ + <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={() => {}}> + 조회항목설정 + </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> + </ContentsDiv> + </> + ); +} diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 843a4682b..81fc5b88a 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -34,13 +34,18 @@ export const headMakeprfmnc = ( return ( <> <TableRow> - {upHeadList.map((head: TableUpperProps) => + {upHeadList + .filter((data) => data.visible !=false) + .map((head: TableUpperProps) => !head.upSequnce ? ( - <TableHead rowSpan={2} key={head.id}> + <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={ @@ -53,9 +58,13 @@ export const headMakeprfmnc = ( )} </TableRow> <TableRow> - {upHeadList.map((head: TableUpperProps) => + {upHeadList + .filter((data) => data.visible !=false) + .map((head: TableUpperProps) => makeHeadNm.find((ch) => ch.headNm === head.upName) ? ( - <TableHead key={head.id}>{head.title}</TableHead> + <TableHead + className={ `border border-gray-600 px-2 py-1 `} + key={head.id}>{head.title}</TableHead> ) : null )} </TableRow> diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index c978b36d9..a74870bd1 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -128,6 +128,7 @@ export type TableUpperProps = { upName?: string; upSequnce?: number; edit?:boolean; + visible?:boolean; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx new file mode 100644 index 000000000..2a9c00b05 --- /dev/null +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx @@ -0,0 +1,88 @@ +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 const headVisibleSchema = z.array( + z.object( + Object.fromEntries( + pbnSttHeadList.map(col => [col.id, z.boolean()]) + )) + ); + + + + + +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 ) =>{ + + }, + + }; +}; + diff --git a/apps/wr/app/store/store.tsx b/apps/wr/app/store/store.tsx index 07bc74685..4e49f412a 100644 --- a/apps/wr/app/store/store.tsx +++ b/apps/wr/app/store/store.tsx @@ -33,6 +33,7 @@ import { codeActionExport, comCodeStateExport, getCityCd, getSggCd, type comCode 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 & @@ -42,7 +43,8 @@ export type WrStore = comCodeType& htdflFacType& bdstFulType& rainChkgdnType& - rswtChkgdnType + rswtChkgdnType& + pbnSttType ; export const StoreZus = ( @@ -54,7 +56,8 @@ export const StoreZus = ( htdflFacState & bdstState & rainChkgdnState& - rswtChkgdnState + rswtChkgdnState& + pbnstSttnState = { ...comCodeStateExport, ...pubFacStateExport, @@ -64,7 +67,8 @@ export const StoreZus = ( ...htdflFacStateExport, ...bdstStateExport, ...rainChkgdnStateExport, - ...rswtChkgdnStateExport + ...rswtChkgdnStateExport, + ...pbnSttStateExport } ) => { return createStore<WrStore>()((set) => { @@ -80,7 +84,8 @@ export const StoreZus = ( ...codeActionExport(set), ...bdstActionsExport(set), ...rainChkgdnActionsExport(set), - ...rswtChkgdnActionsExport(set) + ...rswtChkgdnActionsExport(set), + ...pbnSttActionsExport(set) }; }); };