diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx index ac33f48ac..8aa75fd28 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx @@ -16,7 +16,7 @@ export const pubFacHeadListExport: TableUpperProps[] = [ { id: "authoDay", title: "등록여부" }, ]; -export const pubMngUpHeadListExport: TableUpperProps[] = [ +export const pbnstMngUpHeadListExport: TableUpperProps[] = [ { id: "mng", title: "운영방식" }, { id: "subCo", title: "대행업체" }, { id: "startDay", title: "시작일", upName: "upChangeRe", upSequnce: 1 }, @@ -24,7 +24,7 @@ export const pubMngUpHeadListExport: TableUpperProps[] = [ ]; -export const pubOrgwtHeadListExport: TableUpperProps[] = [ +export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [ { id: "ruseUtztnFcltNm", title: "운영방식" }, { id: "orgwtWtritQnt", title: "원수취수량" }, { id: "tmsYn", title: "하수처리량TMS 전후", }, @@ -33,7 +33,7 @@ export const pubOrgwtHeadListExport: TableUpperProps[] = [ ]; const date = new Date(); -export const pubMngNmExport: chHeadType[] = [ +export const pbnstMngNmExport: chHeadType[] = [ { headNm: "upChangeRe", text: "운영대행기간", length: 2 }, ]; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index b8e3a00ea..a4ee07a95 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -2,34 +2,36 @@ import { z } from "zod"; import type { TableUpperProps } from "../rainReg"; import { getFetch } from "@/components/lib/api"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; -import { pubFacHeadListExport, pubMngNmExport, pubMngUpHeadListExport } from "./headList"; import { exampleData, fcBizSchema, type customPbnst, type pubHasuType } from "./type"; import type { SelectDataType } from "@common/business_components/ui"; +import { pbnstMngUpHeadListExport, pbnstOrgwtHeadListRxport, pbnstMngNmExport, pubFacHeadListExport } from "./headList"; const selectLabel: SelectDataType[] = [{ text: "test", val: "1" }]; const pubFacHeadList= pubFacHeadListExport; -const pubMngUpHeadList = pubMngUpHeadListExport -const pubMngNm= pubMngNmExport; +const pbnstMngUpHeadList = pbnstMngUpHeadListExport +const pbnstOrgwtHeadList =pbnstOrgwtHeadListRxport +const pbnstMngNm= pbnstMngNmExport; export type pubFacState = { pbnst: { isInit: boolean; pubFacHeadList: TableUpperProps[]; - pubMngUpHeadList: TableUpperProps[]; - pubMngNm: chHeadType[]; + pbnstMngUpHeadList: TableUpperProps[]; + pbnstMngNm: chHeadType[]; pbnstHasuRes: pubHasuType[] - selectLabel: SelectDataType[]; pbnstRes: customPbnst[]; pbnstBizCycle: SelectDataType[]; + selectLabel: SelectDataType[]; + pbnstOrgwtHeadList:TableUpperProps[] }; }; type pubFacActions = { + pubHasuInit: (txt: string | undefined) => void; pbnstRegInit: (sgg: string) => void; pbnstRegSearch: (txt: string | undefined, sgg: string) => void; pbnstReg: (txt: string | undefined) => void; - pubHasuInit: (txt: string | undefined) => void; }; export type pubFacType = pubFacState & pubFacActions; @@ -38,12 +40,13 @@ export const pubFacStateExport: pubFacState = { pbnst: { isInit: false, pubFacHeadList: pubFacHeadList, - pubMngUpHeadList: pubMngUpHeadList, - selectLabel: selectLabel, - pubMngNm: pubMngNm, + pbnstMngUpHeadList: pbnstMngUpHeadList, + pbnstMngNm: pbnstMngNm, + pbnstOrgwtHeadList:pbnstOrgwtHeadList, pbnstHasuRes: [], pbnstRes: [], - pbnstBizCycle:[] + pbnstBizCycle:[{text:'없음', val:'1'}], + selectLabel: selectLabel, }, }; @@ -55,13 +58,14 @@ const initFetch = async (txt: string | undefined) => { return rainRes; }; -const getBizCycle = async (fcBizs: z.infer[] ) => { +const getBizCycle = (fcBizs: z.infer[] ) => { const pbnstBizCycle =fcBizs.map((item: z.infer) => { return { - text: `${item.cycl}차수`, + text: `${item.cycl}차`, val: item.cycl, }; }); + return pbnstBizCycle; } export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { @@ -92,6 +96,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { const pbnstRes = exampleData; const pbnstBizCycle = getBizCycle(pbnstRes?.fcBizs); + return set((state: pubFacState) => ({ ...state, pbnst: { 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 0c9aa6bef..d566fec8f 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -1,9 +1,7 @@ "use client"; import { SelectBox } from "@common/business_components"; -import { - FormUi, -} from "@common/business_components/ui"; +import { FormUi } from "@common/business_components/ui"; import { Form, FormField } from "@common/business_components/ui/form"; import { Button, Input, TableHead, TableRow } from "@common/components"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -28,18 +26,16 @@ import { ruseFcltinfo, wasteWaterFcltINfo, } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList"; -import { pbnstRegZod } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; - +import { pbnstRegZod } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; +import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable"; export function PbnstBuseForm() { const { code, pbnst } = useWrStore((state) => state); - const { pubMngUpHeadList,pbnstBizCycle } = pbnst; - const [getBizCycle, setBizCycle] = useState(''); - + const { pbnstBizCycle } = pbnst; + const [getBizCycle, setBizCycle] = useState([{ text: "없음", val: "1" }]); const form = useForm>({ resolver: zodResolver(pbnstRegZod), - }); // 2. Define a submit handler. @@ -56,13 +52,16 @@ export function PbnstBuseForm() { const [bizCmcnDate, setBizCmcnDate] = useState(new Date()); const [files, setFiles] = useState(null); useEffect(() => { - if (getBizCycle ) { - console.log("getBizCycle", getBizCycle); - - form.reset() + console.log("getBizCycle", getBizCycle); + if (getBizCycle) { + form.reset(); } }, [getBizCycle]); + useEffect(() => { + console.log("pbnstBizCycle", pbnstBizCycle); + }, [pbnstBizCycle]); + return (
{/* 차수별 등록 현황 폼 */} @@ -76,18 +75,22 @@ export function PbnstBuseForm() {

등록차수

- - 0 && pbnstBizCycle[0]? pbnstBizCycle[0].val : ""} - className={""} - selectClass={selectClass} - onSelectValue={(val) => {setBizCycle}} - > - - + 0 && pbnstBizCycle[0] + ? pbnstBizCycle[0].val + : "" + } + className={""} + selectClass={selectClass} + onSelectValue={(val) => { + setBizCycle; + }} + > +
@@ -98,7 +101,7 @@ export function PbnstBuseForm() { moClass="grid grid-cols-12 gap-4" sonClass="col-span-4" /> - +

재이용 원수취수 현황

+
+ + +
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 dc18ebd4a..699a687e9 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -37,7 +37,7 @@ const formSchema = z.object({ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) { const { pbnst } = useWrStore((state) => state); - const { pubMngUpHeadList, isInit } = pbnst; + const { pbnstMngUpHeadList, isInit } = pbnst; const [ruseOperData, setRuseOperData] = useState(); const [planFiles, setPlanFiles] = useState(null); const [relationfiles, setRelationFiles] = useState(null); @@ -114,33 +114,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) { // handleSuccess: setUpload, // }) }, [relationfiles]); - const headMakeColSpan = (upHeadList: TableUpperProps[]) => { - return ( - <> - - {upHeadList.map((head: TableUpperProps) => - !head.upSequnce ? ( - - {head.title} - - ) : head.upName === "upChangeRe" && head.upSequnce === 1 ? ( - - {"운영대행기간"} - - ) : null - )} - - - {upHeadList.map((head: TableUpperProps) => - head.upName === "upChangeRe" ? ( - {head.title} - ) : null - )} - - - ); - }; - const nodeList = headMakeColSpan(pubMngUpHeadList); + return (
@@ -186,8 +160,8 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx index 6ba5739db..121ad80f4 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx @@ -1,7 +1,15 @@ import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { Input, Table, TableBody, TableCell, TableHeader, TableRow } from "@common/components/ui"; +import { + Input, + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@common/components/ui"; export default function RuseMngTable({ tableData, @@ -10,13 +18,23 @@ export default function RuseMngTable({ }: { tableData: any[]; headList: TableUpperProps[]; - upHeadList: chHeadType[]; + upHeadList?: chHeadType[]; }) { return ( <> - {headMakeprfmnc(headList, upHeadList)} + {upHeadList ? ( + headMakeprfmnc(headList, upHeadList) + ) : ( + + {headList.map((head) => ( + + {head.title} + + ))} + + )} @@ -32,9 +50,7 @@ export default function RuseMngTable({ { - ; - }} + onChange={(e) => {}} value={item[head.id] || ""} /> ) : (