From 36294fef80a0109abecaf4e67356fe413ec7d212 Mon Sep 17 00:00:00 2001 From: dongsilove Date: Mon, 12 Jan 2026 10:28:36 +0900 Subject: [PATCH] =?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,