From 98decab51282bccbd5d0f4b8522fd1d2ed0f9f8b Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 28 May 2025 13:07:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=8B=A0=EA=B7=9C=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?=ED=8C=9D=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 13 +- .../ruseFcltMng/fcltReg/pbnstReg/index.tsx | 8 +- .../fcltReg/pbnstReg/mngReg/mngRegForm.tsx | 4 +- .../fcltReg/pbnstRegModal/pbnstRegModal.tsx | 123 +++++------------- 4 files changed, 51 insertions(+), 97 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 1aec73e63..95666f8ca 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -20,6 +20,7 @@ import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRe import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm"; import { z } from "zod"; import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal"; +import { Toaster } from "react-hot-toast"; export default function PublicReuseFaciltyInsert() { const { code, pbnst, pubHasuInit,pbnstRegInit } = useWrStore((state) => state); @@ -32,6 +33,7 @@ export default function PublicReuseFaciltyInsert() { const [searchTxt, setSearchTxt] = useState(); const [bdstTable, setbdstTable] = useState(); const [selectBdst, setSelectBdst] = useState(null); + const [selectedRow, setSelectedRow] = useState(null); useEffect(() => { if (!pbnst.isInit ) { @@ -55,6 +57,14 @@ useEffect(() => { }; const cellClick = (val: number | undefined) => { if (val === undefined) return; + console.log("pbnstRes", pbnstRes) + const selectRow = pbnstHasuRes?.[val]; + setSelectedRow(selectRow); + console.log("아제발", selectRow) + if (pbnstRes === null){ + alert("등록된 재이용시설 정보가 없습니다. 신규등록 하십시오.") + return; + } setSelectBdst(pbnstRes); setPbnstBiz(pbnstRes?.fcBizs) }; @@ -141,7 +151,7 @@ useEffect(() => { } + body={} bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { @@ -149,6 +159,7 @@ useEffect(() => { }} /> + ); diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index aaafb9ba4..29af7285a 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -102,6 +102,12 @@ const getBizCycle = (fcBizs: z.infer[]) => { return pbnstBizCycle; }; + +const initFetch = async (code:string|undefined) => { + const pbnstRes =await getFetch("wr", `${code}`); + return pbnstRes; +}; + export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { return { pubHasuInit: async (txt: string | undefined) => { @@ -125,7 +131,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { pbnstRegInit: async (txt: string | undefined) => { try { - //const pbnstRes = await initFetch(txt); + // const pbnstRes = await initFetch(txt); const pbnstRes = exampleData; diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx index 3d37a8832..4ffae932d 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -76,8 +76,8 @@ export function PbnstMngForm({ data }: { data: customPbnst }) { const onSelectValue = (val: string) => {}; useEffect(() => { - form.reset(data); - setRuseOperData(data?.fcOpers); + form.reset(data); + setRuseOperData(data.fcOpers); }, [data]); // 2. Define a submit handler. diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index 3d33d3e92..b46bd028e 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -7,114 +7,51 @@ import { getCity } from "@/components/lib/func/commom"; import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm"; import { ScrollArea, SelectBox, UiTable, type SelectDataType } from "@common/business_components"; import { Button, Input, Label, Tabs, TabsContent, TabsList, TabsTrigger } from "@common/components/ui"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import type { objSearchType } from "../bdstRegModal/bdstRegModal"; import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm"; -export function PbnstRegModal() { - const {code, pbnst} = useWrStore((state) => { + +export function PbnstRegModal({ data }: { data: customPbnst }) { + + const { code, pbnst } = useWrStore((state) => { return state; }); const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst; - const [selectSgg, setSelectSgg] = useState() - const [objSearch, setObjSearch] = useState({sgg:"",city:""}); - const [searchTxt, setSearchTxt] = useState() - const [bdstTable, setbdstTable] = useState(); - const [selectBdst, setSelectBdst] = useState(null); - const [pbnstBiz, setPbnstBiz] = useState(); const [pbnstBdstForm, setPbnstBdstForm] = useState({} as customPbnst); const [currentTab, setCurrentTab] = useState("mng"); // const nodeList = headMakeColSpan(pubFacHeadList.moUpHeadList); - const getSelCity = (val: string | number) => { - const cityValue = String(val); - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: '' }); - }; - const getSgg = (val: string | number) => { - console.log(val); - setObjSearch({...objSearch,sgg: String(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); - // } - // } - } + const handleTabChange = (value: string) => { setCurrentTab(value); }; - return ( - <> -
- - {""} - - - {" "} - - - {}}/> - -
-
-
-

공공 하수처리시설 목록

- -
- (tableClick(idx, headId || ""))} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}> - {/* {nodeList} */} - -
-
-
- - - - 시설정보 - 차수별정보 - - - - - - - - -
- - + useEffect(() => { + if (!data) return; + console.log("데이터", data) + }, [data]); - -
-
-
+ return ( + <> +

하수재이용 시설 신규등록

+ +
+ + + + 시설정보 + 차수별정보 + + + + + + + + + - + ) } From 055091d64db22ad32f84c4f6f43cd6c9a123e006 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 28 May 2025 17:16:21 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EC=9B=90=EC=88=98=EC=B7=A8=EC=88=98=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltReg/pbnstReg/headList.tsx | 6 +- .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 6 +- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 74 +++++++++++-------- .../fcOrgwtsRegModal/fcOrgwtsRegModal.tsx | 53 +++++++++++-- 4 files changed, 97 insertions(+), 42 deletions(-) diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx index 62feda6dc..a0dce391a 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx @@ -52,10 +52,10 @@ export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [ { id: "dtlPstnExpln", title: "상세위치 설명", }, ]; export const fcOrgwtsHeadListExport: TableUpperProps[] = [ - { id: "sido", title: "운영방식" }, - { id: "gugun", title: "원수취수량" }, + { id: "sido", title: "시도" }, + { id: "gugun", title: "시군구" }, { id: "bscFctNm", title: "시설명" }, - { id: "addr", title: "상세위치 설명" }, + { id: "addr", title: "위치" }, ] diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index 29bec52b9..1c356019c 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -316,7 +316,7 @@ export const exampleData = { }, { pbnstRuseFcltBizFk: 1, - swtrmtFcltFk: "11000SW001R", + swtrmtFcltFk: "11200PB001R", orgwtWtritQnt: "153", tmsYn: "Y", dschgFmYn: "N", @@ -410,7 +410,7 @@ export const exampleData = { fcOrgwts: [ { pbnstRuseFcltBizFk: 11, - wtrmtFcltFk: "11000SW001R", + swtrmtFcltFk: "11000SW001R", orgwtWtritQnt: "152", tmsYn: "Y", dschgFmYn: "N", @@ -420,7 +420,7 @@ export const exampleData = { }, { pbnstRuseFcltBizFk: 11, - wtrmtFcltFk: "11000SW001R", + swtrmtFcltFk: "11200PB001R", orgwtWtritQnt: "150", tmsYn: "Y", dschgFmYn: "N", diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index 1743e3b8c..60391fd18 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -1,28 +1,6 @@ "use client"; -import { SelectBox } from "@common/business_components"; -import { - FormUi, - UiModal, - type SelectDataType, -} from "@common/business_components/ui"; -import { Form, FormField } from "@common/business_components/ui/form"; -import { Button, Input, Label, TableHead, TableRow } from "@common/components"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { set, useFieldArray, useForm } from "react-hook-form"; -import { use, useEffect, useRef, useState } from "react"; -import { z } from "zod"; import { useWrStore } from "@/app/store"; -import { - selectClass, - type TableUpperProps, -} from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { - commonButonSize, - formH1Class, - formTableName, -} from "@/components/lib/class/comClass"; -import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail"; import { businessMoneyInfo, businessSttnInfo, @@ -33,13 +11,31 @@ import { } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList"; import { fcBizSchema, - pbnstRegZod, type fcBizType, type fcOrgwtType, - type ppInstlType, + type ppInstlType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; -import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable"; +import { + selectClass +} from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { + commonButonSize, + formH1Class, + formTableName, +} from "@/components/lib/class/comClass"; import FcOrgwtsRegModal from "@/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal"; +import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable"; +import { SelectBox } from "@common/business_components"; +import { + UiModal, + type SelectDataType +} from "@common/business_components/ui"; +import { Form } from "@common/business_components/ui/form"; +import { Button, Input, Label } from "@common/components"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useEffect, useRef, useState } from "react"; +import { useFieldArray, useForm } from "react-hook-form"; +import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail"; export function PbnstBuseForm({ data }: { data: fcBizType[] }) { // const ref = useRef(data[0]?.pplInstls ?? null); @@ -52,7 +48,8 @@ export function PbnstBuseForm({ data }: { data: fcBizType[] }) { const [ppiSelectList, setPpiSelectList] = useState<[{ name: string; val: SelectDataType[] }]>(); const [ppiYn, setPpiYn] = useState("Y"); -const [ isFcOrgwts, setIsFcOrgwts] = useState(false); + const [isFcOrgwts, setIsFcOrgwts] = useState(false); + const [modalData, setModalData] = useState(null); @@ -75,6 +72,12 @@ const [ isFcOrgwts, setIsFcOrgwts] = useState(false); name: "pplInstls", }); + const buttonClick = () => { + console.log("머임?", data[0]?.fcOrgwts) + setIsFcOrgwts(true); + const moData = data[0]?.fcOrgwts; + setModalData(moData); + } const plusHist = () => { @@ -127,6 +130,7 @@ const [ isFcOrgwts, setIsFcOrgwts] = useState(false); }, [form.formState.errors]); return ( + <>
{/* 차수별 등록 현황 폼 */}
@@ -193,7 +197,18 @@ const [ isFcOrgwts, setIsFcOrgwts] = useState(false);

재이용 원수취수 현황

- + (false); setIsFcOrgwts(open)} - bodyClass={"w-[68vw] max-w-none h-[60vh]"} - body={} + bodyClass={"w-[60vw] max-w-none h-[60vh]"} + body={} >
+ ); } diff --git a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx index dc4144073..eb44fba66 100644 --- a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx @@ -1,29 +1,65 @@ "use client"; import { useWrStore } from "@/app/store"; +import type { customPbnst, fcBizType, fcOrgwtType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; +import { tableData } from "@/components/lib/func/commom"; import { Title, UiTable } from "@common/business_components/ui"; +import { Label } from "@common/business_components/ui/form/lib/label"; +import { Button } from "@common/business_components/ui/table/lib/button"; +import { Input } from "@common/components/ui"; import { ArrowLeft, ArrowRight } from "lucide-react"; import { useEffect, useState } from "react"; -export default function FcOrgwtsRegModal() { +export default function FcOrgwtsRegModal({ data }: { data: fcOrgwtType[] }) { const { code, pbnst } = useWrStore((state) => state); - const { fcOrgwtsHeadList } = pbnst; - + const { fcOrgwtsHeadList, pbnstHasuRes } = pbnst; + const [bdstTable, setbdstTable] = useState(); const [isFcOrgwtsData, setIsFcOrgwtsData] = useState(false); + const [pkTable, setPkTable] = useState(); useEffect(() => { console.log("isFcOrgwtsData", isFcOrgwtsData); }, [isFcOrgwtsData]); + useEffect(() => { + // console.log("어휴", pbnstHasuRes); + if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { + setbdstTable(tableData(pbnstHasuRes, { code })); + } + }, [code, pbnstHasuRes]); + + useEffect(() => { + if (!data) return; + const findPk = data.map(element => { + const pk = pbnstHasuRes.find((item)=> String(item.bscFctCd) === element.swtrmtFcltFk) + return pk; + }); + + setPkTable(findPk); + }, [data]); + + useEffect(()=>{ + + }) + return ( <>
+ <Button className="m-2" size={"sm"} onClick={()=>{}}>저장</Button> </div> + <div className="flex flex-row flex-grow gap-4 mt-4"> <div className="w-3/7"> + <Label className="w-full text-2xl text-gray-600 text-right">공공하수처리시설 목록</Label> + <div className="flex items-center"> + <Label className="w-full text-xl text-gray-600 text-right">시설명</Label> + <Input className="w-1/3 !text-xl ml-2" type="text" value={""} onChange={(e) => {}}/> + <Button className="m-2" size={"sm"} onClick={()=>{}}>조회</Button> + </div> + <div className="border-t border-gray-300 my-4"></div> <UiTable - headName={"공공하수처리시설 목록"} - tableData={[]} + headName={""} + tableData={bdstTable || []} headlist={fcOrgwtsHeadList} pageSize={0} total={0} @@ -41,13 +77,16 @@ export default function FcOrgwtsRegModal() { }} className="w-12 h-12 text-gray-500" /> - <ArrowLeft className="w-12 h-12 text-gray-500" /> + <ArrowLeft + type="button" + onClick={() => {}} + className="w-12 h-12 text-gray-500" /> </div> {/* Right Table container: Takes 2/5 of the width */} <div className="w-3/7"> <UiTable headName={"취수하수처리장 목록"} - tableData={[]} + tableData={pkTable || []} headlist={fcOrgwtsHeadList} pageSize={0} total={0}