From 36294fef80a0109abecaf4e67356fe413ec7d212 Mon Sep 17 00:00:00 2001 From: dongsilove Date: Mon, 12 Jan 2026 10:28:36 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fo:=20=EC=B2=98=EB=A6=AC=EA=B5=AC=EC=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/(with-layout)/processArea/page.tsx | 3 +- apps/fo/app/store/processArea/index.tsx | 522 +++++++++--------- 2 files changed, 264 insertions(+), 261 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/processArea/page.tsx b/apps/fo/app/pages/(with-layout)/processArea/page.tsx index 009d72c9f..ba1e27767 100644 --- a/apps/fo/app/pages/(with-layout)/processArea/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processArea/page.tsx @@ -167,7 +167,8 @@ export default function ProcessArea() {
- index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList} headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} /> + index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList} + headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} />
diff --git a/apps/fo/app/store/processArea/index.tsx b/apps/fo/app/store/processArea/index.tsx index 959b83794..31da21bfc 100644 --- a/apps/fo/app/store/processArea/index.tsx +++ b/apps/fo/app/store/processArea/index.tsx @@ -12,52 +12,52 @@ export type { TableUpperProps }; */ // 처리구역 리스트 export type ProcessAreaProps = { - swtrmtFcltCd : string, + swtrmtFcltCd: string, ctpvNm?: string, sggNm?: string, - swtrmtFcltNm : string, - location : string, - fctCpc : number | '', - fcltCpctSum : number | '', - ruse : boolean, - planYrDt4 : string, - planYr : string, - planYrDc1 : string, - planYrDc2 : string, - planYrDc3 : string, - planYrDc4 : string, + swtrmtFcltNm: string, + location: string, + fctCpc: number | '', + fcltCpctSum: number | '', + ruse: boolean, + planYrDt4: string, + planYr: string, + planYrDc1: string, + planYrDc2: string, + planYrDc3: string, + planYrDc4: string, /** * 증설계획 */ // 기승인(당초4단계), 현재, 변경1~4 - planSwageQntSumDt4 : number | '', - planSwageQntSum : number | '', - planSwageQntSumDc1 : number | '', - planSwageQntSumDc2 : number | '', - planSwageQntSumDc3 : number | '', - planSwageQntSumDc4 : number | '', + planSwageQntSumDt4: number | '', + planSwageQntSum: number | '', + planSwageQntSumDc1: number | '', + planSwageQntSumDc2: number | '', + planSwageQntSumDc3: number | '', + planSwageQntSumDc4: number | '', /** * 처리인구 */ // 기승인(당초4단계), 변경1~4 - swtrmtPpltnCntDt4 : number | '', - swtrmtPpltnCnt : number | '', - swtrmtPpltnCntDc1 : number | '', - swtrmtPpltnCntDc2 : number | '', - swtrmtPpltnCntDc3 : number | '', - swtrmtPpltnCntDc4 : number | '', + swtrmtPpltnCntDt4: number | '', + swtrmtPpltnCnt: number | '', + swtrmtPpltnCntDc1: number | '', + swtrmtPpltnCntDc2: number | '', + swtrmtPpltnCntDc3: number | '', + swtrmtPpltnCntDc4: number | '', /** * 처리구역면적 */ // 기승인(당초4단계), 변경1~4 - swtrmtZoneAreaDt4 : number | '', - swtrmtZoneArea : number | '', - swtrmtZoneAreaDc1 : number | '', - swtrmtZoneAreaDc2 : number | '', - swtrmtZoneAreaDc3 : number | '', - swtrmtZoneAreaDc4 : number | '', + swtrmtZoneAreaDt4: number | '', + swtrmtZoneArea: number | '', + swtrmtZoneAreaDc1: number | '', + swtrmtZoneAreaDc2: number | '', + swtrmtZoneAreaDc3: number | '', + swtrmtZoneAreaDc4: number | '', // 처리구역 - trtDstr : string | '', + trtDstr: string | '', } export interface ExcelType { @@ -89,32 +89,32 @@ export interface ExcelType { // (2) 처리구역 팝업 // 시설증설 계획 export type FcltyImproveInfoProps = { - planSwageQntSumDt4 : number | '', - planSwageQntSum : number | '', - planSwageQntSumDc1 : number | '', - planSwageQntSumDc2 : number | '', - planSwageQntSumDc3 : number | '', - planSwageQntSumDc4 : number | '', + planSwageQntSumDt4: number | '', + planSwageQntSum: number | '', + planSwageQntSumDc1: number | '', + planSwageQntSumDc2: number | '', + planSwageQntSumDc3: number | '', + planSwageQntSumDc4: number | '', } // 처리인구 계획 export type ProcessPopulationProps = { - swtrmtPpltnCntDt4 : number | '', - swtrmtPpltnCnt : number | '', - swtrmtPpltnCntDc1 : number | '', - swtrmtPpltnCntDc2 : number | '', - swtrmtPpltnCntDc3 : number | '', - swtrmtPpltnCntDc4 : number | '', + swtrmtPpltnCntDt4: number | '', + swtrmtPpltnCnt: number | '', + swtrmtPpltnCntDc1: number | '', + swtrmtPpltnCntDc2: number | '', + swtrmtPpltnCntDc3: number | '', + swtrmtPpltnCntDc4: number | '', } // 처리구역 계획 export type ProcessAreaPlanProps = { - swtrmtZoneAreaDt4 : number | '', - swtrmtZoneArea : number | '', - swtrmtZoneAreaDc1 : number | '', - swtrmtZoneAreaDc2 : number | '', - swtrmtZoneAreaDc3 : number | '', - swtrmtZoneAreaDc4 : number | '', - trtDstr : string, + swtrmtZoneAreaDt4: number | '', + swtrmtZoneArea: number | '', + swtrmtZoneAreaDc1: number | '', + swtrmtZoneAreaDc2: number | '', + swtrmtZoneAreaDc3: number | '', + swtrmtZoneAreaDc4: number | '', + trtDstr: string, } /**==================================== @@ -123,93 +123,93 @@ export type ProcessAreaPlanProps = { /** * (1) 메인페이지 - */ + */ // 검색단 -const ProcessFacilityLabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '시설상태', '연도별', '권역', '단위유역', '중권역', '환경청별']; +const ProcessFacilityLabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '시설상태', '연도별', '권역', '단위유역', '중권역', '환경청별']; // 리스트 헤더(행정별) -const upHeadList1:TableUpperProps[] = [ - { id: "A", title: "행정구역", colSpan:2, rowSpan:2, row:0 }, - { id: "ctpvNm", title: "시도", upName:"upChangeRe", row:2, widthPercent:4 }, - { id: "sggNm", title: "시군구", upName:"upChangeRe", row:2, widthPercent:4 }, - { id: "swtrmtFcltNm", title: "시설명", rowSpan:3, row:0, widthPercent: 6 }, - { id: "location", title: "주소", rowSpan:3, row:0, widthPercent: 12 }, - { id: "fctCpc", title: "시설용량(m³/일)", align:"right", rowSpan:3, row:0, widthPercent: 5 }, - { id: "B", title: "시설계획", colSpan:19, row: 0 }, - { id: "C", title: "증설계획(m³/일)", colSpan:6, row: 1 }, - { id: "planSwageQntSumDt4", title: "기승인\n4단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "planSwageQntSum", title: "현재", row:2, align:"right", widthPercent: 3.5 }, - { id: "planSwageQntSumDc1", title: "1단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "planSwageQntSumDc2", title: "2단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "planSwageQntSumDc3", title: "3단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "planSwageQntSumDc4", title: "4단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "D", title: "처리인구(인)", colSpan:6, row:1 }, - { id: "swtrmtPpltnCntDt4", title: "기승인\n4단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtPpltnCnt", title: "현재", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtPpltnCntDc1", title: "1단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtPpltnCntDc2", title: "2단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtPpltnCntDc3", title: "3단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtPpltnCntDc4", title: "4단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "E", title: "처리구역(km²)", colSpan:7, row:1 }, - { id: "swtrmtZoneAreaDt4", title: "기승인\n4단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtZoneArea", title: "현재", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtZoneAreaDc1", title: "1단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtZoneAreaDc2", title: "2단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtZoneAreaDc3", title: "3단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "swtrmtZoneAreaDc4", title: "4단계", row:2, align:"right", widthPercent: 3.5 }, - { id: "trtDstr", title: "처리구역", row:2} +const upHeadList1: TableUpperProps[] = [ + { id: "A", title: "행정구역", colSpan: 2, rowSpan: 2, row: 0 }, + { id: "ctpvNm", title: "시도", upName: "upChangeRe", row: 2, widthPercent: 4 }, + { id: "sggNm", title: "시군구", upName: "upChangeRe", row: 2, widthPercent: 4 }, + { id: "swtrmtFcltNm", title: "시설명", rowSpan: 3, row: 0, widthPercent: 6 }, + { id: "location", title: "주소", rowSpan: 3, row: 0, widthPercent: 12 }, + { id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 3, row: 0, widthPercent: 5 }, + { id: "B", title: "시설계획", colSpan: 18, row: 0 }, + { id: "C", title: "증설계획(m³/일)", colSpan: 6, row: 1 }, + { id: "planSwageQntSumDt4", title: "기승인\n4단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "planSwageQntSum", title: "현재", row: 2, align: "right", widthPercent: 3.5 }, + { id: "planSwageQntSumDc1", title: "1단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "planSwageQntSumDc2", title: "2단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "planSwageQntSumDc3", title: "3단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "planSwageQntSumDc4", title: "4단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "D", title: "처리인구(인)", colSpan: 6, row: 1 }, + { id: "swtrmtPpltnCntDt4", title: "기승인\n4단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtPpltnCnt", title: "현재", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtPpltnCntDc1", title: "1단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtPpltnCntDc2", title: "2단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtPpltnCntDc3", title: "3단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtPpltnCntDc4", title: "4단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "E", title: "처리구역(km²)", colSpan: 6, row: 1 }, + { id: "swtrmtZoneAreaDt4", title: "기승인\n4단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtZoneArea", title: "현재", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtZoneAreaDc1", title: "1단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtZoneAreaDc2", title: "2단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtZoneAreaDc3", title: "3단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "swtrmtZoneAreaDc4", title: "4단계", row: 2, align: "right", widthPercent: 3.5 }, + { id: "trtDstr", title: "처리구역", row: 0, rowSpan: 3 } // row - header에서 몇번째 행인지 ]; -const processAreaList:ProcessAreaProps[] = [ +const processAreaList: ProcessAreaProps[] = [ ] /** * 처리구역정보 상세팝업 - */ + */ // 시설증설 계획 (헤더) -const upHeadListFcltyImproveInfo:TableUpperProps[] = [ - { id: "planSwageQntSumDt4", title: "기승인\n4단계(m³/일)", rowSpan:2, row:0, align:"right"}, - { id: "A", title: "증설계획(m³/일)", colSpan:5, row:0}, - { id: "planSwageQntSum", title: "현재", row:1, align:"right"}, - { id: "planSwageQntSumDc1", title: "1단계", row:1, align:"right"}, - { id: "planSwageQntSumDc2", title: "2단계", row:1, align:"right"}, - { id: "planSwageQntSumDc3", title: "3단계", row:1, align:"right"}, - { id: "planSwageQntSumDc4", title: "4단계", row:1, align:"right"}, +const upHeadListFcltyImproveInfo: TableUpperProps[] = [ + { id: "planSwageQntSumDt4", title: "기승인\n4단계(m³/일)", rowSpan: 2, row: 0, align: "right" }, + { id: "A", title: "증설계획(m³/일)", colSpan: 5, row: 0 }, + { id: "planSwageQntSum", title: "현재", row: 1, align: "right" }, + { id: "planSwageQntSumDc1", title: "1단계", row: 1, align: "right" }, + { id: "planSwageQntSumDc2", title: "2단계", row: 1, align: "right" }, + { id: "planSwageQntSumDc3", title: "3단계", row: 1, align: "right" }, + { id: "planSwageQntSumDc4", title: "4단계", row: 1, align: "right" }, ]; // 시설증설 계획 (리스트) -const gridListFcltyImproveInfo:FcltyImproveInfoProps[] = [ +const gridListFcltyImproveInfo: FcltyImproveInfoProps[] = [ ]; // 처리인구 계획 (헤더) -const upHeadListProcessPopulation:TableUpperProps[] = [ - { id: "swtrmtPpltnCntDt4", title: "기승인\n4단계(인)", rowSpan:2, row:0, align:"right"}, - { id: "A", title: "처리인구(인)", colSpan:5, row:0}, - { id: "swtrmtPpltnCnt", title: "현재", row:1, align:"right"}, - { id: "swtrmtPpltnCntDc1", title: "1단계", row:1, align:"right"}, - { id: "swtrmtPpltnCntDc2", title: "2단계", row:1, align:"right"}, - { id: "swtrmtPpltnCntDc3", title: "3단계", row:1, align:"right"}, - { id: "swtrmtPpltnCntDc4", title: "4단계", row:1, align:"right"}, +const upHeadListProcessPopulation: TableUpperProps[] = [ + { id: "swtrmtPpltnCntDt4", title: "기승인\n4단계(인)", rowSpan: 2, row: 0, align: "right" }, + { id: "A", title: "처리인구(인)", colSpan: 5, row: 0 }, + { id: "swtrmtPpltnCnt", title: "현재", row: 1, align: "right" }, + { id: "swtrmtPpltnCntDc1", title: "1단계", row: 1, align: "right" }, + { id: "swtrmtPpltnCntDc2", title: "2단계", row: 1, align: "right" }, + { id: "swtrmtPpltnCntDc3", title: "3단계", row: 1, align: "right" }, + { id: "swtrmtPpltnCntDc4", title: "4단계", row: 1, align: "right" }, ]; // 처리인구 계획 (리스트) -const gridListProcessPopulation:ProcessPopulationProps[] = [ +const gridListProcessPopulation: ProcessPopulationProps[] = [ ]; // 처리구역 계획 (헤더) -const upHeadListProcessAreaPlan:TableUpperProps[] = [ - { id: "swtrmtZoneAreaDt4", title: "기승인\n4단계(km²)", rowSpan:2, row:0, align:"right"}, - { id: "A", title: "처리면적(km²)", colSpan:6, row:0, align:"right"}, - { id: "swtrmtZoneArea", title: "현재", row:1, align:"right"}, - { id: "swtrmtZoneAreaDc1", title: "1단계", row:1, align:"right"}, - { id: "swtrmtZoneAreaDc2", title: "2단계", row:1, align:"right"}, - { id: "swtrmtZoneAreaDc3", title: "3단계", row:1, align:"right"}, - { id: "swtrmtZoneAreaDc4", title: "4단계", row:1, align:"right"}, - { id: "trtDstr", title: "처리구역", row:1} +const upHeadListProcessAreaPlan: TableUpperProps[] = [ + { id: "swtrmtZoneAreaDt4", title: "기승인\n4단계(km²)", rowSpan: 2, row: 0, align: "right" }, + { id: "A", title: "처리면적(km²)", colSpan: 5, row: 0, align: "right" }, + { id: "swtrmtZoneArea", title: "현재", row: 1, align: "right" }, + { id: "swtrmtZoneAreaDc1", title: "1단계", row: 1, align: "right" }, + { id: "swtrmtZoneAreaDc2", title: "2단계", row: 1, align: "right" }, + { id: "swtrmtZoneAreaDc3", title: "3단계", row: 1, align: "right" }, + { id: "swtrmtZoneAreaDc4", title: "4단계", row: 1, align: "right" }, + // { id: "trtDstr", title: "처리구역", row: 1 } ]; // 시설증설 계획 (리스트) -const gridListProcessAreaPlan:ProcessAreaPlanProps[] = [ +const gridListProcessAreaPlan: ProcessAreaPlanProps[] = [ ]; /**==================================== @@ -227,113 +227,115 @@ const gridListProcessAreaPlan:ProcessAreaPlanProps[] = [ } }; */ -const fetchFacilityDetailInfo = async (pageNo:number, pageSize:number, swtrmtFcltCd: string[]) : Promise<{data:any[], count:number}> => { - try { - const res = await postFetch('fo', '/prcsFclt/ruseInfo/'+pageNo+'/'+pageSize, swtrmtFcltCd); - return {data: res.data, count:res.count}; - } catch (error) { - console.error('시설정보 데이터를 가져오는데 실패했습니다:', error); - return {data:[], count:0}; - } +const fetchFacilityDetailInfo = async (pageNo: number, pageSize: number, swtrmtFcltCd: string[]): Promise<{ data: any[], count: number }> => { + try { + const res = await postFetch('fo', '/prcsFclt/ruseInfo/' + pageNo + '/' + pageSize, swtrmtFcltCd); + return { data: res.data, count: res.count }; + } catch (error) { + console.error('시설정보 데이터를 가져오는데 실패했습니다:', error); + return { data: [], count: 0 }; + } }; // 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) -const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined, set : (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{data:any[], count:number}> => { - try { - const res = await fetchPlanInfo(targetYear, ctpvNm, sggNm, undefined); - if(res && res.length > 0){ - const enrichedData = await Promise.all( - res.map(async (item: ProcessAreaProps) => { - upHeadList1.forEach((head:TableUpperProps) => { - /* if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { - head.title = '현재\n(' + item.planYr + '년)'; - } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { - head.title = '1단계\n(' + item.planYrDc1 + '년)'; - } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { - head.title = '2단계\n(' + item.planYrDc2 + '년)'; - } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { - head.title = '3단계\n(' + item.planYrDc3 + '년)'; - } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { - head.title = '4단계\n(' + item.planYrDc4 + '년)'; - } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { - head.title = '기승인\n4단계(' + item.planYrDt4 + '년)'; - } */ - if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { - head.title = '현재'; - } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { - head.title = '1단계'; - } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { - head.title = '2단계'; - } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { - head.title = '3단계'; - } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { - head.title = '4단계'; - } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { - head.title = '기승인\n4단계'; - } - }); - return item; +const fetchProcessAreaList = async (pageNo: number, pageSize: number, ctpvNm: string | undefined, sggNm: string | undefined + , targetYear: string | undefined, set: (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{ data: any[], count: number }> => { + try { + const res = await fetchPlanInfo(targetYear, ctpvNm, sggNm, undefined); + if (res && res.length > 0) { + const enrichedData = await Promise.all( + res.map(async (item: ProcessAreaProps) => { + upHeadList1.forEach((head: TableUpperProps) => { + /* if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { + head.title = '현재\n(' + item.planYr + '년)'; + } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { + head.title = '1단계\n(' + item.planYrDc1 + '년)'; + } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { + head.title = '2단계\n(' + item.planYrDc2 + '년)'; + } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { + head.title = '3단계\n(' + item.planYrDc3 + '년)'; + } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { + head.title = '4단계\n(' + item.planYrDc4 + '년)'; + } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { + head.title = '기승인\n4단계(' + item.planYrDt4 + '년)'; + } */ + if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { + head.title = '현재'; + } else if (head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { + head.title = '1단계'; + } else if (head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { + head.title = '2단계'; + } else if (head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { + head.title = '3단계'; + } else if (head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { + head.title = '4단계'; + } else if (head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { + head.title = '기승인\n4단계'; + } + }); + return item; + }) + ); + + const startIndex = (pageNo - 1) * pageSize; + const endIndex = startIndex + pageSize; + const paginatedData = enrichedData.slice(startIndex, endIndex); + + const fcltyCdList: string[] = []; + paginatedData.forEach(item => { + fcltyCdList.push(item.swtrmtFcltCd); }) - ); - const startIndex = (pageNo - 1) * pageSize; - const endIndex = startIndex + pageSize; - const paginatedData = enrichedData.slice(startIndex, endIndex); - - const fcltyCdList : string[]= []; - paginatedData.forEach(item => { - fcltyCdList.push(item.swtrmtFcltCd); - }) - - const detailFcltylist = await fetchFacilityDetailInfo(1, pageSize, fcltyCdList); - paginatedData.forEach(item => { - const filterdData = detailFcltylist.data.filter(fItem=>fItem.bscFctCd === item.swtrmtFcltCd)[0] || null; - item.fcltCpctSum = filterdData ? filterdData.fctCpc : ''; - item.location = filterdData ? filterdData.addr : ''; - item.ctpvNm = filterdData ? filterdData.sido : ''; - item.sggNm = filterdData ? filterdData.gugun : ''; - }); - return {data: paginatedData, count: enrichedData.length}; - }else{ - return {data: [], count: 0}; - } - } catch (error) { - console.error('시설계획정보를 가져오는데 실패했습니다:', error); - set((state) => ({ - ...state, - ProcessArea : { - ...state.ProcessArea, - isLoading : false + const detailFcltylist = await fetchFacilityDetailInfo(1, pageSize, fcltyCdList); + paginatedData.forEach(item => { + const filterdData = detailFcltylist.data.filter(fItem => fItem.bscFctCd === item.swtrmtFcltCd)[0] || null; + item.fcltCpctSum = filterdData ? filterdData.fctCpc : ''; + item.location = filterdData ? filterdData.addr : ''; + item.ctpvNm = filterdData ? filterdData.sido : ''; + item.sggNm = filterdData ? filterdData.gugun : ''; + item.trtDstr = filterdData ? filterdData.trtDstr : ''; + }); + return { data: paginatedData, count: enrichedData.length }; + } else { + return { data: [], count: 0 }; } - })); - return {data: [], count: 0}; - } + } catch (error) { + console.error('시설계획정보를 가져오는데 실패했습니다:', error); + set((state) => ({ + ...state, + ProcessArea: { + ...state.ProcessArea, + isLoading: false + } + })); + return { data: [], count: 0 }; + } }; /**==================================== * Store - expaort =====================================*/ export type ProcessAreaActions = { - searchProcessAreaList : (pageNo: number, pageSize: number, ctpvNm?:string, sggNm?:string, targetYear?:string) => void; - initModalData : (swtrmtFcltCd:string) => void; + searchProcessAreaList: (pageNo: number, pageSize: number, ctpvNm?: string, sggNm?: string, targetYear?: string) => void; + initModalData: (swtrmtFcltCd: string) => void; } export type ProcessAreaType = { ProcessAreaSearch: { isInit: boolean; - processFacilityLabelArray:string[]; + processFacilityLabelArray: string[]; }, - ProcessArea : { + ProcessArea: { isInit: boolean; upHeadList1: TableUpperProps[]; processAreaList: ProcessAreaProps[]; processAreaCount: number; excelList: ExcelType[]; isLoading: boolean; - }, + }, - ProcessAreaDetail : { + ProcessAreaDetail: { isInit: boolean; upHeadListFcltyImproveInfo: TableUpperProps[]; gridListFcltyImproveInfo: FcltyImproveInfoProps[]; // Changed from facilityAreaProps to ProcessAreaProps @@ -350,23 +352,23 @@ export const processAreaInitState: ProcessAreaType = { processFacilityLabelArray: ProcessFacilityLabelArray, }, - ProcessArea : { - isInit : false, - upHeadList1 : upHeadList1, - processAreaList : processAreaList, - processAreaCount : 0, - excelList : [], - isLoading : true, + ProcessArea: { + isInit: false, + upHeadList1: upHeadList1, + processAreaList: processAreaList, + processAreaCount: 0, + excelList: [], + isLoading: true, }, - ProcessAreaDetail : { - isInit : false, - upHeadListFcltyImproveInfo : upHeadListFcltyImproveInfo, - gridListFcltyImproveInfo : gridListFcltyImproveInfo, - upHeadListProcessPopulation : upHeadListProcessPopulation, - gridListProcessPopulation : gridListProcessPopulation, - upHeadListProcessAreaPlan : upHeadListProcessAreaPlan, - gridListProcessAreaPlan : gridListProcessAreaPlan, + ProcessAreaDetail: { + isInit: false, + upHeadListFcltyImproveInfo: upHeadListFcltyImproveInfo, + gridListFcltyImproveInfo: gridListFcltyImproveInfo, + upHeadListProcessPopulation: upHeadListProcessPopulation, + gridListProcessPopulation: gridListProcessPopulation, + upHeadListProcessAreaPlan: upHeadListProcessAreaPlan, + gridListProcessAreaPlan: gridListProcessAreaPlan, }, } @@ -375,14 +377,14 @@ type SetStateFunction = (state: ProcessAreaType | ((state: ProcessAreaType) => P export type ProcessAreaStore = ProcessAreaType & ProcessAreaActions; -export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set: SetStateFunction) => { +export const processAreaReducer: (set: SetStateFunction) => ProcessAreaActions = (set: SetStateFunction) => { return { /** * 시설정보 리스트 데이터 호출 * @param pageNo : 페이지 번호 * @param pageSize : 페이지 크기 */ - searchProcessAreaList: async ( pageNo:number, pageSize:number, ctpvNm?:string, sggNm?:string, targetYear?:string) => { + searchProcessAreaList: async (pageNo: number, pageSize: number, ctpvNm?: string, sggNm?: string, targetYear?: string) => { set((state: ProcessAreaType) => ({ ...state, ProcessArea: { @@ -391,12 +393,12 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set: }, })); const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set); - res.data.forEach((item:ProcessAreaProps) => { + res.data.forEach((item: ProcessAreaProps) => { item.fctCpc = item.fcltCpctSum; - DataForm({ type: 'float1', column: 'fctCpc', item:item as unknown as Record}); + DataForm({ type: 'float1', column: 'fctCpc', item: item as unknown as Record }); }) const excelDownList: ExcelType[] = []; - if(pageSize>5000){ + if (pageSize > 5000) { res.data.forEach(item => { item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : ''; excelDownList.push({ @@ -425,78 +427,78 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set: 처리구역: item.trtDstr }); }); - }else{ + } else { res.data.forEach(item => { item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : ''; }) } - set((state:ProcessAreaType) => ({ + set((state: ProcessAreaType) => ({ ...state, - ProcessArea: pageSize<5000?{ + ProcessArea: pageSize < 5000 ? { ...state.ProcessArea, processAreaList: res.data, processAreaCount: res.count, - isLoading : false, - }:{ + isLoading: false, + } : { ...state.ProcessArea, excelList: excelDownList, - isLoading : false, + isLoading: false, }, })) }, - initModalData: async (swtrmtFcltCd:string) => { + initModalData: async (swtrmtFcltCd: string) => { set((state: ProcessAreaType) => { const rtnData = state.ProcessArea.processAreaList.find((item: ProcessAreaProps) => item.swtrmtFcltCd === swtrmtFcltCd); if (rtnData) { - upHeadListFcltyImproveInfo.forEach((head:TableUpperProps) => { - if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { - head.title = rtnData.planYr? '현재\n(' + rtnData.planYr + '년)':head.title = '현재'; - } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { - head.title = rtnData.planYrDc1? '1단계\n(' + rtnData.planYrDc1 + '년)':head.title = '1단계'; - } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { - head.title = rtnData.planYrDc2? '2단계\n(' + rtnData.planYrDc2 + '년)':head.title = '2단계'; - } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { - head.title = rtnData.planYrDc3? '3단계\n(' + rtnData.planYrDc3 + '년)':head.title = '3단계'; - } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { - head.title = rtnData.planYrDc4? '4단계\n(' + rtnData.planYrDc4 + '년)':head.title = '4단계'; - } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { - head.title = rtnData.planYrDt4? '기승인\n4단계(' + rtnData.planYrDt4 + '년)':head.title = '기승인\n4단계'; + upHeadListFcltyImproveInfo.forEach((head: TableUpperProps) => { + if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { + head.title = rtnData.planYr ? '현재\n(' + rtnData.planYr + '년)' : head.title = '현재'; + } else if (head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { + head.title = rtnData.planYrDc1 ? '1단계\n(' + rtnData.planYrDc1 + '년)' : head.title = '1단계'; + } else if (head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { + head.title = rtnData.planYrDc2 ? '2단계\n(' + rtnData.planYrDc2 + '년)' : head.title = '2단계'; + } else if (head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { + head.title = rtnData.planYrDc3 ? '3단계\n(' + rtnData.planYrDc3 + '년)' : head.title = '3단계'; + } else if (head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { + head.title = rtnData.planYrDc4 ? '4단계\n(' + rtnData.planYrDc4 + '년)' : head.title = '4단계'; + } else if (head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { + head.title = rtnData.planYrDt4 ? '기승인\n4단계(' + rtnData.planYrDt4 + '년)' : head.title = '기승인\n4단계'; } }); - upHeadListProcessAreaPlan.forEach((head:TableUpperProps) => { - if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { - head.title = rtnData.planYr? '현재\n(' + rtnData.planYr + '년)':head.title = '현재'; - } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { - head.title = rtnData.planYrDc1?'1단계\n(' + rtnData.planYrDc1 + '년)':head.title = '1단계'; - } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { - head.title = rtnData.planYrDc2?'2단계\n(' + rtnData.planYrDc2 + '년)':head.title = '2단계'; - } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { - head.title = rtnData.planYrDc3? '3단계\n(' + rtnData.planYrDc3 + '년)':head.title = '3단계'; - } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { - head.title = rtnData.planYrDc4?'4단계\n(' + rtnData.planYrDc4 + '년)':head.title = '4단계'; - } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { - head.title = rtnData.planYrDt4?'기승인\n4단계(' + rtnData.planYrDt4 + '년)':head.title = '기승인\n4단계'; + upHeadListProcessAreaPlan.forEach((head: TableUpperProps) => { + if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { + head.title = rtnData.planYr ? '현재\n(' + rtnData.planYr + '년)' : head.title = '현재'; + } else if (head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { + head.title = rtnData.planYrDc1 ? '1단계\n(' + rtnData.planYrDc1 + '년)' : head.title = '1단계'; + } else if (head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { + head.title = rtnData.planYrDc2 ? '2단계\n(' + rtnData.planYrDc2 + '년)' : head.title = '2단계'; + } else if (head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { + head.title = rtnData.planYrDc3 ? '3단계\n(' + rtnData.planYrDc3 + '년)' : head.title = '3단계'; + } else if (head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { + head.title = rtnData.planYrDc4 ? '4단계\n(' + rtnData.planYrDc4 + '년)' : head.title = '4단계'; + } else if (head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { + head.title = rtnData.planYrDt4 ? '기승인\n4단계(' + rtnData.planYrDt4 + '년)' : head.title = '기승인\n4단계'; } }); - upHeadListProcessPopulation.forEach((head:TableUpperProps) => { - if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { - head.title = rtnData.planYr?'현재\n(' + rtnData.planYr + '년)':head.title = '현재'; - } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { - head.title = rtnData.planYrDc1?'1단계\n(' + rtnData.planYrDc1 + '년)':head.title = '1단계'; - } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { - head.title = rtnData.planYrDc2?'2단계\n(' + rtnData.planYrDc2 + '년)':head.title = '2단계'; - } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { - head.title = rtnData.planYrDc3?'3단계\n(' + rtnData.planYrDc3 + '년)':head.title = '3단계'; - } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { - head.title = rtnData.planYrDc4?'4단계\n(' + rtnData.planYrDc4 + '년)':head.title = '4단계'; - } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { - head.title = rtnData.planYrDt4?'기승인\n4단계(' + rtnData.planYrDt4 + '년)':head.title = '기승인\n4단계'; + upHeadListProcessPopulation.forEach((head: TableUpperProps) => { + if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { + head.title = rtnData.planYr ? '현재\n(' + rtnData.planYr + '년)' : head.title = '현재'; + } else if (head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { + head.title = rtnData.planYrDc1 ? '1단계\n(' + rtnData.planYrDc1 + '년)' : head.title = '1단계'; + } else if (head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { + head.title = rtnData.planYrDc2 ? '2단계\n(' + rtnData.planYrDc2 + '년)' : head.title = '2단계'; + } else if (head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { + head.title = rtnData.planYrDc3 ? '3단계\n(' + rtnData.planYrDc3 + '년)' : head.title = '3단계'; + } else if (head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { + head.title = rtnData.planYrDc4 ? '4단계\n(' + rtnData.planYrDc4 + '년)' : head.title = '4단계'; + } else if (head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { + head.title = rtnData.planYrDt4 ? '기승인\n4단계(' + rtnData.planYrDt4 + '년)' : head.title = '기승인\n4단계'; } }); - + // 시설증설 계획 데이터 생성 const fcltyImproveInfo: FcltyImproveInfoProps = { planSwageQntSumDt4: rtnData.planSwageQntSumDt4, From fe216499ec097caf6335a850b84bc09412e61c7d Mon Sep 17 00:00:00 2001 From: dongsilove Date: Mon, 12 Jan 2026 13:43:26 +0900 Subject: [PATCH 2/8] =?UTF-8?q?fo:=20=EC=A3=BC=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityWaterQlty/modal/page.tsx | 393 ++++++++---------- .../(with-layout)/facilityWaterQlty/page.tsx | 46 +- apps/fo/app/store/facilityWaterQlty/index.tsx | 317 +++++++------- 3 files changed, 346 insertions(+), 410 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx index c10fd50cf..76c65ca3b 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx @@ -25,10 +25,10 @@ const commentArrayRain = [ "강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날" ]; -type ModalProps ={ +type ModalProps = { fcltyName: string; - facilityCd : string; - searchYear : string; + facilityCd: string; + searchYear: string; } const tabList1 = [ @@ -50,15 +50,15 @@ const tabList3 = [ { value: 'tab_term_winter_chongin', label: '동절기' } ]; -export default function WaterQualityModal({fcltyName='', facilityCd='', searchYear=new Date().getFullYear().toString()} : ModalProps) { +export default function WaterQualityModal({ fcltyName = '', facilityCd = '', searchYear = new Date().getFullYear().toString() }: ModalProps) { const [tabName, setTabName] = useState('tab_num1'); // 그리드 관련 - const {FacilityWaterQltyModal, + const { FacilityWaterQltyModal, searchFacilityWaterQltyListHist, Common } = useFoStore((state) => state); - const {btnClass, COD_YEAR} = Common; + const { btnClass, COD_YEAR } = Common; const { upHeadListModalYear, upHeadListModalYearCod, @@ -71,7 +71,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe const prevExcelListRef = useRef(null); const prevChoinginExcelListRef = useRef(null); - + // 필터링 된 후 최대, 최소, 평균 값 계산 const setFilterAfterData = (filteredData: FacilityWaterQltyProps[]) => { // 쉼표가 포함된 문자열을 숫자로 변환하는 함수 @@ -100,7 +100,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let maxNoProcessInflAmnt = 0; let maxInfoRnDay = 0; - + // 초기값 설정 let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0; let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0; @@ -108,14 +108,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let minefflWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltToc) : 0; let minefflWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltCod) : 0; let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0; - + let mininflAssctBfrWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltBod) : 0; let mininflAssctBfrWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTn) : 0; let minInflAssctBfrWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTp) : 0; let mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0; let mininflAssctBfrWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltCod) : 0; let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0; - + let minTpInflWqltBod = 99999999; let minTpInflWqltTp = 99999999; let minNoProcessInflAmnt = 99999999; @@ -143,27 +143,27 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let noProcessInflAmntCnt = 0; let avgInfoRnDay = 0; - + filteredData.forEach((item: FacilityWaterQltyProps) => { const efflWqltBod = parseNumber(item.efflWqltBod); const efflWqltTn = parseNumber(item.efflWqltTn); const efflWqltTp = parseNumber(item.efflWqltTp); const efflWqltToc = parseNumber(item.efflWqltToc); - const efflWqltCod = parseNumber(item.efflWqltCod?item.efflWqltCod.replaceAll("(","").replaceAll(")",""):0); + const efflWqltCod = parseNumber(item.efflWqltCod ? item.efflWqltCod.replaceAll("(", "").replaceAll(")", "") : 0); const efflWqltSs = parseNumber(item.efflWqltSs); const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod); const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn); const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp); const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc); - const inflAssctBfrWqltCod = parseNumber(item.inflAssctBfrWqltCod?item.inflAssctBfrWqltCod.replaceAll("(","").replaceAll(")",""):0); + const inflAssctBfrWqltCod = parseNumber(item.inflAssctBfrWqltCod ? item.inflAssctBfrWqltCod.replaceAll("(", "").replaceAll(")", "") : 0); const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs); const tpInflWqltBod = parseNumber(item.tpInflWqltBod); const tpInflWqltTp = parseNumber(item.tpInflWqltTp); - if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){ + if (item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined) { tpInflWqltBodCnt += 1; } - if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){ + if (item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined) { tpInflWqltTpCnt += 1; } @@ -175,7 +175,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc); maxefflWqltCod = Math.max(maxefflWqltCod, efflWqltCod); maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs); - + maxinflAssctBfrWqltBod = Math.max(maxinflAssctBfrWqltBod, inflAssctBfrWqltBod); maxinflAssctBfrWqltTn = Math.max(maxinflAssctBfrWqltTn, inflAssctBfrWqltTn); maxInflAssctBfrWqltTp = Math.max(maxInflAssctBfrWqltTp, inflAssctBfrWqltTp); @@ -202,11 +202,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe mininflAssctBfrWqltCod = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltCod); mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs); - if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){ + if (item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined) { minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod); avgTpInflWqltBod += tpInflWqltBod; } - if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){ + if (item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined) { minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp); avgTpInflWqltTp += tpInflWqltTp; } @@ -227,12 +227,12 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe avginflAssctBfrWqltCod += inflAssctBfrWqltCod; avginflAssctBfrWqltSs += inflAssctBfrWqltSs; - if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){ - const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',','')); + if (item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined) { + const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',', '')); avgNoProcessInflAmnt += noProcessInflAmnt; maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt); minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt); - noProcessInflAmntCnt +=1; + noProcessInflAmntCnt += 1; } avgInfoRnDay += infoRnDay; @@ -241,18 +241,18 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe const newFilteredData = [ { msrDt: '평균', - efflWqltBod: filteredData.length==0 || avgEfflWqltBod===0?'0.0':roundNumber((avgEfflWqltBod / filteredData.length), 1), - efflWqltToc: filteredData.length==0 || avgefflWqltToc===0?'0.0':roundNumber((avgefflWqltToc / filteredData.length), 1), - efflWqltCod: filteredData.length==0 || avgefflWqltCod===0?"(0.0)":"("+roundNumber((avgefflWqltCod / filteredData.length), 1)+")", - efflWqltSs: filteredData.length==0 || avgEfflWqltSs===0?'0.0':roundNumber((avgEfflWqltSs / filteredData.length), 1), - efflWqltTn: filteredData.length==0 || avgEfflWqltTn ===0?'0.000':roundNumber((avgEfflWqltTn / filteredData.length), 3), - efflWqltTp: filteredData.length==0 || avgEfflWqltTp ===0?'0.000':roundNumber((avgEfflWqltTp / filteredData.length), 3), - inflAssctBfrWqltBod: filteredData.length==0 || avginflAssctBfrWqltBod===0?'0.0':roundNumber((avginflAssctBfrWqltBod / filteredData.length), 1), - inflAssctBfrWqltTn: filteredData.length==0 || avginflAssctBfrWqltTn===0?'0.000':roundNumber((avginflAssctBfrWqltTn / filteredData.length), 3), - inflAssctBfrWqltTp: filteredData.length==0 || avgInflAssctBfrWqltTp===0?'0.000':roundNumber((avgInflAssctBfrWqltTp / filteredData.length), 3), - inflAssctBfrWqltToc: filteredData.length==0 || avginflAssctBfrWqltToc===0?'0.0':roundNumber((avginflAssctBfrWqltToc / filteredData.length), 1), - inflAssctBfrWqltCod: filteredData.length==0 || avginflAssctBfrWqltCod===0?'(0.0)':"("+roundNumber((avginflAssctBfrWqltCod / filteredData.length), 1)+")", - inflAssctBfrWqltSs: filteredData.length==0 || avginflAssctBfrWqltSs===0?'0.0':roundNumber((avginflAssctBfrWqltSs / filteredData.length), 1), + efflWqltBod: filteredData.length == 0 || avgEfflWqltBod === 0 ? '0.0' : roundNumber((avgEfflWqltBod / filteredData.length), 1), + efflWqltToc: filteredData.length == 0 || avgefflWqltToc === 0 ? '0.0' : roundNumber((avgefflWqltToc / filteredData.length), 1), + efflWqltCod: filteredData.length == 0 || avgefflWqltCod === 0 ? "(0.0)" : "(" + roundNumber((avgefflWqltCod / filteredData.length), 1) + ")", + efflWqltSs: filteredData.length == 0 || avgEfflWqltSs === 0 ? '0.0' : roundNumber((avgEfflWqltSs / filteredData.length), 1), + efflWqltTn: filteredData.length == 0 || avgEfflWqltTn === 0 ? '0.000' : roundNumber((avgEfflWqltTn / filteredData.length), 3), + efflWqltTp: filteredData.length == 0 || avgEfflWqltTp === 0 ? '0.000' : roundNumber((avgEfflWqltTp / filteredData.length), 3), + inflAssctBfrWqltBod: filteredData.length == 0 || avginflAssctBfrWqltBod === 0 ? '0.0' : roundNumber((avginflAssctBfrWqltBod / filteredData.length), 1), + inflAssctBfrWqltTn: filteredData.length == 0 || avginflAssctBfrWqltTn === 0 ? '0.000' : roundNumber((avginflAssctBfrWqltTn / filteredData.length), 3), + inflAssctBfrWqltTp: filteredData.length == 0 || avgInflAssctBfrWqltTp === 0 ? '0.000' : roundNumber((avgInflAssctBfrWqltTp / filteredData.length), 3), + inflAssctBfrWqltToc: filteredData.length == 0 || avginflAssctBfrWqltToc === 0 ? '0.0' : roundNumber((avginflAssctBfrWqltToc / filteredData.length), 1), + inflAssctBfrWqltCod: filteredData.length == 0 || avginflAssctBfrWqltCod === 0 ? '(0.0)' : "(" + roundNumber((avginflAssctBfrWqltCod / filteredData.length), 1) + ")", + inflAssctBfrWqltSs: filteredData.length == 0 || avginflAssctBfrWqltSs === 0 ? '0.0' : roundNumber((avginflAssctBfrWqltSs / filteredData.length), 1), bscFctCd: "", bscFctNm: "", lclgvrnmntNm: "", @@ -260,25 +260,25 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, - noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0), - infoRnDay: filteredData.length==0 || avgInfoRnDay===0?'0.0':roundNumber(avgInfoRnDay / filteredData.length, 1), - tpInflWqltBod: filteredData.length==0 || avgTpInflWqltBod ===0 ?'0.0':roundNumber(avgTpInflWqltBod / tpInflWqltBodCnt, 1), - tpInflWqltTp: filteredData.length==0 || avgTpInflWqltTp === 0?'0.000':roundNumber(avgTpInflWqltTp / tpInflWqltTpCnt, 3) + noProcessInflAmnt: roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0), + infoRnDay: filteredData.length == 0 || avgInfoRnDay === 0 ? '0.0' : roundNumber(avgInfoRnDay / filteredData.length, 1), + tpInflWqltBod: filteredData.length == 0 || avgTpInflWqltBod === 0 ? '0.0' : roundNumber(avgTpInflWqltBod / tpInflWqltBodCnt, 1), + tpInflWqltTp: filteredData.length == 0 || avgTpInflWqltTp === 0 ? '0.000' : roundNumber(avgTpInflWqltTp / tpInflWqltTpCnt, 3) }, { - msrDt : '최대', - efflWqltBod : Math.round(maxEfflWqltBod * 10) / 10?roundNumber(maxEfflWqltBod, 1):'0.0', - efflWqltToc : Math.round(maxefflWqltToc * 10) / 10?roundNumber(maxefflWqltToc, 1):'0.0', - efflWqltCod : Math.round(maxefflWqltCod * 10) / 10?"("+roundNumber(maxefflWqltCod, 1)+")":'(0.0)', - efflWqltSs : Math.round(maxEfflWqltSs * 10) / 10?roundNumber(maxEfflWqltSs, 1):'0.0', - efflWqltTn : Math.round(maxEfflWqltTn * 1000) / 1000?roundNumber(maxEfflWqltTn, 3):'0.000', - efflWqltTp : Math.round(maxEfflWqltTp * 1000) / 1000?roundNumber(maxEfflWqltTp, 3):'0.000', - inflAssctBfrWqltBod : Math.round(maxinflAssctBfrWqltBod * 10) / 10?roundNumber(maxinflAssctBfrWqltBod, 1):'0.0', - inflAssctBfrWqltTn : Math.round(maxinflAssctBfrWqltTn * 1000) / 1000?roundNumber(maxinflAssctBfrWqltTn, 3):'0.000', - inflAssctBfrWqltTp : Math.round(maxInflAssctBfrWqltTp * 1000) / 1000?roundNumber(maxInflAssctBfrWqltTp, 3):'0.000', - inflAssctBfrWqltToc : Math.round(maxinflAssctBfrWqltToc * 10) / 10?roundNumber(maxinflAssctBfrWqltToc, 1):'0.0', - inflAssctBfrWqltCod : Math.round(maxinflAssctBfrWqltCod * 10) / 10?"("+roundNumber(maxinflAssctBfrWqltCod, 1)+")":'(0.0)', - inflAssctBfrWqltSs : Math.round(maxinflAssctBfrWqltSs * 10) / 10?roundNumber(maxinflAssctBfrWqltSs, 1):'0.0', + msrDt: '최대', + efflWqltBod: Math.round(maxEfflWqltBod * 10) / 10 ? roundNumber(maxEfflWqltBod, 1) : '0.0', + efflWqltToc: Math.round(maxefflWqltToc * 10) / 10 ? roundNumber(maxefflWqltToc, 1) : '0.0', + efflWqltCod: Math.round(maxefflWqltCod * 10) / 10 ? "(" + roundNumber(maxefflWqltCod, 1) + ")" : '(0.0)', + efflWqltSs: Math.round(maxEfflWqltSs * 10) / 10 ? roundNumber(maxEfflWqltSs, 1) : '0.0', + efflWqltTn: Math.round(maxEfflWqltTn * 1000) / 1000 ? roundNumber(maxEfflWqltTn, 3) : '0.000', + efflWqltTp: Math.round(maxEfflWqltTp * 1000) / 1000 ? roundNumber(maxEfflWqltTp, 3) : '0.000', + inflAssctBfrWqltBod: Math.round(maxinflAssctBfrWqltBod * 10) / 10 ? roundNumber(maxinflAssctBfrWqltBod, 1) : '0.0', + inflAssctBfrWqltTn: Math.round(maxinflAssctBfrWqltTn * 1000) / 1000 ? roundNumber(maxinflAssctBfrWqltTn, 3) : '0.000', + inflAssctBfrWqltTp: Math.round(maxInflAssctBfrWqltTp * 1000) / 1000 ? roundNumber(maxInflAssctBfrWqltTp, 3) : '0.000', + inflAssctBfrWqltToc: Math.round(maxinflAssctBfrWqltToc * 10) / 10 ? roundNumber(maxinflAssctBfrWqltToc, 1) : '0.0', + inflAssctBfrWqltCod: Math.round(maxinflAssctBfrWqltCod * 10) / 10 ? "(" + roundNumber(maxinflAssctBfrWqltCod, 1) + ")" : '(0.0)', + inflAssctBfrWqltSs: Math.round(maxinflAssctBfrWqltSs * 10) / 10 ? roundNumber(maxinflAssctBfrWqltSs, 1) : '0.0', bscFctCd: "", bscFctNm: "", lclgvrnmntNm: "", @@ -286,25 +286,25 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, - noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0), - infoRnDay: Math.round(maxInfoRnDay * 10) / 10?roundNumber(maxInfoRnDay, 1):'0.0', - tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10?roundNumber(maxTpInflWqltBod, 1):'0.0', - tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000?roundNumber(maxTpInflWqltTp, 3):'0.000' + noProcessInflAmnt: roundNumber(maxNoProcessInflAmnt, 0), + infoRnDay: Math.round(maxInfoRnDay * 10) / 10 ? roundNumber(maxInfoRnDay, 1) : '0.0', + tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10 ? roundNumber(maxTpInflWqltBod, 1) : '0.0', + tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000 ? roundNumber(maxTpInflWqltTp, 3) : '0.000' }, { - msrDt : '최소', - efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?roundNumber(minEfflWqltBod, 1) : '0.0', - efflWqltToc : Math.round(minefflWqltToc * 10) / 10?roundNumber(minefflWqltToc, 1) : '0.0', - efflWqltCod : Math.round(minefflWqltCod * 10) / 10?"("+roundNumber(minefflWqltCod, 1)+")" : '(0.0)', - efflWqltSs : Math.round(minEfflWqltSs * 10) / 10?roundNumber(minEfflWqltSs, 1) : '0.0', - efflWqltTn : Math.round(minEfflWqltTn * 1000) / 1000?roundNumber(minEfflWqltTn, 3) : '0.000', - efflWqltTp : Math.round(minEfflWqltTp * 1000) / 1000?roundNumber(minEfflWqltTp, 3) : '0.000', - inflAssctBfrWqltBod : Math.round(mininflAssctBfrWqltBod * 10) / 10?roundNumber(mininflAssctBfrWqltBod, 1) : '0.0', - inflAssctBfrWqltTn : Math.round(mininflAssctBfrWqltTn * 1000) / 1000?roundNumber(mininflAssctBfrWqltTn, 3) : '0.000', - inflAssctBfrWqltTp : Math.round(minInflAssctBfrWqltTp * 1000) / 1000?roundNumber(minInflAssctBfrWqltTp, 3) : '0.000', - inflAssctBfrWqltToc : Math.round(mininflAssctBfrWqltToc * 10) / 10?roundNumber(mininflAssctBfrWqltToc, 1) : '0.0', - inflAssctBfrWqltCod : Math.round(mininflAssctBfrWqltCod * 10) / 10?"("+roundNumber(mininflAssctBfrWqltCod, 1)+")" : '(0.0)', - inflAssctBfrWqltSs : Math.round(mininflAssctBfrWqltSs * 10) / 10?roundNumber(mininflAssctBfrWqltSs, 1) : '0.0', + msrDt: '최소', + efflWqltBod: Math.round(minEfflWqltBod * 10) / 10 ? roundNumber(minEfflWqltBod, 1) : '0.0', + efflWqltToc: Math.round(minefflWqltToc * 10) / 10 ? roundNumber(minefflWqltToc, 1) : '0.0', + efflWqltCod: Math.round(minefflWqltCod * 10) / 10 ? "(" + roundNumber(minefflWqltCod, 1) + ")" : '(0.0)', + efflWqltSs: Math.round(minEfflWqltSs * 10) / 10 ? roundNumber(minEfflWqltSs, 1) : '0.0', + efflWqltTn: Math.round(minEfflWqltTn * 1000) / 1000 ? roundNumber(minEfflWqltTn, 3) : '0.000', + efflWqltTp: Math.round(minEfflWqltTp * 1000) / 1000 ? roundNumber(minEfflWqltTp, 3) : '0.000', + inflAssctBfrWqltBod: Math.round(mininflAssctBfrWqltBod * 10) / 10 ? roundNumber(mininflAssctBfrWqltBod, 1) : '0.0', + inflAssctBfrWqltTn: Math.round(mininflAssctBfrWqltTn * 1000) / 1000 ? roundNumber(mininflAssctBfrWqltTn, 3) : '0.000', + inflAssctBfrWqltTp: Math.round(minInflAssctBfrWqltTp * 1000) / 1000 ? roundNumber(minInflAssctBfrWqltTp, 3) : '0.000', + inflAssctBfrWqltToc: Math.round(mininflAssctBfrWqltToc * 10) / 10 ? roundNumber(mininflAssctBfrWqltToc, 1) : '0.0', + inflAssctBfrWqltCod: Math.round(mininflAssctBfrWqltCod * 10) / 10 ? "(" + roundNumber(mininflAssctBfrWqltCod, 1) + ")" : '(0.0)', + inflAssctBfrWqltSs: Math.round(mininflAssctBfrWqltSs * 10) / 10 ? roundNumber(mininflAssctBfrWqltSs, 1) : '0.0', bscFctCd: "", bscFctNm: "", lclgvrnmntNm: "", @@ -312,10 +312,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, - noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0), - infoRnDay: Math.round(minInfoRnDay * 10) / 10?'0.0':roundNumber(minInfoRnDay, 1), - tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999?roundNumber(minTpInflWqltBod, 1):'0.0', - tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999?roundNumber(minTpInflWqltTp, 3):'0.000' + noProcessInflAmnt: roundNumber(minNoProcessInflAmnt, 0), + infoRnDay: Math.round(minInfoRnDay * 10) / 10 ? '0.0' : roundNumber(minInfoRnDay, 1), + tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999 ? roundNumber(minTpInflWqltBod, 1) : '0.0', + tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999 ? roundNumber(minTpInflWqltTp, 3) : '0.000' }, ...filteredData ]; @@ -326,7 +326,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe // 날짜 필터링 관련 상태 const [copyYearList, setCopyYearList] = useState([]); const [chongInWaterQltyYearList, setChongInWaterQltyYearList] = useState([]); - + useEffect(() => { searchFacilityWaterQltyListHist(searchYear, facilityCd); }, [searchYear, facilityCd, searchFacilityWaterQltyListHist]); @@ -354,10 +354,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe }, []); const excelDownload = () => { - - if(tabName === 'tab_num1'){ + + if (tabName === 'tab_num1') { //처리시설 수질현황 const excelDownList: modalExcelType[] = []; - if(copyYearList.length > 0){ + if (copyYearList.length > 0) { copyYearList.forEach((item) => { excelDownList.push({ 날짜: item.msrDt, @@ -371,26 +371,27 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe "유출SS(mg/L)": CommaToNumber(item.efflWqltSs), "유출TN(mg/L)": CommaToNumber(item.efflWqltTn), "유출TP(mg/L)": CommaToNumber(item.efflWqltTp), - "강우량(mm/일)": CommaToNumber(item.infoRnDay?item.infoRnDay.toString():"0.0"), + "강우량(mm/일)": CommaToNumber(item.infoRnDay ? item.infoRnDay.toString() : "0.0"), }); }); } if (excelDownList && excelDownList.length > 0) { downloadExcelFormat( - { data: JSON.parse(JSON.stringify(excelDownList)) - , fileName: searchYear+'년 '+fcltyName + ' 수질현황' + { + data: JSON.parse(JSON.stringify(excelDownList)) + , fileName: searchYear + '년 ' + fcltyName + ' 수질현황' , sheetNameArray: [fcltyName + ' 수질현황'] , headerRange: 'A1:L1' - , decimalArray1: [1,2,3,6,7,8,11] - , decimalArray3: [4,5,9,10] + , decimalArray1: [1, 2, 3, 6, 7, 8, 11] + , decimalArray3: [4, 5, 9, 10] }); } else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) { alert('다운받을 데이터가 없습니다.'); } prevExcelListRef.current = excelDownList; - }else{ + } else { // 총인설비 수질현황 const excelDownList: modalChoinginExcelType[] = []; - if(chongInWaterQltyYearList.length > 0){ + if (chongInWaterQltyYearList.length > 0) { chongInWaterQltyYearList.forEach((item) => { excelDownList.push({ 날짜: item.msrDt, @@ -403,12 +404,13 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe } if (excelDownList && excelDownList.length > 0) { downloadExcelFormat( - { data: JSON.parse(JSON.stringify(excelDownList)) - , fileName: searchYear+'년 '+fcltyName + ' 총인설비수질현황' + { + data: JSON.parse(JSON.stringify(excelDownList)) + , fileName: searchYear + '년 ' + fcltyName + ' 총인설비수질현황' , sheetNameArray: [fcltyName + ' 총인설비수질현황'] , headerRange: 'A1:E1' - , decimalArray1: [1,3] - , decimalArray3: [2,4] + , decimalArray1: [1, 3] + , decimalArray3: [2, 4] }); } else if (prevChoinginExcelListRef.current && prevChoinginExcelListRef.current.length > 0) { alert('다운받을 데이터가 없습니다.'); @@ -424,7 +426,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe return ( <> setTabName(value)}> - {/* 처리시설 수질현황 */} @@ -433,24 +435,16 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe searchList={facilityWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName={"tab_term_year"} - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_year" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[310px]" - boldArray={[0,1,2]} + { }} className="h-[310px]" boldArray={[0, 1, 2]} > @@ -460,132 +454,97 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe {/*

