Merge commit '311ce14fc97c833c99b69cd6ba928150ecda80c6'

This commit is contained in:
leedj312
2025-09-17 18:04:03 +09:00
59 changed files with 1712 additions and 1330 deletions
@@ -637,7 +637,7 @@ export function SdmInfoRegForm({
}}
/>
<div className="col-span-1">
<Label className="text-xl">수소이온농도(PH)</Label>
<Label className="text-xl">수소이온농도(pH)</Label>
<div className="flex flex-row items-center gap-2">
<Input
className="!text-xl w-36"
@@ -227,9 +227,9 @@ export default function CoMatRvw() {
</div>
</div>
</SearchFormLeft>
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<SearchFormRight className="w-2/12 mx-5 flex flex-col space-x-2 ">
<div className="space-y">
<div className="flex flex-row space-x-2">
<div className="flex flex-row w-full justify-end space-x-2 mt-6">
<Button
size={"sm"}
onClick={() => {
@@ -585,7 +585,7 @@ export default function CoMatRvw() {
control={form.control}
name="ph"
render={({ field }) => (
<FormUi label="수소이온농도(ph)">
<FormUi label="수소이온농도(pH)">
<div className="flex items-center gap-2">
<div className="relative flex-1 min-w-0">
<Input
@@ -336,6 +336,7 @@ export default function CoSttn() {
}}
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
updateList={upadateData}
openNetwork={false}
></SdmInsertForm>
}
></UiModal>
@@ -13,16 +13,23 @@ import {
SearchInput,
Title,
UiModal,
UiTable
UiTable,
} from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components";
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Toaster } from "react-hot-toast";
export default function Home() {
const { auth,code, htdfl, initHtdflReg, getHtdflBdstData, htdflNmSearch } =
useWrStore((state) => state);
const {
auth,
code,
htdfl,
getLaeSeCdCheck,
initHtdflReg,
getHtdflBdstData,
htdflNmSearch,
} = useWrStore((state) => state);
const [searchTxt, setSearchTxt] = useState("");
const [pageNation, setPageNation] = useState(1);
@@ -30,15 +37,22 @@ export default function Home() {
const [bdstTable, setbdstTable] = useState<customHtdflBdst[]>();
const [issNewReg, setIsNewReg] = useState<boolean>(false);
const { htdflRes ,htdflResCount} = htdfl;
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const { htdflRes, htdflResCount } = htdfl;
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
const useInitRef = useRef(false);
useEffect(() => {
if (!htdfl.isInit) {
initHtdflReg("0");
getLaeSeCdCheck();
useInitRef.current = true;
}, []);
useEffect(() => {
setIsNewReg(false);
if (useInitRef.current == true && laeSeCd !== undefined) {
initHtdflReg(laeSeCd);
}
}, [htdfl.isInit, initHtdflReg]);
}, [useInitRef.current, laeSeCd]);
useEffect(() => {
if (htdflRes && htdflRes.length > 0) {
const htdflData = tableData(htdflRes, { code }).map(
@@ -60,26 +74,13 @@ export default function Home() {
}
}, [code, htdflRes]);
const cellClick: (val: number | undefined, headId: string) => void = (
val
) => {
if ((bdstTable ?? []).length > 0 && val !== undefined) {
{
setHtdflForm(htdflRes[val]);
}
}
// if (headId === "bdstChgYn" && val !== undefined) {
// if (
// htdflRes[val]?.bdstInfoSn != null &&
// htdflRes[val]?.chgBuilding?.length > 0
// ) {
// bdstChgModal(htdflRes[val]?.chgBuilding as chgBuilding[]);
// }
// }
};
// const bdstChgModal = (chgBuilding: chgBuilding[]) => {
// setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
// };
const cellClick: (val: number, headId: string) => void = (val) => {
if (!htdflRes || !Array.isArray(htdflRes)) return;
const idx = Number(val);
console.log('htdflRes[idx]', htdflRes[idx]);
setHtdflForm(htdflRes[idx]);
};
useEffect(() => {
getHtdflBdstData(pageNation, "0");
}, [pageNation]);
@@ -113,9 +114,10 @@ export default function Home() {
>
조회
</Button>
<Button size={"sm"}
onClick={() => setIsNewReg(!issNewReg)}
disabled={regAuthrtYn === "N"}
<Button
size={"sm"}
onClick={() => setIsNewReg(!issNewReg)}
disabled={regAuthrtYn === "N"}
>
신규등록
</Button>
@@ -137,7 +139,9 @@ export default function Home() {
total={htdflResCount}
headName={"시설물 목록"}
cellClick={(val, headId) => {
cellClick(val || undefined, headId);
if (val !== null && val !== undefined) {
cellClick(val, headId);
}
}}
onPageChange={setPageNation}
></UiTable>
@@ -12,7 +12,7 @@ import {
import { Button } from "@common/components";
import { useWrStore } from "../../../../store";
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import ListDiv from "@common/business_components/ui/list_div";
import { confirmToast, tableData } from "@/components/lib/func/commom";
import type {
@@ -47,21 +47,22 @@ export default function PublicReuseFaciltyInsert() {
pbnstRuseFcltUpdate,
pubHasuSearch,
pbnstRuseBizUpdate,
getLaeSeCdCheck,
} = useWrStore((state) => state);
const { t } = useTranslation("base");
const { pubFacHeadList, pbnstHasuResCount, pbnstHasuRes, pbnstRes } = pbnst;
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
const [, setCurrentTab] = useState<string>("mng");
const [isRuseReg, setIsRuseReg] = useState<{
isModal: boolean;
}>({ isModal: false });
const [resetPage, isResetPage] = useState(false);
const [indexMng, setIndexMng] = useState<number>(0);
const [indexBiz, setIndexBiz] = useState<number>(0);
const [searchTxt, setSearchTxt] = useState<string>();
const [bdstTable, setbdstTable] = useState<pubHasuType[]>();
const [selectRow, setSelectRow] = useState<pubHasuType>();
const [resetPage, isResetPage] = useState(false);
const [pageNation, setPageNation] = useState<number>(1);
const form = useForm<{
@@ -83,17 +84,20 @@ export default function PublicReuseFaciltyInsert() {
});
const formWatch = form.watch("items");
const useInitRef = useRef(false);
useEffect(() => {
if (!pbnst.isInit) {
pubHasuInit("1", "41");
getLaeSeCdCheck();
useInitRef.current = true;
}, []);
useEffect(() => {
if (useInitRef.current == true && laeSeCd !== undefined) {
pubHasuInit("1", laeSeCd);
}
}, [pbnst.isInit, pubHasuInit]);
}, [useInitRef.current, laeSeCd]);
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
// if (!isDirty) {
// toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
// return;
// }
const data = writeRgtrAndMdfr(valuse.items);
let bizs = [] as fcBizType[];
data.forEach((fclt) => {
@@ -133,7 +137,7 @@ export default function PublicReuseFaciltyInsert() {
message += "하수재이용 시설 사업 ";
}
toast.error(message + "오류 입니다 ");
pubHasuInit("1", "41");
pubHasuInit("1", laeSeCd);
}
});
};
@@ -220,7 +224,7 @@ export default function PublicReuseFaciltyInsert() {
setSelectRow(pbnstHasuRes?.[val]);
if (selectRow) {
pbnstRegClick(selectRow);
setIndexMng(0)
setIndexMng(0);
} else {
console.error("선택된 행이 없습니다.");
}
@@ -237,7 +241,6 @@ export default function PublicReuseFaciltyInsert() {
}, [indexMng]);
useEffect(() => {
if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) {
form.reset({ items: pbnst.pbnstRes });
} else {
@@ -263,7 +266,7 @@ export default function PublicReuseFaciltyInsert() {
}, [pbnstRes, append, selectRow]);
useEffect(() => {
pubHasuInit(String(pageNation), "41");
pubHasuInit(String(pageNation), laeSeCd);
isResetPage(false);
}, [pageNation, pubHasuInit]);
@@ -289,13 +292,12 @@ export default function PublicReuseFaciltyInsert() {
size={"sm"}
onClick={() => {
if (searchTxt && searchTxt?.length > 0) {
pubHasuSearch(String(pageNation), "41", searchTxt);
pubHasuSearch(String(pageNation), laeSeCd, searchTxt);
} else {
pubHasuInit(String(pageNation), "41");
pubHasuInit(String(pageNation), laeSeCd);
}
isResetPage(true);
}}
>
조회
</Button>
@@ -428,7 +430,7 @@ export default function PublicReuseFaciltyInsert() {
}
}}
onInvalid={onInvalid}
newIndexMng={(formWatch?.length -1)}
newIndexMng={formWatch?.length - 1}
></PbnstRegModal>
}
bodyClass="w-[68vw] max-w-none h-[90vh]"
@@ -1,7 +1,10 @@
"use client";
import { useWrStore } from "@/app/store";
import { rainRegSize, type customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { formatArchArea, tableData } from "@/components/lib/func/commom";
import {
rainRegSize,
type customRainBdst,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { formatArchArea, tableData } from "@/components/lib/func/commom";
import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import {
@@ -16,33 +19,43 @@ import {
} from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components";
import { useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
import { useEffect, useRef, useState } from "react";
import { Toaster } from "react-hot-toast";
export default function Home() {
const { auth, rain, code, initRain, rainSearch, getRainData } = useWrStore(
(state) => {
return state;
}
);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const {
auth,
rain,
code,
initRain,
rainSearch,
getRainData,
getLaeSeCdCheck,
} = useWrStore((state) => {
return state;
});
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
const { rainRes, rainResCount } = rain;
const useInitRef = useRef(false);
const [rainForm, setRainForm] = useState<customRainBdst>();
const [issNewReg, setIsNewReg] = useState<boolean>(false);
const [pageNation, setPageNation] = useState(1);
const [bdstTable, setbdstTable] = useState<customRainBdst[]>();
const [searchTxt, setSearchTxt] = useState<string>();
useEffect(() => {
getLaeSeCdCheck();
useInitRef.current = true;
}, []);
useEffect(() => {
setIsNewReg(false);
if (!rain.isInit) {
initRain("41");
if (useInitRef.current == true && laeSeCd !== undefined) {
initRain(laeSeCd);
}
}, [rain.isInit, initRain]);
}, [useInitRef.current, laeSeCd]);
useEffect(() => {
if (code.sggCd.length > 0) {
@@ -51,9 +64,9 @@ export default function Home() {
(item: customRainBdst) => {
return {
...item,
archArea: formatArchArea(item?.archArea,1),
archArea: formatArchArea(item?.archArea, 1),
bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N",
frstArchPrmsnDt:item?.frstArchPrmsnDt||'확인불가'
frstArchPrmsnDt: item?.frstArchPrmsnDt || "확인불가",
};
}
);
@@ -71,7 +84,7 @@ export default function Home() {
};
useEffect(() => {
getRainData(pageNation, "41");
getRainData(pageNation, laeSeCd);
}, [pageNation]);
return (
@@ -95,7 +108,7 @@ export default function Home() {
className=""
size={"sm"}
onClick={() => {
rainSearch(searchTxt || "", 1, "41");
rainSearch(searchTxt || "", 1, laeSeCd);
//rainSearch(searchTxt || "", pageNation, "41");
}}
>
@@ -105,7 +118,7 @@ export default function Home() {
size={"sm"}
className=""
onClick={() => {
setIsNewReg(!issNewReg);
setIsNewReg(!issNewReg);
}}
disabled={regAuthrtYn === "N"}
>
@@ -138,7 +151,7 @@ export default function Home() {
</ListDiv>
</div>
<div className="col-span-2 ">
<ListDiv >
<ListDiv>
<ScrollArea className="h-[75vh]">
<RainRegForm
rainForm={rainForm ?? ({} as customRainBdst)}
@@ -1,6 +1,9 @@
"use client";
import { useWrStore } from "@/app/store";
import { rswtRegSize, type customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
import {
rswtRegSize,
type customRswtBdst,
} from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
import { tableData } from "@/components/lib/func/commom";
import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
@@ -12,18 +15,24 @@ import {
SearchInput,
Title,
UiModal,
UiTable
UiTable,
} from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components";
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Toaster } from "react-hot-toast";
export default function Home() {
const { auth,code, rswt, initRswt, rswtBdstSearch, getRswtBdstData } = useWrStore(
(state) => state
);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const {
auth,
code,
rswt,
initRswt,
rswtBdstSearch,
getRswtBdstData,
getLaeSeCdCheck,
} = useWrStore((state) => state);
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
const [rswtForm, setRswtForm] = useState<customRswtBdst>();
const [searchTxt, setSearchTxt] = useState<string>();
@@ -32,14 +41,22 @@ export default function Home() {
const [selectVal, setSelect] = useState<number>();
const [bdstTable, setbdstTable] = useState<customRswtBdst[]>();
const { rswtRes, rswtResCount } = rswt;
const useInitRef = useRef(false);
useEffect(() => {
if (!rswt.isInit) {
initRswt("41");
getLaeSeCdCheck();
useInitRef.current = true;
}, []);
useEffect(() => {
setIsNewReg(false);
if (useInitRef.current == true && laeSeCd !== undefined) {
initRswt(laeSeCd);
}
}, [rswt.isInit, initRswt]);
}, [useInitRef.current, laeSeCd]);
useEffect(() => {
if (code.sggCd.length > 0) {
if (rswtRes?.length > 0) {
const rswtData = tableData(rswtRes, { code })?.map(
(item: customRswtBdst) => {
@@ -63,7 +80,6 @@ export default function Home() {
}
}
// }, [code, rswtRes, selectVal]);
}, [code, rswtRes]);
useEffect(() => {
if (rswtRes && rswtRes.length > 0) {
@@ -79,11 +95,10 @@ export default function Home() {
setSelect(val);
}
}
};
useEffect(() => {
getRswtBdstData(pageNation, "41");
getRswtBdstData(pageNation,laeSeCd);
}, [pageNation]);
return (
@@ -107,7 +122,7 @@ export default function Home() {
size={"sm"}
className=""
onClick={() => {
rswtBdstSearch(searchTxt || "", pageNation, "41");
rswtBdstSearch(searchTxt || "", pageNation,laeSeCd);
}}
>
조회
@@ -92,7 +92,7 @@ export default function RainSttn() {
useEffect(() => {
if (!rainSttn.isInit) {
rainSttnInit(false, 1, rainSttnSize, "0", fcltNm, code.cityCd, code.sggCd);
rainSttnInit(false, 1, rainSttnSize, "0", fcltNm, code as unknown as Record<string, SelectDataType[]>);
}
}, [rainSttn.isInit, rainSttnInit]);
@@ -146,8 +146,7 @@ export default function RainSttn() {
rainSttnSize,
String(getConValue()),
fcltNm,
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
isResetPage(false);
}, [pageNation]);
@@ -177,8 +176,7 @@ export default function RainSttn() {
rainSttnResCount,
String(getConValue()),
fcltNm,
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
}, [
rainSttnSearch,
@@ -237,8 +235,7 @@ export default function RainSttn() {
rainSttnSize,
String(getConValue()),
fcltNm,
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
isResetPage(true);
}}
@@ -34,6 +34,7 @@ export default function RswtSttn() {
const { code, rswtSttn, rswtSttnSearch, rswtSttnInit } = useWrStore(
(state) => state
);
const [pageNation, setPageNation] = useState(1);
const { rswtSttnRes, rswtSttnResCount } = rswtSttn;
@@ -83,8 +84,8 @@ export default function RswtSttn() {
};
useEffect(() => {
if (!rswtSttn.isInit) {
rswtSttnInit(false, 1, rswtSttnSize, "0", fcltNm, code.cityCd, code.sggCd);
if (!rswtSttn.isInit&&code) {
rswtSttnInit(false, 1, rswtSttnSize, code.userSiSggCd, fcltNm, code as unknown as Record<string, SelectDataType[]>);
}
}, [rswtSttn.isInit, rswtSttnInit]);
@@ -93,6 +94,8 @@ export default function RswtSttn() {
const chData = data
.map((item: customRswtBdst) => {
const isOrgwtKndCd = item.reuseBuilding[0]?.rswtrObj.orgwtKndCd
return {
...item,
...item.reuseBuilding[0],
@@ -101,7 +104,7 @@ export default function RswtSttn() {
chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N',
instlCst: item.reuseBuilding[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCst,
instlCstSprtAmt: item.reuseBuilding[0]?.instlCstSprtAmt === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCstSprtAmt,
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가'
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가',
}
})
.filter(
@@ -131,11 +134,11 @@ export default function RswtSttn() {
const excelClick = useCallback(() => {
isDownloadTriggered.current = true;
rswtSttnSearch(true, 1, rswtSttnResCount, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
rswtSttnSearch(true, 1, rswtSttnResCount, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, rswtSttnResCount]);
useEffect(() => {
rswtSttnSearch(false, pageNation, rswtSttnSize, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
rswtSttnSearch(false, pageNation, rswtSttnSize, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
isResetPage(false)
}, [pageNation]);
@@ -186,7 +189,7 @@ export default function RswtSttn() {
<Button
size={"sm"}
onClick={() => {
rswtSttnSearch(false, 1, rswtSttnSize, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
rswtSttnSearch(false, 1, rswtSttnSize, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
isResetPage(true)
}}
>
@@ -2,7 +2,6 @@
import { useWrStore } from "@/app/store";
import {
commonCd,
rainPageSize,
type rainChkZodType,
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
@@ -38,7 +37,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@common/components/ui/tooltip";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
@@ -62,10 +61,11 @@ export default function Page() {
rswtChkDelete,
rswtrChkExcelDownload,
rswtChkHeadChange,
getLaeSeCdCheck
} = useWrStore((state) => {
return state;
});
const { regAuthrtYn, mdfcnAuthrtYn, delAuthrtYn } = auth;
const { regAuthrtYn, mdfcnAuthrtYn, delAuthrtYn,laeSeCd } = auth;
const [isRegExcel, setIsRegExcel] = useState(false);
const [updateRainDetail, setUpdateRainDetail] = useState<rainChkZodType[]>(
[]
@@ -85,6 +85,17 @@ export default function Page() {
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
const useInitRef = useRef(false);
useEffect(() => {
getLaeSeCdCheck();
useInitRef.current = true;
}, []);
const cellClick = () => {
if (searchYear)
if (selFcltDiv === "RNB") {
@@ -93,12 +104,12 @@ export default function Page() {
rainPageNation,
rainPageSize,
searchYear,
commonCd,
laeSeCd,
fcltNm
);
setRainPageNation(1);
} else {
rainChkInit(rainPageNation, rainPageSize, searchYear, commonCd);
rainChkInit(rainPageNation, rainPageSize, searchYear, laeSeCd);
}
} else {
if (fcltNm) {
@@ -106,12 +117,12 @@ export default function Page() {
rainPageNation,
rainPageSize,
searchYear,
commonCd,
laeSeCd,
fcltNm
);
setRswtPageNation(1);
} else {
rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd);
rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, laeSeCd);
}
}
};
@@ -123,11 +134,11 @@ export default function Page() {
pageNo,
rainPageSize,
searchYear,
commonCd,
laeSeCd,
fcltNm
);
} else {
rainChkInit(pageNo, rainPageSize, searchYear, commonCd);
rainChkInit(pageNo, rainPageSize, searchYear, laeSeCd);
}
}
};
@@ -139,41 +150,43 @@ export default function Page() {
pageNo,
rainPageSize,
searchYear,
commonCd,
laeSeCd,
fcltNm
);
} else {
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd);
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, laeSeCd);
}
}
};
useEffect(() => {
if (!rainChkgdn.isInit) {
if (useInitRef.current == true && laeSeCd !== undefined&& !rainChkgdn.isInit) {
rainChkInit(
1,
rainPageSize,
new Date().getFullYear().toString(),
commonCd
laeSeCd
);
isRainSttn(false);
setIsModal({ data: {}, open: false });
setIsRegExcel(false);
}
}, [rainChkgdn.isInit, rainChkInit, rainPageSize]);
}, [rainChkgdn.isInit, rainChkInit, rainPageSize,laeSeCd]);
useEffect(() => {
if (!rswtChkgdn.isInit) {
if (useInitRef.current == true && laeSeCd !== undefined&&!rswtChkgdn.isInit) {
rswtChkgdnInit(
1,
rswtPageSize,
new Date().getFullYear().toString(),
commonCd
laeSeCd
);
setIsModal({ data: {}, open: false });
setIsRegExcel(false);
}
}, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize]);
}, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize,laeSeCd]);
useEffect(() => {
if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) {
@@ -197,9 +210,9 @@ export default function Page() {
const excelClick = useCallback(() => {
if (selFcltDiv === "RNB") {
rainChkExcelDownload(code.cityCd, code.sggCd);
rainChkExcelDownload(code.cityCd, code.sggCd,laeSeCd);
} else {
rswtrChkExcelDownload(code.cityCd, code.sggCd);
rswtrChkExcelDownload(code.cityCd, code.sggCd,laeSeCd);
}
}, [
rainChkExcelDownload,
@@ -207,6 +220,7 @@ export default function Page() {
code.cityCd,
code.sggCd,
selFcltDiv,
laeSeCd
]);
const handleClick = useCallback(
@@ -9,7 +9,11 @@ import {
type FcPrfType,
type PrfType,
} from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
import { confirmToast, excelDownload, yearOptions } from "@/components/lib/func/commom";
import {
confirmToast,
excelDownload,
yearOptions,
} from "@/components/lib/func/commom";
import { InputTableBody } from "@/components/lib/func/TableData";
import PbnPrfExcelModal from "@/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal";
import {
@@ -32,17 +36,29 @@ import {
TableBody,
TableHeader,
} from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
export default function PrfmncPrfmncReg() {
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch,getPrfFmcRes } = useWrStore(
(state) => state
);
const { prfPbnFclts, pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const {
auth,
prfmnc,
prfmncHasuInit,
prfmnRegData,
prfmncHasuNmSearch,
getPrfFmcRes,
getLaeSeCdCheck,
} = useWrStore((state) => state);
const {
prfPbnFclts,
pbnstPrfmncHeadList,
monthHeadList,
prfmncRes,
prfmncResCount,
} = prfmnc;
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
const [isReset, setIsReset] = useState(false);
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
const [searchTxt, setSearchTxt] = useState<string>();
@@ -57,6 +73,8 @@ export default function PrfmncPrfmncReg() {
String(new Date().getFullYear())
);
const useInitRef = useRef(false);
const excelClick = useCallback(() => {
excelDownload(
[[]],
@@ -66,26 +84,26 @@ export default function PrfmncPrfmncReg() {
);
}, [prfmnc.excelList]);
const { t } = useTranslation('base');
const { t } = useTranslation("base");
const onSave = useCallback(() => {
const handleConfirm = async () => {
if (!pbnstRuseFcltId) return;
prfmnRegData(
1,
'41',
laeSeCd,
excelToPbnPrfData(
inputData as unknown as JSON[],
searchYear,
pbnstRuseFcltId
) as unknown as PrfType
, searchYear,
) as unknown as PrfType,
searchYear,
prfPbnFclts
);
};
confirmToast(t('isUpdateMsg'), handleConfirm);
}, [inputData, searchYear, pbnstRuseFcltId, cellNum,prfPbnFclts]);
confirmToast(t("isUpdateMsg"), handleConfirm);
}, [inputData, searchYear, pbnstRuseFcltId, cellNum, prfPbnFclts]);
const cellClick = useCallback(
(index: number | undefined) => {
@@ -112,89 +130,90 @@ export default function PrfmncPrfmncReg() {
};
if (prfmncRes[index]?.prfList) {
prfmncRes[index].prfList?.forEach((prfItem) => {
const yr = Number(prfItem.ym?.slice(0, 4)); // "YYYY"
const yr = Number(prfItem.ym?.slice(0, 4)); // "YYYY"
if(yr === Number(searchYear)) {
const month = Number(prfItem?.ym?.slice(4)); // "MM"
const monthKey = `${month}월`;
if (yr === Number(searchYear)) {
const month = Number(prfItem?.ym?.slice(4)); // "MM"
const monthKey = `${month}월`;
inUsageData.forEach((inData: any) => {
const usageKey = inData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
inUsageData.forEach((inData: any) => {
const usageKey = inData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
inData[monthKey] = value;
inData.total += value;
inData[monthKey] = value;
inData.total += value;
if (inSubtotal && usageKey !== "subtotal") {
(inSubtotal as any)[monthKey] =
((inSubtotal as any)[monthKey] ?? 0) + value;
inSubtotal.total += value;
}
});
if (inSubtotal && usageKey !== "subtotal") {
(inSubtotal as any)[monthKey] =
((inSubtotal as any)[monthKey] ?? 0) + value;
inSubtotal.total += value;
}
});
outUsageData.forEach((outData: any) => {
const usageKey = outData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
outUsageData.forEach((outData: any) => {
const usageKey = outData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
outData[monthKey] = value;
outData.total += value;
outData[monthKey] = value;
outData.total += value;
if (usageKey !== "subtotal") {
(outSubtotal as any)[monthKey] =
((outSubtotal as any)[monthKey] ?? 0) + value;
outSubtotal.total += value;
}
});
}
if (usageKey !== "subtotal") {
(outSubtotal as any)[monthKey] =
((outSubtotal as any)[monthKey] ?? 0) + value;
outSubtotal.total += value;
}
});
}
});
if(inSubtotal.total!==0 && outSubtotal.total!==0) {
if (inSubtotal.total !== 0 && outSubtotal.total !== 0) {
inUsageData.push(inSubtotal);
outUsageData.push(outSubtotal);
const usageTotalObj: { [key: string]: any } = {
...structuredClone(totalObj),
구분: "총합계",
용수명: "",
};
for (const key in usageTotalObj) {
if (["usage", "gubun", "edit"].includes(key)) continue;
const val =
(Number((inSubtotal as any)[key]) || 0) +
(Number((outSubtotal as any)[key]) || 0);
inUsageData.push(inSubtotal);
outUsageData.push(outSubtotal);
const usageTotalObj: { [key: string]: any } = {
...structuredClone(totalObj),
구분: "총합계",
용수명: "",
};
for (const key in usageTotalObj) {
if (["usage", "gubun", "edit"].includes(key)) continue;
const val =
(Number((inSubtotal as any)[key]) || 0) +
(Number((outSubtotal as any)[key]) || 0);
(usageTotalObj as any)[key] = val;
(usageTotalObj as any)[key] = val;
}
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
setpbnstRuseFcltId(prfmncRes[index].pbnstRuseFcltId);
setInputData(tableData);
} else {
setInputData([]);
}
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
setpbnstRuseFcltId(prfmncRes[index].pbnstRuseFcltId);
setInputData(tableData);
}else{
setInputData([]);
}
} else {
setInputData([]);
}
}
},
[prfmncRes,searchYear]
[prfmncRes, searchYear]
);
useEffect(() => {
if (!prfmnc.isInit) {
getPrfFmcRes()
getLaeSeCdCheck();
useInitRef.current = true;
}, []);
useEffect(() => {
if (useInitRef.current == true && laeSeCd !== undefined) {
getPrfFmcRes();
useInitRef.current = true;
}
}, [prfmnc.isInit, getPrfFmcRes]);
}, [useInitRef.current, laeSeCd]);
useEffect(() =>{
const year = new Date().getFullYear()
prfmncHasuInit(1, '41',String(year) ,prfPbnFclts);
},[prfPbnFclts])
useEffect(() => {
const year = new Date().getFullYear();
prfmncHasuInit(1, laeSeCd, String(year), prfPbnFclts);
}, [prfPbnFclts]);
useEffect(() => {
if (prfmncRes && prfmncRes.length > 0) {
setbdstTable(prfmncRes);
}
@@ -244,11 +263,12 @@ export default function PrfmncPrfmncReg() {
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="space-y">
<div className="flex flex-row space-x-2">
<Button size={"sm"} onClick={() => {
setIsReset(true)
}}>
<Button
size={"sm"}
onClick={() => {
setIsReset(true);
}}
>
조회
</Button>
<Button
@@ -256,7 +276,7 @@ export default function PrfmncPrfmncReg() {
onClick={() => {
onSave();
}}
disabled={mdfcnAuthrtYn === 'N'}
disabled={mdfcnAuthrtYn === "N"}
>
저장
</Button>
@@ -270,7 +290,7 @@ export default function PrfmncPrfmncReg() {
setIsExcelOPen({ ...isExcelOpen, isModal: true });
}
}}
disabled={regAuthrtYn === 'N'}
disabled={regAuthrtYn === "N"}
>
파일등록
</Button>
@@ -289,7 +309,7 @@ export default function PrfmncPrfmncReg() {
<ListDiv className="min-h-0">
<ScrollArea className="h-[60vh]">
<UiTable
key={'leftTable'}
key={"leftTable"}
tableData={bdstTable || []}
headlist={pbnstPrfmncHeadList}
pageSize={10}
@@ -299,16 +319,21 @@ export default function PrfmncPrfmncReg() {
cellClick(index);
setCellNum(index ?? 0);
}}
onPageChange={
(page:number) => {
if (searchTxt && searchTxt?.length > 0) {
prfmncHasuNmSearch(page, '41', searchYear, searchTxt,prfPbnFclts)
} else {
prfmncHasuInit(page, '41', searchYear,prfPbnFclts)
}
setIsReset(false);
}}
resetPageNo={isReset}
onPageChange={(page: number) => {
if (searchTxt && searchTxt?.length > 0) {
prfmncHasuNmSearch(
page,
laeSeCd,
searchYear,
searchTxt,
prfPbnFclts
);
} else {
prfmncHasuInit(page, laeSeCd, searchYear, prfPbnFclts);
}
setIsReset(false);
}}
resetPageNo={isReset}
/>
</ScrollArea>
</ListDiv>
@@ -324,8 +349,13 @@ export default function PrfmncPrfmncReg() {
<TableHeader className="font-bold">
{headMakeprfmnc(monthHeadList, [])}
</TableHeader>
<TableBody key={prfmnc.pageKey + 'pageKey'}>
{InputTableBody(inputData ?? [], monthHeadList, setInputData, mdfcnAuthrtYn === 'N' ? false : true)}
<TableBody key={prfmnc.pageKey + "pageKey"}>
{InputTableBody(
inputData ?? [],
monthHeadList,
setInputData,
mdfcnAuthrtYn === "N" ? false : true
)}
</TableBody>
</Table>
</ScrollArea>
@@ -338,17 +368,12 @@ export default function PrfmncPrfmncReg() {
<PbnPrfExcelModal
data={isExcelOpen.data}
setIsExcelOPen={(open) => {
setIsExcelOPen({ ...isExcelOpen, isModal: open })
setIsExcelOPen({ ...isExcelOpen, isModal: open });
}}
setModalExcelData={async (excelData) => {
await prfmnRegData(1, '41',
excelData,
searchYear
,prfPbnFclts
);
await prfmnRegData(1, laeSeCd, excelData, searchYear, prfPbnFclts);
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
}
}
}}
></PbnPrfExcelModal>
}
open={isExcelOpen.isModal}
@@ -27,7 +27,7 @@ export default function RswtStat() {
const { t } = useTranslation('base');
useEffect(() => {
searchRswtStatList(searchYear, code.cityCd)
searchRswtStatList(searchYear, code.cityCd,code.rswtBdstType)
}, [searchRswtStatList, code.cityCd])
const excelClick = () => {
@@ -251,7 +251,7 @@ export default function RswtStat() {
className=""
size="sm"
onClick={() => {
searchRswtStatList(searchYear, code.cityCd)
searchRswtStatList(searchYear, code.cityCd,code.rswtBdstType)
}}
>
조회
+16 -11
View File
@@ -7,33 +7,38 @@ import { StoreProvider } from "./store";
import { LoginApi } from "@/src/entities/auth";
import { useEffect } from "react";
const i18n = i18next.createInstance();
i18n.init({
lng: "ko",
fallbackLng: "ko",
resources: {
ko: {
base: koBase,
},
},
});
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
i18next.init({
lng: "ko",
fallbackLng: "ko",
resources: {
ko: {
base: koBase,
},
},
});
useEffect(() => {
// 렌더 중이 아니라 클라이언트에서만 실행 + 에러 캐치
void LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" })
.finally(()=>{
// getCommonUpCd()
} )
.catch((e) => {
console.error("Auto login failed:", e);
});
}, []);
return (
<html lang="en">
<html lang="ko">
<body>
<I18nextProvider i18n={i18next}>
<I18nextProvider i18n={i18n}>
<StoreProvider>
{children}
</StoreProvider>
+38 -10
View File
@@ -1,4 +1,5 @@
import { getFetchWithCount } from "@/components/lib/api";
import { fetchType, getFetchWithCount } from "@/components/lib/api";
import { getUserInfo } from "@common/components/api";
import toast from "react-hot-toast";
export type authState = {
@@ -8,6 +9,7 @@ export type authState = {
regAuthrtYn: string;
mdfcnAuthrtYn: string;
delAuthrtYn: string;
laeSeCd: string;
};
};
@@ -20,26 +22,32 @@ export const authStateExport: authState = {
regAuthrtYn: "Y",
mdfcnAuthrtYn: "Y",
delAuthrtYn: "Y",
laeSeCd: "",
},
};
export type authActions = {
getMenuAuthrts: (menuCd: number) => void;
getLaeSeCdCheck: () => Promise<void>;
};
export const authActionsExport: (set: any) => authActions = (set: any) => {
export const authActionsExport: (set: any, get: any) => authActions = (
set: any,
get: any
) => {
return {
getMenuAuthrts: async (menuCd: number) => {
try{
try {
const response = await getFetchWithCount(
fetchType.LOCAL,
const response = await getFetchWithCount( 'LOCAL',
`/cms-service/api/v1/menu-authrts/pageinfo/${menuCd}`
);
set((state: authState) => {
return {
...state,
auth: {
...state.auth,
mngAuthrtYn: response[0].mngAuthrtYn,
inqAuthrtYn: response[0].mngAuthrtYn,
regAuthrtYn: response[0].mngAuthrtYn,
@@ -48,12 +56,32 @@ export const authActionsExport: (set: any) => authActions = (set: any) => {
},
};
});
}catch(e){
toast.error('권한 정보를 가져오는 중 오류가 발생했습니다. 관리자에게 문의하세요.');
console.error('Error fetching menu authorities:', e);
} catch (e) {
toast.error(
"권한 정보를 가져오는 중 오류가 발생했습니다. 관리자에게 문의하세요."
);
console.error("Error fetching menu authorities:", e);
}
},
getLaeSeCdCheck: async () => {
try {
const current = get().auth.laeSeCd;
if (current && current !== "") {
return;
}
const infoMe = await getUserInfo();
const isLaeSeCd =
infoMe.laeSeCd.slice(0, 2) === "G3" ? infoMe.laeSeCd.slice(2) : "0";
set((state: authState) => ({
...state,
auth: {
...state.auth,
laeSeCd: isLaeSeCd,
},
}));
} catch (e) {
console.error("laeSeCd check error", e);
}
},
};
+372 -184
View File
@@ -3,6 +3,7 @@ import type { SelectDataType } from "@common/business_components";
export const numSize = 12;
export const txtSize = 20;
//export const lwCds: Record<string, SelectDataType[]> = {};
export const yn: SelectDataType[] = [
{ val: "Y", text: "Y" },
{ val: "N", text: "N" },
@@ -14,29 +15,35 @@ export const bdstFilterYn: SelectDataType[] = [
{ val: "F", text: "미가동" },
];
// 최우수(그린1)/우수(그린2), 우량(그린3), 일반(그린4), 확인불가 체크
export const bdstGrntchClass: SelectDataType[] = [
{ val: "최우수(그린1)", text: "최우수(그린1)" },
{ val: "우수(그린2)", text: "우수(그린2)" },
{ val: "우량(그린3)", text: "우량(그린3)" },
{ val: "일반(그린4)", text: "일반(그린4)" },
{ val: "확인불가", text: "확인불가" },
];
//export const bdstGrntchClass: SelectDataType[] = lwCds['bdstGrntchClass']??[]
// [
// { val: "최우수(그린1)", text: "최우수(그린1)" },
// { val: "우수(그린2)", text: "우수(그린2)" },
// { val: "우량(그린3)", text: "우량(그린3)" },
// { val: "일반(그린4)", text: "일반(그린4)" },
// { val: "확인불가", text: "확인불가" },
// ];
export const bdstIncenYn: SelectDataType[] = [
{ val: "Y", text: "Y" },
{ val: "N", text: "N" },
{ val: "D", text: "확인불가" },
];
//처리장연계/자체+연계/자체처리
export const erctUswtrPrcsMeth: SelectDataType[] = [
{ val: "처리장연계", text: "처리장연계" },
{ val: "자체+연계", text: "자체+연계" },
{ val: "자체처리", text: "자체처리" },
];
//export const erctUswtrPrcsMeth: SelectDataType[] = lwCds['erctUswtrPrcsMeth']??[]
export const rusePrcsMthdCd: SelectDataType[] = [
{ val: "물리학적처리", text: "물리학적처리" },
{ val: "생물학적처리", text: "생물학적처리" },
];
// [
// { val: "처리장연계", text: "처리장연계" },
// { val: "자체+연계", text: "자체+연계" },
// { val: "자체처리", text: "자체처리" },
// ];
// export const rusePrcsMthdCd: SelectDataType[] = lwCds['rusePrcsMthdCd']??[]
// [
// { val: "물리학적처리", text: "물리학적처리" },
// { val: "생물학적처리", text: "생물학적처리" },
// ];
export const ruseSeCd: SelectDataType[] = [
{ val: "신규", text: "신규" },
@@ -53,94 +60,100 @@ export const ruseBizMthdCd: SelectDataType[] = [
];
// 공통 건축물 용도
export const bdstUsgCd: SelectDataType[] = [
{ val: "-1", text: "확인불가" },
{ val: "1", text: "운동장" },
{ val: "2", text: "체육관" },
{ val: "3", text: "공공업무시설" },
{ val: "4", text: "공공기관의청사" },
{ val: "5", text: "아파트" },
{ val: "6", text: "연립주택" },
{ val: "7", text: "다세대주택" },
{ val: "8", text: "기숙사" },
{ val: "9", text: "초등학교" },
{ val: "10", text: "중학교" },
{ val: "11", text: "고등학교" },
{ val: "12", text: "전문대학" },
{ val: "13", text: "대학및대학교" },
{ val: "14", text: "골프장" },
{ val: "15", text: "대규모점포" },
{ val: "16", text: "기타" },
{ val: "17", text: "숙박업" },
{ val: "18", text: "목욕장업" },
{ val: "19", text: "공장" },
{ val: "20", text: "발전시설" },
{ val: "21", text: "관광단지개발사업" },
{ val: "22", text: "도시개발사업" },
{ val: "23", text: "산업단지개발사업" },
{ val: "24", text: "택지개발사업" },
{ val: "25", text: "대규모점포(대형마트)" },
{ val: "26", text: "대규모점포(전문점)" },
{ val: "27", text: "대규모점포(백화점)" },
{ val: "28", text: "대규모점포(쇼핑센터)" },
{ val: "29", text: "대규모점포(복합쇼핑몰)" },
{ val: "30", text: "물류시설" },
{ val: "31", text: "운수시설(여객자동차터미널)" },
{ val: "32", text: "운수시설(철도시설)" },
{ val: "33", text: "운수시설(공항시설)" },
{ val: "34", text: "운수시설(항만시설)" },
{ val: "35", text: "업무시설(공공업무시설)" },
{ val: "36", text: "업무시설(금융업소)" },
{ val: "37", text: "업무시설(사무소)" },
{ val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
{ val: "39", text: "업무시설(출판사)" },
{ val: "40", text: "업무시설(신문사)" },
{ val: "41", text: "업무시설(오피스텔)" },
{ val: "42", text: "교정시설" },
{ val: "43", text: "방송국" },
{ val: "44", text: "전신전화국" },
{ val: "45", text: "기타" },
];
//export const bdstUsgCd: SelectDataType[] =lwCds?.bdstUsgCd?.concat(lwCds?.rswtBdstType??[])??[]
export const rswtBdstType: SelectDataType[] = [
{ val: "17", text: "숙박업" },
{ val: "18", text: "목욕장업" },
{ val: "19", text: "공장" },
{ val: "20", text: "발전시설" },
{ val: "21", text: "관광단지개발사업" },
{ val: "22", text: "도시개발사업" },
{ val: "23", text: "산업단지개발사업" },
{ val: "24", text: "택지개발사업" },
{ val: "25", text: "대규모점포(대형마트)" },
{ val: "26", text: "대규모점포(전문점)" },
{ val: "27", text: "대규모점포(백화점)" },
{ val: "28", text: "대규모점포(쇼핑센터)" },
{ val: "29", text: "대규모점포(복합쇼핑몰)" },
{ val: "30", text: "물류시설" },
{ val: "31", text: "운수시설(여객자동차터미널)" },
{ val: "32", text: "운수시설(철도시설)" },
{ val: "33", text: "운수시설(공항시설)" },
{ val: "34", text: "운수시설(항만시설)" },
{ val: "35", text: "업무시설(공공업무시설)" },
{ val: "36", text: "업무시설(금융업소)" },
{ val: "37", text: "업무시설(사무소)" },
{ val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
{ val: "39", text: "업무시설(출판사)" },
{ val: "40", text: "업무시설(신문사)" },
{ val: "41", text: "업무시설(오피스텔)" },
{ val: "42", text: "교정시설" },
{ val: "43", text: "방송국" },
{ val: "44", text: "전신전화국" },
{ val: "45", text: "기타" },
];
// [
// { val: "-1", text: "확인불가" },
// { val: "1", text: "운동장" },
// { val: "2", text: "체육관" },
// { val: "3", text: "공공업무시설" },
// { val: "4", text: "공공기관의청사" },
// { val: "5", text: "아파트" },
// { val: "6", text: "연립주택" },
// { val: "7", text: "다세대주택" },
// { val: "8", text: "기숙사" },
// { val: "9", text: "초등학교" },
// { val: "10", text: "중학교" },
// { val: "11", text: "고등학교" },
// { val: "12", text: "전문대학" },
// { val: "13", text: "대학및대학교" },
// { val: "14", text: "골프장" },
// { val: "15", text: "대규모점포" },
// { val: "16", text: "기타" },
// { val: "17", text: "숙박업" },
// { val: "18", text: "목욕장업" },
// { val: "19", text: "공장" },
// { val: "20", text: "발전시설" },
// { val: "21", text: "관광단지개발사업" },
// { val: "22", text: "도시개발사업" },
// { val: "23", text: "산업단지개발사업" },
// { val: "24", text: "택지개발사업" },
// { val: "25", text: "대규모점포(대형마트)" },
// { val: "26", text: "대규모점포(전문점)" },
// { val: "27", text: "대규모점포(백화점)" },
// { val: "28", text: "대규모점포(쇼핑센터)" },
// { val: "29", text: "대규모점포(복합쇼핑몰)" },
// { val: "30", text: "물류시설" },
// { val: "31", text: "운수시설(여객자동차터미널)" },
// { val: "32", text: "운수시설(철도시설)" },
// { val: "33", text: "운수시설(공항시설)" },
// { val: "34", text: "운수시설(항만시설)" },
// { val: "35", text: "업무시설(공공업무시설)" },
// { val: "36", text: "업무시설(금융업소)" },
// { val: "37", text: "업무시설(사무소)" },
// { val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
// { val: "39", text: "업무시설(출판사)" },
// { val: "40", text: "업무시설(신문사)" },
// { val: "41", text: "업무시설(오피스텔)" },
// { val: "42", text: "교정시설" },
// { val: "43", text: "방송국" },
// { val: "44", text: "전신전화국" },
// { val: "45", text: "기타" },
// ];
export const orgwtKndCd = [
{ text: "오수(변기 오수 제외)", val: "01" },
{ text: "오수", val: "02" },
{ text: "폐수", val: "03" },
{ text: "오수 및 폐수", val: "04" },
{ text: "기타", val: "05" },
];
// export const rswtBdstType: SelectDataType[] = lwCds?.rswtBdstType??[]
//[
// { val: "17", text: "숙박업" },
// { val: "18", text: "목욕장업" },
// { val: "19", text: "공장" },
// { val: "20", text: "발전시설" },
// { val: "21", text: "관광단지개발사업" },
// { val: "22", text: "도시개발사업" },
// { val: "23", text: "산업단지개발사업" },
// { val: "24", text: "택지개발사업" },
// { val: "25", text: "대규모점포(대형마트)" },
// { val: "26", text: "대규모점포(전문점)" },
// { val: "27", text: "대규모점포(백화점)" },
// { val: "28", text: "대규모점포(쇼핑센터)" },
// { val: "29", text: "대규모점포(복합쇼핑몰)" },
// { val: "30", text: "물류시설" },
// { val: "31", text: "운수시설(여객자동차터미널)" },
// { val: "32", text: "운수시설(철도시설)" },
// { val: "33", text: "운수시설(공항시설)" },
// { val: "34", text: "운수시설(항만시설)" },
// { val: "35", text: "업무시설(공공업무시설)" },
// { val: "36", text: "업무시설(금융업소)" },
// { val: "37", text: "업무시설(사무소)" },
// { val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
// { val: "39", text: "업무시설(출판사)" },
// { val: "40", text: "업무시설(신문사)" },
// { val: "41", text: "업무시설(오피스텔)" },
// { val: "42", text: "교정시설" },
// { val: "43", text: "방송국" },
// { val: "44", text: "전신전화국" },
// { val: "45", text: "기타" },
// ];
//export const orgwtKndCd =lwCds['orgwtKndCd']??[]
// [
// { text: "오수(변기 오수 제외)", val: "01" },
// { text: "오수", val: "02" },
// { text: "폐수", val: "03" },
// { text: "오수 및 폐수", val: "04" },
// { text: "기타", val: "05" },
// ];
export const chBuCd = [
{ val: "증축", text: "증축" },
@@ -148,97 +161,104 @@ export const chBuCd = [
{ val: "재축", text: "재축" },
];
export const dmdUszCd = [
{ val: "조경용수", text: "조경용수" },
{ val: "청소화장실용수", text: "청소화장실용수" },
{ val: "농업용수", text: "농업용수" },
{ val: "공업용수", text: "공업용수" },
{ val: "친수용수", text: "친수용수" },
{ val: "기타", text: "기타" },
];
// export const dmdUszCd = [
// { val: "조경용수", text: "조경용수" },
// { val: "청소화장실용수", text: "청소화장실용수" },
// { val: "농업용수", text: "농업용수" },
// { val: "공업용수", text: "공업용수" },
// { val: "친수용수", text: "친수용수" },
// { val: "기타", text: "기타" },
// ];
export const ruseMngMtd = [
{ val: "자체운영", text: "자체운영" },
{ val: "공기업", text: "공기업" },
{ val: "민간(대행)", text: "민간(대행)" },
];
export const pplQulity = [
{ val: "도복장강관", text: "도복장강관" },
{ val: "PE관", text: "PE관" },
{ val: "스테인레스관", text: "스테인레스관" },
{ val: "덕타일주철관", text: "덕타일주철관" },
{ val: "유리섬유복합관", text: "유리섬유복합관" },
{ val: "기타", text: "기타" },
];
export const pplLenght = [
{ val: "D100", text: "D100" },
{ val: "D200", text: "D200" },
{ val: "D250", text: "D250" },
{ val: "D300", text: "D300" },
{ val: "D350", text: "D350" },
{ val: "D400", text: "D400" },
{ val: "D450", text: "D450" },
{ val: "D500", text: "D500" },
{ val: "D700", text: "D700" },
{ val: "D900", text: "D900" },
{ val: "D1000​", text: "D1000​" },
];
export const rainFcltCd = [
{ val: "10", text: "확인불가" },
{ val: "01", text: "지붕" },
{ val: "02", text: "건물옥상" },
{ val: "03", text: "골프장 연못" },
{ val: "04", text: "운동장 바닥" },
{ val: "05", text: "운동장 지붕" },
{ val: "06", text: "주차장" },
{ val: "07", text: "태양광패널" },
{ val: "08", text: "연못" },
{ val: "09", text: "기타" },
];
// export const ruseMngMtd = lwCds['ruseMngMtd']
// [
// { val: "자체운영", text: "자체운영" },
// { val: "공기업", text: "공기업" },
// { val: "민간(대행)", text: "민간(대행)" },
// ];
// export const pplQulity =
// [
// { val: "도복장강관", text: "도복장강관" },
// { val: "PE관", text: "PE관" },
// { val: "스테인레스관", text: "스테인레스관" },
// { val: "덕타일주철관", text: "덕타일주철관" },
// { val: "유리섬유복합관", text: "유리섬유복합관" },
// { val: "기타", text: "기타" },
// ];
// export const pplLenght = [
// { val: "D100", text: "D100" },
// { val: "D200", text: "D200" },
// { val: "D250", text: "D250" },
// { val: "D300", text: "D300" },
// { val: "D350", text: "D350" },
// { val: "D400", text: "D400" },
// { val: "D450", text: "D450" },
// { val: "D500", text: "D500" },
// { val: "D700", text: "D700" },
// { val: "D900", text: "D900" },
// { val: "D1000​", text: "D1000​" },
// ];
// export const rainFcltCd = lwCds?.rainFcltCd??[]
// [
// { val: "10", text: "확인불가" },
// { val: "01", text: "지붕" },
// { val: "02", text: "건물옥상" },
// { val: "03", text: "골프장 연못" },
// { val: "04", text: "운동장 바닥" },
// { val: "05", text: "운동장 지붕" },
// { val: "06", text: "주차장" },
// { val: "07", text: "태양광패널" },
// { val: "08", text: "연못" },
// { val: "09", text: "기타" },
// ];
//물리화학적처리(스크린, 응집, 침전)/생물학적처리(활성슬러지법 등)/소독(염소, UV 등)/기타
export const rswtPrscCdMthdCd = [
{
val: "물리화학적처리(스크린,응집,침전)",
text: "물리화학적처리(스크린,응집,침전)",
},
{
val: "생물학적처리(활성슬러지법 등)",
text: "생물학적처리(활성슬러지법 등)",
},
{ val: "소독(염소, UV 등)", text: "소독(염소, UV 등)" },
{ val: "기타", text: "기타" },
{ val: "확인불가", text: "확인불가" },
];
//export const rswtPrscCdMthdCd = lwCds['rswtPrscCdMthdCd']??[]
// {
// val: "물리화학적처리(스크린,응집,침전)",
// text: "물리화학적처리(스크린,응집,침전)",
// },
// {
// val: "생물학적처리(활성슬러지법 등)",
// text: "생물학적처리(활성슬러지법 등)",
// },
// { val: "소독(염소, UV 등)", text: "소독(염소, UV 등)" },
// { val: "기타", text: "기타" },
// { val: "확인불가", text: "확인불가" },
// ];
export const htdPowerMthdCd= [
{
val: "해당없음",
text: "해당없음",
},
{
val: "석탄화력발전",
text: "석탄화력발전",
},
{
val: "화력발전",
text: "화력발전",
},
{
val: "수력발전",
text: "수력발전",
},
{
val: "태양관발전",
text: "태양관발전",
},
];
// export const htdPowerMthdCd = [
// {
// val: "해당없음",
// text: "해당없음",
// },
// {
// val: "석탄화력발전",
// text: "석탄화력발전",
// },
// {
// val: "화력발전",
// text: "화력발전",
// },
// {
// val: "수력발전",
// text: "수력발전",
// },
// {
// val: "태양관발전",
// text: "태양관발전",
// },
// ];
//(공업용수/양식장/농업용수)
export const htdUtztnUsgCd= [
export const htdUtztnUsgCd = [
{
val: "공업용수",
text: "공업용수",
@@ -252,3 +272,171 @@ export const htdUtztnUsgCd= [
text: "농업용수",
},
];
export const ruseFcltSpot = []
//(공업용수/양식장/농업용수)
export const rainRswtMng = [
{
val: "위탁",
text: "01",
},
{
val: "자체",
text: "02",
},
];
export const rainFcltFlowRate = [
{
val: "01",
text: "유량계",
},
{
val: "02",
text: "수위계",
},
{
val: "03",
text: "펌프적산전력계",
},
{
val: "04",
text: "기타",
},
];
export const rainRswtUse = [
{
val: "01",
text: "유량계",
},
{
val: "02",
text: "수위계",
},
{
val: "03",
text: "펌프적산전력계",
},
{
val: "04",
text: "기타",
},
];
export const sewageInFcltUse = [
{
val: "01",
text: "세척수",
},
{
val: "02",
text: "냉각수",
},
{
val: "03",
text: "청소수",
},
{
val: "04",
text: "삭수대",
},
{
val: "05",
text: "희석용수",
},
{
val: "06",
text: "중수도",
},
{
val: "07",
text: "기타",
},
];
export const sewageOutFclttUse = [
{
val: "01",
text: "청소화장실용수",
},
{
val: "02",
text: "세척살수용수",
},
{
val: "03",
text: "조경용수",
},
{
val: "04",
text: "친수용수",
},
{
val: "05",
text: "지하수충전",
},
{
val: "06",
text: "농업용수",
},
{
val: "07",
text: "하천등유지용수",
},
{
val: "08",
text: "공업용수",
},
];
// const codeMApping = {
// WR001: "bdstUsgCd",
// WR002: "rswtBdstType",
// WR003: "rainFcltCd",
// WR004: "bdstGrntchClass",
// WR005: "rswtPrscCdMthdCd", // 아직 디 못바꿈
// WR006: "orgwtKndCd", //작업 완ㅛ
// WR007: "ruseMngMtd", // 작업완료
// WR008: "rusePrcsMthdCd", //w작업완료
// WR009: "erctUswtrPrcsMeth",//w작업완료
// WR010: "ruseFcltSpot",// inout은 yn 만 사용해야 함으로 해당 코드는 사용안함.
// WR011: "pplQulity",
// WR012: "pplLenght",
// WR013: "bdstFilterYn", // 사용 불가 yn만 사용해야함으로 해당코드 사용 안함
// WR014: "rainRswtMng", // 지도점검 등록 시변경
// WR015: "rainFcltFlowRate", //지도점검 등록 시변경
// WR016: "dmdUszCd", // 지도점검 등록 시변경
// WR017: "sewageInFcltUse", //하수재이용 장내
// WR018: "sewageOutFclttUse", // 하수재이용 장외
// WR019: "htdPowerMthdCd",
// WR020: "htdUtztnUsgCd",
// };
// export const getCommonUpCd = async () => {
// const upCd = await getFetchWithCount(
// fetchType.LOCAL,
// "/cms-service/api/v1/up-codes?keyword=&upCd=&cdSe=&useYn=Y&siteId=WR&page=0&size=100&sort=string"
// );
// const upWrCode: string[] = upCd.content
// .filter((item: any) => item.upCd.slice(0, 2) === "WR")
// .map((cd: any) => cd.upCd);
// await Promise.all(
// upWrCode.map(async (cd) => {
// const mapping = codeMApping[cd as keyof typeof codeMApping];
// if (!mapping) return;
// const lwCd = await getFetchWithCount(
// fetchType.LOCAL,
// `/cms-service/api/v1/lwpo-cds/up-cd/${cd}`
// );
// const list = Array.isArray(lwCd) ? lwCd : lwCd.content ?? [];
// lwCds[mapping] = list.map((it: any) => ({
// text: it.lwpoCdNm,
// val: it.lwpoCd,
// }));
// })
// );
// console.log('lwCds ', lwCds)
// };
+109 -36
View File
@@ -1,32 +1,97 @@
import { getFetch } from "@/components/lib/api";
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
import type {
EnvPartSelectDataType,
SelectDataType,
} from "@common/business_components/ui";
import {
bdstFilterYn,
bdstGrntchClass,
bdstIncenYn,
bdstUsgCd,
chBuCd,
dmdUszCd,
erctUswtrPrcsMeth,
htdPowerMthdCd,
htdUtztnUsgCd,
orgwtKndCd,
pplLenght,
pplQulity,
rainFcltCd,
rswtPrscCdMthdCd,
ruseBizMthdCd,
ruseMngMtd,
rusePrcsMthdCd,
ruseSeCd,
yn,
} from "./basicCode";
export const btnClass = "p-4 m-2 text-white rounded-sm text-lg font-medium ";
const laeSecd = "41";
export const lwCds: Record<string, SelectDataType[]> = {};
const codeMApping = {
WR001: "bdstUsgCd",
WR002: "rswtBdstType",
WR003: "rainFcltCd",
WR004: "bdstGrntchClass",
WR005: "rswtPrscCdMthdCd", // 아직 디 못바꿈
WR006: "orgwtKndCd", //작업 완ㅛ
WR007: "ruseMngMtd", // 작업완료
WR008: "rusePrcsMthdCd", //w작업완료
WR009: "erctUswtrPrcsMeth", //w작업완료
WR010: "ruseFcltSpot", // inout은 yn 만 사용해야 함으로 해당 코드는 사용안함.
WR011: "pplQulity",
WR012: "pplLenght",
WR013: "bdstFilterYn", // 사용 불가 yn만 사용해야함으로 해당코드 사용 안함
WR014: "rainRswtMng", // 지도점검 등록 시변경
WR015: "rainFcltFlowRate", //지도점검 등록 시변경
WR016: "dmdUszCd", // 지도점검 등록 시변경
WR017: "sewageInFcltUse", //하수재이용 장내
WR018: "sewageOutFclttUse", // 하수재이용 장외
WR019: "htdPowerMthdCd",
WR020: "htdUtztnUsgCd",
};
export const getCommonUpCd = async (set: any) => {
try {
let lwCdCode: Record<string, SelectDataType[]> = {};
const upCd = await getFetchWithCount(
fetchType.LOCAL,
"/cms-service/api/v1/up-codes?keyword=&upCd=&cdSe=&useYn=Y&siteId=WR&page=0&size=100&sort=string"
);
const upWrCode: string[] = upCd.content
.filter((item: any) => item.upCd.slice(0, 2) === "WR")
.map((cd: any) => cd.upCd);
await Promise.all(
upWrCode.map(async (cd) => {
const mapping = codeMApping[cd as keyof typeof codeMApping];
if (!mapping) return;
const lwCd = await getFetchWithCount(
fetchType.LOCAL,
`/cms-service/api/v1/lwpo-cds/up-cd/${cd}`
);
const list = Array.isArray(lwCd) ? lwCd : (lwCd.content ?? []);
lwCds[mapping] = list.map((it: any) => ({
text: it.lwpoCdNm,
val: it.lwpoCd,
}));
})
);
lwCdCode = lwCds;
set((state: comCodeState) => ({
code: {
...state.code,
rainFcltCd: lwCdCode["rainFcltCd"] ?? [],
bdstUsgCd: lwCdCode["bdstUsgCd"] ?? [],
orgwtKndCd: lwCdCode["orgwtKndCd"] ?? [],
pplQulity: lwCdCode["pplQulity"] ?? [],
pplLenght: lwCdCode["pplLenght"] ?? [],
dmdUszCd: lwCdCode["dmdUszCd"] ?? [],
ruseMngMtd: lwCdCode["ruseMngMtd"] ?? [],
rusePrcsMthdCd: lwCdCode["rusePrcsMthdCd"] ?? [],
erctUswtrPrcsMeth: lwCdCode["erctUswtrPrcsMeth"] ?? [],
bdstGrntchClass: lwCdCode["bdstGrntchClass"] ?? [],
htdPowerMthdCd: lwCdCode["htdPowerMthdCd"] ?? [],
htdUtztnUsgCd: lwCdCode["htdUtztnUsgCd"] ?? [],
rswtBdstType: lwCdCode["rswtBdstType"] ?? [],
bdstTotalUsgType:
lwCdCode["bdstUsgCd"]?.concat(lwCdCode["rswtBdstType"] || []) ?? [],
},
}));
} catch (e) {
console.log("com code error ", e);
}
};
//물재이용 주소 코드: devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
export const buildingType = {
RST: "RST",
@@ -181,9 +246,11 @@ export type comCodeState = {
bdstFilterYn: SelectDataType[];
bdstIncenYn: SelectDataType[];
bdstGrntchClass: SelectDataType[];
rswtPrscCdMthdCd: SelectDataType[];
// rswtPrscCdMthdCd: SelectDataType[];
htdPowerMthdCd: SelectDataType[];
htdUtztnUsgCd: SelectDataType[];
rswtBdstType: SelectDataType[];
bdstTotalUsgType: SelectDataType[];
userSiSggCd: string;
};
};
@@ -193,50 +260,56 @@ export type comCodeType = comCodeState & comCodeActions;
export const comCodeStateExport: comCodeState = {
code: {
isInit: false,
rainFcltCd: rainFcltCd,
bdstUsgCd: bdstUsgCd,
rainFcltCd: lwCds["rainFcltCd"] ?? [],
bdstUsgCd: lwCds["bdstUsgCd"] ?? [],
chBuCd: chBuCd,
orgwtKndCd: orgwtKndCd,
orgwtKndCd: lwCds["orgwtKndCd"] ?? [],
cityCd: [],
sggCd: [],
rvbsnCd: [],
mdmbsnCd: [],
lgbsnCd: [],
lclgvrnmntCd: [],
pplQulity: pplQulity,
pplLenght: pplLenght,
pplQulity: lwCds["pplQulity"] ?? [],
pplLenght: lwCds["pplLenght"] ?? [],
yn: yn,
dmdUszCd: dmdUszCd,
dmdUszCd: lwCds["dmdUszCd"] ?? [],
buildingType: buildingType,
ruseMngMtd: ruseMngMtd,
ruseMngMtd: lwCds["ruseMngMtd"] ?? [],
ruseSeCd: ruseSeCd,
ruseBizMthdCd: ruseBizMthdCd,
rusePrcsMthdCd: rusePrcsMthdCd,
erctUswtrPrcsMeth: erctUswtrPrcsMeth,
rusePrcsMthdCd: lwCds["rusePrcsMthdCd"] ?? [],
erctUswtrPrcsMeth: lwCds["erctUswtrPrcsMeth"] ?? [],
bdstFilterYn: bdstFilterYn,
bdstIncenYn: bdstIncenYn,
bdstGrntchClass: bdstGrntchClass,
rswtPrscCdMthdCd: rswtPrscCdMthdCd,
htdPowerMthdCd: htdPowerMthdCd,
htdUtztnUsgCd: htdUtztnUsgCd,
bdstGrntchClass: lwCds["bdstGrntchClass"] ?? [],
// rswtPrscCdMthdCd: rswtPrscCdMthdCd, // 공단연락오면 바꿔야함
htdPowerMthdCd: lwCds["htdPowerMthdCd"] ?? [],
htdUtztnUsgCd: lwCds["htdUtztnUsgCd"] ?? [],
userSiSggCd: laeSecd,
rswtBdstType: lwCds["rswtBdstType"] ?? [],
bdstTotalUsgType: lwCds["bdstTotalUsgType"] ?? [],
},
};
export type comCodeActions = {
returnCodeText: (val: string, codeName: string) => string;
returnTextCode: (text: string, codeName: string) => string;
};
export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
export const codeActionExport: (set: any, get:any) => comCodeActions = (set: any, get:any) => {
return {
returnCodeText: (val: string, codeName: string) => {
console.log('val', val, 'codeName', codeName);
return set((state: comCodeState) => {
const codeList = state.code[codeName] || [];
const found = codeList.find((item) => item.val === val);
return found ? found.text : val;
}
);
const codeList = get().code[codeName] || [];
const found = codeList.find((item) => item.val === val);
return found ? found.text : val;
},
returnTextCode: (text: string, codeName: string) => {
const codeList = get().code[codeName] || [];
const found = codeList.find((item) => item.text === text);
return found ? found.val : text;
},
};
};
+31
View File
@@ -0,0 +1,31 @@
export type LwCdType= {
lwpoCd: string,
upCd: string,
lwpoCdNm:string,
lwpoCdExpln:string,
unit: string,
prntLwpoCd: string,
useYn: string,
sortSeq: number,
regDt: Date,
rgtr: string,
mdfcnDt: Date,
mdfr: string
}
export type UPCdType= {
upCd: string,
upCdNm: string,
upCdExpln: string,
cdSe: string,
useYn: string,
delYn: string,
siteId: string,
regDt:Date,
rgtr: string
mdfcnDt: Date,
mdfr: string
}
+3 -6
View File
@@ -23,9 +23,7 @@ export type rainMapState = {
type rainMapActions = {
rainMapInit: (page: number, total: number, cityOrSgg:string) => void;
rainMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rainMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,code:Record<string , SelectDataType[]>) => void;
rainMapDetile:(featureCd:string) => Promise<customRainBdst | undefined>;
};
@@ -72,8 +70,7 @@ export const rainMapActionsExport: (set: any) => rainMapActions = (
}
},
rainMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
code :Record<string, SelectDataType[]>) => {
try {
const rainMapRes = await getFetchWithCount(
fetchType.WR,
@@ -84,7 +81,7 @@ export const rainMapActionsExport: (set: any) => rainMapActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainMapExcelList = excelRainSttnParsing(rainMapRes, sidoCode, sggCode);
const rainMapExcelList = excelRainSttnParsing(rainMapRes, code);
set((state: rainMapState) => {
return {
+3 -7
View File
@@ -23,9 +23,7 @@ export type rswtMapState = {
type rswtMapActions = {
rswtMapInit: (page: number, total: number, cityOrSgg: string) => void;
rswtMapSearch: (
isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
isExcel: boolean, page: number, total: string, con: string, txt: string, code:Record<string, SelectDataType[]>
) => void;
rswtMapDetile: (featureCd: string) => Promise<customRswtBdst | undefined>;
};
@@ -72,9 +70,7 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
console.log(e);
}
},
rswtMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
rswtMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,code:Record<string, SelectDataType[]>
) => {
try {
const rswtMapRes = await getFetchWithCount(
@@ -86,7 +82,7 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtMapExcelList = excelRSwtSttnParsing(rswtMapRes, sidoCode, sggCode);
const rswtMapExcelList = excelRSwtSttnParsing(rswtMapRes, code);
set((state: rswtMapState) => {
return {
...state,
@@ -167,7 +167,7 @@ export const ruseCaseHeadListExport: TableUpperProps[] = [
},
{
id: "grnteWqPh",
title: "수소이온농도(ph)​",
title: "수소이온농도(pH)​",
visible: true,
row: 1,
},
@@ -313,7 +313,7 @@ export const ruseCaseHeadListExport: TableUpperProps[] = [
},
{
id: "prcmPlanEcqrRt",
title: "국고비율",
title: "국고비율(%)",
visible: true,
row: 1,
},
@@ -350,7 +350,7 @@ export const ruseCaseHeadListExport: TableUpperProps[] = [
},
{
id: "clclnEcqrRt",
title: "국고비율",
title: "국고비율(%)",
visible: true,
row: 1,
},
@@ -7,6 +7,7 @@ import {
parseRawValue,
} from "@/components/lib/func/excelFunc";
import toast from "react-hot-toast";
import { codeToText, textToCode } from "@/components/lib/func/commom";
export const useTypes = [
"조경용수",
"청소화장실용수",
@@ -17,17 +18,13 @@ export const useTypes = [
"기타",
];
export const chkMngType =[
'위탁',
'자체'
]
export const chkSpwtPositnType = [
'유량계',
'수위계',
'펌프적산전력계',
'기타'
]
export const chkMngType = { "01": "위탁", "02": "자체" };
export const rainFcltFlowRateType = {
"01": "유량계",
"02": "수위계",
"03": "펌프적산전력계",
"04": "기타",
};
export type Buildingtype = {
bdstInfoSn: number;
@@ -118,7 +115,7 @@ export const excelToRainChkData = (excelData: any, year: string) => {
const ruseData = parseRawValue(item[`빗물_${month}월`]);
if (month.length < 2) month = "0" + month;
return {
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd") ?? undefined,
ym: year + month,
chckYmd: checkYmd,
splyUswtrUtztnQnt: splyData,
@@ -133,14 +130,14 @@ export const excelToRainChkData = (excelData: any, year: string) => {
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
rgtr: TEST_UUID,
operMngCd: item["운영관리형태"] ?? "",
operMngCd: textToCode(item["운영관리형태"], "rainRswtMng") ??item["운영관리형태"],
anlOperCst: parseRawValue(item["연간운영비(원/년)"]),
oilqMeasMthd: item["유량측정방법"] ?? "",
oilqMeasMthd: textToCode( item["유량측정방법"],"rainFcltFlowRate",)??item["유량측정방법"],
guideDetails: makeGuidDetail,
rainyDetails: [
{
ph: item["PH"],
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
trbt: parseRawValue(item["탁도"]),
grssClfg: parseRawValue(item["총대장균군수"]),
etc: item["기타"] || "", // 필드 누락 방지
@@ -156,10 +153,10 @@ export const excelToRainChkData = (excelData: any, year: string) => {
})
.filter((el: any) => el !== undefined);
console.log("rainChkgdData", rainChkgdData);
console.log('rainChkgdData ', rainChkgdData)
if (rainChkgdData.length > 0) {
rainChkgdData.forEach((rain: any) => {
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${codeToText(rain.guideDetails[0]?.utztnUsgCd, "dmdUszCd") ??rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
issues.push(
@@ -173,28 +170,36 @@ console.log("rainChkgdData", rainChkgdData);
);
}
if (rain.operMngCd.length > 1 && !chkMngType.includes(rain.operMngCd)) {
if (rain.operMngCd.length > 1 && !chkMngType[rain.operMngCd]) {
issues.push(
defaultMessage + `운영관리 형태: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
defaultMessage +
`운영관리 형태: 위탁 혹은 자체 만 허용) /입력값:${rain.operMngCd}`
);
}
if (rain.oilqMeasMthd.length > 1 && !chkSpwtPositnType.includes(rain.oilqMeasMthd)) {
if (
rain.oilqMeasMthd.length > 1 &&
!rainFcltFlowRateType[rain.oilqMeasMthd]
) {
issues.push(
defaultMessage + `유량측정방법: 유량계, 수위계, 펌프적산전력계, 기타) /입력값:${rain.oilqMeasMthd}`
defaultMessage +
`유량측정방법: 유량계, 수위계, 펌프적산전력계, 기타) /입력값:${rain.oilqMeasMthd}`
);
}
rain.rainyDetails?.forEach((key) => {
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
issues.push(defaultMessage + `PH: 숫자 형식 아님 /입력값:${key.ph}`);
issues.push(defaultMessage + `pH: 숫자 형식 아님 /입력값:${key.ph}`);
}
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
issues.push(defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`);
issues.push(
defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`
);
}
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
issues.push(
defaultMessage + `총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}`
defaultMessage +
`총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}`
);
}
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
@@ -226,7 +231,7 @@ console.log("rainChkgdData", rainChkgdData);
}
});
});
}else{
} else {
toast.error("데이터가 없습니다. 점검 데이터를 확인해주세요.");
}
@@ -87,6 +87,7 @@ export type chHeadType = {
export type splRuseWaterType = {
utztnUsgCd: string;
utztnUsgCdText: string;
splTotal: number;
spl01: number;
spl02: number;
@@ -141,17 +142,17 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
{ id: "cityText", title: "시도", mergeCell: true },
{ id: "sggText", title: "시군구", mergeCell: true },
{ id: "bdstNm", title: "시설명", mergeCell: true },
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
{ id: "operMngCdText", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthdText", title: "유량측정방법", mergeCell: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "totalSplyUswtrUtztnQnt", title: "연간대체수이용량(m³)" },
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
{
id: "ph",
title: "수소이온농도(ph)",
title: "수소이온농도(pH)",
upName: "useQuilty",
upSequnce: 1,
type: "number",
@@ -201,7 +202,7 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
];
export const ruseHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "ruseTotal", title: "계", upName: "ruseWater", upSequnce: 1 },
{ id: "ruse01", title: "1월", upName: "ruseWater", upSequnce: 2 , edit: true },
{ id: "ruse02", title: "2월", upName: "ruseWater", upSequnce: 3 , edit: true },
@@ -218,7 +219,7 @@ export const ruseHeadListExport: TableUpperProps[] = [
];
export const splHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splTotal", title: "계", upName: "splWater", upSequnce: 1},
{ id: "spl01", title: "1월", upName: "splWater", upSequnce: 2, edit: true },
{ id: "spl02", title: "2월", upName: "splWater", upSequnce: 3, edit: true },
@@ -72,7 +72,8 @@ type rainChkgdnActions = {
rainChkGuidUpdate(rainChk: rainChkZodType): Promise<void>;
rainChkExcelDownload(
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
sggCode: SelectDataType[],
sggCd:string
): Promise<void>;
rainChkExcelDataUPload(excelData: rainChkZodType[] ,year :string) : Promise<void>;
rainChkDelete(chkgdnSns: number[] ,year :string): Promise<void>;
@@ -151,12 +152,13 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
return {
rainChkExcelDownload: async (
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
sggCode: SelectDataType[],
sggCd: string,
) => {
// 로그인한 아이디의 시도 or 시군구로 들어가야하는데 현재는 그냥 0으로 하드코딩
const data = await getFetch(
fetchType.WR,
`/reuseFc/buildingFlg/${buildingType.RNB}/41`
`/reuseFc/buildingFlg/${buildingType.RNB}/${sggCd}`
);
const excelList = buildingToExcelType(data, sidoCode, sggCode);
set((state: rainChkgdnState) => ({
@@ -11,6 +11,7 @@ import {
useTypes,
type Buildingtype
} from "../rainChkgdn/excel";
import { codeToText, textToCode } from "@/components/lib/func/commom";
export const rswtMakeExcelSample = (
buildings: Buildingtype[],
@@ -158,12 +159,12 @@ export const excelToRswtGuideData = (
if (checkYmd.length > 7) {
return {
bdstRuseFcltSn: Number(item["NO"]),
operMngCd: item["운영관리형태"],
operMngCd: textToCode(item["운영관리형태"], "rainRswtMng") ??item["운영관리형태"],
anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]),
prcsCpct: parseRawValue(item[`처리용량(m³)`]),
spwtPositn: item["채수지점"],
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
guideDetails: makeGuidDetail,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
@@ -226,7 +227,7 @@ export const excelToRswtPolution = (excelData: any) => {
return {
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
operMngCd: item["운영관리형태"],
anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]),
prcsCpct: parseRawValue(item["처리용량(m³)"]),
@@ -236,7 +237,7 @@ export const excelToRswtPolution = (excelData: any) => {
mdfr: TEST_UUID,
rswtrDetails: [
{
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
vltnDt: vltnDt,
vltnMttr: item["위반사항"],
levyAmt: Number(item["과태료 부과금액(천원)"]) ?? 0,
@@ -248,13 +249,6 @@ export const excelToRswtPolution = (excelData: any) => {
}
})
.filter((el: any) => el !== undefined);
// if (rswtChkgdData.length > 0) {
// rswtExcelDataCheck(rswtChkgdData, issues);
// }
// if (issues.length > 0) {
// return { data: [], issues };
// }
return rswtChkgdData
};
@@ -265,7 +259,7 @@ export const rswtExcelDataCheck = (
) => {
rswtChkgdData.forEach((rswt: any) => {
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${codeToText(rswt.utztnUsgCd ,"dmdUszCd")??rswt.utztnUsgCd}] 항목에서 `;
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`);
@@ -284,7 +278,7 @@ export const rswtExcelDataCheck = (
}
// if (
// rswt.spwtPositn.length > 1 &&
// !chkSpwtPositnType.includes(rswt.spwtPositn)
// !rainFcltFlowRateType[rswt.spwtPositn]
// ) {
// issues.push(
// defaultMessage +
@@ -53,6 +53,7 @@ const buildingZod = z.object({
});
export const rswtrPolutionsZode = z.object({
utztnUsgCdText:z.string().nullish(),
chkgdnDtlFk: z.string().nullish(),
utztnUsgCd: z.string().nullish(),
node: z.string().nullish(),
@@ -143,7 +144,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
{ id: "prcsCpct", title: "처리용량(m³)" ,mergeCell: true},
{ id: "spwtPositn", title: "채수지점" ,mergeCell: true},
{ id: "chckYmd", title: "점검일" ,mergeCell: true},
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)" ,type: "number"},
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)",type: "number"},
@@ -167,7 +168,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
{ id: "crmty", title: "색도(도)", upName: "useQuilty", upSequnce: 6 ,type: "number"},
{ id: "tn", title: "총질소(T-N)(mg/L)", upName: "useQuilty", upSequnce: 7 ,type: "number"},
{ id: "tph", title: "총인(T-P)(mg/L)", upName: "useQuilty", upSequnce: 8 ,type: "number"},
{ id: "ph", title: "수소이온농도(ph)", upName: "useQuilty", upSequnce: 9,type: "text" },
{ id: "ph", title: "수소이온농도(pH)", upName: "useQuilty", upSequnce: 9,type: "text" },
{ id: "clIonQnt", title: "염화물(mg/L)", upName: "useQuilty", upSequnce: 10 ,type: "number"},
{
@@ -197,7 +198,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
export const rswtDetailHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{
id: "grssClfgUswtr",
@@ -237,7 +238,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
},
{ id: "tn", title: "T-N", upName: "detailQulity", upSequnce: 8, edit: true },
{ id: "tph", title: "T-P", upName: "detailQulity", upSequnce: 9, edit: true },
{ id: "ph", title: "PH", upName: "detailQulity", upSequnce: 10, edit: true },
{ id: "ph", title: "pH", upName: "detailQulity", upSequnce: 10, edit: true },
{
id: "clIonQnt",
title: "염화물",
@@ -75,7 +75,8 @@ type rswtChkgdnActions = {
) => void;
rswtrChkExcelDownload(
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
sggCode: SelectDataType[],
sggCd: string,
): Promise<void>;
rswtChkExceDataUpload: (excelData: rswtChkZodType[]) => void;
rswtChkDelete: (chkgdnSns: number[] ,year:string) => void;
@@ -84,6 +85,7 @@ type rswtChkgdnActions = {
rswtChkPolInit: () => void;
rwstPolAndGuideUpdate: (rswtChk: rswtChkZodType[]) => void;
rswtChkHeadChange: (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => void;
setRswtChkLoading:(status:boolean) =>void
};
export type rswtChkgdnType = rswtChkgdnState & rswtChkgdnActions;
@@ -153,11 +155,12 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
return {
rswtrChkExcelDownload: async (
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
sggCode: SelectDataType[],
sggCd: string,
) => {
const data = await getFetch(
fetchType.WR,
`/reuseFc/buildingFlg/${buildingType.RST}/41`
`/reuseFc/buildingFlg/${buildingType.RST}/${sggCd}`
);
const excelList: any = [];
const exceldata = rswtMakeExcelSample(data, sidoCode, sggCode);
@@ -394,6 +397,15 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
} catch (e) {
console.error(e);
}
},
},setRswtChkLoading:(status:boolean) =>{
set((state: rswtChkgdnState) => ({
...state,
rswtChkgdn: {
...state.rswtChkgdn,
isLoading: status,
},
}));
}
};
};
@@ -5,17 +5,17 @@ export const rainChkgdnHeadSttnExport: TableUpperProps[] = [
{ id: "cityText", title: "시도", mergeCell: true },
{ id: "sggText", title: "시군구", mergeCell: true },
{ id: "bdstNm", title: "시설명", mergeCell: true },
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
{ id: "operMngCdText", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthdText", title: "유량측정방법", mergeCell: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "totalSplyUswtrUtztnQnt", title: "연간대체수이용량(m³)" },
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
{
id: "ph",
title: "수소이온농도(ph)",
title: "수소이온농도(pH)",
upName: "useQuilty",
upSequnce: 1,
type: "number",
@@ -59,7 +59,7 @@ export const rainChkgdnHeadSttnExport: TableUpperProps[] = [
];
export const ruseSttnHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "ruseTotal", title: "계", upName: "ruseWater", upSequnce: 1 },
{ id: "ruse01", title: "1월", upName: "ruseWater", upSequnce: 2 },
{ id: "ruse02", title: "2월", upName: "ruseWater", upSequnce: 3 },
@@ -76,7 +76,7 @@ export const ruseSttnHeadListExport: TableUpperProps[] = [
];
export const splSttnHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splTotal", title: "계", upName: "splWater", upSequnce: 1 },
{ id: "spl01", title: "1월", upName: "splWater", upSequnce: 2 },
{ id: "spl02", title: "2월", upName: "splWater", upSequnce: 3 },
@@ -108,7 +108,7 @@ export const splSttnHeadListExport: TableUpperProps[] = [
];
export const rswtDetailHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{
id: "grssClfgUswtr",
@@ -153,7 +153,7 @@ export const rswtDetailHeadListExport: TableUpperProps[] = [
upName: "detailQulity",
upSequnce: 9,
},
{ id: "ph", title: "PH", upName: "detailQulity", upSequnce: 10 },
{ id: "ph", title: "pH", upName: "detailQulity", upSequnce: 10 },
{
id: "clIonQnt",
title: "염화물",
@@ -10,7 +10,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
{ id: "prcsCpct", title: "처리용량(m³)", mergeCell: true },
{ id: "spwtPositn", title: "채수지점", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)", type: "number" },
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)", type: "number" },
@@ -64,7 +64,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
upSequnce: 8,
type: "number",
},
{ id: "ph", title: "수소이온농도(ph)", upName: "useQuilty", upSequnce: 9, type: "text" },
{ id: "ph", title: "수소이온농도(pH)", upName: "useQuilty", upSequnce: 9, type: "text" },
{
id: "clIonQnt",
title: "염화물(mg/L)",
@@ -132,7 +132,7 @@ export const rswtDetailSttnHeadListExport: TableUpperProps[] = [
},
{ id: "tn", title: "T-N", upName: "detailQulity", upSequnce: 8},
{ id: "tph", title: "T-P", upName: "detailQulity", upSequnce: 9 },
{ id: "ph", title: "PH", upName: "detailQulity", upSequnce: 10 },
{ id: "ph", title: "pH", upName: "detailQulity", upSequnce: 10 },
{
id: "clIonQnt",
title: "염화물",
@@ -37,7 +37,6 @@ const fcOrgwtsHeadList = fcOrgwtsHeadListExport;
export type pubFacState = {
pbnst: {
isInit: boolean;
pubFacHeadList: TableUpperProps[];
pbnstMngUpHeadList: TableUpperProps[];
pbnstMngNm: chHeadType[];
@@ -52,10 +51,10 @@ export type pubFacState = {
fcOrgwtsHeadList: TableUpperProps[];
pbnstMngRegData: customPbnst[];
pbnsUpdateIndex: pbnstInsertIndex;
fcOrgwtsNmList:pubHasuType[];
fcOrgwtsNmList: pubHasuType[];
dmdComList: any[];
apiMessage:string;
pbnstHasuResCount:number
apiMessage: string;
pbnstHasuResCount: number;
};
};
type pubFacActions = {
@@ -63,19 +62,17 @@ type pubFacActions = {
pbnstRegClick: (pubHasuRes: pubHasuType) => void;
//pbnstReg: (txt: string | undefined) => void;
pbnstInsert(pbnstRes: customPbnst): Promise<void>;
appendRuseFclt(array: customPbnst[]): void;
fileDelete: (atflCd: string) => void;
fileDownLoad: (atflCd: string) => void;
pbnstRuseFcltUpdate: (ruseRes: customPbnst[]) => void;
pbnstRuseBizUpdate: (ruseRes: fcBizType[]) => void;
pubHasuSearch :(page: string, sggOrCity: string , searchTxt:string) => void
getFcOrgwts: (fcltPkList: string[], size:number) => void;
pubHasuSearch: (page: string, sggOrCity: string, searchTxt: string) => void;
getFcOrgwts: (fcltPkList: string[], size: number) => void;
};
export type pubFacType = pubFacState & pubFacActions;
export const pubFacStateExport: pubFacState = {
pbnst: {
isInit: false,
pubFacHeadList: pubFacHeadList,
pbnstMngUpHeadList: pbnstMngUpHeadList,
pbnstMngNm: pbnstMngNm,
@@ -90,10 +87,10 @@ export const pubFacStateExport: pubFacState = {
pbnstBizCycle: [{ text: "없음", val: "1" }],
pbnstMngRegData: [],
pbnsUpdateIndex: {} as pbnstInsertIndex,
fcOrgwtsNmList:[],
fcOrgwtsNmList: [],
dmdComList: [],
apiMessage:'',
pbnstHasuResCount:1
apiMessage: "",
pbnstHasuResCount: 1,
},
};
@@ -102,22 +99,20 @@ export const checkWrRegList = async () => {
return wrRegList;
};
const hasuListFetch = async (page: string, sggOrCity: string, searchTxt?:string) => {
const hasuListFetch = async (
page: string,
sggOrCity: string,
searchTxt?: string
) => {
const checkWrRegListRes = await checkWrRegList();
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/11/A/${sggOrCity? sggOrCity : "11"}/0/1/SW`;
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/11/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`;
const data = checkWrRegListRes.filter((item:string) => item !== "")
if(searchTxt){
url= url +`/${searchTxt}`
}
const rainRes = await postFectch(
url,
data,
fetchType.COMMON
);
const data = checkWrRegListRes.filter((item: string) => item !== "");
if (searchTxt) {
url = url + `/${searchTxt}`;
}
const rainRes = await postFectch(url, data, fetchType.COMMON);
const hasuList = rainRes.data.map((item: any) => {
return {
@@ -127,49 +122,46 @@ if(searchTxt){
};
});
return {data: hasuList, count:rainRes.count};
return { data: hasuList, count: rainRes.count };
};
const initFetch = async (ruseFcltPk: string | undefined) => {
const initFetch = async (ruseFcltPk: string | undefined) => {
const pbnstRes = await getFetch("wr", `/reuseFc/pubFc/${ruseFcltPk}`);
return pbnstRes;
};
export const writeRgtrAndMdfr = (data: customPbnst[]) => {
data.forEach((pbnst) => {
pbnst.rgtr = TEST_UUID;
pbnst.mdfr = TEST_UUID;
pbnst.fcBizs = pbnst.fcBizs?.map((item) => {
item.rgtr = TEST_UUID;
item.mdfr = TEST_UUID;
item.fcOrgwts = item.fcOrgwts?.map((orgwt) => {
orgwt.mdfr = TEST_UUID;
orgwt.rgtr = TEST_UUID;
return orgwt;
});
pbnst.fcBizs = pbnst.fcBizs?.map((item) => {
item.rgtr = TEST_UUID;
item.mdfr = TEST_UUID;
item.fcOrgwts = item.fcOrgwts?.map((orgwt) => {
orgwt.mdfr = TEST_UUID;
orgwt.rgtr = TEST_UUID;
return orgwt;
});
item.fcDemands = item.fcDemands?.map((dmd) => {
dmd.mdfr = TEST_UUID;
dmd.rgtr = TEST_UUID;
return dmd;
item.fcDemands = item.fcDemands?.map((dmd) => {
dmd.mdfr = TEST_UUID;
dmd.rgtr = TEST_UUID;
return dmd;
});
return item;
});
pbnst.fcOpers = pbnst?.fcOpers?.map((oper) => {
oper.rgtr = TEST_UUID;
oper.mdfr = TEST_UUID;
return oper;
});
pbnst.fcFiles = pbnst.fcFiles?.map((file) => {
file.rgtr = TEST_UUID;
file.mdfr = TEST_UUID;
return file;
});
return item;
});
pbnst.fcOpers = pbnst?.fcOpers?.map((oper) => {
oper.rgtr = TEST_UUID;
oper.mdfr = TEST_UUID;
return oper;
});
pbnst.fcFiles = pbnst.fcFiles?.map((file) => {
file.rgtr = TEST_UUID;
file.mdfr = TEST_UUID;
return file;
});
});
return data;
};
@@ -183,24 +175,26 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
pbnst: {
...state.pbnst,
pbnstHasuRes: pbnstHasuRes.data,
pbnstHasuResCount:pbnstHasuRes.count,
isInit: false,
pbnstHasuResCount: pbnstHasuRes.count,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},pubHasuSearch : async(page: string, sggOrCity: string , searchTxt:string)=> {
try{
const pbnstHasuRes = await hasuListFetch(page, sggOrCity,searchTxt);
},
pubHasuSearch: async (
page: string,
sggOrCity: string,
searchTxt: string
) => {
try {
const pbnstHasuRes = await hasuListFetch(page, sggOrCity, searchTxt);
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstHasuRes: pbnstHasuRes.data,
pbnstHasuResCount:pbnstHasuRes.count,
isInit: false,
pbnstHasuResCount: pbnstHasuRes.count,
},
}));
} catch (errorHasu) {
@@ -215,7 +209,6 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
pbnst: {
...state.pbnst,
pbnstRes: pbnstRes,
isInit: false,
},
}));
} catch (errorHasu) {
@@ -224,69 +217,40 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
},
pbnstInsert: async (pbnstRes: customPbnst) => {
try {
const response = await postFectch(
`/reuseFc/pubFc`,
pbnstRes
);
if( response.status === 200) {
toast.success(`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`);
const response = await postFectch(`/reuseFc/pubFc`, pbnstRes);
if (response.status === 200) {
toast.success(
`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`
);
}
const newPbnstRes = await initFetch(pbnstRes.pbnstRuseFcltId.slice(0, 11));
const newPbnstRes = await initFetch(
pbnstRes.pbnstRuseFcltId.slice(0, 11)
);
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstRes: newPbnstRes,
// isInit: false,
},
}));
} catch (error) {
console.error("Error updating pbnst:", error);
}
},pbnstRuseFcltUpdate : async(ruseRes:customPbnst[])=>{
},
pbnstRuseFcltUpdate: async (ruseRes: customPbnst[]) => {
try {
await putFectch(
`/reuseFc/pubFc`,
ruseRes
);
await putFectch(`/reuseFc/pubFc`, ruseRes);
} catch (error) {
console.error("Error pbnstRuseFcltUpdate:", error);
}
} ,pbnstRuseBizUpdate : async(ruseRes:fcBizType[])=>{
},
pbnstRuseBizUpdate: async (ruseRes: fcBizType[]) => {
try {
await putFectch(
`/reuseFc/pubFcBiz`,
ruseRes
);
await putFectch(`/reuseFc/pubFcBiz`, ruseRes);
} catch (error) {
console.error("Error pbnstRuseFcltUpdate:", error);
}
} ,
getBizCycle: async (pbnstObj: customPbnst) => {
const pbnstBizCycle = pbnstObj.fcBizs.map((item) => {
return {
text: `${item.cycl}차`,
val: item.cycl,
};
});
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstBizCycle: pbnstBizCycle,
pbnstResObj: pbnstObj,
isInit: false,
},
}));
},
fileDelete: async (atflCd: string) => {
try {
@@ -301,7 +265,6 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
...state,
pbnst: {
...state.pbnst,
isInit: false,
},
}));
} catch (error) {
@@ -310,32 +273,16 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
},
fileDownLoad: async (atflCd: string) => {
try {
await getFetch(
await getFetch(
fetchType.CS,
`/attach-service/api/v1/atflcd/download/${atflCd}`
);
} catch (error) {
console.error("Error downloading file:", error);
throw new Error(`Error downloading file: ${error}`);
}
},
appendRuseFclt: async (array: customPbnst[]) => {
try {
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstRes: array,
isInit: false,
},
}));
} catch (e) {
console.log(e);
}
},getFcOrgwts : async (fcltPkList: string[] ,size:number) => {
getFcOrgwts: async (fcltPkList: string[], size: number) => {
const fcOrgwtsNmList = await postFectch(
`/prcsFclt/ruseInfo/1/${size}/A/0/0/1/SW`,
fcltPkList,
@@ -346,10 +293,9 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
...state,
pbnst: {
...state.pbnst,
fcOrgwtsNmList:fcOrgwtsNmList.data??[]
fcOrgwtsNmList: fcOrgwtsNmList.data ?? [],
},
}));
}
},
};
};
@@ -1,5 +1,5 @@
import type { TableUpperProps } from "@/app/store/common/type/header";
import { getFetchWithCount, postFectch, putFectch } from "@/components/lib/api";
import { fetchType, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api";
import toast from "react-hot-toast";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
@@ -71,7 +71,6 @@ export const selectClass = "w-full h-full !text-xl";
export type rainFacState = {
rain: {
isInit: boolean;
upHeadList: TableUpperProps[];
rainRes: customRainBdst[];
rainResCount: number;
@@ -80,7 +79,7 @@ export type rainFacState = {
type rainFacSActions = {
initRain: (code: string | number) => void;
getRainData: (pageNation: number, code: string | number) => void;
rainSearch: (txt: string, pageNation: number, code: string | number) => void;
rainSearch: (txt: string, pageNation: number, code: string ) => void;
rainBdstReg: (data: customRainBdst, code: string | number) => void;
rainBdstUpdate: (data: customRainBdst, code: string | number) => void;
@@ -90,7 +89,6 @@ export type rainFacType = rainFacState & rainFacSActions;
export const rainFacStateExport: rainFacState = {
rain: {
isInit: false,
rainRes: rainRes,
rainResCount: 1,
upHeadList: upHeadList,
@@ -98,8 +96,7 @@ export const rainFacStateExport: rainFacState = {
};
const initFetch = async (code: string | number) => {
// const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/10/${code}`);
const rainRes = await getFetchWithCount("wr", `/reuseFc/rainyInfoList/1/${rainRegSize}/${code}`);
const rainRes = await getFetchWithCount(fetchType.WR, `/reuseFc/rainyInfoList/1/${rainRegSize}/${code}`);
return rainRes;
};
export const rainFacActionsExport: (set: any) => rainFacSActions = (
@@ -108,7 +105,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
return {
getRainData: async (pageNation: number, code: string | number) => {
try {
const rainRes = await getFetchWithCount("wr", `/reuseFc/rainyInfoList/${pageNation}/${rainRegSize}/${code}`);
const rainRes = await getFetchWithCount(fetchType.WR, `/reuseFc/rainyInfoList/${pageNation}/${rainRegSize}/${code}`);
// 여기서 상태 업데이트
return set((state: rainFacState) => ({
@@ -117,7 +114,6 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
...state.rain,
rainRes: rainRes.data,
rainResCount: rainRes.count,
isInit: false,
},
}));
@@ -138,18 +134,17 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
...state.rain,
rainRes: rainRes.data,
rainResCount: rainRes.count,
isInit: false,
},
}));
} catch (error) {
console.log("error", error);
}
},
rainSearch: async (txt: string, pageNation: number) => {
rainSearch: async (txt: string, pageNation: number ,code:string) => {
try {
// const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:''))
const rainRes = await getFetchWithCount('wr', `/reuseFc/rainyInfoList/${pageNation}/${rainRegSize}/41` + (txt ? `/${txt}` : ''))
const rainRes = await getFetchWithCount(fetchType.WR, `/reuseFc/rainyInfoList/${pageNation}/${rainRegSize}/${code}` + (txt ? `/${txt}` : ''))
console.log("rainRes", rainRes)
set((state: rainFacState) => {
return {
@@ -157,7 +152,6 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
...state.rain,
rainRes: rainRes.data,
rainResCount: rainRes.count,
isInit: false,
},
};
})
@@ -201,7 +195,6 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
...state.rain,
rainRes: rainRes.data,
rainResCount: rainRes.count,
isInit: false,
},
}));
} catch (e) {
@@ -253,7 +246,6 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
...state.rain,
rainRes: rainRes.data,
rainResCount: rainRes.count,
isInit: false,
},
}));
} catch (e) {
@@ -11,15 +11,11 @@ import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "
export const rswtRegSize =15;
const rswtrObjSchema = z.object({
bdstRuseFcltSn: z.number().nullish(),
//wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }),
//oblgTrgtWtrUsqty: z.number().nullish().default(0),
orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }),
filtrTrtmfctCpct: z.number().nullish(),
filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }),
filtrTrtmfctUsgCd: z.string().default("").nullish(),
rswtrUsqty: z.number().default(0),
//altUswtrUtztnYn: z.enum(["Y", "N"]).nullish(), //안쓰는값
// altUswtrKndCd: z.string().default("").nullish(), //안쓰는값
altUswtrUtztnQnt: z.number().default(0), //안쓰는값
altUswtrIdntyMthdCd: z.string().default("").nullish(), //안쓰는값
rgtr: z.string().nullish().default(null),
@@ -56,7 +52,6 @@ const rswtRes: customRswtBdst[] = [];
export type rswtFacState = {
rswt: {
isInit: boolean;
upHeadList: TableUpperProps[];
rswtRes: customRswtBdst[];
rswtResCount: number;
@@ -78,7 +73,6 @@ export type rswtFacType = rswtFacState & rswtFacSActions;
export const rswtFacStateExport: rswtFacState = {
rswt: {
isInit: false,
upHeadList: upHeadList,
rswtRes: rswtRes,
rswtResCount: 1,
@@ -111,7 +105,6 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
...state.rswt,
rswtRes: rswtRes.data,
rswtResCount: rswtRes.count,
isInit: false,
},
};
});
@@ -133,7 +126,6 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
...state.rswt,
rswtRes: rswtRes.data,
rswtResCount: rswtRes.count,
isInit: false,
},
}));
} catch (e) {
@@ -149,7 +141,6 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
...state.rswt,
rswtRes: rswtRes.data,
rswtResCount: rswtRes.count,
isInit: false,
},
}));
} catch (error) {
@@ -189,7 +180,6 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
...state.rswt,
rswtRes: rswtRes.data,
rswtResCount: rswtRes.count,
isInit: false,
},
}));
@@ -235,7 +225,6 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
...state.rswt,
rswtRes: rswtRes.data,
rswtResCount: rswtRes.count,
isInit: false,
},
}));
} catch (e) {
@@ -461,7 +461,7 @@ export const ruseGuranteeHeadListExport: TableUpperProps[] = [
{ id: "crmty", title: "색도(도)", visible: true },
{ id: "tn", title: "총질소(mg/L)", visible: true },
{ id: "tph", title: "총인(mg/L)", visible: true },
{ id: "ph", title: "수소이온농도(ph)", visible: true },
{ id: "ph", title: "수소이온농도(pH)", visible: true },
{ id: "clIonQnt", title: "염화물(mg/L)", visible: true },
{ id: "cdtnv", title: "전기전도도(μs/cm)​", visible: true },
];
@@ -1,22 +1,18 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { customRainBdst } from "../../fcltReg/rainReg";
import { bdstUsgCd } from "@/app/store/common/code/basicCode";
//TODO: 공통코드시 삭제되니 수정 해야됨
export const excelRainSttnParsing = (
excel: { data: customRainBdst[] },
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
code: Record<string, SelectDataType[]>
): string[][] => {
const excelExportData: string[][] = [];
excel.data.forEach((item) => {
console.log("item", item)
excelExportData.push([
sidoCode.find((sido) => sido.val === item.ctpvCd?.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd?.toString())?.text ?? "",
code?.cityCd?.find((sido) => sido.val === item.ctpvCd?.toString())?.text ?? "",
code?.sggCd?.find((sgg) => sgg.val === item.sggCd?.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
bdstUsgCd.find((cd) => cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
code?.bdstUsgCd?.find((cd) => cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
String(item.frstArchPrmsnDt ?? ""),
String(item.archArea.split('.')[0] === '-1' ? '확인불가' : item.archArea.split('.')[0]),
String(item.chgBuilding.length > 0 ? "Y" : "N"),
@@ -126,7 +126,7 @@ export const rainSttHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "녹색건축물인증등급",
visible: true,
},
@@ -405,7 +405,7 @@ export const rainSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "인증등급",
upName: "grntchBdstCert",
visible: true,
@@ -445,7 +445,7 @@ export const rainSttnDetailNodeListExport:CommonTableProps[] = [
rowSpan: 1,
colSpan: 4
},
{ id: "ph", title: "PH",
{ id: "ph", title: "pH",
visible: true,
row: 2,
rowSpan: 1,
@@ -524,7 +524,7 @@ export const rainSttnDetailHeadListExport:CommonTableProps[] = [
colSpan: 1
},
{ id: "ph", title: "PH",
{ id: "ph", title: "pH",
visible: true,
row: 1,
rowSpan: 1,
@@ -102,12 +102,8 @@ export type rainSttnState = {
};
};
type rainSttnActions = {
rainSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void
rainSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rainSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string, SelectDataType[]> ) => void
rainSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string, SelectDataType[]>) => void;
rainChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -134,9 +130,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
set: any
) => {
return {
rainSttnInit: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rainSttnInit: async (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string, SelectDataType[]>) => {
try {
const rainSttnRes = await getFetchWithCount(
@@ -148,7 +142,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
const rainExcel = excelRainSttnParsing(rainSttnRes, code);
set((state: rainSttnState) => {
return {
...state,
@@ -174,9 +168,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
console.log(e)
}
},
rainSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rainSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string, SelectDataType[]>) => {
try {
const rainSttnRes = await getFetchWithCount(
fetchType.WR,
@@ -187,7 +179,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
const rainExcel = excelRainSttnParsing(rainSttnRes,code);
set((state: rainSttnState) => {
return {
...state,
@@ -1,21 +1,20 @@
import { bdstUsgCd } from "@/app/store/common/code/basicCode";
import type { SelectDataType } from "@common/business_components/ui";
import type { customRswtBdst } from "../../fcltReg/rswtReg";
export const excelRSwtSttnParsing = (
excel: { data: customRswtBdst[] },
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
code: Record<string,SelectDataType[]>
): string[][] => {
const excelExportData: string[][] = [];
excel.data.forEach((item) => {
console.log("item", item)
excelExportData.push([
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
code.cityCd?.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
code.sggCd?.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
bdstUsgCd.find((cd)=> cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
code?.bdstUsgCd?.find((cd)=> cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
String(item.frstArchPrmsnDt ?? ""),
String(item.archArea.split('.')[0] === '-1' ? '확인불가' : item.archArea.split('.')[0]),
// String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
@@ -119,7 +119,7 @@ export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "녹색건축물인증등급",
visible: true,
},
@@ -379,7 +379,7 @@ export const rswtSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "인증등급",
upName: "grntchBdstCert",
visible: true,
@@ -30,12 +30,8 @@ export type rswtSttnState = {
};
type rswtSttnActions = {
rswtSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rswtSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rswtSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string,SelectDataType[]>) => void;
rswtSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string,SelectDataType[]>) => void;
rswtChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -60,9 +56,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
set: any
) => {
return {
rswtSttnInit: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rswtSttnInit: async (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string,SelectDataType[]>) => {
try {
const rswtSttnRes = await getFetchWithCount(
fetchType.WR,
@@ -73,17 +67,17 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
set((state: rswtSttnState) => {
return {
...state,
rswtSttn: {
...state.rswtSttn,
excelList: rswtExcel,
},
};
});
} else
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, code);
set((state: rswtSttnState) => {
return {
...state,
rswtSttn: {
...state.rswtSttn,
excelList: rswtExcel,
},
};
});
}
set((state: rswtSttnState) => {
return {
@@ -100,9 +94,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
console.log(e)
}
},
rswtSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rswtSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string,SelectDataType[]>) => {
try {
const rswtSttnRes = await getFetchWithCount(
fetchType.WR,
@@ -113,7 +105,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, code);
set((state: rswtSttnState) => {
return {
...state,
+7 -4
View File
@@ -1,7 +1,10 @@
import type { RswtStatProps } from ".";
import { bdstUsgCd } from "../../common/code/basicCode";
import type { SelectDataType } from "@common/business_components/ui";
import type { RswtStatProps } from ".";
export const excelRswtStat = (excelList:RswtStatProps[]) : (string | number)[][] => {
export const excelRswtStat = (excelList: RswtStatProps[], rswtBdstType : SelectDataType[] ) : (string | number)[][] => {
console.log('bdstUsgCd ', rswtBdstType)
const excelData: (string | number)[][] = [];
excelList.forEach((item) => {
excelData.push([
@@ -15,7 +18,7 @@ export const excelRswtStat = (excelList:RswtStatProps[]) : (string | number)[][]
String(item.bdstNm) ?? "",
//건축물용도코드(빈칸)
//String(item.bdstUsgCd) ?? "",
bdstUsgCd.find((cd)=> cd.val === item.bdstUsgCd.toString())?.text ?? "", //건축물용도
rswtBdstType?.find((cd)=> cd.val === item.bdstUsgCd.toString())?.text ?? "", //건축물용도
//주소
String(item.daddr) ?? "",
//법적의무대상여부
+4 -3
View File
@@ -2,6 +2,7 @@ import { fetchType, getFetch } from "@/components/lib/api";
import type { TableUpperProps } from "../../common/type/header";
import { rswtStatHeadListExport } from "./headList";
import { excelRswtStat } from "./excel";
import type { SelectDataType } from "@common/business_components/ui";
export type RswtStatProps = {
cityText: string //시도명
@@ -38,7 +39,7 @@ export type GuideStatProps = {
}
type rswtStatActions = {
searchRswtStatList: (year: string, city: { val: string; text: string }[]) => void;
searchRswtStatList: (year: string, city: SelectDataType[],bdstUsgCd: SelectDataType[] ) => void;
}
export type ExcelType = {
@@ -72,7 +73,7 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = (
set: any
) => {
return {
searchRswtStatList: async (year: string, city: { val: string; text: string }[]) => {
searchRswtStatList: async (year: string, city: SelectDataType[] , rswtBdstType:SelectDataType[]) => {
const res = await getFetch(fetchType.WR, `/reuseChk/reuseWater/stat/${year}`)
const data = res.filter(item => {
const code = item.ctpvCd.trim();
@@ -198,7 +199,7 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = (
utztnUsgCd: utztnUsgArray.join(', '),
})
});
const excelDetailData = excelRswtStat(rswtDetailList);
const excelDetailData = excelRswtStat(rswtDetailList,rswtBdstType);
set((state: rswtStatState) => ({
rswtStat: {
...state.rswtStat,
+5 -3
View File
@@ -3,6 +3,7 @@ import {
codeActionExport,
comCodeStateExport,
getCityCd,
getCommonUpCd,
getEnvPartCd,
getMiddleRegionCd,
getRegionCd,
@@ -334,13 +335,14 @@ export const StoreZus = (
...dmMapState,
}
) => {
return createStore<WrStore>()((set) => {
return createStore<WrStore>()((set ,get) => {
getSggCd(set);
getCityCd(set);
getRegionCd(set);
getMiddleRegionCd(set);
getUnitWaterShedCd(set);
getEnvPartCd(set);
getCommonUpCd(set)
return {
...initState,
...comFcltSearchAction(set),
@@ -349,7 +351,7 @@ export const StoreZus = (
...rswtFacActionsExport(set),
...matDmdActionsExport(set),
...htdflFacActionsExport(set),
...codeActionExport(set),
...codeActionExport(set,get),
...bdstActionsExport(set),
...rainChkgdnActionsExport(set),
...rswtChkgdnActionsExport(set),
@@ -369,7 +371,7 @@ export const StoreZus = (
...ruseCaseActionsExport(set),
...rainStatActionsExport(set),
...rswtStatActionsExport(set),
...authActionsExport(set),
...authActionsExport(set,get),
...commonMapActionsExport(set),
...pbnMapActionsExport(set),
...rainMapActionsExport(set),
+4 -3
View File
@@ -10,6 +10,7 @@ import {
} from "@common/components/ui";
import moment from "moment";
import {
codeToText,
formatCommaNumber,
formatYyyymmdd,
handleCommaNumberChange
@@ -73,23 +74,23 @@ export const rswtChkTableData = (chkData: rswtChkZodType[]) => {
let flatRswtChk = {};
const findGuide = root.guideDetails.find(
(guide) => guide.utztnUsgCd === detail.utztnUsgCd
);
)
const findPoluttion = root.rswtrPollutions.find(
(polution) => polution.utztnUsgCd === detail.utztnUsgCd
);
const operMngCd = root?.reuseBuilding.operMngCd;
flatRswtChk = {
...root,
...detail,
...findGuide,
...findPoluttion,
...flatRswtChk,
operMngCd: operMngCd,
utztnUsgCdText: codeToText(detail.utztnUsgCd, 'dmdUszCd'),
};
makeRswtData.push(flatRswtChk);
});
});
}
return makeRswtData;
};
+32 -5
View File
@@ -1,4 +1,4 @@
import type { comCodeState } from "@/app/store/common/code";
import { lwCds, type comCodeState } from "@/app/store/common/code";
import {
filePickedBlob,
filePickedBlobArray,
@@ -33,12 +33,11 @@ export const getCity = (val: string, sggCd: SelectDataType[]) => {
// cd text 넣기
export const tableData = (data: any, code: comCodeState) => {
const chCode = code.code;
return data?.map(
(item: {
sggCd: string;
ctpvCd: string;
reuseBuilding: { lawTrgtYn: any; bdstUsgCd: any }[];
reuseBuilding: { lawTrgtYn: string; bdstUsgCd: string ,grntchBdstCertGrd:string}[];
}) => {
let returnData = {};
const sggText = chCode.sggCd.find(
@@ -48,16 +47,25 @@ export const tableData = (data: any, code: comCodeState) => {
(cd) => cd.val === String(item.ctpvCd).trim()
)?.text;
if (item?.reuseBuilding?.length > 0) {
const bdsgUsgText = chCode.bdstUsgCd.find(
(cd) => Number(cd.val) === item?.reuseBuilding[0]?.bdstUsgCd
const bdsgUsgText = chCode?.bdstTotalUsgType?.find(
(cd) => cd.val === item?.reuseBuilding[0]?.bdstUsgCd
)?.text;
const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn;
const grntchBdstCertGrdText =chCode?.bdstGrntchClass?.find(
(cd) => cd.val === item?.reuseBuilding[0]?.grntchBdstCertGrd
)?.text;
returnData = {
...item,
sggText: sggText ?? "없음",
cityText: cityText ?? "없음",
bdsgUsgText: bdsgUsgText,
lawTrgtYn: lawTrgtYn,
grntchBdstCertGrdText:grntchBdstCertGrdText
};
} else {
returnData = {
@@ -296,4 +304,23 @@ export const formatArchArea =(value: string, digits: number=0 ) => {
// 다시 천 단위 콤마 찍어서 반환
return Number(rounded).toLocaleString();
}
export const codeToText = ( val:string, codeName:string ) =>{
if(val===''|| val===undefined){
return ''
}
return lwCds[codeName]?.find((cd) => cd.val ===val)?.text
}
export const textToCode = (text:string, codeName:string) =>{
if(text===''|| text===undefined){
return ''
}
return lwCds[codeName]?.find((cd) => cd.text ===text)?.val
}
+1 -1
View File
@@ -197,7 +197,7 @@ export const getOverLayObj = (fclType: string, data: any,code?:any) => {
newObj = {
건물용도: code?.bdstUsgCd.find((item) => item.val===String(data?.reuseBuilding[0].bdstUsgCd) )?.text ?? '확인불가',
설치완료일: data?.reuseBuilding[0]?.instlCmptnDt ?? '확인불가',
"주요 처리공정": code?.rswtPrscCdMthdCd.find((item) => item.val===data?.reuseBuilding[0]?.rswtrObj.filtrTrtmfctProcs)?.text ?? '확인불가',
"주요 처리공정": data?.reuseBuilding[0]?.rswtrObj.filtrTrtmfctProcs ?? '확인불가',
원수종류: code?.orgwtKndCd.find((item) => item.val === data?.reuseBuilding[0]?.rswtrObj.orgwtKndCd)?.text ?? '확인불가',
//이용용도: isCode.filtrTrtmfctUsgCd data?.reuseBuilding[0]?.rswtrObj.altUswtrKndCd ?? '확인불가',
};
@@ -9,19 +9,16 @@ import {
SelectBox,
type SelectDataType,
} from "@common/business_components";
import SearchInputAddress from "@common/business_components/ui/search_input_address";
import type { addressType } from "@common/business_components/ui/search_input_address/findAddress";
import { Input } from "@common/components";
import { useEffect, useState } from "react";
export default function BdstReg({ form, type }: { form: any; type?: string }) {
const { code } = useWrStore((state) => {
const { code, returnCodeText } = useWrStore((state) => {
return state;
});
const { userSiSggCd } = code;
const [useCityCd, setUserCityCd] = useState<SelectDataType[]>([]);
const [useSggCd, setUserSggCd] = useState<SelectDataType[]>([]);
const [initDaddr, setInitDaddr] = useState<string>();
useEffect(() => {
if (userSiSggCd.length === 2 && code.cityCd.length > 0) {
@@ -56,10 +53,8 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
form.setValue("ctpvCd", Number(city[0]?.val));
form.setValue("sggCd", Number(sgg[0]?.val));
}
}, [form, userSiSggCd, code.cityCd, code.sggCd]);
useEffect(() => {
const subscription = form.form?.watch((value: any) => {
console.log("vale", value);
@@ -72,12 +67,40 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
// console.log("form ", form.watch());
// }, [form.formState]);
useEffect(() => {
const bdstInfoSn = form.getValues("bdstInfoSn");
if (bdstInfoSn && bdstInfoSn > 0) form.setValue("daddr", bdstInfoSn);
}, [form.getValues("bdstInfoSn")]);
const userCtpvCd = form.watch("ctpvCd");
const userSggCd = form.watch("sggCd");
useEffect(() => {
const bdstInfoSn = form.getValues("bdstInfoSn");
if(bdstInfoSn&&bdstInfoSn>0)
setInitDaddr(form.getValues("daddr"));
}, [form.getValues("bdstInfoSn")]);
const strCtpvCd = String(userCtpvCd);
if (strCtpvCd && strCtpvCd !== "0") {
const city = returnCodeText(strCtpvCd, "cityCd");
form?.setValue("daddr", city);
} else if (strCtpvCd === "0") {
form?.setValue("daddr", "");
}
}, [userCtpvCd]);
useEffect(() => {
const strSggCd = String(userSggCd);
if (strSggCd && strSggCd !== "0") {
const city = returnCodeText(strSggCd.slice(0, 2), "cityCd");
const sgg = returnCodeText(strSggCd, "sggCd");
form?.setValue("daddr", city + " " + sgg);
} else if (strSggCd === "0") {
const ctpvCdText = returnCodeText(
String(form.getValues("ctpvCd")),
"cityCd"
);
form?.setValue("daddr", ctpvCdText);
}
}, [userSggCd]);
return (
<>
@@ -162,24 +185,17 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
name="daddr"
render={({ field }) => (
<FormUi label={type !== "HTB" ? "건축물 주소" : "시설 주소"}>
{/* <Input
className={selectClass}
placeholder="위치를 입력해주세요"
type="search"
onChange={(e) => {
field.onChange(e.target.value)
}}
value={field.value || ''}
maxLength={50}
/> */}
<div>
<SearchInputAddress
initValue={initDaddr}
setRtnData={(rtnData: addressType) => {
console.log("rtnData", rtnData);
field.onChange(rtnData.roadAddrPart1);
<Input
className={selectClass}
placeholder="위치를 입력해주세요"
type="search"
onChange={(e) => {
field.onChange(e.target.value);
}}
></SearchInputAddress>
value={field.value || ""}
maxLength={50}
/>
</div>
</FormUi>
)}
@@ -222,9 +238,9 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstUsgCd}
selectArray={ type ==='RNB'?code.bdstUsgCd:code.rswtBdstType}
onSelectValue={(val) => {
field.onChange(Number(val));
field.onChange(val);
}}
value={field.value ?? code.bdstUsgCd[0]?.val}
/>
@@ -34,7 +34,7 @@ export default function HtdflRegForm({
isModal,
readonly = false,
setIsModal,
isMap
isMap,
}: {
htdflForm: customHtdflBdst;
isModal: boolean;
@@ -79,9 +79,29 @@ export default function HtdflRegForm({
const cleanHtdflData = (raw: any): z.infer<typeof hdtflZod> => {
const buildings =
raw?.reuseBuilding && raw.reuseBuilding.length > 0
? raw.reuseBuilding
: [{}];
raw?.reuseBuilding && raw.reuseBuilding.length > 0
? raw.reuseBuilding
: [{}];
if (htdflForm.reuseBuilding && htdflForm.reuseBuilding[0]?.htdflObj.ph) {
const htdflPH = htdflForm.reuseBuilding[0]?.htdflObj.ph;
if (htdflPH && String(htdflPH).includes("~")) {
const [frontPH, backPH] = htdflPH.split("~");
if (frontPH) {
setFrontPHdata(frontPH);
}
if (backPH) {
setBackPHdata(backPH);
}
} else {
setFrontPHdata("");
setBackPHdata("");
}
} else {
setFrontPHdata("");
setBackPHdata("");
}
return {
...raw,
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null),
@@ -96,7 +116,7 @@ export default function HtdflRegForm({
: new Date(item?.archChgPrmsnDt),
bdstChgNm: item?.bdstChgNm ?? "", // null → ""
})),
reuseBuilding:buildings.map((item: any) => ({
reuseBuilding: buildings.map((item: any) => ({
...item,
instlCmptnDt: new Date(item?.instlCmptnDt),
htdflObj: {
@@ -146,16 +166,16 @@ export default function HtdflRegForm({
const [divStyle, setDivStyle] = useState("h-[53vh]");
useEffect(() => {
if(isMap){
setDivStyle("h-[100vh]")
}else if (isModal === true) {
setDivStyle("h-[53vh] max-h-[37vh]")
if (isMap) {
setDivStyle("h-[100vh]");
} else if (isModal === true) {
setDivStyle("h-[53vh] max-h-[37vh]");
} else if (readonly === true) {
setDivStyle("h-[62vh]")
setDivStyle("h-[62vh]");
} else {
setDivStyle("h-[57vh]")
setDivStyle("h-[57vh]");
}
}, [isModal, readonly ,isMap]);
}, [isModal, readonly, isMap]);
useEffect(() => {
console.log("form errors:", form.formState.errors);
@@ -164,25 +184,9 @@ export default function HtdflRegForm({
// form.reset은 비동기로 동작할 수 있어, useEffect 하나로 관리하여 의도치 않은 초기화를 방지합니다.
useEffect(() => {
// Case 1: 수정 또는 '복사하여 등록' 등 데이터가 주입되는 경우
if (htdflForm && Object.keys(htdflForm).length > 0) {
const htdflPH = htdflForm.reuseBuilding[0]?.htdflObj.ph
if(htdflPH && String(htdflPH).includes("~")){
const [frontPH, backPH] = htdflPH.split("~");
if (frontPH) {
setFrontPHdata(frontPH);
}
if (backPH) {
setBackPHdata(backPH);
}
} else {
setFrontPHdata("");
setBackPHdata("");
}
if (htdflForm) {
form.reset(cleanHtdflData(htdflForm));
}else{
} else {
form.reset();
}
// Case 2: 데이터가 없는 순수 신규 등록 모드인 경우
@@ -227,37 +231,12 @@ export default function HtdflRegForm({
if (!isPowerPlant) {
form.setValue(
"reuseBuilding.0.htdflObj.etgtType",
"해당없음", // 빈 문자열로 초기화
"01", // 빈 문자열로 초기화
{ shouldDirty: true } // dirty 상태로 남길지 여부는 취사선택
);
}
}, [isPowerPlant, form]);
// useEffect(() => {
// const watchPH = form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.ph`);
// const checkPkAndCycle =
// form.getValues(`items.${indexMng}.pbnstRuseFcltId`) +
// String(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cycl`));
// console.log("checkPkAndCycle ", checkPkAndCycle);
// if (chekcPk !== checkPkAndCycle) {
// if (watchPH && watchPH !== undefined) {
// const [frontPH, backPH] = watchPH.split("~");
// if (frontPH) {
// setFrontPHdata(frontPH);
// }
// if (backPH) {
// setBackPHdata(backPH);
// }
// } else {
// setFrontPHdata("0");
// setBackPHdata("0");
// }
// setCheakPk(checkPkAndCycle);
// }
// }, [form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.ph`), chekcPk]);
return (
<div className="!mx-[1.6rem] !p-0r">
<Form {...form}>
@@ -310,12 +289,8 @@ export default function HtdflRegForm({
selectArray={code.htdPowerMthdCd}
onSelectValue={readonly ? () => {} : field.onChange}
// value={field.value ?? ""}
value={
field.value ||
(code?.htdPowerMthdCd[0] &&
code?.htdPowerMthdCd[0].val)
}
readOnly={readonly || !isPowerPlant}
value={field.value}
readOnly={readonly}
/>
</FormUi>
)}
@@ -885,7 +860,7 @@ export default function HtdflRegForm({
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<Label className="text-xl">수소이온농도(ph)</Label>
<Label className="text-xl">수소이온농도(pH)</Label>
<div className="flex flex-row items-center gap-2">
<Input
className="!text-xl w-1/2"
@@ -772,6 +772,7 @@ export function PbnstBuseForm({
});
}}
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
openNetwork={false}
></SdmInsertForm>
}
></UiModal>
@@ -460,7 +460,7 @@ export function BuseWaterQulity({
/>
</div>
<div className="col-span-8">
<Label className="text-xl">수소이온농도(ph)</Label>
<Label className="text-xl">수소이온농도(pH)</Label>
<div className="flex flex-row items-center gap-2">
<Input
className="!text-xl w-28"
@@ -97,7 +97,6 @@ export default function MngRegFormDetail({
const potentialOptions = formHead.selectData
? code[formHead.selectData as keyof typeof code]
: [];
return (
<SelectBox
label={""}
@@ -10,7 +10,7 @@ import { formH1Class, formH2Class } from "@/components/lib/class/comClass";
import {
confirmToast,
formatCommaNumber,
handleMinusNumberChange
handleMinusNumberChange,
} from "@/components/lib/func/commom";
import {
DatePicker,
@@ -34,21 +34,18 @@ export default function RswtrRegForm({
isModal,
setIsModal,
readonly = false,
isMap
isMap,
}: {
rswtForm: customRswtBdst;
isModal: boolean;
setIsModal?: (isModal: boolean) => void;
readonly?: boolean;
isMap?: boolean;
}) {
const { code, rswtBdstUpdate, rswtBdstReg } = useWrStore(
(state) => state
);
const { code, rswtBdstUpdate, rswtBdstReg } = useWrStore((state) => state);
// const [divStyle, setDivStyle] = useState("h-[53vh]");
useEffect(() => {
if(isMap){
if (isMap) {
}
}, [isMap]);
// const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({});
@@ -64,29 +61,27 @@ export default function RswtrRegForm({
"reuseBuilding.0.rswtrObj.filtrTrtmfctProcs",
]);
const { t } = useTranslation('base');
const { t } = useTranslation("base");
const onSubmit = (values: z.infer<typeof rswtZod>) => {
if (isModal) {
const handleConfirm = async () => {
rswtBdstReg(values, "41");
if (setIsModal) setIsModal(false);
};
confirmToast(t('isInsertMsg'), handleConfirm);
confirmToast(t("isInsertMsg"), handleConfirm);
} else {
const handleConfirm = async () => {
rswtBdstUpdate(values, "41");
};
confirmToast(t('isUpdateMsg'), handleConfirm);
confirmToast(t("isUpdateMsg"), handleConfirm);
}
};
const filtrTrtmfctCpct = form.watch('reuseBuilding.0.rswtrObj.filtrTrtmfctCpct')
const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => {
const buildings =
raw?.reuseBuilding && raw.reuseBuilding.length > 0
? raw.reuseBuilding
: [{}];
raw?.reuseBuilding && raw.reuseBuilding.length > 0
? raw.reuseBuilding
: [{}];
return {
...raw,
frstArchPrmsnDt: raw?.frstArchPrmsnDt
@@ -95,31 +90,26 @@ export default function RswtrRegForm({
archChgPrmsnDt: raw?.archChgPrmsnDt
? new Date(raw?.archChgPrmsnDt)
: null,
reuseBuilding:buildings.map((item: any) => ({
reuseBuilding: buildings.map((item: any) => ({
...item,
instlCmptnDt: item?.instlCmptnDt
? new Date(item.instlCmptnDt)
: new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화
operMngCd: item?.operMngCd || "", // null → ""
instlCstSprtYn: item?.instlCstSprtYn || 'N', // null → "Y"
grntchBdstCertYn: item?.grntchBdstCertYn ||'N',
instlCstSprtYn: item?.instlCstSprtYn || "N", // null → "Y"
grntchBdstCertYn: item?.grntchBdstCertYn || "N",
bdstUsgCd: item?.bdstUsgCd ?? Number("-1"), // null → "-1"
rswtrObj: {
...item?.rswtrObj,
filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn || code.yn[0]?.val,
filtrTrtmfctCpct: item?.rswtrObj?.filtrTrtmfctCpct ?? null,
filtrTrtmfctProcs: item?.rswtrObj?.filtrTrtmfctProcs || code.rswtPrscCdMthdCd[0]?.val,
filtrTrtmfctProcs:
item?.rswtrObj?.filtrTrtmfctProcs||'',
orgwtKndCd: item?.rswtrObj?.orgwtKndCd || code.orgwtKndCd[0]?.val,
},
})),
};
};
// useEffect(() =>{
// console.log(' formform ', form.watch())
// },[form.formState])
useEffect(() => {
console.log(' filtrTrtmfctCpct ', filtrTrtmfctCpct)
}, [filtrTrtmfctCpct])
useEffect(() => {
console.log("form errors:", form.formState.errors);
@@ -133,7 +123,6 @@ export default function RswtrRegForm({
form.setValue("reuseBuilding.0.instlCstSprtAmt", 0);
}
if (grntchBdstCertYn === "D") {
form.setValue("reuseBuilding.0.grntchBdstCertYr", "0000");
form.setValue("reuseBuilding.0.grntchBdstCertNo", "확인불가");
@@ -141,7 +130,6 @@ export default function RswtrRegForm({
} else if (instlCstSprtYn === "D") {
form.setValue("reuseBuilding.0.instlCstSprtAmt", -1);
}
}, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctProcs, form]);
useEffect(() => {
@@ -149,8 +137,6 @@ export default function RswtrRegForm({
}, [rswtForm, form]);
return (
<div className="!mx-[1.6rem] !p-0r">
<Form {...form}>
@@ -176,335 +162,342 @@ export default function RswtrRegForm({
</div>
</div>
{/* <ScrollArea className={divStyle}> */}
{isModal && rswtForm != undefined ? <BdstReg form={form} /> : <></>}
{isModal ? (
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
중수도 시설 정보{" "}
</h1>
) : (
<></>
)}
<h1 className={formH1Class}>기본정보</h1>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-2">
<FormField
control={form.control}
name="reuseBuilding.0.instlCmptnDt"
render={({ field }) => (
<FormUi label="설치완료일">
<DatePicker
mode="single"
field={{
value:
field.value && !isNaN(new Date(field.value).getTime())
? new Date(field.value)
: new Date(), // Provide a default Date value
onChange: (date) => field.onChange(date),
{isModal && rswtForm != undefined ? <BdstReg form={form} /> : <></>}
{isModal ? (
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
중수도 시설 정보{" "}
</h1>
) : (
<></>
)}
<h1 className={formH1Class}>기본정보</h1>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-2">
<FormField
control={form.control}
name="reuseBuilding.0.instlCmptnDt"
render={({ field }) => (
<FormUi label="설치완료일">
<DatePicker
mode="single"
field={{
value:
field.value && !isNaN(new Date(field.value).getTime())
? new Date(field.value)
: new Date(), // Provide a default Date value
onChange: (date) => field.onChange(date),
}}
selectClass={"w-full"}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name="reuseBuilding.0.instlCst"
render={({ field }) => {
const value = field.value;
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
return (
<FormUi label="설치비(원)">
<Input
className={selectClass}
placeholder="1,000,000"
type="text"
value={
isUnknown ? "확인불가" : formatCommaNumber(value)
}
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
}}
onChange={(e) => {
if (readonly) return;
handleMinusNumberChange(e, field.onChange);
}}
selectClass={"w-full"}
readOnly={readonly}
maxLength={numSize}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name="reuseBuilding.0.instlCst"
render={({ field }) => {
const value = field.value;
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
return (
<FormUi label="설치비(원)">
<Input
className={selectClass}
placeholder="1,000,000"
type="text"
value={
isUnknown ? "확인불가" : formatCommaNumber(value)
);
}}
/>
</div>
</div>
<div className=" my-4">
<h1 className={formH1Class}>중수도 시설 정보</h1>
</div>
<div className="grid grid-cols-12 gap-1 mt-4">
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.filtrTrtmfctCpct"
render={({ field }) => {
const value = field.value;
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
return (
<FormUi label="처리시설 용량(m³)">
<Input
className={selectClass}
placeholder=""
type="text"
value={
isUnknown ? "확인불가" : formatCommaNumber(value)
}
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
}}
onChange={(e) => {
if (readonly) return;
handleMinusNumberChange(e, field.onChange);
}}
readOnly={readonly}
maxLength={numSize}
/>
</FormUi>
);
}}
/>
</div>
}}
onChange={(e) => {
if (readonly) return;
handleMinusNumberChange(e, field.onChange);
}}
readOnly={readonly}
maxLength={numSize}
/>
</FormUi>
);
}}
/>
</div>
<div className=" my-4">
<h1 className={formH1Class}>중수도 시설 정보</h1>
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.orgwtKndCd"
render={({ field }) => (
<FormUi label="원수 종류">
<SelectBox
className={""}
label={""}
selectClass={selectClass}
selectArray={code.orgwtKndCd}
onSelectValue={readonly ? () => {} : field.onChange}
value={field.value ?? code.orgwtKndCd[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.filtrTrtmfctProcs"
render={({ field }) => (
<FormUi label="주요처리공정">
<Input
className={selectClass}
placeholder="ab1234678"
type=""
value={field.value ?? ""}
onChange={(e) => {
if (readonly) return;
<div className="grid grid-cols-12 gap-1 mt-4">
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.filtrTrtmfctCpct"
render={({ field }) => {
const value = field.value;
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
field.onChange(e.target.value);
}}
maxLength={txtSize}
/>
</FormUi>
)}
/>
</div>
</div>
return (
<FormUi label="처리시설 용량(m³)">
<Input
className={selectClass}
placeholder=""
type="text"
value={
isUnknown ? "확인불가" : formatCommaNumber(value)
<div className=" my-2">
<h1 className={formH1Class}>인센티브 정보</h1>
</div>
<div>
<h2 className={formH2Class}>설치비(원) 지원</h2>
</div>
<div className="grid grid-cols-2 gap-2 mt-4">
<div className="col-span-1">
<FormField
control={form.control}
name="reuseBuilding.0.instlCstSprtYn"
render={({ field }) => (
<FormUi label="설치비(원) 지원여부">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstIncenYn}
onSelectValue={readonly ? () => {} : field.onChange}
value={field.value || code.bdstIncenYn[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-1">
<FormField
control={form.control}
name="reuseBuilding.0.instlCstSprtAmt"
render={({ field }) => {
const value = field.value;
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
return (
<FormUi label="지원금액(원)">
<Input
className={selectClass}
placeholder=""
type="text"
readOnly={readonly || isUnknown}
value={
isUnknown ? "확인불가" : formatCommaNumber(value)
}
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
}}
onChange={(e) => {
if (readonly) return;
handleMinusNumberChange(e, field.onChange);
}}
disabled={
instlCstSprtYn === "N" || instlCstSprtYn === "D"
}
maxLength={numSize}
/>
</FormUi>
);
}}
/>
</div>
</div>
console.log('value')
field.onChange(""); // 초기화
}
}}
onChange={(e) => {
if (readonly) return;
handleMinusNumberChange(e, field.onChange);
}}
readOnly={readonly}
maxLength={numSize}
/>
</FormUi>
);
}}
/>
</div>
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.orgwtKndCd"
render={({ field }) => (
<FormUi label="원수 종류">
<SelectBox
className={""}
label={""}
selectClass={selectClass}
selectArray={code.orgwtKndCd}
onSelectValue={readonly ? () => { } : field.onChange}
value={field.value ?? code.orgwtKndCd[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.filtrTrtmfctProcs"
render={({ field }) => (
<FormUi label="주요처리공정">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.rswtPrscCdMthdCd}
onSelectValue={readonly ? () => { } : field.onChange}
value={field.value || code.rswtPrscCdMthdCd[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div>
<h2 className={formH2Class}>녹색건축물 인증</h2>
</div>
<div className="grid grid-cols-6 gap-2 mt-4">
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertYn"
render={({ field }) => (
<FormUi label="인증여부">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstIncenYn}
onSelectValue={readonly ? () => {} : field.onChange}
value={field.value || code.yn[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className=" my-2">
<h1 className={formH1Class}>인센티브 정보</h1>
</div>
<div>
<h2 className={formH2Class}>설치비(원) 지원</h2>
</div>
<div className="grid grid-cols-2 gap-2 mt-4">
<div className="col-span-1">
<FormField
control={form.control}
name="reuseBuilding.0.instlCstSprtYn"
render={({ field }) => (
<FormUi label="설치비(원) 지원여부">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstIncenYn}
onSelectValue={readonly ? () => { } : field.onChange}
value={field.value || code.bdstIncenYn[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-1">
<FormField
control={form.control}
name="reuseBuilding.0.instlCstSprtAmt"
render={({ field }) => {
const value = field.value;
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
return (
<FormUi label="지원금액(원)">
<Input
className={selectClass}
placeholder=""
type="text"
readOnly={readonly || isUnknown}
value={
isUnknown ? "확인불가" : formatCommaNumber(value)
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertYr"
render={({ field }) => {
const isUnknown =
field.value === null || field.value === "0000"; // 또는 Number(value) === -1
return (
<FormUi label="인증년도">
<Input
className={selectClass}
placeholder="2024"
type=""
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
}}
onChange={(e) => {
if (readonly) return;
handleMinusNumberChange(e, field.onChange);
}}
disabled={instlCstSprtYn === "N" || instlCstSprtYn === "D"}
maxLength={numSize}
/>
</FormUi>
);
}}
/>
</div>
</div>
<div>
<h2 className={formH2Class}>녹색건축물 인증</h2>
</div>
<div className="grid grid-cols-6 gap-2 mt-4">
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertYn"
render={({ field }) => (
<FormUi label="인증여부">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstIncenYn}
onSelectValue={readonly ? () => { } : field.onChange}
value={field.value || code.yn[0]?.val}
readOnly={readonly}
}}
value={isUnknown ? "확인불가" : (field.value ?? "")}
onChange={(e) => {
if (readonly) return;
if (e.target.value === "확인불가") {
field.onChange("0000");
} else {
field.onChange(e.target.value);
}
}}
disabled={
grntchBdstCertYn == "N" || grntchBdstCertYn == "D"
}
max={4}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertYr"
render={({ field }) => {
const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1
return (
<FormUi label="인증년도">
<Input
className={selectClass}
placeholder="2024"
type=""
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
}}
value={
isUnknown ? '확인불가' : field.value ?? ""}
onChange={(e) => {
if (readonly) return
if (e.target.value === '확인불가') {
field.onChange('0000');
} else {
field.onChange(e.target.value);
}
}}
disabled={grntchBdstCertYn == "N" || grntchBdstCertYn == "D"}
max={4}
/>
</FormUi>
)
}}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertNo"
render={({ field }) => {
const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1
return (
<FormUi label="인증번호">
<Input
className={selectClass}
placeholder="ab1234678"
type=""
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
}}
value={
isUnknown ? '확인불가' : field.value ?? ""}
onChange={(e) => {
if (readonly) return
);
}}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertNo"
render={({ field }) => {
const isUnknown =
field.value === null || field.value === "0000"; // 또는 Number(value) === -1
return (
<FormUi label="인증번호">
<Input
className={selectClass}
placeholder="ab1234678"
type=""
onFocus={() => {
// 입력 시 자동으로 확인불가 해제
if (isUnknown && !readonly) {
field.onChange(""); // 초기화
}
}}
value={isUnknown ? "확인불가" : (field.value ?? "")}
onChange={(e) => {
if (readonly) return;
if (e.target.value === '확인불가') {
field.onChange('');
} else {
field.onChange(e.target.value);
}
}}
disabled={grntchBdstCertYn == "N" || grntchBdstCertYn == "D"}
maxLength={txtSize}
/>
</FormUi>
)
}}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertGrd"
render={({ field }) => (
<FormUi label="인증등급">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstGrntchClass}
onSelectValue={readonly ? () => { } : field.onChange}
value={field.value || code.bdstGrntchClass[0]?.val}
readOnly={readonly}
if (e.target.value === "확인불가") {
field.onChange("");
} else {
field.onChange(e.target.value);
}
}}
disabled={
grntchBdstCertYn == "N" || grntchBdstCertYn == "D"
}
maxLength={txtSize}
/>
</FormUi>
)}
/>
</div>
);
}}
/>
</div>
<BdstAdd form={form} readonly={readonly}></BdstAdd>
<div className="col-span-3">
<FormField
control={form.control}
name="reuseBuilding.0.grntchBdstCertGrd"
render={({ field }) => (
<FormUi label="인증등급">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.bdstGrntchClass}
onSelectValue={readonly ? () => {} : field.onChange}
value={field.value || code.bdstGrntchClass[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<BdstAdd form={form} readonly={readonly}></BdstAdd>
{/* </ScrollArea> */}
</form>
</Form>
@@ -191,8 +191,7 @@ export function RainFacility({
"1000000",
String(con),
seartchTxt ?? "",
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
}
}}
@@ -249,8 +248,7 @@ export function RainFacility({
String(rainMapSize),
String(con),
seartchTxt ?? "",
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
setIsReset(false);
@@ -187,8 +187,7 @@ export function RswtFacility({
"1000000",
String(con),
seartchTxt ?? "",
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
}
}}
@@ -236,8 +235,7 @@ export function RswtFacility({
String(rainMapSize),
String(con),
seartchTxt ?? "",
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
setIsReset(false);
@@ -18,16 +18,17 @@ import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
export function RuseFacility({
rtnFeature,
}: {
rtnFeature: (feature: any) => void;
}) {
const { code, ruseMap, ruseMapInit, getMapFlcts,ruseMapSearch } = useWrStore(
rtnFeature,
}: {
rtnFeature: (feature: any) => void;
}) {
const { code, ruseMap, ruseMapInit, getMapFlcts, ruseMapSearch } = useWrStore(
(state) => state
);
const { t } = useTranslation("base");
const { ruseMapCount, ruseExcelList,fclts, ruseMapRes,ruseMapHeadList } = ruseMap;
const { ruseMapCount, ruseExcelList, fclts, ruseMapRes, ruseMapHeadList } =
ruseMap;
const [ruseTable, setRuseTable] = useState<WaterReuseFacility[]>();
const [isReset, setIsReset] = useState(false);
@@ -38,10 +39,7 @@ export function RuseFacility({
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
const ruseCellClick = (index: number | undefined) => {
if (
index !== undefined &&
ruseTable !== undefined
) {
if (index !== undefined && ruseTable !== undefined) {
rtnFeature(ruseTable[index]);
}
};
@@ -51,12 +49,11 @@ export function RuseFacility({
}
}, [ruseMap.isInit]);
useEffect(() => {
ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts);
ruseMapInit(1, ruseMapSize, ref.current, searchYear, fclts);
}, [fclts]);
useEffect(()=>{
if(ruseExcelList&&ruseExcelList.length>0){
useEffect(() => {
if (ruseExcelList && ruseExcelList.length > 0) {
if (ruseExcelList.length > 0) {
excelDownload(
ruseExcelList,
@@ -66,20 +63,18 @@ export function RuseFacility({
3
);
} else {
toast.error(t('excelDownErrMsg'));
toast.error(t("excelDownErrMsg"));
}
}
},[ruseExcelList])
}, [ruseExcelList]);
useEffect(() => {
if (ruseMapRes && ruseMapRes.length > 0) {
setRuseTable(ruseMapRes);
setRuseTable(ruseMapRes);
} else {
setRuseTable([]);
setRuseTable([]);
}
}, [ruseMapRes]);
return (
<>
<ContentsDiv>
@@ -94,34 +89,35 @@ export function RuseFacility({
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
buttonOrder={["query", "init", "excel"]}
rightClassName="ml-auto mr-6 flex items-center space-x-1"
rightClassName="ml-auto mr-6 flex items-center space-x-1 "
leftClassName="flex gap-5 w-9/12 m-4"
leftSelectClassName="w-1/4"
rightChildren={<></>}
leftChildren={
<div className="col-span-3 flex items-center">
<SelectBox
className="w-48 h-full text-2xl"
label="연도"
selectClass={"w-full "}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
/>
<Label className="w-full mt-2 ml-4 text-xl text-gray-600">
{"하수처리시설명"}
</Label>
<SearchInput
className={"text-2xl w-full"}
label=""
textValue={pbnRuseNm || ""}
setText={(e) => {
setPbnRuseNm(e || "");
}}
/>
</div>
<SelectBox
label="연도"
selectClass={"w-full w-48 h-full text-2xl rounded-none"}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
className={""}
selectContentClass={''}
/>
<Label className="w-full mt-2 ml-4 text-xl text-gray-600">
{"하수처리시설명"}
</Label>
<SearchInput
className={"text-2xl w-full"}
label=""
textValue={pbnRuseNm || ""}
setText={(e) => {
setPbnRuseNm(e || "");
}}
/>
</div>
}
queryClick={() => {
setIsReset(true);
@@ -133,7 +129,15 @@ export function RuseFacility({
ref={ref}
isAdmin={false}
excelClick={function (returnType: ReturnType): void {
ruseMapSearch(true,1,1000000 , returnType, searchYear, fclts,pbnRuseNm??'')
ruseMapSearch(
true,
1,
1000000,
returnType,
searchYear,
fclts,
pbnRuseNm ?? ""
);
}}
/>
</div>
@@ -147,10 +151,24 @@ export function RuseFacility({
headName={""}
cellClick={ruseCellClick}
onPageChange={(page) => {
if(pbnRuseNm&&pbnRuseNm.length>0){
ruseMapSearch(false,page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm)
}else{
ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts);
if (pbnRuseNm && pbnRuseNm.length > 0) {
ruseMapSearch(
false,
page,
ruseMapSize,
ref.current,
searchYear,
fclts,
pbnRuseNm
);
} else {
ruseMapInit(
page,
ruseMapSize,
ref.current,
searchYear,
fclts
);
}
setIsReset(false);
@@ -23,6 +23,7 @@ export default function CoSttnDetailPopup({isDetail} :{isDetail:DemandCompType})
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
updateList={isDetail}
readOnly={true}
openNetwork={false}
></SdmInsertForm>
</div>
@@ -18,6 +18,7 @@ import {
SelectBox,
Title,
} from "@common/business_components/ui";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
import { Button, Input } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useRef, useState } from "react";
@@ -35,9 +36,12 @@ export default function ChkgdExcel({
setYearChange: (year: string) => void;
}) {
const {
rswtChkgdn,
rainChkgdn,
rainChkExcelDataUPload,
rswtChkExceDataUpload,
setRainChkLoading,
setRswtChkLoading,
} = useWrStore((state) => {
return state;
});
@@ -110,43 +114,38 @@ export default function ChkgdExcel({
setRainChkLoading(false);
});
} else if (type === "RST") {
filePickedArray(file, 0).then((res) => {
setRswtChkLoading(true);
filePickedArray(file, 0)
.then((res) => {
if (res && res?.length > 1) {
const guideData = excelToRswtGuideData(
res[0],
form.getValues("chckYr")
);
const polutionData = excelToRswtPolution(res[1]);
if (res && res?.length > 1) {
const guideData = excelToRswtGuideData(
res[0],
form.getValues("chckYr"),
);
const polutionData = excelToRswtPolution(res[1]);
const keyGenerator = (item: rswtChkZodType) =>
`${item.bdstRuseFcltSn}|${item.chckYmd}|${item.utztnUsgCd}`;
const totalData: rswtChkZodType[] = guideData.map(
(guide) => {
const fusion = polutionData.find(
(polution) =>
guide.bdstRuseFcltSn === polution.bdstRuseFcltSn &&
guide.chckYmd === polution.chckYmd &&
guide.utztnUsgCd === polution.utztnUsgCd
);
const totalData: rswtChkZodType[] = guideData.map((guide) => {
const fusion = polutionData.find(
(polution) =>
guide.bdstRuseFcltSn === polution.bdstRuseFcltSn &&
guide.chckYmd === polution.chckYmd &&
guide.utztnUsgCd === polution.utztnUsgCd
);
if (fusion) {
return {
...guide,
rswtrPollutions: fusion?.rswtrPollutions,
rswtrDetails: fusion?.rswtrDetails,
};
} else {
return {
...guide,
};
}
if (fusion) {
return {
...guide,
rswtrPollutions: fusion?.rswtrPollutions,
rswtrDetails: fusion?.rswtrDetails,
};
} else {
return {
...guide,
};
}
);
});
const guideKey = new Set(guideData.map(keyGenerator));
const onlypolution = polutionData.filter(
(item) => !guideKey.has(keyGenerator(item))
@@ -158,7 +157,7 @@ export default function ChkgdExcel({
];
const issues: string[] = [];
rswtExcelDataCheck(listTotalData,issues)
rswtExcelDataCheck(listTotalData, issues);
if (issues && issues.length > 0) {
issues.some((err, index) => {
@@ -169,8 +168,9 @@ export default function ChkgdExcel({
} else {
setExcelRswtData(listTotalData);
}
}
});
}
})
.finally(() => setRswtChkLoading(false));
}
}
}, [file]);
@@ -222,6 +222,11 @@ export default function ChkgdExcel({
return (
<>
<LoadingOverlay
isLoading={type === "RNB" ? rainChkgdn.isLoading : rswtChkgdn.isLoading}
customZindex={"z-100"}
></LoadingOverlay>
<div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
@@ -2,13 +2,24 @@ import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
import { codeToText } from "@/components/lib/func/commom";
import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable";
import { ScrollArea, Title } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import React, { useEffect, useState } from "react";
import React, { useEffect, useState } from "react";
import type { z } from "zod";
export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type: string; obj: any, setIsModal: (open: boolean) => void, readonly: boolean }) {
export default function ChkgdModal({
type,
obj,
setIsModal,
readonly,
}: {
type: string;
obj: any;
setIsModal: (open: boolean) => void;
readonly: boolean;
}) {
const {
rainChkgdn,
rswtChkgdn,
@@ -58,14 +69,14 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
setHeadList({
splHeadList: rainChkSttn.splHeadList,
ruseHeadList: rainChkSttn.ruseHeadList,
rswtDetailHeadList: type === "RNB" ? [] : rswtChkSttn.rswtDetailSttnHeadList,
rswtDetailHeadList:
type === "RNB" ? [] : rswtChkSttn.rswtDetailSttnHeadList,
});
} else {
setHeadList({
splHeadList: rainChkgdn.splHeadList,
ruseHeadList: rainChkgdn.ruseHeadList,
rswtDetailHeadList:
type === "RNB" ? [] : rswtChkgdn.rswtDetailHeadList,
rswtDetailHeadList: type === "RNB" ? [] : rswtChkgdn.rswtDetailHeadList,
});
}
}, [
@@ -73,12 +84,13 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
rainChkgdn.splHeadList,
rainChkSttn.splHeadList,
rswtChkgdn.rswtDetailHeadList,
rswtChkSttn.rswtDetailSttnHeadList
rswtChkSttn.rswtDetailSttnHeadList,
]);
useEffect(() => {
const result = obj.guideDetails?.reduce((acc: any, cur: any) => {
const code = cur.utztnUsgCd;
const codeText = codeToText(cur.utztnUsgCd, "dmdUszCd");
const month = cur.ym?.slice(4); // "MM"
const ruseMonthKey = `ruse${month}`;
const splMonthKey = `spl${month}`;
@@ -91,7 +103,12 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
(it: { utztnUsgCd: string }) => it?.utztnUsgCd === code
);
if (!target) {
target = { utztnUsgCd: code, ruseTotal: 0, splTotal: 0 };
target = {
utztnUsgCdText: codeText,
utztnUsgCd: code,
ruseTotal: 0,
splTotal: 0,
};
acc.push(target);
}
// 월별 값 누적
@@ -106,12 +123,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
if (result) {
// '기타' 항목을 배열의 맨 뒤로 정렬합니다.
result.sort((a: splRuseWaterType, b: splRuseWaterType) => {
if (a.utztnUsgCd === "기타") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "기타") return -1; // b를 a 뒤로 보냅니다.
if (a.utztnUsgCd === "07") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "07") return -1; // b를 a 뒤로 보냅니다.
return 0; // 순서를 유지합니다.
});
}
setGuidData(result as splRuseWaterType[]);
if (obj.rswtrPollutions) {
@@ -124,6 +140,10 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
obj.rswtrPollutions.forEach(
(item: z.infer<typeof rswtrPolutionsZode>) => {
const nodeKey = String(item.node);
item["utztnUsgCdText"] = codeToText(
item.utztnUsgCd ?? "",
"dmdUszCd"
);
resultPolution[nodeKey]?.push(item);
}
);
@@ -132,8 +152,8 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
Object.entries(resultPolution).forEach(([nodeKey, items]) => {
const onlyData = items as z.infer<typeof rswtrPolutionsZode>[];
if (onlyData.length === 0) return;
const total = initStats();
onlyData.forEach((item) => {
total.grssClfgUswtr += item.grssClfgUswtr;
total.combResdch += item.combResdch;
@@ -148,7 +168,7 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
});
const average = {
utztnUsgCd: "평균",
utztnUsgCdText: "평균",
edit: false,
grssClfgUswtr: (total.grssClfgUswtr / onlyData.length).toFixed(1),
combResdch: (total.combResdch / onlyData.length).toFixed(1),
@@ -168,8 +188,8 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
// '기타' 항목을 배열의 맨 뒤로 정렬합니다.
resultPolution[nodeKey].sort((a: any, b: any) => {
if (a.utztnUsgCd === "기타") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "기타") return -1; // b를 a 뒤로 보냅니다.
if (a.utztnUsgCd === "07") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "07") return -1; // b를 a 뒤로 보냅니다.
return 0; // 순서를 유지합니다.
});
@@ -213,16 +233,15 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
});
obj.guideDetails = realGuideDetail;
if (type === "RNB") {
rainChkGuidUpdate(obj);
setIsModal(false)
setIsModal(false);
} else {
const polution = Object.values(upPolutionData)
.flat()
.filter((item) => item.utztnUsgCd !== "평균");
obj.rswtrPollutions = polution;
rwstPolAndGuideUpdate([obj]);
setIsModal(false)
setIsModal(false);
}
};
@@ -247,7 +266,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
}
></Title>
{!rainChkSttn.isSttn ? (
<Button className="mt-8 mr-7" onClick={allDataUpdate} disabled={!readonly}>
<Button
className="mt-8 mr-7"
onClick={allDataUpdate}
disabled={!readonly}
>
저장
</Button>
) : (
@@ -256,7 +279,8 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
</div>
<h3 className="text-2xl font-bold text-gray-900 mt-2 ml-6">
{type === "RNB"
? `시설명 : (${obj.bdstNm})` : `시설명 : (${obj.building.bdstNm})`}
? `시설명 : (${obj.bdstNm})`
: `시설명 : (${obj.building.bdstNm})`}
</h3>
</div>
@@ -269,7 +293,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
<GuideDetailsTable
chgRes={guidData || []}
headList={headList.splHeadList}
upheadList={type === "RNB" ? rainChkgdn.rainSplHeadNm : rswtChkgdn.rswtSplHeadNm}
upheadList={
type === "RNB"
? rainChkgdn.rainSplHeadNm
: rswtChkgdn.rswtSplHeadNm
}
type={""}
setChGuidData={(data) => {
setChGuidData(data);
@@ -284,7 +312,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
<GuideDetailsTable
chgRes={guidData || []}
headList={headList.ruseHeadList}
upheadList={type === "RNB" ? rainChkgdn.rainRuseHeadNm : rswtChkgdn.rswtRuseHeadNm}
upheadList={
type === "RNB"
? rainChkgdn.rainRuseHeadNm
: rswtChkgdn.rswtRuseHeadNm
}
type={""}
setChGuidData={(data) => {
setChGuidData(data);
@@ -4,12 +4,11 @@ import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common/type/header";
import { rainPageSize, type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import { tableData } from "@/components/lib/func/commom";
import { codeToText, tableData } from "@/components/lib/func/commom";
import {
chRowspanTable,
rainChkTableData
} from "@/components/lib/func/TableData";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
import {
Table,
@@ -89,15 +88,18 @@ export default function RainChkgdTable({
}
)
})
return {
...item,
...bud[0],
utztnUsgCdText: codeToText(item.guideDetails[0].utztnUsgCd, 'dmdUszCd'),
oilqMeasMthdText:codeToText(item.oilqMeasMthd, 'rainFcltFlowRate'),
operMngCdText:codeToText(item.operMngCd.trim(), 'rainRswtMng'),
rainyDetails:rainyDetails,
rowspan: item.rainyDetails?.length,
};
});
console.log('rainChg ', rainChg)
setMakeTableData(rainChkTableData(rainChg));
} else {
setMakeTableData([]);
@@ -188,7 +190,6 @@ export default function RainChkgdTable({
return (
<>
<LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay>
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(
@@ -13,7 +13,6 @@ import {
chRowspanTable,
rswtChkTableData,
} from "@/components/lib/func/TableData";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
import { Table, TableBody, TableHeader } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
@@ -138,7 +137,6 @@ export default function RswtChkgdTable({
return (
<>
<LoadingOverlay isLoading={rswtChkgdn.isLoading}></LoadingOverlay>
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(headList?.headList, headList?.upHeadList)}
Binary file not shown.