- 하수처리시설 정보에서 디지털 자료관 연계 정보 기능 주석 처리
- 운영정보 검색 시 페이지 리셋 추가
- 하수관로 연계정보에서 사업명 줄바꿈 처리
This commit is contained in:
swcho
2025-07-25 10:06:19 +09:00
parent 0795299b48
commit be47ac0edb
4 changed files with 33 additions and 23 deletions
@@ -21,7 +21,7 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on
<TableHeader>
<TableRow>
<TableHead className="border border-gray-300 px-2 py-2 text-sm w-auto whitespace-nowrap">구분</TableHead>
<TableHead className="border border-gray-300 px-2 py-2 text-sm w-[80px] whitespace-nowrap">년도</TableHead>
<TableHead className="border border-gray-300 px-2 py-2 text-sm w-[80px] whitespace-nowrap">진단연도</TableHead>
<TableHead className="border border-gray-300 px-2 py-2 text-sm w-auto whitespace-nowrap">사업명</TableHead>
<TableHead className="border border-gray-300 px-2 py-2 text-sm w-auto whitespace-nowrap">유형</TableHead>
</TableRow>
@@ -40,7 +40,7 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on
className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal"
/>
</TableCell>
<TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal w-auto whitespace-nowrap">
<TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal w-auto">
{row.bizNm}
</TableCell>
<TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal w-auto whitespace-nowrap">
@@ -22,7 +22,7 @@ type LayerContentMap = {
// 레이어 이름과 컴포넌트를 매핑
// 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업
const layerContentMap: LayerContentMap = {
"하수처리시설": { component: SwtrmtFclt, },
// "하수처리시설": { component: SwtrmtFclt, }, // 디지털 자료관 연계정보가 없으니 일단 주석 처리
"하수처리구역": {},
"우수토실": { component: Ssc, },
"중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정
@@ -122,18 +122,6 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
}
};
// 변환 함수: 객체 → [{ year, type }]
// function convertToYearTypeArray(obj: any): { year: string, type: string }[] {
// if (!obj || typeof obj !== "object") return [];
// // 이미 배열이면 그대로 반환
// if (Array.isArray(obj)) return obj;
// // 객체의 각 key를 type, value를 year로 변환
// return Object.entries(obj).map(([type, year]) => ({
// year: String(year ?? ""),
// type: String(type ?? ""),
// }));
// }
return (
<>
@@ -58,6 +58,12 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [detailTableCount, setDetailTableCount] = useState(0);
const [curPage, setCurPage] = useState(1);
const [detailCurPage, setDetailCurPage] = useState(1);
const [isLoading, setIsLoading] = useState(false);
const [isDetailLoading, setIsDetailLoading] = useState(false);
const [isResetPage, setIsResetPage] = useState<boolean>(false);
const [isResetDetailPage, setIsResetDetailPage] = useState<boolean>(false);
const [isResetSelection, setIsResetSelection] = useState<boolean>(false);
const [isResetDetailSelection, setIsResetDetailSelection] = useState<boolean>(false);
const [detailBizId, setDetailBizId] = useState(0);
const [city, setCity] = useState(0);
const [sgg, setSgg] = useState(0);
@@ -76,10 +82,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
// 로딩바
const [isLoading, setIsLoading] = useState(false);
const [isDetailLoading, setIsDetailLoading] = useState(false);
const sidos = useCityCd();
const siguns = useSggCd();
const reportOriginData = useDcTree(""); //:Folder[]
@@ -161,14 +163,20 @@ const SearchModal: React.FC<SearchModalProps> = ({
// 페이지 변경 시마다 데이터 fetch
useEffect(() => {
setIsResetSelection(true);
setIsResetDetailSelection(true);
// showTable이 true일 때만 fetch (최초 렌더 방지)
if (showTable) handleOperationPageNation(Number(detailBizId));
if (showTable) {
handleOperationPageNation(Number(detailBizId));
}
}, [detailCurPage]);
// 검색 API 호출 함수
const fetchFilteredData = async () => {
setIsLoading(true); // 로딩 시작
setIsResetSelection(true); // 선택 초기화
setIsResetDetailSelection(true); // 선택 초기화
try {
let cqlFilters: string[] = [];
if (activeTab === 'basic') {
@@ -285,6 +293,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
setTableData([]);
} finally {
setIsLoading(false); // 로딩 종료
setIsResetSelection(false);
setIsResetDetailSelection(false);
}
};
@@ -450,6 +460,10 @@ const SearchModal: React.FC<SearchModalProps> = ({
const handleSearch = () => {
setCurPage(1); // 페이지를 1로 초기화
setDetailCurPage(1); // 페이지를 1로 초기화
setIsResetPage(true); // 페이지를 1로 초기화
setIsResetDetailPage(true); // 페이지를 1로 초기화
setIsResetSelection(true); // 선택 초기화
setIsResetDetailSelection(true); // 선택 초기화
fetchFilteredData();
setShowTable(true);
};
@@ -463,6 +477,9 @@ const SearchModal: React.FC<SearchModalProps> = ({
};
// 운영정보 테이블 cellClick 핸들러
const handleOperationCellClick = async (index?: number | undefined, headId?: String) => {
setIsResetDetailPage(true); // 페이지를 1로 초기화
setIsResetDetailSelection(true); // 선택 초기화
if (typeof index === "number") {
setIsDetailLoading(true);
setDetailBizId(tableData[index].bizId);
@@ -494,6 +511,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
console.error('운영정보 cellClick 에러:', error);
} finally {
setIsDetailLoading(false);
setIsResetDetailPage(false);
setIsResetDetailSelection(false);
}
}
};
@@ -649,7 +668,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
total={tableCount}
cellClick={activeTab === 'report' ? handleReportCellClick : handleBasicCellClick}
onPageChange={setCurPage}
resetPageNo={false}
resetPageNo={isResetPage}
resetSelection={isResetSelection}
/>
</div>
</div>
@@ -673,7 +693,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
total={tableCount}
cellClick={handleOperationCellClick}
onPageChange={setCurPage}
resetPageNo={false}
resetPageNo={isResetPage}
resetSelection={isResetSelection}
/>
</div>
</div>
@@ -694,7 +715,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
total={detailTableCount}
cellClick={undefined}
onPageChange={setDetailCurPage}
resetPageNo={false}
resetPageNo={isResetDetailPage}
resetSelection={isResetDetailSelection}
/>
</div>
</div>