({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})

*/}
- {}} - boldArray={[0,1,2]} + { }} boldArray={[0, 1, 2]} > - {msrmtDate != yesterDayStr?.replaceAll('-','') ? ( - + {msrmtDate != yesterDayStr?.replaceAll('-', '') ? ( + ) : null}
- + {/* 하절기 */} searchList={facilityWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_summer" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_summer" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- { } } - className="h-[500px]" - boldArray={[0,1,2]} + headlist={Number(searchYear) < COD_YEAR ? upHeadListModalYearCod : upHeadListModalYear} + pageSize={0} total={0} cellClick={undefined} + onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]} >
- + {/* 동절기 */} searchList={facilityWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_winter" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_winter" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[500px]" - boldArray={[0,1,2]} + { }} className="h-[500px]" boldArray={[0, 1, 2]} >
- + {/* 청천 */} searchList={facilityWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_chuncheon" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_chuncheon" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[500px]" - boldArray={[0,1,2]} + { }} className="h-[500px]" boldArray={[0, 1, 2]} >
- +
- + {/* 강우시 */} searchList={facilityWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_rain" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_rain" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[500px]" - boldArray={[0,1,2]} + { }} className="h-[500px]" boldArray={[0, 1, 2]} >
- +
@@ -596,24 +555,16 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe searchList={chongInWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_year" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_year" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[500px]" - boldArray={[0,1,2]} + { }} className="h-[500px]" boldArray={[0, 1, 2]} > @@ -623,24 +574,16 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe searchList={chongInWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_summer" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_summer" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[500px]" - boldArray={[0,1,2]} + { }} className="h-[500px]" boldArray={[0, 1, 2]} > @@ -650,24 +593,16 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe searchList={chongInWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_winter" - searchYear={searchYear} - ref={ref} - queryClick={filterData} + fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_winter" + searchYear={searchYear} ref={ref} queryClick={filterData} />
- {}} - className="h-[500px]" - boldArray={[0,1,2]} + pageSize={0} total={0} cellClick={undefined} + onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]} > diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx index 885ee2728..86a434d6b 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx @@ -23,7 +23,7 @@ export default function ProcessFacilitySearch() { } = useFoStore((state) => state) || { FacilityWaterQltyList: { facilityWaterQltyList: [], facilityWaterQltyCount: 0 } }; const { - isInit, + isInit, selectUpdownData, selectOperationData, selectSidoData, @@ -66,26 +66,26 @@ export default function ProcessFacilitySearch() { const [fcltyCd, setFcltyCd] = useState(""); const [modalYear, setModalYear] = useState(""); - const searchFcltyQltyList = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { + const searchFcltyQltyList = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt: number = 20) => { let nameCd, partStr; switch (partValue) { case 'R': if (regionValue !== '0') { - if(unitWaterShedValue==='0') nameCd = regionValue; - else if (middleRegionValue==='0') nameCd = unitWaterShedValue; + if (unitWaterShedValue === '0') nameCd = regionValue; + else if (middleRegionValue === '0') nameCd = unitWaterShedValue; else nameCd = middleRegionValue; } partStr = partValue break; default: - if(sidoValue !== '0') nameCd = ref.current.sidoValue!="0"?ref.current.sidoValue:sidoValue; - if(sigunValue !== '0') nameCd = sigunValue; - partStr = envPartValue !== '0' ? envPartValue:partValue; - break; + if (sidoValue !== '0') nameCd = ref.current.sidoValue != "0" ? ref.current.sidoValue : sidoValue; + if (sigunValue !== '0') nameCd = sigunValue; + partStr = envPartValue !== '0' ? envPartValue : partValue; + break; } - if(partStr ==='G'){ + if (partStr === 'G') { searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue); - }else{ + } else { searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); } }, [operationValue, fcltyName, searchFacilityWaterQltyList, searchYearValue, fcltCpct]); @@ -138,34 +138,34 @@ export default function ProcessFacilitySearch() { useEffect(() => { if (!isInit) { - if(!initTrigger){ + if (!initTrigger) { initializeCommonData(); searchFcltyQltyList(ref.current, 1, 10); - setInitTrigger(true); + setInitTrigger(true); } } }, [isInit, initializeCommonData, searchFacilityWaterQltyList, searchFcltyQltyList, initTrigger]); useEffect(() => { - if(!excelTrigger) return; + if (!excelTrigger) return; if (excelList && excelList.length > 0) { downloadExcelFormat( { - data: excelList as unknown as JSON[], - fileName: '시설별 수질현황', - sheetNameArray: ['시설별 수질현황'], + data: excelList as unknown as JSON[], + fileName: '시설별 수질현황', + sheetNameArray: ['시설별 수질현황'], headerRange: 'A1:T1', - decimalArray1:[10,11,12,15,16,17], - decimalArray3:[13,14,18,19] + decimalArray1: [10, 11, 12, 15, 16, 17], + decimalArray3: [13, 14, 18, 19] } ); } }, [excelList, excelTrigger]); - const chkVal = useCallback((returntype:ReturnType) => { + const chkVal = useCallback((returntype: ReturnType) => { // setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]") - setUpheadList(returntype.partValue == 'R' ? upHeadList2 : returntype.partValue == 'G'?upHeadList3:upHeadList1); + setUpheadList(returntype.partValue == 'R' ? upHeadList2 : returntype.partValue == 'G' ? upHeadList3 : upHeadList1); setResetPage(true); }, [upHeadList1, upHeadList2, upHeadList3]); @@ -173,7 +173,7 @@ export default function ProcessFacilitySearch() { setExcelTrigger(true); searchFcltyQltyList(ref.current, 1, 10000); }, [searchFcltyQltyList]); - + const handlePageChange = useCallback((page: number) => { setResetPage(false); searchFcltyQltyList(ref.current, page, 10); @@ -202,7 +202,7 @@ export default function ProcessFacilitySearch() { queryClick={chkVal} excelClick={excelDownload} initClick={resetVal} - ref={ref} isAdmin={false} initSidoValue={"11"}/> + ref={ref} isAdmin={false} initSidoValue={"11"} />
@@ -215,7 +215,7 @@ export default function ProcessFacilitySearch() { {selectedRow !== null && ( } - bodyClass="sm:max-w-[90vw] w-[1300px] h-[920px]" + bodyClass="sm:max-w-[90vw] w-[1300px] h-[100dvh] max-h-[930px] overflow-y-auto" open={selectedRow !== null} onOpenChange={(open) => !open && closeModal()} noHeaderYn="Y" diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 0eafcfcd0..5d2e886f4 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -37,8 +37,8 @@ export interface FacilityWaterQltyProps { inflAssctAftWqltBod: string | '', inflAssctBfrWqltToc: string | '', inflAssctAftWqltToc: string | '', - inflAssctBfrWqltCod : string | '', - inflAssctAftWqltCod : string | '', + inflAssctBfrWqltCod: string | '', + inflAssctAftWqltCod: string | '', inflAssctBfrWqltSs: string | '', inflAssctAftWqltSs: string | '', inflAssctBfrWqltTn: string | '', @@ -47,14 +47,14 @@ export interface FacilityWaterQltyProps { inflAssctAftWqltTp: string | '', efflWqltBod: string | '', efflWqltToc: string | '', - efflWqltCod : string | '', + efflWqltCod: string | '', efflWqltSs: string | '', efflWqltTn: string | '', efflWqltTp: string | '', - rgnNm:string|'', - rvbsn:string|'', - lgbsn:string|'', - mdmbsn:string|'', + rgnNm: string | '', + rvbsn: string | '', + lgbsn: string | '', + mdmbsn: string | '', inflAmnt: number | '', lclgvrnmntNm: string, infoRnDay: number | string | '', @@ -68,14 +68,14 @@ export interface FacilityWaterQltyProps { tpInflWqltTp: string | '', tpInflWqltEclgyTox: string | '', tpInflWqltClfgrpcnt: string | '', - noProcessInflAmnt : string | number | '', + noProcessInflAmnt: string | number | '', } export interface ExcelType { 시설코드: string, - 권역:string|'', - 단위유역:string|'', - 중권역:string|'', - 환경청:string|'', + 권역: string | '', + 단위유역: string | '', + 중권역: string | '', + 환경청: string | '', 시도: string, 시군구: string, 시설이름: string, @@ -146,74 +146,74 @@ const mainLabelArray: string[] = ['구분', '시도', '시군구', '용량별', // 시설수질리스트 헤더(행정별) const upHeadList1: TableUpperProps[] = [ - { id: "C", title: "행정명", colSpan: 2, row:0, widthPercent:10 }, - { id: "sidoNm", title: "시도", row: 1, widthPercent:5}, - { id: "sggNm", title: "시군구", row: 1, widthPercent:5 }, + { id: "C", title: "행정명", colSpan: 2, row: 0, widthPercent: 10 }, + { id: "sidoNm", title: "시도", row: 1, widthPercent: 5 }, + { id: "sggNm", title: "시군구", row: 1, widthPercent: 5 }, { id: "bscFctNm", title: "시설명", rowSpan: 2, row: 0, widthPercent: 10 }, { id: "addr", title: "주소", rowSpan: 2, row: 0 }, - { id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0, widthPercent:10 }, - { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent:25 }, - { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent:25 }, - { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent:5 }, - { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent:5 }, - { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, - { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1, widthPercent:5 }, - { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, - { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent:5 }, - { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent:5 }, - { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, - { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 4, align: "right", row: 1, widthPercent:5 }, - { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, + { id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0, widthPercent: 10 }, + { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 25 }, + { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 25 }, + { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 4, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, ]; // 시설수질리스트 헤더(권역별) const upHeadList2: TableUpperProps[] = [ - { id: "C", title: "유역", colSpan: 3, row: 0, widthPercent:15 }, - { id: "rvbsn", title: "권역", upName: "upChangeRe1", upSequnce: 1, row:1, widthPercent:5 }, - { id: "lgbsn", title: "단위유역", upName: "upChangeRe1", upSequnce: 2, row:1, widthPercent:5 }, - { id: "mdmbsn", title: "중권역", upName: "upChangeRe1", upSequnce: 3, row:1, widthPercent:5 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent:10 }, - { id: "addr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2, widthPercent:8 }, - { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent:25 }, - { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent:25 }, - { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1, widthPercent:5 }, - { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent:5 }, - { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent:5 }, - { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent:5 }, - { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent:5 }, - { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1, widthPercent:5 }, - { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent:5 }, - { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent:5 }, - { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent:5 }, - { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent:5 }, + { id: "C", title: "유역", colSpan: 3, row: 0, widthPercent: 15 }, + { id: "rvbsn", title: "권역", upName: "upChangeRe1", upSequnce: 1, row: 1, widthPercent: 5 }, + { id: "lgbsn", title: "단위유역", upName: "upChangeRe1", upSequnce: 2, row: 1, widthPercent: 5 }, + { id: "mdmbsn", title: "중권역", upName: "upChangeRe1", upSequnce: 3, row: 1, widthPercent: 5 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 }, + { id: "addr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 25 }, + { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 25 }, + { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 5 }, + { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 5 }, + { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 }, ]; // 시설수질리스트 헤더(환경청별) const upHeadList3: TableUpperProps[] = [ { id: "C", title: "유역", colSpan: 3, row: 0, widthPercent: 15 }, - { id: "rvbsn", title: "권역", row:1, widthPercent: 5 }, - { id: "lgbsn", title: "단위유역", row:1, widthPercent: 5 }, - { id: "mdmbsn", title: "중권역", row:1, widthPercent: 5 }, - { id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 7 }, + { id: "rvbsn", title: "권역", row: 1, widthPercent: 5 }, + { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 5 }, + { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 5 }, + { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "D", title: "행정명", colSpan: 2, row: 0, widthPercent: 10 }, - { id: "sidoNm", title: "시도", upName: "upChangeRe2", row:1, widthPercent: 5 }, - { id: "sggNm", title: "시군구", upName: "upChangeRe2", row:1, widthPercent: 5 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, - { id: "addr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2, widthPercent: 5 }, + { id: "sidoNm", title: "시도", upName: "upChangeRe2", row: 1, widthPercent: 5 }, + { id: "sggNm", title: "시군구", upName: "upChangeRe2", row: 1, widthPercent: 5 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "addr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row: 0, rowSpan: 2, widthPercent: 5 }, { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 20 }, { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 20 }, - { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1, widthPercent: 4 }, - { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, - { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, - { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, - { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, - { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1, widthPercent: 4 }, - { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, - { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, - { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, - { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, + { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent: 4 }, + { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 4 }, + { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 4 }, + { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 4 }, + { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 4 }, + { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent: 4 }, + { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 4 }, + { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 4 }, + { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 4 }, + { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 4 }, ]; /** @@ -282,9 +282,9 @@ const upHeadListModalChongIn: TableUpperProps[] = [ ====================================*/ // 메인페이지 // 시설정보 수질 리스트 데이터 호출 -const fetchFacilityWaterQltyList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string|undefined, nameCd?: string|undefined, fcltCpct?: string|undefined, operationValue?: string|undefined, fcltyNm?: string | undefined): Promise<{ data: FacilityWaterQltyProps[], count: number }> => { +const fetchFacilityWaterQltyList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string | undefined, nameCd?: string | undefined, fcltCpct?: string | undefined, operationValue?: string | undefined, fcltyNm?: string | undefined): Promise<{ data: FacilityWaterQltyProps[], count: number }> => { try { - const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; + const tailStr = partCd ? '/' + partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/fclt/qlty/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; const res = await getFetch('fo', url); return { data: res.data, count: res.count } @@ -295,7 +295,7 @@ const fetchFacilityWaterQltyList = async (pageNo: number, pageSize: number, sear } // 시설정보 수질 리스트 데이터 호출(모달-수질TMS) -const fetchFacilityWaterQltyTmsList = async (facilityCd: string|undefined) => { +const fetchFacilityWaterQltyTmsList = async (facilityCd: string | undefined) => { try { const res = await getFetch('wr', '/il/getTms/' + facilityCd); return { data: res.data, count: res.count }; @@ -306,7 +306,7 @@ const fetchFacilityWaterQltyTmsList = async (facilityCd: string|undefined) => { }; // 시설정보 수질 리스트 데이터 호출(모달-이력) -export const fetchFacilityWaterQltyListHist = async (searchYear: string|undefined, facilityCd: string|undefined): Promise => { +export const fetchFacilityWaterQltyListHist = async (searchYear: string | undefined, facilityCd: string | undefined): Promise => { try {// const res = await getFetch('fo', '/fclt/qlty/hist/' + searchYear + '/' + facilityCd); return res; @@ -316,9 +316,9 @@ export const fetchFacilityWaterQltyListHist = async (searchYear: string|undefine } }; // 시설정보 RDII 상세 [{BOD - inflAssctBfrWqltBod, 유입유량 inflAmnt, 강우량 infoRnDay, 측정일 msrDt}] -export const fetchFacilityRdiiDetailList = async (searchYear: string|undefined, swtrmtFcltCdList: string[]): Promise => { +export const fetchFacilityRdiiDetailList = async (searchYear: string | undefined, swtrmtFcltCdList: string[]): Promise => { try { - const res = await postFetch('fo', '/rdii/detail/'+searchYear, swtrmtFcltCdList); + const res = await postFetch('fo', '/rdii/detail/' + searchYear, swtrmtFcltCdList); return res; } catch (error) { console.error('시설정보 RDII 상세 데이터를 가져오는데 실패했습니다:', error); @@ -345,7 +345,7 @@ export type FacilityWaterQltyType = { FacilityWaterQltyModal: { // 처리시설 수질현황 upHeadListModalYear: TableUpperProps[]; - upHeadListModalYearCod : TableUpperProps[]; + upHeadListModalYearCod: TableUpperProps[]; facilityWaterQltyYearList: FacilityWaterQltyProps[]; upHeadListModalTms: TableUpperProps[]; facilityWaterQltyTmsList: FacilityWaterQltyTmsProps[]; @@ -431,8 +431,9 @@ const dataFormSetting = (item: FacilityWaterQltyProps) => { } export type FacilityWaterQltyStore = FacilityWaterQltyType & FacilityWaterQltyActions; - -export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType) => FacilityWaterQltyType) => void): FacilityWaterQltyActions => { +// 타입 정의를 분리하여 가독성 향상 +type SetFunc = (fn: (state: FacilityWaterQltyType) => FacilityWaterQltyType) => void; +export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions => { return { // 메인페이지 /** @@ -457,53 +458,53 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); const rtnData = res.data.map(item => { dataFormSetting(item) - if(item.inflAssctBfrWqltTn) { - item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000)/1000).toFixed(3); + if (item.inflAssctBfrWqltTn) { + item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000) / 1000).toFixed(3); } - if(item.efflWqltTn){ - item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3); + if (item.efflWqltTn) { + item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000) / 1000).toFixed(3); } - if(item.inflAssctBfrWqltTp){ - item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000)/1000).toFixed(3); + if (item.inflAssctBfrWqltTp) { + item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000) / 1000).toFixed(3); } - if(item.efflWqltTp){ - item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3); + if (item.efflWqltTp) { + item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000) / 1000).toFixed(3); } - if(item.inflAssctBfrWqltToc){ - item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltToc) { + item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10) / 10).toFixed(1); } - if(item.efflWqltToc){ - item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); + if (item.efflWqltToc) { + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10) / 10).toFixed(1); } - if(item.inflAssctBfrWqltBod){ - item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltBod) { + item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10) / 10).toFixed(1); } - if(item.efflWqltBod){ - item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1); + if (item.efflWqltBod) { + item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10) / 10).toFixed(1); } - if(item.inflAssctBfrWqltSs){ - item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltSs) { + item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10) / 10).toFixed(1); } - if(item.efflWqltSs){ - item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1); + if (item.efflWqltSs) { + item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10) / 10).toFixed(1); } - if(item.inflAssctBfrWqltToc){ - item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltToc) { + item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10) / 10).toFixed(1); } - if(item.efflWqltToc){ - item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); + if (item.efflWqltToc) { + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10) / 10).toFixed(1); } return item; }); const excelDownList: ExcelType[] = []; - if(pageSize>5000){ + if (pageSize > 5000) { res.data.forEach(item => { dataFormSetting(item) item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; - item.inflAssctBfrWqltToc = Number(searchYear) { dataFormSetting(item) item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; - item.inflAssctBfrWqltToc = Number(searchYear) ({ ...state, - FacilityWaterQltyMain: pageSize<5000?{ + FacilityWaterQltyMain: pageSize < 5000 ? { ...state.FacilityWaterQltyMain, facilityWaterQltyList: rtnData, facilityWaterQltyCount: res.count, - isLoading : false, - }:{ + isLoading: false, + } : { ...state.FacilityWaterQltyMain, excelList: excelDownList, - isLoading : false, + isLoading: false, }, })) }, @@ -555,10 +556,10 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType searchFacilityWaterQltyListHist: async (searchYear: string, facilityCd: string) => { const res = await fetchFacilityWaterQltyListHist(searchYear, facilityCd); const res1 = await fetchFacilityWaterQltyTmsList(facilityCd); - + let rtnMsrmtDate = ''; const rtnTmsList: FacilityWaterQltyTmsProps[] = []; - if(res1.data){ + if (res1.data) { rtnTmsList.push({ part: '평균', toc: res1.data.tocAvgVl, @@ -584,7 +585,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType }); rtnMsrmtDate = res1.data.msrmtDate; - }else{ + } else { rtnTmsList.push({ part: '평균', toc: 0, @@ -606,20 +607,20 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType toc: 0, ss: 0, tn: 0, - tp: 0, + tp: 0, }); rtnMsrmtDate = ''; } - - if(Array.isArray(res) || !res || !('data' in res) || !res.data || !res.data.wqltObjs || res.data.wqltObjs.length === 0) { + + if (Array.isArray(res) || !res || !('data' in res) || !res.data || !res.data.wqltObjs || res.data.wqltObjs.length === 0) { set((state: FacilityWaterQltyType) => ({ ...state, FacilityWaterQltyModal: { ...state.FacilityWaterQltyModal, facilityWaterQltyYearList: [], - tmsList : rtnTmsList, - msrmtDate : rtnMsrmtDate + tmsList: rtnTmsList, + msrmtDate: rtnMsrmtDate } })) return; @@ -627,7 +628,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType // facilityPrecipitation의 rainEffectDay 계산 로직을 적용 const data = CalcRainEffect(res.data.wqltObjs); - + /** * [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​ /강우시 일별유입BOD) @@ -639,7 +640,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType let sunnyDay = 0; data.forEach(item => { - if(item.rainEffectDay == 1){ + if (item.rainEffectDay == 1) { //rainDay += 1; //rainInflAmnt += Number(item.inflAmnt); } else { @@ -650,69 +651,69 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType }); //const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay; - const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay; - const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay; + const yearSunnyAmnt = sunnyInflAmnt === 0 ? 0 : sunnyInflAmnt / sunnyDay; + const yearSunnyBod = sunnyBod === 0 ? 0 : sunnyBod / sunnyDay; // const rtnData = data.map((item: FacilityWaterQltyProps) => { dataFormSetting(item) - if(item.inflAssctBfrWqltTn) { - item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000)/1000).toFixed(3); + if (item.inflAssctBfrWqltTn) { + item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000) / 1000).toFixed(3); } - if(item.efflWqltTn){ - item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3); + if (item.efflWqltTn) { + item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000) / 1000).toFixed(3); } - if(item.inflAssctBfrWqltTp){ - item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000)/1000).toFixed(3); + if (item.inflAssctBfrWqltTp) { + item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000) / 1000).toFixed(3); } - if(item.efflWqltTp){ - item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3); + if (item.efflWqltTp) { + item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000) / 1000).toFixed(3); } - if(item.inflAssctBfrWqltToc){ - item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltToc) { + item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10) / 10).toFixed(1); } - if(item.efflWqltToc){ - item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); + if (item.efflWqltToc) { + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10) / 10).toFixed(1); } - if(item.inflAssctBfrWqltCod){ - item.inflAssctBfrWqltCod = "("+Number(Math.round(Number(item.inflAssctBfrWqltCod) * 10)/10).toFixed(1)+")"; + if (item.inflAssctBfrWqltCod) { + item.inflAssctBfrWqltCod = "(" + Number(Math.round(Number(item.inflAssctBfrWqltCod) * 10) / 10).toFixed(1) + ")"; } - if(item.efflWqltCod){ - item.efflWqltCod = "("+Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1)+")"; + if (item.efflWqltCod) { + item.efflWqltCod = "(" + Number(Math.round(Number(item.efflWqltCod) * 10) / 10).toFixed(1) + ")"; } - if(item.inflAssctBfrWqltBod){ - item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltBod) { + item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10) / 10).toFixed(1); } - if(item.efflWqltBod){ - item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1); + if (item.efflWqltBod) { + item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10) / 10).toFixed(1); } - if(item.inflAssctBfrWqltSs){ - item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltSs) { + item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10) / 10).toFixed(1); } - if(item.efflWqltSs){ - item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1); + if (item.efflWqltSs) { + item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10) / 10).toFixed(1); } - if(item.inflAssctBfrWqltToc){ - item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1); + if (item.inflAssctBfrWqltToc) { + item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10) / 10).toFixed(1); } - if(item.efflWqltToc){ - item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); + if (item.efflWqltToc) { + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10) / 10).toFixed(1); } - if(item.tpInflWqltBod){ - item.tpInflWqltBod = item.tpInflWqltBod?Number(Math.round(Number(item.tpInflWqltBod) * 10)/10).toFixed(1):Number(item.tpInflWqltBod)===0?'0.0':''; - }else{ + if (item.tpInflWqltBod) { + item.tpInflWqltBod = item.tpInflWqltBod ? Number(Math.round(Number(item.tpInflWqltBod) * 10) / 10).toFixed(1) : Number(item.tpInflWqltBod) === 0 ? '0.0' : ''; + } else { item.tpInflWqltBod = ''; } - if(item.tpInflWqltTp){ - item.tpInflWqltTp = item.tpInflWqltTp?Number(Math.round(Number(item.tpInflWqltTp) * 1000)/1000).toFixed(3): Number(item.tpInflWqltTp)===0?'0.000':''; - }else{ + if (item.tpInflWqltTp) { + item.tpInflWqltTp = item.tpInflWqltTp ? Number(Math.round(Number(item.tpInflWqltTp) * 1000) / 1000).toFixed(3) : Number(item.tpInflWqltTp) === 0 ? '0.000' : ''; + } else { item.tpInflWqltTp = ''; } const dayBod = Number(item.inflAssctBfrWqltBod); const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0) - item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : ''; + item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',', '')) > 0 ? noProcessInflAmnt : ''; return item; }) @@ -721,8 +722,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType FacilityWaterQltyModal: { ...state.FacilityWaterQltyModal, facilityWaterQltyYearList: rtnData, - tmsList : rtnTmsList, - msrmtDate : rtnMsrmtDate + tmsList: rtnTmsList, + msrmtDate: rtnMsrmtDate } })) }, From 8f26c1482e5abcdc425ab63bd2bd32abc8cf5ab5 Mon Sep 17 00:00:00 2001 From: dongsilove Date: Mon, 12 Jan 2026 22:40:58 +0900 Subject: [PATCH 3/8] =?UTF-8?q?fo:=20=EC=B4=9D=EC=9D=B8=EC=84=A4=EB=B9=84?= =?UTF-8?q?=20=EC=88=98=EC=A7=88=ED=98=84=ED=99=A9=20=EA=B8=B0=EA=B0=84?= =?UTF-8?q?=EB=B3=84=20exceldownload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/FacilityTermModalHeader.tsx | 2 +- .../facilityWaterQlty/modal/page.tsx | 55 +++++++++---------- apps/fo/app/store/facilityWaterQlty/index.tsx | 43 ++++----------- 3 files changed, 37 insertions(+), 63 deletions(-) diff --git a/apps/fo/app/components/common/FacilityTermModalHeader.tsx b/apps/fo/app/components/common/FacilityTermModalHeader.tsx index 4389e2f5a..a46b3652d 100644 --- a/apps/fo/app/components/common/FacilityTermModalHeader.tsx +++ b/apps/fo/app/components/common/FacilityTermModalHeader.tsx @@ -35,7 +35,7 @@ export default function FacilityTermModalHeader({ const [endDate, setEndDate] = useState(new Date(Number(searchYear), 11, 31)); const startPickerRef = useRef(null); const endPickerRef = useRef(null); - const [flowPanel, setFlowPanel] = useState(selectFlowPanel[0]?.val ?? '0'); // 초기값 "전체" + const [flowPanel, setFlowPanel] = useState(selectFlowPanel[0]?.val ?? '0'); // 강수구분 : 초기값 "전체" const [copySearchList, setCopySearchList] = useState(searchList); const [standSearchList, setStandSearchList] = useState(searchList); diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx index 76c65ca3b..7de556932 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx @@ -52,12 +52,10 @@ const tabList3 = [ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', searchYear = new Date().getFullYear().toString() }: ModalProps) { const [tabName, setTabName] = useState('tab_num1'); - - // 그리드 관련 - const { FacilityWaterQltyModal, - searchFacilityWaterQltyListHist, - Common - } = useFoStore((state) => state); + // 날짜 필터링 관련 상태 + const [copyYearList, setCopyYearList] = useState([]); + const [chongInWaterQltyYearList, setChongInWaterQltyYearList] = useState([]); + const { FacilityWaterQltyModal, searchFacilityWaterQltyListHist, Common } = useFoStore((state) => state); const { btnClass, COD_YEAR } = Common; const { upHeadListModalYear, @@ -72,6 +70,16 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea const prevExcelListRef = useRef(null); const prevChoinginExcelListRef = useRef(null); + useEffect(() => { + searchFacilityWaterQltyListHist(searchYear, facilityCd); + }, [searchYear, facilityCd, searchFacilityWaterQltyListHist]); + + useEffect(() => { + const filteredYearData = setFilterAfterData(facilityWaterQltyYearList); + setCopyYearList(filteredYearData as FacilityWaterQltyProps[]); + setChongInWaterQltyYearList(filteredYearData as FacilityWaterQltyProps[]); + }, [facilityWaterQltyYearList]); + // 필터링 된 후 최대, 최소, 평균 값 계산 const setFilterAfterData = (filteredData: FacilityWaterQltyProps[]) => { // 쉼표가 포함된 문자열을 숫자로 변환하는 함수 @@ -313,7 +321,7 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea addr: "", fctCpc: 0, noProcessInflAmnt: roundNumber(minNoProcessInflAmnt, 0), - infoRnDay: Math.round(minInfoRnDay * 10) / 10 ? '0.0' : roundNumber(minInfoRnDay, 1), + infoRnDay: Math.round(minInfoRnDay * 10) / 10 ? roundNumber(minInfoRnDay, 1) : '0.0', tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999 ? roundNumber(minTpInflWqltBod, 1) : '0.0', tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999 ? roundNumber(minTpInflWqltTp, 3) : '0.000' }, @@ -323,20 +331,6 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea return newFilteredData; } - // 날짜 필터링 관련 상태 - const [copyYearList, setCopyYearList] = useState([]); - const [chongInWaterQltyYearList, setChongInWaterQltyYearList] = useState([]); - - useEffect(() => { - searchFacilityWaterQltyListHist(searchYear, facilityCd); - }, [searchYear, facilityCd, searchFacilityWaterQltyListHist]); - - useEffect(() => { - const filteredYearData = setFilterAfterData(facilityWaterQltyYearList); - setCopyYearList(filteredYearData as FacilityWaterQltyProps[]); - setChongInWaterQltyYearList(filteredYearData as FacilityWaterQltyProps[]); - }, [facilityWaterQltyYearList]); - const yesterDay = new Date(); yesterDay.setDate(yesterDay.getDate() - 1); const yesterDayStr = yesterDay.toISOString().split('T')[0]; @@ -350,7 +344,8 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea const filterData = useCallback((returnType: ReturnType) => { const filteredData = setFilterAfterData(returnType.filteredList); - setCopyYearList(filteredData as FacilityWaterQltyProps[]); + setCopyYearList(filteredData as FacilityWaterQltyProps[]); // 처리시설 수질현황 + setChongInWaterQltyYearList(filteredData as FacilityWaterQltyProps[]); // 총인설비 수질현황 }, []); const excelDownload = () => { @@ -393,6 +388,8 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea const excelDownList: modalChoinginExcelType[] = []; if (chongInWaterQltyYearList.length > 0) { chongInWaterQltyYearList.forEach((item) => { + // if (copyYearList.length > 0) { + // copyYearList.forEach((item) => { excelDownList.push({ 날짜: item.msrDt, "유입BOD(mg/L)": CommaToNumber(item.tpInflWqltBod), @@ -432,7 +429,7 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea {/* 처리시설 수질현황 */} - + {/* 연간 */} searchList={facilityWaterQltyYearList} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_year" @@ -449,9 +446,9 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea
-
+

수질 TMS

- {/*

({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})

*/} +

({msrmtDate ? msrmtDate.substring(0, 4) + '-' + msrmtDate.substring(4, 6) + '-' + msrmtDate.substring(6, 8) : yesterDayStr})

- {/* 청천 */} + {/* 청천시 */} searchList={facilityWaterQltyYearList} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_chuncheon" @@ -552,7 +549,7 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea {/* 총인설비 수질현황 */} - + {/* 연간 */} searchList={chongInWaterQltyYearList} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_year" @@ -571,7 +568,7 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea
- + {/* 하절기 */} searchList={chongInWaterQltyYearList} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_summer" @@ -590,7 +587,7 @@ export default function WaterQualityModal({ fcltyName = '', facilityCd = '', sea
- + {/* 동절기 */} searchList={chongInWaterQltyYearList} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_winter" diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 5d2e886f4..db60c5b2d 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -2,7 +2,7 @@ import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; -import { COD_YEAR } from "../common"; +import { COD_YEAR } from "../common"; // 2021년 import CommaToNumber from "@/app/components/common/CommaToNumber"; export type { TableUpperProps }; @@ -431,7 +431,7 @@ const dataFormSetting = (item: FacilityWaterQltyProps) => { } export type FacilityWaterQltyStore = FacilityWaterQltyType & FacilityWaterQltyActions; -// 타입 정의를 분리하여 가독성 향상 + type SetFunc = (fn: (state: FacilityWaterQltyType) => FacilityWaterQltyType) => void; export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions => { return { @@ -447,7 +447,9 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions * @param operationValue : 운영상태코드 * @param fcltyNm : 시설명 */ - searchFacilityWaterQltyList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { + searchFacilityWaterQltyList: async (pageNo: number, pageSize: number, searchYear: string, part?: string + , nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { + set((state: FacilityWaterQltyType) => ({ ...state, FacilityWaterQltyMain: { @@ -567,7 +569,6 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions tn: res1.data.tnAvgVl, tp: res1.data.tpAvgVl, }); - rtnTmsList.push({ part: '최대', toc: res1.data.tocMaxVl, @@ -575,7 +576,6 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions tn: res1.data.tnMaxVl, tp: res1.data.tpMaxVl, }); - rtnTmsList.push({ part: '최소', toc: res1.data.tocMinVl, @@ -586,30 +586,9 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions rtnMsrmtDate = res1.data.msrmtDate; } else { - rtnTmsList.push({ - part: '평균', - toc: 0, - ss: 0, - tn: 0, - tp: 0, - }); - - rtnTmsList.push({ - part: '최대', - toc: 0, - ss: 0, - tn: 0, - tp: 0, - }); - - rtnTmsList.push({ - part: '최소', - toc: 0, - ss: 0, - tn: 0, - tp: 0, - }); - + rtnTmsList.push({ part: '평균', toc: 0, ss: 0, tn: 0, tp: 0, }); + rtnTmsList.push({ part: '최대', toc: 0, ss: 0, tn: 0, tp: 0, }); + rtnTmsList.push({ part: '최소', toc: 0, ss: 0, tn: 0, tp: 0, }); rtnMsrmtDate = ''; } @@ -633,10 +612,8 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions * [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​ /강우시 일별유입BOD) */ - //let rainInflAmnt = 0; let sunnyInflAmnt = 0; let sunnyBod = 0; - //let rainDay = 0; let sunnyDay = 0; data.forEach(item => { @@ -700,12 +677,12 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10) / 10).toFixed(1); } - if (item.tpInflWqltBod) { + if (item.tpInflWqltBod) { // 총인 유입수질 BOD(mg/L) item.tpInflWqltBod = item.tpInflWqltBod ? Number(Math.round(Number(item.tpInflWqltBod) * 10) / 10).toFixed(1) : Number(item.tpInflWqltBod) === 0 ? '0.0' : ''; } else { item.tpInflWqltBod = ''; } - if (item.tpInflWqltTp) { + if (item.tpInflWqltTp) { // 총인 유입수질 TP(mg/L) item.tpInflWqltTp = item.tpInflWqltTp ? Number(Math.round(Number(item.tpInflWqltTp) * 1000) / 1000).toFixed(3) : Number(item.tpInflWqltTp) === 0 ? '0.000' : ''; } else { item.tpInflWqltTp = ''; From c57f05cc3ec8600f711cbbc3cd36b9853c5175de Mon Sep 17 00:00:00 2001 From: dongsilove Date: Tue, 13 Jan 2026 22:53:35 +0900 Subject: [PATCH 4/8] =?UTF-8?q?sn:=20showModal=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/searchModal/searchModal.tsx | 158 +++++++++--------- .../(without-layout)/stats/hasuStat/page.tsx | 14 +- 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx index 34cdb674b..0906ce0ca 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx +++ b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx @@ -125,91 +125,91 @@ const SearchModal: React.FC = () => { {/* 📋 결과 리스트 */} {/* 기본정보 탭 */} {activeTab === 'basic' && ( -
-
- - { - const label = BASIC_TYPES.find((type) => type.val === basicType)?.text - return (<>{label} 조회 결과 ({tableCount.toLocaleString('ko-KR')})건); - })() - } - tableData={tableData} - headlist={dynamicHeadlist} - pageSize={10} - total={tableCount} - cellClick={handleBasicCellClick} - onPageChange={setCurPage} - resetPageNo={isResetPage} - resetSelection={isResetSelection} - curPage={curPage} - headButton={ -
- - -
- } - /> -
+
+ {/*
*/} + + { + const label = BASIC_TYPES.find((type) => type.val === basicType)?.text + return (<>{label} 조회 결과 ({tableCount.toLocaleString('ko-KR')})건); + })() + } + tableData={tableData} + headlist={dynamicHeadlist} + pageSize={10} + total={tableCount} + cellClick={handleBasicCellClick} + onPageChange={setCurPage} + resetPageNo={isResetPage} + resetSelection={isResetSelection} + curPage={curPage} + headButton={ +
+ + +
+ } + /> + {/*
*/}
)} {/* 유지관리 정보 탭 */} {activeTab === 'operation' && ( <> -
-
- - { - const label = WORK_TYPES.find((type) => type.val === workType)?.text - return (<>{label} 사업 현황 ({tableCount.toLocaleString('ko-KR')})건); - })() - } - tableData={tableData} - headlist={dynamicHeadlist} - pageSize={OPERATION_TABLE_SIZE} - total={tableCount} - cellClick={handleOperationCellClick} - onPageChange={setCurPage} - resetPageNo={isResetPage} - resetSelection={isResetSelection} - curPage={curPage} - headButton={ - - } - /> -
+
+ {/*
*/} + + { + const label = WORK_TYPES.find((type) => type.val === workType)?.text + return (<>{label} 사업 현황 ({tableCount.toLocaleString('ko-KR')})건); + })() + } + tableData={tableData} + headlist={dynamicHeadlist} + pageSize={OPERATION_TABLE_SIZE} + total={tableCount} + cellClick={handleOperationCellClick} + onPageChange={setCurPage} + resetPageNo={isResetPage} + resetSelection={isResetSelection} + curPage={curPage} + headButton={ + + } + /> + {/*
*/}
-
+
{/* 테이블2 영역 */} -
- - { - const label = WORK_TYPES.find((type) => type.val === workType)?.text - return (<>{label} 결과표 ({detailTableCount.toLocaleString('ko-KR')})건); - })() - } - tableData={detailTableData} - headlist={dynamicHeadlist2} - pageSize={OPERATION_TABLE_SIZE} - total={detailTableCount} - cellClick={handleOperationResultCellClick} - onPageChange={setDetailCurPage} - resetPageNo={isResetDetailPage} - resetSelection={isResetDetailSelection} - curPage={detailCurPage} - headButton={ -
- - -
- } - /> -
+ {/*
*/} + + { + const label = WORK_TYPES.find((type) => type.val === workType)?.text + return (<>{label} 결과표 ({detailTableCount.toLocaleString('ko-KR')})건); + })() + } + tableData={detailTableData} + headlist={dynamicHeadlist2} + pageSize={OPERATION_TABLE_SIZE} + total={detailTableCount} + cellClick={handleOperationResultCellClick} + onPageChange={setDetailCurPage} + resetPageNo={isResetDetailPage} + resetSelection={isResetDetailSelection} + curPage={detailCurPage} + headButton={ +
+ + +
+ } + /> + {/*
*/}
)} @@ -224,8 +224,8 @@ const SearchModal: React.FC = () => { bodyClass={` h-[100dvh] w-[90dvw] - max-w-[1200px] - max-h-[100dvh] + max-w-[1220px] + max-h-[970px] overflow-y-hidden z-[101] `} diff --git a/apps/wr/app/(without-layout)/stats/hasuStat/page.tsx b/apps/wr/app/(without-layout)/stats/hasuStat/page.tsx index 34ce031e1..d6e9ff601 100644 --- a/apps/wr/app/(without-layout)/stats/hasuStat/page.tsx +++ b/apps/wr/app/(without-layout)/stats/hasuStat/page.tsx @@ -20,20 +20,20 @@ export default function HasuStatPage() { const data = await res.json(); const ip: string = data?.ip || ""; if (didCancel) return; - //alert("Client IP:" + ip); + console.log("Client IP:" + ip); const is10 = /^10\./.test(ip); const is172 = /^172\./.test(ip); - setStatus(is10||is172 ? "redirect-internal" : "redirect-root"); + setStatus(is10 || is172 ? "redirect-internal" : "redirect-root"); // Use location.replace so user can't go back to this page - if (is10||is172) { + if (is10 || is172) { // redirect to internal IP // alert(process.env.NEXT_PUBLIC_HASUDOINFO_IN +'/cms/lay1/WS10000014/program.do'); - window.open(process.env.NEXT_PUBLIC_HASUDOINFO_IN +'/cms/lay1/WS10000014/program.do', '_blank'); + window.open(process.env.NEXT_PUBLIC_HASUDOINFO_IN + '/cms/lay1/WS10000014/program.do', '_blank'); } else { // alert(process.env.NEXT_PUBLIC_HASUDOINFO +'/cms/lay1/WS10000014/program.do'); - window.open(process.env.NEXT_PUBLIC_HASUDOINFO +'/cms/lay1/WS10000014/program.do', '_blank'); + window.open(process.env.NEXT_PUBLIC_HASUDOINFO + '/cms/lay1/WS10000014/program.do', '_blank'); } window.history.back(); } catch { @@ -53,13 +53,13 @@ export default function HasuStatPage() { }, []); return ( -
+
{status === "checking" &&
접속 IP 확인 중...
} {status === "redirect-internal" &&
내부망으로 이동합니다...
} {status === "redirect-root" &&
외부에서 접속하여 루트로 이동합니다...
} {status === "error-fallback" && (
- 문제가 발생하여 루트로 이동합니다. 이동하지 않으면 여기를 클릭하세요. + 문제가 발생하여 루트로 이동합니다. 이동하지 않으면 여기를 클릭하세요.
)}
From 7588ee4e6adfae2eb6821ef65b8e4e16fc995685 Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 14 Jan 2026 17:05:26 +0900 Subject: [PATCH 5/8] =?UTF-8?q?dm:=20=EC=9C=A0=EC=82=AC=EC=82=AC=EB=A1=80?= =?UTF-8?q?=20=ED=8C=9D=EC=97=85=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/sdmMng/sdmInfoInsert/modalSimilar/page.tsx | 6 +++--- apps/dm/components/ui/sdmInfoInsertForm/component.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/modalSimilar/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/modalSimilar/page.tsx index 22418c7b7..35836d07c 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/modalSimilar/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/modalSimilar/page.tsx @@ -87,9 +87,9 @@ export default function ModalSimilarPage({ sply = 0, usageCd = '', money = 0 }: }, [getSimilarCaseList, money, searchUseType, sply, usageCd]); return ( -
+
- <div className="overflow-x-auto h-[450px] w-full mt-8" tabIndex={0} aria-label="유사사례 테이블 영역"> + <div className="overflow-x-auto h-[480px] w-full mt-8" tabIndex={0} aria-label="유사사례 테이블 영역"> <div className="w-[150%]"> <div className="card-header justify-self-start"> <h3 className="text-2xl font-medium text-label">유사사례</h3> @@ -148,7 +148,7 @@ export default function ModalSimilarPage({ sply = 0, usageCd = '', money = 0 }: </div> </div> </div> - <div className="overflow-x-auto h-[270px] w-full mt-8"> + <div className="overflow-x-auto h-[270px] w-full mt-8 overflow-y-hidden"> <div className="w-[130%]"> <UiTable headName={"사업비 상세정보"} diff --git a/apps/dm/components/ui/sdmInfoInsertForm/component.tsx b/apps/dm/components/ui/sdmInfoInsertForm/component.tsx index 17e4bfdc8..62b214f04 100644 --- a/apps/dm/components/ui/sdmInfoInsertForm/component.tsx +++ b/apps/dm/components/ui/sdmInfoInsertForm/component.tsx @@ -950,7 +950,7 @@ export function SdmInfoRegForm({ body={ <ModalSimilarPage sply={sply} usageCd={usageCd} money={money} /> } - bodyClass="sm:max-w-[100vw] w-[1400px] h-[900px]" + bodyClass="sm:max-w-[100vw] w-[1400px] h-[100dvh] max-h-[900px] overflow-y-auto overflow-x-hidden" open={isSimilarCase} onOpenChange={(open) => !open && setIsSimilarCase(false)} noHeaderYn="Y" From 21b043cbae0da414c37746dcae5e941928691897 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Wed, 14 Jan 2026 17:51:48 +0900 Subject: [PATCH 6/8] =?UTF-8?q?dm:=20=EC=9C=A0=EC=82=AC=EC=82=AC=EB=A1=80?= =?UTF-8?q?=20=EC=82=AC=EC=97=85=EB=AA=85=20***=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/dm/app/store/sdmMng/index.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/dm/app/store/sdmMng/index.tsx b/apps/dm/app/store/sdmMng/index.tsx index b5b258839..ef7fb4cea 100644 --- a/apps/dm/app/store/sdmMng/index.tsx +++ b/apps/dm/app/store/sdmMng/index.tsx @@ -167,7 +167,7 @@ export type DemandMatchings = { // 유사사례 export type SimilarCaseType = { - ruseBizNm : string | ''; + ruseBizNm : string | ''; // 사업명 bizBgngDate : string | ''; bizEndDate : string | ''; splyFcltKnd : string | ''; @@ -751,11 +751,23 @@ export const SdmReducer = (set: any): SdmActions => { // 유사사례 조회 getSimilarCaseList: async (part: string, value: number|string) => { const res = await fetchGetSimilarCaseList(part, value); - if(res && res.length !== 0) { + const similarCaseList = res.map((el: SimilarCaseType) => { + const maskedBizNm = el.ruseBizNm + ? el.ruseBizNm.replace(/^(\s*)^\S+/, "***") // 첫 단어(공백 전까지) 치환 + : el.ruseBizNm; + + return { + ...el, + ruseBizNm: maskedBizNm, + }; + }); + console.log(similarCaseList); + + if(similarCaseList && similarCaseList.length !== 0) { set((state: SdmType) => ({ Sdm: { ...state.Sdm, - similarCaseList: res, + similarCaseList: similarCaseList, } })) return; From 4e27466f0099f314c64d1661498aca863c5eefe6 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Thu, 15 Jan 2026 15:51:08 +0900 Subject: [PATCH 7/8] =?UTF-8?q?dm:=20GATEWAY=5FURL=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/dm/.env.local | 2 +- apps/dm/.env.mindone | 1 + apps/dm/.env.production | 1 + apps/dm/app/store/wrStatus/index.tsx | 2 +- apps/dm/components/ui/api/index.ts | 25 +++++++++++++++++++------ apps/dm/middleware.ts | 23 ++++++++--------------- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/apps/dm/.env.local b/apps/dm/.env.local index e73fe4485..88b6f8067 100644 --- a/apps/dm/.env.local +++ b/apps/dm/.env.local @@ -16,7 +16,7 @@ NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API +NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login diff --git a/apps/dm/.env.mindone b/apps/dm/.env.mindone index 1ca3ecfb6..da6f80177 100644 --- a/apps/dm/.env.mindone +++ b/apps/dm/.env.mindone @@ -14,6 +14,7 @@ NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/ap NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API +NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 API # NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login diff --git a/apps/dm/.env.production b/apps/dm/.env.production index 2a08a80e0..5a401c89a 100644 --- a/apps/dm/.env.production +++ b/apps/dm/.env.production @@ -15,6 +15,7 @@ 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_GATEWAY_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 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/dm/app/store/wrStatus/index.tsx b/apps/dm/app/store/wrStatus/index.tsx index bd43db731..b3c08e9e2 100644 --- a/apps/dm/app/store/wrStatus/index.tsx +++ b/apps/dm/app/store/wrStatus/index.tsx @@ -92,7 +92,7 @@ export const DmStatusReducer = (set: any): DmStatusActions => { const sewageCnt = item.sewageCnt; const rainwaterCnt = item.rainwaterCnt; const reclaimedCnt = item.reclaimedCnt; - console.log("regionText ", regionText); + if (!regionText) console.log("item.region ", item.region); if (regionText && regionText.text) { return { region: regionText ? regionText.text : item.region, diff --git a/apps/dm/components/ui/api/index.ts b/apps/dm/components/ui/api/index.ts index 7ba66c4ed..abb0c2c73 100644 --- a/apps/dm/components/ui/api/index.ts +++ b/apps/dm/components/ui/api/index.ts @@ -1,23 +1,33 @@ //8880 import { AUTH_USER_ID, CLAIM_NAME } from "@/src/shared/config"; -import { DEV_URL_FO, DEV_URL_WR } from "../config"; import { getCookie } from "@common/components/lib/cookie"; + const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); export const fetchType = { COMMON: "common", WR: "wr", - FO:'fo' + FO: "fo", + SN: "sn" }; +const API_VERSION = "/api/v1" +const servers = { + common: "", + local: "", + fo: "/operation-service" + API_VERSION, + wr: "/reuse-service" + API_VERSION, + sn: "/sewerage-service" + API_VERSION, +} + interface RequestParams { [key: string]: unknown; } export const getFetch = async (type: string, url: string) => { - const baseUrl = type === fetchType.FO ? DEV_URL_FO : DEV_URL_WR; + const baseUrl = servers[type]; const response = await fetch(baseUrl + url, { method: "GET", headers: { @@ -35,7 +45,8 @@ export const getFetch = async (type: string, url: string) => { }; export const postFetch = async (url: string, params: RequestParams) => { - const response = await fetch(DEV_URL_WR + url, { + const baseUrl = servers[fetchType.WR]; + const response = await fetch(baseUrl + url, { method: "POST", headers: { "Content-Type": "application/json", @@ -52,7 +63,8 @@ export const postFetch = async (url: string, params: RequestParams) => { }; export const putFetch = async (url: string, params: RequestParams) => { - const response = await fetch(DEV_URL_WR + url, { + const baseUrl = servers[fetchType.WR]; + const response = await fetch(baseUrl + url, { method: "PUT", headers: { "Content-Type": "application/json", @@ -69,7 +81,8 @@ export const putFetch = async (url: string, params: RequestParams) => { }; export const deleteFetch = async (url: string, params: RequestParams) => { - const response = await fetch(DEV_URL_WR + url, { + const baseUrl = servers[fetchType.WR]; + const response = await fetch(baseUrl + url, { method: "DELETE", headers: { "Content-Type": "application/json", diff --git a/apps/dm/middleware.ts b/apps/dm/middleware.ts index 0b2b21fbb..44d4cb390 100644 --- a/apps/dm/middleware.ts +++ b/apps/dm/middleware.ts @@ -1,13 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config"; -import { SERVER_API_FO_URL, SERVER_API_WR_URL } from "./src/shared/config/env"; +// import { SERVER_API_FO_URL, SERVER_API_WR_URL } from "./src/shared/config/env"; // const CLAIM_NAME = "Authorization"; // const AUTH_USER_ID = "token-id"; const serverApiUrl = process.env.NEXT_PUBLIC_CS_SERVER_API_URL; const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || ""; -const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; +const GATEWAY_URL = process.env.NEXT_PUBLIC_GATEWAY_URL || ""; const BUSINESS_JUSO_API_URL = process.env.NEXT_PUBLIC_FINDADRESS_URL || ""; const AdressKey = process.env.NEXT_PRIVATE_WR_ADDRESS_KEY || ""; @@ -112,7 +112,7 @@ export function middleware(req: NextRequest) { const url = req.nextUrl.clone(); url.searchParams.set("TYPENAME", typename.replace("hasudo:", "")); queryParams = url.searchParams.toString(); - newUrl = `${SEWERAGE_API_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; + newUrl = `${GATEWAY_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; } console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); @@ -121,24 +121,17 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/reuse-service")) { const queryParams = searchParams.toString(); - const newUrl = `${SERVER_API_WR_URL}${pathname.replace("/reuse-service", "")}${queryParams ? `?${queryParams}` : "" - }`; + const newUrl = `${GATEWAY_URL}${pathname}${queryParams ? `?${queryParams}` : ""}`; console.log(`[Middleware] Rewriting from '/reuse-service' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); - } - - if (pathname.startsWith("/operation-service")) { + } else if (pathname.startsWith("/operation-service")) { const queryParams = searchParams.toString(); - const newUrl = `${SERVER_API_FO_URL}${pathname.replace("/operation-service", "")}${queryParams ? `?${queryParams}` : "" - }`; + const newUrl = `${GATEWAY_URL}${pathname}${queryParams ? `?${queryParams}` : ""}`; console.log(`[Middleware] Rewriting from '/operation-service' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); - } - - if (pathname.startsWith("/sewerage-service")) { + } else if (pathname.startsWith("/sewerage-service")) { const queryParams = searchParams.toString(); - const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service", "")}${queryParams ? `?${queryParams}` : "" - }`; + const newUrl = `${GATEWAY_URL}${pathname}${queryParams ? `?${queryParams}` : ""}`; console.log(`[Middleware] Rewriting from '/sewerage-service' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); } From 3716e8c7b2e4b48d4bdc500f304e7ac3a139611d Mon Sep 17 00:00:00 2001 From: dongsilove <ljparkmindone@gmail.com> Date: Thu, 15 Jan 2026 21:14:49 +0900 Subject: [PATCH 8/8] =?UTF-8?q?dm:=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/sdmMng/sdmInfoInsert/page.tsx | 18 +- .../pages/sdmMng/sdmLogout/page.tsx | 22 + apps/dm/app/store/sdmMng/index.tsx | 617 +++++++++--------- 3 files changed, 348 insertions(+), 309 deletions(-) create mode 100644 apps/dm/app/(base-layout)/pages/sdmMng/sdmLogout/page.tsx diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx index b6a395974..df418b20f 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx @@ -1,5 +1,11 @@ "use client"; +/** + * 수요정보등록 화면 + * + * 🔗 사용 API + * - 수요정보등록: POST /reuseFc/request/demandInfo + */ import { useDmStore } from "@/app/store"; import { sdmInfoFormSchema, type DemandCompBizType, type SdmInfoFormData } from "@/app/store/sdmMng"; import { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component"; @@ -60,7 +66,7 @@ function SdmInfoInsertContent() { ...prev, sdmNm: searchParams.get("dmdCoNm") || "", })); - if(searchParams.get("dmdInfoId")){ + if (searchParams.get("dmdInfoId")) { // const data = { // dmdCoNm: searchParams.get("dmdCoNm") || '', // ctpvCd: searchParams.get("ctpvCd") || '', @@ -69,8 +75,8 @@ function SdmInfoInsertContent() { // daddr: searchParams.get("daddr") || '', // telno: searchParams.get("telno") || '', // } - - // sessionStorage.setItem("user", JSON.stringify(data || {})); + + // sessionStorage.setItem("user", JSON.stringify(data || {})); } //sessionStorage.setItem("user", JSON.parse(user||'') || ""); setIsLogin(user || searchParams.get("dmdInfoId") ? true : false); @@ -121,7 +127,7 @@ function SdmInfoInsertContent() { const userData = JSON.parse(user); if (userData.dmdCoNm) { setFacilityName(userData.dmdCoNm); - form.setValue("sdmNm", userData.dmdCoNm); + form.setValue("sdmNm", userData.dmdCoNm); // 수요처명(회사명) } } catch (error) { console.error("Error parsing user data:", error); @@ -203,10 +209,10 @@ function SdmInfoInsertContent() { tph: Number(data.tph) || null, trbt: Number(data.trbt) || null, ph: data.ph || "", - blgcOxygDmndQnt: Number(data.bod) ||null, + blgcOxygDmndQnt: Number(data.bod) || null, clIonQnt: Number(data.clIonQnt) || null, smll: data.smll || "", - cdtnv: Number(data.cdtnv) ||null, + cdtnv: Number(data.cdtnv) || null, crmty: Number(data.crmty) || null, rmrk: data.rmrk || "", bzmnNo: "", diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmLogout/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmLogout/page.tsx new file mode 100644 index 000000000..2c682bdbf --- /dev/null +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmLogout/page.tsx @@ -0,0 +1,22 @@ +"use client"; +/** + * 수요처 로그아웃 화면 + * + * 🔗 사용 API + * + */ +import { useDmStore } from "@/app/store"; +import { useRouter } from "next/navigation"; +import { useEffect } from "react"; + +export default function SdmLogout() { + const router = useRouter(); + const { actionLogout } = useDmStore((state) => state); + + useEffect(() => { + actionLogout(); + router.push("/pages/sdmMng/sdmInfoInsert"); + }, [actionLogout, router]); + + return null; +} diff --git a/apps/dm/app/store/sdmMng/index.tsx b/apps/dm/app/store/sdmMng/index.tsx index ef7fb4cea..2e52ac13d 100644 --- a/apps/dm/app/store/sdmMng/index.tsx +++ b/apps/dm/app/store/sdmMng/index.tsx @@ -50,8 +50,8 @@ export const sdmInfoFormSchema = z.object({ // 모든 수질 관련 필드 // 총대장균군수는 null 값을 불검출로 표시하기때문에 해당 검사에서 제외함. const allFields: (keyof typeof data)[] = [ - "tn", "combResdch", "tph", - "trbt", "ph", "bod", "clIonQnt", + "tn", "combResdch", "tph", + "trbt", "ph", "bod", "clIonQnt", "smll", "cdtnv", "crmty", ]; @@ -104,38 +104,38 @@ export type SdmInfoFormData = z.infer<typeof sdmInfoFormSchema>; // 수요처 정보 export type DemandCompBizType = { - index : number | ''; - dmdInfoId : string | ''; - dmdInfoFk : string | ''; - bzmnNo : string | ''; - dmdCoNm : string | ''; - daddr : string | ''; - telno : string | ''; - rgtr : string | ''; - useUsgCd : string | ''; - ctpvCd : string | ''; - sggCd : string | ''; - dmdAplyPswd : string | ''; - wntUntprc : number | ''; - dmndTmng : Date | ''; - dmndQty : number | ''; - grssClfg : number | null //총대장균군수 - tn : number | null //총질소 - combResdch : number | null //결합잔류염소 - tph : number | null //총인 - trbt : number | null //탁도 - ph : string | ''; //수소이온농 - blgcOxygDmndQnt : number | null //생물학적산소요구량 - clIonQnt : number | null //염화물 - smll : string | ''; //냄새 - cdtnv : number | null; //전기전도도 - crmty : number | null //색도 - rmrk : string | ''; - reqDt : string | ''; - dmdInfoSn : number | ''; - status : string | ''; - splyCndtList:SupplyCandidate[]|[], - ruseUtztnFcltNm?:string|'' + index: number | ''; + dmdInfoId: string | ''; + dmdInfoFk: string | ''; + bzmnNo: string | ''; + dmdCoNm: string | ''; + daddr: string | ''; + telno: string | ''; + rgtr: string | ''; + useUsgCd: string | ''; + ctpvCd: string | ''; + sggCd: string | ''; + dmdAplyPswd: string | ''; + wntUntprc: number | ''; + dmndTmng: Date | ''; + dmndQty: number | ''; + grssClfg: number | null //총대장균군수 + tn: number | null //총질소 + combResdch: number | null //결합잔류염소 + tph: number | null //총인 + trbt: number | null //탁도 + ph: string | ''; //수소이온농 + blgcOxygDmndQnt: number | null //생물학적산소요구량 + clIonQnt: number | null //염화물 + smll: string | ''; //냄새 + cdtnv: number | null; //전기전도도 + crmty: number | null //색도 + rmrk: string | ''; + reqDt: string | ''; + dmdInfoSn: number | ''; + status: string | ''; + splyCndtList: SupplyCandidate[] | [], + ruseUtztnFcltNm?: string | '' } @@ -147,107 +147,107 @@ export type SupplyCandidate = { export type DemandMatchings = { - splyFcltFk : string | ''; - splyFcltFlg : string | ''; - pbnstRuseFcltBizFk : number | ''; - splyBgngDay : string | ''; - splyEndDay : string | ''; - splyCpct : number | ''; - splyFmYn : string | ''; - useUsgCd : string | ''; - dmdInfoSn : number | ''; - splyCndtList : string | ''; - mtchnCmptnYmd : string | ''; - rvwCmptnYmd : string | ''; - regDt : string | ''; - rgtr : string | ''; - mdfcnDt : string | ''; - mdfr : string | ''; + splyFcltFk: string | ''; + splyFcltFlg: string | ''; + pbnstRuseFcltBizFk: number | ''; + splyBgngDay: string | ''; + splyEndDay: string | ''; + splyCpct: number | ''; + splyFmYn: string | ''; + useUsgCd: string | ''; + dmdInfoSn: number | ''; + splyCndtList: string | ''; + mtchnCmptnYmd: string | ''; + rvwCmptnYmd: string | ''; + regDt: string | ''; + rgtr: string | ''; + mdfcnDt: string | ''; + mdfr: string | ''; } // 유사사례 export type SimilarCaseType = { - ruseBizNm : string | ''; // 사업명 - bizBgngDate : string | ''; - bizEndDate : string | ''; - splyFcltKnd : string | ''; - splyFcltNm : string | ''; - splyFcltCpct : string | ''; - dmdFcltNm : string | ''; - dmdFcltAddr : string | ''; - ruseFcltCpct : string | ''; - ruseFcltPplLen : string | ''; - ruseFcltUsg : string | ''; - ruseFcltSplyCpct : string | ''; - ruseFcltPrcsMsrc : string | ''; - grnteWqUsg : string | ''; - grnteWqGrssClfg : string | ''; - grnteWqCombResdch : string | ''; - grnteWqTrbt : string | ''; - grnteWqBod : string | ''; - grnteWqSmll : string | ''; - grnteWqCrmty : string | ''; - grnteWqTn : string | ''; - grnteWqTp : string | ''; - grnteWqPh : string | ''; - grnteWqClIonQnt : string | ''; - grnteWqCndctStat : string | ''; - grnteWqRmrk : string | ''; - reqBizReuseFcltCst : string | ''; - reqBizPplCst : string | ''; - reqBizArchCst : string | ''; - reqBizMchnCst : string | ''; - reqBizMtrngCst : string | ''; - reqBizGisCst : string | ''; - reqBizCctvCst : string | ''; - reqBizCmcnCst : string | ''; - reqBizWstCst : string | ''; - reqBizDesignCst : string | ''; - reqBizSpvsCst : string | ''; - reqBizSbsdCst : string | ''; - reqBizEtc : string | ''; - reqBizGrssCst : string | ''; - prcmPlanNlep : string | ''; - prcmPlanLcep : string | ''; - prcmPlanBrdnCst : string | ''; - prcmPlanEcqrRt : string | ''; - prcmPlanGrssCst : string | ''; - clclnNlep : string | ''; - clclnLcep : string | ''; - clclnBrdnCst : string | ''; - clclnEcqrRt : string | ''; - clclnGrssCst : string | ''; + ruseBizNm: string | ''; // 사업명 + bizBgngDate: string | ''; + bizEndDate: string | ''; + splyFcltKnd: string | ''; + splyFcltNm: string | ''; + splyFcltCpct: string | ''; + dmdFcltNm: string | ''; + dmdFcltAddr: string | ''; + ruseFcltCpct: string | ''; + ruseFcltPplLen: string | ''; + ruseFcltUsg: string | ''; + ruseFcltSplyCpct: string | ''; + ruseFcltPrcsMsrc: string | ''; + grnteWqUsg: string | ''; + grnteWqGrssClfg: string | ''; + grnteWqCombResdch: string | ''; + grnteWqTrbt: string | ''; + grnteWqBod: string | ''; + grnteWqSmll: string | ''; + grnteWqCrmty: string | ''; + grnteWqTn: string | ''; + grnteWqTp: string | ''; + grnteWqPh: string | ''; + grnteWqClIonQnt: string | ''; + grnteWqCndctStat: string | ''; + grnteWqRmrk: string | ''; + reqBizReuseFcltCst: string | ''; + reqBizPplCst: string | ''; + reqBizArchCst: string | ''; + reqBizMchnCst: string | ''; + reqBizMtrngCst: string | ''; + reqBizGisCst: string | ''; + reqBizCctvCst: string | ''; + reqBizCmcnCst: string | ''; + reqBizWstCst: string | ''; + reqBizDesignCst: string | ''; + reqBizSpvsCst: string | ''; + reqBizSbsdCst: string | ''; + reqBizEtc: string | ''; + reqBizGrssCst: string | ''; + prcmPlanNlep: string | ''; + prcmPlanLcep: string | ''; + prcmPlanBrdnCst: string | ''; + prcmPlanEcqrRt: string | ''; + prcmPlanGrssCst: string | ''; + clclnNlep: string | ''; + clclnLcep: string | ''; + clclnBrdnCst: string | ''; + clclnEcqrRt: string | ''; + clclnGrssCst: string | ''; } // 사업비 상세정보 export type MoneyDetailType = { - reqBizGrssCst : string | ''; - reqBizReuseFcltCst : string | ''; - reqBizPplCst : string | ''; - reqBizArchCst : string | ''; - reqBizMchnCst : string | ''; - reqBizMtrngCst : string | ''; - reqBizGisCst : string | ''; - reqBizCctvCst : string | ''; - reqBizCmcnCst : string | ''; - reqBizWstCst : string | ''; - reqBizDesignCst : string | ''; - reqBizSpvsCst : string | ''; - reqBizSbsdCst : string | ''; - reqBizEtc : string | ''; - + reqBizGrssCst: string | ''; + reqBizReuseFcltCst: string | ''; + reqBizPplCst: string | ''; + reqBizArchCst: string | ''; + reqBizMchnCst: string | ''; + reqBizMtrngCst: string | ''; + reqBizGisCst: string | ''; + reqBizCctvCst: string | ''; + reqBizCmcnCst: string | ''; + reqBizWstCst: string | ''; + reqBizDesignCst: string | ''; + reqBizSpvsCst: string | ''; + reqBizSbsdCst: string | ''; + reqBizEtc: string | ''; + /** 재원조달계획(백만원원) */ - prcmPlanGrssCst : string | ''; - prcmPlanNlep : string | ''; - prcmPlanLcep : string | ''; - prcmPlanBrdnCst : string | ''; - prcmPlanEcqrRt : string | ''; + prcmPlanGrssCst: string | ''; + prcmPlanNlep: string | ''; + prcmPlanLcep: string | ''; + prcmPlanBrdnCst: string | ''; + prcmPlanEcqrRt: string | ''; /** 사업비 정산(백만원) */ - clclnGrssCst : string | ''; - clclnNlep : string | ''; - clclnLcep : string | ''; - clclnBrdnCst : string | ''; - clclnEcqrRt : string | ''; + clclnGrssCst: string | ''; + clclnNlep: string | ''; + clclnLcep: string | ''; + clclnBrdnCst: string | ''; + clclnEcqrRt: string | ''; } // 규칙 타입 선언 export type DisableRulesType = Record<string, string[]>; @@ -255,144 +255,144 @@ export type DisableRulesType = Record<string, string[]>; * Store - 데이터 ====================================*/ // 수요처 정보 -const demandCompList : DemandCompType[] = [ +const demandCompList: DemandCompType[] = [ ] const disableRules: DisableRulesType = { - "청소": ["tn", 'tph',"clIonQnt" ,'cdtnv'], - "화장실용수": ["tn", 'tph',"clIonQnt" ,'cdtnv'], - "세척": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'], - "살수": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'], - "조경": ["combResdch", "crmty",'tph','cdtnv'], - "농업_간접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'], - "농업_직접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'], - "하천": ["combResdch", "trbt", "crmty" ,'clIonQnt','cdtnv'], - '공업':[] - }; + "청소": ["tn", 'tph', "clIonQnt", 'cdtnv'], + "화장실용수": ["tn", 'tph', "clIonQnt", 'cdtnv'], + "세척": ["combResdch", "crmty", 'tph', 'tn', "clIonQnt", 'cdtnv'], + "살수": ["combResdch", "crmty", 'tph', 'tn', "clIonQnt", 'cdtnv'], + "조경": ["combResdch", "crmty", 'tph', 'cdtnv'], + "농업_간접용수": ["combResdch", "crmty", 'tn', 'tph', 'clIonQnt'], + "농업_직접용수": ["combResdch", "crmty", 'tn', 'tph', 'clIonQnt'], + "하천": ["combResdch", "trbt", "crmty", 'clIonQnt', 'cdtnv'], + '공업': [] +}; - const defaultRules: Record<string, object> = { - "청소": { - grssClfg: null, - combResdch:0.2, - trbt: 2, - bod: 5, - crmty: 20, - ph: "5.8~8.5", - smll:'불쾌하지않을것', - tn:null, - tph: null, - clIonQnt: null, - cdtnv: null, +const defaultRules: Record<string, object> = { + "청소": { + grssClfg: null, + combResdch: 0.2, + trbt: 2, + bod: 5, + crmty: 20, + ph: "5.8~8.5", + smll: '불쾌하지않을것', + tn: null, + tph: null, + clIonQnt: null, + cdtnv: null, - }, - "화장실용수": { - grssClfg: null, - combResdch:0.2, - trbt: 2, - bod: 5, - crmty: 20, - smll:'불쾌하지않을것', - ph: "5.8~8.5", - tn:null, - tph: null, - clIonQnt: null, - cdtnv: null, - }, - "세척": { - grssClfg: null, - trbt: 2, - bod: 5, - ph: "5.8~8.5", - combResdch:null, - smll:'불쾌하지않을것', - crmty:null, - tn:null, - tph: null, - clIonQnt: null, - cdtnv: null, - }, - "살수": { - grssClfg: null, - trbt: 2, - bod: 5, - ph: "5.8~8.5", - smll:'불쾌하지않을것', - combResdch:null, - crmty:null, - tn:null, - tph: null, - clIonQnt: null, - cdtnv: null, - }, - "조경": { - grssClfg: null, - trbt: 2, - bod: 5, - ph: "5.8~8.5", - smll:'불쾌하지않을것', - clIonQnt:250, - combResdch:null, - crmty:null, - tn:null, - tph: null, - cdtnv: null, - }, - "농업_간접용수": { - grssClfg: null, - trbt: 5, - bod: 8, - ph: "5.8~8.5", - cdtnv:2000, - combResdch:null, - crmty:null, - tn:null, - tph: null, - clIonQnt: null, - }, - "농업_직접용수": { - grssClfg: null, - trbt: 2, - bod: 8, - smll:'불쾌하지않을것', - ph: "5.8~8.5", - cdtnv:700, - combResdch:null, - crmty:null, - tn:null, - tph: null, - clIonQnt: null, - }, - "하천": { - grssClfg: 1000, - bod: 5, - tn: 10, - tph: 0.5, - smll:'불쾌하지않을것', - ph: "5.8~8.5", - combResdch:null, - trbt:null, - crmty:null, - clIonQnt: null, - cdtnv:null - }, - '공업':{ - grssClfg: null, - bod: null, - tn: null, - tph: null, - ph: "~", - combResdch:null, - smll:'불쾌하지않을것', - trbt:null, - crmty:null, - clIonQnt: null, - cdtnv:null - } - }; + }, + "화장실용수": { + grssClfg: null, + combResdch: 0.2, + trbt: 2, + bod: 5, + crmty: 20, + smll: '불쾌하지않을것', + ph: "5.8~8.5", + tn: null, + tph: null, + clIonQnt: null, + cdtnv: null, + }, + "세척": { + grssClfg: null, + trbt: 2, + bod: 5, + ph: "5.8~8.5", + combResdch: null, + smll: '불쾌하지않을것', + crmty: null, + tn: null, + tph: null, + clIonQnt: null, + cdtnv: null, + }, + "살수": { + grssClfg: null, + trbt: 2, + bod: 5, + ph: "5.8~8.5", + smll: '불쾌하지않을것', + combResdch: null, + crmty: null, + tn: null, + tph: null, + clIonQnt: null, + cdtnv: null, + }, + "조경": { + grssClfg: null, + trbt: 2, + bod: 5, + ph: "5.8~8.5", + smll: '불쾌하지않을것', + clIonQnt: 250, + combResdch: null, + crmty: null, + tn: null, + tph: null, + cdtnv: null, + }, + "농업_간접용수": { + grssClfg: null, + trbt: 5, + bod: 8, + ph: "5.8~8.5", + cdtnv: 2000, + combResdch: null, + crmty: null, + tn: null, + tph: null, + clIonQnt: null, + }, + "농업_직접용수": { + grssClfg: null, + trbt: 2, + bod: 8, + smll: '불쾌하지않을것', + ph: "5.8~8.5", + cdtnv: 700, + combResdch: null, + crmty: null, + tn: null, + tph: null, + clIonQnt: null, + }, + "하천": { + grssClfg: 1000, + bod: 5, + tn: 10, + tph: 0.5, + smll: '불쾌하지않을것', + ph: "5.8~8.5", + combResdch: null, + trbt: null, + crmty: null, + clIonQnt: null, + cdtnv: null + }, + '공업': { + grssClfg: null, + bod: null, + tn: null, + tph: null, + ph: "~", + combResdch: null, + smll: '불쾌하지않을것', + trbt: null, + crmty: null, + clIonQnt: null, + cdtnv: null + } +}; // 사용용도 -const useTypesData : SelectDataType[] = [ +const useTypesData: SelectDataType[] = [ { text: '청소', val: "청소" }, { text: "화장실용수", val: "화장실용수" }, { text: "세척", val: "세척" }, @@ -440,8 +440,8 @@ export const similarCaseModalHeader: TableUpperProps[] = [ ] // 유사사례 데이터 -const similarCaseList : SimilarCaseType[] = [ - +const similarCaseList: SimilarCaseType[] = [ + ] // 사업비 상세정보 모달 헤더 @@ -477,12 +477,12 @@ export const moneyDetailModalHeader: TableUpperProps[] = [ ] // 사업비 상세정보 -const moneyDetailList : MoneyDetailType[] = [ +const moneyDetailList: MoneyDetailType[] = [ ] // 수요정보 신청현황 헤더 export const upHeadSdmInfoStatus: TableUpperProps[] = [ - { id: "index", title: "No."}, + { id: "index", title: "No." }, { id: "ctpvCd", title: "시도", row: 0, rowSpan: 2 }, { id: "sggCd", title: "시군구", row: 0, rowSpan: 2 }, { id: "dmdCoNm", title: "회사명", row: 0, rowSpan: 2 }, @@ -501,7 +501,7 @@ export const upHeadSdmInfoStatus: TableUpperProps[] = [ const postSdmData = async (data: DemandCompType) => { try { await postFetch("/reuseFc/request", data); - sessionStorage.setItem("user", JSON.stringify(data) ); + sessionStorage.setItem("user", JSON.stringify(data)); toast.success("수요처 등록에 성공하였습니다."); return true; } catch (error) { @@ -526,16 +526,16 @@ const postSdmLoginData = async (data: DemandCompType) => { try { const res = await postFetch("/reuseFc/request/login", data); const jsonData = await res.json(); - + const status = jsonData.status; const loginData = jsonData.data; let loginSuccess = false; - if(status === 200 && loginData != null) { + if (status === 200 && loginData != null) { alert("수요처 로그인에 성공하였습니다."); sessionStorage.setItem("user", JSON.stringify(loginData)); loginSuccess = true; - } else if(status === 401) { - alert("패스워드가 틀렸습니다."); + } else if (status === 401) { + alert("패스워드가 일치하지 않습니다."); loginSuccess = false; } else { alert("등록된 수요처가 없습니다."); @@ -553,35 +553,35 @@ const getDemandCompList = async (searchText: string, pageCnt: number) => { try { const url = '/reuseFc/request/' + (searchText ? searchText : '') + '/' + pageCnt; const res = await getFetch(fetchType.WR, url); - return { - data: res?.data || [], - count: res?.count || 0 + return { + data: res?.data || [], + count: res?.count || 0 } } catch (error) { - console.error(error+' 수요처 정보를 불러오지 못했습니다.'); + console.error(error + ' 수요처 정보를 불러오지 못했습니다.'); return { data: [], count: 0 }; } } -const getSdmInfoStatusList = async (dmdInfoId : string) => { +const getSdmInfoStatusList = async (dmdInfoId: string) => { try { const url = '/reuseFc/request/' + dmdInfoId; const res = await getFetch(fetchType.WR, url); return res?.data || []; } catch (error) { - console.error(error+' 수요정보 신청현황을 불러오지 못했습니다.'); + console.error(error + ' 수요정보 신청현황을 불러오지 못했습니다.'); return []; } } // 유사사례 조회 -const fetchGetSimilarCaseList = async (part: string, value: number|string) => { +const fetchGetSimilarCaseList = async (part: string, value: number | string) => { try { const url = '/reuseFc/pubFcRuseCase/dm/' + part + '/' + (value ? value : 0); const res = await getFetch(fetchType.WR, url); return res?.data || []; } catch (error) { - console.error(error+' 유사사례 조회에 실패하였습니다.'); + console.error(error + ' 유사사례 조회에 실패하였습니다.'); return []; } } @@ -590,23 +590,24 @@ const fetchGetSimilarCaseList = async (part: string, value: number|string) => { * Store - expaort ====================================*/ export type SdmActions = { - initializeSdmData: () => void; - insertSdmData: (data: DemandCompType) => Promise<void>; - insertSdmInfoData: (data: DemandCompBizType) => Promise<void>; - getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>; - actionLogin: (data: DemandCompType) => Promise<void>; - getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>; - getSimilarCaseList: (part: string, value: number|string) => Promise<void>; + initializeSdmData: () => void; + insertSdmData: (data: DemandCompType) => Promise<void>; + insertSdmInfoData: (data: DemandCompBizType) => Promise<void>; + getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>; + actionLogin: (data: DemandCompType) => Promise<void>; + getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>; + getSimilarCaseList: (part: string, value: number | string) => Promise<void>; + actionLogout: () => Promise<void>; } -export type SdmType ={ - Sdm :{ +export type SdmType = { + Sdm: { isInit: boolean; useTypesData: SelectDataType[]; demandCompList: DemandCompType[]; upHeadSimilarCaseList: TableUpperProps[]; similarCaseList: SimilarCaseType[]; - upHeadMoneyDetailList : TableUpperProps[]; + upHeadMoneyDetailList: TableUpperProps[]; moneyDetailList: MoneyDetailType[]; // 수요정보 신청현황 @@ -615,28 +616,28 @@ export type SdmType ={ defaultRules: Record<string, object> disableRules: DisableRulesType; // 로그인관련 - successNextPage : boolean; + successNextPage: boolean; successLogin: boolean; } } export const SdmState: SdmType = { - Sdm:{ - isInit:false, + Sdm: { + isInit: false, useTypesData: useTypesData, demandCompList: demandCompList, upHeadSimilarCaseList: similarCaseModalHeader, similarCaseList: similarCaseList, - upHeadMoneyDetailList : moneyDetailModalHeader, + upHeadMoneyDetailList: moneyDetailModalHeader, moneyDetailList: moneyDetailList, // 수요정보 신청현황 sdmInfoStatusList: [], - defaultRules:defaultRules, - disableRules:disableRules, + defaultRules: defaultRules, + disableRules: disableRules, upHeadSdmInfoStatus: upHeadSdmInfoStatus, // 로그인관련 - successNextPage : false, + successNextPage: false, successLogin: false, } } @@ -648,13 +649,13 @@ export const SdmReducer = (set: any): SdmActions => { insertSdmData: async (data: DemandCompType) => { const preRes = await getSdmInfoStatusList(data.dmdInfoId); - if(preRes?.dmdInfoId) { + if (preRes?.dmdInfoId) { toast.error('이미 등록된 수요처입니다.'); return; } const res = await postSdmData(data); - if(res) { + if (res) { set((state: SdmType) => ({ Sdm: { ...state.Sdm, @@ -671,7 +672,7 @@ export const SdmReducer = (set: any): SdmActions => { // 수요처 정보 getDemandCompList: async (searchText: string, pageCnt: number) => { const res = await getDemandCompList(searchText, pageCnt); - if(res.data.length === 0) { + if (res.data.length === 0) { set((state: SdmType) => ({ Sdm: { ...state.Sdm, @@ -693,7 +694,7 @@ export const SdmReducer = (set: any): SdmActions => { getSdmInfoStatusList: async (dmdInfoId: string) => { const res = await getSdmInfoStatusList(dmdInfoId); - if(res.length === 0) { + if (res.length === 0) { set((state: SdmType) => ({ Sdm: { ...state.Sdm, @@ -704,13 +705,13 @@ export const SdmReducer = (set: any): SdmActions => { } //const sdmInfoStatusList : DemandCompBizType[] = []; - const sdmInfoStatusList : DemandCompBizType[]= res.demandInfo.map((el: DemandCompBizType, index: number) => { + const sdmInfoStatusList: DemandCompBizType[] = res.demandInfo.map((el: DemandCompBizType, index: number) => { const matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn); const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청'; const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : ''; - return( { + return ({ ...el, index: ++index, bzmnNo: res.bzmnNo, @@ -723,8 +724,8 @@ export const SdmReducer = (set: any): SdmActions => { sggCd: res.sggCd, useUsgCd: el.useUsgCd, dmndTmng: el.dmndTmng, - dmdInfoSn : el.dmdInfoSn, - status : status, + dmdInfoSn: el.dmdInfoSn, + status: status, splyCndtList: el.splyCndtList, ruseUtztnFcltNm: ruseUtztnFcltNm || '' }) @@ -749,7 +750,7 @@ export const SdmReducer = (set: any): SdmActions => { }, // 유사사례 조회 - getSimilarCaseList: async (part: string, value: number|string) => { + getSimilarCaseList: async (part: string, value: number | string) => { const res = await fetchGetSimilarCaseList(part, value); const similarCaseList = res.map((el: SimilarCaseType) => { const maskedBizNm = el.ruseBizNm @@ -762,24 +763,34 @@ export const SdmReducer = (set: any): SdmActions => { }; }); console.log(similarCaseList); - - if(similarCaseList && similarCaseList.length !== 0) { + + if (similarCaseList && similarCaseList.length !== 0) { set((state: SdmType) => ({ - Sdm: { + Sdm: { ...state.Sdm, similarCaseList: similarCaseList, } })) return; - }else{ + } else { set((state: SdmType) => ({ - Sdm: { + Sdm: { ...state.Sdm, similarCaseList: [], } })) return; } + }, + + actionLogout: async () => { + sessionStorage.removeItem("user"); + set((state: SdmType) => ({ + Sdm: { + ...state.Sdm, + successLogin: false, + } + })) } } }