Files
frontend/apps/fo/app/store/processArea/index.tsx
2026-01-12 10:28:36 +09:00

547 lines
28 KiB
TypeScript

import { postFetch } from "@/app/components/api";
import DataForm from "@/app/components/common/DataForm";
import { fetchPlanInfo } from "../common";
import type { TableUpperProps } from "../dashboard";
export type { TableUpperProps };
/**====================================
* Store - 타입
====================================*/
/**
* (1) 메인페이지
*/
// 처리구역 리스트
export type ProcessAreaProps = {
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,
/**
* 증설계획
*/
// 기승인(당초4단계), 현재, 변경1~4
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 | '',
/**
* 처리구역면적
*/
// 기승인(당초4단계), 변경1~4
swtrmtZoneAreaDt4: number | '',
swtrmtZoneArea: number | '',
swtrmtZoneAreaDc1: number | '',
swtrmtZoneAreaDc2: number | '',
swtrmtZoneAreaDc3: number | '',
swtrmtZoneAreaDc4: number | '',
// 처리구역
trtDstr: string | '',
}
export interface ExcelType {
시설코드: string,
시설명: string,
주소: string,
"시설옹량(m³/일)": number | '',
"증설계획기존(m³/일)": number | '',
"증설계획현재(m³/일)": number | '',
"증설계획1단계(m³/일)": number | '',
"증설계획2단계(m³/일)": number | '',
"증설계획3단계(m³/일)": number | '',
"증설계획4단계(m³/일)": number | '',
"처리인구기존(인)": number | '',
"처리인구현재(인)": number | '',
"처리인구1단계(인)": number | '',
"처리인구2단계(인)": number | '',
"처리인구3단계(인)": number | '',
"처리인구4단계(인)": number | '',
"처리구역기존(km²)": number | '',
"처리구역현재(km²)": number | '',
"처리구역1단계(km²)": number | '',
"처리구역2단계(km²)": number | '',
"처리구역3단계(km²)": number | '',
"처리구역4단계(km²)": number | '',
처리구역: string | ''
}
// (2) 처리구역 팝업
// 시설증설 계획
export type FcltyImproveInfoProps = {
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 | '',
}
// 처리구역 계획
export type ProcessAreaPlanProps = {
swtrmtZoneAreaDt4: number | '',
swtrmtZoneArea: number | '',
swtrmtZoneAreaDc1: number | '',
swtrmtZoneAreaDc2: number | '',
swtrmtZoneAreaDc3: number | '',
swtrmtZoneAreaDc4: number | '',
trtDstr: string,
}
/**====================================
* Store - data
====================================*/
/**
* (1) 메인페이지
*/
// 검색단
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: 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 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 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 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[] = [
];
/**====================================
* Store - API
=====================================*/
// 시설 상세 정보 조회 API
/* const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => {
try {
const tailUrl = '/1/5/A/0/0/0/SW';
const res = await postFetch('fo', '/prcsFclt/ruseInfo'+tailUrl, [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 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 : '';
item.trtDstr = filterdData ? filterdData.trtDstr : '';
});
return { data: paginatedData, count: enrichedData.length };
} else {
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;
}
export type ProcessAreaType = {
ProcessAreaSearch: {
isInit: boolean;
processFacilityLabelArray: string[];
},
ProcessArea: {
isInit: boolean;
upHeadList1: TableUpperProps[];
processAreaList: ProcessAreaProps[];
processAreaCount: number;
excelList: ExcelType[];
isLoading: boolean;
},
ProcessAreaDetail: {
isInit: boolean;
upHeadListFcltyImproveInfo: TableUpperProps[];
gridListFcltyImproveInfo: FcltyImproveInfoProps[]; // Changed from facilityAreaProps to ProcessAreaProps
upHeadListProcessPopulation: TableUpperProps[];
gridListProcessPopulation: ProcessPopulationProps[]; // Changed from facilityAreaProps to ProcessAreaProps
upHeadListProcessAreaPlan: TableUpperProps[];
gridListProcessAreaPlan: ProcessAreaPlanProps[]; // Changed from facilityAreaProps to ProcessAreaProps
},
}
export const processAreaInitState: ProcessAreaType = {
ProcessAreaSearch: {
isInit: false,
processFacilityLabelArray: ProcessFacilityLabelArray,
},
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,
},
}
// 상태 설정 함수 타입 정의
type SetStateFunction = (state: ProcessAreaType | ((state: ProcessAreaType) => ProcessAreaType)) => void;
export type ProcessAreaStore = ProcessAreaType & ProcessAreaActions;
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) => {
set((state: ProcessAreaType) => ({
...state,
ProcessArea: {
...state.ProcessArea,
isLoading: true,
},
}));
const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set);
res.data.forEach((item: ProcessAreaProps) => {
item.fctCpc = item.fcltCpctSum;
DataForm({ type: 'float1', column: 'fctCpc', item: item as unknown as Record<string, unknown> });
})
const excelDownList: ExcelType[] = [];
if (pageSize > 5000) {
res.data.forEach(item => {
item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : '';
excelDownList.push({
시설코드: item.swtrmtFcltCd,
시설명: item.swtrmtFcltNm,
주소: item.location,
"시설옹량(m³/일)": item.fctCpc,
"증설계획기존(m³/일)": item.planSwageQntSumDt4,
"증설계획현재(m³/일)": item.planSwageQntSum,
"증설계획1단계(m³/일)": item.planSwageQntSumDc1,
"증설계획2단계(m³/일)": item.planSwageQntSumDc2,
"증설계획3단계(m³/일)": item.planSwageQntSumDc3,
"증설계획4단계(m³/일)": item.planSwageQntSumDc4,
"처리인구기존(인)": item.swtrmtPpltnCntDt4,
"처리인구현재(인)": item.swtrmtPpltnCnt,
"처리인구1단계(인)": item.swtrmtPpltnCntDc1,
"처리인구2단계(인)": item.swtrmtPpltnCntDc2,
"처리인구3단계(인)": item.swtrmtPpltnCntDc3,
"처리인구4단계(인)": item.swtrmtPpltnCntDc4,
"처리구역기존(km²)": item.swtrmtZoneAreaDt4,
"처리구역현재(km²)": item.swtrmtZoneArea,
"처리구역1단계(km²)": item.swtrmtZoneAreaDc1,
"처리구역2단계(km²)": item.swtrmtZoneAreaDc2,
"처리구역3단계(km²)": item.swtrmtZoneAreaDc3,
"처리구역4단계(km²)": item.swtrmtZoneAreaDc4,
처리구역: item.trtDstr
});
});
} else {
res.data.forEach(item => {
item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : '';
})
}
set((state: ProcessAreaType) => ({
...state,
ProcessArea: pageSize < 5000 ? {
...state.ProcessArea,
processAreaList: res.data,
processAreaCount: res.count,
isLoading: false,
} : {
...state.ProcessArea,
excelList: excelDownList,
isLoading: false,
},
}))
},
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단계';
}
});
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단계';
}
});
// 시설증설 계획 데이터 생성
const fcltyImproveInfo: FcltyImproveInfoProps = {
planSwageQntSumDt4: rtnData.planSwageQntSumDt4,
planSwageQntSum: rtnData.planSwageQntSum,
planSwageQntSumDc1: rtnData.planSwageQntSumDc1,
planSwageQntSumDc2: rtnData.planSwageQntSumDc2,
planSwageQntSumDc3: rtnData.planSwageQntSumDc3,
planSwageQntSumDc4: rtnData.planSwageQntSumDc4
};
// 처리인구 계획 데이터 생성
const processPopulation: ProcessPopulationProps = {
swtrmtPpltnCntDt4: rtnData.swtrmtPpltnCntDt4,
swtrmtPpltnCnt: rtnData.swtrmtPpltnCnt,
swtrmtPpltnCntDc1: rtnData.swtrmtPpltnCntDc1,
swtrmtPpltnCntDc2: rtnData.swtrmtPpltnCntDc2,
swtrmtPpltnCntDc3: rtnData.swtrmtPpltnCntDc3,
swtrmtPpltnCntDc4: rtnData.swtrmtPpltnCntDc4
};
// 처리구역 계획 데이터 생성
const processAreaPlan: ProcessAreaPlanProps = {
swtrmtZoneAreaDt4: rtnData.swtrmtZoneAreaDt4,
swtrmtZoneArea: rtnData.swtrmtZoneArea,
swtrmtZoneAreaDc1: rtnData.swtrmtZoneAreaDc1,
swtrmtZoneAreaDc2: rtnData.swtrmtZoneAreaDc2,
swtrmtZoneAreaDc3: rtnData.swtrmtZoneAreaDc3,
swtrmtZoneAreaDc4: rtnData.swtrmtZoneAreaDc4,
trtDstr: rtnData.trtDstr
};
return {
...state,
ProcessAreaDetail: {
...state.ProcessAreaDetail,
gridListFcltyImproveInfo: [fcltyImproveInfo],
gridListProcessPopulation: [processPopulation],
gridListProcessAreaPlan: [processAreaPlan]
}
};
}
return state;
});
}
}
}