Merge branch 'main' into iipbs/dm/dev

This commit is contained in:
ljpark
2025-11-05 21:33:40 +09:00
45 changed files with 374 additions and 233 deletions
+3 -1
View File
@@ -244,7 +244,9 @@ const LinkForm = ({ form, linkSn, updateLinkInfo, handleInsertLink, deleteLink,
</TableCell>
</TableRow>
<TableRow>
<TableHead>연계서버 IP</TableHead>
<TableHead>
{'link0007' === form.watch('link_clsf_cd') as string ? '연계 파일명 구분자' : '연계서버 IP'}
</TableHead>
<TableCell>
<FormField
control={form.control}
+1 -1
View File
@@ -13,7 +13,7 @@ NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:80
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
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_API_URL= http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1
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_NGII_URL = http://172.29.143.87
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}
@@ -367,7 +367,7 @@ export default function WrStatusPage() {
<MainChart
chartForm={chartOption.chartForm}
chartConfig={chartOption.chartConfig}
chartData={chartOption.chartData}
chartData={chartOption.chartData?.filter(item=>item.label!= '')}
chartTitle={chartOption.chartTitle}
chartClassName={chartOption.chartClassName}
graphSize={chartOption.graphSize}
@@ -43,7 +43,7 @@ export const mapService = {
return response.json();
},
getPbnstRuseFclts: async (ruseFcltPk:any) => {
const response = await fetch(`${DEV_URL_WR}/api/v1/reuseFc/pubFc/${ruseFcltPk}`, {
const response = await fetch(`${DEV_URL_WR}/reuseFc/pubFc/${ruseFcltPk}`, {
method: 'GET',
headers: {
'Accept': 'application/json',
@@ -48,7 +48,8 @@ export default function ProcessFacilitySearch() {
} = FacilityWaterQltyMain;
const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || [];
const [initTrigger, setInitTrigger] = useState<boolean>(false);
const [excelTrigger, setExcelTrigger] = useState<boolean>(false);
// 그리드 관련
const [resetPage, setResetPage] = useState<boolean>(false);
const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null);
@@ -77,16 +78,15 @@ export default function ProcessFacilitySearch() {
partStr = partValue
break;
default:
if(sidoValue !== '0') nameCd = sidoValue;
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.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} else {
if(partStr ==='G'){
searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue);
}else{
searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
}
}, [operationValue, fcltyName, searchFacilityWaterQltyList, searchYearValue, fcltCpct]);
@@ -105,7 +105,8 @@ export default function ProcessFacilitySearch() {
input.value = "";
}
}
searchFacilityWaterQltyList(1, 10, selectSearchYear[0]?.val || "0");
ref.current.sidoValue = "11";
searchFcltyQltyList(ref.current, 1, 10);
}
// 셀 클릭 시 모달 표시
@@ -125,7 +126,7 @@ export default function ProcessFacilitySearch() {
}
const ref = useRef<ReturnType>({
partValue: '',
sidoValue: '',
sidoValue: '11',
sigunValue: '',
regionValue: '',
unitWaterShedValue: '',
@@ -137,12 +138,17 @@ export default function ProcessFacilitySearch() {
useEffect(() => {
if (!isInit) {
initializeCommonData();
searchFacilityWaterQltyList(1, 10, selectSearchYear[0]?.val || "0");
if(!initTrigger){
initializeCommonData();
searchFcltyQltyList(ref.current, 1, 10);
setInitTrigger(true);
}
}
}, [isInit, initializeCommonData, searchFacilityWaterQltyList, selectSearchYear]);
}, [isInit, initializeCommonData, searchFacilityWaterQltyList, searchFcltyQltyList, initTrigger]);
useEffect(() => {
if(!excelTrigger) return;
if (excelList && excelList.length > 0) {
downloadExcelFormat(
{
@@ -154,15 +160,8 @@ export default function ProcessFacilitySearch() {
decimalArray3:[13,14,18,19]
}
);
/* downloadExcel({
data: excelList as unknown as JSON[],
fileName: '시설별 수질현황',
sheetNameArray: ['시설별 수질현황'],
headerRange: 'A1:T1'
}); */
}
}, [excelList]);
}, [excelList, excelTrigger]);
const chkVal = useCallback((returntype:ReturnType) => {
setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]")
@@ -171,6 +170,7 @@ export default function ProcessFacilitySearch() {
}, [upHeadList1, upHeadList2, upHeadList3]);
const excelDownload = useCallback(() => {
setExcelTrigger(true);
searchFcltyQltyList(ref.current, 1, 10000);
}, [searchFcltyQltyList]);
@@ -202,12 +202,12 @@ export default function ProcessFacilitySearch() {
queryClick={chkVal}
excelClick={excelDownload}
initClick={resetVal}
ref={ref} isAdmin={false} />
ref={ref} isAdmin={false} initSidoValue={"11"}/>
<ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll">
<div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 수질현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total<10?facilityWaterQltyList.length:total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} />
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 수질현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} />
</div>
</div>
</ListDiv>
@@ -25,6 +25,8 @@ const tabList = [
{ value: 'tab_term_rain', label: '강우시' }
];
const commentArray = "[미처리하수 추정량 산식 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)]";
export default function FlowRateModal(props: { fcltyName: string; facilityCd: string; searchYear: string }) {
// 그리드 관련
const { Common, FlowRateModal, searchFlowRateModalList } = useFoStore((state) => state);
@@ -192,12 +194,13 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
"연계처리량(m³/일)": CommaToNumber(item.sumFlow),
"총인반류수량(m³/일)": CommaToNumber(item.returnAmnt),
"방류량(m³/일)": CommaToNumber(item.efflAmnt),
/* "강우량(mm/일)": item.infoRnDay, */
"미처리하수 추정량(m³/일)": CommaToNumber(item.noProcessInflAmnt),
"강우량(mm/일)": CommaToNumber(item.infoRnDay),
});
});
}
if (excelDownList && excelDownList.length > 0) {
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 유량현황', sheetNameArray: [props.fcltyName + ' 유량현황'], headerRange: 'A1:G1' });
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 유량현황', sheetNameArray: [props.fcltyName + ' 유량현황'], headerRange: 'A1:H1' });
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.');
}
@@ -233,6 +236,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
boldArray={[0,1,2]}
/>
</div>
<div className="mt-20">
<UnderComment commentArray={[commentArray]} />
</div>
</TabsContent>
<TabsContent value="tab_term_summer">
<FacilityTermModalHeader<FlowRateModalInterface>
@@ -257,6 +263,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
boldArray={[0,1,2]}
/>
</div>
<div className="mt-20">
<UnderComment commentArray={[commentArray]} />
</div>
</TabsContent>
<TabsContent value="tab_term_winter">
<FacilityTermModalHeader<FlowRateModalInterface>
@@ -281,6 +290,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
boldArray={[0,1,2]}
/>
</div>
<div className="mt-20">
<UnderComment commentArray={[commentArray]} />
</div>
</TabsContent>
<TabsContent value="tab_term_chuncheon">
<FacilityTermModalHeader<FlowRateModalInterface>
@@ -305,6 +317,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
boldArray={[0,1,2]}
/>
</div>
<div className="mt-20">
<UnderComment commentArray={[commentArray]} />
</div>
</TabsContent>
<TabsContent value="tab_term_rain">
<FacilityTermModalHeader<FlowRateModalInterface>
@@ -319,7 +334,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
<div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable headName="유량현황" tableData={copyYearList} headlist={upHeadListFlowRateModalYear} pageSize={0} total={0} cellClick={undefined} onPageChange={() => {}} className="h-[370px]" boldArray={[0,1,2]}/>
</div>
<UnderComment commentArray={["강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날"]} />
<div className="mt-20">
<UnderComment commentArray={["미처리하수 추정량 산식 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)","강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날"]} />
</div>
</TabsContent>
</UITab>
</>
@@ -67,9 +67,12 @@ export default function ProcessFacilitySearch() {
const [selectedRow, setSelectedRow] = useState<number | null>(null);
const [fcltyNm, setFcltyNm] = useState<string>("");
const [fcltyCd, setFcltyCd] = useState<string>("");
const [excelTrigger, setExcelTrigger] = useState<boolean>(false);
const [initTrigger, setInitTrigger] = useState<boolean>(false);
const searchFlowRate = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
let nameCd, partStr
let nameCd, partStr;
switch (partValue) {
case 'R':
if (regionValue !== '0') {
@@ -77,20 +80,20 @@ export default function ProcessFacilitySearch() {
else if (middleRegionValue==='0') nameCd = unitWaterShedValue;
else nameCd = middleRegionValue;
}
partStr = partValue
partStr = partValue;
break;
default:
if(sidoValue !== '0') nameCd = sidoValue;
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.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchFlowRateList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} else {
if(partStr==='G'){
searchFlowRateList(pageNo, pageCnt, searchYearValue);
}else{
searchFlowRateList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
}
}, [operationValue, fcltyName, searchFlowRateList, searchYearValue, fcltCpct]);
}, [searchFlowRateList, searchYearValue, fcltCpct, operationValue, fcltyName]);
const resetVal = () => {
setWidthSize("w-[120%]");
@@ -107,7 +110,8 @@ export default function ProcessFacilitySearch() {
input.value = "";
}
}
searchFlowRateList(1, 10, selectSearchYear[0]?.val || "0");
ref.current.sidoValue = '11';
searchFlowRate(ref.current,1, 10);
}
// 셀 클릭 시 모달 표시
@@ -133,23 +137,29 @@ export default function ProcessFacilitySearch() {
// 시도 데이터 초기화
useEffect(() => {
if(!isInit) {
initializeCommonData();
searchFlowRateList(1, 10, selectSearchYear[0]?.val || "0");
if(!initTrigger){
initializeCommonData();
searchFlowRate(ref.current, 1, 10);
setInitTrigger(true);
}
//searchFlowRateList(1, 10, selectSearchYear[0]?.val || "0");
}
}, [isInit, initializeCommonData, searchFlowRateList, selectSearchYear]);
}, [isInit, initializeCommonData, searchFlowRateList, selectSearchYear, searchFlowRate, initTrigger]);
useEffect(() => {
if(!excelTrigger) return;
if (excelList && excelList.length > 0) {
downloadExcelFormat({ data: JSON.parse(JSON.stringify(excelList)), fileName: '시설별 유량현황', sheetNameArray: ['시설별 유량현황'], headerRange: 'A1:O1', decimalArray0: [9,10,11,12,13,14] });
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.');
}
prevExcelListRef.current = excelList;
}, [excelList]);
}, [excelList, excelTrigger]);
const ref = useRef<ReturnType>({
partValue: '',
sidoValue: '',
sidoValue: '11',
sigunValue: '',
regionValue: '',
unitWaterShedValue: '',
@@ -167,10 +177,10 @@ export default function ProcessFacilitySearch() {
const excelDownload = useCallback(() => {
searchFlowRate(ref.current, 1, 10000);
setExcelTrigger(true);
}, [searchFlowRate]);
const total = flowRateCount;
return (
<MainDiv>
<Title title="시설별 유량현황" />
@@ -193,7 +203,7 @@ export default function ProcessFacilitySearch() {
queryClick={chkVal}
excelClick={excelDownload}
initClick={resetVal}
ref={ref} isAdmin={false}/>
ref={ref} isAdmin={false} initSidoValue={'11'}/>
<ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll">
@@ -57,7 +57,7 @@ export default function PlanSewage() {
const ref = useRef<ReturnType>({
partValue: '',
sidoValue: '',
sidoValue: '11',
sigunValue: '',
regionValue: '',
unitWaterShedValue: '',
@@ -86,7 +86,10 @@ export default function PlanSewage() {
const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [initTrigger, setInitTrigger] = useState<boolean>(false);
const [excelTrigger, setExcelTrigger] = useState<boolean>(false);
/**
* 페이지 함수
*/
@@ -106,20 +109,13 @@ export default function PlanSewage() {
input.value = "";
}
}
searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
ref.current.sidoValue='11';
searchPlanSewage(ref.current, 1, 10);
}
/**
* useEffect
*/
useEffect(() => {
if (!isInit) {
initializeCommonData();
searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
}
}, [isInit, initializeCommonData, searchPlanSewageList, selectSearchYear]);
if(!excelTrigger) return;
useEffect(() => {
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
@@ -128,7 +124,7 @@ export default function PlanSewage() {
headerRange: 'A1:M1'
});
}
}, [excelList]);
}, [excelList, excelTrigger]);
/**
* 콜백함수
@@ -146,20 +142,34 @@ export default function PlanSewage() {
partStr = partValue
break;
default:
if(sidoValue !== '0') nameCd = sidoValue;
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.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchPlanSewageList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} else {
// G로 넘기면 데이터가 안떠서 환경청 전체로 넘기면 전체를 추출하기위해서...
if(partStr === 'G'){
partValue = partValue==='G'?'A':partValue;
searchPlanSewageList(pageNo, pageCnt, searchYear, partValue);
}
else{
searchPlanSewageList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
}
}, [operationValue, fcltyName, searchPlanSewageList, searchYear, fcltCpct]);
/**
* useEffect
*/
useEffect(() => {
if (!isInit) {
if(!initTrigger){
initializeCommonData();
searchPlanSewage(ref.current, 1, 10);
setInitTrigger(true);
}
}
}, [isInit, initializeCommonData, searchPlanSewageList, selectSearchYear, initTrigger, searchPlanSewage]);
const chkVal = useCallback((returntype:ReturnType) => {
setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]")
setUpheadList(returntype.partValue == 'R' ? upHeadList2 : returntype.partValue == 'G'?upHeadList3:upHeadList1);
@@ -169,6 +179,7 @@ export default function PlanSewage() {
// 엑셀다운로드
const excelDownload = useCallback((searchReturn: ReturnType) => {
searchPlanSewage(searchReturn, 1, 10000);
setExcelTrigger(true);
}, [searchPlanSewage]);
// 페이지 변경
@@ -201,7 +212,7 @@ export default function PlanSewage() {
queryClick={chkVal}
excelClick={excelDownload}
initClick={resetVal}
ref={ref} isAdmin={false}/>
ref={ref} isAdmin={false} initSidoValue={"11"}/>
<ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll">
@@ -71,7 +71,7 @@ export default function ProcessArea() {
middleRegionValue: '',
envPartValue: '',
sidoText: '',
sigunText: ''
sigunText: '',
});
const searchProcessArea = useCallback(({ sidoText, sigunText}: ReturnType, pageNo: number, pageCnt:number=20) => {
+23 -15
View File
@@ -14,6 +14,7 @@ import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UnderComment from "@/app/components/common/UnderComment";
const commentArray = [
"적정판단근거 = 하절기(6~8)월 강우일 중 BOD수질이 최저인 일자의 RDII추정량을 기준으로 판단",
"강우시 총 추정유입량 = 청천시 유입하수량 + RDII 추정값",
"주) 처리장 유입부에서 측정된 유량 및 수질조사 자료를 기준으로 산정된 결과임"
]
@@ -86,6 +87,7 @@ export default function Rdi() {
// 엑셀 다운로드 트리거
const [isInitExcelDownload, setIsInitExcelDownload] = useState<boolean>(false);
const [initTrigger, setInitTrigger] = useState<boolean>(false);
/**
* 페이지 함수
*/
@@ -106,19 +108,10 @@ export default function Rdi() {
input.value = "";
}
}
searchRdiList(1, 10, selectSearchYear[0]?.val || "0");
ref.current.sidoValue = "11";
searchRdi(ref.current, 1, 10);
}
/**
* useEffect
*/
useEffect(() => {
if (!isInit) {
initializeCommonData();
searchRdiList(1, 10, selectSearchYear[0]?.val || "0");
}
}, [isInit, initializeCommonData, searchRdiList, selectSearchYear]);
useEffect(() => {
if(!isInitExcelDownload) return ;
if (excelList && excelList.length > 0) {
@@ -152,13 +145,28 @@ export default function Rdi() {
partStr = envPartValue !== '0' ? envPartValue:partValue;
break;
}
if (partStr.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchRdiList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} else {
if(partStr === 'G'){
searchRdiList(pageNo, pageCnt, searchYear);
}else{
searchRdiList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
}
}, [operationValue, fcltyName, searchRdiList, searchYear, fcltCpct]);
/**
* useEffect
*/
useEffect(() => {
if (!isInit) {
if(!initTrigger){
initializeCommonData();
searchRdi(ref.current, 1, 10);
setInitTrigger(true);
}
}
}, [isInit, initializeCommonData, searchRdiList, selectSearchYear, searchRdi, initTrigger]);
const chkVal = useCallback((returntype:ReturnType) => {
setWidthSize(returntype.partValue=='A' ?"w-[130%]":"w-[150%]")
setUpheadList(returntype.partValue == 'R' ? upHeadList2 : returntype.partValue == 'G'?upHeadList3:upHeadList1);
@@ -202,7 +210,7 @@ export default function Rdi() {
queryClick={chkVal}
excelClick={excelDownload}
initClick={resetVal}
ref={ref} isAdmin={false} />
ref={ref} isAdmin={false} initSidoValue={"11"}/>
<ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll">
@@ -15,6 +15,12 @@ import { useCallback, useEffect, useRef, useState } from "react";
import UnderWaterInputModal from "./modal/page";
import type { UnderWaterProps } from "@/app/store/underWaterInput/types";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UnderComment from "@/app/components/common/UnderComment";
const commentArray = [
"적정여부(=연간 지하수유입량/연평균 유입하수량*100)가 20%이하면 “적정”으로 표출, 그 이상은 “초과유입”으로 표출",
"지하수 유입량 = 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)"
]
export default function UnderWaterInput() {
const {Common
@@ -238,9 +244,8 @@ export default function UnderWaterInput() {
<div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true}/>
</div>
<UnderComment commentArray={commentArray} />
</div>
<span className="text-2xl text-gray-500">※적정여부 = 연간 지하수유입량/연평균 유입하수량*100 </span><br></br>
<span className="text-2xl text-gray-500">※지하수 유입량 = 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)</span>
</ListDiv>
</ContentsDiv>
{selectedRow !== null && (
+3 -3
View File
@@ -59,7 +59,8 @@ export type modalExcelType = {
"연계처리량(m³/일)": number | '',
"총인반류수량(m³/일)": number | '',
"방류량(m³/일)": number | '',
/* "강우량(mm/일)": number | string | '', */
"미처리하수 추정량(m³/일)": number | '',
"강우량(mm/일)": number | string | '',
}
/**
* (2) 모달
@@ -159,7 +160,7 @@ const upHeadListFlowRateModal:TableUpperProps[] = [
{ id: "sumFlow", title: "연계처리량(m³/일)", align:"right"},
{ id: "returnAmnt", title: "총인 반류수량(m³/일)", align:"right"},
{ id: "efflAmnt", title: "방류량(m³/일)", align:"right"},
{ id: "noProcessInflAmnt", title: "미처리하수량(m³/일)", align:"right"},
{ id: "noProcessInflAmnt", title: "미처리하수 추정량(m³/일)", align:"right"},
{ id: "infoRnDay", title: "강우량(mm/일)", align:"right"}
]
@@ -173,7 +174,6 @@ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: s
try {
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
console.log(url);
const res = await getFetch('fo', url);
return { data: res.data, count: res.count }
} catch (error) {
-1
View File
@@ -96,7 +96,6 @@ const planSewageList:PlanSewageProps[] = [
const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
const tailStr = partCd ? '/'+ partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') +'/0'+ (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/prcsFclt/info/plan/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
console.log(url);
const res = await getFetch('fo', url);
return { data: res.data, count: res.count }
}
+34 -16
View File
@@ -13,11 +13,12 @@ export type { TableUpperProps };
// 처리구역 리스트
export type ProcessAreaProps = {
swtrmtFcltCd : string,
sido : string,
gugun : string,
ctpvNm?: string,
sggNm?: string,
swtrmtFcltNm : string,
location : string,
fctCpc : number | '',
fcltCpctSum : number | '',
ruse : boolean,
planYrDt4 : string,
planYr : string,
@@ -129,8 +130,8 @@ const ProcessFacilityLabelArray:string[] = ['구분', '시도', '시군구','용
// 리스트 헤더(행정별)
const upHeadList1:TableUpperProps[] = [
{ id: "A", title: "행정구역", colSpan:2, rowSpan:2, row:0 },
{ id: "sido", title: "시도", upName:"upChangeRe", row:2, widthPercent:4 },
{ id: "sigungo", title: "시군구", upName:"upChangeRe", row:2, widthPercent:4 },
{ 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: 8 },
{ id: "location", title: "주소", rowSpan:3, row:0 },
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", rowSpan:3, row:0, widthPercent: 5 },
@@ -215,7 +216,7 @@ const gridListProcessAreaPlan:ProcessAreaPlanProps[] = [
* Store - API
=====================================*/
// 시설 상세 정보 조회 API
const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => {
/* const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => {
try {
const tailUrl = '/1/5/A/0/0/0/SW';
const res = await postFetch('fo', '/prcsFclt/ruseInfo'+tailUrl, [swtrmtFcltCd]);
@@ -224,10 +225,20 @@ const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => {
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:ProcessAreaProps[], count:number}> => {
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){
@@ -261,21 +272,27 @@ const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm :
head.title = '기승인\n4단계';
}
});
const res = await fetchFacilityDetailInfo(item.swtrmtFcltCd);
const detailInfo = res.data.filter((item:ProcessAreaProps) => item.ruse === true);
return {
...item,
sido: detailInfo.length > 0 ? detailInfo[0].sido||'' : '',
sigungo: detailInfo.length > 0 ? detailInfo[0].gugun||'' : '',
location: detailInfo.length > 0 ? detailInfo[0].addr||'' : '',
fctCpc: detailInfo.length > 0 ? detailInfo[0].fctCpc||'' : 0,
trtDstr: detailInfo.length > 0 ? detailInfo[0].trtDstr||'' : '',
};
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 : '';
});
return {data: paginatedData, count: enrichedData.length};
}else{
return {data: [], count: 0};
@@ -375,6 +392,7 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
}));
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[] = [];
@@ -431,7 +431,6 @@ export const fetchFacilityListInit = async (pageNo:number, pageSize:number, part
}
};
const fetchFacilityList = async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string ): Promise<{data:facilityListProps[], count:number}> => {
try {
const tailStr = partValue ? '/'+ (partValue==='G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : '';
@@ -1,8 +1,8 @@
/**
* ➡️ 경로 : 하수관망도 메인 페이지 (오른쪽 돋보기 모양 클릭) - 검색 모달 창 내 운영정보 탭
* ➡️ 경로 : 하수관망도 메인 페이지 (오른쪽 돋보기 모양 클릭) - 검색 모달 창 내 유지관리 정보 탭
*
* 📄 Operation Tab
* Next.js App Router (app/) 기반 검색 모달 운영정보 탭 컴포넌트
* Next.js App Router (app/) 기반 검색 모달 유지관리 정보 탭 컴포넌트
*
* - 업무구분 선택 (보수 및 갱신, 점검 및 진단, 청소 및 준설)
* - 사업명 입력 및 수행기간 범위 선택
@@ -4,9 +4,9 @@
* 📄 Search Modal
* Next.js App Router (app/) 기반 검색 모달 컴포넌트
*
* - 탭 기반 검색 인터페이스 (기본정보, 운영정보, 보고서)
* - 탭 기반 검색 인터페이스 (기본정보, 유지관리 정보, 보고서)
* - 테이블 데이터 표시 및 페이지네이션 기능
* - 시설물 조회 결과 및 운영 사업 현황 표시
* - 시설물 조회 결과 및 유지관리 사업 현황 표시
* - 엑셀 다운로드 및 지도에서 보기 기능
* - Zustand를 통한 검색 모달 상태 관리
* - 로딩 오버레이 및 선택 초기화 지원
@@ -72,7 +72,7 @@ const SearchModal: React.FC = () => {
return [];
}
if (activeTab === 'operation') return OPERATION_TABLE_HEADLIST; // 운영정보
if (activeTab === 'operation') return OPERATION_TABLE_HEADLIST; // 유지관리 정보
return [];
}, [activeTab, basicType, workType]);
@@ -118,7 +118,7 @@ const SearchModal: React.FC = () => {
onValueChange={(value: string) => setActiveTab(value)}
/>
{activeTab === 'basic' && (<BasicTab />)} {/* 기본정보 탭 */}
{activeTab === 'operation' && (<OperationTab />)} {/* 운영정보 탭 */}
{activeTab === 'operation' && (<OperationTab />)} {/* 유지관리 정보 탭 */}
{activeTab === 'report' && (<ReportTab open={isSearchModalOpen} />)} {/* 하수도정비기본계획보고서 탭 */}
@@ -153,7 +153,7 @@ const SearchModal: React.FC = () => {
</div>
</div>
)}
{/* 운영정보 탭 */}
{/* 유지관리 정보 탭 */}
{activeTab === 'operation' && (
<>
<div className="h-[39vh] w-full overflow-hidden rounded-lg border">
@@ -1,6 +1,6 @@
/**
* 📄 useOperationTab Hook
* 검색 모달 운영정보 탭 훅
* 검색 모달 유지관리 정보 탭 훅
*
* - 필터링된 사업 현황 데이터 조회 및 포맷팅
* - 사업 현황 테이블 셀 클릭 시 상세 결과표 조회
@@ -11,8 +11,8 @@
* - 데이터 매핑 및 코드 변환 (사업 유형, 용도, 재질 등)
*
* 🔗 사용 API
* - 운영정보 목록 조회: GET /api/v1/bizInfo (sewerage-service)
* - 운영정보(사업정보) 관련 시설 목록 조회: GET /api/v1/bizInfo/fclts (sewerage-service)
* - 유지관리 정보 목록 조회: GET /api/v1/bizInfo (sewerage-service)
* - 유지관리 정보(사업정보) 관련 시설 목록 조회: GET /api/v1/bizInfo/fclts (sewerage-service)
*/
import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui';
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES } from '../components/common/table';
@@ -48,12 +48,12 @@ export default function useOperationTab() {
} = useSearchModalStore();
const { BIZ_TY_CD } = useStore();
const WORK_TYPES = [ // 운영정보 '구분' 선택 목록
const WORK_TYPES = [ // 유지관리 정보 '구분' 선택 목록
{ val: "['200', '201', '204']", text: "보수 및 갱신" },
{ val: "['100']", text: "점검 및 진단" },
{ val: "['203']", text: "청소 및 준설" },
];
const OPERATION_TABLE_HEADLIST = [ // 운영정보 - 사업 현황
const OPERATION_TABLE_HEADLIST = [ // 유지관리 정보 - 사업 현황
{ id: 'rowNumber', title: '일련번호' },
{ id: "bizInfoNm", title: "사업명" },
{ id: "flfmtBgngYmd", title: "수행시작일자" },
@@ -62,7 +62,7 @@ export default function useOperationTab() {
{ id: "bizTypeCd", title: "사업유형" },
{ id: "bizAmt", title: "사업금액" },
];
const MAINTENANACE_TABLE_HEADLIST = [ // 운영정보 - 보수 및 갱신 결과표
const MAINTENANACE_TABLE_HEADLIST = [ // 유지관리 정보 - 보수 및 갱신 결과표
{ id: 'rowNumber', title: '일련번호' },
{ id: "fcltMngNo", title: "관리번호" },
{ id: "swtrmt_zone_nm", title: "처리구역" },
@@ -75,7 +75,7 @@ export default function useOperationTab() {
{ id: "instlYmd", title: "설치일자" },
// { id: "instlYmd", title: "사업구분" },
];
const CLEANING_TABLE_HEADLIST = [ // 운영정보 - 청소 및 준설 결과표
const CLEANING_TABLE_HEADLIST = [ // 유지관리 정보 - 청소 및 준설 결과표
{ id: 'rowNumber', title: '일련번호' },
{ id: "fcltMngNo", title: "관리번호" },
{ id: "swtrmt_zone_nm", title: "처리구역" },
@@ -87,7 +87,7 @@ export default function useOperationTab() {
{ id: "prlgVl", title: "연장(m)" },
{ id: "instlYmd", title: "설치일자" },
];
const INSPECTION_TABLE_HEADLIST = [ // 운영정보 - 점검 및 진단 결과표
const INSPECTION_TABLE_HEADLIST = [ // 유지관리 정보 - 점검 및 진단 결과표
{ id: 'rowNumber', title: '일련번호' },
{ id: "fcltMngNo", title: "관리번호" },
{ id: "swtrmt_zone_nm", title: "처리구역" },
@@ -150,7 +150,7 @@ export default function useOperationTab() {
setDetailTableCount(0);
};
// 운영정보 테이블 cellClick 핸들러
// 유지관리 정보 테이블 cellClick 핸들러
const handleOperationCellClick = async (index?: number | undefined, headId?: String) => {
setIsResetDetailPage(true); // 페이지를 1로 초기화
setIsResetDetailSelection(true); // 선택 초기화
@@ -188,7 +188,7 @@ export default function useOperationTab() {
setDetailTableData(mappedData);
setDetailTableCount(res.count || 0);
} catch (error) {
console.error('운영정보 cellClick 에러:', error);
console.error('유지관리 정보 cellClick 에러:', error);
} finally {
setIsDetailLoading(false);
setIsResetDetailPage(false);
@@ -197,7 +197,7 @@ export default function useOperationTab() {
}
};
// 운영정보 디테일 테이블 cellClick 핸들러
// 유지관리 정보 디테일 테이블 cellClick 핸들러
const handleOperationResultCellClick = async (index?: number | undefined, headId?: String) => {
if (typeof index === "number") {
setIsLoading(true);
@@ -212,7 +212,7 @@ export default function useOperationTab() {
}
};
// 운영정보 디테일 테이블 페이지네이션 핸들러
// 유지관리 정보 디테일 테이블 페이지네이션 핸들러
const handleOperationPageNation = async (index?: number | undefined) => {
if (typeof index === "number") {
setIsDetailLoading(true);
@@ -241,14 +241,14 @@ export default function useOperationTab() {
setDetailTableData(mappedData);
setDetailTableCount(res.count || 0);
} catch (error) {
console.error('운영정보 페이지네이션 에러:', error);
console.error('유지관리 정보 페이지네이션 에러:', error);
} finally {
setIsDetailLoading(false);
}
}
};
// 운영정보 Excel 다운로드 핸들러 추가
// 유지관리 정보 Excel 다운로드 핸들러 추가
const operationExcelDownload = async () => {
if (tableData.length === 0) {
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
@@ -342,7 +342,7 @@ export default function useOperationTab() {
}
};
// 운영정보 결과표 Excel 다운로드 핸들러 추가
// 유지관리 정보 결과표 Excel 다운로드 핸들러 추가
const operationResultExcelDownload = async () => {
if (detailTableData.length === 0) {
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
@@ -2,7 +2,7 @@
* 📄 useSearchModal Hook
* 검색 모달 훅
*
* - 탭 기반 검색 인터페이스 관리 (기본정보, 운영정보, 보고서)
* - 탭 기반 검색 인터페이스 관리 (기본정보, 유지관리 정보, 보고서)
* - 필터링된 데이터 조회 및 포맷팅
* - 조회 버튼을 통한 데이터 검색 트리거
* - 여러 시설 보기 기능
@@ -10,7 +10,7 @@
* - 데이터 매핑 및 코드 변환 (사업 유형 등)
*
* 🔗 사용 API
* - 운영정보 목록 조회: GET /api/v1/bizInfo (sewerage-service)
* - 유지관리 정보 목록 조회: GET /api/v1/bizInfo (sewerage-service)
*/
import { getData } from "@/components/lib/api";
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
@@ -44,7 +44,7 @@ export default function useSearchModal() {
const TABS = [
{ val: "basic", text: "기본정보" },
{ val: "operation", text: "운영정보" },
{ val: "operation", text: "유지관리 정보" },
{ val: "report", text: "하수도정비기본계획보고서" },
];
@@ -18,7 +18,7 @@
* - RDII분석 삭제: DELETE /api/v1/rdiiAnls/{rainInfwtAnlsSn} (sewerage-service)
*/
'use client'
import { deleteData, getData, useCookieAuth } from '@/components/lib/api'
import { deleteData, getData } from '@/components/lib/api'
import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui'
import { zodResolver } from '@hookform/resolvers/zod'
import { useState, useEffect } from 'react'
@@ -66,7 +66,7 @@ const tableColumn = [
]
const Result = () => {
const AUTH = useCookieAuth();
//const AUTH = useCookieAuth();
const form = useForm<ResultFormValues>({
resolver: zodResolver(formSchema),
@@ -133,7 +133,7 @@ const Result = () => {
ctpvCd: ctpvCd !== '0' ? ctpvCd.trim() : null,
sggCd: sggCd !== '0' ? sggCd : null,
swtrmtFcltNm: formValues.swtrmtFcltNm?.trim() ? formValues.swtrmtFcltNm : null,
auth: AUTH,
//auth: AUTH,
};
const queryParams = new URLSearchParams({
@@ -18,7 +18,7 @@
* - 침입수분석 삭제: DELETE /api/v1/inftwtAnls/{inftwtAnlsSn} (sewerage-service)
*/
'use client'
import { deleteData, getData, useCookieAuth } from '@/components/lib/api'
import { deleteData, getData } from '@/components/lib/api'
import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui'
import { zodResolver } from '@hookform/resolvers/zod'
import { useState, useEffect } from 'react'
@@ -63,7 +63,7 @@ const tableColumn = [
]
const Result = () => {
const AUTH = useCookieAuth();
//const AUTH = useCookieAuth();
const form = useForm<ResultFormValues>({
resolver: zodResolver(formSchema),
@@ -127,7 +127,7 @@ const Result = () => {
"ctpvCd": ctpvCd === '0' ? null : ctpvCd.trim(),
"sggCd": sggCd === '0' ? null : sggCd,
"swtrmtFcltNm": formValues.swtrmtFcltNm?.trim() ? formValues.swtrmtFcltNm : null,
"auth": AUTH,
//"auth": AUTH,
};
const queryParams = new URLSearchParams({
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* ➡️ 경로 : I/I분석, 운영정보 모든 페이지
* ➡️ 경로 : I/I분석, 유지관리 정보 모든 페이지
*
* 📄 With Base Layout
* Next.js App Router (app/) 기반 분석 페이지 기본 레이아웃 컴포넌트
@@ -1,5 +1,5 @@
/**
* ➡️ 경로 : 운영정보 - 도시침수예방사업
* ➡️ 경로 : 유지관리 정보 - 도시침수예방사업
*
* 📄 FloodPre Page
* 침수예방 사업 정보 등록 및 조회 페이지 컴포넌트
@@ -1,5 +1,5 @@
/**
* ➡️ 경로 : 운영정보 - 노후 하수관로 정비사업
* ➡️ 경로 : 유지관리 정보 - 노후 하수관로 정비사업
*
* 📄 OldPp Page
* 노후 하수관로 정비사업 추진현황 페이지 컴포넌트
+1 -1
View File
@@ -3,7 +3,7 @@
* 검색 모달 Zustand 스토어
*
* - 검색 모달 열기/닫기 및 탭 전환 상태 관리
* - 기본정보 및 운영정보 탭 데이터 필터링 및 조회
* - 기본정보 및 유지관리 정보 탭 데이터 필터링 및 조회
* - 테이블 데이터 및 페이지네이션 상태 관리
* - 지역(시도/시군구) 및 날짜 범위 필터링 기능
* - 로딩 상태 및 리셋 플래그 관리
@@ -66,6 +66,8 @@ export default function Home() {
return {
...item,
archArea: archArea,
cityText: item.ctpvCd === 0 ? "세종특별자치시" : (item as any).cityText,
sggText: (item as any).sggText === "없음" ? "-" : (item as any).sggText,
};
}
);
@@ -78,10 +78,12 @@ export default function Home() {
archArea: formatArchArea(item?.archArea, 1),
bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N",
frstArchPrmsnDt: item?.frstArchPrmsnDt || "확인불가",
cityText: item.ctpvCd === 0 ? "세종특별자치시" : (item as any).cityText,
sggText: (item as any).sggText === "없음" ? "-" : (item as any).sggText,
};
}
);
console.log("rainData", rainData);
setbdstTable(rainData);
} else {
setbdstTable([]);
@@ -80,6 +80,8 @@ export default function Home() {
archArea: archArea,
bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N",
bdstUsgCd: item.reuseBuilding[0]?.bdstUsgCd,
cityText: item.ctpvCd === 0 ? "세종특별자치시" : (item as any).cityText,
sggText: (item as any).sggText === "없음" ? "-" : (item as any).sggText,
};
}
);
@@ -209,8 +209,9 @@ export default function PrfmncPrfmncReg() {
useEffect(() => {
const year = new Date().getFullYear();
if(laeSeCd === undefined || laeSeCd ==='') return;
prfmncHasuInit(1, laeSeCd, String(year), prfPbnFclts);
}, [prfPbnFclts]);
}, [prfPbnFclts,laeSeCd]);
useEffect(() => {
if (prfmncRes && prfmncRes.length > 0) {
@@ -1,12 +1,9 @@
"use client";
import { useWrStore } from "@/app/store";
import { commonCd, rainPageSize } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import { rainPageSize } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import { rswtPageSize } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
import {
excelDownload,
yearOptions
} from "@/components/lib/func/commom";
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable";
import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable";
@@ -18,7 +15,7 @@ import {
SearchInput,
SelectBox,
Title,
UiModal
UiModal,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, Label } from "@common/components/ui";
@@ -28,6 +25,7 @@ import { useTranslation } from "react-i18next";
export default function Page() {
const {
auth,
rainChkSttn,
rswtChkSttn,
rainChkSttnInit,
@@ -41,6 +39,7 @@ export default function Page() {
return state;
});
const { laeSeCd } = auth;
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
const [rainPageNation, setRainPageNation] = useState(1);
const [rswtPageNation, setRswtPageNation] = useState(1);
@@ -49,7 +48,9 @@ export default function Page() {
open: false,
data: {},
});
const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear()));
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
const cellClick = () => {
if (searchYear) {
if (selFcltDiv === "RNB") {
@@ -58,11 +59,11 @@ export default function Page() {
rainPageNation,
rainPageSize,
searchYear,
commonCd,
laeSeCd,
fcltNm
);
} else {
rainChkSttnInit(rainPageNation, rainPageSize, searchYear, commonCd);
rainChkSttnInit(rainPageNation, rainPageSize, searchYear, laeSeCd);
}
} else {
if (fcltNm) {
@@ -70,11 +71,11 @@ export default function Page() {
rswtPageNation,
rswtPageSize,
searchYear,
commonCd,
laeSeCd,
fcltNm
);
} else {
rswtChkSttnInit(rswtPageNation, rswtPageSize, searchYear, commonCd);
rswtChkSttnInit(rswtPageNation, rswtPageSize, searchYear, laeSeCd);
}
}
}
@@ -84,15 +85,9 @@ export default function Page() {
if (pageNo > 0) {
setRainPageNation(pageNo);
if (fcltNm) {
rainChkSttnNmSearch(
pageNo,
rainPageSize,
searchYear,
commonCd,
fcltNm
);
rainChkSttnNmSearch(pageNo, rainPageSize, searchYear, laeSeCd, fcltNm);
} else {
rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd);
rainChkSttnInit(pageNo, rainPageSize, searchYear, laeSeCd);
}
}
};
@@ -101,38 +96,38 @@ export default function Page() {
if (pageNo > 0) {
setRswtPageNation(pageNo);
if (fcltNm) {
rswtChkNmSttnSearch(
pageNo,
rainPageSize,
searchYear,
commonCd,
fcltNm
);
rswtChkNmSttnSearch(pageNo, rainPageSize, searchYear, laeSeCd, fcltNm);
} else {
rswtChkSttnInit(pageNo, rswtPageSize, searchYear, commonCd);
rswtChkSttnInit(pageNo, rswtPageSize, searchYear, laeSeCd);
}
}
};
useEffect(() => {
if (!rainChkSttn.isInit) {
isRainSttn(true)
rainChkSttnInit(1, rainPageSize, new Date().getFullYear().toString(), commonCd);
isRainSttn(true);
rainChkSttnInit(
1,
rainPageSize,
new Date().getFullYear().toString(),
laeSeCd
);
setIsModal({ data: {}, open: false });
}
}, [rainChkSttn.isInit, rainChkSttnInit, rainPageSize]);
useEffect(() => {
if (!rswtChkSttn.isInit) {
setIsModal({ data: {}, open: false });
rswtChkSttnInit(1, rswtPageSize, new Date().getFullYear().toString(), commonCd);
isRswtSttn(true)
rswtChkSttnInit(
1,
rswtPageSize,
new Date().getFullYear().toString(),
laeSeCd
);
isRswtSttn(true);
}
}, [rswtChkSttn.isInit, rswtChkSttnInit, rswtPageSize])
}, [rswtChkSttn.isInit, rswtChkSttnInit, rswtPageSize]);
const handleClick = useCallback(
(data: any) => {
@@ -140,11 +135,14 @@ export default function Page() {
},
[isModal]
);
const { t } = useTranslation('base');
const { t } = useTranslation("base");
const excelDown = () => {
if (rainChkSttn.sttnExcelList && selFcltDiv === "RNB") {
if (!rainChkSttn.sttnExcelList || rainChkSttn.sttnExcelList.length === 0) {
toast.error(t('excelDownErrMsg'));
if (
!rainChkSttn.sttnExcelList ||
rainChkSttn.sttnExcelList.length === 0
) {
toast.error(t("excelDownErrMsg"));
return;
}
excelDownload(
@@ -155,8 +153,11 @@ export default function Page() {
3
);
} else if (rswtChkSttn.sttnExcelList && selFcltDiv === "RST") {
if (!rswtChkSttn.sttnExcelList || rswtChkSttn.sttnExcelList.length === 0) {
toast.error(t('excelDownErrMsg'));
if (
!rswtChkSttn.sttnExcelList ||
rswtChkSttn.sttnExcelList.length === 0
) {
toast.error(t("excelDownErrMsg"));
return;
}
excelDownload(
@@ -167,7 +168,7 @@ export default function Page() {
3
);
}
}
};
return (
<ContentsDiv>
@@ -177,7 +178,9 @@ export default function Page() {
<SearchDiv>
<SearchFormLeft>
<div className="col-span-2 flex flex-row space-x-2">
<Label className="w-48 mt-2 text-xl text-gray-600">{'지도점검년도'}</Label>
<Label className="w-48 mt-2 text-xl text-gray-600">
{"지도점검년도"}
</Label>
<SelectBox
className="w-full h-full text-2xl"
label=""
@@ -190,7 +193,9 @@ export default function Page() {
/>
</div>
<div className="col-span-2 flex flex-row space-x-2">
<Label className="w-28 mt-2 text-xl text-gray-600">{'시설구분'}</Label>
<Label className="w-28 mt-2 text-xl text-gray-600">
{"시설구분"}
</Label>
<SelectBox
className={"w-full h-full text-2xl"}
label={""}
@@ -198,9 +203,8 @@ export default function Page() {
selectArray={rainChkSttn.fcltDiv}
onSelectValue={(val: string | number) => {
if (val === "RST") rswtChkPolInit();
setSelFcltDiv(String(val))
}
}
setSelFcltDiv(String(val));
}}
value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val}
/>
</div>
@@ -227,7 +231,13 @@ export default function Page() {
>
조회
</Button>
<Button color="green" size={"sm"} onClick={() => { excelDown() }}>
<Button
color="green"
size={"sm"}
onClick={() => {
excelDown();
}}
>
다운로드
</Button>
</div>
@@ -241,8 +251,8 @@ export default function Page() {
<ListDiv>
{selFcltDiv === "RNB" ? (
<RainChkgdTable
deleteData={() => { }}
detailUp={() => { }}
deleteData={() => {}}
detailUp={() => {}}
handleClick={handleClick}
rainChkData={rainChkSttn.rainChkRes}
pageNation={rainPageNation}
@@ -252,8 +262,8 @@ export default function Page() {
/>
) : (
<RswtChkgdTable
detaiRswtlUpdate={() => { }}
deleteRswtData={() => { }}
detaiRswtlUpdate={() => {}}
deleteRswtData={() => {}}
handleRswtClick={handleClick}
rswtChkData={rswtChkSttn.rswtChkRes}
pageNation={rswtPageNation}
@@ -271,7 +281,14 @@ export default function Page() {
setIsModal({ open: !open, data: {} });
}}
bodyClass={"w-[80vw] max-w-none"}
body={<ChkgdModal readonly={true} type={selFcltDiv} obj={isModal.data} setIsModal={() => { }} />}
body={
<ChkgdModal
readonly={true}
type={selFcltDiv}
obj={isModal.data}
setIsModal={() => {}}
/>
}
></UiModal>
<Toaster position="top-center" />
</ContentsDiv>
+1
View File
@@ -24,5 +24,6 @@ export type TableUpperProps = {
mergeCell?:boolean // 셀을 합칠경우
maxLength?:number
readonly?:boolean
commonCode?:string // 공통코드 사용할경우
};
@@ -25,7 +25,6 @@ import {
} from "./headList";
export const rainPageSize = 5;
export const commonCd = "41";
export type rainChkZodType = z.infer<typeof rainChkZod>;
const fcltDiv = [
@@ -75,7 +74,7 @@ type rainChkgdnActions = {
sggCode: SelectDataType[],
sggCd:string
): Promise<void>;
rainChkExcelDataUPload(excelData: rainChkZodType[] ,year :string) : Promise<void>;
rainChkExcelDataUPload(excelData: rainChkZodType[] ,year :string,laeSeCd:string) : Promise<void>;
rainChkDelete(chkgdnSns: number[] ,year :string): Promise<void>;
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void;
rainChkNmSearch: (
@@ -168,7 +167,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
},
}));
},
rainChkExcelDataUPload: async (excelData: rainChkZodType[] ,year:string) => {
rainChkExcelDataUPload: async (excelData: rainChkZodType[] ,year:string,laeSeCd:string) => {
set((state: rainChkgdnType) => (
{ rainChkgdn: { ...state.rainChkgdn, isLoading: true } }));
try {
@@ -178,7 +177,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
1,
rainPageSize,
year,
commonCd
laeSeCd
);
set((state: rainChkgdnState) => ({
...state,
@@ -78,7 +78,7 @@ type rswtChkgdnActions = {
sggCode: SelectDataType[],
sggCd: string,
): Promise<void>;
rswtChkExceDataUpload: (excelData: rswtChkZodType[]) => void;
rswtChkExceDataUpload: (excelData: rswtChkZodType[],laeSeCd:string) => void;
rswtChkDelete: (chkgdnSns: number[] ,year:string) => void;
rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[] ,year:string) => void;
rswtChkPolAndGuide: (chkgdnSn: number) => void;
@@ -244,7 +244,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
console.log(error);
}
},
rswtChkExceDataUpload: async (excelData: rswtChkZodType[]) => {
rswtChkExceDataUpload: async (excelData: rswtChkZodType[],laeSeCd:string) => {
try {
set((state: rswtChkgdnType) => (
{ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } }));
@@ -256,7 +256,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
});
}
const currentYear = new Date().getFullYear().toString();
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, laeSeCd);
return set((state: rswtChkgdnState) => ({
...state,
rswtChkgdn: {
@@ -1,3 +1,13 @@
/**
* 재이용실적등록 > 하수재이용실적등록
*
* 🔗 사용 API
* - 하수재이용시설 실적 조회: POST /api/v1/reuseFc/pubDetailList/{year}/{sggOrCity}/{page}/{pageSize} (reuse-service)
* - 하수재이용시설 실적 등록: POST /api/v1/reuseFc/pubFcPrf (reuse-service)
* - 공공재이용시설 목록 조회: POST /api/v1/prcsFclt/ruseInfo/{page}/{pageSize}/{type}/{sggOrCity}/{etc1}/{etc2}/{etc3} (server-service)
* - 공공재이용시설 목록 조회(이름검색): POST /api/v1/prcsFclt/ruseInfo/{page}/{pageSize}/{type}/{sggOrCity}/{searchTxt} (server-service)
* - 공공재이용시설 조회: GET /api/v1/reuseFc/pubFc (reuse-service)
**/
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
import { pbnstPrfmncHeadListExport, monthHeadListExport } from "./headList";
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
@@ -75,8 +85,8 @@ const hasuListFetch = async (
: fclt.slice(0, 5) === sggOrCity;
});
}
let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}/A/${sggOrCity}/0/1/SW`;
//let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}/A/${sggOrCity}/0/1/SW`;
let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}`;
if (searchTxt && searchTxt?.length > 0) {
url += `/${searchTxt}`;
}
@@ -121,7 +131,6 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
getPrfFmcRes: async () => {
try {
const pbnPrfRes = await getFetch(fetchType.WR, "/reuseFc/pubFc");
console.log("pbnPrfRes ", pbnPrfRes);
set((state: pbnstPrfmncState) => ({
...state,
prfmnc: {
@@ -140,7 +149,6 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
prfPbnFclts: string[]
) => {
try {
console.log("prfPbnFclts ", prfPbnFclts);
const prfmncRes = await hasuListFetch(
page,
sggOrCity,
@@ -171,7 +171,6 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
`/reuseFc/rainyInfoList/${pageNation}/${rainRegSize}/${code}` +
(txt ? `/${txt}` : "")
);
console.log("rainRes", rainRes);
set((state: rainFacState) => {
return {
rain: {
@@ -40,36 +40,43 @@ export const rainStatHeadListExport: TableUpperProps[] = [
{
id: "lndwtr",
title: "조경용수",
commonCode : "01",
row:1,
},
{
id: "cleanToilUswtr",
title: "청소화장실용수",
commonCode : "02",
row:1,
},
{
id:"resn",
title:"세척살수용수",
commonCode : "03",
row:1,
},
{
id: "farmUswtr",
title: "농업용수",
commonCode : "04",
row:1,
},
{
id: "indstUswtr",
title: "공업용수",
commonCode : "05",
row:1,
},
{
id: "hydUswtr",
title: "친수용수",
commonCode : "06",
row:1,
},
{
id: "ithlEtcUswtr",
title: "기타",
commonCode : "07",
row:1,
},
{
+10 -5
View File
@@ -89,12 +89,11 @@ export const rainStatActionsExport = (
searchRainStatList: async (year: string, city: SelectDataType[]) => {
const res = await fetchRainStatList(year);
const cityArr: any[] = [];
console.log('res ', res)
res.filter((resFilter: RainStatProps) =>
city.some((cityCd) =>
resFilter.ctpvCd?.trim() === cityCd.val.trim()
// 도시코드가 0인 데이터 필터링
resFilter.ctpvCd?.trim() === cityCd.val.trim() && resFilter.ctpvCd.trim() != "0"
)
)
.forEach((item: RainStatProps) => {
@@ -116,14 +115,20 @@ export const rainStatActionsExport = (
obj.dtfcltCpct = item.dtfcltCpct;
obj.wtrUsqty = item.wtrUsqty;
obj.anlOperCst = item.anlOperCst;
obj.lndwtr = 0; //조경용수
obj.cleanToilUswtr = 0; //청소화장실용수
obj.resn = 0; //세척살수용수
obj.farmUswtr = 0; //농업용수
obj.indstUswtr = 0; //공업용수
obj.hydUswtr = 0; //친수용수
obj.ithlEtcUswtr = 0; //기타
cityArr.push(obj);
}
if (item.guideStats && item.guideStats.length > 0) {
item.guideStats.forEach((guide: GuideStatProps) => {
rainStatHeadListExport.forEach((headItem: TableUpperProps) => {
if (headItem.title == guide.utztnUsgCd) {
if (headItem.commonCode == guide.utztnUsgCd) {
if (!obj[headItem.id] || typeof obj[headItem.id] !== "number")
obj[headItem.id] = 0;
if (typeof obj[headItem.id] === "number") {
@@ -64,31 +64,37 @@ export const rswtStatHeadListExport :TableUpperProps[]=[
{
id: "lndwtr",
title: "조경용수",
commonCode: "01",
row:1,
},
{
id: "cleanToilUswtr",
title: "청소화장실용수",
commonCode : "02",
row:1,
},
{
id: "farmUswtr",
title: "농업용수",
commonCode : "04",
row:1,
},
{
id: "indstUswtr",
title: "공업용수",
commonCode : "05",
row:1,
},
{
id: "hydUswtr",
title: "친수용수",
commonCode : "06",
row:1,
},
{
id: "ithlEtcUswtr",
title: "기타",
commonCode : "07",
row:1,
},
{
+1 -2
View File
@@ -118,10 +118,9 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = (
item.guideStats.forEach((guide: GuideStatProps) => {
rswtStatHeadListExport.forEach((headItem: TableUpperProps) => {
if (headItem.title == guide.utztnUsgCd) {
if (headItem.commonCode == guide.utztnUsgCd) {
if (!obj[headItem.id] || typeof obj[headItem.id] !== "number") obj[headItem.id] = 0;
if (typeof obj[headItem.id] === "number") {
obj[headItem.id] += guide.ruseFcltUtztnQnt;
}
}
@@ -77,7 +77,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
useEffect(() => {
const city = String(userCtpvCd);
if (city && city === "0") {
if (city && (city === "0" || city === "50")) {
setUserSggCd([{ text: "전체", val: "0" }]);
form.setValue("sggCd", 0, {
@@ -36,6 +36,7 @@ export default function ChkgdExcel({
setYearChange: (year: string) => void;
}) {
const {
auth,
rswtChkgdn,
rainChkgdn,
rainChkExcelDataUPload,
@@ -51,6 +52,7 @@ export default function ChkgdExcel({
const [file, setFile] = useState<File | null>(null);
const { laeSeCd } = auth;
const clearFile = () => {
if (fileInputRef.current) {
fileInputRef.current.value = ""; // ✅ 파일 선택 비우기
@@ -202,7 +204,8 @@ export default function ChkgdExcel({
} else {
rainChkExcelDataUPload(
excelData as rainChkZodType[],
form.getValues("chckYr")
form.getValues("chckYr"),
laeSeCd
);
setIsRegExcel(false);
setYearChange(form.getValues("chckYr"));
@@ -213,7 +216,7 @@ export default function ChkgdExcel({
return;
} else {
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]);
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[], laeSeCd);
setIsRegExcel(false);
setYearChange(form.getValues("chckYr"));
}
@@ -122,10 +122,15 @@ export function BdstReg<T extends MoType>({
setUserSggCd([{ text: "전체", val: "0" }]);
setObjSearch({ ...objSearch, sgg: "0" });
} else if (city.length === 2) {
const sgg = code.sggCd.filter((item) => item.val.slice(0, 2) === city);
//sgg.unshift({ text: "전체", val: "0" });
setUserSggCd(sgg);
setObjSearch({ ...objSearch, sgg: Number(sgg[0]?.val) });
if (city === "50") {
setUserSggCd([{ text: "전체", val: "0" }] as SelectDataType[]);
setObjSearch({ ...objSearch, sgg: "0" });
} else {
const sgg = code.sggCd.filter((item) => item.val.slice(0, 2) === city);
//sgg.unshift({ text: "전체", val: "0" });
setUserSggCd(sgg);
setObjSearch({ ...objSearch, sgg: Number(sgg[0]?.val) });
}
}
}, [objSearch.city]);
@@ -124,7 +124,7 @@ export default function SdmInsertForm({selectSidoData, selectSigunData, dataList
// form 에러 체크
const formErrors = form.formState.errors;
const myUUID = getCookie('token-id');
const myUUID = getCookie('token-id') ||'c475824c-0e82-4a06-a282-2b55a20df265';
if (Object.keys(formErrors).length > 0 ) {
const errorMessage = Object.values(formErrors)[0]?.message || '입력값을 확인해주세요.';
@@ -132,10 +132,7 @@ export default function SdmInsertForm({selectSidoData, selectSigunData, dataList
return;
}
if(!myUUID){
toast.error('사용자 정보가 올바르지 않습니다. 다시 로그인 해주세요.');
return;
}
const dmdInfoId = data.dmdInfoId + (data.bznmTotNo || '0000');
const formData = {
@@ -25,6 +25,7 @@ type SearchBaseType = {
leftClassName?: string;
leftSelectClassName?: string;
buttonOrder?: ("query" | "init" | "excel")[];
initSidoValue?: string | '';
}
export type ReturnType = {
partValue: string;
@@ -57,10 +58,11 @@ function SearchBaseForm ({
rightClassName,
leftClassName,
leftSelectClassName,
buttonOrder
buttonOrder,
initSidoValue='',
}: SearchBaseType) {
const [partValue, setPartValue] = useState<string>("A");
const [sidoValue, setSidoValue] = useState<string>("0");
const [sidoValue, setSidoValue] = useState<string>(initSidoValue?initSidoValue:"0");
const [sigunValue, setSigunValue] = useState<string>("0");
const [sidoText, setSidoText] = useState<string>("");
const [sigunText, setSigunText] = useState<string>("");
@@ -94,7 +96,7 @@ function SearchBaseForm ({
}
};
const queryVal = () => {
console.log("조회버튼 클릭");
console.log("조회버튼 클릭",);
queryClick({
partValue: partValue,
sidoValue: sidoValue,
@@ -108,11 +110,18 @@ function SearchBaseForm ({
});
}
const initVal = useCallback(() => {
if(initSidoValue){
setSidoValue(initSidoValue);
}
setResetTrigger(true);
initClick();
}, [setResetTrigger, initClick]);
}, [initSidoValue, setResetTrigger, initClick]);
useEffect(() => {
if (resetTrigger) {
if(initSidoValue!=""){
setSidoValue(initSidoValue);
}
setResetTrigger(false);
}
}, [resetTrigger]);
@@ -167,6 +176,7 @@ function SearchBaseForm ({
isAdmin={isAdmin}
leftClassName={leftClassName}
leftSelectClassName={leftSelectClassName}
initSidoValue={initSidoValue}
>
{leftChildren}
</SearchFormLeft>
@@ -46,6 +46,7 @@ type SearchFormLeftProps = {
isAdmin?: boolean;
leftClassName?: string;
leftSelectClassName?: string;
initSidoValue?: string;
}
export type EnvPartSelectDataType = SelectDataType & {
@@ -58,11 +59,11 @@ const selectPartData:SelectDataType[] = [
{ text: "환경청별", val: 'G' },
];
function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], selectSigunData = [], selectRegionData = [], selectUnitWaterShedData = [], selectMiddleRegionData = [], selectEnvPartData = [], setRtnPartValue, setRtnSidoValue, setRtnSidoText, setRtnSigunValue, setRtnSigunText, setRtnRegionValue, setRtnUnitWaterShedValue, setRtnMiddleRegionValue, setRtnEnvPartValue, setRtnEnvPartSidoValue, setRtnEnvPartSigunValue, resetTrigger = false, isAdmin = false, leftClassName, leftSelectClassName }: SearchFormLeftProps) {
function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], selectSigunData = [], selectRegionData = [], selectUnitWaterShedData = [], selectMiddleRegionData = [], selectEnvPartData = [], setRtnPartValue, setRtnSidoValue, setRtnSidoText, setRtnSigunValue, setRtnSigunText, setRtnRegionValue, setRtnUnitWaterShedValue, setRtnMiddleRegionValue, setRtnEnvPartValue, setRtnEnvPartSidoValue, setRtnEnvPartSigunValue, resetTrigger = false, isAdmin = false, leftClassName, leftSelectClassName, initSidoValue }: SearchFormLeftProps) {
/******************선택된 데이터******************/
const [partValue, setPartValue] = useState<string>('A');
//행정별 시도 시군구
const [sidoValue, setSidoValue] = useState<string>('0');
const [sidoValue, setSidoValue] = useState<string>(initSidoValue?initSidoValue : '0');
const [sigunValue, setSigunValue] = useState<string>('0');
const [sidoText, setSidoText] = useState<string>('');
const [sigunText, setSigunText] = useState<string>('');
@@ -85,6 +86,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
const [filteredEnvPartSidoData, setFilteredEnvPartSidoData] = useState<EnvPartSelectDataType[]>([{ text: "전체", val: '0', adstDliStrCd:'' }]);
const [filteredEnvPartSigunData, setFilteredEnvPartSigunData] = useState<SelectDataType[]>([{ text: "전체", val: '0' }]);
const [initTrigger, setInitTrigger] = useState<boolean>(false);
// 시군구 세팅
const initializeSigunData = (sidoCd: string) => {
if (sidoCd === '0') {
@@ -99,7 +101,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
setFilteredSigunData(newFilteredData);
}
}
// 단위유역 세팅
const initializeUnitWaterShedData = (regionCd: string) => {
if(regionCd === '0') {
@@ -159,6 +161,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
}
const onSelectValue = (val: string, type: string) => {
setInitTrigger(true);
let selectedSido;
let selectedSigun;
let selectedEnvPartSido;
@@ -272,7 +275,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
// 리셋 함수
const resetAllValues = () => {
setPartValue('A');
setSidoValue('0');
setSidoValue(initSidoValue?initSidoValue:'0');
setSigunValue('0');
setRegionValue('0');
setUnitWaterShedValue('0');
@@ -287,7 +290,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
setFilteredEnvPartSigunData([{ text: "전체", val: '0' }]);
if (setRtnPartValue) setRtnPartValue('A');
if (setRtnSidoValue) setRtnSidoValue('0');
if (setRtnSidoValue) setRtnSidoValue(initSidoValue?initSidoValue:'0');
if (setRtnSigunValue) setRtnSigunValue('0');
if (setRtnRegionValue) setRtnRegionValue('0');
if (setRtnUnitWaterShedValue) setRtnUnitWaterShedValue('0');
@@ -304,6 +307,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
// 리셋 후 트리거를 false로 설정
if (setRtnPartValue) {
setRtnPartValue('A');
setInitTrigger(false);
}
}
}, [resetTrigger]);
@@ -327,7 +331,12 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel
) : (
<>
<SelectBox className={leftSelectClassName?leftSelectClassName:`col-span-3`} label={'시도'} selectArray={selectSidoData} onSelectValue={(val) => onSelectValue(val.toString(), 'sido')} value={sidoValue} selectClass={undefined}/>
<SelectBox className={leftSelectClassName?leftSelectClassName:`col-span-3`} label={'시군구'} selectArray={filteredSigunData} onSelectValue={(val) => onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={undefined}/>
<SelectBox className={leftSelectClassName?leftSelectClassName:`col-span-3`} label={'시군구'} selectArray={initSidoValue&&!initTrigger?[
{ text: '전체', val: '0' },
...selectSigunData.filter(
(item) => String(item.val).slice(0, 2) === String(initSidoValue)
),
]:filteredSigunData} onSelectValue={(val) => onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={undefined}/>
</>
)}
{children}