빗물재이용시설현황 엑셀 다운로드 수정, 온배수시설현황 조회 수정

This commit is contained in:
jyha00
2025-06-20 17:06:49 +09:00
parent 79b39fc22f
commit 98f976eaea
4 changed files with 95 additions and 98 deletions
@@ -6,12 +6,14 @@ import type {
chgBuilding,
customRainBdst,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
import {
excelDownload,
getCityOrSgg,
tableData,
} from "@/components/lib/func/commom";
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import {
ContentsDiv,
SearchBaseForm,
@@ -21,12 +23,9 @@ import {
type ReturnType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { makeFcltRegHead } from "@common/business_components/ui/table/makeFcltRegHead";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
export default function HtdflSttn() {
const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore(
@@ -139,7 +138,7 @@ export default function HtdflSttn() {
} else {
con = returnType.sidoValue;
}
// rainSttnSearch(1, "20", con);
htdflSttnSearch(pageNation, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
@@ -155,7 +154,7 @@ export default function HtdflSttn() {
headName={[]}
tableData={bdstTable || []}
children={
<makeFcltRegHead upHeadList={htdflSttn.htdflSttNodeList} />
<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />
}
headlist={htdflSttn.htdflSttHeadList}
pageSize={20}
@@ -34,7 +34,7 @@ export default function RainSttn() {
const [pageNation, setPageNation] = useState(1);
const [isChHead, setIsChHead] = useState(false);
const [bdstTable, setBdstTable] = useState<customRainBdst[]>();
const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customRainBdst|undefined}>({data:undefined,isOpen:false })
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false })
const [bdstChgProps, setBdstChgProps] = useState<{
isOpen: boolean;
chBuilding: chgBuilding[];
@@ -42,23 +42,22 @@ export default function RainSttn() {
const codeData = getCityOrSgg(ref);
const cellClick=(index:number|undefined, headId: string)=>{
const cellClick = (index: number | undefined, headId: string) => {
if(headId!=='chBuildingYn' && index!==undefined && bdstTable!==undefined){
setDetailModal({isOpen:true ,data:bdstTable[index] })
}else if( headId==='chBuildingYn' && index!==undefined && bdstTable!==undefined){
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
setDetailModal({ isOpen: true, data: bdstTable[index] })
} else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
if (
bdstTable[index] &&
bdstTable[index]?.chgBuilding[0]?.bdstChgNm!==null
bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null
) {
setBdstChgProps({ isOpen:true , chBuilding: bdstTable[index].chgBuilding});
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
}
}
}
useEffect(() => {
if (!rainSttn.isInit) {
rainSttnInit(codeData ?? "0");
@@ -73,7 +72,7 @@ export default function RainSttn() {
...item,
...item.reuseBuilding[0],
...item.reuseBuilding[0].rainyObj,
chBuildingYn:item.chgBuilding[0]?.bdstChgNm!==null?'Y':'N'
chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? 'Y' : 'N'
}))
.filter((item: any) => item.rainyObj !== undefined);
@@ -92,14 +91,15 @@ export default function RainSttn() {
excelDownload(
rainSttn.excelList,
"빗물재이용시설 현황",
"sample_rainSttn.xlsx"
"sample_rainSttn.xlsx",
"A1:W3"
);
}
}, [rainSttn.excelList]);
const excelClick = useCallback(() => {
if (codeData) rainSttnSearch(1, "10000", codeData);
}, [rainSttnSearch,codeData]);
}, [rainSttnSearch, codeData]);
return (
<>
@@ -136,7 +136,7 @@ export default function RainSttn() {
rainSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
initClick={function (): void { }}
btnClass={btnClass}
ref={ref}
/>
@@ -154,7 +154,7 @@ export default function RainSttn() {
headlist={rainSttn.rainSttHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
onPageChange={setPageNation}
></UiTable>
</ListDiv>
@@ -177,12 +177,12 @@ export default function RainSttn() {
}
/>
<UiModal
open={detailModal.isOpen}
onOpenChange={()=>{
setDetailModal({...detailModal, isOpen:!detailModal.isOpen})
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data}/>}/>
open={detailModal.isOpen}
onOpenChange={() => {
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen })
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data} />} />
<UiModal
bodyClass={""}
open={bdstChgProps.isOpen}
@@ -14,13 +14,13 @@ export type htdflSttnState = {
isInit: boolean;
htdflSttHeadList: z.infer<typeof sttnHeadListType>;
htdflSttNodeList: CommonTableProps[];
htdflSttnRes:customHtdflBdst[]
htdflSttnRes: customHtdflBdst[]
excelList: [];
};
};
type htdflSttnActions = {
initHtdfl:(con:string) => void;
initHtdfl: (con: string) => void;
htdflSttnSearch: (page: number, total: string, con: string) => void;
htdflChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
@@ -33,16 +33,16 @@ export const htdflSttnStateExport: htdflSttnState = {
htdflSttn: {
htdflSttHeadList: htdflSttHeadList,
htdflSttNodeList: htdflSttNodeList,
htdflSttnRes:[],
excelList:[],
htdflSttnRes: [],
excelList: [],
isInit: false,
},
};
const initFetch = async (code:string|number) => {
const initFetch = async (code: string | number) => {
const htdflRes = await getFetch(
"wr",
`/drain/facilityList/1/20/${code}`)
return htdflRes;
};
@@ -50,74 +50,72 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
set: any
) => {
return {
initHtdfl: async (code: string | number) => {
try {
const htdflSttnRes = await initFetch(code);
set((state: htdflSttnState) => {
return {
...state,
htdflSttn: {
...state.htdflSttn,
htdflSttnRes: htdflSttnRes,
isInit: false,
},
};
});
} catch (error) {
console.log(error);
}
initHtdfl: async (code: string | number) => {
try {
const htdflSttnRes = await initFetch(code);
set((state: htdflSttnState) => {
return {
...state,
htdflSttn: {
...state.htdflSttn,
htdflSttnRes: htdflSttnRes,
isInit: false,
},
};
});
} catch (error) {
console.log(error);
}
},
htdflSttnSearch: async (page: number, total: string, con: string) => {
try {
const htdflSttnRes = await getFetch(
fetchType.WR,
`/drain/facilityList/${page}/${total}/${con}`
);
if (Number(total) > 9000) {
set((state: htdflSttnState) => {
return {
...state,
htdflSttn: {
...state.htdflSttn,
excelList: htdflSttnRes,
},
};
});
} else
set((state: htdflSttnState) => {
return {
...state,
htdflSttn: {
...state.htdflSttn,
htdflSttnRes: htdflSttnRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
htdflChSttnHead: async (
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
const changeNodeList = controlHeadView(headList, htdflSttNodeList)
return set((state: htdflSttnState) => ({
htdflSttn: {
...state.htdflSttn,
htdflSttHeadList: headList,
htdflSttNodeList: changeNodeList,
},
htdflSttnSearch: async (page: number, total: string, con: string) => {
try {
console.log(page)
const htdflSttnRes = await getFetch(
fetchType.WR,
`/drain/facilityList/${page}/${total}/${con}`
);
if (Number(total) > 9000) {
set((state: htdflSttnState) => {
}));
},
return {
...state,
htdflSttn: {
...state.htdflSttn,
excelList: htdflSttnRes,
},
};
});
} else
set((state: htdflSttnState) => {
return {
...state,
htdflSttn: {
...state.htdflSttn,
htdflSttnRes: htdflSttnRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
htdflChSttnHead: async (
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
console.log('head ', headList)
const changeNodeList= controlHeadView(headList,htdflSttNodeList)
return set((state: htdflSttnState) => ({
htdflSttn: {
...state.htdflSttn,
htdflSttHeadList: headList,
htdflSttNodeList: changeNodeList,
},
}));
},
}
}
Binary file not shown.