From 97727908fa3ff130b8bf4f920f90566c29fcb9f1 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 28 Jul 2025 10:32:58 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20nullish=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 34990c6b3..58d539538 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -98,7 +98,7 @@ export const DmdCoReqSchema = z.object({ z.object({ ruseUtztnFcltNm: z.string(), ruseUtztnFcltCd: z.string(), - }) + }).nullish() ).nullish(), totalConstCost: z.number().nullish(), }); From 662a461cfaad71ed04f01bad498712cb61589d93 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 28 Jul 2025 18:26:43 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=ED=98=84=ED=99=A9=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltSttn/pbnstSttn/page.tsx | 26 ++++---- .../ruseFcltMng/fcltSttn/pbnstSttn/index.tsx | 65 ++++++++++++------- 2 files changed, 56 insertions(+), 35 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx index eb7a398b1..5208edc02 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -33,6 +33,9 @@ export default function PbnstSttn() { } = useWrStore((state) => state); const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn; + + const [isReset, setIsReset] = useState(false); + //const [tableIndex, setTableIndex] = useState(1) const ref = useRef({} as ReturnType); const [searchYear, setSearchYear] = useState( String(new Date().getFullYear()) @@ -84,7 +87,7 @@ export default function PbnstSttn() { if (!pbnstSttn.isInit) { getFlcts(); } - }, [pbnstSttn.isInit, pbnSttnInit, ref.current]); + }, [pbnstSttn.isInit]); useEffect(() => { if (pbnstSttnRes && pbnstSttnRes.length > 0) { setBdstTable(pbnstSttnRes); @@ -94,7 +97,8 @@ export default function PbnstSttn() { }, [pbnstSttnRes]); useEffect(() => { - pbnSttnInit("1", "15", ref.current, searchYear, fclts); + + pbnSttnInit("1", "15", ref.current, searchYear, fclts); }, [fclts]); useEffect(() => { @@ -157,16 +161,11 @@ export default function PbnstSttn() { /> } - queryClick={function (returnType: ReturnType): void { - pbnstSttnSearch( - false, - "1", - "15", - returnType, - pbnRuseNm, - searchYear, - fclts - ); + queryClick={ ()=> { + // pbnSearch(returnType); + + //setTableIndex(0) + setIsReset(true); }} excelClick={excelClick} initClick={function (): void { @@ -200,7 +199,10 @@ export default function PbnstSttn() { searchYear, fclts ); + setIsReset(false); }} + + resetPageNo={isReset} > diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx index 542622d34..7f905dd49 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx @@ -95,43 +95,59 @@ const hasuListFetch = async ( year: string, flcts: string[] ) => { - let url = `/prcsFclt/ruseInfo/`; + let url = ``; + let filteredFclt = flcts; + const filterData = reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue + + if(filterData !== '0') + filteredFclt= flcts.filter((fclt: string) => { + return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData + }) if (reurnValue.partValue === "A") { - url += `${page}/${total}/${reurnValue.partValue}/${ + url += `${reurnValue.partValue}/${ // reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue }/0/1/SW` + + if(filterData !== '0') + filteredFclt= flcts.filter((fclt: string) => { + return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData + }) } else if (reurnValue.partValue === "R") { - url += `${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue + url += `${reurnValue.partValue}/${reurnValue.regionValue ? reurnValue.regionValue : reurnValue.unitWaterShedValue ? reurnValue.unitWaterShedValue : reurnValue.middleRegionValue }/0/1/SW` } else if (reurnValue.partValue === 'G') { - - - url += `${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW` - + url += `${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW` + if(filterData !== '0') + filteredFclt= flcts.filter((fclt: string) => { + return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData + }) + } else { - url += `1/2/A/0/0/1/SW` + url += `A/0/0/1/SW` } if (searchNm && searchNm?.length > 0) { url += "/" + searchNm } - const pbnList = await postFectch(url, flcts, fetchType.COMMON); + const pbnList = await postFectch( `/prcsFclt/ruseInfo/1/${filteredFclt.length}/`+url, filteredFclt, fetchType.COMMON); + + + const checkRuseFcltList = searchNm && searchNm?.length > 0?pbnList.data.map((item)=> item.bscFctCd ):filteredFclt const getRuseList = await postFectch( - `/reuseFc/pubDetailList/${year}`, - flcts, + `/reuseFc/pubDetailList/${year}/${filterData}/${page}/${total}`, + checkRuseFcltList, fetchType.WR ); const checkWrRegListRes = getRuseList.data; - const data: WaterReuseFacility[] = checkWrRegListRes.map( (item: FcPrfType) => { const findData = pbnList.data.find( @@ -140,7 +156,6 @@ const hasuListFetch = async ( ); if (findData) { - const usage = item.prfList.reduce( (acc, cur) => { acc.inUsage += @@ -197,7 +212,11 @@ const hasuListFetch = async ( } ).filter(Boolean); - return data; + + + + + return {data:data, count:getRuseList.count}; }; export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( @@ -237,8 +256,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( fclts: string[] ) => { try { - - + const pbnstSttnRes = await hasuListFetch( page, total, @@ -250,7 +268,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( // if (Number(total) > 9000) { if (isExcel) { - const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes); + const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes.data); set((state: pbnstSttnState) => { return { ...state, @@ -267,8 +285,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( ...state, pbnstSttn: { ...state.pbnstSttn, - pbnstSttnRes: pbnstSttnRes, - pbnstSttnResCount: pbnstSttnRes.length + pbnstSttnRes: pbnstSttnRes.data, + pbnstSttnResCount: pbnstSttnRes.count // isInit: false, }, }; @@ -295,13 +313,14 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( fclts ); + set((state: pbnstSttnState) => { return { ...state, pbnstSttn: { ...state.pbnstSttn, - pbnstSttnRes: pbnstSttnRes, - pbnstSttnResCount: pbnstSttnRes.length, + pbnstSttnRes: pbnstSttnRes.data, + pbnstSttnResCount: pbnstSttnRes.count, isInit: false, pbnstDetail: {} as customPbnst }, @@ -365,8 +384,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( ...state, pbnstSttn: { ...state.pbnstSttn, - pbnstSearchData: pbnstSttnRes, - pbnstSttnResCount: pbnstSttnRes.length, + pbnstSearchData: pbnstSttnRes.data, + pbnstSttnResCount: pbnstSttnRes.count, }, }; }); From 64698fb97e39f5b35b0fd05012f94833dead1522 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Tue, 29 Jul 2025 10:33:34 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=20=ED=98=84=ED=99=A9=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/pbnstPrfmncSttn/index.tsx | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx index 13093f98f..1a833313d 100644 --- a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx @@ -50,42 +50,56 @@ const hasuListFetch = async ( page: number, returnType: ReturnType, searchNm: string | undefined, - year: string, + fromDate: string, + toDate: string, flcts: string[] ) => { - let url = `/prcsFclt/ruseInfo/`; + let url = ''; + let filteredFclt = flcts; + const filterData = returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue + if (filterData !== '0') + filteredFclt = flcts.filter((fclt: string) => { + return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData + }) if (returnType.partValue === "A") { - url += `${page}/5/${returnType.partValue}/${ + url += `${returnType.partValue}/${ // returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue }/0/1/SW` + + if (filterData !== '0') + filteredFclt = flcts.filter((fclt: string) => { + return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData + }) } else if (returnType.partValue === "R") { - url += `${page}/5/${returnType.partValue}/${returnType.regionValue + url += `${returnType.partValue}/${returnType.regionValue ? returnType.regionValue : returnType.unitWaterShedValue ? returnType.unitWaterShedValue : returnType.middleRegionValue }/0/1/SW` } else if (returnType.partValue === 'G') { - url += `${page}/5/${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW` - + url += `${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW` + if (filterData !== '0') + filteredFclt = flcts.filter((fclt: string) => { + return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData + }) } else { - url += `1/2/A/0/0/1/SW` + url += `A/0/0/1/SW` } - if (searchNm && searchNm?.length > 0) { url += "/" + searchNm } - - const pbnList = await postFectch(url, flcts, fetchType.COMMON); + const pbnList = await postFectch(`/prcsFclt/ruseInfo/1/${filteredFclt.length}/` + url, filteredFclt, fetchType.COMMON); + const checkRuseFcltList = searchNm && searchNm?.length > 0 ? pbnList.data.map((item) => item.bscFctCd) : filteredFclt const getRuseList = await postFectch( - `/reuseFc/pubDetailList/${year}`, - flcts, + `/reuseFc/pubDetailPrfList/${fromDate}/${toDate}/${filterData}/${page}/5`, + checkRuseFcltList, fetchType.WR ); - let count = 0; const checkWrRegListRes = getRuseList.data; + const data: WaterReuseFacility[] = checkWrRegListRes.map( (item: FcPrfType) => { if (!item.prfList || item.prfList.length === 0) { @@ -96,7 +110,6 @@ const hasuListFetch = async ( fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11) ); if (findData) { - count++; return { sido: findData?.sido || '-', gugun: findData?.gugun || '-', @@ -104,12 +117,12 @@ const hasuListFetch = async ( ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-', pbnstRuseFcltId: item?.pbnstRuseFcltId || '-', bscFctCd: findData?.bscFctCd || '-', - count + prfList: item.prfList, } } } ).filter(Boolean); - return data; + return {data: data, count: getRuseList.count}; } export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = ( @@ -175,29 +188,17 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions page, returnType, fcltNm, + fromDate, toDate, fclts); - // const bscFctCdList = prfmncRes.map((item: any) => { - // return item.bscFctCd; - // }) - const bscFctCdList = prfmncRes - .map((item: any) => item.bscFctCd) - .filter((value, index, self) => self.indexOf(value) === index); - // const bscFctCdList = [...new Set(prfmncRes.map((item: any) => item.bscFctCd))]; - - const res = await postFectch( - `/reuseFc/pubDetailList/${fromDate}/${toDate}`, - bscFctCdList, - `wr`, - ) let inUsageSum = 0; let outUsageSum = 0; let year = ""; const yearsData = [] as any - res.data.forEach((item: any) => { - if (item.prfList.length === 0) { + prfmncRes.data.forEach((item: any) => { + if (!item.prfList || item.prfList.length === 0) { const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출. const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" }; yearVal[`${year}inUsage`] = 0; @@ -205,7 +206,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions yearVal[`${year}total`] = 0; yearsData.push(yearVal); } - item.prfList.forEach((acc) => { + item.prfList?.forEach((acc: any) => { year = acc.ym?.substring(0, 4) ?? ""; inUsageSum = (acc.wshwtr ?? 0) + //조경용수 @@ -273,7 +274,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions // prfmncRes 정보 merge const resData = Object.values(mergedMap).map((item: any) => { - const match = prfmncRes.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId); + const match = prfmncRes.data.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId); return match ? { ...item, ...match } : item; }); @@ -282,10 +283,10 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions pbnstPrfmncSttn: { ...state.pbnstPrfmncSttn, // prfmncRes: prfmncRes, - prfmncResCount: fclts.length - 5, + prfmncResCount: prfmncRes.count, isInit: false, prfmncRes: resData, - rawData: res.data + rawData: prfmncRes.data }, })); } catch (errorHasu) { From c30de7f40d6b810cc19d5cd23a581d012116899f Mon Sep 17 00:00:00 2001 From: jyha00 Date: Tue, 29 Jul 2025 11:10:22 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=20=ED=98=84=ED=99=A9=20=EC=97=91=EC=85=80=20=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EC=88=98=EC=A0=95,=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=20=EB=B2=84=ED=8A=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index 8035d2875..ac77639a4 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -150,9 +150,9 @@ export default function PbnstPrfmncSttn() { } const tableData = [...inUsageData, ...outUsageData, usageTotalObj]; setPrfData(tableData); - setExcelData(excelPrfmncSttnParsing(prfData ?? [])) - // }); + setExcelData(excelPrfmncSttnParsing(tableData ?? [])) } else { + setExcelData(excelPrfmncSttnParsing([])) setPrfData([]); } } @@ -605,7 +605,11 @@ export default function PbnstPrfmncSttn() { isResetPage(true) }} excelClick={excelClick} - initClick={function (): void { }} + initClick={function (): void { + setPbnRuseNm(""); + setFromDate(String(new Date().getFullYear())); + setToDate(String(new Date().getFullYear())) + }} btnClass={btnClass} ref={ref} isAdmin={false} /> From 913256cac4546dcf2d896e39c4574ba8698ea1f3 Mon Sep 17 00:00:00 2001 From: yschoi Date: Tue, 29 Jul 2025 15:16:45 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=EC=9B=90=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dm/src/entities/auth/api/login-service.ts | 1 - .../fo/src/entities/auth/api/login-service.ts | 2 - apps/wr/app/map/mainMap/page.tsx | 17 +--- apps/wr/app/map/newWindowPopup.tsx | 21 ++-- apps/wr/app/store/matDmd/coSttn/index.tsx | 2 - .../wr/src/entities/auth/api/login-service.ts | 1 - .../business_components/src/ui/map/Gis.js | 95 +------------------ .../business_components/src/ui/map/GisTree.js | 2 +- .../src/ui/map/lib/gis.layer.js | 2 - 9 files changed, 19 insertions(+), 124 deletions(-) diff --git a/apps/dm/src/entities/auth/api/login-service.ts b/apps/dm/src/entities/auth/api/login-service.ts index 614aadbf9..43ea1c33d 100644 --- a/apps/dm/src/entities/auth/api/login-service.ts +++ b/apps/dm/src/entities/auth/api/login-service.ts @@ -16,7 +16,6 @@ export class LoginApiService implements LoginService { public async login(payload: ILogin): Promise { try { - console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN) const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, { method: "POST", body: JSON.stringify({ diff --git a/apps/fo/src/entities/auth/api/login-service.ts b/apps/fo/src/entities/auth/api/login-service.ts index fafb467e7..3f2d958c6 100644 --- a/apps/fo/src/entities/auth/api/login-service.ts +++ b/apps/fo/src/entities/auth/api/login-service.ts @@ -17,8 +17,6 @@ export class LoginApiService implements LoginService { public async login(payload: ILogin): Promise { try { - console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN) - console.log(payload.userId+' '+payload.password) const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, { method: "POST", body: JSON.stringify({ diff --git a/apps/wr/app/map/mainMap/page.tsx b/apps/wr/app/map/mainMap/page.tsx index 1e9afd74b..cc71e69aa 100644 --- a/apps/wr/app/map/mainMap/page.tsx +++ b/apps/wr/app/map/mainMap/page.tsx @@ -61,13 +61,16 @@ const Map = () => { // 2. data가 OpenLayers Feature 인스턴스인지 확인 let foundFeature: any = null; + console.log(data) + //console.log(data.getId()) let featureId = data.fid; const layerName = data.layerNm; - if (layerName === "tb_wr_bdst_ruse_fclt") { + + if (layerName === "재이용시설") { // 재이용시설 featureId = `${layerName}.${data.searchPk}`; } else if ( //빗물이용시설, 중수도시설 - layerName === "tb_wr_rnwtr_utztn_fclt" || + layerName === "빗물이용시설" || layerName == "tb_wr_rswtr_fclt" ) { featureId = `${layerName}.${data.bdstInfoSn}`; @@ -136,16 +139,6 @@ const Map = () => { gisMaps={gisMaps} isMiniMap={false} searchView={undefined} - // searchView={(props: any) => ( - // - // ) - // } detailView={(props: any) => ( = ({ const [mngList, setMngList] = useState(coSttnRes || []); ///////////////////////////////////////////// 피쳐데이터 선택 시 각 시설별 데이터 처리 /////////////////////////////////////////////// const getSelectedLayers = () => { + console.log(1) let result = null; const layers = gisMap ? gisMap.getLayers().getArray().filter((l: any) => l.getVisible()) : []; // gisMap이 null인지 확인 후 레이어 가져오기 let featureLayer: { get: (key: string) => any } = { get: () => null }; @@ -127,6 +128,7 @@ const NewWindowPopup: React.FC = ({ } }); result = featureLayer.get('lyrNm'); + console.log(result) return result; }; @@ -156,15 +158,15 @@ const NewWindowPopup: React.FC = ({ } }; const detainSttn = async (featureCd: string, layerNm: string) => { - if (layerNm == 'tb_wr_rnwtr_utztn_fclt') { //빗물이용시설 + if (layerNm == '빗물이용시설') { //빗물이용시설 const res = await getFetch(fetchType.WR, `/reuseFc/rainyInfoList/1/20/0/${featureCd}`) setRainList(res) } - else if (layerNm == 'tb_wr_rswtr_fclt') { //중수도 시설 + else if (layerNm == '중수도시설') { //중수도 시설 const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`) setRswtrList(res) } - else if(layerNm =='tb_wr_ruse_fclt_dmd_co'){ //수요처 + else if(layerNm =='수요처'){ //수요처 const res = await getFetch(fetchType.WR, `/reuseFc/request/1/20/0/${featureCd}`) setMngList(res) } @@ -192,6 +194,7 @@ const NewWindowPopup: React.FC = ({ },[mngList]) const layerId = getSelectedLayers(); + console.log(layerId) if (featureData && typeof featureData.getProperties === "function") { const selectedVal = featureData.getProperties(); let featureCd = layerId == '하수재이용시설' ? selectedVal?.swtrmt_fclt_cd : layerId == '빗물이용시설' || layerId == '중수도시설' || layerId == '온배수시설' || layerId == '수요처' ? selectedVal?.bdst_nm : layerId == '하수처리시설' ? selectedVal?.swtrmt_fclt_nm : null; @@ -505,17 +508,17 @@ const NewWindowPopup: React.FC = ({ layerId = seletectedLayerNm || ''; } //하수처리시설 - const isPrcsFclt = layerId == 'tb_il_swage_prcs_fclt' + const isPrcsFclt = layerId == '하수처리시설' // 재이용시설 - const isPbnst = layerId == 'tb_wr_bdst_ruse_fclt'; + const isPbnst = layerId == '재이용시설'; // 빗물이용시설 - const isRain = layerId == 'tb_wr_rnwtr_utztn_fclt'; + const isRain = layerId == '빗물이용시설'; // 중수도시설 - const isRswt = layerId == 'tb_wr_rswtr_fclt'; + const isRswt = layerId == '중수도시설'; // 온배수시설 - const isHtdfl = layerId == 'tb_wr_htdfl_fclt'; + const isHtdfl = layerId == '온배수시설'; // 수요처관리 - const isReuseMng = layerId == 'tb_wr_ruse_fclt_dmd_co'; + const isReuseMng = layerId == '수요처관리'; if (isPrcsFclt) { if (viewMode == 'list') { return ( diff --git a/apps/wr/app/store/matDmd/coSttn/index.tsx b/apps/wr/app/store/matDmd/coSttn/index.tsx index cc1db4566..1e20e8a76 100644 --- a/apps/wr/app/store/matDmd/coSttn/index.tsx +++ b/apps/wr/app/store/matDmd/coSttn/index.tsx @@ -52,8 +52,6 @@ export const coSttnActionsExport: (set: any) => coSttnActions = ( `/reuseFc/request/${pageNo}/${pageCnt}/${con}` ); - console.log('coSttnRes ', coSttnRes) - set((state: coSttnState) => { return { ...state, diff --git a/apps/wr/src/entities/auth/api/login-service.ts b/apps/wr/src/entities/auth/api/login-service.ts index 1808f7de8..77d114004 100644 --- a/apps/wr/src/entities/auth/api/login-service.ts +++ b/apps/wr/src/entities/auth/api/login-service.ts @@ -17,7 +17,6 @@ export class LoginApiService implements LoginService { public async login(payload: ILogin): Promise { try { - console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN) const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, { method: "POST", body: JSON.stringify({ diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 6898e37ee..117601cc3 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -128,101 +128,7 @@ function Gis({ // Feature Click Event const handleFeatureSelect = useCallback((data) => { console.log(data); - // gisMap = mapInstanceRef.current; - // gisMap = mapInstanceRef.current; - - // if (!gisMap) { - // console.warn('지도가 초기화되지 않았습니다.'); - // return; - // } - // if (!gisMap) { - // console.warn('지도가 초기화되지 않았습니다.'); - // return; - // } - - // // 항상 같은 select 객체 사용 - // const select = GisApp.Module.select; - // if (!select) return; - // // 항상 같은 select 객체 사용 - // const select = GisApp.Module.select; - // if (!select) return; - - // // 1. 기존 선택 초기화 - // select.resetSelectedFeature(); - - // // 2. data가 OpenLayers Feature 인스턴스인지 확인 - // let foundFeature = null; - // if (data && typeof data.getGeometry === 'function' && typeof data.setStyle === 'function') { - // // 이미 Feature 인스턴스라면 그대로 사용 - // foundFeature = data; - // } else { - // // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용 - // let featureId = data.fid; - // const layerName = layerNmRef.current - // if (layerName === '하수재이용시설') { - // featureId = data.searchPk; - // } else if (layerName === '빗물이용시설' || layerName == '중수도시설') { - // featureId = data.bdstInfoSn; - // } else if (layerName === '하수처리시설') { - // featureId = data.bscFctCd; - // } else if (layerName === '온배수시설') { - // featureId = data.bdstRuseFcltSn; - // } else if(layerName == '수요처'){ - // featureId = data.dmdInfoId.replaceAll('-','') - // } - // else { - // console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm); - // featureId = data.fid || data.id || data.ftrIdn; - // } - // // gisMap.getLayers().getArray().forEach(layer => { - // // const source = layer.getSource?.(); - // // if (source?.getFeatureById) { - // // const feature = source.getFeatureById(String(featureId).trim()); - // // if (feature) foundFeature = feature; - // // } - // // }); - // // const [layerType, id] = String(featureId).split('.'); - // gisMap.getLayers().getArray().forEach(layer => { - // const source = layer.getSource?.(); - // if (source?.getFeatures) { - // const allFeatures = source.getFeatures(); - // for (const f of allFeatures) { - // const id = String(f.getId()); - // // console.log('id', id, featureId) - // if (id && id.split('.')[1] === String(featureId)) { - // foundFeature = f; - // break; - // } - // } - // } - // }); - // } - - // // 3. 피처 선택 - // if (foundFeature) { - // let geometry = foundFeature.getGeometry(); - // if (geometry) { - // let extent = geometry.getExtent(); - - // gisMap.getView().fit(extent, { - // duration: 300, - // padding: [50, 50, 50, 50], - // maxZoom: 16, - // constrainResolution: true, - // nearest: true, - // }); - // } - // select.selectFeature(foundFeature, true); - // } else { - // console.warn('OpenLayers Feature를 찾을 수 없습니다:', data); - // } - - // setFeatureData(data); - // setIsOpen(true); - // setIsSearchModalOpen(false); - onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출 - console.log(data) }, [mapInstanceRef]); // 지도 생성 및 초기화 @@ -467,6 +373,7 @@ function Gis({ setVisible={setTabVisible} onCheckedChange={handleCheckedLayersChange} onLayerIconClick={(layerNm) => { + console.log(layerNm) layerNmRef.current = layerNm setLayerNm(layerNm); setIsOpen(true); const dummyFeature = { getProperties: () => ({}), // 최소 구조 diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index ccaa3c186..335b1b119 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -189,7 +189,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes }; const handleLayerImgClick = (nodeNm, nodeId, layerNm) => { if(!checked.includes(nodeId)) alert('시설을 선택해주세요') - else onLayerIconClick(layerNm) + else onLayerIconClick(nodeNm) } if (!treeData || treeData.length === 0) return null; diff --git a/packages/common/business_components/src/ui/map/lib/gis.layer.js b/packages/common/business_components/src/ui/map/lib/gis.layer.js index fee3f247b..d8474ce0a 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.layer.js +++ b/packages/common/business_components/src/ui/map/lib/gis.layer.js @@ -130,8 +130,6 @@ GisOlLayer.prototype = { strategy: all, }); return source; - - return source; }, /** * [사용]WFS 레이어 생성 From aaed8fe971d0ccf31cb0b07f96bb51af4c125a1f Mon Sep 17 00:00:00 2001 From: leedj312 Date: Tue, 29 Jul 2025 15:51:18 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=20=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=EC=8B=A4=EC=A0=81=20=EB=93=B1=EB=A1=9D=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 10 +- .../ruseFcltMng/fcltSttn/pbnstSttn/page.tsx | 39 ++-- .../prfmncReg/pbnstPrfmncReg/page.tsx | 62 +++--- .../store/prfmncReg/pbnstPrfmncReg/index.tsx | 189 +++++++++++++----- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 10 - 5 files changed, 186 insertions(+), 124 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 934946b74..d08d6f06e 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -71,7 +71,7 @@ export default function PublicReuseFaciltyInsert() { // defaultValues: { items: pbnstRegArrayZod.parse([]) }, mode: "onChange", }); - const { isDirty } = form.formState; + // const { isDirty } = form.formState; const { fields: items, @@ -90,10 +90,10 @@ export default function PublicReuseFaciltyInsert() { }, [pbnst.isInit, pubHasuInit]); const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { - if (!isDirty) { - toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시 - return; - } + // if (!isDirty) { + // toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시 + // return; + // } const data = writeRgtrAndMdfr(valuse.items); let bizs = [] as fcBizType[]; data.forEach((fclt) => { diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx index 5208edc02..8aea16c00 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -1,6 +1,7 @@ "use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; +import { prfRegPageSize } from "@/app/store/prfmncReg/pbnstPrfmncReg"; import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type"; import { excelDownload, yearOptions } from "@/components/lib/func/commom"; @@ -35,7 +36,6 @@ export default function PbnstSttn() { const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn; const [isReset, setIsReset] = useState(false); - //const [tableIndex, setTableIndex] = useState(1) const ref = useRef({} as ReturnType); const [searchYear, setSearchYear] = useState( String(new Date().getFullYear()) @@ -70,6 +70,24 @@ export default function PbnstSttn() { }, [getPbnStnDetail, pbnstSttnRes] ); + useEffect(() => { + if (!pbnstSttn.isInit) { + getFlcts(); + } + }, [pbnstSttn.isInit]); + useEffect(() => { + + pbnSttnInit("1", "15", ref.current, searchYear, fclts); + }, [fclts]); + + useEffect(() => { + if (pbnstSttnRes && pbnstSttnRes.length > 0) { + setBdstTable(pbnstSttnRes); + } else { + setBdstTable([]); + } + }, [pbnstSttnRes]); + useEffect(() => { if (pbnstSttn.excelList.length >= 0) { @@ -82,24 +100,7 @@ export default function PbnstSttn() { ); } }, [pbnstSttn.excelList]); - useEffect(() => { - if (!pbnstSttn.isInit) { - getFlcts(); - } - }, [pbnstSttn.isInit]); - useEffect(() => { - if (pbnstSttnRes && pbnstSttnRes.length > 0) { - setBdstTable(pbnstSttnRes); - } else { - setBdstTable([]); - } - }, [pbnstSttnRes]); - - useEffect(() => { - - pbnSttnInit("1", "15", ref.current, searchYear, fclts); - }, [fclts]); useEffect(() => { if (pbnstSttn.pbnstDetail.pbnstRuseFcltId) @@ -193,7 +194,7 @@ export default function PbnstSttn() { pbnstSttnSearch( false, String(page), - String(15), + String(prfRegPageSize), ref.current, pbnRuseNm, searchYear, diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index fbab00284..4fd866d75 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -38,11 +38,12 @@ import { useTranslation } from "react-i18next"; import { headMakeprfmnc } from "../chkgdnReg/TableHead"; export default function PrfmncPrfmncReg() { - const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch } = useWrStore( + const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch,getPrfFmcRes } = useWrStore( (state) => state ); - const { pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc; + const { prfPbnFclts, pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc; const { regAuthrtYn, mdfcnAuthrtYn } = auth; + const [isReset, setIsReset] = useState(false); const [bdstTable, setbdstTable] = useState(); const [searchTxt, setSearchTxt] = useState(); const [isExcelOpen, setIsExcelOPen] = useState<{ @@ -51,7 +52,6 @@ export default function PrfmncPrfmncReg() { }>({ isModal: false, data: {} as FcPrfType }); const [inputData, setInputData] = useState(); const [pbnstRuseFcltId, setpbnstRuseFcltId] = useState(); - const [pageNation, setPageNation] = useState(1); const [cellNum, setCellNum] = useState(1); const [searchYear, setSearchYear] = useState( String(new Date().getFullYear()) @@ -65,20 +65,6 @@ export default function PrfmncPrfmncReg() { "A1:O1" ); }, [prfmnc.excelList]); - /* - const onSave = useCallback( - async() => { - if (pbnstRuseFcltId) { - await prfmnRegData(pageNation,'41', - excelToPbnPrfData( - inputData as unknown as JSON[], - searchYear, - pbnstRuseFcltId - ) as unknown as PrfType - ); - // cellClick(cellNum) - } - }, [inputData, searchYear, pbnstRuseFcltId, pageNation,cellNum]);*/ const { t } = useTranslation('base'); const onSave = useCallback(() => { @@ -86,19 +72,20 @@ export default function PrfmncPrfmncReg() { if (!pbnstRuseFcltId) return; prfmnRegData( - pageNation, + 1, '41', excelToPbnPrfData( inputData as unknown as JSON[], searchYear, pbnstRuseFcltId ) as unknown as PrfType - , searchYear + , searchYear, + prfPbnFclts ); }; confirmToast(t('isUpdateMsg'), handleConfirm); - }, [inputData, searchYear, pbnstRuseFcltId, pageNation, cellNum]); + }, [inputData, searchYear, pbnstRuseFcltId, cellNum,prfPbnFclts]); const cellClick = useCallback( (index: number | undefined) => { @@ -194,10 +181,15 @@ export default function PrfmncPrfmncReg() { useEffect(() => { if (!prfmnc.isInit) { - const year = new Date().getFullYear() - prfmncHasuInit(1, '41', String(year)); + getPrfFmcRes() } - }, [prfmnc.isInit, prfmncHasuInit]); + }, [prfmnc.isInit, getPrfFmcRes]); + + + useEffect(() =>{ + const year = new Date().getFullYear() + prfmncHasuInit(1, '41',String(year) ,prfPbnFclts); + },[prfPbnFclts]) useEffect(() => { @@ -254,14 +246,8 @@ export default function PrfmncPrfmncReg() {
@@ -314,10 +300,15 @@ export default function PrfmncPrfmncReg() { setCellNum(index ?? 0); }} onPageChange={ - (page) => { - prfmncHasuInit(page, '41', searchYear); - setPageNation(page) + (page:number) => { + if (searchTxt && searchTxt?.length > 0) { + prfmncHasuNmSearch(page, '41', searchYear, searchTxt,prfPbnFclts) + } else { + prfmncHasuInit(page, '41', searchYear,prfPbnFclts) + } + setIsReset(false); }} + resetPageNo={isReset} /> @@ -350,9 +341,10 @@ export default function PrfmncPrfmncReg() { setIsExcelOPen({ ...isExcelOpen, isModal: open }) }} setModalExcelData={async (excelData) => { - await prfmnRegData(pageNation, '41', + await prfmnRegData(1, '41', excelData, searchYear + ,prfPbnFclts ); // 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다. } diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index fbdd4fba6..6c2564655 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -7,16 +7,17 @@ import toast from "react-hot-toast"; const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport; const monthHeadList = monthHeadListExport; - +export const prfRegPageSize = 10; export type pbnstPrfmncState = { prfmnc: { isInit: boolean; pbnstPrfmncHeadList: TableUpperProps[]; monthHeadList: TableUpperProps[]; prfmncRes: FcPrfType[]; - prfmncResCount:number; + prfmncResCount: number; excelList: number[]; - pageKey:number + pageKey: number; + prfPbnFclts: string[]; }; }; @@ -26,68 +27,126 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = { pbnstPrfmncHeadList: pbnstPrfmncHeadList, monthHeadList: monthHeadList, prfmncRes: [], - prfmncResCount:1, + prfPbnFclts: [], + prfmncResCount: 1, excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], - pageKey:1 + pageKey: 1, }, }; export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions; type pbnstPrfmncActions = { - prfmncHasuInit: (page: number, sggOrCity: string ,year:string) => void; - prfmncHasuNmSearch: (page: number, sggOrCity: string , txt:string ,year:string) => void; - prfmnRegData: (page:number,sggOrCity:string, data: PrfType,year:string) => void; + prfmncHasuInit: ( + page: number, + sggOrCity: string, + year: string, + prfPbnFclts: string[] + ) => void; + prfmncHasuNmSearch: ( + page: number, + sggOrCity: string, + year: string, + searchTxt: string, + prfPbnFclts: string[] + ) => void; + prfmnRegData: ( + page: number, + sggOrCity: string, + data: PrfType, + year: string, + prfPbnFclts: string[] + ) => void; + getPrfFmcRes: () => void; }; -const checkWrRegList = async (year:string) => { - const url =`/reuseFc/pubDetailList` - if(year&& year.length>0){ - // url+=`/${year}` +const hasuListFetch = async ( + page: number, + sggOrCity: string, + year: string, + prfPbnFclts: string[], + searchTxt?: string +) => { + let filteredFclt = prfPbnFclts; + if (sggOrCity !== "0") { + filteredFclt = prfPbnFclts?.filter((fclt: string) => { + return sggOrCity.length == 2 + ? fclt.slice(0, 2) === sggOrCity + : fclt.slice(0, 5) === sggOrCity; + }); } - const wrRegList = await getFetch("wr", url); - return wrRegList; -}; -const hasuListFetch = async (page: number, sggOrCity: string , year:string,searchNm?:string ) => { - const checkWrRegListRes = await checkWrRegList(year); - const rainRes = await postFectch( - `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`, - checkWrRegListRes?.fcltCds, - fetchType.COMMON + + let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}/A/${sggOrCity}/0/1/SW`; + if (searchTxt && searchTxt?.length > 0) { + url += `/${searchTxt}`; + } + const rainRes = await postFectch(url, filteredFclt, fetchType.COMMON); + + const checkRuseFcltList = + searchTxt && searchTxt?.length > 0 + ? rainRes.data.map((item) => item.bscFctCd) + : filteredFclt; + + const pubRuseList = await postFectch( + `/reuseFc/pubDetailList/${year}/${sggOrCity}/${page}/${prfRegPageSize}`, + checkRuseFcltList, + fetchType.WR ); - let findData = rainRes.data.map((item: pubHasuType) => { - const data = checkWrRegListRes?.fcPrfList.find( - (fclt: FcPrfType) => - fclt.pbnstRuseFcltId.substring(0, 11) === item?.bscFctCd - ); - if(data !==undefined){ - return( { + const rusePrfList = pubRuseList.data + .map((item: FcPrfType) => { + const findData = rainRes.data?.find( + (fclt: pubHasuType) => + item.pbnstRuseFcltId.substring(0, 11) === fclt?.bscFctCd + ); + if (findData !== undefined) { + return { + sido: findData.sido, + gugun: findData.gugun, + bscFctNm: findData.bscFctNm, + bscFctCd: findData.bscFctCd, + ruseUtztnFcltNm: item.ruseUtztnFcltNm, + pbnstRuseFcltId: item.pbnstRuseFcltId, + prfList: item.prfList, + }; + } + }) + .filter(Boolean); // undefined 값을 제거합니다. - sido: item.sido, - gugun: item.gugun, - bscFctNm: item.bscFctNm, - bscFctCd: item.bscFctCd, - ruseUtztnFcltNm: data.ruseUtztnFcltNm, - pbnstRuseFcltId: data.pbnstRuseFcltId, - prfList: data.prfList, - }); - } - }).filter(Boolean); // undefined 값을 제거합니다. - - if(searchNm){ - - findData= findData.filter((ruse:any) => ruse.ruseUtztnFcltNm.includes(searchNm)) - } - - return {data:findData, count:findData.length}; + return { data: rusePrfList, count: pubRuseList.count }; }; export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( set: any ) => { return { - prfmncHasuInit: async (page: number, sggOrCity: string,year:string) => { + getPrfFmcRes: async () => { try { - const prfmncRes = await hasuListFetch(page, sggOrCity, year); + const pbnPrfRes = await getFetch(fetchType.WR, "/reuseFc/pubFc"); + console.log("pbnPrfRes ", pbnPrfRes); + set((state: pbnstPrfmncState) => ({ + ...state, + prfmnc: { + ...state.prfmnc, + prfPbnFclts: pbnPrfRes, + }, + })); + } catch (error) { + console.log(error); + } + }, + prfmncHasuInit: async ( + page: number, + sggOrCity: string, + year: string, + prfPbnFclts: string[] + ) => { + try { + console.log("prfPbnFclts ", prfPbnFclts); + const prfmncRes = await hasuListFetch( + page, + sggOrCity, + year, + prfPbnFclts + ); return set((state: pbnstPrfmncState) => ({ ...state, prfmnc: { @@ -101,9 +160,21 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( console.log(errorHasu); } }, - prfmncHasuNmSearch: async (page: number, sggOrCity: string,fcltNm:string ,year:string)=> { + prfmncHasuNmSearch: async ( + page: number, + sggOrCity: string, + year: string, + searchTxt: string, + prfPbnFclts: string[] + ) => { try { - const prfmncRes = await hasuListFetch(page, sggOrCity,fcltNm ,year); + const prfmncRes = await hasuListFetch( + page, + sggOrCity, + year, + prfPbnFclts, + searchTxt + ); return set((state: pbnstPrfmncState) => ({ ...state, prfmnc: { @@ -117,7 +188,13 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( console.log(errorHasu); } }, - prfmnRegData: async (page:number,sggOrCity:string,data: PrfType,year:string) => { + prfmnRegData: async ( + page: number, + sggOrCity: string, + data: PrfType, + year: string, + prfPbnFclts: string[] + ) => { try { const ressponse = await postFectch( "/reuseFc/pubFcPrf", @@ -125,11 +202,14 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( fetchType.WR ); - if (ressponse.status === 200) { toast.success("하수재이용 시설 실적 등록이 완료되었습니다."); - const prfmncRes = await hasuListFetch(page, sggOrCity,year) ; - + const prfmncRes = await hasuListFetch( + page, + sggOrCity, + year, + prfPbnFclts + ); return set((state: pbnstPrfmncState) => ({ ...state, @@ -138,10 +218,9 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( prfmncRes: prfmncRes.data, prfmncResCount: prfmncRes.count, isInit: false, - pageKey: state.prfmnc.pageKey + 1 + pageKey: state.prfmnc.pageKey + 1, }, })); - } } catch (e) { console.log(e); diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index 2589422c8..0fb24366a 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -488,16 +488,6 @@ export function PbnstBuseForm({ />
- {/* */}
Date: Wed, 30 Jul 2025 16:00:22 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=EB=AC=BC=EC=82=AC=EC=9A=A9=EB=9F=89=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EB=B0=8F=20null=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/pages/dashboard/facilityInfo/page.tsx | 7 +++---- apps/fo/app/store/dashboard/index.tsx | 6 +++--- apps/fo/app/store/underWaterInput/index.tsx | 3 --- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/fo/app/pages/dashboard/facilityInfo/page.tsx b/apps/fo/app/pages/dashboard/facilityInfo/page.tsx index fa6905fa2..9c16161f5 100644 --- a/apps/fo/app/pages/dashboard/facilityInfo/page.tsx +++ b/apps/fo/app/pages/dashboard/facilityInfo/page.tsx @@ -169,10 +169,9 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}: } else if (index === 8) { el['item'] = (Number(searchYear)-0).toString(); el['provisionalApproval'] = waterUsage1; - } else if(index === 4){ - el['provisionalApproval'] = Math.round((Number(waterUsage1)+Number(waterUsage2)+Number(waterUsage3))/3 * 100)/100; } }); + console.log('planFcltyList :', planFcltyList); } }, [waterUsage1, waterUsage2, waterUsage3, searchYear, planFcltyList]); // 연도가 바뀌면 hasSearched를 false로 리셋 @@ -226,8 +225,8 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}: :(index < 5 || index > 5)&& (index!= 4) && (head.id ==='provisionalApproval'||head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') ?{el[head.id]} :(head.id === "provisionalApproval" && index === 4) - ?{el[head.id]} - :((head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') && index === 4) + ?{Math.round((Number(waterUsage1)+Number(waterUsage2)+Number(waterUsage3))/3 * 100)/100} + :((head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') ) ?null :(head.id === 'item' && index != 5)? {el[head.id]} diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index a415d89b3..b23006c10 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -1232,9 +1232,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } if(operationalStatusList[0] && operationalStatusList[7]){ - operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : data.yearData.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT) * 100) * 10) / 10+'%'; - operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : data.summer.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT) * 100) * 10) / 10+'%'; - operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : data.winter.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterWinter) / Number(data.winter.AVG_INFL_AMNT) * 100) * 10) / 10+'%'; + operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : data.yearData && data.yearData.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterAvg) / (data.yearData && data.yearData.AVG_INFL_AMNT ? Number(data.yearData.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%'; + operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : data.summer && data.summer.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterSummer) / (data.summer && data.summer.AVG_INFL_AMNT ? Number(data.summer.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%'; + operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : data.winter && data.winter.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterWinter) / (data.winter && data.winter.AVG_INFL_AMNT ? Number(data.winter.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%'; operationalStatusList[7].rdi = operationalStatusList[0].rdi === null ? '' : data.summerBod && data.summerBod.INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].rdi) / (data.summerBod&&data.summerBod.INFL_AMNT&&data.summerBod.INFL_AMNT!='null'?Number(data.summerBod.INFL_AMNT):0) * 100) * 10) / 10+'%'; /* operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : Number(Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT)) * 100; operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : Number(Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT)) * 100; diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index 70964d496..589c35962 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -446,7 +446,6 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy let maxWaterUsage = 0; let minWaterUsage = 9999999999; let avgWaterUsage = 0; - console.log('monthData : ', monthData); monthData.forEach((item, index) => { item.usege = item.sum/item.cnt tableData.push({ @@ -465,8 +464,6 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy }); avgWaterUsage = tot/cnt - console.log('avgWaterUsage : ', avgWaterUsage); - console.log('tableData : ', tableData); const newData= [ { msrDt: '평균', From 886561535e4feb5a442fd74ec0f934793823106b Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 30 Jul 2025 17:57:03 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=EB=8C=80=EB=AF=BC=20=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=20=EC=A0=95=EB=B3=B4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/sdmMng/sdmApplyList/page.tsx | 26 +- .../pages/sdmMng/sdmInfoInsert/page.tsx | 282 +++--- .../pages/sdmMng/sdmInsert/page.tsx | 11 +- apps/dm/app/store/sdmMng/index.tsx | 174 +++- .../ui/common/searhDemandInput/component.tsx | 2 +- apps/dm/components/ui/common/utils/utils.ts | 18 + .../sdmInfoInsertForm/AccessibleFormField.tsx | 14 +- .../ui/sdmInfoInsertForm/component.tsx | 863 ++++++++++++------ .../components/ui/sdmLoginForm/component.tsx | 2 +- 9 files changed, 948 insertions(+), 444 deletions(-) create mode 100644 apps/dm/components/ui/common/utils/utils.ts diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx index 212eca6e7..fb81197d6 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx @@ -7,7 +7,7 @@ import ListDiv from '@common/business_components/ui/list_div'; import { useEffect, useState } from 'react'; import { Toaster } from 'react-hot-toast'; import SdmLogin from '../sdmLogin/page'; -import type { DemandCompType } from '@/app/store/sdmMng'; +import type { DemandCompBizType } from '@/app/store/sdmMng'; import TransValueFormat from '@/app/common/transValueFormat'; import { useRouter } from 'next/navigation'; @@ -31,8 +31,8 @@ export default function SdmApplyList({}: SdmApplyProps) { const {selectSidoData, selectSigunData} = Common; const [isLogin, setIsLogin] = useState(false); const [isLoginStorageInfo, setIsLoginStorageInfo] = useState(false); - const [sdmApplyDetail, setSdmApplyDetail] = useState({} as DemandCompType); - const [transformedList, setTransformedList] = useState([]); + const [sdmApplyDetail, setSdmApplyDetail] = useState({} as DemandCompBizType); + const [transformedList, setTransformedList] = useState([]); useEffect(() => { console.log('sessionStorage : ',sessionStorage.getItem('user')); @@ -60,7 +60,7 @@ export default function SdmApplyList({}: SdmApplyProps) { // 데이터 변환을 위한 별도의 useEffect useEffect(() => { if (sdmInfoStatusList.length > 0) { - const newTransformedList = sdmInfoStatusList.map((item: DemandCompType) => ({ + const newTransformedList = sdmInfoStatusList.map((item: DemandCompBizType) => ({ ...item, ctpvCd: selectSidoData.find(sido => sido.val === item.ctpvCd?.trim())?.text || '', sggCd: selectSigunData.find(sigun => sigun.val === item.sggCd?.trim())?.text || '' @@ -121,33 +121,33 @@ export default function SdmApplyList({}: SdmApplyProps) { 총대장균군수(개/100ml) - {} + {} 결합잔류염소(mg/L)​ - {} + {} 탁도(NTU) - {} + {} 생물학적 산소요구량(BOD)(mg/L) - {} + {} 냄새 {} 색도(도) - {} + {} 총질소(T-N)(mg/L) - {} + {} 총인(T-P)(mg/L)​ - {} + {} 수소이온농도(pH)​ {} 염화물(mgCL/L)​ - {} + {} 전기전도도(㎲/cm)​ - {} + {} 비고 {sdmApplyDetail?.rmrk} diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx index 33da31f12..4efc58cb5 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useDmStore } from "@/app/store"; -import type { DemandCompType } from "@/app/store/sdmMng"; +import type { DemandCompBizType } from "@/app/store/sdmMng"; import { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component"; import { UiModal } from "@common/business_components/ui/dialog_ui"; import { Button } from "@common/components/ui"; @@ -14,121 +14,99 @@ import * as z from "zod"; import SdmLogin from "../sdmLogin/page"; const sdmInfoFormSchema = z.object({ - sdmNm: z.string() - .min(1, "수요처를 선택해주세요"), + sdmNm: z.string().min(1, "수요처를 선택해주세요"), demandYmd: z.date().optional(), - demandQnty: z.string() + demandQnty: z + .string() .min(1, "요구수량을 입력해주세요") .regex(/^[0-9]+$/, "요구수량은 숫자만 입력 가능합니다"), usePurpose: z.string().optional(), - money: z.string() - .regex(/^[0-9]+$/, "희망단가는 숫자만 입력 가능합니다"), + money: z.string().regex(/^[0-9]+$/, "희망단가는 숫자만 입력 가능합니다"), /**요구수질 */ reqWaterQlty: z.string().optional(), - grssClfg: z.string() - .min(1, "총대장균군수를 입력해주세요") - .regex(/^[0-9]+$/, "총대장균군수는 숫자만 입력 가능합니다"), - tn: z.string() - .min(1, "총질소를 입력해주세요") - .regex(/^[0-9]+$/, "총질소는 숫자만 입력 가능합니다"), - combResdch: z.string() - .min(1, "결합잔류염소를 입력해주세요") - .regex(/^[0-9]+$/, "결합잔류염소는 숫자만 입력 가능합니다"), - tph: z.string() - .min(1, "총인산물을 입력해주세요") - .regex(/^[0-9]+$/, "총인산물은 숫자만 입력 가능합니다"), - trbt: z.string() - .min(1, "탁도를 입력해주세요") - .regex(/^[0-9]+$/, "탁도는 숫자만 입력 가능합니다"), - ph: z.string() - .min(1, "수소이온농도를 입력해주세요") - .regex(/^[0-9]+$/, "수소이온농도는 숫자만 입력 가능합니다"), - bod: z.string() - .min(1, "생물학적 산소요구량을 입력해주세요") - .regex(/^[0-9]+$/, "생물학적 산소요구량은 숫자만 입력 가능합니다"), + grssClfg: z.number().nullish(), + tn: z.number().nullish(), + combResdch: z.number().nullish(), + tph: z.number().nullish(), + trbt: z.number().nullish(), + ph: z.string().nullish(), + bod: z.number().nullish(), /**컬럼확인필요 */ - clIonQnt: z.string() - .min(1, "염화물을 입력해주세요") - .regex(/^[0-9]+$/, "염화물은 숫자만 입력 가능합니다"), - smll: z.string() - .min(1, "냄새를 입력해주세요") - .regex(/^[0-9]+$/, "냄새는 숫자만 입력 가능합니다"), - cdtnv: z.string() - .min(1, "전기전도도를 입력해주세요") - .regex(/^[0-9]+$/, "전기전도도는 숫자만 입력 가능합니다"), - crmty: z.string() - .min(1, "색도를 입력해주세요") - .regex(/^[0-9]+$/, "색도는 숫자만 입력 가능합니다"), + clIonQnt: z.number().nullish(), + smll: z.string(), + cdtnv: z.number().nullish(), + crmty: z.number().nullish(), rmrk: z.string().optional(), /* telno: z.string() .min(8, "전화번호는 8자 이상 입력해주세요") .max(12, "전화번호는 12자 이내로 입력해주세요") .regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), */ - candidateTitle: z.array(z.object({ - ruseUtztnFcltNm: z.string(), - ruseUtztnFcltCd: z.string(), - })).optional(), + candidateTitle: z + .array( + z.object({ + ruseUtztnFcltNm: z.string(), + ruseUtztnFcltCd: z.string(), + }) + ) + .optional(), }); export type FormData = z.infer; function SdmInfoInsertContent() { const searchParams = useSearchParams(); - const {insertSdmInfoData, Sdm ,setSubsInfo} = useDmStore((state) => state); + const { insertSdmInfoData, Sdm, setSubsInfo } = useDmStore((state) => state); const { successLogin } = Sdm; const [ismoneyDisabled, setIsmoneyDisabled] = useState(false); const formSchema = sdmInfoFormSchema; const [isLogin, setIsLogin] = useState(false); - const [facilityName, setFacilityName] = useState(''); - const [defaultValues, setDefaultValues] = useState({ - sdmNm: '', + const [facilityName, setFacilityName] = useState(""); + const [defaultValues, setDefaultValues] = useState({ + sdmNm: "", demandYmd: new Date(), - demandQnty: '', - usePurpose: '', - money: '', + demandQnty: "", + usePurpose: "", + money: "", /**요구수질 */ - reqWaterQlty: '', - grssClfg: '', - tn: '', - combResdch: '', - tph: '', - trbt: '', - ph: '', - bod: '', + reqWaterQlty: "", + grssClfg: null, + tn: null, + combResdch: null, + tph: null, + trbt: null, + ph: null, + bod: null, /**컬럼확인필요 */ - clIonQnt: '', - smll: '', - cdtnv: '', - crmty: '', - rmrk: '', + clIonQnt: null, + smll: "", + cdtnv: null, + crmty: null, + rmrk: "", /** 후보지 제목 */ candidateTitle: [ - { ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' }, - { ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' }, - { ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' }, + { ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" }, + { ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" }, + { ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" }, ], }); - - useEffect(() => { - const user = sessionStorage.getItem('user'); - setDefaultValues(prev => ({ + const user = sessionStorage.getItem("user"); + setDefaultValues((prev) => ({ ...prev, - sdmNm: searchParams.get('dmdCoNm') || '', + sdmNm: searchParams.get("dmdCoNm") || "", })); - sessionStorage.setItem('user', searchParams.get('dmdInfoId') || ''); - setIsLogin(user || searchParams.get('dmdInfoId') ? true : false); + sessionStorage.setItem("user", searchParams.get("dmdInfoId") || ""); + setIsLogin(user || searchParams.get("dmdInfoId") ? true : false); }, [searchParams]); useEffect(() => { - const local = localStorage.getItem('user'); + const local = localStorage.getItem("user"); if (local) { setIsLogin(true); } setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만) - }, [setSubsInfo]); const form = useForm({ @@ -139,99 +117,138 @@ function SdmInfoInsertContent() { const subsInfo = useDmStore((state) => state.map.subsInfo); - useEffect(()=>{ + useEffect(() => { //map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함 - if(subsInfo.length>0){ - form.setValue('candidateTitle', subsInfo) + if (subsInfo.length > 0) { + form.setValue("candidateTitle", subsInfo); } + }, [subsInfo, form]); -},[subsInfo, form]) + //후보지 팝업 값 셋팅 + useEffect(() => { + const handleMessage = (event: MessageEvent) => { + if (event.data?.type === "SET_SUBS_INFO") { + setSubsInfo(event.data.payload); // zustand로 값 설정 + } + }; -//후보지 팝업 값 셋팅 -useEffect(() => { - const handleMessage = (event: MessageEvent) => { - if (event.data?.type === 'SET_SUBS_INFO') { - setSubsInfo(event.data.payload); // zustand로 값 설정 - } - }; - - window.addEventListener('message', handleMessage); - return () => window.removeEventListener('message', handleMessage); -}, [setSubsInfo]); + window.addEventListener("message", handleMessage); + return () => window.removeEventListener("message", handleMessage); + }, [setSubsInfo]); // 로그인 성공 시 모달 닫기 및 폼 업데이트 useEffect(() => { if (successLogin) { setIsLogin(true); - const user = sessionStorage.getItem('user'); + const user = sessionStorage.getItem("user"); if (user) { try { const userData = JSON.parse(user); if (userData.dmdCoNm) { setFacilityName(userData.dmdCoNm); - form.setValue('sdmNm', userData.dmdCoNm); + form.setValue("sdmNm", userData.dmdCoNm); } - } catch (error) { - console.error('Error parsing user data:', error); + console.error("Error parsing user data:", error); } } } }, [successLogin, form]); + useEffect(() => { + console.log("Form state changed:", form.formState.errors); + }, [form.formState.errors]); + // 체크박스 상태가 변경될 때마다 money 필드의 에러를 초기화 useEffect(() => { if (ismoneyDisabled) { - form.clearErrors('money'); - form.setValue('money', ''); + form.clearErrors("money"); + form.setValue("money", ""); } }, [ismoneyDisabled, form]); -const router = useRouter(); + const router = useRouter(); const onSubmit: SubmitHandler = async (data) => { try { - // Transform form data to match API schema - const apiData: DemandCompType = { - dmdInfoId: JSON.parse(sessionStorage.getItem('user') || '{}')?.dmdInfoId?.toString() || searchParams.get('dmdInfoId') + (searchParams.get('bznmTotNo') || ''), - dmdInfoFk: JSON.parse(sessionStorage.getItem('user') || '{}')?.dmdInfoId?.toString() || searchParams.get('dmdInfoId') + (searchParams.get('bznmTotNo') || ''), - dmdCoNm: JSON.parse(sessionStorage.getItem('user') || '{}')?.dmdCoNm?.toString() || data.sdmNm, - ctpvCd: JSON.parse(sessionStorage.getItem('user') || '{}')?.ctpvCd?.toString() || searchParams.get('ctpvCd') || '', - sggCd: JSON.parse(sessionStorage.getItem('user') || '{}')?.sggCd?.toString() || searchParams.get('sggCd') || '', - daddr: JSON.parse(sessionStorage.getItem('user') || '{}')?.daddr?.toString() || searchParams.get('daddr') || '', - telno: JSON.parse(sessionStorage.getItem('user') || '{}')?.telno?.toString() || searchParams.get('telno') || '', - rgtr: JSON.parse(sessionStorage.getItem('user') || '{}')?.rgtr?.toString() || searchParams.get('rgtr') || '', - useUsgCd: data.usePurpose || '', - wntUntprc: Number(data.money) || '', + const dmSubsInfo = data.candidateTitle?.filter( + (item) => item.ruseUtztnFcltNm && item.ruseUtztnFcltCd + ); + // Transform form data to madata.candidateTitletch API schema + const apiData: DemandCompBizType = { + dmdInfoId: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.dmdInfoId?.toString() || + searchParams.get("dmdInfoId") + (searchParams.get("bznmTotNo") || ""), + dmdInfoFk: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.dmdInfoId?.toString() || + searchParams.get("dmdInfoId") + (searchParams.get("bznmTotNo") || ""), + dmdCoNm: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.dmdCoNm?.toString() || data.sdmNm, + ctpvCd: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.ctpvCd?.toString() || + searchParams.get("ctpvCd") || + "", + sggCd: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.sggCd?.toString() || + searchParams.get("sggCd") || + "", + daddr: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.daddr?.toString() || + searchParams.get("daddr") || + "", + telno: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.telno?.toString() || + searchParams.get("telno") || + "", + rgtr: + JSON.parse( + sessionStorage.getItem("user") || "{}" + )?.rgtr?.toString() || + searchParams.get("rgtr") || + "", + useUsgCd: data.usePurpose || "", + wntUntprc: Number(data.money) || "", dmndTmng: data.demandYmd || new Date(), - dmndQty: Number(data.demandQnty) || '', - grssClfg: Number(data.grssClfg) || '', - tn: Number(data.tn) || '', - combResdch: Number(data.combResdch) || '', - tph: Number(data.tph) || '', - trbt: Number(data.trbt) || '', - ph: Number(data.ph) || '', - blgcOxygDmndQnt: Number(data.bod) || '', - clIonQnt: Number(data.clIonQnt) || '', - smll: Number(data.smll) || '', - cdtnv: Number(data.cdtnv) || '', - crmty: Number(data.crmty) || '', - rmrk: data.rmrk || '', + dmndQty: Number(data.demandQnty) || "", + grssClfg: data.grssClfg === null ? -1 : Number(data.grssClfg), + tn: Number(data.tn) || null, + combResdch: Number(data.combResdch) || null, + tph: Number(data.tph) || null, + trbt: Number(data.trbt) || null, + ph: data.ph || "", + blgcOxygDmndQnt: Number(data.bod) ||null, + clIonQnt: Number(data.clIonQnt) || null, + smll: data.smll || "", + cdtnv: Number(data.cdtnv) ||null, + crmty: Number(data.crmty) || null, + rmrk: data.rmrk || "", bzmnNo: "", dmdAplyPswd: "", index: 0, reqDt: "", dmdInfoSn: 0, - status: '', - splyCndtList: data.candidateTitle || [], + status: "", + splyCndtList: dmSubsInfo || [], }; - - await insertSdmInfoData(apiData); setTimeout(() => { router.push("/"); - }, 1000); + }, 1000); // 0.8초 후 이동 } catch (error) { - console.error('Error submitting form:', error); + console.error("Error submitting form:", error); } }; @@ -254,8 +271,10 @@ const router = useRouter(); />
@@ -265,7 +284,7 @@ const router = useRouter();
- {!isLogin ? + {!isLogin ? ( } bodyClass="sm:max-w-[90vw] w-[530px] h-[430px]" @@ -278,7 +297,7 @@ const router = useRouter(); noHeaderYn="Y" noFooterYn="Y" /> - : null} + ) : null} ); @@ -291,4 +310,3 @@ export default function MyForm() { ); } - diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInsert/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInsert/page.tsx index a0aa35145..9a68510e3 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInsert/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInsert/page.tsx @@ -1,8 +1,8 @@ "use client"; import { useDmStore } from "@/app/store"; -import type { DemandCompType } from "@/app/store/sdmMng"; import SdmInsertForm from '@common/business_components/ui/sdmInsertForm'; +import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import { useRouter } from "next/navigation"; import { useCallback, useEffect, useRef } from "react"; import { Toaster } from "react-hot-toast"; @@ -44,15 +44,9 @@ export default function MyForm() { const handleInsertSdmData = useCallback((data: import('@common/business_components/ui/sdmInsertForm/form').DemandCompType) => { const convertedData: DemandCompType = { ...data, - dmdInfoSn: '', - dmdInfoFk: '', - status: '', - splyCndtList: [] }; formDataRef.current = convertedData; - insertSdmData(convertedData).catch(error => { - console.error('Error inserting SDM data:', error); - }); + insertSdmData(convertedData) }, [insertSdmData]); return ( @@ -70,4 +64,3 @@ export default function MyForm() { ); } - diff --git a/apps/dm/app/store/sdmMng/index.tsx b/apps/dm/app/store/sdmMng/index.tsx index 65fadc714..2199aa7b6 100644 --- a/apps/dm/app/store/sdmMng/index.tsx +++ b/apps/dm/app/store/sdmMng/index.tsx @@ -2,12 +2,13 @@ import type { SelectDataType } from "@common/business_components/ui"; import type { TableUpperProps } from "../common"; import toast from "react-hot-toast"; +import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; /**==================================== * Store - 타입 =====================================*/ // 수요처 정보 -export type DemandCompType = { +export type DemandCompBizType = { index : number | ''; dmdInfoId : string | ''; dmdInfoFk : string | ''; @@ -23,17 +24,17 @@ export type DemandCompType = { wntUntprc : number | ''; dmndTmng : Date | ''; dmndQty : number | ''; - grssClfg : number | ''; - tn : number | ''; - combResdch : number | ''; - tph : number | ''; - trbt : number | ''; - ph : number | ''; - blgcOxygDmndQnt : number | ''; - clIonQnt : number | ''; - smll : number | ''; - cdtnv : number | ''; - crmty : number | ''; + grssClfg : number | null //총대장균군수 + tn : number | null //총질소 + combResdch : number | null //결합잔류염소 + tph : number | null //총인 + trbt : number | null //탁도 + ph : string | ''; //수소이온농 + blgcOxygDmndQnt : number | null //생물학적산소요구량 + clIonQnt : number | null //염화물 + smll : string | ''; //냄새 + cdtnv : number | null; //전기전도도 + crmty : number | null //색도 rmrk : string | ''; reqDt : string | ''; dmdInfoSn : number | ''; @@ -152,7 +153,8 @@ export type MoneyDetailType = { clclnBrdnCst : string | ''; clclnEcqrRt : string | ''; } - +// 규칙 타입 선언 +export type DisableRulesType = Record; /**==================================== * Store - 데이터 ====================================*/ @@ -160,6 +162,131 @@ export type MoneyDetailType = { const demandCompList : DemandCompType[] = [ ] + +const disableRules: DisableRulesType = { + "청소": ["tn", 'tph',"clIonQnt" ,'cdtnv'], + "화장실용수": ["tn", 'tph',"clIonQnt" ,'cdtnv'], + "세척": ["combResdch", "crmty",'tph',"clIonQnt",'cdtnv'], + "살수": ["combResdch", "crmty",'tph',"clIonQnt",'cdtnv'], + "조경": ["combResdch", "crmty",'tph','cdtnv'], + "농업_간접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'], + "농업_직접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'], + "하천": ["combResdch", "trbt", "crmty" ,'clIonQnt','cdtnv'], + '공업':[] + }; + + const defaultRules: Record = { + "청소": { + grssClfg: null, + combResdch:0.2, + trbt: 2, + bod: 5, + crmty: 20, + ph: "5.8~8.5", + tn:null, + tph: null, + clIonQnt: null, + cdtnv: null, + + }, + "화장실용수": { + grssClfg: null, + combResdch:0.2, + trbt: 2, + bod: 5, + crmty: 20, + ph: "5.8~8.5", + tn:null, + tph: null, + clIonQnt: null, + cdtnv: null, + }, + "세척": { + grssClfg: null, + trbt: 2, + bod: 5, + ph: "5.8~8.5", + combResdch:null, + crmty:null, + tn:null, + tph: null, + clIonQnt: null, + cdtnv: null, + }, + "살수": { + grssClfg: null, + trbt: 2, + bod: 5, + ph: "5.8~8.5", + combResdch:null, + crmty:null, + tn:null, + tph: null, + clIonQnt: null, + cdtnv: null, + }, + "조경": { + grssClfg: null, + trbt: 2, + bod: 5, + ph: "5.8~8.5", + clIonQnt:250, + combResdch:null, + crmty:null, + tn:null, + tph: null, + cdtnv: null, + }, + "농업_간접용수": { + grssClfg: null, + trbt: 5, + bod: 8, + ph: "5.8~8.5", + cdtnv:2000, + combResdch:null, + crmty:null, + tn:null, + tph: null, + clIonQnt: null, + }, + "농업_직접용수": { + grssClfg: null, + trbt: 2, + bod: 8, + ph: "5.8~8.5", + cdtnv:700, + combResdch:null, + crmty:null, + tn:null, + tph: null, + clIonQnt: null, + }, + "하천": { + grssClfg: 1000, + bod: 5, + tn: 10, + tph: 0.5, + ph: "5.8~8.5", + combResdch:null, + trbt:null, + crmty:null, + clIonQnt: null, + cdtnv:null + }, + 공업:{ + grssClfg: null, + bod: null, + tn: null, + tph: null, + ph: "~", + combResdch:null, + trbt:null, + crmty:null, + clIonQnt: null, + cdtnv:null + } + }; + // 사용용도 const useTypesData : SelectDataType[] = [ { text: '청소', val: "청소" }, @@ -167,7 +294,8 @@ const useTypesData : SelectDataType[] = [ { text: "세척", val: "세척" }, { text: "살수", val: "살수" }, { text: "조경", val: "조경" }, - { text: "농업", val: "농업" }, + { text: "농업_간접용수", val: "농업_간접용수" }, + { text: "농업_직접용수", val: "농업_직접용수" }, { text: "하천", val: "하천" }, { text: "지하수", val: "지하수" }, { text: "공업", val: "공업" }, @@ -280,7 +408,7 @@ const postSdmData = async (data: DemandCompType) => { } // 수요정보 등록 -const postSdmInfoData = async (data: DemandCompType) => { +const postSdmInfoData = async (data: DemandCompBizType) => { try { await postFetch("/reuseFc/request/demandInfo", data); toast.success('수요 정보 등록에 성공하였습니다.'); @@ -360,7 +488,7 @@ const fetchGetSimilarCaseList = async (part: string, value: number|string) => { export type SdmActions = { initializeSdmData: () => void; insertSdmData: (data: DemandCompType) => Promise; - insertSdmInfoData: (data: DemandCompType) => Promise; + insertSdmInfoData: (data: DemandCompBizType) => Promise; getDemandCompList: (searchText: string, pageCnt: number) => Promise; actionLogin: (data: DemandCompType) => Promise; getSdmInfoStatusList: (dmdInfoId: string) => Promise; @@ -378,9 +506,10 @@ export type SdmType ={ moneyDetailList: MoneyDetailType[]; // 수요정보 신청현황 - sdmInfoStatusList: DemandCompType[]; + sdmInfoStatusList: DemandCompBizType[]; upHeadSdmInfoStatus: TableUpperProps[]; - + defaultRules: Record + disableRules: DisableRulesType; // 로그인관련 successNextPage : boolean; successLogin: boolean; @@ -398,7 +527,10 @@ export const SdmState: SdmType = { moneyDetailList: moneyDetailList, // 수요정보 신청현황 sdmInfoStatusList: [], + defaultRules:defaultRules, + disableRules:disableRules, upHeadSdmInfoStatus: upHeadSdmInfoStatus, + // 로그인관련 successNextPage : false, successLogin: false, @@ -428,7 +560,7 @@ export const SdmReducer = (set: any): SdmActions => { } }, - insertSdmInfoData: async (data: DemandCompType) => { + insertSdmInfoData: async (data: DemandCompBizType) => { postSdmInfoData(data); }, @@ -465,9 +597,9 @@ export const SdmReducer = (set: any): SdmActions => { })) return; } - const sdmInfoStatusList : DemandCompType[] = []; + const sdmInfoStatusList : DemandCompBizType[] = []; - res.demandInfo.map((el: DemandCompType, index: number) => { + res.demandInfo.map((el: DemandCompBizType, index: number) => { const matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn); const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청'; diff --git a/apps/dm/components/ui/common/searhDemandInput/component.tsx b/apps/dm/components/ui/common/searhDemandInput/component.tsx index 5598129a7..70ccf9efc 100644 --- a/apps/dm/components/ui/common/searhDemandInput/component.tsx +++ b/apps/dm/components/ui/common/searhDemandInput/component.tsx @@ -1,5 +1,5 @@ import { useDmStore } from '@/app/store'; -import type { DemandCompType } from '@/app/store/sdmMng'; +import type { DemandCompType } from '@common/business_components/ui/sdmInsertForm/form'; import React, { useCallback, useEffect, useRef, useState } from 'react'; type thisProps = { diff --git a/apps/dm/components/ui/common/utils/utils.ts b/apps/dm/components/ui/common/utils/utils.ts new file mode 100644 index 000000000..f66437553 --- /dev/null +++ b/apps/dm/components/ui/common/utils/utils.ts @@ -0,0 +1,18 @@ +export const sanitizeInput = (val: string, allowDecimal = false) => { + if (val === "") return ""; // 빈 값 허용 + + // 소숫점 허용 + if (allowDecimal) { + // 숫자와 점만 허용 + let cleaned = val.replace(/[^0-9.]/g, ""); + // 소숫점 여러 개일 경우 첫 번째만 유지 + const parts = cleaned.split("."); + if (parts.length > 2) { + cleaned = parts[0] + "." + parts.slice(1).join(""); + } + return cleaned; + } + + // 정수만 허용 + return val.replace(/[^0-9]/g, ""); +}; \ No newline at end of file diff --git a/apps/dm/components/ui/sdmInfoInsertForm/AccessibleFormField.tsx b/apps/dm/components/ui/sdmInfoInsertForm/AccessibleFormField.tsx index 93ec4e353..c37270df8 100644 --- a/apps/dm/components/ui/sdmInfoInsertForm/AccessibleFormField.tsx +++ b/apps/dm/components/ui/sdmInfoInsertForm/AccessibleFormField.tsx @@ -1,27 +1,29 @@ import { FormUi } from "@common/business_components/ui"; -import type { ReactNode } from "react"; import type { ControllerRenderProps, FieldError, FieldValues, Path } from "react-hook-form"; - - +import { cloneElement, isValidElement } from "react"; interface AccessibleFormFieldProps { field: ControllerRenderProps>; label: string; required?: boolean; error?: FieldError; - inputComponent: ReactNode; + isDisabled?: boolean; + inputComponent: React.ReactElement<{ disabled?: boolean }>; } export function AccessibleFormField({ label, required = false, inputComponent, + isDisabled = false, }: AccessibleFormFieldProps) { const labelText = required ? `${label} *` : label; return ( - +
- {inputComponent} + {isValidElement(inputComponent) + ? cloneElement(inputComponent, { disabled: isDisabled } as Partial) + : inputComponent} {/* {error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (

{msg} diff --git a/apps/dm/components/ui/sdmInfoInsertForm/component.tsx b/apps/dm/components/ui/sdmInfoInsertForm/component.tsx index 63638c43e..478c61ac3 100644 --- a/apps/dm/components/ui/sdmInfoInsertForm/component.tsx +++ b/apps/dm/components/ui/sdmInfoInsertForm/component.tsx @@ -11,13 +11,20 @@ import { UiModal, } from "@common/business_components"; import { Input } from "@common/components"; -import { Button } from "@common/components/ui"; +import { Button, Label } from "@common/components/ui"; import { useSearchParams } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; import { AccessibleFormField } from "./AccessibleFormField"; -import type { ControllerRenderProps, UseFormReturn, FieldError } from "react-hook-form"; +import { + type ControllerRenderProps, + type UseFormReturn, + type FieldError, + useWatch, +} from "react-hook-form"; import SearchInputText from "../common/searhDemandInput/component"; -import type { DemandCompType } from "@/app/store/sdmMng"; +import React from "react"; +import { sanitizeInput } from "../common/utils/utils"; +import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; export interface SdmInfoRegFormProps { form: UseFormReturn; @@ -35,12 +42,15 @@ export function SdmInfoRegForm({ facilityName, }: SdmInfoRegFormProps) { const { initializeCommonData, Sdm } = useDmStore((state) => state); - const { useTypesData } = Sdm; + const { useTypesData, defaultRules, disableRules } = Sdm; const searchParams = useSearchParams(); const [sdmNmValue, setSdmNmValue] = useState( searchParams.get("dmdCoNm") || "" ); + + const [frontPHdata, setFrontPHdata] = useState("0"); + const [backPHdata, setBackPHdata] = useState("0"); const [isBznmTotNoDisabled, setIsBznmTotNoDisabled] = useState(false); const [isSimilarCase, setIsSimilarCase] = useState(false); const [key, setKey] = useState(0); @@ -58,6 +68,7 @@ export function SdmInfoRegForm({ useEffect(() => { console.log("candidateTitle ", form.getValues("candidateTitle")); }, [form.getValues]); + useEffect(() => { if (useTypesData && useTypesData.length > 0) { setTimeout(() => { @@ -109,6 +120,54 @@ export function SdmInfoRegForm({ onCheckboxChange?.(checked); }; + useEffect(() => { + const watchPH = form.getValues(`ph`); + if (watchPH && watchPH !== undefined) { + const [frontPH, backPH] = watchPH.split("~"); + if (frontPH) { + setFrontPHdata(frontPH); + } + if (backPH) { + setBackPHdata(backPH); + } + } else { + setFrontPHdata("0"); + setBackPHdata("0"); + } + }, [form.getValues(`ph`)]); + + const isSetPh = useCallback( + (typePHdata: string, index: number) => { + const PHdata = form.getValues("ph"); + const isPH = PHdata?.split("~")[index] || ""; + if (index == 0) { + form.setValue("ph", `${isPH}~${typePHdata}`); + setBackPHdata(typePHdata); + } else if (index == 1) { + form.setValue("ph", `${typePHdata}~${isPH}`); + setFrontPHdata(typePHdata); + } + }, + [form] + ); + + const usePurpose = useWatch({ control: form.control, name: "usePurpose" }); + + useEffect(() => { + if (!usePurpose) return; + + // Apply default values + const defaults = defaultRules[usePurpose]; + + console.log("usePurpose", usePurpose); + console.log("defaults", defaults); + if (defaults) { + Object.entries(defaults).forEach(([field, value]) => { + form.setValue(field as keyof FormData, value, { shouldDirty: true }); + }); + } + }, [form.getValues("usePurpose")]); + // 시설 선택시 이벤트 const selectComp = useCallback( (rtnData: DemandCompType[]) => { @@ -178,7 +237,6 @@ export function SdmInfoRegForm({ required: true, component: (field) => ( ( - - ), - }, - { - name: "tn", - label: "총질소(T-N)(mg/L)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "combResdch", - label: "결합잔류염소(mg/L)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "tph", - label: "총인(T-P)(mg/L)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "trbt", - label: "탁도(NTU)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "ph", - label: "수소이온농도(pH)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "bod", - label: "생물학적 산소요구량(BOD)(mg/L)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "clIonQnt", - label: "염화물(mgCL/L)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "smll", - label: "냄새", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "cdtnv", - label: "전기전도도(㎲/cm)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "crmty", - label: "색도(도)", - formIndex: 1, - required: true, - component: (field) => ( - - ), - }, - { - name: "rmrk", - label: "비고", - formIndex: 1, - component: (field) => ( - - ), - }, + { name: "candidateTitle", label: CANDIDATE || "공급처 후보지 선택(필수아님)", @@ -466,10 +309,20 @@ export function SdmInfoRegForm({ component: () => (

- -
@@ -495,9 +348,9 @@ export function SdmInfoRegForm({ const normalFields = formFields.filter( (f) => f.formIndex === 0 && f.component ); - const groupFields = formFields.filter( - (f) => f.formIndex === 1 && f.component - ); + // const groupFields = formFields.filter( + // (f) => f.formIndex === 1 && f.component + // ); const candidateFields = formFields.filter( (f) => f.formIndex === 2 && f.component ); @@ -512,17 +365,15 @@ export function SdmInfoRegForm({ name={name} render={({ field }) => name === "money" ? ( - component(field) + // component(field) + {component(field)} ) : ( - // - // {component(field)} - // 0 && ( -
- 요구수질 -
- {groupFields.map(({ name, label, component, required }) => ( -
- ( - // - // {component?.(field)} - // - - )} - /> -
- ))} +
+ 요구수질 +
+ { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "불검출" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + {/* TODO: 총대장균군수 확인 필요*/} + {field.value !== null ? ( + + 이하 + + ) : ( + <> + )} +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const cleanValue = sanitizeInput( + e.target.value, + true + ); + field.onChange( + cleanValue === "" ? null : Number(cleanValue) + ); + }} + value={field.value ?? ""} + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이상 + +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const cleanValue = sanitizeInput( + e.target.value, + true + ); + field.onChange( + cleanValue === "" ? null : Number(cleanValue) + ); + }} + value={field.value ?? ""} + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> +
+ +
+ { + const cleanValue = sanitizeInput(e.target.value, true); + isSetPh(cleanValue, 1); + }} + value={frontPHdata ?? ""} + maxLength={5} + /> + ~ + { + const cleanValue = sanitizeInput(e.target.value, true); + isSetPh(cleanValue, 0); + }} + value={backPHdata ?? ""} + maxLength={5} + /> +
+ { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + + { + field.onChange(val.toString()); + }} + value={field.value || "불쾌하지않을것"} + readOnly={isDisabled} + onBlur={field.onBlur} + ref={field.ref} + /> + + ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> + { + const disabledFields = usePurpose ? disableRules[usePurpose] : []; + const isDisabled = disabledFields + ? disabledFields.includes(field.name) + : true; + return ( + +
+
+ { + const inputValue = e.target.value.replace( + /[^0-9]/g, + "" + ); // 정수만 + field.onChange( + inputValue === "" ? null : Number(inputValue) + ); + }} + value={ + field.value !== undefined && field.value !== null + ? `${field.value}` + : "" + } + maxLength={6} + disabled={isDisabled} + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> + + 이하 + +
+
+
+ ); + }} + /> + { + return ( + +
+
+ { + field.onChange(e.target.value); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value}` + : "" + } + onBlur={field.onBlur} + name={field.name} + ref={field.ref} + /> +
+
+
+ ); + }} + />
- )} +
{candidateFields.map(({ name, label, component, required }, index) => component ? ( @@ -581,7 +922,7 @@ export function SdmInfoRegForm({ label={label} required={required} error={ - typeof form.formState.errors[name]?.message === 'string' + typeof form.formState.errors[name]?.message === "string" ? (form.formState.errors[name] as FieldError) : undefined } diff --git a/apps/dm/components/ui/sdmLoginForm/component.tsx b/apps/dm/components/ui/sdmLoginForm/component.tsx index 204b12308..dd764844b 100644 --- a/apps/dm/components/ui/sdmLoginForm/component.tsx +++ b/apps/dm/components/ui/sdmLoginForm/component.tsx @@ -1,6 +1,6 @@ import { useDmStore } from "@/app/store"; -import type { DemandCompType } from "@/app/store/sdmMng"; import { BZNM_TOT_NO, FormField, FormUi } from "@common/business_components"; +import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import { Button, Input } from "@common/components"; import { zodResolver } from "@hookform/resolvers/zod"; import { sha512 } from 'js-sha512'; From c94b33b1b8314cbddfd31b5a52d3722a896181bc Mon Sep 17 00:00:00 2001 From: leedj312 Date: Thu, 31 Jul 2025 11:05:05 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=EB=8C=80=EB=AF=BC=20=EC=8B=A0=EC=B2=AD?= =?UTF-8?q?=ED=98=84=ED=99=A9=20=EB=A7=A4=EC=B9=AD=EB=90=9C=20=EA=B3=B5?= =?UTF-8?q?=EA=B8=89=EC=B2=98=20=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(base-layout)/pages/sdmMng/sdmApplyList/page.tsx | 12 +++++++----- apps/dm/app/store/sdmMng/index.tsx | 7 ++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx b/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx index fb81197d6..ee86a9df5 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx @@ -63,7 +63,7 @@ export default function SdmApplyList({}: SdmApplyProps) { const newTransformedList = sdmInfoStatusList.map((item: DemandCompBizType) => ({ ...item, ctpvCd: selectSidoData.find(sido => sido.val === item.ctpvCd?.trim())?.text || '', - sggCd: selectSigunData.find(sigun => sigun.val === item.sggCd?.trim())?.text || '' + sggCd: selectSigunData.find(sigun => sigun.val === item.sggCd?.trim())?.text || '', })); setTransformedList(newTransformedList); } @@ -73,6 +73,8 @@ export default function SdmApplyList({}: SdmApplyProps) { if (index !== undefined) { const selectedStatus = transformedList[index]; if (selectedStatus) { + + setSdmApplyDetail(selectedStatus); } } @@ -156,11 +158,11 @@ export default function SdmApplyList({}: SdmApplyProps) { 후보지1 - + { sdmApplyDetail?.splyCndtList?.[0]?.ruseUtztnFcltNm ?? ""} 후보지2 - + {sdmApplyDetail?.splyCndtList?.[1]?.ruseUtztnFcltNm ?? ""} 후보지3 - + {sdmApplyDetail?.splyCndtList?.[2]?.ruseUtztnFcltNm ?? ""} @@ -177,7 +179,7 @@ export default function SdmApplyList({}: SdmApplyProps) { 진행상태 {sdmApplyDetail?.status?.toString()} 공급처매칭결과 - + {sdmApplyDetail?.ruseUtztnFcltNm??''} diff --git a/apps/dm/app/store/sdmMng/index.tsx b/apps/dm/app/store/sdmMng/index.tsx index 2199aa7b6..d68a34e2f 100644 --- a/apps/dm/app/store/sdmMng/index.tsx +++ b/apps/dm/app/store/sdmMng/index.tsx @@ -40,6 +40,7 @@ export type DemandCompBizType = { dmdInfoSn : number | ''; status : string | ''; splyCndtList:SupplyCandidate[]|[], + ruseUtztnFcltNm?:string|'' } @@ -602,6 +603,8 @@ export const SdmReducer = (set: any): SdmActions => { res.demandInfo.map((el: DemandCompBizType, index: number) => { const matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn); const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청'; + const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : ''; + const tmpData = { ...el, @@ -617,7 +620,9 @@ export const SdmReducer = (set: any): SdmActions => { useUsgCd: el.useUsgCd, dmndTmng: el.dmndTmng, dmdInfoSn : el.dmdInfoSn, - status : status + status : status, + splyCndtList: el.splyCndtList, + ruseUtztnFcltNm: ruseUtztnFcltNm || '' } sdmInfoStatusList.push(tmpData); }) From 637929ea26c3f87ce942af9dd82953e7b3f9e365 Mon Sep 17 00:00:00 2001 From: yschoi Date: Thu, 31 Jul 2025 13:15:22 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/dm/app/(popup-layout)/map/popup/page.tsx | 22 ++- apps/fo/app/pages/map/page.tsx | 28 ++- apps/sn/app/(map-layout)/map/page.tsx | 2 + .../(map-layout)/map/searchBar/searchBar.tsx | 83 +++++++++ apps/wr/app/map/mainMap/page.tsx | 11 +- apps/wr/app/map/popup/page.tsx | 11 +- .../business_components/src/ui/map/Gis.js | 176 +++++------------- .../src/ui/map/GisContent.js | 121 ++++++------ .../business_components/src/ui/map/GisTab.js | 84 --------- 9 files changed, 217 insertions(+), 321 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/searchBar/searchBar.tsx delete mode 100644 packages/common/business_components/src/ui/map/GisTab.js diff --git a/apps/dm/app/(popup-layout)/map/popup/page.tsx b/apps/dm/app/(popup-layout)/map/popup/page.tsx index dc4e404ce..ea71862d8 100644 --- a/apps/dm/app/(popup-layout)/map/popup/page.tsx +++ b/apps/dm/app/(popup-layout)/map/popup/page.tsx @@ -62,10 +62,9 @@ const Map = () => { Object.keys(item).length > 0 && !prev.some((f) => f.pbnstRuseFcltId === item.pbnstRuseFcltId) ); - console.log(newItems) + console.log(newItems); return [...prev, ...newItems]; }); - } catch (error) { console.error("데이터 불러오기 실패:", error); } @@ -232,14 +231,6 @@ const Map = () => { return ( <> - { - if (hasuPk) { - setSelectDataPk(hasuPk); - } - }} - onApply={onApply} - />
{ isSearchModalOpen={isSearchModalOpen} onCheckedLayersChange={onCheckedLayersChange} imgVisble={false} + searchBar={(props: any) => ( + { + if (hasuPk) { + setSelectDataPk(hasuPk); + } + }} + onApply={onApply} + {...props} + /> + )} />
{ getArray: () => Array<{ getSource?: () => { getFeatureById?: (id: string) => FeatureData | null } }> }; + getLayers: () => { + getArray: () => Array<{ + getSource?: () => { getFeatureById?: (id: string) => FeatureData | null }; + }>; + }; getView: () => { fit: (extent: number[], options: object) => void }; } @@ -26,20 +30,20 @@ const Map = () => { const fetchData = async () => { try { - const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map` + const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map`; const reqUrl = `${API_URL}/lyrStngs/FO_NETWORK`; const response = await fetch(reqUrl, { method: "GET", headers: { accept: "application/json", - } + }, }); if (!response.ok) { throw new Error(`HTTP 오류! 상태: ${response.status}`); } - const data = await response.json(); // 여기서 json 파싱 + const data = await response.json(); // 여기서 json 파싱 setTreeData(data); // 데이터 설정 } catch (error) { console.error("데이터 불러오기 실패:", error); @@ -60,7 +64,12 @@ const Map = () => { } // 항상 같은 select 객체 사용 - const select = (GisApp.Module.select as unknown) as { resetSelectedFeature: () => void; selectFeature: (feature: FeatureData, selected: boolean) => void } | undefined; + const select = GisApp.Module.select as unknown as + | { + resetSelectedFeature: () => void; + selectFeature: (feature: FeatureData, selected: boolean) => void; + } + | undefined; if (!select) return; // 1. 기존 선택 초기화 @@ -115,9 +124,12 @@ const Map = () => { }; // onCheckedLayersChange handler - const handleCheckedLayersChange = (checkedIds: string[], checkedNodesData: unknown[]) => { + const handleCheckedLayersChange = ( + checkedIds: string[], + checkedNodesData: unknown[] + ) => { // Handle checked layers change if needed - console.log('Checked layers changed:', checkedIds, checkedNodesData); + console.log("Checked layers changed:", checkedIds, checkedNodesData); }; return ( @@ -137,6 +149,8 @@ const Map = () => { isOpen={isOpen} isSearchModalOpen={isSearchModalOpen} onCheckedLayersChange={handleCheckedLayersChange} + imgVisble={false} + searchBar={undefined} />
); diff --git a/apps/sn/app/(map-layout)/map/page.tsx b/apps/sn/app/(map-layout)/map/page.tsx index 2dbbcdd1a..40b034199 100644 --- a/apps/sn/app/(map-layout)/map/page.tsx +++ b/apps/sn/app/(map-layout)/map/page.tsx @@ -6,6 +6,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import GisApp from "@common/business_components/ui/map/lib/gis.core"; import SearchModal from "./searchModal/searchModal"; import FeatureClickEventPopup from "./featureClickEventPopup"; +import { SearchBar } from "./searchBar/searchBar"; // 타입 정의 추가 export type LyrStngProps = { @@ -130,6 +131,7 @@ const Map = () => { isOpen={isOpen} isSearchModalOpen={isSearchModalOpen} onCheckedLayersChange={undefined} + searchBar={SearchBar} />
); diff --git a/apps/sn/app/(map-layout)/map/searchBar/searchBar.tsx b/apps/sn/app/(map-layout)/map/searchBar/searchBar.tsx new file mode 100644 index 000000000..b57e66c24 --- /dev/null +++ b/apps/sn/app/(map-layout)/map/searchBar/searchBar.tsx @@ -0,0 +1,83 @@ +"use client"; +import { + SearchDiv, + SearchFormLeft, + SelectBox, + type SelectDataType, +} from "@common/business_components/ui"; +import { useCallback, useEffect, useState } from "react"; + +export function SearchBar() { + const [sidoValue, setSidoValue] = useState(""); + const [sigunValue, setSigunValue] = useState(""); + const [filteredSigunData, setFilteredSigunData] = useState([ + { text: "시도 선택", val: "0" }, + ]); + + const initializeSigunData = useCallback((sidoCd: string) => { + if (sidoCd === "0") { + setSigunValue("0"); + setFilteredSigunData([{ text: "시도 선택", val: "0" }]); + } else { + const newFilteredData = [ + { text: "데이터", val: "0" }, + // ...Common.selectSigunData.filter( + // (item: SelectDataType) => item.val.substring(0, 2) === sidoCd, + // ), + ]; + setSigunValue("0"); + setFilteredSigunData(newFilteredData); + } + }, []); + const onSelectValue = useCallback( + (val: string, type: string) => { + switch (type) { + case "ctpvCd": + initializeSigunData(val); + setSidoValue(val); + break; + case "sggCd": + setSigunValue(val); + } + }, + [initializeSigunData], + ); + + return ( + <> +
+
+
+
+ onSelectValue(val.toString(), "ctpvCd")} + value={sidoValue || /* Common.selectSidoData[0]?.val || */ ""} + /> + onSelectValue(val.toString(), "sggCd")} + value={sigunValue} + /> + onSelectValue(val.toString(), "sggCd")} + value={sigunValue} + /> +
+
+
+
+ + ); +} diff --git a/apps/wr/app/map/mainMap/page.tsx b/apps/wr/app/map/mainMap/page.tsx index 1e9afd74b..1f466f1cd 100644 --- a/apps/wr/app/map/mainMap/page.tsx +++ b/apps/wr/app/map/mainMap/page.tsx @@ -136,16 +136,6 @@ const Map = () => { gisMaps={gisMaps} isMiniMap={false} searchView={undefined} - // searchView={(props: any) => ( - // - // ) - // } detailView={(props: any) => ( { isSearchModalOpen={isSearchModalOpen} onCheckedLayersChange={handleCheckedLayersChange} imgVisble={true} + searchBar={undefined} />
); diff --git a/apps/wr/app/map/popup/page.tsx b/apps/wr/app/map/popup/page.tsx index 80830aa90..56ec8863b 100644 --- a/apps/wr/app/map/popup/page.tsx +++ b/apps/wr/app/map/popup/page.tsx @@ -123,16 +123,6 @@ const Map = () => { gisMaps={gisMaps} isMiniMap={false} searchView={undefined} - // searchView={(props: any) => ( - // - // ) - // } detailView={(props: any) =>( { isSearchModalOpen={isSearchModalOpen} onCheckedLayersChange={handleCheckedLayersChange} imgVisble={true} + searchBar={undefined} />
); diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index f73b428c5..eefb08da6 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -98,7 +98,8 @@ function Gis({ detailView: DetailView, onFeatureSelect, setIsSearchModalOpen, - onCheckedLayersChange + onCheckedLayersChange, + searchBar: SearchBar }) { const mapRef = useRef(); const [mapObject, setMapObject] = useState({}); @@ -127,102 +128,7 @@ function Gis({ // Feature Click Event const handleFeatureSelect = useCallback((data) => { - console.log(data); - // gisMap = mapInstanceRef.current; - // gisMap = mapInstanceRef.current; - - // if (!gisMap) { - // console.warn('지도가 초기화되지 않았습니다.'); - // return; - // } - // if (!gisMap) { - // console.warn('지도가 초기화되지 않았습니다.'); - // return; - // } - - // // 항상 같은 select 객체 사용 - // const select = GisApp.Module.select; - // if (!select) return; - // // 항상 같은 select 객체 사용 - // const select = GisApp.Module.select; - // if (!select) return; - - // // 1. 기존 선택 초기화 - // select.resetSelectedFeature(); - - // // 2. data가 OpenLayers Feature 인스턴스인지 확인 - // let foundFeature = null; - // if (data && typeof data.getGeometry === 'function' && typeof data.setStyle === 'function') { - // // 이미 Feature 인스턴스라면 그대로 사용 - // foundFeature = data; - // } else { - // // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용 - // let featureId = data.fid; - // const layerName = layerNmRef.current - // if (layerName === '하수재이용시설') { - // featureId = data.searchPk; - // } else if (layerName === '빗물이용시설' || layerName == '중수도시설') { - // featureId = data.bdstInfoSn; - // } else if (layerName === '하수처리시설') { - // featureId = data.bscFctCd; - // } else if (layerName === '온배수시설') { - // featureId = data.bdstRuseFcltSn; - // } else if(layerName == '수요처'){ - // featureId = data.dmdInfoId.replaceAll('-','') - // } - // else { - // console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm); - // featureId = data.fid || data.id || data.ftrIdn; - // } - // // gisMap.getLayers().getArray().forEach(layer => { - // // const source = layer.getSource?.(); - // // if (source?.getFeatureById) { - // // const feature = source.getFeatureById(String(featureId).trim()); - // // if (feature) foundFeature = feature; - // // } - // // }); - // // const [layerType, id] = String(featureId).split('.'); - // gisMap.getLayers().getArray().forEach(layer => { - // const source = layer.getSource?.(); - // if (source?.getFeatures) { - // const allFeatures = source.getFeatures(); - // for (const f of allFeatures) { - // const id = String(f.getId()); - // // console.log('id', id, featureId) - // if (id && id.split('.')[1] === String(featureId)) { - // foundFeature = f; - // break; - // } - // } - // } - // }); - // } - - // // 3. 피처 선택 - // if (foundFeature) { - // let geometry = foundFeature.getGeometry(); - // if (geometry) { - // let extent = geometry.getExtent(); - - // gisMap.getView().fit(extent, { - // duration: 300, - // padding: [50, 50, 50, 50], - // maxZoom: 16, - // constrainResolution: true, - // nearest: true, - // }); - // } - // select.selectFeature(foundFeature, true); - // } else { - // console.warn('OpenLayers Feature를 찾을 수 없습니다:', data); - // } - - // setFeatureData(data); - // setIsOpen(true); - // setIsSearchModalOpen(false); - onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출 - console.log(data) }, [mapInstanceRef]); // 지도 생성 및 초기화 @@ -347,44 +253,48 @@ function Gis({ <>
-
- { - layerNmRef.current = layerNm - setLayerNm(layerNm); setIsOpen(true); const dummyFeature = { - getProperties: () => ({}), // 최소 구조 - }; - onFeatureSelect(dummyFeature); - }} - imageVisible={imgVisble} - /> - - {/* */} - - {/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} - {isOpen && !isSearchModalOpen && ( - ({}) }} - seletectedLayerNm={layerNm} - onClose={closePopup} // 닫기 콜백 전달 - onFeatureSelect={handleFeatureSelect} +
+ { + layerNmRef.current = layerNm + setLayerNm(layerNm); setIsOpen(true); const dummyFeature = { + getProperties: () => ({}), // 최소 구조 + }; + onFeatureSelect(dummyFeature); + }} + imageVisible={imgVisble} /> - )} - {/* SearchView가 존재할 때만 렌더링 */} - {SearchView && ( - - )} - {/* */} - - - + + {/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} + {isOpen && !isSearchModalOpen && ( + ({}) }} + seletectedLayerNm={layerNm} + onClose={closePopup} // 닫기 콜백 전달 + onFeatureSelect={handleFeatureSelect} + /> + )} + {/* SearchView가 존재할 때만 렌더링 */} + {SearchView && ( + + )} + {/* 시도/시군구 조회 영역 */} + {SearchBar && ( +
+ +
+ )} + + + +
{isSearch && ( diff --git a/packages/common/business_components/src/ui/map/GisContent.js b/packages/common/business_components/src/ui/map/GisContent.js index d2594ba95..45b44c882 100644 --- a/packages/common/business_components/src/ui/map/GisContent.js +++ b/packages/common/business_components/src/ui/map/GisContent.js @@ -1,74 +1,61 @@ -import { Search } from 'lucide-react'; -import { useCallback, useEffect, useRef, useState } from 'react'; -import { useGisContext } from './Gis'; -import './lib/css/gis.edit.css'; -import GisApp from './lib/gis.core'; +import { Search } from "lucide-react"; +import { useCallback, useEffect, useRef, useState } from "react"; +import { useGisContext } from "./Gis"; +import "./lib/css/gis.edit.css"; +import GisApp from "./lib/gis.core"; -export default function GisContent({ edit = false, onFeatureSelect, isSearch, setIsSearchModalOpen }) { - const { gisMap, gisCore } = useGisContext(); - const [visibleComponents, setVisibleComponents] = useState({}); - const addressResultLayer = useRef(null); - const [playShow, setPlayShow] = useState({ show: false }); +export default function GisContent({ + edit = false, + onFeatureSelect, + isSearch, + setIsSearchModalOpen, +}) { + const { gisMap, gisCore } = useGisContext(); - //셀렉트 버튼 이벤트 - // const clickFeature = useCallback(feature => { - // if (feature) { - // const layer = feature.getLayer(); - // setVisibleComponents(prevState => ({ - // ...prevState, - // })); - // } - // }, []); + //셀렉트 버튼 이벤트 + const selectRslt = useCallback((feature) => { + GisApp.Module.layer.highLightFeature( + [feature], + { + id: GisApp.hlLayerId, + zIndex: 10, + opacity: 1, + selectable: true, + }, + { width: 30 }, + ); + clickFeature(feature); + }, []); - const selectRslt = useCallback(feature => { - GisApp.Module.layer.highLightFeature( - [feature], - { - id: GisApp.hlLayerId, - zIndex: 10, - opacity: 1, - selectable: true, - }, - { width: 30 } - ); - clickFeature(feature); - }, []); + useEffect(() => { + if (gisMap) { + setVisibleComponents((prevState) => ({ + ...prevState, + })); + } + }, [gisMap]); - useEffect(() => { - if (gisMap) { - setVisibleComponents(prevState => ({ - ...prevState, - })); - } - }, [gisMap]); + if (!gisMap) return null; - if (!gisMap) return null; + return ( + <> + + + + + - return ( - <> - {/**/} - {/* - - */} - {/* */} - - {/* 검색 모달 */} - {isSearch && ( -
- -
- )} - - ); + {/* 검색 모달 */} + {isSearch && ( +
+ +
+ )} + + ); } diff --git a/packages/common/business_components/src/ui/map/GisTab.js b/packages/common/business_components/src/ui/map/GisTab.js deleted file mode 100644 index 57d8a48e8..000000000 --- a/packages/common/business_components/src/ui/map/GisTab.js +++ /dev/null @@ -1,84 +0,0 @@ -// import React, { useState } from 'react'; -// import { Tabs, TabsList, TabsTrigger } from '@common/components/ui/tabs'; -// import GisTree from './GisTree'; -// import GisSearch from './GisSearch'; -// import { ChevronLeft, ChevronRight, Search } from 'lucide-react'; -// import SearchModal from '@/map/SearchModal'; - - -// function GisTab({ visible, setVisible, isSearch, isSearchModalOpen, setIsSearchModalOpen, onFeatureSelect }) { -// const [activeTab, setActiveTab] = useState('layers'); - -// return ( -// <> -//
-// -// -// 레이어 -// {/* {isSearch && ( -// -// // -// // -// // -// )} */} -// - -// {/* GisTree는 항상 마운트되며, 탭 상태에 따라 보여주기만 함 */} -//
-// -//
- -// {/* GisSearch도 동일하게 처리 */} -// {/* {isSearch && ( -//
-// -//
-// )} */} - - -// {/* 🔍 검색 모달 */} -// {/* */} -//
- -// {/* 접기 버튼 */} -// -//
- -// {/* 열기 버튼 */} -// {!visible && ( -// -// )} -// -// ); -// } - -// export default React.memo(GisTab); From 5712bcedaac74eabc4c4d70e8abf189254a15499 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 31 Jul 2025 13:38:27 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=EC=9B=90=EC=95=A4=EC=98=AC=20DB=EB=B0=94?= =?UTF-8?q?=EB=9D=BC=EB=B3=B4=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/src/shared/config/env.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/fo/src/shared/config/env.ts b/apps/fo/src/shared/config/env.ts index 8baf1b0f0..cc516daf1 100644 --- a/apps/fo/src/shared/config/env.ts +++ b/apps/fo/src/shared/config/env.ts @@ -2,7 +2,8 @@ export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "FO"; export const PORT = process.env.NEXT_PUBLIC_PORT || "3000"; export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1'; -export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1'; +//export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1'; +export const SERVER_API_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1'; export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000'; export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; export const ACCESS_TOKEN = process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token";