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 2dda06008..212eca6e7 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmApplyList/page.tsx @@ -9,6 +9,7 @@ import { Toaster } from 'react-hot-toast'; import SdmLogin from '../sdmLogin/page'; import type { DemandCompType } from '@/app/store/sdmMng'; import TransValueFormat from '@/app/common/transValueFormat'; +import { useRouter } from 'next/navigation'; const TABLE_STYLES = { header: "text-center border border-[var(--border)] bg-[rgb(234,243,251)] text-[rgb(100,119,132)] whitespace-pre-line", @@ -22,6 +23,9 @@ type SdmApplyProps = { } export default function SdmApplyList({}: SdmApplyProps) { + + const router = useRouter(); + const {getSdmInfoStatusList, Sdm, Common} = useDmStore((state) => state); const {successLogin, sdmInfoStatusList, upHeadSdmInfoStatus} = Sdm; const {selectSidoData, selectSigunData} = Common; @@ -185,7 +189,12 @@ export default function SdmApplyList({}: SdmApplyProps) { body={} bodyClass="sm:max-w-[90vw] w-[530px] h-[430px]" open={!isLogin} - onOpenChange={(open) => !open && setIsLogin(false)} + onOpenChange={(open) => { + if(!open){ + setIsLogin(false) + router.push('/'); + } + }} noHeaderYn="Y" noFooterYn="Y" /> 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 8443f3c05..40ff3948f 100644 --- a/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx +++ b/apps/dm/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page.tsx @@ -64,21 +64,24 @@ const sdmInfoFormSchema = z.object({ .min(8, "전화번호는 8자 이상 입력해주세요") .max(12, "전화번호는 12자 이내로 입력해주세요") .regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), */ - candidateTitle: 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 } = useDmStore((state) => state); + const {map, insertSdmInfoData, Sdm } = 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({ + const [defaultValues, setDefaultValues] = useState({ sdmNm: '', demandYmd: new Date(), demandQnty: '', @@ -100,9 +103,15 @@ function SdmInfoInsertContent() { crmty: '', rmrk: '', /** 후보지 제목 */ - candidateTitle: '', + candidateTitle: [ + { ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' }, + { ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' }, + { ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' }, + ], }); + + useEffect(() => { const user = sessionStorage.getItem('user'); setDefaultValues(prev => ({ @@ -126,6 +135,13 @@ function SdmInfoInsertContent() { mode: "onChange", }); + useEffect(()=>{ + if(map.subsInfo.length>0){ + form.setValue('candidateTitle', map.subsInfo) + } + +},[map.subsInfo, form]) + // 로그인 성공 시 모달 닫기 및 폼 업데이트 useEffect(() => { if (successLogin) { @@ -187,8 +203,13 @@ const router = useRouter(); reqDt: "", dmdInfoSn: 0, status: '', + splyCndtList: data.candidateTitle || [], }; + + + + await insertSdmInfoData(apiData); } catch (error) { console.error('Error submitting form:', error); diff --git a/apps/dm/app/(base-layout)/pages/wrStatus/page.tsx b/apps/dm/app/(base-layout)/pages/wrStatus/page.tsx index 3fccefdb8..7ae840beb 100644 --- a/apps/dm/app/(base-layout)/pages/wrStatus/page.tsx +++ b/apps/dm/app/(base-layout)/pages/wrStatus/page.tsx @@ -12,10 +12,10 @@ interface RegionData { interface TableData { region: string; - sewage: number; - rainwater: number; - reclaimed: number; - thermal: number; + sewage: string; + rainwater: string; + reclaimed: string; + thermal: string; } @@ -161,7 +161,7 @@ const WrStatusPage: React.FC = () => { chartTitle : '', chartClassName : "h-[300px] w-full", graphSize : 40, - yFieldText : '개소수(건)', + yFieldText : '시설(개소)', showLegend : true } @@ -193,24 +193,24 @@ const WrStatusPage: React.FC = () => { }; const tableData: TableData[] = [ - { region: '서울특별시', sewage: 4, rainwater: 816, reclaimed: 371, thermal: 0 }, - { region: '부산광역시', sewage: 13, rainwater: 68, reclaimed: 20, thermal: 1 }, - { region: '대구광역시', sewage: 9, rainwater: 294, reclaimed: 14, thermal: 2 }, - { region: '인천광역시', sewage: 17, rainwater: 165, reclaimed: 35, thermal: 15 }, - { region: '광주광역시', sewage: 3, rainwater: 74, reclaimed: 15, thermal: 15 }, - { region: '대전광역시', sewage: 2, rainwater: 52, reclaimed: 11, thermal: 20 }, - { region: '울산광역시', sewage: 8, rainwater: 111, reclaimed: 19, thermal: 30 }, - { region: '세종특별자치시', sewage: 9, rainwater: 65, reclaimed: 0, thermal: 0 }, - { region: '경기도', sewage: 176, rainwater: 1009, reclaimed: 252, thermal: 40 }, - { region: '강원특별자치도', sewage: 69, rainwater: 69, reclaimed: 22, thermal: 0 }, - { region: '충청북도', sewage: 38, rainwater: 17, reclaimed: 91, thermal: 0 }, - { region: '충청남도', sewage: 67, rainwater: 54, reclaimed: 188, thermal: 0 }, - { region: '전라북도', sewage: 55, rainwater: 33, reclaimed: 220, thermal: 0 }, - { region: '전라남도', sewage: 83, rainwater: 16, reclaimed: 75, thermal: 0 }, - { region: '경상북도', sewage: 81, rainwater: 37, reclaimed: 70, thermal: 0 }, - { region: '경상남도', sewage: 75, rainwater: 27, reclaimed: 140, thermal: 0 }, - { region: '제주특별자치도', sewage: 8, rainwater: 47, reclaimed: 64, thermal: 0 }, - + { region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123' }, + { region: '서울특별시', sewage: '4(114,908)', rainwater: '816(430)', reclaimed: '371(341)', thermal: '0' }, + { region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1' }, + { region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2' }, + { region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15' }, + { region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15' }, + { region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20' }, + { region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30' }, + { region: '세종특별자치시', sewage: '9(2,555)', rainwater: '65(16)', reclaimed: '0(0)', thermal: '0' }, + { region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40' }, + { region: '강원특별자치도', sewage: '69(19,677)', rainwater: '69(4)', reclaimed: '22(447)', thermal: '0' }, + { region: '충청북도', sewage: '38(15,607)', rainwater: '17(91)', reclaimed: '91(2,211)', thermal: '0' }, + { region: '충청남도', sewage: '67(41,368)', rainwater: '54(77)', reclaimed: '188(50,434)', thermal: '0' }, + { region: '전라북도', sewage: '55(42,671)', rainwater: '33(199)', reclaimed: '220(9,453)', thermal: '0' }, + { region: '전라남도', sewage: '83(23,560)', rainwater: '16(885)', reclaimed: '75(15,412)', thermal: '0' }, + { region: '경상북도', sewage: '81(129,081)', rainwater: '37(341)', reclaimed: '70(27,818)', thermal: '0' }, + { region: '경상남도', sewage: '75(50,101)', rainwater: '27(244)', reclaimed: '140(343)', thermal: '0' }, + { region: '제주특별자치도', sewage: '8(1,666)', rainwater: '47(5,746)', reclaimed: '64(660)', thermal: '0' }, ]; const regionData: RegionData[] = [ @@ -410,8 +410,8 @@ const WrStatusPage: React.FC = () => {
{/* 타이틀 영역 */}
-

재이용시설개소수(2023)

-

행정구역별 재이용시설 개소수 조회

+

재이용시설현황(2023)

+

행정구역별 재이용시설현황(개소)

{/* 본문 콘텐츠 */} @@ -455,19 +455,19 @@ const WrStatusPage: React.FC = () => {
- 하수재이용시설 (총 717개소수) + 하수재이용시설 (총 717개소)
- 빗물이용시설 (총 3,730개소수) + 빗물이용시설 (총 3,730개소)
- 중수도시설 (총 1,074개소수) + 중수도시설 (총 1,074개소)
- 온배수시설 (총 201개소수) + 온배수시설 (총 201개소)
@@ -482,7 +482,7 @@ const WrStatusPage: React.FC = () => {

재이용시설현황(2023)

-

행정구역별 재이용시설 현황 비교

+

행정구역별 재이용시설현황(개소)

@@ -493,10 +493,10 @@ const WrStatusPage: React.FC = () => { 번호 시도 - 하수 - 빗물 - 중수도 - 온배수 + 하수(이용량,천m³/년) + 빗물(이용량,천m³/년) + 중수도(이용량,천m³/년) + 온배수(이용량,천m³/년) diff --git a/apps/dm/app/store/map/index.tsx b/apps/dm/app/store/map/index.tsx index 888c8341a..d5f2137f7 100644 --- a/apps/dm/app/store/map/index.tsx +++ b/apps/dm/app/store/map/index.tsx @@ -16,7 +16,7 @@ const getRuseFclt = async ( let url = `/prcsFclt/ruseInfo/${page ? page : 1}/5/A/${sggOrCity ? sggOrCity : "0"}/0/1/SW`; - console.log(' checkWrRegListRes ', checkWrRegListRes) + console.log(" checkWrRegListRes ", checkWrRegListRes); const ruseList = checkWrRegListRes.data.filter((item: string) => item !== ""); if (searchTxt) { @@ -30,45 +30,53 @@ const getRuseFclt = async ( }, body: JSON.stringify(ruseList), }); - const hasuList = await response.json().then((res: any) => { - - const data =res.data - .map((item: any) => { - return { - ...item, - fctCpc: Number(item.fctCpc) || 0, - searchNm: item.fctNm, - searchPk: item.bscFctNm, - - }; - }) - .filter((hasu) => - ruseList.find((ruse) => hasu.bscFctCd === ruse) - ); - return{ data: data, count: res.count }; - + const data = res.data + .map((item: any) => { + return { + ...item, + fctCpc: Number(item.fctCpc) || 0, + searchNm: item.fctNm, + searchPk: item.bscFctNm, + }; + }) + .filter((hasu) => ruseList.find((ruse) => hasu.bscFctCd === ruse)); + return { data: data, count: res.count }; }); - return hasuList + return hasuList; }; export type DmMapActions = { - findRuseFclt(sggOrCity:string, searchTxt: string): void; - setSubsInfo(subsInfo:SubsInfo[]):void + findRuseFclt(sggOrCity: string, searchTxt: string): void; + setSubsInfo(subsInfo: SubsInfo[]): void; }; export type DmMapType = { map: { ruseFcltList: FacilityInfo[]; - subsInfo:SubsInfo[] + subsInfo: SubsInfo[]; }; }; export const dmMapState: DmMapType = { map: { ruseFcltList: [], + // subsInfo: [ + // { + // ruseUtztnFcltNm: "수원제1,2 재이용1", // 재이용시설명 + // ruseUtztnFcltCd: "41110PB001R1", + // }, + // { + // ruseUtztnFcltNm: "낙양 재이용1", // 재이용시설명 + // ruseUtztnFcltCd: "41150SW001R1", + // }, + // { + // ruseUtztnFcltNm: "서남 재이용1", // 재이용시설명 + // ruseUtztnFcltCd: "11500PB001R1", + // }, + // ], subsInfo:[] }, }; @@ -76,26 +84,25 @@ export type DmMapStore = DmMapType & DmMapActions; export const DmMapReducer = (set: any): DmMapActions => { return { - findRuseFclt: async (sggOrCity:string, searchTxt: string) => { - const ruseFcltList = await getRuseFclt('1', sggOrCity,searchTxt); + findRuseFclt: async (sggOrCity: string, searchTxt: string) => { + const ruseFcltList = await getRuseFclt("1", sggOrCity, searchTxt); set((state: DmMapType) => ({ ...state, map: { ...state.map, - ruseFcltList :ruseFcltList.data + ruseFcltList: ruseFcltList.data, }, })); - },setSubsInfo: async (subsInfo: SubsInfo[]) => { - set((state: DmMapType) => ({ + }, + setSubsInfo: async (subsInfo: SubsInfo[]) => { + set((state: DmMapType) => ({ ...state, map: { ...state.map, subsInfo: subsInfo, }, })); - - } - + }, }; }; diff --git a/apps/dm/app/store/sdmMng/index.tsx b/apps/dm/app/store/sdmMng/index.tsx index 8e487543f..65fadc714 100644 --- a/apps/dm/app/store/sdmMng/index.tsx +++ b/apps/dm/app/store/sdmMng/index.tsx @@ -38,8 +38,17 @@ export type DemandCompType = { reqDt : string | ''; dmdInfoSn : number | ''; status : string | ''; + splyCndtList:SupplyCandidate[]|[], + } +// 공급 후보자 타입 정의 +export type SupplyCandidate = { + ruseUtztnFcltNm: string; + ruseUtztnFcltCd: string; +}; + + export type DemandMatchings = { splyFcltFk : string | ''; splyFcltFlg : string | ''; diff --git a/apps/dm/components/ui/sdmInfoInsertForm/component.tsx b/apps/dm/components/ui/sdmInfoInsertForm/component.tsx index bdb2ef6f3..08309ff0f 100644 --- a/apps/dm/components/ui/sdmInfoInsertForm/component.tsx +++ b/apps/dm/components/ui/sdmInfoInsertForm/component.tsx @@ -58,6 +58,11 @@ export function SdmInfoRegForm({ initializeCommonData(); }, [initializeCommonData]); + + + useEffect(() =>{ + console.log('candidateTitle ', form.getValues("candidateTitle")) + },[form.getValues("candidateTitle") ]) useEffect(() => { if (useTypesData && useTypesData.length > 0) { setTimeout(() => { @@ -468,7 +473,7 @@ export function SdmInfoRegForm({ name: "candidateTitle", label: CANDIDATE || "공급처 후보지 선택(필수아님)", formIndex: 2, - component: (field) => ( + component: () => (
- - - + {(form.getValues("candidateTitle") || []).map((candidate: any, index: number) => ( + + ))}
),