diff --git a/apps/wr/app/loading.jsx b/apps/wr/app/loading.jsx deleted file mode 100644 index 5d639b857..000000000 --- a/apps/wr/app/loading.jsx +++ /dev/null @@ -1,10 +0,0 @@ -export default function loading (){ - - return( - <> -
- 'test' -
- - ) -} \ No newline at end of file diff --git a/apps/wr/app/loading.tsx b/apps/wr/app/loading.tsx new file mode 100644 index 000000000..80b268890 --- /dev/null +++ b/apps/wr/app/loading.tsx @@ -0,0 +1,4 @@ +export default function Loading() { + return
페이지 불러오는 중입니다...
; + } + \ No newline at end of file diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 4dedd354f..df5d2c285 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -59,12 +59,14 @@ export default function Home() { }); const { rainRes } = rain; const [rainForm, setRainForm] = useState(); - const [issNewReg,setIsNewReg] = useState( false); + const [issNewReg, setIsNewReg] = useState(false); const [bdstTable, setbdstTable] = useState(); const [searchTxt, setSearchTxt] = useState(); - const [bdstChgProps, setBdstChgProps] = useState<{isOpen:boolean,chgBuilding:chgBuilding[]}>({isOpen:false,chgBuilding:[] }); - + const [bdstChgProps, setBdstChgProps] = useState<{ + isOpen: boolean; + chgBuilding: chgBuilding[]; + }>({ isOpen: false, chgBuilding: [] }); const nodeList = headMakeColSpan(rain.upHeadList); useEffect(() => { @@ -82,32 +84,31 @@ export default function Home() { val, headId ) => { - if ( val !== undefined) { - setRainForm(rainRes[val]); + if (val !== undefined) { + setRainForm(rainRes[val]); } if (headId === "bdstChgYn" && val !== undefined) { - - if (rainRes[val]?.bdstInfoPk != null && rainRes[val]?.chgBuilding.length > 0) { + if ( + rainRes[val]?.bdstInfoPk != null && + rainRes[val]?.chgBuilding.length > 0 + ) { bdstChgModal(rainRes[val].chgBuilding); - } } }; - const bdstChgModal = (chgBuilding:chgBuilding[] ) => { - setBdstChgProps( {isOpen:true, chgBuilding:chgBuilding } ); - + const bdstChgModal = (chgBuilding: chgBuilding[]) => { + setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding }); }; - useEffect(()=>{ + useEffect(() => { console.log("rainForm", rainForm); - },[rainForm]) - + }, [rainForm]); return ( <> - +
@@ -137,59 +138,57 @@ export default function Home() { > 신규등록 </Button> - </SearchFormRight> </SearchDiv> </div> </div> - <div className="grid grid-cols-6 gap-4 "> - <div className="col-span-4 max-h-full ovreflow-y-scroll"> - <ListDiv> - <ScrollArea className="h-full"> - <UiTable - tableData={bdstTable || []} - headlist={rain.upHeadList} - pageSize={100} - total={10} - headName={"○건축물 목록"} - cellClick={(val, headId) => { - cellClick(val, headId); - }} - > - {nodeList} - </UiTable> + <div className="h-screen grid grid-cols-6 gap-4 !overflow-y-scroll"> + <div className="col-span-4 h-full min-h-0"> + <ListDiv className="h-full min-h-0"> + <ScrollArea className="h-[60vh]"> + <UiTable + tableData={bdstTable || []} + headlist={rain.upHeadList} + pageSize={100} + total={10} + headName={"○건축물 목록"} + cellClick={(val, headId) => { + cellClick(val, headId); + }} + > + {nodeList} + </UiTable> </ScrollArea> </ListDiv> </div> - <div className="col-span-2 max-h-full ovreflow-y-scroll"> - <ListDiv> - <ScrollArea> - <RainRegForm - rainForm={rainForm ?? {} as customRainBdst} - isModal={false} - ></RainRegForm> - </ScrollArea> + <div className="col-span-2 max-h-full overflow-y-scroll"> + <ListDiv className=""> + <RainRegForm + rainForm={rainForm ?? ({} as customRainBdst)} + isModal={false} + ></RainRegForm> </ListDiv> </div> </div> <UiModal - body={<BdstReg moType="RNB"></BdstReg>} - bodyClass="w-[90vw] max-w-none" - open={issNewReg} - onOpenChange={(open) => { - setIsNewReg(open); - }} - /> - + body={<BdstReg moType="RNB"></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 }); - } - } - /> + bodyClass={""} + open={bdstChgProps.isOpen} + body={ + <BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal> + } + onOpenChange={(open) => { + setBdstChgProps({ ...bdstChgProps, isOpen: open }); + }} + /> </ContentsDiv> </> ); diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx index b0ce1a124..1e11470a0 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -7,15 +7,20 @@ import { SearchFormRight, SelectBox, Title, + UiModal, 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"; +import HeadChModal from "@/components/ui/modal/headChModal/headChModal"; +import { useState } from "react"; export default function PbnstSttn() { const { code,pbnStt } = useWrStore((state) => state); + + const [isChHead, setIsChHead] = useState(false); const nodeList = headMakeprfmnc(pbnStt.pbnSttHeadList, pbnStt.pbnSttHeadNm); return ( @@ -82,7 +87,9 @@ export default function PbnstSttn() { <Button className="mr-4 rounded-lg" onClick={() => {}}> 다운로드 </Button> - <Button className="mr-4 rounded-lg" onClick={() => {}}> + <Button className="mr-4 rounded-lg" onClick={() => { + // setIsChHead(true) + }}> 조회항목설정 </Button> </SearchFormRight> @@ -108,6 +115,13 @@ export default function PbnstSttn() { </ListDiv> </div> </div> + <UiModal open ={isChHead} onOpenChange ={()=>{setIsChHead(!isChHead)}} bodyClass={""} body={<HeadChModal/>}/> + + + + + + </ContentsDiv> </> ); diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx index 27abc0b84..8017286fa 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx @@ -1,6 +1,8 @@ import { getFectch } from "@/components/lib/api"; -import type { bdstAll } from "../rainReg"; +import { TEST_UUID, type bdstAll, type customRainBdst } from "../rainReg"; import type { TableProps } from "../pbnstReg"; +import type { customHtdflBdst } from "../htdflReg"; +import type { customRswtBdst } from "../rswtReg"; type TableUpperProps = { id: string; @@ -33,6 +35,117 @@ type TableUpperProps = { const bdstBase: bdstAll[] = []; +const isRainBdst = (data: any): data is customRainBdst=> { + return data.reuseBuilding?.[0]?.rainyObj !== undefined; +} + +const isHtdflBdst = (data: any): data is customHtdflBdst=> { + return data.reuseBuilding?.[0]?.htdflObj !== undefined; +} + +const isRswtBdst = (data: any): data is customRswtBdst =>{ + return data.reuseBuilding?.[0]?.rswtrObj !== undefined; +} + + + + export const makeRstr =(data:customRainBdst|customHtdflBdst|customRswtBdst) =>{ + data.rgtr = TEST_UUID; + + let chData + if(isRainBdst(data)){ + chData = data.reuseBuilding.map((item) => ({ + ...item, + rgtr : TEST_UUID, + rainyObj:{ + ...item.rainyObj, + rgtr:TEST_UUID + } + })); + + data.reuseBuilding=chData; + }else if(isHtdflBdst(data)){ + chData = data.reuseBuilding.map((item) => ({ + ...item, + rgtr : TEST_UUID, + htdflObj:{ + ...item.htdflObj, + rgtr:TEST_UUID + } + })); + + data.reuseBuilding=chData; + }else if (isRswtBdst(data)){ + chData = data.reuseBuilding.map((item) => ({ + ...item, + rgtr : TEST_UUID, + rswtrObj:{ + ...item.rswtrObj, + rgtr:TEST_UUID + } + })); + data.reuseBuilding=chData; + } + + if(data?.chgBuilding.length>0){ + const chRgtr = data.chgBuilding.map((item) =>({...item, rgtr:TEST_UUID})) + data.chgBuilding =chRgtr; + } + return data; + + } + + export const makeMdfr =(data:customRainBdst|customHtdflBdst|customRswtBdst) =>{ + data.mdfr = TEST_UUID; + let chData + if(isRainBdst(data)){ + chData = data.reuseBuilding.map((item) => ({ + ...item, + mdfr : TEST_UUID, + rainyObj:{ + ...item.rainyObj, + mdfr:TEST_UUID + } + })); + if(data?.chgBuilding.length>0){ + const chRgtr = data.chgBuilding.map((item) =>({...item, rgtr:TEST_UUID})) + } + + data.reuseBuilding=chData + }else if(isHtdflBdst(data)){ + chData = data.reuseBuilding.map((item) => ({ + ...item, + mdfr : TEST_UUID, + htdflObj:{ + ...item.htdflObj, + mdfr:TEST_UUID + } + })); + data.reuseBuilding=chData; + }else if (isRswtBdst(data)){ + chData = data.reuseBuilding.map((item) => ({ + ...item, + mdfr : TEST_UUID, + rswtrObj:{ + ...item.rswtrObj, + mdfr:TEST_UUID + } + })); + data.reuseBuilding=chData; + } + + if(data?.chgBuilding.length>0){ + const chMdfr = data.chgBuilding.map((item) =>({...item, mdfr:TEST_UUID})) + data.chgBuilding =chMdfr; + } + + return data; + + } + + + + export type bdstFulType = bdstState & bdstActions; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index 61cac7aa3..d185be093 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -2,6 +2,7 @@ import { getFectch, postFectch, putFectch } from "@/components/lib/api"; import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg"; import { z } from "zod"; +import { makeMdfr, makeRstr } from "../bdstReg"; export const hdtflZod = z.object({ bdstInfoPk: z.number().nullish(), @@ -13,7 +14,8 @@ export const hdtflZod = z.object({ archChgPrmsnDt: z.date().default(() => new Date()).nullish() , archArea: z.number().default(0), archChgArea: z.number().nullish().default(0), - + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), reuseBuilding: z .array( z.object({ @@ -37,7 +39,8 @@ export const hdtflZod = z.object({ ruseFcltFlg: z.string().nullish().default(""), bdstUsgCd: z.number().default(0), lawTrgtYn: z.string().default(""), - + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), // htdflObj 매핑 htdflObj: z .object({ @@ -68,6 +71,8 @@ export const hdtflZod = z.object({ clIonQnt: z.number().default(0), cdtnv: z.number().default(0), emsnExitTp: z.number().default(0), + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), }) .default({}), }) @@ -80,6 +85,8 @@ export const hdtflZod = z.object({ archChgPrmsnDt: z.coerce.date() , archChgArea: z.string().default("-"), bdstChgNm: z.string().default(""), + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), }) ) .default([]), @@ -101,7 +108,7 @@ export type htdflReuseBuilding = { anlOperCst: number | undefined; instlCstSprtYn: string | undefined; instlCstSprtAmt: number | undefined; - grntchBdstCertYn: string | undefined; + grntchBdstCertYn?: string | undefined; grntchBdstCertYr: string | undefined; grntchBdstCertNo: string | undefined; grntchBdstCertGrd: string | undefined; @@ -112,14 +119,16 @@ export type htdflReuseBuilding = { bdstUsgCd: number | undefined; lawTrgtYn: string; htdflObj: htdflObj; + rgtr?:string; + mdfr?:string; }; export type htdflObj = { - htdflFcltPk: number; - bdstRuseFcltFk: number; - etgtType: string; - fclCpct: number | undefined; - plwtYn: string; + htdflFcltPk?: number; + bdstRuseFcltFk?: number; + etgtType?: string; + fclCpct?: number | undefined; + plwtYn?: string; orgwtWtritSpt: number | undefined; orgwtOcrnProcs: string; wtritEntrcTp: number | undefined; @@ -141,6 +150,8 @@ export type htdflObj = { clIonQnt: number | undefined; cdtnv: number | undefined; emsnExitTp: number | undefined; + rgtr?:string; + mdfr?:string; }; export type htdflFacState = { @@ -204,6 +215,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( }, htdflUpdate: async (data: customHtdflBdst) => { try { + const chData=await makeMdfr(data) const res = await putFectch("/drain/facility", data); if (res.ok) { alert(" 수정이 완료되었습니다."); @@ -227,6 +239,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( }, htdflReg: async (data: customHtdflBdst) => { try { + const chData=await makeRstr(data) const res = await postFectch("/drain/facility", data); if (res.ok) { @@ -235,6 +248,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( .json() .then((resData: any) => { const chPK = resData?.data?.bdstInfoPk; + const makeCh = resData.data.chgBuilding.map( (item: chgBuilding) => ({ ...item, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index a74870bd1..81cf9f0c0 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -1,12 +1,20 @@ import type { selectArray } from "@/app/store/common/code"; import { getFectch, postFectch, putFectch } from "@/components/lib/api"; +import { FormItem } from "@common/business_components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; +import type { UUID } from "crypto"; import { useForm } from "react-hook-form"; import { z } from "zod"; +import type { customHtdflBdst } from "../htdflReg"; +import type { customRswtBdst } from "../rswtReg"; +import { makeMdfr, makeRstr } from "../bdstReg"; + + +export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e' export const rainZod = z.object({ - bdstInfoPk: z.number().nullish(), + bdstInfoPk: z.number().optional(), ctpvCd: z.number().default(0), sggCd: z.number().default(0), daddr: z.string().default(""), @@ -15,6 +23,8 @@ export const rainZod = z.object({ archChgPrmsnDt: z.coerce.date().nullish().default(null), archArea: z.number().default(0), archChgArea: z.number().default(0), + rgtr:z.string().nullish(), + mdfr:z.string().optional(), reuseBuilding: z.array( z.object({ @@ -22,10 +32,10 @@ export const rainZod = z.object({ bdstInfoFk:z.number().nullish(), instlCmptnDt: z.coerce.date().default(() => new Date()), instlCst: z.number().default(0), - operMngCd: z.string().nullish().default(""), + operMngCd: z.string().optional().default(""), anlOperCst: z.number().default(0), instlCstSprtYn: z.string().default(""), - instlCstSprtAmt: z.number().default(0), + instlCstSprtAmt: z.number().nullish(), grntchBdstCertYn: z.string().default(""), grntchBdstCertYr: z.string() .max(4, "4자리 연도를 입력하세요") @@ -39,17 +49,23 @@ export const rainZod = z.object({ ruseFcltFlg: z.string().default(""), bdstUsgCd: z.number().default(0), lawTrgtYn: z.string().default(""), + rgtr:z.string().nullish(), + mdfr:z.string().optional(), 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), + filtrTrtmfctCpct: z.number().nullish().default(0), filtrTrtmfctYn: z.string().default(""), filtrTrtmfctPrs: z.string().default(""), annRnwtQty: z.number().default(0), - oilqMeasMthd: z.string().default("").nullish() + oilqMeasMthd: z.string().default("").nullish(), + rgtr:z.string().nullish(), + mdfr:z.string().optional(), + + }).default({}) }) ).default([]), @@ -60,6 +76,9 @@ export const rainZod = z.object({ archChgPrmsnDt: z.coerce.date(), archChgArea: z.string().default("-"), bdstChgNm: z.string().default(""), + rgtr:z.string().nullish(), + mdfr:z.string().nullish(), + }) ).default([]) }); @@ -67,22 +86,26 @@ export const rainZod = z.object({ export type chgBuilding={ - bdstInfoFk: number|null, - archChgPrmsnDt: Date, - archChgArea: string, - bdstChgNm: string + bdstInfoFk?: number|null, + archChgPrmsnDt?: Date, + archChgArea?: string, + bdstChgNm?: string + rgtr?:string|null; + mdfr?:string|null; } export type bdstAll = { - bdstInfoPk: number|null; + bdstInfoPk?: number; ctpvCd: number; sggCd: number; bdstNm: string; daddr: string; frstArchPrmsnDt: Date; - archArea: string; + archArea: number; archChgArea: number; + rgtr?:string|null; + mdfr?:string|null; reuseBuilding: rainReuseBuilding[]; chgBuilding:chgBuilding[] }; @@ -95,31 +118,35 @@ export type customRainBdst = Omit<bdstAll, 'reuseBuilding'> & { export type rainReuseBuilding = { lawTrgtYn: string|undefined; bdstUsgCd: number|undefined; - bdstRuseFcltPk: number; - bdstInfoFk: number; - operMngCd: number; + bdstRuseFcltPk?: number|null; + bdstInfoFk: number|undefined; + operMngCd?: number; anlOperCst: number; instlCmptnDt: Date|undefined; - instlCst: number|undefined; + instlCst: number; //archChgPrmsnDt: string; instlCstSprtYn: string|undefined; - instlCstSprtAmt: number|undefined; + instlCstSprtAmt?: number|undefined; grntchBdstCertYn: string|undefined; grntchBdstCertNo: string|undefined; grntchBdstCertGrd: string|undefined; grntchBdstCertYr: string|undefined; - rainyObj: rainyObj | null; + rgtr?:string|null; + mdfr?:string|null; + rainyObj: rainyObj | null |undefined; }; export type rainyObj = { - bdstReuseFcltFk: number; - pntfColKnd: string | undefined; - pntfColArea: number | undefined; - dtfcltCpct: number; - filtrTrtmfctCpct: number | undefined; - filtrTrtmfctYn: string | undefined; - filtrTrtmfctPrs: string | undefined; - annRnwtQty: number; - oilqMeasMthd: string | undefined; + bdstReuseFcltFk?: number|undefined; + pntfColKnd?: string | undefined; + pntfColArea?: number | undefined; + dtfcltCpct?: number; + filtrTrtmfctCpct?: number | undefined; + filtrTrtmfctYn?: string | undefined; + filtrTrtmfctPrs?: string | undefined; + annRnwtQty?: number; + oilqMeasMthd?: string | undefined; + rgtr?:string|null, + mdfr?:string|null, }; export type TableUpperProps = { @@ -156,9 +183,11 @@ const rainRes: customRainBdst[] = []; bdstNm: "", daddr: "", frstArchPrmsnDt:new Date(), - archArea: "", + archArea: 0, archChgArea: 0, bdstInfoPk: 0, + rgtr:"", + mdfr:"", reuseBuilding: [{ rainyObj: { bdstReuseFcltFk: 0, @@ -169,7 +198,9 @@ const rainRes: customRainBdst[] = []; filtrTrtmfctYn: undefined, filtrTrtmfctPrs: undefined, annRnwtQty: 0, - oilqMeasMthd: undefined + oilqMeasMthd: undefined, + rgtr:"", + mdfr:"", }, lawTrgtYn: undefined, bdstUsgCd: undefined, @@ -178,27 +209,30 @@ const rainRes: customRainBdst[] = []; operMngCd: 0, anlOperCst: 0, instlCmptnDt: undefined, - instlCst: undefined, + instlCst: 0, // archChgPrmsnDt: "", instlCstSprtYn: undefined, instlCstSprtAmt: undefined, grntchBdstCertYn: undefined, grntchBdstCertNo: undefined, grntchBdstCertGrd: undefined, - grntchBdstCertYr: undefined + grntchBdstCertYr: undefined, + rgtr:"", + mdfr:"", }], //추가됨 chgBuilding:[{ bdstInfoFk: 0, archChgPrmsnDt: new Date(), archChgArea: "-", - bdstChgNm: "" + bdstChgNm: "", + rgtr:"", + mdfr:"", }] }; - export const selectClass = "w-full h-full text-2xl"; const selectYN = [ { text: "Y", val: "1" }, @@ -236,6 +270,7 @@ export const rainFacStateExport: rainFacState = { + const initFetch = async (txt:string|undefined) => { const rainRes =await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:'')); @@ -292,7 +327,12 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( }, rainReg: async (data: customRainBdst) => { try { - const res = await postFectch("/reuseFc/rainyInfo", data); + + const test =await makeRstr(data); + + + console.log("test ", test) + const res = await postFectch("/reuseFc/rainyInfo", test); if(res.ok){ if(data.chgBuilding.length > 0){ @@ -334,8 +374,10 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( }, rainUpdate: async (data: customRainBdst) => { try { - console.log("data ", data) - const res = await putFectch("/reuseFc/rainyInfo", data); + + + const chData =await makeMdfr(data); + const res = await putFectch("/reuseFc/rainyInfo", chData); console.log('rainUpdate', res); if(res.ok){ alert(" 수정이 완료되었습니다.") diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 73fa5206a..8ba5b6586 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -1,8 +1,9 @@ import { getFectch, postFectch, putFectch } from "@/components/lib/api"; -import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg"; +import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg"; import { rswtBdstType } from "@/app/store/common/code"; import { z } from "zod"; +import { makeMdfr, makeRstr } from "../bdstReg"; export const rswtZod = z.object({ bdstInfoPk: z.number().nullish(), @@ -15,6 +16,8 @@ export const rswtZod = z.object({ archArea: z.number().default(0), archChgArea: z.number().default(0), + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), reuseBuilding: z.array( z.object({ @@ -28,12 +31,12 @@ export const rswtZod = z.object({ instlCstSprtYn: z.string().default(""), instlCstSprtAmt: z.number().default(0), - grntchBdstCertYn: z.string().default(""), + grntchBdstCertYn: z.string().default("N"), grntchBdstCertYr: z.string().max(4, "4자리 연도를 입력하세요") .regex(/^\d{4}$/, "4자리 연도를 입력하세요") .default(""), - grntchBdstCertNo: z.string().default(""), - grntchBdstCertGrd: z.string().default(""), + grntchBdstCertNo: z.string().nullish().default(""), + grntchBdstCertGrd: z.string().nullish().default(""), crgRdctYn: z.string().default(""), crgRdctBss: z.string().default(""), @@ -41,11 +44,13 @@ export const rswtZod = z.object({ ruseFcltFlg: z.string().default(""), bdstUsgCd: z.number().default(0), lawTrgtYn: z.string().default(""), + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), rswtrObj: z.object({ bdstRuseFcltFk: z.number().nullish(), wtrUsqty: z.number().default(0), - oblgTrgtWtrUsqty: z.number().default(0), + oblgTrgtWtrUsqty: z.number().nullish().default(0), orgwtKndCd: z.string().default(""), filtrTrtmfctProcs: z.string().default(""), filtrTrtmfctUsgCd: z.string().default(""), @@ -53,7 +58,9 @@ export const rswtZod = z.object({ altUswtrUtztnYn: z.string().default(""), altUswtrKndCd: z.string().default(""), altUswtrUtztnQnt: z.number().default(0), - altUswtrIdntyMthdCd: z.string().default("") + altUswtrIdntyMthdCd: z.string().default(""), + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), }).default({}) }) ).default([]), @@ -65,6 +72,8 @@ export const rswtZod = z.object({ archChgPrmsnDt: z.coerce.date() , archChgArea: z.string().default("-"), bdstChgNm: z.string().default(""), + rgtr:z.string().nullish().default(null), + mdfr:z.string().nullish().default(null), }) ) .default([]), @@ -90,26 +99,30 @@ export type rswtReuseBuilding = { instlCstSprtYn: string | undefined; instlCstSprtAmt: number | undefined; bdstUsgCd: number | undefined; - grntchBdstCertYn: string | undefined; - grntchBdstCertNo: string | undefined; - grntchBdstCertGrd: string | undefined; - grntchBdstCertYr: string | undefined; + grntchBdstCertYn: string ; + grntchBdstCertNo?: string | undefined; + grntchBdstCertGrd?: string | undefined; + grntchBdstCertYr?: string | undefined; + rgtr?:string; + mdfr?:string; rswtrObj: rswtrObj | null; }; export type rswtrObj = { - bdstRuseFcltFk: number | undefined; - wtrUsqty: number | undefined; - oblgTrgtWtrUsqty: number | undefined; - orgwtKndCd: string | undefined; - filtrTrtmfctProcs: string | undefined; - filtrTrtmfctUsgCd: string | undefined; - rswtrUsqty: number; - altUswtrUtztnYn: string; - altUswtrKndCd: string; - altUswtrUtztnQnt: number; - altUswtrIdntyMthdCd: string; -}; - + bdstRuseFcltFk?: number | undefined; + wtrUsqty?: number | undefined; + oblgTrgtWtrUsqty?: number ; + orgwtKndCd?: string | undefined; + filtrTrtmfctProcs?: string | undefined; + filtrTrtmfctUsgCd?: string | undefined; + rswtrUsqty?: number; + altUswtrUtztnYn?: string; + altUswtrKndCd?: string; + altUswtrUtztnQnt?: number; + + altUswtrIdntyMthdCd?: string; + rgtr?:string; + mdfr?:string; +} const rswtRes: customRswtBdst[] = []; @@ -169,7 +182,8 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( }, rswtUpdate: async (data: customRswtBdst) => { try { - const res = await putFectch("/reuseFc/waterreuseFc", data); + const chData=await makeMdfr(data) + const res = await putFectch("/reuseFc/waterreuseFc", chData); if (res.ok) { alert("등록이 완료되었습니다."); } @@ -189,7 +203,8 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( }, rswtReg: async (data: customRswtBdst) => { try { - const res = await postFectch("/reuseFc/waterreuseFc", data); + const chData=await makeRstr(data) + const res = await postFectch("/reuseFc/waterreuseFc", chData); if(res.ok){ if(data.chgBuilding.length > 0){ await res diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx index 2a9c00b05..b3cd56fe5 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx @@ -42,13 +42,7 @@ export const pbnSttHeadList:TableUpperProps[] = [ ]; - export const headVisibleSchema = z.array( - z.object( - Object.fromEntries( - pbnSttHeadList.map(col => [col.id, z.boolean()]) - )) - ); - + diff --git a/apps/wr/components/lib/api/index.ts b/apps/wr/components/lib/api/index.ts index 1d6dc4935..65533dcad 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 32fd36cc4..66ab1c169 100644 --- a/apps/wr/components/lib/config/index.ts +++ b/apps/wr/components/lib/config/index.ts @@ -1,11 +1,14 @@ const LOCAL_PORT = "3000"; const DEV_PORT = "11080"; +const DEV_PORT_NEW="8882" -const DEV_URL_FO = "11082"; // common - export const LOCAL_URL_WR = `http://localhost:${LOCAL_PORT}/api/v1`; export const DEV_URL_WR = `http://con.mind-one.co.kr:${DEV_PORT}/api/v1`; -export const DEV_URL_COMMON = `http://con.mind-one.co.kr:${DEV_URL_FO}/api/v1`; +//export const DEV_URL_FO = `http://con.mind-one.co.kr:${DEV_PORT_FO}/api/v1`; +export const DEV_URL_FO = `http://192.168.1.193:${DEV_PORT_NEW}/api/v1`; + + + diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 8e529d111..147320992 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store"; import { rainZod, selectClass, + TEST_UUID, type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { DatePicker, FormUi } from "@common/business_components"; @@ -70,7 +71,7 @@ export function RainRegForm({ function onSubmit(values: z.infer<typeof rainZod>) { if (isModal) { - // regRainForm.bdstInfoPk = null; + rainReg(values); } else { rainUpdate(values); diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index 362248218..d730cb9fd 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -20,7 +20,7 @@ import { import { useEffect } from "react"; import BdstReg from "../bdstReg/bdstReg"; -export function RswtrRegForm({ +export function RswtrRegForm({ rswtForm, isModal, }: { diff --git a/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx index 126ac15d6..11c8f04f2 100644 --- a/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/bdstRegModal/bdstRegModal.tsx @@ -14,7 +14,7 @@ import { getCity, tableData } from "@/components/lib/func/commom"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; import { HtdflRegForm } from "../../form/fcltReg/htdflReg/htdflRegForm"; import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; -//import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm"; +import {RswtrRegForm} from "../../form/fcltReg/rswtrReg/rswtrRegForm"; export type objSearchType = { sgg: string|number; @@ -144,7 +144,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) { { moType === 'RNB'? <RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={true} /> :moType==='RST' - ? <></> + ? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true} /> :<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true}></HtdflRegForm> } diff --git a/apps/wr/components/ui/modal/headChModal/headChModal.tsx b/apps/wr/components/ui/modal/headChModal/headChModal.tsx new file mode 100644 index 000000000..da4e090ae --- /dev/null +++ b/apps/wr/components/ui/modal/headChModal/headChModal.tsx @@ -0,0 +1,95 @@ +import { useWrStore } from "@/app/store"; +import { pbnSttHeadList } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn"; +import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@common/business_components/ui"; +import { Button, Checkbox } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; + +export default function HeadChModal() { + const { pbnStt } = useWrStore((state) => state); + + + + const items = pbnSttHeadList.map(item => ({id:item.id, label:item.title})); + + + + + const FormSchema = z.object({ + items: z.array(z.string()).refine((value) => value.some((item) => item), { + message: "You have to select at least one item.", + }), + }) + + const form = useForm<z.infer<typeof FormSchema>>({ + resolver: zodResolver(FormSchema), + }) + + + + const onSubmit = (val : z.infer<typeof FormSchema>) =>{ + + console.log(val) + } + + return ( + <> + <div> + <Form {...form}> + <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8"> + <FormField + control={form.control} + name="items" + render={() => ( + <FormItem> + <div className="mb-4"> + <FormLabel className="text-base">Sidebar</FormLabel> + <FormDescription> + Select the items you want to display in the sidebar. + </FormDescription> + </div> + {items.map((item) => ( + <FormField + key={item.id} + control={form.control} + name="items" + render={({ field }) => { + return ( + <FormItem + key={item.id} + className="flex flex-row items-start space-x-3 space-y-0" + > + <FormControl> + <Checkbox + checked={field.value?.includes(item.id)} + onCheckedChange={(checked) => { + return checked + ? field.onChange([...field.value, item.id]) + : field.onChange( + field.value?.filter( + (value) => value !== item.id + ) + ); + }} + /> + </FormControl> + <FormLabel className="text-sm font-normal"> + {item.label} + </FormLabel> + </FormItem> + ); + }} + /> + ))} + <FormMessage /> + </FormItem> + )} + /> + <Button type="submit">Submit</Button> + </form> + </Form> + </div> + </> + ); +} 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 ef611fa40..0f14c211e 100644 --- a/packages/common/business_components/src/ui/dialog_ui/index.tsx +++ b/packages/common/business_components/src/ui/dialog_ui/index.tsx @@ -6,22 +6,40 @@ type ModalType = { body: React.ReactNode; open?: boolean; onOpenChange?: (open: boolean) => void; + noHeaderYn?: 'N' | 'Y'; + noFooterYn?: 'N' | 'Y'; + headerTitle?: string; + footerContent?: React.ReactNode; } -export function UiModal({ bodyClass, body, open, onOpenChange }: ModalType) { +export function UiModal({ + bodyClass, + body, + open, + onOpenChange, + noHeaderYn = 'N', + noFooterYn = 'N', + headerTitle, + footerContent +}: ModalType) { return ( <> <Dialog open={open} onOpenChange={onOpenChange}> <DialogContent className={bodyClass}> - <DialogHeader> - <DialogDescription> - </DialogDescription> - - </DialogHeader> - {(open && body)} - <DialogFooter className="sm:justify-start"> - </DialogFooter> + {noHeaderYn === 'N' && ( + <DialogHeader> + <DialogDescription> + {headerTitle} + </DialogDescription> + </DialogHeader> + )} + {(open && body)} + {noFooterYn === 'N' && ( + <DialogFooter className="sm:justify-start"> + {footerContent} + </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 368abc5cc..c8ba18765 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -12,29 +12,36 @@ type UiTableProps = { cellClick : ((index:number|undefined, headId:string)=>void )| undefined; onPageChange: (page: number) => void; className?: string; + resetPageNo?: boolean; } type UiHeadProps = { id: string; title: string; + align?: string; } -export function UiTable({ tableData, headlist, pageSize, total, children, headName, cellClick, onPageChange, className = '' }: UiTableProps) { +export function UiTable({ tableData, headlist, pageSize, total, children, headName, cellClick, onPageChange, className = '', resetPageNo = false }: UiTableProps) { const [cur, setCur] = useState<number>(1); const [idx, setIdx] = useState<number>(-1); + + useEffect(() => { + if (resetPageNo) { + setCur(1); + onPageChange(1); + } + }, [onPageChange, resetPageNo]); + const handlePageChange = (page: number) => { setCur(page); onPageChange(page); } - const handleCellClick = (index: number,headId:string )=> { if (cellClick) { cellClick(index,headId); setIdx(index); } - - }; return ( @@ -43,8 +50,8 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa <h3 className="text-2xl font-medium text-label">{headName}</h3> </div> : <></>} <div className={`card !m-[1.2rem] !p-0r ${className}`}> - <Table> - <TableHeader> + <Table variant="secondary"> + <TableHeader > {children ? <>{children}</> : <TableRow> {headlist?.map((head) => ( <TableHead key={head.id}>{head.title}</TableHead> @@ -52,11 +59,19 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa </TableRow>} </TableHeader> <TableBody className='text-center'> - {tableData?.map((el: { [key: string]: any}, index) => ( - <TableRow key={index + "row"} > + {tableData?.map((el: { [key: string]: string | number | boolean | object}, index) => ( + <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={(e)=>handleCellClick(index,head.id)} key={head.id + index}>{el[head.id]}</TableCell> + <TableCell + className={`${head.align === 'right' ? 'text-right' : 'text-center'} ${ + cellClick && idx === index ? '!font-[1000] cursor-pointer' : + cellClick ? 'cursor-pointer' : '' + }`} + onClick={() => handleCellClick(index, head.id)} + key={head.id + index} + > + {String(el[head.id] ?? '')} + </TableCell> ))} </TableRow> ))} diff --git a/packages/common/components/src/ui/table/index.tsx b/packages/common/components/src/ui/table/index.tsx index 797f48dfd..082b2e33b 100644 --- a/packages/common/components/src/ui/table/index.tsx +++ b/packages/common/components/src/ui/table/index.tsx @@ -29,7 +29,7 @@ const TableHeader = React.forwardRef< HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement> >(({ className, ...props }, ref) => ( - <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} /> + <thead ref={ref} className={cn("sticky top-0 bg-secondary [&_tr]:border-b", className)} {...props} /> )); TableHeader.displayName = "TableHeader";