Merge commit '055091d64db22ad32f84c4f6f43cd6c9a123e006' into iipbs/wr/hasuReg
This commit is contained in:
@@ -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<string>();
|
||||
const [bdstTable, setbdstTable] = useState<customPbnst[]>();
|
||||
const [selectBdst, setSelectBdst] = useState<customPbnst | null>(null);
|
||||
const [selectedRow, setSelectedRow] = useState<customPbnst | null>(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(() => {
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
<UiModal
|
||||
body={<PbnstRegModal></PbnstRegModal>}
|
||||
body={<PbnstRegModal data={selectedRow || []}></PbnstRegModal>}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
@@ -149,6 +159,7 @@ useEffect(() => {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Toaster position="top-center" />
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -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: "위치" },
|
||||
|
||||
]
|
||||
|
||||
|
||||
@@ -109,6 +109,12 @@ const getBizCycle = (fcBizs: z.infer<typeof fcBizSchema>[]) => {
|
||||
|
||||
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) => {
|
||||
@@ -132,7 +138,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;
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ export const exampleData = {
|
||||
},
|
||||
{
|
||||
pbnstRuseFcltBizFk: 1,
|
||||
swtrmtFcltFk: "11000SW001R",
|
||||
swtrmtFcltFk: "11200PB001R",
|
||||
orgwtWtritQnt: "153",
|
||||
tmsYn: "Y",
|
||||
dschgFmYn: "N",
|
||||
@@ -412,7 +412,7 @@ export const exampleData = {
|
||||
fcOrgwts: [
|
||||
{
|
||||
pbnstRuseFcltBizFk: 11,
|
||||
wtrmtFcltFk: "11000SW001R",
|
||||
swtrmtFcltFk: "11000SW001R",
|
||||
orgwtWtritQnt: "152",
|
||||
tmsYn: "Y",
|
||||
dschgFmYn: "N",
|
||||
@@ -422,7 +422,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}
|
||||
|
||||
@@ -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<SelectDataType[] | []>()
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({sgg:"",city:""});
|
||||
const [searchTxt, setSearchTxt] = useState<string>()
|
||||
const [bdstTable, setbdstTable] = useState<customPbnst[]>();
|
||||
const [selectBdst, setSelectBdst] = useState<customPbnst | null>(null);
|
||||
const [pbnstBiz, setPbnstBiz] = useState<fcBizType[]>();
|
||||
const [pbnstBdstForm, setPbnstBdstForm] = useState<customPbnst>({} as customPbnst);
|
||||
const [currentTab, setCurrentTab] = useState<string>("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 (
|
||||
<>
|
||||
<div className="grid grid-cols-12 gap-4 mt-4 items-center">
|
||||
<SelectBox
|
||||
className="col-span-3 h-full"
|
||||
label={"시도"}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.cityCd || []}
|
||||
onSelectValue={getSelCity}
|
||||
>
|
||||
{""}
|
||||
</SelectBox>
|
||||
<SelectBox
|
||||
className="col-span-3 h-full"
|
||||
label={"시군구"}
|
||||
selectClass={selectClass}
|
||||
selectArray={selectSgg || []}
|
||||
onSelectValue={getSgg}
|
||||
>
|
||||
{" "}
|
||||
</SelectBox>
|
||||
<Label className="w-full text-xl text-gray-600 text-right">시설명</Label>
|
||||
<Input className="w-full h-full !text-xl col-span-2 col-start-8" type="text" value={searchTxt || ''} onChange={()=>{}}/>
|
||||
<Button className="" size={"sm"} onClick={()=>{}}>조회</Button>
|
||||
</div>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<div className="h-auto">
|
||||
<h1 className="text-2xl font-medium text-label pl-8">공공 하수처리시설 목록</h1>
|
||||
<ScrollArea className="h-[30vh]">
|
||||
<div>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={pbnst.pubFacHeadList}
|
||||
pageSize={-10}
|
||||
total={-1}
|
||||
headName={undefined}
|
||||
cellClick={(idx, headId) => (tableClick(idx, headId || ""))}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}>
|
||||
{/* {nodeList} */}
|
||||
</UiTable>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<ScrollArea className="h-[40vh]">
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="mng">시설정보</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="buse">차수별정보</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="max-h-full" value="mng">
|
||||
<PbnstMngForm mngForm={pbnstBdstForm as customPbnst} isModal={true} />
|
||||
</TabsContent>
|
||||
<TabsContent className="max-h-full" value="buse">
|
||||
<PbnstBuseForm buseForm={pbnstBdstForm as customPbnst} isModal={true} />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
<div>
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!data) return;
|
||||
console.log("데이터", data)
|
||||
}, [data]);
|
||||
|
||||
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
return (
|
||||
<>
|
||||
<h1 className="text-2xl font-medium text-label pl-8">하수재이용 시설 신규등록</h1>
|
||||
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<ScrollArea className="h-[75vh]">
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="mng">시설정보</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="buse">차수별정보</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="max-h-full" value="mng">
|
||||
<PbnstMngForm mngForm={pbnstBdstForm as customPbnst} isModal={true} />
|
||||
</TabsContent>
|
||||
<TabsContent className="max-h-full" value="buse">
|
||||
<PbnstBuseForm buseForm={pbnstBdstForm as customPbnst} isModal={true} />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</ScrollArea>
|
||||
</>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user