diff --git a/apps/wr/.env.development b/apps/wr/.env.development index ceaf190df..d3ec10727 100644 --- a/apps/wr/.env.development +++ b/apps/wr/.env.development @@ -27,3 +27,5 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do +NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM= diff --git a/apps/wr/.env.local b/apps/wr/.env.local index 4d8937ea6..547195433 100644 --- a/apps/wr/.env.local +++ b/apps/wr/.env.local @@ -16,6 +16,12 @@ NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g + + +NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do +NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM= + + NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 diff --git a/apps/wr/.env.production b/apps/wr/.env.production index 4a0754665..295ba7ea9 100644 --- a/apps/wr/.env.production +++ b/apps/wr/.env.production @@ -16,6 +16,9 @@ NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BE NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api +NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do +NEXT_PUBLIC_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA= + diff --git a/apps/wr/app/store/common/code/basicCode.tsx b/apps/wr/app/store/common/code/basicCode.tsx index aa5d1152e..8af04c59f 100644 --- a/apps/wr/app/store/common/code/basicCode.tsx +++ b/apps/wr/app/store/common/code/basicCode.tsx @@ -52,7 +52,7 @@ export const ruseBizMthdCd: SelectDataType[] = [ { val: "자체", text: "자체" }, ]; -//공통 건축물 용도 +// 공통 건축물 용도 export const bdstUsgCd: SelectDataType[] = [ { val: "-1", text: "확인불가" }, { val: "1", text: "운동장" }, @@ -71,67 +71,67 @@ export const bdstUsgCd: SelectDataType[] = [ { val: "14", text: "골프장" }, { val: "15", text: "대규모점포" }, { val: "16", text: "기타" }, - { text: "숙박업", val: "17" }, - { text: "목욕장업", val: "18" }, - { text: "공장", val: "19" }, - { text: "발전시설", val: "20" }, - { text: "관광단지개발사업", val: "21" }, - { text: "도시개발사업", val: "22" }, - { text: "산업단지개발사업", val: "23" }, - { text: "택지개발사업", val: "24" }, - { text: "대규모점포(대형마트)", val: "25" }, - { text: "대규모점포(전문점)", val: "26" }, - { text: "대규모점포(백화점)", val: "27" }, - { text: "대규모점포(쇼핑센터)", val: "28" }, - { text: "대규모점포(복합쇼핑몰)", val: "29" }, - { text: "물류시설", val: "30" }, - { text: "운수시설(여객자동차터미널)", val: "31" }, - { text: "운수시설(철도시설)", val: "32" }, - { text: "운수시설(공항시설)", val: "33" }, - { text: "운수시설(항만시설)", val: "34" }, - { text: "업무시설(공공업무시설)", val: "35" }, - { text: "업무시설(금융업소)", val: "36" }, - { text: "업무시설(사무소)", val: "37" }, - { text: "업무시설(결혼상담소 등 소개업소)", val: "38" }, - { text: "업무시설(출판사)", val: "39" }, - { text: "업무시설(신문사)", val: "40" }, - { text: "업무시설(오피스텔)", val: "41" }, - { text: "교정시설", val: "42" }, - { text: "방송국", val: "43" }, - { text: "전신전화국", val: "44" }, - { text: "기타", val: "45" }, + { val: "17", text: "숙박업" }, + { val: "18", text: "목욕장업" }, + { val: "19", text: "공장" }, + { val: "20", text: "발전시설" }, + { val: "21", text: "관광단지개발사업" }, + { val: "22", text: "도시개발사업" }, + { val: "23", text: "산업단지개발사업" }, + { val: "24", text: "택지개발사업" }, + { val: "25", text: "대규모점포(대형마트)" }, + { val: "26", text: "대규모점포(전문점)" }, + { val: "27", text: "대규모점포(백화점)" }, + { val: "28", text: "대규모점포(쇼핑센터)" }, + { val: "29", text: "대규모점포(복합쇼핑몰)" }, + { val: "30", text: "물류시설" }, + { val: "31", text: "운수시설(여객자동차터미널)" }, + { val: "32", text: "운수시설(철도시설)" }, + { val: "33", text: "운수시설(공항시설)" }, + { val: "34", text: "운수시설(항만시설)" }, + { val: "35", text: "업무시설(공공업무시설)" }, + { val: "36", text: "업무시설(금융업소)" }, + { val: "37", text: "업무시설(사무소)" }, + { val: "38", text: "업무시설(결혼상담소 등 소개업소)" }, + { val: "39", text: "업무시설(출판사)" }, + { val: "40", text: "업무시설(신문사)" }, + { val: "41", text: "업무시설(오피스텔)" }, + { val: "42", text: "교정시설" }, + { val: "43", text: "방송국" }, + { val: "44", text: "전신전화국" }, + { val: "45", text: "기타" }, ]; export const rswtBdstType: SelectDataType[] = [ - { text: "숙박업", val: "17" }, - { text: "목욕장업", val: "18" }, - { text: "공장", val: "19" }, - { text: "발전시설", val: "20" }, - { text: "관광단지개발사업", val: "21" }, - { text: "도시개발사업", val: "22" }, - { text: "산업단지개발사업", val: "23" }, - { text: "택지개발사업", val: "24" }, - { text: "대규모점포(대형마트)", val: "25" }, - { text: "대규모점포(전문점)", val: "26" }, - { text: "대규모점포(백화점)", val: "27" }, - { text: "대규모점포(쇼핑센터)", val: "28" }, - { text: "대규모점포(복합쇼핑몰)", val: "29" }, - { text: "물류시설", val: "30" }, - { text: "운수시설(여객자동차터미널)", val: "31" }, - { text: "운수시설(철도시설)", val: "32" }, - { text: "운수시설(공항시설)", val: "33" }, - { text: "운수시설(항만시설)", val: "34" }, - { text: "업무시설(공공업무시설)", val: "35" }, - { text: "업무시설(금융업소)", val: "36" }, - { text: "업무시설(사무소)", val: "37" }, - { text: "업무시설(결혼상담소 등 소개업소)", val: "38" }, - { text: "업무시설(출판사)", val: "39" }, - { text: "업무시설(신문사)", val: "40" }, - { text: "업무시설(오피스텔)", val: "41" }, - { text: "교정시설", val: "42" }, - { text: "방송국", val: "43" }, - { text: "전신전화국", val: "44" }, - { text: "기타", val: "45" }, + { val: "17", text: "숙박업" }, + { val: "18", text: "목욕장업" }, + { val: "19", text: "공장" }, + { val: "20", text: "발전시설" }, + { val: "21", text: "관광단지개발사업" }, + { val: "22", text: "도시개발사업" }, + { val: "23", text: "산업단지개발사업" }, + { val: "24", text: "택지개발사업" }, + { val: "25", text: "대규모점포(대형마트)" }, + { val: "26", text: "대규모점포(전문점)" }, + { val: "27", text: "대규모점포(백화점)" }, + { val: "28", text: "대규모점포(쇼핑센터)" }, + { val: "29", text: "대규모점포(복합쇼핑몰)" }, + { val: "30", text: "물류시설" }, + { val: "31", text: "운수시설(여객자동차터미널)" }, + { val: "32", text: "운수시설(철도시설)" }, + { val: "33", text: "운수시설(공항시설)" }, + { val: "34", text: "운수시설(항만시설)" }, + { val: "35", text: "업무시설(공공업무시설)" }, + { val: "36", text: "업무시설(금융업소)" }, + { val: "37", text: "업무시설(사무소)" }, + { val: "38", text: "업무시설(결혼상담소 등 소개업소)" }, + { val: "39", text: "업무시설(출판사)" }, + { val: "40", text: "업무시설(신문사)" }, + { val: "41", text: "업무시설(오피스텔)" }, + { val: "42", text: "교정시설" }, + { val: "43", text: "방송국" }, + { val: "44", text: "전신전화국" }, + { val: "45", text: "기타" }, ]; export const orgwtKndCd = [ @@ -186,6 +186,7 @@ export const pplLenght = [ ]; export const rainFcltCd = [ + { val: "10", text: "확인불가" }, { val: "01", text: "지붕" }, { val: "02", text: "건물옥상" }, { val: "03", text: "골프장 연못" }, @@ -195,7 +196,6 @@ export const rainFcltCd = [ { val: "07", text: "태양광패널" }, { val: "08", text: "연못" }, { val: "09", text: "기타" }, - { val: "10", text: "확인불가" }, ]; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index add7030fa..28888d042 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -17,15 +17,15 @@ const hdtflObjSchema = z.object({ .string() .min(1, { message: validationMessages.required("에너지원 종류") }), fclCpct: z - .number() - .positive({ message: validationMessages.required("시설 용량") }), + .number().nullish(), + //.positive({ message: validationMessages.required("시설 용량") }), plwtYn: z.enum(["Y", "N"]).default("Y"), orgwtWtritSpt: z - .string() - .min(1, { message: validationMessages.required("원수 취수 지점") }), + .string().nullish(), + // .min(1, { message: validationMessages.required("원수 취수 지점") }), orgwtOcrnProcs: z - .string() - .min(1, { message: validationMessages.required("원수 발생 공정") }), + .string().nullish(), + // .min(1, { message: validationMessages.required("원수 발생 공정") }), wtritEntrcTp: z .number() .max(100, { message: "온도는 100이상이 될 수 없습니다." }) @@ -33,12 +33,12 @@ const hdtflObjSchema = z.object({ amtgnr: z.number().default(0), prcsProcsYn: z.enum(["Y", "N"]).default("Y"), prcsFcltCpct: z - .number() - .positive({ message: validationMessages.required("처리시설 용량") }), + .number().nullish(), + // .positive({ message: validationMessages.required("처리시설 용량") }), fmYn: z.string().default(""), utztnCpct: z - .number() - .positive({ message: validationMessages.required("이용 용량") }), + .number().nullish(), + // .positive({ message: validationMessages.required("이용 용량") }), utztnUsg: z .string() .min(1, { message: validationMessages.required("이용 용도") }), diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx index 011d29da4..4bf891d87 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx @@ -19,14 +19,9 @@ export const baseReuseBuildingSchema = z.object({ instlCstSprtYn: z.string().default("Y"), instlCstSprtAmt: z.number().nullish(), grntchBdstCertYn: z.string().default("Y"), - grntchBdstCertYr: z - .string() - .max(4, { message: validationMessages.yearFormat }) - .refine( - (year) => year.length === 0 || /^\d{4}$/.test(year), - { - message: validationMessages.yearFormat, - } + grntchBdstCertYr: z.string().refine( + (val) => val === "" || /^\d{4}$/.test(val), + { message: "연도는 빈값 또는 4자리 숫자여야 합니다." } ), grntchBdstCertNo: z.string().default(""), grntchBdstCertGrd: z.string().default(""), @@ -59,7 +54,7 @@ export const chgBuildingSchema = z.object({ export const htdflReuseBuildingSchema = z.object({ bdstRuseFcltSn: z.number().nullish(), bdstInfoSn: z.number().nullish(), - instlCmptnDt: z.coerce.date().default(() => new Date()), + //instlCmptnDt: z.coerce.date().default(() => new Date()), instlCst: z.number().nullish(), operMngCd: z.string().optional().nullish(), anlOperCst: z.number().default(0), diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 7ef9bf0d9..02ea00b19 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -14,7 +14,7 @@ const rswtrObjSchema = z.object({ //wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), //oblgTrgtWtrUsqty: z.number().nullish().default(0), orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }), - filtrTrtmfctCpct: z.number({ required_error: validationMessages.required("처리시설 용량") }), + filtrTrtmfctCpct: z.number().nullish(), filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }), filtrTrtmfctUsgCd: z.string().default("").nullish(), rswtrUsqty: z.number().default(0), diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 90ca4e0f5..0b7be34fa 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -21,7 +21,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { const { userSiSggCd } = code; const [useCityCd, setUserCityCd] = useState([]); const [useSggCd, setUserSggCd] = useState([]); - + const [initDaddr, setInitDaddr] = useState(); useEffect(() => { if (userSiSggCd.length === 2 && code.cityCd.length > 0) { @@ -56,6 +56,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { form.setValue("ctpvCd", Number(city[0]?.val)); form.setValue("sggCd", Number(sgg[0]?.val)); } + }, [form, userSiSggCd, code.cityCd, code.sggCd]); @@ -67,9 +68,16 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { return () => subscription?.unsubscribe(); }, [form.form]); + // useEffect(() => { + // console.log("form ", form.watch()); + // }, [form.formState]); + + useEffect(() => { - console.log("form.formState ", form.watch("archArea")); - }, [form.formState]); + const bdstInfoSn = form.getValues("bdstInfoSn"); + if(bdstInfoSn&&bdstInfoSn>0) + setInitDaddr(form.getValues("daddr")); + }, [form.getValues("bdstInfoSn")]); return ( <> @@ -166,7 +174,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { /> */}
{ console.log("rtnData", rtnData); field.onChange(rtnData.roadAddrPart1); diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index dc2c16242..c17dfda04 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -78,6 +78,10 @@ export default function HtdflRegForm({ }; const cleanHtdflData = (raw: any): z.infer => { + const buildings = + raw?.reuseBuilding && raw.reuseBuilding.length > 0 + ? raw.reuseBuilding + : [{}]; return { ...raw, frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), @@ -92,7 +96,7 @@ export default function HtdflRegForm({ : new Date(item?.archChgPrmsnDt), bdstChgNm: item?.bdstChgNm ?? "", // null → "" })), - reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + reuseBuilding:buildings.map((item: any) => ({ ...item, instlCmptnDt: new Date(item?.instlCmptnDt), htdflObj: { diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 09acc46e8..fbcae44b0 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -84,13 +84,14 @@ export default function RainRegForm({ typeof item?.grntchBdstCertYr === "string" ? item?.grntchBdstCertYr : "", // null → "" + bdstUsgCd: item?.bdstUsgCd ?? Number("-1"), // null → "-1" instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" - grntchBdstCertYn: item?.grntchBdstCertYn ?? "Y", + grntchBdstCertYn: item?.grntchBdstCertYn ?? "D", rainyObj: { ...item?.rainyObj, - pntfColKnd:item.rainyObj?.pntfColKnd??'확인불가', + pntfColKnd:item.rainyObj?.pntfColKnd??rainFcltCd[0]?.val??'', filtrTrtmfctPrs:item.rainyObj?.filtrTrtmfctPrs??'', - filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", + filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "D", }, })), }; @@ -98,7 +99,7 @@ export default function RainRegForm({ useEffect(() => { if (grntchBdstCertYn === "N") { - form.setValue("reuseBuilding.0.grntchBdstCertYr", ""); + form.setValue("reuseBuilding.0.grntchBdstCertYr", ''); form.setValue("reuseBuilding.0.grntchBdstCertNo", ""); form.setValue("reuseBuilding.0.grntchBdstCertGrd", ""); } else if (instlCstSprtYn === "N") { @@ -298,7 +299,10 @@ export default function RainRegForm({ selectClass={selectClass} label={""} selectArray={rainFcltCd} - onSelectValue={readonly ? () => { } : field.onChange} + onSelectValue={ (item) =>{ + if(readonly) return; + field.onChange(item) + } } value={field.value ?? rainFcltCd[0]?.val} readOnly={readonly} /> @@ -521,8 +525,7 @@ export default function RainRegForm({ control={form.control} name="reuseBuilding.0.grntchBdstCertYr" render={({ field }) => { - const isUnknown = - field.value === null || field.value === "0000"; // 또는 Number(value) === -1 + const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1 return ( { if (readonly) return; if (e.target.value === "확인불가") { diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index 5ae5cd264..82aa0227c 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -83,8 +83,10 @@ export default function RswtrRegForm({ const filtrTrtmfctCpct = form.watch('reuseBuilding.0.rswtrObj.filtrTrtmfctCpct') const cleanRswtData = (raw: any): z.infer => { - - console.log('raw ', raw) + const buildings = + raw?.reuseBuilding && raw.reuseBuilding.length > 0 + ? raw.reuseBuilding + : [{}]; return { ...raw, frstArchPrmsnDt: raw?.frstArchPrmsnDt @@ -93,14 +95,15 @@ export default function RswtrRegForm({ archChgPrmsnDt: raw?.archChgPrmsnDt ? new Date(raw?.archChgPrmsnDt) : null, - reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + reuseBuilding:buildings.map((item: any) => ({ ...item, instlCmptnDt: item?.instlCmptnDt ? new Date(item.instlCmptnDt) : new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화 operMngCd: item?.operMngCd || "", // null → "" - instlCstSprtYn: item?.instlCstSprtYn || code.yn[0]?.val, // null → "Y" - grntchBdstCertYn: item?.grntchBdstCertYn || code.yn[0]?.val, + instlCstSprtYn: item?.instlCstSprtYn || 'N', // null → "Y" + grntchBdstCertYn: item?.grntchBdstCertYn ||'N', + bdstUsgCd: item?.bdstUsgCd ?? Number("-1"), // null → "-1" rswtrObj: { ...item?.rswtrObj, filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn || code.yn[0]?.val, @@ -145,6 +148,9 @@ export default function RswtrRegForm({ if (rswtZod) form.reset(cleanRswtData(rswtForm)); }, [rswtForm, form]); + + + return (
@@ -291,7 +297,7 @@ export default function RswtrRegForm({ selectClass={selectClass} selectArray={code.orgwtKndCd} onSelectValue={readonly ? () => { } : field.onChange} - value={field.value || code.orgwtKndCd[0]?.val} + value={field.value ?? code.orgwtKndCd[0]?.val} readOnly={readonly} /> diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 31f9f2d16..a692553af 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -49,8 +49,8 @@ export function BdstReg({ const { userSiSggCd } = code; - const [bdstTable, setbdstTable] = useState(); - const [rainBdstForm, setRainBdstForm] = useState( + const [bdstTable, setBdstTable] = useState(); + const [bdstForm, setBdstForm] = useState( {} as BdstTypeMap[T] ); const [searchTxt, setSearchTxt] = useState(); @@ -83,7 +83,7 @@ export function BdstReg({ archArea: archArea, }; }); - setbdstTable(tableData(bdstData, { code })); + setBdstTable(tableData(bdstData, { code })); } }, [bdst]); @@ -118,13 +118,13 @@ export function BdstReg({ if (val !== undefined && bdst?.bdstBase.length > 0) { const data: BdstTypeMap[T] = bdst?.bdstBase[val]; if (data) { - setRainBdstForm(data); + setBdstForm(data); } } }; useEffect(() => { - setbdstTable([]); // 초기화 작업 + setBdstTable([]); // 초기화 작업 }, []); return ( <> @@ -200,13 +200,13 @@ export function BdstReg({
{moType === "RNB" ? ( ) : moType === "RST" ? ( { if (setIsModal && open) { @@ -216,7 +216,7 @@ export function BdstReg({ > ) : ( { if (setIsModal && open) { diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx index 18c065ee2..0f919a603 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx @@ -8,7 +8,7 @@ import { } from "@/components/lib/func/commom"; import { - DatePicker, + // DatePicker, FormField, FormUi, SelectBox, @@ -24,6 +24,7 @@ import { TableHeader, TableRow, } from "@common/components/ui"; +import moment from "moment"; import React from "react"; type RuseMngTableProps = { @@ -49,14 +50,17 @@ const RuseMngTableForm = React.forwardRef( form, formNm, indexBiz, - readonly= false + readonly = false, }, ref ) => { return ( <> - +
{upHeadList ? ( headMakeprfmnc(headList, upHeadList) @@ -76,20 +80,20 @@ const RuseMngTableForm = React.forwardRef( {tableData.map((item, i) => ( - + {headList.map((head, j) => ( { }} + onClick={() => {}} > = 0 && - typeof indexBiz === "number" && - indexBiz >= 0 + indexMng >= 0 && + typeof indexBiz === "number" && + indexBiz >= 0 ? `items.${indexMng}.fcBizs.${indexBiz}.${formNm}.${i}.${head.id}` : typeof indexMng === "number" && indexMng >= 0 ? `items.${indexMng}.${formNm}.${i}.${head.id}` @@ -99,7 +103,7 @@ const RuseMngTableForm = React.forwardRef( {head.edit === true ? ( { if (head.type === "number") { @@ -113,8 +117,10 @@ const RuseMngTableForm = React.forwardRef( ? formatCommaNumber(field.value) : field.value || "" } - readOnly={readonly|| head.readonly ? true : false} - maxLength={head.maxLength?head.maxLength:15} + readOnly={ + readonly || head.readonly ? true : false + } + maxLength={head.maxLength ? head.maxLength : 15} /> ) : head.type === "select" ? ( ( field.onChange(val); } }} - readOnly={ readonly||head.readonly ? true : false} - // Disabled prop removed as SelectBox does not support it + readOnly={ + readonly || head.readonly ? true : false + } + // Disabled prop removed as SelectBox does not support it > ) : head.type === "date" ? ( - { - console.log("date", date); - field.onChange(date); // readonly 상태가 아닐 때만 값 변경 - }, + // { + // console.log("date", date); + // field.onChange(date); // readonly 상태가 아닐 때만 값 변경 + // }, + // }} + // selectClass={"w-full"} + // readOnly={readonly||head.readonly ? true : false} + // /> + { + // 브라우저에서 선택한 값은 "YYYY-MM-DD" + const date = new Date(e.target.value); // e.g. "2025-06-01" + field.onChange(date); }} - selectClass={"w-full"} + value={ + field.value? moment(field.value, "YYYYMMDD").format( "YYYY-MM-DD"): "" + } + className={"w-full text-gray-600"} readOnly={readonly||head.readonly ? true : false} /> ) : head.type === "checkbox" ? ( @@ -158,22 +179,19 @@ const RuseMngTableForm = React.forwardRef( className="" checked={field.value || false} onCheckedChange={(checked) => { - if(readonly || head.readonly) { + if (readonly || head.readonly) { return; - }else{ + } else { field.onChange(checked); } }} > ) : ( - ( - - { - head.type === "number" + + {head.type === "number" ? formatCommaNumber(field.value) - : field.value || "" - } - ) + : field.value || ""} + )} )} diff --git a/apps/wr/middleware.ts b/apps/wr/middleware.ts index 7758ec5ec..716a851b8 100644 --- a/apps/wr/middleware.ts +++ b/apps/wr/middleware.ts @@ -10,6 +10,8 @@ const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || ""; const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; const REUSE_API_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL || ""; const OPERATION_API_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL || ""; +const BUSINESS_JUSO_API_URL = process.env.NEXT_PUBLIC_FINDADRESS_URL || ""; +const AdressKey = process.env.NEXT_PUBLIC_WR_ADDRESS_KEY || ""; export function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; @@ -148,6 +150,24 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } + + if (pathname.startsWith("/bussiness-juso-service")) { + console.log('AdressKey ', AdressKey) + const params = new URLSearchParams({ + currentPage: "1", // 원하는 페이지 + countPerPage: "5", // 페이지당 결과 수 + keyword: searchParams.get("keyword") || "", // 검색어(주소) + confmKey: AdressKey, // 인증키 인터넷용 패쇄망용은 따로 발급 필요 즉 middleware에서 치환해서 사용해야할듯 + resultType: "json", // 결과 형식 기본은 xml + }); + const newUrl = `${BUSINESS_JUSO_API_URL}?${params.toString()}`; + console.log(`[Middleware] Request to business.juso.go.kr`); + console.log(req.url); + console.log(`[Middleware] Rewriting from '/business.juso.go.kr' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } + + return NextResponse.next(); } @@ -161,6 +181,7 @@ export const config = { "/sewerage-service/:path*", "/reuse-service/:path*", "/operation-service/:path*", + "/bussiness-juso-service/:path*", "/" ], };