Merge remote-tracking branch 'origin/iipbs/wr/dev'
This commit is contained in:
@@ -143,6 +143,7 @@ const Map = () => {
|
||||
}
|
||||
select.selectFeature(foundFeature, true);
|
||||
} else {
|
||||
// toast.error('위치정보를 찾을수 없습니다')
|
||||
console.warn("OpenLayers Feature를 찾을 수 없습니다:");
|
||||
console.log("foundFeature :", foundFeature );
|
||||
console.warn("featureId : ", featureId);
|
||||
@@ -275,6 +276,8 @@ const Map = () => {
|
||||
onOpenPopup={(data: any) => {
|
||||
onOpenPopup(data);
|
||||
}}
|
||||
defaultZoom={7.5}
|
||||
defaultLonLat={[127.75, 36]}
|
||||
/>
|
||||
<Toaster position="top-center" />
|
||||
</div>
|
||||
|
||||
@@ -82,6 +82,8 @@ export default function MapDrgtPopUp() {
|
||||
checkInterval={2500}
|
||||
height={`h-[100vh]`}
|
||||
droughtDates={{ startYmd: fromDate, endYmd: toDate }}
|
||||
defaultZoom={7.5}
|
||||
defaultLonLat={[127.75, 36]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ export function SearchBar({ gisMaps, ctpvCode, sggCode }: CtpvSggPrcsFcltSelectB
|
||||
async function fetchCtpvData() {
|
||||
try {
|
||||
const ctpvData = await fetch(`/geoserver/hasudo/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=hasudo%3Atb_ms_ctpv&outputFormat=application%2Fjson&cql_filter=mctpv_cd=%27${ctpvCd.trim()}%27&srsName=EPSG:5179`)
|
||||
.then(res => res.json());
|
||||
.then(res => res.json());
|
||||
console.log('시도 데이터', ctpvData.features[0]);
|
||||
|
||||
const format = new GeoJSON();
|
||||
@@ -110,10 +110,48 @@ export function SearchBar({ gisMaps, ctpvCode, sggCode }: CtpvSggPrcsFcltSelectB
|
||||
const url = `/geoserver/hasudo/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=hasudo:tb_ms_ctpv&outputFormat=application/json&propertyName=mctpv_korn_nm,mctpv_cd`;
|
||||
const res = await fetch(url).then(res => res.json());
|
||||
|
||||
const list = res.features.map((f: any) => ({
|
||||
text: f.properties.mctpv_korn_nm,
|
||||
val: f.properties.mctpv_cd,
|
||||
}));
|
||||
const list = res.features
|
||||
.map((f: any) => ({
|
||||
text: f.properties.mctpv_korn_nm,
|
||||
val: f.properties.mctpv_cd,
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
// 커스텀 순서 정의
|
||||
const customOrder = [
|
||||
"서울특별시",
|
||||
"부산광역시",
|
||||
"대구광역시",
|
||||
"인천광역시",
|
||||
"광주광역시",
|
||||
"대전광역시",
|
||||
"울산광역시",
|
||||
"세종특별자치시",
|
||||
"경기도",
|
||||
"강원특별자치도", // 경기도 다음에 배치
|
||||
"충청북도",
|
||||
"충청남도",
|
||||
"전북특별자치도", // 충청남도 다음에 배치
|
||||
"전라남도",
|
||||
"경상북도",
|
||||
"경상남도",
|
||||
"제주특별자치도"
|
||||
];
|
||||
|
||||
const indexA = customOrder.indexOf(a.text);
|
||||
const indexB = customOrder.indexOf(b.text);
|
||||
|
||||
// 둘 다 커스텀 순서에 있으면 해당 순서로
|
||||
if (indexA !== -1 && indexB !== -1) {
|
||||
return indexA - indexB;
|
||||
}
|
||||
|
||||
// 하나만 커스텀 순서에 있으면 그것을 앞으로
|
||||
if (indexA !== -1) return -1;
|
||||
if (indexB !== -1) return 1;
|
||||
|
||||
// 둘 다 커스텀 순서에 없으면 기본 알파벳 순서
|
||||
return a.text.localeCompare(b.text, 'ko');
|
||||
});
|
||||
|
||||
console.log('시도 데이터', list);
|
||||
setCtpv(list);
|
||||
@@ -126,7 +164,7 @@ export function SearchBar({ gisMaps, ctpvCode, sggCode }: CtpvSggPrcsFcltSelectB
|
||||
const list = res.features.map((f: any) => ({
|
||||
text: f.properties.sgg_korn_nm,
|
||||
val: f.properties.sgg_cd,
|
||||
}));
|
||||
})).sort((a, b) => a.text.localeCompare(b.text, 'ko'));
|
||||
|
||||
setSgg(list);
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function MapFeaturePopup() {
|
||||
return (
|
||||
<>
|
||||
{isDetail ? (
|
||||
<div className="fixed inset-0 w-screen h-screen m-0 p-0 bg-white">
|
||||
<div className="m-0 bg-white p-4 md:p-6 pb-24 box-border">
|
||||
{layerNm === "tb_wr_bdst_ruse_fclt" ? (
|
||||
<RuseDetailPopup bscFctCd={isDetail} />
|
||||
) : layerNm === "tb_il_swage_prcs_fclt" ? (
|
||||
|
||||
@@ -220,6 +220,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
setSelectRow(pbnstHasuRes?.[val]);
|
||||
if (selectRow) {
|
||||
pbnstRegClick(selectRow);
|
||||
setIndexMng(0)
|
||||
} else {
|
||||
console.error("선택된 행이 없습니다.");
|
||||
}
|
||||
@@ -236,6 +237,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}, [indexMng]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) {
|
||||
form.reset({ items: pbnst.pbnstRes });
|
||||
} else {
|
||||
@@ -426,6 +428,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}
|
||||
}}
|
||||
onInvalid={onInvalid}
|
||||
newIndexMng={(formWatch?.length -1)}
|
||||
></PbnstRegModal>
|
||||
}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
|
||||
@@ -237,11 +237,13 @@ export default function PbnstSttn() {
|
||||
/>
|
||||
<UiModal
|
||||
body={
|
||||
<PbnstSttnModal
|
||||
data={pbnDetaileData.data || ({} as customPbnst)}
|
||||
></PbnstSttnModal>
|
||||
<div className="flex-1 min-h-0 overflow-auto p-4 md:p-6">
|
||||
<PbnstSttnModal
|
||||
data={pbnDetaileData.data || ({} as customPbnst)}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh] overflow-hidden flex flex-col min-h-0"
|
||||
open={pbnDetaileData.isModal}
|
||||
onOpenChange={(open) => {
|
||||
//TODO:OPEN 상태 확인필요
|
||||
|
||||
@@ -132,7 +132,7 @@ export default function RswtStat() {
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
|
||||
// 시도별 합계 계산
|
||||
transformedRswtDetailList.forEach((item: RswtStatProps[]) => {
|
||||
const sidoText = item[0]?.toString();
|
||||
@@ -144,18 +144,21 @@ export default function RswtStat() {
|
||||
sidoData[i] = '합계';
|
||||
} else if (i == 3) {
|
||||
// 해당 시도의 데이터 개수를 계산
|
||||
const sidoDataCount = rswtDetailList.filter((data: unknown[]) =>
|
||||
Array.isArray(data) && data.length > 0 && String(data[0]) === sidoText
|
||||
).length;
|
||||
sidoData[i] = sidoDataCount;
|
||||
if (typeof sidoData[i] === "number") {
|
||||
sidoData[i] = (sidoData[i] as number) + 1;
|
||||
} else if ((sidoData[i] === undefined || isNaN(Number(sidoData[i])))) {
|
||||
sidoData[i] = 1;
|
||||
}
|
||||
} else if (i == 4) {
|
||||
sidoData[i] = '';
|
||||
} else if (i == 6) {
|
||||
// 법정 대상 건축물 개수 (인덱스 6이 'Y'인 경우)
|
||||
const bumCnt = rswtDetailList.filter((data: unknown[]) =>
|
||||
Array.isArray(data) && data.length > 6 && String(data[0]) === sidoText
|
||||
).filter((data: unknown[]) => String(data[6]) === '대상').length;
|
||||
sidoData[i] = bumCnt;
|
||||
|
||||
if (item[i]?.toString() == '대상'&&typeof sidoData[i] === "number") {
|
||||
sidoData[i] = (sidoData[i] as number) + 1;
|
||||
} else if (item[i]?.toString() == '대상'&&(sidoData[i] === undefined || isNaN(Number(sidoData[i])))) {
|
||||
sidoData[i] = 1;
|
||||
}
|
||||
} else if (i == 9) {
|
||||
const value = Number(item[9]) || 0;
|
||||
sidoData[i] = (Number(sidoData[i]) + value) as string | number;
|
||||
@@ -256,14 +259,14 @@ export default function RswtStat() {
|
||||
<Button
|
||||
className=""
|
||||
size="sm"
|
||||
onClick={() => excelClick()}
|
||||
onClick={excelClick}
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
<Button
|
||||
className=""
|
||||
size="sm"
|
||||
onClick={() => { excelDetailDownLoad() }}
|
||||
onClick={excelDetailDownLoad}
|
||||
>
|
||||
전체통계다운로드
|
||||
</Button>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
export const excelHasuMapParsing = (
|
||||
excel:{data:any[]}
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
excel.data.forEach((item) => {
|
||||
|
||||
excelExportData.push([
|
||||
item.sido??'',
|
||||
item.gugun??'',
|
||||
item.bscFctNm ?? "",
|
||||
String(item.addr??""),
|
||||
item.efflWqltStndrdNm ?? "",
|
||||
String(item.fctCpc ?? ""),
|
||||
String(item.ruse ?? ""),
|
||||
String(item.rswtrYn ?? ""),
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
};
|
||||
@@ -1,9 +1,10 @@
|
||||
import { fetchType, postFectch } from "@/components/lib/api";
|
||||
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { checkWrRegList } from "../../ruseFcltMng/fcltReg/pbnstReg";
|
||||
import type { ReturnType } from "@common/business_components/ui";
|
||||
import type { ReturnType} from "@common/business_components/ui";
|
||||
import { pubFacHeadListExport } from "../../ruseFcltMng/fcltReg/pbnstReg/headList";
|
||||
import type { TableUpperProps } from "../../common/type/header";
|
||||
import { excelHasuMapParsing } from "./excel";
|
||||
|
||||
export const pbnMapTableSize = 20;
|
||||
|
||||
@@ -61,12 +62,23 @@ export type pbnMapState = {
|
||||
pbnMapRes: pubHasuType[];
|
||||
pbnMapCount: number;
|
||||
pbnMapHeadList: TableUpperProps[];
|
||||
hasuMapExcelList:[]
|
||||
};
|
||||
};
|
||||
|
||||
type pbnMapActions = {
|
||||
pbnMapInit: (page: number, pageTotal: number, reurnValue: ReturnType) => void;
|
||||
pbnMapDetaile: (featureCd: string, data: string) => Promise<pubHasuType | undefined>;
|
||||
pbnMapSearch: (
|
||||
isExcel: boolean,
|
||||
page: number,
|
||||
pageTotal: number,
|
||||
reurnValue: ReturnType,
|
||||
txt: string,
|
||||
) => void;
|
||||
pbnMapDetaile: (
|
||||
featureCd: string,
|
||||
data: string
|
||||
) => Promise<pubHasuType | undefined>;
|
||||
};
|
||||
|
||||
export type pbnMapType = pbnMapState & pbnMapActions;
|
||||
@@ -77,6 +89,7 @@ export const pbnMapStateExport: pbnMapState = {
|
||||
pbnMapRes: [],
|
||||
pbnMapCount: 1,
|
||||
pbnMapHeadList: pubFacHeadListExport,
|
||||
hasuMapExcelList:[]
|
||||
},
|
||||
};
|
||||
|
||||
@@ -124,5 +137,44 @@ export const pbnMapActionsExport: (set: any) => pbnMapActions = (set: any) => {
|
||||
throw error; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
},
|
||||
pbnMapSearch: async (
|
||||
isExcel: boolean,
|
||||
page: number,
|
||||
pageTotal: number,
|
||||
reurnValue: ReturnType,
|
||||
txt: string,
|
||||
) => {
|
||||
try {
|
||||
const hasuMapRes = await hasuListFetch(page, pageTotal, reurnValue, txt);
|
||||
if (isExcel) {
|
||||
const hasuMapExcelList = excelHasuMapParsing(
|
||||
hasuMapRes
|
||||
);
|
||||
set((state: pbnMapState) => {
|
||||
return {
|
||||
...state,
|
||||
pbnMap: {
|
||||
...state.pbnMap,
|
||||
hasuMapExcelList: hasuMapExcelList
|
||||
},
|
||||
};
|
||||
});
|
||||
} else {
|
||||
set((state: pbnMapState) => {
|
||||
return {
|
||||
...state,
|
||||
pbnMap: {
|
||||
...state.pbnMap,
|
||||
pbnMapRes: hasuMapRes.data,
|
||||
pbnMapCount: hasuMapRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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[];
|
||||
@@ -31,11 +33,19 @@ type ruseMapActions = {
|
||||
year: string,
|
||||
fclts: string[]
|
||||
) => void;
|
||||
ruseMapSearch: (
|
||||
isExcel: boolean,
|
||||
page: number,
|
||||
total: number,
|
||||
reurnValue: ReturnType,
|
||||
year: string,
|
||||
fclts: string[],
|
||||
fcltNm: string
|
||||
) => void;
|
||||
ruseMapDetail: (ruseFcltId: string) => Promise<customPbnst | undefined>;
|
||||
getRuseMaplList: (bscFctCd: string) => void;
|
||||
};
|
||||
|
||||
|
||||
export type ruseMapType = ruseMapState & ruseMapActions;
|
||||
|
||||
export const ruseMapStateExport: ruseMapState = {
|
||||
@@ -45,6 +55,7 @@ export const ruseMapStateExport: ruseMapState = {
|
||||
ruseDetailList: [],
|
||||
fclts: [],
|
||||
ruseMapCount: 1,
|
||||
ruseExcelList: [],
|
||||
ruseMapHeadList: pbnSttHeadListExport,
|
||||
ruseMapNodeList: pbnstSttNodeListExport,
|
||||
},
|
||||
@@ -80,7 +91,6 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
|
||||
year,
|
||||
fclts
|
||||
);
|
||||
|
||||
set((state: ruseMapState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -148,5 +158,51 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
|
||||
throw errorHasu; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
},
|
||||
ruseMapSearch: async (
|
||||
isExcel: boolean,
|
||||
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
|
||||
);
|
||||
if (isExcel) {
|
||||
const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data);
|
||||
set((state: ruseMapState) => {
|
||||
return {
|
||||
...state,
|
||||
ruseMap: {
|
||||
...state.ruseMap,
|
||||
ruseExcelList: ruseMapExcel,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else {
|
||||
set((state: ruseMapState) => {
|
||||
return {
|
||||
...state,
|
||||
ruseMap: {
|
||||
...state.ruseMap,
|
||||
ruseMapRes: ruseMapRes.data,
|
||||
ruseMapCount: ruseMapRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
// };
|
||||
@@ -172,9 +172,16 @@ console.log("rainChkgdData", rainChkgdData);
|
||||
` 연간운영비(원/년): 숫자 형식 아님 /입력값:${rain.anlOperCst}`
|
||||
);
|
||||
}
|
||||
if (rain.oilqMeasMthd.length > 1 && !chkMngType.includes(rain.oilqMeasMthd)) {
|
||||
|
||||
if (rain.operMngCd.length > 1 && !chkMngType.includes(rain.operMngCd)) {
|
||||
issues.push(
|
||||
defaultMessage + `유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
|
||||
defaultMessage + `운영관리 형태: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
|
||||
);
|
||||
}
|
||||
|
||||
if (rain.oilqMeasMthd.length > 1 && !chkSpwtPositnType.includes(rain.oilqMeasMthd)) {
|
||||
issues.push(
|
||||
defaultMessage + `유량측정방법: 유량계, 수위계, 펌프적산전력계, 기타) /입력값:${rain.oilqMeasMthd}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
isInvalidDate,
|
||||
isInvalidNumber,
|
||||
parseCommaRawValue,
|
||||
parseRawValue,
|
||||
} from "@/components/lib/func/excelFunc";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { rswtChkZodType } from ".";
|
||||
import {
|
||||
chkSpwtPositnType,
|
||||
useTypes,
|
||||
type Buildingtype
|
||||
} from "../rainChkgdn/excel";
|
||||
@@ -137,7 +137,6 @@ export const rswtMakeExcelSample = (
|
||||
export const excelToRswtGuideData = (
|
||||
excelData: any,
|
||||
year: string,
|
||||
issues: string[]
|
||||
) => {
|
||||
const rswtChkgdData: rswtChkZodType[] = excelData
|
||||
.map((item: any) => {
|
||||
@@ -160,7 +159,7 @@ export const excelToRswtGuideData = (
|
||||
return {
|
||||
bdstRuseFcltSn: Number(item["NO"]),
|
||||
operMngCd: item["운영관리형태"],
|
||||
anlOperCst: parseRawValue(item[`연간운영비(원/년)`]),
|
||||
anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]),
|
||||
prcsCpct: parseRawValue(item[`처리용량(m³)`]),
|
||||
spwtPositn: item["채수지점"],
|
||||
chckYmd: checkYmd,
|
||||
@@ -174,18 +173,15 @@ export const excelToRswtGuideData = (
|
||||
})
|
||||
.filter((el: any) => el !== undefined);
|
||||
|
||||
if (rswtChkgdData.length > 0) {
|
||||
rswtExcelDataCheck(rswtChkgdData, issues);
|
||||
}
|
||||
|
||||
if (issues.length > 0) {
|
||||
return { data: [], issues };
|
||||
}
|
||||
|
||||
return { data: rswtChkgdData, issues: [] };
|
||||
return rswtChkgdData
|
||||
};
|
||||
|
||||
export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||
|
||||
|
||||
|
||||
export const excelToRswtPolution = (excelData: any) => {
|
||||
|
||||
const rswtChkgdData: rswtChkZodType[] = excelData
|
||||
.map((item: any) => {
|
||||
if (item["점검일"] !== undefined) {
|
||||
@@ -203,11 +199,11 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||
const combResdch = parseRawValue(item[`${quarter}분기_결합잔류염소`]);
|
||||
const trbt = parseRawValue(item[`${quarter}분기_탁도`]);
|
||||
const bod = parseRawValue(item[`${quarter}분기_BOD`]);
|
||||
const smll = parseRawValue(item[`${quarter}분기_냄새`]);
|
||||
const smll = String(item[`${quarter}분기_냄새`]);
|
||||
const crmty = parseRawValue(item[`${quarter}분기_색도`]);
|
||||
const tph = parseRawValue(item[`${quarter}분기_T-P`]);
|
||||
const tn = parseRawValue(item[`${quarter}분기_T-N`]);
|
||||
const ph = parseRawValue(item[`${quarter}분기_PH`]);
|
||||
const ph = String(item[`${quarter}분기_PH`]) ;
|
||||
const clIonQnt = parseRawValue(item[`${quarter}분기_염화물`]);
|
||||
return {
|
||||
node: quarter,
|
||||
@@ -226,12 +222,13 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||
mdfr: TEST_UUID,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
bdstRuseFcltSn: Number(item["NO"]),
|
||||
chckYmd: checkYmd,
|
||||
utztnUsgCd: item["이용용도"],
|
||||
operMngCd: item["운영관리형태"],
|
||||
anlOperCst: parseRawValue(item["연간운영비(원/년)"]),
|
||||
anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]),
|
||||
prcsCpct: parseRawValue(item["처리용량(m³)"]),
|
||||
spwtPositn: item["채수지점"],
|
||||
rswtrPollutions: makePoluttion,
|
||||
@@ -251,21 +248,22 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||
}
|
||||
})
|
||||
.filter((el: any) => el !== undefined);
|
||||
if (rswtChkgdData.length > 0) {
|
||||
rswtExcelDataCheck(rswtChkgdData, issues);
|
||||
}
|
||||
// if (rswtChkgdData.length > 0) {
|
||||
// rswtExcelDataCheck(rswtChkgdData, issues);
|
||||
// }
|
||||
|
||||
if (issues.length > 0) {
|
||||
return { data: [], issues };
|
||||
}
|
||||
// if (issues.length > 0) {
|
||||
// return { data: [], issues };
|
||||
// }
|
||||
|
||||
return { data: rswtChkgdData, issues: [] };
|
||||
return rswtChkgdData
|
||||
};
|
||||
|
||||
const rswtExcelDataCheck = (
|
||||
export const rswtExcelDataCheck = (
|
||||
rswtChkgdData: rswtChkZodType[],
|
||||
issues: string[]
|
||||
) => {
|
||||
|
||||
rswtChkgdData.forEach((rswt: any) => {
|
||||
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
|
||||
|
||||
@@ -273,6 +271,7 @@ const rswtExcelDataCheck = (
|
||||
issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`);
|
||||
}
|
||||
if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) {
|
||||
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
` 연간운영비(원/년): 숫자 형식 아님 (${rswt.anlOperCst})`
|
||||
@@ -283,15 +282,15 @@ const rswtExcelDataCheck = (
|
||||
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
|
||||
);
|
||||
}
|
||||
if (
|
||||
rswt.spwtPositn.length > 1 &&
|
||||
!chkSpwtPositnType.includes(rswt.spwtPositn)
|
||||
) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}`
|
||||
);
|
||||
}
|
||||
// if (
|
||||
// rswt.spwtPositn.length > 1 &&
|
||||
// !chkSpwtPositnType.includes(rswt.spwtPositn)
|
||||
// ) {
|
||||
// issues.push(
|
||||
// defaultMessage +
|
||||
// `채수지점 : 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}`
|
||||
// );
|
||||
// }
|
||||
|
||||
if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) {
|
||||
rswt.rswtrPollutions.forEach((pol) => {
|
||||
@@ -318,12 +317,6 @@ const rswtExcelDataCheck = (
|
||||
defaultMessage + `${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
|
||||
);
|
||||
}
|
||||
if (isInvalidNumber(pol.smll)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`${pol.node}분기_냄새: 숫자 형식 아님 (${pol.smll})`
|
||||
);
|
||||
}
|
||||
if (isInvalidNumber(pol.crmty)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
@@ -340,20 +333,16 @@ const rswtExcelDataCheck = (
|
||||
defaultMessage + `${pol.node}분기_T-N: 숫자 형식 아님 (${pol.tn})`
|
||||
);
|
||||
}
|
||||
if (isInvalidNumber(pol.ph)) {
|
||||
issues.push(
|
||||
defaultMessage + `${pol.node}분기_PH: 숫자 형식 아님 (${pol.ph})`
|
||||
);
|
||||
|
||||
if (isInvalidNumber(pol.clIonQnt)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`${pol.node}분기_PH: 숫자 형식 아님 (${pol.clIonQnt})`
|
||||
`${pol.node}분기_염소이온량: 숫자 형식 아님 (${pol.clIonQnt})`
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (rswt?.rswtrDetails && rswt?.rswtrDetails.length > 0) {
|
||||
rswt?.rswtrDetails.forEach((key) => {
|
||||
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
|
||||
|
||||
@@ -285,6 +285,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
@@ -361,7 +362,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes,
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
|
||||
@@ -232,16 +232,18 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
if( response.status === 200) {
|
||||
toast.success(`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`);
|
||||
}
|
||||
const pbnstHasuRes = await hasuListFetch('1', '0');
|
||||
|
||||
const newPbnstRes = await initFetch(pbnstRes.pbnstRuseFcltId.slice(0, 11));
|
||||
return set((state: pubFacState) => ({
|
||||
...state,
|
||||
pbnst: {
|
||||
...state.pbnst,
|
||||
pbnstHasuRes: pbnstHasuRes.data,
|
||||
pbnstHasuResCount:pbnstHasuRes.count,
|
||||
isInit: false,
|
||||
pbnstRes: newPbnstRes,
|
||||
// isInit: false,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error updating pbnst:", error);
|
||||
}
|
||||
|
||||
@@ -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 ?? ""), //설치지원비용여부
|
||||
|
||||
@@ -50,7 +50,13 @@ const excelDownList: ExcelType[] = [];
|
||||
|
||||
const fetchRainStatList = async (year: string) => {
|
||||
const res = await getFetch(fetchType.WR, `/reuseChk/rainy/stat/${year}`);
|
||||
return res;
|
||||
|
||||
|
||||
return res.map((item) => ({
|
||||
...item,
|
||||
instlCst:item.instlCst<0?0:item.instlCst,
|
||||
dtfcltCpct:item.dtfcltCpct<0?0:item.dtfcltCpct
|
||||
}));
|
||||
};
|
||||
|
||||
type rainStatActions = {
|
||||
@@ -83,7 +89,8 @@ export const rainStatActionsExport = (
|
||||
searchRainStatList: async (year: string, city: SelectDataType[]) => {
|
||||
const res = await fetchRainStatList(year);
|
||||
const cityArr: any[] = [];
|
||||
|
||||
|
||||
console.log('res ', res)
|
||||
|
||||
res.filter((resFilter: RainStatProps) =>
|
||||
city.some((cityCd) =>
|
||||
@@ -209,6 +216,7 @@ export const rainStatActionsExport = (
|
||||
utztnUsgCd: utztnUsgArray.join(", "),
|
||||
});
|
||||
});
|
||||
|
||||
const excelDetailData = excelRainStat(rainDetailList);
|
||||
/* const rainStatHeadList = data.map((item:RainStatProps) => ({
|
||||
...item,
|
||||
@@ -230,8 +238,6 @@ export const rainStatActionsExport = (
|
||||
yearMoney:item.yearMoney,
|
||||
})) */
|
||||
|
||||
console.log(" cityArr ", cityArr);
|
||||
console.log(" excelDownList ", excelDownList);
|
||||
|
||||
cityArr.unshift(totalObj);
|
||||
set((state: rainStatState) => ({
|
||||
|
||||
@@ -173,7 +173,6 @@ export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
|
||||
|
||||
export const safeDate = (value: any): Date | undefined => {
|
||||
const date = new Date(value);
|
||||
console.log(' date ', date)
|
||||
return isNaN(date.getTime()) ? undefined : date;
|
||||
};
|
||||
|
||||
@@ -181,8 +180,8 @@ const currentYear = new Date().getFullYear();
|
||||
export const yearOptions: { val: string; text: string }[] = Array.from(
|
||||
{ length: currentYear - 1969 },
|
||||
(_, i) => ({
|
||||
val: String(1970 + i),
|
||||
text: `${1970 + i}년`,
|
||||
val: String(currentYear - i),
|
||||
text: `${currentYear - i}년`,
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -12,6 +12,23 @@ export const isInvalidNumber = (val: any) => {
|
||||
if (val === "" || val === undefined || val === null) return 0;
|
||||
if (typeof val === "string" && ["보류", "N/A"].includes(val.trim()))
|
||||
return val;
|
||||
return !isNaN(val) && val !== " " ? Number(val) : val;
|
||||
return !isNaN(val) && val !== " " ? Number(val.replaceAll(',','')) : val;
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const parseCommaRawValue = (val: any): number | string => {
|
||||
if (val === "" || val === undefined || val === null) return 0;
|
||||
|
||||
// 문자열이고 "보류"나 "N/A"면 그대로 반환
|
||||
if (typeof val === "string" && ["보류", "N/A"].includes(val.trim())) {
|
||||
return val;
|
||||
}
|
||||
|
||||
// 문자열에 쉼표가 있으면 제거
|
||||
if (typeof val === "string" && val.includes(",")) {
|
||||
val = val.replace(/,/g, "");
|
||||
}
|
||||
|
||||
// 숫자로 변환 가능하면 숫자로, 아니면 그대로
|
||||
return !isNaN(val) && val !== " " ? Number(val) : val;
|
||||
};
|
||||
@@ -9,7 +9,7 @@ const wrLayerList = [
|
||||
];
|
||||
const wrFeaturePK = [
|
||||
{ text: "bscFctCd", val: "tb_il_swage_prcs_fclt" },
|
||||
{ text: "pbnstRuseFcltId", val: "tb_wr_bdst_ruse_fclt" },
|
||||
{ text: "searchPk", val: "tb_wr_bdst_ruse_fclt" },
|
||||
{ text: "bdstInfoSn", val: "tb_wr_rnwtr_utztn_fclt" },
|
||||
{ text: "bdstInfoSn", val: "tb_wr_rswtr_fclt" },
|
||||
{ text: "bdstInfoSn", val: "tb_wr_htdfl_fclt" },
|
||||
@@ -26,11 +26,12 @@ const wrFeaturePK = [
|
||||
// { text: "잠재수요처", val: "tb_wr_tmpr_dmd_co" },
|
||||
|
||||
export const getFeatureCd = (featurePropertise: any, layerNm: string) => {
|
||||
|
||||
console.log('featurePropertise ', featurePropertise)
|
||||
const featureCd =
|
||||
layerNm === "tb_wr_bdst_ruse_fclt"
|
||||
? featurePropertise?.swtrmt_fclt_cd
|
||||
: [
|
||||
"tb_wr_ruse_fclt_dmd_co",
|
||||
"tb_wr_rswtr_fclt",
|
||||
"tb_wr_htdfl_fclt",
|
||||
"tb_wr_rnwtr_utztn_fclt",
|
||||
@@ -39,6 +40,8 @@ export const getFeatureCd = (featurePropertise: any, layerNm: string) => {
|
||||
? featurePropertise?.bdst_nm
|
||||
: layerNm === "tb_il_swage_prcs_fclt"
|
||||
? featurePropertise?.swtrmt_fclt_nm
|
||||
: layerNm === "tb_wr_ruse_fclt_dmd_co"?
|
||||
featurePropertise?.bdst_info_sn
|
||||
: null;
|
||||
|
||||
return featureCd;
|
||||
@@ -125,15 +128,18 @@ export function featurePopUpOpen(layerNm:string,featureCd:string,popupDetailRef)
|
||||
const url = `/mapFeaturePopup?layerNm=${encodeURIComponent(String(layerNm))}&featureCd=${encodeURIComponent(featureCd)} `;
|
||||
const width =
|
||||
String(layerNm) === "tb_wr_bdst_ruse_fclt"
|
||||
? Math.floor(window.innerWidth * 0.8)
|
||||
? Math.floor(window.innerWidth * 0.6)
|
||||
: Math.floor(window.innerWidth * 0.4); // 화면 폭의 40%
|
||||
const height =
|
||||
String(layerNm) === "tb_wr_bdst_ruse_fclt"
|
||||
? Math.floor(window.innerHeight - 150)
|
||||
: Math.floor(window.innerHeight - 450); // 150px 여백 확보; // calc(100% - 70px)
|
||||
? Math.floor(window.innerHeight - 100)
|
||||
: 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`;
|
||||
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes `;
|
||||
|
||||
popupDetailRef.current = window.open(
|
||||
url,
|
||||
"지도 시설 상세정보 팝업",
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from "@common/business_components/ui";
|
||||
import { Form, FormField } from "@common/business_components/ui/form";
|
||||
import { Button, Input } from "@common/components";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useFieldArray, type UseFormReturn } from "react-hook-form";
|
||||
import {
|
||||
commonButonSize,
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
} from "@/components/lib/class/comClass";
|
||||
import { TusClientUpload } from "@/components/lib/useTus_wr/useTusWr";
|
||||
import {
|
||||
type fcFileType,
|
||||
type PbnstRegArrrayType,
|
||||
type selectLabel,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
@@ -52,15 +51,11 @@ export function PbnstMngForm({
|
||||
const { code, pbnst, fileDelete, fileDownLoad } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const fileInitRef = useRef<{ index: number; key: string } | null>(null);
|
||||
const [regFileList, setRegFileList] = useState<fcFileType[] | null>(null);
|
||||
const [planFiles, setPlanFiles] = useState<FilesType[] | null>(null);
|
||||
const [relationfiles, setRelationFiles] = useState<FilesType[] | null>(null);
|
||||
const [fcltNm, setFcltNm] = useState<selectLabel[] | null>(null);
|
||||
const [mngMtdCode, setMngMtdCode] =
|
||||
useState<{ name: string; val: SelectDataType[] }[]>();
|
||||
|
||||
|
||||
const {
|
||||
fields: fcOpersField,
|
||||
prepend,
|
||||
@@ -155,35 +150,30 @@ export function PbnstMngForm({
|
||||
}
|
||||
};
|
||||
|
||||
const regFileFilter = (
|
||||
files: FilesType[],
|
||||
fileKnd: string,
|
||||
regFile: fcFileType[]
|
||||
) => {
|
||||
const exFileDatas =
|
||||
regFile?.filter((item) => item.fileKnd !== fileKnd) || [];
|
||||
const currentdata = files.map((item) => ({
|
||||
fileTkn: item.atflCd,
|
||||
filePath: item.file.name,
|
||||
fileKnd: fileKnd,
|
||||
rgtr: TEST_UUID,
|
||||
mdfr: TEST_UUID,
|
||||
}));
|
||||
return [...exFileDatas, ...currentdata];
|
||||
};
|
||||
// const regFileFilter = (
|
||||
// files: FilesType[],
|
||||
// fileKnd: string,
|
||||
// regFile: fcFileType[]
|
||||
// ) => {
|
||||
// const exFileDatas =
|
||||
// regFile?.filter((item) => item.fileKnd !== fileKnd) || [];
|
||||
// const currentdata = files.map((item) => ({
|
||||
// fileTkn: item.atflCd,
|
||||
// filePath: item.file.name,
|
||||
// fileKnd: fileKnd,
|
||||
// rgtr: TEST_UUID,
|
||||
// mdfr: TEST_UUID,
|
||||
// }));
|
||||
// return [...exFileDatas, ...currentdata];
|
||||
// };
|
||||
|
||||
useEffect(() => {
|
||||
setRelationFiles([]);
|
||||
setPlanFiles([]);
|
||||
console.log("indexMng ", indexMng);
|
||||
|
||||
const currentItem = form.getValues(`items.${indexMng}`);
|
||||
const currentKey = JSON.stringify(currentItem);
|
||||
const isNewItem =
|
||||
!fileInitRef.current ||
|
||||
fileInitRef.current.index !== indexMng ||
|
||||
fileInitRef.current.key !== currentKey;
|
||||
|
||||
if (!isNewItem) return; //
|
||||
|
||||
const defaultFiles = currentItem?.fcFiles || [];
|
||||
|
||||
const relationFileList = defaultFiles.filter(
|
||||
(item) => item.fileKnd === "계통도"
|
||||
);
|
||||
@@ -199,7 +189,6 @@ export function PbnstMngForm({
|
||||
}))
|
||||
: null
|
||||
);
|
||||
|
||||
setPlanFiles(
|
||||
planFileList.length > 0
|
||||
? planFileList.map((item) => ({
|
||||
@@ -208,16 +197,10 @@ export function PbnstMngForm({
|
||||
}))
|
||||
: null
|
||||
);
|
||||
// ✅ 다음 루프에선 다시 안 하도록 저장
|
||||
fileInitRef.current = {
|
||||
index: indexMng,
|
||||
key: currentKey,
|
||||
};
|
||||
}, [indexMng, form.getValues(`items.${indexMng}`)]);
|
||||
}, [form.getValues(`items.${indexMng}`)]);
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
//폼이 들어오면 폼에 대한 이름 셀렉트박스를만들기 위해
|
||||
if (mngRegForm && mngRegForm.length >= 0) {
|
||||
const fcltNmList = mngRegForm?.map((item, index) => ({
|
||||
text: item.ruseUtztnFcltNm,
|
||||
@@ -231,20 +214,33 @@ export function PbnstMngForm({
|
||||
[mngRegForm]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (regFileList && regFileList?.length > 0) {
|
||||
form.setValue(`items.${indexMng}.fcFiles`, regFileList);
|
||||
}
|
||||
}, [regFileList, indexMng]);
|
||||
|
||||
const formFileChange = (file: FilesType[], type: string) => {
|
||||
return file?.map((item) => ({
|
||||
fileTkn: item.atflCd,
|
||||
filePath: item.file.name,
|
||||
fileKnd: type,
|
||||
rgtr: TEST_UUID,
|
||||
mdfr: TEST_UUID,
|
||||
}));
|
||||
};
|
||||
useEffect(() => {
|
||||
if (relationfiles) {
|
||||
setRegFileList(regFileFilter(relationfiles, "계통도", regFileList || []));
|
||||
console.log("indexMng relationfiles", indexMng);
|
||||
form.setValue(`items.${indexMng}.fcFiles`, [
|
||||
...(formFileChange(planFiles ?? [], "평면도") ?? []),
|
||||
...formFileChange(relationfiles, "계통도"),
|
||||
]);
|
||||
//setRegFileList(regFileFilter(relationfiles, "계통도", regFileList || []));
|
||||
}
|
||||
}, [relationfiles]);
|
||||
useEffect(() => {
|
||||
if (planFiles) {
|
||||
setRegFileList(regFileFilter(planFiles, "평면도", regFileList || []));
|
||||
// setRegFileList(regFileFilter(planFiles, "평면도", regFileList || []));
|
||||
console.log("indexMng planFiles", indexMng);
|
||||
form.setValue(`items.${indexMng}.fcFiles`, [
|
||||
...(formFileChange(planFiles ?? [], "평면도") ?? []),
|
||||
...formFileChange(relationfiles ?? [], "계통도"),
|
||||
]);
|
||||
}
|
||||
}, [planFiles]);
|
||||
|
||||
@@ -254,6 +250,7 @@ export function PbnstMngForm({
|
||||
}
|
||||
}, [code]);
|
||||
|
||||
|
||||
return (
|
||||
<div className=" !mx-[1.6rem] !p-0r">
|
||||
<div>
|
||||
@@ -365,7 +362,7 @@ export function PbnstMngForm({
|
||||
maxLength={numSize} //입력제한
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
@@ -388,7 +385,7 @@ export function PbnstMngForm({
|
||||
maxLength={numSize} //입력제한
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
@@ -410,7 +407,7 @@ export function PbnstMngForm({
|
||||
maxLength={numSize} //입력제한
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
@@ -445,6 +442,7 @@ export function PbnstMngForm({
|
||||
) : (
|
||||
<FormUi label="계통도">
|
||||
<FileUpload
|
||||
key={`items.${indexMng}.planFiles`}
|
||||
files={relationfiles?.map((item) => item.file) || []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files) fileHandler(files, "relation");
|
||||
@@ -482,6 +480,7 @@ export function PbnstMngForm({
|
||||
) : (
|
||||
<FormUi label="평면도">
|
||||
<FileUpload
|
||||
key={`items.${indexMng}.planFiles`}
|
||||
files={planFiles?.map((item) => item.file) || []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files) fileHandler(files, "plan");
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import { pbnMapTableSize } from "@/app/store/map/pbnstMap";
|
||||
import type { pubHasuType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { excelDownload, tableData } from "@/components/lib/func/commom";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchBaseForm,
|
||||
@@ -13,14 +13,17 @@ 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 HasuFacility({rtnFeature}:{rtnFeature:(feature:any)=>void } ) {
|
||||
const { code, pbnMap, pbnMapInit } = useWrStore((state) => state);
|
||||
const { code, pbnMap, pbnMapInit ,pbnMapSearch} = useWrStore((state) => state);
|
||||
const [hasuTable, setHasuTable] = useState<pubHasuType[]>();
|
||||
const [isReset, setIsReset] = useState(false);
|
||||
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const { pbnMapHeadList, pbnMapRes, pbnMapCount } = pbnMap;
|
||||
const { pbnMapHeadList, pbnMapRes, pbnMapCount ,hasuMapExcelList} = pbnMap;
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
useEffect(() => {
|
||||
if (!pbnMap.isInit) {
|
||||
@@ -39,6 +42,22 @@ export function HasuFacility({rtnFeature}:{rtnFeature:(feature:any)=>void } ) {
|
||||
rtnFeature(pbnMapRes[index])
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (hasuMapExcelList.length > 0) {
|
||||
excelDownload(
|
||||
hasuMapExcelList,
|
||||
"하수처리시설 현황",
|
||||
"sample_hasuMap.xlsx",
|
||||
"A1:H1",
|
||||
2
|
||||
);
|
||||
} else {
|
||||
toast.error(t("excelDownErrMsg"));
|
||||
}
|
||||
}, [hasuMapExcelList]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -83,6 +102,10 @@ export function HasuFacility({rtnFeature}:{rtnFeature:(feature:any)=>void } ) {
|
||||
isAdmin={false}
|
||||
excelClick={function (returnType: ReturnType): void {
|
||||
console.log("pbnstSttnSearch ", returnType);
|
||||
|
||||
|
||||
pbnMapSearch(true,1, 100000, returnType,pbnRuseNm??'' )
|
||||
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -96,7 +119,9 @@ export function HasuFacility({rtnFeature}:{rtnFeature:(feature:any)=>void } ) {
|
||||
headName={""}
|
||||
cellClick={hasuCellClick}
|
||||
onPageChange={(page) => {
|
||||
pbnMapInit(page, pbnMapTableSize, ref.current);
|
||||
//pbnMapInit(page, pbnMapTableSize, ref.current);
|
||||
|
||||
pbnMapSearch(false,page, pbnMapTableSize, ref.current,pbnRuseNm??'' )
|
||||
setIsReset(false);
|
||||
}}
|
||||
resetPageNo={isReset}
|
||||
|
||||
@@ -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),
|
||||
seartchTxt||'',
|
||||
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),
|
||||
seartchTxt ?? "",
|
||||
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),
|
||||
seartchTxt ?? "",
|
||||
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);
|
||||
@@ -51,6 +54,23 @@ export function RuseFacility({
|
||||
ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts);
|
||||
}, [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);
|
||||
ruseMapSearch(true,1,1000000 , returnType, searchYear, fclts,pbnRuseNm??'')
|
||||
}}
|
||||
/>
|
||||
</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(false,page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm)
|
||||
}else{
|
||||
ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts);
|
||||
}
|
||||
|
||||
setIsReset(false);
|
||||
}}
|
||||
resetPageNo={isReset}
|
||||
|
||||
@@ -13,7 +13,7 @@ export function RuseDetailPopup({ bscFctCd }: { bscFctCd: string }) {
|
||||
const { ruseMap, getRuseMaplList } = useWrStore((state) => state);
|
||||
const { ruseDetailList } = ruseMap;
|
||||
const [fcltTab, setFcltTab] = useState<string>("");
|
||||
const [isDetail, setIsDetail] = useState<customPbnst>({} as customPbnst);
|
||||
const [, setIsDetail] = useState<customPbnst>({} as customPbnst);
|
||||
const initRef = useRef<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -38,9 +38,9 @@ export function RuseDetailPopup({ bscFctCd }: { bscFctCd: string }) {
|
||||
|
||||
if (!(ruseDetailList && ruseDetailList[0])) return;
|
||||
return (
|
||||
<div>
|
||||
<div className="">
|
||||
<Tabs value={fcltTab} onValueChange={setFcltTab}>
|
||||
<TabsList className="mt-4">
|
||||
<TabsList className="mt-2 mb-3 gap-2 flex flex-wrap">
|
||||
{ruseDetailList.map((item, index) => {
|
||||
return (
|
||||
<TabsTrigger
|
||||
@@ -54,9 +54,17 @@ export function RuseDetailPopup({ bscFctCd }: { bscFctCd: string }) {
|
||||
})}
|
||||
</TabsList>
|
||||
|
||||
<TabsContent className="flex-1 px-4" value={fcltTab}>
|
||||
<PbnstSttnModal data={isDetail} isMap={true} />
|
||||
</TabsContent>
|
||||
{ruseDetailList.map((item) => (
|
||||
<TabsContent
|
||||
key={item.pbnstRuseFcltId}
|
||||
className="flex-1 px-4 py-3"
|
||||
value={item.pbnstRuseFcltId}
|
||||
>
|
||||
<div className="mb-4">
|
||||
<PbnstSttnModal data={item} isMap={true} />
|
||||
</div>
|
||||
</TabsContent>
|
||||
))}
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn
|
||||
import {
|
||||
excelToRswtGuideData,
|
||||
excelToRswtPolution,
|
||||
rswtExcelDataCheck,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel";
|
||||
import { showConfirmToast } from "@/components/lib/func/commom";
|
||||
import {
|
||||
@@ -110,30 +111,23 @@ export default function ChkgdExcel({
|
||||
});
|
||||
} else if (type === "RST") {
|
||||
filePickedArray(file, 0).then((res) => {
|
||||
let issues: string[] = [];
|
||||
|
||||
|
||||
if (res && res?.length > 1) {
|
||||
const guideData = excelToRswtGuideData(
|
||||
res[0],
|
||||
form.getValues("chckYr"),
|
||||
issues
|
||||
);
|
||||
const polutionData = excelToRswtPolution(res[1], issues);
|
||||
const polutionData = excelToRswtPolution(res[1]);
|
||||
|
||||
issues = [...guideData.issues, ...polutionData.issues];
|
||||
|
||||
|
||||
if (issues && issues.length > 0) {
|
||||
issues.some((err, index) => {
|
||||
showConfirmToast(err);
|
||||
return index === 6; // true 반환 시 반복 종료
|
||||
});
|
||||
clearFile();
|
||||
} else {
|
||||
|
||||
const keyGenerator = (item: rswtChkZodType) =>
|
||||
`${item.bdstRuseFcltSn}|${item.chckYmd}|${item.utztnUsgCd}`;
|
||||
const totalData: rswtChkZodType[] = guideData.data.map(
|
||||
const totalData: rswtChkZodType[] = guideData.map(
|
||||
(guide) => {
|
||||
const fusion = polutionData.data.find(
|
||||
const fusion = polutionData.find(
|
||||
(polution) =>
|
||||
guide.bdstRuseFcltSn === polution.bdstRuseFcltSn &&
|
||||
guide.chckYmd === polution.chckYmd &&
|
||||
@@ -153,8 +147,8 @@ export default function ChkgdExcel({
|
||||
}
|
||||
}
|
||||
);
|
||||
const guideKey = new Set(guideData.data.map(keyGenerator));
|
||||
const onlypolution = polutionData.data.filter(
|
||||
const guideKey = new Set(guideData.map(keyGenerator));
|
||||
const onlypolution = polutionData.filter(
|
||||
(item) => !guideKey.has(keyGenerator(item))
|
||||
);
|
||||
|
||||
@@ -162,9 +156,20 @@ export default function ChkgdExcel({
|
||||
...totalData,
|
||||
...onlypolution,
|
||||
];
|
||||
const issues: string[] = [];
|
||||
|
||||
setExcelRswtData(listTotalData);
|
||||
}
|
||||
console.log('listTotalData ', listTotalData)
|
||||
rswtExcelDataCheck(listTotalData,issues)
|
||||
|
||||
if (issues && issues.length > 0) {
|
||||
issues.some((err, index) => {
|
||||
showConfirmToast(err);
|
||||
return index === 6; // true 반환 시 반복 종료
|
||||
});
|
||||
clearFile();
|
||||
} else {
|
||||
setExcelRswtData(listTotalData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ export default function RuseCaseMngExcel() {
|
||||
};
|
||||
|
||||
Object.keys(reUseCaseNames).forEach((key: string) => {
|
||||
console.log("reUseCaseNames", reUseCaseNames)
|
||||
if (item && reUseCaseNames[key] !== undefined) {
|
||||
const mappedKey = reUseCaseNames[key];
|
||||
if (mappedKey && object.hasOwnProperty(mappedKey)) {
|
||||
|
||||
@@ -25,18 +25,20 @@ export function PbnstRegModal({
|
||||
form,
|
||||
setPbnstInsert,
|
||||
onInvalid,
|
||||
newIndexMng
|
||||
}: {
|
||||
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
|
||||
setPbnstInsert: (data: customPbnst) => void;
|
||||
onInvalid: (
|
||||
errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>
|
||||
) => void;
|
||||
newIndexMng:number
|
||||
}) {
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
//TODO: 유즈 스테이트에 set만해도 되나?
|
||||
const [, setCurrentTab] = useState<string>("mng");
|
||||
const [indexMng, setIndexMng] = useState<number>(0);
|
||||
const [indexMng, setIndexMng] = useState<number>(newIndexMng);
|
||||
const [indexBiz, setIndexBiz] = useState<number>(0);
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
@@ -59,12 +61,8 @@ export function PbnstRegModal({
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
|
||||
useEffect(() => {
|
||||
const firstForm = form.getValues("items");
|
||||
if (firstForm) {
|
||||
setIndexMng(firstForm.length - 1);
|
||||
}
|
||||
}, [form]);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1 className="text-2xl font-medium text-label pl-8">
|
||||
|
||||
@@ -169,7 +169,7 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" };
|
||||
const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" };
|
||||
|
||||
if (prfList) {
|
||||
if (prfList&&prfList.length>0) {
|
||||
prfList?.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
@@ -220,12 +220,16 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
outPrf: outUsageData,
|
||||
totalPrf: tableData,
|
||||
});
|
||||
}else{
|
||||
setPrfData(undefined);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
if(isMap){
|
||||
if(data.prfList &&data.prfList.length>0){
|
||||
getTablePrfData(data.prfList);
|
||||
}else{
|
||||
getTablePrfData([]);
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -250,16 +254,17 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
}
|
||||
|
||||
}, [data, form])
|
||||
const Wrapper: React.ElementType = isMap ?"div": ScrollArea;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<div className="min-h-0 px-4 md:px-6 py-4">
|
||||
{titleVisible && (
|
||||
<>
|
||||
<Title title={"하수재이용 시설 상세정보"} />
|
||||
</>
|
||||
)}
|
||||
<ScrollArea className={ isMap==true? "h-[100vh]":"h-[70vh]" }>
|
||||
<Wrapper className={ "h-[70vh]" }>
|
||||
<PbnstMngForm
|
||||
form={form}
|
||||
formType={"sttn"}
|
||||
@@ -289,7 +294,7 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
재이용 수요처 현황
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="max-h-full" value={fcltTab}>
|
||||
<TabsContent className="min-h-0" value={fcltTab}>
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={ruseTableData || []}
|
||||
@@ -322,10 +327,10 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
장외용수
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="max-h-full" value={ruseTab}>
|
||||
<TabsContent className="min-h-0" value={ruseTab}>
|
||||
{prfData && (
|
||||
<ListDiv className="col-span-8 pr-6 ">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
{/* <ScrollArea className="h-[60vh]"> */}
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{"하수처리수재이용 실적(m³) 등록결과"}
|
||||
@@ -339,13 +344,13 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
{InputTableBody(prfData[ruseTab as keyof typeof prfData] || [], pbnstPrfmncSttn.monthSttnHeadList, setPrfData as any)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
{/* </ScrollArea> */}
|
||||
</ListDiv>
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</Wrapper>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import type { customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { rainChkTableData } from "@/components/lib/func/TableData";
|
||||
import { ScrollArea, Title, UiTable } from "@common/business_components/ui";
|
||||
import { Title, UiTable } from "@common/business_components/ui";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import { useEffect, useState } from "react";
|
||||
import HtdflRegForm from "../../../form/fcltReg/htdflReg/htdflRegForm";
|
||||
@@ -89,13 +89,13 @@ export default function SttnDetailModal({
|
||||
: "온배수시설 상세정보"
|
||||
}
|
||||
></Title>
|
||||
<ScrollArea
|
||||
{/* <ScrollArea
|
||||
className={isMap ?"h-[100vh]":
|
||||
detailData.data.length > 0
|
||||
? "h-[80vh]"
|
||||
: "h-[70vh]"
|
||||
}
|
||||
>
|
||||
> */}
|
||||
{type === "RNB" ? (
|
||||
<RainRegForm
|
||||
rainForm={formObj as customRainBdst}
|
||||
@@ -143,7 +143,7 @@ export default function SttnDetailModal({
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</ScrollArea>
|
||||
{/* </ScrollArea> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user