From cf61a8956b4164afaa1e6cdf409f7f82083cd372 Mon Sep 17 00:00:00 2001 From: ljpark Date: Mon, 26 Jan 2026 12:57:00 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fo:=20exceldown=EC=8B=9C=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/.env.local | 2 +- apps/fo/.env.production | 5 ++--- .../app/pages/(with-layout)/sewageOccur/page.tsx | 16 ++++++++++++++++ .../pages/(with-layout)/underWaterInput/page.tsx | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/apps/fo/.env.local b/apps/fo/.env.local index 693b6e7ef..1b80d302e 100644 --- a/apps/fo/.env.local +++ b/apps/fo/.env.local @@ -8,7 +8,7 @@ NEXT_PUBLIC_PROXY_HOST = http://localhost:3000 NEXT_PUBLIC_SUB_DOMAIN = http://localhost:13000 #NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/ +NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver diff --git a/apps/fo/.env.production b/apps/fo/.env.production index 64f0398e0..d6940b0e9 100644 --- a/apps/fo/.env.production +++ b/apps/fo/.env.production @@ -8,13 +8,12 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token #NEXT_PUBLIC_PROXY_HOST = https://devlarva.hasuon.or.kr #NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service -NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 +NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl -NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 -NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service +NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} diff --git a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx index 31862e362..e9297d0f5 100644 --- a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx +++ b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx @@ -196,6 +196,22 @@ export default function PlanSewage() { // 엑셀다운로드 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; + } + } searchFacilityPrecipitation(ref.current, 1, 5000); setIsInitExcelDownload(true); }, [searchFacilityPrecipitation]); diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx index a2ad7bfd6..969ae2a05 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx @@ -200,6 +200,22 @@ export default function UnderWaterInput() { // 엑셀다운로드 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; + } + } searchFacilityPrecipitation(ref.current, 1, 5000); setIsMount(true); }, [searchFacilityPrecipitation]); From a61fda8b58931c2869dc892bab2d6555de43149f Mon Sep 17 00:00:00 2001 From: ljpark Date: Mon, 26 Jan 2026 16:13:33 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fo:=20exceldown=EC=8B=9C=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EB=82=98=EB=A8=B8=EC=A7=80=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityPrecipitation/page.tsx | 16 ++++++++++++++++ .../(with-layout)/facilityWaterQlty/page.tsx | 17 +++++++++++++++++ .../app/pages/(with-layout)/flowRate/page.tsx | 17 +++++++++++++++++ .../app/pages/(with-layout)/planSewage/page.tsx | 17 +++++++++++++++++ .../pages/(with-layout)/processArea/page.tsx | 17 +++++++++++++++++ .../(with-layout)/processFacility/page.tsx | 17 +++++++++++++++++ apps/fo/app/pages/(with-layout)/rdi/page.tsx | 17 +++++++++++++++++ 7 files changed, 118 insertions(+) diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx index 18a769871..eecab5768 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx @@ -191,6 +191,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; + } + } searchFacilityPrecipitation(searchReturn, 1, 10000); }, [searchFacilityPrecipitation]); diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx index 86a434d6b..539cc6f31 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx @@ -170,6 +170,23 @@ export default function ProcessFacilitySearch() { }, [upHeadList1, upHeadList2, upHeadList3]); 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; + } + } + setExcelTrigger(true); searchFcltyQltyList(ref.current, 1, 10000); }, [searchFcltyQltyList]); diff --git a/apps/fo/app/pages/(with-layout)/flowRate/page.tsx b/apps/fo/app/pages/(with-layout)/flowRate/page.tsx index a1a5e22d1..696e8f0b2 100644 --- a/apps/fo/app/pages/(with-layout)/flowRate/page.tsx +++ b/apps/fo/app/pages/(with-layout)/flowRate/page.tsx @@ -176,6 +176,23 @@ export default function ProcessFacilitySearch() { }, [upHeadList1, upHeadList2, upHeadList3]); 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; + } + } + searchFlowRate(ref.current, 1, 10000); setExcelTrigger(true); }, [searchFlowRate]); diff --git a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx index 62ae9483a..0f73f1035 100644 --- a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx +++ b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx @@ -178,6 +178,23 @@ export default function PlanSewage() { // 엑셀다운로드 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; + } + } + searchPlanSewage(searchReturn, 1, 10000); setExcelTrigger(true); }, [searchPlanSewage]); diff --git a/apps/fo/app/pages/(with-layout)/processArea/page.tsx b/apps/fo/app/pages/(with-layout)/processArea/page.tsx index ba1e27767..deca4366c 100644 --- a/apps/fo/app/pages/(with-layout)/processArea/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processArea/page.tsx @@ -132,6 +132,23 @@ 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; + } + } + searchProcessArea(ref.current, 1, 10000); }, [searchProcessArea]); diff --git a/apps/fo/app/pages/(with-layout)/processFacility/page.tsx b/apps/fo/app/pages/(with-layout)/processFacility/page.tsx index 9c3c612b5..b239970e0 100644 --- a/apps/fo/app/pages/(with-layout)/processFacility/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processFacility/page.tsx @@ -236,6 +236,23 @@ 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; + } + } + searchFcltyList(ref.current, 1, 10000); }, [searchFcltyList]); diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index 98120523a..ef1691d69 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -175,6 +175,23 @@ 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; + } + } + searchRdi(ref.current, 1, 5000); setIsInitExcelDownload(true); }, [searchRdi]); From 4356ec8a34855828ece8359188557f5d6658b203 Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 28 Jan 2026 18:05:48 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fo:=20=EB=85=84=EB=8F=84=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=20=EB=B0=8F=20exceldown=EC=8B=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EC=B2=98=EB=A6=AC=203=EB=B3=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/(with-layout)/dashboard/page.tsx | 8 +++-- .../facilityPrecipitation/page.tsx | 17 +++++---- .../(with-layout)/facilityWaterQlty/page.tsx | 11 ++++-- .../app/pages/(with-layout)/flowRate/page.tsx | 35 +++++++++++-------- .../pages/(with-layout)/planSewage/page.tsx | 13 ++++--- .../pages/(with-layout)/processArea/page.tsx | 17 +++++---- apps/fo/app/pages/(with-layout)/rdi/page.tsx | 11 ++++-- .../pages/(with-layout)/sewageOccur/page.tsx | 25 ++++++++----- .../(with-layout)/underWaterInput/page.tsx | 27 ++++++++------ apps/fo/app/store/common/index.tsx | 30 ++++++++-------- .../src/ui/select/index.tsx | 22 +++++++----- 11 files changed, 136 insertions(+), 80 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx index 6ab18b825..833f706ed 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx @@ -60,6 +60,10 @@ export default function DashBoard() { const [sidoValue, setSidoValue] = useState('0'); const [sigunValue, setSigunValue] = useState('0'); const { isInit, selectSearchYear, btnClass, selectSidoData, selectSigunData, } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; const { planFcltyList } = PlanFclty; const { operationalStatusList } = OperationStatus; const { excelList } = RainManage; @@ -75,7 +79,7 @@ export default function DashBoard() { /******************선택된 데이터******************/ - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || '0'); // 연도 + const [searchYear, setSearchYear] = useState(defaultSearchYear); // 연도 // 시설명 const [fcltyList, setFcltyList] = useState({ bscFctCd: '11000SW001R', @@ -283,7 +287,7 @@ export default function DashBoard() { trtFrfNm: '표준활성슬러지법, MLE, A2O', efflWqltStndrdNm: '500톤 이상(Ⅲ지역)' }); - setSearchYear(selectSearchYear[0]?.val || '0'); + setSearchYear(defaultSearchYear); searchFcltyList.bscFctNm = '난지'; setSidoValue('0'); diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx index eecab5768..0f29a28c4 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx @@ -37,6 +37,11 @@ export default function FacilityPrecipitation() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { labelArray, } = FacilityPrecipitationSearch; @@ -90,7 +95,7 @@ export default function FacilityPrecipitation() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState(defaultSearchYear); /** * 페이지 함수 @@ -102,7 +107,7 @@ export default function FacilityPrecipitation() { // 상태값 설정 setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); - setSearchYear(selectSearchYear[0]?.val || "0"); + setSearchYear(defaultSearchYear); // SearchInputSelect 초기화 setFcltyName(""); if (searchInputRef.current) { @@ -111,7 +116,7 @@ export default function FacilityPrecipitation() { input.value = ""; } } - searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0"); + searchFacilityPrecipitationList(1, 10, defaultSearchYear); } // 모달 닫기 @@ -134,9 +139,9 @@ export default function FacilityPrecipitation() { useEffect(() => { if (!isInit) { initializeCommonData(); - searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0"); + searchFacilityPrecipitationList(1, 10, defaultSearchYear); } - }, [isInit, initializeCommonData, searchFacilityPrecipitationList, selectSearchYear]); + }, [isInit, initializeCommonData, searchFacilityPrecipitationList, defaultSearchYear]); useEffect(() => { if (excelList && excelList.length > 0) { @@ -270,4 +275,4 @@ export default function FacilityPrecipitation() { )} ); -} \ No newline at end of file +} diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx index 539cc6f31..0f8427458 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx @@ -36,6 +36,11 @@ export default function ProcessFacilitySearch() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { mainLabelArray, upHeadList1, @@ -57,7 +62,7 @@ export default function ProcessFacilitySearch() { const [upheadList, setUpheadList] = useState(upHeadList1); const [fcltyName, setFcltyName] = useState(""); const [operationValue, setOperationValue] = useState("0"); - const [searchYearValue, setSearchYearValue] = useState(selectSearchYear[0]?.val || "0"); + const [searchYearValue, setSearchYearValue] = useState(defaultSearchYear); const [fcltCpct, setFcltCpct] = useState("0"); // 모달 상태 추가 @@ -96,7 +101,7 @@ export default function ProcessFacilitySearch() { // 상태값 설정 setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); - setSearchYearValue(selectSearchYear[0]?.val || "0"); + setSearchYearValue(defaultSearchYear); // SearchInputSelect 초기화 setFcltyName(""); if (searchInputRef.current) { @@ -241,4 +246,4 @@ export default function ProcessFacilitySearch() { )} ); -} \ No newline at end of file +} diff --git a/apps/fo/app/pages/(with-layout)/flowRate/page.tsx b/apps/fo/app/pages/(with-layout)/flowRate/page.tsx index 696e8f0b2..c80d46699 100644 --- a/apps/fo/app/pages/(with-layout)/flowRate/page.tsx +++ b/apps/fo/app/pages/(with-layout)/flowRate/page.tsx @@ -7,7 +7,7 @@ "use client" import { useFoStore } from "@/app/store"; import type { TableUpperProps } from "@/app/store/common"; -import type { ExcelType } from "@/app/store/flowRate"; +// import type { ExcelType } from "@/app/store/flowRate"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; import LoadingOverlay from "@common/business_components/ui/loadingBar"; @@ -38,6 +38,11 @@ export default function ProcessFacilitySearch() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { flowRateSearchLabelArray } = FlowRateSearch; @@ -57,17 +62,17 @@ export default function ProcessFacilitySearch() { const [fcltCpct, setFcltCpct] = useState("0"); const [fcltyName, setFcltyName] = useState(""); const [operationValue, setOperationValue] = useState("0"); - const [searchYearValue, setSearchYearValue] = useState(selectSearchYear[0]?.val || "0"); + const [searchYearValue, setSearchYearValue] = useState(defaultSearchYear); // const [widthSize, setWidthSize] = useState("w-[120%]"); const [upheadList, setUpheadList] = useState(upHeadList1); const [resetPage, setResetPage] = useState(false); - const prevExcelListRef = useRef(null); + // const prevExcelListRef = useRef(null); // 모달 상태 추가 const [selectedRow, setSelectedRow] = useState(null); const [fcltyNm, setFcltyNm] = useState(""); const [fcltyCd, setFcltyCd] = useState(""); - const [excelTrigger, setExcelTrigger] = useState(false); + const [isExcelDownClick, setIsExcelDownClick] = useState(false); const [initTrigger, setInitTrigger] = useState(false); const searchFlowRate = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { @@ -99,7 +104,7 @@ export default function ProcessFacilitySearch() { // setWidthSize("w-[120%]"); setUpheadList(upHeadList1) // 상태값 설정 - setSearchYearValue(selectSearchYear[0]?.val || "0"); + setSearchYearValue(defaultSearchYear); setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); // SearchInputSelect 초기화 @@ -147,15 +152,17 @@ export default function ProcessFacilitySearch() { }, [isInit, initializeCommonData, searchFlowRateList, selectSearchYear, searchFlowRate, initTrigger]); useEffect(() => { - if(!excelTrigger) return; + if(!isExcelDownClick) return; - if (excelList && excelList.length > 0) { - downloadExcelFormat({ data: JSON.parse(JSON.stringify(excelList)), fileName: '시설별 유량현황', sheetNameArray: ['시설별 유량현황'], headerRange: 'A1:O1', decimalArray0: [9,10,11,12,13,14] }); - } else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) { - alert('다운받을 데이터가 없습니다.'); - } - prevExcelListRef.current = excelList; - }, [excelList, excelTrigger]); + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcelFormat({ data: JSON.parse(JSON.stringify(excelList)), fileName: '시설별 유량현황', sheetNameArray: ['시설별 유량현황'], headerRange: 'A1:O1', decimalArray0: [9,10,11,12,13,14] }); + } else { + alert('조회된 결과가 없습니다.'); + } + }, 1000); // 약간의 지연을 두고 다운로드 실행 + return () => clearTimeout(timer); + }, [excelList, isExcelDownClick]); const ref = useRef({ partValue: '', @@ -194,7 +201,7 @@ export default function ProcessFacilitySearch() { } searchFlowRate(ref.current, 1, 10000); - setExcelTrigger(true); + setIsExcelDownClick(true); }, [searchFlowRate]); const total = flowRateCount; diff --git a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx index 0f73f1035..41b541ce9 100644 --- a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx +++ b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx @@ -41,6 +41,11 @@ export default function PlanSewage() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { labelArray, } = PlanSewageSearch; @@ -85,7 +90,7 @@ export default function PlanSewage() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState(defaultSearchYear); const [initTrigger, setInitTrigger] = useState(false); @@ -100,7 +105,7 @@ export default function PlanSewage() { // 상태값 설정 setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); - setSearchYear(selectSearchYear[0]?.val || "0"); + setSearchYear(defaultSearchYear); // SearchInputSelect 초기화 setFcltyName(""); if (searchInputRef.current) { @@ -168,7 +173,7 @@ export default function PlanSewage() { setInitTrigger(true); } } - }, [isInit, initializeCommonData, searchPlanSewageList, selectSearchYear, initTrigger, searchPlanSewage]); + }, [isInit, initializeCommonData, initTrigger, searchPlanSewage]); const chkVal = useCallback((returntype: ReturnType) => { // setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]") @@ -241,4 +246,4 @@ export default function PlanSewage() { ); -} \ No newline at end of file +} diff --git a/apps/fo/app/pages/(with-layout)/processArea/page.tsx b/apps/fo/app/pages/(with-layout)/processArea/page.tsx index deca4366c..e3b6fc3da 100644 --- a/apps/fo/app/pages/(with-layout)/processArea/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processArea/page.tsx @@ -42,6 +42,11 @@ export default function ProcessArea() { btnClass, } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { processFacilityLabelArray, } = ProcessAreaSearch; @@ -64,7 +69,7 @@ export default function ProcessArea() { const [fcltyCd, setFcltyCd] = useState(""); const [resetPage, setResetPage] = useState(false); - const [searchYearValue, setSearchYearValue] = useState(selectSearchYear[0]?.val || "0"); + const [searchYearValue, setSearchYearValue] = useState(defaultSearchYear); const ref = useRef({ partValue: '', @@ -95,8 +100,8 @@ export default function ProcessArea() { input.value = ""; } } - setSearchYearValue(selectSearchYear[0]?.val || "0"); - searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0"); + setSearchYearValue(defaultSearchYear); + searchProcessAreaList(1, 10, '', '', defaultSearchYear); } // 셀 클릭 시 모달 표시 @@ -116,9 +121,9 @@ export default function ProcessArea() { useEffect(() => { if (!isInit) { initializeCommonData(); - searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0"); + searchProcessAreaList(1, 10, '', '', defaultSearchYear); } - }, [isInit, initializeCommonData, searchProcessAreaList]); + }, [isInit, initializeCommonData, searchProcessAreaList, defaultSearchYear]); useEffect(() => { if (excelList && excelList.length > 0) { @@ -200,4 +205,4 @@ export default function ProcessArea() { )} ); -} \ No newline at end of file +} diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index ef1691d69..d166e01a3 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -41,6 +41,11 @@ export default function Rdi() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { labelArray, } = RdiSearch; @@ -83,7 +88,7 @@ export default function Rdi() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState(defaultSearchYear); // 엑셀 다운로드 트리거 const [isInitExcelDownload, setIsInitExcelDownload] = useState(false); @@ -99,7 +104,7 @@ export default function Rdi() { // 상태값 설정 setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); - setSearchYear(selectSearchYear[0]?.val || "0"); + setSearchYear(defaultSearchYear); // SearchInputSelect 초기화 setFcltyName(""); if (searchInputRef.current) { @@ -241,4 +246,4 @@ export default function Rdi() { ); -} \ No newline at end of file +} diff --git a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx index e9297d0f5..a7ff0df71 100644 --- a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx +++ b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx @@ -44,6 +44,11 @@ export default function PlanSewage() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { labelArray, } = SewageOccurSearch; @@ -93,9 +98,9 @@ export default function PlanSewage() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState(defaultSearchYear); // 엑셀다운로드 트리거 - const [isInitExcelDownload, setIsInitExcelDownload] = useState(false); + const [isExcelDownClick, setIsExcelDownClick] = useState(false); /** * 페이지 함수 @@ -107,7 +112,7 @@ export default function PlanSewage() { // 상태값 설정 setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); - setSearchYear(selectSearchYear[0]?.val || "0"); + setSearchYear(defaultSearchYear); // SearchInputSelect 초기화 setFcltyName(""); if (searchInputRef.current) { @@ -116,7 +121,7 @@ export default function PlanSewage() { input.value = ""; } } - searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0"); + searchSewageOccurList(1, 10, defaultSearchYear); } // 모달 닫기 @@ -139,12 +144,12 @@ export default function PlanSewage() { useEffect(() => { if (!isInit) { initializeCommonData(); - searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0"); + searchSewageOccurList(1, 10, defaultSearchYear); } - }, [isInit, initializeCommonData, searchSewageOccurList, selectSearchYear]); + }, [isInit, initializeCommonData, searchSewageOccurList, defaultSearchYear]); useEffect(() => { - if(!isInitExcelDownload) return ; + if(!isExcelDownClick) return ; const timer = setTimeout(() => { if (excelList && excelList.length > 0) { @@ -154,11 +159,13 @@ export default function PlanSewage() { sheetNameArray: ['오수발생량 추정'], headerRange: 'A1:O1' }); + } else { + alert("조회된 결과가 없습니다."); } }, 500); // 약간의 지연을 두고 다운로드 실행 return () => clearTimeout(timer); - }, [excelList, isInit, isInitExcelDownload]); + }, [excelList, isInit, isExcelDownClick]); /** * 콜백함수 @@ -213,7 +220,7 @@ export default function PlanSewage() { } } searchFacilityPrecipitation(ref.current, 1, 5000); - setIsInitExcelDownload(true); + setIsExcelDownClick(true); }, [searchFacilityPrecipitation]); // 페이지 변경 diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx index 969ae2a05..849689312 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx @@ -50,6 +50,11 @@ export default function UnderWaterInput() { btnClass } = Common; + const defaultSearchYear = + selectSearchYear.find((item) => item.selected)?.val || + selectSearchYear[0]?.val || + "0"; + const { labelArray, } = UnderWaterSearch; @@ -98,9 +103,9 @@ export default function UnderWaterInput() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState(defaultSearchYear); // 엑셀다운로드 트리거 - const [isMount, setIsMount] = useState(false); + const [isExcelDownClick, setIsExcelDownClick] = useState(false); /** * 페이지 함수 @@ -112,7 +117,7 @@ export default function UnderWaterInput() { // 상태값 설정 setFcltCpct(selectUpdownData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0"); - setSearchYear(selectSearchYear[0]?.val || "0"); + setSearchYear(defaultSearchYear); // SearchInputSelect 초기화 setFcltyName(""); if (searchInputRef.current) { @@ -121,7 +126,7 @@ export default function UnderWaterInput() { input.value = ""; } } - searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0"); + searchUnderWaterList(1, 10, defaultSearchYear); } // 모달 닫기 @@ -144,12 +149,12 @@ export default function UnderWaterInput() { useEffect(() => { if (!isInit) { initializeCommonData(); - searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0"); + searchUnderWaterList(1, 10, defaultSearchYear); } - }, [isInit, initializeCommonData, searchUnderWaterList, selectSearchYear]); + }, [isInit, initializeCommonData, searchUnderWaterList, defaultSearchYear]); useEffect(() => { - if(!isMount) return ; + if(!isExcelDownClick) return ; const timer = setTimeout(() => { if (excelList && excelList.length > 0) { @@ -159,10 +164,12 @@ export default function UnderWaterInput() { sheetNameArray: ['지하수유입량 추정'], headerRange: 'A1:O1' }); + } else { + alert("조회된 결과가 없습니다."); } }, 1000); // 약간의 지연을 두고 다운로드 실행 return () => clearTimeout(timer); - }, [excelList, isMount]); + }, [excelList, isExcelDownClick]); /** * 콜백함수 @@ -217,7 +224,7 @@ export default function UnderWaterInput() { } } searchFacilityPrecipitation(ref.current, 1, 5000); - setIsMount(true); + setIsExcelDownClick(true); }, [searchFacilityPrecipitation]); // 페이지 변경 @@ -276,4 +283,4 @@ export default function UnderWaterInput() { )} ); -} \ No newline at end of file +} diff --git a/apps/fo/app/store/common/index.tsx b/apps/fo/app/store/common/index.tsx index a381eb50d..d24305aa9 100644 --- a/apps/fo/app/store/common/index.tsx +++ b/apps/fo/app/store/common/index.tsx @@ -12,6 +12,8 @@ import { getFetch, getFetchAreaList } from "@/app/components/api"; export type SelectDataType = { text: string; val: string; + selected?: boolean; + hidden?: boolean; } // grid header export type TableUpperProps = { @@ -160,23 +162,21 @@ const selectFacilityPartData: SelectDataType[] = [ const getYearData = () => { const today = new Date(); const year = today.getFullYear(); - const month = today.getMonth() + 1; + // const month = today.getMonth() + 1; // 상반기(6월까지)는 2년 전, 하반기는 1년 전부터 시작 - const startYear = month <= 6 ? (year - 2) : (year - 1); + // const startYear = month <= 6 ? (year - 2) : (year - 1); + const startYear = year - 1; - const year1 = startYear; - const year2 = startYear - 1; - const year3 = startYear - 2; - const year4 = startYear - 3; - const year5 = startYear - 4; - return [ - { text: year1 + "년", val: year1.toString() }, - { text: year2 + "년", val: year2.toString() }, - { text: year3 + "년", val: year3.toString() }, - { text: year4 + "년", val: year4.toString() }, - { text: year5 + "년", val: year5.toString() }, - ] + // 최근 10개년도 제공 (기본값: 첫 번째 항목 선택) + return Array.from({ length: 10 }, (_, index) => { + const targetYear = startYear - index; + return { + text: `${targetYear}년`, + val: targetYear.toString(), + selected: index === 0, + }; + }); } const selectSearchYear: SelectDataType[] = getYearData(); @@ -486,4 +486,4 @@ export const CommonReducer = ( } } -export type CommonStore = CommonType & CommonAction; \ No newline at end of file +export type CommonStore = CommonType & CommonAction; diff --git a/packages/common/business_components/src/ui/select/index.tsx b/packages/common/business_components/src/ui/select/index.tsx index f9dac92d6..32510eb18 100644 --- a/packages/common/business_components/src/ui/select/index.tsx +++ b/packages/common/business_components/src/ui/select/index.tsx @@ -1,7 +1,8 @@ // selectBox import { Label } from "@common/components"; -import React, { useEffect, useState } from "react"; +// import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import { Select, SelectContent, @@ -15,6 +16,7 @@ interface SelectBox1 { text: string; val: string | number; hidden?: boolean; + selected?: boolean; } const SelectBox = React.forwardRef< @@ -51,18 +53,22 @@ const SelectBox = React.forwardRef< const [isOpen, setIsOpen] = useState(false); // hidden이 true인 항목만 드롭다운에서 제외 const visibleItems = selectArray.filter((item) => !item.hidden); + const selectedItem = visibleItems.find((item) => item.selected); + + const resolvedValue = + value === undefined && selectedItem ? selectedItem.val : value; // 현재 값이 hidden 항목이거나 빈 값인 경우 undefined로 설정하여 placeholder가 표시되도록 함 const currentValue = - value !== undefined && + resolvedValue !== undefined && hiddenItem && - (String(value) === String(hiddenItem.val) || - value === "" || - value === "0" || - value === 0) + (String(resolvedValue) === String(hiddenItem.val) || + resolvedValue === "" || + resolvedValue === "0" || + resolvedValue === 0) ? undefined - : value !== undefined - ? String(value) + : resolvedValue !== undefined + ? String(resolvedValue) : undefined; return ( From 5faced2928a4741d8584bdda4ea6c4019e2eb75f Mon Sep 17 00:00:00 2001 From: ljpark Date: Thu, 29 Jan 2026 09:12:00 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fo:=20default=20=EB=85=84=EB=8F=84=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/common/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/fo/app/store/common/index.tsx b/apps/fo/app/store/common/index.tsx index d24305aa9..f71550f1a 100644 --- a/apps/fo/app/store/common/index.tsx +++ b/apps/fo/app/store/common/index.tsx @@ -162,11 +162,11 @@ const selectFacilityPartData: SelectDataType[] = [ const getYearData = () => { const today = new Date(); const year = today.getFullYear(); - // const month = today.getMonth() + 1; - + const month = today.getMonth() + 1; + // 상반기(6월까지)는 2년 전, 하반기는 1년 전부터 시작 - // const startYear = month <= 6 ? (year - 2) : (year - 1); - const startYear = year - 1; + const defaultIdx = month <= 6 ? 2 : 1; + const startYear = year; // 최근 10개년도 제공 (기본값: 첫 번째 항목 선택) return Array.from({ length: 10 }, (_, index) => { @@ -174,7 +174,7 @@ const getYearData = () => { return { text: `${targetYear}년`, val: targetYear.toString(), - selected: index === 0, + selected: index === defaultIdx, }; }); }