원수취수 작업중

This commit is contained in:
jyha00
2025-05-28 17:16:21 +09:00
parent ab2c28bec6
commit 055091d64d
4 changed files with 97 additions and 42 deletions
@@ -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: "위치" },
]
@@ -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",
@@ -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<ppInstlType[] | null>(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<boolean>(false);
const [isFcOrgwts, setIsFcOrgwts] = useState<boolean>(false);
const [modalData, setModalData] = useState<fcOrgwtType | null>(null);
@@ -75,6 +72,12 @@ const [ isFcOrgwts, setIsFcOrgwts] = useState<boolean>(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<boolean>(false);
}, [form.formState.errors]);
return (
<>
<div className=" !mx-[1.6rem] !p-0r">
{/* 차수별 등록 현황 폼 */}
<div className="justify-between">
@@ -193,7 +197,18 @@ const [ isFcOrgwts, setIsFcOrgwts] = useState<boolean>(false);
<h1 className={formH1Class}>재이용 원수취수 현황</h1>
<div>
<Button type="button" onClick={() => {setIsFcOrgwts(true)} }size={commonButonSize}>추가등록</Button>
<Button
type="button"
onClick={
// () => {
// setIsFcOrgwts(true)
// setModalData(modalData)
// }
buttonClick
}
size={commonButonSize}>
추가등록
</Button>
<RuseMngTable
tableData={fcOrgwtFiled}
headList={pbnst.pbnstOrgwtHeadList}
@@ -267,9 +282,10 @@ const [ isFcOrgwts, setIsFcOrgwts] = useState<boolean>(false);
<UiModal
open={isFcOrgwts}
onOpenChange={(open: boolean) => setIsFcOrgwts(open)}
bodyClass={"w-[68vw] max-w-none h-[60vh]"}
body={<FcOrgwtsRegModal></FcOrgwtsRegModal>}
bodyClass={"w-[60vw] max-w-none h-[60vh]"}
body={<FcOrgwtsRegModal data={ modalData || []}></FcOrgwtsRegModal>}
></UiModal>
</div>
</>
);
}
@@ -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<customPbnst[]>();
const [isFcOrgwtsData, setIsFcOrgwtsData] = useState<boolean>(false);
const [pkTable, setPkTable] = useState<customPbnst[]>();
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 (
<>
<div className="flex flex-col h-full">
<div>
<Title title={"취수하수처리장 추가"} />
<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}