빗물/중수도/온배수 등록, 현황 build 오류 수정 완료

This commit is contained in:
jyha00
2025-07-14 14:12:41 +09:00
parent 58ec7ed002
commit 34bc8b6a5c
12 changed files with 98 additions and 127 deletions
@@ -1,6 +1,10 @@
"use client";
import { useWrStore } from "@/app/store";
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import { tableData } from "@/components/lib/func/commom";
import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import {
ContentsDiv,
ScrollArea,
@@ -12,15 +16,9 @@ import {
UiModal,
UiTable,
} from "@common/business_components";
import { Button } from "@common/components";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components";
import { useEffect, useState } from "react";
import { tableData } from "@/components/lib/func/commom";
import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { Toaster } from "react-hot-toast";
export default function Home() {
@@ -33,10 +31,10 @@ export default function Home() {
const [bdstTable, setbdstTable] = useState<customHtdflBdst[]>();
const [issNewReg, setIsNewReg] = useState<boolean>(false);
const [bdstChgProps, setBdstChgProps] = useState<{
isOpen: boolean;
chgBuilding: chgBuilding[];
}>({ isOpen: false, chgBuilding: [] });
// const [bdstChgProps, setBdstChgProps] = useState<{
// isOpen: boolean;
// chgBuilding: chgBuilding[];
// }>({ isOpen: false, chgBuilding: [] });
const { htdflRes ,htdflResCount} = htdfl;
@@ -49,7 +47,7 @@ export default function Home() {
if (htdflRes && htdflRes.length > 0) {
const htdflData = tableData(htdflRes, { code }).map(
(item: customHtdflBdst) => {
let archArea =
const archArea =
item?.archArea.split(".")[0] !== "-1"
? item?.archArea.split(".")[0]
: "확인불가";
@@ -67,8 +65,7 @@ export default function Home() {
}, [code, htdflRes]);
const cellClick: (val: number | undefined, headId: string) => void = (
val,
headId
val
) => {
if ((bdstTable ?? []).length > 0 && val !== undefined) {
{
@@ -52,7 +52,7 @@ export default function Home() {
if (rainRes && rainRes.length > 0) {
const rainData = tableData(rainRes, { code }).map(
(item: customRainBdst) => {
let archArea =
const archArea =
item?.archArea.split(".")[0] !== "-1"
? item?.archArea.split(".")[0]
: "확인불가";
@@ -117,7 +117,7 @@ export default function Home() {
<Button
className=""
size={"sm"}
onClick={(e) => {
onClick={() => {
rainSearch(searchTxt || "", 1, "41");
//rainSearch(searchTxt || "", pageNation, "41");
}}
@@ -48,7 +48,7 @@ export default function Home() {
if (rswtRes?.length > 0) {
const rswtData = tableData(rswtRes, { code })?.map(
(item: customRswtBdst) => {
let archArea =
const archArea =
item?.archArea.split(".")[0] !== "-1"
? item?.archArea.split(".")[0]
: "확인불가";
@@ -125,7 +125,7 @@ export default function Home() {
<Button
size={"sm"}
className="mr-4 "
onClick={(e) => {
onClick={() => {
rswtBdstSearch(searchTxt || "", pageNation, "41");
}}
>
@@ -3,20 +3,18 @@
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import type {
chgBuilding,
customRainBdst,
customRainBdst
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import {
excelDownload,
getCity,
getCityOrSgg,
tableData,
tableData
} from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import {
ContentsDiv,
SearchBaseForm,
SearchDiv,
SearchFormLeft,
SearchFormRight,
@@ -25,15 +23,12 @@ import {
Title,
UiModal,
UiTable,
type ReturnType,
type SelectDataType,
type SelectDataType
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
@@ -43,7 +38,6 @@ export default function HtdflSttn() {
);
const { htdflSttnRes, htdflSttnResCount } = htdflSttn;
const ref = useRef<ReturnType>({} as ReturnType);
const isDownloadTriggered = useRef(false);
const { t } = useTranslation('base');
const [pageNation, setPageNation] = useState(1);
@@ -56,10 +50,10 @@ export default function HtdflSttn() {
isOpen: boolean;
data: customRainBdst | undefined;
}>({ data: undefined, isOpen: false });
const [bdstChgProps, setBdstChgProps] = useState<{
isOpen: boolean;
chBuilding: chgBuilding[];
}>({ isOpen: false, chBuilding: [] });
// const [bdstChgProps, setBdstChgProps] = useState<{
// isOpen: boolean;
// chBuilding: chgBuilding[];
// }>({ isOpen: false, chBuilding: [] });
const [fcltNm, setFcltNm] = useState<string>("");
useEffect(() => {
@@ -224,9 +218,6 @@ export default function HtdflSttn() {
<UiTable
headName={undefined}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />
}
headlist={htdflSttn.htdflSttHeadList}
pageSize={20}
total={htdflSttnResCount || 0}
@@ -235,7 +226,9 @@ export default function HtdflSttn() {
}}
onPageChange={setPageNation}
resetPageNo={resetPage}
></UiTable>
>
<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />
</UiTable>
</ListDiv>
</div>
</div>
@@ -2,16 +2,21 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import type {
chgBuilding,
customRainBdst,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import {
excelDownload,
getCity,
getCityOrSgg,
tableData,
tableData
} from "@/components/lib/func/commom";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import {
ContentsDiv,
SearchBaseForm,
SearchDiv,
SearchFormLeft,
SearchFormRight,
@@ -20,20 +25,12 @@ import {
Title,
UiModal,
UiTable,
type ReturnType,
type SelectDataType,
type SelectDataType
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import type {
chgBuilding,
customRainBdst,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
@@ -42,7 +39,6 @@ export default function RainSttn() {
(state) => state
);
const { rainSttnRes, rainSttnResCount } = rainSttn;
const ref = useRef<ReturnType>({} as ReturnType);
const [pageNation, setPageNation] = useState(1);
const [isChHead, setIsChHead] = useState(false);
@@ -235,16 +231,15 @@ export default function RainSttn() {
<UiTable
headName={undefined}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={rainSttn.rainSttNodeList} />
}
headlist={rainSttn.rainSttHeadList}
pageSize={20}
total={rainSttnResCount || 0}
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
onPageChange={setPageNation}
resetPageNo={resetPage}
></UiTable>
>
<HeadMakeColSpan upHeadList={rainSttn.rainSttNodeList} />
</UiTable>
</ListDiv>
</div>
</div>
@@ -6,8 +6,7 @@ import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
import {
excelDownload,
getCity,
getCityOrSgg,
tableData,
tableData
} from "@/components/lib/func/commom";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
@@ -15,7 +14,6 @@ import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import {
ContentsDiv,
SearchBaseForm,
SearchDiv,
SearchFormLeft,
SearchFormRight,
@@ -24,8 +22,7 @@ import {
Title,
UiModal,
UiTable,
type ReturnType,
type SelectDataType,
type SelectDataType
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
@@ -43,7 +40,6 @@ export default function RswtSttn() {
const { rswtSttnRes, rswtSttnResCount } = rswtSttn;
const [isChHead, setIsChHead] = useState(false);
const [resetPage, isResetPage] = useState(false);
const ref = useRef<ReturnType>({} as ReturnType);
const [bdstTable, setBdstTable] = useState<customRswtBdst[]>();
const isDownloadTriggered = useRef(false);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
@@ -233,16 +229,15 @@ export default function RswtSttn() {
<UiTable
headName={undefined}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} />
}
headlist={rswtSttn.rswtSttHeadList}
pageSize={20}
total={rswtSttnResCount || 0}
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
onPageChange={setPageNation}
resetPageNo={resetPage}
></UiTable>
>
<HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} />
</UiTable>
</ListDiv>
</div>
</div>
@@ -2,7 +2,7 @@ import type { SelectDataType } from "@common/business_components/ui";
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
export const excelHtdflSttnParsing = (
excel: customHtdflBdst[],
excel: { data: customHtdflBdst[] },
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
): string[][] => {
@@ -1,12 +1,12 @@
import type { CommonTableProps } from "@/app/store/common/type/header";
import { htdflSttHeadListExport, htdflSttNodeListExport } from "./headList";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { z } from "zod";
import { controlHeadView } from "../rainSttn";
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
import { fetchType, getFetchWithCount } from "@/components/lib/api";
import type { SelectDataType } from "@common/business_components/ui";
import type { z } from "zod";
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
import { excelHtdflSttnParsing } from "./excel";
import { htdflSttHeadListExport, htdflSttNodeListExport } from "./headList";
const htdflSttHeadList = htdflSttHeadListExport;
const htdflSttNodeList = htdflSttNodeListExport;
@@ -45,9 +45,7 @@ export const htdflSttnStateExport: htdflSttnState = {
htdflSttnResCount: 1,
},
};
const initFetch = async (page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
const initFetch = async (page: number, total: string, con: string, txt: string) => {
const htdflRes = await getFetchWithCount(
"wr",
`/drain/facilityList` +
@@ -68,7 +66,7 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
try {
const htdflSttnRes = await initFetch(page, total, con, txt, sidoCode, sggCode);
const htdflSttnRes = await initFetch(page, total, con, txt);
if (isExcel) {
const htdflExcel = excelHtdflSttnParsing(htdflSttnRes, sidoCode, sggCode);
set((state: htdflSttnState) => {
@@ -2,7 +2,7 @@ import type { SelectDataType } from "@common/business_components/ui";
import type { customRainBdst } from "../../fcltReg/rainReg";
export const excelRainSttnParsing = (
excel: customRainBdst[],
excel: { data: customRainBdst[] },
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
): string[][] => {
@@ -10,8 +10,8 @@ export const excelRainSttnParsing = (
excel.data.forEach((item) => {
excelExportData.push([
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
sidoCode.find((sido) => sido.val === item.ctpvCd?.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd?.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
String(item.bdstInfoPk ?? ""),
@@ -1,15 +1,15 @@
import { bdstUsgCd } from "@/app/store/common/code/basicCode";
import type { SelectDataType } from "@common/business_components/ui";
import type { customRswtBdst } from "../../fcltReg/rswtReg";
import { useWrStore } from "@/app/store";
import { bdstUsgCd } from "@/app/store/common/code/basicCode";
export const excelRSwtSttnParsing = (
excel: customRswtBdst[],
excel: { data: customRswtBdst[] },
sidoCode: SelectDataType[],
sggCode: 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 ?? "",
@@ -18,10 +18,10 @@ export const excelRSwtSttnParsing = (
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"), //물사용량
// String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
String(item.chgBuilding.length > 0 ? "Y" : "N"), //중축・개축・재축여부
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), //법적의무대상여부
String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), //의무대상물사용량
// String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), //의무대상물사용량
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시
String(item.reuseBuilding?.[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding?.[0]?.instlCst ?? ""), //설치비용
item.reuseBuilding?.[0]?.rswtrObj?.orgwtKndCd ?? "", //원수종류
@@ -38,11 +38,11 @@ export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
title: "건축면적",
visible: true,
},
{
id: "wtrUsqty",
title: "물사용량",
visible: true,
},
// {
// id: "wtrUsqty",
// title: "물사용량",
// visible: true,
// },
{
id: "chBuildingYn",
title: "중축・개축・재축여부",
@@ -54,12 +54,11 @@ export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
title: "법적의무대상여부",
visible: true,
},
{
id: "oblgTrgtWtrUsqty",
title: "의무대상물사용량 ",
visible: true,
},
// {
// id: "oblgTrgtWtrUsqty",
// title: "의무대상물사용량 ",
// visible: true,
// },
{
id: "instlCmptnDt",
title: "설치완료일시",
@@ -134,7 +133,7 @@ export const rswtSttNodeListExport: CommonTableProps[] = [
visible: true,
row: 1,
rowSpan: 1,
colSpan: 12,
colSpan: 10,
},
{
id: "rswtFcltInfo",
@@ -229,15 +228,15 @@ export const rswtSttNodeListExport: CommonTableProps[] = [
rowSpan: 2,
colSpan: 1,
},
{
id: "wtrUsqty",
title: "물사용량",
upName: "bdnstInfo",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
// {
// id: "wtrUsqty",
// title: "물사용량",
// upName: "bdnstInfo",
// visible: true,
// row: 2,
// rowSpan: 2,
// colSpan: 1,
// },
{
id: "chBuildingYn",
title: "중축・개축・재축여부",
@@ -257,15 +256,15 @@ export const rswtSttNodeListExport: CommonTableProps[] = [
rowSpan: 2,
colSpan: 1,
},
{
id: "oblgTrgtWtrUsqty",
title: "의무대상물사용량",
upName: "bdnstInfo",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
// {
// id: "oblgTrgtWtrUsqty",
// title: "의무대상물사용량",
// upName: "bdnstInfo",
// visible: true,
// row: 2,
// rowSpan: 2,
// colSpan: 1,
// },
{
id: "instlCmptnDt",
title: "설치완료일시",
@@ -1,12 +1,12 @@
import type { CommonTableProps } from "@/app/store/common/type/header";
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
import { fetchType, getFetchWithCount } from "@/components/lib/api";
import type { SelectDataType } from "@common/business_components/ui";
import type { z } from "zod";
import type { customRswtBdst } from "../../fcltReg/rswtReg";
import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
import { excelRSwtSttnParsing } from "./excel";
import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList";
import type { SelectDataType } from "@common/business_components/ui";
@@ -30,11 +30,11 @@ export type rswtSttnState = {
type rswtSttnActions = {
rswtSttnInit: (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rswtSttnSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rswtChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -72,7 +72,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
set((state: rswtSttnState) => {
return {
...state,
@@ -111,12 +111,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : "")
);
console.log("주소",`/reuseFc/waterreuseFc` +
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : ""))
console.log("rswtSttnRes", rswtSttnRes)
if (isExcel) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
set((state: rswtSttnState) => {