From 850653b442988adf3583463c55ba91e2bc52f53a Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 26 Mar 2025 16:50:52 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 199 ++++++++---------- 1 file changed, 91 insertions(+), 108 deletions(-) diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 5b062a5db..ffed7b0d0 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -1,3 +1,4 @@ +import { bdstUsgCd, comCodeStateExport } from "@/app/store/common/code"; import { getFectch } from "@/components/lib/api"; type RainyInfoResponse = { @@ -12,6 +13,7 @@ type RainyInfoResponse = { archChgArea: string; bdstInfoPk: number; reuseBuilding: Array<{ + bdstUsgCd: any; bdstRuseFcltPk: number; bdstInfoFk: number; operMngCd: number | null; @@ -26,15 +28,20 @@ type RainyInfoResponse = { grntchBdstCertGrd: string | null; grntchBdstCertYr: string | null; rainyObj: { + bdstReuseFcltFk:number|null; pntfColKnd: string | null; pntfColArea: number | null; + dtfcltCpct:number|null; filtrTrtmfctCpct: number | null; filtrTrtmfctYn: string | null; filtrTrtmfctPrs: number | null; + annRnwtQty:number|null; + oilqMeasMthd:string|null } | null; }>; }; + export type TableUpperProps = { id: string; title: string; @@ -42,43 +49,65 @@ export type TableUpperProps = { upSequnce?: number; }; + +type rainRuseBd={ + bdstRuseFcltPk: number, // 건축물 재이용시설 기본키 + bdstInfoFk: number, // 건축물 정보 외부키 + operMngCd:number|null, // 운영관리 코드 tb_wr_bdst_ruse_fclt 삭제 요망 + anlOperCst: number|null, // 연간운영비용 tb_wr_bdst_ruse_fclt 삭제 요망 + instlCmptnDt: Date|null, // 설치완료 일시 tb_wr_bdst_ruse_fclt 1 + instlCst: number|null, // 설치 비용 tb_wr_bdst_ruse_fclt 2 + instlCstSprtAmt: number|null, // 설치비용지원금액 tb_wr_bdst_ruse_fclt 8 + grntchBdstCertYn: string|null, // 녹색 기술 건축물 인증여부 tb_wr_bdst_ruse_fclt 9 + grntchBdstCertNo: string|null, // 녹색 기술 건축물 인증번호 tb_wr_bdst_ruse_fclt 10 + grntchBdstCertGrd: string|null, // 녹색 기술 건축물 인증등급 tb_wr_bdst_ruse_fclt 11 + grntchBdstCertYr: string|null, // 녹색 기술 건축물 인증년도 tb_wr_bdst_ruse_fclt 12 + + bdstReuseFcltFk:number|null; + dtfcltCpct:number|null, // 저류오 용량 tb_wr_rnwtr_utztn_fclt 3-1 + pntfColKnd: string|null, // 접수지점 종류 tb_wr_rnwtr_utztn_fclt 3 + pntfColArea: number|null, // 접수지점 지역 tb_wr_rnwtr_utztn_fclt 4 + filtrTrtmfctCpct: number|null, // 여과 처리시설 용량 tb_wr_rnwtr_utztn_fclt 5 + filtrTrtmfctYn: string|null, // 여과 처리시설 유무 tb_wr_rnwtr_utztn_fclt 6 + filtrTrtmfctPrs: number|null, // 여과 처리시설 공정 tb_wr_rnwtr_utztn_fclt 7 + + annRnwtQty:number|null; //연간 빗물량 + oilqMeasMthd:string|null // 유량측정 방법 +} - 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, - - - // crgRdctYn: string|null, - // crgRdctBsst: string|null, - // crgRdctAmt:number|null, - // ruseFcltFlg: string|null, - // bdstReuseFcltFk:number|null, - // annRnwtQty: number|null, - // oilqMeasMthd: string|null, + export type reuseBuilding = { + bdstRuseFcltPk: number, // 건축물 재이용시설 기본키 + bdstInfoFk: number, // 건축물 정보 외부키 + operMngCd:number|null, // 운영관리 코드 tb_wr_bdst_ruse_fclt 삭제 요망 + anlOperCst: number|null, // 연간운영비용 tb_wr_bdst_ruse_fclt 삭제 요망 + instlCmptnDt: Date|null, // 설치완료 일시 tb_wr_bdst_ruse_fclt 1 + instlCst: number|null, // 설치 비용 tb_wr_bdst_ruse_fclt 2 + instlCstSprtAmt: number|null, // 설치비용지원금액 tb_wr_bdst_ruse_fclt 8 + grntchBdstCertYn: string|null, // 녹색 기술 건축물 인증여부 tb_wr_bdst_ruse_fclt 9 + grntchBdstCertNo: string|null, // 녹색 기술 건축물 인증번호 tb_wr_bdst_ruse_fclt 10 + grntchBdstCertGrd: string|null, // 녹색 기술 건축물 인증등급 tb_wr_bdst_ruse_fclt 11 + grntchBdstCertYr: string|null, // 녹색 기술 건축물 인증년도 tb_wr_bdst_ruse_fclt 12 + rainyObj:rainyObj } + export type rainyObj ={ + bdstReuseFcltFk:number|null; + dtfcltCpct:number|null, // 저류오 용량 tb_wr_rnwtr_utztn_fclt 3-1 + pntfColKnd: string|null, // 접수지점 종류 tb_wr_rnwtr_utztn_fclt 3 + pntfColArea: number|null, // 접수지점 지역 tb_wr_rnwtr_utztn_fclt 4 + filtrTrtmfctCpct: number|null, // 여과 처리시설 용량 tb_wr_rnwtr_utztn_fclt 5 + filtrTrtmfctYn: string|null, // 여과 처리시설 유무 tb_wr_rnwtr_utztn_fclt 6 + filtrTrtmfctPrs: number|null, // 여과 처리시설 공정 tb_wr_rnwtr_utztn_fclt 7 + + annRnwtQty:number|null; //연간 빗물량 + oilqMeasMthd:string|null // 유량측정 방법 + } export type bdstType = { ctpvCd: string; // 시도 sggCd: string; // 시군구 - bdstNm: string; // 시설명 daddr: string; // 위치 bdstUsgCd: string; // 건축물용도 frstArchPrmsnDt: string; // 최초건축허가일 @@ -87,12 +116,12 @@ export type bdstType = { archChgPrmsnDt: string; // 건축변경 허가일시 archChgArea: string; // 변경 면적 bdstInfoPk: number; + bdstNm: string; }; - export const upHeadList: TableUpperProps[] = [ - { id: "ctpvCd", title: "시도" }, - { id: "sggCd", title: "시군구" }, + { id: "cityText", title: "시도" }, + { id: "sggText", title: "시군구" }, { id: "bdstNm", title: "시설명" }, { id: "daddr", title: "위치" }, { id: "bdstUsgCd", title: "건축물용도" }, @@ -105,34 +134,7 @@ export const upHeadList: TableUpperProps[] = [ ]; 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 -// }] + const rainRuseObj: rainRuseBd[] = [] export type selectArray = { text: string; @@ -140,11 +142,6 @@ export type selectArray = { }; export const selectClass = "w-full h-full text-2xl"; -const selectHomeWater = [ - { text: "집수면", val: "1" }, - { text: "종류", val: "2" }, -]; - const selectYN = [ { text: "Y", val: "1" }, { text: "N", val: "2" }, @@ -153,10 +150,8 @@ export type rainFacState = { rain: { isInit: boolean; upHeadList: TableUpperProps[]; - rainRuseObj: rainRuseType[]; + rainRuseObj: rainRuseBd[]; bdstObj: bdstType[]; - // rainFcltObj: rainFcltType[]; - // selectHomeWater: selectArray[]; selectYN: selectArray[]; }; }; @@ -165,7 +160,6 @@ type rainFacSActions = { dataInit:( )=>void; }; -//const rainSelectApi = getFectch('v1/reuseFc/rainyInfo/1/20'); export type rainFacType = rainFacState & rainFacSActions; @@ -175,61 +169,50 @@ export const rainFacStateExport: rainFacState = { upHeadList: upHeadList, rainRuseObj: rainRuseObj, bdstObj: bdstObj, - //rainFcltObj:rainFcltObj, - // selectHomeWater: selectHomeWater, - selectYN: selectYN, }, }; +console.log(comCodeStateExport.code.sggCd) + +const chBdstUsgCd =(value:string|number)=>{ + const data = bdstUsgCd.find((item)=>item.val===value)?.text + + return data; +} + + +const chCityCd =(value:string|number)=>{ + const data = bdstUsgCd.find((item)=>item.val===value)?.text + + return data; +} + + export const rainFacActionsExport: (set: any) => rainFacSActions = ( set: any ) => { return { init: async() =>{ try { - const res = await getFectch("/reuseFc/rainyInfoList/1/20"); + // 파라이터 수정 통합관리자 =0, 시관리자=시코드, 시군구 관리자= 시군구 코드 를 세번째 파라미터로 지정 / 건축물 서치가 있을경우 4번째 파라미터로 던지기 즉 1/20/42(서울시)/영현빌딩 이런식으로) + const res = await getFectch('wr', "/reuseFc/rainyInfoList/1/20/42"); 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 - }; + const { bdstUsgCd, archChgPrmsnDt, rainyObj, ...restRb } = rb; + const bdstObj = { + ...item, + bdstUsgCd: bdstUsgCd ? chBdstUsgCd(bdstUsgCd) ?? '' : '', + archChgPrmsnDt: archChgPrmsnDt ?? '' + } as bdstType; + const rainRuseObj = { + ...restRb, + ...rainyObj + } as rainRuseBd; + return { bdstObj, rainRuseObj }; }) ); - console.log('result', result ) // 여기서 상태 업데이트 return set((state: rainFacState) => ({