잠재수요처 엑셀 다운로드 수정, 페이징 처리 수정

This commit is contained in:
jyha00
2025-07-08 20:59:35 +09:00
parent e314369cbb
commit e30130dc8f
7 changed files with 37 additions and 29 deletions
@@ -42,7 +42,7 @@ export default function LdrmntCoSttn() {
const [bdstTable, setBdstTable] = useState<customLdrmnt[]>();
const [searchTxt, setSearchTxt] = useState<string>();
const [excelData, setExcelData] = useState<any[]>();
const [isExcelDownload, setIsExcelDownload] = useState(false);
// const [isExcelDownload, setIsExcelDownload] = useState(false);
const excelClick = useCallback(() => {
excelDownload(
@@ -77,20 +77,20 @@ export default function LdrmntCoSttn() {
const excelDownloadClick = useCallback(() => {
const cityNm = computeCityNm();
ldrmntSearch(true, pageNation, String(ldrmntResCount), cityNm, searchTxt || "");
setIsExcelDownload(true);
}, [objSearch, pageNation, searchTxt, code, ldrmntSearch, computeCityNm]);
// setIsExcelDownload(true);
}, [objSearch, pageNation, searchTxt, code, ldrmntSearch, computeCityNm, ldrmntResCount]);
useEffect(() => {
if (isExcelDownload && excelData && excelData.length > 0) {
if (/*isExcelDownload &&*/ excelData && excelData.length > 0) {
downloadExcel({
data: excelData,
fileName: "잠재수요처 관리",
sheetNameArray: ["Sheet1"],
headerRange: "A1:F1"
});
setIsExcelDownload(false);
// setIsExcelDownload(false);
}
}, [excelData, isExcelDownload]);
}, [excelData, /*isExcelDownload*/]);
const [isExcelOpen, setIsExcelOpen] = useState<{
isModal: boolean;
@@ -247,7 +247,7 @@ export default function LdrmntCoSttn() {
tableData={bdstTable || []}
headlist={ldrmntHeadListExport}
pageSize={20}
total={10000}
total={ldrmntResCount || 0}
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
onPageChange={setPageNation}
/>
@@ -60,7 +60,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
return {
ldrmntInit: async (con: string) => {
try {
const ldrmntRes = await getFetch(
const ldrmntRes = await getFetchWithCount(
fetchType.WR,
`/reuseFc/request/temp/1/20/${con}`
);
@@ -70,7 +70,8 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
...state,
ldrmnt: {
...state.ldrmnt,
ldrmntRes: ldrmntRes,
ldrmntRes: ldrmntRes.data,
ldrmntResCount: ldrmntRes.count,
isInit: false,
excelList: excelDownList,
},
@@ -120,7 +121,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
fetchType.WR,
searchUrl
);
console.log("알이에스", ldrmntRes)
if (isExcel) {
let excelDownList: ExcelType[] = [];
ldrmntRes.data.forEach((item: customLdrmnt) => {
@@ -139,7 +140,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
ldrmnt: {
...state.ldrmnt,
excelList: excelDownList,
ldrmntResCount: ldrmntRes.count,
},
};
});
@@ -77,7 +77,6 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
htdflSttn: {
...state.htdflSttn,
excelList: htdflExcel,
htdflSttnResCount: htdflSttnRes.count
},
};
});
@@ -119,7 +118,6 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
htdflSttn: {
...state.htdflSttn,
excelList: htdflExcel,
htdflSttnResCount: htdflSttnRes.count
},
};
});
@@ -153,7 +153,6 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
rainSttn: {
...state.rainSttn,
excelList: rainExcel,
rainSttnResCount: rainSttnRes.count,
},
};
});
@@ -164,7 +163,6 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
rainSttn: {
...state.rainSttn,
rainSttnRes: rainSttnRes.data,
rainSttnResCount: rainSttnRes.count,
isInit: false,
},
};
@@ -1,6 +1,7 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { customRswtBdst } from "../../fcltReg/rswtReg";
import { useWrStore } from "@/app/store";
import { bdstUsgCd } from "@/app/store/common/code/basicCode";
export const excelRSwtSttnParsing = (
excel: customRswtBdst[],
@@ -14,7 +15,7 @@ export const excelRSwtSttnParsing = (
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
String(item.bdstUsgCd === -1 || item.bdstUsgCd === undefined ? "확인불가" : item.bdstUsgCd ?? ""), //건축물용도
bdstUsgCd.find((cd)=> cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
String(item.frstArchPrmsnDt ?? ""),
String(item.archArea.split('.')[0] === '-1' ? '확인불가' : item.archArea.split('.')[0]),
String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
@@ -79,7 +79,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
rswtSttn: {
...state.rswtSttn,
excelList: rswtExcel,
rswtSttnResCount: rswtSttnRes.count,
},
};
});
@@ -112,6 +111,12 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : "")
);
console.log("주소",`/reuseFc/waterreuseFc` +
(page ? `/${page}` : "/1") +
(total ? `/${total}` : "/20") +
(con ? `/${con}` : "/0") +
(txt ? `/${txt}` : ""))
console.log("rswtSttnRes", rswtSttnRes)
if (isExcel) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
set((state: rswtSttnState) => {
@@ -120,7 +125,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
rswtSttn: {
...state.rswtSttn,
excelList: rswtExcel,
rswtSttnResCount: rswtSttnRes.count,
},
};
});