Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
def2867c28 | ||
|
|
96a50e4f5a | ||
|
|
96448b6427 | ||
|
|
0ef6aea502 | ||
|
|
33ad044ed3 | ||
|
|
c94b33b1b8 | ||
|
|
886561535e | ||
|
|
ebde6d433a | ||
|
|
556d3f33b6 | ||
|
|
f826f0fb3f | ||
|
|
11010099b4 | ||
|
|
17886b0f9d | ||
|
|
46c166a87c | ||
|
|
5b96245e7d | ||
|
|
6ba78d0923 | ||
|
|
15b6520ee1 | ||
|
|
ed53ad249c | ||
|
|
b67d1261ff | ||
|
|
cfde5d695f | ||
|
|
13ce985fe5 | ||
|
|
3e634fa575 |
@@ -1,8 +1,8 @@
|
|||||||
NEXT_PUBLIC_SITE_ID = DM
|
NEXT_PUBLIC_SITE_ID = DM
|
||||||
NEXT_PUBLIC_PORT = 3000
|
NEXT_PUBLIC_PORT = 11035
|
||||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
|
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
|
||||||
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
|
||||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
|
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
|
|||||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||||
NEXT_PUBLIC_PORT = 11035
|
NEXT_PUBLIC_PORT = 3005
|
||||||
#NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
|
#NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
|
||||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000/
|
NEXT_PUBLIC_PROXY_HOST = http://localhost:3005/
|
||||||
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import ListDiv from '@common/business_components/ui/list_div';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Toaster } from 'react-hot-toast';
|
import { Toaster } from 'react-hot-toast';
|
||||||
import SdmLogin from '../sdmLogin/page';
|
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 TransValueFormat from '@/app/common/transValueFormat';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
|||||||
const {selectSidoData, selectSigunData} = Common;
|
const {selectSidoData, selectSigunData} = Common;
|
||||||
const [isLogin, setIsLogin] = useState(false);
|
const [isLogin, setIsLogin] = useState(false);
|
||||||
const [isLoginStorageInfo, setIsLoginStorageInfo] = useState(false);
|
const [isLoginStorageInfo, setIsLoginStorageInfo] = useState(false);
|
||||||
const [sdmApplyDetail, setSdmApplyDetail] = useState<DemandCompType>({} as DemandCompType);
|
const [sdmApplyDetail, setSdmApplyDetail] = useState<DemandCompBizType>({} as DemandCompBizType);
|
||||||
const [transformedList, setTransformedList] = useState<DemandCompType[]>([]);
|
const [transformedList, setTransformedList] = useState<DemandCompBizType[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('sessionStorage : ',sessionStorage.getItem('user'));
|
console.log('sessionStorage : ',sessionStorage.getItem('user'));
|
||||||
@@ -60,10 +60,10 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
|||||||
// 데이터 변환을 위한 별도의 useEffect
|
// 데이터 변환을 위한 별도의 useEffect
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (sdmInfoStatusList.length > 0) {
|
if (sdmInfoStatusList.length > 0) {
|
||||||
const newTransformedList = sdmInfoStatusList.map((item: DemandCompType) => ({
|
const newTransformedList = sdmInfoStatusList.map((item: DemandCompBizType) => ({
|
||||||
...item,
|
...item,
|
||||||
ctpvCd: selectSidoData.find(sido => sido.val === item.ctpvCd?.trim())?.text || '',
|
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);
|
setTransformedList(newTransformedList);
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,8 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
|||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
const selectedStatus = transformedList[index];
|
const selectedStatus = transformedList[index];
|
||||||
if (selectedStatus) {
|
if (selectedStatus) {
|
||||||
|
|
||||||
|
|
||||||
setSdmApplyDetail(selectedStatus);
|
setSdmApplyDetail(selectedStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,33 +123,33 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>총대장균군수(개/100ml)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>총대장균군수(개/100ml)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.grssClfg} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.grssClfg ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>결합잔류염소(mg/L)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>결합잔류염소(mg/L)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.combResdch} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.combResdch ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>탁도(NTU)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>탁도(NTU)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.trbt} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.trbt ?? ''} format="number"/>}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>생물학적 산소요구량(BOD)(mg/L)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>생물학적 산소요구량(BOD)(mg/L)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.blgcOxygDmndQnt} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.blgcOxygDmndQnt ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>냄새</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>냄새</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.smll} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.smll} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>색도(도)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>색도(도)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.crmty} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.crmty ?? ''} format="number"/>}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>총질소(T-N)(mg/L)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>총질소(T-N)(mg/L)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.tn} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.tn ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>총인(T-P)(mg/L)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>총인(T-P)(mg/L)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.tph} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.tph ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>수소이온농도(pH)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>수소이온농도(pH)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.ph} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.ph} format="number"/>}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>염화물(mgCL/L)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>염화물(mgCL/L)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.clIonQnt} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.clIonQnt ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>전기전도도(㎲/cm)</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>전기전도도(㎲/cm)</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.cdtnv} format="number"/>}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.cdtnv ?? ''} format="number"/>}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>비고</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>비고</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{sdmApplyDetail?.rmrk}</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{sdmApplyDetail?.rmrk}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
@@ -156,11 +158,11 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>후보지1</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>후보지1</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}></TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{ sdmApplyDetail?.splyCndtList?.[0]?.ruseUtztnFcltNm ?? ""}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>후보지2</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>후보지2</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}></TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{sdmApplyDetail?.splyCndtList?.[1]?.ruseUtztnFcltNm ?? ""}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>후보지3</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>후보지3</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}></TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{sdmApplyDetail?.splyCndtList?.[2]?.ruseUtztnFcltNm ?? ""}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
@@ -177,7 +179,7 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
|||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>진행상태</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>진행상태</TableCell>
|
||||||
<TableCell colSpan={2} className={TABLE_STYLES.cell}>{sdmApplyDetail?.status?.toString()}</TableCell>
|
<TableCell colSpan={2} className={TABLE_STYLES.cell}>{sdmApplyDetail?.status?.toString()}</TableCell>
|
||||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>공급처매칭결과</TableCell>
|
<TableCell colSpan={1} className={TABLE_STYLES.header}>공급처매칭결과</TableCell>
|
||||||
<TableCell colSpan={2} className={TABLE_STYLES.cell}></TableCell>
|
<TableCell colSpan={2} className={TABLE_STYLES.cell}>{sdmApplyDetail?.ruseUtztnFcltNm??''}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useDmStore } from "@/app/store";
|
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 { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component";
|
||||||
import { UiModal } from "@common/business_components/ui/dialog_ui";
|
import { UiModal } from "@common/business_components/ui/dialog_ui";
|
||||||
import { Button } from "@common/components/ui";
|
import { Button } from "@common/components/ui";
|
||||||
@@ -9,126 +9,104 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import { Suspense, useEffect, useState } from "react";
|
import { Suspense, useEffect, useState } from "react";
|
||||||
import { FormProvider, useForm, type SubmitHandler } from "react-hook-form";
|
import { FormProvider, useForm, type SubmitHandler } from "react-hook-form";
|
||||||
import { Toaster } from "react-hot-toast";
|
import toast, { Toaster } from "react-hot-toast";
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
import SdmLogin from "../sdmLogin/page";
|
import SdmLogin from "../sdmLogin/page";
|
||||||
|
|
||||||
const sdmInfoFormSchema = z.object({
|
const sdmInfoFormSchema = z.object({
|
||||||
sdmNm: z.string()
|
sdmNm: z.string().min(1, "수요처를 선택해주세요"),
|
||||||
.min(1, "수요처를 선택해주세요"),
|
|
||||||
demandYmd: z.date().optional(),
|
demandYmd: z.date().optional(),
|
||||||
demandQnty: z.string()
|
demandQnty: z
|
||||||
|
.string()
|
||||||
.min(1, "요구수량을 입력해주세요")
|
.min(1, "요구수량을 입력해주세요")
|
||||||
.regex(/^[0-9]+$/, "요구수량은 숫자만 입력 가능합니다"),
|
.regex(/^[0-9]+$/, "요구수량은 숫자만 입력 가능합니다"),
|
||||||
usePurpose: z.string().optional(),
|
usePurpose: z.string().optional(),
|
||||||
money: z.string()
|
money: z.string().regex(/^[0-9]+$/, "희망단가는 숫자만 입력 가능합니다"),
|
||||||
.regex(/^[0-9]+$/, "희망단가는 숫자만 입력 가능합니다"),
|
|
||||||
/**요구수질 */
|
/**요구수질 */
|
||||||
reqWaterQlty: z.string().optional(),
|
reqWaterQlty: z.string().optional(),
|
||||||
grssClfg: z.string()
|
grssClfg: z.number().nullish(),
|
||||||
.min(1, "총대장균군수를 입력해주세요")
|
tn: z.number().nullish(),
|
||||||
.regex(/^[0-9]+$/, "총대장균군수는 숫자만 입력 가능합니다"),
|
combResdch: z.number().nullish(),
|
||||||
tn: z.string()
|
tph: z.number().nullish(),
|
||||||
.min(1, "총질소를 입력해주세요")
|
trbt: z.number().nullish(),
|
||||||
.regex(/^[0-9]+$/, "총질소는 숫자만 입력 가능합니다"),
|
ph: z.string().nullish(),
|
||||||
combResdch: z.string()
|
bod: z.number().nullish(),
|
||||||
.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]+$/, "생물학적 산소요구량은 숫자만 입력 가능합니다"),
|
|
||||||
/**컬럼확인필요 */
|
/**컬럼확인필요 */
|
||||||
clIonQnt: z.string()
|
clIonQnt: z.number().nullish(),
|
||||||
.min(1, "염화물을 입력해주세요")
|
smll: z.string(),
|
||||||
.regex(/^[0-9]+$/, "염화물은 숫자만 입력 가능합니다"),
|
cdtnv: z.number().nullish(),
|
||||||
smll: z.string()
|
crmty: z.number().nullish(),
|
||||||
.min(1, "냄새를 입력해주세요")
|
|
||||||
.regex(/^[0-9]+$/, "냄새는 숫자만 입력 가능합니다"),
|
|
||||||
cdtnv: z.string()
|
|
||||||
.min(1, "전기전도도를 입력해주세요")
|
|
||||||
.regex(/^[0-9]+$/, "전기전도도는 숫자만 입력 가능합니다"),
|
|
||||||
crmty: z.string()
|
|
||||||
.min(1, "색도를 입력해주세요")
|
|
||||||
.regex(/^[0-9]+$/, "색도는 숫자만 입력 가능합니다"),
|
|
||||||
rmrk: z.string().optional(),
|
rmrk: z.string().optional(),
|
||||||
/* telno: z.string()
|
/* telno: z.string()
|
||||||
.min(8, "전화번호는 8자 이상 입력해주세요")
|
.min(8, "전화번호는 8자 이상 입력해주세요")
|
||||||
.max(12, "전화번호는 12자 이내로 입력해주세요")
|
.max(12, "전화번호는 12자 이내로 입력해주세요")
|
||||||
.regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), */
|
.regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), */
|
||||||
candidateTitle: z.array(z.object({
|
candidateTitle: z
|
||||||
ruseUtztnFcltNm: z.string(),
|
.array(
|
||||||
ruseUtztnFcltCd: z.string(),
|
z.object({
|
||||||
})).optional(),
|
ruseUtztnFcltNm: z.string(),
|
||||||
|
ruseUtztnFcltCd: z.string(),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type FormData = z.infer<typeof sdmInfoFormSchema>;
|
export type FormData = z.infer<typeof sdmInfoFormSchema>;
|
||||||
|
|
||||||
function SdmInfoInsertContent() {
|
function SdmInfoInsertContent() {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const {insertSdmInfoData, Sdm ,setSubsInfo} = useDmStore((state) => state);
|
const { insertSdmInfoData, Sdm, setSubsInfo } = useDmStore((state) => state);
|
||||||
const { successLogin } = Sdm;
|
const { successLogin } = Sdm;
|
||||||
const [ismoneyDisabled, setIsmoneyDisabled] = useState(false);
|
const [ismoneyDisabled, setIsmoneyDisabled] = useState(false);
|
||||||
const formSchema = sdmInfoFormSchema;
|
const formSchema = sdmInfoFormSchema;
|
||||||
|
|
||||||
const [isLogin, setIsLogin] = useState(false);
|
const [isLogin, setIsLogin] = useState(false);
|
||||||
const [facilityName, setFacilityName] = useState<string>('');
|
const [facilityName, setFacilityName] = useState<string>("");
|
||||||
const [defaultValues, setDefaultValues] = useState<FormData>({
|
const [defaultValues, setDefaultValues] = useState<FormData>({
|
||||||
sdmNm: '',
|
sdmNm: "",
|
||||||
demandYmd: new Date(),
|
demandYmd: new Date(),
|
||||||
demandQnty: '',
|
demandQnty: "",
|
||||||
usePurpose: '',
|
usePurpose: "",
|
||||||
money: '',
|
money: "",
|
||||||
/**요구수질 */
|
/**요구수질 */
|
||||||
reqWaterQlty: '',
|
reqWaterQlty: "",
|
||||||
grssClfg: '',
|
grssClfg: null,
|
||||||
tn: '',
|
tn: null,
|
||||||
combResdch: '',
|
combResdch: null,
|
||||||
tph: '',
|
tph: null,
|
||||||
trbt: '',
|
trbt: null,
|
||||||
ph: '',
|
ph: null,
|
||||||
bod: '',
|
bod: null,
|
||||||
/**컬럼확인필요 */
|
/**컬럼확인필요 */
|
||||||
clIonQnt: '',
|
clIonQnt: null,
|
||||||
smll: '',
|
smll: "",
|
||||||
cdtnv: '',
|
cdtnv: null,
|
||||||
crmty: '',
|
crmty: null,
|
||||||
rmrk: '',
|
rmrk: "",
|
||||||
/** 후보지 제목 */
|
/** 후보지 제목 */
|
||||||
candidateTitle: [
|
candidateTitle: [
|
||||||
{ ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' },
|
{ ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" },
|
||||||
{ ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' },
|
{ ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" },
|
||||||
{ ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' },
|
{ ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const user = sessionStorage.getItem('user');
|
const user = sessionStorage.getItem("user");
|
||||||
setDefaultValues(prev => ({
|
setDefaultValues((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
sdmNm: searchParams.get('dmdCoNm') || '',
|
sdmNm: searchParams.get("dmdCoNm") || "",
|
||||||
}));
|
}));
|
||||||
sessionStorage.setItem('user', searchParams.get('dmdInfoId') || '');
|
sessionStorage.setItem("user", searchParams.get("dmdInfoId") || "");
|
||||||
setIsLogin(user || searchParams.get('dmdInfoId') ? true : false);
|
setIsLogin(user || searchParams.get("dmdInfoId") ? true : false);
|
||||||
}, [searchParams]);
|
}, [searchParams]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const local = localStorage.getItem('user');
|
const local = localStorage.getItem("user");
|
||||||
if (local) {
|
if (local) {
|
||||||
setIsLogin(true);
|
setIsLogin(true);
|
||||||
}
|
}
|
||||||
setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만)
|
setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만)
|
||||||
|
|
||||||
}, [setSubsInfo]);
|
}, [setSubsInfo]);
|
||||||
|
|
||||||
const form = useForm<FormData>({
|
const form = useForm<FormData>({
|
||||||
@@ -139,98 +117,138 @@ function SdmInfoInsertContent() {
|
|||||||
|
|
||||||
const subsInfo = useDmStore((state) => state.map.subsInfo);
|
const subsInfo = useDmStore((state) => state.map.subsInfo);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
//map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함
|
//map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함
|
||||||
if(subsInfo.length>0){
|
if (subsInfo.length > 0) {
|
||||||
form.setValue('candidateTitle', subsInfo)
|
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로 값 설정
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//후보지 팝업 값 셋팅
|
window.addEventListener("message", handleMessage);
|
||||||
useEffect(() => {
|
return () => window.removeEventListener("message", handleMessage);
|
||||||
const handleMessage = (event: MessageEvent) => {
|
}, [setSubsInfo]);
|
||||||
if (event.data?.type === 'SET_SUBS_INFO') {
|
|
||||||
setSubsInfo(event.data.payload); // zustand로 값 설정
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('message', handleMessage);
|
|
||||||
return () => window.removeEventListener('message', handleMessage);
|
|
||||||
}, [setSubsInfo]);
|
|
||||||
|
|
||||||
// 로그인 성공 시 모달 닫기 및 폼 업데이트
|
// 로그인 성공 시 모달 닫기 및 폼 업데이트
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (successLogin) {
|
if (successLogin) {
|
||||||
setIsLogin(true);
|
setIsLogin(true);
|
||||||
const user = sessionStorage.getItem('user');
|
const user = sessionStorage.getItem("user");
|
||||||
if (user) {
|
if (user) {
|
||||||
try {
|
try {
|
||||||
const userData = JSON.parse(user);
|
const userData = JSON.parse(user);
|
||||||
if (userData.dmdCoNm) {
|
if (userData.dmdCoNm) {
|
||||||
setFacilityName(userData.dmdCoNm);
|
setFacilityName(userData.dmdCoNm);
|
||||||
form.setValue('sdmNm', userData.dmdCoNm);
|
form.setValue("sdmNm", userData.dmdCoNm);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing user data:', error);
|
console.error("Error parsing user data:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [successLogin, form]);
|
}, [successLogin, form]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("Form state changed:", form.formState.errors);
|
||||||
|
}, [form.formState.errors]);
|
||||||
|
|
||||||
// 체크박스 상태가 변경될 때마다 money 필드의 에러를 초기화
|
// 체크박스 상태가 변경될 때마다 money 필드의 에러를 초기화
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (ismoneyDisabled) {
|
if (ismoneyDisabled) {
|
||||||
form.clearErrors('money');
|
form.clearErrors("money");
|
||||||
form.setValue('money', '');
|
form.setValue("money", "");
|
||||||
}
|
}
|
||||||
}, [ismoneyDisabled, form]);
|
}, [ismoneyDisabled, form]);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
||||||
try {
|
try {
|
||||||
// Transform form data to match API schema
|
const dmSubsInfo = data.candidateTitle?.filter(
|
||||||
const apiData: DemandCompType = {
|
(item) => item.ruseUtztnFcltNm && item.ruseUtztnFcltCd
|
||||||
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') || ''),
|
// Transform form data to madata.candidateTitletch API schema
|
||||||
dmdCoNm: JSON.parse(sessionStorage.getItem('user') || '{}')?.dmdCoNm?.toString() || data.sdmNm,
|
const apiData: DemandCompBizType = {
|
||||||
ctpvCd: JSON.parse(sessionStorage.getItem('user') || '{}')?.ctpvCd?.toString() || searchParams.get('ctpvCd') || '',
|
dmdInfoId:
|
||||||
sggCd: JSON.parse(sessionStorage.getItem('user') || '{}')?.sggCd?.toString() || searchParams.get('sggCd') || '',
|
JSON.parse(
|
||||||
daddr: JSON.parse(sessionStorage.getItem('user') || '{}')?.daddr?.toString() || searchParams.get('daddr') || '',
|
sessionStorage.getItem("user") || "{}"
|
||||||
telno: JSON.parse(sessionStorage.getItem('user') || '{}')?.telno?.toString() || searchParams.get('telno') || '',
|
)?.dmdInfoId?.toString() ||
|
||||||
rgtr: JSON.parse(sessionStorage.getItem('user') || '{}')?.rgtr?.toString() || searchParams.get('rgtr') || '',
|
searchParams.get("dmdInfoId") + (searchParams.get("bznmTotNo") || ""),
|
||||||
useUsgCd: data.usePurpose || '',
|
dmdInfoFk:
|
||||||
wntUntprc: Number(data.money) || '',
|
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(),
|
dmndTmng: data.demandYmd || new Date(),
|
||||||
dmndQty: Number(data.demandQnty) || '',
|
dmndQty: Number(data.demandQnty) || "",
|
||||||
grssClfg: Number(data.grssClfg) || '',
|
grssClfg: data.grssClfg === null ? -1 : Number(data.grssClfg),
|
||||||
tn: Number(data.tn) || '',
|
tn: Number(data.tn) || null,
|
||||||
combResdch: Number(data.combResdch) || '',
|
combResdch: Number(data.combResdch) || null,
|
||||||
tph: Number(data.tph) || '',
|
tph: Number(data.tph) || null,
|
||||||
trbt: Number(data.trbt) || '',
|
trbt: Number(data.trbt) || null,
|
||||||
ph: Number(data.ph) || '',
|
ph: data.ph || "",
|
||||||
blgcOxygDmndQnt: Number(data.bod) || '',
|
blgcOxygDmndQnt: Number(data.bod) ||null,
|
||||||
clIonQnt: Number(data.clIonQnt) || '',
|
clIonQnt: Number(data.clIonQnt) || null,
|
||||||
smll: Number(data.smll) || '',
|
smll: data.smll || "",
|
||||||
cdtnv: Number(data.cdtnv) || '',
|
cdtnv: Number(data.cdtnv) ||null,
|
||||||
crmty: Number(data.crmty) || '',
|
crmty: Number(data.crmty) || null,
|
||||||
rmrk: data.rmrk || '',
|
rmrk: data.rmrk || "",
|
||||||
bzmnNo: "",
|
bzmnNo: "",
|
||||||
dmdAplyPswd: "",
|
dmdAplyPswd: "",
|
||||||
index: 0,
|
index: 0,
|
||||||
reqDt: "",
|
reqDt: "",
|
||||||
dmdInfoSn: 0,
|
dmdInfoSn: 0,
|
||||||
status: '',
|
status: "",
|
||||||
splyCndtList: data.candidateTitle || [],
|
splyCndtList: dmSubsInfo || [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await insertSdmInfoData(apiData);
|
await insertSdmInfoData(apiData);
|
||||||
|
setTimeout(() => {
|
||||||
|
router.push("/");
|
||||||
|
}, 1000); // 0.8초 후 이동
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error submitting form:', error);
|
console.error("Error submitting form:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -253,8 +271,10 @@ const router = useRouter();
|
|||||||
/>
|
/>
|
||||||
<div className="flex justify-center pt-4">
|
<div className="flex justify-center pt-4">
|
||||||
<Button
|
<Button
|
||||||
|
color="sky"
|
||||||
|
size={"sm"}
|
||||||
type="submit"
|
type="submit"
|
||||||
className="w-40 bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded-md transition-colors duration-200"
|
className="w-40 font-semibold py-2 px-4 rounded-md "
|
||||||
>
|
>
|
||||||
수요정보 등록
|
수요정보 등록
|
||||||
</Button>
|
</Button>
|
||||||
@@ -264,20 +284,21 @@ const router = useRouter();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!isLogin ?
|
{!isLogin ? (
|
||||||
<UiModal
|
<UiModal
|
||||||
body={<SdmLogin />}
|
body={<SdmLogin />}
|
||||||
bodyClass="sm:max-w-[90vw] w-[530px] h-[430px]"
|
bodyClass="sm:max-w-[90vw] w-[530px] h-[430px]"
|
||||||
open={!isLogin}
|
open={!isLogin}
|
||||||
onOpenChange={(open) => {
|
onOpenChange={(open) => {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
|
toast.dismiss();
|
||||||
router.push("/");
|
router.push("/");
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
noHeaderYn="Y"
|
noHeaderYn="Y"
|
||||||
noFooterYn="Y"
|
noFooterYn="Y"
|
||||||
/>
|
/>
|
||||||
: null}
|
) : null}
|
||||||
<Toaster position="top-center" />
|
<Toaster position="top-center" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -290,4 +311,3 @@ export default function MyForm() {
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useDmStore } from "@/app/store";
|
import { useDmStore } from "@/app/store";
|
||||||
import type { DemandCompType } from "@/app/store/sdmMng";
|
|
||||||
import SdmInsertForm from '@common/business_components/ui/sdmInsertForm';
|
import SdmInsertForm from '@common/business_components/ui/sdmInsertForm';
|
||||||
|
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useCallback, useEffect, useRef } from "react";
|
import { useCallback, useEffect, useRef } from "react";
|
||||||
import { Toaster } from "react-hot-toast";
|
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 handleInsertSdmData = useCallback((data: import('@common/business_components/ui/sdmInsertForm/form').DemandCompType) => {
|
||||||
const convertedData: DemandCompType = {
|
const convertedData: DemandCompType = {
|
||||||
...data,
|
...data,
|
||||||
dmdInfoSn: '',
|
|
||||||
dmdInfoFk: '',
|
|
||||||
status: '',
|
|
||||||
splyCndtList: []
|
|
||||||
};
|
};
|
||||||
formDataRef.current = convertedData;
|
formDataRef.current = convertedData;
|
||||||
insertSdmData(convertedData).catch(error => {
|
insertSdmData(convertedData)
|
||||||
console.error('Error inserting SDM data:', error);
|
|
||||||
});
|
|
||||||
}, [insertSdmData]);
|
}, [insertSdmData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -70,4 +64,3 @@ export default function MyForm() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export default function WrAboutPage() {
|
|||||||
물재이용 필요성
|
물재이용 필요성
|
||||||
</h2>
|
</h2>
|
||||||
<section aria-labelledby="card2-desc" className="bg-white border border-gray-300 rounded-xl p-[60px] pt-[70px] pb-[70px] ">
|
<section aria-labelledby="card2-desc" className="bg-white border border-gray-300 rounded-xl p-[60px] pt-[70px] pb-[70px] ">
|
||||||
<h1 id="card2-desc" className="font-NotoSansKR text-[#ED5534] text-5xl font-semibold mb-8">물 재이용, 왜 필요한가요?</h1>
|
<h1 id="card2-desc" className="font-NotoSansKR text-[#D63F1F] text-5xl font-semibold mb-8">물 재이용, 왜 필요한가요?</h1>
|
||||||
<p className="font-NotoSansKR text-2xl font-normal mb-10 leading-relaxed">
|
<p className="font-NotoSansKR text-2xl font-normal mb-10 leading-relaxed">
|
||||||
빗물, 중수, 하수처리수는 지속적으로 이용 가능한 순환자원입니다.<br />
|
빗물, 중수, 하수처리수는 지속적으로 이용 가능한 순환자원입니다.<br />
|
||||||
물 재이용을 통한 효율적인 수자원 활용은 물 스트레스국가인 우리나라에서<br />가뭄대응능력 향상 및 하천수질보전을 위해 반드시 필요한 일입니다.
|
물 재이용을 통한 효율적인 수자원 활용은 물 스트레스국가인 우리나라에서<br />가뭄대응능력 향상 및 하천수질보전을 위해 반드시 필요한 일입니다.
|
||||||
@@ -237,7 +237,7 @@ export default function WrAboutPage() {
|
|||||||
하수 재이용
|
하수 재이용
|
||||||
</h2>
|
</h2>
|
||||||
<section aria-labelledby="card5-desc" className="bg-white border border-gray-300 rounded-xl p-[60px] pt-[70px] pb-[70px] ">
|
<section aria-labelledby="card5-desc" className="bg-white border border-gray-300 rounded-xl p-[60px] pt-[70px] pb-[70px] ">
|
||||||
<h1 id="card5-desc" className="font-NotoSansKR leading-snug text-[#0099A4] text-5xl font-bold mb-6">아직 할 일이 많은 하수처리수,<br />풍족하게 재이용할 수 있어요!</h1>
|
<h1 id="card5-desc" className="font-NotoSansKR leading-snug text-[#00818A] text-5xl font-bold mb-6">아직 할 일이 많은 하수처리수,<br />풍족하게 재이용할 수 있어요!</h1>
|
||||||
<p className="font-NotoSansKR text-2xl mb-10 leading-relaxed">사용하고 버려져 공공하수처리장으로 모여든 물은<br />용도에 맞는 처리 후 재이용 할 수 있습니다.</p>
|
<p className="font-NotoSansKR text-2xl mb-10 leading-relaxed">사용하고 버려져 공공하수처리장으로 모여든 물은<br />용도에 맞는 처리 후 재이용 할 수 있습니다.</p>
|
||||||
<Image
|
<Image
|
||||||
src="/img/wrAbout/img_05_1.png"
|
src="/img/wrAbout/img_05_1.png"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { CHART_FORM, MainChart, type ChartConfig } from '@common/business_components';
|
import { CHART_FORM, MainChart, type ChartConfig } from '@common/business_components';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState, useMemo, useCallback } from 'react';
|
||||||
|
|
||||||
interface RegionData {
|
interface RegionData {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -213,7 +213,7 @@ const WrStatusPage: React.FC = () => {
|
|||||||
{ region: '제주특별자치도', sewage: '8(1,666)', rainwater: '47(5,746)', reclaimed: '64(660)', thermal: '0' },
|
{ region: '제주특별자치도', sewage: '8(1,666)', rainwater: '47(5,746)', reclaimed: '64(660)', thermal: '0' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const regionData: RegionData[] = [
|
const regionData: RegionData[] = useMemo(() => [
|
||||||
{ name: '서울', x: 170, y: 140, values: [0.3, 0.3, 0.2, 0.2] },
|
{ name: '서울', x: 170, y: 140, values: [0.3, 0.3, 0.2, 0.2] },
|
||||||
{ name: '인천', x: 120, y: 150, values: [0.3, 0.3, 0.2, 0.2] },
|
{ name: '인천', x: 120, y: 150, values: [0.3, 0.3, 0.2, 0.2] },
|
||||||
{ name: '경기', x: 210, y: 210, values: [0.3, 0.3, 0.2, 0.2] },
|
{ name: '경기', x: 210, y: 210, values: [0.3, 0.3, 0.2, 0.2] },
|
||||||
@@ -231,7 +231,7 @@ const WrStatusPage: React.FC = () => {
|
|||||||
{ name: '울산', x: 450, y: 500, values: [0.3, 0.3, 0.2, 0.2] },
|
{ name: '울산', x: 450, y: 500, values: [0.3, 0.3, 0.2, 0.2] },
|
||||||
{ name: '부산', x: 420, y: 550, values: [0.3, 0.3, 0.2, 0.2] },
|
{ name: '부산', x: 420, y: 550, values: [0.3, 0.3, 0.2, 0.2] },
|
||||||
{ name: '제주', x: 60, y: 750, values: [0.3, 0.3, 0.2, 0.2] },
|
{ name: '제주', x: 60, y: 750, values: [0.3, 0.3, 0.2, 0.2] },
|
||||||
];
|
], []);
|
||||||
|
|
||||||
const handleMarkerClick = (regionId: string) => {
|
const handleMarkerClick = (regionId: string) => {
|
||||||
if (selectedRegion === regionId) {
|
if (selectedRegion === regionId) {
|
||||||
@@ -242,7 +242,7 @@ const WrStatusPage: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const createDonutMarker = (svg: SVGSVGElement, x: number, y: number, name: string, values: number[]) => {
|
const createDonutMarker = useCallback((svg: SVGSVGElement, x: number, y: number, name: string, values: number[]) => {
|
||||||
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FED16A'];
|
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FED16A'];
|
||||||
const radius = 26;
|
const radius = 26;
|
||||||
const innerRadius = 18;
|
const innerRadius = 18;
|
||||||
@@ -334,7 +334,7 @@ const WrStatusPage: React.FC = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
svg.appendChild(g);
|
svg.appendChild(g);
|
||||||
};
|
}, [handleMarkerClick, regionIdMap]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadSVG = async () => {
|
const loadSVG = async () => {
|
||||||
@@ -374,7 +374,7 @@ const WrStatusPage: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadSVG();
|
loadSVG();
|
||||||
}, []);
|
}, [createDonutMarker, regionData]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const svg = svgContainerRef.current?.querySelector('svg');
|
const svg = svgContainerRef.current?.querySelector('svg');
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="ko">
|
<html lang="ko">
|
||||||
|
<head>
|
||||||
|
<title>물재이용 대민</title>
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{children}
|
{children}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
import type { SelectDataType } from "@common/business_components/ui";
|
import type { SelectDataType } from "@common/business_components/ui";
|
||||||
import type { TableUpperProps } from "../common";
|
import type { TableUpperProps } from "../common";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
|
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||||
|
|
||||||
/**====================================
|
/**====================================
|
||||||
* Store - 타입
|
* Store - 타입
|
||||||
=====================================*/
|
=====================================*/
|
||||||
// 수요처 정보
|
// 수요처 정보
|
||||||
export type DemandCompType = {
|
export type DemandCompBizType = {
|
||||||
index : number | '';
|
index : number | '';
|
||||||
dmdInfoId : string | '';
|
dmdInfoId : string | '';
|
||||||
dmdInfoFk : string | '';
|
dmdInfoFk : string | '';
|
||||||
@@ -23,22 +24,23 @@ export type DemandCompType = {
|
|||||||
wntUntprc : number | '';
|
wntUntprc : number | '';
|
||||||
dmndTmng : Date | '';
|
dmndTmng : Date | '';
|
||||||
dmndQty : number | '';
|
dmndQty : number | '';
|
||||||
grssClfg : number | '';
|
grssClfg : number | null //총대장균군수
|
||||||
tn : number | '';
|
tn : number | null //총질소
|
||||||
combResdch : number | '';
|
combResdch : number | null //결합잔류염소
|
||||||
tph : number | '';
|
tph : number | null //총인
|
||||||
trbt : number | '';
|
trbt : number | null //탁도
|
||||||
ph : number | '';
|
ph : string | ''; //수소이온농
|
||||||
blgcOxygDmndQnt : number | '';
|
blgcOxygDmndQnt : number | null //생물학적산소요구량
|
||||||
clIonQnt : number | '';
|
clIonQnt : number | null //염화물
|
||||||
smll : number | '';
|
smll : string | ''; //냄새
|
||||||
cdtnv : number | '';
|
cdtnv : number | null; //전기전도도
|
||||||
crmty : number | '';
|
crmty : number | null //색도
|
||||||
rmrk : string | '';
|
rmrk : string | '';
|
||||||
reqDt : string | '';
|
reqDt : string | '';
|
||||||
dmdInfoSn : number | '';
|
dmdInfoSn : number | '';
|
||||||
status : string | '';
|
status : string | '';
|
||||||
splyCndtList:SupplyCandidate[]|[],
|
splyCndtList:SupplyCandidate[]|[],
|
||||||
|
ruseUtztnFcltNm?:string|''
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +154,8 @@ export type MoneyDetailType = {
|
|||||||
clclnBrdnCst : string | '';
|
clclnBrdnCst : string | '';
|
||||||
clclnEcqrRt : string | '';
|
clclnEcqrRt : string | '';
|
||||||
}
|
}
|
||||||
|
// 규칙 타입 선언
|
||||||
|
export type DisableRulesType = Record<string, string[]>;
|
||||||
/**====================================
|
/**====================================
|
||||||
* Store - 데이터
|
* Store - 데이터
|
||||||
====================================*/
|
====================================*/
|
||||||
@@ -160,6 +163,131 @@ export type MoneyDetailType = {
|
|||||||
const demandCompList : DemandCompType[] = [
|
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<string, object> = {
|
||||||
|
"청소": {
|
||||||
|
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[] = [
|
const useTypesData : SelectDataType[] = [
|
||||||
{ text: '청소', val: "청소" },
|
{ text: '청소', val: "청소" },
|
||||||
@@ -167,7 +295,8 @@ const useTypesData : SelectDataType[] = [
|
|||||||
{ text: "세척", val: "세척" },
|
{ text: "세척", val: "세척" },
|
||||||
{ text: "살수", val: "살수" },
|
{ text: "살수", val: "살수" },
|
||||||
{ text: "조경", val: "조경" },
|
{ text: "조경", val: "조경" },
|
||||||
{ text: "농업", val: "농업" },
|
{ text: "농업_간접용수", val: "농업_간접용수" },
|
||||||
|
{ text: "농업_직접용수", val: "농업_직접용수" },
|
||||||
{ text: "하천", val: "하천" },
|
{ text: "하천", val: "하천" },
|
||||||
{ text: "지하수", val: "지하수" },
|
{ text: "지하수", val: "지하수" },
|
||||||
{ text: "공업", val: "공업" },
|
{ text: "공업", val: "공업" },
|
||||||
@@ -280,7 +409,7 @@ const postSdmData = async (data: DemandCompType) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 수요정보 등록
|
// 수요정보 등록
|
||||||
const postSdmInfoData = async (data: DemandCompType) => {
|
const postSdmInfoData = async (data: DemandCompBizType) => {
|
||||||
try {
|
try {
|
||||||
await postFetch("/reuseFc/request/demandInfo", data);
|
await postFetch("/reuseFc/request/demandInfo", data);
|
||||||
toast.success('수요 정보 등록에 성공하였습니다.');
|
toast.success('수요 정보 등록에 성공하였습니다.');
|
||||||
@@ -360,7 +489,7 @@ const fetchGetSimilarCaseList = async (part: string, value: number|string) => {
|
|||||||
export type SdmActions = {
|
export type SdmActions = {
|
||||||
initializeSdmData: () => void;
|
initializeSdmData: () => void;
|
||||||
insertSdmData: (data: DemandCompType) => Promise<void>;
|
insertSdmData: (data: DemandCompType) => Promise<void>;
|
||||||
insertSdmInfoData: (data: DemandCompType) => Promise<void>;
|
insertSdmInfoData: (data: DemandCompBizType) => Promise<void>;
|
||||||
getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>;
|
getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>;
|
||||||
actionLogin: (data: DemandCompType) => Promise<void>;
|
actionLogin: (data: DemandCompType) => Promise<void>;
|
||||||
getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>;
|
getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>;
|
||||||
@@ -378,9 +507,10 @@ export type SdmType ={
|
|||||||
moneyDetailList: MoneyDetailType[];
|
moneyDetailList: MoneyDetailType[];
|
||||||
|
|
||||||
// 수요정보 신청현황
|
// 수요정보 신청현황
|
||||||
sdmInfoStatusList: DemandCompType[];
|
sdmInfoStatusList: DemandCompBizType[];
|
||||||
upHeadSdmInfoStatus: TableUpperProps[];
|
upHeadSdmInfoStatus: TableUpperProps[];
|
||||||
|
defaultRules: Record<string, object>
|
||||||
|
disableRules: DisableRulesType;
|
||||||
// 로그인관련
|
// 로그인관련
|
||||||
successNextPage : boolean;
|
successNextPage : boolean;
|
||||||
successLogin: boolean;
|
successLogin: boolean;
|
||||||
@@ -398,7 +528,10 @@ export const SdmState: SdmType = {
|
|||||||
moneyDetailList: moneyDetailList,
|
moneyDetailList: moneyDetailList,
|
||||||
// 수요정보 신청현황
|
// 수요정보 신청현황
|
||||||
sdmInfoStatusList: [],
|
sdmInfoStatusList: [],
|
||||||
|
defaultRules:defaultRules,
|
||||||
|
disableRules:disableRules,
|
||||||
upHeadSdmInfoStatus: upHeadSdmInfoStatus,
|
upHeadSdmInfoStatus: upHeadSdmInfoStatus,
|
||||||
|
|
||||||
// 로그인관련
|
// 로그인관련
|
||||||
successNextPage : false,
|
successNextPage : false,
|
||||||
successLogin: false,
|
successLogin: false,
|
||||||
@@ -428,7 +561,7 @@ export const SdmReducer = (set: any): SdmActions => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
insertSdmInfoData: async (data: DemandCompType) => {
|
insertSdmInfoData: async (data: DemandCompBizType) => {
|
||||||
postSdmInfoData(data);
|
postSdmInfoData(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -465,11 +598,13 @@ export const SdmReducer = (set: any): SdmActions => {
|
|||||||
}))
|
}))
|
||||||
return;
|
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 matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn);
|
||||||
const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청';
|
const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청';
|
||||||
|
const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : '';
|
||||||
|
|
||||||
|
|
||||||
const tmpData = {
|
const tmpData = {
|
||||||
...el,
|
...el,
|
||||||
@@ -485,7 +620,9 @@ export const SdmReducer = (set: any): SdmActions => {
|
|||||||
useUsgCd: el.useUsgCd,
|
useUsgCd: el.useUsgCd,
|
||||||
dmndTmng: el.dmndTmng,
|
dmndTmng: el.dmndTmng,
|
||||||
dmdInfoSn : el.dmdInfoSn,
|
dmdInfoSn : el.dmdInfoSn,
|
||||||
status : status
|
status : status,
|
||||||
|
splyCndtList: el.splyCndtList,
|
||||||
|
ruseUtztnFcltNm: ruseUtztnFcltNm || ''
|
||||||
}
|
}
|
||||||
sdmInfoStatusList.push(tmpData);
|
sdmInfoStatusList.push(tmpData);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ export const StoreZus = (initState: DmState= {
|
|||||||
...dmMapState,
|
...dmMapState,
|
||||||
}) => {
|
}) => {
|
||||||
return createStore<DmStore>()((set) => {
|
return createStore<DmStore>()((set) => {
|
||||||
tokenManager.setToken("site-id-key", 'DM');
|
if (typeof window !== "undefined") {
|
||||||
tokenManager.setToken("site-theme-key", 'green');
|
tokenManager.setToken("site-id-key", 'DM');
|
||||||
|
tokenManager.setToken("site-theme-key", 'green');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useDmStore } from '@/app/store';
|
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';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
type thisProps = {
|
type thisProps = {
|
||||||
|
|||||||
@@ -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, "");
|
||||||
|
};
|
||||||
@@ -118,14 +118,6 @@ export function SearchBar({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row space-x-2">
|
<div className="flex flex-row space-x-2">
|
||||||
<Button
|
|
||||||
color="red"
|
|
||||||
className="mx-2 mt-2"
|
|
||||||
size={"sm"}
|
|
||||||
onClick={() => {}}
|
|
||||||
>
|
|
||||||
후보지선택
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
color="sky"
|
color="sky"
|
||||||
className="mt-2"
|
className="mt-2"
|
||||||
|
|||||||
@@ -1,28 +1,29 @@
|
|||||||
import { FormUi } from "@common/business_components/ui";
|
import { FormUi } from "@common/business_components/ui";
|
||||||
import type { ReactNode } from "react";
|
|
||||||
import type { ControllerRenderProps, FieldError, FieldValues, Path } from "react-hook-form";
|
import type { ControllerRenderProps, FieldError, FieldValues, Path } from "react-hook-form";
|
||||||
|
import { cloneElement, isValidElement } from "react";
|
||||||
|
|
||||||
interface AccessibleFormFieldProps<T extends FieldValues> {
|
interface AccessibleFormFieldProps<T extends FieldValues> {
|
||||||
field: ControllerRenderProps<T, Path<T>>;
|
field: ControllerRenderProps<T, Path<T>>;
|
||||||
label: string;
|
label: string;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
error?: FieldError;
|
error?: FieldError;
|
||||||
inputComponent: ReactNode;
|
isDisabled?: boolean;
|
||||||
|
inputComponent: React.ReactElement<{ disabled?: boolean }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AccessibleFormField<T extends FieldValues>({
|
export function AccessibleFormField<T extends FieldValues>({
|
||||||
label,
|
label,
|
||||||
required = false,
|
required = false,
|
||||||
error,
|
|
||||||
inputComponent,
|
inputComponent,
|
||||||
|
isDisabled = false,
|
||||||
}: AccessibleFormFieldProps<T>) {
|
}: AccessibleFormFieldProps<T>) {
|
||||||
const labelText = required ? `${label} *` : label;
|
const labelText = required ? `${label} *` : label;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormUi label={labelText}>
|
<FormUi label={labelText} isDisabled={isDisabled}>
|
||||||
<div>
|
<div>
|
||||||
{inputComponent}
|
{isValidElement(inputComponent)
|
||||||
|
? cloneElement(inputComponent, { disabled: isDisabled } as Partial<typeof inputComponent.props>)
|
||||||
|
: inputComponent}
|
||||||
{/* {error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (
|
{/* {error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (
|
||||||
<p key={idx} className="text-red-500 text-sm mt-1" role="alert">
|
<p key={idx} className="text-red-500 text-sm mt-1" role="alert">
|
||||||
{msg}
|
{msg}
|
||||||
|
|||||||
@@ -11,13 +11,20 @@ import {
|
|||||||
UiModal,
|
UiModal,
|
||||||
} from "@common/business_components";
|
} from "@common/business_components";
|
||||||
import { Input } from "@common/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 { useSearchParams } from "next/navigation";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { AccessibleFormField } from "./AccessibleFormField";
|
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 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 {
|
export interface SdmInfoRegFormProps {
|
||||||
form: UseFormReturn<FormData>;
|
form: UseFormReturn<FormData>;
|
||||||
@@ -35,12 +42,15 @@ export function SdmInfoRegForm({
|
|||||||
facilityName,
|
facilityName,
|
||||||
}: SdmInfoRegFormProps) {
|
}: SdmInfoRegFormProps) {
|
||||||
const { initializeCommonData, Sdm } = useDmStore((state) => state);
|
const { initializeCommonData, Sdm } = useDmStore((state) => state);
|
||||||
const { useTypesData } = Sdm;
|
const { useTypesData, defaultRules, disableRules } = Sdm;
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
const [sdmNmValue, setSdmNmValue] = useState<string>(
|
const [sdmNmValue, setSdmNmValue] = useState<string>(
|
||||||
searchParams.get("dmdCoNm") || ""
|
searchParams.get("dmdCoNm") || ""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [frontPHdata, setFrontPHdata] = useState("0");
|
||||||
|
const [backPHdata, setBackPHdata] = useState("0");
|
||||||
const [isBznmTotNoDisabled, setIsBznmTotNoDisabled] = useState(false);
|
const [isBznmTotNoDisabled, setIsBznmTotNoDisabled] = useState(false);
|
||||||
const [isSimilarCase, setIsSimilarCase] = useState(false);
|
const [isSimilarCase, setIsSimilarCase] = useState(false);
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
@@ -57,14 +67,15 @@ export function SdmInfoRegForm({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("candidateTitle ", form.getValues("candidateTitle"));
|
console.log("candidateTitle ", form.getValues("candidateTitle"));
|
||||||
}, [form.getValues("candidateTitle")]);
|
}, [form.getValues]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (useTypesData && useTypesData.length > 0) {
|
if (useTypesData && useTypesData.length > 0) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
form.setValue("usePurpose", useTypesData[0]?.val?.toString() || "");
|
form.setValue("usePurpose", useTypesData[0]?.val?.toString() || "");
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}, [useTypesData, form]);
|
}, [useTypesData, form.setValue, form]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (facilityName) {
|
if (facilityName) {
|
||||||
@@ -72,7 +83,7 @@ export function SdmInfoRegForm({
|
|||||||
form.setValue("sdmNm", facilityName);
|
form.setValue("sdmNm", facilityName);
|
||||||
setKey((prev) => prev + 1);
|
setKey((prev) => prev + 1);
|
||||||
}
|
}
|
||||||
}, [facilityName, form]);
|
}, [facilityName, form.setValue, form]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchParams.get("dmdCoNm")) {
|
if (searchParams.get("dmdCoNm")) {
|
||||||
@@ -80,7 +91,7 @@ export function SdmInfoRegForm({
|
|||||||
setSdmNmValue(searchParams.get("dmdCoNm") || "");
|
setSdmNmValue(searchParams.get("dmdCoNm") || "");
|
||||||
setKey((prev) => prev + 1);
|
setKey((prev) => prev + 1);
|
||||||
}
|
}
|
||||||
}, [searchParams, form]);
|
}, [searchParams, form.setValue, form]);
|
||||||
|
|
||||||
const searchCandidate = (e: React.MouseEvent) => {
|
const searchCandidate = (e: React.MouseEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -109,6 +120,54 @@ export function SdmInfoRegForm({
|
|||||||
onCheckboxChange?.(checked);
|
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(
|
const selectComp = useCallback(
|
||||||
(rtnData: DemandCompType[]) => {
|
(rtnData: DemandCompType[]) => {
|
||||||
@@ -178,7 +237,6 @@ export function SdmInfoRegForm({
|
|||||||
required: true,
|
required: true,
|
||||||
component: (field) => (
|
component: (field) => (
|
||||||
<Input
|
<Input
|
||||||
placeholder="요구수량(㎥/d)을 입력하세요"
|
|
||||||
type="text"
|
type="text"
|
||||||
className="!text-xl text-gray-600"
|
className="!text-xl text-gray-600"
|
||||||
value={field.value as string}
|
value={field.value as string}
|
||||||
@@ -222,7 +280,6 @@ export function SdmInfoRegForm({
|
|||||||
isDisabled={isBznmTotNoDisabled}
|
isDisabled={isBznmTotNoDisabled}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder="희망단가(원/㎥)을 입력하세요"
|
|
||||||
type="text"
|
type="text"
|
||||||
className="!text-xl text-gray-600"
|
className="!text-xl text-gray-600"
|
||||||
value={field.value as string}
|
value={field.value as string}
|
||||||
@@ -244,221 +301,7 @@ export function SdmInfoRegForm({
|
|||||||
required: true,
|
required: true,
|
||||||
component: undefined,
|
component: undefined,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "grssClfg",
|
|
||||||
label: "총대장균군수(개/100ml)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="총대장균군수를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "tn",
|
|
||||||
label: "총질소(T-N)(mg/L)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="총질소를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "combResdch",
|
|
||||||
label: "결합잔류염소(mg/L)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="결합잔류염소를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "tph",
|
|
||||||
label: "총인(T-P)(mg/L)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="총인을 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "trbt",
|
|
||||||
label: "탁도(NTU)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="탁도를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ph",
|
|
||||||
label: "수소이온농도(pH)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="수소이온농도를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "bod",
|
|
||||||
label: "생물학적 산소요구량(BOD)(mg/L)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="생물학적 산소요구량을 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "clIonQnt",
|
|
||||||
label: "염화물(mgCL/L)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="염화물을 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "smll",
|
|
||||||
label: "냄새",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="냄새를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "cdtnv",
|
|
||||||
label: "전기전도도(㎲/cm)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="전기전도도를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "crmty",
|
|
||||||
label: "색도(도)",
|
|
||||||
formIndex: 1,
|
|
||||||
required: true,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="색도를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "rmrk",
|
|
||||||
label: "비고",
|
|
||||||
formIndex: 1,
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="비고를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!text-xl text-gray-600"
|
|
||||||
value={field.value as string}
|
|
||||||
onChange={field.onChange}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
name={field.name}
|
|
||||||
ref={field.ref}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "candidateTitle",
|
name: "candidateTitle",
|
||||||
label: CANDIDATE || "공급처 후보지 선택(필수아님)",
|
label: CANDIDATE || "공급처 후보지 선택(필수아님)",
|
||||||
@@ -466,10 +309,20 @@ export function SdmInfoRegForm({
|
|||||||
component: () => (
|
component: () => (
|
||||||
<div>
|
<div>
|
||||||
<div className="-mt-14 float-right flex gap-10">
|
<div className="-mt-14 float-right flex gap-10">
|
||||||
<Button className={"bg-gray-200"} onClick={searchCandidate}>
|
<Button
|
||||||
|
className="rounded-md"
|
||||||
|
color="sky"
|
||||||
|
size={"sm"}
|
||||||
|
onClick={searchCandidate}
|
||||||
|
>
|
||||||
후보지 조회
|
후보지 조회
|
||||||
</Button>
|
</Button>
|
||||||
<Button className={"bg-gray-200"} onClick={searchSimilarCase}>
|
<Button
|
||||||
|
className="rounded-md"
|
||||||
|
color="sky"
|
||||||
|
size={"sm"}
|
||||||
|
onClick={searchSimilarCase}
|
||||||
|
>
|
||||||
유사사례
|
유사사례
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -495,9 +348,9 @@ export function SdmInfoRegForm({
|
|||||||
const normalFields = formFields.filter(
|
const normalFields = formFields.filter(
|
||||||
(f) => f.formIndex === 0 && f.component
|
(f) => f.formIndex === 0 && f.component
|
||||||
);
|
);
|
||||||
const groupFields = formFields.filter(
|
// const groupFields = formFields.filter(
|
||||||
(f) => f.formIndex === 1 && f.component
|
// (f) => f.formIndex === 1 && f.component
|
||||||
);
|
// );
|
||||||
const candidateFields = formFields.filter(
|
const candidateFields = formFields.filter(
|
||||||
(f) => f.formIndex === 2 && f.component
|
(f) => f.formIndex === 2 && f.component
|
||||||
);
|
);
|
||||||
@@ -512,17 +365,15 @@ export function SdmInfoRegForm({
|
|||||||
name={name}
|
name={name}
|
||||||
render={({ field }) =>
|
render={({ field }) =>
|
||||||
name === "money" ? (
|
name === "money" ? (
|
||||||
component(field)
|
// component(field)
|
||||||
|
<FormUi label={label + "*"}>{component(field)}</FormUi>
|
||||||
) : (
|
) : (
|
||||||
// <FormUi label={label}>
|
|
||||||
// {component(field)}
|
|
||||||
// </FormUi>
|
|
||||||
<AccessibleFormField
|
<AccessibleFormField
|
||||||
field={field}
|
field={field}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
error={
|
error={
|
||||||
typeof form.formState.errors[name]?.message === 'string'
|
typeof form.formState.errors[name]?.message === "string"
|
||||||
? (form.formState.errors[name] as FieldError)
|
? (form.formState.errors[name] as FieldError)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@@ -534,37 +385,527 @@ export function SdmInfoRegForm({
|
|||||||
) : null
|
) : null
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{groupFields.length > 0 && (
|
<div className="mt-10">
|
||||||
<div className="mt-10">
|
<FormLabel className="text-xl">요구수질</FormLabel>
|
||||||
<FormLabel className="text-xl">요구수질</FormLabel>
|
<div className="grid grid-cols-2 gap-x-10 gap-y-6 mt-3 mb-3">
|
||||||
<div className="flex flex-wrap justify-start gap-10 mt-3 mb-3">
|
<FormField
|
||||||
{groupFields.map(({ name, label, component, required }) => (
|
control={form.control}
|
||||||
<div key={name} className="min-w-[180px]">
|
name={`grssClfg`}
|
||||||
<FormField
|
render={({ field }) => {
|
||||||
control={form.control}
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
name={name}
|
const isDisabled = disabledFields
|
||||||
render={({ field }) => (
|
? disabledFields.includes(field.name)
|
||||||
// <FormUi label={label}>
|
: true;
|
||||||
// {component?.(field)}
|
return (
|
||||||
// </FormUi>
|
<FormUi
|
||||||
<AccessibleFormField
|
label={
|
||||||
field={field}
|
!isDisabled ? `총대장균군수(개/mg)*` : "총대장균군수(개/mg)"
|
||||||
label={label}
|
}
|
||||||
required={required}
|
>
|
||||||
error={
|
<div className="flex items-center gap-2">
|
||||||
typeof form.formState.errors[name]?.message === 'string'
|
<div className="relative flex-1 min-w-0">
|
||||||
? (form.formState.errors[name] as FieldError)
|
<Input
|
||||||
: undefined
|
type="text"
|
||||||
}
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
inputComponent={component?.(field)}
|
placeholder=""
|
||||||
/>
|
onChange={(e) => {
|
||||||
)}
|
const inputValue = e.target.value.replace(
|
||||||
/>
|
/[^0-9]/g,
|
||||||
</div>
|
""
|
||||||
))}
|
); // 정수만
|
||||||
|
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 ? (
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`tn`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi
|
||||||
|
label={
|
||||||
|
!isDisabled ? `총질소(T-N)(mg/L)*` : "총질소(T-N)(mg/L)"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`combResdch`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi
|
||||||
|
label={
|
||||||
|
!isDisabled ? `결합잔류염소(mg/L)*` : "결합잔류염소(mg/L)"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이상
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`tph`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi
|
||||||
|
label={!isDisabled ? `총인(T-P)(mg/L)*` : "총인(T-P)(mg/L)"}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`trbt`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi label={!isDisabled ? `탁도(NTU)*` : "탁도(NTU)"}>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div className="col-span-1">
|
||||||
|
<Label className="text-xl">수소이온농도(PH)</Label>
|
||||||
|
<div className="flex flex-row items-center gap-2">
|
||||||
|
<Input
|
||||||
|
className="!text-xl w-36"
|
||||||
|
placeholder=""
|
||||||
|
type="text"
|
||||||
|
onChange={(e) => {
|
||||||
|
const cleanValue = sanitizeInput(e.target.value, true);
|
||||||
|
isSetPh(cleanValue, 1);
|
||||||
|
}}
|
||||||
|
value={frontPHdata ?? ""}
|
||||||
|
maxLength={5}
|
||||||
|
/>
|
||||||
|
<span className="text-xl mx-2">~</span>
|
||||||
|
<Input
|
||||||
|
className="!text-xl w-36 "
|
||||||
|
placeholder=""
|
||||||
|
type="text"
|
||||||
|
onChange={(e) => {
|
||||||
|
const cleanValue = sanitizeInput(e.target.value, true);
|
||||||
|
isSetPh(cleanValue, 0);
|
||||||
|
}}
|
||||||
|
value={backPHdata ?? ""}
|
||||||
|
maxLength={5}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`bod`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi
|
||||||
|
label={
|
||||||
|
!isDisabled
|
||||||
|
? `생물학적 산소요구량(BOD)(mg/L)*`
|
||||||
|
: "생물학적 산소요구량(BOD)(mg/L)"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`clIonQnt`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi
|
||||||
|
label={!isDisabled ? `염화물(mgCL/L)*` : "염화물(mgCL/L)"}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`smll`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi label={!isDisabled ? `냄새*` : "냄새"}>
|
||||||
|
<SelectBox
|
||||||
|
className="!text-2xl rounded-md"
|
||||||
|
label={""}
|
||||||
|
selectClass={undefined}
|
||||||
|
selectArray={[
|
||||||
|
{ text: "불쾌하지않을것", val: "불쾌하지않을것" },
|
||||||
|
{ text: "해당사항없음", val: "해당사항없음" },
|
||||||
|
]}
|
||||||
|
onSelectValue={(val: string | number) => {
|
||||||
|
field.onChange(val.toString());
|
||||||
|
}}
|
||||||
|
value={field.value || "불쾌하지않을것"}
|
||||||
|
readOnly={isDisabled}
|
||||||
|
onBlur={field.onBlur}
|
||||||
|
ref={field.ref}
|
||||||
|
/>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`cdtnv`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi
|
||||||
|
label={
|
||||||
|
!isDisabled ? `전기전도도(㎲/cm)*` : "전기전도도(㎲/cm)"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`crmty`}
|
||||||
|
render={({ field }) => {
|
||||||
|
const disabledFields = usePurpose ? disableRules[usePurpose] : [];
|
||||||
|
const isDisabled = disabledFields
|
||||||
|
? disabledFields.includes(field.name)
|
||||||
|
: true;
|
||||||
|
return (
|
||||||
|
<FormUi label={!isDisabled ? `색도(도)*` : "색도(도)"}>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
<span className="text-xl absolute inset-y-0 right-3 flex items-center text-gray-500 pointer-events-none">
|
||||||
|
이하
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name={`rmrk`}
|
||||||
|
render={({ field }) => {
|
||||||
|
return (
|
||||||
|
<FormUi label={"비고"}>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1 min-w-0">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
className="w-full pr-16 border py-2 text-right rounded-md"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => {
|
||||||
|
field.onChange(e.target.value);
|
||||||
|
}}
|
||||||
|
value={
|
||||||
|
field.value !== undefined && field.value !== ""
|
||||||
|
? `${field.value}`
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
onBlur={field.onBlur}
|
||||||
|
name={field.name}
|
||||||
|
ref={field.ref}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormUi>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
{candidateFields.map(({ name, label, component, required }, index) =>
|
{candidateFields.map(({ name, label, component, required }, index) =>
|
||||||
component ? (
|
component ? (
|
||||||
@@ -581,7 +922,7 @@ export function SdmInfoRegForm({
|
|||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
error={
|
error={
|
||||||
typeof form.formState.errors[name]?.message === 'string'
|
typeof form.formState.errors[name]?.message === "string"
|
||||||
? (form.formState.errors[name] as FieldError)
|
? (form.formState.errors[name] as FieldError)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { useDmStore } from "@/app/store";
|
import { useDmStore } from "@/app/store";
|
||||||
import type { DemandCompType } from "@/app/store/sdmMng";
|
|
||||||
import { BZNM_TOT_NO, FormField, FormUi } from "@common/business_components";
|
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 { Button, Input } from "@common/components";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { sha512 } from 'js-sha512';
|
import { sha512 } from 'js-sha512';
|
||||||
import { useEffect, useState, useMemo } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { FormProvider, useForm, type ControllerRenderProps } from "react-hook-form";
|
import { FormProvider, useForm, type ControllerRenderProps } from "react-hook-form";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
|
|
||||||
export function SdmLoginForm() {
|
export function SdmLoginForm() {
|
||||||
@@ -72,6 +73,26 @@ export function SdmLoginForm() {
|
|||||||
setIsBznmTotNoDisabled(checked);
|
setIsBznmTotNoDisabled(checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initPassword = () => {
|
||||||
|
toast(
|
||||||
|
(t) => (
|
||||||
|
<div className="flex flex-col items-center">
|
||||||
|
<div className="text-2xl mb-2">
|
||||||
|
관리자(031-0000-0000)에게 비밀번호 초기화 요청을 유선으로 하시기 바랍니다.
|
||||||
|
</div>
|
||||||
|
<Button size={"sm"} onClick={() => toast.dismiss(t.id)}>
|
||||||
|
확인
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
{
|
||||||
|
id: "pwd-reset",
|
||||||
|
duration: Infinity,
|
||||||
|
position: "top-center",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const handleLogin = () => {
|
const handleLogin = () => {
|
||||||
const data = form.getValues();
|
const data = form.getValues();
|
||||||
const passwordStr = sha512.hex(data.password)
|
const passwordStr = sha512.hex(data.password)
|
||||||
@@ -88,55 +109,55 @@ export function SdmLoginForm() {
|
|||||||
label: string;
|
label: string;
|
||||||
component: FieldComponent | undefined;
|
component: FieldComponent | undefined;
|
||||||
}> = [
|
}> = [
|
||||||
{
|
{
|
||||||
name: "dmdInfoId",
|
name: "dmdInfoId",
|
||||||
label: "사업자등록번호",
|
label: "사업자등록번호",
|
||||||
component: (field) => (
|
component: (field) => (
|
||||||
<Input
|
|
||||||
placeholder="사업자등록번호를 입력하세요"
|
|
||||||
type="text"
|
|
||||||
className="!mt-5 !mb-5 !text-xl text-gray-600"
|
|
||||||
{...field}
|
|
||||||
value={formatBusinessNumber(field.value as string)}
|
|
||||||
onChange={(e) => {
|
|
||||||
const dmdId = e.target.value.replace(/\D/g, "").slice(0, 10);
|
|
||||||
field.onChange(dmdId);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "bznmTotNo",
|
|
||||||
label: BZNM_TOT_NO || "종사업자등록번호",
|
|
||||||
component: (field) => (
|
|
||||||
<FormUi
|
|
||||||
label="종사업자등록번호"
|
|
||||||
onCheckboxChange={handleCheckboxChange}
|
|
||||||
isDisabled={isBznmTotNoDisabled}
|
|
||||||
>
|
|
||||||
<Input
|
<Input
|
||||||
placeholder="여러사업장이 있을 경우 입력해주세요"
|
placeholder="사업자등록번호를 입력하세요"
|
||||||
type="text"
|
type="text"
|
||||||
className="!mt-5 !text-xl text-gray-600"
|
className="!mt-5 !mb-5 !text-xl text-gray-600"
|
||||||
disabled={isBznmTotNoDisabled}
|
{...field}
|
||||||
|
value={formatBusinessNumber(field.value as string)}
|
||||||
|
onChange={(e) => {
|
||||||
|
const dmdId = e.target.value.replace(/\D/g, "").slice(0, 10);
|
||||||
|
field.onChange(dmdId);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bznmTotNo",
|
||||||
|
label: BZNM_TOT_NO || "종사업자등록번호",
|
||||||
|
component: (field) => (
|
||||||
|
<FormUi
|
||||||
|
label="종사업자등록번호"
|
||||||
|
onCheckboxChange={handleCheckboxChange}
|
||||||
|
isDisabled={isBznmTotNoDisabled}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder="여러사업장이 있을 경우 입력해주세요"
|
||||||
|
type="text"
|
||||||
|
className="!mt-5 !text-xl text-gray-600"
|
||||||
|
disabled={isBznmTotNoDisabled}
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormUi>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "password",
|
||||||
|
label: "비밀번호",
|
||||||
|
component: (field) => (
|
||||||
|
<Input
|
||||||
|
placeholder="비밀번호를 입력하세요"
|
||||||
|
type="password"
|
||||||
|
className="!mt-5 !mb-5 !text-xl text-gray-600"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormUi>
|
)
|
||||||
)
|
}
|
||||||
},
|
];
|
||||||
{
|
|
||||||
name: "password",
|
|
||||||
label: "비밀번호",
|
|
||||||
component: (field) => (
|
|
||||||
<Input
|
|
||||||
placeholder="비밀번호를 입력하세요"
|
|
||||||
type="password"
|
|
||||||
className="!mt-5 !mb-5 !text-xl text-gray-600"
|
|
||||||
{...field}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -148,11 +169,11 @@ export function SdmLoginForm() {
|
|||||||
control={form.control}
|
control={form.control}
|
||||||
name={name}
|
name={name}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
label==='종사업자등록번호' ?
|
label === '종사업자등록번호' ?
|
||||||
<>
|
<>
|
||||||
{component && component(field)}
|
{component && component(field)}
|
||||||
</>
|
</>
|
||||||
: <FormUi label={label}>
|
: <FormUi label={label}>
|
||||||
{component && component(field)}
|
{component && component(field)}
|
||||||
</FormUi>
|
</FormUi>
|
||||||
)}
|
)}
|
||||||
@@ -160,12 +181,15 @@ export function SdmLoginForm() {
|
|||||||
))}
|
))}
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
<div className="flex justify-center pt-4">
|
<div className="flex justify-center pt-4">
|
||||||
<Button
|
<div className="flex flex-col items-center">
|
||||||
onClick={handleLogin}
|
<Button
|
||||||
className="w-32 bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded-md transition-colors duration-200"
|
onClick={handleLogin}
|
||||||
>
|
className="w-32 bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded-md transition-colors duration-200"
|
||||||
로그인
|
>
|
||||||
</Button>
|
로그인
|
||||||
|
</Button>
|
||||||
|
<div className="text-xl mt-2 text-gray-400 cursor-pointer" onClick={initPassword}>비밀번호 초기화 요청</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev -p 3005",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start:dm": "next start -p 3005",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 35 KiB |
@@ -16,6 +16,7 @@ export class LoginApiService implements LoginService {
|
|||||||
|
|
||||||
public async login(payload: ILogin): Promise<void> {
|
public async login(payload: ILogin): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
|
||||||
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ export class LoginApiService implements LoginService {
|
|||||||
|
|
||||||
public async login(payload: ILogin): Promise<void> {
|
public async login(payload: ILogin): Promise<void> {
|
||||||
try {
|
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, {
|
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
|
|||||||
<span className="text-2xl text-red-600 font-bold">● 침입수량 산정결과</span>
|
<span className="text-2xl text-red-600 font-bold">● 침입수량 산정결과</span>
|
||||||
<div className="flex items-center mt-2">
|
<div className="flex items-center mt-2">
|
||||||
<span className="ml-5 text-black text-xl">침입수량 : </span>
|
<span className="ml-5 text-black text-xl">침입수량 : </span>
|
||||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold">{inftwtQty}</span>
|
<span className="w-[35px] inline-block text-right text-black text-xl font-bold">{inftwtQty}</span>
|
||||||
<span className="ml-2 text-black text-xl">m³/d</span>
|
<span className="ml-2 text-black text-xl">m³/d</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -170,7 +170,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
|
|||||||
{/* 차트 */}
|
{/* 차트 */}
|
||||||
<div className="h-[90%] bg-white text-3xl">
|
<div className="h-[90%] bg-white text-3xl">
|
||||||
<MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'침입수량 그래프'}
|
<MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'침입수량 그래프'}
|
||||||
yFieldText2="" yFieldText="유량(m³/h)"/>
|
yFieldText2="시간" yFieldText="유량(m³/h)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{popupOpen && (
|
{popupOpen && (
|
||||||
|
|||||||
@@ -161,17 +161,17 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => {
|
|||||||
<span className="text-2xl text-red-600 font-bold">● 강우유입수량 분석결과</span>
|
<span className="text-2xl text-red-600 font-bold">● 강우유입수량 분석결과</span>
|
||||||
<div className="flex items-center mt-2">
|
<div className="flex items-center mt-2">
|
||||||
<span className="w-[95px] inline-block text-right text-black text-xl">평균RDII : </span>
|
<span className="w-[95px] inline-block text-right text-black text-xl">평균RDII : </span>
|
||||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {rdiiQty}</span>
|
<span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {rdiiQty}</span>
|
||||||
<span className="ml-2 text-black"> m³/d</span>
|
<span className="ml-2 text-black"> m³/d</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center mt-2">
|
<div className="flex items-center mt-2">
|
||||||
<span className="w-[95px] inline-block text-right text-black text-xl">적용강우량 : </span>
|
<span className="w-[95px] inline-block text-right text-black text-xl">적용강우량 : </span>
|
||||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {rainTotal}</span>
|
<span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {rainTotal}</span>
|
||||||
<span className="ml-2 text-black"> mm</span>
|
<span className="ml-2 text-black"> mm</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center mt-2">
|
<div className="flex items-center mt-2">
|
||||||
<span className="w-[95px] inline-block text-right text-black text-xl">강우량대비RDII : </span>
|
<span className="w-[95px] inline-block text-right text-black text-xl">강우량대비RDII : </span>
|
||||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {totalVolume}</span>
|
<span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {totalVolume}</span>
|
||||||
<span className="ml-2 text-black"> m³/mm</span>
|
<span className="ml-2 text-black"> m³/mm</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+21
-16
@@ -31,14 +31,6 @@ const isYear = (value: string): boolean => {
|
|||||||
return /^[0-9]{4}년$/.test(value);
|
return /^[0-9]{4}년$/.test(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const reportGubuns = [{val: '0', text: '전체'}, {val: '1', text: '보고서'}
|
|
||||||
, {val: '2', text: '요약보고서'} , {val: '3', text: '부록'}, {val: '4', text: '기타'}];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flatten a hierarchical folder structure into a flat array.
|
|
||||||
* @param data - The hierarchical folder data to flatten.
|
|
||||||
* @returns An array of flattened folders with their paths and levels.
|
|
||||||
*/
|
|
||||||
export function flattenFolders(data: Folder[]): FlattenedFolder[] {
|
export function flattenFolders(data: Folder[]): FlattenedFolder[] {
|
||||||
const result: FlattenedFolder[] = [];
|
const result: FlattenedFolder[] = [];
|
||||||
const exceptNodeNm = ["부분","통합","전체"];
|
const exceptNodeNm = ["부분","통합","전체"];
|
||||||
@@ -80,10 +72,15 @@ export function flattenFolders(data: Folder[]): FlattenedFolder[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.forEach((root) => traverse(root, {}, 0));
|
data.forEach((root) => traverse(root, {}, 0));
|
||||||
|
console.log(result.slice(0, 10));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDcTree = async (clsfSystmNm:string) => {
|
export const getDcTree = async (clsfSystmNm:string) => {
|
||||||
|
//const cityName = encodeURIComponent(clsfSystmNm);
|
||||||
|
const queryString = 'clsfSystmNm='+clsfSystmNm;
|
||||||
|
console.log("getDcTree queryString:", queryString);
|
||||||
|
//const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`);
|
||||||
const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm);
|
const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -113,8 +110,13 @@ export const addFileName = async (data:FlattenedFolder[]) => {
|
|||||||
data.map(async (item) => {
|
data.map(async (item) => {
|
||||||
const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn));
|
const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn));
|
||||||
const f = filenameArr[0];
|
const f = filenameArr[0];
|
||||||
|
//console.log("clsfSystmSn:", item.clsfSystmSn, "f:", f);
|
||||||
const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:f?.filePath};
|
const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:f?.filePath};
|
||||||
|
// if (f !== undefined && f.fileSn !== "") {
|
||||||
|
// const fprcs = await getDcFileprcs(f?.fileSn);
|
||||||
|
// if (fprcs.length>0)
|
||||||
|
// result.filePath = fprcs[0].filePath;
|
||||||
|
// }
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -122,6 +124,7 @@ export const addFileName = async (data:FlattenedFolder[]) => {
|
|||||||
}
|
}
|
||||||
export const getDcFileprcs = async (fileSn:string) => {
|
export const getDcFileprcs = async (fileSn:string) => {
|
||||||
const queryString = 'fileSn='+fileSn;
|
const queryString = 'fileSn='+fileSn;
|
||||||
|
console.log("getDcTree queryString:", queryString);
|
||||||
const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`);
|
const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -148,6 +151,9 @@ export const fileDownload = (data:Blob, fileName:string) => { // Blob데이터
|
|||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
export const getFileDownload = async (fileSn:string, fileName:string, filePath:string) => {
|
export const getFileDownload = async (fileSn:string, fileName:string, filePath:string) => {
|
||||||
|
//const fileprcsData = await getDcFileprcs(fileSn); // filePath 조회
|
||||||
|
//if (fileprcsData?.length === 0 ) { alert("filePath 조회 오류"); }
|
||||||
|
//if (fileprcsData[0].filePath === "") alert("filePath 정보 없으므로 다운로드 불가");
|
||||||
if (filePath === "") alert("filePath 정보 없으므로 다운로드 불가:filesn"+ fileSn);
|
if (filePath === "") alert("filePath 정보 없으므로 다운로드 불가:filesn"+ fileSn);
|
||||||
const blobData = await getDcFileDownload(filePath); // 실제 다운로드 API
|
const blobData = await getDcFileDownload(filePath); // 실제 다운로드 API
|
||||||
fileDownload(blobData, fileName);
|
fileDownload(blobData, fileName);
|
||||||
@@ -159,13 +165,12 @@ export const getCityCd = async (): Promise<SelectDataType[]> => {
|
|||||||
if (!response.ok) throw new Error(`시도 데이터 오류: ${response.status}`);
|
if (!response.ok) throw new Error(`시도 데이터 오류: ${response.status}`);
|
||||||
const res = await response.json();
|
const res = await response.json();
|
||||||
const city = res.data;
|
const city = res.data;
|
||||||
let citys:SelectDataType[] = city.map((item: {adstDstrCd:string, sido:string}) => ({
|
const cityCd = city.map((item: any) => ({
|
||||||
val: item.adstDstrCd,
|
val: item.adstDstrCd,
|
||||||
text: item.sido,
|
text: item.sido,
|
||||||
}));
|
}));
|
||||||
citys = citys.sort((a:SelectDataType, b:SelectDataType) => a.text.localeCompare(b.text));
|
cityCd.unshift({ val: '0', text: '전체' });
|
||||||
citys.unshift({ val: '0', text: '전체' });
|
return cityCd;
|
||||||
return citys;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('시도 데이터를 가져오는데 실패했습니다:', error);
|
console.error('시도 데이터를 가져오는데 실패했습니다:', error);
|
||||||
return [{ val: '0', text: '전체', sido: '0' }];
|
return [{ val: '0', text: '전체', sido: '0' }];
|
||||||
@@ -181,9 +186,9 @@ export const useSggCd = () => {
|
|||||||
if (result) {
|
if (result) {
|
||||||
setData(result);
|
setData(result);
|
||||||
}
|
}
|
||||||
console.log("useSggCd호출");
|
|
||||||
};
|
};
|
||||||
fetch();
|
fetch();
|
||||||
|
console.log("useSggCd호출");
|
||||||
}, []);
|
}, []);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@@ -195,7 +200,7 @@ export const getSggCd = async (): Promise<SelectDataType[]> => {
|
|||||||
if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`);
|
if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`);
|
||||||
const res = await response.json();
|
const res = await response.json();
|
||||||
const sgg = res.data;
|
const sgg = res.data;
|
||||||
const sggCd = sgg.map((item: {adstDstrCd:string, sido:string, gugun:string}) => ({
|
const sggCd = sgg.map((item: any) => ({
|
||||||
val: item.adstDstrCd,
|
val: item.adstDstrCd,
|
||||||
sido: item.sido,
|
sido: item.sido,
|
||||||
text: item.gugun,
|
text: item.gugun,
|
||||||
@@ -217,9 +222,9 @@ export const useCityCd = () => {
|
|||||||
if (result) {
|
if (result) {
|
||||||
setData(result);
|
setData(result);
|
||||||
}
|
}
|
||||||
console.log("useCityCd호출");
|
|
||||||
};
|
};
|
||||||
fetch();
|
fetch();
|
||||||
|
console.log("useCityCd호출");
|
||||||
}, []);
|
}, []);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
'use client';
|
|
||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import { Button } from '@common/components';
|
|
||||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||||
import { SelectBox, UiTable } from '@common/business_components/ui';
|
import { SelectBox } from '@common/business_components/ui';
|
||||||
import LoadingOverlay from '@/components/ui/LoadingBar';
|
import { Button, Input } from '@common/components';
|
||||||
|
import React from 'react';
|
||||||
import { addFileName, flattenFolders, getFileDownload, useCityCd, useDcTree, useSggCd, reportGubuns } from './searchModalReportApi';
|
//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
|
||||||
import { type SelectDataType } from '../commonStore';
|
import { type SelectDataType } from '../commonStore';
|
||||||
|
import { useCityCd, useSggCd } from '../components/searchModalReportApi';
|
||||||
|
// import { useBizByFcltStore } from "../../../store/StoreProvider";
|
||||||
|
|
||||||
|
|
||||||
// 하수도정비 기본계획 보고서
|
// // 하수도정비 기본계획 보고서
|
||||||
export const reportTableHeadlist = [
|
export const reportTableHeadlist = [
|
||||||
{ id: "no", title: "NO" },
|
{ id: "no", title: "NO" },
|
||||||
{ id: "sido", title: "시도" },
|
{ id: "sido", title: "시도" },
|
||||||
@@ -24,180 +23,79 @@ export const reportTableHeadlist = [
|
|||||||
|
|
||||||
interface BasicTabProps {
|
interface BasicTabProps {
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
|
gubun: string;
|
||||||
|
sidos: SelectDataType[];
|
||||||
|
ctpvCd: string | number;
|
||||||
|
sigungu: string;
|
||||||
|
filteredSiguns: SelectDataType[];
|
||||||
|
yearFilter: { start: string; end: string; };
|
||||||
|
handleSearch: () => void;
|
||||||
|
handleCtpvCdChange: (val: string | number) => void;
|
||||||
|
// onOpenChange?: (open: boolean) => void;
|
||||||
|
// onFeatureSelect?: (row: any) => void;
|
||||||
|
// setTableData?: (data: any[]) => void;
|
||||||
|
// setTableCount?: (count: number) => void;
|
||||||
|
setYearFilter: (filter: { start: string; end: string }) => void;
|
||||||
|
setGubun: (gubun: string) => void;
|
||||||
|
setSigungu: (sigungu: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReportTab: React.FC<BasicTabProps> = ({ open }) => {
|
const ReportTab: React.FC<BasicTabProps> = ({
|
||||||
|
open,
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
gubun,
|
||||||
const [isResetPage, setIsResetPage] = useState<boolean>(false);
|
sidos,
|
||||||
const [isResetSelection, setIsResetSelection] = useState<boolean>(false);
|
ctpvCd,
|
||||||
const [showTable, setShowTable] = useState(false);
|
sigungu,
|
||||||
const [tableData, setTableData] = useState<any[]>([]);
|
filteredSiguns = [{ val: '0', text: '전체', sido: '0' }],
|
||||||
const [tableCount, setTableCount] = useState(0);
|
yearFilter,
|
||||||
const [curPage, setCurPage] = useState(1);
|
handleSearch,
|
||||||
const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
|
handleCtpvCdChange,
|
||||||
const [ctpvCd, setCtpvCd] = useState('0'); // 하수정비기본계획 report
|
// onOpenChange,
|
||||||
const [sigungu, setSigungu] = useState('0'); // 하수정비기본계획 report
|
// onFeatureSelect,
|
||||||
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
|
// setTableData,
|
||||||
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
|
// setTableCount,
|
||||||
const [reportGubun, setReportGubun] = useState("0"); // 하수정비기본계획 report
|
setYearFilter,
|
||||||
|
setGubun,
|
||||||
|
setSigungu,
|
||||||
// 하수정비기본계획 report
|
}) => {
|
||||||
const sidos = useCityCd();
|
|
||||||
const siguns = useSggCd();
|
|
||||||
const reportOriginData = useDcTree(""); //:Folder[]
|
|
||||||
|
|
||||||
const dynamicHeadlist: { id: string, title: string }[] = reportTableHeadlist;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// filterParams 초기화
|
|
||||||
setCtpvCd('0');
|
|
||||||
setSigungu('0');
|
|
||||||
setReportGubun('0');
|
|
||||||
setYearFilter({ start: "", end: "" });
|
|
||||||
setShowTable(false);
|
|
||||||
setTableData([]);
|
|
||||||
setTableCount(0);
|
|
||||||
setCurPage(1); // 페이지를 1로 초기화
|
|
||||||
setIsResetPage(true); // 페이지를 초기화
|
|
||||||
setIsResetSelection(true); // 선택 초기화
|
|
||||||
}, [open]);
|
|
||||||
|
|
||||||
// 페이지 변경 시마다 데이터 fetch
|
|
||||||
useEffect(() => {
|
|
||||||
// showTable이 true일 때만 fetch (최초 렌더 방지)
|
|
||||||
setIsResetPage(false);
|
|
||||||
setIsResetSelection(true); // 선택 초기화
|
|
||||||
if (showTable) fetchFilteredData();
|
|
||||||
}, [curPage]);
|
|
||||||
|
|
||||||
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
|
|
||||||
const sidoOption = sidos.find((n) => n.val === val);
|
|
||||||
setCtpvCd(String(val));
|
|
||||||
if (val !== '0') {
|
|
||||||
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
|
|
||||||
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
|
|
||||||
setFilteredSiguns(filterSiguns);
|
|
||||||
}
|
|
||||||
setSigungu("0");
|
|
||||||
setGubun("");
|
|
||||||
setYearFilter({ start: "", end: "", });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화
|
|
||||||
const handleSearch = () => {
|
|
||||||
setCurPage(1); // 페이지를 1로 초기화
|
|
||||||
fetchFilteredData();
|
|
||||||
setIsResetPage(true); // 페이지를 초기화
|
|
||||||
setIsResetSelection(false); // 선택 초기화
|
|
||||||
setShowTable(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 하수도정비기본계획 테이블 cellClick 핸들러
|
|
||||||
const handleReportCellClick = (index: number | undefined ) => {
|
|
||||||
console.log(index);
|
|
||||||
if (typeof index === "number" && tableData[index]) {
|
|
||||||
const reportData = tableData[index];
|
|
||||||
const fileName = reportData.fileName;
|
|
||||||
const filePath = reportData.filePath;
|
|
||||||
if (reportData.fileSn !== "") {
|
|
||||||
getFileDownload(reportData.fileSn, fileName, filePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 검색 API 호출 함수
|
|
||||||
const fetchFilteredData = async () => {
|
|
||||||
setIsLoading(true); // 로딩 시작
|
|
||||||
setIsResetSelection(true); // 선택 초기화
|
|
||||||
|
|
||||||
try {
|
|
||||||
//const reportOriginData = await getDcTree('경기도');
|
|
||||||
const reportData = flattenFolders(reportOriginData);
|
|
||||||
let filterReportData = reportData;
|
|
||||||
if (ctpvCd !== "0") { // 시도검색
|
|
||||||
const sidoOption = sidos.find((n) => n.val === ctpvCd);
|
|
||||||
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
|
|
||||||
}
|
|
||||||
if (sigungu !== "0") { // 시군구검색
|
|
||||||
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
|
|
||||||
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
|
|
||||||
}
|
|
||||||
if (reportGubun !== "0") { // 보고서구분검색
|
|
||||||
const reportGubunOption = reportGubuns.find((n) => n.val === reportGubun);
|
|
||||||
filterReportData = filterReportData.filter(item => item.reportGubun === reportGubunOption?.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
|
|
||||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
|
|
||||||
if (yearFilter.start == "" && yearFilter.end != "")
|
|
||||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
|
|
||||||
if (yearFilter.start != "" && yearFilter.end != "") {
|
|
||||||
filterReportData = filterReportData.filter(item => {
|
|
||||||
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (gubun !== "") { // 구분검색
|
|
||||||
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
|
|
||||||
}
|
|
||||||
console.log('report count:', filterReportData.length);
|
|
||||||
setTableCount(filterReportData.length || 0);
|
|
||||||
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
|
|
||||||
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
|
|
||||||
//const fileList = await getDcFile("CLS20250530000041");
|
|
||||||
addFileName(filterReportData).then(data => {
|
|
||||||
filterReportData = data;
|
|
||||||
setTableData(filterReportData || []);
|
|
||||||
});
|
|
||||||
setTableData(filterReportData || []);
|
|
||||||
|
|
||||||
setShowTable(true);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('API ERROR:', err);
|
|
||||||
setTableData([]);
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false); // 로딩 종료
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
<div className="relative flex flex-col border rounded-lg p-6 w-full h-[10vh]">
|
<div className="relative flex flex-col border rounded-lg p-6 w-full h-[10vh]">
|
||||||
<div className="flex items-center mb-3">
|
<div className="flex items-center mb-3">
|
||||||
<SelectBox className="w-[150px] mr-8"
|
<SelectBox
|
||||||
|
className="w-[150px] mr-8"
|
||||||
selectClass="rounded-lg bg-white"
|
selectClass="rounded-lg bg-white"
|
||||||
label="시도" selectArray={sidos}
|
label="시도"
|
||||||
value={ctpvCd} onSelectValue={handleCtpvCdChange}
|
selectArray={sidos}
|
||||||
|
value={ctpvCd}
|
||||||
|
onSelectValue={handleCtpvCdChange}
|
||||||
selectContentClass="z-[101]"
|
selectContentClass="z-[101]"
|
||||||
/>
|
/>
|
||||||
<SelectBox className="w-48"
|
<SelectBox
|
||||||
|
className="w-48"
|
||||||
selectClass="w-48 rounded-lg bg-white truncate"
|
selectClass="w-48 rounded-lg bg-white truncate"
|
||||||
label="시군구" selectArray={filteredSiguns}
|
label="시군구"
|
||||||
value={sigungu} onSelectValue={val => setSigungu(String(val))}
|
selectArray={filteredSiguns}
|
||||||
|
value={sigungu}
|
||||||
|
onSelectValue={val => setSigungu(String(val))}
|
||||||
selectContentClass="z-[101]"
|
selectContentClass="z-[101]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center mb-6">
|
<div className="flex items-center mb-6">
|
||||||
{/* <label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label>
|
<label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label>
|
||||||
<Input
|
<Input
|
||||||
className='!text-xl w-[100px] placeholder:text-center mr-8'
|
className='!text-xl w-[100px] placeholder:text-center mr-8'
|
||||||
placeholder="입력"
|
placeholder="입력"
|
||||||
value={gubun}
|
value={gubun}
|
||||||
onChange={(e) => { setGubun(e.target.value); }}
|
onChange={(e) => { setGubun(e.target.value); }}
|
||||||
/> */}
|
|
||||||
<SelectBox className="w-[150px] mr-8"
|
|
||||||
selectClass="rounded-lg bg-white"
|
|
||||||
label="보고서구분" selectArray={[...reportGubuns]}
|
|
||||||
value={reportGubun} onSelectValue={val => setReportGubun(String(val))}
|
|
||||||
selectContentClass="z-[101]" labelClass='whitespace-nowrap text-xl text-gray-600 pr-2'
|
|
||||||
/>
|
/>
|
||||||
{/* 승인년도 필터 */}
|
<YearRangeSelectBox
|
||||||
<YearRangeSelectBox start={yearFilter.start} end={yearFilter.end}
|
start={yearFilter.start}
|
||||||
|
end={yearFilter.end}
|
||||||
onChange={range => setYearFilter({ ...yearFilter, start: range.start, end: range.end })}
|
onChange={range => setYearFilter({ ...yearFilter, start: range.start, end: range.end })}
|
||||||
startLabel="승인년도" endLabel=""
|
startLabel="승인년도"
|
||||||
|
endLabel=""
|
||||||
/>
|
/>
|
||||||
{/* 조회 버튼 */}
|
{/* 조회 버튼 */}
|
||||||
<div className="flex-1 flex justify-end">
|
<div className="flex-1 flex justify-end">
|
||||||
@@ -205,28 +103,6 @@ const ReportTab: React.FC<BasicTabProps> = ({ open }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
|
|
||||||
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
|
|
||||||
<div className="flex-1 px-2 pb-2">
|
|
||||||
<LoadingOverlay isLoading={isLoading} />
|
|
||||||
<UiTable
|
|
||||||
headName={(() => {
|
|
||||||
return (<>조회 결과 ({tableCount.toLocaleString('ko-KR')})건</>);
|
|
||||||
})()
|
|
||||||
}
|
|
||||||
tableData={tableData}
|
|
||||||
headlist={dynamicHeadlist}
|
|
||||||
pageSize={10}
|
|
||||||
total={tableCount}
|
|
||||||
cellClick={handleReportCellClick}
|
|
||||||
onPageChange={setCurPage}
|
|
||||||
resetPageNo={isResetPage}
|
|
||||||
resetSelection={isResetSelection}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ import { UiModal, UITab, UiTable } from '@common/business_components/ui';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
import { ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2 } from '../components/common/table';
|
import { ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2 } from '../components/common/table';
|
||||||
|
//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
|
||||||
import { type SelectDataType } from '../commonStore';
|
import { type SelectDataType } from '../commonStore';
|
||||||
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES } from '../components/common/table';
|
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES } from '../components/common/table';
|
||||||
|
import { addFileName, flattenFolders, getFileDownload, useCityCd, useDcTree, useSggCd } from '../components/searchModalReportApi';
|
||||||
|
// import { useBizByFcltStore } from "../../../store/StoreProvider";
|
||||||
import { getData } from "@/components/lib/api";
|
import { getData } from "@/components/lib/api";
|
||||||
import BasicTab, { BASIC_TYPES } from './basicTab';
|
import BasicTab, { BASIC_TYPES } from './basicTab';
|
||||||
import OperationTab, { BIZ_TY_CD, operationCleaningTableHeadlist, operationInspectionTableHeadlist, operationMaintenanceTableHeadlist, operationTableHeadlist, WORK_TYPES } from './operationTab';
|
import OperationTab, { BIZ_TY_CD, operationCleaningTableHeadlist, operationInspectionTableHeadlist, operationMaintenanceTableHeadlist, operationTableHeadlist, WORK_TYPES } from './operationTab';
|
||||||
@@ -65,10 +68,9 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
const [detailBizId, setDetailBizId] = useState(0);
|
const [detailBizId, setDetailBizId] = useState(0);
|
||||||
const [city, setCity] = useState(0);
|
const [city, setCity] = useState(0);
|
||||||
const [sgg, setSgg] = useState(0);
|
const [sgg, setSgg] = useState(0);
|
||||||
const [ctpvCd, setCtpvCd] = useState('0'); // 하수정비기본계획 report
|
const [ctpvCd, setCtpvCd] = useState('0');
|
||||||
const [sigungu, setSigungu] = useState('0'); // 하수정비기본계획 report
|
const [sigungu, setSigungu] = useState('0');
|
||||||
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
|
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
|
||||||
const [reportGubun, setReportGubun] = useState("0"); // 하수정비기본계획 report
|
|
||||||
const [start1, setStart1] = useState("");
|
const [start1, setStart1] = useState("");
|
||||||
const [start2, setStart2] = useState("");
|
const [start2, setStart2] = useState("");
|
||||||
const [end1, setEnd1] = useState("");
|
const [end1, setEnd1] = useState("");
|
||||||
@@ -81,6 +83,9 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
|
const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
|
||||||
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
|
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
|
||||||
|
|
||||||
|
const sidos = useCityCd();
|
||||||
|
const siguns = useSggCd();
|
||||||
|
const reportOriginData = useDcTree(""); //:Folder[]
|
||||||
|
|
||||||
// 오늘 날짜 구하기
|
// 오늘 날짜 구하기
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
@@ -100,6 +105,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (activeTab === 'operation') return operationTableHeadlist;
|
if (activeTab === 'operation') return operationTableHeadlist;
|
||||||
|
if (activeTab === 'report') return reportTableHeadlist;
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}, [activeTab, basicType, workType]);
|
}, [activeTab, basicType, workType]);
|
||||||
@@ -128,6 +134,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
setVar4("");
|
setVar4("");
|
||||||
setCity(0);
|
setCity(0);
|
||||||
setSgg(0);
|
setSgg(0);
|
||||||
|
setCtpvCd('0');
|
||||||
|
setSigungu('0');
|
||||||
setYearFilter({
|
setYearFilter({
|
||||||
start: "",
|
start: "",
|
||||||
end: "",
|
end: "",
|
||||||
@@ -273,6 +281,40 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
setDetailTableData([]);
|
setDetailTableData([]);
|
||||||
setDetailTableCount(0);
|
setDetailTableCount(0);
|
||||||
|
|
||||||
|
} else if (activeTab === 'report') {
|
||||||
|
//const reportOriginData = await getDcTree('경기도');
|
||||||
|
const reportData = flattenFolders(reportOriginData);
|
||||||
|
let filterReportData = reportData;
|
||||||
|
if (ctpvCd !== "0") { // 시도검색
|
||||||
|
const sidoOption = sidos.find((n) => n.val === ctpvCd);
|
||||||
|
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
|
||||||
|
}
|
||||||
|
if (sigungu !== "0") { // 시군구검색
|
||||||
|
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
|
||||||
|
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
|
||||||
|
}
|
||||||
|
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
|
||||||
|
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
|
||||||
|
if (yearFilter.start == "" && yearFilter.end != "")
|
||||||
|
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
|
||||||
|
if (yearFilter.start != "" && yearFilter.end != "") {
|
||||||
|
filterReportData = filterReportData.filter(item => {
|
||||||
|
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (gubun !== "") { // 구분검색
|
||||||
|
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
|
||||||
|
}
|
||||||
|
console.log('report count:', filterReportData.length);
|
||||||
|
setTableCount(filterReportData.length || 0);
|
||||||
|
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
|
||||||
|
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
|
||||||
|
//const fileList = await getDcFile("CLS20250530000041");
|
||||||
|
addFileName(filterReportData).then(data => {
|
||||||
|
filterReportData = data;
|
||||||
|
setTableData(filterReportData || []);
|
||||||
|
});
|
||||||
|
setTableData(filterReportData || []);
|
||||||
}
|
}
|
||||||
|
|
||||||
setShowTable(true);
|
setShowTable(true);
|
||||||
@@ -546,7 +588,31 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 하수도정비기본계획 테이블 cellClick 핸들러
|
||||||
|
const handleReportCellClick = (index: number | undefined, headId?: String) => {
|
||||||
|
console.log(index);
|
||||||
|
if (typeof index === "number" && tableData[index]) {
|
||||||
|
const reportData = tableData[index];
|
||||||
|
const fileName = reportData.fileName;
|
||||||
|
const filePath = reportData.filePath;
|
||||||
|
if (reportData.fileSn !== "") {
|
||||||
|
getFileDownload(reportData.fileSn, fileName, filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
|
||||||
|
const sidoOption = sidos.find((n) => n.val === val);
|
||||||
|
setCtpvCd(String(val));
|
||||||
|
if (val !== '0') {
|
||||||
|
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
|
||||||
|
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
|
||||||
|
setFilteredSiguns(filterSiguns);
|
||||||
|
}
|
||||||
|
setSigungu("0");
|
||||||
|
setGubun("");
|
||||||
|
setYearFilter({ start: "", end: "", });
|
||||||
|
}
|
||||||
|
|
||||||
const renderBody = () => (
|
const renderBody = () => (
|
||||||
<>
|
<>
|
||||||
@@ -607,6 +673,17 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
{activeTab === 'report' && (
|
{activeTab === 'report' && (
|
||||||
<ReportTab
|
<ReportTab
|
||||||
open={open}
|
open={open}
|
||||||
|
gubun={gubun}
|
||||||
|
sidos={sidos}
|
||||||
|
ctpvCd={ctpvCd}
|
||||||
|
sigungu={sigungu}
|
||||||
|
filteredSiguns={filteredSiguns}
|
||||||
|
yearFilter={yearFilter}
|
||||||
|
handleSearch={handleSearch}
|
||||||
|
handleCtpvCdChange={handleCtpvCdChange}
|
||||||
|
setYearFilter={setYearFilter}
|
||||||
|
setGubun={setGubun}
|
||||||
|
setSigungu={setSigungu}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* </UITab2> */}
|
{/* </UITab2> */}
|
||||||
@@ -614,7 +691,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
|
|
||||||
{/* 📋 결과 리스트 */}
|
{/* 📋 결과 리스트 */}
|
||||||
{/* 기본정보 탭, 하수도정비기본계획보고서 탭 */}
|
{/* 기본정보 탭, 하수도정비기본계획보고서 탭 */}
|
||||||
{(activeTab === 'basic' ) && (
|
{(activeTab === 'basic' || activeTab === 'report') && (
|
||||||
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
|
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
|
||||||
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
|
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
|
||||||
<div className="flex-1 px-2 pb-2">
|
<div className="flex-1 px-2 pb-2">
|
||||||
@@ -629,7 +706,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
|||||||
headlist={dynamicHeadlist}
|
headlist={dynamicHeadlist}
|
||||||
pageSize={10}
|
pageSize={10}
|
||||||
total={tableCount}
|
total={tableCount}
|
||||||
cellClick={handleBasicCellClick}
|
cellClick={activeTab === 'report' ? handleReportCellClick : handleBasicCellClick}
|
||||||
onPageChange={setCurPage}
|
onPageChange={setCurPage}
|
||||||
resetPageNo={isResetPage}
|
resetPageNo={isResetPage}
|
||||||
resetSelection={isResetSelection}
|
resetSelection={isResetSelection}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export const deleteData = async (url: string, data?: object): Promise<any> => {
|
|||||||
|
|
||||||
// RSONE DC API 호출
|
// RSONE DC API 호출
|
||||||
export const getDcData = async (url: string, data?: object): Promise<any> => {
|
export const getDcData = async (url: string, data?: object): Promise<any> => {
|
||||||
|
console.log(url);
|
||||||
const res = await fetch('/dc-service' + url, {
|
const res = await fetch('/dc-service' + url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,16 +61,13 @@ const Map = () => {
|
|||||||
|
|
||||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||||
let foundFeature: any = null;
|
let foundFeature: any = null;
|
||||||
console.log(data)
|
|
||||||
//console.log(data.getId())
|
|
||||||
let featureId = data.fid;
|
let featureId = data.fid;
|
||||||
const layerName = data.layerNm;
|
const layerName = data.layerNm;
|
||||||
|
if (layerName === "tb_wr_bdst_ruse_fclt") {
|
||||||
if (layerName === "재이용시설") {
|
|
||||||
// 재이용시설
|
// 재이용시설
|
||||||
featureId = `${layerName}.${data.searchPk}`;
|
featureId = `${layerName}.${data.searchPk}`;
|
||||||
} else if ( //빗물이용시설, 중수도시설
|
} else if ( //빗물이용시설, 중수도시설
|
||||||
layerName === "빗물이용시설" ||
|
layerName === "tb_wr_rnwtr_utztn_fclt" ||
|
||||||
layerName == "tb_wr_rswtr_fclt"
|
layerName == "tb_wr_rswtr_fclt"
|
||||||
) {
|
) {
|
||||||
featureId = `${layerName}.${data.bdstInfoSn}`;
|
featureId = `${layerName}.${data.bdstInfoSn}`;
|
||||||
@@ -139,6 +136,16 @@ const Map = () => {
|
|||||||
gisMaps={gisMaps}
|
gisMaps={gisMaps}
|
||||||
isMiniMap={false}
|
isMiniMap={false}
|
||||||
searchView={undefined}
|
searchView={undefined}
|
||||||
|
// searchView={(props: any) => (
|
||||||
|
// <MapSearchBar
|
||||||
|
// searchType="공급처 후보지 조회"
|
||||||
|
// showApplyButton={false}
|
||||||
|
// checkedLayers={checkedLayers}
|
||||||
|
// checkedLayersData={checkedLayersData}
|
||||||
|
// {...props}
|
||||||
|
// />
|
||||||
|
// )
|
||||||
|
// }
|
||||||
detailView={(props: any) => (
|
detailView={(props: any) => (
|
||||||
<NewWindowPopup
|
<NewWindowPopup
|
||||||
onClose={handlePopupClose} // 메모이제이션된 함수 사용
|
onClose={handlePopupClose} // 메모이제이션된 함수 사용
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
|||||||
const [mngList, setMngList] = useState<DemandCompType[]>(coSttnRes || []);
|
const [mngList, setMngList] = useState<DemandCompType[]>(coSttnRes || []);
|
||||||
///////////////////////////////////////////// 피쳐데이터 선택 시 각 시설별 데이터 처리 ///////////////////////////////////////////////
|
///////////////////////////////////////////// 피쳐데이터 선택 시 각 시설별 데이터 처리 ///////////////////////////////////////////////
|
||||||
const getSelectedLayers = () => {
|
const getSelectedLayers = () => {
|
||||||
console.log(1)
|
|
||||||
let result = null;
|
let result = null;
|
||||||
const layers = gisMap ? gisMap.getLayers().getArray().filter((l: any) => l.getVisible()) : []; // gisMap이 null인지 확인 후 레이어 가져오기
|
const layers = gisMap ? gisMap.getLayers().getArray().filter((l: any) => l.getVisible()) : []; // gisMap이 null인지 확인 후 레이어 가져오기
|
||||||
let featureLayer: { get: (key: string) => any } = { get: () => null };
|
let featureLayer: { get: (key: string) => any } = { get: () => null };
|
||||||
@@ -128,7 +127,6 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
result = featureLayer.get('lyrNm');
|
result = featureLayer.get('lyrNm');
|
||||||
console.log(result)
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -158,15 +156,15 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const detainSttn = async (featureCd: string, layerNm: string) => {
|
const detainSttn = async (featureCd: string, layerNm: string) => {
|
||||||
if (layerNm == '빗물이용시설') { //빗물이용시설
|
if (layerNm == 'tb_wr_rnwtr_utztn_fclt') { //빗물이용시설
|
||||||
const res = await getFetch(fetchType.WR, `/reuseFc/rainyInfoList/1/20/0/${featureCd}`)
|
const res = await getFetch(fetchType.WR, `/reuseFc/rainyInfoList/1/20/0/${featureCd}`)
|
||||||
setRainList(res)
|
setRainList(res)
|
||||||
}
|
}
|
||||||
else if (layerNm == '중수도시설') { //중수도 시설
|
else if (layerNm == 'tb_wr_rswtr_fclt') { //중수도 시설
|
||||||
const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`)
|
const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`)
|
||||||
setRswtrList(res)
|
setRswtrList(res)
|
||||||
}
|
}
|
||||||
else if(layerNm =='수요처'){ //수요처
|
else if(layerNm =='tb_wr_ruse_fclt_dmd_co'){ //수요처
|
||||||
const res = await getFetch(fetchType.WR, `/reuseFc/request/1/20/0/${featureCd}`)
|
const res = await getFetch(fetchType.WR, `/reuseFc/request/1/20/0/${featureCd}`)
|
||||||
setMngList(res)
|
setMngList(res)
|
||||||
}
|
}
|
||||||
@@ -194,7 +192,6 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
|||||||
},[mngList])
|
},[mngList])
|
||||||
|
|
||||||
const layerId = getSelectedLayers();
|
const layerId = getSelectedLayers();
|
||||||
console.log(layerId)
|
|
||||||
if (featureData && typeof featureData.getProperties === "function") {
|
if (featureData && typeof featureData.getProperties === "function") {
|
||||||
const selectedVal = featureData.getProperties();
|
const selectedVal = featureData.getProperties();
|
||||||
let featureCd = layerId == '하수재이용시설' ? selectedVal?.swtrmt_fclt_cd : layerId == '빗물이용시설' || layerId == '중수도시설' || layerId == '온배수시설' || layerId == '수요처' ? selectedVal?.bdst_nm : layerId == '하수처리시설' ? selectedVal?.swtrmt_fclt_nm : null;
|
let featureCd = layerId == '하수재이용시설' ? selectedVal?.swtrmt_fclt_cd : layerId == '빗물이용시설' || layerId == '중수도시설' || layerId == '온배수시설' || layerId == '수요처' ? selectedVal?.bdst_nm : layerId == '하수처리시설' ? selectedVal?.swtrmt_fclt_nm : null;
|
||||||
@@ -508,17 +505,17 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
|||||||
layerId = seletectedLayerNm || '';
|
layerId = seletectedLayerNm || '';
|
||||||
}
|
}
|
||||||
//하수처리시설
|
//하수처리시설
|
||||||
const isPrcsFclt = layerId == '하수처리시설'
|
const isPrcsFclt = layerId == 'tb_il_swage_prcs_fclt'
|
||||||
// 재이용시설
|
// 재이용시설
|
||||||
const isPbnst = layerId == '재이용시설';
|
const isPbnst = layerId == 'tb_wr_bdst_ruse_fclt';
|
||||||
// 빗물이용시설
|
// 빗물이용시설
|
||||||
const isRain = layerId == '빗물이용시설';
|
const isRain = layerId == 'tb_wr_rnwtr_utztn_fclt';
|
||||||
// 중수도시설
|
// 중수도시설
|
||||||
const isRswt = layerId == '중수도시설';
|
const isRswt = layerId == 'tb_wr_rswtr_fclt';
|
||||||
// 온배수시설
|
// 온배수시설
|
||||||
const isHtdfl = layerId == '온배수시설';
|
const isHtdfl = layerId == 'tb_wr_htdfl_fclt';
|
||||||
// 수요처관리
|
// 수요처관리
|
||||||
const isReuseMng = layerId == '수요처관리';
|
const isReuseMng = layerId == 'tb_wr_ruse_fclt_dmd_co';
|
||||||
if (isPrcsFclt) {
|
if (isPrcsFclt) {
|
||||||
if (viewMode == 'list') {
|
if (viewMode == 'list') {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default function PublicReuseFaciltyInsert() {
|
|||||||
// defaultValues: { items: pbnstRegArrayZod.parse([]) },
|
// defaultValues: { items: pbnstRegArrayZod.parse([]) },
|
||||||
mode: "onChange",
|
mode: "onChange",
|
||||||
});
|
});
|
||||||
// const { isDirty } = form.formState;
|
const { isDirty } = form.formState;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
fields: items,
|
fields: items,
|
||||||
@@ -90,10 +90,10 @@ export default function PublicReuseFaciltyInsert() {
|
|||||||
}, [pbnst.isInit, pubHasuInit]);
|
}, [pbnst.isInit, pubHasuInit]);
|
||||||
|
|
||||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||||
// if (!isDirty) {
|
if (!isDirty) {
|
||||||
// toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
|
toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
const data = writeRgtrAndMdfr(valuse.items);
|
const data = writeRgtrAndMdfr(valuse.items);
|
||||||
let bizs = [] as fcBizType[];
|
let bizs = [] as fcBizType[];
|
||||||
data.forEach((fclt) => {
|
data.forEach((fclt) => {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { useWrStore } from "@/app/store";
|
import { useWrStore } from "@/app/store";
|
||||||
import { btnClass } from "@/app/store/common/code";
|
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 { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||||
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
|
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||||
@@ -34,8 +33,6 @@ export default function PbnstSttn() {
|
|||||||
} = useWrStore((state) => state);
|
} = useWrStore((state) => state);
|
||||||
|
|
||||||
const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn;
|
const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn;
|
||||||
|
|
||||||
const [isReset, setIsReset] = useState(false);
|
|
||||||
const ref = useRef<ReturnType>({} as ReturnType);
|
const ref = useRef<ReturnType>({} as ReturnType);
|
||||||
const [searchYear, setSearchYear] = useState<string>(
|
const [searchYear, setSearchYear] = useState<string>(
|
||||||
String(new Date().getFullYear())
|
String(new Date().getFullYear())
|
||||||
@@ -70,24 +67,6 @@ export default function PbnstSttn() {
|
|||||||
},
|
},
|
||||||
[getPbnStnDetail, pbnstSttnRes]
|
[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(() => {
|
useEffect(() => {
|
||||||
if (pbnstSttn.excelList.length >= 0) {
|
if (pbnstSttn.excelList.length >= 0) {
|
||||||
@@ -100,7 +79,23 @@ export default function PbnstSttn() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [pbnstSttn.excelList]);
|
}, [pbnstSttn.excelList]);
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
if (!pbnstSttn.isInit) {
|
||||||
|
getFlcts();
|
||||||
|
}
|
||||||
|
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (pbnstSttnRes && pbnstSttnRes.length > 0) {
|
||||||
|
setBdstTable(pbnstSttnRes);
|
||||||
|
} else {
|
||||||
|
setBdstTable([]);
|
||||||
|
}
|
||||||
|
}, [pbnstSttnRes]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
pbnSttnInit("1", "15", ref.current, searchYear, fclts);
|
||||||
|
}, [fclts]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltId)
|
if (pbnstSttn.pbnstDetail.pbnstRuseFcltId)
|
||||||
@@ -162,11 +157,16 @@ export default function PbnstSttn() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
queryClick={ ()=> {
|
queryClick={function (returnType: ReturnType): void {
|
||||||
// pbnSearch(returnType);
|
pbnstSttnSearch(
|
||||||
|
false,
|
||||||
//setTableIndex(0)
|
"1",
|
||||||
setIsReset(true);
|
"15",
|
||||||
|
returnType,
|
||||||
|
pbnRuseNm,
|
||||||
|
searchYear,
|
||||||
|
fclts
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
excelClick={excelClick}
|
excelClick={excelClick}
|
||||||
initClick={function (): void {
|
initClick={function (): void {
|
||||||
@@ -194,16 +194,13 @@ export default function PbnstSttn() {
|
|||||||
pbnstSttnSearch(
|
pbnstSttnSearch(
|
||||||
false,
|
false,
|
||||||
String(page),
|
String(page),
|
||||||
String(prfRegPageSize),
|
String(15),
|
||||||
ref.current,
|
ref.current,
|
||||||
pbnRuseNm,
|
pbnRuseNm,
|
||||||
searchYear,
|
searchYear,
|
||||||
fclts
|
fclts
|
||||||
);
|
);
|
||||||
setIsReset(false);
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
resetPageNo={isReset}
|
|
||||||
>
|
>
|
||||||
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
|
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
|
||||||
</UiTable>
|
</UiTable>
|
||||||
|
|||||||
@@ -38,12 +38,11 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
|
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
|
||||||
|
|
||||||
export default function PrfmncPrfmncReg() {
|
export default function PrfmncPrfmncReg() {
|
||||||
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch,getPrfFmcRes } = useWrStore(
|
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch } = useWrStore(
|
||||||
(state) => state
|
(state) => state
|
||||||
);
|
);
|
||||||
const { prfPbnFclts, pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
|
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
|
||||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||||
const [isReset, setIsReset] = useState(false);
|
|
||||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||||
const [searchTxt, setSearchTxt] = useState<string>();
|
const [searchTxt, setSearchTxt] = useState<string>();
|
||||||
const [isExcelOpen, setIsExcelOPen] = useState<{
|
const [isExcelOpen, setIsExcelOPen] = useState<{
|
||||||
@@ -52,6 +51,7 @@ export default function PrfmncPrfmncReg() {
|
|||||||
}>({ isModal: false, data: {} as FcPrfType });
|
}>({ isModal: false, data: {} as FcPrfType });
|
||||||
const [inputData, setInputData] = useState<any[]>();
|
const [inputData, setInputData] = useState<any[]>();
|
||||||
const [pbnstRuseFcltId, setpbnstRuseFcltId] = useState<string>();
|
const [pbnstRuseFcltId, setpbnstRuseFcltId] = useState<string>();
|
||||||
|
const [pageNation, setPageNation] = useState<number>(1);
|
||||||
const [cellNum, setCellNum] = useState<number>(1);
|
const [cellNum, setCellNum] = useState<number>(1);
|
||||||
const [searchYear, setSearchYear] = useState<string>(
|
const [searchYear, setSearchYear] = useState<string>(
|
||||||
String(new Date().getFullYear())
|
String(new Date().getFullYear())
|
||||||
@@ -65,6 +65,20 @@ export default function PrfmncPrfmncReg() {
|
|||||||
"A1:O1"
|
"A1:O1"
|
||||||
);
|
);
|
||||||
}, [prfmnc.excelList]);
|
}, [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 { t } = useTranslation('base');
|
||||||
const onSave = useCallback(() => {
|
const onSave = useCallback(() => {
|
||||||
@@ -72,20 +86,19 @@ export default function PrfmncPrfmncReg() {
|
|||||||
if (!pbnstRuseFcltId) return;
|
if (!pbnstRuseFcltId) return;
|
||||||
|
|
||||||
prfmnRegData(
|
prfmnRegData(
|
||||||
1,
|
pageNation,
|
||||||
'41',
|
'41',
|
||||||
excelToPbnPrfData(
|
excelToPbnPrfData(
|
||||||
inputData as unknown as JSON[],
|
inputData as unknown as JSON[],
|
||||||
searchYear,
|
searchYear,
|
||||||
pbnstRuseFcltId
|
pbnstRuseFcltId
|
||||||
) as unknown as PrfType
|
) as unknown as PrfType
|
||||||
, searchYear,
|
, searchYear
|
||||||
prfPbnFclts
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
confirmToast(t('isUpdateMsg'), handleConfirm);
|
confirmToast(t('isUpdateMsg'), handleConfirm);
|
||||||
}, [inputData, searchYear, pbnstRuseFcltId, cellNum,prfPbnFclts]);
|
}, [inputData, searchYear, pbnstRuseFcltId, pageNation, cellNum]);
|
||||||
|
|
||||||
const cellClick = useCallback(
|
const cellClick = useCallback(
|
||||||
(index: number | undefined) => {
|
(index: number | undefined) => {
|
||||||
@@ -181,15 +194,10 @@ export default function PrfmncPrfmncReg() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!prfmnc.isInit) {
|
if (!prfmnc.isInit) {
|
||||||
getPrfFmcRes()
|
const year = new Date().getFullYear()
|
||||||
|
prfmncHasuInit(1, '41', String(year));
|
||||||
}
|
}
|
||||||
}, [prfmnc.isInit, getPrfFmcRes]);
|
}, [prfmnc.isInit, prfmncHasuInit]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() =>{
|
|
||||||
const year = new Date().getFullYear()
|
|
||||||
prfmncHasuInit(1, '41',String(year) ,prfPbnFclts);
|
|
||||||
},[prfPbnFclts])
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
|
|
||||||
@@ -246,8 +254,14 @@ export default function PrfmncPrfmncReg() {
|
|||||||
<div className="flex flex-row space-x-2">
|
<div className="flex flex-row space-x-2">
|
||||||
<Button size={"sm"} onClick={() => {
|
<Button size={"sm"} onClick={() => {
|
||||||
|
|
||||||
|
if (searchTxt && searchTxt?.length > 0) {
|
||||||
|
prfmncHasuNmSearch(1, '41', searchYear, searchTxt)
|
||||||
|
setPageNation(1)
|
||||||
|
} else {
|
||||||
|
prfmncHasuInit(1, '41', searchYear)
|
||||||
|
setPageNation(1)
|
||||||
|
}
|
||||||
|
|
||||||
setIsReset(true)
|
|
||||||
}}>
|
}}>
|
||||||
조회
|
조회
|
||||||
</Button>
|
</Button>
|
||||||
@@ -300,15 +314,10 @@ export default function PrfmncPrfmncReg() {
|
|||||||
setCellNum(index ?? 0);
|
setCellNum(index ?? 0);
|
||||||
}}
|
}}
|
||||||
onPageChange={
|
onPageChange={
|
||||||
(page:number) => {
|
(page) => {
|
||||||
if (searchTxt && searchTxt?.length > 0) {
|
prfmncHasuInit(page, '41', searchYear);
|
||||||
prfmncHasuNmSearch(page, '41', searchYear, searchTxt,prfPbnFclts)
|
setPageNation(page)
|
||||||
} else {
|
|
||||||
prfmncHasuInit(page, '41', searchYear,prfPbnFclts)
|
|
||||||
}
|
|
||||||
setIsReset(false);
|
|
||||||
}}
|
}}
|
||||||
resetPageNo={isReset}
|
|
||||||
/>
|
/>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
@@ -341,10 +350,9 @@ export default function PrfmncPrfmncReg() {
|
|||||||
setIsExcelOPen({ ...isExcelOpen, isModal: open })
|
setIsExcelOPen({ ...isExcelOpen, isModal: open })
|
||||||
}}
|
}}
|
||||||
setModalExcelData={async (excelData) => {
|
setModalExcelData={async (excelData) => {
|
||||||
await prfmnRegData(1, '41',
|
await prfmnRegData(pageNation, '41',
|
||||||
excelData,
|
excelData,
|
||||||
searchYear
|
searchYear
|
||||||
,prfPbnFclts
|
|
||||||
);
|
);
|
||||||
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
|
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ export default function PbnstPrfmncSttn() {
|
|||||||
}
|
}
|
||||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||||
setPrfData(tableData);
|
setPrfData(tableData);
|
||||||
setExcelData(excelPrfmncSttnParsing(tableData ?? []))
|
setExcelData(excelPrfmncSttnParsing(prfData ?? []))
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
setExcelData(excelPrfmncSttnParsing([]))
|
|
||||||
setPrfData([]);
|
setPrfData([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,11 +605,7 @@ export default function PbnstPrfmncSttn() {
|
|||||||
isResetPage(true)
|
isResetPage(true)
|
||||||
}}
|
}}
|
||||||
excelClick={excelClick}
|
excelClick={excelClick}
|
||||||
initClick={function (): void {
|
initClick={function (): void { }}
|
||||||
setPbnRuseNm("");
|
|
||||||
setFromDate(String(new Date().getFullYear()));
|
|
||||||
setToDate(String(new Date().getFullYear()))
|
|
||||||
}}
|
|
||||||
btnClass={btnClass}
|
btnClass={btnClass}
|
||||||
ref={ref} isAdmin={false} />
|
ref={ref} isAdmin={false} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export const DmdCoReqSchema = z.object({
|
|||||||
z.object({
|
z.object({
|
||||||
ruseUtztnFcltNm: z.string(),
|
ruseUtztnFcltNm: z.string(),
|
||||||
ruseUtztnFcltCd: z.string(),
|
ruseUtztnFcltCd: z.string(),
|
||||||
}).nullish()
|
})
|
||||||
).nullish(),
|
).nullish(),
|
||||||
totalConstCost: z.number().nullish(),
|
totalConstCost: z.number().nullish(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
|||||||
`/reuseFc/request/${pageNo}/${pageCnt}/${con}`
|
`/reuseFc/request/${pageNo}/${pageCnt}/${con}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log('coSttnRes ', coSttnRes)
|
||||||
|
|
||||||
set((state: coSttnState) => {
|
set((state: coSttnState) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
isInvalidNumber,
|
isInvalidNumber,
|
||||||
parseRawValue,
|
parseRawValue,
|
||||||
} from "@/components/lib/func/excelFunc";
|
} from "@/components/lib/func/excelFunc";
|
||||||
import toast from "react-hot-toast";
|
|
||||||
export const useTypes = [
|
export const useTypes = [
|
||||||
"조경용수",
|
"조경용수",
|
||||||
"청소화장실용수",
|
"청소화장실용수",
|
||||||
@@ -17,18 +16,6 @@ export const useTypes = [
|
|||||||
"기타",
|
"기타",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export const chkMngType =[
|
|
||||||
'위탁',
|
|
||||||
'자체'
|
|
||||||
]
|
|
||||||
export const chkSpwtPositnType = [
|
|
||||||
'유량계',
|
|
||||||
'수위계',
|
|
||||||
'펌프적산전력계',
|
|
||||||
'기타'
|
|
||||||
]
|
|
||||||
|
|
||||||
export type Buildingtype = {
|
export type Buildingtype = {
|
||||||
bdstInfoSn: number;
|
bdstInfoSn: number;
|
||||||
ctpvCd: 1;
|
ctpvCd: 1;
|
||||||
@@ -156,56 +143,43 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
|||||||
})
|
})
|
||||||
.filter((el: any) => el !== undefined);
|
.filter((el: any) => el !== undefined);
|
||||||
|
|
||||||
console.log("rainChkgdData", rainChkgdData);
|
|
||||||
if (rainChkgdData.length > 0) {
|
if (rainChkgdData.length > 0) {
|
||||||
rainChkgdData.forEach((rain: any) => {
|
rainChkgdData.forEach((rain: any) => {
|
||||||
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
|
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
|
||||||
|
|
||||||
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
|
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage + `점검일: 날짜 형식 아님 입력값 : (${rain.chckYmd})`
|
defaultMessage + `점검일: 날짜 형식 아님 (${rain.chckYmd})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (rain.anlOperCst.length > 2 && isInvalidNumber(rain.anlOperCst)) {
|
if (rain.anlOperCst.length > 2 && isInvalidNumber(rain.anlOperCst)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage +
|
defaultMessage +
|
||||||
` 연간운영비(원/년): 숫자 형식 아님 /입력값:${rain.anlOperCst}`
|
` 연간운영비(원/년): 숫자 형식 아님 (${rain.anlOperCst})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (rain.oilqMeasMthd.length > 1 && !chkMngType.includes(rain.oilqMeasMthd)) {
|
|
||||||
issues.push(
|
|
||||||
defaultMessage + `유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (rain.spwtPositn.length > 1 && !chkSpwtPositnType.includes(rain.spwtPositn)) {
|
|
||||||
issues.push(
|
|
||||||
defaultMessage + `측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rain.spwtPositn}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rain.rainyDetails?.forEach((key) => {
|
rain.rainyDetails?.forEach((key) => {
|
||||||
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
|
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
|
||||||
issues.push(defaultMessage + `PH: 숫자 형식 아님 /입력값:${key.ph}`);
|
issues.push(defaultMessage + `PH: 숫자 형식 아님 (${key.ph})`);
|
||||||
}
|
}
|
||||||
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
|
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
|
||||||
issues.push(defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`);
|
issues.push(defaultMessage + `탁도: 숫자 형식 아님 (${key.trbt})`);
|
||||||
}
|
}
|
||||||
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
|
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage + `총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}`
|
defaultMessage + `총대장균군수: 숫자 형식 아님 (${key.grssClfg})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
|
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage +
|
defaultMessage +
|
||||||
`과태료부과금액(천원): 숫자 형식 아님 /입력값:${key.levyAmt}`
|
`과태료부과금액(천원): 숫자 형식 아님 (${key.levyAmt})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) {
|
if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage +
|
defaultMessage +
|
||||||
`과태료 부과일(위반일): 날짜 형식 아님 /입력값:${key.vltnDt}`
|
`과태료 부과일(위반일): 날짜 형식 아님 (${key.vltnDt})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -214,19 +188,17 @@ console.log("rainChkgdData", rainChkgdData);
|
|||||||
if (isInvalidNumber(guide.splyUswtrUtztnQnt)) {
|
if (isInvalidNumber(guide.splyUswtrUtztnQnt)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage +
|
defaultMessage +
|
||||||
`대체_${mm}: 숫자 형식 아님 /입력값:${guide.splyUswtrUtztnQnt}`
|
`대체_${mm}: 숫자 형식 아님 (${guide.splyUswtrUtztnQnt})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isInvalidNumber(guide.ruseFcltUtztnQnt)) {
|
if (isInvalidNumber(guide.ruseFcltUtztnQnt)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage +
|
defaultMessage +
|
||||||
`빗물_${mm}: 숫자 형식 아님 /입력값:${guide.ruseFcltUtztnQnt}`
|
`빗물_${mm}: 숫자 형식 아님 (${guide.ruseFcltUtztnQnt})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
toast.error("데이터가 없습니다. 점검 데이터를 확인해주세요.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issues.length > 0) {
|
if (issues.length > 0) {
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import type { SelectDataType } from "@common/business_components/ui";
|
import type { SelectDataType } from "@common/business_components/ui";
|
||||||
import {
|
import { useTypes, type Buildingtype } from "../rainChkgdn/excel";
|
||||||
chkMngType,
|
|
||||||
chkSpwtPositnType,
|
|
||||||
useTypes,
|
|
||||||
type Buildingtype,
|
|
||||||
} from "../rainChkgdn/excel";
|
|
||||||
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||||
import type { rswtChkZodType } from ".";
|
import type { rswtChkZodType } from ".";
|
||||||
import {
|
import {
|
||||||
@@ -176,14 +171,14 @@ export const excelToRswtGuideData = (
|
|||||||
.filter((el: any) => el !== undefined);
|
.filter((el: any) => el !== undefined);
|
||||||
|
|
||||||
if (rswtChkgdData.length > 0) {
|
if (rswtChkgdData.length > 0) {
|
||||||
rswtExcelDataCheck(rswtChkgdData, issues);
|
rswtExcelDataCheck(rswtChkgdData,issues)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issues.length > 0) {
|
if (issues.length > 0) {
|
||||||
return { data: [], issues };
|
return { data: [], issues };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { data: rswtChkgdData, issues: [] };
|
return { data:rswtChkgdData, issues: [] };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||||
@@ -253,25 +248,25 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
|||||||
})
|
})
|
||||||
.filter((el: any) => el !== undefined);
|
.filter((el: any) => el !== undefined);
|
||||||
if (rswtChkgdData.length > 0) {
|
if (rswtChkgdData.length > 0) {
|
||||||
rswtExcelDataCheck(rswtChkgdData, issues);
|
rswtExcelDataCheck(rswtChkgdData,issues)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issues.length > 0) {
|
if (issues.length > 0) {
|
||||||
return { data: [], issues };
|
return { data: [], issues };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { data: rswtChkgdData, issues: [] };
|
return { data:rswtChkgdData, issues: [] };
|
||||||
};
|
};
|
||||||
|
|
||||||
const rswtExcelDataCheck = (
|
|
||||||
rswtChkgdData: rswtChkZodType[],
|
const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
|
||||||
issues: string[]
|
|
||||||
) => {
|
|
||||||
rswtChkgdData.forEach((rswt: any) => {
|
rswtChkgdData.forEach((rswt: any) => {
|
||||||
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
|
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
|
||||||
|
|
||||||
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
|
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
|
||||||
issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`);
|
issues.push(
|
||||||
|
defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) {
|
if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
@@ -284,25 +279,6 @@ const rswtExcelDataCheck = (
|
|||||||
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
|
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
rswt.oilqMeasMthd.length > 1 &&
|
|
||||||
!chkMngType.includes(rswt.oilqMeasMthd)
|
|
||||||
) {
|
|
||||||
issues.push(
|
|
||||||
defaultMessage +
|
|
||||||
`유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rswt.oilqMeasMthd}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
rswt.spwtPositn.length > 1 &&
|
|
||||||
!chkSpwtPositnType.includes(rswt.spwtPositn)
|
|
||||||
) {
|
|
||||||
issues.push(
|
|
||||||
defaultMessage +
|
|
||||||
`측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) {
|
if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) {
|
||||||
rswt.rswtrPollutions.forEach((pol) => {
|
rswt.rswtrPollutions.forEach((pol) => {
|
||||||
if (isInvalidNumber(pol.grssClfgUswtr)) {
|
if (isInvalidNumber(pol.grssClfgUswtr)) {
|
||||||
@@ -325,7 +301,8 @@ const rswtExcelDataCheck = (
|
|||||||
}
|
}
|
||||||
if (isInvalidNumber(pol.bod)) {
|
if (isInvalidNumber(pol.bod)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage + `${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
|
defaultMessage +
|
||||||
|
`${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isInvalidNumber(pol.smll)) {
|
if (isInvalidNumber(pol.smll)) {
|
||||||
@@ -342,7 +319,8 @@ const rswtExcelDataCheck = (
|
|||||||
}
|
}
|
||||||
if (isInvalidNumber(pol.tph)) {
|
if (isInvalidNumber(pol.tph)) {
|
||||||
issues.push(
|
issues.push(
|
||||||
defaultMessage + `${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})`
|
defaultMessage +
|
||||||
|
`${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isInvalidNumber(pol.tn)) {
|
if (isInvalidNumber(pol.tn)) {
|
||||||
@@ -380,5 +358,7 @@ const rswtExcelDataCheck = (
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
};
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,17 +7,16 @@ import toast from "react-hot-toast";
|
|||||||
|
|
||||||
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
|
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
|
||||||
const monthHeadList = monthHeadListExport;
|
const monthHeadList = monthHeadListExport;
|
||||||
export const prfRegPageSize = 10;
|
|
||||||
export type pbnstPrfmncState = {
|
export type pbnstPrfmncState = {
|
||||||
prfmnc: {
|
prfmnc: {
|
||||||
isInit: boolean;
|
isInit: boolean;
|
||||||
pbnstPrfmncHeadList: TableUpperProps[];
|
pbnstPrfmncHeadList: TableUpperProps[];
|
||||||
monthHeadList: TableUpperProps[];
|
monthHeadList: TableUpperProps[];
|
||||||
prfmncRes: FcPrfType[];
|
prfmncRes: FcPrfType[];
|
||||||
prfmncResCount: number;
|
prfmncResCount:number;
|
||||||
excelList: number[];
|
excelList: number[];
|
||||||
pageKey: number;
|
pageKey:number
|
||||||
prfPbnFclts: string[];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27,126 +26,68 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = {
|
|||||||
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
|
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
|
||||||
monthHeadList: monthHeadList,
|
monthHeadList: monthHeadList,
|
||||||
prfmncRes: [],
|
prfmncRes: [],
|
||||||
prfPbnFclts: [],
|
prfmncResCount:1,
|
||||||
prfmncResCount: 1,
|
|
||||||
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
pageKey: 1,
|
pageKey:1
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
|
export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
|
||||||
|
|
||||||
type pbnstPrfmncActions = {
|
type pbnstPrfmncActions = {
|
||||||
prfmncHasuInit: (
|
prfmncHasuInit: (page: number, sggOrCity: string ,year:string) => void;
|
||||||
page: number,
|
prfmncHasuNmSearch: (page: number, sggOrCity: string , txt:string ,year:string) => void;
|
||||||
sggOrCity: string,
|
prfmnRegData: (page:number,sggOrCity:string, data: PrfType,year:string) => void;
|
||||||
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 hasuListFetch = async (
|
const checkWrRegList = async (year:string) => {
|
||||||
page: number,
|
const url =`/reuseFc/pubDetailList`
|
||||||
sggOrCity: string,
|
if(year&& year.length>0){
|
||||||
year: string,
|
// url+=`/${year}`
|
||||||
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);
|
||||||
let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}/A/${sggOrCity}/0/1/SW`;
|
return wrRegList;
|
||||||
if (searchTxt && searchTxt?.length > 0) {
|
};
|
||||||
url += `/${searchTxt}`;
|
const hasuListFetch = async (page: number, sggOrCity: string , year:string,searchNm?:string ) => {
|
||||||
}
|
const checkWrRegListRes = await checkWrRegList(year);
|
||||||
const rainRes = await postFectch(url, filteredFclt, fetchType.COMMON);
|
const rainRes = await postFectch(
|
||||||
|
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
|
||||||
const checkRuseFcltList =
|
checkWrRegListRes?.fcltCds,
|
||||||
searchTxt && searchTxt?.length > 0
|
fetchType.COMMON
|
||||||
? rainRes.data.map((item) => item.bscFctCd)
|
|
||||||
: filteredFclt;
|
|
||||||
|
|
||||||
const pubRuseList = await postFectch(
|
|
||||||
`/reuseFc/pubDetailList/${year}/${sggOrCity}/${page}/${prfRegPageSize}`,
|
|
||||||
checkRuseFcltList,
|
|
||||||
fetchType.WR
|
|
||||||
);
|
);
|
||||||
const rusePrfList = pubRuseList.data
|
let findData = rainRes.data.map((item: pubHasuType) => {
|
||||||
.map((item: FcPrfType) => {
|
const data = checkWrRegListRes?.fcPrfList.find(
|
||||||
const findData = rainRes.data?.find(
|
(fclt: FcPrfType) =>
|
||||||
(fclt: pubHasuType) =>
|
fclt.pbnstRuseFcltId.substring(0, 11) === item?.bscFctCd
|
||||||
item.pbnstRuseFcltId.substring(0, 11) === fclt?.bscFctCd
|
);
|
||||||
);
|
if(data !==undefined){
|
||||||
if (findData !== undefined) {
|
return( {
|
||||||
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 값을 제거합니다.
|
|
||||||
|
|
||||||
return { data: rusePrfList, count: pubRuseList.count };
|
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};
|
||||||
};
|
};
|
||||||
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||||
set: any
|
set: any
|
||||||
) => {
|
) => {
|
||||||
return {
|
return {
|
||||||
getPrfFmcRes: async () => {
|
prfmncHasuInit: async (page: number, sggOrCity: string,year:string) => {
|
||||||
try {
|
try {
|
||||||
const pbnPrfRes = await getFetch(fetchType.WR, "/reuseFc/pubFc");
|
const prfmncRes = await hasuListFetch(page, sggOrCity, year);
|
||||||
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) => ({
|
return set((state: pbnstPrfmncState) => ({
|
||||||
...state,
|
...state,
|
||||||
prfmnc: {
|
prfmnc: {
|
||||||
@@ -160,21 +101,9 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
|||||||
console.log(errorHasu);
|
console.log(errorHasu);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prfmncHasuNmSearch: async (
|
prfmncHasuNmSearch: async (page: number, sggOrCity: string,fcltNm:string ,year:string)=> {
|
||||||
page: number,
|
|
||||||
sggOrCity: string,
|
|
||||||
year: string,
|
|
||||||
searchTxt: string,
|
|
||||||
prfPbnFclts: string[]
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
const prfmncRes = await hasuListFetch(
|
const prfmncRes = await hasuListFetch(page, sggOrCity,fcltNm ,year);
|
||||||
page,
|
|
||||||
sggOrCity,
|
|
||||||
year,
|
|
||||||
prfPbnFclts,
|
|
||||||
searchTxt
|
|
||||||
);
|
|
||||||
return set((state: pbnstPrfmncState) => ({
|
return set((state: pbnstPrfmncState) => ({
|
||||||
...state,
|
...state,
|
||||||
prfmnc: {
|
prfmnc: {
|
||||||
@@ -188,13 +117,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
|||||||
console.log(errorHasu);
|
console.log(errorHasu);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prfmnRegData: async (
|
prfmnRegData: async (page:number,sggOrCity:string,data: PrfType,year:string) => {
|
||||||
page: number,
|
|
||||||
sggOrCity: string,
|
|
||||||
data: PrfType,
|
|
||||||
year: string,
|
|
||||||
prfPbnFclts: string[]
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
const ressponse = await postFectch(
|
const ressponse = await postFectch(
|
||||||
"/reuseFc/pubFcPrf",
|
"/reuseFc/pubFcPrf",
|
||||||
@@ -202,14 +125,11 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
|||||||
fetchType.WR
|
fetchType.WR
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (ressponse.status === 200) {
|
if (ressponse.status === 200) {
|
||||||
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
|
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
|
||||||
const prfmncRes = await hasuListFetch(
|
const prfmncRes = await hasuListFetch(page, sggOrCity,year) ;
|
||||||
page,
|
|
||||||
sggOrCity,
|
|
||||||
year,
|
|
||||||
prfPbnFclts
|
|
||||||
);
|
|
||||||
|
|
||||||
return set((state: pbnstPrfmncState) => ({
|
return set((state: pbnstPrfmncState) => ({
|
||||||
...state,
|
...state,
|
||||||
@@ -218,9 +138,10 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
|||||||
prfmncRes: prfmncRes.data,
|
prfmncRes: prfmncRes.data,
|
||||||
prfmncResCount: prfmncRes.count,
|
prfmncResCount: prfmncRes.count,
|
||||||
isInit: false,
|
isInit: false,
|
||||||
pageKey: state.prfmnc.pageKey + 1,
|
pageKey: state.prfmnc.pageKey + 1
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|||||||
@@ -50,56 +50,42 @@ const hasuListFetch = async (
|
|||||||
page: number,
|
page: number,
|
||||||
returnType: ReturnType,
|
returnType: ReturnType,
|
||||||
searchNm: string | undefined,
|
searchNm: string | undefined,
|
||||||
fromDate: string,
|
year: string,
|
||||||
toDate: string,
|
|
||||||
flcts: string[]
|
flcts: string[]
|
||||||
) => {
|
) => {
|
||||||
let url = '';
|
let url = `/prcsFclt/ruseInfo/`;
|
||||||
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") {
|
if (returnType.partValue === "A") {
|
||||||
url += `${returnType.partValue}/${
|
url += `${page}/5/${returnType.partValue}/${
|
||||||
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
|
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
|
||||||
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
||||||
}/0/1/SW`
|
}/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") {
|
} else if (returnType.partValue === "R") {
|
||||||
url += `${returnType.partValue}/${returnType.regionValue
|
url += `${page}/5/${returnType.partValue}/${returnType.regionValue
|
||||||
? returnType.regionValue
|
? returnType.regionValue
|
||||||
: returnType.unitWaterShedValue
|
: returnType.unitWaterShedValue
|
||||||
? returnType.unitWaterShedValue
|
? returnType.unitWaterShedValue
|
||||||
: returnType.middleRegionValue
|
: returnType.middleRegionValue
|
||||||
}/0/1/SW`
|
}/0/1/SW`
|
||||||
} else if (returnType.partValue === 'G') {
|
} else if (returnType.partValue === 'G') {
|
||||||
url += `${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW`
|
url += `${page}/5/${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 {
|
} else {
|
||||||
url += `A/0/0/1/SW`
|
url += `1/2/A/0/0/1/SW`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchNm && searchNm?.length > 0) {
|
if (searchNm && searchNm?.length > 0) {
|
||||||
url += "/" + searchNm
|
url += "/" + searchNm
|
||||||
}
|
}
|
||||||
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 pbnList = await postFectch(url, flcts, fetchType.COMMON);
|
||||||
const getRuseList = await postFectch(
|
const getRuseList = await postFectch(
|
||||||
`/reuseFc/pubDetailPrfList/${fromDate}/${toDate}/${filterData}/${page}/5`,
|
`/reuseFc/pubDetailList/${year}`,
|
||||||
checkRuseFcltList,
|
flcts,
|
||||||
fetchType.WR
|
fetchType.WR
|
||||||
);
|
);
|
||||||
|
let count = 0;
|
||||||
const checkWrRegListRes = getRuseList.data;
|
const checkWrRegListRes = getRuseList.data;
|
||||||
|
|
||||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||||
(item: FcPrfType) => {
|
(item: FcPrfType) => {
|
||||||
if (!item.prfList || item.prfList.length === 0) {
|
if (!item.prfList || item.prfList.length === 0) {
|
||||||
@@ -110,6 +96,7 @@ const hasuListFetch = async (
|
|||||||
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
||||||
);
|
);
|
||||||
if (findData) {
|
if (findData) {
|
||||||
|
count++;
|
||||||
return {
|
return {
|
||||||
sido: findData?.sido || '-',
|
sido: findData?.sido || '-',
|
||||||
gugun: findData?.gugun || '-',
|
gugun: findData?.gugun || '-',
|
||||||
@@ -117,12 +104,12 @@ const hasuListFetch = async (
|
|||||||
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
|
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
|
||||||
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
|
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
|
||||||
bscFctCd: findData?.bscFctCd || '-',
|
bscFctCd: findData?.bscFctCd || '-',
|
||||||
prfList: item.prfList,
|
count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).filter(Boolean);
|
).filter(Boolean);
|
||||||
return {data: data, count: getRuseList.count};
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
|
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
|
||||||
@@ -188,17 +175,29 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
page,
|
page,
|
||||||
returnType,
|
returnType,
|
||||||
fcltNm,
|
fcltNm,
|
||||||
fromDate,
|
|
||||||
toDate,
|
toDate,
|
||||||
fclts);
|
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 inUsageSum = 0;
|
||||||
let outUsageSum = 0;
|
let outUsageSum = 0;
|
||||||
let year = "";
|
let year = "";
|
||||||
const yearsData = [] as any
|
const yearsData = [] as any
|
||||||
|
|
||||||
prfmncRes.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
if (!item.prfList || item.prfList.length === 0) {
|
if (item.prfList.length === 0) {
|
||||||
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
||||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
||||||
yearVal[`${year}inUsage`] = 0;
|
yearVal[`${year}inUsage`] = 0;
|
||||||
@@ -206,7 +205,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
yearVal[`${year}total`] = 0;
|
yearVal[`${year}total`] = 0;
|
||||||
yearsData.push(yearVal);
|
yearsData.push(yearVal);
|
||||||
}
|
}
|
||||||
item.prfList?.forEach((acc: any) => {
|
item.prfList.forEach((acc) => {
|
||||||
year = acc.ym?.substring(0, 4) ?? "";
|
year = acc.ym?.substring(0, 4) ?? "";
|
||||||
inUsageSum =
|
inUsageSum =
|
||||||
(acc.wshwtr ?? 0) + //조경용수
|
(acc.wshwtr ?? 0) + //조경용수
|
||||||
@@ -274,7 +273,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
|
|
||||||
// prfmncRes 정보 merge
|
// prfmncRes 정보 merge
|
||||||
const resData = Object.values(mergedMap).map((item: any) => {
|
const resData = Object.values(mergedMap).map((item: any) => {
|
||||||
const match = prfmncRes.data.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
|
const match = prfmncRes.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
|
||||||
return match ? { ...item, ...match } : item;
|
return match ? { ...item, ...match } : item;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -283,10 +282,10 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
|||||||
pbnstPrfmncSttn: {
|
pbnstPrfmncSttn: {
|
||||||
...state.pbnstPrfmncSttn,
|
...state.pbnstPrfmncSttn,
|
||||||
// prfmncRes: prfmncRes,
|
// prfmncRes: prfmncRes,
|
||||||
prfmncResCount: prfmncRes.count,
|
prfmncResCount: fclts.length - 5,
|
||||||
isInit: false,
|
isInit: false,
|
||||||
prfmncRes: resData,
|
prfmncRes: resData,
|
||||||
rawData: prfmncRes.data
|
rawData: res.data
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
} catch (errorHasu) {
|
} catch (errorHasu) {
|
||||||
|
|||||||
@@ -95,59 +95,43 @@ const hasuListFetch = async (
|
|||||||
year: string,
|
year: string,
|
||||||
flcts: string[]
|
flcts: string[]
|
||||||
) => {
|
) => {
|
||||||
let url = ``;
|
let url = `/prcsFclt/ruseInfo/`;
|
||||||
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") {
|
if (reurnValue.partValue === "A") {
|
||||||
url += `${reurnValue.partValue}/${
|
url += `${page}/${total}/${reurnValue.partValue}/${
|
||||||
// reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
|
// reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
|
||||||
reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
|
reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
|
||||||
}/0/1/SW`
|
}/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") {
|
} else if (reurnValue.partValue === "R") {
|
||||||
url += `${reurnValue.partValue}/${reurnValue.regionValue
|
url += `${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue
|
||||||
? reurnValue.regionValue
|
? reurnValue.regionValue
|
||||||
: reurnValue.unitWaterShedValue
|
: reurnValue.unitWaterShedValue
|
||||||
? reurnValue.unitWaterShedValue
|
? reurnValue.unitWaterShedValue
|
||||||
: reurnValue.middleRegionValue
|
: reurnValue.middleRegionValue
|
||||||
}/0/1/SW`
|
}/0/1/SW`
|
||||||
} else if (reurnValue.partValue === 'G') {
|
} else if (reurnValue.partValue === 'G') {
|
||||||
url += `${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
|
|
||||||
if(filterData !== '0')
|
|
||||||
filteredFclt= flcts.filter((fclt: string) => {
|
url += `${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
|
||||||
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
|
|
||||||
})
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
url += `A/0/0/1/SW`
|
url += `1/2/A/0/0/1/SW`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchNm && searchNm?.length > 0) {
|
if (searchNm && searchNm?.length > 0) {
|
||||||
url += "/" + searchNm
|
url += "/" + searchNm
|
||||||
}
|
}
|
||||||
|
|
||||||
const pbnList = await postFectch( `/prcsFclt/ruseInfo/1/${filteredFclt.length}/`+url, filteredFclt, fetchType.COMMON);
|
const pbnList = await postFectch(url, flcts, fetchType.COMMON);
|
||||||
|
|
||||||
|
|
||||||
const checkRuseFcltList = searchNm && searchNm?.length > 0?pbnList.data.map((item)=> item.bscFctCd ):filteredFclt
|
|
||||||
const getRuseList = await postFectch(
|
const getRuseList = await postFectch(
|
||||||
`/reuseFc/pubDetailList/${year}/${filterData}/${page}/${total}`,
|
`/reuseFc/pubDetailList/${year}`,
|
||||||
checkRuseFcltList,
|
flcts,
|
||||||
fetchType.WR
|
fetchType.WR
|
||||||
);
|
);
|
||||||
const checkWrRegListRes = getRuseList.data;
|
const checkWrRegListRes = getRuseList.data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||||
(item: FcPrfType) => {
|
(item: FcPrfType) => {
|
||||||
const findData = pbnList.data.find(
|
const findData = pbnList.data.find(
|
||||||
@@ -156,6 +140,7 @@ const hasuListFetch = async (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (findData) {
|
if (findData) {
|
||||||
|
|
||||||
const usage = item.prfList.reduce(
|
const usage = item.prfList.reduce(
|
||||||
(acc, cur) => {
|
(acc, cur) => {
|
||||||
acc.inUsage +=
|
acc.inUsage +=
|
||||||
@@ -212,11 +197,7 @@ const hasuListFetch = async (
|
|||||||
|
|
||||||
}
|
}
|
||||||
).filter(Boolean);
|
).filter(Boolean);
|
||||||
|
return data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {data:data, count:getRuseList.count};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||||
@@ -257,6 +238,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
|||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
const pbnstSttnRes = await hasuListFetch(
|
const pbnstSttnRes = await hasuListFetch(
|
||||||
page,
|
page,
|
||||||
total,
|
total,
|
||||||
@@ -268,7 +250,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
|||||||
|
|
||||||
// if (Number(total) > 9000) {
|
// if (Number(total) > 9000) {
|
||||||
if (isExcel) {
|
if (isExcel) {
|
||||||
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes.data);
|
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
|
||||||
set((state: pbnstSttnState) => {
|
set((state: pbnstSttnState) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
@@ -285,8 +267,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
|||||||
...state,
|
...state,
|
||||||
pbnstSttn: {
|
pbnstSttn: {
|
||||||
...state.pbnstSttn,
|
...state.pbnstSttn,
|
||||||
pbnstSttnRes: pbnstSttnRes.data,
|
pbnstSttnRes: pbnstSttnRes,
|
||||||
pbnstSttnResCount: pbnstSttnRes.count
|
pbnstSttnResCount: pbnstSttnRes.length
|
||||||
// isInit: false,
|
// isInit: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -313,14 +295,13 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
|||||||
fclts
|
fclts
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
set((state: pbnstSttnState) => {
|
set((state: pbnstSttnState) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
pbnstSttn: {
|
pbnstSttn: {
|
||||||
...state.pbnstSttn,
|
...state.pbnstSttn,
|
||||||
pbnstSttnRes: pbnstSttnRes.data,
|
pbnstSttnRes: pbnstSttnRes,
|
||||||
pbnstSttnResCount: pbnstSttnRes.count,
|
pbnstSttnResCount: pbnstSttnRes.length,
|
||||||
isInit: false,
|
isInit: false,
|
||||||
pbnstDetail: {} as customPbnst
|
pbnstDetail: {} as customPbnst
|
||||||
},
|
},
|
||||||
@@ -384,8 +365,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
|||||||
...state,
|
...state,
|
||||||
pbnstSttn: {
|
pbnstSttn: {
|
||||||
...state.pbnstSttn,
|
...state.pbnstSttn,
|
||||||
pbnstSearchData: pbnstSttnRes.data,
|
pbnstSearchData: pbnstSttnRes,
|
||||||
pbnstSttnResCount: pbnstSttnRes.count,
|
pbnstSttnResCount: pbnstSttnRes.length,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -488,6 +488,16 @@ export function PbnstBuseForm({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <MngRegFormDetail
|
||||||
|
formList={ruseWaterQulityList}
|
||||||
|
h1Title={`하수처리수 재이용시설 보증수질 `}
|
||||||
|
subTitle="※재처리시설이 있는 경우만 작성"
|
||||||
|
form={form}
|
||||||
|
moClass="grid grid-cols-12 gap-4"
|
||||||
|
sonClass="col-span-4"
|
||||||
|
indexMng={indexMng}
|
||||||
|
indexBiz={indexBiz}
|
||||||
|
/> */}
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<BuseWaterQulity
|
<BuseWaterQulity
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export class LoginApiService implements LoginService {
|
|||||||
|
|
||||||
public async login(payload: ILogin): Promise<void> {
|
public async login(payload: ILogin): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
|
||||||
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ type MonthPickerProps = {
|
|||||||
selectClass?: string;
|
selectClass?: string;
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
startYear?: number; // 시작 연도 props 추가
|
startYear?: number; // 시작 연도 props 추가
|
||||||
yearReadOnly?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// yyyyMM → Date 객체
|
// yyyyMM → Date 객체
|
||||||
@@ -40,7 +39,6 @@ export const DateMonthPicker = ({
|
|||||||
selectClass,
|
selectClass,
|
||||||
readOnly = false,
|
readOnly = false,
|
||||||
startYear,
|
startYear,
|
||||||
yearReadOnly = false,
|
|
||||||
}: MonthPickerProps) => {
|
}: MonthPickerProps) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
@@ -80,7 +78,6 @@ export const DateMonthPicker = ({
|
|||||||
currentMonth={parsedDate}
|
currentMonth={parsedDate}
|
||||||
onMonthChange={handleSelect}
|
onMonthChange={handleSelect}
|
||||||
startYear={startYear}
|
startYear={startYear}
|
||||||
yearReadOnly={yearReadOnly}
|
|
||||||
/>
|
/>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ export type MonthPickerProps = {
|
|||||||
shouldClosePopover?: boolean
|
shouldClosePopover?: boolean
|
||||||
) => void;
|
) => void;
|
||||||
startYear?: number;
|
startYear?: number;
|
||||||
yearReadOnly?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function MonthPicker({ currentMonth, onMonthChange, startYear, yearReadOnly }: MonthPickerProps) {
|
export function MonthPicker({ currentMonth, onMonthChange, startYear }: MonthPickerProps) {
|
||||||
|
|
||||||
const today = startOfToday();
|
const today = startOfToday();
|
||||||
const currentYear = today.getFullYear();
|
const currentYear = today.getFullYear();
|
||||||
@@ -74,7 +73,6 @@ const selectedYear = parseInt(yearFromProp);
|
|||||||
<div className="flex justify-center pt-1">
|
<div className="flex justify-center pt-1">
|
||||||
<Select
|
<Select
|
||||||
value={yearFromProp}
|
value={yearFromProp}
|
||||||
disabled={yearReadOnly}
|
|
||||||
onValueChange={(selectedYearStr) => {
|
onValueChange={(selectedYearStr) => {
|
||||||
const selectedYearNum = parseInt(selectedYearStr);
|
const selectedYearNum = parseInt(selectedYearStr);
|
||||||
const newDate = new Date(
|
const newDate = new Date(
|
||||||
|
|||||||
@@ -128,7 +128,101 @@ function Gis({
|
|||||||
// Feature Click Event
|
// Feature Click Event
|
||||||
const handleFeatureSelect = useCallback((data) => {
|
const handleFeatureSelect = useCallback((data) => {
|
||||||
console.log(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); // 선택된 피쳐 데이터 콜백 호출
|
onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출
|
||||||
|
console.log(data)
|
||||||
}, [mapInstanceRef]);
|
}, [mapInstanceRef]);
|
||||||
|
|
||||||
// 지도 생성 및 초기화
|
// 지도 생성 및 초기화
|
||||||
@@ -373,7 +467,6 @@ function Gis({
|
|||||||
setVisible={setTabVisible}
|
setVisible={setTabVisible}
|
||||||
onCheckedChange={handleCheckedLayersChange}
|
onCheckedChange={handleCheckedLayersChange}
|
||||||
onLayerIconClick={(layerNm) => {
|
onLayerIconClick={(layerNm) => {
|
||||||
console.log(layerNm)
|
|
||||||
layerNmRef.current = layerNm
|
layerNmRef.current = layerNm
|
||||||
setLayerNm(layerNm); setIsOpen(true); const dummyFeature = {
|
setLayerNm(layerNm); setIsOpen(true); const dummyFeature = {
|
||||||
getProperties: () => ({}), // 최소 구조
|
getProperties: () => ({}), // 최소 구조
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
|||||||
};
|
};
|
||||||
const handleLayerImgClick = (nodeNm, nodeId, layerNm) => {
|
const handleLayerImgClick = (nodeNm, nodeId, layerNm) => {
|
||||||
if(!checked.includes(nodeId)) alert('시설을 선택해주세요')
|
if(!checked.includes(nodeId)) alert('시설을 선택해주세요')
|
||||||
else onLayerIconClick(nodeNm)
|
else onLayerIconClick(layerNm)
|
||||||
}
|
}
|
||||||
if (!treeData || treeData.length === 0) return null;
|
if (!treeData || treeData.length === 0) return null;
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ GisOlLayer.prototype = {
|
|||||||
strategy: all,
|
strategy: all,
|
||||||
});
|
});
|
||||||
return source;
|
return source;
|
||||||
|
|
||||||
|
return source;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* [사용]WFS 레이어 생성
|
* [사용]WFS 레이어 생성
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ const SelectBox = React.forwardRef<
|
|||||||
value?: string | number;
|
value?: string | number;
|
||||||
readOnly?: boolean; // readOnly 속성 추가
|
readOnly?: boolean; // readOnly 속성 추가
|
||||||
selectContentClass?: string;
|
selectContentClass?: string;
|
||||||
labelClass?: string;
|
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
(
|
(
|
||||||
@@ -41,7 +40,6 @@ const SelectBox = React.forwardRef<
|
|||||||
value,
|
value,
|
||||||
readOnly = false,
|
readOnly = false,
|
||||||
selectContentClass,
|
selectContentClass,
|
||||||
labelClass = "w-20 whitespace-nowrap text-xl text-gray-600",
|
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
@@ -68,7 +66,7 @@ const SelectBox = React.forwardRef<
|
|||||||
return (
|
return (
|
||||||
<div className={className + " flex items-center"} ref={ref}>
|
<div className={className + " flex items-center"} ref={ref}>
|
||||||
{label && (
|
{label && (
|
||||||
<Label className={labelClass}>
|
<Label className="w-20 whitespace-nowrap text-xl text-gray-600">
|
||||||
{label}
|
{label}
|
||||||
</Label>
|
</Label>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user