- 하수관로, 하수맨홀, 하수펌프장, 우수토실 검색 구현 - UiTable number 값 가운데 정렬 - 일련번호 컬럼 삭제 - 환경청, 시도, 시군구 컬럼 추가 - 관리년도 삭제 - 오수전환율 0~1 사이의 값만 입력 가능하게 수정
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import MsSwagePpl from "../popupComponent/MsSwagePpl";
|
|
import sewagePump from "../popupComponent/sewagePump";
|
|
import smh from "../popupComponent/smh";
|
|
import Ssc from "../popupComponent/Ssc";
|
|
import StormWaterPump from "../popupComponent/stormWaterPump";
|
|
import SwtrmtFclt from "../popupComponent/SwtrmtFclt";
|
|
|
|
type LayerComponentProps = {
|
|
featureData: any;
|
|
chkMainSsc?: boolean;
|
|
additionalData?: any;
|
|
onSaveClick?: () => void;
|
|
};
|
|
type LayerContentMap = {
|
|
[key: string]: {
|
|
component?: React.FC<LayerComponentProps>;
|
|
props?: any;
|
|
};
|
|
};
|
|
// 레이어 이름과 컴포넌트를 매핑
|
|
// 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업
|
|
const layerContentMap: LayerContentMap = {
|
|
"하수처리시설": { component: SwtrmtFclt, },
|
|
"하수처리구역": {},
|
|
"우수토실": { component: Ssc, },
|
|
"중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정
|
|
"하수관로": { component: MsSwagePpl, },
|
|
"하수맨홀": { component: smh, },
|
|
"하수펌프장": { component: sewagePump },
|
|
// "빗물펌프": { component: StormWaterPump },
|
|
// "오수펌프": { component: sewagePump },
|
|
};
|
|
|
|
// 동적 컴포넌트 반환 함수
|
|
export const getLayerContentComponent = (layerNm: string): React.FC<LayerComponentProps> | null => {
|
|
const component = layerContentMap[layerNm];
|
|
if (!component || !component.component) {
|
|
// component가 없으면 null 반환
|
|
return () => null;
|
|
}
|
|
return component.component
|
|
};
|
|
// 사용자 입력 필드 (보수 및 갱신, 청소 및 준설, 점검 및 진단)
|
|
export const handleInputChange = (section: string,
|
|
index: number,
|
|
field: string,
|
|
value: string,
|
|
dataMap: {
|
|
[key: string]: {
|
|
data: { year: string; type: string }[];
|
|
setData: React.Dispatch<React.SetStateAction<{ year: string; type: string }[]>>;
|
|
};
|
|
}
|
|
) => {
|
|
const target = dataMap[section];
|
|
if (!target) return;
|
|
|
|
const updated = [...target.data];
|
|
if (updated[index]) {
|
|
updated[index][field as keyof typeof updated[number]] = value;
|
|
}
|
|
target.setData(updated);
|
|
}; |