fo:exceldown시 조건 해제 4개화면

This commit is contained in:
2026-01-29 18:07:08 +09:00
parent 5faced2928
commit a2504f4c85
5 changed files with 72 additions and 68 deletions
@@ -196,22 +196,22 @@ export default function FacilityPrecipitation() {
// 엑셀다운로드
const excelDownload = useCallback((searchReturn: ReturnType) => {
if (ref.current.partValue === 'A') { // 행정별
if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
// if (ref.current.partValue === 'A') { // 행정별
// if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
searchFacilityPrecipitation(searchReturn, 1, 10000);
}, [searchFacilityPrecipitation]);
@@ -137,22 +137,22 @@ export default function ProcessArea() {
}, [excelList]);
const excelDownload = useCallback(() => {
if (ref.current.partValue === 'A') { // 행정별
if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
// if (ref.current.partValue === 'A') { // 행정별
// if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
searchProcessArea(ref.current, 1, 10000);
}, [searchProcessArea]);
@@ -236,22 +236,22 @@ export default function ProcessFacilitySearch() {
}
const excelDownload = useCallback(() => {
if (ref.current.partValue === 'A') { // 행정별
if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
// if (ref.current.partValue === 'A') { // 행정별
// if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
searchFcltyList(ref.current, 1, 10000);
}, [searchFcltyList]);
+23 -20
View File
@@ -90,7 +90,8 @@ export default function Rdi() {
// 조회기간
const [searchYear, setSearchYear] = useState<string>(defaultSearchYear);
// 엑셀 다운로드 트리거
const [isInitExcelDownload, setIsInitExcelDownload] = useState<boolean>(false);
const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
const [initTrigger, setInitTrigger] = useState<boolean>(false);
/**
@@ -118,7 +119,7 @@ export default function Rdi() {
}
useEffect(() => {
if(!isInitExcelDownload) return ;
if(!isExcelDownClick) return ;
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
@@ -126,8 +127,10 @@ export default function Rdi() {
sheetNameArray: ['RDII추정'],
headerRange: 'A1:R1'
});
} else {
alert("조회된 결과가 없습니다.");
}
}, [excelList, isInitExcelDownload]);
}, [excelList, isExcelDownClick]);
/**
* 콜백함수
@@ -180,25 +183,25 @@ export default function Rdi() {
// 엑셀다운로드
const excelDownload = useCallback(() => {
if (ref.current.partValue === 'A') { // 행정별
if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
// if (ref.current.partValue === 'A') { // 행정별
// if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
searchRdi(ref.current, 1, 5000);
setIsInitExcelDownload(true);
setIsExcelDownClick(true);
}, [searchRdi]);
// 페이지 변경
@@ -1,3 +1,4 @@
"use client";
import { createContext, useState } from "react";
interface PromptContext {