감리지적사항 수정

This commit is contained in:
leedj312
2025-08-13 13:17:31 +09:00
parent a5f7fb7fe8
commit 6fef06963d
13 changed files with 523 additions and 195 deletions
@@ -143,7 +143,7 @@ const Map = () => {
}
select.selectFeature(foundFeature, true);
} else {
toast.error('위치정보를 찾을수 없습니다')
// toast.error('위치정보를 찾을수 없습니다')
console.warn("OpenLayers Feature를 찾을 수 없습니다:");
console.log("foundFeature :", foundFeature );
console.warn("featureId : ", featureId);
+38 -20
View File
@@ -2,12 +2,15 @@ import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
import type { CommonTableProps } from "../../common/type/header";
import type { customHtdflBdst } from "../../ruseFcltMng/fcltReg/htdflReg";
import { htdflSttHeadListExport, htdflSttNodeListExport } from "../../ruseFcltMng/fcltSttn/htdflSttn/headList";
import type { SelectDataType } from "@common/business_components/ui";
import { excelHtdflSttnParsing } from "../../ruseFcltMng/fcltSttn/htdflSttn/excel";
export const htdfMapSize = 15;
export type htdfMapState = {
htdfMap: {
htdfMapRes: customHtdflBdst[];
htdfMapCount: number;
htdflMapExcelList:[]
isInit: boolean;
htdfSttHeadList: CommonTableProps[];
htdfSttNodeList: CommonTableProps[];
@@ -16,7 +19,9 @@ export type htdfMapState = {
type htdfMapActions = {
htdfMapInit: (page: number, total: number, cityOrSgg: string) => void;
htdfMapSearch: (page: number, total: number, cityOrSgg:string, searchTxt?:string) =>void
htdfMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
htdfMapDetile:(featureCd:string) => Promise<customHtdflBdst | undefined>;
};
@@ -27,6 +32,7 @@ export const htdfMapStateExport: htdfMapState = {
htdfMap: {
isInit: false,
htdfMapRes: [],
htdflMapExcelList:[],
htdfMapCount: 1,
htdfSttHeadList: htdflSttHeadListExport,
htdfSttNodeList: htdflSttNodeListExport,
@@ -62,32 +68,44 @@ export const htdfMapActionsExport: (set: any) => htdfMapActions = (
console.log(e);
}
},
htdfMapSearch: async (
page: number,
total: number,
cityOrSgg: string,
searchTxt?: string
htdfMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
) => {
try {
const htdfMapRes = await getFetchWithCount(
fetchType.WR,
`/drain/facilityList` +
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(cityOrSgg ? `/${cityOrSgg}` : "/0") +
(searchTxt ? `/${searchTxt}` : "")
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : "")
);
if (isExcel) {
const htdflMapExcelList = excelHtdflSttnParsing(htdfMapRes, sidoCode, sggCode);
set((state: htdfMapState) => {
return {
...state,
htdfMap: {
...state.htdfMap,
htdfMapRes: htdfMapRes.data,
htdfMapCount: htdfMapRes.count,
},
};
});
set((state: htdfMapState) => {
return {
...state,
htdfMap: {
...state.htdfMap,
htdflMapExcelList: htdflMapExcelList
},
};
});
}else{
set((state: htdfMapState) => {
return {
...state,
htdfMap: {
...state.htdfMap,
htdfMapRes: htdfMapRes.data,
htdfMapCount: htdfMapRes.count,
},
};
});
}
} catch (e) {
console.log(e);
}
+29 -7
View File
@@ -5,12 +5,15 @@ import {
rainSttNodeListExport,
} from "../../ruseFcltMng/fcltSttn/rainSttn/headList";
import type { customRainBdst } from "../../ruseFcltMng/fcltReg/rainReg";
import type { SelectDataType } from "@common/business_components/ui";
import { excelRainSttnParsing } from "../../ruseFcltMng/fcltSttn/rainSttn/excel";
export const rainMapSize = 15
export type rainMapState = {
rainMap: {
rainMapRes: customRainBdst[];
rainMapExcelList: [];
rainMapCount: number;
isInit: boolean;
rainSttHeadList: CommonTableProps[];
@@ -20,7 +23,9 @@ export type rainMapState = {
type rainMapActions = {
rainMapInit: (page: number, total: number, cityOrSgg:string) => void;
rainMapSearch: (page: number, total: number, cityOrSgg:string, searchTxt?:string) =>void
rainMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rainMapDetile:(featureCd:string) => Promise<customRainBdst | undefined>;
};
@@ -30,6 +35,7 @@ export const rainMapStateExport: rainMapState = {
rainMap: {
isInit: false,
rainMapRes: [],
rainMapExcelList:[],
rainMapCount: 1,
rainSttHeadList: rainSttHeadListExport,
rainSttNodeList: rainSttNodeListExport,
@@ -65,17 +71,31 @@ export const rainMapActionsExport: (set: any) => rainMapActions = (
console.log(e);
}
},
rainMapSearch: async (page: number, total: number, cityOrSgg:string, searchTxt?:string) => {
rainMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
try {
const rainMapRes = await getFetchWithCount(
fetchType.WR,
`/reuseFc/rainyInfoList` +
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(cityOrSgg ? `/${cityOrSgg}` : "/0") +
(searchTxt ? `/${searchTxt}` : "")
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainMapExcelList = excelRainSttnParsing(rainMapRes, sidoCode, sggCode);
set((state: rainMapState) => {
return {
...state,
rainMap: {
...state.rainMap,
rainMapExcelList: rainMapExcelList,
},
};
});
}else{
set((state: rainMapState) => {
return {
...state,
@@ -86,6 +106,8 @@ export const rainMapActionsExport: (set: any) => rainMapActions = (
},
};
});
}
} catch (e) {
console.log(e);
}
+37 -23
View File
@@ -5,12 +5,15 @@ import {
rswtSttHeadListExport,
rswtSttNodeListExport,
} from "../../ruseFcltMng/fcltSttn/rswtSttn/headList";
import type { SelectDataType } from "@common/business_components/ui";
import { excelRSwtSttnParsing } from "../../ruseFcltMng/fcltSttn/rswtSttn/excel";
export const rswtMapSize = 15;
export type rswtMapState = {
rswtMap: {
rswtMapRes: customRswtBdst[];
rswtMapCount: number;
rswtMapExcelList:[]
isInit: boolean;
rswtSttHeadList: CommonTableProps[];
rswtSttNodeList: CommonTableProps[];
@@ -20,10 +23,9 @@ export type rswtMapState = {
type rswtMapActions = {
rswtMapInit: (page: number, total: number, cityOrSgg: string) => void;
rswtMapSearch: (
page: number,
total: number,
cityOrSgg: string,
searchTxt?: string
isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
) => void;
rswtMapDetile: (featureCd: string) => Promise<customRswtBdst | undefined>;
};
@@ -34,6 +36,7 @@ export const rswtMapStateExport: rswtMapState = {
rswtMap: {
isInit: false,
rswtMapRes: [],
rswtMapExcelList:[],
rswtMapCount: 1,
rswtSttHeadList: rswtSttHeadListExport,
rswtSttNodeList: rswtSttNodeListExport,
@@ -69,32 +72,43 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
console.log(e);
}
},
rswtMapSearch: async (
page: number,
total: number,
cityOrSgg: string,
searchTxt?: string
rswtMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
) => {
try {
const rswtMapRes = await getFetchWithCount(
fetchType.WR,
`/reuseFc/waterreuseFc` +
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(cityOrSgg ? `/${cityOrSgg}` : "/0") +
(searchTxt ? `/${searchTxt}` : "")
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtMapExcelList = excelRSwtSttnParsing(rswtMapRes, sidoCode, sggCode);
set((state: rswtMapState) => {
return {
...state,
rswtMap: {
...state.rswtMap,
rswtMapExcelList:rswtMapExcelList
},
};
});
}else{
set((state: rswtMapState) => {
return {
...state,
rswtMap: {
...state.rswtMap,
rswtMapRes: rswtMapRes.data,
rswtMapCount: rswtMapRes.count,
},
};
});
set((state: rswtMapState) => {
return {
...state,
rswtMap: {
...state.rswtMap,
rswtMapRes: rswtMapRes.data,
rswtMapCount: rswtMapRes.count,
},
};
});
}
} catch (e) {
console.log(e);
}
+62 -3
View File
@@ -8,6 +8,7 @@ import {
import type { ReturnType } from "@common/business_components/ui";
import { hasuListFetch } from "../../ruseFcltMng/fcltSttn/pbnstSttn";
import type { customPbnst } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
import { excelPbnstSttnParsing } from "../../ruseFcltMng/fcltSttn/pbnstSttn/excel";
export const ruseMapSize = 15;
export type ruseMapState = {
@@ -16,6 +17,7 @@ export type ruseMapState = {
ruseMapCount: number;
isInit: boolean;
fclts: string[];
ruseExcelList:[];
ruseDetailList: customPbnst[];
ruseMapHeadList: CommonTableProps[];
ruseMapNodeList: CommonTableProps[];
@@ -29,7 +31,16 @@ type ruseMapActions = {
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[]
fclts: string[],
isExcel:boolean
) => void;
ruseMapSearch: (
page: number,
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[],
fcltNm:string
) => void;
ruseMapDetail: (ruseFcltId: string) => Promise<customPbnst | undefined>;
getRuseMaplList: (bscFctCd: string) => void;
@@ -45,6 +56,7 @@ export const ruseMapStateExport: ruseMapState = {
ruseDetailList: [],
fclts: [],
ruseMapCount: 1,
ruseExcelList:[],
ruseMapHeadList: pbnSttHeadListExport,
ruseMapNodeList: pbnstSttNodeListExport,
},
@@ -69,7 +81,8 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[]
fclts: string[],
isExcel:boolean
) => {
try {
const ruseMapRes = await hasuListFetch(
@@ -80,7 +93,7 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
year,
fclts
);
if(!isExcel){
set((state: ruseMapState) => {
return {
...state,
@@ -92,6 +105,19 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
},
};
});
}else{
const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data);
set((state: ruseMapState) => {
return {
...state,
ruseMap: {
...state.ruseMap,
ruseExcelList: ruseMapExcel,
},
};
});
}
} catch (e) {
console.log(e);
}
@@ -148,5 +174,38 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
throw errorHasu; // 호출부에서 catch 가능하도록
}
},
ruseMapSearch: async (
page: number,
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[],
fcltNm:string
) => {
try {
const ruseMapRes = await hasuListFetch(
String(page),
String(total),
reurnValue,
fcltNm,
year,
fclts,
);
set((state: ruseMapState) => {
return {
...state,
ruseMap: {
...state.ruseMap,
ruseMapRes: ruseMapRes.data,
ruseMapCount: ruseMapRes.count,
isInit: false,
},
};
});
} catch (e) {
console.log(e);
}
},
};
};
+44 -44
View File
@@ -61,49 +61,49 @@ export const reUseCaseNames: nameMap = {
"사업비 정산_국고비율(백만원)": "clclnEcqrRt"
}
interface PbnstSttnItem {
rvbsn: string;
lgbsn: number;
mdmbsn?: string;
rgnNm?: string;
sido?: number;
gugun?: number;
bscFctNm?: string;
efflWqltStndrdNm?: string;
fctCpc?: number;
tel?: string;
ruseUtztnFcltNm?: string;
fcltCpct?: number;
splyExtraCpct?: number;
ruseCpct?: number;
usageTotal?: number;
inUsage?: number;
outUsage?: number;
}
// interface PbnstSttnItem {
// rvbsn: string;
// lgbsn: number;
// mdmbsn?: string;
// rgnNm?: string;
// sido?: number;
// gugun?: number;
// bscFctNm?: string;
// efflWqltStndrdNm?: string;
// fctCpc?: number;
// tel?: string;
// ruseUtztnFcltNm?: string;
// fcltCpct?: number;
// splyExtraCpct?: number;
// ruseCpct?: number;
// usageTotal?: number;
// inUsage?: number;
// outUsage?: number;
// }
export const excelPbnstSttnParsing = (data: PbnstSttnItem[]): string[][] => {
const excelExportData: string[][] = [];
// export const excelPbnstSttnParsing = (data: PbnstSttnItem[]): string[][] => {
// const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
item.rvbsn,
String(item.lgbsn),
item.mdmbsn ?? "",
item.rgnNm ?? "",
String(item.sido ?? ""),
String(item.gugun ?? ""),
String(item.bscFctNm ?? ""),
String(item.efflWqltStndrdNm ?? ""),
String(item.fctCpc ?? ""),
String(item.tel ?? ""),
String(item.ruseUtztnFcltNm ?? ""),
String(item.fcltCpct ?? ""),
String(item.splyExtraCpct ?? ""),
String(item.ruseCpct ?? ""),
String(item.usageTotal ?? ""),
String(item.inUsage ?? ""),
String(item.outUsage ?? ""),
])
})
return excelExportData;
};
// data.forEach((item) => {
// excelExportData.push([
// item.rvbsn,
// String(item.lgbsn),
// item.mdmbsn ?? "",
// item.rgnNm ?? "",
// String(item.sido ?? ""),
// String(item.gugun ?? ""),
// String(item.bscFctNm ?? ""),
// String(item.efflWqltStndrdNm ?? ""),
// String(item.fctCpc ?? ""),
// String(item.tel ?? ""),
// String(item.ruseUtztnFcltNm ?? ""),
// String(item.fcltCpct ?? ""),
// String(item.splyExtraCpct ?? ""),
// String(item.ruseCpct ?? ""),
// String(item.usageTotal ?? ""),
// String(item.inUsage ?? ""),
// String(item.outUsage ?? ""),
// ])
// })
// return excelExportData;
// };
@@ -22,13 +22,13 @@ export const excelRainSttnParsing = (
String(item.chgBuilding.length > 0 ? "Y" : "N"),
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""),
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""),
String(item.reuseBuilding?.[0]?.instlCst ?? ""),
String(item.reuseBuilding?.[0]?.instlCst === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.instlCst) ?? ""),
item.reuseBuilding?.[0]?.rainyObj?.pntfColKnd ?? "",
String(item.reuseBuilding?.[0]?.rainyObj?.pntfColArea ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.pntfColArea === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.rainyObj?.pntfColArea) ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctYn ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctCpct ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctCpct === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctCpct) ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctPrs ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.dtfcltCpct ?? ""),
String(item.reuseBuilding?.[0]?.rainyObj?.dtfcltCpct === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.rainyObj?.dtfcltCpct) ?? ""),
String(item.reuseBuilding?.[0]?.instlCstSprtYn ?? ""),
String(item.reuseBuilding?.[0]?.instlCstSprtAmt === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.instlCstSprtAmt) ?? ""),
String(item.reuseBuilding?.[0]?.grntchBdstCertYn ?? ""),
@@ -25,7 +25,7 @@ export const excelRSwtSttnParsing = (
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시
String(item.reuseBuilding?.[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding?.[0]?.instlCst ?? ""), //설치비용
item.reuseBuilding?.[0]?.rswtrObj?.orgwtKndCd ?? "", //원수종류
String(item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct ?? ""), //처리시설용량
String(item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct === -1 ? "확인불가" : item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct ?? ""), //처리시설용량
String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctProcs ?? ""), //주요처리공정
String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctUsgCd ?? ""), //이용용도
String(item.reuseBuilding?.[0]?.instlCstSprtYn ?? ""), //설치지원비용여부
+3 -1
View File
@@ -133,7 +133,9 @@ export function featurePopUpOpen(layerNm:string,featureCd:string,popupDetailRef)
const height =
String(layerNm) === "tb_wr_bdst_ruse_fclt"
? Math.floor(window.innerHeight - 100)
: Math.floor(window.innerHeight - 450); // 150px 여백 확보; // calc(100% - 70px)
: String(layerNm) === "tb_wr_ruse_fclt_dmd_co"
?Math.floor(window.innerHeight - 430)
: Math.floor(window.innerHeight - 300); // 150px 여백 확보; // calc(100% - 70px)
const left = (window.screen.availWidth - width) / 2;
const top = (window.screen.availHeight - height) / 2;
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes `;
@@ -1,7 +1,12 @@
import { useWrStore } from "@/app/store";
import { htdfMapSize } from "@/app/store/map/htdflMap";
import { rainMapSize } from "@/app/store/map/rainMap";
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import { getCity, tableData } from "@/components/lib/func/commom";
import {
excelDownload,
getCity,
tableData,
} from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import {
ContentsDiv,
@@ -17,15 +22,26 @@ import {
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
export function HtdflFacility({
rtnFeature,
}: {
rtnFeature: (feature: any) => void;
}) {
const { code, htdfMap, htdfMapInit,htdfMapSearch } = useWrStore((state) => state);
const { htdfMapCount, htdfMapRes, htdfSttHeadList, htdfSttNodeList } =
htdfMap;
const { code, htdfMap, htdfMapInit, htdfMapSearch } = useWrStore(
(state) => state
);
const { t } = useTranslation("base");
const {
htdfMapCount,
htdflMapExcelList,
htdfMapRes,
htdfSttHeadList,
htdfSttNodeList,
} = htdfMap;
const [htdflTable, setHtdflTable] = useState<customHtdflBdst[]>();
const [isReset, setIsReset] = useState(false);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
@@ -86,6 +102,19 @@ export function HtdflFacility({
setHtdflTable(chData);
}, [code, htdfMapRes]);
useEffect(() => {
if (htdflMapExcelList.length > 0) {
excelDownload(
htdflMapExcelList,
"온배수시설 현황",
"sample_htdflSttn.xlsx",
"A1:R3"
);
} else {
toast.error(t("excelDownErrMsg"));
}
}, [htdflMapExcelList]);
return (
<>
<ContentsDiv>
@@ -115,17 +144,50 @@ export function HtdflFacility({
/>
<SearchInput
className={"!text-3xl ml-4"}
label="회사명"
label="건물명"
textValue={seartchTxt ?? ""}
setText={(e) => {
setSearchTxt(e);
}}
/>
/>{" "}
<Button
className="mt-2 mx-4"
size={"sm"}
onClick={() => {
setIsReset(true);
}}
>
조회
</Button>
<Button
className="mt-2"
size={"sm"}
color="green"
onClick={() => {
const con =
objSearch.sgg && objSearch.sgg !== "0"
? objSearch.sgg
: objSearch.city;
if (con) {
htdfMapSearch(
true,
1,
"1000000",
String(con),
"",
code.cityCd,
code.sggCd
);
}
}}
>
엑셀다운로드
</Button>
</div>
</SearchFormLeft>
<SearchFormRight className="w-3/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
{/* <Button
className="mt-2"
size={"sm"}
onClick={() => {
@@ -134,13 +196,23 @@ export function HtdflFacility({
>
조회
</Button>
<Button
className="mt-2"
size={"sm"}
color="green"
onClick={() => {
setIsReset(true);
}}
>
엑셀다운로드
</Button> */}
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-2 gap-4 ">
<div className="col-span-2">
<div className="col-span-2">
<UiTable
headName={[]}
tableData={htdflTable || []}
@@ -156,16 +228,15 @@ export function HtdflFacility({
? objSearch.sgg
: objSearch.city;
if (con) {
if (seartchTxt && seartchTxt?.length > 0) {
htdfMapSearch(
page,
rainMapSize,
String(con),
seartchTxt ?? ""
);
} else {
htdfMapSearch(page, rainMapSize, String(con));
}
htdfMapSearch(
false,
page,
String(htdfMapSize),
String(con),
seartchTxt||'',
code.cityCd,
code.sggCd
);
setIsReset(false);
}
}}
@@ -1,7 +1,7 @@
import { useWrStore } from "@/app/store";
import { rainMapSize } from "@/app/store/map/rainMap";
import type { customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { getCity, tableData } from "@/components/lib/func/commom";
import { excelDownload, getCity, tableData } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import {
ContentsDiv,
@@ -17,6 +17,8 @@ import {
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
export function RainFacility({
rtnFeature,
@@ -26,7 +28,7 @@ export function RainFacility({
const { code, rainMap, rainMapInit, rainMapSearch } = useWrStore(
(state) => state
);
const { rainMapRes, rainMapCount, rainSttHeadList, rainSttNodeList } =
const { rainMapRes, rainMapExcelList,rainMapCount, rainSttHeadList, rainSttNodeList } =
rainMap;
const [rainTable, setRainTable] = useState<customRainBdst[]>();
const [isReset, setIsReset] = useState(false);
@@ -35,6 +37,7 @@ export function RainFacility({
sgg: "",
city: "",
});
const { t } = useTranslation('base');
const [seartchTxt, setSearchTxt] = useState<string>();
@@ -116,7 +119,18 @@ export function RainFacility({
.filter((item: any) => item.rainyObj !== undefined);
setRainTable(chData);
}, [code, rainMapRes]);
useEffect(() => {
if (rainMapExcelList.length > 0) {
excelDownload(
rainMapExcelList,
"빗물재이용시설 현황",
"sample_rainSttn.xlsx",
"A1:W3"
);
} else {
toast.error(t("excelDownErrMsg"));
}
}, [rainMapExcelList]);
return (
<>
<ContentsDiv>
@@ -146,17 +160,50 @@ export function RainFacility({
/>
<SearchInput
className={"!text-3xl ml-4"}
label="회사명"
label="건물명"
textValue={seartchTxt ?? ""}
setText={(e) => {
setSearchTxt(e);
}}
/>
<Button
className="mt-2 mx-4"
size={"sm"}
onClick={() => {
setIsReset(true);
}}
>
조회
</Button>
<Button
className="mt-2"
size={"sm"}
color="green"
onClick={() => {
const con =
objSearch.sgg && objSearch.sgg !== "0"
? objSearch.sgg
: objSearch.city;
if (con) {
rainMapSearch(
true,
1,
"1000000",
String(con),
"",
code.cityCd,
code.sggCd
);
}
}}
>
엑셀다운로드
</Button>
</div>
</SearchFormLeft>
<SearchFormRight className="w-3/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
{/* <Button
className="mt-2"
size={"sm"}
onClick={() => {
@@ -165,6 +212,15 @@ export function RainFacility({
>
조회
</Button>
<Button
className="mt-2"
size={"sm"}
color="green"
onClick={() => {
}}
>
엑셀다운로드
</Button> */}
</div>
</SearchFormRight>
</SearchDiv>
@@ -187,16 +243,16 @@ export function RainFacility({
? objSearch.sgg
: objSearch.city;
if (con) {
if (seartchTxt && seartchTxt?.length > 0) {
rainMapSearch(
page,
rainMapSize,
String(con),
seartchTxt ?? ""
);
} else {
rainMapSearch(page, rainMapSize, String(con));
}
rainMapSearch(
false,
page,
String(rainMapSize),
String(con),
seartchTxt ?? "",
code.cityCd,
code.sggCd
);
setIsReset(false);
}
}}
@@ -1,57 +1,71 @@
import { useWrStore } from "@/app/store";
import { rainMapSize } from "@/app/store/map/rainMap";
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
import { getCity, tableData } from "@/components/lib/func/commom";
import { excelDownload, getCity, tableData } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiTable,
type SelectDataType,
} from "@common/business_components/ui";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
export function RswtFacility({
rtnFeature,
}: {
rtnFeature: (feature: any) => void;
}) {
const { code, rswtMap, rswtMapInit,rswtMapSearch } = useWrStore((state) => state);
const { rswtMapRes, rswtMapCount, rswtSttHeadList, rswtSttNodeList } =
const { code, rswtMap, rswtMapInit, rswtMapSearch } = useWrStore(
(state) => state
);
const { rswtMapRes, rswtMapExcelList, rswtMapCount, rswtSttHeadList, rswtSttNodeList } =
rswtMap;
const [rswtrTable, setRswtrTable] = useState<customRswtBdst[]>();
const [isReset, setIsReset] = useState(false);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
const [objSearch, setObjSearch] = useState<objSearchType>({
sgg: "",
city: "",
});
const [seartchTxt, setSearchTxt] = useState<string>();
const getSelCity = useCallback(
(val: string | number) => {
const cityValue = String(val);
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "0" });
},
[code.sggCd]
);
const getSgg = useCallback((val: string | number) => {
setObjSearch((prev) => ({ ...prev, sgg: String(val) }));
}, []);
useEffect(() => {
// code.cityCd 데이터가 로드되었고, 아직 시/도 선택이 안된 초기 상태일 때 실행
if (code.cityCd && code.cityCd.length > 0 && !objSearch.city) {
const firstCityVal = code.cityCd[0]?.val;
if (firstCityVal) {
// 첫 번째 시/도 값으로 상태를 초기화합니다.
getSelCity(firstCityVal);
}
const [objSearch, setObjSearch] = useState<objSearchType>({
sgg: "",
city: "",
});
const { t } = useTranslation('base');
const [seartchTxt, setSearchTxt] = useState<string>();
const getSelCity = useCallback(
(val: string | number) => {
const cityValue = String(val);
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "0" });
},
[code.sggCd]
);
const getSgg = useCallback((val: string | number) => {
setObjSearch((prev) => ({ ...prev, sgg: String(val) }));
}, []);
useEffect(() => {
// code.cityCd 데이터가 로드되었고, 아직 시/도 선택이 안된 초기 상태일 때 실행
if (code.cityCd && code.cityCd.length > 0 && !objSearch.city) {
const firstCityVal = code.cityCd[0]?.val;
if (firstCityVal) {
// 첫 번째 시/도 값으로 상태를 초기화합니다.
getSelCity(firstCityVal);
}
}, [code.cityCd, objSearch.city, getSelCity]);
}
}, [code.cityCd, objSearch.city, getSelCity]);
const rswtCellClick = (index: number | undefined, headId: string) => {
if (
headId !== "chBuildingYn" &&
@@ -100,6 +114,19 @@ export function RswtFacility({
);
setRswtrTable(chData);
}, [code, rswtMapRes]);
useEffect(() => {
if (rswtMapExcelList.length > 0) {
excelDownload(
rswtMapExcelList,
"중수도시설 현황",
"sample_rswtSttn.xlsx",
"A1:W3",
);
} else {
toast.error(t('excelDownErrMsg'));
}
}, [rswtMapExcelList]);
return (
<>
<ContentsDiv>
@@ -129,18 +156,14 @@ export function RswtFacility({
/>
<SearchInput
className={"!text-3xl ml-4"}
label="회사명"
label="건물명"
textValue={seartchTxt ?? ""}
setText={(e) => {
setSearchTxt(e);
}}
/>
</div>
</SearchFormLeft>
<SearchFormRight className="w-3/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
className="mt-2"
className="mt-2 mx-4"
size={"sm"}
onClick={() => {
setIsReset(true);
@@ -148,6 +171,43 @@ export function RswtFacility({
>
조회
</Button>
<Button
className="mt-2"
size={"sm"}
color="green"
onClick={() => {
const con =
objSearch.sgg && objSearch.sgg !== "0"
? objSearch.sgg
: objSearch.city;
if (con) {
rswtMapSearch(
true,
1,
"1000000",
String(con),
"",
code.cityCd,
code.sggCd
);
}
}}
>
엑셀다운로드
</Button>
</div>
</SearchFormLeft>
<SearchFormRight className="w-3/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
{/* <Button
className="mt-2"
size={"sm"}
onClick={() => {
setIsReset(true);
}}
>
조회
</Button> */}
</div>
</SearchFormRight>
</SearchDiv>
@@ -166,22 +226,23 @@ export function RswtFacility({
}}
onPageChange={(page) => {
const con =
objSearch.sgg && objSearch.sgg !== "0"
? objSearch.sgg
: objSearch.city;
if (con) {
if (seartchTxt && seartchTxt?.length > 0) {
objSearch.sgg && objSearch.sgg !== "0"
? objSearch.sgg
: objSearch.city;
if (con) {
rswtMapSearch(
false,
page,
rainMapSize,
String(rainMapSize),
String(con),
seartchTxt ?? ""
seartchTxt ?? "",
code.cityCd,
code.sggCd
);
} else {
rswtMapSearch(page, rainMapSize, String(con));
setIsReset(false);
}
setIsReset(false);
}}}
}}
resetPageNo={isReset}
>
<HeadMakeColSpan upHeadList={rswtSttNodeList} />
@@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import { ruseMapSize } from "@/app/store/map/ruseMap";
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
import { yearOptions } from "@/components/lib/func/commom";
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
import {
ContentsDiv,
SearchBaseForm,
@@ -14,17 +14,20 @@ import {
} from "@common/business_components/ui";
import { Label } from "@common/components/ui";
import { useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
export function RuseFacility({
rtnFeature,
}: {
rtnFeature: (feature: any) => void;
}) {
const { code, ruseMap, ruseMapInit, getMapFlcts } = useWrStore(
const { code, ruseMap, ruseMapInit, getMapFlcts,ruseMapSearch } = useWrStore(
(state) => state
);
const { t } = useTranslation("base");
const { ruseMapCount, fclts, ruseMapRes,ruseMapHeadList } = ruseMap;
const { ruseMapCount, ruseExcelList,fclts, ruseMapRes,ruseMapHeadList } = ruseMap;
const [ruseTable, setRuseTable] = useState<WaterReuseFacility[]>();
const [isReset, setIsReset] = useState(false);
@@ -48,9 +51,26 @@ export function RuseFacility({
}
}, [ruseMap.isInit]);
useEffect(() => {
ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts);
ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts,false);
}, [fclts]);
useEffect(()=>{
if(ruseExcelList&&ruseExcelList.length>0){
if (ruseExcelList.length > 0) {
excelDownload(
ruseExcelList,
"하수재이용시설 현황",
"sample_pbnstSttn.xlsx",
"A1:U2",
3
);
} else {
toast.error(t('excelDownErrMsg'));
}
}
},[ruseExcelList])
useEffect(() => {
if (ruseMapRes && ruseMapRes.length > 0) {
setRuseTable(ruseMapRes);
@@ -113,7 +133,7 @@ export function RuseFacility({
ref={ref}
isAdmin={false}
excelClick={function (returnType: ReturnType): void {
console.log("pbnstSttnSearch ", returnType);
ruseMapInit(1,100000 , returnType, searchYear, fclts,true);
}}
/>
</div>
@@ -127,7 +147,12 @@ export function RuseFacility({
headName={""}
cellClick={ruseCellClick}
onPageChange={(page) => {
ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts);
if(pbnRuseNm&&pbnRuseNm.length>0){
ruseMapSearch(page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm)
}else{
ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts,false);
}
setIsReset(false);
}}
resetPageNo={isReset}