Compare commits
55
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca9f2da83c | ||
|
|
e54a0d0ef8 | ||
|
|
82e29ec4e2 | ||
|
|
96a50e4f5a | ||
|
|
96448b6427 | ||
|
|
6808430c9a | ||
|
|
0ef6aea502 | ||
|
|
33ad044ed3 | ||
|
|
c94b33b1b8 | ||
|
|
886561535e | ||
|
|
ebde6d433a | ||
|
|
556d3f33b6 | ||
|
|
f826f0fb3f | ||
|
|
11010099b4 | ||
|
|
17886b0f9d | ||
|
|
46c166a87c | ||
|
|
5b96245e7d | ||
|
|
6ba78d0923 | ||
|
|
15b6520ee1 | ||
|
|
ed53ad249c | ||
|
|
b67d1261ff | ||
|
|
cfde5d695f | ||
|
|
13ce985fe5 | ||
|
|
3e634fa575 | ||
|
|
16b204f83b | ||
|
|
0f9d7a115f | ||
|
|
05802896a8 | ||
|
|
a44e8722c6 | ||
|
|
690e671a25 | ||
|
|
46b98b99e2 | ||
|
|
9e339cd451 | ||
|
|
95085cbdeb | ||
|
|
c1b0f32609 | ||
|
|
f9b328278a | ||
|
|
8a5b9ba2c3 | ||
|
|
763e0ff5d8 | ||
|
|
93e8ec1df3 | ||
|
|
f087e55c3c | ||
|
|
53b3cc9817 | ||
|
|
b2bbdb8ad4 | ||
|
|
417a24bb16 | ||
|
|
72c1c01e47 | ||
|
|
aea6924015 | ||
|
|
4be7354b36 | ||
|
|
ab23e4ba2c | ||
|
|
e688a703ca | ||
|
|
49961db9a9 | ||
|
|
56f8d3700a | ||
|
|
c68e1d017e | ||
|
|
a09e7fc709 | ||
|
|
024f25f003 | ||
|
|
9d101666ab | ||
|
|
f5ae14de9e | ||
|
|
fe6293eb28 | ||
|
|
662fb390bc |
@@ -1,7 +1,8 @@
|
||||
NEXT_PUBLIC_SITE_ID = DM
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_PORT = 11035
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
|
||||
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_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
@@ -9,9 +10,7 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
|
||||
|
||||
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||
|
||||
+7
-5
@@ -3,17 +3,19 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-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://localhost:3000/
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3005/
|
||||
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_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_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import ListDiv from '@common/business_components/ui/list_div';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
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 { useRouter } from 'next/navigation';
|
||||
|
||||
@@ -31,8 +31,8 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
||||
const {selectSidoData, selectSigunData} = Common;
|
||||
const [isLogin, setIsLogin] = useState(false);
|
||||
const [isLoginStorageInfo, setIsLoginStorageInfo] = useState(false);
|
||||
const [sdmApplyDetail, setSdmApplyDetail] = useState<DemandCompType>({} as DemandCompType);
|
||||
const [transformedList, setTransformedList] = useState<DemandCompType[]>([]);
|
||||
const [sdmApplyDetail, setSdmApplyDetail] = useState<DemandCompBizType>({} as DemandCompBizType);
|
||||
const [transformedList, setTransformedList] = useState<DemandCompBizType[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('sessionStorage : ',sessionStorage.getItem('user'));
|
||||
@@ -60,10 +60,10 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
||||
// 데이터 변환을 위한 별도의 useEffect
|
||||
useEffect(() => {
|
||||
if (sdmInfoStatusList.length > 0) {
|
||||
const newTransformedList = sdmInfoStatusList.map((item: DemandCompType) => ({
|
||||
const newTransformedList = sdmInfoStatusList.map((item: DemandCompBizType) => ({
|
||||
...item,
|
||||
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);
|
||||
}
|
||||
@@ -73,6 +73,8 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
||||
if (index !== undefined) {
|
||||
const selectedStatus = transformedList[index];
|
||||
if (selectedStatus) {
|
||||
|
||||
|
||||
setSdmApplyDetail(selectedStatus);
|
||||
}
|
||||
}
|
||||
@@ -121,33 +123,33 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<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}>{ sdmApplyDetail?.grssClfg!=-1?<TransValueFormat value={sdmApplyDetail?.grssClfg ?? ''} format="number"/>:''} {sdmApplyDetail?.grssClfg?sdmApplyDetail.grssClfg!=-1? '이하':'불검출':'-'} </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"/>} {sdmApplyDetail?.combResdch?'이하':'-'}</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"/>} {sdmApplyDetail?.trbt?'이하':'-'}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<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"/>} {sdmApplyDetail?.blgcOxygDmndQnt?'이하':'-'}</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"/>} {sdmApplyDetail?.smll?'이하':'-'}</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"/>} {sdmApplyDetail?.crmty?'이하':'-'}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<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"/>} {sdmApplyDetail?.tn?'이하':'-'}</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"/>} {sdmApplyDetail?.tph?'이하':'-'}</TableCell>
|
||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>수소이온농도(pH)</TableCell>
|
||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{<TransValueFormat value={sdmApplyDetail?.ph} format="number"/>}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<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"/>} {sdmApplyDetail?.clIonQnt?'이하':'-'}</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"/>} {sdmApplyDetail?.cdtnv?'이하':'-'}</TableCell>
|
||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>비고</TableCell>
|
||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{sdmApplyDetail?.rmrk}</TableCell>
|
||||
</TableRow>
|
||||
@@ -156,11 +158,11 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<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.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.cell}></TableCell>
|
||||
<TableCell colSpan={1} className={TABLE_STYLES.cell}>{sdmApplyDetail?.splyCndtList?.[2]?.ruseUtztnFcltNm ?? ""}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
@@ -177,7 +179,7 @@ export default function SdmApplyList({}: SdmApplyProps) {
|
||||
<TableCell colSpan={1} className={TABLE_STYLES.header}>진행상태</TableCell>
|
||||
<TableCell colSpan={2} className={TABLE_STYLES.cell}>{sdmApplyDetail?.status?.toString()}</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>
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useDmStore } from "@/app/store";
|
||||
import type { DemandCompType } from "@/app/store/sdmMng";
|
||||
import { sdmInfoFormSchema, type DemandCompBizType, type SdmInfoFormData } from "@/app/store/sdmMng";
|
||||
import { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component";
|
||||
import { UiModal } from "@common/business_components/ui/dialog_ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
@@ -10,209 +10,206 @@ import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { Suspense, useEffect, useState } from "react";
|
||||
import { FormProvider, useForm, type SubmitHandler } from "react-hook-form";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import * as z from "zod";
|
||||
import SdmLogin from "../sdmLogin/page";
|
||||
|
||||
const sdmInfoFormSchema = z.object({
|
||||
sdmNm: z.string()
|
||||
.min(1, "수요처를 선택해주세요"),
|
||||
demandYmd: z.date().optional(),
|
||||
demandQnty: z.string()
|
||||
.min(1, "요구수량을 입력해주세요")
|
||||
.regex(/^[0-9]+$/, "요구수량은 숫자만 입력 가능합니다"),
|
||||
usePurpose: z.string().optional(),
|
||||
money: z.string()
|
||||
.regex(/^[0-9]+$/, "희망단가는 숫자만 입력 가능합니다"),
|
||||
/**요구수질 */
|
||||
reqWaterQlty: z.string().optional(),
|
||||
grssClfg: z.string()
|
||||
.min(1, "총대장균군수를 입력해주세요")
|
||||
.regex(/^[0-9]+$/, "총대장균군수는 숫자만 입력 가능합니다"),
|
||||
tn: z.string()
|
||||
.min(1, "총질소를 입력해주세요")
|
||||
.regex(/^[0-9]+$/, "총질소는 숫자만 입력 가능합니다"),
|
||||
combResdch: z.string()
|
||||
.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()
|
||||
.min(1, "염화물을 입력해주세요")
|
||||
.regex(/^[0-9]+$/, "염화물은 숫자만 입력 가능합니다"),
|
||||
smll: z.string()
|
||||
.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(),
|
||||
/* telno: z.string()
|
||||
.min(8, "전화번호는 8자 이상 입력해주세요")
|
||||
.max(12, "전화번호는 12자 이내로 입력해주세요")
|
||||
.regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), */
|
||||
candidateTitle: z.array(z.object({
|
||||
ruseUtztnFcltNm: z.string(),
|
||||
ruseUtztnFcltCd: z.string(),
|
||||
})).optional(),
|
||||
});
|
||||
|
||||
export type FormData = z.infer<typeof sdmInfoFormSchema>;
|
||||
|
||||
function SdmInfoInsertContent() {
|
||||
const searchParams = useSearchParams();
|
||||
const {map, insertSdmInfoData, Sdm } = useDmStore((state) => state);
|
||||
const { insertSdmInfoData, Sdm, setSubsInfo } = useDmStore((state) => state);
|
||||
const { successLogin } = Sdm;
|
||||
const [ismoneyDisabled, setIsmoneyDisabled] = useState(false);
|
||||
const formSchema = sdmInfoFormSchema;
|
||||
|
||||
const [isLogin, setIsLogin] = useState(false);
|
||||
const [facilityName, setFacilityName] = useState<string>('');
|
||||
const [defaultValues, setDefaultValues] = useState<FormData>({
|
||||
sdmNm: '',
|
||||
const [facilityName, setFacilityName] = useState<string>("");
|
||||
const [defaultValues, setDefaultValues] = useState<SdmInfoFormData>({
|
||||
sdmNm: "",
|
||||
demandYmd: new Date(),
|
||||
demandQnty: '',
|
||||
usePurpose: '',
|
||||
money: '',
|
||||
demandQnty: "",
|
||||
usePurpose: "",
|
||||
money: "",
|
||||
/**요구수질 */
|
||||
reqWaterQlty: '',
|
||||
grssClfg: '',
|
||||
tn: '',
|
||||
combResdch: '',
|
||||
tph: '',
|
||||
trbt: '',
|
||||
ph: '',
|
||||
bod: '',
|
||||
reqWaterQlty: "",
|
||||
grssClfg: null,
|
||||
tn: null,
|
||||
combResdch: null,
|
||||
tph: null,
|
||||
trbt: null,
|
||||
ph: null,
|
||||
bod: null,
|
||||
/**컬럼확인필요 */
|
||||
clIonQnt: '',
|
||||
smll: '',
|
||||
cdtnv: '',
|
||||
crmty: '',
|
||||
rmrk: '',
|
||||
clIonQnt: null,
|
||||
smll: "",
|
||||
cdtnv: null,
|
||||
crmty: null,
|
||||
rmrk: "",
|
||||
/** 후보지 제목 */
|
||||
candidateTitle: [
|
||||
{ ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' },
|
||||
{ ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' },
|
||||
{ ruseUtztnFcltNm: '', ruseUtztnFcltCd: '' },
|
||||
{ ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" },
|
||||
{ ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" },
|
||||
{ ruseUtztnFcltNm: "", ruseUtztnFcltCd: "" },
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const user = sessionStorage.getItem('user');
|
||||
setDefaultValues(prev => ({
|
||||
const user = sessionStorage.getItem("user");
|
||||
setDefaultValues((prev) => ({
|
||||
...prev,
|
||||
sdmNm: searchParams.get('dmdCoNm') || '',
|
||||
sdmNm: searchParams.get("dmdCoNm") || "",
|
||||
}));
|
||||
sessionStorage.setItem('user', searchParams.get('dmdInfoId') || '');
|
||||
setIsLogin(user || searchParams.get('dmdInfoId') ? true : false);
|
||||
sessionStorage.setItem("user", searchParams.get("dmdInfoId") || "");
|
||||
setIsLogin(user || searchParams.get("dmdInfoId") ? true : false);
|
||||
}, [searchParams]);
|
||||
|
||||
useEffect(() => {
|
||||
const local = localStorage.getItem('user');
|
||||
const local = localStorage.getItem("user");
|
||||
if (local) {
|
||||
setIsLogin(true);
|
||||
}
|
||||
}, []);
|
||||
setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만)
|
||||
}, [setSubsInfo]);
|
||||
|
||||
const form = useForm<FormData>({
|
||||
const form = useForm<SdmInfoFormData>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues,
|
||||
mode: "onChange",
|
||||
mode: "onSubmit",
|
||||
});
|
||||
|
||||
useEffect(()=>{
|
||||
if(map.subsInfo.length>0){
|
||||
form.setValue('candidateTitle', map.subsInfo)
|
||||
}
|
||||
const subsInfo = useDmStore((state) => state.map.subsInfo);
|
||||
|
||||
},[map.subsInfo, form])
|
||||
useEffect(() => {
|
||||
//map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함
|
||||
if (subsInfo.length > 0) {
|
||||
form.setValue("candidateTitle", subsInfo);
|
||||
}
|
||||
}, [subsInfo, form]);
|
||||
|
||||
//후보지 팝업 값 셋팅
|
||||
useEffect(() => {
|
||||
const handleMessage = (event: MessageEvent) => {
|
||||
if (event.data?.type === "SET_SUBS_INFO") {
|
||||
setSubsInfo(event.data.payload); // zustand로 값 설정
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("message", handleMessage);
|
||||
return () => window.removeEventListener("message", handleMessage);
|
||||
}, [setSubsInfo]);
|
||||
|
||||
// 로그인 성공 시 모달 닫기 및 폼 업데이트
|
||||
useEffect(() => {
|
||||
if (successLogin) {
|
||||
setIsLogin(true);
|
||||
const user = sessionStorage.getItem('user');
|
||||
const user = sessionStorage.getItem("user");
|
||||
if (user) {
|
||||
try {
|
||||
const userData = JSON.parse(user);
|
||||
if (userData.dmdCoNm) {
|
||||
setFacilityName(userData.dmdCoNm);
|
||||
form.setValue('sdmNm', userData.dmdCoNm);
|
||||
form.setValue("sdmNm", userData.dmdCoNm);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error parsing user data:', error);
|
||||
console.error("Error parsing user data:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [successLogin, form]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Form state changed:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
|
||||
// 체크박스 상태가 변경될 때마다 money 필드의 에러를 초기화
|
||||
useEffect(() => {
|
||||
if (ismoneyDisabled) {
|
||||
form.clearErrors('money');
|
||||
form.setValue('money', '');
|
||||
form.clearErrors("money");
|
||||
form.setValue("money", "");
|
||||
}
|
||||
}, [ismoneyDisabled, form]);
|
||||
const router = useRouter();
|
||||
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
||||
const router = useRouter();
|
||||
const onSubmit: SubmitHandler<SdmInfoFormData> = async (data) => {
|
||||
try {
|
||||
// Transform form data to match API schema
|
||||
const apiData: DemandCompType = {
|
||||
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') || ''),
|
||||
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) || '',
|
||||
const dmSubsInfo = data.candidateTitle?.filter(
|
||||
(item) => item.ruseUtztnFcltNm && item.ruseUtztnFcltCd
|
||||
);
|
||||
// Transform form data to madata.candidateTitletch API schema
|
||||
const apiData: DemandCompBizType = {
|
||||
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") || ""),
|
||||
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(),
|
||||
dmndQty: Number(data.demandQnty) || '',
|
||||
grssClfg: Number(data.grssClfg) || '',
|
||||
tn: Number(data.tn) || '',
|
||||
combResdch: Number(data.combResdch) || '',
|
||||
tph: Number(data.tph) || '',
|
||||
trbt: Number(data.trbt) || '',
|
||||
ph: Number(data.ph) || '',
|
||||
blgcOxygDmndQnt: Number(data.bod) || '',
|
||||
clIonQnt: Number(data.clIonQnt) || '',
|
||||
smll: Number(data.smll) || '',
|
||||
cdtnv: Number(data.cdtnv) || '',
|
||||
crmty: Number(data.crmty) || '',
|
||||
rmrk: data.rmrk || '',
|
||||
dmndQty: Number(data.demandQnty) || "",
|
||||
grssClfg: data.grssClfg === null ? -1 : Number(data.grssClfg),
|
||||
tn: Number(data.tn) || null,
|
||||
combResdch: Number(data.combResdch) || null,
|
||||
tph: Number(data.tph) || null,
|
||||
trbt: Number(data.trbt) || null,
|
||||
ph: data.ph || "",
|
||||
blgcOxygDmndQnt: Number(data.bod) ||null,
|
||||
clIonQnt: Number(data.clIonQnt) || null,
|
||||
smll: data.smll || "",
|
||||
cdtnv: Number(data.cdtnv) ||null,
|
||||
crmty: Number(data.crmty) || null,
|
||||
rmrk: data.rmrk || "",
|
||||
bzmnNo: "",
|
||||
dmdAplyPswd: "",
|
||||
index: 0,
|
||||
reqDt: "",
|
||||
dmdInfoSn: 0,
|
||||
status: '',
|
||||
splyCndtList: data.candidateTitle || [],
|
||||
status: "",
|
||||
splyCndtList: dmSubsInfo || [],
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
await insertSdmInfoData(apiData);
|
||||
setTimeout(() => {
|
||||
router.push("/");
|
||||
}, 1000); // 0.8초 후 이동
|
||||
} catch (error) {
|
||||
console.error('Error submitting form:', error);
|
||||
console.error("Error submitting form:", error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -235,8 +232,10 @@ const router = useRouter();
|
||||
/>
|
||||
<div className="flex justify-center pt-4">
|
||||
<Button
|
||||
color="sky"
|
||||
size={"sm"}
|
||||
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>
|
||||
@@ -246,7 +245,7 @@ const router = useRouter();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!isLogin ?
|
||||
{!isLogin ? (
|
||||
<UiModal
|
||||
body={<SdmLogin />}
|
||||
bodyClass="sm:max-w-[90vw] w-[530px] h-[430px]"
|
||||
@@ -259,7 +258,7 @@ const router = useRouter();
|
||||
noHeaderYn="Y"
|
||||
noFooterYn="Y"
|
||||
/>
|
||||
: null}
|
||||
) : null}
|
||||
<Toaster position="top-center" />
|
||||
</div>
|
||||
);
|
||||
@@ -272,4 +271,3 @@ export default function MyForm() {
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { useDmStore } from "@/app/store";
|
||||
import type { DemandCompType } from "@/app/store/sdmMng";
|
||||
import SdmInsertForm from '@common/business_components/ui/sdmInsertForm';
|
||||
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useCallback, useEffect, useRef } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
@@ -44,14 +44,9 @@ export default function MyForm() {
|
||||
const handleInsertSdmData = useCallback((data: import('@common/business_components/ui/sdmInsertForm/form').DemandCompType) => {
|
||||
const convertedData: DemandCompType = {
|
||||
...data,
|
||||
dmdInfoSn: '',
|
||||
dmdInfoFk: '',
|
||||
status: '',
|
||||
};
|
||||
formDataRef.current = convertedData;
|
||||
insertSdmData(convertedData).catch(error => {
|
||||
console.error('Error inserting SDM data:', error);
|
||||
});
|
||||
insertSdmData(convertedData)
|
||||
}, [insertSdmData]);
|
||||
|
||||
return (
|
||||
@@ -69,4 +64,3 @@ export default function MyForm() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,14 +53,16 @@ export default function WrAboutPage() {
|
||||
}, observerOptions);
|
||||
|
||||
// 각 카드 요소를 관찰
|
||||
cardRefs.current.forEach((card) => {
|
||||
const cardsSnapshot = [...cardRefs.current];
|
||||
|
||||
cardsSnapshot.forEach((card) => {
|
||||
if (card) {
|
||||
observer.observe(card);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return () => {
|
||||
cardRefs.current.forEach((card) => {
|
||||
cardsSnapshot.forEach((card) => {
|
||||
if (card) {
|
||||
observer.unobserve(card);
|
||||
}
|
||||
@@ -129,7 +131,7 @@ export default function WrAboutPage() {
|
||||
물재이용 필요성
|
||||
</h2>
|
||||
<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">
|
||||
빗물, 중수, 하수처리수는 지속적으로 이용 가능한 순환자원입니다.<br />
|
||||
물 재이용을 통한 효율적인 수자원 활용은 물 스트레스국가인 우리나라에서<br />가뭄대응능력 향상 및 하천수질보전을 위해 반드시 필요한 일입니다.
|
||||
@@ -235,7 +237,7 @@ export default function WrAboutPage() {
|
||||
하수 재이용
|
||||
</h2>
|
||||
<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>
|
||||
<Image
|
||||
src="/img/wrAbout/img_05_1.png"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
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 {
|
||||
name: string;
|
||||
@@ -193,16 +193,16 @@ const WrStatusPage: React.FC = () => {
|
||||
};
|
||||
|
||||
const tableData: TableData[] = [
|
||||
{ region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123' },
|
||||
{ region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123(492)' },
|
||||
{ region: '서울특별시', sewage: '4(114,908)', rainwater: '816(430)', reclaimed: '371(341)', thermal: '0' },
|
||||
{ region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1' },
|
||||
{ region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2' },
|
||||
{ region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15' },
|
||||
{ region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15' },
|
||||
{ region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20' },
|
||||
{ region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30' },
|
||||
{ region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1(18)' },
|
||||
{ region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2(12)' },
|
||||
{ region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15(32)' },
|
||||
{ region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15(6)' },
|
||||
{ region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20(100)' },
|
||||
{ region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30(130)' },
|
||||
{ region: '세종특별자치시', sewage: '9(2,555)', rainwater: '65(16)', reclaimed: '0(0)', thermal: '0' },
|
||||
{ region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40' },
|
||||
{ region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40(143)' },
|
||||
{ region: '강원특별자치도', sewage: '69(19,677)', rainwater: '69(4)', reclaimed: '22(447)', thermal: '0' },
|
||||
{ region: '충청북도', sewage: '38(15,607)', rainwater: '17(91)', reclaimed: '91(2,211)', thermal: '0' },
|
||||
{ region: '충청남도', sewage: '67(41,368)', rainwater: '54(77)', reclaimed: '188(50,434)', thermal: '0' },
|
||||
@@ -213,7 +213,7 @@ const WrStatusPage: React.FC = () => {
|
||||
{ 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: 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] },
|
||||
@@ -231,7 +231,7 @@ const WrStatusPage: React.FC = () => {
|
||||
{ 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: 60, y: 750, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
];
|
||||
], []);
|
||||
|
||||
const handleMarkerClick = (regionId: string) => {
|
||||
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 radius = 26;
|
||||
const innerRadius = 18;
|
||||
@@ -334,7 +334,7 @@ const WrStatusPage: React.FC = () => {
|
||||
});
|
||||
|
||||
svg.appendChild(g);
|
||||
};
|
||||
}, [handleMarkerClick, regionIdMap]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadSVG = async () => {
|
||||
@@ -374,7 +374,7 @@ const WrStatusPage: React.FC = () => {
|
||||
};
|
||||
|
||||
loadSVG();
|
||||
}, []);
|
||||
}, [createDonutMarker, regionData]);
|
||||
|
||||
useEffect(() => {
|
||||
const svg = svgContainerRef.current?.querySelector('svg');
|
||||
@@ -493,10 +493,10 @@ const WrStatusPage: React.FC = () => {
|
||||
<tr>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">번호</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">시도</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">하수(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">빗물(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">중수도(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">하수(이용량,천𝓂³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">빗물(이용량,천𝓂³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">중수도(이용량,천𝓂³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천𝓂³/년)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
|
||||
@@ -1,42 +1,46 @@
|
||||
"use client";
|
||||
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import { useEffect, useRef, useState, useCallback } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { mapService } from "../service";
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
|
||||
import { useDmStore } from "@/app/store";
|
||||
import SelectedFcltList from "./selectedFcltList";
|
||||
import type { SubsInfo } from "@/app/store/map/type";
|
||||
|
||||
// export type SubsInfo={
|
||||
// ruseUtztnFcltNm: string; // 재이용시설명
|
||||
// ruseUtztnFcltCd: string; // 재이용시설 코드
|
||||
// }
|
||||
const Map = () => {
|
||||
|
||||
//수요처 저장하는 함수 setSubsInfo
|
||||
//setSubsInfo(subsInfo:SubsInfo[]):void
|
||||
const { map,setSubsInfo } = useDmStore(
|
||||
(state) => state
|
||||
);
|
||||
//저장된 수요처 리스트
|
||||
const { subsInfo } = map;
|
||||
|
||||
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
|
||||
const gisMaps = useRef<any | null>(null);
|
||||
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
|
||||
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
|
||||
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
|
||||
const [checkedLayers, setCheckedLayers] = useState<string[]>([]);
|
||||
const [checkedLayersData, setCheckedLayersData] = useState<any[]>([]);
|
||||
const [selectDataPk, setSelectDataPk] = useState<string>("");
|
||||
const [subs, setSubs] = useState<object[]>([]);
|
||||
|
||||
//적용 버튼 클릭 이벤트
|
||||
const [selectDataPk, setSelectDataPk] = useState<Record<string, any>>({});
|
||||
const [selectedFclts, setSelectedFclts] = useState<any[]>([]);
|
||||
|
||||
//적용 버튼 클릭 이벤트
|
||||
const onApply = () => {
|
||||
//setSubs([{'41110PB001R1':'수원제1,2 재이용1'},{'41110PB001R2':'수원제1,2 재이용2'}]);
|
||||
console.log(subs)
|
||||
if (selectedFclts.length > 3) {
|
||||
alert("재이용시설 후보지는 최대 3개까지만 선택할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const subsInfoList: SubsInfo[] = selectedFclts.map((fclt) => ({
|
||||
ruseUtztnFcltNm: fclt.ruseUtztnFcltNm,
|
||||
ruseUtztnFcltCd: fclt.pbnstRuseFcltId,
|
||||
}));
|
||||
|
||||
window.opener.postMessage(
|
||||
{
|
||||
type: "SET_SUBS_INFO",
|
||||
payload: subsInfoList, // 또는 필요한 데이터
|
||||
},
|
||||
"*"
|
||||
);
|
||||
|
||||
window.close();
|
||||
};
|
||||
|
||||
//트리 레이어 데이터 조회
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const response = await mapService.getLyrStngs();
|
||||
@@ -46,76 +50,167 @@ const Map = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 팝업 닫기 핸들러를 useCallback으로 메모이제이션
|
||||
const handlePopupClose = useCallback(() => {
|
||||
setIsOpen(false);
|
||||
setFeatureData(null);
|
||||
}, []);
|
||||
//하수처리시설코드로 재이용시설 목록 조회
|
||||
const reuseData = async (ruseFcltPk: any) => {
|
||||
try {
|
||||
const response = await mapService.getPbnstRuseFclts(ruseFcltPk);
|
||||
const data = response.data || [];
|
||||
setSelectedFclts((prev) => {
|
||||
const newItems = data.filter(
|
||||
(item: any) =>
|
||||
item &&
|
||||
Object.keys(item).length > 0 &&
|
||||
!prev.some((f) => f.pbnstRuseFcltId === item.pbnstRuseFcltId)
|
||||
);
|
||||
console.log(newItems)
|
||||
return [...prev, ...newItems];
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error("데이터 불러오기 실패:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 컴포넌트 마운트 시 1회 실행
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Selected Data Pk: ", selectDataPk);
|
||||
}, [selectDataPk]);
|
||||
// 레이어 생성 후 초기화 처리
|
||||
const onCheckedLayersChange = () => {
|
||||
//수요처 ID
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const dmdInfoId = urlParams.get("dmdInfoId");
|
||||
|
||||
// 체크된 레이어 정보를 받는 핸들러
|
||||
const handleCheckedLayersChange = (
|
||||
checkedIds: string[],
|
||||
checkedNodesData: any[]
|
||||
) => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
};
|
||||
|
||||
// SearchModal, GisContent 등에서 호출
|
||||
const onFeatureSelect = (data: any) => {
|
||||
const map = gisMaps.current;
|
||||
if (!map) {
|
||||
console.warn("지도가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 항상 같은 select 객체 사용
|
||||
const select = GisApp.Module.select as any;
|
||||
if (!select) return;
|
||||
|
||||
// 1. 기존 선택 초기화
|
||||
select.resetSelectedFeature();
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
//수요처 위치로 화면 이동
|
||||
const maps = gisMaps.current;
|
||||
const layer = GisApp.Module.layer as any;
|
||||
const layerNm = "tb_wr_ruse_fclt_dmd_co";
|
||||
const featureId = `${layerNm}.${dmdInfoId}`;
|
||||
let foundFeature: any = null;
|
||||
if (
|
||||
data &&
|
||||
typeof data.getGeometry === "function" &&
|
||||
typeof data.setStyle === "function"
|
||||
) {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
const featureId = data.fid || data.ftrIdn || data.id;
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
|
||||
maps
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
if (layer.get("lyrTyNm") == layerNm) {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
if (feature) {
|
||||
foundFeature = feature;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
|
||||
if (geometry) {
|
||||
const extent = geometry.getExtent();
|
||||
|
||||
if (geometry.getType() === "Point") {
|
||||
maps.getView().setCenter(geometry.getCoordinates());
|
||||
maps.getView().setZoom(11);
|
||||
} else {
|
||||
maps.getView().fit(extent, {
|
||||
duration: 300,
|
||||
padding: [30, 30, 30, 30],
|
||||
maxZoom: 16,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
layer.highLightFeature(
|
||||
[foundFeature],
|
||||
{
|
||||
id: GisApp.hlLayerId,
|
||||
zIndex: 10,
|
||||
opacity: 1,
|
||||
selectable: true,
|
||||
},
|
||||
{ width: 30 }
|
||||
);
|
||||
}
|
||||
|
||||
// 3. 피처 선택
|
||||
const formatNumber = (val: any) => {
|
||||
const num = Number(val);
|
||||
return isNaN(num) ? "-" : num.toLocaleString();
|
||||
};
|
||||
|
||||
// 재이용시설 오버레이
|
||||
maps
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
if (layer.get("lyrTyNm") === "tb_wr_bdst_ruse_fclt") {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatures) {
|
||||
const features = source.getFeatures();
|
||||
|
||||
features.forEach((feature: any) => {
|
||||
// 필요한 고유 ID 또는 속성 가져오기 (예: ftrIdn 또는 feature.getId())
|
||||
const featureId =
|
||||
feature.getId() || feature.get("ftrIdn") || Math.random();
|
||||
|
||||
// HTML 또는 React 오버레이 컴포넌트 구성
|
||||
const overlayContent = `
|
||||
<div class="rounded-md border border-gray-300 bg-white shadow-md text-sm w-[120px]">
|
||||
<!-- 헤더 -->
|
||||
<div class="bg-cyan-700 text-white px-3 py-2 text-[11px] font-semibold text-center rounded-t-md">
|
||||
${feature.get("swtrmt_fclt_nm") || "-"}
|
||||
</div>
|
||||
|
||||
<!-- 테이블 -->
|
||||
<table class="w-full text-sm text-gray-800 border-t border-gray-200">
|
||||
<tbody>
|
||||
<tr class="border-b border-gray-200">
|
||||
<th class="bg-gray-100 text-gray-600 font-semibold text-[10px] text-left">용량(m³/일)</th>
|
||||
<td class="text-right text-[10px] font-bold">${formatNumber(feature.get("fclt_cpct"))}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
feature.set("html", overlayContent);
|
||||
feature.set("overLayId", `overLay.${featureId}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 검색해서 재이용시설 선택하면 해당 시설로 화면 이동 처리
|
||||
useEffect(() => {
|
||||
if (!selectDataPk || Object.keys(selectDataPk).length === 0) return;
|
||||
const maps = gisMaps.current;
|
||||
let foundFeature: any = null;
|
||||
const layerNm = "tb_wr_bdst_ruse_fclt";
|
||||
const featureId = `${layerNm}.${selectDataPk.bscFctCd}`;
|
||||
maps
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
if (layer.get("lyrTyNm") == layerNm) {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) {
|
||||
foundFeature = feature;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
if (geometry) {
|
||||
const extent = geometry.getExtent();
|
||||
|
||||
map.getView().fit(extent, {
|
||||
maps.getView().fit(extent, {
|
||||
duration: 300,
|
||||
padding: [50, 50, 50, 50],
|
||||
maxZoom: 16,
|
||||
@@ -123,21 +218,23 @@ const Map = () => {
|
||||
nearest: true,
|
||||
});
|
||||
}
|
||||
select.selectFeature(foundFeature, true);
|
||||
} else {
|
||||
console.warn("OpenLayers Feature를 찾을 수 없습니다:", data);
|
||||
console.warn("OpenLayers Feature를 찾을 수 없습니다:", selectDataPk);
|
||||
}
|
||||
}, [selectDataPk]);
|
||||
|
||||
setFeatureData(data);
|
||||
setIsOpen(true);
|
||||
setIsSearchModalOpen(false);
|
||||
// 재이용시설 클릭 시 선택 시설목록에 추가
|
||||
const onFeatureSelect = (data: any) => {
|
||||
// 처리시설코드
|
||||
const swtrmtFcltCd = data.get("swtrmt_fclt_cd");
|
||||
reuseData(swtrmtFcltCd);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchBar
|
||||
setHasuPk={(hasuPk: string) => {
|
||||
if (hasuPk !== "") {
|
||||
setHasuPk={(hasuPk: any) => {
|
||||
if (hasuPk) {
|
||||
setSelectDataPk(hasuPk);
|
||||
}
|
||||
}}
|
||||
@@ -150,7 +247,7 @@ const Map = () => {
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={undefined}
|
||||
detailView={null}
|
||||
detailView={undefined}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
@@ -158,11 +255,14 @@ const Map = () => {
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={handleCheckedLayersChange}
|
||||
onCheckedLayersChange={onCheckedLayersChange}
|
||||
imgVisble={false}
|
||||
setData={setSubs}
|
||||
/>
|
||||
</div>
|
||||
<SelectedFcltList
|
||||
data={selectedFclts}
|
||||
onRemove={(updatedList) => setSelectedFclts(updatedList)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import { useEffect, useRef, useState, useCallback } from "react";
|
||||
import { mapService } from "../service";
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
|
||||
|
||||
const Map = () => {
|
||||
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
|
||||
const gisMaps = useRef<any | null>(null);
|
||||
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
|
||||
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
|
||||
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
|
||||
const [checkedLayers, setCheckedLayers] = useState<string[]>([]);
|
||||
const [checkedLayersData, setCheckedLayersData] = useState<any[]>([]);
|
||||
const [selectDataPk, setSelectDataPk] = useState<string>("");
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const response = await mapService.getLyrStngs();
|
||||
setTreeData(response); // API 응답 저장
|
||||
} catch (error) {
|
||||
console.error("데이터 불러오기 실패:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 팝업 닫기 핸들러를 useCallback으로 메모이제이션
|
||||
const handlePopupClose = useCallback(() => {
|
||||
setIsOpen(false);
|
||||
setFeatureData(null);
|
||||
}, []);
|
||||
|
||||
// 컴포넌트 마운트 시 1회 실행
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Selected Data Pk: ", selectDataPk);
|
||||
}, [selectDataPk]);
|
||||
|
||||
// 체크된 레이어 정보를 받는 핸들러
|
||||
const handleCheckedLayersChange = (
|
||||
checkedIds: string[],
|
||||
checkedNodesData: any[]
|
||||
) => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
};
|
||||
|
||||
// SearchModal, GisContent 등에서 호출
|
||||
const onFeatureSelect = (data: any) => {
|
||||
const map = gisMaps.current;
|
||||
if (!map) {
|
||||
console.warn("지도가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 항상 같은 select 객체 사용
|
||||
const select = GisApp.Module.select as any;
|
||||
if (!select) return;
|
||||
|
||||
// 1. 기존 선택 초기화
|
||||
select.resetSelectedFeature();
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
let foundFeature: any = null;
|
||||
if (
|
||||
data &&
|
||||
typeof data.getGeometry === "function" &&
|
||||
typeof data.setStyle === "function"
|
||||
) {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
const featureId = data.fid || data.ftrIdn || data.id;
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 3. 피처 선택
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
if (geometry) {
|
||||
const extent = geometry.getExtent();
|
||||
|
||||
map.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);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchBar
|
||||
setHasuPk={(hasuPk: string) => {
|
||||
if (hasuPk !== "") {
|
||||
setSelectDataPk(hasuPk);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<div className="bg-container">
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={false}
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={undefined}
|
||||
detailView={null}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={handleCheckedLayersChange}
|
||||
imgVisble={false}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Map;
|
||||
@@ -0,0 +1,81 @@
|
||||
import React from "react";
|
||||
|
||||
type FcltItem = {
|
||||
pbnstRuseFcltId: string;
|
||||
ruseUtztnFcltNm: string;
|
||||
splyExtraCpct?: number;
|
||||
ruseCpct?: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export default function SelectedFcltList({
|
||||
data = [],
|
||||
onRemove,
|
||||
}: {
|
||||
data: FcltItem[];
|
||||
onRemove: (updatedList: FcltItem[]) => void;
|
||||
}) {
|
||||
const handleDelete = (code: string) => {
|
||||
const updatedList = data.filter((item) => item.pbnstRuseFcltId !== code);
|
||||
onRemove(updatedList);
|
||||
};
|
||||
|
||||
const TableContent = (
|
||||
<>
|
||||
<thead className="bg-gray-100 text-gray-700 text-[13px]">
|
||||
<tr>
|
||||
<th className="px-3 py-2 text-left border-b">시설명</th>
|
||||
<th className="px-3 py-2 text-right border-b">
|
||||
하수처리량
|
||||
<br />
|
||||
(㎥/일)
|
||||
</th>
|
||||
<th className="px-3 py-2 text-right border-b">
|
||||
재이용량
|
||||
<br />
|
||||
(㎥/일)
|
||||
</th>
|
||||
<th className="px-3 py-2 border-b">삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{data.map((item) => (
|
||||
<tr key={item.pbnstRuseFcltId} className="border-b last:border-none">
|
||||
<td className="px-3 py-2 text-[12px]">{item.ruseUtztnFcltNm}</td>
|
||||
<td className="px-3 py-2 text-right text-[12px]">
|
||||
{Number(item.splyExtraCpct || 0).toLocaleString()}
|
||||
</td>
|
||||
<td className="px-3 py-2 text-right text-[12px]">
|
||||
{Number(item.ruseCpct || 0).toLocaleString()}
|
||||
</td>
|
||||
<td className="px-3 py-2 text-center">
|
||||
<button
|
||||
onClick={() => handleDelete(item.pbnstRuseFcltId)}
|
||||
className="text-red-500 hover:text-red-700 text-sm font-bold"
|
||||
aria-label="삭제"
|
||||
title="삭제"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</>
|
||||
);
|
||||
|
||||
if (data.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed right-40 top-[8rem] w-[40rem] max-h-[130rem] overflow-auto bg-white shadow-lg rounded p-4 border border-gray-300 z-50">
|
||||
<h3 className="bg-cyan-700 text-white text-xl font-bold mb-2 p-2">
|
||||
선택된 시설
|
||||
</h3>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-sm text-gray-800 border border-gray-200">
|
||||
{TableContent}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
// 현재 문서의 스타일(CSS)을 새 창으로 복사하는 함수
|
||||
const copyStyles = (sourceDoc: Document, targetDoc: Document) => {
|
||||
Array.from(sourceDoc.styleSheets).forEach(styleSheet => {
|
||||
try {
|
||||
if (styleSheet.cssRules) { // <style> 태그로 주입된 CSS
|
||||
const newStyleEl = sourceDoc.createElement('style');
|
||||
Array.from(styleSheet.cssRules).forEach(cssRule => {
|
||||
newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText));
|
||||
});
|
||||
targetDoc.head.appendChild(newStyleEl);
|
||||
} else if (styleSheet.href) { // <link> 태그로 연결된 CSS 파일
|
||||
const newLinkEl = sourceDoc.createElement('link');
|
||||
newLinkEl.rel = 'stylesheet';
|
||||
newLinkEl.href = styleSheet.href;
|
||||
targetDoc.head.appendChild(newLinkEl);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('스타일시트를 복사할 수 없습니다:', e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
interface NewWindowPortalProps {
|
||||
children: React.ReactNode;
|
||||
onClose: () => void;
|
||||
title?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
resizable?: string;
|
||||
scrollbars?: string;
|
||||
}
|
||||
|
||||
const NewWindowPortal: React.FC<NewWindowPortalProps> = ({ children, onClose, title = "" , width = 900, height = 800, resizable = "yes", scrollbars= "yes" }) => {
|
||||
const [container, setContainer] = useState<HTMLElement | null>(null);
|
||||
const newWindowRef = useRef<Window | null>(null);
|
||||
const onCloseRef = useRef(onClose);
|
||||
|
||||
// onClose 함수를 ref로 저장하여 의존성 문제 해결
|
||||
useEffect(() => {
|
||||
onCloseRef.current = onClose;
|
||||
}, [onClose]);
|
||||
|
||||
const handleUnload = useCallback(() => {
|
||||
onCloseRef.current();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// 이미 창이 열려있으면 새로 열지 않음
|
||||
if (newWindowRef.current && !newWindowRef.current.closed) return;
|
||||
|
||||
// 1. 새 창을 열고 참조를 저장합니다.
|
||||
const popupOptions = `width=${width},height=${height},resizable=${resizable},scrollbars=${scrollbars}`;
|
||||
newWindowRef.current = window.open('', title, popupOptions);
|
||||
|
||||
if (newWindowRef.current) {
|
||||
newWindowRef.current.document.title = title;
|
||||
|
||||
// 2. React 컴포넌트를 마운트할 컨테이너 div를 생성하여 새 창의 body에 추가합니다.
|
||||
const div = newWindowRef.current.document.createElement('div');
|
||||
newWindowRef.current.document.body.appendChild(div);
|
||||
setContainer(div);
|
||||
|
||||
// 3. 메인 창의 스타일을 새 창으로 복사합니다. (매우 중요)
|
||||
copyStyles(document, newWindowRef.current.document);
|
||||
|
||||
// 4. 사용자가 창을 닫을 때 부모에게 알리기 위한 이벤트 리스너를 설정합니다.
|
||||
// const handleUnload = () => {
|
||||
// onClose();
|
||||
// };
|
||||
newWindowRef.current.addEventListener('unload', handleUnload);
|
||||
|
||||
// 5. 컴포넌트가 사라질 때 창을 닫는 클린업 함수를 반환합니다.
|
||||
return () => {
|
||||
if (newWindowRef.current) {
|
||||
newWindowRef.current.removeEventListener('unload', handleUnload);
|
||||
if (!newWindowRef.current.closed) {
|
||||
newWindowRef.current.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
alert('팝업이 차단되었습니다. 팝업 차단을 해제하고 다시 시도해주세요.');
|
||||
onCloseRef.current();
|
||||
}
|
||||
}, []);
|
||||
|
||||
// `createPortal`을 사용해 children을 새 창의 container div에 렌더링합니다.
|
||||
return container ? createPortal(children, container) : null;
|
||||
};
|
||||
|
||||
export default NewWindowPortal;
|
||||
@@ -3,6 +3,7 @@
|
||||
* 관망도 API
|
||||
*/
|
||||
const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map`
|
||||
const REUSE_API_URL = `${process.env.NEXT_PUBLIC_REUSE_API_URL}`
|
||||
|
||||
export type LyrStngProps = {
|
||||
lyr_sn: string
|
||||
@@ -41,6 +42,20 @@ export const mapService = {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
},
|
||||
getPbnstRuseFclts: async (ruseFcltPk:any) => {
|
||||
const response = await fetch(`${REUSE_API_URL}/reuseFc/pubFc/${ruseFcltPk}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ export default function RootLayout({
|
||||
}>) {
|
||||
return (
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<title>물재이용 대민</title>
|
||||
</head>
|
||||
<body>
|
||||
{children}
|
||||
</body>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import path from "path";
|
||||
|
||||
const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
||||
const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
||||
const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL || "";
|
||||
const SERVER_API_URL = process.env.NEXT_PUBLIC_DM_SERVER_API_URL || "";
|
||||
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
|
||||
const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
|
||||
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
|
||||
|
||||
@@ -16,7 +16,6 @@ const getRuseFclt = async (
|
||||
|
||||
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/5/A/${sggOrCity ? sggOrCity : "0"}/0/1/SW`;
|
||||
|
||||
console.log(" checkWrRegListRes ", checkWrRegListRes);
|
||||
const ruseList = checkWrRegListRes.data.filter((item: string) => item !== "");
|
||||
|
||||
if (searchTxt) {
|
||||
|
||||
@@ -2,12 +2,108 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { TableUpperProps } from "../common";
|
||||
import toast from "react-hot-toast";
|
||||
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||
import { z } from "zod";
|
||||
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
=====================================*/
|
||||
|
||||
export const sdmInfoFormSchema = z.object({
|
||||
sdmNm: z.string().min(1, "수요처를 선택해주세요"),
|
||||
demandYmd: z.date().optional(),
|
||||
demandQnty: z
|
||||
.string()
|
||||
.min(1, "요구수량을 입력해주세요")
|
||||
.regex(/^[0-9]+$/, "요구수량은 숫자만 입력 가능합니다"),
|
||||
usePurpose: z.string().optional(),
|
||||
money: z.string().regex(/^[0-9]+$/, "희망단가는 숫자만 입력 가능합니다"),
|
||||
/**요구수질 */
|
||||
reqWaterQlty: z.string().optional(),
|
||||
grssClfg: z.number().nullish(),
|
||||
tn: z.number().nullish(),
|
||||
combResdch: z.number().nullish(),
|
||||
tph: z.number().nullish(),
|
||||
trbt: z.number().nullish(),
|
||||
ph: z.string().nullish(),
|
||||
bod: z.number().nullish(),
|
||||
/**컬럼확인필요 */
|
||||
clIonQnt: z.number().nullish(),
|
||||
smll: z.string(),
|
||||
cdtnv: z.number().nullish(),
|
||||
crmty: z.number().nullish(),
|
||||
rmrk: z.string().optional(),
|
||||
/* telno: z.string()
|
||||
.min(8, "전화번호는 8자 이상 입력해주세요")
|
||||
.max(12, "전화번호는 12자 이내로 입력해주세요")
|
||||
.regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), */
|
||||
candidateTitle: z
|
||||
.array(
|
||||
z.object({
|
||||
ruseUtztnFcltNm: z.string(),
|
||||
ruseUtztnFcltCd: z.string(),
|
||||
})
|
||||
)
|
||||
.optional(),
|
||||
}).superRefine((data, ctx) => {
|
||||
const disabledFields = disableRules[data.usePurpose ?? ""] || [];
|
||||
// 모든 수질 관련 필드
|
||||
// 총대장균군수는 null 값을 불검출로 표시하기때문에 해당 검사에서 제외함.
|
||||
const allFields: (keyof typeof data)[] = [
|
||||
"tn", "combResdch", "tph",
|
||||
"trbt", "ph", "bod", "clIonQnt",
|
||||
"smll", "cdtnv", "crmty",
|
||||
];
|
||||
|
||||
const allFieldsName: Record<string, string> = {
|
||||
tn: "총질소(T-N)(mg/L)",
|
||||
combResdch: "결합잔류염소(mg/L)",
|
||||
tph: "총인(T-P)(mg/L)",
|
||||
trbt: "탁도(NTU)",
|
||||
ph: "수소이온농도(pH)",
|
||||
bod: "생물학적 산소요구량(BOD)(mg/L)",
|
||||
clIonQnt: "염화물(mgCL/L)",
|
||||
smll: "냄새",
|
||||
cdtnv: "전기전도도(㎲/cm)",
|
||||
crmty: "색도(도)",
|
||||
};
|
||||
allFields.forEach((field) => {
|
||||
const isDisabled = disabledFields.includes(field);
|
||||
if (!isDisabled) {
|
||||
// disabled가 아닌 필드는 반드시 값이 있어야 함
|
||||
const value = data[field];
|
||||
if (typeof value === "string") {
|
||||
if (value.trim().length === 0) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
path: [field],
|
||||
message: `${allFieldsName[field]} 을 입력해주세요.`,
|
||||
});
|
||||
}
|
||||
} else if (typeof value === "number") {
|
||||
if (value <= 0 || Number.isNaN(value)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
path: [field],
|
||||
message: `${allFieldsName[field]} 을 입력해주세요.`,
|
||||
});
|
||||
}
|
||||
} else if (value == null) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
path: [field],
|
||||
message: `${allFieldsName[field]} 을 입력해주세요.`,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export type SdmInfoFormData = z.infer<typeof sdmInfoFormSchema>;
|
||||
|
||||
|
||||
// 수요처 정보
|
||||
export type DemandCompType = {
|
||||
export type DemandCompBizType = {
|
||||
index : number | '';
|
||||
dmdInfoId : string | '';
|
||||
dmdInfoFk : string | '';
|
||||
@@ -23,22 +119,23 @@ export type DemandCompType = {
|
||||
wntUntprc : number | '';
|
||||
dmndTmng : Date | '';
|
||||
dmndQty : number | '';
|
||||
grssClfg : number | '';
|
||||
tn : number | '';
|
||||
combResdch : number | '';
|
||||
tph : number | '';
|
||||
trbt : number | '';
|
||||
ph : number | '';
|
||||
blgcOxygDmndQnt : number | '';
|
||||
clIonQnt : number | '';
|
||||
smll : number | '';
|
||||
cdtnv : number | '';
|
||||
crmty : number | '';
|
||||
grssClfg : number | null //총대장균군수
|
||||
tn : number | null //총질소
|
||||
combResdch : number | null //결합잔류염소
|
||||
tph : number | null //총인
|
||||
trbt : number | null //탁도
|
||||
ph : string | ''; //수소이온농
|
||||
blgcOxygDmndQnt : number | null //생물학적산소요구량
|
||||
clIonQnt : number | null //염화물
|
||||
smll : string | ''; //냄새
|
||||
cdtnv : number | null; //전기전도도
|
||||
crmty : number | null //색도
|
||||
rmrk : string | '';
|
||||
reqDt : string | '';
|
||||
dmdInfoSn : number | '';
|
||||
status : string | '';
|
||||
splyCndtList:SupplyCandidate[]|[],
|
||||
ruseUtztnFcltNm?:string|''
|
||||
|
||||
}
|
||||
|
||||
@@ -152,7 +249,8 @@ export type MoneyDetailType = {
|
||||
clclnBrdnCst : string | '';
|
||||
clclnEcqrRt : string | '';
|
||||
}
|
||||
|
||||
// 규칙 타입 선언
|
||||
export type DisableRulesType = Record<string, string[]>;
|
||||
/**====================================
|
||||
* Store - 데이터
|
||||
====================================*/
|
||||
@@ -160,6 +258,139 @@ export type MoneyDetailType = {
|
||||
const demandCompList : DemandCompType[] = [
|
||||
]
|
||||
|
||||
|
||||
const disableRules: DisableRulesType = {
|
||||
"청소": ["tn", 'tph',"clIonQnt" ,'cdtnv'],
|
||||
"화장실용수": ["tn", 'tph',"clIonQnt" ,'cdtnv'],
|
||||
"세척": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'],
|
||||
"살수": ["combResdch", "crmty",'tph','tn',"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",
|
||||
smll:'불쾌하지않을것',
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
|
||||
},
|
||||
"화장실용수": {
|
||||
grssClfg: null,
|
||||
combResdch:0.2,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
crmty: 20,
|
||||
smll:'불쾌하지않을것',
|
||||
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,
|
||||
smll:'불쾌하지않을것',
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"살수": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
smll:'불쾌하지않을것',
|
||||
combResdch:null,
|
||||
crmty:null,
|
||||
tn:null,
|
||||
tph: null,
|
||||
clIonQnt: null,
|
||||
cdtnv: null,
|
||||
},
|
||||
"조경": {
|
||||
grssClfg: null,
|
||||
trbt: 2,
|
||||
bod: 5,
|
||||
ph: "5.8~8.5",
|
||||
smll:'불쾌하지않을것',
|
||||
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,
|
||||
smll:'불쾌하지않을것',
|
||||
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,
|
||||
smll:'불쾌하지않을것',
|
||||
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,
|
||||
smll:'불쾌하지않을것',
|
||||
trbt:null,
|
||||
crmty:null,
|
||||
clIonQnt: null,
|
||||
cdtnv:null
|
||||
}
|
||||
};
|
||||
|
||||
// 사용용도
|
||||
const useTypesData : SelectDataType[] = [
|
||||
{ text: '청소', val: "청소" },
|
||||
@@ -167,9 +398,9 @@ const useTypesData : SelectDataType[] = [
|
||||
{ text: "세척", val: "세척" },
|
||||
{ text: "살수", val: "살수" },
|
||||
{ text: "조경", val: "조경" },
|
||||
{ text: "농업", val: "농업" },
|
||||
{ text: "농업_간접용수", val: "농업_간접용수" },
|
||||
{ text: "농업_직접용수", val: "농업_직접용수" },
|
||||
{ text: "하천", val: "하천" },
|
||||
{ text: "지하수", val: "지하수" },
|
||||
{ text: "공업", val: "공업" },
|
||||
];
|
||||
|
||||
@@ -280,7 +511,7 @@ const postSdmData = async (data: DemandCompType) => {
|
||||
}
|
||||
|
||||
// 수요정보 등록
|
||||
const postSdmInfoData = async (data: DemandCompType) => {
|
||||
const postSdmInfoData = async (data: DemandCompBizType) => {
|
||||
try {
|
||||
await postFetch("/reuseFc/request/demandInfo", data);
|
||||
toast.success('수요 정보 등록에 성공하였습니다.');
|
||||
@@ -360,7 +591,7 @@ const fetchGetSimilarCaseList = async (part: string, value: number|string) => {
|
||||
export type SdmActions = {
|
||||
initializeSdmData: () => void;
|
||||
insertSdmData: (data: DemandCompType) => Promise<void>;
|
||||
insertSdmInfoData: (data: DemandCompType) => Promise<void>;
|
||||
insertSdmInfoData: (data: DemandCompBizType) => Promise<void>;
|
||||
getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>;
|
||||
actionLogin: (data: DemandCompType) => Promise<void>;
|
||||
getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>;
|
||||
@@ -378,9 +609,10 @@ export type SdmType ={
|
||||
moneyDetailList: MoneyDetailType[];
|
||||
|
||||
// 수요정보 신청현황
|
||||
sdmInfoStatusList: DemandCompType[];
|
||||
sdmInfoStatusList: DemandCompBizType[];
|
||||
upHeadSdmInfoStatus: TableUpperProps[];
|
||||
|
||||
defaultRules: Record<string, object>
|
||||
disableRules: DisableRulesType;
|
||||
// 로그인관련
|
||||
successNextPage : boolean;
|
||||
successLogin: boolean;
|
||||
@@ -398,7 +630,10 @@ export const SdmState: SdmType = {
|
||||
moneyDetailList: moneyDetailList,
|
||||
// 수요정보 신청현황
|
||||
sdmInfoStatusList: [],
|
||||
defaultRules:defaultRules,
|
||||
disableRules:disableRules,
|
||||
upHeadSdmInfoStatus: upHeadSdmInfoStatus,
|
||||
|
||||
// 로그인관련
|
||||
successNextPage : false,
|
||||
successLogin: false,
|
||||
@@ -428,7 +663,7 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
}
|
||||
},
|
||||
|
||||
insertSdmInfoData: async (data: DemandCompType) => {
|
||||
insertSdmInfoData: async (data: DemandCompBizType) => {
|
||||
postSdmInfoData(data);
|
||||
},
|
||||
|
||||
@@ -465,11 +700,13 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
}))
|
||||
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 status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청';
|
||||
const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : '';
|
||||
|
||||
|
||||
const tmpData = {
|
||||
...el,
|
||||
@@ -485,7 +722,9 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
useUsgCd: el.useUsgCd,
|
||||
dmndTmng: el.dmndTmng,
|
||||
dmdInfoSn : el.dmdInfoSn,
|
||||
status : status
|
||||
status : status,
|
||||
splyCndtList: el.splyCndtList,
|
||||
ruseUtztnFcltNm: ruseUtztnFcltNm || ''
|
||||
}
|
||||
sdmInfoStatusList.push(tmpData);
|
||||
})
|
||||
|
||||
@@ -13,8 +13,10 @@ export const StoreZus = (initState: DmState= {
|
||||
...dmMapState,
|
||||
}) => {
|
||||
return createStore<DmStore>()((set) => {
|
||||
tokenManager.setToken("site-id-key", 'DM');
|
||||
tokenManager.setToken("site-theme-key", 'green');
|
||||
if (typeof window !== "undefined") {
|
||||
tokenManager.setToken("site-id-key", 'DM');
|
||||
tokenManager.setToken("site-theme-key", 'green');
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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';
|
||||
|
||||
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, "");
|
||||
};
|
||||
@@ -1,53 +1,76 @@
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
type SearchType = {
|
||||
searchNm: string;
|
||||
searchPk: string;
|
||||
bscFctNm: string;
|
||||
bscFctCd: string;
|
||||
};
|
||||
|
||||
type thisProps = {
|
||||
label: string | undefined;
|
||||
initValue: string | undefined;
|
||||
setValue: (searchNm?: string) => void;
|
||||
setRtnData: (rtnData: any) => void;
|
||||
searchList?: any[];
|
||||
searchList?: SearchType[];
|
||||
};
|
||||
|
||||
export default function SearchInputText({
|
||||
label = undefined,
|
||||
initValue = undefined,
|
||||
setValue = () => {},
|
||||
setRtnData = () => {},
|
||||
searchList = undefined,
|
||||
searchList = [],
|
||||
}: thisProps) {
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [textValue, setTextValue] = useState(initValue || "");
|
||||
const [highlightIndex, setHighlightIndex] = useState<number>(-1);
|
||||
|
||||
const wrapperRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const handleInputChange = useCallback(
|
||||
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const value = e.target.value;
|
||||
|
||||
setTextValue(value);
|
||||
setValue(value);
|
||||
if (value && value!=='') {
|
||||
setIsOpen(true);
|
||||
} else {
|
||||
setIsOpen(false);
|
||||
}
|
||||
setHighlightIndex(-1);
|
||||
setIsOpen(value !== "");
|
||||
},
|
||||
[setValue]
|
||||
);
|
||||
|
||||
const handleSuggestionClick = useCallback(
|
||||
(searchNm: string) => {
|
||||
// Do not update textValue to keep input unchanged on suggestion click
|
||||
setValue(searchNm);
|
||||
setTextValue(searchNm);
|
||||
setIsOpen(false);
|
||||
setRtnData(searchList?.find((item) => item.searchNm === searchNm) || {});
|
||||
setRtnData(searchList?.find((item) => item.bscFctNm === searchNm) || {});
|
||||
},
|
||||
[searchList, setRtnData, setValue]
|
||||
);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (!isOpen || searchList.length === 0) return;
|
||||
|
||||
if (e.key === "ArrowDown") {
|
||||
e.preventDefault();
|
||||
setHighlightIndex((prev) => (prev + 1) % searchList.length);
|
||||
} else if (e.key === "ArrowUp") {
|
||||
e.preventDefault();
|
||||
setHighlightIndex((prev) =>
|
||||
prev <= 0 ? searchList.length - 1 : prev - 1
|
||||
);
|
||||
} else if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
if (searchList.length === 1 && searchList[0]) {
|
||||
handleSuggestionClick(searchList[0].bscFctNm);
|
||||
} else if (highlightIndex >= 0 && highlightIndex < searchList.length && searchList[highlightIndex]) {
|
||||
handleSuggestionClick(searchList[highlightIndex].bscFctNm);
|
||||
}
|
||||
}
|
||||
},
|
||||
[highlightIndex, isOpen, searchList, handleSuggestionClick]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (
|
||||
@@ -68,31 +91,39 @@ export default function SearchInputText({
|
||||
<div ref={wrapperRef} className="relative">
|
||||
<input
|
||||
type="text"
|
||||
value={textValue ||''}
|
||||
value={textValue || ""}
|
||||
onChange={handleInputChange}
|
||||
/* onFocus={() => setIsOpen(true)} */
|
||||
onKeyDown={handleKeyDown}
|
||||
className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder={`${label}을(를) 입력하세요`}
|
||||
onClick={() => {
|
||||
setTextValue("");
|
||||
setValue("");
|
||||
setIsOpen(false);
|
||||
}}
|
||||
/>
|
||||
{isOpen && (
|
||||
<div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||
<div className="max-h-72">
|
||||
{searchList && searchList.length > 0 ? (
|
||||
searchList.map((item: SearchType, index: number) => (
|
||||
{searchList.length > 0 ? (
|
||||
searchList.map((item, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl hover:bg-gray-100"
|
||||
onClick={() => handleSuggestionClick(item.searchNm)}
|
||||
className={`w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl ${
|
||||
highlightIndex === index
|
||||
? "bg-blue-100"
|
||||
: "hover:bg-gray-100"
|
||||
}`}
|
||||
onClick={() => handleSuggestionClick(item.bscFctNm)}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
handleSuggestionClick(item.searchNm);
|
||||
handleSuggestionClick(item.bscFctNm);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{item.searchPk?.substring(0, 10)}
|
||||
<span className="float-right">{item.searchNm}</span>
|
||||
<span className="float-left">{item.bscFctNm}</span>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useDmStore } from "@/app/store";
|
||||
import {
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SelectBox,
|
||||
type SelectDataType,
|
||||
} from "@common/business_components/ui";
|
||||
@@ -13,9 +12,9 @@ import SearchInputText from "../SearchInputText/SearchInputText";
|
||||
|
||||
export function SearchBar({
|
||||
setHasuPk,
|
||||
onApply
|
||||
onApply,
|
||||
}: {
|
||||
setHasuPk: (hasuPk: string) => void;
|
||||
setHasuPk: (hasuPk: any) => void;
|
||||
onApply: () => void;
|
||||
}) {
|
||||
const { map, Common, initializeCommonData, findRuseFclt } = useDmStore(
|
||||
@@ -26,6 +25,7 @@ export function SearchBar({
|
||||
const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([
|
||||
{ text: "전체", val: "0" },
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
initializeCommonData();
|
||||
}, [initializeCommonData]);
|
||||
@@ -62,9 +62,9 @@ export function SearchBar({
|
||||
[initializeSigunData]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("map.ruseFcltList ", map.ruseFcltList);
|
||||
}, [map.ruseFcltList]);
|
||||
// useEffect(() => {
|
||||
// console.log("map.ruseFcltList ", map.ruseFcltList);
|
||||
// }, [map.ruseFcltList]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -112,25 +112,19 @@ export function SearchBar({
|
||||
}
|
||||
}}
|
||||
setRtnData={(rtnData: any) => {
|
||||
setHasuPk(rtnData.bscFctCd || "");
|
||||
setHasuPk(rtnData);
|
||||
}}
|
||||
searchList={map.ruseFcltList || []}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button
|
||||
color="red"
|
||||
className="mx-2 mt-2"
|
||||
size={"sm"}
|
||||
onClick={() => {}}
|
||||
>
|
||||
후보지선택
|
||||
</Button>
|
||||
<Button
|
||||
color="sky"
|
||||
className="mt-2"
|
||||
size={"sm"}
|
||||
onClick={() => {onApply();}}
|
||||
onClick={() => {
|
||||
onApply();
|
||||
}}
|
||||
>
|
||||
적용
|
||||
</Button>
|
||||
|
||||
@@ -1,33 +1,34 @@
|
||||
import { FormUi } from "@common/business_components/ui";
|
||||
import type { ReactNode } from "react";
|
||||
import type { ControllerRenderProps, FieldError, FieldValues, Path } from "react-hook-form";
|
||||
|
||||
|
||||
import { cloneElement, isValidElement } from "react";
|
||||
interface AccessibleFormFieldProps<T extends FieldValues> {
|
||||
field: ControllerRenderProps<T, Path<T>>;
|
||||
label: string;
|
||||
required?: boolean;
|
||||
error?: FieldError;
|
||||
inputComponent: ReactNode;
|
||||
isDisabled?: boolean;
|
||||
inputComponent: React.ReactElement<{ disabled?: boolean }>;
|
||||
}
|
||||
|
||||
export function AccessibleFormField<T extends FieldValues>({
|
||||
label,
|
||||
required = false,
|
||||
error,
|
||||
inputComponent,
|
||||
isDisabled = false,
|
||||
}: AccessibleFormFieldProps<T>) {
|
||||
const labelText = required ? `${label} *` : label;
|
||||
|
||||
return (
|
||||
<FormUi label={labelText}>
|
||||
<FormUi label={labelText} isDisabled={isDisabled}>
|
||||
<div>
|
||||
{inputComponent}
|
||||
{error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (
|
||||
{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) => (
|
||||
<p key={idx} className="text-red-500 text-sm mt-1" role="alert">
|
||||
{msg}
|
||||
</p>
|
||||
))}
|
||||
))} */}
|
||||
</div>
|
||||
</FormUi>
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
import { useDmStore } from "@/app/store";
|
||||
import type { DemandCompType } from "@/app/store/sdmMng";
|
||||
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 { zodResolver } from "@hookform/resolvers/zod";
|
||||
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 toast from "react-hot-toast";
|
||||
import * as z from "zod";
|
||||
|
||||
export function SdmLoginForm() {
|
||||
@@ -15,10 +16,10 @@ export function SdmLoginForm() {
|
||||
const formatBusinessNumber = (value: string) => {
|
||||
// 숫자만 추출
|
||||
const digitsOnly = value.replace(/\D/g, "");
|
||||
|
||||
|
||||
// 10자리까지만 처리
|
||||
const limitedDigits = digitsOnly.slice(0, 10);
|
||||
|
||||
|
||||
// 3-2-5 형식으로 포맷팅
|
||||
if (limitedDigits.length <= 3) {
|
||||
return limitedDigits;
|
||||
@@ -28,33 +29,33 @@ export function SdmLoginForm() {
|
||||
return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3, 5)}-${limitedDigits.slice(5)}`;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 스키마를 useMemo로 최적화
|
||||
const sdmLoginFormSchema = useMemo(() => z.object({
|
||||
dmdInfoId: z.string()
|
||||
.min(1, "사업자등록번호를 입력해주세요")
|
||||
.regex(/^\d{10}$/, "사업자등록번호는 10자리 숫자만 입력 가능합니다"),
|
||||
bznmTotNo: isBznmTotNoDisabled
|
||||
bznmTotNo: isBznmTotNoDisabled
|
||||
? z.string().optional()
|
||||
: z.string().length(4, "종사업자등록번호는 4자리 숫자만 입력 가능합니다"),
|
||||
password: z.string()
|
||||
.min(1, "비밀번호를 입력해주세요")
|
||||
.min(8, "비밀번호는 8자 이상 입력해주세요")
|
||||
.min(8, "비밀번호는 8자 이상 입력해주세요")
|
||||
.max(16, "비밀번호는 16자 이내로 입력해주세요"),
|
||||
rgtr: z.string().optional(),
|
||||
dmdAplyPswd: z.string().optional(),
|
||||
}), [isBznmTotNoDisabled]);
|
||||
|
||||
type FormData = z.infer<typeof sdmLoginFormSchema>;
|
||||
type FieldComponent = (field: ControllerRenderProps<FormData, keyof FormData>) => JSX.Element;
|
||||
|
||||
type SdmLoginForm = z.infer<typeof sdmLoginFormSchema>;
|
||||
type FieldComponent = (field: ControllerRenderProps<SdmLoginForm, keyof SdmLoginForm>) => JSX.Element;
|
||||
|
||||
const formSchema = sdmLoginFormSchema;
|
||||
|
||||
useEffect(() => {
|
||||
initializeCommonData();
|
||||
}, [initializeCommonData]);
|
||||
|
||||
const defaultValues: FormData = {
|
||||
const defaultValues: SdmLoginForm = {
|
||||
dmdInfoId: '',
|
||||
bznmTotNo: '',
|
||||
password: '',
|
||||
@@ -62,7 +63,7 @@ export function SdmLoginForm() {
|
||||
dmdAplyPswd: '',
|
||||
};
|
||||
|
||||
const form = useForm<FormData>({
|
||||
const form = useForm<SdmLoginForm>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues,
|
||||
mode: "onChange",
|
||||
@@ -72,6 +73,23 @@ export function SdmLoginForm() {
|
||||
setIsBznmTotNoDisabled(checked);
|
||||
};
|
||||
|
||||
const initPassword = () => {
|
||||
toast(
|
||||
() => (
|
||||
<div className="flex flex-col items-center">
|
||||
<div className="text-2xl mb-2">
|
||||
관리자(031-0000-0000)에게 비밀번호 초기화 요청을 유선으로 하시기 바랍니다.
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
id: "pwd-reset",
|
||||
duration: 5000,
|
||||
position: "top-center",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const handleLogin = () => {
|
||||
const data = form.getValues();
|
||||
const passwordStr = sha512.hex(data.password)
|
||||
@@ -82,61 +100,61 @@ export function SdmLoginForm() {
|
||||
}
|
||||
actionLogin(param as unknown as DemandCompType);
|
||||
};
|
||||
|
||||
|
||||
const formFields: Array<{
|
||||
name: keyof FormData;
|
||||
name: keyof SdmLoginForm;
|
||||
label: string;
|
||||
component: FieldComponent | undefined;
|
||||
}> = [
|
||||
{
|
||||
name: "dmdInfoId",
|
||||
label: "사업자등록번호",
|
||||
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
|
||||
placeholder="여러사업장이 있을 경우 입력해주세요"
|
||||
{
|
||||
name: "dmdInfoId",
|
||||
label: "사업자등록번호",
|
||||
component: (field) => (
|
||||
<Input
|
||||
placeholder="사업자등록번호를 입력하세요"
|
||||
type="text"
|
||||
className="!mt-5 !text-xl text-gray-600"
|
||||
disabled={isBznmTotNoDisabled}
|
||||
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
|
||||
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}
|
||||
/>
|
||||
</FormUi>
|
||||
)
|
||||
},
|
||||
{
|
||||
name: "password",
|
||||
label: "비밀번호",
|
||||
component: (field) => (
|
||||
<Input
|
||||
placeholder="비밀번호를 입력하세요"
|
||||
type="password"
|
||||
className="!mt-5 !mb-5 !text-xl text-gray-600"
|
||||
{...field}
|
||||
/>
|
||||
)
|
||||
}
|
||||
];
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -148,11 +166,11 @@ export function SdmLoginForm() {
|
||||
control={form.control}
|
||||
name={name}
|
||||
render={({ field }) => (
|
||||
label==='종사업자등록번호' ?
|
||||
<>
|
||||
label === '종사업자등록번호' ?
|
||||
<>
|
||||
{component && component(field)}
|
||||
</>
|
||||
: <FormUi label={label}>
|
||||
: <FormUi label={label}>
|
||||
{component && component(field)}
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -160,12 +178,15 @@ export function SdmLoginForm() {
|
||||
))}
|
||||
</FormProvider>
|
||||
<div className="flex justify-center pt-4">
|
||||
<Button
|
||||
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>
|
||||
<div className="flex flex-col items-center">
|
||||
<Button
|
||||
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>
|
||||
<div className="text-xl mt-2 text-gray-400 cursor-pointer" onClick={initPassword}>비밀번호 초기화 요청</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"dev": "next dev -p 3005",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"start:dm": "next start -p 3005",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 35 KiB |
@@ -1,7 +1,7 @@
|
||||
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "DM";
|
||||
export const PORT = process.env.NEXT_PUBLIC_PORT || "3000";
|
||||
export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL ||'http://con.mind-one.co.kr:11035/api/v1';
|
||||
export const SERVER_API_DM_URL = process.env.NEXT_PUBLIC_DM_SERVER_API_URL ||'http://con.mind-one.co.kr:11035/api/v1';
|
||||
export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1';
|
||||
export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL||' http://con.mind-one.co.kr:11080/api/v1';
|
||||
export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000';
|
||||
|
||||
@@ -2,7 +2,6 @@ NEXT_PUBLIC_SITE_ID = FO
|
||||
NEXT_PUBLIC_PORT = 11300
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
NEXT_PUBLIC_SITE_ID = FO
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
|
||||
@@ -15,7 +15,6 @@ NEXT_PUBLIC_SITE_ID = FO
|
||||
NEXT_PUBLIC_PORT = 11300
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
|
||||
@@ -97,7 +97,10 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
|
||||
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
|
||||
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
|
||||
const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay;
|
||||
if(flowPanel === '2'){
|
||||
if(flowPanel === '1') {
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay>0 && infoRnDay < 3;
|
||||
} else if(flowPanel === '2'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 3 && infoRnDay < 10;
|
||||
} else if(flowPanel === '3'){
|
||||
@@ -119,7 +122,8 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60;
|
||||
} else {
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (rainEffectDay ===1);
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (infoRnDay>0 || rainEffectDay ===1);
|
||||
}
|
||||
});
|
||||
} else if(tabName.includes("_chuncheon")) {
|
||||
@@ -128,8 +132,8 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
|
||||
const itemDateOnly = new Date(itemDate.getFullYear(), itemDate.getMonth(), itemDate.getDate());
|
||||
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
|
||||
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
|
||||
const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && rainEffectDay==0;
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay==0;
|
||||
});
|
||||
} else {
|
||||
filteredData = searchList.filter((item) => {
|
||||
@@ -140,6 +144,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
|
||||
return itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly;
|
||||
});
|
||||
}
|
||||
|
||||
setCopySearchList(filteredData);
|
||||
setStandSearchList(filteredData);
|
||||
}, [searchList, searchYear, tabName, flowPanel]);
|
||||
|
||||
@@ -15,6 +15,7 @@ export default function DrainageEquipment({searchYear = '', fcltyList = []}: Dra
|
||||
const {
|
||||
Common,
|
||||
DrainageEquipment,
|
||||
searchDrainageEquipment,
|
||||
} = useFoStore((state) => state);
|
||||
|
||||
const {
|
||||
@@ -34,10 +35,11 @@ export default function DrainageEquipment({searchYear = '', fcltyList = []}: Dra
|
||||
|
||||
useEffect(() => {
|
||||
if (!isInit && tableData[0]?.bscFctCd && (tableData[0].bscFctCd !== prevFacilityCode || !hasSearched)) {
|
||||
searchDrainageEquipment(searchYear, tableData[0].bscFctCd, false);
|
||||
setHasSearched(true);
|
||||
setPrevFacilityCode(tableData[0].bscFctCd);
|
||||
}
|
||||
}, [fcltyList, isInit, searchYear, tableData, hasSearched, prevFacilityCode]);
|
||||
}, [fcltyList, isInit, searchDrainageEquipment, searchYear, tableData, hasSearched, prevFacilityCode]);
|
||||
|
||||
// 연도가 바뀌면 hasSearched를 false로 리셋
|
||||
useEffect(() => {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ContentsDiv, UiModal, UiTable } from "@common/business_components";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import DashBoardChartModal from "./modal/page";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export type facilityInfoProps = {
|
||||
searchYear?: string;
|
||||
@@ -57,7 +56,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
PlanFclty,
|
||||
OperationStatus,
|
||||
searchOperationStatus,
|
||||
searchPlanInfo,
|
||||
searchPlanInfo
|
||||
} = useFoStore((state) => state);
|
||||
|
||||
const [modalItem, setModalItem] = useState<{item: string, period: string, title: string, waterQlty: string} | null>(null);
|
||||
@@ -78,18 +77,13 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
const {
|
||||
upHeadListPlanFclty,
|
||||
planFcltyList,
|
||||
planYearList,
|
||||
waterUsage1,
|
||||
waterUsage2,
|
||||
waterUsage3,
|
||||
isLoadingPlanFclty
|
||||
planYearList
|
||||
} = PlanFclty;
|
||||
|
||||
// 그리드 관련
|
||||
const {
|
||||
upHeadListOperationStatus,
|
||||
operationalStatusList,
|
||||
isLoadingOperationStatus
|
||||
operationalStatusList
|
||||
} = OperationStatus;
|
||||
|
||||
const closeModal = () => {
|
||||
@@ -153,27 +147,20 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
searchPlanInfo(searchYear, fcltyList[0].bscFctCd);
|
||||
setHasSearched(true);
|
||||
setPrevFacilityCode(fcltyList[0].bscFctCd);
|
||||
}
|
||||
}, [isInit, searchOperationStatus, searchYear, fcltyList, hasSearched, prevFacilityCode, searchPlanInfo]);
|
||||
|
||||
// waterUsage 값들이 로드된 후에 테이블 데이터 업데이트
|
||||
useEffect(() => {
|
||||
if (waterUsage1 !== '' && waterUsage2 !== '' && waterUsage3 !== '') {
|
||||
planFcltyList.forEach((el: { [key: string]: string | number | boolean }, index) => {
|
||||
if (index === 6) {
|
||||
el['item'] = (Number(searchYear)-2).toString();
|
||||
el['provisionalApproval'] = waterUsage3;
|
||||
el['provisionalApproval'] = Number(fcltyList[0]?.fcltyCpc)* 0.6;
|
||||
} else if (index === 7) {
|
||||
el['item'] = (Number(searchYear)-1).toString();
|
||||
el['provisionalApproval'] = waterUsage2;
|
||||
el['provisionalApproval'] = Number(fcltyList[0]?.fcltyCpc)* 0.6;
|
||||
} else if (index === 8) {
|
||||
el['item'] = (Number(searchYear)-0).toString();
|
||||
el['provisionalApproval'] = waterUsage1;
|
||||
el['provisionalApproval'] = Number(fcltyList[0]?.fcltyCpc)* 0.6;
|
||||
}
|
||||
});
|
||||
console.log('planFcltyList :', planFcltyList);
|
||||
}
|
||||
}, [waterUsage1, waterUsage2, waterUsage3, searchYear, planFcltyList]);
|
||||
}, [isInit, searchOperationStatus, searchYear, fcltyList, hasSearched, prevFacilityCode, searchPlanInfo, planFcltyList]);
|
||||
// 연도가 바뀌면 hasSearched를 false로 리셋
|
||||
useEffect(() => {
|
||||
setHasSearched(false);
|
||||
@@ -203,7 +190,6 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
<>
|
||||
<UiTable headName={""} tableData={mappedTableData} headlist={upHeadListFclty} pageSize={0} total={0} cellClick={ undefined } onPageChange={() => { } } />
|
||||
<ContentsDiv>
|
||||
<LoadingOverlay isLoading={isLoadingPlanFclty} />
|
||||
<div className="grid grid-cols-12 gap-1">
|
||||
<div className="col-span-5">
|
||||
<Table variant="secondary">
|
||||
@@ -225,8 +211,8 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
:(index < 5 || index > 5)&& (index!= 4) && (head.id ==='provisionalApproval'||head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour')
|
||||
?<TableCell className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>
|
||||
:(head.id === "provisionalApproval" && index === 4)
|
||||
?<TableCell colSpan={6} className="text-right border border-[var(--border)] text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{Math.round((Number(waterUsage1)+Number(waterUsage2)+Number(waterUsage3))/3 * 100)/100}</TableCell>
|
||||
:((head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') )
|
||||
?<TableCell colSpan={6} className="text-right border border-[var(--border)] text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{(Number(fcltyList[0]?.fcltyCpc)* 0.6).toLocaleString('en-US', { minimumFractionDigits: 1, maximumFractionDigits: 1 })} </TableCell>
|
||||
:((head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') && index === 4)
|
||||
?null
|
||||
:(head.id === 'item' && index != 5)?
|
||||
<TableCell className="text-center text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>
|
||||
@@ -239,40 +225,39 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
</div>
|
||||
<div className="col-span-7 h-[600px] overflow-x-auto">
|
||||
<div className="w-[200%]">
|
||||
<LoadingOverlay isLoading={isLoadingOperationStatus} />
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
{upChangeHeadListOperationStatus}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{operationalStatusList.map((el: { [key: string]: string | number | boolean },index) => (
|
||||
<TableRow key={index+"row"} >
|
||||
{upHeadListOperationStatus.map((head) => (
|
||||
(head.id === 'flowRate' && index === 0)?<TableCell rowSpan={5} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'flowRate' && index === 5)?<TableCell rowSpan={6} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'flowRate' && index === 11)?<TableCell rowSpan={2} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'rdi'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'rdi'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'rdiRain'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el['rdiRain']}</TableCell>:
|
||||
(head.id === 'rdiRain'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>:
|
||||
(head.id === 'waterQlty')?<TableCell className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=5 && index<=10))?<TableCell className="bg-green-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=0 && index<=4))?<TableCell className="bg-yellow-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=5 && index<=10))?<TableCell className="bg-green-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=11 && index<=12))?<TableCell className="bg-blue-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=5 && index<=10))?<TableCell className="bg-green-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
null
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
{upChangeHeadListOperationStatus}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{operationalStatusList.map((el: { [key: string]: string | number | boolean },index) => (
|
||||
<TableRow key={index+"row"} >
|
||||
{upHeadListOperationStatus.map((head) => (
|
||||
(head.id === 'flowRate' && index === 0)?<TableCell rowSpan={5} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'flowRate' && index === 5)?<TableCell rowSpan={6} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'flowRate' && index === 11)?<TableCell rowSpan={2} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'rdi'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
(head.id === 'rdi'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>:
|
||||
(head.id === 'rdiRain'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el['rdiRain']}</TableCell>:
|
||||
(head.id === 'rdiRain'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>:
|
||||
(head.id === 'waterQlty')?<TableCell className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=5 && index<=10))?<TableCell className="bg-green-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=0 && index<=4))?<TableCell className="bg-yellow-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=5 && index<=10))?<TableCell className="bg-green-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=11 && index<=12))?<TableCell className="bg-blue-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=5 && index<=10))?<TableCell className="bg-green-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
|
||||
null
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { CHART_FORM, type ChartConfig, ContentsDiv, MainChart } from "@common/bu
|
||||
import { Card, CardContent } from "@common/business_components/ui/chart/lib/card";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useEffect, useState } from "react";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
type facilityInfoProps = {
|
||||
searchYear?: string;
|
||||
@@ -45,7 +44,6 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
chart_inflTn,
|
||||
chart_efflTn,
|
||||
chart_inflBod,
|
||||
isLoadingMainGraph,
|
||||
} = MainGraph;
|
||||
|
||||
/**
|
||||
@@ -181,7 +179,6 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<LoadingOverlay isLoading={isLoadingMainGraph} />
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
|
||||
@@ -57,7 +57,8 @@ export default function DashBoard() {
|
||||
|
||||
/******************선택된 데이터******************/
|
||||
// 연도
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0');
|
||||
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0');
|
||||
const [searchYear, setSearchYear] = useState<string>('2023');
|
||||
// 시설명
|
||||
const [fcltyList, setFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({
|
||||
bscFctCd: '26260PB001R',
|
||||
@@ -279,11 +280,8 @@ export default function DashBoard() {
|
||||
trtFrfNm: '표준활성슬러지법, MLE, MBR',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
|
||||
});
|
||||
setSearchYear(selectSearchYear[0]?.val || '0');
|
||||
setSearchYear('2023');
|
||||
searchFcltyList.bscFctNm = '수영';
|
||||
|
||||
setSidoValue('0');
|
||||
setSigunValue('0');
|
||||
}
|
||||
|
||||
const searchVal = () => {
|
||||
|
||||
@@ -45,7 +45,6 @@ export default function RainManageTab({searchYear = '', fcltyList = []}: facilit
|
||||
}, [searchYear]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<UiTable
|
||||
headName=""
|
||||
tableData={rainManageList}
|
||||
@@ -56,7 +55,5 @@ export default function RainManageTab({searchYear = '', fcltyList = []}: facilit
|
||||
onPageChange={() => {}}
|
||||
>
|
||||
</UiTable>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 일수에 강우영향일 포함됨</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, Selec
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import PrecipitationModal from "./modal/page";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function FacilityPrecipitation() {
|
||||
const {Common
|
||||
@@ -40,8 +39,7 @@ export default function FacilityPrecipitation() {
|
||||
upHeadList3,
|
||||
excelList,
|
||||
facilityPrecipitation,
|
||||
facilityPrecipitationCount,
|
||||
isLoading,
|
||||
facilityPrecipitationCount
|
||||
} = FacilityPrecipitation;
|
||||
|
||||
const {
|
||||
@@ -83,7 +81,8 @@ export default function FacilityPrecipitation() {
|
||||
// 시설상태
|
||||
const [operationValue, setOperationValue] = useState<string>("0");
|
||||
// 조회기간
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
const [searchYear, setSearchYear] = useState<string>("2023");
|
||||
|
||||
/**
|
||||
* 페이지 함수
|
||||
@@ -127,9 +126,9 @@ export default function FacilityPrecipitation() {
|
||||
useEffect(() => {
|
||||
if (!isInit) {
|
||||
initializeCommonData();
|
||||
searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
searchFacilityPrecipitationList(1, 10, searchYear || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchFacilityPrecipitationList]);
|
||||
}, [isInit, initializeCommonData, searchFacilityPrecipitationList, searchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -228,7 +227,6 @@ export default function FacilityPrecipitation() {
|
||||
initClick={resetVal}
|
||||
ref={ref} isAdmin={false} />
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 강수현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -66,11 +66,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
let maxefflWqltToc = 0;
|
||||
let maxEfflWqltSs = 0;
|
||||
|
||||
let maxinflAssctBfrWqltBod = 0;
|
||||
let maxinflAssctBfrWqltTn = 0;
|
||||
let maxInflAssctAftWqltBod = 0;
|
||||
let maxInflAssctAftWqltTn = 0;
|
||||
let maxInflAssctBfrWqltTp = 0;
|
||||
let maxinflAssctBfrWqltToc = 0;
|
||||
let maxinflAssctBfrWqltSs = 0;
|
||||
let maxInflAssctAftWqltToc = 0;
|
||||
let maxInflAssctAftWqltSs = 0;
|
||||
|
||||
let maxTpInflWqltBod = 0;
|
||||
let maxTpInflWqltTp = 0;
|
||||
@@ -83,11 +83,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
let minefflWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltToc) : 0;
|
||||
let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0;
|
||||
|
||||
let mininflAssctBfrWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltBod) : 0;
|
||||
let mininflAssctBfrWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTn) : 0;
|
||||
let minInflAssctAftWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltBod) : 0;
|
||||
let minInflAssctAftWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltTn) : 0;
|
||||
let minInflAssctBfrWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTp) : 0;
|
||||
let mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0;
|
||||
let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0;
|
||||
let minInflAssctAftWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltToc) : 0;
|
||||
let minInflAssctAftWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltSs) : 0;
|
||||
|
||||
let minTpInflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltBod) : 0;
|
||||
let minTpInflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltTp) : 0;
|
||||
@@ -100,11 +100,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
let avgefflWqltToc = 0;
|
||||
let avgEfflWqltSs = 0;
|
||||
|
||||
let avginflAssctBfrWqltBod = 0;
|
||||
let avginflAssctBfrWqltTn = 0;
|
||||
let avgInflAssctAftWqltBod = 0;
|
||||
let avgInflAssctAftWqltTn = 0;
|
||||
let avgInflAssctBfrWqltTp = 0;
|
||||
let avginflAssctBfrWqltToc = 0;
|
||||
let avginflAssctBfrWqltSs = 0;
|
||||
let avgInflAssctAftWqltToc = 0;
|
||||
let avgInflAssctAftWqltSs = 0;
|
||||
|
||||
let avgTpInflWqltBod = 0;
|
||||
let avgTpInflWqltTp = 0;
|
||||
@@ -118,11 +118,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
const efflWqltToc = parseNumber(item.efflWqltToc);
|
||||
const efflWqltSs = parseNumber(item.efflWqltSs);
|
||||
|
||||
const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod);
|
||||
const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn);
|
||||
const inflAssctAftWqltBod = parseNumber(item.inflAssctAftWqltBod);
|
||||
const inflAssctAftWqltTn = parseNumber(item.inflAssctAftWqltTn);
|
||||
const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp);
|
||||
const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc);
|
||||
const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs);
|
||||
const inflAssctAftWqltToc = parseNumber(item.inflAssctAftWqltToc);
|
||||
const inflAssctAftWqltSs = parseNumber(item.inflAssctAftWqltSs);
|
||||
|
||||
|
||||
const tpInflWqltBod = parseNumber(item.tpInflWqltBod);
|
||||
@@ -136,11 +136,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc);
|
||||
maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs);
|
||||
|
||||
maxinflAssctBfrWqltBod = Math.max(maxinflAssctBfrWqltBod, inflAssctBfrWqltBod);
|
||||
maxinflAssctBfrWqltTn = Math.max(maxinflAssctBfrWqltTn, inflAssctBfrWqltTn);
|
||||
maxInflAssctAftWqltBod = Math.max(maxInflAssctAftWqltBod, inflAssctAftWqltBod);
|
||||
maxInflAssctAftWqltTn = Math.max(maxInflAssctAftWqltTn, inflAssctAftWqltTn);
|
||||
maxInflAssctBfrWqltTp = Math.max(maxInflAssctBfrWqltTp, inflAssctBfrWqltTp);
|
||||
maxinflAssctBfrWqltToc = Math.max(maxinflAssctBfrWqltToc, inflAssctBfrWqltToc);
|
||||
maxinflAssctBfrWqltSs = Math.max(maxinflAssctBfrWqltSs, inflAssctBfrWqltSs);
|
||||
maxInflAssctAftWqltToc = Math.max(maxInflAssctAftWqltToc, inflAssctAftWqltToc);
|
||||
maxInflAssctAftWqltSs = Math.max(maxInflAssctAftWqltSs, inflAssctAftWqltSs);
|
||||
|
||||
maxTpInflWqltBod = Math.max(maxTpInflWqltBod, tpInflWqltBod);
|
||||
maxTpInflWqltTp = Math.max(maxTpInflWqltTp, tpInflWqltTp);
|
||||
@@ -153,11 +153,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
minefflWqltToc = Math.min(minefflWqltToc, efflWqltToc);
|
||||
minEfflWqltSs = Math.min(minEfflWqltSs, efflWqltSs);
|
||||
|
||||
mininflAssctBfrWqltBod = Math.min(mininflAssctBfrWqltBod, inflAssctBfrWqltBod);
|
||||
mininflAssctBfrWqltTn = Math.min(mininflAssctBfrWqltTn, inflAssctBfrWqltTn);
|
||||
minInflAssctAftWqltBod = Math.min(minInflAssctAftWqltBod, inflAssctAftWqltBod);
|
||||
minInflAssctAftWqltTn = Math.min(minInflAssctAftWqltTn, inflAssctAftWqltTn);
|
||||
minInflAssctBfrWqltTp = Math.min(minInflAssctBfrWqltTp, inflAssctBfrWqltTp);
|
||||
mininflAssctBfrWqltToc = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltToc);
|
||||
mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs);
|
||||
minInflAssctAftWqltToc = Math.min(minInflAssctAftWqltToc, inflAssctAftWqltToc);
|
||||
minInflAssctAftWqltSs = Math.min(minInflAssctAftWqltSs, inflAssctAftWqltSs);
|
||||
|
||||
minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod);
|
||||
minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp);
|
||||
@@ -170,11 +170,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
avgefflWqltToc += efflWqltToc;
|
||||
avgEfflWqltSs += efflWqltSs;
|
||||
|
||||
avginflAssctBfrWqltBod += inflAssctBfrWqltBod;
|
||||
avginflAssctBfrWqltTn += inflAssctBfrWqltTn;
|
||||
avgInflAssctAftWqltBod += inflAssctAftWqltBod;
|
||||
avgInflAssctAftWqltTn += inflAssctAftWqltTn;
|
||||
avgInflAssctBfrWqltTp += inflAssctBfrWqltTp;
|
||||
avginflAssctBfrWqltToc += inflAssctBfrWqltToc;
|
||||
avginflAssctBfrWqltSs += inflAssctBfrWqltSs;
|
||||
avgInflAssctAftWqltToc += inflAssctAftWqltToc;
|
||||
avgInflAssctAftWqltSs += inflAssctAftWqltSs;
|
||||
|
||||
avgTpInflWqltBod += tpInflWqltBod;
|
||||
avgTpInflWqltTp += tpInflWqltTp;
|
||||
@@ -190,11 +190,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
efflWqltSs: filteredData.length==0?'0.0':(Math.round(avgEfflWqltSs / filteredData.length * 10) / 10).toFixed(1),
|
||||
efflWqltTn: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTn / filteredData.length * 1000) / 1000).toFixed(3),
|
||||
efflWqltTp: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTp / filteredData.length * 1000) / 1000).toFixed(3),
|
||||
inflAssctBfrWqltBod: filteredData.length==0?'0.0':(Math.round(avginflAssctBfrWqltBod / filteredData.length * 10) / 10).toFixed(1),
|
||||
inflAssctBfrWqltTn: filteredData.length==0?'0.000':(Math.round(avginflAssctBfrWqltTn / filteredData.length * 1000) / 1000).toFixed(3),
|
||||
inflAssctAftWqltBod: filteredData.length==0?'0.0':(Math.round(avgInflAssctAftWqltBod / filteredData.length * 10) / 10).toFixed(1),
|
||||
inflAssctAftWqltTn: filteredData.length==0?'0.000':(Math.round(avgInflAssctAftWqltTn / filteredData.length * 1000) / 1000).toFixed(3),
|
||||
inflAssctBfrWqltTp: filteredData.length==0?'0.000':(Math.round(avgInflAssctBfrWqltTp / filteredData.length * 1000) / 1000).toFixed(3),
|
||||
inflAssctBfrWqltToc: filteredData.length==0?'0.0':(Math.round(avginflAssctBfrWqltToc / filteredData.length * 10) / 10).toFixed(1),
|
||||
inflAssctBfrWqltSs: filteredData.length==0?'0.0':(Math.round(avginflAssctBfrWqltSs / filteredData.length * 10) / 10).toFixed(1),
|
||||
inflAssctAftWqltToc: filteredData.length==0?'0.0':(Math.round(avgInflAssctAftWqltToc / filteredData.length * 10) / 10).toFixed(1),
|
||||
inflAssctAftWqltSs: filteredData.length==0?'0.0':(Math.round(avgInflAssctAftWqltSs / filteredData.length * 10) / 10).toFixed(1),
|
||||
bscFctCd: "",
|
||||
bscFctNm: "",
|
||||
lclgvrnmntNm: "",
|
||||
@@ -213,11 +213,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
efflWqltSs : Math.round(maxEfflWqltSs * 10) / 10?(Math.round(maxEfflWqltSs * 10) / 10).toFixed(1):'0.0',
|
||||
efflWqltTn : Math.round(maxEfflWqltTn * 1000) / 1000?(Math.round(maxEfflWqltTn * 1000) / 1000).toFixed(3):'0.000',
|
||||
efflWqltTp : Math.round(maxEfflWqltTp * 1000) / 1000?(Math.round(maxEfflWqltTp * 1000) / 1000).toFixed(3):'0.000',
|
||||
inflAssctBfrWqltBod : Math.round(maxinflAssctBfrWqltBod * 10) / 10?(Math.round(maxinflAssctBfrWqltBod * 10) / 10).toFixed(1):'0.0',
|
||||
inflAssctBfrWqltTn : Math.round(maxinflAssctBfrWqltTn * 1000) / 1000?(Math.round(maxinflAssctBfrWqltTn * 1000) / 1000).toFixed(3):'0.000',
|
||||
inflAssctAftWqltBod : Math.round(maxInflAssctAftWqltBod * 10) / 10?(Math.round(maxInflAssctAftWqltBod * 10) / 10).toFixed(1):'0.0',
|
||||
inflAssctAftWqltTn : Math.round(maxInflAssctAftWqltTn * 1000) / 1000?(Math.round(maxInflAssctAftWqltTn * 1000) / 1000).toFixed(3):'0.000',
|
||||
inflAssctBfrWqltTp : Math.round(maxInflAssctBfrWqltTp * 1000) / 1000?(Math.round(maxInflAssctBfrWqltTp * 1000) / 1000).toFixed(3):'0.000',
|
||||
inflAssctBfrWqltToc : Math.round(maxinflAssctBfrWqltToc * 10) / 10?(Math.round(maxinflAssctBfrWqltToc * 10) / 10).toFixed(1):'0.0',
|
||||
inflAssctBfrWqltSs : Math.round(maxinflAssctBfrWqltSs * 10) / 10?(Math.round(maxinflAssctBfrWqltSs * 10) / 10).toFixed(1):'0.0',
|
||||
inflAssctAftWqltToc : Math.round(maxInflAssctAftWqltToc * 10) / 10?(Math.round(maxInflAssctAftWqltToc * 10) / 10).toFixed(1):'0.0',
|
||||
inflAssctAftWqltSs : Math.round(maxInflAssctAftWqltSs * 10) / 10?(Math.round(maxInflAssctAftWqltSs * 10) / 10).toFixed(1):'0.0',
|
||||
bscFctCd: "",
|
||||
bscFctNm: "",
|
||||
lclgvrnmntNm: "",
|
||||
@@ -236,11 +236,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
efflWqltSs : Math.round(minEfflWqltSs * 10) / 10?(Math.round(minEfflWqltSs * 10) / 10).toFixed(1) : '0.0',
|
||||
efflWqltTn : Math.round(minEfflWqltTn * 1000) / 1000?(Math.round(minEfflWqltTn * 1000) / 1000).toFixed(3) : '0.000',
|
||||
efflWqltTp : Math.round(minEfflWqltTp * 1000) / 1000?(Math.round(minEfflWqltTp * 1000) / 1000).toFixed(3) : '0.000',
|
||||
inflAssctBfrWqltBod : Math.round(mininflAssctBfrWqltBod * 10) / 10?(Math.round(mininflAssctBfrWqltBod * 10) / 10).toFixed(1) : '0.0',
|
||||
inflAssctBfrWqltTn : Math.round(mininflAssctBfrWqltTn * 1000) / 1000?(Math.round(mininflAssctBfrWqltTn * 1000) / 1000).toFixed(3) : '0.000',
|
||||
inflAssctAftWqltBod : Math.round(minInflAssctAftWqltBod * 10) / 10?(Math.round(minInflAssctAftWqltBod * 10) / 10).toFixed(1) : '0.0',
|
||||
inflAssctAftWqltTn : Math.round(minInflAssctAftWqltTn * 1000) / 1000?(Math.round(minInflAssctAftWqltTn * 1000) / 1000).toFixed(3) : '0.000',
|
||||
inflAssctBfrWqltTp : Math.round(minInflAssctBfrWqltTp * 1000) / 1000?(Math.round(minInflAssctBfrWqltTp * 1000) / 1000).toFixed(3) : '0.000',
|
||||
inflAssctBfrWqltToc : Math.round(mininflAssctBfrWqltToc * 10) / 10?(Math.round(mininflAssctBfrWqltToc * 10) / 10).toFixed(1) : '0.0',
|
||||
inflAssctBfrWqltSs : Math.round(mininflAssctBfrWqltSs * 10) / 10?(Math.round(mininflAssctBfrWqltSs * 10) / 10).toFixed(1) : '0.0',
|
||||
inflAssctAftWqltToc : Math.round(minInflAssctAftWqltToc * 10) / 10?(Math.round(minInflAssctAftWqltToc * 10) / 10).toFixed(1) : '0.0',
|
||||
inflAssctAftWqltSs : Math.round(minInflAssctAftWqltSs * 10) / 10?(Math.round(minInflAssctAftWqltSs * 10) / 10).toFixed(1) : '0.0',
|
||||
bscFctCd: "",
|
||||
bscFctNm: "",
|
||||
lclgvrnmntNm: "",
|
||||
@@ -293,10 +293,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
copyYearList.forEach((item) => {
|
||||
excelDownList.push({
|
||||
날짜: item.msrDt,
|
||||
"유입BOD(mg/L)": item.inflAssctBfrWqltBod,
|
||||
"유입TOC(COD)(mg/L)": item.inflAssctBfrWqltToc,
|
||||
"유입SS(mg/L)": item.inflAssctBfrWqltSs,
|
||||
"유입TN(mg/L)": item.inflAssctBfrWqltTn,
|
||||
"유입BOD(mg/L)": item.inflAssctAftWqltBod,
|
||||
"유입TOC(COD)(mg/L)": item.inflAssctAftWqltToc,
|
||||
"유입SS(mg/L)": item.inflAssctAftWqltSs,
|
||||
"유입TN(mg/L)": item.inflAssctAftWqltTn,
|
||||
"유입TP(mg/L)": item.inflAssctBfrWqltTp,
|
||||
"유출BOD(mg/L)": item.efflWqltBod,
|
||||
"유출TOC(COD)(mg/L)": item.efflWqltToc,
|
||||
|
||||
@@ -7,7 +7,6 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import WaterQualityModal from "./modal/page";
|
||||
import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function ProcessFacilitySearch() {
|
||||
const { Common
|
||||
@@ -37,8 +36,7 @@ export default function ProcessFacilitySearch() {
|
||||
upHeadList3,
|
||||
facilityWaterQltyList,
|
||||
facilityWaterQltyCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
excelList
|
||||
} = FacilityWaterQltyMain;
|
||||
|
||||
const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || [];
|
||||
@@ -50,7 +48,8 @@ export default function ProcessFacilitySearch() {
|
||||
const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1);
|
||||
const [fcltyName, setFcltyName] = useState<string>("");
|
||||
const [operationValue, setOperationValue] = useState<string>("0");
|
||||
const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
//const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
const [searchYearValue, setSearchYearValue] = useState<string>("2023");
|
||||
const [fcltCpct, setFcltCpct] = useState<string>("0");
|
||||
|
||||
// 모달 상태 추가
|
||||
@@ -134,7 +133,7 @@ export default function ProcessFacilitySearch() {
|
||||
initializeCommonData();
|
||||
searchFacilityWaterQltyList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchFacilityWaterQltyList]);
|
||||
}, [isInit, initializeCommonData, searchFacilityWaterQltyList, selectSearchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -188,7 +187,6 @@ export default function ProcessFacilitySearch() {
|
||||
initClick={resetVal}
|
||||
ref={ref} isAdmin={false} />
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 수질현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total<10?facilityWaterQltyList.length:total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -52,6 +52,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
return Number(value.replace(/,/g, ''));
|
||||
};
|
||||
|
||||
console.log('filteredData : ', filteredData);
|
||||
let maxtotInflAmnt = 0;
|
||||
let maxinflAmnt = 0;
|
||||
let maxsumFlow = 0;
|
||||
|
||||
@@ -6,7 +6,6 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import FlowRateModal from "./modal/page";
|
||||
import type { ExcelType } from "@/app/store/flowRate";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function ProcessFacilitySearch() {
|
||||
const {Common
|
||||
@@ -43,15 +42,15 @@ export default function ProcessFacilitySearch() {
|
||||
upHeadList3,
|
||||
flowRateList,
|
||||
flowRateCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
excelList
|
||||
} = FlowRateList;
|
||||
|
||||
// 입력값 상태 관리
|
||||
const [fcltCpct, setFcltCpct] = useState<string>("0");
|
||||
const [fcltyName, setFcltyName] = useState<string>("");
|
||||
const [operationValue, setOperationValue] = useState<string>("0");
|
||||
const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
//const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
const [searchYearValue, setSearchYearValue] = useState<string>("2023");
|
||||
const [widthSize, setWidthSize] = useState<string>("w-[120%]");
|
||||
const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1);
|
||||
const [resetPage, setResetPage] = useState<boolean>(false);
|
||||
@@ -90,9 +89,9 @@ export default function ProcessFacilitySearch() {
|
||||
setWidthSize("w-[120%]");
|
||||
setUpheadList(upHeadList1)
|
||||
// 상태값 설정
|
||||
setSearchYearValue(selectSearchYear[0]?.val || "0");
|
||||
setFcltCpct(selectUpdownData[0]?.val || "0");
|
||||
setOperationValue(selectOperationData[0]?.val || "0");
|
||||
setSearchYearValue(selectSearchYear[0]?.val || "0");
|
||||
// SearchInputSelect 초기화
|
||||
setFcltyName("");
|
||||
if (searchInputRef.current) {
|
||||
@@ -127,10 +126,11 @@ export default function ProcessFacilitySearch() {
|
||||
// 시도 데이터 초기화
|
||||
useEffect(() => {
|
||||
if(!isInit) {
|
||||
console.log('searchYearValue', searchYearValue, isInit);
|
||||
initializeCommonData();
|
||||
searchFlowRateList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
searchFlowRateList(1, 10, searchYearValue || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchFlowRateList]);
|
||||
}, [isInit, initializeCommonData, searchFlowRateList, searchYearValue]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -189,7 +189,6 @@ export default function ProcessFacilitySearch() {
|
||||
initClick={resetVal}
|
||||
ref={ref} isAdmin={false} />
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 유량현황"} tableData={flowRateList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { TableUpperProps } from "@/app/store/common";
|
||||
import { downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function PlanSewage() {
|
||||
const {Common
|
||||
@@ -38,8 +37,7 @@ export default function PlanSewage() {
|
||||
upHeadList3,
|
||||
planSewageList,
|
||||
planSewageCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
excelList
|
||||
} = PlanSewage;
|
||||
|
||||
const ref = useRef<ReturnType>({
|
||||
@@ -72,7 +70,8 @@ export default function PlanSewage() {
|
||||
// 시설상태
|
||||
const [operationValue, setOperationValue] = useState<string>("0");
|
||||
// 조회기간
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
const [searchYear, setSearchYear] = useState<string>("2023");
|
||||
|
||||
/**
|
||||
* 페이지 함수
|
||||
@@ -93,7 +92,6 @@ export default function PlanSewage() {
|
||||
input.value = "";
|
||||
}
|
||||
}
|
||||
searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,9 +100,9 @@ export default function PlanSewage() {
|
||||
useEffect(() => {
|
||||
if (!isInit) {
|
||||
initializeCommonData();
|
||||
searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
|
||||
searchPlanSewageList(1, 10, searchYear, ref.current.partValue);
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchPlanSewageList]);
|
||||
}, [isInit, initializeCommonData, searchYear, searchPlanSewageList]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('excelList' , excelList);
|
||||
@@ -189,7 +187,6 @@ export default function PlanSewage() {
|
||||
initClick={resetVal}
|
||||
ref={ref} isAdmin={false}/>
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={ undefined } headName={"계획하수량 산정지표 현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SelectBox, Title,
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import ProcessFacilityInfoModal from "./modal/page";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function ProcessArea() {
|
||||
const {Common,
|
||||
@@ -40,8 +39,7 @@ export default function ProcessArea() {
|
||||
upHeadList1,
|
||||
processAreaList,
|
||||
processAreaCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
excelList
|
||||
} = ProcessArea;
|
||||
|
||||
const mainList: Record<string, unknown>[] = processAreaList || [];
|
||||
@@ -86,7 +84,7 @@ export default function ProcessArea() {
|
||||
}
|
||||
}
|
||||
setSearchYearValue(selectSearchYear[0]?.val || "0");
|
||||
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0");
|
||||
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val);
|
||||
}
|
||||
|
||||
// 셀 클릭 시 모달 표시
|
||||
@@ -106,9 +104,9 @@ export default function ProcessArea() {
|
||||
useEffect(() => {
|
||||
if (!isInit) {
|
||||
initializeCommonData();
|
||||
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0");
|
||||
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val);
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchProcessAreaList]);
|
||||
}, [isInit, initializeCommonData, searchProcessAreaList, selectSearchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -154,7 +152,6 @@ export default function ProcessArea() {
|
||||
isAdmin={true}
|
||||
/>
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className="w-[180%]">
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList} headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, Selec
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import ProcessFacilityInfoModal from "./modal/page";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function ProcessFacilitySearch() {
|
||||
const {Common
|
||||
@@ -64,8 +63,7 @@ export default function ProcessFacilitySearch() {
|
||||
upHeadList1,
|
||||
upHeadList2,
|
||||
upHeadList3,
|
||||
excelList,
|
||||
isLoading,
|
||||
excelList
|
||||
} = ProcessFacilityList;
|
||||
|
||||
const processFacilityList = ProcessFacilityList?.processFacilityList || [];
|
||||
@@ -264,7 +262,6 @@ export default function ProcessFacilitySearch() {
|
||||
initClick={resetVal}
|
||||
ref={ref} isAdmin={false} />
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { TableUpperProps } from "@/app/store/common";
|
||||
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function Rdi() {
|
||||
const {Common
|
||||
@@ -39,7 +38,6 @@ export default function Rdi() {
|
||||
rdiList,
|
||||
rdiCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
} = Rdi;
|
||||
|
||||
const ref = useRef<ReturnType>({
|
||||
@@ -72,10 +70,6 @@ export default function Rdi() {
|
||||
// 조회기간
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
|
||||
useEffect(() => {
|
||||
console.log(isLoading);
|
||||
}, [isLoading]);
|
||||
|
||||
/**
|
||||
* 페이지 함수
|
||||
*/
|
||||
@@ -97,6 +91,7 @@ export default function Rdi() {
|
||||
}
|
||||
}
|
||||
searchRdiList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +102,7 @@ export default function Rdi() {
|
||||
initializeCommonData();
|
||||
searchRdiList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchRdiList]);
|
||||
}, [isInit, initializeCommonData, searchRdiList, selectSearchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -192,7 +187,6 @@ export default function Rdi() {
|
||||
initClick={resetVal}
|
||||
ref={ref} isAdmin={false} />
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={ undefined } headName={"RDII추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -30,11 +30,6 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
|
||||
setDetailList(gridListSewageOccurDetail);
|
||||
}, [gridListSewageOccurDetail]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
searchSewageOccurDetailList(props.facilityCd, validSearchYear, startYearMonth, endYearMonth);
|
||||
}, [startYearMonth, endYearMonth]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!h-[80px] !mt-10">
|
||||
@@ -62,7 +57,6 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={1900}
|
||||
yearReadOnly={true}
|
||||
/>~
|
||||
<DateMonthPicker
|
||||
field={{
|
||||
@@ -80,7 +74,6 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={1900}
|
||||
yearReadOnly={true}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
@@ -6,7 +6,6 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import SewageOccurModal from "./modal/page";
|
||||
import type { SewageOccurProps } from "@/app/store/sewageOccur";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function PlanSewage() {
|
||||
const {Common
|
||||
@@ -47,8 +46,7 @@ export default function PlanSewage() {
|
||||
upHeadList3,
|
||||
sewageOccurList,
|
||||
sewageOccurCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
excelList
|
||||
} = SewageOccur;
|
||||
|
||||
const ref = useRef<ReturnType>({
|
||||
@@ -86,7 +84,8 @@ export default function PlanSewage() {
|
||||
// 시설상태
|
||||
const [operationValue, setOperationValue] = useState<string>("0");
|
||||
// 조회기간
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
// const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
const [searchYear, setSearchYear] = useState<string>("2023");
|
||||
|
||||
/**
|
||||
* 페이지 함수
|
||||
@@ -107,7 +106,6 @@ export default function PlanSewage() {
|
||||
input.value = "";
|
||||
}
|
||||
}
|
||||
searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
}
|
||||
|
||||
// 모달 닫기
|
||||
@@ -130,9 +128,9 @@ export default function PlanSewage() {
|
||||
useEffect(() => {
|
||||
if (!isInit) {
|
||||
initializeCommonData();
|
||||
searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
searchSewageOccurList(1, 10, searchYear || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchSewageOccurList]);
|
||||
}, [isInit, initializeCommonData, searchSewageOccurList, searchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -219,7 +217,6 @@ export default function PlanSewage() {
|
||||
isAdmin={false}
|
||||
/>
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"오수발생량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -116,6 +116,7 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}
|
||||
}, [searchYear, tabTerm]);
|
||||
useEffect(()=>{
|
||||
console.log(fcltyName, searchYear);
|
||||
unserWaterModal(fcltyName, searchYear);
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
@@ -163,7 +164,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={Number(searchYear)} // 시작 연도 설정
|
||||
yearReadOnly={true}
|
||||
/>
|
||||
<h3 className="justify-center px-5">~</h3>
|
||||
<DateMonthPicker
|
||||
@@ -175,7 +175,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={Number(searchYear)} // 시작 연도 설정
|
||||
yearReadOnly={true}
|
||||
/>
|
||||
</div>
|
||||
</TableCell>
|
||||
@@ -228,8 +227,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={Number(searchYear)} // 시작 연도 설정
|
||||
yearReadOnly={true}
|
||||
enableMonth={['6월', '7월', '8월']}
|
||||
/>
|
||||
<h3 className="justify-center px-5">~</h3>
|
||||
<DateMonthPicker
|
||||
@@ -241,8 +238,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={Number(searchYear)} // 시작 연도 설정
|
||||
yearReadOnly={true}
|
||||
enableMonth={['6월', '7월', '8월']}
|
||||
/>
|
||||
</div>
|
||||
</TableCell>
|
||||
@@ -286,8 +281,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={Number(searchYear)} // 시작 연도 설정
|
||||
yearReadOnly={true}
|
||||
enableMonth={['1월', '2월']}
|
||||
/>
|
||||
<h3 className="justify-center px-5">~</h3>
|
||||
<DateMonthPicker
|
||||
@@ -299,8 +292,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
|
||||
}}
|
||||
selectClass="ml-5 w-[100px]"
|
||||
startYear={Number(searchYear)} // 시작 연도 설정
|
||||
yearReadOnly={true}
|
||||
enableMonth={['1월', '2월']}
|
||||
/>
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
@@ -6,7 +6,6 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import UnderWaterInputModal from "./modal/page";
|
||||
import type { UnderWaterProps } from "@/app/store/underWaterInput/types";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function UnderWaterInput() {
|
||||
const {Common
|
||||
@@ -47,7 +46,6 @@ export default function UnderWaterInput() {
|
||||
underWaterList,
|
||||
underWaterCount,
|
||||
excelList,
|
||||
isLoading,
|
||||
} = UnderWater;
|
||||
|
||||
const ref = useRef<ReturnType>({
|
||||
@@ -84,7 +82,8 @@ export default function UnderWaterInput() {
|
||||
// 시설상태
|
||||
const [operationValue, setOperationValue] = useState<string>("0");
|
||||
// 조회기간
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
|
||||
const [searchYear, setSearchYear] = useState<string>("2023");
|
||||
|
||||
/**
|
||||
* 페이지 함수
|
||||
@@ -129,7 +128,7 @@ export default function UnderWaterInput() {
|
||||
initializeCommonData();
|
||||
searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchUnderWaterList]);
|
||||
}, [isInit, initializeCommonData, searchUnderWaterList, selectSearchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -216,7 +215,6 @@ export default function UnderWaterInput() {
|
||||
isAdmin={false}
|
||||
/>
|
||||
<ListDiv>
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<div className="h-full w-full overflow-x-scroll">
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* 보편적으로 쓰는 store 공간
|
||||
====================================**/
|
||||
|
||||
import { getFetch, getFetchAreaList } from "@/app/components/api";
|
||||
import { getFetch } from "@/app/components/api";
|
||||
|
||||
/**
|
||||
* STORE - TYPE
|
||||
@@ -205,28 +205,6 @@ const selectMiddleRegionData: SelectDataType[] = [
|
||||
* STORE - API
|
||||
*/
|
||||
|
||||
// 처리시설 계획정보 호출 (알에스원)
|
||||
export const planInfoUrl = 'https://apigateway.apps.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy';
|
||||
|
||||
export const fetchPlanInfo = async (targetYear : string | undefined, ctpvNm : string | undefined, sggNm : string | undefined, fcltyCd : string | undefined) => {
|
||||
try {
|
||||
const baseUrl = planInfoUrl;
|
||||
const queryParams = new URLSearchParams();
|
||||
if (ctpvNm && ctpvNm !== '전체') queryParams.append('ctpvNm', ctpvNm);
|
||||
if (sggNm && sggNm !== '전체') queryParams.append('sggNm', sggNm);
|
||||
if (targetYear) queryParams.append('targetYear',targetYear);
|
||||
if (fcltyCd) queryParams.append('swtrmtFcltCd', fcltyCd);
|
||||
const queryString = queryParams.toString();
|
||||
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
||||
const res = await getFetchAreaList(url);
|
||||
return res;
|
||||
} catch (error) {
|
||||
console.error('처리시설 계획정보를 가져오는데 실패했습니다:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 시도 API 호출 함수 추가
|
||||
const fetchSidoData = async (): Promise<SelectDataType[]> => {
|
||||
try {
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
* Store - 타입
|
||||
*/
|
||||
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import { getFetch, getFetchAreaList } from "@/app/components/api";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import { fetchPlanInfo } from "../common";
|
||||
import type { FacilityWaterQltyProps } from "../facilityWaterQlty";
|
||||
import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput";
|
||||
|
||||
// selectBox
|
||||
export type SelectDataType = {
|
||||
@@ -113,13 +111,13 @@ export interface RainManageListProps {
|
||||
sggNm?: string,
|
||||
addr?: string,
|
||||
fctCpc?: number,
|
||||
inflAssctBfrWqltBod: number | '',
|
||||
inflAssctBfrWqltToc: number | '',
|
||||
inflAssctBfrWqltSs: number | '',
|
||||
inflAssctBfrWqltTn: number | '',
|
||||
inflAssctBfrWqltTp: number | '',
|
||||
inflAssctAftWqltBod: number | '',
|
||||
inflAssctAftWqltToc: number | '',
|
||||
inflAssctAftWqltSs: number | '',
|
||||
inflAssctAftWqltTn: number | '',
|
||||
inflAssctAftWqltTp: number | '',
|
||||
efflWqltBod: number | '',
|
||||
efflWqltToc: number | '',
|
||||
efflWqltCod: number | '',
|
||||
efflWqltSs: number | '',
|
||||
efflWqltTn: number | '',
|
||||
efflWqltTp: number | '',
|
||||
@@ -145,7 +143,6 @@ export interface RainManageListProps {
|
||||
dsInflWqltTn: number | '',
|
||||
dsInflWqltTp: number | '',
|
||||
extnsSeqno?: number | '',
|
||||
rainEffectDay?: number | '',
|
||||
}
|
||||
|
||||
export interface RainManageExcelType {
|
||||
@@ -367,14 +364,14 @@ const upHeadListRainManage : TableUpperProps[] = [
|
||||
{ id: "dsInflWqltTn", title: "T-N", row:1 },
|
||||
{ id: "dsInflWqltTp", title: "T-P", row:1 },
|
||||
{ id: "C", title: "유입수질(㎎/L)", row:0, colSpan:5 },
|
||||
{ id: "inflAssctBfrWqltBod", title: "BOD", row:1 },
|
||||
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)", row:1 },
|
||||
{ id: "inflAssctBfrWqltSs", title: "SS", row:1 },
|
||||
{ id: "inflAssctBfrWqltTn", title: "T-N", row:1 },
|
||||
{ id: "inflAssctBfrWqltTp", title: "T-P", row:1 },
|
||||
{ id: "inflAssctAftWqltBod", title: "BOD", row:1 },
|
||||
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)", row:1 },
|
||||
{ id: "inflAssctAftWqltSs", title: "SS", row:1 },
|
||||
{ id: "inflAssctAftWqltTn", title: "T-N", row:1 },
|
||||
{ id: "inflAssctAftWqltTp", title: "T-P", row:1 },
|
||||
{ id: "D", title: "방류수질(㎎/L)", row:0, colSpan:5 },
|
||||
{ id: "efflWqltBod", title: "BOD", row:1 },
|
||||
{ id: "efflWqltToc", title: "TOC\n(COD)", row:1 },
|
||||
{ id: "efflWqltCod", title: "TOC\n(COD)", row:1 },
|
||||
{ id: "efflWqltSs", title: "SS", row:1 },
|
||||
{ id: "efflWqltTn", title: "T-N", row:1 },
|
||||
{ id: "efflWqltTp", title: "T-P", row:1 },
|
||||
@@ -690,20 +687,20 @@ const drainageEquipmentList : DrainageEquipmentListProps[] = [
|
||||
* Store - api (데이터 호출)
|
||||
====================================*/
|
||||
/* 시설정보 및 운영현황 - 계획 */
|
||||
const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : string | undefined, set : (fn: (state: DashBoardType) => DashBoardType) => void) => {
|
||||
const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : string | undefined) => {
|
||||
try {
|
||||
const res = await fetchPlanInfo(undefined, undefined, undefined, fcltyCd);
|
||||
return res;
|
||||
targetYear = targetYear ? targetYear : "2023";
|
||||
const baseUrl = 'https://apigateway.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy';
|
||||
const queryParams = new URLSearchParams();
|
||||
|
||||
if (fcltyCd) queryParams.append('swtrmtFcltCd', fcltyCd);
|
||||
//if (targetYear) queryParams.append('targetYear',targetYear);
|
||||
const queryString = queryParams.toString();
|
||||
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
||||
const res = await getFetchAreaList(url);
|
||||
return res
|
||||
} catch (error) {
|
||||
console.error('시설계획정보를 가져오는데 실패했습니다:', error);
|
||||
set((state) => ({
|
||||
...state,
|
||||
PlanFclty : {
|
||||
...state.PlanFclty,
|
||||
isLoadingPlanFclty : false,
|
||||
isLoadingOperationStatus : false
|
||||
}
|
||||
}));
|
||||
return {data: [], count: 0};
|
||||
}
|
||||
};
|
||||
@@ -732,6 +729,20 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde
|
||||
}
|
||||
}
|
||||
|
||||
// 배수설비 정비현황
|
||||
const fetchDrainageEquipment = async (searchYear: string|undefined, fcltyCd: string|undefined) => {
|
||||
try{
|
||||
/* const url = '/fclt/qlty/hist/' + (searchYear?searchYear:'2024') + '/' + (fcltyCd?fcltyCd:'11680PB001R');
|
||||
const res = await getFetch('fo', url);
|
||||
return { data: res.data, count: res.count } */
|
||||
console.log(searchYear, fcltyCd);
|
||||
return { data : drainageEquipmentList, count : drainageEquipmentList.length }
|
||||
} catch (error) {
|
||||
console.error('배수설비 정비현황 데이터를 가져오는데 실패했습니다:', error);
|
||||
return { data: [], count: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
/**====================================
|
||||
* Store - action
|
||||
====================================*/
|
||||
@@ -745,6 +756,8 @@ export type DashBoardActions = {
|
||||
searchMainGraph(searchYear: string, fcltyCd: string): Promise<void>;
|
||||
/**강우일 운영현황 */
|
||||
searchRainManage(searchYear: string, fcltyCd: string, isExcel: boolean): Promise<void>;
|
||||
/**배수설비 정비현황 */
|
||||
searchDrainageEquipment(searchYear: string, fcltyCd: string, isExcel: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export type DashBoardType = {
|
||||
@@ -764,17 +777,12 @@ export type DashBoardType = {
|
||||
planYearList : string[];
|
||||
upHeadListPlanFclty : TableUpperProps[];
|
||||
planFcltyList : planFcltyListProps[];
|
||||
waterUsage1 : number | '',
|
||||
waterUsage2 : number | '',
|
||||
waterUsage3 : number | '',
|
||||
isLoadingPlanFclty : boolean;
|
||||
},
|
||||
|
||||
OperationStatus : {
|
||||
isInit : boolean;
|
||||
upHeadListOperationStatus : TableUpperProps[];
|
||||
operationalStatusList : OperationalStatusListProps[];
|
||||
isLoadingOperationStatus : boolean;
|
||||
}
|
||||
|
||||
MainGraph : {
|
||||
@@ -788,7 +796,6 @@ export type DashBoardType = {
|
||||
chart_efflTn : lineChartDataProps[];
|
||||
chart_inflBod : lineChartDataProps[];
|
||||
chart_efflBod : lineChartDataProps[];
|
||||
isLoadingMainGraph : boolean;
|
||||
},
|
||||
|
||||
RainManage : {
|
||||
@@ -796,7 +803,6 @@ export type DashBoardType = {
|
||||
upHeadListRainManage : TableUpperProps[];
|
||||
rainManageList : RainManageListProps[];
|
||||
excelList : RainManageExcelType[];
|
||||
isLoadingRainManage : boolean;
|
||||
},
|
||||
|
||||
DrainageEquipment : {
|
||||
@@ -825,18 +831,13 @@ export const dashBoardInitState:DashBoardType = {
|
||||
isInit : true,
|
||||
planYearList : planYearList,
|
||||
upHeadListPlanFclty : upHeadListPlanFclty,
|
||||
planFcltyList : planFcltyList,
|
||||
waterUsage1 : 0,
|
||||
waterUsage2 : 0,
|
||||
waterUsage3 : 0,
|
||||
isLoadingPlanFclty : false,
|
||||
planFcltyList : planFcltyList
|
||||
},
|
||||
|
||||
OperationStatus : {
|
||||
isInit : false,
|
||||
upHeadListOperationStatus : upHeadListOperationStatus,
|
||||
operationalStatusList : operationalStatusList,
|
||||
isLoadingOperationStatus : false,
|
||||
operationalStatusList : operationalStatusList
|
||||
},
|
||||
|
||||
MainGraph : {
|
||||
@@ -849,16 +850,14 @@ export const dashBoardInitState:DashBoardType = {
|
||||
chart_inflTn : chart_inflTn,
|
||||
chart_efflTn : chart_efflTn,
|
||||
chart_inflBod : chart_inflBod,
|
||||
chart_efflBod : chart_efflBod,
|
||||
isLoadingMainGraph : false,
|
||||
chart_efflBod : chart_efflBod
|
||||
},
|
||||
|
||||
RainManage : {
|
||||
isInit : false,
|
||||
upHeadListRainManage : upHeadListRainManage,
|
||||
rainManageList : rainManageList,
|
||||
excelList : [],
|
||||
isLoadingRainManage : false,
|
||||
excelList : []
|
||||
},
|
||||
|
||||
DrainageEquipment : {
|
||||
@@ -927,106 +926,18 @@ const changeValue=(operationalStatus, data, keyTxt = 'INFL_AMNT')=>{
|
||||
|
||||
const calcValue = (operationalStatus, data, keyTxt='INFL_ASSCT_BFR_WQLT_TP') => {
|
||||
// 연간
|
||||
operationalStatus.yearAvg = data.yearData && data.yearData['AVG_'+keyTxt] ? Number(Math.round(data.yearData['AVG_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.yearMax = data.yearData && data.yearData['MAX_'+keyTxt] ? Number(Math.round(data.yearData['MAX_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.yearMin = data.yearData && data.yearData['MIN_'+keyTxt] ? Number(Math.round(data.yearData['MIN_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.yearAvg = data.yearData ? Number(Math.round(data.yearData['AVG_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.yearMax = data.yearData ? Number(Math.round(data.yearData.MAX_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.yearMin = data.yearData ? Number(Math.round(data.yearData.MIN_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
// 여름
|
||||
operationalStatus.summerAll = data.summer && data.summer['AVG_'+keyTxt] ? Number(Math.round(data.summer['AVG_'+keyTxt] * 0.8 * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.summerThree = data.summerRainy && data.summerRainy['AVG_'+keyTxt] ? Number(Math.round(data.summerRainy['AVG_'+keyTxt] * 0.82 * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.summerRain = data.summerSunny && data.summerSunny['AVG_'+keyTxt] ? Number(Math.round(data.summerSunny['AVG_'+keyTxt] * 0.74 * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.summerAll = data.summer ? Number(Math.round(data.summer.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.summerThree = data.summerRainy ? Number(Math.round(data.summerRainy.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.summerRain = data.summerSunny ? Number(Math.round(data.summerSunny.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
// 겨울
|
||||
operationalStatus.winterAll = data.winter && data.winter['AVG_'+keyTxt] ? Number(Math.round(data.winter['AVG_'+keyTxt] * 1.16*1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.winterSunnyMin = data.winterSunny && data.winterSunny['MIN_'+keyTxt] ? Number(Math.round(data.winterSunny['MIN_'+keyTxt] * 1.2 * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.winterSunnyAvg = data.winterSunny && data.winterSunny['AVG_'+keyTxt] ? Number(Math.round(data.winterSunny['AVG_'+keyTxt] * 1.25 *1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.winterSunnyMax = data.winterSunny && data.winterSunny['MAX_'+keyTxt] ? Number(Math.round(data.winterSunny['MAX_'+keyTxt] * 1.3 *1000) / 1000).toFixed(3).toString() : '';
|
||||
}
|
||||
|
||||
type RtnFlowType = {
|
||||
inflAmnt: string | number;
|
||||
infoRnDay: string | number;
|
||||
bscFctCd: string;
|
||||
msrDt: string;
|
||||
}
|
||||
|
||||
type RtnFlowResponse = {
|
||||
data: RtnFlowType[];
|
||||
count: number;
|
||||
}
|
||||
|
||||
const searchWaterUsage = async (searchYear: string, fcltyCd: string) => {
|
||||
const waterUsage = [0, 0, 0];
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
try {
|
||||
const res = await getFetch('fo', '/fclt/flow/' + fcltyCd + '/' + (Number(searchYear)-i)) as RtnFlowResponse;
|
||||
let totWaterUsage = 0;
|
||||
|
||||
if (res && res.data && Array.isArray(res.data)) {
|
||||
res.data.forEach((item: RtnFlowType) => {
|
||||
totWaterUsage += Number(item.inflAmnt);
|
||||
});
|
||||
|
||||
if (res.count > 0) {
|
||||
const avg = totWaterUsage / res.count;
|
||||
waterUsage[i] = parseFloat((avg * 0.65).toFixed(2));
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching water usage for year ${Number(searchYear)-i}:`, error);
|
||||
waterUsage[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return waterUsage;
|
||||
}
|
||||
|
||||
// 강우영향일 계산 및 강우량 덮어씌우기
|
||||
export const calRainEffectDayRainManage = (data: RainManageListProps[]) => {
|
||||
|
||||
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
const item = data[idx];
|
||||
if(item){
|
||||
if(item.infoRnDay && Number(item.infoRnDay) >= 3) {
|
||||
item.rainEffectDay = 1;
|
||||
} else {
|
||||
item.rainEffectDay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx]) {
|
||||
// 하루 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
// 이틀 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx] && data[idx]?.rainEffectDay === 1) {
|
||||
if(idx > 1){
|
||||
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let rtnData : RainManageListProps[] = [];
|
||||
rtnData = data.filter((item: RainManageListProps) => item.rainEffectDay === 1);
|
||||
return rtnData;
|
||||
operationalStatus.winterAll = data.winter ? Number(Math.round(data.winter.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.winterSunnyMin = data.winterSunny ? Number(Math.round(data.winterSunny.MIN_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.winterSunnyAvg = data.winterSunny ? Number(Math.round(data.winterSunny.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
operationalStatus.winterSunnyMax = data.winterSunny ? Number(Math.round(data.winterSunny.MAX_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : '';
|
||||
}
|
||||
|
||||
export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) => void)=>DashBoardActions=(set: (fn: (state: DashBoardType) => DashBoardType) => void) => {
|
||||
@@ -1043,28 +954,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
/** 시설정보 및 운영현황 - 계획정보 */
|
||||
searchPlanInfo : async (targetYear: string, fcltyCd: string) => {
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
PlanFclty: {
|
||||
...state.PlanFclty,
|
||||
isLoadingPlanFclty: true,
|
||||
},
|
||||
}));
|
||||
let waterUsage = [0, 0, 0];
|
||||
waterUsage = await searchWaterUsage(targetYear, fcltyCd);
|
||||
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
PlanFclty : {
|
||||
...state.PlanFclty,
|
||||
waterUsage1 : waterUsage[0] || 0,
|
||||
waterUsage2 : waterUsage[1] || 0,
|
||||
waterUsage3 : waterUsage[2] || 0,
|
||||
},
|
||||
}));
|
||||
|
||||
const res = await fetchFacilityPlan(targetYear, fcltyCd, set);
|
||||
|
||||
const res = await fetchFacilityPlan(targetYear, fcltyCd);
|
||||
let minDiff=9999999;
|
||||
let minIndex;
|
||||
res.forEach((el:any, idx) => {
|
||||
@@ -1114,31 +1004,21 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
// 임시시
|
||||
dataFormSettingPlan(el);
|
||||
console.log('planFcltyList', planFcltyList);
|
||||
console.log('rtnPlanData', rtnPlanData);
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
PlanFclty: {
|
||||
...state.PlanFclty,
|
||||
planFcltyList: planFcltyList,
|
||||
isLoadingPlanFclty: false,
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
PlanFclty : {
|
||||
...state.PlanFclty,
|
||||
planFcltyList : planFcltyList
|
||||
}
|
||||
}));
|
||||
},
|
||||
|
||||
/** 시설정보 및 운영현황 - 운영실태 */
|
||||
searchOperationStatus: async (isExcel: boolean, searchYear: string, fcltyCd: string) => {
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
OperationStatus: {
|
||||
...state.OperationStatus,
|
||||
isLoadingOperationStatus: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchOperationStatus(searchYear, fcltyCd);
|
||||
const data = res.data;
|
||||
|
||||
if(data && operationalStatusList){
|
||||
// 유량 - 유입
|
||||
if (operationalStatusList?.[0]) {
|
||||
@@ -1170,56 +1050,10 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
operationalStatusList[0].winterSunnyMin = data.winterSunny === null ? '' : (data.winterSunny.MIN_INFL_AMNT ? data.winterSunny.MIN_INFL_AMNT : 0) + (data.winterSunny.MIN_SUM_FLOW ? data.winterSunny.MIN_SUM_FLOW : 0) + (data.winterSunny.MIN_TP_INFL_WQLT_TP ? data.winterSunny.MIN_TP_INFL_WQLT_TP : 0);
|
||||
operationalStatusList[0].winterSunnyAvg = data.winterSunny === null ? '' : (data.winterSunny.AVG_INFL_AMNT ? data.winterSunny.AVG_INFL_AMNT : 0) + (data.winterSunny.AVG_SUM_FLOW ? data.winterSunny.AVG_SUM_FLOW : 0) + (data.winterSunny.AVG_TP_INFL_WQLT_TP ? data.winterSunny.AVG_TP_INFL_WQLT_TP : 0);
|
||||
operationalStatusList[0].winterSunnyMax = data.winterSunny === null ? '' : (data.winterSunny.MAX_INFL_AMNT ? data.winterSunny.MAX_INFL_AMNT : 0) + (data.winterSunny.MAX_SUM_FLOW ? data.winterSunny.MAX_SUM_FLOW : 0) + (data.winterSunny.MAX_TP_INFL_WQLT_TP ? data.winterSunny.MAX_TP_INFL_WQLT_TP : 0);
|
||||
|
||||
// 연계처리수,지하수유입량
|
||||
const bscFctCd = fcltyCd;
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse;
|
||||
|
||||
const calData = calRainEffectDay(res2.data, 'SUNNY');
|
||||
let chungcunSumFlow = 0;
|
||||
|
||||
let sumSummerChungcunDay = 0;
|
||||
let sumSummerChungcunFlow = 0;
|
||||
|
||||
let sumWinterChungcunDay = 0;
|
||||
let sumWinterChungcunFlow = 0;
|
||||
|
||||
/* let yearSumFlow = 0;
|
||||
let summerSumFlow = 0;
|
||||
let winterSumFlow = 0; */
|
||||
|
||||
calData.forEach((flowItem: FlowDataItem) => {
|
||||
chungcunSumFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
//yearSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
|
||||
if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){
|
||||
sumSummerChungcunDay += 1;
|
||||
sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
//summerSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
}else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){
|
||||
sumWinterChungcunDay += 1;
|
||||
sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
// winterSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
}
|
||||
});
|
||||
|
||||
// 연계처리수
|
||||
/* const avgYearSumFlow = yearSumFlow / calData.length;
|
||||
const avgSummerSumFlow = summerSumFlow / calData.length;
|
||||
const avgWinterSumFlow = winterSumFlow / calData.length; */
|
||||
|
||||
// 지하수유입량
|
||||
const usage = chungcunSumFlow / calData.length;
|
||||
const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay;
|
||||
const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay;
|
||||
|
||||
operationalStatusList[0].groundWaterAvg = Math.round((usage-(usage*0.65*0.8)) * 100) / 100;
|
||||
operationalStatusList[0].groundWaterSummer = Math.round((summerUsage-(summerUsage*0.65*0.8)) * 100) / 100;
|
||||
operationalStatusList[0].groundWaterWinter = Math.round((winterUsage-(winterUsage*0.65*0.8)) * 100) / 100;
|
||||
|
||||
//operationalStatusList[0].groundWaterAvg = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8);
|
||||
//operationalStatusList[0].groundWaterSummer = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8);
|
||||
//operationalStatusList[0].groundWaterWinter = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8);
|
||||
// 지하수
|
||||
operationalStatusList[0].groundWaterAvg = data.yearData.AVG_INFL_AMNT === null ? '' : Number(data.yearData.AVG_INFL_AMNT) - (Number(data.yearData.AVG_INFL_AMNT)*0.65*0.8);
|
||||
operationalStatusList[0].groundWaterSummer = data.summer.AVG_INFL_AMNT === null ? '' : Number(data.summer.AVG_INFL_AMNT) - (Number(data.summer.AVG_INFL_AMNT)*0.65*0.8);
|
||||
operationalStatusList[0].groundWaterWinter = data.winter.AVG_INFL_AMNT === null ? '' : Number(data.winter.AVG_INFL_AMNT) - (Number(data.winter.AVG_INFL_AMNT)*0.65*0.8);
|
||||
|
||||
// 오염물질
|
||||
// RDII 추정 = 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD))
|
||||
@@ -1229,13 +1063,16 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
const summerLowRain = data.summerBod&&data.summerBod.INFO_RN_DAY&&data.summerBod.INFO_RN_DAY!='null'?Number(data.summerBod.INFO_RN_DAY):0;
|
||||
operationalStatusList[0].rdi = winterAvgBod===0?0:summerLowFlow * ((winterAvgBod - summerLowBod) / winterAvgBod);
|
||||
operationalStatusList[0].rdiRain = summerLowRain;
|
||||
dataFormSetting(operationalStatusList[0]);
|
||||
}
|
||||
|
||||
if(operationalStatusList[0] && operationalStatusList[7]){
|
||||
operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : data.yearData && data.yearData.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterAvg) / (data.yearData && data.yearData.AVG_INFL_AMNT ? Number(data.yearData.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%';
|
||||
operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : data.summer && data.summer.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterSummer) / (data.summer && data.summer.AVG_INFL_AMNT ? Number(data.summer.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%';
|
||||
operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : data.winter && data.winter.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterWinter) / (data.winter && data.winter.AVG_INFL_AMNT ? Number(data.winter.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%';
|
||||
operationalStatusList[7].rdi = operationalStatusList[0].rdi === null ? '' : data.summerBod && data.summerBod.INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].rdi) / (data.summerBod&&data.summerBod.INFL_AMNT&&data.summerBod.INFL_AMNT!='null'?Number(data.summerBod.INFL_AMNT):0) * 100) * 10) / 10+'%';
|
||||
console.log(Number(operationalStatusList[0].groundWaterAvg)+' '+Number(data.yearData.AVG_INFL_AMNT));
|
||||
console.log(Number(operationalStatusList[0].groundWaterSummer)+' '+Number(data.summer.AVG_INFL_AMNT));
|
||||
console.log(Number(operationalStatusList[0].groundWaterWinter)+' '+Number(data.winter.AVG_INFL_AMNT));
|
||||
operationalStatusList[7].groundWaterAvg = Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT) * 100;
|
||||
operationalStatusList[7].groundWaterSummer = Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT) * 100;
|
||||
operationalStatusList[7].groundWaterWinter = Number(operationalStatusList[0].groundWaterWinter) / Number(data.winter.AVG_INFL_AMNT) * 100;
|
||||
/* operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : Number(Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT)) * 100;
|
||||
operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : Number(Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT)) * 100;
|
||||
operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : Number(Number(operationalStatusList[0].groundWaterWinter) / Number(data.winter.AVG_INFL_AMNT)) * 100;*/
|
||||
@@ -1243,7 +1080,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
}
|
||||
|
||||
for(let i=1; i<operationalStatusList.length; i++){
|
||||
const txtArray = ['1', 'INFL_AMNT', 'SUM_FLOW', 'RETURN_AMNT', 'EFFL_AMNT', 'INFL_ASSCT_BFR_WQLT_BOD', 'EFFL_WQLT_BOD', 'INFL_ASSCT_BFR_WQLT_TN', 'EFFL_WQLT_TN', 'INFL_ASSCT_BFR_WQLT_TP', 'EFFL_WQLT_TP', 'TP_INFL_WQLT_TP', 'EFFL_WQLT_TP'];
|
||||
const txtArray = ['1', 'INFL_AMNT', 'SUM_FLOW', 'RETURN_AMNT', 'EFFL_AMNT', 'INFL_ASSCT_BFR_WQLT_BOD', 'EFFL_WQLT_BOD', 'INFL_ASSCT_BFR_WQLT_TN', 'EFFL_WQLT_TN', 'INFL_ASSCT_BFR_WQLT_TP', 'EFFL_WQLT_TP', 'INFL_ASSCT_BFR_WQLT_TP', 'EFFL_WQLT_TP'];
|
||||
if(operationalStatusList[i]){
|
||||
if(i < 7){
|
||||
changeValue(operationalStatusList[i], data, txtArray[i]);
|
||||
@@ -1269,8 +1106,8 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
시군구: item.sggNm,
|
||||
주소: item.addr,
|
||||
용량: item.fctCpc,
|
||||
유입BOD: item.inflAssctBfrWqltBod,
|
||||
유입TN: item.inflAssctBfrWqltTn,
|
||||
유입BOD: item.inflAssctAftWqltBod,
|
||||
유입TN: item.inflAssctAftWqltTn,
|
||||
유입TP: item.inflAssctBfrWqltTp,
|
||||
유출BOD: item.efflWqltBod,
|
||||
유출TN: item.efflWqltTn,
|
||||
@@ -1290,20 +1127,12 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
OperationStatus: {
|
||||
...state.OperationStatus,
|
||||
operationalStatusList: operationalStatusList,
|
||||
operationalStatusCount: res.count,
|
||||
isLoadingOperationStatus : false,
|
||||
},
|
||||
operationalStatusCount: res.count
|
||||
}
|
||||
}))
|
||||
},
|
||||
|
||||
searchMainGraph: async (searchYear: string, fcltyCd: string) => {
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
MainGraph: {
|
||||
...state.MainGraph,
|
||||
isLoadingMainGraph: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchMainGraph(searchYear, fcltyCd);
|
||||
if(res == null || res.data == null || res.data.length === 0) {
|
||||
set((state: DashBoardType) => ({
|
||||
@@ -1319,7 +1148,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
chart_efflTn: [],
|
||||
chart_inflBod: [],
|
||||
chart_efflBod: [],
|
||||
isLoadingMainGraph : false,
|
||||
}
|
||||
}));
|
||||
return;
|
||||
@@ -1335,7 +1163,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
const chart_bodRain = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
|
||||
barVal0: item.infoRnDay ?? 0,
|
||||
lineVal0: item.inflAssctBfrWqltBod ?? 0,
|
||||
lineVal0: item.inflAssctAftWqltBod ?? 0,
|
||||
}));
|
||||
|
||||
const chart_inflTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
@@ -1355,7 +1183,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
const chart_inflTn = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
|
||||
val : item.inflAssctBfrWqltTn ?? 0
|
||||
val : item.inflAssctAftWqltTn ?? 0
|
||||
}));
|
||||
|
||||
const chart_efflTn = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
@@ -1365,7 +1193,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
const chart_inflBod = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
|
||||
val : item.inflAssctBfrWqltBod ?? 0
|
||||
val : item.inflAssctAftWqltBod ?? 0
|
||||
}));
|
||||
|
||||
const chart_efflBod = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
@@ -1385,20 +1213,12 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
chart_inflTn: chart_inflTn,
|
||||
chart_efflTn: chart_efflTn,
|
||||
chart_inflBod: chart_inflBod,
|
||||
chart_efflBod: chart_efflBod,
|
||||
isLoadingMainGraph : false,
|
||||
},
|
||||
chart_efflBod: chart_efflBod
|
||||
}
|
||||
}))
|
||||
},
|
||||
|
||||
searchRainManage: async (searchYear: string, fcltyCd: string, isExcel : boolean) => {
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
RainManage: {
|
||||
...state.RainManage,
|
||||
isLoadingRainManage: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchMainGraph(searchYear, fcltyCd);
|
||||
if(res == null || res.data.wqltObjs == null || res.data.wqltObjs.length === 0) {
|
||||
set((state: DashBoardType) => ({
|
||||
@@ -1406,7 +1226,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
RainManage: {
|
||||
...state.RainManage,
|
||||
rainManageList: [],
|
||||
isLoadingRainManage : false,
|
||||
}
|
||||
}));
|
||||
return;
|
||||
@@ -1424,51 +1243,75 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
const dsInflWqltSs: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const dsInflWqltTn: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const dsInflWqltTp: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltToc = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctBfrWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltToc = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const inflAssctAftWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltToc = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltCodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltCod = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const efflWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
|
||||
// 청천시 중 강우영향일인 날짜는 이전의 강우량을 대입해 리스트 수정
|
||||
|
||||
const rainEffectList = calRainEffectDayRainManage(res.data.wqltObjs);
|
||||
// Process the data and create rain management list
|
||||
rainEffectList.forEach((item: RainManageListProps) => {
|
||||
res.data.wqltObjs.forEach((item: RainManageListProps) => {
|
||||
|
||||
// 강우일
|
||||
/*if(Number(item.infoRnDay) < 3){
|
||||
rainDate[1] = Number(rainDate[1] || 0) + 1;
|
||||
inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1;
|
||||
inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[1] = 0;
|
||||
inflAssctAftWqltBodCnt[1] = Number(inflAssctAftWqltBodCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltBod[1] = Number(inflAssctAftWqltBod[1] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[1] = Number(inflAssctAftWqltTocCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltToc[1] = Number(inflAssctAftWqltToc[1] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[1] = Number(inflAssctAftWqltSsCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltSs[1] = Number(inflAssctAftWqltSs[1] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[1] = Number(inflAssctAftWqltTnCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltTn[1] = Number(inflAssctAftWqltTn[1] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[1] = Number(inflAssctAftWqltTpCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltTp[1] = Number(inflAssctAftWqltTp[1] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[1] = Number(efflWqltBodCnt[1] || 0) + 1;
|
||||
efflWqltBod[1] = Number(efflWqltBod[1] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltCodCnt[1] = Number(efflWqltCodCnt[1] || 0) + 1;
|
||||
efflWqltCod[1] = Number(efflWqltCod[1] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[1] = Number(efflWqltSsCnt[1] || 0) + 1;
|
||||
efflWqltSs[1] = Number(efflWqltSs[1] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[1] = Number(efflWqltTnCnt[1] || 0) + 1;
|
||||
efflWqltTn[1] = Number(efflWqltTn[1] || 0) + Number(item.efflWqltTn || 0);
|
||||
efflWqltTpCnt[1] = Number(efflWqltTpCnt[1] || 0) + 1;
|
||||
efflWqltTp[1] = Number(efflWqltTp[1] || 0) + Number(item.efflWqltTp || 0);
|
||||
}*/
|
||||
if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){
|
||||
rainDate[1] = Number(rainDate[1] || 0) + 1;
|
||||
inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1;
|
||||
inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[1] = 0;
|
||||
inflAssctBfrWqltBodCnt[1] = Number(inflAssctBfrWqltBodCnt[1] || 0) + 1;
|
||||
inflAssctBfrWqltBod[1] = Number(inflAssctBfrWqltBod[1] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[1] = Number(inflAssctBfrWqltTocCnt[1] || 0) + 1;
|
||||
inflAssctBfrWqltToc[1] = Number(inflAssctBfrWqltToc[1] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[1] = Number(inflAssctBfrWqltSsCnt[1] || 0) + 1;
|
||||
inflAssctBfrWqltSs[1] = Number(inflAssctBfrWqltSs[1] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[1] = Number(inflAssctBfrWqltTnCnt[1] || 0) + 1;
|
||||
inflAssctBfrWqltTn[1] = Number(inflAssctBfrWqltTn[1] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[1] = Number(inflAssctBfrWqltTpCnt[1] || 0) + 1;
|
||||
inflAssctBfrWqltTp[1] = Number(inflAssctBfrWqltTp[1] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[1] = Number(inflAssctAftWqltBodCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltBod[1] = Number(inflAssctAftWqltBod[1] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[1] = Number(inflAssctAftWqltTocCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltToc[1] = Number(inflAssctAftWqltToc[1] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[1] = Number(inflAssctAftWqltSsCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltSs[1] = Number(inflAssctAftWqltSs[1] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[1] = Number(inflAssctAftWqltTnCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltTn[1] = Number(inflAssctAftWqltTn[1] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[1] = Number(inflAssctAftWqltTpCnt[1] || 0) + 1;
|
||||
inflAssctAftWqltTp[1] = Number(inflAssctAftWqltTp[1] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[1] = Number(efflWqltBodCnt[1] || 0) + 1;
|
||||
efflWqltBod[1] = Number(efflWqltBod[1] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[1] = Number(efflWqltTocCnt[1] || 0) + 1;
|
||||
efflWqltToc[1] = Number(efflWqltToc[1] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[1] = Number(efflWqltCodCnt[1] || 0) + 1;
|
||||
efflWqltCod[1] = Number(efflWqltCod[1] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[1] = Number(efflWqltSsCnt[1] || 0) + 1;
|
||||
efflWqltSs[1] = Number(efflWqltSs[1] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[1] = Number(efflWqltTnCnt[1] || 0) + 1;
|
||||
@@ -1480,20 +1323,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
inflAmtCnt[2] = Number(inflAmtCnt[2] || 0) + 1;
|
||||
inflAmnt[2] = Number(inflAmnt[2] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[2] = 0;
|
||||
inflAssctBfrWqltBodCnt[2] = Number(inflAssctBfrWqltBodCnt[2] || 0) + 1;
|
||||
inflAssctBfrWqltBod[2] = Number(inflAssctBfrWqltBod[2] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[2] = Number(inflAssctBfrWqltTocCnt[2] || 0) + 1;
|
||||
inflAssctBfrWqltToc[2] = Number(inflAssctBfrWqltToc[2] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[2] = Number(inflAssctBfrWqltSsCnt[2] || 0) + 1;
|
||||
inflAssctBfrWqltSs[2] = Number(inflAssctBfrWqltSs[2] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[2] = Number(inflAssctBfrWqltTnCnt[2] || 0) + 1;
|
||||
inflAssctBfrWqltTn[2] = Number(inflAssctBfrWqltTn[2] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[2] = Number(inflAssctBfrWqltTpCnt[2] || 0) + 1;
|
||||
inflAssctBfrWqltTp[2] = Number(inflAssctBfrWqltTp[2] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[2] = Number(inflAssctAftWqltBodCnt[2] || 0) + 1;
|
||||
inflAssctAftWqltBod[2] = Number(inflAssctAftWqltBod[2] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[2] = Number(inflAssctAftWqltTocCnt[2] || 0) + 1;
|
||||
inflAssctAftWqltToc[2] = Number(inflAssctAftWqltToc[2] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[2] = Number(inflAssctAftWqltSsCnt[2] || 0) + 1;
|
||||
inflAssctAftWqltSs[2] = Number(inflAssctAftWqltSs[2] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[2] = Number(inflAssctAftWqltTnCnt[2] || 0) + 1;
|
||||
inflAssctAftWqltTn[2] = Number(inflAssctAftWqltTn[2] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[2] = Number(inflAssctAftWqltTpCnt[2] || 0) + 1;
|
||||
inflAssctAftWqltTp[2] = Number(inflAssctAftWqltTp[2] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[2] = Number(efflWqltBodCnt[2] || 0) + 1;
|
||||
efflWqltBod[2] = Number(efflWqltBod[2] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[2] = Number(efflWqltTocCnt[2] || 0) + 1;
|
||||
efflWqltToc[2] = Number(efflWqltToc[2] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[2] = Number(efflWqltCodCnt[2] || 0) + 1;
|
||||
efflWqltCod[2] = Number(efflWqltCod[2] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[2] = Number(efflWqltSsCnt[2] || 0) + 1;
|
||||
efflWqltSs[2] = Number(efflWqltSs[2] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[2] = Number(efflWqltTnCnt[2] || 0) + 1;
|
||||
@@ -1505,20 +1348,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
inflAmtCnt[3] = Number(inflAmtCnt[3] || 0) + 1;
|
||||
inflAmnt[3] = Number(inflAmnt[3] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[3] = 0;
|
||||
inflAssctBfrWqltBodCnt[3] = Number(inflAssctBfrWqltBodCnt[3] || 0) + 1;
|
||||
inflAssctBfrWqltBod[3] = Number(inflAssctBfrWqltBod[3] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[3] = Number(inflAssctBfrWqltTocCnt[3] || 0) + 1;
|
||||
inflAssctBfrWqltToc[3] = Number(inflAssctBfrWqltToc[3] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[3] = Number(inflAssctBfrWqltSsCnt[3] || 0) + 1;
|
||||
inflAssctBfrWqltSs[3] = Number(inflAssctBfrWqltSs[3] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[3] = Number(inflAssctBfrWqltTnCnt[3] || 0) + 1;
|
||||
inflAssctBfrWqltTn[3] = Number(inflAssctBfrWqltTn[3] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[3] = Number(inflAssctBfrWqltTpCnt[3] || 0) + 1;
|
||||
inflAssctBfrWqltTp[3] = Number(inflAssctBfrWqltTp[3] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[3] = Number(inflAssctAftWqltBodCnt[3] || 0) + 1;
|
||||
inflAssctAftWqltBod[3] = Number(inflAssctAftWqltBod[3] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[3] = Number(inflAssctAftWqltTocCnt[3] || 0) + 1;
|
||||
inflAssctAftWqltToc[3] = Number(inflAssctAftWqltToc[3] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[3] = Number(inflAssctAftWqltSsCnt[3] || 0) + 1;
|
||||
inflAssctAftWqltSs[3] = Number(inflAssctAftWqltSs[3] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[3] = Number(inflAssctAftWqltTnCnt[3] || 0) + 1;
|
||||
inflAssctAftWqltTn[3] = Number(inflAssctAftWqltTn[3] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[3] = Number(inflAssctAftWqltTpCnt[3] || 0) + 1;
|
||||
inflAssctAftWqltTp[3] = Number(inflAssctAftWqltTp[3] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[3] = Number(efflWqltBodCnt[3] || 0) + 1;
|
||||
efflWqltBod[3] = Number(efflWqltBod[3] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[3] = Number(efflWqltTocCnt[3] || 0) + 1;
|
||||
efflWqltToc[3] = Number(efflWqltToc[3] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[3] = Number(efflWqltCodCnt[3] || 0) + 1;
|
||||
efflWqltCod[3] = Number(efflWqltCod[3] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[3] = Number(efflWqltSsCnt[3] || 0) + 1;
|
||||
efflWqltSs[3] = Number(efflWqltSs[3] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[3] = Number(efflWqltTnCnt[3] || 0) + 1;
|
||||
@@ -1530,20 +1373,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
inflAmtCnt[4] = Number(inflAmtCnt[4] || 0) + 1;
|
||||
inflAmnt[4] = Number(inflAmnt[4] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[4] = item.inflAmnt&&Number(item.inflAmnt) !== 0 ? Number(Math.round(Number(item.inflAmnt) / Number(item.fctCpc) * 10) / 10) : 0;
|
||||
inflAssctBfrWqltBodCnt[4] = Number(inflAssctBfrWqltBodCnt[4] || 0) + 1;
|
||||
inflAssctBfrWqltBod[4] = Number(inflAssctBfrWqltBod[4] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[4] = Number(inflAssctBfrWqltTocCnt[4] || 0) + 1;
|
||||
inflAssctBfrWqltToc[4] = Number(inflAssctBfrWqltToc[4] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[4] = Number(inflAssctBfrWqltSsCnt[4] || 0) + 1;
|
||||
inflAssctBfrWqltSs[4] = Number(inflAssctBfrWqltSs[4] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[4] = Number(inflAssctBfrWqltTnCnt[4] || 0) + 1;
|
||||
inflAssctBfrWqltTn[4] = Number(inflAssctBfrWqltTn[5] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[4] = Number(inflAssctBfrWqltTpCnt[4] || 0) + 1;
|
||||
inflAssctBfrWqltTp[4] = Number(inflAssctBfrWqltTp[4] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[4] = Number(inflAssctAftWqltBodCnt[4] || 0) + 1;
|
||||
inflAssctAftWqltBod[4] = Number(inflAssctAftWqltBod[4] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[4] = Number(inflAssctAftWqltTocCnt[4] || 0) + 1;
|
||||
inflAssctAftWqltToc[4] = Number(inflAssctAftWqltToc[4] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[4] = Number(inflAssctAftWqltSsCnt[4] || 0) + 1;
|
||||
inflAssctAftWqltSs[4] = Number(inflAssctAftWqltSs[4] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[4] = Number(inflAssctAftWqltTnCnt[4] || 0) + 1;
|
||||
inflAssctAftWqltTn[4] = Number(inflAssctAftWqltTn[5] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[4] = Number(inflAssctAftWqltTpCnt[4] || 0) + 1;
|
||||
inflAssctAftWqltTp[4] = Number(inflAssctAftWqltTp[4] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[4] = Number(efflWqltBodCnt[4] || 0) + 1;
|
||||
efflWqltBod[4] = Number(efflWqltBod[4] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[4] = Number(efflWqltTocCnt[4] || 0) + 1;
|
||||
efflWqltToc[4] = Number(efflWqltToc[4] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[4] = Number(efflWqltCodCnt[4] || 0) + 1;
|
||||
efflWqltCod[4] = Number(efflWqltCod[4] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[4] = Number(efflWqltSsCnt[4] || 0) + 1;
|
||||
efflWqltSs[4] = Number(efflWqltSs[4] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[4] = Number(efflWqltTnCnt[5] || 0) + 1;
|
||||
@@ -1555,20 +1398,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
inflAmtCnt[5] = Number(inflAmtCnt[5] || 0) + 1;
|
||||
inflAmnt[5] = Number(inflAmnt[5] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[5] = 0;
|
||||
inflAssctBfrWqltBodCnt[5] = Number(inflAssctBfrWqltBodCnt[5] || 0) + 1;
|
||||
inflAssctBfrWqltBod[5] = Number(inflAssctBfrWqltBod[5] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[5] = Number(inflAssctBfrWqltTocCnt[5] || 0) + 1;
|
||||
inflAssctBfrWqltToc[5] = Number(inflAssctBfrWqltToc[5] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[5] = Number(inflAssctBfrWqltSsCnt[5] || 0) + 1;
|
||||
inflAssctBfrWqltSs[5] = Number(inflAssctBfrWqltSs[5] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[5] = Number(inflAssctBfrWqltTnCnt[5] || 0) + 1;
|
||||
inflAssctBfrWqltTn[5] = Number(inflAssctBfrWqltTn[5] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[5] = Number(inflAssctBfrWqltTpCnt[5] || 0) + 1;
|
||||
inflAssctBfrWqltTp[5] = Number(inflAssctBfrWqltTp[5] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[5] = Number(inflAssctAftWqltBodCnt[5] || 0) + 1;
|
||||
inflAssctAftWqltBod[5] = Number(inflAssctAftWqltBod[5] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[5] = Number(inflAssctAftWqltTocCnt[5] || 0) + 1;
|
||||
inflAssctAftWqltToc[5] = Number(inflAssctAftWqltToc[5] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[5] = Number(inflAssctAftWqltSsCnt[5] || 0) + 1;
|
||||
inflAssctAftWqltSs[5] = Number(inflAssctAftWqltSs[5] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[5] = Number(inflAssctAftWqltTnCnt[5] || 0) + 1;
|
||||
inflAssctAftWqltTn[5] = Number(inflAssctAftWqltTn[5] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[5] = Number(inflAssctAftWqltTpCnt[5] || 0) + 1;
|
||||
inflAssctAftWqltTp[5] = Number(inflAssctAftWqltTp[5] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[5] = Number(efflWqltBodCnt[5] || 0) + 1;
|
||||
efflWqltBod[5] = Number(efflWqltBod[5] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[5] = Number(efflWqltTocCnt[5] || 0) + 1;
|
||||
efflWqltToc[5] = Number(efflWqltToc[5] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[5] = Number(efflWqltCodCnt[5] || 0) + 1;
|
||||
efflWqltCod[5] = Number(efflWqltCod[5] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[5] = Number(efflWqltSsCnt[5] || 0) + 1;
|
||||
efflWqltSs[5] = Number(efflWqltSs[5] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[5] = Number(efflWqltTnCnt[5] || 0) + 1;
|
||||
@@ -1580,20 +1423,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
inflAmtCnt[6] = Number(inflAmtCnt[6] || 0) + 1;
|
||||
inflAmnt[6] = Number(inflAmnt[6] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[6] = 0;
|
||||
inflAssctBfrWqltBodCnt[6] = Number(inflAssctBfrWqltBodCnt[6] || 0) + 1;
|
||||
inflAssctBfrWqltBod[6] = Number(inflAssctBfrWqltBod[6] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[6] = Number(inflAssctBfrWqltTocCnt[6] || 0) + 1;
|
||||
inflAssctBfrWqltToc[6] = Number(inflAssctBfrWqltToc[6] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[6] = Number(inflAssctBfrWqltSsCnt[6] || 0) + 1;
|
||||
inflAssctBfrWqltSs[6] = Number(inflAssctBfrWqltSs[6] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[6] = Number(inflAssctBfrWqltTnCnt[6] || 0) + 1;
|
||||
inflAssctBfrWqltTn[6] = Number(inflAssctBfrWqltTn[6] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[6] = Number(inflAssctBfrWqltTpCnt[6] || 0) + 1;
|
||||
inflAssctBfrWqltTp[6] = Number(inflAssctBfrWqltTp[6] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[6] = Number(inflAssctAftWqltBodCnt[6] || 0) + 1;
|
||||
inflAssctAftWqltBod[6] = Number(inflAssctAftWqltBod[6] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[6] = Number(inflAssctAftWqltTocCnt[6] || 0) + 1;
|
||||
inflAssctAftWqltToc[6] = Number(inflAssctAftWqltToc[6] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[6] = Number(inflAssctAftWqltSsCnt[6] || 0) + 1;
|
||||
inflAssctAftWqltSs[6] = Number(inflAssctAftWqltSs[6] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[6] = Number(inflAssctAftWqltTnCnt[6] || 0) + 1;
|
||||
inflAssctAftWqltTn[6] = Number(inflAssctAftWqltTn[6] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[6] = Number(inflAssctAftWqltTpCnt[6] || 0) + 1;
|
||||
inflAssctAftWqltTp[6] = Number(inflAssctAftWqltTp[6] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[6] = Number(efflWqltBodCnt[6] || 0) + 1;
|
||||
efflWqltBod[6] = Number(efflWqltBod[6] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[6] = Number(efflWqltTocCnt[6] || 0) + 1;
|
||||
efflWqltToc[6] = Number(efflWqltToc[6] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[6] = Number(efflWqltCodCnt[6] || 0) + 1;
|
||||
efflWqltCod[6] = Number(efflWqltCod[6] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[6] = Number(efflWqltSsCnt[6] || 0) + 1;
|
||||
efflWqltSs[6] = Number(efflWqltSs[6] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[6] = Number(efflWqltTnCnt[6] || 0) + 1;
|
||||
@@ -1605,20 +1448,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
inflAmtCnt[7] = Number(inflAmtCnt[7] || 0) + 1;
|
||||
inflAmnt[7] = Number(inflAmnt[7] || 0) + Number(item.inflAmnt || 0);
|
||||
fcltyCpct[7] = 0;
|
||||
inflAssctBfrWqltBodCnt[7] = Number(inflAssctBfrWqltBodCnt[7] || 0) + 1;
|
||||
inflAssctBfrWqltBod[7] = Number(inflAssctBfrWqltBod[7] || 0) + Number(item.inflAssctBfrWqltBod || 0);
|
||||
inflAssctBfrWqltTocCnt[7] = Number(inflAssctBfrWqltTocCnt[7] || 0) + 1;
|
||||
inflAssctBfrWqltToc[7] = Number(inflAssctBfrWqltToc[7] || 0) + Number(item.inflAssctBfrWqltToc || 0);
|
||||
inflAssctBfrWqltSsCnt[7] = Number(inflAssctBfrWqltSsCnt[7] || 0) + 1;
|
||||
inflAssctBfrWqltSs[7] = Number(inflAssctBfrWqltSs[7] || 0) + Number(item.inflAssctBfrWqltSs || 0);
|
||||
inflAssctBfrWqltTnCnt[7] = Number(inflAssctBfrWqltTnCnt[7] || 0) + 1;
|
||||
inflAssctBfrWqltTn[7] = Number(inflAssctBfrWqltTn[7] || 0) + Number(item.inflAssctBfrWqltTn || 0);
|
||||
inflAssctBfrWqltTpCnt[7] = Number(inflAssctBfrWqltTpCnt[7] || 0) + 1;
|
||||
inflAssctBfrWqltTp[7] = Number(inflAssctBfrWqltTp[7] || 0) + Number(item.inflAssctBfrWqltTp || 0);
|
||||
inflAssctAftWqltBodCnt[7] = Number(inflAssctAftWqltBodCnt[7] || 0) + 1;
|
||||
inflAssctAftWqltBod[7] = Number(inflAssctAftWqltBod[7] || 0) + Number(item.inflAssctAftWqltBod || 0);
|
||||
inflAssctAftWqltTocCnt[7] = Number(inflAssctAftWqltTocCnt[7] || 0) + 1;
|
||||
inflAssctAftWqltToc[7] = Number(inflAssctAftWqltToc[7] || 0) + Number(item.inflAssctAftWqltToc || 0);
|
||||
inflAssctAftWqltSsCnt[7] = Number(inflAssctAftWqltSsCnt[7] || 0) + 1;
|
||||
inflAssctAftWqltSs[7] = Number(inflAssctAftWqltSs[7] || 0) + Number(item.inflAssctAftWqltSs || 0);
|
||||
inflAssctAftWqltTnCnt[7] = Number(inflAssctAftWqltTnCnt[7] || 0) + 1;
|
||||
inflAssctAftWqltTn[7] = Number(inflAssctAftWqltTn[7] || 0) + Number(item.inflAssctAftWqltTn || 0);
|
||||
inflAssctAftWqltTpCnt[7] = Number(inflAssctAftWqltTpCnt[7] || 0) + 1;
|
||||
inflAssctAftWqltTp[7] = Number(inflAssctAftWqltTp[7] || 0) + Number(item.inflAssctAftWqltTp || 0);
|
||||
efflWqltBodCnt[7] = Number(efflWqltBodCnt[7] || 0) + 1;
|
||||
efflWqltBod[7] = Number(efflWqltBod[7] || 0) + Number(item.efflWqltBod || 0);
|
||||
efflWqltTocCnt[7] = Number(efflWqltTocCnt[7] || 0) + 1;
|
||||
efflWqltToc[7] = Number(efflWqltToc[7] || 0) + Number(item.efflWqltToc || 0);
|
||||
efflWqltCodCnt[7] = Number(efflWqltCodCnt[7] || 0) + 1;
|
||||
efflWqltCod[7] = Number(efflWqltCod[7] || 0) + Number(item.efflWqltCod || 0);
|
||||
efflWqltSsCnt[7] = Number(efflWqltSsCnt[7] || 0) + 1;
|
||||
efflWqltSs[7] = Number(efflWqltSs[7] || 0) + Number(item.efflWqltSs || 0);
|
||||
efflWqltTnCnt[7] = Number(efflWqltTnCnt[7] || 0) + 1;
|
||||
@@ -1696,13 +1539,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
for(let idx=0; idx<inflAmnt.length; idx++){
|
||||
inflAmnt[idx] = calculateAverage(Number(inflAmnt[idx]), Number(inflAmtCnt[idx]));
|
||||
inflAssctBfrWqltBod[idx] = calculateAverage(Number(inflAssctBfrWqltBod[idx]), Number(inflAssctBfrWqltBodCnt[idx]));
|
||||
inflAssctBfrWqltToc[idx] = calculateAverage(Number(inflAssctBfrWqltToc[idx]), Number(inflAssctBfrWqltTocCnt[idx]));
|
||||
inflAssctBfrWqltSs[idx] = calculateAverage(Number(inflAssctBfrWqltSs[idx]), Number(inflAssctBfrWqltSsCnt[idx]));
|
||||
inflAssctBfrWqltTn[idx] = calculateAverage(Number(inflAssctBfrWqltTn[idx]), Number(inflAssctBfrWqltTnCnt[idx]));
|
||||
inflAssctBfrWqltTp[idx] = calculateAverage(Number(inflAssctBfrWqltTp[idx]), Number(inflAssctBfrWqltTpCnt[idx]));
|
||||
inflAssctAftWqltBod[idx] = calculateAverage(Number(inflAssctAftWqltBod[idx]), Number(inflAssctAftWqltBodCnt[idx]));
|
||||
inflAssctAftWqltToc[idx] = calculateAverage(Number(inflAssctAftWqltToc[idx]), Number(inflAssctAftWqltTocCnt[idx]));
|
||||
inflAssctAftWqltSs[idx] = calculateAverage(Number(inflAssctAftWqltSs[idx]), Number(inflAssctAftWqltSsCnt[idx]));
|
||||
inflAssctAftWqltTn[idx] = calculateAverage(Number(inflAssctAftWqltTn[idx]), Number(inflAssctAftWqltTnCnt[idx]));
|
||||
inflAssctAftWqltTp[idx] = calculateAverage(Number(inflAssctAftWqltTp[idx]), Number(inflAssctAftWqltTpCnt[idx]));
|
||||
efflWqltBod[idx] = calculateAverage(Number(efflWqltBod[idx]), Number(efflWqltBodCnt[idx]));
|
||||
efflWqltToc[idx] = calculateAverage(Number(efflWqltToc[idx]), Number(efflWqltTocCnt[idx]));
|
||||
efflWqltCod[idx] = calculateAverage(Number(efflWqltCod[idx]), Number(efflWqltCodCnt[idx]));
|
||||
efflWqltSs[idx] = calculateAverage(Number(efflWqltSs[idx]), Number(efflWqltSsCnt[idx]));
|
||||
efflWqltTn[idx] = calculateAverage(Number(efflWqltTn[idx]), Number(efflWqltTnCnt[idx]));
|
||||
efflWqltTp[idx] = calculateAverage(Number(efflWqltTp[idx]), Number(efflWqltTpCnt[idx]));
|
||||
@@ -1715,13 +1558,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
inflAmnt[0] = calculateAverage(calculateTotal(inflAmnt), dataIsCount);
|
||||
fcltyCpct[0] = calculateTotal(fcltyCpct);
|
||||
inflAssctBfrWqltBod[0] = Number((calculateTotal(inflAssctBfrWqltBod)/7).toFixed(1));
|
||||
inflAssctBfrWqltToc[0] = Number((calculateTotal(inflAssctBfrWqltToc)/7).toFixed(1));
|
||||
inflAssctBfrWqltSs[0] = Number((calculateTotal(inflAssctBfrWqltSs)/7).toFixed(1));
|
||||
inflAssctBfrWqltTn[0] = Number((calculateTotal(inflAssctBfrWqltTn)/7).toFixed(3));
|
||||
inflAssctBfrWqltTp[0] = Number((calculateTotal(inflAssctBfrWqltTp)/7).toFixed(3));
|
||||
inflAssctAftWqltBod[0] = Number((calculateTotal(inflAssctAftWqltBod)/7).toFixed(1));
|
||||
inflAssctAftWqltToc[0] = Number((calculateTotal(inflAssctAftWqltToc)/7).toFixed(1));
|
||||
inflAssctAftWqltSs[0] = Number((calculateTotal(inflAssctAftWqltSs)/7).toFixed(1));
|
||||
inflAssctAftWqltTn[0] = Number((calculateTotal(inflAssctAftWqltTn)/7).toFixed(3));
|
||||
inflAssctAftWqltTp[0] = Number((calculateTotal(inflAssctAftWqltTp)/7).toFixed(3));
|
||||
efflWqltBod[0] = Number((calculateTotal(efflWqltBod)/7).toFixed(1));
|
||||
efflWqltToc[0] = Number((calculateTotal(efflWqltToc)/7).toFixed(1));
|
||||
efflWqltCod[0] = Number((calculateTotal(efflWqltCod)/7).toFixed(1));
|
||||
efflWqltSs[0] = Number((calculateTotal(efflWqltSs as number[])/7).toFixed(1));
|
||||
efflWqltTn[0] = Number((calculateTotal(efflWqltTn as number[])/7).toFixed(3));
|
||||
efflWqltTp[0] = Number((calculateTotal(efflWqltTp as number[])/7).toFixed(3));
|
||||
@@ -1738,13 +1581,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
dsInflWqltSs: dsInflWqltSs[index] ? Number(dsInflWqltSs[index].toFixed(1)) : '',
|
||||
dsInflWqltTn: dsInflWqltTn[index] ? dsInflWqltTn[index].toFixed(3) : '',
|
||||
dsInflWqltTp: dsInflWqltTp[index] ? dsInflWqltTp[index].toFixed(3) : '',
|
||||
inflAssctBfrWqltBod: inflAssctBfrWqltBod[index] ? Number(inflAssctBfrWqltBod[index].toFixed(1)) : '',
|
||||
inflAssctBfrWqltToc: inflAssctBfrWqltToc[index] ? Number(inflAssctBfrWqltToc[index].toFixed(1)) : '',
|
||||
inflAssctBfrWqltSs: inflAssctBfrWqltSs[index] ? Number(inflAssctBfrWqltSs[index].toFixed(1)) : '',
|
||||
inflAssctBfrWqltTn: inflAssctBfrWqltTn[index] ? inflAssctBfrWqltTn[index].toFixed(3) : '',
|
||||
inflAssctBfrWqltTp: inflAssctBfrWqltTp[index] ? inflAssctBfrWqltTp[index].toFixed(3) : '',
|
||||
inflAssctAftWqltBod: inflAssctAftWqltBod[index] ? Number(inflAssctAftWqltBod[index].toFixed(1)) : '',
|
||||
inflAssctAftWqltToc: inflAssctAftWqltToc[index] ? Number(inflAssctAftWqltToc[index].toFixed(1)) : '',
|
||||
inflAssctAftWqltSs: inflAssctAftWqltSs[index] ? Number(inflAssctAftWqltSs[index].toFixed(1)) : '',
|
||||
inflAssctAftWqltTn: inflAssctAftWqltTn[index] ? inflAssctAftWqltTn[index].toFixed(3) : '',
|
||||
inflAssctAftWqltTp: inflAssctAftWqltTp[index] ? inflAssctAftWqltTp[index].toFixed(3) : '',
|
||||
efflWqltBod: efflWqltBod[index] ? Number(efflWqltBod[index].toFixed(1)) : '',
|
||||
efflWqltToc: efflWqltToc[index] ? Number(efflWqltToc[index].toFixed(1)) : '',
|
||||
efflWqltCod: efflWqltCod[index] ? Number(efflWqltCod[index].toFixed(1)) : '',
|
||||
efflWqltSs: efflWqltSs[index] ? Number(efflWqltSs[index].toFixed(1)) : '',
|
||||
efflWqltTn: efflWqltTn[index] ? efflWqltTn[index].toFixed(3) : '',
|
||||
efflWqltTp: efflWqltTp[index] ? efflWqltTp[index].toFixed(3) : ''
|
||||
@@ -1764,13 +1607,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
설계유입수질SS: item.dsInflWqltSs ? Number(Number(item.dsInflWqltSs).toFixed(1)) : '',
|
||||
설계유입수질TN: item.dsInflWqltTn ? Number(item.dsInflWqltTn).toFixed(3) : '',
|
||||
설계유입수질TP: item.dsInflWqltTp ? Number(item.dsInflWqltTp).toFixed(3) : '',
|
||||
유입수질BOD: item.inflAssctBfrWqltBod ? Number(Number(item.inflAssctBfrWqltBod).toFixed(1)) : '',
|
||||
유입수질TOC: item.inflAssctBfrWqltToc ? Number(Number(item.inflAssctBfrWqltToc).toFixed(1)) : '',
|
||||
유입수질SS: item.inflAssctBfrWqltSs ? Number(Number(item.inflAssctBfrWqltSs).toFixed(1)) : '',
|
||||
유입수질TN: item.inflAssctBfrWqltTn ? Number(item.inflAssctBfrWqltTn).toFixed(3) : '',
|
||||
유입수질TP: item.inflAssctBfrWqltTp ? Number(item.inflAssctBfrWqltTp).toFixed(3) : '',
|
||||
유입수질BOD: item.inflAssctAftWqltBod ? Number(Number(item.inflAssctAftWqltBod).toFixed(1)) : '',
|
||||
유입수질TOC: item.inflAssctAftWqltToc ? Number(Number(item.inflAssctAftWqltToc).toFixed(1)) : '',
|
||||
유입수질SS: item.inflAssctAftWqltSs ? Number(Number(item.inflAssctAftWqltSs).toFixed(1)) : '',
|
||||
유입수질TN: item.inflAssctAftWqltTn ? Number(item.inflAssctAftWqltTn).toFixed(3) : '',
|
||||
유입수질TP: item.inflAssctAftWqltTp ? Number(item.inflAssctAftWqltTp).toFixed(3) : '',
|
||||
방류수질BOD: item.efflWqltBod ? Number(Number(item.efflWqltBod).toFixed(1)) : '',
|
||||
방류수질TOC: item.efflWqltToc ? Number(Number(item.efflWqltToc).toFixed(1)) : '',
|
||||
방류수질TOC: item.efflWqltCod ? Number(Number(item.efflWqltCod).toFixed(1)) : '',
|
||||
방류수질SS: item.efflWqltSs ? Number(Number(item.efflWqltSs).toFixed(1)) : '',
|
||||
방류수질TN: item.efflWqltTn ? Number(item.efflWqltTn).toFixed(3) : '',
|
||||
방류수질TP: item.efflWqltTp ? Number(item.efflWqltTp).toFixed(3) : '',
|
||||
@@ -1784,13 +1627,61 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
...state.RainManage,
|
||||
rainManageList: filteredData as RainManageListProps[],
|
||||
excelList: excelList,
|
||||
isLoadingRainManage : false,
|
||||
} : {
|
||||
...state.RainManage,
|
||||
rainManageList: filteredData as RainManageListProps[],
|
||||
isLoadingRainManage : false,
|
||||
}
|
||||
}));
|
||||
},
|
||||
|
||||
searchDrainageEquipment: async (searchYear: string, fcltyCd: string, isExcel : boolean) => {
|
||||
await fetchDrainageEquipment(searchYear, fcltyCd);
|
||||
/* if(res == null || res.data.wqltObjs == null || res.data.wqltObjs.length === 0) {
|
||||
set((state: DashBoardType) => ({
|
||||
...state.RainManage,
|
||||
rainManageList: [],
|
||||
}));
|
||||
return;
|
||||
} */
|
||||
|
||||
/* if(isExcel){
|
||||
res.data.wqltObjs.forEach((item) => {
|
||||
excelList.push({
|
||||
강우량: item.rainItem,
|
||||
강우조건비율: item.rainRate || 0,
|
||||
일수: item.rainDay || 0,
|
||||
유입유량: item.inflAmnt || 0,
|
||||
시설용량대비: item.fctCpc || 0,
|
||||
설계유입수질BOD: item.dsInflWqltBod || 0,
|
||||
설계유입수질TOC: item.dsInflWqltCod || 0,
|
||||
설계유입수질SS: item.dsInflWqltSs || 0,
|
||||
설계유입수질TN: item.dsInflWqltTn || 0,
|
||||
설계유입수질TP: item.dsInflWqltTp || 0,
|
||||
유입수질BOD: item.inflAssctAftWqltBod || 0,
|
||||
유입수질COD: item.inflAssctAftWqltToc || 0,
|
||||
유입수질SS: item.inflAssctAftWqltSs || 0,
|
||||
유입수질TN: item.inflAssctAftWqltTn || 0,
|
||||
유입수질TP: item.inflAssctAftWqltTp || 0,
|
||||
방류수질BOD: item.efflWqltBod || 0,
|
||||
방류수질COD: item.efflWqltCod || 0,
|
||||
방류수질SS: item.efflWqltSs || 0,
|
||||
방류수질TN: item.efflWqltTn || 0,
|
||||
방류수질TP: item.efflWqltTp || 0,
|
||||
});
|
||||
});
|
||||
} */
|
||||
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
DrainageEquipment: isExcel ? {
|
||||
...state.DrainageEquipment,
|
||||
drainageEquipmentList: drainageEquipmentList,
|
||||
drainageEquipmentExcelList: [],
|
||||
} : {
|
||||
...state.DrainageEquipment,
|
||||
drainageEquipmentList: drainageEquipmentList,
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,6 @@ export type FacilityPrecipitationType = {
|
||||
facilityPrecipitation: FacilityPrecipitationProps[];
|
||||
excelList: ExcelType[];
|
||||
facilityPrecipitationCount: number;
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
PrecipitationDetail : {
|
||||
@@ -240,8 +239,7 @@ export const facilityPrecipitationInitState: FacilityPrecipitationType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
facilityPrecipitation : facilityPrecipitation,
|
||||
excelList : [],
|
||||
facilityPrecipitationCount : 0,
|
||||
isLoading : true,
|
||||
facilityPrecipitationCount : 0
|
||||
},
|
||||
|
||||
PrecipitationDetail : {
|
||||
@@ -256,14 +254,6 @@ export type FacilityPrecipitationStore = FacilityPrecipitationType & FacilityPre
|
||||
export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitationType) => FacilityPrecipitationType) => void)=>FacilityPrecipitationActions=(set: (fn: (state: FacilityPrecipitationType) => FacilityPrecipitationType) => void) => {
|
||||
return {
|
||||
searchFacilityPrecipitationList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: FacilityPrecipitationType) => ({
|
||||
...state,
|
||||
FacilityPrecipitation: {
|
||||
...state.FacilityPrecipitation,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
|
||||
const res = await fetchFacilityPrecipitationList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const data = res.data;
|
||||
const excelDownList: ExcelType[] = [];
|
||||
@@ -303,15 +293,13 @@ export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitatio
|
||||
...state.FacilityPrecipitation,
|
||||
facilityPrecipitation: res.data,
|
||||
facilityPrecipitationCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.FacilityPrecipitation,
|
||||
excelList: excelDownList,
|
||||
isLoading : false,
|
||||
},
|
||||
PrecipitationDetail:{
|
||||
...state.PrecipitationDetail,
|
||||
gridListPrecipitationDetail: res.detailData,
|
||||
gridListPrecipitationDetail: res.detailData
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -21,16 +21,12 @@ export interface FacilityWaterQltyProps {
|
||||
sggNm: string,
|
||||
addr: string,
|
||||
fctCpc: number,
|
||||
inflAssctBfrWqltBod: string | '',
|
||||
inflAssctAftWqltBod: string | '',
|
||||
inflAssctBfrWqltToc: string | '',
|
||||
inflAssctAftWqltToc: string | '',
|
||||
inflAssctBfrWqltSs: string | '',
|
||||
inflAssctAftWqltSs: string | '',
|
||||
inflAssctBfrWqltTn: string | '',
|
||||
inflAssctAftWqltTn: string | '',
|
||||
inflAssctBfrWqltTp: string | '',
|
||||
inflAssctAftWqltTp: string | '',
|
||||
inflAssctBfrWqltTp: string | '',
|
||||
efflWqltBod: string | '',
|
||||
efflWqltToc: string | '',
|
||||
efflWqltSs: string | '',
|
||||
@@ -131,11 +127,11 @@ const upHeadList1: TableUpperProps[] = [
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0 },
|
||||
{ id: "A", title: "유입", colSpan: 5, row: 0 },
|
||||
{ id: "B", title: "방류", colSpan: 5, row: 0 },
|
||||
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1 },
|
||||
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1 },
|
||||
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 },
|
||||
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1 },
|
||||
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 },
|
||||
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1 },
|
||||
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1 },
|
||||
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 },
|
||||
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1 },
|
||||
{ id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 },
|
||||
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1 },
|
||||
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1 },
|
||||
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1 },
|
||||
@@ -155,11 +151,11 @@ const upHeadList2: TableUpperProps[] = [
|
||||
{ id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2 },
|
||||
{ id: "A", title: "유입", colSpan: 5, row: 0 },
|
||||
{ id: "B", title: "방류", colSpan: 5, row: 0 },
|
||||
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 },
|
||||
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
|
||||
@@ -183,11 +179,11 @@ const upHeadList3: TableUpperProps[] = [
|
||||
{ id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2 },
|
||||
{ id: "A", title: "유입", colSpan: 5, row: 0 },
|
||||
{ id: "B", title: "방류", colSpan: 5, row: 0 },
|
||||
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
|
||||
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 },
|
||||
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
|
||||
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
|
||||
@@ -201,10 +197,10 @@ const upHeadList3: TableUpperProps[] = [
|
||||
// 처리시설 수질현황 헤더(모달-연간)
|
||||
const upHeadListModalYear: TableUpperProps[] = [
|
||||
{ id: "msrDt", title: "날짜" },
|
||||
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe1", upSequnce: 1, align: "right" },
|
||||
{ id: "inflAssctBfrWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" },
|
||||
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" },
|
||||
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" },
|
||||
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe1", upSequnce: 1, align: "right" },
|
||||
{ id: "inflAssctAftWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" },
|
||||
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" },
|
||||
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" },
|
||||
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" },
|
||||
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe2", upSequnce: 1, align: "right" },
|
||||
{ id: "efflWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" },
|
||||
@@ -292,7 +288,6 @@ export type FacilityWaterQltyType = {
|
||||
upHeadList1: TableUpperProps[];
|
||||
upHeadList2: TableUpperProps[];
|
||||
upHeadList3: TableUpperProps[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
FacilityWaterQltyModal: {
|
||||
@@ -316,7 +311,6 @@ export const facilityWaterQltyInitState: FacilityWaterQltyType = {
|
||||
facilityWaterQltyCount: 0,
|
||||
facilityWaterQltyList: [],
|
||||
excelList: [],
|
||||
isLoading: true,
|
||||
isInit: false,
|
||||
mainLabelArray: mainLabelArray,
|
||||
upHeadList1: upHeadList1,
|
||||
@@ -367,8 +361,8 @@ export type FacilityWaterQltyActions = {
|
||||
* @returns : 없음
|
||||
* @description : 시설수질리스트 타입의 데이터를 표현 방식으로 바꿔주는 함수
|
||||
* - msrDt : YYYY-MM-DD 형식으로 변환
|
||||
* - inflAssctBfrWqltBod : 소수점 1자리까지 표현
|
||||
* - inflAssctBfrWqltTn : 소수점 1자리까지 표현
|
||||
* - inflAssctAftWqltBod : 소수점 1자리까지 표현
|
||||
* - inflAssctAftWqltTn : 소수점 1자리까지 표현
|
||||
* - inflAssctBfrWqltTp : 소수점 1자리까지 표현
|
||||
* - efflWqltBod : 소수점 2자리까지 표현
|
||||
* - efflWqltTn : 소수점 2자리까지 표현
|
||||
@@ -397,48 +391,41 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
* @param fcltyNm : 시설명
|
||||
*/
|
||||
searchFacilityWaterQltyList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: FacilityWaterQltyType) => ({
|
||||
...state,
|
||||
FacilityWaterQltyMain: {
|
||||
...state.FacilityWaterQltyMain,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const rtnData = res.data.map(item => {
|
||||
dataFormSetting(item)
|
||||
if(item.inflAssctBfrWqltTn) {
|
||||
item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000)/1000).toFixed(3);
|
||||
if(item.inflAssctAftWqltTn) {
|
||||
item.inflAssctAftWqltTn = Number(Math.round(Number(item.inflAssctAftWqltTn) * 1000)/1000).toFixed(3);
|
||||
}
|
||||
if(item.efflWqltTn){
|
||||
item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3);
|
||||
}
|
||||
if(item.inflAssctBfrWqltTp){
|
||||
item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000)/1000).toFixed(3);
|
||||
if(item.inflAssctAftWqltTp){
|
||||
item.inflAssctAftWqltTp = Number(Math.round(Number(item.inflAssctAftWqltTp) * 1000)/1000).toFixed(3);
|
||||
}
|
||||
if(item.efflWqltTp){
|
||||
item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3);
|
||||
}
|
||||
if(item.inflAssctBfrWqltToc){
|
||||
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltToc){
|
||||
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltToc){
|
||||
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.inflAssctBfrWqltBod){
|
||||
item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltBod){
|
||||
item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltBod){
|
||||
item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.inflAssctBfrWqltSs){
|
||||
item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltSs){
|
||||
item.inflAssctAftWqltSs = Number(Math.round(Number(item.inflAssctAftWqltSs) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltSs){
|
||||
item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.inflAssctBfrWqltToc){
|
||||
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltToc){
|
||||
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltToc){
|
||||
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
|
||||
@@ -463,11 +450,11 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
시설이름: item.bscFctNm,
|
||||
주소: item.addr,
|
||||
용량: item.fctCpc,
|
||||
유입BOD: item.inflAssctBfrWqltBod,
|
||||
유입TOC: item.inflAssctBfrWqltToc,
|
||||
유입SS: item.inflAssctBfrWqltSs,
|
||||
유입TN: item.inflAssctBfrWqltTn,
|
||||
유입TP: item.inflAssctBfrWqltTp,
|
||||
유입BOD: item.inflAssctAftWqltBod,
|
||||
유입TOC: item.inflAssctAftWqltToc,
|
||||
유입SS: item.inflAssctAftWqltSs,
|
||||
유입TN: item.inflAssctAftWqltTn,
|
||||
유입TP: item.inflAssctAftWqltTp,
|
||||
유출BOD: item.efflWqltBod,
|
||||
유출TOC: item.efflWqltToc,
|
||||
유출SS: item.efflWqltSs,
|
||||
@@ -489,12 +476,10 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
...state.FacilityWaterQltyMain,
|
||||
facilityWaterQltyList: rtnData,
|
||||
facilityWaterQltyCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.FacilityWaterQltyMain,
|
||||
excelList: excelDownList,
|
||||
isLoading : false,
|
||||
},
|
||||
}
|
||||
}))
|
||||
},
|
||||
|
||||
@@ -571,54 +556,47 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
return;
|
||||
}
|
||||
|
||||
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용
|
||||
const tmpData:FacilityWaterQltyProps[] = [];
|
||||
|
||||
const data = res.data.wqltObjs;
|
||||
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
const item = data[idx];
|
||||
if(item){
|
||||
if(item.infoRnDay && Number(item.infoRnDay) > 3) {
|
||||
item.rainEffectDay = 1;
|
||||
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용
|
||||
for(let idx = 0; idx < res.data.wqltObjs.length; idx++) {
|
||||
const item = res.data.wqltObjs[idx];
|
||||
if (!item) continue;
|
||||
|
||||
const rainDay = Number(item.infoRnDay) >= 3 ? 1 : 0;
|
||||
let rainEffectDay = 0;
|
||||
|
||||
if(idx < res.data.wqltObjs.length - 2) {
|
||||
if(rainDay == 1) {
|
||||
rainEffectDay = 1;
|
||||
} else {
|
||||
item.rainEffectDay = 0;
|
||||
if(idx >= 2) {
|
||||
const prevItem1 = res.data.wqltObjs[idx-1];
|
||||
const prevItem2 = res.data.wqltObjs[idx-2];
|
||||
if((prevItem1 && Number(prevItem1.infoRnDay) >= 3) || (prevItem2 && Number(prevItem2.infoRnDay) >= 3)) {
|
||||
rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(idx < res.data.wqltObjs.length - 1) {
|
||||
const nextItem = res.data.wqltObjs[idx+1];
|
||||
if(rainDay == 1 || (nextItem && Number(nextItem.infoRnDay) >= 3)) {
|
||||
rainEffectDay = 1;
|
||||
}
|
||||
} else {
|
||||
rainEffectDay = rainDay;
|
||||
}
|
||||
|
||||
tmpData.push({
|
||||
...item,
|
||||
rainEffectDay: rainEffectDay,
|
||||
} as FacilityWaterQltyProps);
|
||||
}
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx]) {
|
||||
// 하루 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
// 이틀 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx] && data[idx]?.rainEffectDay === 1) {
|
||||
if(idx > 1){
|
||||
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) > 3) {
|
||||
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) > 3) {
|
||||
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rtnData = data.map((item: FacilityWaterQltyProps) => {
|
||||
const rtnData = tmpData.map((item: FacilityWaterQltyProps) => {
|
||||
dataFormSetting(item)
|
||||
if(item.inflAssctBfrWqltTn) {
|
||||
item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000)/1000).toFixed(3);
|
||||
if(item.inflAssctAftWqltTn) {
|
||||
item.inflAssctAftWqltTn = Number(Math.round(Number(item.inflAssctAftWqltTn) * 1000)/1000).toFixed(3);
|
||||
}
|
||||
if(item.efflWqltTn){
|
||||
item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3);
|
||||
@@ -629,26 +607,26 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
if(item.efflWqltTp){
|
||||
item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3);
|
||||
}
|
||||
if(item.inflAssctBfrWqltToc){
|
||||
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltToc){
|
||||
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltToc){
|
||||
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.inflAssctBfrWqltBod){
|
||||
item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltBod){
|
||||
item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltBod){
|
||||
item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.inflAssctBfrWqltSs){
|
||||
item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltSs){
|
||||
item.inflAssctAftWqltSs = Number(Math.round(Number(item.inflAssctAftWqltSs) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltSs){
|
||||
item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.inflAssctBfrWqltToc){
|
||||
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
|
||||
if(item.inflAssctAftWqltToc){
|
||||
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
|
||||
}
|
||||
if(item.efflWqltToc){
|
||||
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
|
||||
|
||||
@@ -170,6 +170,7 @@ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: s
|
||||
try {
|
||||
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
|
||||
const res = await getFetch('fo', url);
|
||||
console.log(url);
|
||||
return { data: res.data, count: res.count }
|
||||
} catch (error) {
|
||||
console.error('시설정보 유량현황 데이터를 가져오는데 실패했습니다:', error);
|
||||
@@ -219,7 +220,6 @@ export type FlowRateSearchType = {
|
||||
flowRateList:flowRateListProps[];
|
||||
flowRateCount: number;
|
||||
excelList: ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
FlowRateModal : {
|
||||
@@ -253,8 +253,7 @@ export const flowRateSearchInitState:FlowRateSearchType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
flowRateList : flowRateList,
|
||||
flowRateCount : 0,
|
||||
excelList: [],
|
||||
isLoading: true,
|
||||
excelList: []
|
||||
},
|
||||
FlowRateModal : {
|
||||
isInit : false,
|
||||
@@ -266,13 +265,6 @@ export const flowRateSearchInitState:FlowRateSearchType = {
|
||||
export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => FlowRateSearchType) => void)=>FlowRateSearchActions=(set: (fn: (state: FlowRateSearchType) => FlowRateSearchType) => void) => {
|
||||
return {
|
||||
searchFlowRateList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: FlowRateSearchType) => ({
|
||||
...state,
|
||||
FlowRateList: {
|
||||
...state.FlowRateList,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const data = res.data;
|
||||
const excelDownList: ExcelType[] = [];
|
||||
@@ -311,59 +303,54 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
|
||||
...state.FlowRateList,
|
||||
flowRateList: rtnData,
|
||||
flowRateCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.FlowRateList,
|
||||
excelList: excelDownList,
|
||||
isLoading : false,
|
||||
},
|
||||
}
|
||||
}))
|
||||
},
|
||||
searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => {
|
||||
const res = await fetchFlowRateModalList(bscFctCd, searchYear);
|
||||
const data = res.data;
|
||||
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
|
||||
const tmpData:FlowRateModalProps[] = [];
|
||||
|
||||
data.forEach((item: FlowRateModalProps) => {
|
||||
if(item.infoRnDay && item.infoRnDay.toString().trim() === 'x') {
|
||||
item.infoRnDay = '';
|
||||
}
|
||||
});
|
||||
|
||||
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
const item = data[idx];
|
||||
if(item){
|
||||
if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) {
|
||||
item.rainEffectDay = 1;
|
||||
const rainDay = Number(item.infoRnDay) >= 3 ? 1 : 0;
|
||||
let rainEffectDay = 0;
|
||||
|
||||
if(idx < data.length - 2) {
|
||||
if(rainDay == 1) {
|
||||
rainEffectDay = 1;
|
||||
} else {
|
||||
item.rainEffectDay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx]) {
|
||||
// 하루 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
// 이틀 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx] && data[idx]?.rainEffectDay === 1) {
|
||||
if(idx > 1){
|
||||
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
|
||||
if(idx >= 2) {
|
||||
if(Number(data[idx-1].infoRnDay) >= 3 || Number(data[idx-2].infoRnDay) >= 3) {
|
||||
rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
} else if(idx < data.length - 1) {
|
||||
if(rainDay == 1 || Number(data[idx+1].infoRnDay) >= 3) {
|
||||
rainEffectDay = 1;
|
||||
}
|
||||
} else {
|
||||
rainEffectDay = rainDay;
|
||||
}
|
||||
|
||||
tmpData.push({
|
||||
...item,
|
||||
rainEffectDay: rainEffectDay,
|
||||
});
|
||||
}
|
||||
|
||||
const rtnData = data.map((item: FlowRateModalProps) => {
|
||||
const rtnData = tmpData.map((item: FlowRateModalProps) => {
|
||||
item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0)
|
||||
dataFormSetting(item);
|
||||
return item;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput";
|
||||
export type { TableUpperProps };
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
@@ -146,7 +145,6 @@ export type PlanSewageType = {
|
||||
planSewageList: PlanSewageProps[];
|
||||
planSewageCount: number;
|
||||
excelList: ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
}
|
||||
|
||||
@@ -163,8 +161,7 @@ export const planSewageInitState: PlanSewageType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
planSewageList : planSewageList,
|
||||
planSewageCount : 0,
|
||||
excelList : [],
|
||||
isLoading : true,
|
||||
excelList : []
|
||||
},
|
||||
}
|
||||
|
||||
@@ -173,43 +170,16 @@ export type PlanSewageStore = PlanSewageType & PlanSewageActions;
|
||||
export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageType) => void)=>PlanSewageActions=(set: (fn: (state: PlanSewageType) => PlanSewageType) => void) => {
|
||||
return {
|
||||
searchPlanSewageList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: PlanSewageType) => ({
|
||||
...state,
|
||||
PlanSewage: {
|
||||
...state.PlanSewage,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchPlanSewageList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const excelDownList: ExcelType[] = [];
|
||||
const data = res.data
|
||||
const processedData = await Promise.all(data.map(async (item:PlanSewageProps) => {
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + item.bscFctCd + '/' + searchYear) as ApiResponse;
|
||||
const calData = calRainEffectDay(res2.data, 'SUNNY');
|
||||
|
||||
let sumInflAmntSunny = 0;
|
||||
let avgInflAmntSunny = 0;
|
||||
calData.forEach((flowItem:FlowDataItem) => {
|
||||
sumInflAmntSunny += Number(flowItem.inflAmnt);
|
||||
})
|
||||
avgInflAmntSunny = sumInflAmntSunny / calData.length;
|
||||
item.avgInflAmntSunny = avgInflAmntSunny;
|
||||
if(item.bscFctCd === '11200PB001R'){
|
||||
console.log('avgInflAmntSunny : ',item.avgInflAmntSunny);
|
||||
console.log('calData : ',calData);
|
||||
}
|
||||
return item;
|
||||
}));
|
||||
|
||||
console.log('res' , res.data);
|
||||
/**
|
||||
* 결과데이터 계산
|
||||
* (1) 여유용량 = 시설용량 - 건기시 평균유량
|
||||
* (2) 변동부하율 = 건기시 일최대 유량/일평균유량(기준 최근 3개년)
|
||||
* (3) 분류식화율 = 분류식지역 면적(㎢)/처리구역 면적합계(㎢) ×100
|
||||
*/
|
||||
const resultData = processedData.map((item:PlanSewageProps) => {
|
||||
console.log('item.fctCpc : ',item.fctCpc);
|
||||
console.log('item.avgInflAmntSunny : ',item.avgInflAmntSunny);
|
||||
const resultData = res.data.map((item:PlanSewageProps) => {
|
||||
item.spareCapacity = Number(item.fctCpc) - Number(item.avgInflAmntSunny);
|
||||
item.variableLoadPercent = item.maxInflAmntSunny && item.maxInflAmntSunny!==0 ? Number(item.maxInflAmntSunny) / Number(item.avgInflAmntSunny) : 0;
|
||||
item.classifiedSewerPercent = item.sprtProcZoneAr && item.sprtProcZoneAr!==0 ? Number(item.sprtProcZoneAr) / Number(item.procZoneSm) * 100 : 0;
|
||||
@@ -246,12 +216,10 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy
|
||||
...state.PlanSewage,
|
||||
planSewageList: resultData,
|
||||
planSewageCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.PlanSewage,
|
||||
excelList: excelDownList,
|
||||
isLoading : false,
|
||||
},
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { postFetch } from "@/app/components/api";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import { fetchPlanInfo } from "../common";
|
||||
import { getFetchAreaList, postFetch } from "@/app/components/api";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
export type { TableUpperProps };
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
@@ -228,14 +227,25 @@ const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => {
|
||||
};
|
||||
|
||||
// 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우)
|
||||
const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined, set : (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{data:ProcessAreaProps[], count:number}> => {
|
||||
const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined ): Promise<{data:ProcessAreaProps[], count:number}> => {
|
||||
try {
|
||||
const res = await fetchPlanInfo(targetYear, ctpvNm, sggNm, undefined);
|
||||
targetYear = targetYear ? targetYear : "2024";
|
||||
const baseUrl = 'https://apigateway.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy';
|
||||
const queryParams = new URLSearchParams();
|
||||
|
||||
if (ctpvNm && ctpvNm !== '전체') queryParams.append('ctpvNm', ctpvNm);
|
||||
if (sggNm && sggNm !== '전체') queryParams.append('sggNm', sggNm);
|
||||
if (targetYear) queryParams.append('targetYear',targetYear);
|
||||
|
||||
const queryString = queryParams.toString();
|
||||
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
||||
const res = await getFetchAreaList(url);
|
||||
|
||||
if(res && res.length > 0){
|
||||
const enrichedData = await Promise.all(
|
||||
res.map(async (item: ProcessAreaProps) => {
|
||||
upHeadList1.forEach((head:TableUpperProps) => {
|
||||
/* if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
head.title = '현재\n(' + item.yr + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
|
||||
head.title = '1단계\n(' + item.yrDc1 + '년)';
|
||||
@@ -247,19 +257,6 @@ const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm :
|
||||
head.title = '4단계\n(' + item.yrDc4 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
|
||||
head.title = '기승인\n4단계(' + item.yrDt4 + '년)';
|
||||
} */
|
||||
if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
head.title = '현재';
|
||||
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
|
||||
head.title = '1단계';
|
||||
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
|
||||
head.title = '2단계';
|
||||
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
|
||||
head.title = '3단계';
|
||||
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
|
||||
head.title = '4단계';
|
||||
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
|
||||
head.title = '기승인\n4단계';
|
||||
}
|
||||
});
|
||||
const res = await fetchFacilityDetailInfo(item.swtrmtFcltCd);
|
||||
@@ -283,13 +280,6 @@ const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm :
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('시설계획정보를 가져오는데 실패했습니다:', error);
|
||||
set((state) => ({
|
||||
...state,
|
||||
ProcessArea : {
|
||||
...state.ProcessArea,
|
||||
isLoading : false
|
||||
}
|
||||
}));
|
||||
return {data: [], count: 0};
|
||||
}
|
||||
};
|
||||
@@ -314,7 +304,6 @@ export type ProcessAreaType = {
|
||||
processAreaList: ProcessAreaProps[];
|
||||
processAreaCount: number;
|
||||
excelList: ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
ProcessAreaDetail : {
|
||||
@@ -339,8 +328,7 @@ export const processAreaInitState: ProcessAreaType = {
|
||||
upHeadList1 : upHeadList1,
|
||||
processAreaList : processAreaList,
|
||||
processAreaCount : 0,
|
||||
excelList : [],
|
||||
isLoading : true,
|
||||
excelList : []
|
||||
},
|
||||
|
||||
ProcessAreaDetail : {
|
||||
@@ -367,14 +355,7 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
|
||||
* @param pageSize : 페이지 크기
|
||||
*/
|
||||
searchProcessAreaList: async ( pageNo:number, pageSize:number, ctpvNm?:string, sggNm?:string, targetYear?:string) => {
|
||||
set((state: ProcessAreaType) => ({
|
||||
...state,
|
||||
ProcessArea: {
|
||||
...state.ProcessArea,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set);
|
||||
const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear);
|
||||
res.data.forEach((item:ProcessAreaProps) => {
|
||||
DataForm({ type: 'float1', column: 'fctCpc', item:item as unknown as Record<string, unknown>});
|
||||
})
|
||||
@@ -419,11 +400,9 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
|
||||
...state.ProcessArea,
|
||||
processAreaList: res.data,
|
||||
processAreaCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.ProcessArea,
|
||||
excelList: excelDownList,
|
||||
isLoading : false,
|
||||
},
|
||||
}))
|
||||
},
|
||||
@@ -432,51 +411,51 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
|
||||
set((state: ProcessAreaType) => {
|
||||
const rtnData = state.ProcessArea.processAreaList.find((item: ProcessAreaProps) => item.swtrmtFcltCd === swtrmtFcltCd);
|
||||
if (rtnData) {
|
||||
upHeadListFcltyImproveInfo.forEach((head:TableUpperProps) => {
|
||||
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
head.title = rtnData.yr? '현재\n(' + rtnData.yr + '년)':head.title = '현재';
|
||||
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
|
||||
head.title = rtnData.yrDc1? '1단계\n(' + rtnData.yrDc1 + '년)':head.title = '1단계';
|
||||
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
|
||||
head.title = rtnData.yrDc2? '2단계\n(' + rtnData.yrDc2 + '년)':head.title = '2단계';
|
||||
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
|
||||
head.title = rtnData.yrDc3? '3단계\n(' + rtnData.yrDc3 + '년)':head.title = '3단계';
|
||||
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
|
||||
head.title = rtnData.yrDc4? '4단계\n(' + rtnData.yrDc4 + '년)':head.title = '4단계';
|
||||
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
|
||||
head.title = rtnData.yrDt4? '기승인\n4단계(' + rtnData.yrDt4 + '년)':head.title = '기승인\n4단계';
|
||||
}
|
||||
});
|
||||
upHeadListFcltyImproveInfo.forEach((head:TableUpperProps) => {
|
||||
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
head.title = '현재\n(' + rtnData.yr + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
|
||||
head.title = '1단계\n(' + rtnData.yrDc1 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
|
||||
head.title = '2단계\n(' + rtnData.yrDc2 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
|
||||
head.title = '3단계\n(' + rtnData.yrDc3 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
|
||||
head.title = '4단계\n(' + rtnData.yrDc4 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
|
||||
head.title = '기승인\n4단계(' + rtnData.yrDt4 + '년)';
|
||||
}
|
||||
});
|
||||
|
||||
upHeadListProcessAreaPlan.forEach((head:TableUpperProps) => {
|
||||
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
head.title = rtnData.yr? '현재\n(' + rtnData.yr + '년)':head.title = '현재';
|
||||
head.title = '현재\n(' + rtnData.yr + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
|
||||
head.title = rtnData.yrDc1?'1단계\n(' + rtnData.yrDc1 + '년)':head.title = '1단계';
|
||||
head.title = '1단계\n(' + rtnData.yrDc1 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
|
||||
head.title = rtnData.yrDc2?'2단계\n(' + rtnData.yrDc2 + '년)':head.title = '2단계';
|
||||
head.title = '2단계\n(' + rtnData.yrDc2 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
|
||||
head.title = rtnData.yrDc3? '3단계\n(' + rtnData.yrDc3 + '년)':head.title = '3단계';
|
||||
head.title = '3단계\n(' + rtnData.yrDc3 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
|
||||
head.title = rtnData.yrDc4?'4단계\n(' + rtnData.yrDc4 + '년)':head.title = '4단계';
|
||||
head.title = '4단계\n(' + rtnData.yrDc4 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
|
||||
head.title = rtnData.yrDt4?'기승인\n4단계(' + rtnData.yrDt4 + '년)':head.title = '기승인\n4단계';
|
||||
head.title = '기승인\n4단계(' + rtnData.yrDt4 + '년)';
|
||||
}
|
||||
});
|
||||
|
||||
upHeadListProcessPopulation.forEach((head:TableUpperProps) => {
|
||||
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
|
||||
head.title = rtnData.yr?'현재\n(' + rtnData.yr + '년)':head.title = '현재';
|
||||
head.title = '현재\n(' + rtnData.yr + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
|
||||
head.title = rtnData.yrDc1?'1단계\n(' + rtnData.yrDc1 + '년)':head.title = '1단계';
|
||||
head.title = '1단계\n(' + rtnData.yrDc1 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
|
||||
head.title = rtnData.yrDc2?'2단계\n(' + rtnData.yrDc2 + '년)':head.title = '2단계';
|
||||
head.title = '2단계\n(' + rtnData.yrDc2 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
|
||||
head.title = rtnData.yrDc3?'3단계\n(' + rtnData.yrDc3 + '년)':head.title = '3단계';
|
||||
head.title = '3단계\n(' + rtnData.yrDc3 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
|
||||
head.title = rtnData.yrDc4?'4단계\n(' + rtnData.yrDc4 + '년)':head.title = '4단계';
|
||||
head.title = '4단계\n(' + rtnData.yrDc4 + '년)';
|
||||
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
|
||||
head.title = rtnData.yrDt4?'기승인\n4단계(' + rtnData.yrDt4 + '년)':head.title = '기승인\n4단계';
|
||||
head.title = '기승인\n4단계(' + rtnData.yrDt4 + '년)';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -517,7 +517,6 @@ export type ProcessFacilityType = {
|
||||
processFacilityList:facilityListProps[];
|
||||
processFacilityCount:number;
|
||||
excelList : ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
ProcessFacilityDetail : {
|
||||
@@ -552,8 +551,7 @@ export const processFacilityInitState:ProcessFacilityType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
processFacilityList : processFacilityList,
|
||||
processFacilityCount:1,
|
||||
excelList : [],
|
||||
isLoading : true,
|
||||
excelList : []
|
||||
},
|
||||
|
||||
ProcessFacilityDetail : {
|
||||
@@ -590,13 +588,6 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
|
||||
* @param pageSize : 페이지 크기
|
||||
*/
|
||||
searchProcessFacility: async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string) => {
|
||||
set((state: ProcessFacilityType) => ({
|
||||
...state,
|
||||
ProcessFacilityList: {
|
||||
...state.ProcessFacilityList,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchFacilityList(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName);
|
||||
res.data.forEach((item:facilityListProps) => {
|
||||
DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record<string, unknown>});
|
||||
@@ -644,11 +635,9 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
|
||||
...state.ProcessFacilityList,
|
||||
processFacilityList: res.data,
|
||||
processFacilityCount: res.count,
|
||||
isLoading: false,
|
||||
}:{
|
||||
...state.ProcessFacilityList,
|
||||
excelList: excelDownList,
|
||||
isLoading: false,
|
||||
},
|
||||
}))
|
||||
},
|
||||
@@ -659,13 +648,6 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
|
||||
* @param pageSize : 페이지 크기
|
||||
*/
|
||||
searchProcessFacilitySearching: async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string) => {
|
||||
set((state: ProcessFacilityType) => ({
|
||||
...state,
|
||||
ProcessFacilityList: {
|
||||
...state.ProcessFacilityList,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchFacilityListSearching(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName);
|
||||
/* res.data.forEach((item:facilityListProps) => {
|
||||
DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record<string, unknown>});
|
||||
@@ -683,7 +665,6 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
|
||||
...state.ProcessFacilityList,
|
||||
processFacilityList: res.data,
|
||||
processFacilityCount: res.count,
|
||||
isLoading: false,
|
||||
},
|
||||
}))
|
||||
},
|
||||
|
||||
@@ -183,7 +183,6 @@ export type RdiType = {
|
||||
rdiList: RdiProps[]; // Changed from facilityAreaProps to ProcessAreaProps
|
||||
rdiCount: number;
|
||||
excelList: ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
}
|
||||
|
||||
@@ -200,8 +199,7 @@ export const rdiInitState: RdiType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
rdiList : rdiList,
|
||||
rdiCount : 2,
|
||||
excelList : [],
|
||||
isLoading : true,
|
||||
excelList : []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,14 +220,6 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
console.log("tableActionsExport");
|
||||
return {
|
||||
searchRdiList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: RdiType) => ({
|
||||
...state,
|
||||
Rdi: {
|
||||
...state.Rdi,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
|
||||
const res = await fetchRdiList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const data = res.data;
|
||||
const excelDownList: ExcelType[] = [];
|
||||
@@ -274,12 +264,10 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
...state.Rdi,
|
||||
rdiList: rtnData,
|
||||
rdiCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.Rdi,
|
||||
excelList: excelDownList,
|
||||
isLoading : false,
|
||||
},
|
||||
}
|
||||
}))
|
||||
},
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ const tempSewageOccurList:modalTableType[] = []
|
||||
|
||||
const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
// 20250701임시시
|
||||
console.log("searchYear", searchYear);
|
||||
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
|
||||
const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
|
||||
const res = await getFetch('fo', url);
|
||||
@@ -144,7 +145,7 @@ const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear
|
||||
====================================*/
|
||||
export type SewageOccurActions = {
|
||||
searchSewageOccurList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void;
|
||||
searchSewageOccurDetailList: (bscFctCd: string, searchYear: string, startYearMonth?: string, endYearMonth?: string) => void;
|
||||
searchSewageOccurDetailList: (bscFctCd: string, searchYear: string) => void;
|
||||
}
|
||||
|
||||
export type SewageOccurType = {
|
||||
@@ -161,7 +162,6 @@ export type SewageOccurType = {
|
||||
sewageOccurList: SewageOccurProps[]; // Changed from facilityAreaProps to ProcessAreaProps
|
||||
sewageOccurCount: number;
|
||||
excelList: ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
SewageOccurDetail : {
|
||||
@@ -184,8 +184,7 @@ export const sewageOccurInitState: SewageOccurType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
sewageOccurList : sewageOccurList,
|
||||
sewageOccurCount : 2,
|
||||
excelList : [],
|
||||
isLoading : true,
|
||||
excelList : []
|
||||
},
|
||||
|
||||
SewageOccurDetail : {
|
||||
@@ -198,15 +197,14 @@ export const sewageOccurInitState: SewageOccurType = {
|
||||
export type SewageOccurStore = SewageOccurType & SewageOccurActions;
|
||||
|
||||
// Add type definitions for API responses
|
||||
export type FlowDataItem = {
|
||||
type FlowDataItem = {
|
||||
inflAmnt: string | number;
|
||||
infoRnDay: string | number;
|
||||
bscFctCd: string;
|
||||
msrDt: string;
|
||||
rainEffectDay?: number;
|
||||
}
|
||||
|
||||
export type FlowResponse = {
|
||||
type FlowResponse = {
|
||||
data: FlowDataItem[];
|
||||
count: number;
|
||||
}
|
||||
@@ -214,84 +212,28 @@ export type FlowResponse = {
|
||||
export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
|
||||
return {
|
||||
searchSewageOccurList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: SewageOccurType) => ({
|
||||
...state,
|
||||
SewageOccur: {
|
||||
...state.SewageOccur,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
const res = await fetchSewageOccurList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const data = res.data;
|
||||
|
||||
// Promise.all을 사용하여 모든 비동기 작업이 완료될 때까지 기다림
|
||||
const calData = await Promise.all(data.map(async (item: SewageOccurProps) => {
|
||||
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
|
||||
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
|
||||
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
|
||||
item.swageChangePercent = 80;
|
||||
|
||||
|
||||
const bscFctCd = item.bscFctCd;
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as FlowResponse;
|
||||
|
||||
|
||||
let sumChungcunDay = 0;
|
||||
let chungcunSumFlow = 0;
|
||||
let totWaterUsage = 0;
|
||||
|
||||
if(bscFctCd === '11200PB001R'){
|
||||
console.log('res2.data : ',res2.data);
|
||||
}
|
||||
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
|
||||
for(let idx = 0; idx < res2.data.length; idx++) {
|
||||
const item = res2.data[idx];
|
||||
if(item){
|
||||
if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) {
|
||||
item.rainEffectDay = 1;
|
||||
} else {
|
||||
item.rainEffectDay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
|
||||
for(let idx = 0; idx < res2.data.length; idx++) {
|
||||
if(res2.data[idx]) {
|
||||
// 하루 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 0 && res2.data[idx-1]?.infoRnDay && Number(res2.data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
res2.data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
// 이틀 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 1 && res2.data[idx-2]?.infoRnDay && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
res2.data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let idx = 0; idx < res2.data.length; idx++) {
|
||||
if(res2.data[idx] && res2.data[idx]?.rainEffectDay === 1) {
|
||||
if(idx > 1){
|
||||
if(res2.data[idx-1]?.infoRnDay && Number(res2.data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
res2.data[idx]!.infoRnDay = res2.data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(res2.data[idx-2]?.infoRnDay && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
res2.data[idx]!.infoRnDay = res2.data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(bscFctCd === '11200PB001R'){
|
||||
console.log('calData : ',res2.data);
|
||||
}
|
||||
|
||||
res2.data.forEach((item: FlowDataItem) => {
|
||||
|
||||
if(Number(item.rainEffectDay) === 0){
|
||||
if(Number(item.infoRnDay) ===0){
|
||||
chungcunSumFlow += Number(item.inflAmnt);
|
||||
sumChungcunDay += 1;
|
||||
}
|
||||
|
||||
totWaterUsage += Number(item.inflAmnt);
|
||||
});
|
||||
const avg = totWaterUsage /res2.count;
|
||||
@@ -308,34 +250,17 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
|
||||
...state.SewageOccur,
|
||||
sewageOccurList: calData,
|
||||
sewageOccurCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.SewageOccur,
|
||||
excelList: [],
|
||||
isLoading : false,
|
||||
},
|
||||
}
|
||||
}))
|
||||
},
|
||||
|
||||
searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string, startYearMonth?: string, endYearMonth?: string) => {
|
||||
searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string) => {
|
||||
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
|
||||
const monthData: SewageOccurDetailProps[] = [];
|
||||
let tot = 0, cnt= 0;
|
||||
|
||||
console.log('startYearMonth : ', startYearMonth, 'endYearMonth : ', endYearMonth);
|
||||
if(startYearMonth) {
|
||||
res.data = res.data.filter((item: FlowDataItem) => {
|
||||
const month = item.msrDt?.substring(0, 6);
|
||||
return month >= startYearMonth;
|
||||
});
|
||||
}
|
||||
if(endYearMonth) {
|
||||
res.data = res.data.filter((item: FlowDataItem) => {
|
||||
const month = item.msrDt?.substring(0, 6);
|
||||
return month <= endYearMonth;
|
||||
});
|
||||
}
|
||||
|
||||
let tot = 0, cnt= 0
|
||||
res.data.forEach((item: FlowDataItem) => {
|
||||
const month = item.msrDt?.substring(4, 6);
|
||||
const monthIdx = month ? Number(month) - 1 : -1;
|
||||
@@ -359,7 +284,7 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
|
||||
monthData.forEach((item, index) => {
|
||||
item.usege = item.sum/item.cnt *0.65
|
||||
tableData.push({
|
||||
msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)),
|
||||
msrDt: item.yr+'-'+(index+1>10?String(index+1):'0'+(index+1)),
|
||||
waterUsage: Math.round(item.usege*100) /100,
|
||||
swageChangePercent: (Math.round((item.usege/item.usege*0.8) * 100) / 100) * 100,
|
||||
estimationSewage: Math.round(item.usege*0.8 * 100) / 100
|
||||
|
||||
@@ -59,7 +59,7 @@ export const StoreZus =
|
||||
}
|
||||
) => {
|
||||
return createStore<FoStore>()((set) => {
|
||||
LoginApi.login({userId: "CLEANWATER", password: "gktneh12!@"})
|
||||
LoginApi.login({userId: "admin1gmail", password: "test1234!"})
|
||||
return {
|
||||
...initState,
|
||||
...CommonReducer(set),
|
||||
|
||||
@@ -2,15 +2,8 @@ import DataForm from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps } from "./types";
|
||||
import type { SewageOccurDetailProps } from "../sewageOccur";
|
||||
export type { TableUpperProps };
|
||||
|
||||
// SewageOccurDetailProps 타입을 여기에 정의
|
||||
export type SewageOccurDetailProps = {
|
||||
cnt : number,
|
||||
sum : number,
|
||||
yr:string,
|
||||
usege:number
|
||||
}
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
====================================*/
|
||||
@@ -82,7 +75,7 @@ const upHeadList3:TableUpperProps[] = [
|
||||
// 모달
|
||||
const upHeadListUnderWaterDetail:TableUpperProps[] = [
|
||||
{ id: "msrDt", title: "날짜" },
|
||||
{ id: "realSewageInput", title: "청천시 실제 하수유입량\n(m³/일)" },
|
||||
{ id: "realSewageInput", title: "실제 하수유입량\n(m³/일)" },
|
||||
{ id: "sewageOccur", title: "오수발생량\n(m³/일)" },
|
||||
{ id: "underWaterInput", title: "지하수 유입량\n(m³/일)" },
|
||||
];
|
||||
@@ -169,15 +162,13 @@ const underWaterDetailList:UnderWaterInputModalProps[] = [
|
||||
====================================*/
|
||||
|
||||
// API response types
|
||||
export interface FlowDataItem {
|
||||
inflAmnt: number | string;
|
||||
interface FlowDataItem {
|
||||
inflAmnt: number;
|
||||
infoRnDay: number;
|
||||
msrDt: string;
|
||||
rainEffectDay? : number;
|
||||
sumFlow? : number | string | '';
|
||||
}
|
||||
|
||||
export interface ApiResponse {
|
||||
interface ApiResponse {
|
||||
data: FlowDataItem[];
|
||||
count: number;
|
||||
}
|
||||
@@ -218,7 +209,6 @@ export type UnderWaterType = {
|
||||
underWaterList: UnderWaterProps[]; // Changed from facilityAreaProps to ProcessAreaProps
|
||||
underWaterCount: number;
|
||||
excelList: ExcelType[];
|
||||
isLoading: boolean;
|
||||
},
|
||||
|
||||
UnderWaterDetail : {
|
||||
@@ -241,8 +231,7 @@ export const underWaterInitState: UnderWaterType = {
|
||||
upHeadList3 : upHeadList3,
|
||||
underWaterList : underWaterList,
|
||||
underWaterCount : 4,
|
||||
excelList : [],
|
||||
isLoading : true,
|
||||
excelList : []
|
||||
},
|
||||
|
||||
UnderWaterDetail : {
|
||||
@@ -261,70 +250,9 @@ const dataFormSetting=(item : UnderWaterProps)=> {
|
||||
|
||||
export type UnderWaterStore = UnderWaterType & UnderWaterActions;
|
||||
|
||||
export const calRainEffectDay = (data: FlowDataItem[], weather: string) => {
|
||||
// 강우영향일 계산 (강우량이 3 이상이면 무조건 강우영향일)
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
const item = data[idx];
|
||||
if(item){
|
||||
if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) {
|
||||
item.rainEffectDay = 1;
|
||||
} else {
|
||||
item.rainEffectDay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx]) {
|
||||
// 하루 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
// 이틀 전이 강우영향일(3 이상)인 경우
|
||||
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let idx = 0; idx < data.length; idx++) {
|
||||
if(data[idx] && data[idx]?.rainEffectDay === 1) {
|
||||
if(idx > 1){
|
||||
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let rtnData : FlowDataItem[] = [];
|
||||
if (weather === 'ALL') {
|
||||
rtnData = data;
|
||||
} else if (weather === 'SUNNY') {
|
||||
rtnData = data.filter((item: FlowDataItem) => item.rainEffectDay === 0);
|
||||
} else {
|
||||
rtnData = data.filter((item: FlowDataItem) => item.rainEffectDay === 1);
|
||||
}
|
||||
return rtnData;
|
||||
}
|
||||
|
||||
export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterType) => void)=>UnderWaterActions=(set: (fn: (state: UnderWaterType) => UnderWaterType) => void) => {
|
||||
return {
|
||||
searchUnderWaterList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
set((state: UnderWaterType) => ({
|
||||
...state,
|
||||
UnderWater: {
|
||||
...state.UnderWater,
|
||||
isLoading: true,
|
||||
},
|
||||
}));
|
||||
|
||||
const res = await fetchUnderWaterList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const data = res.data;
|
||||
const calData = await Promise.all(data.map(async (item: UnderWaterProps) => {
|
||||
@@ -334,7 +262,8 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
|
||||
const bscFctCd = item.bscFctCd;
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse;
|
||||
const calData = calRainEffectDay(res2.data, 'SUNNY');
|
||||
|
||||
let sumChungcunDay = 0;
|
||||
let chungcunSumFlow = 0;
|
||||
|
||||
let sumSummerChungcunDay = 0;
|
||||
@@ -343,25 +272,24 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
let sumWinterChungcunDay = 0;
|
||||
let sumWinterChungcunFlow = 0;
|
||||
|
||||
calData.forEach((flowItem: FlowDataItem) => {
|
||||
chungcunSumFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
|
||||
if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){
|
||||
sumSummerChungcunDay += 1;
|
||||
sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
}else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){
|
||||
sumWinterChungcunDay += 1;
|
||||
sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
res2.data.forEach((flowItem: FlowDataItem) => {
|
||||
// 청천시
|
||||
if(Number(flowItem.infoRnDay) ===0){
|
||||
sumChungcunDay += 1;
|
||||
chungcunSumFlow += Number(flowItem.inflAmnt);
|
||||
|
||||
if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){
|
||||
sumSummerChungcunDay += 1;
|
||||
sumSummerChungcunFlow += Number(flowItem.inflAmnt);
|
||||
}else if(flowItem.msrDt.includes('01') || flowItem.msrDt.includes('02')){
|
||||
sumWinterChungcunDay += 1;
|
||||
sumWinterChungcunFlow += Number(flowItem.inflAmnt);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const usage = chungcunSumFlow / calData.length;
|
||||
const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay;
|
||||
const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay;
|
||||
|
||||
item.underWaterInputYear = Math.round((usage-(usage*0.65*0.8)) * 100) / 100;
|
||||
item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*0.8)) * 100) / 100;
|
||||
item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*0.8)) * 100) / 100;
|
||||
item.underWaterInputYear = Number(chungcunSumFlow==0?0:Math.round((chungcunSumFlow / sumChungcunDay) * 10) / 10) - Number(item.fctCpc * 0.6 * 0.8);
|
||||
item.underWaterInputSummer = Number(sumSummerChungcunFlow==0?0:Math.round((sumSummerChungcunFlow / sumSummerChungcunDay) * 10) / 10) - Number(item.fctCpc * 0.6 * 0.8);
|
||||
item.underWaterInputWinter = Number(sumWinterChungcunFlow==0?0:Math.round((sumWinterChungcunFlow / sumWinterChungcunDay) * 10) / 10) - Number(item.fctCpc * 0.6 * 0.8);
|
||||
|
||||
return item;
|
||||
}));
|
||||
@@ -404,30 +332,17 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
...state.UnderWater,
|
||||
underWaterList: calData,
|
||||
underWaterCount: res.count,
|
||||
isLoading : false,
|
||||
}:{
|
||||
...state.UnderWater,
|
||||
isLoading : false,
|
||||
excelList: excelDownList
|
||||
},
|
||||
excelList: excelDownList,
|
||||
}
|
||||
}))
|
||||
},
|
||||
unserWaterModal:async (bscFctCd, searchYear)=>{
|
||||
console.log('searchYear : ', searchYear);
|
||||
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
|
||||
const monthData: SewageOccurDetailProps[] = [];
|
||||
|
||||
const calData = calRainEffectDay(res.data, 'SUNNY');
|
||||
let tot = 0, cnt= 0;
|
||||
|
||||
let tmpTot = 0;
|
||||
|
||||
calData.forEach((item: FlowDataItem) => {
|
||||
tmpTot += Number(item.inflAmnt);
|
||||
})
|
||||
console.log('tmpTot : ', tmpTot/calData.length);
|
||||
|
||||
calData.forEach((item: FlowDataItem) => {
|
||||
let tot = 0, cnt= 0
|
||||
res.data.forEach((item: FlowDataItem) => {
|
||||
const month = item.msrDt?.substring(4, 6);
|
||||
const monthIdx = month ? Number(month) - 1 : -1;
|
||||
if (monthIdx >= 0) {
|
||||
@@ -449,7 +364,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
monthData.forEach((item, index) => {
|
||||
item.usege = item.sum/item.cnt
|
||||
tableData.push({
|
||||
msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)),
|
||||
msrDt: item.yr+'-'+(index+1>10?String(index+1):'0'+(index+1)),
|
||||
realSewageInput:Math.round(item.usege*100) /100,
|
||||
sewageOccur:Math.round(item.usege*0.65*0.8 * 100) / 100,
|
||||
underWaterInput:Math.round((item.usege-(item.usege*0.65*0.8)) * 100) / 100,
|
||||
@@ -464,6 +379,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
|
||||
});
|
||||
avgWaterUsage = tot/cnt
|
||||
|
||||
const newData= [
|
||||
{
|
||||
msrDt: '평균',
|
||||
|
||||
@@ -107,7 +107,7 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
|
||||
console.log('repairArr', repairArr);
|
||||
};
|
||||
fetchAll();
|
||||
}, []);
|
||||
}, [featureData]);
|
||||
|
||||
// 폼 데이터가 변경될 때 호출될 핸들러
|
||||
const handleFormDataChange = (newFormData: any) => {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { VerticalTable } from '@/components/ui/verticalTable';
|
||||
import React, { useState, useEffect } from 'react'
|
||||
// 빗물펌프 자체 입력 정보
|
||||
const exclnInputColumn = [
|
||||
{ id: "swtrmtZoneCd", title: "처리구역", type: "input" },
|
||||
{ id: "mltvDtdvNm", title: "처리분구", type: "input" },
|
||||
{ id: "swtrmtZoneCd", title: "배수구역", type: "input" },
|
||||
{ id: "mltvDtdvNm", title: "배수분구", type: "input" },
|
||||
{ id: "dsgnFrqnc", title: "설계빈도(년)", type: "input" },
|
||||
]
|
||||
// 오수펌프 자체 입력 정보
|
||||
|
||||
@@ -41,7 +41,7 @@ const Map = () => {
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const data = await getData('v1/map/lyrStngs/SN_NETWORK');
|
||||
const data = await getData("v1/map/lyrStngs/SN_NETWORK");
|
||||
setTreeData(data);
|
||||
} catch (error) {
|
||||
console.error("데이터 불러오기 실패:", error);
|
||||
@@ -115,22 +115,22 @@ const Map = () => {
|
||||
};
|
||||
return (
|
||||
<div className="bg-container">
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={true}
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={SearchModal}
|
||||
detailView={FeatureClickEventPopup}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={undefined}
|
||||
/>
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={true}
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={SearchModal}
|
||||
detailView={FeatureClickEventPopup}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={undefined}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ const BasicTab: React.FC<BasicTabProps> = ({
|
||||
setVar2,
|
||||
}) => {
|
||||
return (
|
||||
<div className="relative border rounded-lg p-6 mt-4 w-full h-[10vh]">
|
||||
<div className="relative border rounded-lg p-6 w-full h-[10vh]">
|
||||
{/* 구분 */}
|
||||
<div className="mb-3 flex items-center justify-between gap-4">
|
||||
<div className="flex items-center">
|
||||
|
||||
@@ -39,6 +39,7 @@ export const BIZ_TY_CD_SELECT_ARRAY = BIZ_TY_CD.map(item => ({
|
||||
}));
|
||||
// 운영정보 - 사업 현황
|
||||
export const operationTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "bizNm", title: "사업명" },
|
||||
{ id: "flfmtBgngYmd", title: "수행시작일자" },
|
||||
{ id: "flfmtEndYmd", title: "수행종료일자" },
|
||||
@@ -48,6 +49,7 @@ export const operationTableHeadlist = [
|
||||
];
|
||||
// 운영정보 - 보수 및 갱신 결과표
|
||||
export const operationMaintenanceTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
@@ -58,6 +60,7 @@ export const operationMaintenanceTableHeadlist = [
|
||||
];
|
||||
// 운영정보 - 청소 및 준설 결과표
|
||||
export const operationCleaningTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
@@ -67,6 +70,7 @@ export const operationCleaningTableHeadlist = [
|
||||
];
|
||||
// 운영정보 - 점검 및 진단 결과표
|
||||
export const operationInspectionTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
@@ -109,7 +113,7 @@ const OperationTab: React.FC<OperationTabProps> = ({
|
||||
setYearFilter,
|
||||
}) => {
|
||||
return (
|
||||
<div className="relative flex flex-col border rounded-lg p-6 mt-4 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">
|
||||
<SelectBox
|
||||
className="w-80 mr-8"
|
||||
|
||||
@@ -61,7 +61,7 @@ const ReportTab: React.FC<BasicTabProps> = ({
|
||||
|
||||
|
||||
return (
|
||||
<div className="relative flex flex-col border rounded-lg p-6 mt-4 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">
|
||||
<SelectBox
|
||||
className="w-[150px] mr-8"
|
||||
|
||||
@@ -235,7 +235,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
} else if (activeTab === 'operation') {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${curPage - 1}`,
|
||||
size: '4',
|
||||
size: '5',
|
||||
};
|
||||
if (var1) RequestDTO.bizNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTyCd = var2;
|
||||
@@ -265,12 +265,13 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
console.log('필터링된 API 결과(개수):', res.totalElements);
|
||||
console.log('필터링된 API 결과(데이터):', res.content);
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any) => {
|
||||
const mappedContent = (res.content || []).map((item: any, index: number) => {
|
||||
console.log("item:", item);
|
||||
const formattedItem = formatDisplayData(item);
|
||||
const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTyCd);
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * 4 + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
bizTyCd: matched ? matched.lwpoCdNm : item.bizTyCd,
|
||||
};
|
||||
});
|
||||
@@ -521,19 +522,22 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: '4',
|
||||
bizId: tableData[index % 4].bizId,
|
||||
size: '5',
|
||||
bizId: tableData[index % 5].bizId,
|
||||
};
|
||||
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
console.log('운영정보 cellClick 데이터:', res);
|
||||
console.log('운영정보 length:', res.data.length);
|
||||
|
||||
const mappedData = (res.data || []).map((item: any) => {
|
||||
const mappedData = (res.data || []).map((item: any, detailIndex: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim());
|
||||
const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim());
|
||||
return {
|
||||
...item,
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * 4 + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
};
|
||||
@@ -557,18 +561,19 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: '4',
|
||||
size: '5',
|
||||
bizId: String(detailBizId),
|
||||
};
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
console.log('운영정보 페이지네이션 데이터:', res);
|
||||
console.log('운영정보 페이지네이션 length:', res.data.length);
|
||||
|
||||
const mappedData = (res.data || []).map((item: any) => {
|
||||
const mappedData = (res.data || []).map((item: any, detailIndex: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim());
|
||||
const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim());
|
||||
return {
|
||||
...item,
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * 4 + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
};
|
||||
@@ -620,6 +625,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}))}
|
||||
onValueChange={(value: string) => setActiveTab(value)}
|
||||
>
|
||||
</UITab>
|
||||
{/* 각각의 탭 영역 */}
|
||||
{/* 기본정보 탭 */}
|
||||
{activeTab === 'basic' && (
|
||||
@@ -681,12 +687,12 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
/>
|
||||
)}
|
||||
{/* </UITab2> */}
|
||||
</UITab>
|
||||
|
||||
|
||||
{/* 📋 결과 리스트 */}
|
||||
{/* 기본정보 탭, 하수도정비기본계획보고서 탭 */}
|
||||
{(activeTab === 'basic' || activeTab === 'report') && (
|
||||
<div className="h-[80vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
|
||||
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
@@ -711,7 +717,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
{/* 운영정보 탭 */}
|
||||
{activeTab === 'operation' && (
|
||||
<>
|
||||
<div className="h-[35vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="h-[39vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<UiTable
|
||||
@@ -723,7 +729,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}
|
||||
tableData={tableData}
|
||||
headlist={dynamicHeadlist}
|
||||
pageSize={4}
|
||||
pageSize={5}
|
||||
total={tableCount}
|
||||
cellClick={handleOperationCellClick}
|
||||
onPageChange={setCurPage}
|
||||
@@ -733,7 +739,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-[35vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="h-[39vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isDetailLoading} />
|
||||
<UiTable
|
||||
@@ -745,7 +751,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}
|
||||
tableData={detailTableData}
|
||||
headlist={dynamicHeadlist2}
|
||||
pageSize={4}
|
||||
pageSize={5}
|
||||
total={detailTableCount}
|
||||
cellClick={undefined}
|
||||
onPageChange={setDetailCurPage}
|
||||
|
||||
@@ -30,6 +30,13 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<div className="mb-2 flex items-center">
|
||||
@@ -70,6 +77,7 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -81,6 +89,7 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -31,6 +31,13 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<div className="flex items-center mb-2">
|
||||
@@ -53,6 +60,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -64,6 +72,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 양수능력 - 우수맨홀 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">
|
||||
@@ -78,6 +87,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -89,6 +99,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -33,6 +33,13 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-6">
|
||||
<div className="mb-2 flex items-center">
|
||||
@@ -85,6 +92,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setVar1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -96,6 +104,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 연장 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">연장(m)</Label>
|
||||
@@ -108,6 +117,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -119,6 +129,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -35,6 +35,13 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
{/* 가동개시일자 */}
|
||||
@@ -64,6 +71,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -75,6 +83,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 처리구역 면적 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">처리구역 면적(m²)</Label>
|
||||
@@ -87,6 +96,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -98,6 +108,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 하수처리시설명 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label>
|
||||
@@ -108,6 +119,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
onChange={(e) => {
|
||||
setVar1(e.target.value);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -27,6 +27,13 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
|
||||
setSgg,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<div className="mb-2 flex items-center">
|
||||
@@ -47,6 +54,7 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
|
||||
onChange={(e) => {
|
||||
setVar1(e.target.value);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label>
|
||||
<Input
|
||||
@@ -56,6 +64,7 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
|
||||
onChange={(e) => {
|
||||
setVar2(e.target.value);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -307,8 +307,8 @@ const Result = () => {
|
||||
onDeleteFile={handleFileDelete}
|
||||
selectedRowData={selectedRowData}
|
||||
>
|
||||
{[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md">
|
||||
<div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div>
|
||||
{[<div key='table1' className="h-[58vh] flex flex-col border rounded-lg bg-white shadow-md">
|
||||
{/* <div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div> */}
|
||||
<div className="flex-grow overflow-auto">
|
||||
<UiTable
|
||||
headName=''
|
||||
|
||||
@@ -307,8 +307,8 @@ const Result = () => {
|
||||
onDeleteFile={handleFileDelete}
|
||||
selectedRowData={selectedRowData}
|
||||
>
|
||||
{[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md">
|
||||
<div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div>
|
||||
{[<div key='table1' className="h-[58vh] flex flex-col border rounded-lg bg-white shadow-md">
|
||||
{/* <div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div> */}
|
||||
<div className="flex-grow overflow-auto">
|
||||
<UiTable
|
||||
headName=''
|
||||
|
||||
@@ -7,8 +7,8 @@ import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Home() {
|
||||
const router = useRouter();
|
||||
const userId = "admin1gmail";
|
||||
const password = "test1234!";
|
||||
const userId = "CLEANWATER";
|
||||
const password = "gktneh12!@";
|
||||
const checkToken = getCookie(AUTH_USER_ID);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 11301
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_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_WR_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_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 3001
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3001
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_WR_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_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_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
@@ -13,7 +14,7 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||
|
||||
|
||||
|
||||
+32
-32
@@ -1,39 +1,39 @@
|
||||
# NEXT_PUBLIC_SITE_ID = WR
|
||||
# NEXT_PUBLIC_PORT = 3000
|
||||
# NEXT_PUBLIC_PROXY_HOST = http://wr.hasuon.or.kr
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/api/v1
|
||||
# NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/operation-service/api/v1
|
||||
# NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
# NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
# NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
|
||||
# NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
||||
# NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
# NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
# NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 11301
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_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_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = http://wr.hasuon.or.kr
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/api/v1
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/operation-service/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# NEXT_PUBLIC_SITE_ID = WR
|
||||
# NEXT_PUBLIC_PORT = 11301
|
||||
# NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
|
||||
# # NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
# NEXT_PUBLIC_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_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
# NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
# NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
# NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
# NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
# NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
# NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
|
||||
@@ -36,7 +36,10 @@ const Map = () => {
|
||||
}, []);
|
||||
|
||||
// 체크된 레이어 정보를 받는 핸들러
|
||||
const handleCheckedLayersChange = (checkedIds: string[], checkedNodesData: any[]) => {
|
||||
const handleCheckedLayersChange = (
|
||||
checkedIds: string[],
|
||||
checkedNodesData: any[]
|
||||
) => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
};
|
||||
@@ -58,28 +61,38 @@ const Map = () => {
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
let foundFeature: any = null;
|
||||
if (
|
||||
data &&
|
||||
typeof data.getGeometry === "function" &&
|
||||
typeof data.setStyle === "function"
|
||||
let featureId = data.fid;
|
||||
const layerName = data.layerNm;
|
||||
if (layerName === "tb_wr_bdst_ruse_fclt") {
|
||||
// 재이용시설
|
||||
featureId = `${layerName}.${data.searchPk}`;
|
||||
} else if ( //빗물이용시설, 중수도시설
|
||||
layerName === "tb_wr_rnwtr_utztn_fclt" ||
|
||||
layerName == "tb_wr_rswtr_fclt"
|
||||
) {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
featureId = `${layerName}.${data.bdstInfoSn}`;
|
||||
} else if (layerName === "tb_il_swage_prcs_fclt") { //하수처리시설
|
||||
featureId = `${layerName}.${data.bscFctCd}`;
|
||||
} else if (layerName === "tb_wr_htdfl_fclt") { //온배수시설
|
||||
featureId = `${layerName}.${data.bdstRuseFcltSn}`;
|
||||
} else if (layerName == "tb_wr_ruse_fclt_dmd_co") { //수요처
|
||||
featureId = `${layerName}.${data.dmdInfoId.replaceAll("-", "")}`;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
const featureId = data.fid || data.ftrIdn || data.id;
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
}
|
||||
});
|
||||
console.warn("해당 레이어에 대한 featureId 매핑 없음", layerName);
|
||||
featureId = `${layerName}.${data.fid || data.id || data.ftrIdn}`;
|
||||
}
|
||||
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
}
|
||||
});
|
||||
|
||||
// 3. 피처 선택
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
@@ -133,7 +146,7 @@ const Map = () => {
|
||||
// />
|
||||
// )
|
||||
// }
|
||||
detailView={(props: any) =>(
|
||||
detailView={(props: any) => (
|
||||
<NewWindowPopup
|
||||
onClose={handlePopupClose} // 메모이제이션된 함수 사용
|
||||
checkedLayers={checkedLayers}
|
||||
|
||||
@@ -156,15 +156,15 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
}
|
||||
};
|
||||
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}`)
|
||||
setRainList(res)
|
||||
}
|
||||
else if (layerNm == '중수도시설') {
|
||||
else if (layerNm == 'tb_wr_rswtr_fclt') { //중수도 시설
|
||||
const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`)
|
||||
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}`)
|
||||
setMngList(res)
|
||||
}
|
||||
@@ -505,17 +505,17 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
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 (viewMode == 'list') {
|
||||
return (
|
||||
|
||||
@@ -617,63 +617,31 @@ export default function CoMatRvw() {
|
||||
<div className="col-span-12 w-full">
|
||||
<h1 className={formH1Class}>공급처 후보지</h1>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`demandMatching.splyCndtList.${0}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="후보지1">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(String(e.target.value));
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`demandMatching.splyCndtList.${1}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="후보지2">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`demandMatching.splyCndtList.${2}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="후보지3">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{[0, 1, 2].map((idx) => (
|
||||
<div key={idx} className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`splyCndtList.${idx}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label={`후보지${idx + 1}`}>
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
const newValue = {
|
||||
...(field.value || {}),
|
||||
ruseUtztnFcltNm: e.target.value,
|
||||
};
|
||||
field.onChange(newValue);
|
||||
}}
|
||||
value={field.value?.ruseUtztnFcltNm ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Form>
|
||||
<ConCostForm
|
||||
|
||||
@@ -80,6 +80,7 @@ export default function PbnstSttn() {
|
||||
}
|
||||
}, [pbnstSttn.excelList]);
|
||||
useEffect(() => {
|
||||
|
||||
if (!pbnstSttn.isInit) {
|
||||
getFlcts();
|
||||
}
|
||||
@@ -93,7 +94,7 @@ export default function PbnstSttn() {
|
||||
}, [pbnstSttnRes]);
|
||||
|
||||
useEffect(() => {
|
||||
pbnSttnInit("1", "15", ref.current, searchYear, pbnstSttn.fclts);
|
||||
pbnSttnInit("1", "15", ref.current, searchYear, fclts);
|
||||
}, [fclts]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -117,6 +118,7 @@ export default function PbnstSttn() {
|
||||
selectUnitWaterShedData={code.lgbsnCd}
|
||||
selectMiddleRegionData={code.mdmbsnCd}
|
||||
selectEnvPartData={code.lclgvrnmntCd}
|
||||
buttonOrder={["query", "init", "excel"]}
|
||||
rightClassName="ml-auto mr-6 flex items-center space-x-1"
|
||||
leftClassName="flex gap-5 w-9/12 m-4"
|
||||
leftSelectClassName="w-1/4"
|
||||
|
||||
@@ -6,8 +6,7 @@ import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType,
|
||||
import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel";
|
||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import SearchInputText from "@/components/ui/searchInput/searchInput";
|
||||
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
|
||||
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Label, Table, TableBody, TableHeader } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
@@ -22,12 +21,12 @@ export default function PbnstPrfmncSttn() {
|
||||
pbnstPrfmncSttn,
|
||||
// pbnstPrfmncInit,
|
||||
pbnstPrfmncSearch,
|
||||
getFlctsSttn,
|
||||
prfmnc,
|
||||
pbnstSttn,
|
||||
pbnNmSearch
|
||||
} = useWrStore((state) => state);
|
||||
const { monthHeadList } = prfmnc
|
||||
const { pbnstPrfHeadList, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn;
|
||||
const { pbnstPrfHeadList, prfmncResCount, prfmncRes, rawData, selectYearList, fclts } = pbnstPrfmncSttn;
|
||||
// const [isChHead, setIsChHead] = useState(false);
|
||||
const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear()));
|
||||
const [toDate, setToDate] = useState<string>(String(new Date().getFullYear()));
|
||||
@@ -39,6 +38,9 @@ export default function PbnstPrfmncSttn() {
|
||||
const { t } = useTranslation('base');
|
||||
const searchYear = String(new Date().getFullYear());
|
||||
const [excelData, setExcelData] = useState<any[]>([]);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
if (!excelData || excelData.length === 0) {
|
||||
toast.error(t('excelDownErrMsg'));
|
||||
@@ -98,11 +100,12 @@ export default function PbnstPrfmncSttn() {
|
||||
}));
|
||||
const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" };
|
||||
const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" };
|
||||
|
||||
const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year)
|
||||
const prfFilter = prfList?.filter((e) =>
|
||||
e.ym.slice(0, 4) === year
|
||||
)
|
||||
if (prfList && prfFilter.length > 0) {
|
||||
|
||||
prfList?.forEach((prfItem) => {
|
||||
prfFilter.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
|
||||
@@ -148,6 +151,7 @@ export default function PbnstPrfmncSttn() {
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPrfData(tableData);
|
||||
setExcelData(excelPrfmncSttnParsing(prfData ?? []))
|
||||
// });
|
||||
} else {
|
||||
setPrfData([]);
|
||||
}
|
||||
@@ -209,9 +213,10 @@ export default function PbnstPrfmncSttn() {
|
||||
rawData.forEach((item) => {
|
||||
// 실적 테이블 데이터
|
||||
if (chartId) {
|
||||
if (item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltId === chartId) {
|
||||
if (item.prfList.find((e) => e.ym.slice(0, 4) === year) && item.prfList?.[0]?.pbnstRuseFcltId === chartId) {
|
||||
prfTableData(item.prfList, year);
|
||||
}
|
||||
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltId === chartId).forEach((element) => {
|
||||
// 누적
|
||||
wshwtr += element.wshwtr;
|
||||
@@ -435,7 +440,6 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}, [inLineData]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (outLineData?.chartData1) {
|
||||
const newChartConfig = {
|
||||
@@ -489,22 +493,28 @@ export default function PbnstPrfmncSttn() {
|
||||
sigunText: ""
|
||||
}
|
||||
tableHeadMaker(Number(searchYear), Number(searchYear));
|
||||
pbnstPrfmncSearch(returnType, "", searchYear, searchYear)
|
||||
getFlctsSttn();
|
||||
pbnstPrfmncSearch(1, returnType, "", searchYear, searchYear, fclts)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setbdstTable(prfmncRes.map((e, idx) => {
|
||||
pbnstPrfmncSearch(pageNation, ref.current, pbnRuseNm, fromDate, toDate, pbnstPrfmncSttn.fclts);
|
||||
isResetPage(false)
|
||||
}, [fclts, pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
const tableData = prfmncRes.map((e, idx) => {
|
||||
|
||||
return ({
|
||||
...e,
|
||||
number: String(idx + 1)
|
||||
})
|
||||
}))
|
||||
})
|
||||
setbdstTable(tableData)
|
||||
|
||||
if (prfmncRes?.[0]?.pbnstRuseFcltId) setChartId(prfmncRes[0].pbnstRuseFcltId)
|
||||
}, [prfmncRes]);
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnRuseNm.length > 1)
|
||||
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear, []);
|
||||
@@ -515,7 +525,6 @@ export default function PbnstPrfmncSttn() {
|
||||
setChartId(prfmncRes[index].pbnstRuseFcltId)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -533,6 +542,7 @@ export default function PbnstPrfmncSttn() {
|
||||
rightClassName="ml-auto mr-6 flex items-center space-x-1"
|
||||
leftClassName="flex gap-5 w-9/12 m-4"
|
||||
leftSelectClassName="w-1/6"
|
||||
buttonOrder={["query", "init", "excel"]}
|
||||
leftChildren={<div className="col-span-5">
|
||||
<div className="flex flex-row">
|
||||
{/* <div className="flex flex-row items-center"> */}
|
||||
@@ -548,7 +558,7 @@ export default function PbnstPrfmncSttn() {
|
||||
selectArray={yearOptions}
|
||||
value={fromDate}
|
||||
onSelectValue={(val: string | number) => setFromDate(String(val))} />
|
||||
<span> ~</span>
|
||||
<span> ~</span>
|
||||
<SelectBox
|
||||
// className="w-full h-full text-2xl mx-4"
|
||||
className="flex-none w-32 h-full text-2xl mr-4"
|
||||
@@ -557,18 +567,16 @@ export default function PbnstPrfmncSttn() {
|
||||
selectArray={yearOptions}
|
||||
value={toDate}
|
||||
onSelectValue={(val: string | number) => setToDate(String(val))} />
|
||||
<Label className="w-28 mt-2 text-xl">
|
||||
{"시설명"}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={" h-full text-2xl"}
|
||||
label={""}
|
||||
textValue={pbnRuseNm || ""}
|
||||
setText={setPbnRuseNm}
|
||||
/>
|
||||
</div>
|
||||
<SearchInputText
|
||||
label={"하수처리시설"}
|
||||
initValue={pbnRuseNm ?? ""}
|
||||
setValue={(searchNm?: string) => {
|
||||
setPbnRuseNm(searchNm || "");
|
||||
}}
|
||||
setRtnData={/*function (rtnData: any[]): void {setbdstTable(rtnData);}*/
|
||||
() => { }
|
||||
}
|
||||
searchList={pbnstSttn.pbnstSearchData || []}
|
||||
></SearchInputText>
|
||||
{/* <SelectBox
|
||||
className="h-full text-2xl"
|
||||
label="재이용시설명"
|
||||
@@ -579,7 +587,7 @@ export default function PbnstPrfmncSttn() {
|
||||
</div>
|
||||
</div>}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
pbnstPrfmncSearch(returnType, pbnRuseNm ?? "", fromDate, toDate);
|
||||
pbnstPrfmncSearch(1, returnType, pbnRuseNm ?? "", fromDate, toDate, fclts);
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
@@ -594,6 +602,7 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}
|
||||
}
|
||||
isResetPage(true)
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void { }}
|
||||
@@ -608,13 +617,14 @@ export default function PbnstPrfmncSttn() {
|
||||
headName={undefined}
|
||||
tableData={bdstTable || []}
|
||||
headlist={pbnstPrfHeadList}
|
||||
pageSize={20}
|
||||
total={10000}
|
||||
pageSize={5}
|
||||
total={prfmncResCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index ?? undefined, headId);
|
||||
}}
|
||||
onPageChange={() => { }}
|
||||
onPageChange={setPageNation}
|
||||
index={0}
|
||||
resetPageNo={resetPage}
|
||||
/>
|
||||
|
||||
<hr />
|
||||
@@ -631,54 +641,62 @@ export default function PbnstPrfmncSttn() {
|
||||
|
||||
<div className="flex">
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
{chartData.find((e) => e.val > 0) ?
|
||||
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 장내·외 용수 총 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
{dnInUsage.find((e) => e.val > 0) ?
|
||||
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 장내용수 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
{dnOutUsage.find((e) => e.val > 0) ?
|
||||
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 장외용수 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<h1 className="">장내·외 월별 하수재이용실적 현황</h1>
|
||||
<div className="flex">
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
|
||||
{barData.length > 0 ?
|
||||
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 월별 장내·외 용수 총 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
{inLineData && Object.values(inLineData).every(arr => Array.isArray(arr) && arr.length === 0) ?
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 월별 장내 용수 실적(m³) 데이터가 없습니다.
|
||||
</div>
|
||||
:
|
||||
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
</div>
|
||||
{outLineData && Object.values(outLineData).every(arr => Array.isArray(arr) && arr.length === 0) ?
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 월별 장외 용수 총 실적(m³) 데이터가 없습니다.
|
||||
</div>
|
||||
:
|
||||
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
}</div>
|
||||
</div>
|
||||
<h1 className="">하수재이용실적 현황 (단위: m³)</h1>
|
||||
{/* <ListDiv className="col-span-8 pr-6 "> */}
|
||||
{/* <ScrollArea className="h-[60vh]"> */}
|
||||
{/* <div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{"하수처리수재이용 실적(m³) 등록결과"}
|
||||
</h3>
|
||||
</div> */}
|
||||
|
||||
{/* <UiTable
|
||||
headName={undefined}
|
||||
tableData={prfData || []}
|
||||
headlist={monthHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={()=>{}}>
|
||||
</UiTable> */}
|
||||
|
||||
<ListDiv className="col-span-8 pr-6 ">
|
||||
<ScrollArea className={prfData && prfData.length > 0 ? "h-[60vh]" : ""}>
|
||||
{/* <div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{"하수재이용실적 현황 (단위: m³)"}
|
||||
</h3>
|
||||
</div> */}
|
||||
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(monthHeadList, [])}
|
||||
@@ -690,10 +708,7 @@ export default function PbnstPrfmncSttn() {
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
{/* </ScrollArea> */}
|
||||
</ListDiv>
|
||||
|
||||
{/* </ListDiv> */}
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -94,6 +94,12 @@ export const DmdCoReqSchema = z.object({
|
||||
demandMatching: DemandMatchingSchema.nullish(),
|
||||
demandCst: DemandCstSchema.nullish(),
|
||||
ruseUtztnFcltNm: z.string().nullish(),
|
||||
splyCndtList: z.array(
|
||||
z.object({
|
||||
ruseUtztnFcltNm: z.string(),
|
||||
ruseUtztnFcltCd: z.string(),
|
||||
})
|
||||
).nullish(),
|
||||
totalConstCost: z.number().nullish(),
|
||||
});
|
||||
|
||||
@@ -147,3 +153,10 @@ export type rateFeeType = {
|
||||
stdCost: number;
|
||||
rt: number;
|
||||
};
|
||||
|
||||
|
||||
// 공급 후보자 타입 정의
|
||||
export type SupplyCandidate = {
|
||||
ruseUtztnFcltNm: string;
|
||||
ruseUtztnFcltCd: string;
|
||||
};
|
||||
@@ -4,11 +4,13 @@ import { monthSttnHeadListExport, pbnstPrfmncSttnHeadListExport, pbnstYearHeadLi
|
||||
import type { FcPrfType, PrfType } from "../../prfmncReg/pbnstPrfmncReg/type";
|
||||
import type { pubHasuType, selectLabel } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { ReturnType } from "@common/business_components";
|
||||
import type { WaterReuseFacility } from "../../ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||
|
||||
type pbnstPrfmncSttnActions = {
|
||||
tableHeadMaker: (startYear: number, endYear: number) => void;
|
||||
pbnstPrfmncInit: (page: string, sggOrCity: string) => void;
|
||||
pbnstPrfmncSearch: (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => void;
|
||||
// pbnstPrfmncInit: (page: string, sggOrCity: string) => void;
|
||||
pbnstPrfmncSearch: (page: number, returnType: ReturnType, fcltNm: string, fromDate: string, toDate: string, fclts: string[]) => void;
|
||||
getFlctsSttn: () => void;
|
||||
}
|
||||
|
||||
const pbnstPrfmncRes: PrfType[] = [];
|
||||
@@ -22,7 +24,9 @@ export type pbnstPrfmncSttnState = {
|
||||
isInit: boolean;
|
||||
rawData: any[];
|
||||
selectYearList: selectLabel[]
|
||||
monthSttnHeadList:TableUpperProps[];
|
||||
monthSttnHeadList: TableUpperProps[];
|
||||
fclts: string[];
|
||||
prfmncResCount: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,34 +40,75 @@ export const pbnstPrfmncSttnExport: pbnstPrfmncSttnState = {
|
||||
isInit: false,
|
||||
rawData: [],
|
||||
selectYearList: [],
|
||||
monthSttnHeadList:monthSttnHeadListExport
|
||||
monthSttnHeadList: monthSttnHeadListExport,
|
||||
fclts: [],
|
||||
prfmncResCount: 1,
|
||||
}
|
||||
}
|
||||
|
||||
const checkWrRegList = async () => {
|
||||
const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`);
|
||||
return wrRegList;
|
||||
};
|
||||
const hasuListFetch = async (page: string, sggOrCity: string) => {
|
||||
const checkWrRegListRes = await checkWrRegList();
|
||||
const rainRes = await postFectch(
|
||||
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
|
||||
checkWrRegListRes?.fcltCds,
|
||||
fetchType.COMMON
|
||||
const hasuListFetch = async (
|
||||
page: number,
|
||||
returnType: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string,
|
||||
flcts: string[]
|
||||
) => {
|
||||
let url = `/prcsFclt/ruseInfo/`;
|
||||
|
||||
if (returnType.partValue === "A") {
|
||||
url += `${page}/5/${returnType.partValue}/${
|
||||
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
|
||||
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
||||
}/0/1/SW`
|
||||
} else if (returnType.partValue === "R") {
|
||||
url += `${page}/5/${returnType.partValue}/${returnType.regionValue
|
||||
? returnType.regionValue
|
||||
: returnType.unitWaterShedValue
|
||||
? returnType.unitWaterShedValue
|
||||
: returnType.middleRegionValue
|
||||
}/0/1/SW`
|
||||
} else if (returnType.partValue === 'G') {
|
||||
url += `${page}/5/${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW`
|
||||
|
||||
} else {
|
||||
url += `1/2/A/0/0/1/SW`
|
||||
}
|
||||
|
||||
if (searchNm && searchNm?.length > 0) {
|
||||
url += "/" + searchNm
|
||||
}
|
||||
|
||||
const pbnList = await postFectch(url, flcts, fetchType.COMMON);
|
||||
const getRuseList = await postFectch(
|
||||
`/reuseFc/pubDetailList/${year}`,
|
||||
flcts,
|
||||
fetchType.WR
|
||||
);
|
||||
const data = checkWrRegListRes.fcPrfList.map((item: FcPrfType) => {
|
||||
const findData = rainRes.data.find(
|
||||
(fclt: pubHasuType) =>
|
||||
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
||||
);
|
||||
return {
|
||||
sido: findData?.sido,
|
||||
gugun: findData?.gugun,
|
||||
bscFctNm: findData?.bscFctNm,
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltId: item.pbnstRuseFcltId,
|
||||
};
|
||||
});
|
||||
let count = 0;
|
||||
const checkWrRegListRes = getRuseList.data;
|
||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||
(item: FcPrfType) => {
|
||||
if (!item.prfList || item.prfList.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const findData = pbnList.data.find(
|
||||
(fclt: pubHasuType) =>
|
||||
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
||||
);
|
||||
if (findData) {
|
||||
count++;
|
||||
return {
|
||||
sido: findData?.sido || '-',
|
||||
gugun: findData?.gugun || '-',
|
||||
bscFctNm: findData?.bscFctNm || '-',
|
||||
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
|
||||
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
|
||||
bscFctCd: findData?.bscFctCd || '-',
|
||||
count
|
||||
}
|
||||
}
|
||||
}
|
||||
).filter(Boolean);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -71,6 +116,15 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
getFlctsSttn: async () => {
|
||||
const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc')
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
fclts: fclts
|
||||
},
|
||||
}));
|
||||
},
|
||||
tableHeadMaker: (startYear: number, endYear: number) => {
|
||||
let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport];
|
||||
const selectList = [] as unknown as selectLabel[]
|
||||
@@ -79,7 +133,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
if (yearHead) {
|
||||
yearHead.forEach((item: { id?: string; }) => {
|
||||
if (item.id) {
|
||||
if(item.id === "year") {item.id = ""; return;}
|
||||
if (item.id === "year") { item.id = ""; return; }
|
||||
item.id = i + item.id;
|
||||
}
|
||||
})
|
||||
@@ -100,117 +154,144 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
};
|
||||
});
|
||||
},
|
||||
pbnstPrfmncInit: async (page: string, sggOrCity: string) => {
|
||||
// pbnstPrfmncInit: async (page: string, sggOrCity: string) => {
|
||||
// try {
|
||||
// const prfmncRes = await hasuListFetch(page, sggOrCity);
|
||||
// return set((state: pbnstPrfmncSttnState) => ({
|
||||
// ...state,
|
||||
// pbnstPrfmncSttn: {
|
||||
// ...state.pbnstPrfmncSttn,
|
||||
// prfmncRes: prfmncRes,
|
||||
// isInit: true,
|
||||
// },
|
||||
// }));
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// }
|
||||
// },
|
||||
pbnstPrfmncSearch: async (page: number, returnType: ReturnType, fcltNm: string, fromDate: string, toDate: string, fclts: string[]) => {
|
||||
try {
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity);
|
||||
const prfmncRes = await hasuListFetch(
|
||||
page,
|
||||
returnType,
|
||||
fcltNm,
|
||||
toDate,
|
||||
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 outUsageSum = 0;
|
||||
let year = "";
|
||||
const yearsData = [] as any
|
||||
|
||||
res.data.forEach((item: any) => {
|
||||
if (item.prfList.length === 0) {
|
||||
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = 0;
|
||||
yearVal[`${year}outUsage`] = 0;
|
||||
yearVal[`${year}total`] = 0;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
item.prfList.forEach((acc) => {
|
||||
year = acc.ym?.substring(0, 4) ?? "";
|
||||
inUsageSum =
|
||||
(acc.wshwtr ?? 0) + //조경용수
|
||||
(acc.coolUswtr ?? 0) + //냉각수
|
||||
(acc.cleanUswtr ?? 0) + //청소수
|
||||
(acc.drwtUswtr ?? 0) + //식수대
|
||||
(acc.dltnUswtr ?? 0) + //희석용수
|
||||
(acc.ithlRswtr ?? 0) + //중수도
|
||||
(acc.ithlEtcUswtr ?? 0) //기타
|
||||
outUsageSum =
|
||||
(acc.cleanToilUswtr ?? 0) + //청소화장실용수
|
||||
(acc.resn ?? 0) + //세척살수용도
|
||||
(acc.lndwtr ?? 0) + //조경용수
|
||||
(acc.hydUswtr ?? 0) + //친수용수
|
||||
(acc.ugwtChr ?? 0) + //지하수충전
|
||||
(acc.farmUswtr ?? 0) + //농업용수
|
||||
(acc.rvrKeepUswtr ?? 0) + //하천등유지용수
|
||||
(acc.indstUswtr ?? 0); //공업용수
|
||||
const yearData = yearsData.find(
|
||||
(yearItem) =>
|
||||
yearItem.year === year &&
|
||||
yearItem.pbnstRuseFcltId == acc.pbnstRuseFcltId
|
||||
);
|
||||
|
||||
if (yearData) {
|
||||
yearData[`${year}inUsage`] += inUsageSum;
|
||||
yearData[`${year}outUsage`] += outUsageSum;
|
||||
yearData[`${year}total`] += (inUsageSum + outUsageSum);
|
||||
} else {
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: acc.pbnstRuseFcltId, ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = inUsageSum;
|
||||
yearVal[`${year}outUsage`] = outUsageSum;
|
||||
yearVal[`${year}total`] = inUsageSum + outUsageSum;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 연도 필터링
|
||||
const from = Number(fromDate);
|
||||
const to = Number(toDate);
|
||||
|
||||
// 연도별 실적을 시설별로 병합
|
||||
const mergedMap: { [key: string]: any } = {};
|
||||
|
||||
yearsData.forEach((acc) => {
|
||||
const facilityId = acc.pbnstRuseFcltId;
|
||||
const year = acc.year;
|
||||
|
||||
// 연도 필터 범위 안에만 포함
|
||||
if (!year || Number(year) < from || Number(year) > to) return;
|
||||
|
||||
if (!mergedMap[facilityId]) {
|
||||
mergedMap[facilityId] = {
|
||||
pbnstRuseFcltId: facilityId,
|
||||
ruseUtztnFcltNm: acc.ruseUtztnFcltNm,
|
||||
};
|
||||
}
|
||||
|
||||
// 해당 연도 데이터 추가
|
||||
mergedMap[facilityId][`${year}inUsage`] = acc[`${year}inUsage`] ?? 0;
|
||||
mergedMap[facilityId][`${year}outUsage`] = acc[`${year}outUsage`] ?? 0;
|
||||
mergedMap[facilityId][`${year}total`] = acc[`${year}total`] ?? 0;
|
||||
});
|
||||
|
||||
// prfmncRes 정보 merge
|
||||
const resData = Object.values(mergedMap).map((item: any) => {
|
||||
const match = prfmncRes.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
|
||||
return match ? { ...item, ...match } : item;
|
||||
});
|
||||
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
prfmncRes: prfmncRes,
|
||||
isInit: true,
|
||||
// prfmncRes: prfmncRes,
|
||||
prfmncResCount: fclts.length - 5,
|
||||
isInit: false,
|
||||
prfmncRes: resData,
|
||||
rawData: res.data
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} catch (errorHasu) {
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
pbnstPrfmncSearch: async (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => {
|
||||
let searchUrl = "";
|
||||
if (returnType.sigunValue !== "0") {
|
||||
if (swtrmtFcltNm !== "") {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW${'/' + swtrmtFcltNm}`;
|
||||
} else {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW`;
|
||||
}
|
||||
} else {
|
||||
if (swtrmtFcltNm !== "") {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW${'/' + swtrmtFcltNm}`;
|
||||
} else {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW`;
|
||||
}
|
||||
}
|
||||
|
||||
const pbnstRes = await getFetch(
|
||||
fetchType.COMMON,
|
||||
searchUrl
|
||||
);
|
||||
|
||||
const bscFctCdList = pbnstRes.map((item: any) => {
|
||||
return item.bscFctCd;
|
||||
})
|
||||
const res = await postFectch(
|
||||
`/reuseFc/pubDetailList/${fromDate}/${toDate}`,
|
||||
bscFctCdList,
|
||||
`wr`,
|
||||
)
|
||||
let inUsageSum = 0;
|
||||
let outUsageSum = 0;
|
||||
let year = "";
|
||||
const yearsData = [] as any
|
||||
|
||||
res.data.forEach((item : any) => {
|
||||
if (item.prfList.length === 0) {
|
||||
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = 0;
|
||||
yearVal[`${year}outUsage`] = 0;
|
||||
yearVal[`${year}total`] = 0;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
item.prfList.forEach((acc) => {
|
||||
year = acc.ym?.substring(0, 4) ?? "";
|
||||
inUsageSum =
|
||||
(acc.wshwtr ?? 0) + //조경용수
|
||||
(acc.coolUswtr ?? 0) + //냉각수
|
||||
(acc.cleanUswtr ?? 0) + //청소수
|
||||
(acc.drwtUswtr ?? 0) + //식수대
|
||||
(acc.dltnUswtr ?? 0) + //희석용수
|
||||
(acc.ithlRswtr ?? 0) + //중수도
|
||||
(acc.ithlEtcUswtr ?? 0) //기타
|
||||
outUsageSum =
|
||||
(acc.cleanToilUswtr ?? 0) + //청소화장실용수
|
||||
(acc.resn ?? 0)+ //세척살수용도
|
||||
(acc.lndwtr ?? 0) + //조경용수
|
||||
(acc.hydUswtr ?? 0) + //친수용수
|
||||
(acc.ugwtChr ?? 0) + //지하수충전
|
||||
(acc.farmUswtr ?? 0) + //농업용수
|
||||
(acc.rvrKeepUswtr ?? 0) + //하천등유지용수
|
||||
(acc.indstUswtr ?? 0); //공업용수
|
||||
const yearData = yearsData.find(
|
||||
(yearItem) =>
|
||||
yearItem.year === year &&
|
||||
yearItem.pbnstRuseFcltId == acc.pbnstRuseFcltId
|
||||
);
|
||||
|
||||
if (yearData) {
|
||||
yearData[`${year}inUsage`] += inUsageSum;
|
||||
yearData[`${year}outUsage`] += outUsageSum;
|
||||
yearData[`${year}total`] += (inUsageSum + outUsageSum);
|
||||
} else {
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: acc.pbnstRuseFcltId, ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = inUsageSum;
|
||||
yearVal[`${year}outUsage`] = outUsageSum;
|
||||
yearVal[`${year}total`] = inUsageSum + outUsageSum;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
});
|
||||
});
|
||||
const resData: any[] = []
|
||||
pbnstRes.forEach((acc) => {
|
||||
const data = yearsData.find((item) => item.pbnstRuseFcltId.substring(0, 11) === acc.bscFctCd)
|
||||
if (data) {
|
||||
resData.push({ ...acc, ...data })
|
||||
}
|
||||
})
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
prfmncRes: resData,
|
||||
rawData: res.data
|
||||
},
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,6 +206,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
return {
|
||||
getFlcts: async () => {
|
||||
const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc')
|
||||
|
||||
return set((state: pbnstSttnState) => ({
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
@@ -293,6 +294,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
year,
|
||||
fclts
|
||||
);
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
SERVER_API_CS_TUS_URL,
|
||||
SERVER_API_CS_URL,
|
||||
SERVER_API_FO_URL,
|
||||
SERVER_API_URL,
|
||||
SERVER_API_WR_URL,
|
||||
} from "@/src/shared/config";
|
||||
|
||||
//const DEV_PORT = "11080";
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
//export const CS_TUS_UPLOAD= "/attach-service/api/v1/tus/upload";
|
||||
|
||||
export const LOCAL_URL_WR = PROXY_HOST + `/api/v1`;
|
||||
export const DEV_URL_WR = SERVER_API_URL;
|
||||
export const DEV_URL_WR = SERVER_API_WR_URL;
|
||||
export const DEV_URL_FO = SERVER_API_FO_URL;
|
||||
export const LOCAL_URL = PROXY_HOST;
|
||||
export const CS_URL = SERVER_API_CS_URL;
|
||||
|
||||
@@ -156,6 +156,10 @@ export default function ConCostForm({
|
||||
toast.error("공사비 계산 진행 후 저장을 눌러주새요");
|
||||
return;
|
||||
}
|
||||
|
||||
const splycd = form.getValues("splyCndtList")
|
||||
const pk = splycd&&splycd[0]?.ruseUtztnFcltCd?splycd[0]?.ruseUtztnFcltCd:'11000SW001R1'
|
||||
|
||||
if (type === "mat") {
|
||||
if (value.demandCst) {
|
||||
const data: DedMatUpdateType = {
|
||||
@@ -178,8 +182,9 @@ export default function ConCostForm({
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
toast.dismiss(t.id);
|
||||
|
||||
coMatRvwUpdate(
|
||||
"11000SW001R1",
|
||||
pk,
|
||||
form.getValues("dmdInfoId"),
|
||||
data
|
||||
);
|
||||
@@ -194,12 +199,15 @@ export default function ConCostForm({
|
||||
</span>
|
||||
));
|
||||
} else {
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoId"), data);
|
||||
|
||||
coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data);
|
||||
}
|
||||
}
|
||||
} else if (type === "hist") {
|
||||
delete value.totalConstCost;
|
||||
delete value.ruseUtztnFcltNm;
|
||||
console.log("onSubmit data ", pk);
|
||||
|
||||
ruseRvwCalUpdate(value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,10 +48,10 @@ export default function CoDetailModal({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ScrollArea className="h-[85vh]">
|
||||
<ScrollArea className="h-[85vh] mx-8">
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onFormSubmit)}>
|
||||
<div className="grid grid-cols-12 flex items-center card-header">
|
||||
<div className="grid grid-cols-12 items-center card-header">
|
||||
<h1 className="text-2xl font-medium text-label col-span-10">
|
||||
잠재수요처 상세정보
|
||||
</h1>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "WR";
|
||||
export const PORT = process.env.NEXT_PUBLIC_PORT || "3001";
|
||||
export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1';
|
||||
export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1';
|
||||
export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1';
|
||||
export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000';
|
||||
export const SERVER_API_CS_TUS_URL = process.env.NEXT_PUBLIC_CS_TUS_UPLOAD ||'/attach-service/api/v1/tus/upload'
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Search } from 'lucide-react';
|
||||
import OlMap from 'ol/Map';
|
||||
import Overlay from 'ol/Overlay';
|
||||
import View from 'ol/View';
|
||||
import { defaults as defaultControls, OverviewMap } from 'ol/control';
|
||||
import { defaults } from 'ol/interaction';
|
||||
@@ -8,15 +7,12 @@ import * as olProj from 'ol/proj';
|
||||
import { register } from 'ol/proj/proj4';
|
||||
import proj4 from 'proj4';
|
||||
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import GisLonLat from './GisLonLat';
|
||||
import GisMapToggle from './GisMapToggle';
|
||||
import GisSelect from './GisSelect';
|
||||
import GisToolBar from './GisToolBar';
|
||||
import GisTree from './GisTree';
|
||||
import './lib/css/gis.common.css';
|
||||
import GisApp from './lib/gis.core';
|
||||
// import FacilityInfoPopup from './FacilityInfoPopup';
|
||||
|
||||
export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null });
|
||||
export const useGisContext = () => useContext(GisContext);
|
||||
@@ -87,9 +83,8 @@ export const searchUpperPpls = async (fcltMngNo) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function Gis({
|
||||
isOpen,
|
||||
isOpen, //우측 상세 레이어 팝업
|
||||
gisMaps,
|
||||
isSearchModalOpen,
|
||||
treeData = [],
|
||||
@@ -103,7 +98,7 @@ function Gis({
|
||||
detailView: DetailView,
|
||||
onFeatureSelect,
|
||||
setIsSearchModalOpen,
|
||||
onCheckedLayersChange
|
||||
onCheckedLayersChange,
|
||||
}) {
|
||||
const mapRef = useRef();
|
||||
const [mapObject, setMapObject] = useState({});
|
||||
@@ -132,91 +127,102 @@ function Gis({
|
||||
|
||||
// Feature Click Event
|
||||
const handleFeatureSelect = useCallback((data) => {
|
||||
gisMap = mapInstanceRef.current;
|
||||
console.log(data);
|
||||
// gisMap = mapInstanceRef.current;
|
||||
// gisMap = mapInstanceRef.current;
|
||||
|
||||
if (!gisMap) {
|
||||
console.warn('지도가 초기화되지 않았습니다.');
|
||||
return;
|
||||
}
|
||||
// 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;
|
||||
// // 항상 같은 select 객체 사용
|
||||
// const select = GisApp.Module.select;
|
||||
// if (!select) return;
|
||||
|
||||
// 1. 기존 선택 초기화
|
||||
select.resetSelectedFeature();
|
||||
// // 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// // 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();
|
||||
// // 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);
|
||||
}
|
||||
// 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);
|
||||
|
||||
setFeatureData(data);
|
||||
setIsOpen(true);
|
||||
setIsSearchModalOpen(false);
|
||||
onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출
|
||||
console.log(data)
|
||||
}, [mapInstanceRef]);
|
||||
|
||||
// 지도 생성 및 초기화
|
||||
@@ -282,6 +288,7 @@ function Gis({
|
||||
gisCore.changeBaseLayer('base');
|
||||
setMapObject({ map: map });
|
||||
mapInstanceRef.current = map; // 생성 완료 플래그 설정
|
||||
|
||||
}, []);
|
||||
|
||||
// treeData 변경 시 레이어 코드 생성
|
||||
@@ -298,7 +305,7 @@ function Gis({
|
||||
|
||||
//setTreeData(data);
|
||||
// 편집 가능한 레이어 목록 생성
|
||||
const layerItems = getLayerItems(layerCode);
|
||||
//const layerItems = getLayerItems(layerCode);
|
||||
//setEditLayerItems(prev => [...layerItems])
|
||||
}, [treeData]);
|
||||
|
||||
@@ -447,7 +454,7 @@ function Gis({
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
onCheckedLayersChange?.(checkedIds, checkedNodesData);
|
||||
}, 0);
|
||||
}, 1000);
|
||||
}, [onCheckedLayersChange]);
|
||||
|
||||
return (
|
||||
@@ -459,9 +466,9 @@ function Gis({
|
||||
visible={tabVisible}
|
||||
setVisible={setTabVisible}
|
||||
onCheckedChange={handleCheckedLayersChange}
|
||||
onLayerIconClick={(nodeNm) => {
|
||||
layerNmRef.current = nodeNm
|
||||
setLayerNm(nodeNm); setIsOpen(true); const dummyFeature = {
|
||||
onLayerIconClick={(layerNm) => {
|
||||
layerNmRef.current = layerNm
|
||||
setLayerNm(layerNm); setIsOpen(true); const dummyFeature = {
|
||||
getProperties: () => ({}), // 최소 구조
|
||||
};
|
||||
onFeatureSelect(dummyFeature);
|
||||
|
||||
@@ -31,7 +31,6 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
// 기본으로 체크된 노드들 찾기
|
||||
const defaultChecked = getDefaultCheckedNodes(nodes);
|
||||
setChecked(defaultChecked);
|
||||
console.log('defaultChecked : ', defaultChecked);
|
||||
|
||||
// 기본으로 확장된 노드들 설정
|
||||
const defaultExpanded = Array.from(new Set([
|
||||
@@ -188,9 +187,9 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
image.src = canvas.toDataURL('image/png');
|
||||
return image;
|
||||
};
|
||||
const handleLayerImgClick = (nodeNm, nodeId) => {
|
||||
const handleLayerImgClick = (nodeNm, nodeId, layerNm) => {
|
||||
if(!checked.includes(nodeId)) alert('시설을 선택해주세요')
|
||||
else onLayerIconClick(nodeNm)
|
||||
else onLayerIconClick(layerNm)
|
||||
}
|
||||
if (!treeData || treeData.length === 0) return null;
|
||||
|
||||
@@ -224,7 +223,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
<input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer" />
|
||||
{node.icon && <span>{node.icon}</span>}
|
||||
<span className="text-[1.3rem] font-medium text-label">{node.text}</span>
|
||||
{imageVisible ? depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text, node.id)}} alt={node.text}></img></span> : null}
|
||||
{imageVisible ? depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text, node.id, node.data.lyrTyNm)}} alt={node.text}></img></span> : null}
|
||||
</div>
|
||||
)}
|
||||
sort={(a, b) => {
|
||||
|
||||
@@ -88,7 +88,7 @@ GisOlStyle.prototype = {
|
||||
}
|
||||
|
||||
let baseResolution = 2;
|
||||
let minScale = 0.4;
|
||||
let minScale = 0.8;
|
||||
let maxScale = 1.5;
|
||||
let scale = baseResolution / resolution > maxScale ? maxScale : baseResolution / resolution;
|
||||
scale = Math.max(minScale, Math.min(maxScale, scale));
|
||||
@@ -176,7 +176,7 @@ GisOlStyle.prototype = {
|
||||
|
||||
const properties = feature.getProperties();
|
||||
const overLayId = feature?.get('overLayId');
|
||||
const overLayMinZoom = layer.get('overLayMinZoom') || '12';
|
||||
const overLayMinZoom = layer.get('overLayMinZoom') || '10';
|
||||
const overLayOffset = layer?.get('overLayOffset');
|
||||
let findoOverlay = this.overlays[overLayId];
|
||||
if (findoOverlay) {
|
||||
@@ -193,7 +193,8 @@ GisOlStyle.prototype = {
|
||||
|
||||
if (typeof overlayHtml === 'string') {
|
||||
//const sanitizedHtml = DOMPurify.sanitize(overlayHtml);
|
||||
overlayContainer.innerHTML = sanitizedHtml;
|
||||
//overlayContainer.innerHTML = sanitizedHtml;
|
||||
overlayContainer.innerHTML = overlayHtml;
|
||||
}
|
||||
// React 컴포넌트일 경우 createPortal() 사용
|
||||
else if (React.isValidElement(overlayHtml)) {
|
||||
@@ -205,7 +206,7 @@ GisOlStyle.prototype = {
|
||||
element: overlayContainer,
|
||||
positioning: 'bottom-center',
|
||||
stopEvent: false,
|
||||
offset: overLayOffset ? overLayOffset : [0, 0], // 오프셋 설정 (위치 조정)
|
||||
offset: overLayOffset ? overLayOffset : [80, 0], // 오프셋 설정 (위치 조정)
|
||||
});
|
||||
this.overlays[overLayId] = overlay;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const UITab = React.forwardRef<
|
||||
return (
|
||||
<Tabs
|
||||
defaultValue={defaultValue || tabList[0]?.value}
|
||||
className={"w-full space-x-1 border-b border-gray-200"}
|
||||
className={"w-full space-x-1 border-gray-200"}
|
||||
onValueChange={onValueChange}
|
||||
ref={ref}
|
||||
{...props}
|
||||
|
||||
@@ -78,6 +78,10 @@ export function UiTable({
|
||||
}
|
||||
}, [tableData, headlist]);
|
||||
|
||||
useEffect(() => {
|
||||
setIdx(index);
|
||||
}, [index])
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
setCur(page);
|
||||
onPageChange(page);
|
||||
@@ -120,10 +124,10 @@ export function UiTable({
|
||||
(boldArray.includes(index) ? (
|
||||
<TableCell
|
||||
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${cellClick && idx === index
|
||||
? "cursor-pointer !font-[1000]"
|
||||
: cellClick
|
||||
? "cursor-pointer"
|
||||
: ""
|
||||
? "cursor-pointer !font-[1000]"
|
||||
: cellClick
|
||||
? "cursor-pointer"
|
||||
: ""
|
||||
} sticky top-20 z-40 bg-secondary !font-bold`}
|
||||
style={{ top: `${headerHeight + index * 32 - 4}px` }}
|
||||
onClick={() => handleCellClick(index, head.id)}
|
||||
@@ -151,10 +155,10 @@ export function UiTable({
|
||||
) : (
|
||||
<TableCell
|
||||
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${cellClick && idx === index
|
||||
? "cursor-pointer !font-[1000]"
|
||||
: cellClick
|
||||
? "cursor-pointer"
|
||||
: ""
|
||||
? "cursor-pointer !font-[1000]"
|
||||
: cellClick
|
||||
? "cursor-pointer"
|
||||
: ""
|
||||
} mt-[${boldArray.length * 40}px]`}
|
||||
onClick={() => handleCellClick(index, head.id)}
|
||||
key={`cell-${head.id}-${index}`}
|
||||
|
||||
Reference in New Issue
Block a user