diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 8cae406f3..28ded2bfd 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -90,7 +90,7 @@ const resetContents = () => {
운영정보 - 시설현황 + 시설정보 - + +
@@ -51,13 +66,13 @@ export default function Home() {
- + {nodeList}
- +
diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index fcd8b02ba..890505198 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -1,10 +1,10 @@ import { upHeadList, - type rainFacOfType, + type bdstType, type TableUpperProps, } from "../rainReg"; -const htdflOfObject: rainFacOfType[] = [ +const htdflOfObject: bdstType[] = [ { sido: "서울", sigungo: "종로구", @@ -53,7 +53,7 @@ export type htdflFacState = { htdfl: { isInit: boolean; upHeadList: TableUpperProps[]; - htdflOfObject: rainFacOfType[]; + htdflOfObject: bdstType[]; }; }; type htdflFacSActions = { diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 0fd5194f9..5b062a5db 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -1,134 +1,262 @@ +import { getFectch } from "@/components/lib/api"; + +type RainyInfoResponse = { + ctpvCd: string; + sggCd: string; + bdstNm: string; + daddr: string; + bdstUsgCd: string; + frstArchPrmsnDt: string; + archArea: string; + lawTrgtYn: string; + archChgArea: string; + bdstInfoPk: number; + reuseBuilding: Array<{ + bdstRuseFcltPk: number; + bdstInfoFk: number; + operMngCd: number | null; + anlOperCst: number | null; + instlCmptnDt: string | null; + instlCst: number | null; + archChgPrmsnDt: string | null; + instlCstSprtYn: string | null; + instlCstSprtAmt: number | null; + grntchBdstCertYn: string | null; + grntchBdstCertNo: string | null; + grntchBdstCertGrd: string | null; + grntchBdstCertYr: string | null; + rainyObj: { + pntfColKnd: string | null; + pntfColArea: number | null; + filtrTrtmfctCpct: number | null; + filtrTrtmfctYn: string | null; + filtrTrtmfctPrs: number | null; + } | null; + }>; +}; export type TableUpperProps = { - id: string; - title: string; - upName?: string; - upSequnce?: number; -} -export type rainFacOfType = { - sido: string, - sigungo: string, - facilityName: string, - location: string, - locationgubun: string, - firstConstructionPermission:string, - facilityCapacity: string, - buildingArea:string, - yn?: string, - permissionDay:string; - authoDay?: string, - area?: string, - reuse?: string, - register?: string, - legalTargetYn:string, -} + id: string; + title: string; + upName?: string; + upSequnce?: number; +}; -export const upHeadList:TableUpperProps[] = [ - { id: "sido", title: "시도"}, - { id: "sigungo", title: "시군구"}, - { id: "facilityName", title: "시설명"}, - { id: "location", title: "위치"}, - { id: "locationgubun", title: "지역구분"}, - { id: "facilityCapacity", title: "시설용량"}, - { id: "yn", title: '여부', upName:'upChangeRe' , upSequnce:1 }, - { id: "authoDay", title: '허가일',upName:'upChangeRe', upSequnce:2 }, - { id: "area", title: '면적' ,upName:'upChangeRe',upSequnce:3 }]; - -const rainOfObject:rainFacOfType[] = [ - { - sido: "서울", - sigungo: "종로구", - facilityName: "그랑서울", - location: "종로 33", - locationgubun: "업무시설", - firstConstructionPermission : '2024-10-10', - buildingArea: "50", - facilityCapacity: "800,000", - reuse: "Y", - permissionDay:'2024-10-10', - register: "Y", - legalTargetYn:"Y" - }, - { - sido: "서울", - sigungo: "종로구", - facilityName: "그랑서울", - location: "종로 33", - locationgubun: "업무시설", - firstConstructionPermission : '2024-10-10', - buildingArea: "50", - facilityCapacity: "800,000", - reuse: "Y", - permissionDay:'2024-10-10', - register: "Y", - legalTargetYn:"Y" - }, - { - sido: "서울", - sigungo: "종로구", - facilityName: "그랑서울", - location: "종로 33", - locationgubun: "업무시설", - firstConstructionPermission : '2024-10-10', - buildingArea: "50", - facilityCapacity: "800,000", - reuse: "Y", - permissionDay:'2024-10-10', - register: "Y", - legalTargetYn:"Y" - }, -] + + export type rainRuseType = { + bdstRuseFcltPk: number, + bdstInfoFk: number, + operMngCd:number|null, + anlOperCst: number|null, + instlCmptnDt: Date|null, + instlCst: number|null, + pntfColKnd: string|null, + pntfColArea: number|null, + filtrTrtmfctCpct: number|null, + filtrTrtmfctYn: string|null, + filtrTrtmfctPrs: number|null, + instlCstSprtYn: string|null, + instlCstSprtAmt: number|null, + grntchBdstCertYn: string|null, + grntchBdstCertNo: string|null, + grntchBdstCertGrd: string|null, + grntchBdstCertYr: string|null, -export type selectArray ={ - text:string, - val:string - -} + // crgRdctYn: string|null, + // crgRdctBsst: string|null, + // crgRdctAmt:number|null, + // ruseFcltFlg: string|null, + // bdstReuseFcltFk:number|null, + // annRnwtQty: number|null, + // oilqMeasMthd: string|null, + } -export const selectClass ="w-full h-full text-2xl"; + + + +export type bdstType = { + ctpvCd: string; // 시도 + sggCd: string; // 시군구 + bdstNm: string; // 시설명 + daddr: string; // 위치 + bdstUsgCd: string; // 건축물용도 + frstArchPrmsnDt: string; // 최초건축허가일 + archArea: string; // 건축면적 + lawTrgtYn: string; // 법적의무대상여부 + archChgPrmsnDt: string; // 건축변경 허가일시 + archChgArea: string; // 변경 면적 + bdstInfoPk: number; +}; + + +export const upHeadList: TableUpperProps[] = [ + { id: "ctpvCd", title: "시도" }, + { id: "sggCd", title: "시군구" }, + { id: "bdstNm", title: "시설명" }, + { id: "daddr", title: "위치" }, + { id: "bdstUsgCd", title: "건축물용도" }, + { id: "frstArchPrmsnDt", title: "최초건축허가일" }, + { id: "archArea", title: "건축면적", }, + { id: "lawTrgtYn", title: "법적의무대상여부", }, + { id: "archChgYn", title: "여부", upName: "upChangeRe", upSequnce: 1 }, + { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 }, + { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 }, +]; + + const bdstObj: bdstType[] =[] + const rainRuseObj: rainRuseType[] = [] + // =[{ +// sido: "", +// sigungo: "", +// facilityName: "", +// location: "", +// locationgubun: "", +// firstConstructionPermission: "", +// facilityCapacity: "", +// buildingArea: "", +// permissionDay: "", +// legalTargetYn: "" +// }] +// const rainFcltObj: rainFcltType[] = [{ +// instlCmptnDt: "", +// instlCst: "", +// instlCstSprtYn: "", +// instlCstSprtAmt: "", +// grntchBdstCertYn: "", +// grntchBdstCertNo: "", +// grntchBdstCertGrd: "", +// grntchBdstCertYr: "", +// pntfColKnd: "", +// pntfColArea: 0, +// filtrTrtmfctCpct: 0, +// filtrTrtmfctYn: "", +// filtrTrtmfctPrsnl: 0 +// }] + +export type selectArray = { + text: string; + val: string; +}; + +export const selectClass = "w-full h-full text-2xl"; const selectHomeWater = [ - { text: '집수면', val: "1" }, - { text: "종류", val: "2" }, - ]; + { text: "집수면", val: "1" }, + { text: "종류", val: "2" }, +]; - const selectYN= [ - { text: 'Y', val: "1" }, - { text: 'N', val: "2" }, - ]; - -export type rainFacState ={ rain:{ +const selectYN = [ + { text: "Y", val: "1" }, + { text: "N", val: "2" }, +]; +export type rainFacState = { + rain: { isInit: boolean; upHeadList: TableUpperProps[]; - rainOfObject: rainFacOfType[]; - selectHomeWater:selectArray[]; - selectYN:selectArray[]; -}} + rainRuseObj: rainRuseType[]; + bdstObj: bdstType[]; + // rainFcltObj: rainFcltType[]; + // selectHomeWater: selectArray[]; + selectYN: selectArray[]; + }; +}; type rainFacSActions = { - decrementList: () => void -} + init: () => void; + dataInit:( )=>void; +}; + +//const rainSelectApi = getFectch('v1/reuseFc/rainyInfo/1/20'); export type rainFacType = rainFacState & rainFacSActions; -export const rainFacStateExport:rainFacState= {rain:{ - isInit:false, +export const rainFacStateExport: rainFacState = { + rain: { + isInit: false, upHeadList: upHeadList, - rainOfObject: rainOfObject, - selectHomeWater:selectHomeWater, - selectYN:selectYN - - -}} -export const rainFacActionsExport:(set:any)=>rainFacSActions=(set: any) => { - return { - decrementList:()=>set( - (state:rainFacState) => { - return ( - {rain:{ - upHeadList: state.rain.upHeadList, - rainOfObject: - state.rain.rainOfObject.slice(0, state.rain.rainOfObject.length - 1) - }})} - ) - } -} + rainRuseObj: rainRuseObj, + bdstObj: bdstObj, + //rainFcltObj:rainFcltObj, + // selectHomeWater: selectHomeWater, + + selectYN: selectYN, + }, +}; +export const rainFacActionsExport: (set: any) => rainFacSActions = ( + set: any +) => { + return { + init: async() =>{ + try { + const res = await getFectch("/reuseFc/rainyInfoList/1/20"); + const result = res.flatMap(({ reuseBuilding = [] as RainyInfoResponse["reuseBuilding"], ...item }) => + reuseBuilding.map(rb => { + const rainy = rb.rainyObj || {}; + + const bdstObj: bdstType = { + ctpvCd: String(item.ctpvCd ?? ''), + sggCd: String(item.sggCd ?? ''), + bdstNm: item.bdstNm ?? '', + daddr: item.daddr ?? '', + bdstUsgCd: String(item.bdstUsgCd ?? ''), + frstArchPrmsnDt: item.frstArchPrmsnDt ?? '', + archArea: String(item.archArea ?? ''), + lawTrgtYn: item.lawTrgtYn ?? '', + archChgPrmsnDt: rb.archChgPrmsnDt ?? '', + archChgArea: String(item.archChgArea ?? ''), + bdstInfoPk: item.bdstInfoPk + }; + + const rainRuseObj: rainRuseType = { + bdstRuseFcltPk: rb.bdstRuseFcltPk, + bdstInfoFk: rb.bdstInfoFk, + operMngCd: rb.operMngCd, + anlOperCst: rb.anlOperCst, + instlCmptnDt: rb.instlCmptnDt ? new Date(rb.instlCmptnDt) : null, + instlCst: rb.instlCst, + pntfColKnd: rb.rainyObj?.pntfColKnd || null, + pntfColArea: rb.rainyObj?.pntfColArea || null, + filtrTrtmfctCpct: rb.rainyObj?.filtrTrtmfctCpct || null, + filtrTrtmfctYn: rb.rainyObj?.filtrTrtmfctYn || null, + filtrTrtmfctPrs: rb.rainyObj?.filtrTrtmfctPrs || null, + instlCstSprtYn: rb.instlCstSprtYn, + instlCstSprtAmt: rb.instlCstSprtAmt, + grntchBdstCertYn: rb.grntchBdstCertYn, + grntchBdstCertNo: rb.grntchBdstCertNo, + grntchBdstCertGrd: rb.grntchBdstCertGrd, + grntchBdstCertYr: rb.grntchBdstCertYr + }; + + return { bdstObj, rainRuseObj }; + }) + ); + console.log('result', result ) + + // 여기서 상태 업데이트 + return set((state: rainFacState) => ({ + ...state, + rain: { + ...state.rain, + bdstObj: result.map((item: { bdstObj: any; }) => item.bdstObj), + rainRuseObj: result.map((item: { rainRuseObj: any; }) => item.rainRuseObj), + isInit: false + } + })); + } catch (error) { + console.log('error', error); + } finally { + console.log('finally'); + } + }, + dataInit: () => + set(async (state: rainFacState) => { + console.log(" state ", state.rain.bdstObj) + return ({ + rain: { + ...state.rain, + + isInit: false, + }, + }) + }), + }; +}; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 667afef2d..16cd43b44 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -1,7 +1,7 @@ -import { upHeadList, type rainFacOfType, type selectArray, type TableUpperProps } from "../rainReg"; +import { upHeadList, type bdstType, type selectArray, type TableUpperProps } from "../rainReg"; -const rswtOfObject:rainFacOfType[] = [ +const rswtOfObject:bdstType[] = [ { sido: "서울", sigungo: "종로구", @@ -60,7 +60,7 @@ const selectHomeWater = [ export type rswtFacState ={ rswt:{ isInit: boolean; upHeadList: TableUpperProps[]; - rswtOfObject: rainFacOfType[]; + rswtOfObject: bdstType[]; selectHomeWater:selectArray[]; selectYN:selectArray[]; }} diff --git a/apps/wr/components/lib/api/index.ts b/apps/wr/components/lib/api/index.ts new file mode 100644 index 000000000..9d6114578 --- /dev/null +++ b/apps/wr/components/lib/api/index.ts @@ -0,0 +1,64 @@ +//8880 + +import { DEV_URL_WR } from "../config/env"; + + + +export const getFectch = async (url: string) => { + const response = await fetch( DEV_URL_WR+url , { + method: "GET", + headers: { + accept: "application/json", + }, + }); + + if(!response.ok) { + throw new Error(`오류 발생: ${response.status}`); + } + const res = await response.json() + return res.data; +} + +export const postFectch = async (url: string, params: any) => { + const response = await fetch(DEV_URL_WR+url, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }); + if(!response.ok) { + throw new Error(`오류 발생: ${response.status}`); + } + return response; +} + + +export const putFectch = async (url: string, params: any) => { + const response = await fetch(DEV_URL_WR+url, { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }); + if(!response.ok) { + throw new Error(`오류 발생: ${response.status}`); + } + return response; + } + + +export const deleteFectch = async (url: string, params: any) => { + const response = await fetch(DEV_URL_WR+url, { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }); + if(!response.ok) { + throw new Error(`오류 발생: ${response.status}`); + } + return response; + } \ No newline at end of file diff --git a/apps/wr/components/lib/config/api.ts b/apps/wr/components/lib/config/api.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/wr/components/lib/config/env.ts b/apps/wr/components/lib/config/env.ts new file mode 100644 index 000000000..82aaa5026 --- /dev/null +++ b/apps/wr/components/lib/config/env.ts @@ -0,0 +1,6 @@ + +const LOCAL_PORT = "3000"; +const DEV_PORT = "8880"; + +export const LOCAL_URL_WR = `http://localhost:${LOCAL_PORT}/api/v1`; +export const DEV_URL_WR = `http://192.168.1.193:${DEV_PORT}/api/v1`; diff --git a/apps/wr/components/lib/config/index.ts b/apps/wr/components/lib/config/index.ts new file mode 100644 index 000000000..e7f55b887 --- /dev/null +++ b/apps/wr/components/lib/config/index.ts @@ -0,0 +1 @@ +export * from './env'; \ No newline at end of file diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx index 41977cc83..83766b8de 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/component.tsx @@ -308,7 +308,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList); -

+

농축수관리{" "}

@@ -375,6 +375,51 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
+ +

+ 폐수배출시설 정보 +

+
+
+ ( + + + + )} + /> +
+ +
+ ( + + + + )} + /> +
+ +
+ ( + + + + )} + /> +
+
+

+ 재이용 원수취수 현황 +

+ diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/component.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/component.tsx index a493a7981..6ceb41317 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/component.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/component.tsx @@ -18,6 +18,7 @@ import { type TableUpperProps, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import type { fcltOperInfoType, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg"; +import { PbnstMngModal } from "@/components/ui/modal/pbnstMng/component"; const formSchema = z.object({ fcltNm: z.string().min(2).max(50), @@ -37,6 +38,9 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) { const { fcltOperInfo } = pubMng; const [ruseOperData, setRuseOperData] = useState(); const [files, setFiles] = useState(null); + const [isModalOpen, setIsModalOpen] = useState(false); + + const form = useForm>({ resolver: zodResolver(formSchema), @@ -61,10 +65,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) { } }; - const newReuseFclt = () => { - form.reset(); - setRuseOperData([{}] as fcltOperInfoType[]); - }; + useEffect(() => { if (isInit) { @@ -169,11 +170,12 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) { -
+

○ 재이용시설 운영정보

- + + {/* */}
-
+
+ + + + + + + Share link + + Anyone who has this link will be able to view this. + + + {chldrn} + + + + + + + + + ); +}