Compare commits
103
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f002c05292 | ||
|
|
0a2284138c | ||
|
|
536f07a13f | ||
|
|
bf3ced7a00 | ||
|
|
0d9ebcbd55 | ||
|
|
64e5c4c0fb | ||
|
|
29e8223efa | ||
|
|
d12610db98 | ||
|
|
ab0d787615 | ||
|
|
39e2734a49 | ||
|
|
bc016c71ae | ||
|
|
77b4ba01b4 | ||
|
|
eac09bde2e | ||
|
|
ebd2a9f2c8 | ||
|
|
41b90bd7b5 | ||
|
|
6844db4c29 | ||
|
|
311ce14fc9 | ||
|
|
3c5d37cc6c | ||
|
|
d92d4d3949 | ||
|
|
858a2c0bac | ||
|
|
0bc87e2082 | ||
|
|
5588eddbc5 | ||
|
|
682cc1297c | ||
|
|
e26d800449 | ||
|
|
e6be168d0d | ||
|
|
ad6e4484b7 | ||
|
|
92f12c2104 | ||
|
|
75d2d0c827 | ||
|
|
675a1a09fa | ||
|
|
b93efa5503 | ||
|
|
00b0832acb | ||
|
|
6e109e970e | ||
|
|
00ecc1dc72 | ||
|
|
328787e1b2 | ||
|
|
1862497bf4 | ||
|
|
344e77eafa | ||
|
|
1bf8afd9ac | ||
|
|
f50de19137 | ||
|
|
f9e8748906 | ||
|
|
2f5d76ed38 | ||
|
|
0b8559891a | ||
|
|
c916977292 | ||
|
|
d898121764 | ||
|
|
500a6b1489 | ||
|
|
ffa1781005 | ||
|
|
b47c0dff2b | ||
|
|
7e7335530e | ||
|
|
2d474696e6 | ||
|
|
a89eb98191 | ||
|
|
2b28bae58f | ||
|
|
9fadb172f9 | ||
|
|
99b0580697 | ||
|
|
d9b52ba5ef | ||
|
|
cbc7c4918f | ||
|
|
192cb91517 | ||
|
|
ca45874fe9 | ||
|
|
d051d3fa1d | ||
|
|
c4c5e68267 | ||
|
|
5ec38f1fb4 | ||
|
|
9707232954 | ||
|
|
d9cd742355 | ||
|
|
50b5c66a7e | ||
|
|
b92baf8b2a | ||
|
|
236cc9fdd2 | ||
|
|
f923297498 | ||
|
|
83f5d878e7 | ||
|
|
2f00efadfc | ||
|
|
34e88c6b63 | ||
|
|
c85147e989 | ||
|
|
e434e711bf | ||
|
|
03dd39b128 | ||
|
|
cfc4d70d43 | ||
|
|
ebe7d1a86c | ||
|
|
155f345911 | ||
|
|
a2a38f8937 | ||
|
|
1bfc8b6a19 | ||
|
|
1cdbdd00d9 | ||
|
|
eea932f43a | ||
|
|
5357a65b91 | ||
|
|
9d8678e8e5 | ||
|
|
03d5fc330a | ||
|
|
7ddb7dda97 | ||
|
|
2e6679c14f | ||
|
|
14c1846fe1 | ||
|
|
1600927237 | ||
|
|
88893eb0be | ||
|
|
d3fa026e22 | ||
|
|
537c895ebe | ||
|
|
1b22d55b94 | ||
|
|
1fceb181b7 | ||
|
|
aa54f32ba2 | ||
|
|
bc5bce3171 | ||
|
|
af8677d510 | ||
|
|
8013483d17 | ||
|
|
7ca09a60d8 | ||
|
|
f425a303e5 | ||
|
|
fc70b9c4be | ||
|
|
cc4e3ea0cf | ||
|
|
1fa1a880e9 | ||
|
|
035f2fd4c1 | ||
|
|
fda8750f14 | ||
|
|
4e7d291ad9 | ||
|
|
03f87c2042 |
@@ -19,4 +19,4 @@ NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/ap
|
||||
|
||||
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
|
||||
+1
-1
@@ -22,4 +22,4 @@ NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/ap
|
||||
|
||||
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
|
||||
@@ -18,4 +18,4 @@ NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:800
|
||||
|
||||
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PUBLIC_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA=
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA=
|
||||
|
||||
@@ -58,6 +58,7 @@ export default function MyForm() {
|
||||
dataList={demandCompList}
|
||||
rtnValue={callback}
|
||||
rtnInputData={handleInsertSdmData}
|
||||
openNetwork={true}
|
||||
/>
|
||||
<Toaster position="top-center" />
|
||||
</div>
|
||||
|
||||
@@ -1,237 +1,43 @@
|
||||
'use client';
|
||||
|
||||
import { regionData, regionIdMap } from '@/app/common/comFunction';
|
||||
import { useDmStore } from '@/app/store';
|
||||
import type { DmStatusDataType } from '@/app/store/wrStatus/type';
|
||||
import { CHART_FORM, MainChart, type ChartConfig } from '@common/business_components';
|
||||
import React, { useEffect, useRef, useState, useMemo, useCallback } from 'react';
|
||||
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
||||
|
||||
interface RegionData {
|
||||
name: string;
|
||||
x: number;
|
||||
y: number;
|
||||
values: number[];
|
||||
|
||||
interface WrStatusChartProps {
|
||||
chartForm: string;
|
||||
chartConfig: ChartConfig;
|
||||
chartData: any;
|
||||
chartTitle: string;
|
||||
chartClassName?: string;
|
||||
graphSize?: number;
|
||||
yFieldText? : string | undefined;
|
||||
yFieldText2? : string | undefined;
|
||||
showLegend? : boolean;
|
||||
setXAxisYearTick ?: boolean;
|
||||
}
|
||||
|
||||
interface TableData {
|
||||
region: string;
|
||||
sewage: string;
|
||||
rainwater: string;
|
||||
reclaimed: string;
|
||||
thermal: string;
|
||||
}
|
||||
export default function WrStatusPage() {
|
||||
|
||||
|
||||
const WrStatusPage: React.FC = () => {
|
||||
const { dmStatus, getDmStatusData} = useDmStore((state) => state);
|
||||
const { statusData,facilityTotals ,chartData} = dmStatus;
|
||||
const [selectedRegion, setSelectedRegion] = useState<string | null>(null);
|
||||
const [hoveredRegion, setHoveredRegion] = useState<string | null>(null);
|
||||
const [tooltipPosition, setTooltipPosition] = useState<{ x: number; y: number } | null>(null);
|
||||
const [chartOption, setChartOption] = useState<WrStatusChartProps>({} as WrStatusChartProps)
|
||||
const svgContainerRef = useRef<HTMLDivElement>(null);
|
||||
const [chartData] = useState<any[]>([
|
||||
{
|
||||
label : '서울',
|
||||
하수 : 4,
|
||||
빗물 : 816,
|
||||
중수도 : 371,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '부산',
|
||||
하수 : 13,
|
||||
빗물 : 68,
|
||||
중수도 : 20,
|
||||
온배수 : 1
|
||||
},
|
||||
{
|
||||
label : '대구',
|
||||
하수 : 9,
|
||||
빗물 : 294,
|
||||
중수도 : 14,
|
||||
온배수 : 2
|
||||
},
|
||||
{
|
||||
label : '인천',
|
||||
하수 : 17,
|
||||
빗물 : 165,
|
||||
중수도 : 35,
|
||||
온배수 : 15
|
||||
},
|
||||
{
|
||||
label : '광주',
|
||||
하수 : 3,
|
||||
빗물 : 74,
|
||||
중수도 : 15,
|
||||
온배수 : 15
|
||||
},
|
||||
{
|
||||
label : '대전',
|
||||
하수 : 2,
|
||||
빗물 : 52,
|
||||
중수도 : 11,
|
||||
온배수 : 20
|
||||
},
|
||||
{
|
||||
label : '울산',
|
||||
하수 : 8,
|
||||
빗물 : 111,
|
||||
중수도 : 19,
|
||||
온배수 : 30
|
||||
},
|
||||
{
|
||||
label : '세종',
|
||||
하수 : 9,
|
||||
빗물 : 65,
|
||||
중수도 : 0,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '경기',
|
||||
하수 : 176,
|
||||
빗물 : 1009,
|
||||
중수도 : 252,
|
||||
온배수 : 40
|
||||
},
|
||||
{
|
||||
label : '강원',
|
||||
하수 : 69,
|
||||
빗물 : 69,
|
||||
중수도 : 22,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '충북',
|
||||
하수 : 38,
|
||||
빗물 : 17,
|
||||
중수도 : 91,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '충남',
|
||||
하수 : 67,
|
||||
빗물 : 54,
|
||||
중수도 : 188,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '전북',
|
||||
하수 : 55,
|
||||
빗물 : 33,
|
||||
중수도 : 220,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '전남',
|
||||
하수 : 83,
|
||||
빗물 : 16,
|
||||
중수도 : 75,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '경북',
|
||||
하수 : 81,
|
||||
빗물 : 37,
|
||||
중수도 : 70,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '경남',
|
||||
하수 : 75,
|
||||
빗물 : 27,
|
||||
중수도 : 140,
|
||||
온배수 : 0
|
||||
},
|
||||
{
|
||||
label : '제주',
|
||||
하수 : 8,
|
||||
빗물 : 47,
|
||||
중수도 : 64,
|
||||
온배수 : 0
|
||||
}
|
||||
]);
|
||||
|
||||
const chartConfig = chartData.reduce((config, element) => {
|
||||
config[element.label] = {
|
||||
label: element.label,
|
||||
color : "hsl(var(--chart-1))"
|
||||
};
|
||||
return config;
|
||||
}, {} as Record<string, { label: string; color: string; }>) satisfies ChartConfig;
|
||||
|
||||
const chartOption = {
|
||||
chartForm : CHART_FORM.BAR,
|
||||
chartConfig : chartConfig,
|
||||
chartData : chartData,
|
||||
chartTitle : '',
|
||||
chartClassName : "h-[300px] w-full",
|
||||
graphSize : 40,
|
||||
yFieldText : '시설(개소)',
|
||||
showLegend : true
|
||||
}
|
||||
|
||||
const colorLegend = [
|
||||
{ label: '하수', color: '#FF6B6B', key: 'sewage' },
|
||||
{ label: '빗물', color: '#4ECDC4', key: 'rainwater' },
|
||||
{ label: '중수도', color: '#45B7D1', key: 'reclaimed' },
|
||||
{ label: '온배수', color: '#FED16A', key: 'thermal' },
|
||||
];
|
||||
const facilityTotalsColor = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FED16A'];
|
||||
const defaultYear= '2023'
|
||||
|
||||
const regionIdMap: Record<string, string> = {
|
||||
서울: '서울특별시',
|
||||
부산: '부산광역시',
|
||||
대구: '대구광역시',
|
||||
인천: '인천광역시',
|
||||
광주: '광주광역시',
|
||||
대전: '대전광역시',
|
||||
울산: '울산광역시',
|
||||
세종: '세종특별자치시',
|
||||
경기: '경기도',
|
||||
강원: '강원특별자치도',
|
||||
충북: '충청북도',
|
||||
충남: '충청남도',
|
||||
전북: '전라북도',
|
||||
전남: '전라남도',
|
||||
경북: '경상북도',
|
||||
경남: '경상남도',
|
||||
제주: '제주특별자치도'
|
||||
};
|
||||
|
||||
const tableData: TableData[] = [
|
||||
{ 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(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(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' },
|
||||
{ region: '전라북도', sewage: '55(42,671)', rainwater: '33(199)', reclaimed: '220(9,453)', thermal: '0' },
|
||||
{ region: '전라남도', sewage: '83(23,560)', rainwater: '16(885)', reclaimed: '75(15,412)', thermal: '0' },
|
||||
{ region: '경상북도', sewage: '81(129,081)', rainwater: '37(341)', reclaimed: '70(27,818)', thermal: '0' },
|
||||
{ region: '경상남도', sewage: '75(50,101)', rainwater: '27(244)', reclaimed: '140(343)', thermal: '0' },
|
||||
{ region: '제주특별자치도', sewage: '8(1,666)', rainwater: '47(5,746)', reclaimed: '64(660)', thermal: '0' },
|
||||
];
|
||||
|
||||
const regionData: RegionData[] = 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] },
|
||||
{ name: '강원', x: 330, y: 120, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '충북', x: 260, y: 280, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '충남', x: 100, y: 320, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '세종', x: 180, y: 305, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '대전', x: 195, y: 360, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '전북', x: 170, y: 450, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '전남', x: 160, y: 600, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '광주', x: 120, y: 530, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '경북', x: 400, y: 320, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '경남', x: 310, y: 530, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '대구', x: 350, y: 450, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '울산', x: 450, y: 500, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '부산', x: 420, y: 550, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '제주', x: 60, y: 750, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
], []);
|
||||
|
||||
const handleMarkerClick = (regionId: string) => {
|
||||
if (selectedRegion === regionId) {
|
||||
@@ -241,7 +47,6 @@ const WrStatusPage: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const createDonutMarker = useCallback((svg: SVGSVGElement, x: number, y: number, name: string, values: number[]) => {
|
||||
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FED16A'];
|
||||
const radius = 26;
|
||||
@@ -252,7 +57,6 @@ const WrStatusPage: React.FC = () => {
|
||||
console.warn(`Invalid region name: ${name}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
||||
g.setAttribute('transform', `translate(${x}, ${y})`);
|
||||
g.setAttribute('id', `marker-${name}`);
|
||||
@@ -336,6 +140,13 @@ const WrStatusPage: React.FC = () => {
|
||||
svg.appendChild(g);
|
||||
}, [handleMarkerClick, regionIdMap]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
getDmStatusData(defaultYear);
|
||||
},[])
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const loadSVG = async () => {
|
||||
try {
|
||||
@@ -393,6 +204,31 @@ const WrStatusPage: React.FC = () => {
|
||||
});
|
||||
}
|
||||
}, [selectedRegion]);
|
||||
useEffect(() => {
|
||||
if(chartData.length>0){
|
||||
const chartConfig = chartData.reduce((config, element) => {
|
||||
config[element.label] = {
|
||||
label: element.label,
|
||||
color : "hsl(var(--chart-1))"
|
||||
};
|
||||
return config;
|
||||
}, {} as Record<string, { label: string; color: string; }>) satisfies ChartConfig;
|
||||
|
||||
const Option = {
|
||||
chartForm : CHART_FORM.BAR,
|
||||
chartConfig : chartConfig,
|
||||
chartData : chartData,
|
||||
chartTitle : '',
|
||||
chartClassName : "h-[300px] w-full",
|
||||
graphSize : 40,
|
||||
yFieldText : '시설(개소)',
|
||||
showLegend : true
|
||||
}
|
||||
setChartOption(Option)
|
||||
}else{
|
||||
setChartOption({} as WrStatusChartProps)
|
||||
}
|
||||
}, [chartData]);
|
||||
|
||||
return (
|
||||
<div className="flex h-screen bg-[#F2F2F2] text-gray-800">
|
||||
@@ -401,7 +237,6 @@ const WrStatusPage: React.FC = () => {
|
||||
{/* 상단 제목 */}
|
||||
<div className="mb-6 flex justify-between items-center">
|
||||
<h2 className="text-2xl font-bold">물재이용 현황</h2>
|
||||
<div className="text-sm text-gray-500">관리자 ▼</div>
|
||||
</div>
|
||||
|
||||
{/* 콘텐츠 본문 */}
|
||||
@@ -410,7 +245,7 @@ const WrStatusPage: React.FC = () => {
|
||||
<div className="bg-white rounded-xl shadow border border-[#DBE2E6] overflow-hidden max-h-[900px]">
|
||||
{/* 타이틀 영역 */}
|
||||
<div className="border-b border-[#DBE2E6] px-4 py-3">
|
||||
<h3 className="text-[12px] font-semibold">재이용시설현황(2023)</h3>
|
||||
<h3 className="text-[12px] font-semibold">{`재이용시설현황(${defaultYear})`}</h3>
|
||||
<p className="text-[12px] text-[#999] font-medium">행정구역별 재이용시설현황(개소)</p>
|
||||
</div>
|
||||
|
||||
@@ -439,11 +274,11 @@ const WrStatusPage: React.FC = () => {
|
||||
<div className="font-semibold mb-1">{hoveredRegion}</div>
|
||||
<div className="space-y-1">
|
||||
{colorLegend.map(({ label, color, key }) => (
|
||||
<div key={key} className="flex items-center space-x-2">
|
||||
<div key={key+'' +color} className="flex items-center space-x-2">
|
||||
<span className="text-[12px] inline-block w-3 h-3 rounded-sm" style={{ backgroundColor: color }}></span>
|
||||
<span className="text-[12px]">
|
||||
{label}:{' '}
|
||||
{tableData.find(d => d.region === hoveredRegion)?.[key as keyof TableData] ?? '-'}
|
||||
{statusData?.find(d => d.region === hoveredRegion)?.[key as keyof DmStatusDataType] || '-'}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
@@ -453,22 +288,12 @@ const WrStatusPage: React.FC = () => {
|
||||
|
||||
{/* 범례 */}
|
||||
<div className="absolute bottom-2 right-2 bg-white rounded-lg shadow-md p-4 text-sm space-y-2">
|
||||
<div className="flex items-center space-x-2">
|
||||
<span className="inline-block w-4 h-4 rounded-sm" style={{backgroundColor: '#FF6B6B'}}></span>
|
||||
<span className="text-[12px] text-gray-900">하수재이용시설 (총 717개소)</span>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<span className="inline-block w-4 h-4 rounded-sm" style={{backgroundColor: '#4ECDC4'}}></span>
|
||||
<span className="text-[12px] text-gray-900">빗물이용시설 (총 3,730개소)</span>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<span className="inline-block w-4 h-4 rounded-sm" style={{backgroundColor: '#45B7D1'}}></span>
|
||||
<span className="text-[12px] text-gray-900">중수도시설 (총 1,074개소)</span>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<span className="inline-block w-4 h-4 rounded-sm" style={{backgroundColor: '#FED16A'}}></span>
|
||||
<span className="text-[12px] text-gray-900">온배수시설 (총 201개소)</span>
|
||||
</div>
|
||||
{facilityTotals?.map((item, index) => (
|
||||
<div key ={'fcltTotal' +index}className="flex items-center space-x-2">
|
||||
<span className="inline-block w-4 h-4 rounded-sm" style={{backgroundColor:facilityTotalsColor[index]}}></span>
|
||||
<span className="text-[12px] text-gray-900">{item}</span>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -479,10 +304,10 @@ const WrStatusPage: React.FC = () => {
|
||||
{/* 재이용시설현황 표 */}
|
||||
<div className="bg-white rounded-xl shadow border border-[#DBE2E6] overflow-hidden">
|
||||
{/* 타이틀 + 버튼 영역 */}
|
||||
<div className="flex justify-between items-center border-b border-[#DBE2E6] px-4 py-3">
|
||||
<div className="flex justify-between items-center border-b border-[#436d85] px-4 py-3">
|
||||
<div>
|
||||
<h3 className="text-[12px] font-semibold">재이용시설현황(2023)</h3>
|
||||
<p className="text-[12px] text-[#999] font-medium">행정구역별 재이용시설현황(개소)</p>
|
||||
<h3 className="text-[12px] font-semibold">{`재이용시설현황(${defaultYear})`}</h3>
|
||||
<p className="text-[12px] text-[#999] font-medium">행정구역별 재이용시설현황[개소(천m³/년)]</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
@@ -493,14 +318,18 @@ 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">하수(이용량,천𝓂³/년)</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>
|
||||
{/* <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>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천𝓂³/년)</th> */}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
{tableData.map((row, index) => (
|
||||
{statusData?.map((row, index) => (
|
||||
<tr key={index} className="hover:bg-gray-50">
|
||||
<td className="text-[12px] px-4 py-2 text-center">
|
||||
{index+1}
|
||||
@@ -521,21 +350,23 @@ const WrStatusPage: React.FC = () => {
|
||||
{/* 재이용통계 차트 */}
|
||||
<div className="bg-white rounded-xl shadow border border-[#DBE2E6] overflow-hidden">
|
||||
<div className="border-b border-[#DBE2E6] px-4 py-3">
|
||||
<h3 className="text-[12px] font-semibold">재이용통계(2023)</h3>
|
||||
<h3 className="text-[12px] font-semibold">{`재이용통계(${defaultYear})`}</h3>
|
||||
<p className="text-[12px] text-[#999] font-medium">행정구역별 재이용시설 현황 개소수 그래프</p>
|
||||
</div>
|
||||
<div className="p-4 bg-[#f9fbfd]">
|
||||
<div className="h-[305px] text-gray-500">
|
||||
<MainChart
|
||||
chartForm={chartOption.chartForm}
|
||||
chartConfig={chartOption.chartConfig}
|
||||
chartData={chartOption.chartData}
|
||||
chartTitle={chartOption.chartTitle}
|
||||
chartClassName={chartOption.chartClassName}
|
||||
graphSize={chartOption.graphSize}
|
||||
yFieldText={chartOption.yFieldText}
|
||||
showLegend={chartOption.showLegend}
|
||||
/>
|
||||
{chartOption?
|
||||
<MainChart
|
||||
chartForm={chartOption.chartForm}
|
||||
chartConfig={chartOption.chartConfig}
|
||||
chartData={chartOption.chartData}
|
||||
chartTitle={chartOption.chartTitle}
|
||||
chartClassName={chartOption.chartClassName}
|
||||
graphSize={chartOption.graphSize}
|
||||
yFieldText={chartOption.yFieldText}
|
||||
showLegend={chartOption.showLegend}
|
||||
/>
|
||||
:<></>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -545,5 +376,3 @@ const WrStatusPage: React.FC = () => {
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default WrStatusPage;
|
||||
@@ -0,0 +1,74 @@
|
||||
import type { DmStatusChartType, DmStatusDataType, RegionData, } from "../store/wrStatus/type";
|
||||
|
||||
|
||||
|
||||
export const regionData:RegionData[] = [
|
||||
{ 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] },
|
||||
{ name: '강원', x: 330, y: 120, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '충북', x: 260, y: 280, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '충남', x: 100, y: 320, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '세종', x: 180, y: 305, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '대전', x: 195, y: 360, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '전북', x: 170, y: 450, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '전남', x: 160, y: 600, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '광주', x: 120, y: 530, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '경북', x: 400, y: 320, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '경남', x: 310, y: 530, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '대구', x: 350, y: 450, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '울산', x: 450, y: 500, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '부산', x: 420, y: 550, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
{ name: '제주', x: 60, y: 750, values: [0.3, 0.3, 0.2, 0.2] },
|
||||
]
|
||||
|
||||
export const regionIdMap: Record<string, string> = {
|
||||
서울: '서울특별시',
|
||||
부산: '부산광역시',
|
||||
대구: '대구광역시',
|
||||
인천: '인천광역시',
|
||||
광주: '광주광역시',
|
||||
대전: '대전광역시',
|
||||
울산: '울산광역시',
|
||||
세종: '세종특별자치시',
|
||||
경기: '경기도',
|
||||
강원: '강원특별자치도',
|
||||
충북: '충청북도',
|
||||
충남: '충청남도',
|
||||
전북: '전라북도',
|
||||
전남: '전라남도',
|
||||
경북: '경상북도',
|
||||
경남: '경상남도',
|
||||
제주: '제주특별자치도'
|
||||
};
|
||||
|
||||
|
||||
const makeRegion = (region: string) => {
|
||||
if (region === '서울특별시') return '서울'
|
||||
if (region === '부산광역시') return '부산'
|
||||
if (region === '대구광역시') return '대구'
|
||||
if (region === '인천광역시') return '인천'
|
||||
if (region === '광주광역시') return '광주'
|
||||
if (region === '대전광역시') return '대전'
|
||||
if (region === '울산광역시') return '울산'
|
||||
if (region === '세종특별자치시') return '세종'
|
||||
if (region === '경기도') return '경기'
|
||||
if (region === '강원특별자치도') return '강원'
|
||||
if (region === '충청북도') return '충북'
|
||||
if (region === '충청남도') return '충남'
|
||||
if (region === '전라북도') return '전북'
|
||||
if (region === '전라남도') return '전남'
|
||||
if (region === '경상북도') return '경북'
|
||||
if (region === '경상남도') return '경남'
|
||||
if (region === '제주특별자치도') return '제주'
|
||||
return region;
|
||||
}
|
||||
export const changeStatusMapData= (data: DmStatusDataType[]) : DmStatusChartType[]=> {
|
||||
return data.map((item) => ({
|
||||
label: makeRegion(item.region??''),
|
||||
하수: item.sewage.split('(')[0]?.replaceAll(',','') ??'',
|
||||
빗물: item.rainwater.split('(')[0]?.replaceAll(',','')??'',
|
||||
중수도: item.reclaimed.split('(')[0]?.replaceAll(',','') ??'',
|
||||
온배수: item.thermal.split('(')[0]?.replaceAll(',','') ??'',
|
||||
}));
|
||||
}
|
||||
+38
-19
@@ -1,29 +1,48 @@
|
||||
import { createStore } from 'zustand/vanilla';
|
||||
import { CommonReducer, CommonState, type CommonStore, type CommonType } from './common';
|
||||
import { SdmReducer, SdmState, type SdmStore, type SdmType } from './sdmMng';
|
||||
import { dmMapState, type DmMapType, type DmMapStore, DmMapReducer } from './map';
|
||||
import { tokenManager } from '@/src/entities/auth/lib/token-manager';
|
||||
import { createStore } from "zustand/vanilla";
|
||||
import {
|
||||
CommonReducer,
|
||||
CommonState,
|
||||
type CommonStore,
|
||||
type CommonType,
|
||||
} from "./common";
|
||||
import { SdmReducer, SdmState, type SdmStore, type SdmType } from "./sdmMng";
|
||||
import {
|
||||
dmMapState,
|
||||
type DmMapType,
|
||||
type DmMapStore,
|
||||
DmMapReducer,
|
||||
} from "./map";
|
||||
import { tokenManager } from "@/src/entities/auth/lib/token-manager";
|
||||
import {
|
||||
DmStatusReducer,
|
||||
dmStatusState,
|
||||
type DmStatusStore,
|
||||
type DmStatusType,
|
||||
} from "./wrStatus";
|
||||
|
||||
export type DmStore = CommonStore & SdmStore &DmMapStore ;
|
||||
export type DmState = CommonType & SdmType &DmMapType;
|
||||
export type DmStore = CommonStore & SdmStore & DmMapStore & DmStatusStore;
|
||||
export type DmState = CommonType & SdmType & DmMapType & DmStatusType;
|
||||
|
||||
export const StoreZus = (initState: DmState= {
|
||||
...CommonState,
|
||||
...SdmState,
|
||||
...dmMapState,
|
||||
}) => {
|
||||
export const StoreZus = (
|
||||
initState: DmState = {
|
||||
...CommonState,
|
||||
...SdmState,
|
||||
...dmMapState,
|
||||
...dmStatusState,
|
||||
}
|
||||
) => {
|
||||
return createStore<DmStore>()((set) => {
|
||||
if (typeof window !== "undefined") {
|
||||
tokenManager.setToken("site-id-key", 'DM');
|
||||
tokenManager.setToken("site-theme-key", 'green');
|
||||
tokenManager.setToken("site-id-key", "DM");
|
||||
tokenManager.setToken("site-theme-key", "green");
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
...initState,
|
||||
...CommonReducer(set),
|
||||
...SdmReducer(set),
|
||||
...DmMapReducer(set)
|
||||
}
|
||||
})
|
||||
}
|
||||
...DmMapReducer(set),
|
||||
...DmStatusReducer(set),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { changeStatusMapData } from "@/app/common/comFunction";
|
||||
import { fetchType, getFetch } from "@/components/ui/api";
|
||||
import type {
|
||||
DmStatusDataType,
|
||||
DmStatusChartType,
|
||||
} from "./type";
|
||||
|
||||
export type DmStatusActions = {
|
||||
getDmStatusData(year: string): void;
|
||||
};
|
||||
|
||||
export type DmStatusType = {
|
||||
dmStatus: {
|
||||
statusData: DmStatusDataType[];
|
||||
facilityTotals: string[];
|
||||
chartData: DmStatusChartType[];
|
||||
};
|
||||
};
|
||||
|
||||
export const dmStatusState: DmStatusType = {
|
||||
dmStatus: {
|
||||
statusData: [],
|
||||
facilityTotals: [],
|
||||
chartData: [],
|
||||
},
|
||||
};
|
||||
export type DmStatusStore = DmStatusType & DmStatusActions;
|
||||
|
||||
export const DmStatusReducer = (set: any): DmStatusActions => {
|
||||
return {
|
||||
getDmStatusData: async (year: string) => {
|
||||
const data = await getFetch(fetchType.WR, "/daemin/" + year);
|
||||
let isData:DmStatusDataType[] =[]
|
||||
if(data.data&&data.data.length>0){
|
||||
isData=data.data
|
||||
}else{
|
||||
fetch(`data/wrStatusData.json`).then((res) => res.json()).then((json) => isData=json)//만약 백엔드에서 못가져올경우 방어책
|
||||
}
|
||||
|
||||
const orgin: DmStatusDataType[] = isData;
|
||||
const chartData = changeStatusMapData(orgin);
|
||||
const facilityTotals = [
|
||||
"하수재이용시설" + "(총" + orgin[0]?.sewage.split("(")[0] + "개소)",
|
||||
"빗물재이용시설" + "(총" + orgin[0]?.rainwater.split("(")[0] + "개소)",
|
||||
"중수도재이용시설" +
|
||||
"(총" +
|
||||
orgin[0]?.reclaimed.split("(")[0] +
|
||||
"개소)",
|
||||
"온배수재이용시설" + "(총" + orgin[0]?.thermal.split("(")[0] + "개소)",
|
||||
];
|
||||
|
||||
set((state: DmStatusType) => ({
|
||||
...state,
|
||||
dmStatus: {
|
||||
...state.dmStatus,
|
||||
statusData: data.data,
|
||||
chartData: chartData,
|
||||
facilityTotals: facilityTotals,
|
||||
},
|
||||
}));
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
export type DmStatusDataType = {
|
||||
region: string;
|
||||
sewage: string;
|
||||
rainwater: string;
|
||||
reclaimed: string;
|
||||
thermal: string;
|
||||
};
|
||||
|
||||
|
||||
export type DmStatusFcltType = {
|
||||
sewageFclt: string;
|
||||
rainwaterFclt: string;
|
||||
reclaimedFclt: string;
|
||||
thermalFclt: string;
|
||||
};
|
||||
|
||||
|
||||
|
||||
export type DmStatusChartType = {
|
||||
label: string,
|
||||
하수: string,
|
||||
빗물: string,
|
||||
중수도: string,
|
||||
온배수: string,
|
||||
}
|
||||
|
||||
export type RegionData = {
|
||||
name: string;
|
||||
x: number;
|
||||
y: number;
|
||||
values: number[];
|
||||
}
|
||||
@@ -637,7 +637,7 @@ export function SdmInfoRegForm({
|
||||
}}
|
||||
/>
|
||||
<div className="col-span-1">
|
||||
<Label className="text-xl">수소이온농도(PH)</Label>
|
||||
<Label className="text-xl">수소이온농도(pH)</Label>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<Input
|
||||
className="!text-xl w-36"
|
||||
|
||||
@@ -8,7 +8,7 @@ const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
|
||||
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
|
||||
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
|
||||
const BUSINESS_JUSO_API_URL = process.env.NEXT_PUBLIC_FINDADRESS_URL || "";
|
||||
const AdressKey = process.env.NEXT_PUBLIC_WR_ADDRESS_KEY || "";
|
||||
const AdressKey = process.env.NEXT_PRIVATE_WR_ADDRESS_KEY || "";
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{ "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(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(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" },
|
||||
{ "region": "전라북도", "sewage": "55(42,671)", "rainwater": "33(199)", "reclaimed": "220(9,453)", "thermal": "0" },
|
||||
{ "region": "전라남도", "sewage": "83(23,560)", "rainwater": "16(885)", "reclaimed": "75(15,412)", "thermal": "0" },
|
||||
{ "region": "경상북도", "sewage": "81(129,081)", "rainwater": "37(341)", "reclaimed": "70(27,818)", "thermal": "0" },
|
||||
{ "region": "경상남도", "sewage": "75(50,101)", "rainwater": "27(244)", "reclaimed": "140(343)", "thermal": "0" },
|
||||
{ "region": "제주특별자치도", "sewage": "8(1,666)", "rainwater": "47(5,746)", "reclaimed": "64(660)", "thermal": "0" }
|
||||
]
|
||||
+19
-18
@@ -1,31 +1,32 @@
|
||||
# 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_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
|
||||
# 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
|
||||
|
||||
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
|
||||
NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = https://fo.hasuon.or.kr
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
NEXT_PUBLIC_SERVER_API_URL = https://fo.hasuon.or.kr/operation-service/api/v1
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = https://apigateway.hasuon.or.kr/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_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
|
||||
NEXT_PUBLIC_WR_SERVER_API_URL = https://fo.hasuon.or.kr/reuse-service/api/v1
|
||||
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = https://fo.hasuon.or.kr/sewerage-service/api
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 강우영향일 계산 로직
|
||||
*
|
||||
* 1.강우영향일 및 강우량을 계산하며 강우량이 3이상이면 강우영향일이며 이후 이틀까지 강우영향일로 포함
|
||||
*
|
||||
* 2.강우영향일이면서 3mm이하의 강우량일 경우에는 강우영향을 준 날의 강우량을 따름
|
||||
* @param data
|
||||
* @param weather (default:ALL), SUNNY, ..etc
|
||||
* @author jsyang
|
||||
*/
|
||||
|
||||
export default function CalcRainEffect(data : any, weather='ALL') {
|
||||
console.log("%c Calculate RainEffect !" , "background:blue;color:white");
|
||||
console.log("%c Data Length :"+data.length+" Weather : "+weather , "background:yellow;color:blue");
|
||||
// 강우영향일 계산 (강우량이 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;
|
||||
}
|
||||
|
||||
if(item.infoRnDay == 'x'){
|
||||
item.infoRnDay = '0.0';
|
||||
item.toBeInfoRnDay = '0.0';
|
||||
}else{
|
||||
item.infoRnDay = Number(item.infoRnDay).toFixed(1);
|
||||
item.toBeInfoRnDay = Number(item.infoRnDay).toFixed(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(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]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.toBeInfoRnDay = data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.toBeInfoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let rtnData : any = [];
|
||||
if (weather === 'ALL') {
|
||||
rtnData = data;
|
||||
} else if (weather === 'SUNNY') {
|
||||
rtnData = data.filter((item: any) => item.rainEffectDay === 0);
|
||||
} else {
|
||||
rtnData = data.filter((item: any) => item.rainEffectDay === 1);
|
||||
}
|
||||
return rtnData;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export default function DataForm({ type, column, item }: DataFormProps) {
|
||||
break;
|
||||
case 'float0':
|
||||
if(value) {
|
||||
item[column] = String(value).includes('.')?String(Math.round(parseFloat(value.toString().replace(/,/g, '')) * 1) / 1).split('.').map((part, index) =>
|
||||
item[column] = item[column] = String(value).includes('.')?String(Math.round(parseFloat(value.toString().replace(/,/g, '')) * 1) / 1).split('.').map((part, index) =>
|
||||
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
|
||||
).join('.')
|
||||
: String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
|
||||
@@ -97,26 +97,27 @@ 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'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 3 && infoRnDay < 10;
|
||||
} else if(flowPanel === '3'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 10 && infoRnDay < 20;
|
||||
} else if(flowPanel === '4'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 20 && infoRnDay < 30;
|
||||
} else if(flowPanel === '5'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 30 && infoRnDay < 40;
|
||||
} else if(flowPanel === '6'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 40 && infoRnDay < 50;
|
||||
} else if(flowPanel === '7'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 50 && infoRnDay < 60;
|
||||
} else if(flowPanel === '8'){
|
||||
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
|
||||
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60;
|
||||
} else {
|
||||
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (rainEffectDay ===1);
|
||||
|
||||
@@ -69,22 +69,12 @@ export default function DashBoardChartModal({item='', period='', title='',modalD
|
||||
useEffect(() => {
|
||||
if(period === 'year'){
|
||||
const filteredData: yearProps[] = modalData.map((item) => {
|
||||
if(waterQlty.trim().includes('T-N') || waterQlty.trim().includes('T-P')){
|
||||
return {
|
||||
label: item.waterQlty,
|
||||
평균: typeof item.yearAvg === 'string' ? Number(item.yearAvg.replace(/,/g, '')).toFixed(3) : (item.yearAvg || 0),
|
||||
최대: typeof item.yearMax === 'string' ? Number(item.yearMax.replace(/,/g, '')).toFixed(3) : (item.yearMax || 0),
|
||||
최소: typeof item.yearMin === 'string' ? Number(item.yearMin.replace(/,/g, '')).toFixed(3) : (item.yearMin || 0),
|
||||
평균: typeof item.yearAvg === 'string' ? Number(item.yearAvg.replace(/,/g, '')) : (item.yearAvg || 0),
|
||||
최대: typeof item.yearMax === 'string' ? Number(item.yearMax.replace(/,/g, '')) : (item.yearMax || 0),
|
||||
최소: typeof item.yearMin === 'string' ? Number(item.yearMin.replace(/,/g, '')) : (item.yearMin || 0),
|
||||
}
|
||||
}
|
||||
else{
|
||||
return {
|
||||
label: item.waterQlty,
|
||||
평균: typeof item.yearAvg === 'string' ? Number(item.yearAvg.replace(/,/g, '')).toFixed(1) : (item.yearAvg || 0),
|
||||
최대: typeof item.yearMax === 'string' ? Number(item.yearMax.replace(/,/g, '')).toFixed(1) : (item.yearMax || 0),
|
||||
최소: typeof item.yearMin === 'string' ? Number(item.yearMin.replace(/,/g, '')).toFixed(1) : (item.yearMin || 0),
|
||||
}
|
||||
}
|
||||
})
|
||||
if (item === 'flowRate') {
|
||||
setChartData(filteredData.slice(0,5));
|
||||
|
||||
@@ -182,7 +182,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
useEffect(() => {
|
||||
operationalStatusList.map((item: { [key: string]: string | number | boolean },index) => {
|
||||
if(index===8 || index===9 || index===10 || index===11 || index===12 || index===13 || index===14 || index===15){
|
||||
item['yearAvg'] = Number(item['yearAvg']).toFixed(3);
|
||||
/* item['yearAvg'] = Number(item['yearAvg']).toFixed(3);
|
||||
item['yearMax'] = item['yearMax']+'%';
|
||||
item['yearMin'] = item['yearMin']+'%';
|
||||
item['summerAll'] = item['summerAll']+'%';
|
||||
@@ -191,7 +191,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
|
||||
item['winterAll'] = item['winterAll']+'%';
|
||||
item['winterSunnyAvg'] = item['winterSunnyAvg']+'%';
|
||||
item['winterSunnyMax'] = item['winterSunnyMax']+'%';
|
||||
item['winterSunnyMin'] = item['winterSunnyMin']+'%';
|
||||
item['winterSunnyMin'] = item['winterSunnyMin']+'%'; */
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -22,10 +22,12 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
const [chart_tpTp, setChart_tpTp] = useState<{
|
||||
chartData1: lineChartDataProps[];
|
||||
chartData2: lineChartDataProps[];
|
||||
chartData3: lineChartDataProps[];
|
||||
}>();
|
||||
const [chart_tntn, setChart_tntn] = useState<{
|
||||
chartData1: lineChartDataProps[];
|
||||
chartData2: lineChartDataProps[];
|
||||
chartData3: lineChartDataProps[];
|
||||
}>();
|
||||
const [chart_inflBodInflTn, setChart_inflBodInflTn] = useState<{
|
||||
chartData1: lineChartDataProps[];
|
||||
@@ -46,6 +48,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
chart_efflTn,
|
||||
chart_inflBod,
|
||||
isLoadingMainGraph,
|
||||
waterQltyStandartd,
|
||||
} = MainGraph;
|
||||
|
||||
/**
|
||||
@@ -90,6 +93,10 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
label: '방류T-P',
|
||||
color: colors[1],
|
||||
},
|
||||
chartData3: {
|
||||
label : '법적방류T-P',
|
||||
color : 'blackdash',
|
||||
}
|
||||
} satisfies ChartConfig;
|
||||
|
||||
// 유입T-N-방류T-N
|
||||
@@ -102,6 +109,10 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
label: '방류T-N',
|
||||
color: colors[1],
|
||||
},
|
||||
chartData3: {
|
||||
label : '법적방류T-N',
|
||||
color : 'blackdash',
|
||||
}
|
||||
} satisfies ChartConfig;
|
||||
|
||||
// 유입BOD-유입T-N
|
||||
@@ -139,21 +150,37 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
|
||||
useEffect(() => {
|
||||
if (!chart_chongInTp || !chart_efflTp) return;
|
||||
const legalTpData: lineChartDataProps[] = [];
|
||||
if (waterQltyStandartd){
|
||||
chart_inflTn.forEach(item =>{
|
||||
legalTpData.push({label : item.label, val:waterQltyStandartd.tp});
|
||||
})
|
||||
}
|
||||
|
||||
const chartTpTpData = {
|
||||
chartData1: chart_chongInTp,
|
||||
chartData2: chart_efflTp
|
||||
chartData2: chart_efflTp,
|
||||
chartData3: legalTpData
|
||||
};
|
||||
setChart_tpTp(chartTpTpData);
|
||||
}, [chart_chongInTp, chart_efflTp]);
|
||||
}, [chart_chongInTp, chart_efflTp, chart_inflTn, waterQltyStandartd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!chart_inflTn || !chart_efflTn) return;
|
||||
const legalTnData: lineChartDataProps[] = [];
|
||||
if (waterQltyStandartd){
|
||||
chart_inflTn.forEach(item =>{
|
||||
legalTnData.push({label : item.label, val:waterQltyStandartd.tn});
|
||||
})
|
||||
}
|
||||
|
||||
const chartTntnData = {
|
||||
chartData1: chart_inflTn,
|
||||
chartData2: chart_efflTn
|
||||
chartData2: chart_efflTn,
|
||||
chartData3: legalTnData,
|
||||
};
|
||||
setChart_tntn(chartTntnData);
|
||||
}, [chart_inflTn, chart_efflTn]);
|
||||
}, [chart_inflTn, chart_efflTn, waterQltyStandartd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!chart_inflBod || !chart_inflTn) return;
|
||||
@@ -185,21 +212,21 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
<MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_inflowRain} chartData={chart_inflowRain} chartTitle="유입하수량-강수량" yFieldText="유입하수량(m³/일)" yFieldText2="강수량(mm)"></MainChart>
|
||||
<MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_inflowRain} chartData={chart_inflowRain} chartTitle="유입하수량-강수량" yFieldText="유입하수량(m³/일)" yFieldText2="강수량(mm)" setXAxisYearTick={true}></MainChart>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</ListDiv>
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
<MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_rainBod} chartData={chart_bodRain} chartTitle="유입BOD-강수량" yFieldText="BOD(mg/L)" yFieldText2="강수량(mm)"></MainChart>
|
||||
<MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_rainBod} chartData={chart_bodRain} chartTitle="유입BOD-강수량" yFieldText="BOD(mg/L)" yFieldText2="강수량(mm)" setXAxisYearTick = {true}></MainChart>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</ListDiv>
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tptp} chartData={chart_tpTp} chartTitle="총인유입T-P-방류T-P" yFieldText="T-P(mg/L)"></MainChart>
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tptp} chartData={chart_tpTp} chartTitle="총인유입T-P-방류T-P" yFieldText="T-P(mg/L)" setXAxisYearTick={true}></MainChart>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</ListDiv>
|
||||
@@ -207,7 +234,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tntn} chartData={chart_tntn} chartTitle="유입T-N-방류T-N" yFieldText="T-N(mg/L)"></MainChart>
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tntn} chartData={chart_tntn} chartTitle="유입T-N-방류T-N" yFieldText="T-N(mg/L)" setXAxisYearTick={true}></MainChart>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</ListDiv>
|
||||
@@ -215,7 +242,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTn} chartData={chart_inflBodInflTn} chartTitle="유입BOD-유입T-N" yFieldText="농도(mg/L)"></MainChart>
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTn} chartData={chart_inflBodInflTn} chartTitle="유입BOD-유입T-N" yFieldText="농도(mg/L)" setXAxisYearTick={true}></MainChart>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</ListDiv>
|
||||
@@ -223,7 +250,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
|
||||
<ListDiv className="h-[300px]">
|
||||
<Card className="h-full">
|
||||
<CardContent className="h-full">
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTp} chartData={chart_inflBodInflTp} chartTitle="유입BOD-유입T-P" yFieldText="농도(mg/L)"></MainChart>
|
||||
<MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTp} chartData={chart_inflBodInflTp} chartTitle="유입BOD-유입T-P" yFieldText="농도(mg/L)" setXAxisYearTick={true}></MainChart>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</ListDiv>
|
||||
|
||||
@@ -9,6 +9,7 @@ import ProcessFacilitySearch from "./facilityInfo/page";
|
||||
import DashBoardChart from "./maingraph/page";
|
||||
import RainManageTab from "./rainManage/page";
|
||||
import DrainageEquipment from "./drainageEquipment/page";
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
|
||||
const tabList = [
|
||||
{ value: 'facilityInfo', label: '시설정보 및 운영현황' },
|
||||
@@ -17,6 +18,22 @@ const tabList = [
|
||||
//{ value: 'drainageEquipment', label: '배수설비 정비현황' }
|
||||
];
|
||||
|
||||
export const generateYearDates = (searchYear: string) => {
|
||||
const dates: string[] = [];
|
||||
const start = new Date(Number(searchYear), 0, 1); // 1월 1일
|
||||
const end = new Date(Number(searchYear), 11, 31); // 12월 31일
|
||||
|
||||
for (let d = new Date(start); d <= end; d.setDate(d.getDate() + 1)) {
|
||||
const year = d.getFullYear();
|
||||
const month = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getDate()).padStart(2, "0");
|
||||
|
||||
dates.push(`${year}-${month}-${day}`); // YYYY-MM-DD 형식
|
||||
}
|
||||
|
||||
return dates;
|
||||
}
|
||||
|
||||
export default function DashBoard() {
|
||||
// 입력값 상태 관리
|
||||
const { Common, initializeCommonData,searchMainGraph, searchRainManage, searchOperationStatus, OperationStatus, RainManage, MainGraph, PlanFclty } = useFoStore((state) => state);
|
||||
@@ -60,11 +77,11 @@ export default function DashBoard() {
|
||||
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0');
|
||||
// 시설명
|
||||
const [fcltyList, setFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({
|
||||
bscFctCd: '26260PB001R',
|
||||
bscFctNm: '수영',
|
||||
fcltyCpc: 452000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, MBR',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
|
||||
bscFctCd: '11000SW001R',
|
||||
bscFctNm: '난지',
|
||||
fcltyCpc: 860000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, A2O',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅲ지역)'
|
||||
});
|
||||
|
||||
const [searchFcltyList, setSearchFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({
|
||||
@@ -79,11 +96,11 @@ export default function DashBoard() {
|
||||
if (!isInit) {
|
||||
initializeCommonData();
|
||||
setSearchFcltyList({
|
||||
bscFctCd: '26260PB001R',
|
||||
bscFctNm: '수영',
|
||||
fcltyCpc: 452000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, MBR',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
|
||||
bscFctCd: '11000SW001R',
|
||||
bscFctNm: '난지',
|
||||
fcltyCpc: 860000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, A2O',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅲ지역)'
|
||||
});
|
||||
}
|
||||
}, [isInit, initializeCommonData]);
|
||||
@@ -190,62 +207,98 @@ export default function DashBoard() {
|
||||
|
||||
case 'mainGraph':
|
||||
searchMainGraph(searchYear, fcltyList.bscFctCd);
|
||||
const yearData = generateYearDates(searchYear);
|
||||
const yearValueData : any = [];
|
||||
|
||||
for (const i in yearData){
|
||||
const rowArray: string[] = [];
|
||||
rowArray.push(yearData[i] ?? "");
|
||||
//강수량
|
||||
rowArray.push(roundNumber(chart_inflowRain.filter(item=>{return yearData[i] === item.label})[0]?.barVal0?.toString(), 1) || '');
|
||||
//유입하수량
|
||||
rowArray.push(roundNumber(chart_inflowRain.filter(item=>{return yearData[i] === item.label})[0]?.lineVal1?.toString(), 0) || '');
|
||||
//시설용량
|
||||
rowArray.push(roundNumber(chart_inflowRain.filter(item=>{return yearData[i] === item.label})[0]?.lineVal0?.toString(), 0) || '');
|
||||
//유입BOD
|
||||
rowArray.push(roundNumber(chart_bodRain.filter(item=>{return yearData[i] === item.label})[0]?.lineVal0?.toString(), 1) || '');
|
||||
//유입T-P
|
||||
rowArray.push(roundNumber(chart_inflTp.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || '');
|
||||
//총인유입T-P
|
||||
rowArray.push(roundNumber(chart_chongInTp.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || '');
|
||||
//방류T-P
|
||||
rowArray.push(roundNumber(chart_efflTp.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || '');
|
||||
//유입T-N
|
||||
rowArray.push(roundNumber(chart_inflTn.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || '');
|
||||
//방류T-N
|
||||
rowArray.push(roundNumber(chart_efflTn.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || '');
|
||||
|
||||
yearValueData.push(
|
||||
rowArray
|
||||
)
|
||||
}
|
||||
/* const excelData = [['날짜', '강수량', '유입하수량','시설용량', '유입BOD', '유입T-P', '총인유입T-P', '방류T-P'], */
|
||||
|
||||
const sheetParameter = [
|
||||
{
|
||||
data: [['날짜', '강수량'],...chart_inflowRain.map((item) => [item.label, item.barVal0])],
|
||||
data: [['날짜', '강수량', '유입하수량', '시설용량', '유입BOD', '유입T-P','총인유입T-P', '방류T-P', '유입T-N', '방류T-N'],...yearValueData],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:J1',
|
||||
sheetName: '주요그래프'
|
||||
}
|
||||
/* {
|
||||
data: [['날짜', '강수량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.barVal0, 1)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '강수량'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '유입하수량'],...chart_inflowRain.map((item) => [item.label, item.lineVal1])],
|
||||
data: [['날짜', '유입하수량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.lineVal1, 0)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '유입하수량'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '시설용량'],...chart_inflowRain.map((item) => [item.label, item.lineVal0])],
|
||||
data: [['날짜', '시설용량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.lineVal0, 0)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '시설용량'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '유입BOD'],...chart_bodRain.map((item) => [item.label, item.lineVal0])],
|
||||
data: [['날짜', '유입BOD'],...chart_bodRain.map((item) => [item.label, roundNumber(item.lineVal0, 1)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '유입BOD'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '유입T-P'],...chart_inflTp.map((item) => [item.label, item.val])],
|
||||
data: [['날짜', '유입T-P'],...chart_inflTp.map((item) => [item.label, roundNumber(item.val, 3)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '유입T-P'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '총인유입T-P'],...chart_chongInTp.map((item) => [item.label, item.val])],
|
||||
data: [['날짜', '총인유입T-P'],...chart_chongInTp.map((item) => [item.label, roundNumber(item.val, 3)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '총인유입T-P'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '방류T-P'],...chart_efflTp.map((item) => [item.label, item.val])],
|
||||
data: [['날짜', '방류T-P'],...chart_efflTp.map((item) => [item.label, roundNumber(item.val, 3)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '방류T-P'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '유입T-N'],...chart_inflTn.map((item) => [item.label, item.val])],
|
||||
data: [['날짜', '유입T-N'],...chart_inflTn.map((item) => [item.label, roundNumber(item.val, 3)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '유입T-N'
|
||||
},
|
||||
{
|
||||
data: [['날짜', '방류T-N'],...chart_efflTn.map((item) => [item.label, item.val])],
|
||||
data: [['날짜', '방류T-N'],...chart_efflTn.map((item) => [item.label, roundNumber(item.val, 3)])],
|
||||
headerNum: 1,
|
||||
headerRange: 'A1:B1',
|
||||
sheetName: '방류T-N'
|
||||
}
|
||||
} */
|
||||
];
|
||||
|
||||
downloadMultipleExcel('주요그래프', sheetParameter);
|
||||
@@ -265,22 +318,22 @@ export default function DashBoard() {
|
||||
|
||||
const initVal = () => {
|
||||
setFcltyList({
|
||||
bscFctCd: '26260PB001R',
|
||||
bscFctNm: '수영',
|
||||
fcltyCpc: 452000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, MBR',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
|
||||
bscFctCd: '11000SW001R',
|
||||
bscFctNm: '난지',
|
||||
fcltyCpc: 860000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, A2O',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅲ지역)'
|
||||
});
|
||||
|
||||
setSearchFcltyList({
|
||||
bscFctCd: '26260PB001R',
|
||||
bscFctNm: '수영',
|
||||
fcltyCpc: 452000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, MBR',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
|
||||
bscFctCd: '11000SW001R',
|
||||
bscFctNm: '난지',
|
||||
fcltyCpc: 860000,
|
||||
trtFrfNm: '표준활성슬러지법, MLE, A2O',
|
||||
efflWqltStndrdNm: '500톤 이상(Ⅲ지역)'
|
||||
});
|
||||
setSearchYear(selectSearchYear[0]?.val || '0');
|
||||
searchFcltyList.bscFctNm = '수영';
|
||||
searchFcltyList.bscFctNm = '난지';
|
||||
|
||||
setSidoValue('0');
|
||||
setSigunValue('0');
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function DashBoardFclty({ onFacilityChange, sidoSigun, facilityNm
|
||||
} = Common;
|
||||
|
||||
// 시설명
|
||||
const [bscFctNm, setFcltyName] = useState<string>(facilityNm || '수영');
|
||||
const [bscFctNm, setFcltyName] = useState<string>(facilityNm || '난지');
|
||||
const [bscFctCd, setbscFctCd] = useState<string>('11000SW001R');
|
||||
const [fcltyCpc, setFcltyCpc] = useState<number | ''>(860000);
|
||||
const [trtFrfNm, setTrtFrfNm] = useState<string | ''>('표준활성슬러지법, MLE, A2O');
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"use client"
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { PrecipitationPropsDetailProps } from "@/app/store/facilityPrecipitation";
|
||||
import { DatePickerRange, UiTable } from "@common/business_components/ui";
|
||||
import { DatePickerRange, downloadExcel, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Table, TableCell, TableHead, TableRow } from "@common/components/ui";
|
||||
import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
type PrecipitationModalProps = {
|
||||
@@ -19,16 +21,17 @@ type DateRange = {
|
||||
}
|
||||
|
||||
export default function PrecipitationModal(props: PrecipitationModalProps) {
|
||||
const { PrecipitationDetail } = useFoStore((state) => state);
|
||||
const { Common, PrecipitationDetail } = useFoStore((state) => state);
|
||||
const { upHeadListPrecipitationDetail } = PrecipitationDetail;
|
||||
|
||||
const { btnClass } = Common;
|
||||
// Refs
|
||||
const startPickerRef = useRef<HTMLDivElement>(null);
|
||||
const endPickerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// States
|
||||
const [startDate, setStartDate] = useState<Date | null>(null);
|
||||
const [endDate, setEndDate] = useState<Date | null>(null);
|
||||
const [startDate, setStartDate] = useState<Date | undefined>(new Date());
|
||||
const [endDate, setEndDate] = useState<Date | undefined>(new Date());
|
||||
const didInit = useRef(false);
|
||||
const [filteredDetailList, setFilteredDetailList] = useState<PrecipitationPropsDetailProps[]>([]);
|
||||
const [copyDetailList, setCopyDetailList] = useState<PrecipitationPropsDetailProps[]>([]);
|
||||
|
||||
@@ -113,17 +116,20 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if(didInit.current) return;
|
||||
|
||||
if (props.detailList.length > 0) {
|
||||
const filteredList = props.detailList.filter((item) =>
|
||||
props.facilityCd === item.bscFctCd
|
||||
);
|
||||
|
||||
setFilteredDetailList(filteredList);
|
||||
setCopyDetailList(filteredList);
|
||||
|
||||
if (filteredList.length > 0) {
|
||||
const firstDateStr = filteredList[0]?.rainDt;
|
||||
const lastDateStr = filteredList[filteredList.length - 1]?.rainDt;
|
||||
didInit.current = true;
|
||||
const filteredList = props.detailList
|
||||
.map(i => ({ ...i })) // ← 얕은 복제
|
||||
.filter((item) => props.facilityCd === item.bscFctCd);
|
||||
const calcData = CalcRainEffect(filteredList);
|
||||
|
||||
setFilteredDetailList(calcData);
|
||||
setCopyDetailList(calcData);
|
||||
if (calcData.length > 0) {
|
||||
const firstDateStr = calcData[0]?.rainDt;
|
||||
const lastDateStr = calcData[calcData.length - 1]?.rainDt;
|
||||
|
||||
if (firstDateStr) {
|
||||
const firstDate = new Date(firstDateStr);
|
||||
@@ -131,7 +137,6 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
|
||||
setStartDate(firstDate);
|
||||
}
|
||||
}
|
||||
|
||||
if (lastDateStr) {
|
||||
const lastDate = new Date(lastDateStr);
|
||||
if (!isNaN(lastDate.getTime())) {
|
||||
@@ -142,8 +147,24 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
|
||||
}
|
||||
}, [props.detailList, props.facilityCd]);
|
||||
|
||||
if (!startDate || !endDate) {
|
||||
return <div>로딩 중...</div>;
|
||||
const excelDownload = () => {
|
||||
const totData = getTableData();
|
||||
const excelDownList: any[] = [];
|
||||
if(totData.length > 0){
|
||||
totData.forEach((item) => {
|
||||
excelDownList.push({
|
||||
"날짜": item.rainDt,
|
||||
"강수량(mm/일)": roundNumber(item.infoRnDay, 1),
|
||||
"강우일(일)": roundNumber(item.rainDay, 0),
|
||||
"강우영향일(일)": roundNumber(item.rainEffectDay, 0),
|
||||
});
|
||||
});
|
||||
}
|
||||
if (excelDownList && excelDownList.length > 0) {
|
||||
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 강수현황', sheetNameArray: ['지하수유입량'], headerRange: 'A1:D1' });
|
||||
} else if (totData.length == 0) {
|
||||
alert('다운받을 데이터가 없습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -187,6 +208,9 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
|
||||
</div>
|
||||
</ListDiv>
|
||||
<ListDiv className="h-[550px] overflow-y-auto">
|
||||
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}>
|
||||
{"엑셀다운로드"}
|
||||
</Button>
|
||||
<UiTable
|
||||
headName={"강수현황"}
|
||||
tableData={getTableData()}
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function FacilityPrecipitation() {
|
||||
initializeCommonData();
|
||||
searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0");
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchFacilityPrecipitationList]);
|
||||
}, [isInit, initializeCommonData, searchFacilityPrecipitationList, selectSearchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
@@ -153,14 +153,6 @@ export default function FacilityPrecipitation() {
|
||||
*/
|
||||
// 조회
|
||||
const searchFacilityPrecipitation = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
|
||||
console.log('partValue : ', partValue);
|
||||
console.log('regionValue : ', regionValue);
|
||||
console.log('unitWaterShedValue : ', unitWaterShedValue);
|
||||
console.log('middleRegionValue : ', middleRegionValue);
|
||||
console.log('envPartValue : ', envPartValue);
|
||||
console.log('sidoValue : ', sidoValue);
|
||||
console.log('sigunValue : ', sigunValue);
|
||||
|
||||
let nameCd, partStr
|
||||
switch (partValue) {
|
||||
case 'R':
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader";
|
||||
import FacilityTermModalHeader from "../../../../components/common/FacilityTermModalHeader";
|
||||
import { HeadMakeColSpan } from "../HeadMakeColSpan";
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
|
||||
type ModalProps ={
|
||||
fcltyName: string;
|
||||
@@ -74,8 +75,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
|
||||
let maxTpInflWqltBod = 0;
|
||||
let maxTpInflWqltTp = 0;
|
||||
let maxNoProcessInflAmnt = 0;
|
||||
let maxInfoRnDay = 0;
|
||||
|
||||
|
||||
// 초기값 설정
|
||||
let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0;
|
||||
let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0;
|
||||
@@ -89,9 +92,9 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
let mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0;
|
||||
let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0;
|
||||
|
||||
let minTpInflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltBod) : 0;
|
||||
let minTpInflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltTp) : 0;
|
||||
|
||||
let minTpInflWqltBod = 99999999;
|
||||
let minTpInflWqltTp = 99999999;
|
||||
let minNoProcessInflAmnt = 99999999;
|
||||
let minInfoRnDay = filteredData.length > 0 ? parseNumber(filteredData[0]?.infoRnDay) : 0;
|
||||
|
||||
let avgEfflWqltBod = 0;
|
||||
@@ -108,6 +111,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
|
||||
let avgTpInflWqltBod = 0;
|
||||
let avgTpInflWqltTp = 0;
|
||||
let tpInflWqltBodCnt = 0;
|
||||
let tpInflWqltTpCnt = 0;
|
||||
let avgNoProcessInflAmnt = 0;
|
||||
let noProcessInflAmntCnt = 0;
|
||||
|
||||
let avgInfoRnDay = 0;
|
||||
|
||||
@@ -117,16 +124,20 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
const efflWqltTp = parseNumber(item.efflWqltTp);
|
||||
const efflWqltToc = parseNumber(item.efflWqltToc);
|
||||
const efflWqltSs = parseNumber(item.efflWqltSs);
|
||||
|
||||
const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod);
|
||||
const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn);
|
||||
const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp);
|
||||
const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc);
|
||||
const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs);
|
||||
|
||||
|
||||
const tpInflWqltBod = parseNumber(item.tpInflWqltBod);
|
||||
const tpInflWqltTp = parseNumber(item.tpInflWqltTp);
|
||||
if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){
|
||||
tpInflWqltBodCnt += 1;
|
||||
}
|
||||
if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){
|
||||
tpInflWqltTpCnt += 1;
|
||||
}
|
||||
|
||||
const infoRnDay = parseNumber(item.infoRnDay);
|
||||
|
||||
@@ -159,8 +170,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
mininflAssctBfrWqltToc = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltToc);
|
||||
mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs);
|
||||
|
||||
minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod);
|
||||
minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp);
|
||||
if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){
|
||||
minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod);
|
||||
avgTpInflWqltBod += tpInflWqltBod;
|
||||
}
|
||||
if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){
|
||||
minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp);
|
||||
avgTpInflWqltTp += tpInflWqltTp;
|
||||
}
|
||||
|
||||
minInfoRnDay = Math.min(minInfoRnDay, infoRnDay);
|
||||
|
||||
@@ -176,8 +193,13 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
avginflAssctBfrWqltToc += inflAssctBfrWqltToc;
|
||||
avginflAssctBfrWqltSs += inflAssctBfrWqltSs;
|
||||
|
||||
avgTpInflWqltBod += tpInflWqltBod;
|
||||
avgTpInflWqltTp += tpInflWqltTp;
|
||||
if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){
|
||||
const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',',''));
|
||||
avgNoProcessInflAmnt += noProcessInflAmnt;
|
||||
maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt);
|
||||
minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt);
|
||||
noProcessInflAmntCnt +=1;
|
||||
}
|
||||
|
||||
avgInfoRnDay += infoRnDay;
|
||||
});
|
||||
@@ -202,9 +224,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
sggNm: "",
|
||||
addr: "",
|
||||
fctCpc: 0,
|
||||
noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0),
|
||||
infoRnDay: filteredData.length==0?'0.0':(Math.round(avgInfoRnDay / filteredData.length * 10) / 10).toFixed(1),
|
||||
tpInflWqltBod: filteredData.length==0?'0.0':(Math.round(avgTpInflWqltBod / filteredData.length * 10) / 10).toFixed(1),
|
||||
tpInflWqltTp: filteredData.length==0?'0.000':(Math.round(avgTpInflWqltTp / filteredData.length * 1000) / 1000).toFixed(3)
|
||||
tpInflWqltBod: filteredData.length==0?'0.0':(Math.round(avgTpInflWqltBod / tpInflWqltBodCnt * 10) / 10).toFixed(1),
|
||||
tpInflWqltTp: filteredData.length==0?'0.000':(Math.round(avgTpInflWqltTp / tpInflWqltTpCnt * 1000) / 1000).toFixed(3)
|
||||
},
|
||||
{
|
||||
msrDt : '최대',
|
||||
@@ -225,14 +248,15 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
sggNm: "",
|
||||
addr: "",
|
||||
fctCpc: 0,
|
||||
infoRnDay: 0,
|
||||
noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0),
|
||||
infoRnDay: Math.round(maxInfoRnDay * 10) / 10?(Math.round(maxInfoRnDay * 10) / 10).toFixed(1):'0.0',
|
||||
tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10?(Math.round(maxTpInflWqltBod * 10) / 10).toFixed(1):'0.0',
|
||||
tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000?(Math.round(maxTpInflWqltTp * 1000) / 1000).toFixed(3):'0.000'
|
||||
},
|
||||
{
|
||||
msrDt : '최소',
|
||||
efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?(Math.round(minEfflWqltBod?minEfflWqltBod:0 * 10) / 10).toFixed(1) : '0.0',
|
||||
efflWqltToc : Math.round(minefflWqltToc * 10) / 10?(Math.round(minefflWqltToc?minefflWqltToc:0 * 10) / 10).toFixed(1) : '0.0',
|
||||
efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?(Math.round(minEfflWqltBod * 10) / 10).toFixed(1) : '0.0',
|
||||
efflWqltToc : Math.round(minefflWqltToc * 10) / 10?(Math.round(minefflWqltToc * 10) / 10).toFixed(1) : '0.0',
|
||||
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',
|
||||
@@ -248,12 +272,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
sggNm: "",
|
||||
addr: "",
|
||||
fctCpc: 0,
|
||||
infoRnDay: 0,
|
||||
tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10?'0.0':(Math.round(minTpInflWqltBod * 10) / 10).toFixed(1),
|
||||
tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000?'0.000':(Math.round(minTpInflWqltTp * 1000) / 1000).toFixed(3)
|
||||
noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0),
|
||||
infoRnDay: Math.round(minInfoRnDay * 10) / 10?'0.0':(Math.round(minInfoRnDay * 10) / 10).toFixed(1),
|
||||
tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999?(Math.round(minTpInflWqltBod * 10) / 10).toFixed(1):'0.0',
|
||||
tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999?(Math.round(minTpInflWqltTp * 1000) / 1000).toFixed(3):'0.000'
|
||||
},
|
||||
...filteredData
|
||||
];
|
||||
|
||||
return newFilteredData;
|
||||
}
|
||||
|
||||
@@ -380,7 +406,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
ref={ref}
|
||||
queryClick={filterData}
|
||||
/>
|
||||
<div className="overflow-y-auto h-[550px]">
|
||||
<div className="overflow-y-auto h-[500px]">
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={copyYearList}
|
||||
@@ -395,6 +421,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
|
||||
</UiTable>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab_term_winter">
|
||||
@@ -407,34 +437,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
ref={ref}
|
||||
queryClick={filterData}
|
||||
/>
|
||||
<div className="overflow-y-auto h-[550px]">
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={copyYearList}
|
||||
headlist={upHeadListModalYear}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={() => {}}
|
||||
className="h-[500px]"
|
||||
boldArray={[0,1,2]}
|
||||
>
|
||||
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
|
||||
</UiTable>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab_term_chuncheon">
|
||||
<FacilityTermModalHeader<FacilityWaterQltyProps>
|
||||
searchList={facilityWaterQltyYearList}
|
||||
fcltyCd={facilityCd}
|
||||
fcltyName={fcltyName}
|
||||
tabName="tab_term_chuncheon"
|
||||
searchYear={searchYear}
|
||||
ref={ref}
|
||||
queryClick={filterData}
|
||||
/>
|
||||
<div className="overflow-y-auto h-[550px]">
|
||||
<div className="overflow-y-auto h-[500px]">
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={copyYearList}
|
||||
@@ -450,6 +453,39 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
</UiTable>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab_term_chuncheon">
|
||||
<FacilityTermModalHeader<FacilityWaterQltyProps>
|
||||
searchList={facilityWaterQltyYearList}
|
||||
fcltyCd={facilityCd}
|
||||
fcltyName={fcltyName}
|
||||
tabName="tab_term_chuncheon"
|
||||
searchYear={searchYear}
|
||||
ref={ref}
|
||||
queryClick={filterData}
|
||||
/>
|
||||
<div className="overflow-y-auto h-[500px]">
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={copyYearList}
|
||||
headlist={upHeadListModalYear}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={() => {}}
|
||||
className="h-[500px]"
|
||||
boldArray={[0,1,2]}
|
||||
>
|
||||
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
|
||||
</UiTable>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 청천시 : 강우량이 3mm미만의 날</span>
|
||||
</div>
|
||||
</TabsContent>
|
||||
@@ -464,7 +500,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
ref={ref}
|
||||
queryClick={filterData}
|
||||
/>
|
||||
<div className="overflow-y-auto h-[550px]">
|
||||
<div className="overflow-y-auto h-[500px]">
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={copyYearList}
|
||||
@@ -480,6 +516,8 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
</UiTable>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날</span>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
@@ -134,7 +134,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) {
|
||||
@@ -163,7 +163,6 @@ export default function ProcessFacilitySearch() {
|
||||
}, [searchFcltyQltyList]);
|
||||
|
||||
const total = facilityWaterQltyCount || 1;
|
||||
console.log('total : ', total);
|
||||
return (
|
||||
<MainDiv>
|
||||
<Title title="시설별 수질현황" />
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Button, TabsContent } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader";
|
||||
import { roundUp } from "@/app/store/common";
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
|
||||
const tabList = [
|
||||
{ value: 'tab_term_year', label: '연간' },
|
||||
@@ -59,6 +60,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
let maxreturnAmnt = 0;
|
||||
let maxefflAmnt = 0;
|
||||
let maxinfoRnDay = 0;
|
||||
let maxNoProcessInflAmnt = 0;
|
||||
|
||||
// 초기값 설정
|
||||
let mintotInflAmnt = parseNumber(filteredData[0]?.totInflAmnt);
|
||||
@@ -67,6 +69,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
let minreturnAmnt = parseNumber(filteredData[0]?.returnAmnt);
|
||||
let minefflAmnt = parseNumber(filteredData[0]?.efflAmnt);
|
||||
let mininfoRnDay = parseNumber(filteredData[0]?.infoRnDay && filteredData[0]?.infoRnDay.toString().trim() !== 'x' ? filteredData[0]?.infoRnDay.toString().trim() : 0);
|
||||
let minNoProcessInflAmnt = 99999999;
|
||||
|
||||
let avgtotInflAmnt = 0;
|
||||
let avginflAmnt = 0;
|
||||
@@ -74,8 +77,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
let avgreturnAmnt = 0;
|
||||
let avgefflAmnt = 0;
|
||||
let avginfoRnDay = 0;
|
||||
|
||||
console.log('filteredData', filteredData);
|
||||
let avgNoProcessInflAmnt = 0;
|
||||
let noProcessInflAmntCnt = 0;
|
||||
|
||||
filteredData.forEach((item: FlowRateModalInterface) => {
|
||||
const totInflAmnt = parseNumber(item.totInflAmnt);
|
||||
const inflAmnt = parseNumber(item.inflAmnt);
|
||||
@@ -83,6 +87,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
const returnAmnt = parseNumber(item.returnAmnt);
|
||||
const efflAmnt = parseNumber(item.efflAmnt);
|
||||
const infoRnDay = parseNumber(item.infoRnDay && item.infoRnDay.toString().trim() !== 'x' ? item.infoRnDay.toString().trim() : 0);
|
||||
|
||||
maxtotInflAmnt = Math.max(maxtotInflAmnt, totInflAmnt);
|
||||
maxinflAmnt = Math.max(maxinflAmnt, inflAmnt);
|
||||
maxsumFlow = Math.max(maxsumFlow, sumFlow);
|
||||
@@ -103,16 +108,25 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
avgreturnAmnt += returnAmnt;
|
||||
avgefflAmnt += efflAmnt;
|
||||
avginfoRnDay += infoRnDay;
|
||||
|
||||
if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){
|
||||
const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',',''));
|
||||
avgNoProcessInflAmnt += noProcessInflAmnt;
|
||||
maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt);
|
||||
minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt);
|
||||
noProcessInflAmntCnt +=1;
|
||||
}
|
||||
});
|
||||
|
||||
const newFilteredData = [
|
||||
{
|
||||
msrDt: '평균',
|
||||
totInflAmnt: roundUp((avgtotInflAmnt / filteredData.length), 0),
|
||||
inflAmnt: roundUp((avginflAmnt / filteredData.length), 0),
|
||||
sumFlow: roundUp((avgsumFlow / filteredData.length), 0),
|
||||
returnAmnt: roundUp((avgreturnAmnt / filteredData.length), 0),
|
||||
efflAmnt: roundUp((avgefflAmnt / filteredData.length), 0),
|
||||
totInflAmnt: avgtotInflAmnt && avgtotInflAmnt!=0 ? roundUp((avgtotInflAmnt / filteredData.length), 0) : 0,
|
||||
inflAmnt: avginflAmnt && avginflAmnt!=0 ? roundUp((avginflAmnt / filteredData.length), 0) : 0,
|
||||
sumFlow: avgsumFlow && avgsumFlow!=0 ? roundUp((avgsumFlow / filteredData.length), 0) : 0,
|
||||
returnAmnt: avgreturnAmnt && avgreturnAmnt!=0 ? roundUp((avgreturnAmnt / filteredData.length), 0) : 0,
|
||||
efflAmnt: avgefflAmnt && avgefflAmnt!=0 ? roundUp((avgefflAmnt / filteredData.length), 0) : 0,
|
||||
noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0),
|
||||
infoRnDay: avginfoRnDay > 0 ? roundUp((avginfoRnDay / filteredData.length), 1) : '0.0',
|
||||
rainEffectDay: 0,
|
||||
},
|
||||
@@ -123,6 +137,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
sumFlow: roundUp(maxsumFlow, 0),
|
||||
returnAmnt: roundUp(maxreturnAmnt, 0),
|
||||
efflAmnt: roundUp(maxefflAmnt, 0),
|
||||
noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0),
|
||||
infoRnDay: maxinfoRnDay > 0 ? roundUp(maxinfoRnDay, 1) : '0.0',
|
||||
rainEffectDay: 0,
|
||||
},
|
||||
@@ -133,6 +148,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
sumFlow: roundUp(minsumFlow, 0),
|
||||
returnAmnt: roundUp(minreturnAmnt, 0),
|
||||
efflAmnt: roundUp(minefflAmnt, 0),
|
||||
noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0),
|
||||
infoRnDay: mininfoRnDay > 0 ? roundUp(mininfoRnDay, 1) : '0.0',
|
||||
rainEffectDay: 0,
|
||||
},
|
||||
@@ -209,6 +225,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
boldArray={[0,1,2]}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="tab_term_summer">
|
||||
<FacilityTermModalHeader<FlowRateModalInterface>
|
||||
@@ -233,6 +253,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
boldArray={[0,1,2]}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="tab_term_winter">
|
||||
<FacilityTermModalHeader<FlowRateModalInterface>
|
||||
@@ -257,6 +281,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
boldArray={[0,1,2]}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="tab_term_chuncheon">
|
||||
<FacilityTermModalHeader<FlowRateModalInterface>
|
||||
@@ -282,6 +310,8 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 청천시 : 강우량이 3mm미만의 날</span>
|
||||
</div>
|
||||
</TabsContent>
|
||||
@@ -299,6 +329,8 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
|
||||
<UiTable headName="유량현황" tableData={copyYearList} headlist={upHeadListFlowRateModalYear} pageSize={0} total={0} cellClick={undefined} onPageChange={() => {}} className="h-[370px]" boldArray={[0,1,2]}/>
|
||||
</div>
|
||||
<div className="mt-14">
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br>
|
||||
<span className="text-2xl font-bold text-gray-500">☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날</span>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
@@ -104,10 +104,9 @@ export default function PlanSewage() {
|
||||
initializeCommonData();
|
||||
searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
|
||||
}
|
||||
}, [isInit, initializeCommonData, searchPlanSewageList]);
|
||||
}, [isInit, initializeCommonData, searchPlanSewageList, selectSearchYear]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('excelList' , excelList);
|
||||
if (excelList && excelList.length > 0) {
|
||||
downloadExcel({
|
||||
data: excelList as unknown as JSON[],
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
"use client"
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/dashboard";
|
||||
import { UITab, UiTable } from "@common/business_components/ui";
|
||||
import { downloadExcel, filePickedBlobArray, UITab, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import {
|
||||
TabsContent
|
||||
} from "@common/components";
|
||||
import { Table, TableCell, TableHead, TableRow } from "@common/components/ui";
|
||||
import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui";
|
||||
|
||||
type ModalType = {
|
||||
fcltyName: string;
|
||||
@@ -82,8 +83,8 @@ const headMakeList = (upHeadList: TableUpperProps[], gridNum:number) => {
|
||||
|
||||
export default function ProcessFacilityInfoModal(props: ModalType) {
|
||||
// 그리드 관련
|
||||
const {ProcessFacilityDetail} = useFoStore((state) => state);
|
||||
|
||||
const {Common, ProcessFacilityDetail} = useFoStore((state) => state);
|
||||
const { btnClass } = Common;
|
||||
const {
|
||||
upHeadListPlanInfo,
|
||||
gridListPlanInfo,
|
||||
@@ -115,6 +116,78 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
|
||||
const upHeadListPlanInfoChange = headMakeList(upHeadListPlanInfo, 2);
|
||||
const upHeadListFcltyHistInfoChange = headMakeList(upHeadListFcltyHistInfo, 3);
|
||||
const upHeadListFcltyWaterQltyInfoChange = headMakeList(upHeadListFcltyWaterQltyInfo, 4);
|
||||
|
||||
const excelDownloadPlan = () => {
|
||||
const excelDownList: any[] = [];
|
||||
|
||||
if(gridListFcltyHistInfo.length > 0){
|
||||
gridListFcltyHistInfo.forEach((item) => {
|
||||
excelDownList.push({
|
||||
"차수": item.extnsSeqno,
|
||||
"구분": item.extnsNm,
|
||||
"사업시작일": item.bzStrtYrMnth,
|
||||
"사업종료일": item.bzEdYrMnth,
|
||||
"설치인가일": item.eqpPrmsDt,
|
||||
"준공일": item.cmplDt,
|
||||
"시운전완료일": item.trlrnCmplDt,
|
||||
"가동개시일": item.rnDt,
|
||||
"시설용량(m³/일)": roundNumber(item.fctCpc,0),
|
||||
});
|
||||
});
|
||||
}
|
||||
if (excelDownList && excelDownList.length > 0) {
|
||||
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.fcltyName + ' 시설이력관리', sheetNameArray: [props.fcltyName + ' 시설이력관리'], headerRange: 'A1:I1' });
|
||||
} else if (gridListFcltyHistInfo.length == 0) {
|
||||
alert('다운받을 데이터가 없습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
const excelDownloadQlty = () => {
|
||||
fetch(`/dashBoadModalWaterQlty.xlsx`, {}).then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
|
||||
// 받은 파일 바인너리 처리
|
||||
const blobRet = await response.arrayBuffer();
|
||||
const excelData = gridListFcltyWaterQltyInfo.map((item) => {
|
||||
return [
|
||||
item.extnsSeqno,
|
||||
item.plInflWqltBod,
|
||||
item.plInflWqltToc,
|
||||
item.plInflWqltCod,
|
||||
item.plInflWqltSs,
|
||||
item.plInflWqltTn,
|
||||
item.plInflWqltTp,
|
||||
item.dsInflWqltBod,
|
||||
item.dsInflWqltToc,
|
||||
item.dsInflWqltCod,
|
||||
item.dsInflWqltSs,
|
||||
item.dsInflWqltTn,
|
||||
item.dsInflWqltTp,
|
||||
item.plEfflWqltBod,
|
||||
item.plEfflWqltToc,
|
||||
item.plEfflWqltCod,
|
||||
item.plEfflWqltSs,
|
||||
item.plEfflWqltTn,
|
||||
item.plEfflWqltTp,
|
||||
];
|
||||
});
|
||||
|
||||
const sheetParameter = [
|
||||
{
|
||||
data: excelData,
|
||||
headerNum: 2,
|
||||
headerRange: 'A1:S2',
|
||||
sheetName: '시설 수질정보',
|
||||
startCol: 'A'
|
||||
},
|
||||
];
|
||||
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
|
||||
await filePickedBlobArray(blobRet, props.fcltyName +' 수질정보', sheetParameter);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!h-[80px]">
|
||||
@@ -132,7 +205,7 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
|
||||
</div>
|
||||
</ListDiv>
|
||||
<div className="overflow-y-auto">
|
||||
<div className="!h-[600px]">
|
||||
<div className="h-[550px]">
|
||||
<ListDiv className="">
|
||||
<UITab tabList={tabList} defaultValue="common_info">
|
||||
<TabsContent value="common_info">
|
||||
@@ -184,8 +257,11 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
|
||||
|
||||
<TabsContent value="history_info">
|
||||
<ListDiv>
|
||||
<div className="h-[270px] w-full overflow-y-auto overflow-x-hidden">
|
||||
<div className="h-[130%]">
|
||||
<div className="h-[250px] w-full overflow-y-auto overflow-x-hidden">
|
||||
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadPlan}>
|
||||
{"엑셀다운로드"}
|
||||
</Button>
|
||||
<div className="h-[120%]">
|
||||
<UiTable headName={"시설 이력관리"} tableData={gridListFcltyHistInfo} headlist={upHeadListFcltyHistInfo} pageSize={0} total={0} cellClick={undefined} onPageChange={()=>{}}>
|
||||
{upHeadListFcltyHistInfoChange}
|
||||
</UiTable>
|
||||
@@ -193,8 +269,11 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
|
||||
</div>
|
||||
</ListDiv>
|
||||
<ListDiv>
|
||||
<div className="h-[270px] w-full overflow-y-auto overflow-x-hidden">
|
||||
<div className="h-[130%]">
|
||||
<div className="h-[250px] w-full overflow-y-auto overflow-x-hidden">
|
||||
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadQlty}>
|
||||
{"엑셀다운로드"}
|
||||
</Button>
|
||||
<div className="h-[120%]">
|
||||
<UiTable headName={"시설 수질정보"} tableData={gridListFcltyWaterQltyInfo} headlist={upHeadListFcltyWaterQltyInfo} pageSize={0} total={0} cellClick={undefined} onPageChange={()=>{}}>
|
||||
{upHeadListFcltyWaterQltyInfoChange}
|
||||
</UiTable>
|
||||
|
||||
@@ -107,7 +107,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) {
|
||||
@@ -197,7 +197,8 @@ export default function Rdi() {
|
||||
<div className={widthSize}>
|
||||
<UiTable cellClick={ undefined } headName={"RDII추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
</div>
|
||||
<span className="text-2xl text-gray-500">※주) 처리장 유입부에서 측정된 유량 및 수질조사 자료를 기준으로 산정된 결과임</span>
|
||||
<span className="text-2xl text-gray-500">※ 강우시 총 추정유입량 = 청천시 유입하수량 + RDII 추정값</span><br></br>
|
||||
<span className="text-2xl text-gray-500">※ 주) 처리장 유입부에서 측정된 유량 및 수질조사 자료를 기준으로 산정된 결과임</span>
|
||||
</div>
|
||||
</ListDiv>
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
"use client"
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { modalTableType } from "@/app/store/sewageOccur";
|
||||
import { DateMonthPicker, UiTable } from "@common/business_components/ui";
|
||||
import { DateMonthPicker, downloadExcel, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Table, TableCell, TableHead, TableRow } from "@common/components/ui";
|
||||
import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function SewageOccurModal(props: { fcltyName: string; facilityCd : string; searchYear : string}) {
|
||||
// 그리드 관련
|
||||
const {SewageOccurDetail, searchSewageOccurDetailList} = useFoStore((state) => state);
|
||||
|
||||
const { Common, SewageOccurDetail, searchSewageOccurDetailList} = useFoStore((state) => state);
|
||||
const { btnClass } = Common;
|
||||
|
||||
// searchYear 유효성 검사 및 기본값 설정
|
||||
const validSearchYear = props.searchYear && /^\d{4}$/.test(props.searchYear) ? props.searchYear : new Date().getFullYear().toString();
|
||||
|
||||
@@ -61,6 +63,25 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
|
||||
}
|
||||
}, [endYearMonth, startYearMonth]);
|
||||
|
||||
const excelDownload = () => {
|
||||
const excelDownList: any[] = [];
|
||||
if(detailList.length > 0){
|
||||
detailList.forEach((item) => {
|
||||
excelDownList.push({
|
||||
"날짜": item.msrDt,
|
||||
"물사용량(m³/일)": roundNumber(item.waterUsage, 0),
|
||||
"오수전환율(%)": roundNumber(item.swageChangePercent, 0),
|
||||
"오수발생량 추정(m³/일)": roundNumber(item.estimationSewage, 0),
|
||||
});
|
||||
});
|
||||
}
|
||||
if (excelDownList && excelDownList.length > 0) {
|
||||
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 오수발생량 추정', sheetNameArray: [props.fcltyName + ' 오수발생량 추정'], headerRange: 'A1:D1' });
|
||||
} else if (detailList.length == 0) {
|
||||
alert('다운받을 데이터가 없습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!h-[80px] !mt-10">
|
||||
@@ -118,6 +139,9 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
|
||||
</ListDiv>
|
||||
<ListDiv className="!h-[570px] overflow-y-auto">
|
||||
<div className="h-[120%]">
|
||||
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}>
|
||||
{"엑셀다운로드"}
|
||||
</Button>
|
||||
<UiTable headName={"오수발생량 추정"} tableData={detailList} headlist={upHeadListSewageOccurDetail} pageSize={0} total={0} cellClick={undefined} onPageChange={() => {}} boldArray={[0, 1, 2]}>
|
||||
</UiTable>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"use client"
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { UnderWaterInputModalProps } from "@/app/store/underWaterInput/types";
|
||||
import { downloadExcel } from "@common/business_components";
|
||||
import { DateMonthPicker, UITab, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Table, TableCell, TableHead, TableRow, TabsContent } from "@common/components/ui";
|
||||
import { Button, Table, TableCell, TableHead, TableRow, TabsContent } from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
type ModalProps ={
|
||||
@@ -20,8 +22,8 @@ const tabList1 = [
|
||||
|
||||
export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYear=new Date().getFullYear().toString()} : ModalProps) {
|
||||
// 그리드 관련
|
||||
const {UnderWaterDetail, unserWaterModal} = useFoStore((state) => state);
|
||||
|
||||
const {Common, UnderWaterDetail, unserWaterModal} = useFoStore((state) => state);
|
||||
const { btnClass } = Common;
|
||||
const [startYmDate, setStartYmDate] = useState<string>(searchYear+'01');
|
||||
const [endYmDate, setEndYmDate] = useState<string>(searchYear+'12');
|
||||
const [tabTerm, setTabTerm] = useState<string>('tab_term_year');
|
||||
@@ -87,9 +89,31 @@ export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYea
|
||||
unserWaterModal(fcltyCd, searchYear, prevStartYmDate, prevEndYmDate);
|
||||
} , [fcltyCd, searchYear, unserWaterModal, prevStartYmDate, prevEndYmDate]);
|
||||
|
||||
const excelDownload = () => {
|
||||
const excelDownList: any[] = [];
|
||||
if(copyYearList.length > 0){
|
||||
copyYearList.forEach((item) => {
|
||||
excelDownList.push({
|
||||
"날짜": item.msrDt,
|
||||
"청천시 실제 하수유입량(m³/일)": roundNumber(item.realSewageInput, 0),
|
||||
"오수발생량(m³/일)": roundNumber(item.sewageOccur, 0),
|
||||
"지하수 유입량(m³/일)": roundNumber(item.underWaterInput, 0),
|
||||
});
|
||||
});
|
||||
}
|
||||
if (excelDownList && excelDownList.length > 0) {
|
||||
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: searchYear+'년 '+fcltyName + ' 지하수유입량', sheetNameArray: [fcltyName + ' 지하수유입량'], headerRange: 'A1:D1' });
|
||||
} else if (copyYearList.length == 0) {
|
||||
alert('다운받을 데이터가 없습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<UITab tabList={tabList1} defaultValue="tab_term_year" onValueChange={(val) => {setTabTerm(val)}}>
|
||||
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}>
|
||||
{"엑셀다운로드"}
|
||||
</Button>
|
||||
<TabsContent value="tab_term_year">
|
||||
<ListDiv className="!h-[100px]">
|
||||
<div className="card !m-[1.2rem] max-h-[40rem] overflow-auto !p-0r">
|
||||
|
||||
@@ -223,6 +223,7 @@ export default function UnderWaterInput() {
|
||||
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
|
||||
</div>
|
||||
</div>
|
||||
<span className="text-2xl text-gray-500">※적정여부 = 연간 지하수유입량/연평균 유입하수량*100 </span><br></br>
|
||||
<span className="text-2xl text-gray-500">※지하수 유입량 = 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)</span>
|
||||
</ListDiv>
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -201,6 +201,9 @@ const selectMiddleRegionData: SelectDataType[] = [
|
||||
{ text: "전체", val: '0' }
|
||||
];
|
||||
|
||||
// 오수전환율
|
||||
export const OSU_PERCENT = 0.9;
|
||||
|
||||
/**
|
||||
* 반올림 함수
|
||||
* @param value : 대상 숫자
|
||||
@@ -211,6 +214,17 @@ export const roundUp = (value: number, precision: number = 1): number => {
|
||||
return Math.round(value * (10 ** precision)) / (10 ** precision);
|
||||
}
|
||||
|
||||
/**
|
||||
* 수질 데이터 포맷 변경 함수
|
||||
* @param value : 수질 데이터
|
||||
* @param day : 일수
|
||||
* @param digit : 소수점 자리수
|
||||
*/
|
||||
export const qltyDataSetting = (value: number, day : number, digit: number) => {
|
||||
const toZero = digit === 1 ? '0.0' : digit === 2 ? '0.00' : '0.000';
|
||||
return value > 0 ? roundUp((value/day), digit).toFixed(digit) : toZero;
|
||||
};
|
||||
|
||||
/**
|
||||
* STORE - API
|
||||
*/
|
||||
@@ -406,7 +420,7 @@ export const commonState: CommonType = {
|
||||
selectFlowTerm: selectFlowTerm,
|
||||
selectFlowPanel: selectFlowPanel,
|
||||
selectEnvPartData: selectEnvPartData,
|
||||
btnClass: "p-4 m-2 text-white rounded-sm text-lg font-medium",
|
||||
btnClass: "p-4 m-2 !mr-10 text-white rounded-sm text-lg font-medium",
|
||||
},
|
||||
|
||||
auth: {
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
*/
|
||||
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import { fetchPlanInfo, roundUp } from "../common";
|
||||
import type { FacilityWaterQltyProps } from "../facilityWaterQlty";
|
||||
import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import DataForm, { roundNumber } from "@/app/components/common/DataForm";
|
||||
import { fetchPlanInfo, OSU_PERCENT, qltyDataSetting, roundUp } from "../common";
|
||||
import { type FacilityWaterQltyProps } from "../facilityWaterQlty";
|
||||
import { fetchFlowRateModalList } from "../flowRate";
|
||||
import { fetchFacilityWaterQltyInfo } from "../processFacility";
|
||||
|
||||
// selectBox
|
||||
export type SelectDataType = {
|
||||
@@ -99,7 +101,7 @@ export type lineBarChartDataProps = {
|
||||
|
||||
export type lineChartDataProps = {
|
||||
label : string,
|
||||
val : number
|
||||
val : number,
|
||||
}
|
||||
|
||||
export interface RainManageListProps {
|
||||
@@ -146,6 +148,7 @@ export interface RainManageListProps {
|
||||
dsInflWqltTp: number | '',
|
||||
extnsSeqno?: number | '',
|
||||
rainEffectDay?: number | '',
|
||||
toBeInfoRnDay? : number | '',
|
||||
}
|
||||
|
||||
export interface RainManageExcelType {
|
||||
@@ -660,6 +663,7 @@ const chart_inflTn : lineChartDataProps[] = [];
|
||||
const chart_efflTn : lineChartDataProps[] = [];
|
||||
const chart_inflBod : lineChartDataProps[] = [];
|
||||
const chart_efflBod : lineChartDataProps[] = [];
|
||||
const waterQltyStandartd : any = [];
|
||||
|
||||
const rainManageList : RainManageListProps[] = [];
|
||||
|
||||
@@ -732,6 +736,250 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde
|
||||
}
|
||||
}
|
||||
|
||||
// 수질 데이터 청천시, 강우시 재계산
|
||||
const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcltyCd : string|undefined) => {
|
||||
|
||||
const nullToZero = (value: any) => {
|
||||
return value === null || value === undefined || value === '' ? 0 : Number(value);
|
||||
};
|
||||
|
||||
const orgData = data;
|
||||
const res = await fetchMainGraph(searchYear, fcltyCd);
|
||||
if(res.data.wqltObjs.length> 0) {
|
||||
const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
|
||||
const qltyData = res.data.wqltObjs;
|
||||
const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY');
|
||||
const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN');
|
||||
|
||||
// (0) 전체변수
|
||||
let summerDay = 0;
|
||||
let totalInflBodAvgSummer = 0;
|
||||
let totalInflTnAvgSummer = 0;
|
||||
let totalInflTpAvgSummer = 0;
|
||||
let totalEfflBodAvgSummer = 0;
|
||||
let totalEfflTnAvgSummer = 0;
|
||||
let totalEfflTpAvgSummer = 0;
|
||||
|
||||
let winterDay = 0;
|
||||
let totalInflBodAvgWinter = 0;
|
||||
let totalInflTnAvgWinter = 0;
|
||||
let totalInflTpAvgWinter = 0;
|
||||
let totalEfflBodAvgWinter = 0;
|
||||
let totalEfflTnAvgWinter = 0;
|
||||
let totalEfflTpAvgWinter = 0;
|
||||
|
||||
// 전체 대상
|
||||
qltyData.forEach((item: any) => {
|
||||
const month = item.msrDt.substring(4, 6); // 월 추출
|
||||
if(month === '01' || month === '02'){
|
||||
const inflbod = nullToZero(item.inflAssctBfrWqltBod);
|
||||
const infltn = nullToZero(item.inflAssctBfrWqltTn);
|
||||
const infltp = nullToZero(item.inflAssctBfrWqltTp);
|
||||
const effbod = nullToZero(item.efflWqltBod);
|
||||
const efftn = nullToZero(item.efflWqltTn);
|
||||
const efftp = nullToZero(item.efflWqltTp);
|
||||
|
||||
totalInflBodAvgWinter += inflbod;
|
||||
totalInflTnAvgWinter += infltn;
|
||||
totalInflTpAvgWinter += infltp;
|
||||
totalEfflBodAvgWinter += effbod;
|
||||
totalEfflTnAvgWinter += efftn;
|
||||
totalEfflTpAvgWinter += efftp;
|
||||
winterDay += 1;
|
||||
}else if(month === '06' || month === '07' || month === '08'){
|
||||
summerDay += 1;
|
||||
const inflbod = nullToZero(item.inflAssctBfrWqltBod);
|
||||
const infltn = nullToZero(item.inflAssctBfrWqltTn);
|
||||
const infltp = nullToZero(item.inflAssctBfrWqltTp);
|
||||
const effbod = nullToZero(item.efflWqltBod);
|
||||
const efftn = nullToZero(item.efflWqltTn);
|
||||
const efftp = nullToZero(item.efflWqltTp);
|
||||
|
||||
totalInflBodAvgSummer += inflbod;
|
||||
totalInflTnAvgSummer += infltn;
|
||||
totalInflTpAvgSummer += infltp;
|
||||
totalEfflBodAvgSummer += effbod;
|
||||
totalEfflTnAvgSummer += efftn;
|
||||
totalEfflTpAvgSummer += efftp;
|
||||
}
|
||||
});
|
||||
|
||||
orgData[5].winterAll = qltyDataSetting(totalInflBodAvgWinter, winterDay, 1);
|
||||
orgData[6].winterAll = qltyDataSetting(totalEfflBodAvgWinter, winterDay, 1);
|
||||
orgData[7].winterAll = qltyDataSetting(totalInflTnAvgWinter, winterDay, 3);
|
||||
orgData[8].winterAll = qltyDataSetting(totalEfflTnAvgWinter, winterDay, 3);
|
||||
orgData[9].winterAll = qltyDataSetting(totalInflTpAvgWinter, winterDay, 3);
|
||||
orgData[10].winterAll = qltyDataSetting(totalEfflTpAvgWinter, winterDay, 3);
|
||||
|
||||
orgData[5].summerAll = qltyDataSetting(totalInflBodAvgSummer, summerDay, 1);
|
||||
orgData[6].summerAll = qltyDataSetting(totalEfflBodAvgSummer, summerDay, 1);
|
||||
orgData[7].summerAll = qltyDataSetting(totalInflTnAvgSummer, summerDay, 3);
|
||||
orgData[8].summerAll = qltyDataSetting(totalEfflTnAvgSummer, summerDay, 3);
|
||||
orgData[9].summerAll = qltyDataSetting(totalInflTpAvgSummer, summerDay, 3);
|
||||
orgData[10].summerAll = qltyDataSetting(totalEfflTpAvgSummer, summerDay, 3);
|
||||
|
||||
// (1) 청천시 변수
|
||||
// (1-1) 날짜 count
|
||||
let chungchunSummerDay = 0;
|
||||
let chungchunWinterDay = 0;
|
||||
|
||||
// (1-2) 하절기
|
||||
let chungchunInflBodAvgSummer = 0;
|
||||
let chungchunInflTnAvgSummer = 0;
|
||||
let chungchunInflTpAvgSummer = 0;
|
||||
let chungchunEfflBodAvgSummer = 0;
|
||||
let chungchunEfflTnAvgSummer = 0;
|
||||
let chungchunEfflTpAvgSummer = 0;
|
||||
|
||||
// (1-3) 동절기 (최대, 최소, 평균 다 필요)
|
||||
let chungchunInflBodAvg = 0;
|
||||
let chungchunInflTnAvg = 0;
|
||||
let chungchunInflTpAvg = 0;
|
||||
let chungchunInflBodMax = 0;
|
||||
let chungchunInflTnMax= 0;
|
||||
let chungchunInflTpMax = 0;
|
||||
let chungchunInflBodMin = 99999999;
|
||||
let chungchunInflTnMin = 99999999;
|
||||
let chungchunInflTpMin = 99999999;
|
||||
|
||||
let chungchunEfflBodAvg = 0;
|
||||
let chungchunEfflTnAvg = 0;
|
||||
let chungchunEfflTpAvg = 0;
|
||||
let chungchunEfflBodMax = 0;
|
||||
let chungchunEfflTnMax= 0;
|
||||
let chungchunEfflTpMax = 0;
|
||||
let chungchunEfflBodMin = 99999999;
|
||||
let chungchunEfflTnMin = 99999999;
|
||||
let chungchunEfflTpMin = 99999999;
|
||||
|
||||
// 청천시
|
||||
qltyChungchunData.forEach((item: any) => {
|
||||
const month = item.msrDt.substring(4, 6); // 월 추출
|
||||
if(month === '01' || month === '02'){
|
||||
chungchunWinterDay += 1;
|
||||
|
||||
const inflbod = nullToZero(item.inflAssctBfrWqltBod);
|
||||
const infltn = nullToZero(item.inflAssctBfrWqltTn);
|
||||
const infltp = nullToZero(item.inflAssctBfrWqltTp);
|
||||
const effbod = nullToZero(item.efflWqltBod);
|
||||
const efftn = nullToZero(item.efflWqltTn);
|
||||
const efftp = nullToZero(item.efflWqltTp);
|
||||
|
||||
chungchunInflBodAvg += inflbod;
|
||||
chungchunInflTnAvg += infltn;
|
||||
chungchunInflTpAvg += infltp;
|
||||
chungchunEfflBodAvg += effbod;
|
||||
chungchunEfflTnAvg += efftn;
|
||||
chungchunEfflTpAvg += efftp;
|
||||
|
||||
if(chungchunInflBodMax < inflbod) chungchunInflBodMax = inflbod;
|
||||
if(chungchunInflTnMax < infltn) chungchunInflTnMax = infltn;
|
||||
if(chungchunInflTpMax < infltp) chungchunInflTpMax = infltp;
|
||||
if(chungchunEfflBodMax < effbod) chungchunEfflBodMax = effbod;
|
||||
if(chungchunEfflTnMax < efftn) chungchunEfflTnMax = efftn;
|
||||
if(chungchunEfflTpMax < efftp) chungchunEfflTpMax = efftp;
|
||||
|
||||
if(chungchunInflBodMin > inflbod) chungchunInflBodMin = inflbod;
|
||||
if(chungchunInflTnMin > infltn) chungchunInflTnMin = infltn;
|
||||
if(chungchunInflTpMin > infltp) chungchunInflTpMin = infltp;
|
||||
if(chungchunEfflBodMin > effbod) chungchunEfflBodMin = effbod;
|
||||
if(chungchunEfflTnMin > efftn) chungchunEfflTnMin = efftn;
|
||||
if(chungchunEfflTpMin > efftp) chungchunEfflTpMin = efftp;
|
||||
}else if(month === '06' || month === '07' || month === '08'){
|
||||
chungchunSummerDay += 1;
|
||||
|
||||
const inflbod = nullToZero(item.inflAssctBfrWqltBod);
|
||||
const infltn = nullToZero(item.inflAssctBfrWqltTn);
|
||||
const infltp = nullToZero(item.inflAssctBfrWqltTp);
|
||||
const effbod = nullToZero(item.efflWqltBod);
|
||||
const efftn = nullToZero(item.efflWqltTn);
|
||||
const efftp = nullToZero(item.efflWqltTp);
|
||||
|
||||
chungchunInflBodAvgSummer += inflbod;
|
||||
chungchunInflTnAvgSummer += infltn;
|
||||
chungchunInflTpAvgSummer += infltp;
|
||||
chungchunEfflBodAvgSummer += effbod;
|
||||
chungchunEfflTnAvgSummer += efftn;
|
||||
chungchunEfflTpAvgSummer += efftp;
|
||||
}
|
||||
});
|
||||
|
||||
// 청천시 수질 데이터 수정
|
||||
// 하절기
|
||||
orgData[5].summerRain = qltyDataSetting(chungchunInflBodAvgSummer, chungchunSummerDay, 1);
|
||||
orgData[6].summerRain = qltyDataSetting(chungchunEfflBodAvgSummer, chungchunSummerDay, 1);
|
||||
orgData[7].summerRain = qltyDataSetting(chungchunInflTnAvgSummer, chungchunSummerDay, 3);
|
||||
orgData[8].summerRain = qltyDataSetting(chungchunEfflTnAvgSummer, chungchunSummerDay, 3);
|
||||
orgData[9].summerRain = qltyDataSetting(chungchunInflTpAvgSummer, chungchunSummerDay, 3);
|
||||
orgData[10].summerRain = qltyDataSetting(chungchunEfflTpAvgSummer, chungchunSummerDay, 3);
|
||||
|
||||
// 동절기
|
||||
orgData[5].winterSunnyAvg = qltyDataSetting(chungchunInflBodAvg, chungchunWinterDay, 1);
|
||||
orgData[6].winterSunnyAvg = qltyDataSetting(chungchunEfflBodAvg, chungchunWinterDay, 1);
|
||||
orgData[7].winterSunnyAvg = qltyDataSetting(chungchunInflTnAvg, chungchunWinterDay, 3);
|
||||
orgData[8].winterSunnyAvg = qltyDataSetting(chungchunEfflTnAvg, chungchunWinterDay, 3);
|
||||
orgData[9].winterSunnyAvg = qltyDataSetting(chungchunInflTpAvg, chungchunWinterDay, 3);
|
||||
orgData[10].winterSunnyAvg = qltyDataSetting(chungchunEfflTpAvg, chungchunWinterDay, 3);
|
||||
|
||||
orgData[5].winterSunnyMax = roundUp(chungchunInflBodMax, 1).toFixed(1);
|
||||
orgData[6].winterSunnyMax = roundUp(chungchunEfflBodMax, 1).toFixed(1);
|
||||
orgData[7].winterSunnyMax = roundUp(chungchunInflTnMax, 3).toFixed(3);
|
||||
orgData[8].winterSunnyMax = roundUp(chungchunEfflTnMax, 3).toFixed(3);
|
||||
orgData[9].winterSunnyMax = roundUp(chungchunInflTpMax, 3).toFixed(3);
|
||||
orgData[10].winterSunnyMax = roundUp(chungchunEfflTpMax, 3).toFixed(3);
|
||||
|
||||
orgData[5].winterSunnyMin = chungchunInflBodMin === 99999999 ? '0.0' : roundUp(chungchunInflBodMin, 1).toFixed(1);
|
||||
orgData[6].winterSunnyMin = chungchunEfflBodMin === 99999999 ? '0.0' : roundUp(chungchunEfflBodMin, 1).toFixed(1);
|
||||
orgData[7].winterSunnyMin = chungchunInflTnMin === 99999999 ? '0.000' : roundUp(chungchunInflTnMin, 3).toFixed(3);
|
||||
orgData[8].winterSunnyMin = chungchunEfflTnMin === 99999999 ? '0.000' : roundUp(chungchunEfflTnMin, 3).toFixed(3);
|
||||
orgData[9].winterSunnyMin = chungchunInflTpMin === 99999999 ? '0.000' : roundUp(chungchunInflTpMin, 3).toFixed(3);
|
||||
orgData[10].winterSunnyMin = chungchunEfflTpMin === 99999999 ? '0.000' : roundUp(chungchunEfflTpMin, 3).toFixed(3);
|
||||
|
||||
// 강우시 변수
|
||||
let rainSummerDay = 0;
|
||||
|
||||
let rainInflBodAvg = 0;
|
||||
let rainInflTnAvg = 0;
|
||||
let rainInflTpAvg = 0;
|
||||
let rainEfflBodAvg = 0;
|
||||
let rainEfflTnAvg = 0;
|
||||
let rainEfflTpAvg = 0;
|
||||
|
||||
// 강우시
|
||||
qltyRainData.forEach((item: any) => {
|
||||
const month = item.msrDt.substring(4, 6); // 월 추출
|
||||
if(month === '06' || month === '07' || month === '08'){
|
||||
rainSummerDay += 1;
|
||||
|
||||
const inflbod = nullToZero(item.inflAssctBfrWqltBod);
|
||||
const infltn = nullToZero(item.inflAssctBfrWqltTn);
|
||||
const infltp = nullToZero(item.inflAssctBfrWqltTp);
|
||||
const effbod = nullToZero(item.efflWqltBod);
|
||||
const efftn = nullToZero(item.efflWqltTn);
|
||||
const efftp = nullToZero(item.efflWqltTp);
|
||||
|
||||
rainInflBodAvg += inflbod;
|
||||
rainInflTnAvg += infltn;
|
||||
rainInflTpAvg += infltp;
|
||||
rainEfflBodAvg += effbod;
|
||||
rainEfflTnAvg += efftn;
|
||||
rainEfflTpAvg += efftp;
|
||||
}
|
||||
});
|
||||
|
||||
// 강우시 수질 데이터 수정
|
||||
orgData[5].summerThree = qltyDataSetting(rainInflBodAvg, rainSummerDay, 1);
|
||||
orgData[6].summerThree = qltyDataSetting(rainEfflBodAvg, rainSummerDay, 1);
|
||||
orgData[7].summerThree = qltyDataSetting(rainInflTnAvg, rainSummerDay, 3);
|
||||
orgData[8].summerThree = qltyDataSetting(rainEfflTnAvg, rainSummerDay, 3);
|
||||
orgData[9].summerThree = qltyDataSetting(rainInflTpAvg, rainSummerDay, 3);
|
||||
orgData[10].summerThree = qltyDataSetting(rainEfflTpAvg, rainSummerDay, 3);
|
||||
return orgData;
|
||||
} else {
|
||||
return orgData;
|
||||
}
|
||||
};
|
||||
|
||||
/**====================================
|
||||
* Store - action
|
||||
====================================*/
|
||||
@@ -773,7 +1021,7 @@ export type DashBoardType = {
|
||||
OperationStatus : {
|
||||
isInit : boolean;
|
||||
upHeadListOperationStatus : TableUpperProps[];
|
||||
operationalStatusList : OperationalStatusListProps[];
|
||||
operationalStatusList : any;
|
||||
isLoadingOperationStatus : boolean;
|
||||
}
|
||||
|
||||
@@ -788,6 +1036,7 @@ export type DashBoardType = {
|
||||
chart_efflTn : lineChartDataProps[];
|
||||
chart_inflBod : lineChartDataProps[];
|
||||
chart_efflBod : lineChartDataProps[];
|
||||
waterQltyStandartd : any;
|
||||
isLoadingMainGraph : boolean;
|
||||
},
|
||||
|
||||
@@ -850,6 +1099,7 @@ export const dashBoardInitState:DashBoardType = {
|
||||
chart_efflTn : chart_efflTn,
|
||||
chart_inflBod : chart_inflBod,
|
||||
chart_efflBod : chart_efflBod,
|
||||
waterQltyStandartd : waterQltyStandartd,
|
||||
isLoadingMainGraph : false,
|
||||
},
|
||||
|
||||
@@ -999,55 +1249,6 @@ const searchWaterUsage = async (searchYear: string, fcltyCd: string) => {
|
||||
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]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && 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;
|
||||
}
|
||||
|
||||
export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) => void)=>DashBoardActions=(set: (fn: (state: DashBoardType) => DashBoardType) => void) => {
|
||||
return {
|
||||
initializeDashBoardData: async () => {
|
||||
@@ -1131,14 +1332,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
el.provisionalApproval = rtnPlanData?rtnPlanData.ugwtUseSum:'';
|
||||
}
|
||||
|
||||
if(index == 0 || index === 2){
|
||||
if(index === 2){
|
||||
dataFormSettingPlan(el, 1);
|
||||
}else if(index == 4){
|
||||
}else{
|
||||
dataFormSettingPlan(el, 0);
|
||||
}
|
||||
|
||||
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
PlanFclty: {
|
||||
@@ -1173,14 +1373,49 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
let winterSunnyMin = 1;
|
||||
let winterSunnyAvg = 1;
|
||||
let winterSunnyMax = 1;
|
||||
|
||||
// 최대, 최소 총 유입량 (1년 하루 합계의 최대, 최소)
|
||||
|
||||
// 하절기 청천시, 강우시 재계산 리턴값
|
||||
let summerChungchunFlow = 1
|
||||
let summerChungchunReturnAmnt = 1;
|
||||
let summerChungchunEfflAmnt = 1;
|
||||
let summerRainInflAmnt = 1;
|
||||
let summerRainReturnAmnt = 1;
|
||||
let summerRainEfflAmnt = 1;
|
||||
|
||||
// 동절기 청천시 최대, 최소, 평균 리턴값
|
||||
let winterChungchunFlowAvg = 1 ;
|
||||
let winterChungchunFlowMax = 1 ;
|
||||
let winterChungchunFlowMin = 1 ;
|
||||
let winterChungchunReturnAvg = 1 ;
|
||||
let winterChungchunReturnMax = 1 ;
|
||||
let winterChungchunReturnMin = 1 ;
|
||||
let winterChungchunEfflAvg = 1 ;
|
||||
let winterChungchunEfflMax = 1 ;
|
||||
let winterChungchunEfflMin = 1 ;
|
||||
|
||||
let rdiPercent = 0;
|
||||
|
||||
if(data && operationalStatusList){
|
||||
// 유량 - 유입
|
||||
if (operationalStatusList?.[0]) {
|
||||
// 연간
|
||||
const yearAvg = data.yearData===null?'':(data.yearData.AVG_INFL_AMNT?data.yearData.AVG_INFL_AMNT:0)+(data.yearData.AVG_SUM_FLOW?data.yearData.AVG_SUM_FLOW:0)+(data.yearData.AVG_RETURN_AMNT?data.yearData.AVG_RETURN_AMNT:0);
|
||||
const yearMax = data.yearData===null?'':(data.yearData.MAX_INFL_AMNT?data.yearData.MAX_INFL_AMNT:0)+(data.yearData.MAX_SUM_FLOW?data.yearData.MAX_SUM_FLOW:0)+(data.yearData.MAX_RETURN_AMNT?data.yearData.MAX_RETURN_AMNT:0);
|
||||
const yearMin = data.yearData===null?'':(data.yearData.MIN_INFL_AMNT?data.yearData.MIN_INFL_AMNT:0)+(data.yearData.MIN_SUM_FLOW?data.yearData.MIN_SUM_FLOW:0)+(data.yearData.MIN_RETURN_AMNT?data.yearData.MIN_RETURN_AMNT:0);
|
||||
const yearAvg = data.yearData===null ? '' : (
|
||||
(data.yearData.AVG_INFL_AMNT?data.yearData.AVG_INFL_AMNT:0) +
|
||||
(data.yearData.AVG_SUM_FLOW?data.yearData.AVG_SUM_FLOW:0) +
|
||||
(data.yearData.AVG_RETURN_AMNT?data.yearData.AVG_RETURN_AMNT:0)
|
||||
);
|
||||
const yearMax = data.yearData===null ? '' : (
|
||||
(data.yearData.MAX_INFL_AMNT?data.yearData.MAX_INFL_AMNT:0) +
|
||||
(data.yearData.MAX_SUM_FLOW?data.yearData.MAX_SUM_FLOW:0) +
|
||||
(data.yearData.MAX_RETURN_AMNT?data.yearData.MAX_RETURN_AMNT:0)
|
||||
);
|
||||
const yearMin = data.yearData===null ? '' : (
|
||||
(data.yearData.MIN_INFL_AMNT?data.yearData.MIN_INFL_AMNT:0) +
|
||||
(data.yearData.MIN_SUM_FLOW?data.yearData.MIN_SUM_FLOW:0) +
|
||||
(data.yearData.MIN_RETURN_AMNT?data.yearData.MIN_RETURN_AMNT:0)
|
||||
);
|
||||
|
||||
operationalStatusList[0].yearAvg = yearAvg;
|
||||
operationalStatusList[0].yearMax = yearMax;
|
||||
@@ -1188,18 +1423,15 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
// 여름
|
||||
operationalStatusList[0].summerAll = data.summer === null ? '' : (
|
||||
(data.summer.AVG_INFL_AMNT ? data.summer.AVG_INFL_AMNT : 0) +
|
||||
(data.summer.AVG_SUM_FLOW ? data.summer.AVG_SUM_FLOW : 0) +
|
||||
(data.summer.AVG_TP_INFL_WQLT_TP ? data.summer.AVG_TP_INFL_WQLT_TP : 0)
|
||||
(data.summer.AVG_SUM_FLOW ? data.summer.AVG_SUM_FLOW : 0)
|
||||
);
|
||||
operationalStatusList[0].summerThree = data.summerRainy === null ? '' : (
|
||||
(data.summerRainy.AVG_INFL_AMNT ? data.summerRainy.AVG_INFL_AMNT : 0) +
|
||||
(data.summerRainy.AVG_SUM_FLOW ? data.summerRainy.AVG_SUM_FLOW : 0) +
|
||||
(data.summerRainy.AVG_TP_INFL_WQLT_TP ? data.summerRainy.AVG_TP_INFL_WQLT_TP : 0)
|
||||
(data.summerRainy.AVG_SUM_FLOW ? data.summerRainy.AVG_SUM_FLOW : 0)
|
||||
);
|
||||
operationalStatusList[0].summerRain = data.summerSunny === null ? '' : (
|
||||
(data.summerSunny.AVG_INFL_AMNT ? data.summerSunny.AVG_INFL_AMNT : 0) +
|
||||
(data.summerSunny.AVG_SUM_FLOW ? data.summerSunny.AVG_SUM_FLOW : 0) +
|
||||
(data.summerSunny.AVG_TP_INFL_WQLT_TP ? data.summerSunny.AVG_TP_INFL_WQLT_TP : 0)
|
||||
(data.summerSunny.AVG_SUM_FLOW ? data.summerSunny.AVG_SUM_FLOW : 0)
|
||||
);
|
||||
// 겨울
|
||||
operationalStatusList[0].winterAll = data.winter === null ? '' : (
|
||||
@@ -1230,29 +1462,47 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
let summerChungchunDay = 0;
|
||||
let winterChungchuDay = 0;
|
||||
|
||||
let totFlowMax = 0;
|
||||
let totFlowMin = 9999999;
|
||||
|
||||
let yearSumFlow = 0;
|
||||
let maxYearSumFlow = 0;
|
||||
let minYearSumFlow = 9999999;
|
||||
let summerSumFlow = 0;
|
||||
let summerChungchunSumFlow = 0;
|
||||
let summerRainDaySumFlow = 0;
|
||||
let summerRainDayFlow = 0;
|
||||
let summerRainDayReturnFlow = 0;
|
||||
let summerRainDayEfflFlow = 0;
|
||||
|
||||
let winterSumFlow = 0;
|
||||
let winterChungchunSumFlow = 0;
|
||||
let minWinterChungchunSumFlow = 9999999;
|
||||
let maxWinterChungchunSumFlow = 0;
|
||||
|
||||
|
||||
// 연계처리수,지하수유입량
|
||||
const bscFctCd = fcltyCd;
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse;
|
||||
const res2 = await fetchFlowRateModalList(bscFctCd, searchYear);
|
||||
yearDay = res2.data?res2.data.length:1;
|
||||
res2.data.forEach((item: FlowDataItem) => {
|
||||
res2.data.forEach((item: any) => {
|
||||
yearSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0;
|
||||
if(maxYearSumFlow < (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0)) {
|
||||
maxYearSumFlow = item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0;
|
||||
}
|
||||
if(minYearSumFlow > (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0) || minYearSumFlow === 0) {
|
||||
if(minYearSumFlow > (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0)) {
|
||||
minYearSumFlow = item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0;
|
||||
}
|
||||
|
||||
// 1년 최대 총 하수유입량
|
||||
let totYearFlow = 0;
|
||||
totYearFlow = (item.inflAmnt && item.inflAmnt !== 'x' ? Number(item.inflAmnt.toString().trim()) : 0) + (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0) + (item.returnAmnt && item.returnAmnt !== 'x' ? Number(item.returnAmnt.toString().trim()) : 0);
|
||||
if(totFlowMax < totYearFlow) {
|
||||
totFlowMax = totYearFlow;
|
||||
}
|
||||
if(totFlowMin > totYearFlow || totFlowMin === 0) {
|
||||
totFlowMin = totYearFlow;
|
||||
}
|
||||
|
||||
if(item.msrDt.substring(4,6) === '06' || item.msrDt.substring(4,6) === '07' || item.msrDt.substring(4,6) === '08') {
|
||||
summerDay += 1;
|
||||
summerSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0;
|
||||
@@ -1262,54 +1512,103 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
}
|
||||
});
|
||||
|
||||
const calData = calRainEffectDay(res2.data, 'SUNNY');
|
||||
const calRainDate = calRainEffectDay(res2.data, 'RAIN');
|
||||
const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
|
||||
const calData = CalcRainEffect(clone(res2.data), 'SUNNY');
|
||||
const calRainData = CalcRainEffect(clone(res2.data), 'RAIN');
|
||||
|
||||
// 지하수유입량 - 청천시 기준
|
||||
let chungcunSumFlow = 0;
|
||||
let sumSummerChungcunFlow = 0;
|
||||
let sumWinterChungcunFlow = 0;
|
||||
|
||||
// 하절기 청천시 총인설비 반류수
|
||||
let summerChungchunDayReturnAmnt = 0;
|
||||
// 하절기 청천시 방류수
|
||||
let summerChungchunDayEfflAmnt = 0;
|
||||
|
||||
// 동절기 총 유입량 최대, 최소
|
||||
let winterChungchunTotalInflAmntMax = 0 ;
|
||||
let winterChungchunTotalInflAmntMin = 9999999 ;
|
||||
// 동절기 청천시 하수유입량 최대, 최소
|
||||
let winterChungchunDayFlowMax = 0 ;
|
||||
let winterChungchunDayFlowMin = 9999999 ;
|
||||
// 동절기 청천시 총인반류수 최대, 최소, 평균
|
||||
let winterChungchunDayReturnMax = 0 ;
|
||||
let winterChungchunDayReturnMin = 9999999 ;
|
||||
let winterChungchunDayReturnAvg = 0 ;
|
||||
// 동절기 청천시 방류량 최대, 최소, 평균
|
||||
let winterChungchunDayEfflMax = 0 ;
|
||||
let winterChungchunDayEfflMin = 9999999 ;
|
||||
let winterChungchunDayEfflAvg = 0;
|
||||
|
||||
// 하절기, 동절기 청천시 계산
|
||||
calData.forEach((flowItem: FlowDataItem) => {
|
||||
calData.forEach((flowItem: any) => {
|
||||
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'){
|
||||
summerChungchunDay += 1;
|
||||
summerChungchunSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
summerChungchunDayReturnAmnt += flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0;
|
||||
summerChungchunDayEfflAmnt += flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0;
|
||||
|
||||
}else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){
|
||||
if(minWinterChungchunSumFlow > (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0) || minWinterChungchunSumFlow === 0) {
|
||||
winterChungchuDay += 1;
|
||||
winterChungchunSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
winterChungchunDayReturnAvg += flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0;
|
||||
winterChungchunDayEfflAvg += flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0;
|
||||
|
||||
let totWinterTotalInflAmnt = 0;
|
||||
totWinterTotalInflAmnt = (flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0) + (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0) + (flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0);
|
||||
if(winterChungchunTotalInflAmntMax < totWinterTotalInflAmnt) {
|
||||
winterChungchunTotalInflAmntMax = totWinterTotalInflAmnt;
|
||||
}
|
||||
if(winterChungchunTotalInflAmntMin > totWinterTotalInflAmnt || winterChungchunTotalInflAmntMin === 0) {
|
||||
winterChungchunTotalInflAmntMin = totWinterTotalInflAmnt;
|
||||
}
|
||||
|
||||
if(winterChungchunDayFlowMin > (flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0)) {
|
||||
winterChungchunDayFlowMin = flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
if(winterChungchunDayFlowMax < (flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0)) {
|
||||
winterChungchunDayFlowMax = flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
|
||||
if(minWinterChungchunSumFlow > (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0) ) {
|
||||
minWinterChungchunSumFlow = flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
}
|
||||
if(maxWinterChungchunSumFlow < (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0)) {
|
||||
maxWinterChungchunSumFlow = flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
}
|
||||
winterChungchuDay += 1;
|
||||
winterChungchunSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
|
||||
if(winterChungchunDayReturnMin > (flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0)) {
|
||||
winterChungchunDayReturnMin = flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0;
|
||||
}
|
||||
if(winterChungchunDayReturnMax < (flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0)) {
|
||||
winterChungchunDayReturnMax = flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0;
|
||||
}
|
||||
|
||||
if(winterChungchunDayEfflMin > (flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0)) {
|
||||
winterChungchunDayEfflMin = flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
if(winterChungchunDayEfflMax < (flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0)) {
|
||||
winterChungchunDayEfflMax = flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 하절기 강우시 계산
|
||||
calRainDate.forEach((flowItem: FlowDataItem) => {
|
||||
calRainData.forEach((flowItem: any) => {
|
||||
if(flowItem.msrDt.substring(4,6) === '06' || flowItem.msrDt.substring(4,6) === '07' || flowItem.msrDt.substring(4,6) === '08') {
|
||||
summerRainDay += 1;
|
||||
summerRainDaySumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
summerRainDayFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
summerRainDayReturnFlow += flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0;
|
||||
summerRainDayEfflFlow += flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
});
|
||||
|
||||
operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg) + (yearSumFlow&&Number(yearSumFlow) != 0?Number(yearSumFlow / yearDay):0), 0);
|
||||
operationalStatusList[0].yearMax = roundUp(Number(operationalStatusList[0].yearMax) + Number(maxYearSumFlow), 0);
|
||||
operationalStatusList[0].yearMin = roundUp(Number(operationalStatusList[0].yearMin) + Number(minYearSumFlow), 0);
|
||||
operationalStatusList[0].summerAll = roundUp(Number(operationalStatusList[0].summerAll) + (summerSumFlow&&Number(summerSumFlow)!=0?Number(summerSumFlow / summerDay):0), 0);
|
||||
operationalStatusList[0].summerThree = roundUp(Number(operationalStatusList[0].summerThree) + (summerRainDaySumFlow&&Number(summerRainDaySumFlow)!=0?Number(summerRainDaySumFlow / summerRainDay):0), 0);
|
||||
operationalStatusList[0].summerRain = roundUp(Number(operationalStatusList[0].summerRain) + (summerChungchunSumFlow&&Number(summerChungchunSumFlow)!=0?Number(summerChungchunSumFlow / summerChungchunDay):0), 0);
|
||||
operationalStatusList[0].winterAll = roundUp(Number(operationalStatusList[0].winterAll) + (winterSumFlow&&Number(winterSumFlow)!=0?Number(winterSumFlow / winterDay):0), 0);
|
||||
operationalStatusList[0].winterSunnyMin = roundUp(Number(operationalStatusList[0].winterSunnyMin) + Number(minWinterChungchunSumFlow), 0);
|
||||
operationalStatusList[0].winterSunnyMax = roundUp(Number(operationalStatusList[0].winterSunnyMax) + (winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?Number(winterChungchunSumFlow / winterChungchuDay):0), 0);
|
||||
operationalStatusList[0].winterSunnyAvg = roundUp(Number(operationalStatusList[0].winterSunnyAvg) + Number(maxWinterChungchunSumFlow), 0);
|
||||
|
||||
// 연계처리수
|
||||
yearAvgSumFlow = Number((yearSumFlow&&Number(yearSumFlow)!=0)?(yearSumFlow / yearDay):'');
|
||||
yearMaxSumFlow = maxYearSumFlow;
|
||||
@@ -1322,14 +1621,58 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
winterSunnyAvg = winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?(winterChungchunSumFlow / winterChungchuDay):0;
|
||||
winterSunnyMax = maxWinterChungchunSumFlow;
|
||||
|
||||
// 하절기 강우시 계산
|
||||
// 하수유입량 (강우시)
|
||||
summerRainInflAmnt = summerRainDayFlow&&Number(summerRainDayFlow)!=0?Number(summerRainDayFlow / summerRainDay):0;
|
||||
// 총인설비방류수 (강우시)
|
||||
summerRainReturnAmnt = summerRainDayReturnFlow&&Number(summerRainDayReturnFlow)!=0?Number(summerRainDayReturnFlow / summerRainDay):0;
|
||||
// 방루량 (강우시)
|
||||
summerRainEfflAmnt = summerRainDayEfflFlow&&summerRainDayEfflFlow!=0?summerRainDayEfflFlow / summerRainDay:0;
|
||||
|
||||
// 동절기 청천시 계산
|
||||
// 하수유입량 (청천시) 평균
|
||||
winterChungchunFlowAvg = sumWinterChungcunFlow&&Number(sumWinterChungcunFlow)!=0?(sumWinterChungcunFlow / winterChungchuDay):0;
|
||||
// 총인반류수 (청천시) 평균
|
||||
winterChungchunReturnAvg = winterChungchunDayReturnAvg&&Number(winterChungchunDayReturnAvg)!=0?(winterChungchunDayReturnAvg / winterChungchuDay):0;
|
||||
// 방류량 (청천시) 평균
|
||||
winterChungchunEfflAvg = winterChungchunDayEfflAvg&&Number(winterChungchunDayEfflAvg)!=0?(winterChungchunDayEfflAvg / winterChungchuDay):0;
|
||||
// 하수유입량 (청천시) 최대
|
||||
winterChungchunFlowMax = winterChungchunDayFlowMax;
|
||||
// 총인반류수 (청천시) 최대
|
||||
winterChungchunReturnMax = winterChungchunDayReturnMax;
|
||||
// 방류량 (청천시) 최대
|
||||
winterChungchunEfflMax = winterChungchunDayEfflMax;
|
||||
// 하수유입량 (청천시) 최소
|
||||
winterChungchunFlowMin = winterChungchunDayFlowMin;
|
||||
// 총인반류수 (청천시) 최소
|
||||
winterChungchunReturnMin = winterChungchunDayReturnMin;
|
||||
// 방류량 (청천시) 최소
|
||||
winterChungchunEfflMin = winterChungchunDayEfflMin
|
||||
|
||||
operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg), 0) + roundUp(yearAvgSumFlow, 0);
|
||||
operationalStatusList[0].yearMax = roundUp(totFlowMax, 0); // + roundUp(yearMaxSumFlow, 0);
|
||||
operationalStatusList[0].yearMin = roundUp(totFlowMin, 0);
|
||||
operationalStatusList[0].summerAll = roundUp(Number(operationalStatusList[0].summerAll), 0) + roundUp(summerAll, 0);
|
||||
operationalStatusList[0].summerThree = roundUp(Number(operationalStatusList[0].summerThree), 0) + roundUp(summerThree, 0);
|
||||
operationalStatusList[0].summerRain = roundUp(Number(operationalStatusList[0].summerRain), 0) + roundUp(summerRain, 0);
|
||||
operationalStatusList[0].winterAll = roundUp(Number(operationalStatusList[0].winterAll), 0) + roundUp(winterAll, 0);
|
||||
operationalStatusList[0].winterSunnyMin = roundUp(winterChungchunTotalInflAmntMin, 0);
|
||||
operationalStatusList[0].winterSunnyMax = roundUp(winterChungchunTotalInflAmntMax, 0);
|
||||
operationalStatusList[0].winterSunnyAvg = roundUp(Number(operationalStatusList[0].winterSunnyAvg), 0) + roundUp(winterSunnyAvg, 0);
|
||||
|
||||
// 지하수유입량
|
||||
const usage = chungcunSumFlow / calData.length;
|
||||
const summerUsage = sumSummerChungcunFlow / summerChungchunDay;
|
||||
const winterUsage = sumWinterChungcunFlow / winterChungchuDay;
|
||||
|
||||
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;
|
||||
// 임시 계산변수값들 메인에 대입
|
||||
summerChungchunFlow = summerUsage;
|
||||
summerChungchunReturnAmnt = summerChungchunDayReturnAmnt / summerChungchunDay;
|
||||
summerChungchunEfflAmnt = summerChungchunDayEfflAmnt / summerChungchunDay;
|
||||
|
||||
operationalStatusList[0].groundWaterAvg = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 100) / 100;
|
||||
operationalStatusList[0].groundWaterSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 100) / 100;
|
||||
operationalStatusList[0].groundWaterWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 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);
|
||||
@@ -1337,20 +1680,60 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
// 오염물질
|
||||
// RDII 추정 = 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD))
|
||||
const summerLowFlow = data.summerBod&&data.summerBod.INFL_AMNT&&data.summerBod.INFL_AMNT!='null'?Number(data.summerBod.INFL_AMNT):0;
|
||||
const resp = await fetchMainGraph(searchYear, fcltyCd);
|
||||
const wqltData = resp.data.wqltObjs;
|
||||
const wqltDataTot = CalcRainEffect(clone(wqltData));
|
||||
const wqltDataSunny = CalcRainEffect(clone(wqltData), 'SUNNY');
|
||||
|
||||
let minSummerBod = 99999999;
|
||||
let minSummerBodInfl = 99999999;
|
||||
let winterCnt = 0;
|
||||
let winterBodSunny = 0;
|
||||
let rdiRain = 0;
|
||||
|
||||
const summerMonth = ['06', '07', '08'];
|
||||
const winterMonth = ['01', '02'];
|
||||
|
||||
wqltDataTot.filter(item=>summerMonth.includes(item.msrDt.toString().replaceAll('-','').substring(4,6))).forEach(item2 => {
|
||||
if(Number(item2.infoRnDay)>=3){
|
||||
const inflBod = Number(item2.inflAssctBfrWqltBod);
|
||||
const infl = Number(item2.inflAmnt);
|
||||
const rain = Number(item2.infoRnDay);
|
||||
if(inflBod < minSummerBod){
|
||||
minSummerBodInfl = infl;
|
||||
minSummerBod = inflBod;
|
||||
rdiRain = rain;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
wqltDataSunny.filter(item=>winterMonth.includes(item.msrDt.toString().replaceAll('-','').substring(4,6))).forEach(item2 => {
|
||||
winterBodSunny += Number(item2.inflAssctBfrWqltBod);
|
||||
winterCnt += 1;
|
||||
});
|
||||
|
||||
const winterBodAvg = winterBodSunny / winterCnt;
|
||||
// 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD))
|
||||
const winMinusSum = winterBodAvg - minSummerBod;
|
||||
const rdiValue = winMinusSum===0 ? 0 : minSummerBodInfl * ((winMinusSum / winterBodAvg ));
|
||||
|
||||
rdiPercent = (rdiValue / minSummerBodInfl) * 100;
|
||||
|
||||
operationalStatusList[0].rdi = rdiValue;
|
||||
operationalStatusList[0].rdiRain = rdiRain;
|
||||
/* const summerLowFlow = data.summerBod&&data.summerBod.INFL_AMNT&&data.summerBod.INFL_AMNT!='null'?Number(data.summerBod.INFL_AMNT):0;
|
||||
const winterAvgBod = data.winterSunny&&data.winterSunny.AVG_INFL_ASSCT_BFR_WQLT_BOD&&data.winterSunny.AVG_INFL_ASSCT_BFR_WQLT_BOD!='null'?Number(data.winterSunny.AVG_INFL_ASSCT_BFR_WQLT_BOD):0;
|
||||
const summerLowBod = data.summerBod&&data.summerBod.MIN_INFL_ASSCT_BFR_WQLT_BOD&&data.summerBod.MIN_INFL_ASSCT_BFR_WQLT_BOD!='null'?Number(data.summerBod.MIN_INFL_ASSCT_BFR_WQLT_BOD):0;
|
||||
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:roundUp(summerLowFlow * ((winterAvgBod - summerLowBod) / winterAvgBod), 2);
|
||||
operationalStatusList[0].rdiRain = summerLowRain;
|
||||
dataFormSetting(operationalStatusList[0]);
|
||||
operationalStatusList[0].rdiRain = summerLowRain; */
|
||||
}
|
||||
|
||||
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.toString().replaceAll(',', '')) / (data.yearData && data.yearData.AVG_INFL_AMNT ? Number(data.yearData.AVG_INFL_AMNT.toString().replaceAll(',','')) : 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.toString().replaceAll(',','')) / (data.summer && data.summer.AVG_INFL_AMNT ? Number(data.summer.AVG_INFL_AMNT.toString().replaceAll(',','')) : 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.toString().replaceAll(',','')) / (data.winter && data.winter.AVG_INFL_AMNT ? Number(data.winter.AVG_INFL_AMNT.toString().replaceAll(',','')) : 0) * 100) * 10) / 10+'%';
|
||||
operationalStatusList[7].rdi = operationalStatusList[0].rdi === null ? '' : data.summerBod && data.summerBod.INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].rdi.toString().replaceAll(',','')) / (data.summerBod&&data.summerBod.INFL_AMNT&&data.summerBod.INFL_AMNT!='null'?Number(data.summerBod.INFL_AMNT.toString().replaceAll(',','')):0) * 100) * 10) / 10+'%';
|
||||
operationalStatusList[7].rdi = roundNumber(rdiPercent, 1)+'%';
|
||||
/* 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;*/
|
||||
@@ -1373,6 +1756,17 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
}
|
||||
}
|
||||
|
||||
// 순수하수량
|
||||
if(operationalStatusList[1]){
|
||||
operationalStatusList[1].summerThree = summerRainInflAmnt;
|
||||
operationalStatusList[1].summerRain = summerChungchunFlow;
|
||||
operationalStatusList[1].winterSunnyAvg = winterChungchunFlowAvg;
|
||||
operationalStatusList[1].winterSunnyMax = winterChungchunFlowMax;
|
||||
operationalStatusList[1].winterSunnyMin = winterChungchunFlowMin;
|
||||
dataFormSetting(operationalStatusList[1]);
|
||||
}
|
||||
|
||||
// 연계처리수
|
||||
if(operationalStatusList[2]){
|
||||
operationalStatusList[2].yearAvg = yearAvgSumFlow;
|
||||
operationalStatusList[2].yearMax = yearMaxSumFlow;
|
||||
@@ -1386,11 +1780,71 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
operationalStatusList[2].winterSunnyMax = winterSunnyMax;
|
||||
dataFormSetting(operationalStatusList[2]);
|
||||
}
|
||||
|
||||
// 총인설비방류수
|
||||
if(operationalStatusList[3]){
|
||||
operationalStatusList[3].summerThree = summerRainReturnAmnt;
|
||||
operationalStatusList[3].summerRain = summerChungchunReturnAmnt;
|
||||
operationalStatusList[3].winterSunnyAvg = winterChungchunReturnAvg;
|
||||
operationalStatusList[3].winterSunnyMax = winterChungchunReturnMax;
|
||||
operationalStatusList[3].winterSunnyMin = winterChungchunReturnMin;
|
||||
dataFormSetting(operationalStatusList[3]);
|
||||
}
|
||||
|
||||
// 방류수
|
||||
if(operationalStatusList[4]){
|
||||
operationalStatusList[4].summerThree = summerRainEfflAmnt;
|
||||
operationalStatusList[4].summerRain = summerChungchunEfflAmnt;
|
||||
operationalStatusList[4].winterSunnyAvg = winterChungchunEfflAvg;
|
||||
operationalStatusList[4].winterSunnyMax = winterChungchunEfflMax;
|
||||
operationalStatusList[4].winterSunnyMin = winterChungchunEfflMin;
|
||||
dataFormSetting(operationalStatusList[4]);
|
||||
}
|
||||
|
||||
if (operationalStatusList[0]) {
|
||||
// 안전하게 숫자 변환하는 함수
|
||||
const toNum = (val) => {
|
||||
if (val === null || val === undefined || val === '' || val === '0') return 0;
|
||||
return Number(val.toString().replaceAll(',', '')) || 0;
|
||||
};
|
||||
|
||||
operationalStatusList[0].summerAll =
|
||||
toNum(operationalStatusList[1]?.summerAll) +
|
||||
toNum(operationalStatusList[2]?.summerAll) +
|
||||
toNum(operationalStatusList[3]?.summerAll);
|
||||
|
||||
operationalStatusList[0].summerThree =
|
||||
toNum(operationalStatusList[1]?.summerThree) +
|
||||
toNum(operationalStatusList[2]?.summerThree) +
|
||||
toNum(operationalStatusList[3]?.summerThree);
|
||||
|
||||
operationalStatusList[0].summerRain =
|
||||
toNum(operationalStatusList[1]?.summerRain) +
|
||||
toNum(operationalStatusList[2]?.summerRain) +
|
||||
toNum(operationalStatusList[3]?.summerRain);
|
||||
|
||||
operationalStatusList[0].winterAll =
|
||||
toNum(operationalStatusList[1]?.winterAll) +
|
||||
toNum(operationalStatusList[2]?.winterAll) +
|
||||
toNum(operationalStatusList[3]?.winterAll);
|
||||
|
||||
operationalStatusList[0].winterSunnyAvg =
|
||||
toNum(operationalStatusList[1]?.winterSunnyAvg) +
|
||||
toNum(operationalStatusList[2]?.winterSunnyAvg) +
|
||||
toNum(operationalStatusList[3]?.winterSunnyAvg);
|
||||
|
||||
dataFormSetting(operationalStatusList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if(data.yearData.TP_INFL_WQLT_TP === null || data.yearData.TP_INFL_WQLT_TP === undefined || data.yearData.TP_INFL_WQLT_TP === 'null') {
|
||||
operationalStatusList = operationalStatusList.slice(0, 10);
|
||||
const rtnData = await calcWaterQltyData(operationalStatusList, searchYear, fcltyCd);
|
||||
operationalStatusList = rtnData;
|
||||
|
||||
// 총인설비가 없을 경우 제외
|
||||
console.log('총인시설 여부 : ', data.yearData.TP_FCT_YN);
|
||||
|
||||
if(data.yearData.TP_FCT_YN !== 'Y') {
|
||||
operationalStatusList = operationalStatusList.slice(0, 11);
|
||||
}
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
@@ -1412,6 +1866,24 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
},
|
||||
}));
|
||||
const res = await fetchMainGraph(searchYear, fcltyCd);
|
||||
const res2 = await fetchFacilityWaterQltyInfo(fcltyCd);
|
||||
|
||||
// 법적방류수질 데이터
|
||||
const sortedWaterQltyInfo = [...res2].sort((a, b) => {
|
||||
// 숫자로 변환하여 비교
|
||||
const numA = Number(a.extnsSeqno);
|
||||
const numB = Number(b.extnsSeqno);
|
||||
if (!isNaN(numA) && !isNaN(numB)) {
|
||||
return numA - numB;
|
||||
}
|
||||
// 숫자 변환이 실패하면 문자열로 비교
|
||||
return String(a.extnsSeqno).localeCompare(String(b.extnsSeqno));
|
||||
});
|
||||
|
||||
const waterQltyStandartd : any = sortedWaterQltyInfo && sortedWaterQltyInfo.length > 0
|
||||
? sortedWaterQltyInfo[sortedWaterQltyInfo.length - 1]
|
||||
: [];
|
||||
|
||||
if(res == null || res.data == null || res.data.length === 0) {
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
@@ -1426,6 +1898,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
chart_efflTn: [],
|
||||
chart_inflBod: [],
|
||||
chart_efflBod: [],
|
||||
waterQltyStandartd : [],
|
||||
isLoadingMainGraph : false,
|
||||
}
|
||||
}));
|
||||
@@ -1449,10 +1922,10 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
|
||||
val : item.inflAssctBfrWqltTp ?? 0
|
||||
}));
|
||||
|
||||
|
||||
const chart_chongInTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
|
||||
val : item.tpInflWqltTp ?? 0
|
||||
val : Number(item.tpInflWqltTp) == 0 ? null : item.tpInflWqltTp
|
||||
}));
|
||||
|
||||
const chart_efflTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
|
||||
@@ -1493,6 +1966,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
chart_efflTn: chart_efflTn,
|
||||
chart_inflBod: chart_inflBod,
|
||||
chart_efflBod: chart_efflBod,
|
||||
waterQltyStandartd : waterQltyStandartd,
|
||||
isLoadingMainGraph : false,
|
||||
},
|
||||
}))
|
||||
@@ -1554,7 +2028,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
|
||||
// 청천시 중 강우영향일인 날짜는 이전의 강우량을 대입해 리스트 수정
|
||||
|
||||
const rainEffectList = calRainEffectDayRainManage(res.data.wqltObjs);
|
||||
const rainEffectList = CalcRainEffect(res.data.wqltObjs, 'RAIN_DAY');
|
||||
// Process the data and create rain management list
|
||||
|
||||
const totItemCnt = rainEffectList?rainEffectList.length : 1;
|
||||
@@ -1581,7 +2055,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
totEfflWqltTn += item.efflWqltTn ? Number(item.efflWqltTn.toString().trim()) : 0;
|
||||
totEfflWqltTp += item.efflWqltTp ? Number(item.efflWqltTp.toString().trim()) : 0;
|
||||
|
||||
if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){
|
||||
const toBeRain = item.toBeInfoRnDay ? Number(item.toBeInfoRnDay) : 0;
|
||||
|
||||
if(toBeRain >= 3 && toBeRain < 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);
|
||||
@@ -1606,7 +2082,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
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);
|
||||
}else if(Number(item.infoRnDay) >= 10 && Number(item.infoRnDay) < 20){
|
||||
}else if(toBeRain >= 10 && toBeRain < 20){
|
||||
rainDate[2] = Number(rainDate[2] || 0) + 1;
|
||||
inflAmtCnt[2] = Number(inflAmtCnt[2] || 0) + 1;
|
||||
inflAmnt[2] = Number(inflAmnt[2] || 0) + Number(item.inflAmnt || 0);
|
||||
@@ -1631,7 +2107,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
efflWqltTn[2] = Number(efflWqltTn[2] || 0) + Number(item.efflWqltTn || 0);
|
||||
efflWqltTpCnt[2] = Number(efflWqltTpCnt[2] || 0) + 1;
|
||||
efflWqltTp[2] = Number(efflWqltTp[2] || 0) + Number(item.efflWqltTp || 0);
|
||||
}else if(Number(item.infoRnDay) >= 20 && Number(item.infoRnDay) < 30){
|
||||
}else if(toBeRain >= 20 && toBeRain < 30){
|
||||
rainDate[3] = Number(rainDate[3] || 0) + 1;
|
||||
inflAmtCnt[3] = Number(inflAmtCnt[3] || 0) + 1;
|
||||
inflAmnt[3] = Number(inflAmnt[3] || 0) + Number(item.inflAmnt || 0);
|
||||
@@ -1656,7 +2132,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
efflWqltTn[3] = Number(efflWqltTn[3] || 0) + Number(item.efflWqltTn || 0);
|
||||
efflWqltTpCnt[3] = Number(efflWqltTpCnt[3] || 0) + 1;
|
||||
efflWqltTp[3] = Number(efflWqltTp[3] || 0) + Number(item.efflWqltTp || 0);
|
||||
}else if(Number(item.infoRnDay) >= 30 && Number(item.infoRnDay) < 40){
|
||||
}else if(toBeRain >= 30 && toBeRain < 40){
|
||||
rainDate[4] = Number(rainDate[4] || 0) + 1;
|
||||
inflAmtCnt[4] = Number(inflAmtCnt[4] || 0) + 1;
|
||||
inflAmnt[4] = Number(inflAmnt[4] || 0) + Number(item.inflAmnt || 0);
|
||||
@@ -1681,7 +2157,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
efflWqltTn[4] = Number(efflWqltTn[4] || 0) + Number(item.efflWqltTn || 0);
|
||||
efflWqltTpCnt[4] = Number(efflWqltTpCnt[4] || 0) + 1;
|
||||
efflWqltTp[4] = Number(efflWqltTp[4] || 0) + Number(item.efflWqltTp || 0);
|
||||
}else if(Number(item.infoRnDay) >= 40 && Number(item.infoRnDay) < 50){
|
||||
}else if(toBeRain >= 40 && toBeRain < 50){
|
||||
rainDate[5] = Number(rainDate[5] || 0) + 1;
|
||||
inflAmtCnt[5] = Number(inflAmtCnt[5] || 0) + 1;
|
||||
inflAmnt[5] = Number(inflAmnt[5] || 0) + Number(item.inflAmnt || 0);
|
||||
@@ -1706,7 +2182,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
efflWqltTn[5] = Number(efflWqltTn[5] || 0) + Number(item.efflWqltTn || 0);
|
||||
efflWqltTpCnt[5] = Number(efflWqltTpCnt[5] || 0) + 1;
|
||||
efflWqltTp[5] = Number(efflWqltTp[5] || 0) + Number(item.efflWqltTp || 0);
|
||||
}else if(Number(item.infoRnDay) >= 50 && Number(item.infoRnDay) < 60){
|
||||
}else if(toBeRain >= 50 && toBeRain < 60){
|
||||
rainDate[6] = Number(rainDate[6] || 0) + 1;
|
||||
inflAmtCnt[6] = Number(inflAmtCnt[6] || 0) + 1;
|
||||
inflAmnt[6] = Number(inflAmnt[6] || 0) + Number(item.inflAmnt || 0);
|
||||
@@ -1731,7 +2207,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
efflWqltTn[6] = Number(efflWqltTn[6] || 0) + Number(item.efflWqltTn || 0);
|
||||
efflWqltTpCnt[6] = Number(efflWqltTpCnt[6] || 0) + 1;
|
||||
efflWqltTp[6] = Number(efflWqltTp[6] || 0) + Number(item.efflWqltTp || 0);
|
||||
}else if(Number(item.infoRnDay) >= 60){
|
||||
}else if(toBeRain >= 60){
|
||||
rainDate[7] = Number(rainDate[7] || 0) + 1;
|
||||
inflAmtCnt[7] = Number(inflAmtCnt[7] || 0) + 1;
|
||||
inflAmnt[7] = Number(inflAmnt[7] || 0) + Number(item.inflAmnt || 0);
|
||||
|
||||
@@ -49,11 +49,11 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설이름: string,
|
||||
주소: string,
|
||||
시설용량: number,
|
||||
"시설옹량(m³/일)": number,
|
||||
관측소정보 : string,
|
||||
강우일 : number,
|
||||
강우영향일 : number,
|
||||
연간총강수량 : number,
|
||||
"강우일(일)": number,
|
||||
"강우영향일(일)": number,
|
||||
"연간총강수량(mm)": number,
|
||||
}
|
||||
|
||||
/**====================================
|
||||
@@ -135,7 +135,6 @@ const gridListPrecipitationDetail:PrecipitationPropsDetailProps[] = [
|
||||
|
||||
const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ;
|
||||
console.log('tailStr', tailStr);
|
||||
const url = '/fclt/rain' + tailStr;
|
||||
const res = await getFetch('fo', url);
|
||||
const tmpData:PrecipitationPropsDetailProps[] = [];
|
||||
@@ -146,31 +145,13 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number,
|
||||
const rainDt = res.data[idx].rainyDayObjList[idx2].rainDt;
|
||||
const infoRnDay = res.data[idx].rainyDayObjList[idx2].infoRnDay;
|
||||
const rainDay = res.data[idx].rainyDayObjList[idx2].infoRnDay>=3?1:0;
|
||||
let rainEffectDay = 0;
|
||||
if(idx2 < res.data[idx].rainyDayObjList.length-2){
|
||||
if(rainDay==1){
|
||||
rainEffectDay = 1;
|
||||
} else {
|
||||
if(idx2 >= 2){
|
||||
if(res.data[idx].rainyDayObjList[idx2-1].infoRnDay>=3 || res.data[idx].rainyDayObjList[idx2-2].infoRnDay>=3){
|
||||
rainEffectDay = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(idx2 < res.data[idx].rainyDayObjList.length-1){
|
||||
if(rainDay==1 || res.data[idx].rainyDayObjList[idx2+1].infoRnDay>=3){
|
||||
rainEffectDay = 1;
|
||||
}
|
||||
} else {
|
||||
rainEffectDay = rainDay;
|
||||
}
|
||||
|
||||
tmpData.push({
|
||||
bscFctCd : bscFctCd,
|
||||
rainDt : rainDt,
|
||||
infoRnDay : infoRnDay,
|
||||
rainDay : rainDay,
|
||||
rainEffectDay : rainEffectDay
|
||||
rainEffectDay : rainDay
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -183,8 +164,10 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number,
|
||||
item.rainEffectDay = filteredList.reduce((acc, curr) => acc + curr.rainEffectDay, 0);
|
||||
item.totalYearRain = filteredList.reduce((acc, curr) => acc + curr.infoRnDay, 0);
|
||||
item.infoRnDay = filteredList.reduce((acc, curr) => acc + curr.rainDay, 0);
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return { data: res.data, count: res.count, detailData: tmpData };
|
||||
}
|
||||
|
||||
@@ -280,11 +263,11 @@ export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitatio
|
||||
시군구: item.gugun,
|
||||
시설이름: item.bscFctNm,
|
||||
주소: item.addr,
|
||||
시설용량: item.fctCpc,
|
||||
"시설옹량(m³/일)": item.fctCpc,
|
||||
관측소정보: item.stnKo,
|
||||
강우일: item.infoRnDay,
|
||||
강우영향일: item.rainEffectDay,
|
||||
연간총강수량: item.totalYearRain,
|
||||
"강우일(일)": item.infoRnDay,
|
||||
"강우영향일(일)": item.rainEffectDay,
|
||||
"연간총강수량(mm)": item.totalYearRain,
|
||||
})
|
||||
})
|
||||
}else{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import DataForm, { roundNumber } from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
export type { TableUpperProps };
|
||||
|
||||
/**====================================
|
||||
@@ -42,7 +43,7 @@ export interface FacilityWaterQltyProps {
|
||||
mdmbsn:string|'',
|
||||
inflAmnt: number | '',
|
||||
lclgvrnmntNm: string,
|
||||
infoRnDay: number | '',
|
||||
infoRnDay: number | string | '',
|
||||
rainEffectDay: number | '',
|
||||
tpInflWqltTmprtr: number | '',
|
||||
tpInflWqltPh: string | '',
|
||||
@@ -53,6 +54,7 @@ export interface FacilityWaterQltyProps {
|
||||
tpInflWqltTp: string | '',
|
||||
tpInflWqltEclgyTox: string | '',
|
||||
tpInflWqltClfgrpcnt: string | '',
|
||||
noProcessInflAmnt : string | number | '',
|
||||
}
|
||||
export interface ExcelType {
|
||||
시설코드: string,
|
||||
@@ -64,17 +66,17 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설이름: string,
|
||||
주소: string,
|
||||
용량: number,
|
||||
유입BOD: string | '',
|
||||
유입TOC: string | '',
|
||||
유입SS: string | '',
|
||||
유입TN: string | '',
|
||||
유입TP: string | '',
|
||||
유출BOD: string | '',
|
||||
유출TOC: string | '',
|
||||
유출SS: string | '',
|
||||
유출TN: string | '',
|
||||
유출TP: string | '',
|
||||
"시설용량(m³/일)": number,
|
||||
"유입BOD(mg/L)": string | '',
|
||||
"유입TOC(mg/L)": string | '',
|
||||
"유입SS(mg/L)": string | '',
|
||||
"유입TN(mg/L)": string | '',
|
||||
"유입TP(mg/L)": string | '',
|
||||
"유출BOD(mg/L)": string | '',
|
||||
"유출TOC(mg/L)": string | '',
|
||||
"유출SS(mg/L)": string | '',
|
||||
"유출TN(mg/L)": string | '',
|
||||
"유출TP(mg/L)": string | '',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +210,8 @@ const upHeadListModalYear: TableUpperProps[] = [
|
||||
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" },
|
||||
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" },
|
||||
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" },
|
||||
/* { id: "infoRnDay", title: "강우량(mm/일)", align: "right" }, */
|
||||
{ id: "noProcessInflAmnt", title: "미처리하수량\n(m³/일)", align:"right"},
|
||||
{ id: "infoRnDay", title: "강우량\n(mm/일)", align: "right" }
|
||||
];
|
||||
|
||||
// 처리시설 수질현황 헤더(모달-수질TMS)
|
||||
@@ -375,6 +378,7 @@ export type FacilityWaterQltyActions = {
|
||||
*/
|
||||
const dataFormSetting = (item: FacilityWaterQltyProps) => {
|
||||
DataForm({ type: 'date', column: 'msrDt', item: item as unknown as Record<string, unknown> });
|
||||
DataForm({ type: 'float1', column: 'infoRnDay', item: item as unknown as Record<string, unknown> });
|
||||
}
|
||||
|
||||
export type FacilityWaterQltyStore = FacilityWaterQltyType & FacilityWaterQltyActions;
|
||||
@@ -461,17 +465,17 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
시군구: item.sggNm,
|
||||
시설이름: item.bscFctNm,
|
||||
주소: item.addr,
|
||||
용량: item.fctCpc,
|
||||
유입BOD: item.inflAssctBfrWqltBod,
|
||||
유입TOC: item.inflAssctBfrWqltToc,
|
||||
유입SS: item.inflAssctBfrWqltSs,
|
||||
유입TN: item.inflAssctBfrWqltTn,
|
||||
유입TP: item.inflAssctBfrWqltTp,
|
||||
유출BOD: item.efflWqltBod,
|
||||
유출TOC: item.efflWqltToc,
|
||||
유출SS: item.efflWqltSs,
|
||||
유출TN: item.efflWqltTn,
|
||||
유출TP: item.efflWqltTp,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"유입BOD(mg/L)": item.inflAssctBfrWqltBod,
|
||||
"유입TOC(mg/L)": item.inflAssctBfrWqltToc,
|
||||
"유입SS(mg/L)": item.inflAssctBfrWqltSs,
|
||||
"유입TN(mg/L)": item.inflAssctBfrWqltTn,
|
||||
"유입TP(mg/L)": item.inflAssctBfrWqltTp,
|
||||
"유출BOD(mg/L)": item.efflWqltBod,
|
||||
"유출TOC(mg/L)": item.efflWqltToc,
|
||||
"유출SS(mg/L)": item.efflWqltSs,
|
||||
"유출TN(mg/L)": item.efflWqltTn,
|
||||
"유출TP(mg/L)": item.efflWqltTp,
|
||||
});
|
||||
});
|
||||
}else{
|
||||
@@ -573,48 +577,33 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
}
|
||||
|
||||
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용
|
||||
|
||||
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;
|
||||
} else {
|
||||
item.rainEffectDay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = CalcRainEffect(res.data.wqltObjs);
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]
|
||||
/강우시 일별유입BOD)
|
||||
*/
|
||||
//let rainInflAmnt = 0;
|
||||
let sunnyInflAmnt = 0;
|
||||
let sunnyBod = 0;
|
||||
//let rainDay = 0;
|
||||
let sunnyDay = 0;
|
||||
|
||||
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]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
if(idx > 2){
|
||||
if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
data.forEach(item => {
|
||||
if(item.rainEffectDay == 1){
|
||||
//rainDay += 1;
|
||||
//rainInflAmnt += Number(item.inflAmnt);
|
||||
} else {
|
||||
sunnyDay += 1;
|
||||
sunnyInflAmnt += Number(item.inflAmnt);
|
||||
sunnyBod += Number(item.inflAssctBfrWqltBod);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay;
|
||||
const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay;
|
||||
const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay;
|
||||
//
|
||||
|
||||
const rtnData = data.map((item: FacilityWaterQltyProps) => {
|
||||
dataFormSetting(item)
|
||||
@@ -665,6 +654,11 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
}else{
|
||||
item.tpInflWqltTp = '';
|
||||
}
|
||||
|
||||
const dayBod = Number(item.inflAssctBfrWqltBod);
|
||||
const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0)
|
||||
item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : '';
|
||||
|
||||
return item;
|
||||
})
|
||||
set((state: FacilityWaterQltyType) => ({
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import DataForm, { roundNumber } from "@/app/components/common/DataForm";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty";
|
||||
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
@@ -36,17 +38,17 @@ export interface ExcelType {
|
||||
권역:string|'',
|
||||
단위유역:string|'',
|
||||
중권역:string|'',
|
||||
환경청:string|'',
|
||||
시도: string,
|
||||
시군구: string,
|
||||
시설이름: string,
|
||||
주소: string,
|
||||
용량: number,
|
||||
총유입량: number | '',
|
||||
하수유입량: number | '',
|
||||
연계처리량: number | '',
|
||||
총인반류수량: number | '',
|
||||
방류량: number | '',
|
||||
환경청:string|'',
|
||||
"시설용량(m³/일)": number,
|
||||
"총유입량(m³/일)": number | '',
|
||||
"하수유입량(m³/일)": number | '',
|
||||
"연계처리량(m³/일)": number | '',
|
||||
"총인반류수량(m³/일)": number | '',
|
||||
"방류량(m³/일)": number | '',
|
||||
}
|
||||
|
||||
export type modalExcelType = {
|
||||
@@ -70,6 +72,7 @@ export interface FlowRateModalInterface {
|
||||
efflAmnt : number | '',
|
||||
infoRnDay : number | string | '',
|
||||
rainEffectDay : number | string | '' ,
|
||||
noProcessInflAmnt : number | string | ''
|
||||
}
|
||||
export type FlowRateModalProps = {
|
||||
msrDt : string,
|
||||
@@ -80,6 +83,7 @@ export type FlowRateModalProps = {
|
||||
efflAmnt : number,
|
||||
infoRnDay : number | string | '',
|
||||
rainEffectDay : number | string | '',
|
||||
noProcessInflAmnt : number | string | ''
|
||||
}
|
||||
|
||||
/**====================================
|
||||
@@ -97,7 +101,7 @@ const upHeadList1:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2},
|
||||
{ id: "daddr", title: "주소", row: 0, rowSpan: 2},
|
||||
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "totInflAmnt", title: "총 유입입량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "totInflAmnt", title: "총 유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "inflAmnt", title: "하수유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "sumFlow", title: '연계처리량\n(m³/일)', align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align:"right", row: 0, rowSpan: 2},
|
||||
@@ -113,7 +117,7 @@ const upHeadList2:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2},
|
||||
{ id: "daddr", title: "주소", row: 0, rowSpan: 2},
|
||||
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "totInflAmnt", title: "총 유입입량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "totInflAmnt", title: "총 유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "inflAmnt", title: "하수유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "sumFlow", title: '연계처리량\n(m³/일)', align:"right", row: 0, rowSpan: 2},
|
||||
{ id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align:"right", row: 0, rowSpan: 2},
|
||||
@@ -133,7 +137,7 @@ const upHeadList3:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2 },
|
||||
{ id: "daddr", title: "주소", row: 0, rowSpan: 2 },
|
||||
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row: 0, rowSpan: 2 },
|
||||
{ id: "totInflAmnt", title: "총 유입입량\n(m³/일)", align:"right", row: 0, rowSpan: 2 },
|
||||
{ id: "totInflAmnt", title: "총 유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2 },
|
||||
{ id: "inflAmnt", title: "하수유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2 },
|
||||
{ id: "sumFlow", title: '연계처리량\n(m³/일)', align:"right", row: 0, rowSpan: 2 },
|
||||
{ id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align:"right", row: 0, rowSpan: 2 },
|
||||
@@ -154,6 +158,7 @@ const upHeadListFlowRateModal:TableUpperProps[] = [
|
||||
{ id: "sumFlow", title: "연계처리량(m³/일)", align:"right"},
|
||||
{ id: "returnAmnt", title: "총인 반류수량(m³/일)", align:"right"},
|
||||
{ id: "efflAmnt", title: "방류량(m³/일)", align:"right"},
|
||||
{ id: "noProcessInflAmnt", title: "미처리하수량(m³/일)", align:"right"},
|
||||
{ id: "infoRnDay", title: "강우량(mm/일)", align:"right"}
|
||||
]
|
||||
|
||||
@@ -165,7 +170,8 @@ const modalFlowRateListYear:FlowRateModalProps[] = [
|
||||
====================================*/
|
||||
const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
try {
|
||||
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
|
||||
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
|
||||
const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
|
||||
const res = await getFetch('fo', url);
|
||||
return { data: res.data, count: res.count }
|
||||
} catch (error) {
|
||||
@@ -174,7 +180,7 @@ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: s
|
||||
}
|
||||
}
|
||||
|
||||
const fetchFlowRateModalList = async (bscFctCd: string, searchYear: string) => {
|
||||
export const fetchFlowRateModalList = async (bscFctCd: string, searchYear: string) => {
|
||||
try {
|
||||
const url = '/fclt/flow/' + bscFctCd + '/' + searchYear;
|
||||
const res = await getFetch('fo', url);
|
||||
@@ -292,12 +298,12 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
|
||||
시군구: item.gugun,
|
||||
시설이름: item.bscFctNm,
|
||||
주소: item.daddr,
|
||||
용량: item.fctCpc,
|
||||
총유입량: item.totInflAmnt,
|
||||
하수유입량: item.inflAmnt,
|
||||
연계처리량: item.sumFlow,
|
||||
총인반류수량: item.returnAmnt,
|
||||
방류량: item.efflAmnt,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"총유입량(m³/일)": item.totInflAmnt,
|
||||
"하수유입량(m³/일)": item.inflAmnt,
|
||||
"연계처리량(m³/일)": item.sumFlow,
|
||||
"총인반류수량(m³/일)": item.returnAmnt,
|
||||
"방류량(m³/일)": item.efflAmnt,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -318,50 +324,43 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
|
||||
},
|
||||
searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => {
|
||||
const res = await fetchFlowRateModalList(bscFctCd, searchYear);
|
||||
const data = res.data;
|
||||
// 강우영향일 계산 (강우량이 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
const inflData = CalcRainEffect(res.data);
|
||||
|
||||
// 이틀 전, 하루 전이 강우영향일(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
const res2 = await fetchFacilityWaterQltyListHist(searchYear, bscFctCd);
|
||||
const wqltData = CalcRainEffect(res2?.data.wqltObjs);
|
||||
|
||||
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]?.infoRnDay) < 3 && 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]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]
|
||||
/강우시 일별유입BOD)
|
||||
*/
|
||||
//let rainInflAmnt = 0;
|
||||
let sunnyInflAmnt = 0;
|
||||
let sunnyBod = 0;
|
||||
//let rainDay = 0;
|
||||
let sunnyDay = 0;
|
||||
|
||||
const rtnData = data.map((item: FlowRateModalProps) => {
|
||||
item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0)
|
||||
inflData.forEach(item => {
|
||||
if(item.rainEffectDay == 1){
|
||||
//rainDay += 1;
|
||||
//rainInflAmnt += Number(item.inflAmnt);
|
||||
} else {
|
||||
const msrDt = item.msrDt.replaceAll('-','');
|
||||
sunnyDay += 1;
|
||||
sunnyInflAmnt += Number(item.inflAmnt);
|
||||
sunnyBod += Number(wqltData.filter((wqitem)=>wqitem.msrDt === msrDt)[0].inflAssctBfrWqltBod);
|
||||
}
|
||||
});
|
||||
|
||||
//const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay;
|
||||
const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay;
|
||||
const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay;
|
||||
|
||||
const rtnData = inflData.map((item: FlowRateModalProps) => {
|
||||
const dayBod = Number(wqltData.filter(wqitem=>wqitem.msrDt === item.msrDt.replaceAll('-',''))[0].inflAssctBfrWqltBod);
|
||||
const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0)
|
||||
|
||||
item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0);
|
||||
item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : '';
|
||||
dataFormSetting(item);
|
||||
return item;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
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";
|
||||
import { type ApiResponse, type FlowDataItem } from "../underWaterInput";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { roundUp } from "../common";
|
||||
export type { TableUpperProps };
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
@@ -51,7 +53,7 @@ const upHeadList1:TableUpperProps[] = [
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "variableLoadPercent", title: "변동부하율", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right' },
|
||||
];
|
||||
|
||||
@@ -64,7 +66,7 @@ const upHeadList2:TableUpperProps[] = [
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "variableLoadPercent", title: "변동부하율", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right' },
|
||||
];
|
||||
|
||||
@@ -81,7 +83,7 @@ const upHeadList3:TableUpperProps[] = [
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "variableLoadPercent", title: "변동부하율", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right' },
|
||||
{ id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right' },
|
||||
];
|
||||
|
||||
@@ -94,7 +96,6 @@ const planSewageList:PlanSewageProps[] = [
|
||||
const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
const tailStr = partCd ? '/'+ partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') +'/0'+ (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
|
||||
const url = '/prcsFclt/info/plan/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
|
||||
console.log(url);
|
||||
const res = await getFetch('fo', url);
|
||||
return { data: res.data, count: res.count }
|
||||
}
|
||||
@@ -112,10 +113,10 @@ export type ExcelType = {
|
||||
시군구: string;
|
||||
시설이름: string;
|
||||
주소: string;
|
||||
시설용량: number;
|
||||
여유용량: number;
|
||||
변동부하율 : number;
|
||||
분류식화율 : number;
|
||||
"시설용량(m³/일)": number;
|
||||
"여유용량(m³/일)": number;
|
||||
"변동부하율(%)" : number;
|
||||
"분류식화율(%)" : number;
|
||||
}
|
||||
|
||||
const dataFormSetting=(item : PlanSewageProps)=> {
|
||||
@@ -182,22 +183,25 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy
|
||||
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');
|
||||
const calData = CalcRainEffect(res2.data, 'SUNNY');
|
||||
|
||||
let sumInflAmntSunny = 0;
|
||||
let avgInflAmntSunny = 0;
|
||||
let maxInflAmntSunny = 0;
|
||||
calData.forEach((flowItem:FlowDataItem) => {
|
||||
sumInflAmntSunny += Number(flowItem.inflAmnt);
|
||||
})
|
||||
|
||||
if(Number(flowItem.inflAmnt) > maxInflAmntSunny){
|
||||
maxInflAmntSunny = Number(flowItem.inflAmnt);
|
||||
}
|
||||
});
|
||||
|
||||
avgInflAmntSunny = sumInflAmntSunny / calData.length;
|
||||
item.avgInflAmntSunny = avgInflAmntSunny;
|
||||
if(item.bscFctCd === '11200PB001R'){
|
||||
console.log('avgInflAmntSunny : ',item.avgInflAmntSunny);
|
||||
console.log('calData : ',calData);
|
||||
}
|
||||
item.avgInflAmntSunny = roundUp(avgInflAmntSunny, 0);
|
||||
item.maxInflAmntSunny = roundUp(maxInflAmntSunny, 0);
|
||||
return item;
|
||||
}));
|
||||
|
||||
|
||||
/**
|
||||
* 결과데이터 계산
|
||||
* (1) 여유용량 = 시설용량 - 건기시 평균유량
|
||||
@@ -205,8 +209,6 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy
|
||||
* (3) 분류식화율 = 분류식지역 면적(㎢)/처리구역 면적합계(㎢) ×100
|
||||
*/
|
||||
const resultData = processedData.map((item:PlanSewageProps) => {
|
||||
console.log('item.fctCpc : ',item.fctCpc);
|
||||
console.log('item.avgInflAmntSunny : ',item.avgInflAmntSunny);
|
||||
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;
|
||||
@@ -229,10 +231,10 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy
|
||||
시도: item.sido,
|
||||
시군구: item.gugun,
|
||||
주소: item.daddr,
|
||||
시설용량: item.fctCpc,
|
||||
여유용량: item.spareCapacity,
|
||||
변동부하율: item.variableLoadPercent,
|
||||
분류식화율: item.classifiedSewerPercent,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"여유용량(m³/일)": item.spareCapacity,
|
||||
"변동부하율(%)": item.variableLoadPercent,
|
||||
"분류식화율(%)": item.classifiedSewerPercent,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -63,25 +63,25 @@ export interface ExcelType {
|
||||
시설코드: string,
|
||||
시설명: string,
|
||||
주소: string,
|
||||
시설용량: number | '',
|
||||
증설계획기존: number | '',
|
||||
증설계획현재: number | '',
|
||||
증설계획1단계: number | '',
|
||||
증설계획2단계: number | '',
|
||||
증설계획3단계: number | '',
|
||||
증설계획4단계: number | '',
|
||||
처리인구기존: number | '',
|
||||
처리인구현재: number | '',
|
||||
처리인구1단계: number | '',
|
||||
처리인구2단계: number | '',
|
||||
처리인구3단계: number | '',
|
||||
처리인구4단계: number | '',
|
||||
처리구역기존: number | '',
|
||||
처리구역현재: number | '',
|
||||
처리구역1단계: number | '',
|
||||
처리구역2단계: number | '',
|
||||
처리구역3단계: number | '',
|
||||
처리구역4단계: number | '',
|
||||
"시설옹량(m³/일)": number | '',
|
||||
"증설계획기존(m³/일)": number | '',
|
||||
"증설계획현재(m³/일)": number | '',
|
||||
"증설계획1단계(m³/일)": number | '',
|
||||
"증설계획2단계(m³/일)": number | '',
|
||||
"증설계획3단계(m³/일)": number | '',
|
||||
"증설계획4단계(m³/일)": number | '',
|
||||
"처리인구기존(인)": number | '',
|
||||
"처리인구현재(인)": number | '',
|
||||
"처리인구1단계(인)": number | '',
|
||||
"처리인구2단계(인)": number | '',
|
||||
"처리인구3단계(인)": number | '',
|
||||
"처리인구4단계(인)": number | '',
|
||||
"처리구역기존(km²)": number | '',
|
||||
"처리구역현재(km²)": number | '',
|
||||
"처리구역1단계(km²)": number | '',
|
||||
"처리구역2단계(km²)": number | '',
|
||||
"처리구역3단계(km²)": number | '',
|
||||
"처리구역4단계(km²)": number | '',
|
||||
처리구역: string | ''
|
||||
}
|
||||
|
||||
@@ -385,25 +385,25 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
|
||||
시설코드: item.swtrmtFcltCd,
|
||||
시설명: item.swtrmtFcltNm,
|
||||
주소: item.location,
|
||||
시설용량: item.fctCpc,
|
||||
증설계획기존: item.planSwageQntSumDt4,
|
||||
증설계획현재: item.planSwageQntSum,
|
||||
증설계획1단계: item.planSwageQntSumDc1,
|
||||
증설계획2단계: item.planSwageQntSumDc2,
|
||||
증설계획3단계: item.planSwageQntSumDc3,
|
||||
증설계획4단계: item.planSwageQntSumDc4,
|
||||
처리인구기존: item.swtrmtPpltnCntDt4,
|
||||
처리인구현재: item.swtrmtPpltnCnt,
|
||||
처리인구1단계: item.swtrmtPpltnCntDc1,
|
||||
처리인구2단계: item.swtrmtPpltnCntDc2,
|
||||
처리인구3단계: item.swtrmtPpltnCntDc3,
|
||||
처리인구4단계: item.swtrmtPpltnCntDc4,
|
||||
처리구역기존: item.swtrmtZoneAreaDt4,
|
||||
처리구역현재: item.swtrmtZoneArea,
|
||||
처리구역1단계: item.swtrmtZoneAreaDc1,
|
||||
처리구역2단계: item.swtrmtZoneAreaDc2,
|
||||
처리구역3단계: item.swtrmtZoneAreaDc3,
|
||||
처리구역4단계: item.swtrmtZoneAreaDc4,
|
||||
"시설옹량(m³/일)": item.fctCpc,
|
||||
"증설계획기존(m³/일)": item.planSwageQntSumDt4,
|
||||
"증설계획현재(m³/일)": item.planSwageQntSum,
|
||||
"증설계획1단계(m³/일)": item.planSwageQntSumDc1,
|
||||
"증설계획2단계(m³/일)": item.planSwageQntSumDc2,
|
||||
"증설계획3단계(m³/일)": item.planSwageQntSumDc3,
|
||||
"증설계획4단계(m³/일)": item.planSwageQntSumDc4,
|
||||
"처리인구기존(인)": item.swtrmtPpltnCntDt4,
|
||||
"처리인구현재(인)": item.swtrmtPpltnCnt,
|
||||
"처리인구1단계(인)": item.swtrmtPpltnCntDc1,
|
||||
"처리인구2단계(인)": item.swtrmtPpltnCntDc2,
|
||||
"처리인구3단계(인)": item.swtrmtPpltnCntDc3,
|
||||
"처리인구4단계(인)": item.swtrmtPpltnCntDc4,
|
||||
"처리구역기존(km²)": item.swtrmtZoneAreaDt4,
|
||||
"처리구역현재(km²)": item.swtrmtZoneArea,
|
||||
"처리구역1단계(km²)": item.swtrmtZoneAreaDc1,
|
||||
"처리구역2단계(km²)": item.swtrmtZoneAreaDc2,
|
||||
"처리구역3단계(km²)": item.swtrmtZoneAreaDc3,
|
||||
"처리구역4단계(km²)": item.swtrmtZoneAreaDc4,
|
||||
처리구역: item.trtDstr
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,9 +44,9 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설이름: string,
|
||||
주소: string,
|
||||
시설용량: number | '',
|
||||
계획유입수질: number | '',
|
||||
설계유입수질: number | '',
|
||||
"시설용량(m³/일)": number | '',
|
||||
"계획유입수질(mg/L)": number | '',
|
||||
"설계유입수질(mg/L)": number | '',
|
||||
공법: string,
|
||||
가동개시일: string,
|
||||
준공일: string,
|
||||
@@ -118,7 +118,7 @@ export type fcltyHistInfoProps = {
|
||||
sitArea : number,
|
||||
trtDstrArea : number,
|
||||
swrTrtPopl : number,
|
||||
fcltCpc : number | ''
|
||||
fctCpc : number | ''
|
||||
}
|
||||
|
||||
// 시설 수질정보
|
||||
@@ -345,7 +345,7 @@ const gridListFcltyHistInfo:fcltyHistInfoProps[] = [
|
||||
sitArea : 0,
|
||||
trtDstrArea : 0,
|
||||
swrTrtPopl : 0,
|
||||
fcltCpc : 860000
|
||||
fctCpc : 860000
|
||||
}
|
||||
];
|
||||
|
||||
@@ -456,7 +456,7 @@ const fetchFacilityHistInfo = async (facilityCd:string ): Promise<fcltyHistInfoP
|
||||
};
|
||||
|
||||
// 시설정보 수질정보 데이터 호출
|
||||
const fetchFacilityWaterQltyInfo = async (facilityCd:string ): Promise<fcltyWaterQltyInfoProps[]> => {
|
||||
export const fetchFacilityWaterQltyInfo = async (facilityCd:string ): Promise<fcltyWaterQltyInfoProps[]> => {
|
||||
try {
|
||||
const res = await getFetch('fo', '/prcsFclt/info/history/'+facilityCd);
|
||||
const data = res.data;
|
||||
@@ -623,13 +623,13 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
|
||||
시군구: item.gugun,
|
||||
시설이름: item.bscFctNm,
|
||||
주소: item.daddr,
|
||||
시설용량: item.fctCpc ? Number(item.fctCpc) : '',
|
||||
계획유입수질: item.plInflWqltBod ? Number(item.plInflWqltBod) : '',
|
||||
설계유입수질: item.dsInflWqltBod ? Number(item.dsInflWqltBod) : '',
|
||||
"시설용량(m³/일)": item.fctCpc ? Number(item.fctCpc.toString().replaceAll(',','')) : '',
|
||||
"계획유입수질(mg/L)": item.plInflWqltBod ? Number(item.plInflWqltBod) : '',
|
||||
"설계유입수질(mg/L)": item.dsInflWqltBod ? Number(item.dsInflWqltBod) : '',
|
||||
공법: item.trtFrfNm,
|
||||
가동개시일: item.rnDt,
|
||||
준공일: item.cmplDt,
|
||||
관리대행업자: item.mnstr,
|
||||
관리대행업자: item.trstOprEtpNm,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
+132
-46
@@ -1,8 +1,9 @@
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import DataForm, { roundNumber } from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty";
|
||||
import { calRainEffectDay } from "../underWaterInput";
|
||||
import type { FlowResponse } from "../sewageOccur";
|
||||
export type { TableUpperProps };
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
@@ -30,6 +31,9 @@ export type RdiProps = {
|
||||
lgbsn : string,
|
||||
mdmbsn : string,
|
||||
rainEffectDay : number, // 강우영향일
|
||||
chungchunFlow : string | number | '',
|
||||
rainCalInflAmnt : string | number | '',
|
||||
properYn : string,
|
||||
}
|
||||
|
||||
export interface RdiInterface {
|
||||
@@ -44,11 +48,15 @@ export interface RdiInterface {
|
||||
inflAmnt : number,
|
||||
winterAvgBodLowRainfall : number,
|
||||
rdiiValue : number,
|
||||
infoRnDay : number,
|
||||
infoRnDay : number | string,
|
||||
rgnNm : string,
|
||||
rvbsn : string,
|
||||
lgbsn : string,
|
||||
mdmbsn : string,
|
||||
rainEffectDay : number, // 강우영향일
|
||||
chungchunFlow : string | number | '',
|
||||
rainCalInflAmnt : string | number | '',
|
||||
properYn : string,
|
||||
}
|
||||
|
||||
// 모달
|
||||
@@ -79,12 +87,15 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설명: string,
|
||||
주소: string,
|
||||
시설용량: number,
|
||||
하절기강우일최저유입BOD: number | '',
|
||||
하절기최저유입BOD유입유량: number | string | '',
|
||||
동절기청천시유입BOD: number | '',
|
||||
RDII추정 : number | '',
|
||||
RDII추정시일강수량 : number | '',
|
||||
"시설용량(m³/일)": number,
|
||||
"청천시유입하수량(m³/일)": string | number | '',
|
||||
"하절기강우일최저유입BOD(mg/L)": number | '',
|
||||
"하절기최저유입BOD유입유량(m³/일)": number | string | '',
|
||||
"동절기청천시유입BOD(mg/L)": number | '',
|
||||
"RDII추정" : number | '',
|
||||
"RDII추정시일강수량(mm)": number | '',
|
||||
"강우시총추정유입량(m³/일)" : string | number | '',
|
||||
적정여부 : string,
|
||||
}
|
||||
|
||||
// 리스트 헤더
|
||||
@@ -95,6 +106,7 @@ const upHeadList1:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "chungchunFlow", title: "청천시 유입하수량\n(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "B", title: "하절기 운영현황(6~8월)", row:0, colSpan:2 },
|
||||
{ id: "summerMinBodValue", title: "3mm 이상 강우일 중 최저 유입BOD\n(mg/L)", align:"right", row:1 },
|
||||
{ id: "inflAmnt", title: "하절기최저유입BOD유입유량\n(m³/일)", row:1, align:"right" },
|
||||
@@ -102,6 +114,8 @@ const upHeadList1:TableUpperProps[] = [
|
||||
{ id: "winterAvgBodLowRainfall", title: "청천시 유입BOD\n(mg/L)", row:1, align:"right" },
|
||||
{ id: "rdiiValue", title: "RDII추정", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "infoRnDay", title: "RDII추정시일강수량\n(mm)", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "rainCalInflAmnt", title: "강우시 총 추정유입량\n(m³/일)", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "properYn", title: "적정여부", row:0, rowSpan:2 },
|
||||
];
|
||||
|
||||
const upHeadList2:TableUpperProps[] = [
|
||||
@@ -112,13 +126,16 @@ const upHeadList2:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "chungchunFlow", title: "청천시 유입하수량\n(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "B", title: "하절기 운영현황(6~8월)", row:0, colSpan:2 },
|
||||
{ id: "summerMinBodValue", title: "하절기강우일최저유입BOD", align:"right", row:1 },
|
||||
{ id: "summerMinBodValue", title: "3mm 이상 강우일 중 최저 유입BOD\n(mg/L)", align:"right", row:1 },
|
||||
{ id: "inflAmnt", title: "하절기최저유입BOD유입유량", row:1, align:"right" },
|
||||
{ id: "D", title: "동절기 운영현황(1~2월)", row:0 },
|
||||
{ id: "winterAvgBodLowRainfall", title: "동절기청천시유입BOD", row:1, align:"right" },
|
||||
{ id: "rdiiValue", title: "RDII추정", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "infoRnDay", title: "RDII추정시일강수량", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "rainCalInflAmnt", title: "강우시 총 추정유입량\n(m³/일)", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "properYn", title: "적정여부", row:0, rowSpan:2 },
|
||||
];
|
||||
|
||||
const upHeadList3:TableUpperProps[] = [
|
||||
@@ -133,13 +150,16 @@ const upHeadList3:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "chungchunFlow", title: "청천시 유입하수량\n(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "C", title: "하절기 운영현황(6~8월)", row:0, colSpan:2 },
|
||||
{ id: "summerMinBodValue", title: "하절기강우일최저유입BOD", align:"right", row:1 },
|
||||
{ id: "summerMinBodValue", title: "3mm 이상 강우일 중 최저 유입BOD\n(mg/L)", align:"right", row:1 },
|
||||
{ id: "inflAmnt", title: "하절기최저유입BOD유입유량", row:1, align:"right" },
|
||||
{ id: "D", title: "동절기 운영현황(1~2월)", row:0 },
|
||||
{ id: "winterAvgBodLowRainfall", title: "동절기청천시유입BOD", row:1, align:"right" },
|
||||
{ id: "rdiiValue", title: "RDII추정", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "infoRnDay", title: "RDII추정시일강수량", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "rainCalInflAmnt", title: "강우시 총 추정유입량\n(m³/일)", row:0, rowSpan:2, align:"right" },
|
||||
{ id: "properYn", title: "적정여부", row:0, rowSpan:2 },
|
||||
];
|
||||
|
||||
const rdiList:RdiProps[] = [
|
||||
@@ -153,7 +173,6 @@ const fetchRdiList = async (pageNo: number, pageSize: number, searchYear: string
|
||||
try{
|
||||
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
|
||||
const url = '/rdii/list/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
|
||||
console.log(url);
|
||||
const res = await getFetch('fo', url);
|
||||
return { data: res.data, count: res.count }
|
||||
}catch(error){
|
||||
@@ -207,11 +226,6 @@ export const rdiInitState: RdiType = {
|
||||
|
||||
const dataFormSetting=(item : RdiProps)=> {
|
||||
DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record<string, unknown> });
|
||||
DataForm({ type: 'float1', column: 'summerMinBodValue', item: item as unknown as Record<string, unknown>});
|
||||
DataForm({ type: 'float1', column: 'winterAvgBodLowRainfall', item: item as unknown as Record<string, unknown>});
|
||||
DataForm({ type: 'float1', column: 'rdiiValue', item: item as unknown as Record<string, unknown>});
|
||||
DataForm({ type: 'float1', column: 'infoRnDay', item: item as unknown as Record<string, unknown>});
|
||||
DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record<string, unknown>});
|
||||
}
|
||||
|
||||
// Add type definitions for state setter function
|
||||
@@ -232,9 +246,31 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
|
||||
const res = await fetchRdiList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
|
||||
const data = res.data;
|
||||
const excelDownList: ExcelType[] = [];
|
||||
const reData = await Promise.all(data.map(async (item: RdiProps) => {
|
||||
const bscFctCd = item.bscFctCd;
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as FlowResponse;
|
||||
const calData = CalcRainEffect(res2.data, 'SUNNY');
|
||||
let avgChungcunSumFlow = 0;
|
||||
let chungcunSumFlow = 0;
|
||||
|
||||
const rtnData = data.map((item: RdiProps) => {
|
||||
calData.forEach((flowItem: any) => {
|
||||
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;
|
||||
} */
|
||||
});
|
||||
avgChungcunSumFlow = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / calData.length : 0;
|
||||
item.chungchunFlow = avgChungcunSumFlow;
|
||||
item.rainCalInflAmnt = Number(avgChungcunSumFlow) + Number(item.rdiiValue);
|
||||
return item;
|
||||
}));
|
||||
|
||||
const excelDownList: ExcelType[] = [];
|
||||
const rtnData = reData.map((item: RdiProps) => {
|
||||
return {
|
||||
...item,
|
||||
sido: item.lclgvrnmntNm.split(' ')[0]?.toString() || '',
|
||||
@@ -242,44 +278,91 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
inflAmnt: item.inflAmnt?Number(item.inflAmnt).toFixed(1): ''
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 청천히 동절기 유입bod를 새로 구하기 위해서 재 호출
|
||||
for (const item of rtnData) {
|
||||
const fcltyCd = item.bscFctCd;
|
||||
let winterInflBod = 0;
|
||||
|
||||
const res: any = await fetchFacilityWaterQltyListHist(searchYear, fcltyCd);
|
||||
|
||||
let rtnWinterInflBod = 0;
|
||||
let rtnSummerBodInfl = 0;
|
||||
let rtnSummerBod = 0;
|
||||
let rtnRdiValue = 0;
|
||||
let rtnRdiRain = 0;
|
||||
let chungchunFlow = 0;
|
||||
|
||||
if (res?.data) {
|
||||
const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
|
||||
const rtnWqltData = res.data.wqltObjs;
|
||||
rtnWqltData.forEach((dataItem: any) => {
|
||||
dataItem.rainEffectDay = 0;
|
||||
});
|
||||
const wqltDataTot = CalcRainEffect(clone(rtnWqltData));
|
||||
const wqltDataSunny = CalcRainEffect(clone(rtnWqltData), 'SUNNY');
|
||||
|
||||
calRainEffectDay(rtnWqltData, 'SUNNY');
|
||||
let chungchunInfl = 0;
|
||||
let chungchunCnt = 0;
|
||||
let minSummerBod = 99999999;
|
||||
let minSummerBodInfl = 99999999;
|
||||
let winterCnt = 0;
|
||||
let winterBodSunny = 0;
|
||||
let rdiRain = 0;
|
||||
|
||||
const summerMonth = ['06', '07', '08'];
|
||||
const winterMonth = ['01', '02'];
|
||||
|
||||
const rtnWqltWinterData = rtnWqltData.filter((dataItem: any) =>
|
||||
(dataItem.msrDt.substring(4, 6) === '01' ||
|
||||
dataItem.msrDt.substring(4, 6) === '02') &&
|
||||
dataItem.rainEffectDay == 0
|
||||
);
|
||||
wqltDataTot.forEach(item2 => {
|
||||
if(item2.rainEffectDay == 0){
|
||||
chungchunCnt ++;
|
||||
chungchunInfl += Number(item2.inflAmnt);
|
||||
}
|
||||
|
||||
rtnWqltWinterData.forEach((dataItem: any) => {
|
||||
winterInflBod += dataItem.inflAssctBfrWqltBod
|
||||
? Number(dataItem.inflAssctBfrWqltBod)
|
||||
: 0;
|
||||
if(summerMonth.includes(item2.msrDt.toString().replaceAll('-','').substring(4,6))){
|
||||
if(Number(item2.infoRnDay)>=3){
|
||||
const inflBod = Number(item2.inflAssctBfrWqltBod);
|
||||
const infl = Number(item2.inflAmnt);
|
||||
const rain = Number(item2.infoRnDay);
|
||||
if(inflBod < minSummerBod){
|
||||
minSummerBodInfl = infl;
|
||||
minSummerBod = inflBod;
|
||||
rdiRain = rain;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (rtnWqltWinterData.length > 0) {
|
||||
winterInflBod = winterInflBod / rtnWqltWinterData.length;
|
||||
}
|
||||
wqltDataSunny.filter(item=>winterMonth.includes(item.msrDt.toString().replaceAll('-','').substring(4,6))).forEach(item2 => {
|
||||
winterBodSunny += Number(item2.inflAssctBfrWqltBod);
|
||||
winterCnt += 1;
|
||||
});
|
||||
|
||||
minSummerBod = minSummerBod === 99999999 ? 0 : minSummerBod;
|
||||
minSummerBodInfl = minSummerBodInfl === 99999999 ? 0 : minSummerBodInfl;
|
||||
|
||||
const winterBodAvg = winterBodSunny / winterCnt;
|
||||
// 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD))
|
||||
const winMinusSum = winterBodAvg - minSummerBod;
|
||||
console.log(item.bscFctCd+' '+minSummerBodInfl+' '+winMinusSum+' ('+winterBodSunny+' '+winterCnt+') '+' '+winterBodSunny)
|
||||
const rdiValue = winMinusSum===0 ? 0 : minSummerBodInfl * ((winMinusSum / winterBodAvg ));
|
||||
|
||||
rtnWinterInflBod = winterBodAvg;
|
||||
rtnSummerBodInfl = minSummerBodInfl;
|
||||
rtnSummerBod = minSummerBod;
|
||||
rtnRdiValue = rdiValue;
|
||||
rtnRdiRain = rdiRain;
|
||||
chungchunFlow = chungchunInfl == 0? 0 : chungchunInfl / chungchunCnt;
|
||||
}
|
||||
|
||||
item.winterAvgBodLowRainfall = winterInflBod;
|
||||
item.summerMinBodValue = roundNumber(rtnSummerBod,1);
|
||||
item.inflAmnt = roundNumber(rtnSummerBodInfl.toString(), 0);
|
||||
item.winterAvgBodLowRainfall = roundNumber(rtnWinterInflBod, 1);
|
||||
item.rdiiValue = roundNumber(rtnRdiValue, 0);
|
||||
item.infoRnDay = roundNumber(rtnRdiRain, 0);
|
||||
item.chungchunFlow = roundNumber(chungchunFlow, 0);
|
||||
item.rainCalInflAmnt = roundNumber(Number(item.chungchunFlow.toString().replaceAll(',','')) + Number(item.rdiiValue.toString().replaceAll(',','')), 0);
|
||||
item.properYn = Number(item.rainCalInflAmnt.toString().replaceAll(',','')) > Number(item.fctCpc.toString().replaceAll(',','')) ? '초과유입' : '적정';
|
||||
|
||||
}
|
||||
|
||||
rtnData.forEach((item: RdiProps) => {
|
||||
dataFormSetting(item)
|
||||
dataFormSetting(item);
|
||||
})
|
||||
|
||||
if(pageSize>5000){
|
||||
@@ -294,12 +377,15 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
시도: item.sido,
|
||||
시군구: item.sigungo,
|
||||
주소: item.daddr,
|
||||
시설용량: item.fctCpc,
|
||||
하절기강우일최저유입BOD: item.summerMinBodValue,
|
||||
하절기최저유입BOD유입유량: item.inflAmnt,
|
||||
동절기청천시유입BOD: item.winterAvgBodLowRainfall,
|
||||
RDII추정 : item.rdiiValue,
|
||||
RDII추정시일강수량 : item.infoRnDay,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"청천시유입하수량(m³/일)": item.chungchunFlow,
|
||||
"하절기강우일최저유입BOD(mg/L)": item.summerMinBodValue,
|
||||
"하절기최저유입BOD유입유량(m³/일)": item.inflAmnt,
|
||||
"동절기청천시유입BOD(mg/L)": item.winterAvgBodLowRainfall,
|
||||
"RDII추정": item.rdiiValue,
|
||||
"RDII추정시일강수량(mm)": item.infoRnDay,
|
||||
"강우시총추정유입량(m³/일)": item.rainCalInflAmnt,
|
||||
적정여부: item.properYn,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { OSU_PERCENT } from "../common";
|
||||
export type { TableUpperProps };
|
||||
/**====================================
|
||||
* Store - 타입
|
||||
@@ -50,12 +52,12 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설명: string,
|
||||
주소: string,
|
||||
시설용량: number,
|
||||
물사용량: number | '',
|
||||
오수전환율: number | '',
|
||||
오수발생량추정: number | '',
|
||||
연간하수유입량: number | '',
|
||||
청천시하수유입량: number | '',
|
||||
"시설용량(m³/일)": number,
|
||||
"물사용량(m³/일)": number | '',
|
||||
"오수전환율(%)": number | '',
|
||||
"오수발생량추정(m³/일)": number | '',
|
||||
"연간하수유입량(m³/일)": number | '',
|
||||
"청천시하수유입량(m³/일)": number | '',
|
||||
}
|
||||
|
||||
// 리스트 헤더
|
||||
@@ -236,47 +238,9 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
|
||||
let totWaterUsage = 0;
|
||||
|
||||
// 강우영향일 계산 (강우량이 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]?.infoRnDay) < 3 && 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]?.infoRnDay) < 3 && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
|
||||
res2.data[idx]!.infoRnDay = res2.data[idx-2]!.infoRnDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const rainEffectData = CalcRainEffect(res2.data);
|
||||
|
||||
res2.data.forEach((item: FlowDataItem) => {
|
||||
rainEffectData.forEach((item: FlowDataItem) => {
|
||||
|
||||
if(Number(item.rainEffectDay) === 0){
|
||||
chungcunSumFlow += Number(item.inflAmnt);
|
||||
@@ -314,12 +278,12 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
|
||||
시도: item.sidoNm,
|
||||
시군구: item.sggNm,
|
||||
주소: item.daddr,
|
||||
시설용량: item.fctCpc,
|
||||
물사용량: item.waterUsage,
|
||||
오수전환율: item.swageChangePercent,
|
||||
오수발생량추정: item.estimationSewage,
|
||||
연간하수유입량 : item.sewageInputYear,
|
||||
청천시하수유입량 : item.sewageInputChungchun,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"물사용량(m³/일)": item.waterUsage,
|
||||
"오수전환율(%)": item.swageChangePercent,
|
||||
"오수발생량추정(m³/일)": item.estimationSewage,
|
||||
"연간하수유입량(m³/일)": item.sewageInputYear,
|
||||
"청천시하수유입량(m³/일)": item.sewageInputChungchun,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -382,8 +346,8 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
|
||||
tableData.push({
|
||||
msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)),
|
||||
waterUsage: Math.round(item.usege*1) /1,
|
||||
swageChangePercent: (Math.round((item.usege/item.usege*0.9) * 100) / 100) * 100,
|
||||
estimationSewage: Math.round(item.usege*0.9 * 1) / 1
|
||||
swageChangePercent: (Math.round((item.usege/item.usege*OSU_PERCENT) * 100) / 100) * 100,
|
||||
estimationSewage: Math.round(item.usege*OSU_PERCENT * 1) / 1
|
||||
})
|
||||
if (item.usege > maxWaterUsage) {
|
||||
maxWaterUsage = item.usege;
|
||||
|
||||
@@ -2,6 +2,8 @@ import { getFetch } from "@/app/components/api";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps } from "./types";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { OSU_PERCENT } from "../common";
|
||||
export type { TableUpperProps };
|
||||
|
||||
// SewageOccurDetailProps 타입을 여기에 정의
|
||||
@@ -38,10 +40,12 @@ const upHeadList1:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 },
|
||||
{ id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "properYn", title: "적정여부", row:0, rowSpan:2 },
|
||||
];
|
||||
|
||||
const upHeadList2:TableUpperProps[] = [
|
||||
@@ -52,10 +56,12 @@ const upHeadList2:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 },
|
||||
{ id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "properYn", title: "적정여부", row:0, rowSpan:2 },
|
||||
];
|
||||
|
||||
const upHeadList3:TableUpperProps[] = [
|
||||
@@ -70,10 +76,12 @@ const upHeadList3:TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 },
|
||||
{ id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 },
|
||||
{ id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1 },
|
||||
{ id: "properYn", title: "적정여부", row:0, rowSpan:2 },
|
||||
];
|
||||
|
||||
// 모달
|
||||
@@ -251,6 +259,7 @@ export const underWaterInitState: UnderWaterType = {
|
||||
|
||||
const dataFormSetting=(item : UnderWaterProps)=> {
|
||||
DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record<string, unknown> });
|
||||
DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record<string, unknown> });
|
||||
DataForm({ type: 'float0', column: 'underWaterInputYear', item: item as unknown as Record<string, unknown>});
|
||||
DataForm({ type: 'float0', column: 'underWaterInputSummer', item: item as unknown as Record<string, unknown>});
|
||||
DataForm({ type: 'float0', column: 'underWaterInputWinter', item: item as unknown as Record<string, unknown>});
|
||||
@@ -258,65 +267,6 @@ const dataFormSetting=(item : UnderWaterProps)=> {
|
||||
|
||||
export type UnderWaterStore = UnderWaterType & UnderWaterActions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @param weather ('ALL' | 'SUNNY' | 'RAINY')
|
||||
* @returns
|
||||
*/
|
||||
export const calRainEffectDay = (data: any, 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]?.infoRnDay) < 3 && 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]?.infoRnDay) < 3 && 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) => {
|
||||
@@ -337,7 +287,7 @@ 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');
|
||||
const calData = CalcRainEffect(res2.data, 'SUNNY');
|
||||
let chungcunSumFlow = 0;
|
||||
|
||||
let sumSummerChungcunDay = 0;
|
||||
@@ -357,20 +307,19 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
});
|
||||
|
||||
const usage = chungcunSumFlow / calData.length;
|
||||
const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay;
|
||||
const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay;
|
||||
const usage = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / calData.length:0;
|
||||
const summerUsage = sumSummerChungcunFlow?sumSummerChungcunFlow / sumSummerChungcunDay:0;
|
||||
const winterUsage = sumWinterChungcunFlow?sumWinterChungcunFlow / sumWinterChungcunDay:0;
|
||||
|
||||
if(bscFctCd === '11200PB001R') {
|
||||
//bscFctCd === '11200PB001R') 중랑 - 테스트할 때 코드넣고 해야 보기편해요~
|
||||
/* if(bscFctCd === '11200PB001R') {
|
||||
console.log('calData.length : ', calData.length);
|
||||
console.log('usage : ', usage, 'summerUsage : ', summerUsage, 'winterUsage : ', winterUsage);
|
||||
}
|
||||
|
||||
item.underWaterInputYear = Math.round((usage-(usage*0.65*0.9)) * 1) / 1;
|
||||
item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*0.9)) * 1) / 1;
|
||||
item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*0.9)) * 1) / 1;
|
||||
|
||||
} */
|
||||
item.underWaterInputYear = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 1) / 1;
|
||||
item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 1) / 1;
|
||||
item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 1) / 1;
|
||||
item.properYn = Math.round( (Number(usage-(usage*0.65*OSU_PERCENT)) / Number(item.inflAmnt)) * 100 * 1 ) / 1 > 20?'초과유입':'적정';
|
||||
return item;
|
||||
}));
|
||||
|
||||
@@ -391,11 +340,12 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
시군구: item.sggNm,
|
||||
시설명: item.bscFctNm,
|
||||
주소: item.daddr,
|
||||
시설용량: item.fctCpc,
|
||||
연간지하수유입량: item.underWaterInputYear,
|
||||
하절기지하수유입량: item.underWaterInputSummer,
|
||||
동절기지하수유입량: item.underWaterInputWinter,
|
||||
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"평균유입하수량(m³/일)": item.inflAmnt,
|
||||
"연간지하수유입량(m³/일)": item.underWaterInputYear,
|
||||
"하절기지하수유입량(m³/일)": item.underWaterInputSummer,
|
||||
"동절기지하수유입량(m³/일)": item.underWaterInputWinter,
|
||||
적정여부: item.properYn,
|
||||
});
|
||||
});
|
||||
}else{
|
||||
@@ -425,7 +375,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
|
||||
const monthData: SewageOccurDetailProps[] = [];
|
||||
|
||||
const calData = calRainEffectDay(res.data, 'SUNNY');
|
||||
const calData = CalcRainEffect(res.data, 'SUNNY');
|
||||
let tot = 0;
|
||||
let cnt = 0;
|
||||
|
||||
@@ -456,8 +406,8 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
tableData.push({
|
||||
msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)),
|
||||
realSewageInput:Math.round(item.usege*1) /1,
|
||||
sewageOccur:Math.round(item.usege*0.65*0.9 * 1) / 1,
|
||||
underWaterInput:Math.round((item.usege-(item.usege*0.65*0.9)) * 1) / 1,
|
||||
sewageOccur:Math.round(item.usege*0.65*OSU_PERCENT * 1) / 1,
|
||||
underWaterInput:Math.round((item.usege-(item.usege*0.65*OSU_PERCENT)) * 1) / 1,
|
||||
})
|
||||
if (item.usege > maxWaterUsage) {
|
||||
maxWaterUsage = item.usege;
|
||||
@@ -468,28 +418,33 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
|
||||
}
|
||||
|
||||
});
|
||||
console.log('tot', tot, 'calData.length', calData.length);
|
||||
|
||||
if(monthData.length == 0){
|
||||
maxWaterUsage = 0;
|
||||
avgWaterUsage = 0;
|
||||
minWaterUsage = 0;
|
||||
}
|
||||
|
||||
avgWaterUsage = tot/cnt;
|
||||
console.log(avgWaterUsage);
|
||||
const newData= [
|
||||
{
|
||||
msrDt: '평균',
|
||||
realSewageInput:Math.round(avgWaterUsage*1) /1,
|
||||
sewageOccur:Math.round(avgWaterUsage*0.65*0.9 * 1) / 1,
|
||||
underWaterInput: Math.round((avgWaterUsage-(avgWaterUsage*0.65*0.9)) * 1) / 1
|
||||
sewageOccur:Math.round(avgWaterUsage*0.65*OSU_PERCENT * 1) / 1,
|
||||
underWaterInput: Math.round((avgWaterUsage-(avgWaterUsage*0.65*OSU_PERCENT)) * 1) / 1
|
||||
//underWaterInput:Math.round((avgWaterUsage-(avgWaterUsage*0.65*0.8)) * 100) / 100,
|
||||
},
|
||||
{
|
||||
msrDt: '최대',
|
||||
realSewageInput: Math.round(maxWaterUsage*1) /1,
|
||||
sewageOccur: Math.round(maxWaterUsage*0.65*0.9 * 1) / 1,
|
||||
underWaterInput: Math.round((maxWaterUsage-(maxWaterUsage*0.65*0.9)) * 1) / 1,
|
||||
sewageOccur: Math.round(maxWaterUsage*0.65*OSU_PERCENT * 1) / 1,
|
||||
underWaterInput: Math.round((maxWaterUsage-(maxWaterUsage*0.65*OSU_PERCENT)) * 1) / 1,
|
||||
},
|
||||
{
|
||||
msrDt: '최소',
|
||||
realSewageInput: Math.round(minWaterUsage*1) /1,
|
||||
sewageOccur: Math.round(minWaterUsage*0.65*0.9 * 1) / 1,
|
||||
underWaterInput: Math.round((minWaterUsage-(minWaterUsage*0.65*0.9)) * 1) / 1,
|
||||
sewageOccur: Math.round(minWaterUsage*0.65*OSU_PERCENT * 1) / 1,
|
||||
underWaterInput: Math.round((minWaterUsage-(minWaterUsage*0.65*OSU_PERCENT)) * 1) / 1,
|
||||
},
|
||||
...tableData
|
||||
]
|
||||
|
||||
@@ -14,6 +14,8 @@ export type UnderWaterProps = {
|
||||
rvbsn : string,
|
||||
lgbsn : string,
|
||||
mdmbsn : string,
|
||||
inflAmnt : number | '',
|
||||
properYn : string | '',
|
||||
}
|
||||
export interface UnderWaterInterface {
|
||||
bscFctCd : string,
|
||||
@@ -30,6 +32,8 @@ export interface UnderWaterInterface {
|
||||
rvbsn : string,
|
||||
lgbsn : string,
|
||||
mdmbsn : string,
|
||||
inflAmnt : number | '',
|
||||
properYn : string | '',
|
||||
}
|
||||
|
||||
// 모달
|
||||
@@ -51,8 +55,10 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설명: string,
|
||||
주소: string,
|
||||
시설용량: number,
|
||||
연간지하수유입량: number | '',
|
||||
하절기지하수유입량: number | '',
|
||||
동절기지하수유입량: number | '',
|
||||
"시설용량(m³/일)": number,
|
||||
"평균유입하수량(m³/일)": number | '',
|
||||
"연간지하수유입량(m³/일)": number | '',
|
||||
"하절기지하수유입량(m³/일)": number | '',
|
||||
"동절기지하수유입량(m³/일)": number | '',
|
||||
적정여부: string | '',
|
||||
}
|
||||
+43
-6
@@ -6,7 +6,7 @@ const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
||||
const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
|
||||
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
|
||||
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
|
||||
|
||||
const serverApiUrl = SERVER_API_CS_URL;
|
||||
export function middleware(req: NextRequest) {
|
||||
console.log("Middleware 진입:", req.nextUrl.pathname);
|
||||
const pathname = req.nextUrl.pathname;
|
||||
@@ -14,7 +14,7 @@ export function middleware(req: NextRequest) {
|
||||
|
||||
if (pathname.startsWith("/server")) {
|
||||
const queryParams = searchParams.toString();
|
||||
const newUrl = `${SERVER_API_CS_URL}${pathname.replace("/server", "")}${
|
||||
const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${
|
||||
queryParams ? `?${queryParams}` : ""
|
||||
}`;
|
||||
console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`);
|
||||
@@ -76,13 +76,47 @@ export function middleware(req: NextRequest) {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const token = req.cookies.get(CLAIM_NAME)?.value;
|
||||
const userId = req.cookies.get(AUTH_USER_ID)?.value;
|
||||
const newUrl = `${SERVER_API_CS_URL}${pathname}`;
|
||||
const newUrl = `${serverApiUrl}${pathname}`;
|
||||
|
||||
if (token) requestHeaders.set(CLAIM_NAME, token);
|
||||
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
|
||||
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/attach-service' path to: ${newUrl}`,
|
||||
`[Middleware] Rewriting from '/attach-service' path to: ${newUrl}`
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/operation-service")) {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const token = req.cookies.get(CLAIM_NAME)?.value;
|
||||
const userId = req.cookies.get(AUTH_USER_ID)?.value;
|
||||
const newUrl = `${serverApiUrl}${pathname}`;
|
||||
|
||||
if (token) requestHeaders.set(CLAIM_NAME, token);
|
||||
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
|
||||
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/operation-service' path to: ${newUrl}`
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/reuse-service")) {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const token = req.cookies.get(CLAIM_NAME)?.value;
|
||||
const userId = req.cookies.get(AUTH_USER_ID)?.value;
|
||||
const newUrl = `${serverApiUrl}${pathname}`;
|
||||
|
||||
if (token) requestHeaders.set(CLAIM_NAME, token);
|
||||
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
|
||||
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/reuse-service' path to: ${newUrl}`
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
@@ -94,12 +128,13 @@ export function middleware(req: NextRequest) {
|
||||
const newUrl = `${SERVER_API_CS_URL}${pathname}`;
|
||||
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/user-service' path to: ${newUrl}`,
|
||||
`[Middleware] Rewriting from '/user-service' path to: ${newUrl}`
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
}
|
||||
|
||||
if (pathname === "/") {
|
||||
return NextResponse.redirect(new URL("/pages/dashboard", req.url));
|
||||
}
|
||||
@@ -108,11 +143,13 @@ export function middleware(req: NextRequest) {
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/",
|
||||
"/server/:path*",
|
||||
"/geoserver/:path*",
|
||||
"/attach-service/:path*",
|
||||
"/user-service/:path*",
|
||||
"/cms-service/:path*",
|
||||
"/"
|
||||
"/operation-service/:path*",
|
||||
"/reuse-service/:path*",
|
||||
],
|
||||
};
|
||||
|
||||
Binary file not shown.
@@ -8,6 +8,6 @@ NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com
|
||||
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api
|
||||
NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083
|
||||
+6
-6
@@ -5,12 +5,12 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
NEXT_PUBLIC_PORT = 3002
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3002
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com
|
||||
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/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.222:8883/sewerage-service/api
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083
|
||||
NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.222:8883
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883
|
||||
@@ -5,9 +5,9 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = https://sn.hasuon.or.kr
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
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_DC_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
||||
NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = https://apigateway.hasuon.or.kr/sewerage-service/api
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
||||
NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
|
||||
|
||||
@@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'
|
||||
import InputSection from '../InputSection';
|
||||
import { handleInputChange } from '../common';
|
||||
import { getData } from "@/components/lib/api";
|
||||
import useStore from '../../../../store/useStore';
|
||||
import useStore from '@/store/useStore';
|
||||
|
||||
// 하수관로
|
||||
const inputColumn = [
|
||||
|
||||
@@ -5,7 +5,7 @@ import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
|
||||
// 상류관로 보기 함수 (FeatureClickEventPopup에서 사용)
|
||||
export async function searchUpperPpls(gisMap: any, fcltMngNo: any) {
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
|
||||
const BASE_URL = "/sewerage-service/api";
|
||||
const res = await fetch(`${BASE_URL}/v1/fcltmhl/upperPpls/${fcltMngNo}`, {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
@@ -8,37 +8,15 @@ import SearchModal from "./searchModal/searchModal";
|
||||
import FeatureClickEventPopup from "./components/popupComponent/featureClickEventPopup";
|
||||
import { WaterDepth, WATER_DEPTH_LAYER_TYPES } from "./waterDepth/waterDepth";
|
||||
import { ProcSearchBar } from "@common/business_components/ui/map/searchBar";
|
||||
import useSearchModalStore from "@/store/useSearchModalStore";
|
||||
|
||||
// 타입 정의 추가
|
||||
export type LyrStngProps = {
|
||||
lyr_sn: string;
|
||||
lyr_nm: string;
|
||||
upper_lyr_sn: string;
|
||||
drawOrdr: string;
|
||||
flterSql: string;
|
||||
gobjTy: string;
|
||||
lyrTpNm: string;
|
||||
useYn: string;
|
||||
minViewSize: string;
|
||||
iconNm: string;
|
||||
lblAtrbNm: string;
|
||||
fontNm: string;
|
||||
fontIntnColor: string;
|
||||
fontExtnColor: string;
|
||||
fontExtnWdth: string;
|
||||
lnWdth: string;
|
||||
lnColor: string;
|
||||
polgnColor: string;
|
||||
initEprssYn: string;
|
||||
clickPsblYn: string;
|
||||
};
|
||||
|
||||
const Map = () => {
|
||||
const { isSearchModalOpen, setIsSearchModalOpen } = useSearchModalStore();
|
||||
|
||||
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
|
||||
const [selectedFeature, setSelectedFeature] = useState(null); // 선택된 피처 상태
|
||||
const gisMaps = useRef<any | null>(null);
|
||||
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
|
||||
const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); // SearchModal 열림 상태
|
||||
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
|
||||
const [showWaterDepth, setShowWaterDepth] = useState(false); // WaterDepth 표시 여부
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
@@ -148,12 +126,12 @@ const Map = () => {
|
||||
searchView={SearchModal}
|
||||
detailView={FeatureClickEventPopup}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
isOpen={isOpen}
|
||||
setIsOpen={setIsOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
onCheckedLayersChange={handleCheckedLayersChange}
|
||||
searchBar={<ProcSearchBar gisMaps={gisMaps} facilityTypes={facilityTypes} />}
|
||||
waterDepth={showWaterDepth ? WaterDepth : undefined}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import React from 'react';
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { SelectBox } from '@common/business_components/ui';
|
||||
import { Button, Label } from '@common/components';
|
||||
import { Label } from '@common/components';
|
||||
import SwagePpl from './swagePpl';
|
||||
import SwagePrcsFclt from './swagePrcsFclt';
|
||||
import SwagePrcsZone from './swagePrcsZone';
|
||||
import SwageMhl from './swageMhl';
|
||||
import SwagePmstn from './swagePmstn';
|
||||
import Stofcbr from './stofcbr';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import useSearchModalStore from '@/store/useSearchModalStore';
|
||||
|
||||
|
||||
// 기본정보 '구분' 선택 목록
|
||||
@@ -22,7 +20,7 @@ export const BASIC_TYPES = [
|
||||
{ val: "tb_ms_stofcbr", text: "우수토실" },
|
||||
];
|
||||
|
||||
const BasicTab: React.FC<SearchModalProps> = (props) => {
|
||||
const BasicTab: React.FC = () => {
|
||||
const { basicType, setBasicType } = useSearchModalStore();
|
||||
|
||||
return (
|
||||
@@ -45,12 +43,12 @@ const BasicTab: React.FC<SearchModalProps> = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
{/* 조회 조건 */}
|
||||
{basicType === "tb_ms_swage_ppl" && (<SwagePpl {...props} />)} {/* 하수관로 */}
|
||||
{basicType === "tb_il_swage_prcs_fclt" && (<SwagePrcsFclt {...props} />)} {/* 하수처리시설 */}
|
||||
{basicType === "tb_ms_swage_prcs_zone" && (<SwagePrcsZone {...props} />)} {/* 하수처리구역 */}
|
||||
{basicType === "tb_ms_swage_mhl" && (<SwageMhl {...props} />)} {/* 하수맨홀 */}
|
||||
{basicType === "tb_ms_swage_pmstn" && (<SwagePmstn {...props} />)} {/* 하수펌프장 */}
|
||||
{basicType === "tb_ms_stofcbr" && (<Stofcbr {...props} />)} {/* 우수토실 */}
|
||||
{basicType === "tb_ms_swage_ppl" && (<SwagePpl />)} {/* 하수관로 */}
|
||||
{basicType === "tb_il_swage_prcs_fclt" && (<SwagePrcsFclt />)} {/* 하수처리시설 */}
|
||||
{basicType === "tb_ms_swage_prcs_zone" && (<SwagePrcsZone />)} {/* 하수처리구역 */}
|
||||
{basicType === "tb_ms_swage_mhl" && (<SwageMhl />)} {/* 하수맨홀 */}
|
||||
{basicType === "tb_ms_swage_pmstn" && (<SwagePmstn />)} {/* 하수펌프장 */}
|
||||
{basicType === "tb_ms_stofcbr" && (<Stofcbr />)} {/* 우수토실 */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2,81 +2,21 @@ import React from 'react';
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { SelectBox } from '@common/business_components/ui';
|
||||
import { Button, Input, Label } from '@common/components';
|
||||
import useStore from '../../../store/useStore';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
|
||||
// 운영정보 '구분' 선택 목록
|
||||
export const WORK_TYPES = [
|
||||
{ val: "['200', '201', '204']", text: "보수 및 갱신" },
|
||||
{ val: "['100']", text: "점검 및 진단" },
|
||||
{ val: "['203']", text: "청소 및 준설" },
|
||||
];
|
||||
// 운영정보 - 사업 현황
|
||||
export const operationTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "bizInfoNm", title: "사업명" },
|
||||
{ id: "flfmtBgngYmd", title: "수행시작일자" },
|
||||
{ id: "flfmtEndYmd", title: "수행종료일자" },
|
||||
{ id: "flfmtYr", title: "수행년도" },
|
||||
{ id: "bizTypeCd", title: "사업유형" },
|
||||
{ id: "bizAmt", title: "사업금액" },
|
||||
];
|
||||
// 운영정보 - 보수 및 갱신 결과표
|
||||
export const operationMaintenanceTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "swtrmt_zone_nm", title: "처리구역" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
// { id: "lgalDrblyr", title: "내용연수" },
|
||||
// { id: "acqsPrmpc", title: "취득금액" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
{ id: "pdmtVl", title: "관경(mm)" },
|
||||
{ id: "prlgVl", title: "연장(m)" },
|
||||
{ id: "instlYmd", title: "설치일자" },
|
||||
// { id: "instlYmd", title: "사업구분" },
|
||||
];
|
||||
// 운영정보 - 청소 및 준설 결과표
|
||||
export const operationCleaningTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "swtrmt_zone_nm", title: "처리구역" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
// { id: "lgalDrblyr", title: "내용연수" },
|
||||
// { id: "acqsPrmpc", title: "취득금액" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
{ id: "pdmtVl", title: "관경(mm)" },
|
||||
{ id: "prlgVl", title: "연장(m)" },
|
||||
{ id: "instlYmd", title: "설치일자" },
|
||||
];
|
||||
// 운영정보 - 점검 및 진단 결과표
|
||||
export const operationInspectionTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "swtrmt_zone_nm", title: "처리구역" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
// { id: "riskEval", title: "위험평가" },
|
||||
// { id: "acqsPrmpc", title: "취득금액" },
|
||||
// { id: "lgalDrblyr", title: "내용연수" },
|
||||
// { id: "remLife", title: "잔존수명" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
{ id: "pdmtVl", title: "관경(mm)" },
|
||||
{ id: "prlgVl", title: "연장(m)" },
|
||||
{ id: "instlYmd", title: "설치일자" },
|
||||
{ id: "strc_stts_grd", title: "구조적 상태등급" },
|
||||
{ id: "oper_stts_grd", title: "운영적 상태등급" },
|
||||
];
|
||||
import useStore from '@/store/useStore';
|
||||
import useSearchModalStore from '@/store/useSearchModalStore';
|
||||
import useSearchModal from './useSearchModal';
|
||||
import useOperationTab from './useOperationTab';
|
||||
|
||||
|
||||
const OperationTab: React.FC<SearchModalProps> = (props) => {
|
||||
const OperationTab: React.FC = () => {
|
||||
const { BIZ_TY_CD } = useStore();
|
||||
const {
|
||||
workType, setWorkType,
|
||||
var1, setVar1, var2, setVar2,
|
||||
yearFilter, setYearFilter,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
|
||||
const { BIZ_TY_CD } = useStore();
|
||||
const { handleSearch } = useSearchModal();
|
||||
const { WORK_TYPES } = useOperationTab();
|
||||
|
||||
const BIZ_TY_CD_SELECT_ARRAY = BIZ_TY_CD.map(item => ({
|
||||
val: item.lwpoCd,
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
'use client'
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import LoadingOverlay from '@/components/ui/LoadingBar';
|
||||
import { getFileDownload, getDcFiles, useDcFiles } from './searchModalReportApi';
|
||||
import { type ReportDataFile } from './searchModalReportApi';
|
||||
import { useReportFileModalStore } from './searchModalReportApi'; // 모달 상태 관리 스토어
|
||||
import { UiTable } from '@common/business_components/ui';
|
||||
import { UiModal } from "@common/business_components";
|
||||
|
||||
type ModalOpenProp = {
|
||||
clsfSystmSn: string, // 자료관 기본계획 일련번호
|
||||
}
|
||||
// 하수도정비 기본계획 보고서 파일목록
|
||||
export const headlist = [
|
||||
{ id: "no", title: "NO" },
|
||||
{ id: "fileTitle", title: "파일명" },
|
||||
{ id: "regDt", title: "등록일자" },
|
||||
];
|
||||
|
||||
const ReportFiles: React.FC<ModalOpenProp> = ({ clsfSystmSn }: ModalOpenProp) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isResetPage, setIsResetPage] = useState<boolean>(false);
|
||||
const [isResetSelection, setIsResetSelection] = useState<boolean>(false);
|
||||
const { isOpen: isModalOpen, setIsOpen: setIsModalOpen } = useReportFileModalStore(); // 모달 상태 관리 스토어
|
||||
const [files, setFiles] = useState<ReportDataFile[]>([]);
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
|
||||
const filesOrigin = useDcFiles(clsfSystmSn); // 자료관 기본계획 일련번호에 해당하는 파일 목록을 가져오기 위한 훅
|
||||
useEffect(() => {
|
||||
if (isModalOpen === true) {
|
||||
getFiles(); // 파일 목록 조회
|
||||
} else {
|
||||
setFiles([]); // 모달이 닫힐 때 파일 목록 초기화
|
||||
setCurPage(1); // 페이지를 1로 초기화
|
||||
setIsResetPage(true); // 페이지를 초기화
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
}
|
||||
}, [filesOrigin, isModalOpen, curPage]);
|
||||
|
||||
// 파일 목록 조회
|
||||
const getFiles = async () => {
|
||||
setIsLoading(true); // 로딩 시작
|
||||
try {
|
||||
//let data = await getDcFiles(clsfSystmSn);
|
||||
let data = filesOrigin;
|
||||
data = data?.slice((curPage - 1) * 10, curPage * 10); // paging
|
||||
data = data?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
|
||||
setFiles(data);
|
||||
} catch (error) {
|
||||
console.error("파일 목록 조회 에러:", error);
|
||||
} finally {
|
||||
setIsLoading(false); // 로딩 종료
|
||||
}
|
||||
};
|
||||
|
||||
// cellClick 핸들러
|
||||
const handleCellClick = (index: number|undefined) => {
|
||||
if (typeof index === "number" && files[index]) {
|
||||
const fileName = files[index].fileTitle;
|
||||
const filePath = files[index].filePath;
|
||||
if (files[index].fileSn !== "") {
|
||||
getFileDownload(files[index].fileSn, fileName, filePath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const renderBody = () => (
|
||||
<>
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<UiTable
|
||||
headName={(() => {
|
||||
return (<>조회 결과 ({filesOrigin.length.toLocaleString('ko-KR')})건</>);
|
||||
})()
|
||||
}
|
||||
tableData={files}
|
||||
headlist={headlist}
|
||||
pageSize={10}
|
||||
total={filesOrigin.length}
|
||||
cellClick={handleCellClick}
|
||||
onPageChange={setCurPage}
|
||||
resetPageNo={isResetPage}
|
||||
resetSelection={isResetSelection}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<UiModal
|
||||
open={isModalOpen}
|
||||
onOpenChange={setIsModalOpen}
|
||||
headerTitle=""
|
||||
bodyClass={`
|
||||
min-h-[50vh] h-[570px]
|
||||
min-w-[35vw] w-[400px]
|
||||
max-w-none max-h-none
|
||||
overflow-visible
|
||||
z-[5000]
|
||||
flex items-start
|
||||
`}
|
||||
body={renderBody()}
|
||||
noFooterYn='Y'
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(ReportFiles);
|
||||
@@ -0,0 +1,95 @@
|
||||
'use client'
|
||||
import React, { useEffect } from 'react';
|
||||
import LoadingOverlay from '@/components/ui/LoadingBar';
|
||||
import useReportTab from './useReportTab';
|
||||
import { useReportTabStore } from '@/store/useReportTabStore';
|
||||
import { UiTable } from '@common/business_components/ui';
|
||||
import { UiModal } from "@common/business_components";
|
||||
import useSearchModalStore from '@/store/useSearchModalStore';
|
||||
|
||||
type ModalOpenProp = { clsfSystmSn: string } // 자료관 기본계획 일련번호
|
||||
const ReportFilesModal: React.FC<ModalOpenProp> = ({ clsfSystmSn }: ModalOpenProp) => {
|
||||
// 하수도정비 기본계획 보고서 파일목록
|
||||
const REPORT_FILES_HEADLIST = [
|
||||
{ id: "no", title: "NO" },
|
||||
{ id: "fileTitle", title: "파일명" },
|
||||
{ id: "regDt", title: "등록일자" },
|
||||
];
|
||||
|
||||
const {
|
||||
curPage, setCurPage,
|
||||
isLoading,
|
||||
isResetPage,
|
||||
isResetSelection,
|
||||
setIsResetPage,
|
||||
setIsResetSelection
|
||||
} = useSearchModalStore();
|
||||
const {
|
||||
isOpen: isModalOpen,
|
||||
files,
|
||||
dcFiles: filesOrigin,
|
||||
setIsOpen: setIsModalOpen,
|
||||
setFiles,
|
||||
fetchDcFiles
|
||||
} = useReportTabStore();
|
||||
const { getFiles, handleCellClick } = useReportTab();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
fetchDcFiles(clsfSystmSn);
|
||||
}, [clsfSystmSn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isModalOpen === true) {
|
||||
getFiles(); // 파일 목록 조회
|
||||
} else {
|
||||
setFiles([]); // 모달이 닫힐 때 파일 목록 초기화
|
||||
setCurPage(1); // 페이지를 1로 초기화
|
||||
setIsResetPage(true); // 페이지를 초기화
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
}
|
||||
}, [filesOrigin, isModalOpen, curPage]);
|
||||
|
||||
const renderBody = () => (
|
||||
<>
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<UiTable
|
||||
headName={(() => {
|
||||
return (<>조회 결과 ({filesOrigin.length.toLocaleString('ko-KR')})건</>);
|
||||
})()
|
||||
}
|
||||
tableData={files}
|
||||
headlist={REPORT_FILES_HEADLIST}
|
||||
pageSize={10}
|
||||
total={filesOrigin.length}
|
||||
cellClick={handleCellClick}
|
||||
onPageChange={setCurPage}
|
||||
resetPageNo={isResetPage}
|
||||
resetSelection={isResetSelection}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<UiModal
|
||||
open={isModalOpen}
|
||||
onOpenChange={setIsModalOpen}
|
||||
headerTitle=""
|
||||
bodyClass={`
|
||||
min-h-[50vh] h-[570px]
|
||||
min-w-[35vw] w-[400px]
|
||||
max-w-none max-h-none
|
||||
overflow-visible
|
||||
z-[5000]
|
||||
flex items-start
|
||||
`}
|
||||
body={renderBody()}
|
||||
noFooterYn='Y'
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(ReportFilesModal);
|
||||
@@ -4,11 +4,11 @@ import { Button, Label } from '@common/components';
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { SelectBox, UiTable } from '@common/business_components/ui';
|
||||
import LoadingOverlay from '@/components/ui/LoadingBar';
|
||||
import { addFileName, flattenFolders, getFileDownload, useDcTree, reportGubuns } from './searchModalReportApi';
|
||||
import useStore from '../../../store/useStore';
|
||||
import useReportTab from './useReportTab';
|
||||
import useStore from '@/store/useStore';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import { useReportFileModalStore } from './searchModalReportApi'; // 모달 상태 관리 스토어
|
||||
import ReportFiles from './reportFiles'; // 파일목록모달
|
||||
import { useReportTabStore } from '@/store/useReportTabStore';
|
||||
import ReportFilesModal from './reportFilesModal'; // 파일목록모달
|
||||
|
||||
|
||||
// 하수도정비 기본계획 보고서
|
||||
@@ -42,13 +42,20 @@ const ReportTab: React.FC<ReportTabProps> = ({ open, isSearch = true, ctpvNm, sg
|
||||
const [ctpvCd, setCtpvCd] = useState('0');
|
||||
const [sggCd, setSggCd] = useState('0');
|
||||
const [reportGubun, setReportGubun] = useState("0");
|
||||
// const [gubun, setGubun] = useState("");
|
||||
const { isOpen: isModalOpen, setIsOpen: setIsModalOpen } = useReportFileModalStore(); // 모달 상태 관리 스토어
|
||||
const [clsfSystmSn, setClsfSystmSn] = useState(''); // 자료관 기본계획 일련번호
|
||||
const { ctpv, sgg } = useStore();
|
||||
|
||||
// 하수정비기본계획 report
|
||||
const reportOriginData = useDcTree(""); //:Folder[]
|
||||
const { ctpv, sgg } = useStore();
|
||||
const {
|
||||
isOpen: isReportFilesModalOpen,
|
||||
setIsOpen: setIsReportFilesModalOpen,
|
||||
dcTree: reportOriginData,
|
||||
fetchDcTree
|
||||
} = useReportTabStore(); // 모달 상태 관리 스토어
|
||||
const { REPORT_TYPES, flattenFolders, addFileName } = useReportTab();
|
||||
|
||||
useEffect(() => {
|
||||
fetchDcTree(""); // 하수정비기본계획 report
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// filterParams 초기화
|
||||
@@ -105,12 +112,9 @@ const ReportTab: React.FC<ReportTabProps> = ({ open, isSearch = true, ctpvNm, sg
|
||||
const handleReportCellClick = (index: number | undefined) => {
|
||||
if (typeof index === "number" && tableData[index]) {
|
||||
const reportData = tableData[index];
|
||||
const fileName = reportData.fileName;
|
||||
const filePath = reportData.filePath;
|
||||
if (reportData.fileSn !== "") {
|
||||
//getFileDownload(reportData.fileSn, fileName, filePath);
|
||||
setIsModalOpen(true); // 모달 열기
|
||||
setClsfSystmSn(reportData.clsfSystmSn); // 자료관 기본계획 일련번호 설정
|
||||
setIsReportFilesModalOpen(true); // 모달 열기
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -133,15 +137,16 @@ const ReportTab: React.FC<ReportTabProps> = ({ open, isSearch = true, ctpvNm, sg
|
||||
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
|
||||
}
|
||||
if (reportGubun !== "0") { // 보고서구분검색
|
||||
const reportGubunOption = reportGubuns.find((n) => n.val === reportGubun);
|
||||
const reportGubunOption = REPORT_TYPES.find((n) => n.val === reportGubun);
|
||||
filterReportData = filterReportData.filter(item => item.reportGubun === reportGubunOption?.text);
|
||||
}
|
||||
|
||||
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
|
||||
const { start, end } = yearFilter;
|
||||
if (start && !end) //승인년도검색
|
||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
|
||||
if (yearFilter.start == "" && yearFilter.end != "")
|
||||
else if (!start && end)
|
||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
|
||||
if (yearFilter.start != "" && yearFilter.end != "") {
|
||||
else if (start && end) {
|
||||
filterReportData = filterReportData.filter(item => {
|
||||
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
|
||||
});
|
||||
@@ -194,7 +199,7 @@ const ReportTab: React.FC<ReportTabProps> = ({ open, isSearch = true, ctpvNm, sg
|
||||
<SelectBox className="w-44 mr-8"
|
||||
selectClass="rounded-lg bg-white"
|
||||
label=""
|
||||
selectArray={[...reportGubuns]}
|
||||
selectArray={[...REPORT_TYPES]}
|
||||
value={reportGubun} onSelectValue={val => setReportGubun(String(val))}
|
||||
selectContentClass="z-[101]" labelClass='whitespace-nowrap text-xl text-gray-600 pr-2'
|
||||
/>
|
||||
@@ -233,7 +238,7 @@ const ReportTab: React.FC<ReportTabProps> = ({ open, isSearch = true, ctpvNm, sg
|
||||
</div>
|
||||
</div>
|
||||
{/* 모달 컴포넌트 */}
|
||||
{isModalOpen && <ReportFiles clsfSystmSn={clsfSystmSn} />}
|
||||
{isReportFilesModalOpen && <ReportFilesModal clsfSystmSn={clsfSystmSn} />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,45 +1,52 @@
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import LoadingOverlay from '@/components/ui/LoadingBar';
|
||||
import { UiModal, UITab, UiTable } from '@common/business_components/ui';
|
||||
import { Button } from '@common/components/ui';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2,
|
||||
MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES,
|
||||
} from '../components/common/table';
|
||||
import { getData } from "@/components/lib/api";
|
||||
import BasicTab, { BASIC_TYPES } from './basicTab';
|
||||
import OperationTab, { operationCleaningTableHeadlist, operationInspectionTableHeadlist, operationMaintenanceTableHeadlist, operationTableHeadlist, WORK_TYPES } from './operationTab';
|
||||
import ReportTab from './reportTab';
|
||||
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { useSearchModal, OPERATION_TABLE_SIZE, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import useSearchModalStore from '@/store/useSearchModalStore';
|
||||
import { ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2 } from '../components/common/table';
|
||||
import BasicTab, { BASIC_TYPES } from './basicTab';
|
||||
import OperationTab from './operationTab';
|
||||
import ReportTab from './reportTab';
|
||||
import useSearchModal from './useSearchModal';
|
||||
import useBasicTab from './useBasicTab';
|
||||
import useOperationTab from './useOperationTab';
|
||||
|
||||
const SearchModal: React.FC<SearchModalProps> = (props) => {
|
||||
const {
|
||||
open, onOpenChange,
|
||||
TABS,
|
||||
handleSearch,
|
||||
handleBasicCellClick,
|
||||
handleOperationCellClick,
|
||||
handleOperationResultCellClick,
|
||||
basicExcelDownload,
|
||||
operationExcelDownload,
|
||||
operationResultExcelDownload,
|
||||
viewMultipleFeature,
|
||||
} = useSearchModal(props);
|
||||
const SearchModal: React.FC = () => {
|
||||
const {
|
||||
showTable,
|
||||
isSearchModalOpen, setIsSearchModalOpen,
|
||||
activeTab, basicType, workType,
|
||||
tableData, detailTableData,
|
||||
tableData, detailTableData,
|
||||
tableCount, detailTableCount,
|
||||
curPage, detailCurPage,
|
||||
detailBizId,
|
||||
isLoading, isDetailLoading,
|
||||
isResetPage, isResetDetailPage,
|
||||
isResetSelection, isResetDetailSelection,
|
||||
setActiveTab,
|
||||
setCurPage, setDetailCurPage,
|
||||
setIsResetPage, setIsResetDetailPage,
|
||||
setDetailBizId,
|
||||
setIsResetDetailSelection,
|
||||
resetFilters
|
||||
} = useSearchModalStore();
|
||||
const { TABS, viewMultipleFeature, fetchFilteredData } = useSearchModal();
|
||||
const { handleBasicCellClick, basicExcelDownload } = useBasicTab();
|
||||
const {
|
||||
WORK_TYPES,
|
||||
OPERATION_TABLE_SIZE,
|
||||
OPERATION_TABLE_HEADLIST,
|
||||
MAINTENANACE_TABLE_HEADLIST,
|
||||
CLEANING_TABLE_HEADLIST,
|
||||
INSPECTION_TABLE_HEADLIST,
|
||||
handleOperationCellClick,
|
||||
handleOperationResultCellClick,
|
||||
operationExcelDownload,
|
||||
operationResultExcelDownload,
|
||||
handleOperationPageNation
|
||||
} = useOperationTab();
|
||||
|
||||
|
||||
const dynamicHeadlist: { id: string, title: string }[] = useMemo(() => {
|
||||
if (activeTab === 'basic') { // 기본정보
|
||||
@@ -52,21 +59,39 @@ const SearchModal: React.FC<SearchModalProps> = (props) => {
|
||||
|
||||
return [];
|
||||
}
|
||||
if (activeTab === 'operation') return operationTableHeadlist; // 운영정보
|
||||
if (activeTab === 'operation') return OPERATION_TABLE_HEADLIST; // 운영정보
|
||||
|
||||
return [];
|
||||
}, [activeTab, basicType, workType]);
|
||||
|
||||
const dynamicHeadlist2: { id: string, title: string }[] = useMemo(() => {
|
||||
if (activeTab === 'operation') {
|
||||
if (workType === WORK_TYPES[0]?.val) return operationMaintenanceTableHeadlist; // 보수 및 갱신
|
||||
if (workType === WORK_TYPES[1]?.val) return operationInspectionTableHeadlist; // 점검 및 진단
|
||||
if (workType === WORK_TYPES[2]?.val) return operationCleaningTableHeadlist; // 청소 및 준설
|
||||
if (workType === WORK_TYPES[0]?.val) return MAINTENANACE_TABLE_HEADLIST; // 보수 및 갱신
|
||||
if (workType === WORK_TYPES[1]?.val) return CLEANING_TABLE_HEADLIST; // 점검 및 진단
|
||||
if (workType === WORK_TYPES[2]?.val) return INSPECTION_TABLE_HEADLIST; // 청소 및 준설
|
||||
}
|
||||
|
||||
return [];
|
||||
}, [activeTab, workType]);
|
||||
|
||||
useEffect(() => {
|
||||
resetFilters();
|
||||
}, [activeTab, basicType, workType]);
|
||||
|
||||
// 페이지 변경 시마다 데이터 fetch
|
||||
useEffect(() => {
|
||||
setIsResetPage(false);
|
||||
setIsResetDetailPage(true);
|
||||
setDetailBizId(0);
|
||||
if (showTable) fetchFilteredData();
|
||||
}, [curPage]);
|
||||
|
||||
// 페이지 변경 시마다 데이터 fetch
|
||||
useEffect(() => {
|
||||
setIsResetDetailSelection(false);
|
||||
if (showTable) handleOperationPageNation(Number(detailBizId));
|
||||
}, [detailCurPage]);
|
||||
|
||||
|
||||
const renderBody = () => (
|
||||
<>
|
||||
@@ -79,20 +104,9 @@ const SearchModal: React.FC<SearchModalProps> = (props) => {
|
||||
}))}
|
||||
onValueChange={(value: string) => setActiveTab(value)}
|
||||
/>
|
||||
{/* 기본정보 탭 */}
|
||||
{activeTab === 'basic' && (
|
||||
<BasicTab {...props} />
|
||||
)}
|
||||
{/* 운영정보 탭 */}
|
||||
{activeTab === 'operation' && (
|
||||
<OperationTab {...props} />
|
||||
)}
|
||||
{/* 하수도정비기본계획보고서 탭 */}
|
||||
{activeTab === 'report' && (
|
||||
<ReportTab
|
||||
open={open}
|
||||
/>
|
||||
)}
|
||||
{activeTab === 'basic' && (<BasicTab />)} {/* 기본정보 탭 */}
|
||||
{activeTab === 'operation' && (<OperationTab />)} {/* 운영정보 탭 */}
|
||||
{activeTab === 'report' && (<ReportTab open={isSearchModalOpen} />)} {/* 하수도정비기본계획보고서 탭 */}
|
||||
|
||||
|
||||
{/* 📋 결과 리스트 */}
|
||||
@@ -192,8 +206,8 @@ const SearchModal: React.FC<SearchModalProps> = (props) => {
|
||||
return (
|
||||
<>
|
||||
<UiModal
|
||||
open={open}
|
||||
onOpenChange={onOpenChange}
|
||||
open={isSearchModalOpen}
|
||||
onOpenChange={setIsSearchModalOpen}
|
||||
bodyClass={`
|
||||
h-[100dvh]
|
||||
w-[60dvw]
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { getDcData } from '@/components/lib/api';
|
||||
import { create } from 'zustand';
|
||||
|
||||
export type Folder = {
|
||||
clsfSystmSn: string;
|
||||
upClsfSystmSn: string;
|
||||
clsfSystmNm: string;
|
||||
children: Folder[];
|
||||
};
|
||||
export type FlattenedFolder = {
|
||||
[key: string]: string | number | undefined;
|
||||
};
|
||||
export type SelectDataType = {
|
||||
text: string;
|
||||
val: string;
|
||||
sido?: string; // 시도 코드 (선택 사항)
|
||||
}
|
||||
export type ReportDataFile = {
|
||||
no: number;
|
||||
fileTitle: string;
|
||||
regDt: string;
|
||||
fileSn: string;
|
||||
filePath: string;
|
||||
}
|
||||
|
||||
const isYear = (value: string): boolean => {
|
||||
return /^[0-9]{4}년$/.test(value);
|
||||
};
|
||||
export const reportGubuns = [{ val: '0', text: '전체' }, { val: '1', text: '보고서' }
|
||||
, { val: '2', text: '요약보고서' }, { val: '3', text: '부록' }, { val: '4', text: '기타' }];
|
||||
|
||||
|
||||
/**
|
||||
* Flatten a hierarchical folder structure into a flat array.
|
||||
* @param data - The hierarchical folder data to flatten.
|
||||
* @returns An array of flattened folders with their paths and levels.
|
||||
*/
|
||||
export function flattenFolders(data: Folder[]): FlattenedFolder[] {
|
||||
const result: FlattenedFolder[] = [];
|
||||
const exceptNodeNm = ["부분", "통합", "전체"];
|
||||
const addNodeNm = ["보고서", "요약보고서", "부록", "기타"]; // level5
|
||||
const columnNms: { [key: number]: string } = {
|
||||
0: "root", 1: "sido", 2: "sigungu", 3: "approvalYear"
|
||||
, 4: "plantZoneGubun", 5: "reportGubun", 7: "fileName", 8: "regDate"
|
||||
};
|
||||
|
||||
function traverse(
|
||||
node: Folder,
|
||||
path: { [key: string]: string | number },
|
||||
level: number
|
||||
) {
|
||||
if (level === 2 && isYear(node.clsfSystmNm)) {
|
||||
level++;
|
||||
}
|
||||
if (level === 4 && addNodeNm.includes(node.clsfSystmNm)) {
|
||||
level++; // 레벨을 증가시켜 하위값에 추가되도록 함.
|
||||
}
|
||||
|
||||
const newPath = {
|
||||
...path,
|
||||
[`${columnNms[level]}`]: node.clsfSystmNm,
|
||||
};
|
||||
|
||||
if (node.children.length === 0) {
|
||||
newPath.no = result.length + 1;
|
||||
newPath.clsfSystmSn = node.clsfSystmSn; // 파일 조회를 위한 고유번호
|
||||
result.push(newPath);
|
||||
} else {
|
||||
if (level === 4) {
|
||||
if (exceptNodeNm.includes(node.clsfSystmNm)) {
|
||||
level--; // 제외할 노드 이름인 경우, 현재의 레벨에 하위값이 써지도록 함.
|
||||
}
|
||||
}
|
||||
node.children.forEach((child) => {
|
||||
traverse(child, newPath, level + 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (data && data.length > 0 && data[0]?.clsfSystmNm == "기본계획") { // data가 비어있지 않고 children이 있는 경우에만 처리
|
||||
data.forEach((root) => traverse(root, {}, 0));
|
||||
} else {
|
||||
data.forEach((root) => traverse(root, {}, 1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export const getDcTree = async (clsfSystmNm: string) => {
|
||||
const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm);
|
||||
return result;
|
||||
};
|
||||
export const useDcTree = (clsfSystmNm: string) => {
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetch = async () => {
|
||||
const result = await getDcTree(clsfSystmNm);
|
||||
if (result) {
|
||||
setData(result);
|
||||
}
|
||||
console.log("useDcTree호출");
|
||||
console.log("clsfSystmNm:", clsfSystmNm, "data:", result);
|
||||
};
|
||||
fetch();
|
||||
}, [clsfSystmNm]);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getDcFiles = async (clsfSystmSn: string) : Promise<ReportDataFile[]> => {
|
||||
if (!clsfSystmSn) {
|
||||
console.error("clsfSystmSn is required to get files.");
|
||||
return [];
|
||||
}
|
||||
const queryString = 'clsfSystmSn=' + clsfSystmSn;
|
||||
const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`);
|
||||
return result;
|
||||
};
|
||||
|
||||
export const useDcFiles = (clsfSystmNm: string) => {
|
||||
const [data, setData] = useState<ReportDataFile[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetch = async () => {
|
||||
const result = await getDcFiles(clsfSystmNm);
|
||||
if (result) {
|
||||
setData(result);
|
||||
}
|
||||
console.log("useDcFiles 호출");
|
||||
console.log("clsfSystmNm:", clsfSystmNm, "data:", result);
|
||||
};
|
||||
fetch();
|
||||
}, [clsfSystmNm]);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// 파일 이름 추가
|
||||
export const addFileName = async (data: FlattenedFolder[]) => {
|
||||
const fileReportData = await Promise.all(
|
||||
data.map(async (item) => {
|
||||
const fileArr: ReportDataFile[] = await getDcFiles(String(item.clsfSystmSn));
|
||||
let result:FlattenedFolder;
|
||||
if (fileArr.length > 0) {
|
||||
const f = fileArr[0];
|
||||
const fCount = fileArr.length;
|
||||
result = { ...item, fileName: f?.fileTitle+" 외 "+fCount+"건", regDate: f?.regDt, fileSn: f?.fileSn, filePath: f?.filePath };
|
||||
} else {
|
||||
result = { ...item, fileName: "", regDate: "", fileSn: "", filePath: "" };
|
||||
}
|
||||
return result;
|
||||
})
|
||||
);
|
||||
return fileReportData;
|
||||
};
|
||||
|
||||
export const getDcFileprcs = async (fileSn: string) => {
|
||||
const queryString = 'fileSn=' + fileSn;
|
||||
const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`);
|
||||
return result;
|
||||
};
|
||||
|
||||
export const getDcFileDownload = async (filePath: string) => {
|
||||
const queryString = 'filePath=' + encodeURIComponent(filePath);
|
||||
const response = await fetch(`/dc-service/api/v1/dc/file/download?${queryString}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`File download failed: ${response.status}`);
|
||||
}
|
||||
const blob = await response.blob(); // PDF, image 등은 blob으로 받아야 함
|
||||
return blob;
|
||||
};
|
||||
export const fileDownload = (data: Blob, fileName: string) => { // Blob데이터 임시link로 연결
|
||||
const url = window.URL.createObjectURL(data);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName; // 원하는 파일명 지정
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
export const getFileDownload = async (fileSn: string, fileName: string, filePath: string) => {
|
||||
if (filePath === "") alert("filePath 정보 없으므로 다운로드 불가:filesn" + fileSn);
|
||||
const blobData = await getDcFileDownload(filePath); // 실제 다운로드 API
|
||||
fileDownload(blobData, fileName);
|
||||
}
|
||||
|
||||
interface ModalStore {
|
||||
isOpen: boolean;
|
||||
setIsOpen: (open: boolean) => void;
|
||||
}
|
||||
export const useReportFileModalStore = create<ModalStore>((set) => ({
|
||||
isOpen: false,
|
||||
setIsOpen: (open: boolean) => set({ isOpen: open }),
|
||||
}));
|
||||
@@ -1,28 +1,19 @@
|
||||
// 우수토실
|
||||
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { Button } from '@common/components';
|
||||
import React from 'react';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModal from './useSearchModal';
|
||||
|
||||
interface stofcbrCqlFiltersParams {
|
||||
ctpvCd: string;
|
||||
sggCd: string;
|
||||
yearFilter: { start: string; end: string };
|
||||
todayYear: string;
|
||||
todayMonth: string;
|
||||
todayDate: string;
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
}
|
||||
export const stofcbrCqlFilters = (params: stofcbrCqlFiltersParams) => {
|
||||
|
||||
export const stofcbrCqlFilters = () => {
|
||||
const {
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
} = params;
|
||||
} = useSearchModalStore.getState();
|
||||
|
||||
const cqlFilters: string[] = [];
|
||||
// 시도, 시군구
|
||||
@@ -48,13 +39,13 @@ export const stofcbrCqlFilters = (params: stofcbrCqlFiltersParams) => {
|
||||
return cqlFilters;
|
||||
};
|
||||
|
||||
const Stofcbr: React.FC<SearchModalProps> = (props) => {
|
||||
const Stofcbr: React.FC = () => {
|
||||
const {
|
||||
ctpvCd, setCtpvCd,
|
||||
sggCd, setSggCd,
|
||||
yearFilter, setYearFilter,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
const { handleSearch } = useSearchModal();
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// 하수맨홀
|
||||
|
||||
import React from 'react';
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { Button, Input, Label } from '@common/components';
|
||||
@@ -7,21 +6,10 @@ import { MS_SWAGE_MHL_USE_CODES } from '../components/common/table';
|
||||
import { SelectBox } from '@common/business_components/ui';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModal from './useSearchModal';
|
||||
|
||||
interface swageMhlCqlFiltersParams {
|
||||
ctpvCd: string;
|
||||
sggCd: string;
|
||||
yearFilter: { start: string; end: string };
|
||||
start1: string;
|
||||
end1: string;
|
||||
var1: string;
|
||||
todayYear: string;
|
||||
todayMonth: string;
|
||||
todayDate: string;
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
}
|
||||
export const swageMhlCqlFilters = (params: swageMhlCqlFiltersParams) => {
|
||||
|
||||
export const swageMhlCqlFilters = () => {
|
||||
const {
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
@@ -29,7 +17,7 @@ export const swageMhlCqlFilters = (params: swageMhlCqlFiltersParams) => {
|
||||
var1,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
} = params;
|
||||
} = useSearchModalStore.getState();
|
||||
|
||||
const cqlFilters: string[] = [];
|
||||
// 시도, 시군구
|
||||
@@ -60,7 +48,7 @@ export const swageMhlCqlFilters = (params: swageMhlCqlFiltersParams) => {
|
||||
return cqlFilters;
|
||||
};
|
||||
|
||||
const SwageMhl: React.FC<SearchModalProps> = (props) => {
|
||||
const SwageMhl: React.FC = () => {
|
||||
const {
|
||||
var1, setVar1,
|
||||
start1, setStart1, end1, setEnd1,
|
||||
@@ -68,7 +56,7 @@ const SwageMhl: React.FC<SearchModalProps> = (props) => {
|
||||
sggCd, setSggCd,
|
||||
yearFilter, setYearFilter,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
const { handleSearch } = useSearchModal();
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
|
||||
@@ -1,33 +1,20 @@
|
||||
// 하수펌프장
|
||||
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { Button, Input, Label } from '@common/components';
|
||||
import React from 'react';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModal from './useSearchModal';
|
||||
|
||||
interface swagePmstnCqlFiltersParams {
|
||||
ctpvCd: string;
|
||||
sggCd: string;
|
||||
yearFilter: { start: string; end: string };
|
||||
start1: string;
|
||||
start2: string;
|
||||
end1: string;
|
||||
end2: string;
|
||||
todayYear: string;
|
||||
todayMonth: string;
|
||||
todayDate: string;
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
}
|
||||
export const swagePmstnCqlFilters = (params: swagePmstnCqlFiltersParams) => {
|
||||
|
||||
export const swagePmstnCqlFilters = () => {
|
||||
const {
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, start2, end1, end2,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
} = params;
|
||||
} = useSearchModalStore.getState();
|
||||
|
||||
const cqlFilters: string[] = [];
|
||||
// 시도, 시군구
|
||||
@@ -63,7 +50,7 @@ export const swagePmstnCqlFilters = (params: swagePmstnCqlFiltersParams) => {
|
||||
return cqlFilters;
|
||||
};
|
||||
|
||||
const SwagePmstn: React.FC<SearchModalProps> = (props) => {
|
||||
const SwagePmstn: React.FC = () => {
|
||||
const {
|
||||
start1, setStart1,
|
||||
end1, setEnd1,
|
||||
@@ -71,7 +58,7 @@ const SwagePmstn: React.FC<SearchModalProps> = (props) => {
|
||||
sggCd, setSggCd,
|
||||
yearFilter, setYearFilter,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
const { handleSearch } = useSearchModal();
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
|
||||
@@ -1,32 +1,16 @@
|
||||
// 하수관로
|
||||
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { SelectBox } from '@common/business_components/ui';
|
||||
import { Button, Input, Label } from '@common/components';
|
||||
import React from 'react';
|
||||
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES } from '../components/common/table';
|
||||
import { MS_SWAGE_PPL_USE_CODES } from '../components/common/table';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModal from './useSearchModal';
|
||||
|
||||
|
||||
interface swagePplCqlFiltersParams {
|
||||
var1: string;
|
||||
var2: string;
|
||||
ctpvCd: string;
|
||||
sggCd: string;
|
||||
yearFilter: { start: string; end: string };
|
||||
start1: string;
|
||||
start2: string;
|
||||
end1: string;
|
||||
end2: string;
|
||||
todayYear: string;
|
||||
todayMonth: string;
|
||||
todayDate: string;
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
}
|
||||
// 하수관로용 CQL 필터 생성
|
||||
export const swagePplCqlFilters = (params: swagePplCqlFiltersParams) => {
|
||||
export const swagePplCqlFilters = () => {
|
||||
const {
|
||||
var1, var2,
|
||||
ctpvCd, sggCd,
|
||||
@@ -34,7 +18,7 @@ export const swagePplCqlFilters = (params: swagePplCqlFiltersParams) => {
|
||||
start1, start2, end1, end2,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
} = params;
|
||||
} = useSearchModalStore.getState();
|
||||
|
||||
const cqlFilters: string[] = [];
|
||||
if (var1) cqlFilters.push(`usg_cd='${var1}'`);
|
||||
@@ -69,14 +53,14 @@ export const swagePplCqlFilters = (params: swagePplCqlFiltersParams) => {
|
||||
return cqlFilters;
|
||||
};
|
||||
|
||||
const SwagePpl: React.FC<SearchModalProps> = (props) => {
|
||||
const SwagePpl: React.FC = () => {
|
||||
const {
|
||||
var1, setVar1,
|
||||
start1, setStart1, end1, setEnd1,
|
||||
ctpvCd, setCtpvCd, sggCd, setSggCd,
|
||||
yearFilter, setYearFilter,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
const { handleSearch } = useSearchModal();
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,33 +1,21 @@
|
||||
// 하수처리시설
|
||||
|
||||
import React from 'react';
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { Button, Input, Label } from '@common/components';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModal from './useSearchModal';
|
||||
|
||||
|
||||
interface swagePrcsFcltCqlFiltersParams {
|
||||
ctpvName: string;
|
||||
sggName: string;
|
||||
yearFilter: { start: string; end: string };
|
||||
start1: string;
|
||||
end1: string;
|
||||
todayYear: string;
|
||||
todayMonth: string;
|
||||
todayDate: string;
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
}
|
||||
// 하수처리시설용 CQL 필터 생성
|
||||
export const swagePrcsFcltCqlFilters = (params: swagePrcsFcltCqlFiltersParams) => {
|
||||
export const swagePrcsFcltCqlFilters = () => {
|
||||
const {
|
||||
ctpvName, sggName,
|
||||
yearFilter,
|
||||
start1, end1,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
} = params;
|
||||
} = useSearchModalStore.getState();
|
||||
|
||||
const cqlFilters: string[] = [];
|
||||
// 가동개시일자 범위
|
||||
@@ -65,14 +53,14 @@ export const swagePrcsFcltCqlFilters = (params: swagePrcsFcltCqlFiltersParams) =
|
||||
return cqlFilters;
|
||||
};
|
||||
|
||||
const SwagePrcsFclt: React.FC<SearchModalProps> = (props) => {
|
||||
const SwagePrcsFclt: React.FC = () => {
|
||||
const {
|
||||
start1, setStart1, end1, setEnd1,
|
||||
ctpvCd, setCtpvCd, setCtpvName,
|
||||
sggCd, setSggCd, setSggName,
|
||||
yearFilter, setYearFilter,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
const { handleSearch } = useSearchModal();
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
|
||||
@@ -4,21 +4,15 @@ import React from 'react';
|
||||
import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox';
|
||||
import { Button, Input, Label } from '@common/components';
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { useSearchModal, type SearchModalProps } from './useSearchModal';
|
||||
import useSearchModal from './useSearchModal';
|
||||
|
||||
|
||||
interface swagePrcsZoneCqlFiltersParams {
|
||||
ctpvCd: string;
|
||||
sggCd: string;
|
||||
var1: string;
|
||||
var2: string;
|
||||
}
|
||||
// 하수처리구역용 CQL 필터 생성
|
||||
export const swagePrcsZoneCqlFilters = (params: swagePrcsZoneCqlFiltersParams) => {
|
||||
export const swagePrcsZoneCqlFilters = () => {
|
||||
const {
|
||||
ctpvCd, sggCd,
|
||||
var1, var2
|
||||
} = params;
|
||||
} = useSearchModalStore.getState();
|
||||
const cqlFilters: string[] = [];
|
||||
if (ctpvCd !== '' && ctpvCd !== '0') cqlFilters.push(`ctpv_cd='${ctpvCd?.trim()}'`);
|
||||
if (sggCd !== '' && sggCd !== '0') cqlFilters.push(`sgg_cd='${sggCd}'`);
|
||||
@@ -27,13 +21,13 @@ export const swagePrcsZoneCqlFilters = (params: swagePrcsZoneCqlFiltersParams) =
|
||||
return cqlFilters;
|
||||
};
|
||||
|
||||
const swagePrcsZone: React.FC<SearchModalProps> = (props) => {
|
||||
const swagePrcsZone: React.FC = () => {
|
||||
const {
|
||||
var1, setVar1, var2, setVar2,
|
||||
ctpvCd, setCtpvCd,
|
||||
sggCd, setSggCd,
|
||||
} = useSearchModalStore();
|
||||
const { handleSearch } = useSearchModal(props);
|
||||
const { handleSearch } = useSearchModal();
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES,
|
||||
MsSwagePplExcelCol, SwtrmtFcltExcelCol, SwtrmtPrcsZoneExcelCol, MsSwageMhlExcelCol, ExclnSewagePumpExcelCol, stofcbrExcelCol
|
||||
} from '../components/common/table';
|
||||
import { getData } from "@/components/lib/api";
|
||||
import { BASIC_TYPES } from './basicTab';
|
||||
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
|
||||
import useStore from '../../../store/useStore';
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { confirmToast } from '@/components/ui/toast'
|
||||
import { toast } from "react-hot-toast";
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { swagePplCqlFilters } from './swagePpl';
|
||||
import { swagePrcsFcltCqlFilters } from './swagePrcsFclt';
|
||||
import { swagePrcsZoneCqlFilters } from './swagePrcsZone';
|
||||
import { swageMhlCqlFilters } from './swageMhl';
|
||||
import { swagePmstnCqlFilters } from './swagePmstn';
|
||||
import { stofcbrCqlFilters } from './stofcbr';
|
||||
|
||||
|
||||
export default function useBasicTab() {
|
||||
const {
|
||||
basicType,
|
||||
tableData,
|
||||
curPage,
|
||||
todayYear, todayMonth, todayDate,
|
||||
setIsSearchModalOpen,
|
||||
setTableData,
|
||||
setTableCount,
|
||||
setIsLoading,
|
||||
} = useSearchModalStore();
|
||||
const { ctpv, sgg } = useStore();
|
||||
|
||||
const fetchBasicFilteredData = async () => {
|
||||
let cqlFilters: string[] = [];
|
||||
const queryParams = new URLSearchParams({
|
||||
lyrTypeNm: basicType,
|
||||
page: `${curPage - 1}`,
|
||||
size: '10',
|
||||
sort: 'string',
|
||||
});
|
||||
|
||||
if (basicType === 'tb_ms_swage_ppl') cqlFilters = swagePplCqlFilters(); // 하수관로
|
||||
else if (basicType === 'tb_il_swage_prcs_fclt') cqlFilters = swagePrcsFcltCqlFilters(); // 하수처리시설
|
||||
else if (basicType === 'tb_ms_swage_prcs_zone') cqlFilters = swagePrcsZoneCqlFilters(); // 하수처리구역
|
||||
else if (basicType === 'tb_ms_swage_mhl') cqlFilters = swageMhlCqlFilters(); // 하수맨홀
|
||||
else if (basicType === 'tb_ms_swage_pmstn') cqlFilters = swagePmstnCqlFilters(); // 하수펌프장
|
||||
else if (basicType === 'tb_ms_stofcbr') cqlFilters = stofcbrCqlFilters(); // 우수토실
|
||||
if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and '));
|
||||
|
||||
const res = await getData(`v1/fclts?${queryParams.toString()}`);
|
||||
// const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`);
|
||||
console.log('fetch res', res);
|
||||
console.log('fetch res.data', res.data);
|
||||
console.log('fetch res.count', res.count);
|
||||
console.log('fetch res.length', res.length);
|
||||
|
||||
// 🎯 각 아이템을 개별적으로 포맷팅하면서 일련번호 추가
|
||||
const dataWithRowNumber = (res.data || []).map((item: any, index: number) => {
|
||||
// 🎯 먼저 각 아이템을 포맷팅
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
let ctpvCd = item?.ctpvNm ?? formattedItem?.ctpvNm ?? '';
|
||||
let sggCd = item?.sggNm ?? formattedItem?.sggNm ?? '';
|
||||
|
||||
if (!ctpvCd || !sggCd) {
|
||||
const code = String(item?.pbadmsEmdCd ?? formattedItem?.pbadmsEmdCd ?? '')?.trim();
|
||||
if (!ctpvCd && code) ctpvCd = code.slice(0, 2);
|
||||
if (!sggCd && code) sggCd = code.slice(0, 5);
|
||||
}
|
||||
|
||||
const matchedMhlCode = MS_SWAGE_MHL_CODES.find(code => code.val === item?.mqltCd?.trim());
|
||||
const matchedMhlUsgCode = MS_SWAGE_MHL_USE_CODES.find(code => code.val === item?.usgCd);
|
||||
const ctpvNm = ctpv.find(code => code.val.trim() === ctpvCd)?.text || item?.ctpvNm;
|
||||
const sggNm = sgg.find(code => code.val.trim() === sggCd)?.text || item?.sggNm;
|
||||
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item?.usgCd?.trim());
|
||||
|
||||
// 추가 처리 및 일련번호 추가
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * 10 + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item?.scsYn, // scsYn이 null이면 'N'으로 변경
|
||||
mqltCd: matchedMhlCode ? matchedMhlCode.text : item?.mqltCd,
|
||||
usgCd: matchedMhlUsgCode ? matchedMhlUsgCode.text : (usgCdObj ? usgCdObj.text : item?.usgCd),
|
||||
ctpvNm: ctpvNm ?? '-',
|
||||
sggNm: sggNm ?? '-',
|
||||
swtrmt_zone_nm: item.swtrmtZoneNm || item.swtrmt_zone_nm || '-',
|
||||
};
|
||||
});
|
||||
|
||||
setTableData(dataWithRowNumber);
|
||||
setTableCount(res.count || []);
|
||||
};
|
||||
|
||||
// 기본정보 테이블 cellClick 핸들러
|
||||
const handleBasicCellClick = async (index?: number | undefined, headId?: String) => {
|
||||
if (typeof index === "number") {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = tableData[index];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fid = row.fid;
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showSearchResultsFromGeoJSON(layerNm, fid);
|
||||
setIsLoading(false);
|
||||
setIsSearchModalOpen(false); // SearchModal 닫기
|
||||
}
|
||||
};
|
||||
|
||||
// 기본정보 Excel 다운로드 핸들러
|
||||
const basicExcelDownload = async () => {
|
||||
if (tableData.length === 0) {
|
||||
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.dismiss("global-confirm-toast");
|
||||
|
||||
confirmToast(
|
||||
"파일 다운로드에는 2분 내외의 시간이 소요될 수 있습니다.\n파일 다운로드를 진행하시겠습니까?",
|
||||
onDownload ?? (() => { }),
|
||||
"text-xl font-medium text-gray-800"
|
||||
);
|
||||
|
||||
async function onDownload() {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const queryParams = new URLSearchParams({
|
||||
lyrTypeNm: basicType,
|
||||
size: '10000',
|
||||
});
|
||||
|
||||
let cqlFilters: string[] = [];
|
||||
let headerMapping: { [key: string]: string } = {};
|
||||
let headerRange: string = "A1:F1";
|
||||
|
||||
switch (basicType) {
|
||||
case 'tb_ms_swage_ppl': {
|
||||
// 하수관로
|
||||
cqlFilters = swagePplCqlFilters()
|
||||
headerMapping = MsSwagePplExcelCol;
|
||||
headerRange = "A1:M1";
|
||||
break;
|
||||
}
|
||||
case 'tb_il_swage_prcs_fclt': {
|
||||
// 하수처리시설
|
||||
cqlFilters = swagePrcsFcltCqlFilters();
|
||||
headerMapping = SwtrmtFcltExcelCol;
|
||||
headerRange = "A1:J1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_swage_prcs_zone': {
|
||||
// 하수처리구역
|
||||
cqlFilters = swagePrcsZoneCqlFilters();
|
||||
headerMapping = SwtrmtPrcsZoneExcelCol;
|
||||
headerRange = "A1:D1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_swage_mhl': {
|
||||
// 하수맨홀
|
||||
cqlFilters = swageMhlCqlFilters();
|
||||
headerMapping = MsSwageMhlExcelCol;
|
||||
headerRange = "A1:J1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_swage_pmstn': {
|
||||
// 하수펌프장
|
||||
cqlFilters = swagePmstnCqlFilters();
|
||||
headerMapping = ExclnSewagePumpExcelCol;
|
||||
headerRange = "A1:J1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_stofcbr': {
|
||||
// 우수토실
|
||||
cqlFilters = stofcbrCqlFilters();
|
||||
headerMapping = stofcbrExcelCol;
|
||||
headerRange = "A1:H1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and '));
|
||||
|
||||
const res = await getData(`v1/fclts?${queryParams.toString()}`);
|
||||
|
||||
const mhlUsgCdMap = new Map(MS_SWAGE_MHL_USE_CODES.map(code => [code.val?.trim(), code.text]));
|
||||
const pplUsgCdMap = new Map(MS_SWAGE_PPL_USE_CODES.map(code => [code.val?.trim(), code.text]));
|
||||
const ctpvMap = new Map(ctpv.map(code => [code.val?.trim(), code.text]));
|
||||
const sggMap = new Map(sgg.map(code => [code.val?.trim(), code.text]));
|
||||
|
||||
const mappedContent = (res.data || []).map((item: any) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
let ctpvCd = item?.ctpvCd ?? formattedItem?.ctpvCd ?? '';
|
||||
let sggCd = item?.sggCd ?? formattedItem?.sggCd ?? '';
|
||||
|
||||
if (!ctpvCd || !sggCd) {
|
||||
const code = String(item?.pbadmsEmdCd ?? formattedItem?.pbadmsEmdCd ?? '')?.trim();
|
||||
if (!ctpvCd && code) ctpvCd = code.slice(0, 2);
|
||||
if (!sggCd && code) sggCd = code.slice(0, 5);
|
||||
}
|
||||
|
||||
// trim 한 번만 수행
|
||||
const trimmedUsgCd = item?.usgCd?.trim();
|
||||
// const trimmedMqltCd = item?.mqltCd?.trim();
|
||||
|
||||
switch (basicType) {
|
||||
case 'tb_ms_swage_ppl': {
|
||||
// 하수관로
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
instMngNo: formattedItem.instMngNo ?? item.instMngNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? item.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? item.sggNm ?? '-',
|
||||
swtrmt_zone_nm: formattedItem.swtrmt_zone_nm ?? item.swtrmt_zone_nm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
usgCd: pplUsgCdMap.get(trimmedUsgCd) || item.usgCd || formattedItem.usgCd || '-',
|
||||
pdmtVl: formattedItem.pdmtVl ?? item.pdmtVl ?? '-',
|
||||
prlgVl: formattedItem.prlgVl ?? item.prlgVl ?? '-',
|
||||
tmptDpth: formattedItem.tmptDpth ?? item.tmptDpth ?? '-',
|
||||
tmptMhlMngNo: formattedItem.tmptMhlMngNo ?? item.tmptMhlMngNo ?? '-',
|
||||
scendDpth: formattedItem.scendDpth ?? item.scendDpth ?? '-',
|
||||
scendMhlMngNo: formattedItem.scendMhlMngNo ?? item.scendMhlMngNo ?? '-',
|
||||
};
|
||||
}
|
||||
case 'tb_il_swage_prcs_fclt': {
|
||||
// 하수처리시설
|
||||
return {
|
||||
swtrmtFcltNm: formattedItem.swtrmtFcltNm ?? item.swtrmtFcltNm ?? '-',
|
||||
fcltCpct: formattedItem.fcltCpct ?? item.fcltCpct ?? '-',
|
||||
rgnExpln: formattedItem.rgnExpln ?? item.rgnExpln ?? '-',
|
||||
oprtngStrtYmd: formattedItem.oprtngStrtYmd ?? item.oprtngStrtYmd ?? '-',
|
||||
laeNm: formattedItem.laeNm ?? item.laeNm ?? '-',
|
||||
sareaNm: formattedItem.sareaNm ?? item.sareaNm ?? '-',
|
||||
rvrNm: formattedItem.rvrNm ?? item.rvrNm ?? '-',
|
||||
dschgWtstNm: formattedItem.dschgWtstNm ?? item.dschgWtstNm ?? '-',
|
||||
swtrmtPpltnCnt: formattedItem.swtrmtPpltnCnt ?? item.swtrmtPpltnCnt ?? '-',
|
||||
rprsMsrcCn: formattedItem.rprsMsrcCn ?? item.rprsMsrcCn ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_swage_prcs_zone': {
|
||||
// 하수처리구역
|
||||
return {
|
||||
swtrmtZoneNm: formattedItem.swtrmtZoneNm ?? item.swtrmtZoneNm ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
swtrmtFcltNm: formattedItem.swtrmtFcltNm ?? item.swtrmtFcltNm ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_swage_mhl': {
|
||||
// 하수맨홀
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
usgCd: mhlUsgCdMap.get(trimmedUsgCd) || item.usgCd || formattedItem.usgCd || '-',
|
||||
swageMhlDiamVl: formattedItem.swageMhlDiamVl ?? item.swageMhlDiamVl ?? '-',
|
||||
wdthLen: formattedItem.wdthLen ?? item.wdthLen ?? '-',
|
||||
vrtcLen: formattedItem.vrtcLen ?? item.vrtcLen ?? '-',
|
||||
altdVl: formattedItem.altdVl ?? item.altdVl ?? '-',
|
||||
dpthlVl: formattedItem.dpthlVl ?? item.dpthlVl ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_swage_pmstn': {
|
||||
// 하수펌프장
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
swagePmstnNm: formattedItem.swagePmstnNm ?? item.swagePmstnNm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
dailyPrcsCpct: formattedItem.dailyPrcsCpct ?? item.dailyPrcsCpct ?? '-',
|
||||
maxImpndCpct: formattedItem.maxImpndCpct ?? item.maxImpndCpct ?? '-',
|
||||
altdVl: formattedItem.altdVl ?? item.altdVl ?? '-',
|
||||
wtlvVl: formattedItem.wtlvVl ?? item.wtlvVl ?? '-',
|
||||
exclnWpmpAbltVl: formattedItem.exclnWpmpAbltVl ?? item.exclnWpmpAbltVl ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_stofcbr': {
|
||||
// 우수토실
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
mapshtNo: formattedItem.mapshtNo ?? item.mapshtNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
worflwWallHgt: formattedItem.worflwWallHgt ?? item.worflwWallHgt ?? '-',
|
||||
swageMhlMngNo: formattedItem.swageMhlMngNo ?? item.swageMhlMngNo ?? '-',
|
||||
drtnAngl: formattedItem.drtnAngl ?? item.drtnAngl ?? '-'
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
|
||||
const excelData = mappedContent; // 배열로 감싸서 전달
|
||||
|
||||
// 파일명 생성 (분석번호 기반)
|
||||
const label = BASIC_TYPES.find((type) => type.val === basicType)?.text
|
||||
const fileName = `${label} 조회 결과_${todayYear}${todayMonth}${todayDate}`;
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: excelData as JSON[],
|
||||
fileName: fileName,
|
||||
sheetNameArray: [fileName],
|
||||
headerRange: headerRange,
|
||||
headerMapping: headerMapping
|
||||
});
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
console.error("Excel 다운로드 중 오류 발생:", error);
|
||||
alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return { fetchBasicFilteredData, handleBasicCellClick, basicExcelDownload };
|
||||
};
|
||||
@@ -0,0 +1,437 @@
|
||||
import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui';
|
||||
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES } from '../components/common/table';
|
||||
import { getData } from "@/components/lib/api";
|
||||
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { confirmToast } from '@/components/ui/toast'
|
||||
import { toast } from "react-hot-toast";
|
||||
import useSearchModalStore from '@/store/useSearchModalStore';
|
||||
import useStore from '@/store/useStore';
|
||||
|
||||
|
||||
export default function useOperationTab() {
|
||||
const OPERATION_TABLE_SIZE = 5;
|
||||
|
||||
const {
|
||||
workType,
|
||||
tableData, detailTableData,
|
||||
curPage, detailCurPage,
|
||||
detailBizId,
|
||||
var1, var2,
|
||||
yearFilter,
|
||||
todayYear, todayMonth, todayDate,
|
||||
setIsSearchModalOpen,
|
||||
setTableData, setDetailTableData,
|
||||
setTableCount, setDetailTableCount,
|
||||
setDetailCurPage,
|
||||
setIsLoading, setIsDetailLoading,
|
||||
setIsResetDetailPage,
|
||||
setIsResetDetailSelection,
|
||||
setDetailBizId,
|
||||
getDateString
|
||||
} = useSearchModalStore();
|
||||
const { BIZ_TY_CD } = useStore();
|
||||
|
||||
const WORK_TYPES = [ // 운영정보 '구분' 선택 목록
|
||||
{ val: "['200', '201', '204']", text: "보수 및 갱신" },
|
||||
{ val: "['100']", text: "점검 및 진단" },
|
||||
{ val: "['203']", text: "청소 및 준설" },
|
||||
];
|
||||
const OPERATION_TABLE_HEADLIST = [ // 운영정보 - 사업 현황
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "bizInfoNm", title: "사업명" },
|
||||
{ id: "flfmtBgngYmd", title: "수행시작일자" },
|
||||
{ id: "flfmtEndYmd", title: "수행종료일자" },
|
||||
{ id: "flfmtYr", title: "수행년도" },
|
||||
{ id: "bizTypeCd", title: "사업유형" },
|
||||
{ id: "bizAmt", title: "사업금액" },
|
||||
];
|
||||
const MAINTENANACE_TABLE_HEADLIST = [ // 운영정보 - 보수 및 갱신 결과표
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "swtrmt_zone_nm", title: "처리구역" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
// { id: "lgalDrblyr", title: "내용연수" },
|
||||
// { id: "acqsPrmpc", title: "취득금액" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
{ id: "pdmtVl", title: "관경(mm)" },
|
||||
{ id: "prlgVl", title: "연장(m)" },
|
||||
{ id: "instlYmd", title: "설치일자" },
|
||||
// { id: "instlYmd", title: "사업구분" },
|
||||
];
|
||||
const CLEANING_TABLE_HEADLIST = [ // 운영정보 - 청소 및 준설 결과표
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "swtrmt_zone_nm", title: "처리구역" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
// { id: "lgalDrblyr", title: "내용연수" },
|
||||
// { id: "acqsPrmpc", title: "취득금액" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
{ id: "pdmtVl", title: "관경(mm)" },
|
||||
{ id: "prlgVl", title: "연장(m)" },
|
||||
{ id: "instlYmd", title: "설치일자" },
|
||||
];
|
||||
const INSPECTION_TABLE_HEADLIST = [ // 운영정보 - 점검 및 진단 결과표
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "swtrmt_zone_nm", title: "처리구역" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
// { id: "riskEval", title: "위험평가" },
|
||||
// { id: "acqsPrmpc", title: "취득금액" },
|
||||
// { id: "lgalDrblyr", title: "내용연수" },
|
||||
// { id: "remLife", title: "잔존수명" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
{ id: "pdmtVl", title: "관경(mm)" },
|
||||
{ id: "prlgVl", title: "연장(m)" },
|
||||
{ id: "instlYmd", title: "설치일자" },
|
||||
{ id: "strc_stts_grd", title: "구조적 상태등급" },
|
||||
{ id: "oper_stts_grd", title: "운영적 상태등급" },
|
||||
];
|
||||
|
||||
const fetchOperationFilteredData = async () => {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${curPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
};
|
||||
if (var1) RequestDTO.bizInfoNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTypeCd = var2;
|
||||
// 수행기간 범위
|
||||
const startDate = getDateString(
|
||||
yearFilter.start,
|
||||
'',
|
||||
'',
|
||||
"19000101",
|
||||
);
|
||||
const endDate = getDateString(
|
||||
yearFilter.end,
|
||||
'',
|
||||
'',
|
||||
`${todayYear}${todayMonth}${todayDate}`,
|
||||
);
|
||||
RequestDTO.fromflfmtEndYmd = startDate;
|
||||
RequestDTO.toflfmtEndYmd = endDate;
|
||||
|
||||
// JSON.parse 사용으로 문자열 -> 배열 변환
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const params = new URLSearchParams(RequestDTO).toString();
|
||||
|
||||
const res = await getData(`v1/bizInfo?${params}`);
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any, index: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTypeCd);
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * OPERATION_TABLE_SIZE + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
bizTypeCd: matched ? matched.lwpoCdNm : item.bizTypeCd,
|
||||
};
|
||||
});
|
||||
|
||||
setTableData(mappedContent || []);
|
||||
setTableCount(res.totalElements || 0);
|
||||
setDetailTableData([]);
|
||||
setDetailTableCount(0);
|
||||
};
|
||||
|
||||
// 운영정보 테이블 cellClick 핸들러
|
||||
const handleOperationCellClick = async (index?: number | undefined, headId?: String) => {
|
||||
setIsResetDetailPage(true); // 페이지를 1로 초기화
|
||||
setIsResetDetailSelection(true); // 선택 초기화
|
||||
setIsResetDetailPage(true); // 디테일 페이지를 초기화
|
||||
|
||||
if (typeof index === "number") {
|
||||
setIsDetailLoading(true);
|
||||
setDetailBizId(tableData[index].bizId);
|
||||
setDetailCurPage(1); // 상세 페이지 초기화
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
bizId: tableData[index % OPERATION_TABLE_SIZE].bizId,
|
||||
};
|
||||
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
|
||||
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 {
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * OPERATION_TABLE_SIZE + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
swtrmt_zone_nm: item.swtrmt_zone_nm ? item.swtrmt_zone_nm : '-',
|
||||
};
|
||||
});
|
||||
|
||||
setDetailTableData(mappedData);
|
||||
setDetailTableCount(res.count || 0);
|
||||
} catch (error) {
|
||||
console.error('운영정보 cellClick 에러:', error);
|
||||
} finally {
|
||||
setIsDetailLoading(false);
|
||||
setIsResetDetailPage(false);
|
||||
setIsResetDetailSelection(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 운영정보 디테일 테이블 cellClick 핸들러
|
||||
const handleOperationResultCellClick = async (index?: number | undefined, headId?: String) => {
|
||||
if (typeof index === "number") {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = detailTableData[index];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fid = row.fid;
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showSearchResultsFromGeoJSON(layerNm, fid);
|
||||
setIsLoading(false);
|
||||
setIsSearchModalOpen(false); // SearchModal 닫기
|
||||
}
|
||||
};
|
||||
|
||||
// 운영정보 디테일 테이블 페이지네이션 핸들러
|
||||
const handleOperationPageNation = async (index?: number | undefined) => {
|
||||
if (typeof index === "number") {
|
||||
setIsDetailLoading(true);
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
bizId: String(detailBizId),
|
||||
};
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
|
||||
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 {
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * OPERATION_TABLE_SIZE + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
swtrmt_zone_nm: item.swtrmt_zone_nm ? item.swtrmt_zone_nm : '-',
|
||||
};
|
||||
});
|
||||
|
||||
setDetailTableData(mappedData);
|
||||
setDetailTableCount(res.count || 0);
|
||||
} catch (error) {
|
||||
console.error('운영정보 페이지네이션 에러:', error);
|
||||
} finally {
|
||||
setIsDetailLoading(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 운영정보 Excel 다운로드 핸들러 추가
|
||||
const operationExcelDownload = async () => {
|
||||
if (tableData.length === 0) {
|
||||
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.dismiss("global-confirm-toast");
|
||||
|
||||
confirmToast(
|
||||
"파일 다운로드에는 2분 내외의 시간이 소요될 수 있습니다.\n파일 다운로드를 진행하시겠습니까?",
|
||||
onAnalysis ?? (() => { }),
|
||||
"text-xl font-medium text-gray-800"
|
||||
);
|
||||
|
||||
async function onAnalysis() {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
size: '10000',
|
||||
};
|
||||
if (var1) RequestDTO.bizInfoNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTypeCd = var2;
|
||||
// 수행기간 범위
|
||||
const startDate = getDateString(
|
||||
yearFilter.start,
|
||||
'',
|
||||
'',
|
||||
"19000101",
|
||||
);
|
||||
const endDate = getDateString(
|
||||
yearFilter.end,
|
||||
'',
|
||||
'',
|
||||
`${todayYear}${todayMonth}${todayDate}`,
|
||||
);
|
||||
RequestDTO.fromflfmtEndYmd = startDate;
|
||||
RequestDTO.toflfmtEndYmd = endDate;
|
||||
|
||||
// JSON.parse 사용으로 문자열 -> 배열 변환
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const params = new URLSearchParams(RequestDTO).toString();
|
||||
const res = await getData(`v1/bizInfo?${params}`);
|
||||
|
||||
// 헤더 매핑 정의
|
||||
const headerMapping: { [key: string]: string } = {
|
||||
'bizInfoNm': '사업명',
|
||||
'flfmtBgngYmd': '수행시작일자',
|
||||
'flfmtEndYmd': '수행종료일자',
|
||||
'flfmtYr': '수행년도',
|
||||
'bizTypeCd': '사업유형',
|
||||
'bizAmt': '사업금액(원)',
|
||||
};
|
||||
|
||||
const bizTyCdMap = new Map(BIZ_TY_CD.map(code => [code.lwpoCd, code.lwpoCdNm]));
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
return {
|
||||
bizInfoNm: formattedItem.bizInfoNm ?? item.bizInfoNm ?? '',
|
||||
flfmtBgngYmd: formattedItem.flfmtBgngYmd ?? item.flfmtBgngYmd ?? '',
|
||||
flfmtEndYmd: formattedItem.flfmtEndYmd ?? item.flfmtEndYmd ?? '',
|
||||
flfmtYr: formattedItem.flfmtYr ?? item.flfmtYr ?? '',
|
||||
bizTypeCd: bizTyCdMap.get(item.bizTypeCd) || item.bizTypeCd || formattedItem.bizTypeCd || '',
|
||||
bizAmt: ((v) => (v === 0 || v === '0') ? '0' : (v ?? ''))(formattedItem.bizAmt ?? item.bizAmt),
|
||||
};
|
||||
});
|
||||
|
||||
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
|
||||
const excelData = mappedContent; // 배열로 감싸서 전달
|
||||
|
||||
// 파일명 생성 (분석번호 기반)
|
||||
const label = WORK_TYPES.find((type) => type.val === workType)?.text
|
||||
const fileName = `${label} 사업 현황_${todayYear}${todayMonth}${todayDate}`;
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: excelData as JSON[],
|
||||
fileName: fileName,
|
||||
sheetNameArray: [fileName],
|
||||
headerRange: "A1:F1",
|
||||
headerMapping: headerMapping
|
||||
});
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
console.error("Excel 다운로드 중 오류 발생:", error);
|
||||
alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 운영정보 결과표 Excel 다운로드 핸들러 추가
|
||||
const operationResultExcelDownload = async () => {
|
||||
if (detailTableData.length === 0) {
|
||||
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.dismiss("global-confirm-toast");
|
||||
|
||||
confirmToast(
|
||||
"파일 다운로드에는 2분 내외의 시간이 소요될 수 있습니다.\n파일 다운로드를 진행하시겠습니까?",
|
||||
onAnalysis ?? (() => { }),
|
||||
"text-xl font-medium text-gray-800"
|
||||
);
|
||||
|
||||
async function onAnalysis() {
|
||||
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
size: '100',
|
||||
bizId: String(detailBizId),
|
||||
};
|
||||
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
console.log('res', res);
|
||||
|
||||
// 헤더 매핑 정의
|
||||
const headerMapping: { [key: string]: string } = {
|
||||
'fcltMngNo': '관리번호',
|
||||
'swtrmt_zone_nm': '처리구역',
|
||||
'usgCd': '용도',
|
||||
'mqltCd': '재질',
|
||||
'pdmtVl': '관경(mm)',
|
||||
'prlgVl': '연장(m)',
|
||||
'instlYmd': '설치일자',
|
||||
'strc_stts_grd': '구조적 상태등급',
|
||||
'oper_stts_grd': '운영적 상태등급',
|
||||
};
|
||||
|
||||
const usgCdMap = new Map(MS_SWAGE_PPL_USE_CODES.map(code => [code.val, code.text]));
|
||||
const mqltCdMap = new Map(MS_SWAGE_PPL_CODES.map(code => [code.val, code.text]));
|
||||
|
||||
// 🎯 단일 반복문으로 최적화 - 각 아이템마다 필요한 필드만 직접 매핑
|
||||
const mappedData = (res.data || []).map((item: any) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
// trim 한 번만 수행
|
||||
const trimmedUsgCd = item?.usgCd?.trim();
|
||||
const trimmedMqltCd = item?.mqltCd?.trim();
|
||||
|
||||
// zone 값 한 번만 계산
|
||||
const zone = item.swtrmtZoneNm ?? formattedItem.swtrmt_zone_nm ?? item.swtrmt_zone_nm ?? '';
|
||||
|
||||
// 직접 매핑 - 반복문 없이 한 번에 객체 생성
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '',
|
||||
swtrmt_zone_nm: (zone === null || zone === '') ? '-' : zone,
|
||||
usgCd: usgCdMap.get(trimmedUsgCd) || item.usgCd || formattedItem.usgCd || '',
|
||||
mqltCd: mqltCdMap.get(trimmedMqltCd) || item.mqltCd || formattedItem.mqltCd || '',
|
||||
pdmtVl: formattedItem.pdmtVl ?? item.pdmtVl ?? '',
|
||||
prlgVl: formattedItem.prlgVl ?? item.prlgVl ?? '',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '',
|
||||
strc_stts_grd: ((v) => (v === 0 || v === '0') ? '0' : (v ?? ''))(formattedItem.strc_stts_grd ?? item.strc_stts_grd),
|
||||
oper_stts_grd: ((v) => (v === 0 || v === '0') ? '0' : (v ?? ''))(formattedItem.oper_stts_grd ?? item.oper_stts_grd),
|
||||
};
|
||||
});
|
||||
|
||||
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
|
||||
const excelData = mappedData; // 배열로 감싸서 전달
|
||||
|
||||
// 파일명 생성 (분석번호 기반)
|
||||
const label = WORK_TYPES.find((type) => type.val === workType)?.text
|
||||
const fileName = `${label} 결과표_${todayYear}${todayMonth}${todayDate}`;
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: excelData as JSON[],
|
||||
fileName: fileName,
|
||||
sheetNameArray: [fileName],
|
||||
headerRange: "A1:I1",
|
||||
headerMapping: headerMapping
|
||||
});
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
console.error("Excel 다운로드 중 오류 발생:", error);
|
||||
alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
WORK_TYPES,
|
||||
OPERATION_TABLE_HEADLIST,
|
||||
MAINTENANACE_TABLE_HEADLIST,
|
||||
CLEANING_TABLE_HEADLIST,
|
||||
INSPECTION_TABLE_HEADLIST,
|
||||
OPERATION_TABLE_SIZE,
|
||||
fetchOperationFilteredData,
|
||||
handleOperationCellClick,
|
||||
handleOperationResultCellClick,
|
||||
handleOperationPageNation,
|
||||
operationExcelDownload,
|
||||
operationResultExcelDownload
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,173 @@
|
||||
import { getDcData } from '@/components/lib/api';
|
||||
import { fileDownload } from '@/utils';
|
||||
import { useReportTabStore } from '@/store/useReportTabStore';
|
||||
import useSearchModalStore from '@/app/store/useSearchModalStore';
|
||||
|
||||
export type Folder = {
|
||||
clsfSystmSn: string;
|
||||
upClsfSystmSn: string;
|
||||
clsfSystmNm: string;
|
||||
children: Folder[];
|
||||
};
|
||||
export type FlattenedFolder = {
|
||||
[key: string]: string | number | undefined;
|
||||
};
|
||||
export type SelectDataType = {
|
||||
text: string;
|
||||
val: string;
|
||||
sido?: string; // 시도 코드 (선택 사항)
|
||||
}
|
||||
export type ReportDataFile = {
|
||||
no: number;
|
||||
fileTitle: string;
|
||||
regDt: string;
|
||||
fileSn: string;
|
||||
filePath: string;
|
||||
}
|
||||
|
||||
export default function useReportTab() {
|
||||
const REPORT_TYPES = [
|
||||
{ val: '0', text: '전체' },
|
||||
{ val: '1', text: '보고서' },
|
||||
{ val: '2', text: '요약보고서' },
|
||||
{ val: '3', text: '부록' },
|
||||
{ val: '4', text: '기타' }
|
||||
];
|
||||
|
||||
const { curPage, setIsLoading } = useSearchModalStore();
|
||||
const { dcFiles: filesOrigin, files, setFiles } = useReportTabStore();
|
||||
|
||||
/**
|
||||
* Flatten a hierarchical folder structure into a flat array.
|
||||
* @param data - The hierarchical folder data to flatten.
|
||||
* @returns An array of flattened folders with their paths and levels.
|
||||
*/
|
||||
const flattenFolders = (data: Folder[]): FlattenedFolder[] => {
|
||||
const result: FlattenedFolder[] = [];
|
||||
const exceptNodeNm = ["부분", "통합", "전체"];
|
||||
const addNodeNm = ["보고서", "요약보고서", "부록", "기타"]; // level5
|
||||
const columnNms: { [key: number]: string } = {
|
||||
0: "root", 1: "sido", 2: "sigungu", 3: "approvalYear"
|
||||
, 4: "plantZoneGubun", 5: "reportGubun", 7: "fileName", 8: "regDate"
|
||||
};
|
||||
|
||||
const traverse = (
|
||||
node: Folder,
|
||||
path: { [key: string]: string | number },
|
||||
level: number
|
||||
) => {
|
||||
const isYear = (value: string): boolean => {
|
||||
return /^[0-9]{4}년$/.test(value);
|
||||
};
|
||||
|
||||
if (level === 2 && isYear(node.clsfSystmNm)) {
|
||||
level++;
|
||||
}
|
||||
if (level === 4 && addNodeNm.includes(node.clsfSystmNm)) {
|
||||
level++; // 레벨을 증가시켜 하위값에 추가되도록 함.
|
||||
}
|
||||
|
||||
const newPath = {
|
||||
...path,
|
||||
[`${columnNms[level]}`]: node.clsfSystmNm,
|
||||
};
|
||||
|
||||
if (node.children.length === 0) {
|
||||
newPath.no = result.length + 1;
|
||||
newPath.clsfSystmSn = node.clsfSystmSn; // 파일 조회를 위한 고유번호
|
||||
result.push(newPath);
|
||||
} else {
|
||||
if (level === 4) {
|
||||
if (exceptNodeNm.includes(node.clsfSystmNm)) {
|
||||
level--; // 제외할 노드 이름인 경우, 현재의 레벨에 하위값이 써지도록 함.
|
||||
}
|
||||
}
|
||||
node.children.forEach((child) => {
|
||||
traverse(child, newPath, level + 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (data && data.length > 0 && data[0]?.clsfSystmNm == "기본계획") { // data가 비어있지 않고 children이 있는 경우에만 처리
|
||||
data.forEach((root) => traverse(root, {}, 0));
|
||||
} else {
|
||||
data.forEach((root) => traverse(root, {}, 1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const getDcFiles = async (clsfSystmSn: string): Promise<ReportDataFile[]> => {
|
||||
if (!clsfSystmSn) {
|
||||
console.error("clsfSystmSn is required to get files.");
|
||||
return [];
|
||||
}
|
||||
const queryString = 'clsfSystmSn=' + clsfSystmSn;
|
||||
const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`);
|
||||
return result;
|
||||
};
|
||||
|
||||
// 파일 이름 추가
|
||||
const addFileName = async (data: FlattenedFolder[]) => {
|
||||
const fileReportData = await Promise.all(
|
||||
data.map(async (item) => {
|
||||
const fileArr: ReportDataFile[] = await getDcFiles(String(item.clsfSystmSn));
|
||||
let result: FlattenedFolder;
|
||||
if (fileArr.length > 0) {
|
||||
const f = fileArr[0];
|
||||
const fCount = fileArr.length;
|
||||
result = { ...item, fileName: f?.fileTitle + " 외 " + fCount + "건", regDate: f?.regDt, fileSn: f?.fileSn, filePath: f?.filePath };
|
||||
} else {
|
||||
result = { ...item, fileName: "", regDate: "", fileSn: "", filePath: "" };
|
||||
}
|
||||
return result;
|
||||
})
|
||||
);
|
||||
return fileReportData;
|
||||
};
|
||||
|
||||
const getDcFileDownload = async (fileSn: string, fileName: string, filePath: string) => {
|
||||
if (filePath === "") {
|
||||
alert(`filePath 정보가 없으므로 다운로드가 불가합니다.\nfilesn: ${fileSn}`);
|
||||
return;
|
||||
}
|
||||
const queryString = 'filePath=' + encodeURIComponent(filePath);
|
||||
const responseBlob = await getDcData(`/api/v1/dc/file/download${queryString ? `?${queryString}` : ''}`, "blob");
|
||||
fileDownload(responseBlob, fileName);
|
||||
}
|
||||
|
||||
// 파일 목록 조회
|
||||
const getFiles = async () => {
|
||||
setIsLoading(true); // 로딩 시작
|
||||
try {
|
||||
let data = filesOrigin;
|
||||
data = data?.slice((curPage - 1) * 10, curPage * 10); // paging
|
||||
data = data?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
|
||||
setFiles(data);
|
||||
} catch (error) {
|
||||
console.error("파일 목록 조회 에러:", error);
|
||||
} finally {
|
||||
setIsLoading(false); // 로딩 종료
|
||||
}
|
||||
};
|
||||
|
||||
// cellClick 핸들러
|
||||
const handleCellClick = (index: number | undefined) => {
|
||||
if (typeof index === "number" && files[index]) {
|
||||
const fileName = files[index].fileTitle;
|
||||
const filePath = files[index].filePath;
|
||||
if (files[index].fileSn !== "") {
|
||||
getDcFileDownload(files[index].fileSn, fileName, filePath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
REPORT_TYPES,
|
||||
flattenFolders,
|
||||
addFileName,
|
||||
getDcFiles,
|
||||
getDcFileDownload,
|
||||
getFiles,
|
||||
handleCellClick
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
import { getData } from "@/components/lib/api";
|
||||
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
|
||||
import useStore from '../../../store/useStore';
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import useBasicTab from './useBasicTab';
|
||||
import useOperationTab from './useOperationTab';
|
||||
|
||||
export default function useSearchModal() {
|
||||
const {
|
||||
activeTab, workType,
|
||||
tableData, detailTableData,
|
||||
curPage,
|
||||
var1, var2,
|
||||
yearFilter,
|
||||
todayYear, todayMonth, todayDate,
|
||||
setIsSearchModalOpen,
|
||||
setShowTable,
|
||||
setTableData, setDetailTableData,
|
||||
setTableCount, setDetailTableCount,
|
||||
setCurPage,
|
||||
setIsLoading,
|
||||
setIsResetPage, setIsResetDetailPage,
|
||||
setIsResetSelection, setIsResetDetailSelection,
|
||||
getDateString
|
||||
} = useSearchModalStore();
|
||||
const { fetchBasicFilteredData } = useBasicTab();
|
||||
const { OPERATION_TABLE_SIZE } = useOperationTab();
|
||||
const { BIZ_TY_CD } = useStore();
|
||||
|
||||
const TABS = [
|
||||
{ val: "basic", text: "기본정보" },
|
||||
{ val: "operation", text: "운영정보" },
|
||||
{ val: "report", text: "하수도정비기본계획보고서" },
|
||||
];
|
||||
|
||||
// 검색 API 호출 함수
|
||||
const fetchFilteredData = async () => {
|
||||
setIsLoading(true); // 로딩 시작
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
setIsResetDetailSelection(true); // 선택 초기화
|
||||
|
||||
try {
|
||||
if (activeTab === 'basic') {
|
||||
fetchBasicFilteredData();
|
||||
|
||||
} else if (activeTab === 'operation') {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${curPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
};
|
||||
if (var1) RequestDTO.bizInfoNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTypeCd = var2;
|
||||
// 수행기간 범위
|
||||
const startDate = getDateString(
|
||||
yearFilter.start,
|
||||
'',
|
||||
'',
|
||||
"19000101",
|
||||
);
|
||||
const endDate = getDateString(
|
||||
yearFilter.end,
|
||||
'',
|
||||
'',
|
||||
`${todayYear}${todayMonth}${todayDate}`,
|
||||
);
|
||||
RequestDTO.fromflfmtEndYmd = startDate;
|
||||
RequestDTO.toflfmtEndYmd = endDate;
|
||||
|
||||
// JSON.parse 사용으로 문자열 -> 배열 변환
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const params = new URLSearchParams(RequestDTO).toString();
|
||||
|
||||
const res = await getData(`v1/bizInfo?${params}`);
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any, index: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTypeCd);
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * OPERATION_TABLE_SIZE + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
bizTypeCd: matched ? matched.lwpoCdNm : item.bizTypeCd,
|
||||
};
|
||||
});
|
||||
|
||||
setTableData(mappedContent || []);
|
||||
setTableCount(res.totalElements || 0);
|
||||
setDetailTableData([]);
|
||||
setDetailTableCount(0);
|
||||
}
|
||||
|
||||
setShowTable(true);
|
||||
setIsResetSelection(false);
|
||||
} catch (err) {
|
||||
console.error('API ERROR:', err);
|
||||
setTableData([]);
|
||||
setIsResetSelection(false);
|
||||
} finally {
|
||||
setIsLoading(false); // 로딩 종료
|
||||
setIsResetSelection(false);
|
||||
// setIsResetDetailSelection(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화
|
||||
const handleSearch = () => {
|
||||
setCurPage(1); // 페이지를 1로 초기화
|
||||
fetchFilteredData();
|
||||
setIsResetPage(true); // 페이지를 초기화
|
||||
setIsResetDetailPage(true); // 디테일 페이지를 초기화
|
||||
setIsResetSelection(false); // 선택 초기화
|
||||
setIsResetDetailSelection(false); // 선택 초기화
|
||||
setShowTable(true);
|
||||
};
|
||||
|
||||
// 여러 시설 보기
|
||||
const viewMultipleFeature = async () => {
|
||||
if (activeTab === 'basic') {
|
||||
if (!(tableData.length === 0)) {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = tableData[0];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fids = tableData.map((item) => item.fid);
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showMultipleSearchResultsFromGeoJSON(layerNm, fids);
|
||||
setIsLoading(false);
|
||||
setIsSearchModalOpen(false);
|
||||
}
|
||||
} else if (activeTab === 'operation') {
|
||||
if (!(detailTableData.length === 0)) {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = detailTableData[0];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fids = detailTableData.map((item) => item.fid);
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showMultipleSearchResultsFromGeoJSON(layerNm, fids);
|
||||
setIsLoading(false);
|
||||
setIsSearchModalOpen(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { TABS, getDateString, handleSearch, viewMultipleFeature, fetchFilteredData };
|
||||
};
|
||||
@@ -1,841 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES,
|
||||
MsSwagePplExcelCol, SwtrmtFcltExcelCol, SwtrmtPrcsZoneExcelCol, MsSwageMhlExcelCol, ExclnSewagePumpExcelCol, stofcbrExcelCol
|
||||
} from '../components/common/table';
|
||||
import { getData } from "@/components/lib/api";
|
||||
import { BASIC_TYPES } from './basicTab';
|
||||
import { WORK_TYPES } from './operationTab';
|
||||
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
|
||||
import useStore from '../../../store/useStore';
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { confirmToast } from '@/components/ui/toast'
|
||||
import { toast } from "react-hot-toast";
|
||||
import useSearchModalStore from '../../../store/useSearchModalStore';
|
||||
import { swagePplCqlFilters } from './swagePpl';
|
||||
import { swagePrcsFcltCqlFilters } from './swagePrcsFclt';
|
||||
import { swagePrcsZoneCqlFilters } from './swagePrcsZone';
|
||||
import { swageMhlCqlFilters } from './swageMhl';
|
||||
import { swagePmstnCqlFilters } from './swagePmstn';
|
||||
import { stofcbrCqlFilters } from './stofcbr';
|
||||
|
||||
const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`;
|
||||
export const OPERATION_TABLE_SIZE = 5;
|
||||
|
||||
export interface SearchModalProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onFeatureSelect: (row: any) => void;
|
||||
}
|
||||
|
||||
export function useSearchModal({ open, onOpenChange, onFeatureSelect }: SearchModalProps) {
|
||||
const {
|
||||
activeTab, basicType, workType,
|
||||
showTable,
|
||||
tableData, detailTableData,
|
||||
curPage, detailCurPage,
|
||||
detailBizId,
|
||||
ctpvCd, ctpvName, sggCd, sggName,
|
||||
start1, start2, end1, end2,
|
||||
var1, var2,
|
||||
yearFilter,
|
||||
todayYear, todayMonth, todayDate,
|
||||
setShowTable,
|
||||
setTableData, setDetailTableData,
|
||||
setTableCount, setDetailTableCount,
|
||||
setCurPage, setDetailCurPage,
|
||||
setIsLoading, setIsDetailLoading,
|
||||
setIsResetPage, setIsResetDetailPage,
|
||||
setIsResetSelection, setIsResetDetailSelection,
|
||||
setDetailBizId,
|
||||
resetFilters,
|
||||
getDateString
|
||||
} = useSearchModalStore();
|
||||
const { ctpv, sgg, BIZ_TY_CD } = useStore();
|
||||
|
||||
const TABS = [
|
||||
{ val: "basic", text: "기본정보" },
|
||||
{ val: "operation", text: "운영정보" },
|
||||
{ val: "report", text: "하수도정비기본계획보고서" },
|
||||
];
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
resetFilters();
|
||||
}, [activeTab, basicType, workType]);
|
||||
|
||||
// 페이지 변경 시마다 데이터 fetch
|
||||
useEffect(() => {
|
||||
setIsResetPage(false);
|
||||
setIsResetDetailPage(true);
|
||||
setDetailBizId(0);
|
||||
if (showTable) fetchFilteredData();
|
||||
}, [curPage]);
|
||||
|
||||
// 페이지 변경 시마다 데이터 fetch
|
||||
useEffect(() => {
|
||||
setIsResetDetailSelection(false);
|
||||
if (showTable) handleOperationPageNation(Number(detailBizId));
|
||||
}, [detailCurPage]);
|
||||
|
||||
|
||||
// 검색 API 호출 함수
|
||||
const fetchFilteredData = async () => {
|
||||
setIsLoading(true); // 로딩 시작
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
setIsResetDetailSelection(true); // 선택 초기화
|
||||
|
||||
try {
|
||||
let cqlFilters: string[] = [];
|
||||
if (activeTab === 'basic') {
|
||||
const queryParams = new URLSearchParams({
|
||||
lyrTypeNm: basicType,
|
||||
page: `${curPage - 1}`,
|
||||
size: '10',
|
||||
sort: 'string',
|
||||
});
|
||||
|
||||
if (basicType === 'tb_ms_swage_prcs_zone') cqlFilters = swagePrcsZoneCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
var1, var2
|
||||
}); // 하수처리구역
|
||||
else if (basicType === 'tb_il_swage_prcs_fclt') cqlFilters = swagePrcsFcltCqlFilters({
|
||||
ctpvName, sggName,
|
||||
yearFilter,
|
||||
start1, end1,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
}); // 하수처리시설
|
||||
else if (basicType === 'tb_ms_swage_ppl') cqlFilters = swagePplCqlFilters({
|
||||
var1, var2,
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, start2, end1, end2,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
}); // 하수관로
|
||||
else if (basicType === 'tb_ms_swage_mhl') cqlFilters = swageMhlCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, end1,
|
||||
var1,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
}); // 하수맨홀
|
||||
else if (basicType === 'tb_ms_swage_pmstn') cqlFilters = swagePmstnCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, start2, end1, end2,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
}); // 하수펌프장
|
||||
else if (basicType === 'tb_ms_stofcbr') cqlFilters = stofcbrCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
}); // 우수토실
|
||||
|
||||
if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and '));
|
||||
|
||||
const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`);
|
||||
|
||||
// 🎯 각 아이템을 개별적으로 포맷팅하면서 일련번호 추가
|
||||
const dataWithRowNumber = (res.data.data || []).map((item: any, index: number) => {
|
||||
// 🎯 먼저 각 아이템을 포맷팅
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
let ctpvCd = item?.ctpvNm ?? formattedItem?.ctpvNm ?? '';
|
||||
let sggCd = item?.sggNm ?? formattedItem?.sggNm ?? '';
|
||||
|
||||
if (!ctpvCd || !sggCd) {
|
||||
const code = String(item?.pbadmsEmdCd ?? formattedItem?.pbadmsEmdCd ?? '')?.trim();
|
||||
if (!ctpvCd && code) ctpvCd = code.slice(0, 2);
|
||||
if (!sggCd && code) sggCd = code.slice(0, 5);
|
||||
}
|
||||
|
||||
const matchedMhlCode = MS_SWAGE_MHL_CODES.find(code => code.val === item?.mqltCd?.trim());
|
||||
const matchedMhlUsgCode = MS_SWAGE_MHL_USE_CODES.find(code => code.val === item?.usgCd);
|
||||
const ctpvNm = ctpv.find(code => code.val.trim() === ctpvCd)?.text || item?.ctpvNm;
|
||||
const sggNm = sgg.find(code => code.val.trim() === sggCd)?.text || item?.sggNm;
|
||||
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item?.usgCd?.trim());
|
||||
|
||||
// 추가 처리 및 일련번호 추가
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * 10 + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item?.scsYn, // scsYn이 null이면 'N'으로 변경
|
||||
mqltCd: matchedMhlCode ? matchedMhlCode.text : item?.mqltCd,
|
||||
usgCd: matchedMhlUsgCode ? matchedMhlUsgCode.text : (usgCdObj ? usgCdObj.text : item?.usgCd),
|
||||
ctpvNm: ctpvNm ?? '-',
|
||||
sggNm : sggNm ?? '-',
|
||||
swtrmt_zone_nm: item.swtrmtZoneNm || item.swtrmt_zone_nm || '-',
|
||||
};
|
||||
});
|
||||
|
||||
setTableData(dataWithRowNumber);
|
||||
setTableCount(res.data.count || []);
|
||||
|
||||
} else if (activeTab === 'operation') {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${curPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
};
|
||||
if (var1) RequestDTO.bizInfoNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTypeCd = var2;
|
||||
// 수행기간 범위
|
||||
const startDate = getDateString(
|
||||
yearFilter.start,
|
||||
'',
|
||||
'',
|
||||
"19000101",
|
||||
);
|
||||
const endDate = getDateString(
|
||||
yearFilter.end,
|
||||
'',
|
||||
'',
|
||||
`${todayYear}${todayMonth}${todayDate}`,
|
||||
);
|
||||
RequestDTO.fromflfmtEndYmd = startDate;
|
||||
RequestDTO.toflfmtEndYmd = endDate;
|
||||
|
||||
// JSON.parse 사용으로 문자열 -> 배열 변환
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const params = new URLSearchParams(RequestDTO).toString();
|
||||
|
||||
const res = await getData(`v1/bizInfo?${params}`);
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any, index: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTypeCd);
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * OPERATION_TABLE_SIZE + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
bizTypeCd: matched ? matched.lwpoCdNm : item.bizTypeCd,
|
||||
};
|
||||
});
|
||||
|
||||
setTableData(mappedContent || []);
|
||||
setTableCount(res.totalElements || 0);
|
||||
setDetailTableData([]);
|
||||
setDetailTableCount(0);
|
||||
}
|
||||
|
||||
setShowTable(true);
|
||||
setIsResetSelection(false);
|
||||
} catch (err) {
|
||||
console.error('API ERROR:', err);
|
||||
setTableData([]);
|
||||
setIsResetSelection(false);
|
||||
} finally {
|
||||
setIsLoading(false); // 로딩 종료
|
||||
setIsResetSelection(false);
|
||||
// setIsResetDetailSelection(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화
|
||||
const handleSearch = () => {
|
||||
setCurPage(1); // 페이지를 1로 초기화
|
||||
fetchFilteredData();
|
||||
setIsResetPage(true); // 페이지를 초기화
|
||||
setIsResetDetailPage(true); // 디테일 페이지를 초기화
|
||||
setIsResetSelection(false); // 선택 초기화
|
||||
setIsResetDetailSelection(false); // 선택 초기화
|
||||
setShowTable(true);
|
||||
};
|
||||
|
||||
// 기본정보 테이블 cellClick 핸들러
|
||||
const handleBasicCellClick = async (index?: number | undefined, headId?: String) => {
|
||||
if (typeof index === "number") {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = tableData[index];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fid = row.fid;
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showSearchResultsFromGeoJSON(layerNm, fid);
|
||||
setIsLoading(false);
|
||||
onOpenChange(false); // SearchModal 닫기
|
||||
}
|
||||
};
|
||||
// 운영정보 테이블 cellClick 핸들러
|
||||
const handleOperationCellClick = async (index?: number | undefined, headId?: String) => {
|
||||
setIsResetDetailPage(true); // 페이지를 1로 초기화
|
||||
setIsResetDetailSelection(true); // 선택 초기화
|
||||
setIsResetDetailPage(true); // 디테일 페이지를 초기화
|
||||
|
||||
if (typeof index === "number") {
|
||||
setIsDetailLoading(true);
|
||||
setDetailBizId(tableData[index].bizId);
|
||||
setDetailCurPage(1); // 상세 페이지 초기화
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
bizId: tableData[index % OPERATION_TABLE_SIZE].bizId,
|
||||
};
|
||||
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
|
||||
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 {
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * OPERATION_TABLE_SIZE + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
swtrmt_zone_nm: item.swtrmt_zone_nm ? item.swtrmt_zone_nm : '-',
|
||||
};
|
||||
});
|
||||
|
||||
setDetailTableData(mappedData);
|
||||
setDetailTableCount(res.count || 0);
|
||||
} catch (error) {
|
||||
console.error('운영정보 cellClick 에러:', error);
|
||||
} finally {
|
||||
setIsDetailLoading(false);
|
||||
setIsResetDetailPage(false);
|
||||
setIsResetDetailSelection(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
// 운영정보 디테일 테이블 페이지네이션 핸들러
|
||||
const handleOperationPageNation = async (index?: number | undefined) => {
|
||||
if (typeof index === "number") {
|
||||
setIsDetailLoading(true);
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: `${OPERATION_TABLE_SIZE}`,
|
||||
bizId: String(detailBizId),
|
||||
};
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
|
||||
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 {
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * OPERATION_TABLE_SIZE + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
swtrmt_zone_nm: item.swtrmt_zone_nm ? item.swtrmt_zone_nm : '-',
|
||||
};
|
||||
});
|
||||
|
||||
setDetailTableData(mappedData);
|
||||
setDetailTableCount(res.count || 0);
|
||||
} catch (error) {
|
||||
console.error('운영정보 페이지네이션 에러:', error);
|
||||
} finally {
|
||||
setIsDetailLoading(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleOperationResultCellClick = async (index?: number | undefined, headId?: String) => {
|
||||
if (typeof index === "number") {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = detailTableData[index];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fid = row.fid;
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showSearchResultsFromGeoJSON(layerNm, fid);
|
||||
setIsLoading(false);
|
||||
onOpenChange(false); // SearchModal 닫기
|
||||
}
|
||||
};
|
||||
|
||||
// 기본정보 Excel 다운로드 핸들러
|
||||
const basicExcelDownload = async () => {
|
||||
if (tableData.length === 0) {
|
||||
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.dismiss("global-confirm-toast");
|
||||
|
||||
confirmToast(
|
||||
"파일 다운로드에는 2분 내외의 시간이 소요될 수 있습니다.\n파일 다운로드를 진행하시겠습니까?",
|
||||
onAnalysis ?? (() => { }),
|
||||
"text-xl font-medium text-gray-800"
|
||||
);
|
||||
|
||||
async function onAnalysis() {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const queryParams = new URLSearchParams({
|
||||
lyrTypeNm: basicType,
|
||||
size: '10000',
|
||||
});
|
||||
|
||||
let cqlFilters: string[] = [];
|
||||
let headerMapping: { [key: string]: string } = {};
|
||||
let headerRange: string = "A1:F1";
|
||||
|
||||
switch (basicType) {
|
||||
case 'tb_ms_swage_ppl': {
|
||||
// 하수관로
|
||||
cqlFilters = swagePplCqlFilters({
|
||||
var1, var2,
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, start2, end1, end2,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
})
|
||||
headerMapping = MsSwagePplExcelCol;
|
||||
headerRange = "A1:M1";
|
||||
break;
|
||||
}
|
||||
case 'tb_il_swage_prcs_fclt': {
|
||||
// 하수처리시설
|
||||
cqlFilters = swagePrcsFcltCqlFilters({
|
||||
ctpvName, sggName,
|
||||
yearFilter,
|
||||
start1, end1,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
});
|
||||
headerMapping = SwtrmtFcltExcelCol;
|
||||
headerRange = "A1:J1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_swage_prcs_zone': {
|
||||
// 하수처리구역
|
||||
cqlFilters = swagePrcsZoneCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
var1, var2
|
||||
});
|
||||
headerMapping = SwtrmtPrcsZoneExcelCol;
|
||||
headerRange = "A1:D1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_swage_mhl': {
|
||||
// 하수맨홀
|
||||
cqlFilters = swageMhlCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, end1,
|
||||
var1,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
});
|
||||
headerMapping = MsSwageMhlExcelCol;
|
||||
headerRange = "A1:J1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_swage_pmstn': {
|
||||
// 하수펌프장
|
||||
cqlFilters = swagePmstnCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
start1, start2, end1, end2,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
});
|
||||
headerMapping = ExclnSewagePumpExcelCol;
|
||||
headerRange = "A1:J1";
|
||||
break;
|
||||
}
|
||||
case 'tb_ms_stofcbr': {
|
||||
// 우수토실
|
||||
cqlFilters = stofcbrCqlFilters({
|
||||
ctpvCd, sggCd,
|
||||
yearFilter,
|
||||
todayYear, todayMonth, todayDate,
|
||||
getDateString
|
||||
});
|
||||
headerMapping = stofcbrExcelCol;
|
||||
headerRange = "A1:H1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and '));
|
||||
|
||||
const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`);
|
||||
|
||||
|
||||
|
||||
|
||||
// const mhlCdMap = new Map(MS_SWAGE_MHL_CODES.map(code => [code.val?.trim(), code.text]));
|
||||
const mhlUsgCdMap = new Map(MS_SWAGE_MHL_USE_CODES.map(code => [code.val?.trim(), code.text]));
|
||||
const pplUsgCdMap = new Map(MS_SWAGE_PPL_USE_CODES.map(code => [code.val?.trim(), code.text]));
|
||||
const ctpvMap = new Map(ctpv.map(code => [code.val?.trim(), code.text]));
|
||||
const sggMap = new Map(sgg.map(code => [code.val?.trim(), code.text]));
|
||||
|
||||
const mappedContent = (res.data.data || []).map((item: any) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
let ctpvCd = item?.ctpvCd ?? formattedItem?.ctpvCd ?? '';
|
||||
let sggCd = item?.sggCd ?? formattedItem?.sggCd ?? '';
|
||||
|
||||
if (!ctpvCd || !sggCd) {
|
||||
const code = String(item?.pbadmsEmdCd ?? formattedItem?.pbadmsEmdCd ?? '')?.trim();
|
||||
if (!ctpvCd && code) ctpvCd = code.slice(0, 2);
|
||||
if (!sggCd && code) sggCd = code.slice(0, 5);
|
||||
}
|
||||
|
||||
// trim 한 번만 수행
|
||||
const trimmedUsgCd = item?.usgCd?.trim();
|
||||
// const trimmedMqltCd = item?.mqltCd?.trim();
|
||||
|
||||
switch (basicType) {
|
||||
case 'tb_ms_swage_ppl': {
|
||||
// 하수관로
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
instMngNo: formattedItem.instMngNo ?? item.instMngNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? item.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? item.sggNm ?? '-',
|
||||
swtrmt_zone_nm: formattedItem.swtrmt_zone_nm ?? item.swtrmt_zone_nm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
usgCd: pplUsgCdMap.get(trimmedUsgCd) || item.usgCd || formattedItem.usgCd || '-',
|
||||
pdmtVl: formattedItem.pdmtVl ?? item.pdmtVl ?? '-',
|
||||
prlgVl: formattedItem.prlgVl ?? item.prlgVl ?? '-',
|
||||
tmptDpth: formattedItem.tmptDpth ?? item.tmptDpth ?? '-',
|
||||
tmptMhlMngNo: formattedItem.tmptMhlMngNo ?? item.tmptMhlMngNo ?? '-',
|
||||
scendDpth: formattedItem.scendDpth ?? item.scendDpth ?? '-',
|
||||
scendMhlMngNo: formattedItem.scendMhlMngNo ?? item.scendMhlMngNo ?? '-',
|
||||
};
|
||||
}
|
||||
case 'tb_il_swage_prcs_fclt': {
|
||||
// 하수처리시설
|
||||
return {
|
||||
swtrmtFcltNm: formattedItem.swtrmtFcltNm ?? item.swtrmtFcltNm ?? '-',
|
||||
fcltCpct: formattedItem.fcltCpct ?? item.fcltCpct ?? '-',
|
||||
rgnExpln: formattedItem.rgnExpln ?? item.rgnExpln ?? '-',
|
||||
oprtngStrtYmd: formattedItem.oprtngStrtYmd ?? item.oprtngStrtYmd ?? '-',
|
||||
laeNm: formattedItem.laeNm ?? item.laeNm ?? '-',
|
||||
sareaNm: formattedItem.sareaNm ?? item.sareaNm ?? '-',
|
||||
rvrNm: formattedItem.rvrNm ?? item.rvrNm ?? '-',
|
||||
dschgWtstNm: formattedItem.dschgWtstNm ?? item.dschgWtstNm ?? '-',
|
||||
swtrmtPpltnCnt: formattedItem.swtrmtPpltnCnt ?? item.swtrmtPpltnCnt ?? '-',
|
||||
rprsMsrcCn: formattedItem.rprsMsrcCn ?? item.rprsMsrcCn ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_swage_prcs_zone': {
|
||||
// 하수처리구역
|
||||
return {
|
||||
swtrmtZoneNm: formattedItem.swtrmtZoneNm ?? item.swtrmtZoneNm ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
swtrmtFcltNm: formattedItem.swtrmtFcltNm ?? item.swtrmtFcltNm ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_swage_mhl': {
|
||||
// 하수맨홀
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
usgCd: mhlUsgCdMap.get(trimmedUsgCd) || item.usgCd || formattedItem.usgCd || '-',
|
||||
swageMhlDiamVl: formattedItem.swageMhlDiamVl ?? item.swageMhlDiamVl ?? '-',
|
||||
wdthLen: formattedItem.wdthLen ?? item.wdthLen ?? '-',
|
||||
vrtcLen: formattedItem.vrtcLen ?? item.vrtcLen ?? '-',
|
||||
altdVl: formattedItem.altdVl ?? item.altdVl ?? '-',
|
||||
dpthlVl: formattedItem.dpthlVl ?? item.dpthlVl ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_swage_pmstn': {
|
||||
// 하수펌프장
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
swagePmstnNm: formattedItem.swagePmstnNm ?? item.swagePmstnNm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
dailyPrcsCpct: formattedItem.dailyPrcsCpct ?? item.dailyPrcsCpct ?? '-',
|
||||
maxImpndCpct: formattedItem.maxImpndCpct ?? item.maxImpndCpct ?? '-',
|
||||
altdVl: formattedItem.altdVl ?? item.altdVl ?? '-',
|
||||
wtlvVl: formattedItem.wtlvVl ?? item.wtlvVl ?? '-',
|
||||
exclnWpmpAbltVl: formattedItem.exclnWpmpAbltVl ?? item.exclnWpmpAbltVl ?? '-'
|
||||
};
|
||||
}
|
||||
case 'tb_ms_stofcbr': {
|
||||
// 우수토실
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '-',
|
||||
mapshtNo: formattedItem.mapshtNo ?? item.mapshtNo ?? '-',
|
||||
ctpvNm: ctpvMap.get(ctpvCd) ?? formattedItem.ctpvNm ?? '-',
|
||||
sggNm: sggMap.get(sggCd) ?? formattedItem.sggNm ?? '-',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '-',
|
||||
worflwWallHgt: formattedItem.worflwWallHgt ?? item.worflwWallHgt ?? '-',
|
||||
swageMhlMngNo: formattedItem.swageMhlMngNo ?? item.swageMhlMngNo ?? '-',
|
||||
drtnAngl: formattedItem.drtnAngl ?? item.drtnAngl ?? '-'
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
|
||||
const excelData = mappedContent; // 배열로 감싸서 전달
|
||||
|
||||
// 파일명 생성 (분석번호 기반)
|
||||
const label = BASIC_TYPES.find((type) => type.val === basicType)?.text
|
||||
const fileName = `${label} 조회 결과_${todayYear}${todayMonth}${todayDate}`;
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: excelData as JSON[],
|
||||
fileName: fileName,
|
||||
sheetNameArray: [fileName],
|
||||
headerRange: headerRange,
|
||||
headerMapping: headerMapping
|
||||
});
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
console.error("Excel 다운로드 중 오류 발생:", error);
|
||||
alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 운영정보 Excel 다운로드 핸들러 추가
|
||||
const operationExcelDownload = async () => {
|
||||
if (tableData.length === 0) {
|
||||
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.dismiss("global-confirm-toast");
|
||||
|
||||
confirmToast(
|
||||
"파일 다운로드에는 2분 내외의 시간이 소요될 수 있습니다.\n파일 다운로드를 진행하시겠습니까?",
|
||||
onAnalysis ?? (() => { }),
|
||||
"text-xl font-medium text-gray-800"
|
||||
);
|
||||
|
||||
async function onAnalysis() {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
size: '10000',
|
||||
};
|
||||
if (var1) RequestDTO.bizInfoNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTypeCd = var2;
|
||||
// 수행기간 범위
|
||||
const startDate = getDateString(
|
||||
yearFilter.start,
|
||||
'',
|
||||
'',
|
||||
"19000101",
|
||||
);
|
||||
const endDate = getDateString(
|
||||
yearFilter.end,
|
||||
'',
|
||||
'',
|
||||
`${todayYear}${todayMonth}${todayDate}`,
|
||||
);
|
||||
RequestDTO.fromflfmtEndYmd = startDate;
|
||||
RequestDTO.toflfmtEndYmd = endDate;
|
||||
|
||||
// JSON.parse 사용으로 문자열 -> 배열 변환
|
||||
RequestDTO.workTypes = JSON.parse(workType.replace(/'/g, '"'));
|
||||
|
||||
const params = new URLSearchParams(RequestDTO).toString();
|
||||
const res = await getData(`v1/bizInfo?${params}`);
|
||||
|
||||
// 헤더 매핑 정의
|
||||
const headerMapping: { [key: string]: string } = {
|
||||
'bizInfoNm': '사업명',
|
||||
'flfmtBgngYmd': '수행시작일자',
|
||||
'flfmtEndYmd': '수행종료일자',
|
||||
'flfmtYr': '수행년도',
|
||||
'bizTypeCd': '사업유형',
|
||||
'bizAmt': '사업금액(원)',
|
||||
};
|
||||
|
||||
const bizTyCdMap = new Map(BIZ_TY_CD.map(code => [code.lwpoCd, code.lwpoCdNm]));
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
return {
|
||||
bizInfoNm: formattedItem.bizInfoNm ?? item.bizInfoNm ?? '',
|
||||
flfmtBgngYmd: formattedItem.flfmtBgngYmd ?? item.flfmtBgngYmd ?? '',
|
||||
flfmtEndYmd: formattedItem.flfmtEndYmd ?? item.flfmtEndYmd ?? '',
|
||||
flfmtYr: formattedItem.flfmtYr ?? item.flfmtYr ?? '',
|
||||
bizTypeCd: bizTyCdMap.get(item.bizTypeCd) || item.bizTypeCd || formattedItem.bizTypeCd || '',
|
||||
bizAmt: ((v) => (v === 0 || v === '0') ? '0' : (v ?? ''))(formattedItem.bizAmt ?? item.bizAmt),
|
||||
};
|
||||
});
|
||||
|
||||
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
|
||||
const excelData = mappedContent; // 배열로 감싸서 전달
|
||||
|
||||
// 파일명 생성 (분석번호 기반)
|
||||
const label = WORK_TYPES.find((type) => type.val === workType)?.text
|
||||
const fileName = `${label} 사업 현황_${todayYear}${todayMonth}${todayDate}`;
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: excelData as JSON[],
|
||||
fileName: fileName,
|
||||
sheetNameArray: [fileName],
|
||||
headerRange: "A1:F1",
|
||||
headerMapping: headerMapping
|
||||
});
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
console.error("Excel 다운로드 중 오류 발생:", error);
|
||||
alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 운영정보 Excel 다운로드 핸들러 추가
|
||||
const operationResultExcelDownload = async () => {
|
||||
if (detailTableData.length === 0) {
|
||||
alert("다운로드 할 Excel 파일이 없습니다.\n조회 후 다시 시도해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.dismiss("global-confirm-toast");
|
||||
|
||||
confirmToast(
|
||||
"파일 다운로드에는 2분 내외의 시간이 소요될 수 있습니다.\n파일 다운로드를 진행하시겠습니까?",
|
||||
onAnalysis ?? (() => { }),
|
||||
"text-xl font-medium text-gray-800"
|
||||
);
|
||||
|
||||
async function onAnalysis() {
|
||||
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
size: '10000',
|
||||
bizId: String(detailBizId),
|
||||
};
|
||||
|
||||
const apiStartTime = performance.now();
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
const apiEndTime = performance.now();
|
||||
|
||||
const mappingStartTime = performance.now();
|
||||
// 헤더 매핑 정의
|
||||
const headerMapping: { [key: string]: string } = {
|
||||
'fcltMngNo': '관리번호',
|
||||
'swtrmt_zone_nm': '처리구역',
|
||||
'usgCd': '용도',
|
||||
'mqltCd': '재질',
|
||||
'pdmtVl': '관경(mm)',
|
||||
'prlgVl': '연장(m)',
|
||||
'instlYmd': '설치일자',
|
||||
'strc_stts_grd': '구조적 상태등급',
|
||||
'oper_stts_grd': '운영적 상태등급',
|
||||
};
|
||||
|
||||
const usgCdMap = new Map(MS_SWAGE_PPL_USE_CODES.map(code => [code.val, code.text]));
|
||||
const mqltCdMap = new Map(MS_SWAGE_PPL_CODES.map(code => [code.val, code.text]));
|
||||
|
||||
// 🎯 단일 반복문으로 최적화 - 각 아이템마다 필요한 필드만 직접 매핑
|
||||
const mappedData = (res.data || []).map((item: any) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
// trim 한 번만 수행
|
||||
const trimmedUsgCd = item?.usgCd?.trim();
|
||||
const trimmedMqltCd = item?.mqltCd?.trim();
|
||||
|
||||
// zone 값 한 번만 계산
|
||||
const zone = item.swtrmtZoneNm ?? formattedItem.swtrmt_zone_nm ?? item.swtrmt_zone_nm ?? '';
|
||||
|
||||
// 직접 매핑 - 반복문 없이 한 번에 객체 생성
|
||||
return {
|
||||
fcltMngNo: formattedItem.fcltMngNo ?? item.fcltMngNo ?? '',
|
||||
swtrmt_zone_nm: (zone === null || zone === '') ? '-' : zone,
|
||||
usgCd: usgCdMap.get(trimmedUsgCd) || item.usgCd || formattedItem.usgCd || '',
|
||||
mqltCd: mqltCdMap.get(trimmedMqltCd) || item.mqltCd || formattedItem.mqltCd || '',
|
||||
pdmtVl: formattedItem.pdmtVl ?? item.pdmtVl ?? '',
|
||||
prlgVl: formattedItem.prlgVl ?? item.prlgVl ?? '',
|
||||
instlYmd: formattedItem.instlYmd ?? item.instlYmd ?? '',
|
||||
strc_stts_grd: ((v) => (v === 0 || v === '0') ? '0' : (v ?? ''))(formattedItem.strc_stts_grd ?? item.strc_stts_grd),
|
||||
oper_stts_grd: ((v) => (v === 0 || v === '0') ? '0' : (v ?? ''))(formattedItem.oper_stts_grd ?? item.oper_stts_grd),
|
||||
};
|
||||
});
|
||||
|
||||
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
|
||||
const excelData = mappedData; // 배열로 감싸서 전달
|
||||
|
||||
// 파일명 생성 (분석번호 기반)
|
||||
const label = WORK_TYPES.find((type) => type.val === workType)?.text
|
||||
const fileName = `${label} 결과표_${todayYear}${todayMonth}${todayDate}`;
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: excelData as JSON[],
|
||||
fileName: fileName,
|
||||
sheetNameArray: [fileName],
|
||||
headerRange: "A1:I1",
|
||||
headerMapping: headerMapping
|
||||
});
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
console.error("Excel 다운로드 중 오류 발생:", error);
|
||||
alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 여러 시설 보기
|
||||
const viewMultipleFeature = async () => {
|
||||
if (activeTab === 'basic') {
|
||||
if (!(tableData.length === 0)) {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = tableData[0];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fids = tableData.map((item) => item.fid);
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showMultipleSearchResultsFromGeoJSON(layerNm, fids);
|
||||
setIsLoading(false);
|
||||
onOpenChange(false);
|
||||
}
|
||||
} else if (activeTab === 'operation') {
|
||||
if (!(detailTableData.length === 0)) {
|
||||
setIsLoading(true);
|
||||
|
||||
const row = detailTableData[0];
|
||||
const layerNm = row.lyrTypeNm;
|
||||
const fids = detailTableData.map((item) => item.fid);
|
||||
const core = GisApp.Module.layer as any;
|
||||
await core.showMultipleSearchResultsFromGeoJSON(layerNm, fids);
|
||||
setIsLoading(false);
|
||||
onOpenChange(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
open, onOpenChange, onFeatureSelect,
|
||||
TABS,
|
||||
getDateString,
|
||||
handleSearch,
|
||||
handleBasicCellClick,
|
||||
handleOperationCellClick,
|
||||
handleOperationPageNation,
|
||||
handleOperationResultCellClick,
|
||||
basicExcelDownload,
|
||||
operationExcelDownload,
|
||||
operationResultExcelDownload,
|
||||
viewMultipleFeature,
|
||||
};
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React, { useRef, useEffect, useState } from "react";
|
||||
import { Label } from "@common/components/ui/label";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export const WATER_DEPTH_LAYER_TYPES: string[] = [
|
||||
'tb_ms_flood_dngr_map',
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
// FileUpload.js
|
||||
import React, { useState } from 'react';
|
||||
import axios from 'axios';
|
||||
const SEWERAGE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
|
||||
const SEWERAGE_URL = "/sewerage-service/api";
|
||||
|
||||
function FileUpload() {
|
||||
const [file, setFile] = useState(null);
|
||||
const [text, setText] = useState('');
|
||||
|
||||
const handleFileChange = (e) => {
|
||||
const handleFileChange = (e: any) => {
|
||||
setFile(e.target.files[0]);
|
||||
};
|
||||
|
||||
const handleTextChange = (e) => {
|
||||
const handleTextChange = (e: any) => {
|
||||
setText(e.target.value);
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ function FileUpload() {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const handleFindUser = (e) => {
|
||||
const handleFindUser = () => {
|
||||
const auth = getCookie("Authorization");
|
||||
if (auth) console.log("쿠키 auth : " + auth);
|
||||
fetch(SEWERAGE_URL+"/v1/inftwtAnls/users/65a00f65-8460-49af-98ec-042977e56f4b", {
|
||||
@@ -37,7 +37,7 @@ function FileUpload() {
|
||||
console.log(data);
|
||||
});
|
||||
};
|
||||
const handleFindUserOna = (e) => {
|
||||
const handleFindUserOna = () => {
|
||||
const auth = getCookie("Authorization");
|
||||
if (auth) console.log("쿠키 auth : " + auth);
|
||||
fetch("/server/user-service/api/v1/users/65a00f65-8460-49af-98ec-042977e56f4b").then((data) => {
|
||||
@@ -45,7 +45,7 @@ function FileUpload() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (!file) {
|
||||
|
||||
@@ -100,7 +100,7 @@ const Page = () => {
|
||||
alert('파일을 선택해주세요')
|
||||
return false
|
||||
}
|
||||
handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm)
|
||||
handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm);
|
||||
}
|
||||
|
||||
// 선택 파일 삭제
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import axios from 'axios';
|
||||
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || '';
|
||||
const BASE_URL = '/sewerage-service/api';
|
||||
|
||||
export const getData = async (url: string): Promise<any> => {
|
||||
const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, {
|
||||
@@ -80,12 +80,15 @@ export const deleteData = async (url: string, data?: object): Promise<any> => {
|
||||
};
|
||||
|
||||
// DC API 호출
|
||||
export const getDcData = async (url: string, data?: object): Promise<any> => {
|
||||
export const getDcData = async (url: string, resType: string = "json"): Promise<any> => {
|
||||
const res = await fetch('/dc-service' + url, {
|
||||
method: "GET",
|
||||
});
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
let data;
|
||||
if (resType === "json") data = await res.json();
|
||||
else if (resType === "blob") data = await res.blob();
|
||||
|
||||
return data;
|
||||
}
|
||||
throw new Error('Failed to fetch data');
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_SERVER_API_URL || '';
|
||||
|
||||
export const handleDownload = async (api:string, fileNm:string) => {
|
||||
try {
|
||||
const response = await fetch(api, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('파일 다운로드 실패');
|
||||
}
|
||||
export const handleDownload = async (api: string, fileNm: string) => {
|
||||
try {
|
||||
const response = await fetch(api, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (!response.ok) throw new Error('파일 다운로드 실패');
|
||||
|
||||
const blob = await response.blob();
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const blob = await response.blob();
|
||||
fileDownload(blob, fileNm);
|
||||
} catch (error) {
|
||||
console.error('다운로드 중 오류 발생:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 다운로드를 트리거할 가짜 <a> 태그 생성
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileNm.normalize('NFC'); // 원하는 파일명 지정
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// 메모리 해제
|
||||
link.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
} catch (error) {
|
||||
console.error('다운로드 중 오류 발생:', error);
|
||||
}
|
||||
};
|
||||
export const fileDownload = (data: Blob, fileName: string) => { // Blob데이터 임시link로 연결
|
||||
const url = window.URL.createObjectURL(data);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName; // 원하는 파일명 지정
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// 메모리 해제
|
||||
link.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import useReportTab, { type Folder, type ReportDataFile } from '../(map-layout)/map/searchModal/useReportTab';
|
||||
import { create } from 'zustand';
|
||||
import { getDcData } from '@/components/lib/api';
|
||||
|
||||
interface useReportTabStoreType {
|
||||
isOpen: boolean;
|
||||
files: ReportDataFile[];
|
||||
dcTree: Folder[];
|
||||
dcFiles: ReportDataFile[];
|
||||
setIsOpen: (open: boolean) => void;
|
||||
setFiles: (files: ReportDataFile[]) => void;
|
||||
fetchDcTree: (clsfSystmNm: string) => void;
|
||||
fetchDcFiles: (clsfSystmNm: string) => void;
|
||||
}
|
||||
export const useReportTabStore = create<useReportTabStoreType>((set, get) => ({
|
||||
isOpen: false,
|
||||
files: [],
|
||||
dcTree: [],
|
||||
dcFiles: [],
|
||||
setIsOpen: (open: boolean) => set({ isOpen: open }),
|
||||
setFiles: (files: ReportDataFile[]) => set({ files }),
|
||||
fetchDcTree: async (clsfSystmNm: string) => {
|
||||
const { dcTree } = get();
|
||||
try {
|
||||
const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm);
|
||||
if (result && JSON.stringify(result) !== JSON.stringify(dcTree))
|
||||
set({ dcTree: result });
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch DC tree:', error);
|
||||
}
|
||||
},
|
||||
fetchDcFiles: async (clsfSystmNm: string) => {
|
||||
const { getDcFiles } = useReportTab();
|
||||
const { dcFiles } = get();
|
||||
try {
|
||||
const result = await getDcFiles(clsfSystmNm);
|
||||
if (result && JSON.stringify(result) !== JSON.stringify(dcFiles))
|
||||
set({ dcFiles: result });
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch DC files:', error);
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -1,5 +1,4 @@
|
||||
import { create } from "zustand";
|
||||
import { type SelectDataType } from "@common/business_components";
|
||||
|
||||
|
||||
// 날짜 조합 함수
|
||||
@@ -23,6 +22,8 @@ const todayMonth = (today.getMonth() + 1).toString().padStart(2, "0");
|
||||
const todayDate = today.getDate().toString().padStart(2, "0");
|
||||
|
||||
export interface SearchModalState {
|
||||
// 모달 열림 상태
|
||||
isSearchModalOpen: boolean;
|
||||
// 탭 관련
|
||||
activeTab: string;
|
||||
basicType: string;
|
||||
@@ -67,9 +68,9 @@ export interface SearchModalState {
|
||||
todayYear: string;
|
||||
todayMonth: string;
|
||||
todayDate: string;
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
|
||||
// setters
|
||||
setIsSearchModalOpen: (open: boolean) => void;
|
||||
setActiveTab: (tab: string) => void;
|
||||
setBasicType: (type: string) => void;
|
||||
setWorkType: (type: string) => void;
|
||||
@@ -98,11 +99,13 @@ export interface SearchModalState {
|
||||
setVar1: (val: string) => void;
|
||||
setVar2: (val: string) => void;
|
||||
setYearFilter: (filter: { start: string; end: string }) => void;
|
||||
// 초기화 액션
|
||||
resetFilters: () => void;
|
||||
|
||||
getDateString: (year: string, month: string, day: string, defaultDate: string) => string;
|
||||
resetFilters: () => void; // 초기화 액션
|
||||
}
|
||||
|
||||
const useSearchModalStore = create<SearchModalState>((set) => ({
|
||||
isSearchModalOpen: false,
|
||||
activeTab: "basic",
|
||||
basicType: "tb_ms_swage_ppl",
|
||||
workType: "['200', '201', '204']",
|
||||
@@ -135,7 +138,7 @@ const useSearchModalStore = create<SearchModalState>((set) => ({
|
||||
todayYear,
|
||||
todayMonth,
|
||||
todayDate,
|
||||
getDateString,
|
||||
setIsSearchModalOpen: (isSearchModalOpen) => set({ isSearchModalOpen }),
|
||||
setActiveTab: (tab) => set({ activeTab: tab }),
|
||||
setBasicType: (type) => set({ basicType: type }),
|
||||
setWorkType: (type) => set({ workType: type }),
|
||||
@@ -164,7 +167,8 @@ const useSearchModalStore = create<SearchModalState>((set) => ({
|
||||
setVar1: (val) => set({ var1: val }),
|
||||
setVar2: (val) => set({ var2: val }),
|
||||
setYearFilter: (filter) => set({ yearFilter: filter }),
|
||||
|
||||
|
||||
getDateString: getDateString,
|
||||
// 초기화 액션
|
||||
resetFilters: () =>
|
||||
set({
|
||||
|
||||
+68
-56
@@ -1,5 +1,4 @@
|
||||
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";
|
||||
@@ -9,23 +8,56 @@ const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
|
||||
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
|
||||
const DC_URL = process.env.NEXT_PUBLIC_DC_URL || "";
|
||||
|
||||
/** 공통: URLSearchParams의 값을 decodeURIComponent 적용하여 querystring 생성 */
|
||||
function toDecodedQueryString(params: URLSearchParams): string {
|
||||
const entries: string[][] = Array.from(params.entries()).map(([k, v]) => {
|
||||
try {
|
||||
return [k, decodeURIComponent(v)] as string[];
|
||||
} catch {
|
||||
return [k, v] as string[];
|
||||
}
|
||||
});
|
||||
return new URLSearchParams(entries).toString();
|
||||
}
|
||||
|
||||
/** 공통: 요청 헤더에 쿠키 기반 인증 값 주입 */
|
||||
function buildAuthHeaders(req: NextRequest): Headers {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const token = req.cookies.get(CLAIM_NAME)?.value;
|
||||
const userId = req.cookies.get(AUTH_USER_ID)?.value;
|
||||
if (token) requestHeaders.set(CLAIM_NAME, token);
|
||||
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
|
||||
return requestHeaders;
|
||||
}
|
||||
|
||||
/** 공통: rewrite 응답 생성 (헤더 주입 여부 선택) */
|
||||
function rewriteWith(url: string, req: NextRequest, withAuth = false): NextResponse {
|
||||
return withAuth
|
||||
? NextResponse.rewrite(new URL(url), { headers: buildAuthHeaders(req) })
|
||||
: NextResponse.rewrite(new URL(url));
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
console.log("Middleware 진입:", req.nextUrl.pathname);
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
if (pathname.startsWith("/server")) {
|
||||
|
||||
const decodedParams = Array.from(searchParams.entries())
|
||||
.map(([key, value]) => `${key}=${decodeURIComponent(value)}`)
|
||||
.join("&");
|
||||
|
||||
const newUrl = `${SERVER_API_URL}${pathname.replace("/server", "")}${
|
||||
decodedParams ? `?${decodedParams}` : ""
|
||||
}`;
|
||||
return NextResponse.rewrite(new URL(newUrl));
|
||||
const decodedQuery = toDecodedQueryString(searchParams);
|
||||
const newUrl = `${SERVER_API_URL}${pathname.replace("/server", "")}${decodedQuery ? `?${decodedQuery}` : ""
|
||||
}`;
|
||||
console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`);
|
||||
return rewriteWith(newUrl, req, true);
|
||||
}
|
||||
|
||||
|
||||
if (pathname.startsWith("/api/proxy")) {
|
||||
const decodedQuery = toDecodedQueryString(searchParams);
|
||||
const newUrl = `${SERVER_API_URL}${pathname}${decodedQuery ? `?${decodedQuery}` : ""
|
||||
}`;
|
||||
console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`);
|
||||
return rewriteWith(newUrl, req, true);
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/geoserver")) {
|
||||
let queryParams = searchParams.toString();
|
||||
const typename = searchParams.get("TYPENAME");
|
||||
@@ -57,66 +89,45 @@ export function middleware(req: NextRequest) {
|
||||
|| typename == "hasudo:tb_wr_htdfl_fclt" //온배수시설
|
||||
|| typename == "hasudo:tb_wr_ruse_fclt_dmd_co" //수요처
|
||||
|| typename == "hasudo:tb_wr_tmpr_dmd_co" //잠재수요처
|
||||
){
|
||||
) {
|
||||
const url = req.nextUrl.clone();
|
||||
url.searchParams.set('TYPENAME', typename.replace("hasudo:",""));
|
||||
url.searchParams.set('TYPENAME', typename.replace("hasudo:", ""));
|
||||
queryParams = url.searchParams.toString();
|
||||
newUrl = `${SEWERAGE_API_URL}/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`;
|
||||
newUrl = `${SEWERAGE_API_URL}/sewerage-service/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`;
|
||||
}
|
||||
|
||||
console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`);
|
||||
return NextResponse.rewrite(new URL(newUrl));
|
||||
}
|
||||
|
||||
if (
|
||||
pathname.startsWith("/attach-service") ||
|
||||
pathname.startsWith("/cms-service")
|
||||
|
||||
if (pathname.startsWith("/attach-service")
|
||||
|| pathname.startsWith("/cms-service")
|
||||
|| pathname.startsWith("/user-service")
|
||||
) {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const token = req.cookies.get(CLAIM_NAME)?.value;
|
||||
const userId = req.cookies.get(AUTH_USER_ID)?.value;
|
||||
const newUrl = `${SERVER_API_URL}${pathname}`;
|
||||
|
||||
if (token) requestHeaders.set(CLAIM_NAME, token);
|
||||
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
|
||||
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/attach-service' path to: ${newUrl}`,
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
const decodedQuery = toDecodedQueryString(searchParams);
|
||||
const newUrl = `${SERVER_API_URL}${pathname}${decodedQuery ? `?${decodedQuery}` : ""}`;
|
||||
console.log(`[Middleware] Rewriting from '${pathname}' path to: ${newUrl}`);
|
||||
return rewriteWith(newUrl, req, true);
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/user-service")) {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const newUrl = `${SERVER_API_URL}${pathname}`;
|
||||
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/user-service' path to: ${newUrl}`,
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/dc-service")) {
|
||||
const requestHeaders = new Headers(req.headers);
|
||||
const decodedParams = Array.from(searchParams.entries())
|
||||
.map(([key, value]) => `${key}=${decodeURIComponent(value)}`)
|
||||
.join("&");
|
||||
|
||||
const newUrl = `${DC_URL}${pathname}${decodedParams ? `?${decodedParams}` : ""}`;
|
||||
console.log(
|
||||
`[Middleware] Rewriting from '/dc-service' path to: ${newUrl}`,
|
||||
);
|
||||
return NextResponse.rewrite(new URL(newUrl), {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
const decodedQuery = toDecodedQueryString(searchParams);
|
||||
const newUrl = `${DC_URL}${pathname}${decodedQuery ? `?${decodedQuery}` : ""}`;
|
||||
console.log(`[Middleware] Rewriting from '${pathname}' path to: ${newUrl}`);
|
||||
return rewriteWith(newUrl, req, true);
|
||||
}
|
||||
|
||||
if (pathname.startsWith("/sewerage-service")) {
|
||||
const decodedQuery = toDecodedQueryString(searchParams);
|
||||
const newUrl = `${SEWERAGE_API_URL}${pathname}${decodedQuery ? `?${decodedQuery}` : ""}`;
|
||||
console.log(`[Middleware] Rewriting from '${pathname}' path to: ${newUrl}`);
|
||||
return rewriteWith(newUrl, req, true);
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/server/:path*",
|
||||
@@ -125,6 +136,7 @@ export const config = {
|
||||
"/user-service/:path*",
|
||||
"/cms-service/:path*",
|
||||
"/dc-service/:path*",
|
||||
"/sewerage-service/:path*",
|
||||
],
|
||||
|
||||
};
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
"react-hook-form": "^7.54.2",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"tus-js-client": "^4.3.1",
|
||||
"xlsx": "^0.18.5",
|
||||
"xlsx-populate": "^1.21.0",
|
||||
"zod": "^3.24.2",
|
||||
"zustand": "^5.0.3",
|
||||
"ol": "^7.3.0",
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
"@common/business_components/*": ["../../../packages/common/business_components/src/*"],
|
||||
"@common/network": ["../../../packages/common/network/"],
|
||||
"@common/config": ["../../../packages/common/config/dist/"],
|
||||
"@utils": ["../app/components/lib/utils"],
|
||||
"@/components/*": ["../app/components/*"]
|
||||
"@/app/*": ["../app/*"],
|
||||
"@/components/*": ["../app/components/*"],
|
||||
"@/utils": ["../app/components/lib/utils"],
|
||||
"@/store/*": ["../app/store/*"],
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
|
||||
@@ -28,4 +28,4 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_
|
||||
|
||||
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
|
||||
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
|
||||
@@ -21,7 +21,7 @@ NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BE
|
||||
|
||||
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PUBLIC_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA=
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA=
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const Map = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 항상 같은 select 객체 사용
|
||||
const select = GisApp.Module.select as any;
|
||||
if (!select) return;
|
||||
@@ -107,6 +108,8 @@ const Map = () => {
|
||||
if (popUpClick) {
|
||||
const layerName = getWrLayerNm(data);
|
||||
const featurePk = getWrFeaturePk(layerName ?? "");
|
||||
|
||||
|
||||
// 재이용시설
|
||||
if (featurePk) {
|
||||
const lastPk =
|
||||
@@ -114,6 +117,7 @@ const Map = () => {
|
||||
? data[featurePk].replaceAll("-", "")
|
||||
: data[featurePk];
|
||||
featureId = `${layerName}.${lastPk}`;
|
||||
|
||||
} else {
|
||||
console.warn("해당 피처는 선택된 레이어에서 찾을수 없습니다.");
|
||||
}
|
||||
@@ -160,7 +164,6 @@ const Map = () => {
|
||||
setFeatureData(data);
|
||||
setIsOpen(true);
|
||||
setIsSearchModalOpen(false);
|
||||
|
||||
if (
|
||||
popUpClick &&
|
||||
foundFeature &&
|
||||
@@ -181,6 +184,7 @@ const Map = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (isFeatured) {
|
||||
|
||||
onFeatureSelect(isFeatured);
|
||||
}
|
||||
}, [isFeatured]);
|
||||
@@ -189,6 +193,7 @@ const Map = () => {
|
||||
const bc = new BroadcastChannel("mapDetailPopUp");
|
||||
bc.onmessage = (event) => {
|
||||
if (event.data.type === "SELECT_FEATURE") {
|
||||
|
||||
onFeatureSelect(event.data.feature, true);
|
||||
closePopup();
|
||||
}
|
||||
@@ -263,8 +268,10 @@ const overlayFormatter = async (feature: any, props: any) => {
|
||||
feature.getId?.() ?? p?.id ?? p?.fid ?? p?.ftrIdn ?? '';
|
||||
if (!featureId) return null;
|
||||
|
||||
|
||||
const tableId = String(featureId).split('.')[0]??'';
|
||||
const fcltCd = getFeatureCd(props, tableId);
|
||||
|
||||
if (!fcltCd) return null;
|
||||
|
||||
let data: any = null;
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function MapFeaturePopup() {
|
||||
coSttnMapDetail
|
||||
} = useWrStore((state) => state);
|
||||
const { pbnMapHeadList } = pbnMap;
|
||||
const [isDetail, setIsDetail] = useState<any>(null);
|
||||
const [isDetail, setIsDetail] = useState<any>(undefined);
|
||||
const [layerNm, setLayerNm] = useState<string>();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
@@ -46,15 +46,27 @@ export default function MapFeaturePopup() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if(isDetail ===null){
|
||||
alert("해당시설은 X,Y좌표를 찾을수 없어 위치를 찾을수 없습니다.");
|
||||
window.close(); // isDetail이 null이면 팝업 닫기
|
||||
}
|
||||
console.log("isDetail", isDetail);
|
||||
}, [isDetail]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log(' layerNm ' , layerNm)
|
||||
if (isFeatureCd && layerNm) {
|
||||
if (layerNm === "tb_wr_bdst_ruse_fclt") {
|
||||
setIsDetail(isFeatureCd);
|
||||
} else if (layerNm === "tb_il_swage_prcs_fclt") {
|
||||
pbnMapDetaile(isFeatureCd).then((res) => {
|
||||
setIsDetail(res);
|
||||
console.log('res', res)
|
||||
setIsDetail([res]);
|
||||
});
|
||||
} else if (layerNm === "tb_wr_rnwtr_utztn_fclt") {
|
||||
rainMapDetile(isFeatureCd).then((res) => {
|
||||
|
||||
setIsDetail(res);
|
||||
});
|
||||
} else if (layerNm === "tb_wr_rswtr_fclt") {
|
||||
@@ -78,7 +90,7 @@ export default function MapFeaturePopup() {
|
||||
}
|
||||
}, [isFeatureCd, layerNm]);
|
||||
|
||||
if (!isDetail) return null; // 데이터 없으면 아무것도 안 그림
|
||||
if (isDetail === undefined) return null; // 데이터 없으면 아무것도 안 그림
|
||||
return (
|
||||
<>
|
||||
{isDetail ? (
|
||||
|
||||
@@ -40,6 +40,14 @@ import { useForm, useWatch } from "react-hook-form";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
/**
|
||||
* 📄 CoMatRvw 수요매칭 검토
|
||||
* Next.js App Router (app/) 기반 페이지 컴포넌트 예시
|
||||
*
|
||||
* - 대민에서 신청하는 수요처의 수요등록 정보를 운영담당자가 수요 매칭 검토를 진행한다.
|
||||
* - 전체적으로 form을 만들어서 form안에 데이터를 넣고 api를 호출하여 저장한다.
|
||||
*/
|
||||
export default function CoMatRvw() {
|
||||
const { auth, code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
|
||||
useWrStore((state) => state);
|
||||
@@ -70,6 +78,9 @@ export default function CoMatRvw() {
|
||||
);
|
||||
const [selectionVersion, setSelectionVersion] = useState(0);
|
||||
|
||||
|
||||
|
||||
//수요 매칭 검색
|
||||
const getSearch = (
|
||||
startYear: number,
|
||||
endYear: number,
|
||||
@@ -117,7 +128,7 @@ export default function CoMatRvw() {
|
||||
if (coMatRvwRes && coMatRvwRes.length > 0) {
|
||||
const data = coMatRvwRes?.map((item) => {
|
||||
let flag = "";
|
||||
|
||||
// 수요처의 매칭된 정보를 확인할수 있도록 한다.
|
||||
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg || undefined);
|
||||
|
||||
return {
|
||||
@@ -227,9 +238,9 @@ export default function CoMatRvw() {
|
||||
</div>
|
||||
</div>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col space-x-2 ">
|
||||
<div className="space-y">
|
||||
<div className="flex flex-row space-x-2">
|
||||
<div className="flex flex-row w-full justify-end space-x-2 mt-6">
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
@@ -585,7 +596,7 @@ export default function CoMatRvw() {
|
||||
control={form.control}
|
||||
name="ph"
|
||||
render={({ field }) => (
|
||||
<FormUi label="수소이온농도(ph)">
|
||||
<FormUi label="수소이온농도(pH)">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="relative flex-1 min-w-0">
|
||||
<Input
|
||||
|
||||
@@ -6,18 +6,18 @@ import { excelDownload, getCity } from "@/components/lib/func/commom";
|
||||
import RuseCaseMngExcel from "@/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal";
|
||||
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
filePickedBlobArray,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
type SelectDataType,
|
||||
type SheetParameter,
|
||||
ContentsDiv,
|
||||
filePickedBlobArray,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
type SelectDataType,
|
||||
type SheetParameter,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
@@ -26,277 +26,294 @@ import toast, { Toaster } from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function RuseCaseMng() {
|
||||
const { code, ruseCaseMng, selectRuseCaseMng, ruseCaseMngInit } = useWrStore((state) => state);
|
||||
const { ruseCaseMngList, status, count, excelList } = ruseCaseMng;
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>([]);
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
|
||||
const { code, ruseCaseMng, selectRuseCaseMng, ruseCaseMngInit } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { ruseCaseMngList, status, count, excelList } = ruseCaseMng;
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>([]);
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({
|
||||
sgg: "",
|
||||
city: "",
|
||||
});
|
||||
|
||||
const [sidoCd, setSidoCd] = useState<string>("");
|
||||
const [sigunguCd, setSigunguCd] = useState<string>("");
|
||||
// const [selectUtz, setSelectUtz] = useState<string[] | []>(["조경용수"]);
|
||||
const [selectUtz, setSelectUtz] = useState<string>("");
|
||||
const [name, setName] = useState<string>("");
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const { t } = useTranslation('base');
|
||||
const [sidoCd, setSidoCd] = useState<string>("");
|
||||
const [sigunguCd, setSigunguCd] = useState<string>("");
|
||||
// const [selectUtz, setSelectUtz] = useState<string[] | []>(["조경용수"]);
|
||||
const [selectUtz, setSelectUtz] = useState<string>("");
|
||||
const [name, setName] = useState<string>("");
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
// 물재이용사례 조회
|
||||
const searchRuseCaseMng = async (isExcel: boolean, pageNo: number, pageSize: number) => {
|
||||
await selectRuseCaseMng(
|
||||
isExcel,
|
||||
pageNo,
|
||||
pageSize,
|
||||
sidoCd ?? "",
|
||||
sigunguCd ?? "",
|
||||
selectUtz ?? "",
|
||||
name ?? ""
|
||||
);
|
||||
// 엑셀 등록 모달
|
||||
const [isExcelOpen, setIsExcelOpen] = useState<boolean>(false);
|
||||
|
||||
// 물재이용사례 조회
|
||||
|
||||
useEffect(() => {
|
||||
ruseCaseMngInit();
|
||||
}, []);
|
||||
|
||||
// 시도 선택
|
||||
const getSelCity = (val: string | number) => {
|
||||
const cityValue = String(val);
|
||||
const cityText = code.cityCd.find(
|
||||
(item: { val: string; text: string }) => item.val === cityValue
|
||||
)?.text;
|
||||
setSidoCd(cityText || "");
|
||||
const data = getCity(cityValue, code.sggCd);
|
||||
setSelectSgg(data);
|
||||
setObjSearch({ city: cityValue, sgg: "" });
|
||||
};
|
||||
|
||||
// 시군구 선택
|
||||
const getSgg = (val: string | number) => {
|
||||
const sggValue = String(val);
|
||||
const sggText = selectSgg?.find(
|
||||
(item: { val: string; text: string }) => item.val === sggValue
|
||||
)?.text;
|
||||
setSigunguCd(sggText || "");
|
||||
setObjSearch({ ...objSearch, sgg: String(val) });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList !== undefined && excelList.length === 0) {
|
||||
toast.error(t("excelDownErrMsg"));
|
||||
return;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
ruseCaseMngInit();
|
||||
}, [])
|
||||
|
||||
// 시도 선택
|
||||
const getSelCity = (val: string | number) => {
|
||||
const cityValue = String(val);
|
||||
const cityText = code.cityCd.find((item: { val: string; text: string }) => item.val === cityValue)?.text;
|
||||
setSidoCd(cityText || "");
|
||||
const data = getCity(cityValue, code.sggCd);
|
||||
setSelectSgg(data);
|
||||
setObjSearch({ city: cityValue, sgg: "" });
|
||||
};
|
||||
|
||||
// 시군구 선택
|
||||
const getSgg = (val: string | number) => {
|
||||
const sggValue = String(val);
|
||||
const sggText = selectSgg?.find((item: { val: string; text: string }) => item.val === sggValue)?.text;
|
||||
setSigunguCd(sggText || "");
|
||||
setObjSearch({ ...objSearch, sgg: String(val) });
|
||||
};
|
||||
|
||||
// 엑셀 등록 모달
|
||||
const [isExcelOpen, setIsExcelOpen] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (excelList !== undefined && excelList.length === 0) {
|
||||
toast.error(t('excelDownErrMsg'));
|
||||
return;
|
||||
}
|
||||
fetch(`/sample_ruseCaseMng.xlsx`, {}).then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
// 받은 파일 바인너리 처리
|
||||
const blobRet = await response.arrayBuffer();
|
||||
if(excelList){
|
||||
const excelData1 = excelList.map((item) => {
|
||||
return [
|
||||
item.ruseBizNm,
|
||||
item.bizBgngDate,
|
||||
item.bizEndDate,
|
||||
item.splyFcltKnd,
|
||||
item.splyFcltNm,
|
||||
item.splyFcltCpct,
|
||||
item.dmdFcltNm,
|
||||
item.dmdFcltAddr,
|
||||
item.ruseFcltCpct,
|
||||
item.ruseFcltPplLen,
|
||||
item.ruseFcltUsg,
|
||||
item.ruseFcltSplyCpct,
|
||||
item.ruseFcltPrcsMsrc,
|
||||
item.grnteWqUsg,
|
||||
item.grnteWqGrssClfg,
|
||||
item.grnteWqCombResdch,
|
||||
item.grnteWqTrbt,
|
||||
item.grnteWqBod,
|
||||
item.grnteWqSmll,
|
||||
item.grnteWqCrmty,
|
||||
item.grnteWqTn,
|
||||
item.grnteWqTp,
|
||||
item.grnteWqPh,
|
||||
item.grnteWqClIonQnt,
|
||||
item.grnteWqCndctStat,
|
||||
item.grnteWqRmrk,
|
||||
item.reqBizGrssCst,
|
||||
item.reqBizReuseFcltCst,
|
||||
item.reqBizPplCst,
|
||||
item.reqBizArchCst,
|
||||
item.reqBizMchnCst,
|
||||
item.reqBizMtrngCst,
|
||||
item.reqBizGisCst,
|
||||
item.reqBizCctvCst,
|
||||
item.reqBizCmcnCst,
|
||||
item.reqBizWstCst,
|
||||
item.reqBizDesignCst,
|
||||
item.reqBizSpvsCst,
|
||||
item.reqBizSbsdCst,
|
||||
item.reqBizEtc,
|
||||
item.prcmPlanGrssCst,
|
||||
item.prcmPlanNlep,
|
||||
item.prcmPlanLcep,
|
||||
item.prcmPlanBrdnCst,
|
||||
item.prcmPlanEcqrRt,
|
||||
item.clclnGrssCst,
|
||||
item.clclnNlep,
|
||||
item.clclnLcep,
|
||||
item.clclnBrdnCst,
|
||||
item.clclnEcqrRt,
|
||||
];
|
||||
});
|
||||
|
||||
const sheetParameter: SheetParameter[] = [
|
||||
{
|
||||
data: excelData1,
|
||||
headerNum: 2,
|
||||
headerRange: 'A1:AX1',
|
||||
sheetName: '물재이용사례',
|
||||
startCol: 'A'
|
||||
}
|
||||
];
|
||||
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
|
||||
await filePickedBlobArray(blobRet, '물재이용사례현황', sheetParameter);
|
||||
}
|
||||
fetch(`/sample_ruseCaseMng.xlsx`, {}).then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
// 받은 파일 바인너리 처리
|
||||
const blobRet = await response.arrayBuffer();
|
||||
if (excelList) {
|
||||
const excelData1 = excelList.map((item) => {
|
||||
return [
|
||||
item.ruseBizNm,
|
||||
item.bizBgngDate,
|
||||
item.bizEndDate,
|
||||
item.splyFcltKnd,
|
||||
item.splyFcltNm,
|
||||
item.splyFcltCpct,
|
||||
item.dmdFcltNm,
|
||||
item.dmdFcltAddr,
|
||||
item.ruseFcltCpct,
|
||||
item.ruseFcltPplLen,
|
||||
item.ruseFcltUsg,
|
||||
item.ruseFcltSplyCpct,
|
||||
item.ruseFcltPrcsMsrc,
|
||||
item.grnteWqUsg,
|
||||
item.grnteWqGrssClfg,
|
||||
item.grnteWqCombResdch,
|
||||
item.grnteWqTrbt,
|
||||
item.grnteWqBod,
|
||||
item.grnteWqSmll,
|
||||
item.grnteWqCrmty,
|
||||
item.grnteWqTn,
|
||||
item.grnteWqTp,
|
||||
item.grnteWqPh,
|
||||
item.grnteWqClIonQnt,
|
||||
item.grnteWqCndctStat,
|
||||
item.grnteWqRmrk,
|
||||
item.reqBizGrssCst,
|
||||
item.reqBizReuseFcltCst,
|
||||
item.reqBizPplCst,
|
||||
item.reqBizArchCst,
|
||||
item.reqBizMchnCst,
|
||||
item.reqBizMtrngCst,
|
||||
item.reqBizGisCst,
|
||||
item.reqBizCctvCst,
|
||||
item.reqBizCmcnCst,
|
||||
item.reqBizWstCst,
|
||||
item.reqBizDesignCst,
|
||||
item.reqBizSpvsCst,
|
||||
item.reqBizSbsdCst,
|
||||
item.reqBizEtc,
|
||||
item.prcmPlanGrssCst,
|
||||
item.prcmPlanNlep,
|
||||
item.prcmPlanLcep,
|
||||
item.prcmPlanBrdnCst,
|
||||
item.prcmPlanEcqrRt,
|
||||
item.clclnGrssCst,
|
||||
item.clclnNlep,
|
||||
item.clclnLcep,
|
||||
item.clclnBrdnCst,
|
||||
item.clclnEcqrRt,
|
||||
];
|
||||
});
|
||||
|
||||
const sheetParameter: SheetParameter[] = [
|
||||
{
|
||||
data: excelData1,
|
||||
headerNum: 2,
|
||||
headerRange: "A1:AX1",
|
||||
sheetName: "물재이용사례",
|
||||
startCol: "A",
|
||||
},
|
||||
];
|
||||
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
|
||||
await filePickedBlobArray(blobRet, "물재이용사례현황", sheetParameter);
|
||||
}
|
||||
});
|
||||
}, [excelList]);
|
||||
|
||||
}, [excelList])
|
||||
|
||||
// 양식받기
|
||||
const sampleDownLoad = () => {
|
||||
excelDownload(
|
||||
[[]],
|
||||
"물재이용사례 관리 등록양식",
|
||||
"sample_ruseCaseMng.xlsx",
|
||||
"A1:AX1",
|
||||
2
|
||||
);
|
||||
useEffect(() => {
|
||||
if (status === 200) {
|
||||
setIsExcelOpen(false);
|
||||
}
|
||||
}, [status]);
|
||||
|
||||
useEffect(() => {
|
||||
if (status === 200) {
|
||||
setIsExcelOpen({ isModal: false });
|
||||
}
|
||||
}, [status]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4">
|
||||
<div className="col-span-4">
|
||||
<Title title={"물재이용사례 관리"} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<div className="col-span-8 flex flex-row items-center">
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/3 h-full text-2xl"
|
||||
label="시도"
|
||||
selectClass={""}
|
||||
selectArray={code.cityCd || []}
|
||||
onSelectValue={getSelCity}
|
||||
/>
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/3 h-full text-2xl ml-4"
|
||||
label="시군구"
|
||||
selectClass={""}
|
||||
selectArray={selectSgg || []}
|
||||
onSelectValue={getSgg}
|
||||
/>
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/3 h-full text-2xl ml-4"
|
||||
label="용도"
|
||||
selectClass={""}
|
||||
selectArray={ruseUtzType}
|
||||
onSelectValue={(val) => {
|
||||
if (val) setSelectUtz(String(val));
|
||||
}}
|
||||
value={selectUtz || ruseUtzType[0]?.val}
|
||||
/>
|
||||
<Label className="w-28 text-xl ml-4 mr-6">
|
||||
{"수요처명"}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={"col-span-2 w-1/3 text-2xl"}
|
||||
label=""
|
||||
textValue={name}
|
||||
setText={(e) => {
|
||||
setName(e);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2">
|
||||
<div className="space-y">
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button size={"sm"} onClick={() => {
|
||||
searchRuseCaseMng(false, 1, 10);
|
||||
isResetPage(true);
|
||||
}}>
|
||||
조회
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={() => { setIsExcelOpen({ isModal: true }); }}>
|
||||
엑셀등록
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={() => {
|
||||
selectRuseCaseMng(
|
||||
true,
|
||||
1,
|
||||
count,
|
||||
sidoCd ?? "",
|
||||
sigunguCd ?? "",
|
||||
selectUtz ?? "",
|
||||
name ?? ""
|
||||
);
|
||||
// download()
|
||||
|
||||
|
||||
}} className={"green"}>
|
||||
다운로드
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={() => { sampleDownLoad() }}>
|
||||
양식받기
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4">
|
||||
<div className="col-span-4">
|
||||
<Title title={"물재이용사례 관리"} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<div className="col-span-8 flex flex-row items-center">
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/3 h-full text-2xl"
|
||||
label="시도"
|
||||
selectClass={""}
|
||||
selectArray={code.cityCd || []}
|
||||
onSelectValue={getSelCity}
|
||||
/>
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/3 h-full text-2xl ml-4"
|
||||
label="시군구"
|
||||
selectClass={""}
|
||||
selectArray={selectSgg || []}
|
||||
onSelectValue={getSgg}
|
||||
/>
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/3 h-full text-2xl ml-4"
|
||||
label="용도"
|
||||
selectClass={""}
|
||||
selectArray={ruseUtzType}
|
||||
onSelectValue={(val) => {
|
||||
if (val) setSelectUtz(String(val));
|
||||
}}
|
||||
value={selectUtz || ruseUtzType[0]?.val}
|
||||
/>
|
||||
<Label className="w-28 text-xl ml-4 mr-6">{"수요처명"}</Label>
|
||||
<SearchInput
|
||||
className={"col-span-2 w-1/3 text-2xl"}
|
||||
label=""
|
||||
textValue={name}
|
||||
setText={(e) => {
|
||||
setName(e);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4">
|
||||
<div className="col-span-6">
|
||||
<ListDiv className="overflow-x-auto">
|
||||
<div className="w-[350%]">
|
||||
<UiTable
|
||||
headName={"물재이용사례 현황"}
|
||||
tableData={ruseCaseMngList}
|
||||
headlist={ruseCaseMng.ruseHeadList}
|
||||
pageSize={20}
|
||||
total={count}
|
||||
cellClick={undefined}
|
||||
onPageChange={(pageNo: number) => {
|
||||
searchRuseCaseMng(false, pageNo, 10);
|
||||
isResetPage(false)
|
||||
}}
|
||||
resetPageNo={resetPage}
|
||||
/>
|
||||
</div>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2">
|
||||
<div className="space-y">
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
selectRuseCaseMng(
|
||||
false,
|
||||
1,
|
||||
10,
|
||||
sidoCd ?? "",
|
||||
sigunguCd ?? "",
|
||||
selectUtz ?? "",
|
||||
name ?? ""
|
||||
);
|
||||
|
||||
isResetPage(true);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
setIsExcelOpen(true);
|
||||
}}
|
||||
>
|
||||
엑셀등록
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
selectRuseCaseMng(
|
||||
true,
|
||||
1,
|
||||
count,
|
||||
sidoCd ?? "",
|
||||
sigunguCd ?? "",
|
||||
selectUtz ?? "",
|
||||
name ?? ""
|
||||
);
|
||||
// download()
|
||||
}}
|
||||
className={"green"}
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
excelDownload(
|
||||
[[]],
|
||||
"물재이용사례 관리 등록양식",
|
||||
"sample_ruseCaseMng.xlsx",
|
||||
"A1:AX1",
|
||||
2
|
||||
);
|
||||
}}
|
||||
>
|
||||
양식받기
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
<Toaster position="top-center" />
|
||||
{/* 엑셀 등록 모달 */}
|
||||
<UiModal
|
||||
open={isExcelOpen.isModal}
|
||||
onOpenChange={() => {
|
||||
setIsExcelOpen({ isModal: !isExcelOpen.isModal })
|
||||
}}
|
||||
bodyClass={"w-[35vw] max-w-none"}
|
||||
body={<RuseCaseMngExcel />}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4">
|
||||
<div className="col-span-6">
|
||||
<ListDiv className="overflow-x-auto">
|
||||
<div className="w-[350%]">
|
||||
<UiTable
|
||||
headName={"물재이용사례 현황"}
|
||||
tableData={ruseCaseMngList}
|
||||
headlist={ruseCaseMng.ruseHeadList}
|
||||
pageSize={20}
|
||||
total={count}
|
||||
cellClick={undefined}
|
||||
onPageChange={(pageNo: number) => {
|
||||
selectRuseCaseMng(
|
||||
false,
|
||||
pageNo,
|
||||
10,
|
||||
sidoCd ?? "",
|
||||
sigunguCd ?? "",
|
||||
selectUtz ?? "",
|
||||
name ?? ""
|
||||
);
|
||||
isResetPage(false);
|
||||
}}
|
||||
resetPageNo={resetPage}
|
||||
/>
|
||||
</div>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
<Toaster position="top-center" />
|
||||
{/* 엑셀 등록 모달 */}
|
||||
<UiModal
|
||||
open={isExcelOpen}
|
||||
onOpenChange={() => {
|
||||
setIsExcelOpen(!isExcelOpen );
|
||||
}}
|
||||
bodyClass={"w-[35vw] max-w-none"}
|
||||
body={<RuseCaseMngExcel setIsExcelOpen={setIsExcelOpen} />}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ export default function CoSttn() {
|
||||
});
|
||||
|
||||
const [seartchTxt, setSearchTxt] = useState<string>();
|
||||
const [upadateData, setUpdateData] = useState<DemandCompType>();
|
||||
const [updateData, setUpdateData] = useState<DemandCompType>();
|
||||
const [isResetSelection, setIsResetSelection] = useState<boolean>(false);
|
||||
|
||||
const getSelCity = useCallback(
|
||||
(val: string | number) => {
|
||||
@@ -135,6 +136,10 @@ export default function CoSttn() {
|
||||
}
|
||||
}, [coSttn.excelList, code]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsResetSelection(false);
|
||||
}, [updateData]);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
const con =
|
||||
objSearch.sgg && objSearch.sgg !== "0" ? objSearch.sgg : objSearch.city;
|
||||
@@ -160,8 +165,8 @@ export default function CoSttn() {
|
||||
};
|
||||
const { t } = useTranslation('base');
|
||||
const initPassword = () => {
|
||||
if (upadateData) {
|
||||
const dmdInfoId = upadateData.dmdInfoId;
|
||||
if (updateData) {
|
||||
const dmdInfoId = updateData.dmdInfoId;
|
||||
const dmdInfoSliceId = `${dmdInfoId.slice(0, 3)}-${dmdInfoId.slice(3, 5)}-${dmdInfoId.slice(5, 10)}-${dmdInfoId.slice(10)}`
|
||||
const handleConfirm = () => {
|
||||
coSttnPwInit(dmdInfoId);
|
||||
@@ -219,6 +224,7 @@ export default function CoSttn() {
|
||||
size={"sm"}
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
setIsResetSelection(true);
|
||||
setUpdateData(undefined);
|
||||
setIsDmdModal({ ...isDmdModal, isMoal: true });
|
||||
}}
|
||||
@@ -231,7 +237,7 @@ export default function CoSttn() {
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
/* 저장 로직 */
|
||||
if (!upadateData) {
|
||||
if (!updateData) {
|
||||
toast.error("수요처 변경을 원하는 행을 선택해주세요");
|
||||
} else {
|
||||
setIsDmdModal({
|
||||
@@ -283,13 +289,14 @@ export default function CoSttn() {
|
||||
setPageNation(page);
|
||||
coSttnSearch(String(page), "13", String(con));
|
||||
}}
|
||||
resetSelection={isResetSelection}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
bodyClass={
|
||||
"w-[40vw] max-w-none h-[83vh] " // +upadateData?.dmdInfoId?'h-[60vh]':'h-[90vh]'
|
||||
"w-[40vw] max-w-none h-[83vh] " // +updateData?.dmdInfoId?'h-[60vh]':'h-[90vh]'
|
||||
}
|
||||
open={isDmdModal.isMoal}
|
||||
onOpenChange={() => {
|
||||
@@ -308,7 +315,7 @@ export default function CoSttn() {
|
||||
objSearch.sgg && objSearch.sgg !== "0"
|
||||
? objSearch.sgg
|
||||
: objSearch.city;
|
||||
if (upadateData?.dmdInfoId) {
|
||||
if (updateData?.dmdInfoId) {
|
||||
await updateDemandCompany(data as DemandCompType);
|
||||
coSttnInit("1", "13", String(con));
|
||||
setIsDmdModal({
|
||||
@@ -335,7 +342,8 @@ export default function CoSttn() {
|
||||
}
|
||||
}}
|
||||
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
|
||||
updateList={upadateData}
|
||||
updateList={updateData}
|
||||
openNetwork={false}
|
||||
></SdmInsertForm>
|
||||
}
|
||||
></UiModal>
|
||||
|
||||
@@ -13,16 +13,23 @@ import {
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
export default function Home() {
|
||||
const { auth,code, htdfl, initHtdflReg, getHtdflBdstData, htdflNmSearch } =
|
||||
useWrStore((state) => state);
|
||||
const {
|
||||
auth,
|
||||
code,
|
||||
htdfl,
|
||||
getLaeSeCdCheck,
|
||||
initHtdflReg,
|
||||
getHtdflBdstData,
|
||||
htdflNmSearch,
|
||||
} = useWrStore((state) => state);
|
||||
const [searchTxt, setSearchTxt] = useState("");
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
|
||||
@@ -30,15 +37,22 @@ export default function Home() {
|
||||
const [bdstTable, setbdstTable] = useState<customHtdflBdst[]>();
|
||||
const [issNewReg, setIsNewReg] = useState<boolean>(false);
|
||||
|
||||
|
||||
const { htdflRes ,htdflResCount} = htdfl;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||
const { htdflRes, htdflResCount } = htdfl;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
|
||||
const useInitRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!htdfl.isInit) {
|
||||
initHtdflReg("0");
|
||||
getLaeSeCdCheck();
|
||||
useInitRef.current = true;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setIsNewReg(false);
|
||||
if (useInitRef.current == true && laeSeCd !== undefined) {
|
||||
initHtdflReg(laeSeCd);
|
||||
}
|
||||
}, [htdfl.isInit, initHtdflReg]);
|
||||
}, [useInitRef.current, laeSeCd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (htdflRes && htdflRes.length > 0) {
|
||||
const htdflData = tableData(htdflRes, { code }).map(
|
||||
@@ -60,26 +74,13 @@ export default function Home() {
|
||||
}
|
||||
}, [code, htdflRes]);
|
||||
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val
|
||||
) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
setHtdflForm(htdflRes[val]);
|
||||
}
|
||||
}
|
||||
// if (headId === "bdstChgYn" && val !== undefined) {
|
||||
// if (
|
||||
// htdflRes[val]?.bdstInfoSn != null &&
|
||||
// htdflRes[val]?.chgBuilding?.length > 0
|
||||
// ) {
|
||||
// bdstChgModal(htdflRes[val]?.chgBuilding as chgBuilding[]);
|
||||
// }
|
||||
// }
|
||||
};
|
||||
// const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
// setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
// };
|
||||
const cellClick: (val: number, headId: string) => void = (val) => {
|
||||
if (!htdflRes || !Array.isArray(htdflRes)) return;
|
||||
const idx = Number(val);
|
||||
console.log('htdflRes[idx]', htdflRes[idx]);
|
||||
setHtdflForm(htdflRes[idx]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getHtdflBdstData(pageNation, "0");
|
||||
}, [pageNation]);
|
||||
@@ -113,9 +114,10 @@ export default function Home() {
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button size={"sm"}
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
disabled={regAuthrtYn === "N"}
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
disabled={regAuthrtYn === "N"}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
@@ -137,7 +139,9 @@ export default function Home() {
|
||||
total={htdflResCount}
|
||||
headName={"시설물 목록"}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val || undefined, headId);
|
||||
if (val !== null && val !== undefined) {
|
||||
cellClick(val, headId);
|
||||
}
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
></UiTable>
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { Button } from "@common/components";
|
||||
import { useWrStore } from "../../../../store";
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { confirmToast, tableData } from "@/components/lib/func/commom";
|
||||
import type {
|
||||
@@ -35,6 +35,17 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { z } from "zod";
|
||||
import { createDefaultPbnstItem } from "./utilsZod";
|
||||
import { useTranslation } from "react-i18next";
|
||||
/**
|
||||
* 재이용시설 등록 - 하수재이용 시설등록
|
||||
*
|
||||
* - layout.tsx에 의해 공통 레이아웃이 적용됨
|
||||
* - with-layout 적용
|
||||
* - 하수처리시설에 하수재이용 시설을 등록 한다.
|
||||
* - form으로 시설정보 및 차수별 정보의 컴포넌트 데이터를 관리한다
|
||||
* indexMng: 시설정보
|
||||
* indexBiz: 차수별 정보
|
||||
* 로 하수재이용 시설에 등록된 시설 및 차수별 정보를 관리한다.
|
||||
* */
|
||||
|
||||
export default function PublicReuseFaciltyInsert() {
|
||||
const {
|
||||
@@ -47,21 +58,22 @@ export default function PublicReuseFaciltyInsert() {
|
||||
pbnstRuseFcltUpdate,
|
||||
pubHasuSearch,
|
||||
pbnstRuseBizUpdate,
|
||||
getLaeSeCdCheck,
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const { t } = useTranslation("base");
|
||||
const { pubFacHeadList, pbnstHasuResCount, pbnstHasuRes, pbnstRes } = pbnst;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
|
||||
const [, setCurrentTab] = useState<string>("mng");
|
||||
const [isRuseReg, setIsRuseReg] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const [indexMng, setIndexMng] = useState<number>(0);
|
||||
const [indexBiz, setIndexBiz] = useState<number>(0);
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [bdstTable, setbdstTable] = useState<pubHasuType[]>();
|
||||
const [selectRow, setSelectRow] = useState<pubHasuType>();
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
|
||||
const [pageNation, setPageNation] = useState<number>(1);
|
||||
const form = useForm<{
|
||||
@@ -83,17 +95,20 @@ export default function PublicReuseFaciltyInsert() {
|
||||
});
|
||||
|
||||
const formWatch = form.watch("items");
|
||||
const useInitRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!pbnst.isInit) {
|
||||
pubHasuInit("1", "41");
|
||||
getLaeSeCdCheck();
|
||||
useInitRef.current = true;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (useInitRef.current == true && laeSeCd !== undefined) {
|
||||
pubHasuInit("1", laeSeCd);
|
||||
}
|
||||
}, [pbnst.isInit, pubHasuInit]);
|
||||
}, [useInitRef.current, laeSeCd]);
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
// if (!isDirty) {
|
||||
// toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
|
||||
// return;
|
||||
// }
|
||||
const data = writeRgtrAndMdfr(valuse.items);
|
||||
let bizs = [] as fcBizType[];
|
||||
data.forEach((fclt) => {
|
||||
@@ -133,7 +148,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
message += "하수재이용 시설 사업 ";
|
||||
}
|
||||
toast.error(message + "오류 입니다 ");
|
||||
pubHasuInit("1", "41");
|
||||
pubHasuInit("1", laeSeCd);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -220,7 +235,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
setSelectRow(pbnstHasuRes?.[val]);
|
||||
if (selectRow) {
|
||||
pbnstRegClick(selectRow);
|
||||
setIndexMng(0)
|
||||
setIndexMng(0);
|
||||
} else {
|
||||
console.error("선택된 행이 없습니다.");
|
||||
}
|
||||
@@ -237,7 +252,6 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}, [indexMng]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) {
|
||||
form.reset({ items: pbnst.pbnstRes });
|
||||
} else {
|
||||
@@ -263,7 +277,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}, [pbnstRes, append, selectRow]);
|
||||
|
||||
useEffect(() => {
|
||||
pubHasuInit(String(pageNation), "41");
|
||||
pubHasuInit(String(pageNation), laeSeCd);
|
||||
isResetPage(false);
|
||||
}, [pageNation, pubHasuInit]);
|
||||
|
||||
@@ -289,13 +303,12 @@ export default function PublicReuseFaciltyInsert() {
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
pubHasuSearch(String(pageNation), "41", searchTxt);
|
||||
pubHasuSearch(String(pageNation), laeSeCd, searchTxt);
|
||||
} else {
|
||||
pubHasuInit(String(pageNation), "41");
|
||||
pubHasuInit(String(pageNation), laeSeCd);
|
||||
}
|
||||
isResetPage(true);
|
||||
}}
|
||||
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
@@ -428,7 +441,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}
|
||||
}}
|
||||
onInvalid={onInvalid}
|
||||
newIndexMng={(formWatch?.length -1)}
|
||||
newIndexMng={formWatch?.length - 1}
|
||||
></PbnstRegModal>
|
||||
}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { rainRegSize, type customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { formatArchArea, tableData } from "@/components/lib/func/commom";
|
||||
import {
|
||||
rainRegSize,
|
||||
type customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { formatArchArea, tableData } from "@/components/lib/func/commom";
|
||||
import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
|
||||
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
@@ -16,33 +19,54 @@ import {
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 밧물이용시설 등록
|
||||
* 재이용시설 등록 - 빗물시설 등록
|
||||
* - layout.tsx에 의해 공통 레이아웃이 적용됨
|
||||
* - with-layout 적용
|
||||
* 왼쪽 테이블에는 건축물 리스트 / 오른쪽 폼에는 건축물에 해당하는 빗물이용시설 데이터가 보인다.
|
||||
* 신규 등록 버튼을 눌러 건축물 정보부터 입력한다.
|
||||
*
|
||||
* */
|
||||
export default function Home() {
|
||||
const { auth, rain, code, initRain, rainSearch, getRainData } = useWrStore(
|
||||
(state) => {
|
||||
return state;
|
||||
}
|
||||
);
|
||||
|
||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||
|
||||
const {
|
||||
auth,
|
||||
rain,
|
||||
code,
|
||||
initRain,
|
||||
rainSearch,
|
||||
getRainData,
|
||||
getLaeSeCdCheck,
|
||||
} = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
|
||||
|
||||
const { rainRes, rainResCount } = rain;
|
||||
const useInitRef = useRef(false);
|
||||
const [rainForm, setRainForm] = useState<customRainBdst>();
|
||||
const [issNewReg, setIsNewReg] = useState<boolean>(false);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [bdstTable, setbdstTable] = useState<customRainBdst[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
|
||||
useEffect(() => {
|
||||
getLaeSeCdCheck();
|
||||
useInitRef.current = true;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setIsNewReg(false);
|
||||
if (!rain.isInit) {
|
||||
initRain("41");
|
||||
if (useInitRef.current == true && laeSeCd !== undefined) {
|
||||
initRain(laeSeCd);
|
||||
}
|
||||
}, [rain.isInit, initRain]);
|
||||
}, [useInitRef.current, laeSeCd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
@@ -51,9 +75,9 @@ export default function Home() {
|
||||
(item: customRainBdst) => {
|
||||
return {
|
||||
...item,
|
||||
archArea: formatArchArea(item?.archArea,1),
|
||||
archArea: formatArchArea(item?.archArea, 1),
|
||||
bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N",
|
||||
frstArchPrmsnDt:item?.frstArchPrmsnDt||'확인불가'
|
||||
frstArchPrmsnDt: item?.frstArchPrmsnDt || "확인불가",
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -71,7 +95,7 @@ export default function Home() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getRainData(pageNation, "41");
|
||||
getRainData(pageNation, laeSeCd);
|
||||
}, [pageNation]);
|
||||
|
||||
return (
|
||||
@@ -95,7 +119,7 @@ export default function Home() {
|
||||
className=""
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
rainSearch(searchTxt || "", 1, "41");
|
||||
rainSearch(searchTxt || "", 1, laeSeCd);
|
||||
//rainSearch(searchTxt || "", pageNation, "41");
|
||||
}}
|
||||
>
|
||||
@@ -105,7 +129,7 @@ export default function Home() {
|
||||
size={"sm"}
|
||||
className=""
|
||||
onClick={() => {
|
||||
setIsNewReg(!issNewReg);
|
||||
setIsNewReg(!issNewReg);
|
||||
}}
|
||||
disabled={regAuthrtYn === "N"}
|
||||
>
|
||||
@@ -138,7 +162,7 @@ export default function Home() {
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 ">
|
||||
<ListDiv >
|
||||
<ListDiv>
|
||||
<ScrollArea className="h-[75vh]">
|
||||
<RainRegForm
|
||||
rainForm={rainForm ?? ({} as customRainBdst)}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { rswtRegSize, type customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import {
|
||||
rswtRegSize,
|
||||
type customRswtBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
@@ -12,18 +15,33 @@ import {
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
|
||||
/**
|
||||
* 중수도 시설 등록
|
||||
* 재이용시설 등록 - 중수도시설 등록
|
||||
* - layout.tsx에 의해 공통 레이아웃이 적용됨
|
||||
* - with-layout 적용
|
||||
* 왼쪽 테이블에는 건축물 리스트 / 오른쪽 폼에는 건축물에 해당하는 중수도시설 데이터가 보인다.
|
||||
* 신규 등록 버튼을 눌러 건축물 정보부터 입력한다.
|
||||
* */
|
||||
export default function Home() {
|
||||
const { auth,code, rswt, initRswt, rswtBdstSearch, getRswtBdstData } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||
const {
|
||||
auth,
|
||||
code,
|
||||
rswt,
|
||||
initRswt,
|
||||
rswtBdstSearch,
|
||||
getRswtBdstData,
|
||||
getLaeSeCdCheck,
|
||||
} = useWrStore((state) => state);
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
|
||||
|
||||
const [rswtForm, setRswtForm] = useState<customRswtBdst>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
@@ -32,14 +50,22 @@ export default function Home() {
|
||||
const [selectVal, setSelect] = useState<number>();
|
||||
const [bdstTable, setbdstTable] = useState<customRswtBdst[]>();
|
||||
const { rswtRes, rswtResCount } = rswt;
|
||||
const useInitRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswt.isInit) {
|
||||
initRswt("41");
|
||||
getLaeSeCdCheck();
|
||||
useInitRef.current = true;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setIsNewReg(false);
|
||||
if (useInitRef.current == true && laeSeCd !== undefined) {
|
||||
initRswt(laeSeCd);
|
||||
}
|
||||
}, [rswt.isInit, initRswt]);
|
||||
}, [useInitRef.current, laeSeCd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
|
||||
if (rswtRes?.length > 0) {
|
||||
const rswtData = tableData(rswtRes, { code })?.map(
|
||||
(item: customRswtBdst) => {
|
||||
@@ -63,7 +89,6 @@ export default function Home() {
|
||||
}
|
||||
}
|
||||
// }, [code, rswtRes, selectVal]);
|
||||
|
||||
}, [code, rswtRes]);
|
||||
useEffect(() => {
|
||||
if (rswtRes && rswtRes.length > 0) {
|
||||
@@ -79,11 +104,10 @@ export default function Home() {
|
||||
setSelect(val);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getRswtBdstData(pageNation, "41");
|
||||
getRswtBdstData(pageNation,laeSeCd);
|
||||
}, [pageNation]);
|
||||
|
||||
return (
|
||||
@@ -107,7 +131,7 @@ export default function Home() {
|
||||
size={"sm"}
|
||||
className=""
|
||||
onClick={() => {
|
||||
rswtBdstSearch(searchTxt || "", pageNation, "41");
|
||||
rswtBdstSearch(searchTxt || "", pageNation,laeSeCd);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
|
||||
@@ -24,6 +24,15 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
/**
|
||||
* 하수재이용 시설 현황
|
||||
* 재이용시설 현황 - 하수재이용시설 현황
|
||||
* - layout.tsx에 의해 공통 레이아웃이 적용됨
|
||||
* - with-layout 적용
|
||||
* 하수처리시설. 하수재이용시설 , 하수재이용시설 실적에 대한 정보를 확인한다.
|
||||
* 모달 : 테이블의 헤더를 원하는대로 조절해서 볼수 있다.
|
||||
* 클릭시 해당 재이용ㅇ
|
||||
* */
|
||||
export default function PbnstSttn() {
|
||||
const {
|
||||
code,
|
||||
@@ -32,7 +41,7 @@ export default function PbnstSttn() {
|
||||
pbnSttnInit,
|
||||
getPbnStnDetail,
|
||||
getFlcts,
|
||||
resetPbnstDetail
|
||||
resetPbnstDetail,
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn;
|
||||
@@ -50,7 +59,7 @@ export default function PbnstSttn() {
|
||||
}>({ isModal: false, data: {} as customPbnst });
|
||||
const isDownloadTriggered = useRef(false);
|
||||
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
|
||||
const { t } = useTranslation('base');
|
||||
const { t } = useTranslation("base");
|
||||
const excelClick = useCallback(() => {
|
||||
isDownloadTriggered.current = true;
|
||||
pbnstSttnSearch(
|
||||
@@ -79,7 +88,6 @@ export default function PbnstSttn() {
|
||||
}
|
||||
}, [pbnstSttn.isInit]);
|
||||
useEffect(() => {
|
||||
|
||||
pbnSttnInit("1", "15", ref.current, searchYear, fclts);
|
||||
}, [fclts]);
|
||||
|
||||
@@ -91,7 +99,6 @@ export default function PbnstSttn() {
|
||||
}
|
||||
}, [pbnstSttnRes]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDownloadTriggered.current) {
|
||||
return;
|
||||
@@ -105,12 +112,11 @@ export default function PbnstSttn() {
|
||||
3
|
||||
);
|
||||
} else {
|
||||
toast.error(t('excelDownErrMsg'));
|
||||
toast.error(t("excelDownErrMsg"));
|
||||
}
|
||||
isDownloadTriggered.current = false;
|
||||
}, [pbnstSttn.excelList]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltId)
|
||||
setPbnDetaileData({
|
||||
@@ -211,7 +217,6 @@ export default function PbnstSttn() {
|
||||
);
|
||||
setIsReset(false);
|
||||
}}
|
||||
|
||||
resetPageNo={isReset}
|
||||
>
|
||||
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
|
||||
|
||||
@@ -92,7 +92,7 @@ export default function RainSttn() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainSttn.isInit) {
|
||||
rainSttnInit(false, 1, rainSttnSize, "0", fcltNm, code.cityCd, code.sggCd);
|
||||
rainSttnInit(false, 1, rainSttnSize, "0", fcltNm, code as unknown as Record<string, SelectDataType[]>);
|
||||
}
|
||||
}, [rainSttn.isInit, rainSttnInit]);
|
||||
|
||||
@@ -146,8 +146,7 @@ export default function RainSttn() {
|
||||
rainSttnSize,
|
||||
String(getConValue()),
|
||||
fcltNm,
|
||||
code.cityCd,
|
||||
code.sggCd
|
||||
code as unknown as Record<string, SelectDataType[]>
|
||||
);
|
||||
isResetPage(false);
|
||||
}, [pageNation]);
|
||||
@@ -177,8 +176,7 @@ export default function RainSttn() {
|
||||
rainSttnResCount,
|
||||
String(getConValue()),
|
||||
fcltNm,
|
||||
code.cityCd,
|
||||
code.sggCd
|
||||
code as unknown as Record<string, SelectDataType[]>
|
||||
);
|
||||
}, [
|
||||
rainSttnSearch,
|
||||
@@ -237,8 +235,7 @@ export default function RainSttn() {
|
||||
rainSttnSize,
|
||||
String(getConValue()),
|
||||
fcltNm,
|
||||
code.cityCd,
|
||||
code.sggCd
|
||||
code as unknown as Record<string, SelectDataType[]>
|
||||
);
|
||||
isResetPage(true);
|
||||
}}
|
||||
|
||||
@@ -34,6 +34,7 @@ export default function RswtSttn() {
|
||||
const { code, rswtSttn, rswtSttnSearch, rswtSttnInit } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
|
||||
const { rswtSttnRes, rswtSttnResCount } = rswtSttn;
|
||||
@@ -83,8 +84,8 @@ export default function RswtSttn() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswtSttn.isInit) {
|
||||
rswtSttnInit(false, 1, rswtSttnSize, "0", fcltNm, code.cityCd, code.sggCd);
|
||||
if (!rswtSttn.isInit&&code) {
|
||||
rswtSttnInit(false, 1, rswtSttnSize, code.userSiSggCd, fcltNm, code as unknown as Record<string, SelectDataType[]>);
|
||||
}
|
||||
}, [rswtSttn.isInit, rswtSttnInit]);
|
||||
|
||||
@@ -93,6 +94,8 @@ export default function RswtSttn() {
|
||||
const chData = data
|
||||
.map((item: customRswtBdst) => {
|
||||
const isOrgwtKndCd = item.reuseBuilding[0]?.rswtrObj.orgwtKndCd
|
||||
|
||||
|
||||
return {
|
||||
...item,
|
||||
...item.reuseBuilding[0],
|
||||
@@ -101,7 +104,7 @@ export default function RswtSttn() {
|
||||
chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N',
|
||||
instlCst: item.reuseBuilding[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCst,
|
||||
instlCstSprtAmt: item.reuseBuilding[0]?.instlCstSprtAmt === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCstSprtAmt,
|
||||
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가'
|
||||
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가',
|
||||
}
|
||||
})
|
||||
.filter(
|
||||
@@ -131,11 +134,11 @@ export default function RswtSttn() {
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
isDownloadTriggered.current = true;
|
||||
rswtSttnSearch(true, 1, rswtSttnResCount, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
rswtSttnSearch(true, 1, rswtSttnResCount, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
|
||||
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, rswtSttnResCount]);
|
||||
|
||||
useEffect(() => {
|
||||
rswtSttnSearch(false, pageNation, rswtSttnSize, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
rswtSttnSearch(false, pageNation, rswtSttnSize, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
|
||||
isResetPage(false)
|
||||
}, [pageNation]);
|
||||
|
||||
@@ -186,7 +189,7 @@ export default function RswtSttn() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
rswtSttnSearch(false, 1, rswtSttnSize, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
rswtSttnSearch(false, 1, rswtSttnSize, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
|
||||
isResetPage(true)
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
commonCd,
|
||||
rainPageSize,
|
||||
type rainChkZodType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
@@ -38,7 +37,7 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@common/components/ui/tooltip";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -62,17 +61,14 @@ export default function Page() {
|
||||
rswtChkDelete,
|
||||
rswtrChkExcelDownload,
|
||||
rswtChkHeadChange,
|
||||
getLaeSeCdCheck
|
||||
} = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, delAuthrtYn } = auth;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, delAuthrtYn,laeSeCd } = auth;
|
||||
const [isRegExcel, setIsRegExcel] = useState(false);
|
||||
const [updateRainDetail, setUpdateRainDetail] = useState<rainChkZodType[]>(
|
||||
[]
|
||||
);
|
||||
const [updateRswtDetail, setUpdateRSwtDetail] = useState<
|
||||
rswtrChkDetailsZodType[]
|
||||
>([]);
|
||||
const [updateRainDetail, setUpdateRainDetail] = useState<rainChkZodType[]>([]);
|
||||
const [updateRswtDetail, setUpdateRSwtDetail] = useState<rswtrChkDetailsZodType[]>([]);
|
||||
const [deleteIdx, setDeleteIdx] = useState<number[]>([]);
|
||||
const [rainPageNation, setRainPageNation] = useState(1);
|
||||
const [rswtPageNation, setRswtPageNation] = useState(1);
|
||||
@@ -85,6 +81,17 @@ export default function Page() {
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
|
||||
const useInitRef = useRef(false);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
getLaeSeCdCheck();
|
||||
useInitRef.current = true;
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
const cellClick = () => {
|
||||
if (searchYear)
|
||||
if (selFcltDiv === "RNB") {
|
||||
@@ -93,12 +100,12 @@ export default function Page() {
|
||||
rainPageNation,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
laeSeCd,
|
||||
fcltNm
|
||||
);
|
||||
setRainPageNation(1);
|
||||
} else {
|
||||
rainChkInit(rainPageNation, rainPageSize, searchYear, commonCd);
|
||||
rainChkInit(rainPageNation, rainPageSize, searchYear, laeSeCd);
|
||||
}
|
||||
} else {
|
||||
if (fcltNm) {
|
||||
@@ -106,12 +113,12 @@ export default function Page() {
|
||||
rainPageNation,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
laeSeCd,
|
||||
fcltNm
|
||||
);
|
||||
setRswtPageNation(1);
|
||||
} else {
|
||||
rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd);
|
||||
rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, laeSeCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -123,11 +130,11 @@ export default function Page() {
|
||||
pageNo,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
laeSeCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rainChkInit(pageNo, rainPageSize, searchYear, commonCd);
|
||||
rainChkInit(pageNo, rainPageSize, searchYear, laeSeCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -139,41 +146,43 @@ export default function Page() {
|
||||
pageNo,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
laeSeCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
||||
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, laeSeCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainChkgdn.isInit) {
|
||||
if (useInitRef.current == true && laeSeCd !== undefined&& !rainChkgdn.isInit) {
|
||||
rainChkInit(
|
||||
1,
|
||||
rainPageSize,
|
||||
new Date().getFullYear().toString(),
|
||||
commonCd
|
||||
laeSeCd
|
||||
);
|
||||
isRainSttn(false);
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
}, [rainChkgdn.isInit, rainChkInit, rainPageSize]);
|
||||
}, [rainChkgdn.isInit, rainChkInit, rainPageSize,laeSeCd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswtChkgdn.isInit) {
|
||||
if (useInitRef.current == true && laeSeCd !== undefined&&!rswtChkgdn.isInit) {
|
||||
rswtChkgdnInit(
|
||||
1,
|
||||
rswtPageSize,
|
||||
new Date().getFullYear().toString(),
|
||||
commonCd
|
||||
laeSeCd
|
||||
);
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
}, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize]);
|
||||
}, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize,laeSeCd]);
|
||||
|
||||
useEffect(() => {
|
||||
if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) {
|
||||
@@ -197,9 +206,9 @@ export default function Page() {
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkExcelDownload(code.cityCd, code.sggCd);
|
||||
rainChkExcelDownload(code.cityCd, code.sggCd,laeSeCd);
|
||||
} else {
|
||||
rswtrChkExcelDownload(code.cityCd, code.sggCd);
|
||||
rswtrChkExcelDownload(code.cityCd, code.sggCd,laeSeCd);
|
||||
}
|
||||
}, [
|
||||
rainChkExcelDownload,
|
||||
@@ -207,6 +216,7 @@ export default function Page() {
|
||||
code.cityCd,
|
||||
code.sggCd,
|
||||
selFcltDiv,
|
||||
laeSeCd
|
||||
]);
|
||||
|
||||
const handleClick = useCallback(
|
||||
|
||||
@@ -9,7 +9,11 @@ import {
|
||||
type FcPrfType,
|
||||
type PrfType,
|
||||
} from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import { confirmToast, excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
import {
|
||||
confirmToast,
|
||||
excelDownload,
|
||||
yearOptions,
|
||||
} from "@/components/lib/func/commom";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import PbnPrfExcelModal from "@/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal";
|
||||
import {
|
||||
@@ -32,17 +36,29 @@ import {
|
||||
TableBody,
|
||||
TableHeader,
|
||||
} from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
|
||||
|
||||
export default function PrfmncPrfmncReg() {
|
||||
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch,getPrfFmcRes } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { prfPbnFclts, pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||
const {
|
||||
auth,
|
||||
prfmnc,
|
||||
prfmncHasuInit,
|
||||
prfmnRegData,
|
||||
prfmncHasuNmSearch,
|
||||
getPrfFmcRes,
|
||||
getLaeSeCdCheck,
|
||||
} = useWrStore((state) => state);
|
||||
const {
|
||||
prfPbnFclts,
|
||||
pbnstPrfmncHeadList,
|
||||
monthHeadList,
|
||||
prfmncRes,
|
||||
prfmncResCount,
|
||||
} = prfmnc;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn, laeSeCd } = auth;
|
||||
const [isReset, setIsReset] = useState(false);
|
||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
@@ -57,6 +73,8 @@ export default function PrfmncPrfmncReg() {
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
|
||||
const useInitRef = useRef(false);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
excelDownload(
|
||||
[[]],
|
||||
@@ -66,26 +84,26 @@ export default function PrfmncPrfmncReg() {
|
||||
);
|
||||
}, [prfmnc.excelList]);
|
||||
|
||||
const { t } = useTranslation('base');
|
||||
const { t } = useTranslation("base");
|
||||
const onSave = useCallback(() => {
|
||||
const handleConfirm = async () => {
|
||||
if (!pbnstRuseFcltId) return;
|
||||
|
||||
prfmnRegData(
|
||||
1,
|
||||
'41',
|
||||
laeSeCd,
|
||||
excelToPbnPrfData(
|
||||
inputData as unknown as JSON[],
|
||||
searchYear,
|
||||
pbnstRuseFcltId
|
||||
) as unknown as PrfType
|
||||
, searchYear,
|
||||
) as unknown as PrfType,
|
||||
searchYear,
|
||||
prfPbnFclts
|
||||
);
|
||||
};
|
||||
|
||||
confirmToast(t('isUpdateMsg'), handleConfirm);
|
||||
}, [inputData, searchYear, pbnstRuseFcltId, cellNum,prfPbnFclts]);
|
||||
confirmToast(t("isUpdateMsg"), handleConfirm);
|
||||
}, [inputData, searchYear, pbnstRuseFcltId, cellNum, prfPbnFclts]);
|
||||
|
||||
const cellClick = useCallback(
|
||||
(index: number | undefined) => {
|
||||
@@ -112,89 +130,90 @@ export default function PrfmncPrfmncReg() {
|
||||
};
|
||||
if (prfmncRes[index]?.prfList) {
|
||||
prfmncRes[index].prfList?.forEach((prfItem) => {
|
||||
const yr = Number(prfItem.ym?.slice(0, 4)); // "YYYY"
|
||||
const yr = Number(prfItem.ym?.slice(0, 4)); // "YYYY"
|
||||
|
||||
if(yr === Number(searchYear)) {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
if (yr === Number(searchYear)) {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
|
||||
inUsageData.forEach((inData: any) => {
|
||||
const usageKey = inData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
inUsageData.forEach((inData: any) => {
|
||||
const usageKey = inData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
inData[monthKey] = value;
|
||||
inData.total += value;
|
||||
inData[monthKey] = value;
|
||||
inData.total += value;
|
||||
|
||||
if (inSubtotal && usageKey !== "subtotal") {
|
||||
(inSubtotal as any)[monthKey] =
|
||||
((inSubtotal as any)[monthKey] ?? 0) + value;
|
||||
inSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
if (inSubtotal && usageKey !== "subtotal") {
|
||||
(inSubtotal as any)[monthKey] =
|
||||
((inSubtotal as any)[monthKey] ?? 0) + value;
|
||||
inSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
|
||||
outUsageData.forEach((outData: any) => {
|
||||
const usageKey = outData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
outUsageData.forEach((outData: any) => {
|
||||
const usageKey = outData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
outData[monthKey] = value;
|
||||
outData.total += value;
|
||||
outData[monthKey] = value;
|
||||
outData.total += value;
|
||||
|
||||
if (usageKey !== "subtotal") {
|
||||
(outSubtotal as any)[monthKey] =
|
||||
((outSubtotal as any)[monthKey] ?? 0) + value;
|
||||
outSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (usageKey !== "subtotal") {
|
||||
(outSubtotal as any)[monthKey] =
|
||||
((outSubtotal as any)[monthKey] ?? 0) + value;
|
||||
outSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if(inSubtotal.total!==0 && outSubtotal.total!==0) {
|
||||
if (inSubtotal.total !== 0 && outSubtotal.total !== 0) {
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = {
|
||||
...structuredClone(totalObj),
|
||||
구분: "총합계",
|
||||
용수명: "",
|
||||
};
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
(Number((inSubtotal as any)[key]) || 0) +
|
||||
(Number((outSubtotal as any)[key]) || 0);
|
||||
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = {
|
||||
...structuredClone(totalObj),
|
||||
구분: "총합계",
|
||||
용수명: "",
|
||||
};
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
(Number((inSubtotal as any)[key]) || 0) +
|
||||
(Number((outSubtotal as any)[key]) || 0);
|
||||
|
||||
(usageTotalObj as any)[key] = val;
|
||||
(usageTotalObj as any)[key] = val;
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setpbnstRuseFcltId(prfmncRes[index].pbnstRuseFcltId);
|
||||
setInputData(tableData);
|
||||
} else {
|
||||
setInputData([]);
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setpbnstRuseFcltId(prfmncRes[index].pbnstRuseFcltId);
|
||||
setInputData(tableData);
|
||||
}else{
|
||||
setInputData([]);
|
||||
}
|
||||
} else {
|
||||
setInputData([]);
|
||||
}
|
||||
}
|
||||
},
|
||||
[prfmncRes,searchYear]
|
||||
[prfmncRes, searchYear]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!prfmnc.isInit) {
|
||||
getPrfFmcRes()
|
||||
getLaeSeCdCheck();
|
||||
useInitRef.current = true;
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if (useInitRef.current == true && laeSeCd !== undefined) {
|
||||
getPrfFmcRes();
|
||||
useInitRef.current = true;
|
||||
}
|
||||
}, [prfmnc.isInit, getPrfFmcRes]);
|
||||
}, [useInitRef.current, laeSeCd]);
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
const year = new Date().getFullYear()
|
||||
prfmncHasuInit(1, '41',String(year) ,prfPbnFclts);
|
||||
},[prfPbnFclts])
|
||||
useEffect(() => {
|
||||
const year = new Date().getFullYear();
|
||||
|
||||
prfmncHasuInit(1, laeSeCd, String(year), prfPbnFclts);
|
||||
}, [prfPbnFclts]);
|
||||
|
||||
useEffect(() => {
|
||||
if (prfmncRes && prfmncRes.length > 0) {
|
||||
|
||||
setbdstTable(prfmncRes);
|
||||
}
|
||||
|
||||
@@ -244,11 +263,12 @@ export default function PrfmncPrfmncReg() {
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<div className="space-y">
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button size={"sm"} onClick={() => {
|
||||
|
||||
|
||||
setIsReset(true)
|
||||
}}>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
setIsReset(true);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
@@ -256,7 +276,7 @@ export default function PrfmncPrfmncReg() {
|
||||
onClick={() => {
|
||||
onSave();
|
||||
}}
|
||||
disabled={mdfcnAuthrtYn === 'N'}
|
||||
disabled={mdfcnAuthrtYn === "N"}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
@@ -270,7 +290,7 @@ export default function PrfmncPrfmncReg() {
|
||||
setIsExcelOPen({ ...isExcelOpen, isModal: true });
|
||||
}
|
||||
}}
|
||||
disabled={regAuthrtYn === 'N'}
|
||||
disabled={regAuthrtYn === "N"}
|
||||
>
|
||||
파일등록
|
||||
</Button>
|
||||
@@ -289,7 +309,7 @@ export default function PrfmncPrfmncReg() {
|
||||
<ListDiv className="min-h-0">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<UiTable
|
||||
key={'leftTable'}
|
||||
key={"leftTable"}
|
||||
tableData={bdstTable || []}
|
||||
headlist={pbnstPrfmncHeadList}
|
||||
pageSize={10}
|
||||
@@ -299,16 +319,21 @@ export default function PrfmncPrfmncReg() {
|
||||
cellClick(index);
|
||||
setCellNum(index ?? 0);
|
||||
}}
|
||||
onPageChange={
|
||||
(page:number) => {
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
prfmncHasuNmSearch(page, '41', searchYear, searchTxt,prfPbnFclts)
|
||||
} else {
|
||||
prfmncHasuInit(page, '41', searchYear,prfPbnFclts)
|
||||
}
|
||||
setIsReset(false);
|
||||
}}
|
||||
resetPageNo={isReset}
|
||||
onPageChange={(page: number) => {
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
prfmncHasuNmSearch(
|
||||
page,
|
||||
laeSeCd,
|
||||
searchYear,
|
||||
searchTxt,
|
||||
prfPbnFclts
|
||||
);
|
||||
} else {
|
||||
prfmncHasuInit(page, laeSeCd, searchYear, prfPbnFclts);
|
||||
}
|
||||
setIsReset(false);
|
||||
}}
|
||||
resetPageNo={isReset}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
@@ -324,8 +349,13 @@ export default function PrfmncPrfmncReg() {
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(monthHeadList, [])}
|
||||
</TableHeader>
|
||||
<TableBody key={prfmnc.pageKey + 'pageKey'}>
|
||||
{InputTableBody(inputData ?? [], monthHeadList, setInputData, mdfcnAuthrtYn === 'N' ? false : true)}
|
||||
<TableBody key={prfmnc.pageKey + "pageKey"}>
|
||||
{InputTableBody(
|
||||
inputData ?? [],
|
||||
monthHeadList,
|
||||
setInputData,
|
||||
mdfcnAuthrtYn === "N" ? false : true
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
@@ -338,17 +368,12 @@ export default function PrfmncPrfmncReg() {
|
||||
<PbnPrfExcelModal
|
||||
data={isExcelOpen.data}
|
||||
setIsExcelOPen={(open) => {
|
||||
setIsExcelOPen({ ...isExcelOpen, isModal: open })
|
||||
setIsExcelOPen({ ...isExcelOpen, isModal: open });
|
||||
}}
|
||||
setModalExcelData={async (excelData) => {
|
||||
await prfmnRegData(1, '41',
|
||||
excelData,
|
||||
searchYear
|
||||
,prfPbnFclts
|
||||
);
|
||||
await prfmnRegData(1, laeSeCd, excelData, searchYear, prfPbnFclts);
|
||||
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
|
||||
}
|
||||
}
|
||||
}}
|
||||
></PbnPrfExcelModal>
|
||||
}
|
||||
open={isExcelOpen.isModal}
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function RswtStat() {
|
||||
|
||||
const { t } = useTranslation('base');
|
||||
useEffect(() => {
|
||||
searchRswtStatList(searchYear, code.cityCd)
|
||||
searchRswtStatList(searchYear, code.cityCd,code.rswtBdstType)
|
||||
}, [searchRswtStatList, code.cityCd])
|
||||
|
||||
const excelClick = () => {
|
||||
@@ -251,7 +251,7 @@ export default function RswtStat() {
|
||||
className=""
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
searchRswtStatList(searchYear, code.cityCd)
|
||||
searchRswtStatList(searchYear, code.cityCd,code.rswtBdstType)
|
||||
}}
|
||||
>
|
||||
조회
|
||||
|
||||
@@ -15,7 +15,15 @@ export default function Base({
|
||||
|
||||
const changeMenu = (path: MenuItem) => {
|
||||
getMenuAuthrts(path.menuCd);
|
||||
router.push(path.urlPath);
|
||||
if (path.menuKornNm === "하수재이용통계") {
|
||||
// console.log("외부 페이지로 이동합니다. " ,path);
|
||||
// const popupOptions = `width=${window.screen.availWidth},height=${window.screen.availHeight},left=0,top=0,resizable=yes,scrollbars=yes`;
|
||||
// path.newWndwYn ='N'
|
||||
// window.open(path.urlPath, "candidatePopup", popupOptions);
|
||||
return null;
|
||||
} else {
|
||||
router.push(path.urlPath);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={changeMenu}>
|
||||
|
||||
+16
-11
@@ -7,33 +7,38 @@ import { StoreProvider } from "./store";
|
||||
import { LoginApi } from "@/src/entities/auth";
|
||||
import { useEffect } from "react";
|
||||
|
||||
const i18n = i18next.createInstance();
|
||||
i18n.init({
|
||||
lng: "ko",
|
||||
fallbackLng: "ko",
|
||||
resources: {
|
||||
ko: {
|
||||
base: koBase,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
i18next.init({
|
||||
lng: "ko",
|
||||
fallbackLng: "ko",
|
||||
resources: {
|
||||
ko: {
|
||||
base: koBase,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// 렌더 중이 아니라 클라이언트에서만 실행 + 에러 캐치
|
||||
void LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" })
|
||||
.finally(()=>{
|
||||
// getCommonUpCd()
|
||||
} )
|
||||
.catch((e) => {
|
||||
console.error("Auto login failed:", e);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<html lang="ko">
|
||||
<body>
|
||||
<I18nextProvider i18n={i18next}>
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<StoreProvider>
|
||||
{children}
|
||||
</StoreProvider>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user