diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index b252121dc..956f7dc84 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -24,9 +24,10 @@ import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; import { headMakeColSpan } from "../rainReg/TableHead"; export default function Home() { - const { code, htdfl, initHtdfl } = useWrStore((state) => state); - const nodeList = headMakeColSpan(htdfl.upHeadList); + const { code, htdfl, initHtdfl,getHtdflBdstData } = useWrStore((state) => state); const [searchTxt, setSearchTxt] = useState(""); + const [pageNation, setPageNation] = useState(1); + const [htdflForm, setHtdflForm] = useState(); const [bdstTable, setbdstTable] = useState(); const [issNewReg,setIsNewReg] = useState( false); @@ -40,13 +41,23 @@ export default function Home() { useEffect(() => { if (!htdfl.isInit) { - initHtdfl(undefined); + initHtdfl('41'); } }, [htdfl.isInit, initHtdfl]); useEffect(() => { if (code.sggCd.length > 0) { - setbdstTable(tableData(htdflRes, { code })); + + const htdflData = tableData(htdflRes, { code }).map( + (item: customHtdflBdst) => { + return { + ...item, + bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", + bdstUsgCd: item.reuseBuilding[0]?.bdstUsgCd + }; + } + ); + setbdstTable(htdflData); } }, [code, htdflRes]); @@ -64,13 +75,17 @@ export default function Home() { htdflRes[val]?.bdstInfoPk != null && htdflRes[val]?.chgBuilding?.length > 0 ) { - bdstChgModal(htdflRes[val]?.chgBuilding); + bdstChgModal(htdflRes[val]?.chgBuilding as chgBuilding[]); } } }; const bdstChgModal = (chgBuilding: chgBuilding[]) => { setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding }); }; + useEffect(() => { + getHtdflBdstData(pageNation, "41"); + }, [pageNation]); + return ( <> @@ -112,9 +127,9 @@ export default function Home() { pageSize={100} total={10} headName={"○건축물 목록"} - cellClick={(val,headId)=>{cellClick(val||undefined , headId)}} - > - {nodeList} + cellClick={(val, headId) => { cellClick(val || undefined, headId); } } + onPageChange={setPageNation} + > diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index b537fcfcc..7bfcc29b0 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -2,7 +2,11 @@ "use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; -import { excelDownload, tableData } from "@/components/lib/func/commom"; +import { + excelDownload, + getCityOrSgg, + tableData, +} from "@/components/lib/func/commom"; import HeadChModal from "@/components/ui/modal/headChModal/headChModal"; import { ContentsDiv, @@ -10,7 +14,7 @@ import { Title, UiModal, UiTable, - type ReturnType + type ReturnType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; @@ -19,50 +23,32 @@ import type { customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; export default function RainSttn() { - const { code, rainSttn, rainSttnSearch } = - useWrStore((state) => state); + const { code, rainSttn, rainSttnSearch, rainSttnInit } = useWrStore( + (state) => state + ); + + const [pageNation, setPageNation] = useState(1); const { rainSttnRes } = rainSttn; const [isChHead, setIsChHead] = useState(false); const ref = useRef({} as ReturnType); const [bdstTable, setBdstTable] = useState(); + const codeData = getCityOrSgg(ref); + useEffect(() => { if (!rainSttn.isInit) { - let con - if (ref.current.sigunValue != '0') { - con = ref.current.sigunValue - }else{ - con = ref.current.sidoValue - } - rainSttnSearch('1', '20' ,con); + rainSttnInit(codeData ?? "0"); } - }, [rainSttn.isInit, rainSttnSearch]); - + }, [rainSttn.isInit, rainSttnInit]); useEffect(() => { - - if (rainSttnRes.length > 0 && code.cityCd.length>0) { + if (rainSttnRes.length > 0 && code.cityCd.length > 0) { const data = tableData(rainSttnRes, { code }); const chData = data .map((item: any) => ({ - ...item, ...item.reuseBuilding[0], ...item.reuseBuilding[0].rainyObj, - // cityText:item.cityText, - // sggText:item.sggText, - // bdstNm: item.bdstNm, - // daddr:item.daddr, - // bdstUsgCd:item.bdstUsgCd, - // frstArchPrmsnDt:item.frstArchPrmsnDt, - // archArea:item.archArea, - // lawTrgtYn:item.lawTrgtYn, - // instlCmptnDt:item.instlCmptnDt, - // instlCst:item.instlCst, - - - - })) .filter((item: any) => item.rainyObj !== undefined); @@ -70,29 +56,25 @@ export default function RainSttn() { } }, [code, rainSttnRes, rainSttn.rainSttHeadList]); - - useEffect(() =>{ -console.log(rainSttn.rainSttNodeList) - },[rainSttn.rainSttNodeList]) + useEffect(() => { + if (codeData != null) rainSttnSearch(pageNation, "20", codeData); + }, [pageNation]); useEffect(() => { - if(rainSttn.excelList.length>0){ - + if (rainSttn.excelList.length > 0) { if (rainSttn.excelList.length === 0) return; - excelDownload(rainSttn.excelList , '빗물재이용시설 현황','sample_rainSttn.xlsx') + excelDownload( + rainSttn.excelList, + "빗물재이용시설 현황", + "sample_rainSttn.xlsx" + ); } }, [rainSttn.excelList]); - - const excelClick = useCallback((returnType:ReturnType) => { - let con - if (returnType.sigunValue != '0') { - con = returnType.sigunValue - }else{ - con = returnType.sidoValue - } - rainSttnSearch('1', '10000' ,con); - },[rainSttnSearch]); + const excelClick = useCallback(() => { + if (codeData) rainSttnSearch(1, "10000", codeData); + }, [rainSttnSearch]); + return ( <> @@ -119,13 +101,13 @@ console.log(rainSttn.rainSttNodeList) leftChildren={undefined} queryClick={function (returnType: ReturnType): void { // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - let con - if (returnType.sigunValue != '0') { - con = returnType.sigunValue - }else{ - con = returnType.sidoValue + let con; + if (returnType.sigunValue != "0") { + con = returnType.sigunValue; + } else { + con = returnType.sidoValue; } - rainSttnSearch('1', '20' ,con); + rainSttnSearch(1, "20", con); }} excelClick={excelClick} initClick={function (): void {}} @@ -140,16 +122,15 @@ console.log(rainSttn.rainSttNodeList) } + children={ + + } headlist={rainSttn.rainSttHeadList} - pageSize={0} - total={0} + pageSize={20} + total={100000} cellClick={undefined} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }} - > - + onPageChange={setPageNation} + > @@ -159,7 +140,15 @@ console.log(rainSttn.rainSttNodeList) setIsChHead(!isChHead); }} bodyClass={""} - body={} + body={ + ({ + ...item, + visible: item.visible ?? false, + }))} + /> + } /> diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx new file mode 100644 index 000000000..73ea9b13a --- /dev/null +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx @@ -0,0 +1,157 @@ +"use client"; +import { useWrStore } from "@/app/store"; +import { btnClass } from "@/app/store/common/code"; +import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; +import { excelDownload, getCityOrSgg, tableData } from "@/components/lib/func/commom"; +import HeadChModal from "@/components/ui/modal/headChModal/headChModal"; +import { + ContentsDiv, + SearchBaseForm, + Title, + UiModal, + UiTable, + type ReturnType, +} from "@common/business_components/ui"; +import ListDiv from "@common/business_components/ui/list_div"; +import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; +import { Button } from "@common/components/ui"; +import { useCallback, useEffect, useRef, useState } from "react"; + +export default function RswtSttn() { + const { code, rswtSttn, rswtSttnSearch ,rswtSttnInit} = useWrStore((state) => state); + const [pageNation, setPageNation] = useState(1); + + const { rswtSttnRes } = rswtSttn; + const [isChHead, setIsChHead] = useState(false); + const ref = useRef({} as ReturnType); + const [bdstTable, setBdstTable] = useState(); + + const codeData = getCityOrSgg(ref); + + + useEffect(() => { + if (!rswtSttn.isInit) { + + rswtSttnInit('0') + } + }, [rswtSttn.isInit, rswtSttnInit]); + + useEffect(() => { + if (rswtSttnRes.length > 0 && code.cityCd.length > 0) { + const data = tableData(rswtSttnRes, { code }); + const chData = data + .map((item: customRswtBdst) => ({ + ...item, + ...item.reuseBuilding[0], + ...item.reuseBuilding[0]?.rswtrObj, + chBuildingYn:item.chgBuilding.length>0?'Y':'N' + })) + .filter((item: customRswtBdst) => item.reuseBuilding[0]?.rswtrObj !== undefined); + + console.log("chData ", chData) + setBdstTable(chData); + } + }, [code, rswtSttnRes]); + + + useEffect(() => { + if (rswtSttn.excelList.length > 0) { + if (rswtSttn.excelList.length === 0) return; + excelDownload( + rswtSttn.excelList, + "중수도시설 현황", + "sample_rswtSttn.xlsx" + ); + } + }, [rswtSttn.excelList]); + + const excelClick = useCallback( + (returnType: ReturnType) => { + let con; + if (returnType.sigunValue != "0") { + con = returnType.sigunValue; + } else { + con = returnType.sidoValue; + } + rswtSttnSearch(1, "10000", con); + }, + [rswtSttnSearch] + ); + + useEffect(() => { + if (codeData != null) rswtSttnSearch(pageNation, "20", codeData); + }, [pageNation]); + + + return ( + <> + +
+
+ + <SearchBaseForm + selectSidoData={code.cityCd} + selectSigunData={code.sggCd} + selectRegionData={code.rvbsnCd} + selectUnitWaterShedData={code.lgbsnCd} + selectMiddleRegionData={code.mdmbsnCd} + selectEnvPartData={code.lclgvrnmntCd} + rightChildren={ + <Button + className={btnClass} + onClick={() => { + setIsChHead(true); + }} + > + 조회항목설정 + </Button> + } + leftChildren={undefined} + queryClick={function (returnType: ReturnType): void { + // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' + let con; + if (returnType.sigunValue != "0") { + con = returnType.sigunValue; + } else { + con = returnType.sidoValue; + } + rswtSttnSearch(1, "20", con); + }} + excelClick={excelClick} + initClick={function (): void {}} + btnClass={btnClass} + ref={ref} + /> + </div> + </div> + <div className="grid grid-cols-6 gap-4 "> + <div className="col-span-6"> + <ListDiv> + <UiTable + headName={[]} + tableData={bdstTable || []} + children={ + <HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} /> + } + headlist={rswtSttn.rswtSttHeadList} + pageSize={20} + total={10000} + cellClick={undefined} + onPageChange={setPageNation} + + ></UiTable> + </ListDiv> + </div> + </div> + <UiModal + open={isChHead} + onOpenChange={() => { + setIsChHead(!isChHead); + }} + bodyClass={""} + body={<HeadChModal headList={(rswtSttn.rswtSttHeadList||[]).map(item => ({ ...item, visible: item.visible ?? false }))} type={"RST"} />} + /> + </ContentsDiv> + </> + ); +} diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index fc8fb1e0a..2e8b4ee48 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -9,7 +9,6 @@ import { excelDownload } from "@/components/lib/func/commom"; import ChkgdExcel from "@/components/ui/modal/chkgdExcel/chkgdExcel"; import ChkgdModal from "@/components/ui/modal/chkgdModal/chkgdModal"; import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable"; -import RainChkgdTableModal from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTableModal"; import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable"; import { ContentsDiv, @@ -61,6 +60,7 @@ export default function Page() { }, [rainChkgdn.excelList]); const excelClick= useCallback(()=>{ + rainChkExcelDownload(code.cityCd, code.sggCd); }, [rainChkExcelDownload, code.cityCd, code.sggCd]); @@ -72,9 +72,7 @@ export default function Page() { const clickDelete=(data:number[])=>{ if(data.length>0){ - data.forEach((data) =>{ - rainChkDelete( String(data) ) - }) + rainChkDelete( data ) } } diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 9f51eed50..ec3464ab8 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -313,7 +313,7 @@ type rainChkgdnActions = { rainChkGuidUpdate(rainChk: rainChkZodType): Promise<void>; rainChkExcelDownload(sidoCode: SelectDataType[],sggCode: SelectDataType[]): Promise<void> rainChkExcelDataUPload(excelData:rainChkZodType[]) : Promise<void> - rainChkDelete(chkgdnPk:string) :Promise<void> + rainChkDelete( chkgdnPks:number[] ) :Promise<void> }; export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; @@ -367,7 +367,9 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( ) => { return { rainChkExcelDownload:async(sidoCode:SelectDataType[], sggCode:SelectDataType[])=>{ - const data = await getFetch(fetchType.WR, "/reuseFc/building/RNB/0") + + // 로그인한 아이디의 시도 or 시군구로 들어가야하는데 현재는 그냥 0으로 하드코딩 + const data = await getFetch(fetchType.WR, `/reuseFc/buildingFlg/RNB/41`) // const excelList = buildingToExcelType(data, sidoCode, sggCode); const excelList = buildingToExcelType(data, sidoCode, sggCode); @@ -454,9 +456,9 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( }, - rainChkDelete: async (chkgdnPk:string) =>{ + rainChkDelete: async (chkgdnPks:number[] ) =>{ try{ - const res = await deleteFectch(`/reuseChk/rainy/${chkgdnPk}`,''); + const res = await deleteFectch(`/reuseChk/rainy`,chkgdnPks); if(res.ok){ ToastFormUi({body:"삭제가 완료되었습니다. " ,title:'지도점검 삭제'}) diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index 2ac27be5a..80864d026 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -25,21 +25,21 @@ export const hdtflZod = z.object({ instlCst: z.number().nullish().default(0), operMngCd: z.string().nullish().default(""), anlOperCst: z.number().default(0), - instlCstSprtYn: z.enum(["Y", "N"]), + instlCstSprtYn: z.enum(["Y", "N"]).nullish(), instlCstSprtAmt: z.number().nullish().default(0), - grntchBdstCertYn: z.enum(["Y", "N"]), - grntchBdstCertYr: z .string().default("") - .refine((year) =>year.length ===0 || /^\d{4}$/.test(year),{ - message:'4자리 연도만 입력하세요' - }), + // grntchBdstCertYn: z.enum(["Y", "N"]), + // grntchBdstCertYr: z .string().default("") + // .refine((year) =>year.length ===0 || /^\d{4}$/.test(year),{ + // message:'4자리 연도만 입력하세요' + // }), grntchBdstCertNo: z.string().nullish().default(""), grntchBdstCertGrd: z.string().nullish().default(""), - crgRdctYn: z.enum(["Y", "N"]), - crgRdctBss: z.string().nullish().default(""), - crgRdctAmt: z.number().nullish().default(0), - ruseFcltFlg: z.string().nullish().default(""), + // crgRdctYn: z.enum(["Y", "N"]), + // crgRdctBss: z.string().nullish().default(""), + // crgRdctAmt: z.number().nullish().default(0), + ruseFcltFlg: z.string().nullish().default(""), bdstUsgCd: z.number().default(0), - lawTrgtYn: z.enum(["Y", "N"]), + lawTrgtYn: z.enum(["Y", "N"]).nullish(), rgtr:z.string().nullish().default(null), mdfr:z.string().nullish().default(null), // htdflObj 매핑 @@ -49,13 +49,13 @@ export const hdtflZod = z.object({ bdstRuseFcltFk: z.number().nullish(), etgtType: z.string().default(""), fclCpct: z.number().default(0), - plwtYn: z.string().default(""), + plwtYn: z.enum(["Y", "N"]), orgwtWtritSpt: z.number().default(0), orgwtOcrnProcs: z.string().default(""), wtritEntrcTp: z.number().max(4, "온도는 100이상이 될 수 없습니다.") .default(0), amtgnr: z.number().default(0), - prcsProcsYn: z.string().default(""), + prcsProcsYn: z.enum(["Y", "N"]), prcsFcltCpct: z.number().default(0), fmYn: z.string().default(""), utztnCpct: z.number().default(0), @@ -75,7 +75,10 @@ export const hdtflZod = z.object({ rgtr:z.string().nullish().default(null), mdfr:z.string().nullish().default(null), }) - .default({}), + .default({ + plwtYn: "N", + prcsProcsYn: "N", + }), }) ) .default([]), @@ -84,7 +87,7 @@ export const hdtflZod = z.object({ z.object({ bdstInfoFk: z.number().nullish(), archChgPrmsnDt: z.coerce.date() , - archChgArea: z.string().default("-"), + archChgArea: z.string().default("-").nullish(), bdstChgNm: z.string().default(""), rgtr:z.string().nullish().default(null), mdfr:z.string().nullish().default(null), @@ -94,7 +97,6 @@ export const hdtflZod = z.object({ }); export type customHtdflBdst = z.infer<typeof hdtflZod> - //export type customHtdflBdst = z.infer<typeof hdtflZod>; export type htdflFacState = { @@ -105,9 +107,11 @@ export type htdflFacState = { }; }; type htdflFacSActions = { - initHtdfl: (txt: string | undefined) => void; - htdflUpdate:(data: customHtdflBdst) => void; - htdflReg:(data: customHtdflBdst) => void; + initHtdfl: (code: string | number) => void; + htdflBdstUpdate:(data: customHtdflBdst, code:string|number) => void; + htdflBdstReg:(data: customHtdflBdst, code:string|number) => void; + getHtdflBdstData:(pageNation:number, code:string|number) =>void; + }; const htdflRes: customHtdflBdst[] = []; @@ -122,26 +126,43 @@ export const htdflFacStateExport: htdflFacState = { }, }; -const initFetch = async (txt: string | undefined) => { - const htdflRes = await getFetch( + +const initFetch = async (code:string|number) => { + const rswtRes = await getFetch( "wr", - `/drain/facilityList/1/20/0` + (txt ? `/${txt}` : "") - ); - const chHtdflRes = htdflRes.map((item: customHtdflBdst) => { - return { - ...item, - bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", - }; - }); - return chHtdflRes; + `/facilityList/1/20/${code}`) + + return rswtRes; }; export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( set: any ) => { return { - initHtdfl: async (txt: string | undefined) => { + getHtdflBdstData: async (pageNation: number, code: string | number) => { try { - const htdflRes = await initFetch(txt); + const rswtRes = await getFetch( + "wr", + `/drain/facilityList/${pageNation}/20/${code}` + ); + console.log(pageNation) + // 여기서 상태 업데이트 + return set((state: htdflFacState) => ({ + ...state, + htdfl: { + ...state.htdfl, + htdflRes: rswtRes, + isInit: false, + }, + })); + } catch (e) { + console.log(e); + } + }, + + + initHtdfl: async (code: string | number) => { + try { + const htdflRes = await initFetch(code); set((state: htdflFacState) => { return { ...state, @@ -156,7 +177,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( console.log(error); } }, - htdflUpdate: async (data: customHtdflBdst) => { + htdflBdstUpdate: async (data: customHtdflBdst, code:string|number) => { try { const chData=await makeMdfr(data) const res = await putFectch("/drain/facility", data); @@ -164,7 +185,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( alert(" 수정이 완료되었습니다."); } - const htdflRes = await initFetch(undefined); + const htdflRes = await initFetch(code); set((state: htdflFacState) => ({ ...state, htdfl: { @@ -180,7 +201,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( ); } }, - htdflReg: async (data: customHtdflBdst) => { + htdflBdstReg: async (data: customHtdflBdst , code:string|number) => { try { const chData=await makeRstr(data) const res = await postFectch("/drain/facility", data); @@ -211,7 +232,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( } } - const htdflRes = await initFetch(undefined); + const htdflRes = await initFetch(code); set((state: htdflFacState) => ({ ...state, htdfl: { diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index ea7f38244..bd7473bbb 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -17,6 +17,9 @@ export const rswtZod = z.object({ archChgArea: z.number().default(0), rgtr: z.string().nullish().default(null), mdfr: z.string().nullish().default(null), + bdstUsgText: z.string().default(''), + cityText: z.string().default(''), + sggText: z.string().default(''), reuseBuilding: z .array( @@ -56,6 +59,7 @@ export const rswtZod = z.object({ wtrUsqty: z.number().default(0), oblgTrgtWtrUsqty: z.number().nullish().default(0), orgwtKndCd: z.string().default(""), + filtrTrtmfctCpct: z.string().default(""), filtrTrtmfctProcs: z.string().default(""), filtrTrtmfctUsgCd: z.string().default(""), rswtrUsqty: z.number().default(0), @@ -128,7 +132,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( rswtBdstSearch: async(txt:string,pageNation:number,code:string|number) =>{ try{ - const rswtRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/${code}` +(txt? `/${txt}`:'')) + const rswtRes = await getFetch('wr' , `/reuseFc/waterreuseFc/${pageNation}/20/${code}` +(txt? `/${txt}`:'')) set((state: rswtFacState) => { return { ...state, diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx index 264e3b6cc..5387f4292 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx @@ -1,6 +1,6 @@ import type { customRainBdst } from "../../fcltReg/rainReg"; -export const excelSttnParsing = (data: customRainBdst[]): string[][] => { +export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => { const excelExportData: string[][] = []; data.forEach((item) => { @@ -31,3 +31,4 @@ export const excelSttnParsing = (data: customRainBdst[]): string[][] => { }); return excelExportData; }; + diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index 62af8cd19..17027335c 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -30,7 +30,7 @@ export default function HtdflRegForm({ htdflForm: customHtdflBdst; isModal: boolean; }) { - const { code, htdflUpdate, htdflReg } = useWrStore((state) => state); + const { code, htdflBdstUpdate, htdflBdstReg } = useWrStore((state) => state); const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({}); @@ -41,15 +41,12 @@ export default function HtdflRegForm({ const onSubmit = (values: z.infer<typeof hdtflZod>) => { if (isModal) { - htdflReg(values); + htdflBdstReg(values,'41'); } else { - htdflUpdate(values); + htdflBdstUpdate(values ,'41'); } }; - const onSelectValue = (val: string | number) => { - console.log(val); - }; const cleanHtdflData = (raw: any): z.infer<typeof hdtflZod> => { return { @@ -159,7 +156,7 @@ export default function HtdflRegForm({ label={""} selectClass={selectClass} selectArray={code.yn} - onSelectValue={onSelectValue} + onSelectValue={field.onChange} value={field.value ?? code.yn[0]?.val} /> </FormUi> @@ -259,7 +256,7 @@ export default function HtdflRegForm({ label={""} selectClass={selectClass} selectArray={code.yn} - onSelectValue={onSelectValue} + onSelectValue={field.onChange} value={field.value ?? code.yn[0]?.val} /> </FormUi> @@ -296,7 +293,7 @@ export default function HtdflRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={onSelectValue} + onSelectValue={field.onChange} value={field.value ?? code.yn[0]?.val} /> </FormUi> diff --git a/apps/wr/components/ui/modal/headChModal/headChModal.tsx b/apps/wr/components/ui/modal/headChModal/headChModal.tsx index 2f1236f27..1f97373ca 100644 --- a/apps/wr/components/ui/modal/headChModal/headChModal.tsx +++ b/apps/wr/components/ui/modal/headChModal/headChModal.tsx @@ -1,5 +1,5 @@ import { useWrStore } from "@/app/store"; -import { rainSttnHeadListType } from "@/app/store/ruseFcltMng/fcltSttn/rainSttn/headList"; +import { sttnHeadListType } from "@/app/store/ruseFcltMng/fcltSttn/rainSttn/headList"; 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"; @@ -7,38 +7,32 @@ import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; -export default function HeadChModal({type }:{type: string }) { - const { rainSttn ,rainChSttnHead} = useWrStore((state) => state); +export default function HeadChModal({headList, type }:{headList : z.infer<typeof sttnHeadListType> ,type:string }) { + const { rainChSttnHead , rswtChSttnHead} = useWrStore((state) => state); - const { rainSttHeadList, rainSttNodeList } =rainSttn; - let items = rainSttHeadList.map(item => ({id:item.id, title:item.title, val:item.visible })); + let items = headList.map(item => ({id:item.id, title:item.title, val:item.visible })); - - // const FormSchema = - // z.object({ - // id: z.string().refine((value) => value.some((item) => item), { - // message: "최소한 하나를 선택해주시길 바랍니다.", - // }), - // visible: z.boolean() - // }) - - - const form = useForm<z.infer<typeof rainSttnHeadListType>>({ - resolver: zodResolver(rainSttnHeadListType), + const form = useForm<z.infer<typeof sttnHeadListType>>({ + resolver: zodResolver(sttnHeadListType), defaultValues: [], }) useEffect(() =>{ - form.reset(rainSttHeadList) + form.reset(headList) - },[rainSttHeadList]) + },[headList]) - const onSubmit = (headList : z.infer<typeof rainSttnHeadListType> ) =>{ - rainChSttnHead(headList) + const onSubmit = (valueList : z.infer<typeof sttnHeadListType> ) =>{ + if(type==='RNB'){ + + rainChSttnHead(valueList) + }else if(type=== 'RST'){ + rswtChSttnHead(valueList) + } } return ( diff --git a/apps/wr/public/sample_rswtSttn.xlsx b/apps/wr/public/sample_rswtSttn.xlsx new file mode 100644 index 000000000..9f6024752 Binary files /dev/null and b/apps/wr/public/sample_rswtSttn.xlsx differ