Compare commits

..
47 changed files with 1186 additions and 1211 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
NEXT_PUBLIC_SITE_ID = FO
NEXT_PUBLIC_PORT = 3000
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
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_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
@@ -2,7 +2,7 @@
import { useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/processFacility";
import { ContentsDiv, UiModal, UiTable } from "@common/business_components";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
import { cn, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
import { useEffect, useState } from "react";
import DashBoardChartModal from "./modal/page";
@@ -30,20 +30,20 @@ const headMakeColSpanPlanFclty = (upHeadList: TableUpperProps[], planYearList: s
const headMakeColSpanOperationStatus = (upHeadList: TableUpperProps[], searchYear: string) => {
return ( <>
<TableRow>
<TableHead rowSpan={1} colSpan={17} style={{ whiteSpace: 'pre-line' }}>{searchYear+'년도 운영실태'}</TableHead>
<TableHead rowSpan={1} colSpan={16} style={{ whiteSpace: 'pre-line' }}>{searchYear+'년도 운영실태'}</TableHead>
</TableRow>
<TableRow>{
upHeadList.map((head: TableUpperProps) =>
(head.upName === 'upChangeRe1'&&head.upSequnce===1?<TableHead key={head.id} rowSpan={2}colSpan={2} style={{ whiteSpace: 'pre-line' }}>{head.title}</TableHead>:
!head.upSequnce?<TableHead style={{ whiteSpace: 'pre-line' }} rowSpan={2}key={head.id}>{head.title}</TableHead>:
!head.upSequnce?<TableHead rowSpan={2}key={head.id}>{head.title}</TableHead>:
head.upName === 'upChangeRe2'&&head.upSequnce===1?<TableHead key={head.id} colSpan={3} style={{ whiteSpace: 'pre-line' }}>{'연간 운영실태'}</TableHead>:
head.upName === 'upChangeRe3'&&head.upSequnce===1?<TableHead key={head.id} colSpan={3} style={{ whiteSpace: 'pre-line' }}>{'하절기 운영실태\n(6~8월)'}</TableHead>:
head.upName === 'upChangeRe4'&&head.upSequnce===1?<TableHead key={head.id} colSpan={4} style={{ whiteSpace: 'pre-line' }}>{'동절기 운영실태\n(1~2월)'}</TableHead>:
head.upName === 'upChangeRe5'&&head.upSequnce===1?<TableHead key={head.id} colSpan={3} style={{ whiteSpace: 'pre-line' }}>{'지하수 유입량 추정'}</TableHead>:null))}
head.upName === 'upChangeRe5'&&head.upSequnce===1?<TableHead key={head.id} colSpan={3} style={{ whiteSpace: 'pre-line' }}>{'지하수유입량'}</TableHead>:null))}
</TableRow>
<TableRow>
{upHeadList.map((head: TableUpperProps) =>
(head.upName === 'upChangeRe2'||head.upName === 'upChangeRe3'||head.upName === 'upChangeRe4'||head.upName === 'upChangeRe5'?<TableHead style={{ whiteSpace: 'pre-line' }} key={head.id}>{head.title}</TableHead>:null))}
(head.upName === 'upChangeRe2'||head.upName === 'upChangeRe3'||head.upName === 'upChangeRe4'||head.upName === 'upChangeRe5' ?<TableHead key={head.id}>{head.title}</TableHead>:null))}
</TableRow>
</> )
}
@@ -238,10 +238,10 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
(head.id === 'flowRate' && index === 11)?<TableCell rowSpan={2} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdi'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdi'&&index === 0)?<TableCell rowSpan={2} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdi'&&index === 2)?<TableCell rowSpan={3} className={cn("sticky top-0 bg-secondary [&_tr]:border-b", "text-center" )} style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{'RDII추정시\n일강수량(mm)'}</TableCell>:
(head.id === 'rdi'&&index === 5)?<TableCell rowSpan={2} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el['rdiRain']}</TableCell>:
(head.id === 'rdi'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>:
(head.id === 'rdiRain'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el['rdiRain']}</TableCell>:
(head.id === 'rdiRain'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>:
(head.id === 'waterQlty')?<TableCell className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=5 && index<=10))?<TableCell className="bg-green-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
+12 -13
View File
@@ -14,7 +14,7 @@ const tabList = [
{ value: 'facilityInfo', label: '시설정보 및 운영현황' },
{ value: 'mainGraph', label: '주요그래프' },
{ value: 'rainManage', label: '강우일 운영현황' },
//{ value: 'drainageEquipment', label: '배수설비 정비현황' }
{ value: 'drainageEquipment', label: '배수설비 정비현황' }
];
export default function DashBoard() {
@@ -57,8 +57,7 @@ export default function DashBoard() {
/******************선택된 데이터******************/
// 연도
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0');
const [searchYear, setSearchYear] = useState<string>('2021');
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0');
// 시설명
const [fcltyList, setFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({
bscFctCd: '',
@@ -72,11 +71,11 @@ export default function DashBoard() {
if (!isInit) {
initializeCommonData();
setFcltyList({
bscFctCd: '26260PB001R',
bscFctNm: '수영',
fcltyCpc: 452000,
trtFrfNm: '표준활성슬러지법, MLE, MBR',
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
bscFctCd: '11000SW001R',
bscFctNm: '난지',
fcltyCpc: 860000,
trtFrfNm: '표준활성슬러지법, MLE, A2O',
efflWqltStndrdNm: '500톤 이상(Ⅲ지역)'
});
}
}, [isInit, initializeCommonData]);
@@ -258,11 +257,11 @@ 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톤 이상(Ⅲ지역)'
});
}
@@ -81,8 +81,7 @@ export default function FacilityPrecipitation() {
// 시설상태
const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
/**
* 페이지 함수
@@ -126,9 +125,9 @@ export default function FacilityPrecipitation() {
useEffect(() => {
if (!isInit) {
initializeCommonData();
searchFacilityPrecipitationList(1, 10, searchYear || "0");
searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0");
}
}, [isInit, initializeCommonData, searchFacilityPrecipitationList, searchYear]);
}, [isInit, initializeCommonData, searchFacilityPrecipitationList, selectSearchYear]);
useEffect(() => {
if (excelList && excelList.length > 0) {
@@ -63,7 +63,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let maxEfflWqltBod = 0;
let maxEfflWqltTn = 0;
let maxEfflWqltTp = 0;
let maxefflWqltToc = 0;
let maxefflWqltCod = 0;
let maxEfflWqltSs = 0;
let maxInflAssctAftWqltBod = 0;
@@ -80,7 +80,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0;
let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0;
let minEfflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTp) : 0;
let minefflWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltToc) : 0;
let minefflWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltCod) : 0;
let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0;
let minInflAssctAftWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltBod) : 0;
@@ -97,7 +97,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let avgEfflWqltBod = 0;
let avgEfflWqltTn = 0;
let avgEfflWqltTp = 0;
let avgefflWqltToc = 0;
let avgefflWqltCod = 0;
let avgEfflWqltSs = 0;
let avgInflAssctAftWqltBod = 0;
@@ -115,7 +115,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
const efflWqltBod = parseNumber(item.efflWqltBod);
const efflWqltTn = parseNumber(item.efflWqltTn);
const efflWqltTp = parseNumber(item.efflWqltTp);
const efflWqltToc = parseNumber(item.efflWqltToc);
const efflWqltCod = parseNumber(item.efflWqltCod);
const efflWqltSs = parseNumber(item.efflWqltSs);
const inflAssctAftWqltBod = parseNumber(item.inflAssctAftWqltBod);
@@ -133,7 +133,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
maxEfflWqltBod = Math.max(maxEfflWqltBod, efflWqltBod);
maxEfflWqltTn = Math.max(maxEfflWqltTn, efflWqltTn);
maxEfflWqltTp = Math.max(maxEfflWqltTp, efflWqltTp);
maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc);
maxefflWqltCod = Math.max(maxefflWqltCod, efflWqltCod);
maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs);
maxInflAssctAftWqltBod = Math.max(maxInflAssctAftWqltBod, inflAssctAftWqltBod);
@@ -150,7 +150,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
minEfflWqltBod = Math.min(minEfflWqltBod, efflWqltBod);
minEfflWqltTn = Math.min(minEfflWqltTn, efflWqltTn);
minEfflWqltTp = Math.min(minEfflWqltTp, efflWqltTp);
minefflWqltToc = Math.min(minefflWqltToc, efflWqltToc);
minefflWqltCod = Math.min(minefflWqltCod, efflWqltCod);
minEfflWqltSs = Math.min(minEfflWqltSs, efflWqltSs);
minInflAssctAftWqltBod = Math.min(minInflAssctAftWqltBod, inflAssctAftWqltBod);
@@ -167,7 +167,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
avgEfflWqltBod += efflWqltBod;
avgEfflWqltTn += efflWqltTn;
avgEfflWqltTp += efflWqltTp;
avgefflWqltToc += efflWqltToc;
avgefflWqltCod += efflWqltCod;
avgEfflWqltSs += efflWqltSs;
avgInflAssctAftWqltBod += inflAssctAftWqltBod;
@@ -186,7 +186,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
{
msrDt: '평균',
efflWqltBod: filteredData.length==0?'0.0':(Math.round(avgEfflWqltBod / filteredData.length * 10) / 10).toFixed(1),
efflWqltToc: filteredData.length==0?'0.0':(Math.round(avgefflWqltToc / filteredData.length * 10) / 10).toFixed(1),
efflWqltCod: filteredData.length==0?'0.0':(Math.round(avgefflWqltCod / filteredData.length * 10) / 10).toFixed(1),
efflWqltSs: filteredData.length==0?'0.0':(Math.round(avgEfflWqltSs / filteredData.length * 10) / 10).toFixed(1),
efflWqltTn: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTn / filteredData.length * 1000) / 1000).toFixed(3),
efflWqltTp: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTp / filteredData.length * 1000) / 1000).toFixed(3),
@@ -209,7 +209,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
{
msrDt : '최대',
efflWqltBod : Math.round(maxEfflWqltBod * 10) / 10?(Math.round(maxEfflWqltBod * 10) / 10).toFixed(1):'0.0',
efflWqltToc : Math.round(maxefflWqltToc * 10) / 10?(Math.round(maxefflWqltToc * 10) / 10).toFixed(1):'0.0',
efflWqltCod : Math.round(maxefflWqltCod * 10) / 10?(Math.round(maxefflWqltCod * 10) / 10).toFixed(1):'0.0',
efflWqltSs : Math.round(maxEfflWqltSs * 10) / 10?(Math.round(maxEfflWqltSs * 10) / 10).toFixed(1):'0.0',
efflWqltTn : Math.round(maxEfflWqltTn * 1000) / 1000?(Math.round(maxEfflWqltTn * 1000) / 1000).toFixed(3):'0.000',
efflWqltTp : Math.round(maxEfflWqltTp * 1000) / 1000?(Math.round(maxEfflWqltTp * 1000) / 1000).toFixed(3):'0.000',
@@ -232,7 +232,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
{
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',
efflWqltCod : Math.round(minefflWqltCod * 10) / 10?(Math.round(minefflWqltCod?minefflWqltCod:0 * 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',
@@ -299,16 +299,16 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
"유입TN(mg/L)": item.inflAssctAftWqltTn,
"유입TP(mg/L)": item.inflAssctBfrWqltTp,
"유출BOD(mg/L)": item.efflWqltBod,
"유출TOC(COD)(mg/L)": item.efflWqltToc,
"유출TOC(COD)(mg/L)": item.efflWqltCod,
"유출SS(mg/L)": item.efflWqltSs,
"유출TN(mg/L)": item.efflWqltTn,
"유출TP(mg/L)": item.efflWqltTp,
/* "강우량(mm/일)": item.infoRnDay?item.infoRnDay.toString():"0.0", */
"강우량(일)": item.infoRnDay?item.infoRnDay.toString():"0.0",
});
});
}
if (excelDownList && excelDownList.length > 0) {
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: searchYear+'년 '+fcltyName + ' 수질현황', sheetNameArray: [fcltyName + ' 수질현황'], headerRange: 'A1:K1' });
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: searchYear+'년 '+fcltyName + ' 수질현황', sheetNameArray: [fcltyName + ' 수질현황'], headerRange: 'A1:L1' });
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.');
}
@@ -351,7 +351,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
</div>
<div className="card-header">
<h3 className="text-2xl font-medium text-label">수질 TMS</h3>
{/*<h3 className="text-2xl font-medium text-label text-right">({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})</h3> */}
<h3 className="text-2xl font-medium text-label text-right">({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})</h3>
</div>
<div className="overflow-y-auto h-[250px]">
<UiTable
@@ -449,9 +449,6 @@ 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">☞ 청천시 : 강우량이 3mm미만의 날</span>
</div>
</TabsContent>
<TabsContent value="tab_term_rain">
@@ -479,9 +476,6 @@ 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">☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날</span>
</div>
</TabsContent>
</UITab>
</TabsContent>
+2 -3
View File
@@ -48,8 +48,7 @@ export default function ProcessFacilitySearch() {
const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1);
const [fcltyName, setFcltyName] = useState<string>("");
const [operationValue, setOperationValue] = useState<string>("0");
//const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYearValue, setSearchYearValue] = useState<string>("2023");
const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
const [fcltCpct, setFcltCpct] = useState<string>("0");
// 모달 상태 추가
@@ -197,7 +196,7 @@ export default function ProcessFacilitySearch() {
{selectedRow !== null && (
<UiModal
body={<WaterQualityModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={modalYear}></WaterQualityModal>}
bodyClass="sm:max-w-[90vw] w-[1300px] h-[920px]"
bodyClass="sm:max-w-[90vw] w-[1200px] h-[920px]"
open={selectedRow !== null}
onOpenChange={(open) => !open && closeModal()}
noHeaderYn="Y"
+62 -59
View File
@@ -52,7 +52,6 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
return Number(value.replace(/,/g, ''));
};
console.log('filteredData : ', filteredData);
let maxtotInflAmnt = 0;
let maxinflAmnt = 0;
let maxsumFlow = 0;
@@ -66,7 +65,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
let minsumFlow = parseNumber(filteredData[0]?.sumFlow);
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 mininfoRnDay = parseNumber(filteredData[0]?.infoRnDay);
let avgtotInflAmnt = 0;
let avginflAmnt = 0;
@@ -81,7 +80,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
const sumFlow = parseNumber(item.sumFlow);
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);
const infoRnDay = parseNumber(item.infoRnDay);
maxtotInflAmnt = Math.max(maxtotInflAmnt, totInflAmnt);
maxinflAmnt = Math.max(maxinflAmnt, inflAmnt);
maxsumFlow = Math.max(maxsumFlow, sumFlow);
@@ -167,7 +166,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
"연계처리량(m³/일)": item.sumFlow,
"총인반류수량(m³/일)": item.returnAmnt,
"방류량(m³/일)": item.efflAmnt,
/* "강우량(mm/일)": item.infoRnDay, */
"강우량": item.infoRnDay,
});
});
}
@@ -195,18 +194,20 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
ref={ref}
queryClick={filterData}
/>
<div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
<div className="h-[370px] overflow-y-auto overflow-x-auto">
<div className="w-[120%]">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
</div>
</div>
</TabsContent>
<TabsContent value="tab_term_summer">
@@ -219,18 +220,20 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
ref={ref}
queryClick={filterData}
/>
<div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
<div className="h-[370px] overflow-y-auto overflow-x-auto">
<div className="w-[120%]">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
</div>
</div>
</TabsContent>
<TabsContent value="tab_term_winter">
@@ -243,18 +246,20 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
ref={ref}
queryClick={filterData}
/>
<div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
<div className="h-[370px] overflow-y-auto overflow-x-auto">
<div className="w-[120%]">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
</div>
</div>
</TabsContent>
<TabsContent value="tab_term_chuncheon">
@@ -267,21 +272,20 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
ref={ref}
queryClick={filterData}
/>
<div className="h-[370px] overflow-y-auto overflow-x-hidden">
<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">☞ 청천시 : 강우량이 3mm미만의 날</span>
<div className="h-[370px] overflow-y-auto overflow-x-auto">
<div className="w-[120%]">
<UiTable
headName="유량현황"
tableData={copyYearList}
headlist={upHeadListFlowRateModalYear}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[370px]"
boldArray={[0,1,2]}
/>
</div>
</div>
</TabsContent>
<TabsContent value="tab_term_rain">
@@ -294,11 +298,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
ref={ref}
queryClick={filterData}
/>
<div className="h-[370px] overflow-y-auto overflow-x-hidden">
<div className="h-[370px] overflow-y-auto overflow-x-auto">
<div className="w-[120%]">
<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">☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날</span>
</div>
</div>
</TabsContent>
</UITab>
+4 -6
View File
@@ -49,8 +49,7 @@ export default function ProcessFacilitySearch() {
const [fcltCpct, setFcltCpct] = useState<string>("0");
const [fcltyName, setFcltyName] = useState<string>("");
const [operationValue, setOperationValue] = useState<string>("0");
//const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYearValue, setSearchYearValue] = useState<string>("2023");
const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
const [widthSize, setWidthSize] = useState<string>("w-[120%]");
const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1);
const [resetPage, setResetPage] = useState<boolean>(false);
@@ -126,11 +125,10 @@ export default function ProcessFacilitySearch() {
// 시도 데이터 초기화
useEffect(() => {
if(!isInit) {
console.log('searchYearValue', searchYearValue, isInit);
initializeCommonData();
searchFlowRateList(1, 10, searchYearValue || "0");
searchFlowRateList(1, 10, selectSearchYear[0]?.val || "0");
}
}, [isInit, initializeCommonData, searchFlowRateList, searchYearValue]);
}, [isInit, initializeCommonData, searchFlowRateList, selectSearchYear]);
useEffect(() => {
if (excelList && excelList.length > 0) {
@@ -199,7 +197,7 @@ export default function ProcessFacilitySearch() {
{selectedRow !== null && (
<UiModal
body={<FlowRateModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={searchYearValue}></FlowRateModal>}
bodyClass="sm:max-w-[90vw] w-[1250px] h-[780px]"
bodyClass="sm:max-w-[90vw] w-[1050px] h-[700px]"
open={selectedRow !== null}
onOpenChange={(open: boolean) => !open && closeModal()}
/>
+1 -7
View File
@@ -70,8 +70,7 @@ export default function PlanSewage() {
// 시설상태
const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
/**
* 페이지 함수
@@ -191,11 +190,6 @@ export default function PlanSewage() {
<div className={widthSize}>
<UiTable cellClick={ undefined } headName={"계획하수량 산정지표 현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
</div>
<div className="mt-14">
<span className="text-2xl font-bold text-gray-500">☞ 여유용량 = 하수처리시설 시설용량 – 건기시 유입유량(평균)​</span><br/>
<span className="text-2xl font-bold text-gray-500">☞ 변동부하율 = 건기시 일최대 유량/일평균​유량(기준 최근 3개년)​</span><br/>
<span className="text-2xl font-bold text-gray-500">☞ 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) ×100</span><br/>
</div>
</div>
</ListDiv>
</MainDiv>
+77 -8
View File
@@ -1,35 +1,104 @@
"use client"
import { useFoStore } from "@/app/store";
import type { modalTableType } from "@/app/store/sewageOccur";
import type { SewageOccurDetailProps } from "@/app/store/sewageOccur";
import { DateMonthPicker, 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 { useEffect, useState } from "react";
export default function SewageOccurModal(props: { fcltyName: string; facilityCd : string; searchYear : string}) {
// 그리드 관련
const {SewageOccurDetail, searchSewageOccurDetailList} = useFoStore((state) => state);
const {SewageOccurDetail} = useFoStore((state) => state);
// searchYear 유효성 검사 및 기본값 설정
const validSearchYear = props.searchYear && /^\d{4}$/.test(props.searchYear) ? props.searchYear : new Date().getFullYear().toString();
const [startYearMonth, setStartYearMonth] = useState(validSearchYear+'01');
const [endYearMonth, setEndYearMonth] = useState(validSearchYear+'12');
const [detailList, setDetailList] = useState<modalTableType[]>([]);
const [detailList, setDetailList] = useState<SewageOccurDetailProps[]>([]);
const {
upHeadListSewageOccurDetail,
gridListSewageOccurDetail
} = SewageOccurDetail;
useEffect(() => {
searchSewageOccurDetailList(props.facilityCd, validSearchYear);
}, [searchSewageOccurDetailList, props.facilityCd, validSearchYear]);
useEffect(() => {
setDetailList(gridListSewageOccurDetail);
}, [gridListSewageOccurDetail]);
useEffect(() => {
const filteredList = gridListSewageOccurDetail.filter(item => item.msrDt.replace(/-/g, '') >= startYearMonth && item.msrDt.replace(/-/g, '') <= endYearMonth);
let maxWaterUsage = 0;
let maxSwageChangePercent = 0;
let maxEstimationSewage = 0;
let minWaterUsage = filteredList[0]?.waterUsage || 0;
let minSwageChangePercent = filteredList[0]?.swageChangePercent || 0;
let minEstimationSewage = filteredList[0]?.estimationSewage || 0;
let totalWaterUsage = 0;
let totalSwageChangePercent = 0;
let totalEstimationSewage = 0;
let avgWaterUsage = 0;
let avgSwageChangePercent = 0;
let avgEstimationSewage = 0;
filteredList.forEach(item => {
if (item.waterUsage > maxWaterUsage) {
maxWaterUsage = item.waterUsage;
}
if (item.swageChangePercent > maxSwageChangePercent) {
maxSwageChangePercent = item.swageChangePercent;
}
if (item.estimationSewage > maxEstimationSewage) {
maxEstimationSewage = item.estimationSewage;
}
if (item.waterUsage < minWaterUsage) {
minWaterUsage = item.waterUsage;
}
if (item.swageChangePercent < minSwageChangePercent) {
minSwageChangePercent = item.swageChangePercent;
}
if (item.estimationSewage < minEstimationSewage) {
minEstimationSewage = item.estimationSewage;
}
totalWaterUsage += item.waterUsage;
totalSwageChangePercent += item.swageChangePercent;
totalEstimationSewage += item.estimationSewage;
});
avgWaterUsage = totalWaterUsage?totalWaterUsage / filteredList.length:0;
avgSwageChangePercent = totalSwageChangePercent?totalSwageChangePercent / filteredList.length:0;
avgEstimationSewage = totalEstimationSewage?totalEstimationSewage / filteredList.length:0;
const newData = [
{
msrDt: '평균',
waterUsage: Math.round(avgWaterUsage * 100) / 100,
swageChangePercent: Math.round(avgSwageChangePercent * 100) / 100,
estimationSewage: Math.round(avgEstimationSewage * 100) / 100
},
{
msrDt: '최대',
waterUsage: maxWaterUsage,
swageChangePercent: maxSwageChangePercent,
estimationSewage: maxEstimationSewage
},
{
msrDt: '최소',
waterUsage: minWaterUsage,
swageChangePercent: minSwageChangePercent,
estimationSewage: minEstimationSewage
},
...filteredList
]
setDetailList(newData);
}, [startYearMonth, endYearMonth, gridListSewageOccurDetail]);
return (
<>
<ListDiv className="!h-[80px] !mt-10">
+5 -11
View File
@@ -18,8 +18,7 @@ export default function PlanSewage() {
SewageOccur: { sewageOccurList: [], sewageOccurCount: 0, excelList: [], upHeadList1: [], upHeadList2: [], upHeadList3: [] },
SewageOccurSearch: { labelArray: [] },
initializeCommonData: () => {},
searchSewageOccurList: () => {},
calculateModalDataForAllFacilities: async () => []
searchSewageOccurList: () => {}
};
const {
@@ -84,8 +83,7 @@ export default function PlanSewage() {
// 시설상태
const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간
// const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
/**
* 페이지 함수
@@ -128,9 +126,9 @@ export default function PlanSewage() {
useEffect(() => {
if (!isInit) {
initializeCommonData();
searchSewageOccurList(1, 10, searchYear || "0");
searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0");
}
}, [isInit, initializeCommonData, searchSewageOccurList, searchYear]);
}, [isInit, initializeCommonData, searchSewageOccurList, selectSearchYear]);
useEffect(() => {
if (excelList && excelList.length > 0) {
@@ -226,11 +224,7 @@ export default function PlanSewage() {
</ContentsDiv>
{selectedRow !== null && (
<UiModal
body={<SewageOccurModal
fcltyName={fcltyNm}
facilityCd={fcltyCd}
searchYear={searchYear}
/>}
body={<SewageOccurModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={searchYear}></SewageOccurModal>}
bodyClass="sm:max-w-[90vw] w-[1000px] h-[770px]"
open={selectedRow !== null}
onOpenChange={(open) => !open && closeModal()}
+1 -2
View File
@@ -82,8 +82,7 @@ export default function UnderWaterInput() {
// 시설상태
const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
/**
* 페이지 함수
+11
View File
@@ -3,6 +3,8 @@
====================================**/
import { getFetch } from "@/app/components/api";
import { LoginApi } from "@/src/entities/auth";
import type { ILogin } from "@/src/entities/auth/model/login-interface";
/**
* STORE - TYPE
@@ -411,6 +413,15 @@ export const CommonReducer:(set:(fn: (state: CommonType) => CommonType) => void)
// 시도 변경 이벤트
initializeCommonData: async () => {
const payLoad : ILogin = {
userId: "tuser10003",
password: "test1234!"
};
console.log(payLoad.userId)
console.log(payLoad.password)
LoginApi.login(payLoad);
const promiseSet = await Promise.all([fetchSidoData(), fetchSigunData(), fetchRegionData(), fetchUnitWaterShedData(), fetchMiddleRegionData(), fetchEnvPartData()]);
const [sidoData, sggData, regionData, unitData, midData, envData] = promiseSet;
set((state: CommonType) => ({
+80 -82
View File
@@ -347,7 +347,6 @@ const upHeadListOperationStatus : TableUpperProps[] = [
{ id: "groundWaterSummer", title: "하절기\n평균", upName:"upChangeRe5", upSequnce:2 },
{ id: "groundWaterWinter", title: "동절기\n평균", upName:"upChangeRe5", upSequnce:3 },
{ id: "rdi", title: "RDII 추정" },
{ id: "rdiRain", title: "RDII 추정시\n일강수량(mm)" },
]
const upHeadListRainManage : TableUpperProps[] = [
@@ -1208,42 +1207,42 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
}
const fcltyCpcValue = res.data.wqltObjs[0].fctCpc;
const itemList = ['계', '3~10mm 미만', '10~20mm 미만', '20~30mm 미만', '30~40mm 미만', '40~50mm 미만', '50mm~60mm 미만', '60mm 이상'];
const rainRate = ['0', '0', '0', '0', '0', '0', '0', '0'];
const rainDate = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAmtCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAmnt = [0, 0, 0, 0, 0, 0, 0, 0];
const fcltyCpct = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltBod: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltCod: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltSs: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltTn: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltTp: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltToc = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltCodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltCod = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
const itemList = ['계', '3mm 미만', '3~10mm 미만', '10~20mm 미만', '20~30mm 미만', '30~40mm 미만', '40~50mm 미만', '50mm~60mm 미만', '60mm 이상'];
const rainRate = ['0', '0', '0', '0', '0', '0', '0', '0', '0'];
const rainDate = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAmtCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAmnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const fcltyCpct = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltBod: number[] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltCod: number[] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltSs: number[] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltTn: number[] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltTp: number[] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltBod = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltToc = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltSs = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTn = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTp = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltBod = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltCodCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltCod = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltSs = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTn = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTp = [0, 0, 0, 0, 0, 0, 0, 0, 0];
// Process the data and create rain management list
res.data.wqltObjs.forEach((item: RainManageListProps) => {
// 강우일
/*if(Number(item.infoRnDay) < 3){
if(Number(item.infoRnDay) < 3){
rainDate[1] = Number(rainDate[1] || 0) + 1;
inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1;
inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0);
@@ -1268,33 +1267,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);
}*/
if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){
rainDate[1] = Number(rainDate[1] || 0) + 1;
inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1;
inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[1] = 0;
inflAssctAftWqltBodCnt[1] = Number(inflAssctAftWqltBodCnt[1] || 0) + 1;
inflAssctAftWqltBod[1] = Number(inflAssctAftWqltBod[1] || 0) + Number(item.inflAssctAftWqltBod || 0);
inflAssctAftWqltTocCnt[1] = Number(inflAssctAftWqltTocCnt[1] || 0) + 1;
inflAssctAftWqltToc[1] = Number(inflAssctAftWqltToc[1] || 0) + Number(item.inflAssctAftWqltToc || 0);
inflAssctAftWqltSsCnt[1] = Number(inflAssctAftWqltSsCnt[1] || 0) + 1;
inflAssctAftWqltSs[1] = Number(inflAssctAftWqltSs[1] || 0) + Number(item.inflAssctAftWqltSs || 0);
inflAssctAftWqltTnCnt[1] = Number(inflAssctAftWqltTnCnt[1] || 0) + 1;
inflAssctAftWqltTn[1] = Number(inflAssctAftWqltTn[1] || 0) + Number(item.inflAssctAftWqltTn || 0);
inflAssctAftWqltTpCnt[1] = Number(inflAssctAftWqltTpCnt[1] || 0) + 1;
inflAssctAftWqltTp[1] = Number(inflAssctAftWqltTp[1] || 0) + Number(item.inflAssctAftWqltTp || 0);
efflWqltBodCnt[1] = Number(efflWqltBodCnt[1] || 0) + 1;
efflWqltBod[1] = Number(efflWqltBod[1] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[1] = Number(efflWqltCodCnt[1] || 0) + 1;
efflWqltCod[1] = Number(efflWqltCod[1] || 0) + Number(item.efflWqltCod || 0);
efflWqltSsCnt[1] = Number(efflWqltSsCnt[1] || 0) + 1;
efflWqltSs[1] = Number(efflWqltSs[1] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[1] = Number(efflWqltTnCnt[1] || 0) + 1;
efflWqltTn[1] = Number(efflWqltTn[1] || 0) + Number(item.efflWqltTn || 0);
efflWqltTpCnt[1] = Number(efflWqltTpCnt[1] || 0) + 1;
efflWqltTp[1] = Number(efflWqltTp[1] || 0) + Number(item.efflWqltTp || 0);
}else if(Number(item.infoRnDay) >= 10 && Number(item.infoRnDay) < 20){
}else if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){
rainDate[2] = Number(rainDate[2] || 0) + 1;
inflAmtCnt[2] = Number(inflAmtCnt[2] || 0) + 1;
inflAmnt[2] = Number(inflAmnt[2] || 0) + Number(item.inflAmnt || 0);
@@ -1310,7 +1283,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAssctAftWqltTpCnt[2] = Number(inflAssctAftWqltTpCnt[2] || 0) + 1;
inflAssctAftWqltTp[2] = Number(inflAssctAftWqltTp[2] || 0) + Number(item.inflAssctAftWqltTp || 0);
efflWqltBodCnt[2] = Number(efflWqltBodCnt[2] || 0) + 1;
efflWqltBod[2] = Number(efflWqltBod[2] || 0) + Number(item.efflWqltBod || 0);
efflWqltBod[2] = Number(efflWqltBod[2] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[2] = Number(efflWqltCodCnt[2] || 0) + 1;
efflWqltCod[2] = Number(efflWqltCod[2] || 0) + Number(item.efflWqltCod || 0);
efflWqltSsCnt[2] = Number(efflWqltSsCnt[2] || 0) + 1;
@@ -1319,7 +1292,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(Number(item.infoRnDay) >= 10 && Number(item.infoRnDay) < 20){
rainDate[3] = Number(rainDate[3] || 0) + 1;
inflAmtCnt[3] = Number(inflAmtCnt[3] || 0) + 1;
inflAmnt[3] = Number(inflAmnt[3] || 0) + Number(item.inflAmnt || 0);
@@ -1344,11 +1317,11 @@ 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(Number(item.infoRnDay) >= 20 && Number(item.infoRnDay) < 30){
rainDate[4] = Number(rainDate[4] || 0) + 1;
inflAmtCnt[4] = Number(inflAmtCnt[4] || 0) + 1;
inflAmnt[4] = Number(inflAmnt[4] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[4] = item.inflAmnt&&Number(item.inflAmnt) !== 0 ? Number(Math.round(Number(item.inflAmnt) / Number(item.fctCpc) * 10) / 10) : 0;
fcltyCpct[4] = 0;
inflAssctAftWqltBodCnt[4] = Number(inflAssctAftWqltBodCnt[4] || 0) + 1;
inflAssctAftWqltBod[4] = Number(inflAssctAftWqltBod[4] || 0) + Number(item.inflAssctAftWqltBod || 0);
inflAssctAftWqltTocCnt[4] = Number(inflAssctAftWqltTocCnt[4] || 0) + 1;
@@ -1356,7 +1329,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAssctAftWqltSsCnt[4] = Number(inflAssctAftWqltSsCnt[4] || 0) + 1;
inflAssctAftWqltSs[4] = Number(inflAssctAftWqltSs[4] || 0) + Number(item.inflAssctAftWqltSs || 0);
inflAssctAftWqltTnCnt[4] = Number(inflAssctAftWqltTnCnt[4] || 0) + 1;
inflAssctAftWqltTn[4] = Number(inflAssctAftWqltTn[5] || 0) + Number(item.inflAssctAftWqltTn || 0);
inflAssctAftWqltTn[4] = Number(inflAssctAftWqltTn[4] || 0) + Number(item.inflAssctAftWqltTn || 0);
inflAssctAftWqltTpCnt[4] = Number(inflAssctAftWqltTpCnt[4] || 0) + 1;
inflAssctAftWqltTp[4] = Number(inflAssctAftWqltTp[4] || 0) + Number(item.inflAssctAftWqltTp || 0);
efflWqltBodCnt[4] = Number(efflWqltBodCnt[4] || 0) + 1;
@@ -1365,15 +1338,15 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
efflWqltCod[4] = Number(efflWqltCod[4] || 0) + Number(item.efflWqltCod || 0);
efflWqltSsCnt[4] = Number(efflWqltSsCnt[4] || 0) + 1;
efflWqltSs[4] = Number(efflWqltSs[4] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[4] = Number(efflWqltTnCnt[5] || 0) + 1;
efflWqltTnCnt[4] = Number(efflWqltTnCnt[4] || 0) + 1;
efflWqltTn[4] = Number(efflWqltTn[4] || 0) + Number(item.efflWqltTn || 0);
efflWqltTpCnt[4] = Number(efflWqltTpCnt[5] || 0) + 1;
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(Number(item.infoRnDay) >= 30 && Number(item.infoRnDay) < 40){
rainDate[5] = Number(rainDate[5] || 0) + 1;
inflAmtCnt[5] = Number(inflAmtCnt[5] || 0) + 1;
inflAmnt[5] = Number(inflAmnt[5] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[5] = 0;
fcltyCpct[5] = item.inflAmnt&&Number(item.inflAmnt) !== 0 ? Number(Math.round(Number(item.inflAmnt) / Number(item.fctCpc) * 10) / 10) : 0;
inflAssctAftWqltBodCnt[5] = Number(inflAssctAftWqltBodCnt[5] || 0) + 1;
inflAssctAftWqltBod[5] = Number(inflAssctAftWqltBod[5] || 0) + Number(item.inflAssctAftWqltBod || 0);
inflAssctAftWqltTocCnt[5] = Number(inflAssctAftWqltTocCnt[5] || 0) + 1;
@@ -1394,7 +1367,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(Number(item.infoRnDay) >= 40 && Number(item.infoRnDay) < 50){
rainDate[6] = Number(rainDate[6] || 0) + 1;
inflAmtCnt[6] = Number(inflAmtCnt[6] || 0) + 1;
inflAmnt[6] = Number(inflAmnt[6] || 0) + Number(item.inflAmnt || 0);
@@ -1419,7 +1392,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(Number(item.infoRnDay) >= 50 && Number(item.infoRnDay) < 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);
@@ -1444,6 +1417,31 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
efflWqltTn[7] = Number(efflWqltTn[7] || 0) + Number(item.efflWqltTn || 0);
efflWqltTpCnt[7] = Number(efflWqltTpCnt[7] || 0) + 1;
efflWqltTp[7] = Number(efflWqltTp[7] || 0) + Number(item.efflWqltTp || 0);
}else if(Number(item.infoRnDay) >= 60){
rainDate[8] = Number(rainDate[8] || 0) + 1;
inflAmtCnt[8] = Number(inflAmtCnt[8] || 0) + 1;
inflAmnt[8] = Number(inflAmnt[8] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[8] = 0;
inflAssctAftWqltBodCnt[8] = Number(inflAssctAftWqltBodCnt[8] || 0) + 1;
inflAssctAftWqltBod[8] = Number(inflAssctAftWqltBod[8] || 0) + Number(item.inflAssctAftWqltBod || 0);
inflAssctAftWqltTocCnt[8] = Number(inflAssctAftWqltTocCnt[8] || 0) + 1;
inflAssctAftWqltToc[8] = Number(inflAssctAftWqltToc[8] || 0) + Number(item.inflAssctAftWqltToc || 0);
inflAssctAftWqltSsCnt[8] = Number(inflAssctAftWqltSsCnt[8] || 0) + 1;
inflAssctAftWqltSs[8] = Number(inflAssctAftWqltSs[8] || 0) + Number(item.inflAssctAftWqltSs || 0);
inflAssctAftWqltTnCnt[8] = Number(inflAssctAftWqltTnCnt[8] || 0) + 1;
inflAssctAftWqltTn[8] = Number(inflAssctAftWqltTn[8] || 0) + Number(item.inflAssctAftWqltTn || 0);
inflAssctAftWqltTpCnt[8] = Number(inflAssctAftWqltTpCnt[8] || 0) + 1;
inflAssctAftWqltTp[8] = Number(inflAssctAftWqltTp[8] || 0) + Number(item.inflAssctAftWqltTp || 0);
efflWqltBodCnt[8] = Number(efflWqltBodCnt[8] || 0) + 1;
efflWqltBod[8] = Number(efflWqltBod[8] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[8] = Number(efflWqltCodCnt[8] || 0) + 1;
efflWqltCod[8] = Number(efflWqltCod[8] || 0) + Number(item.efflWqltCod || 0);
efflWqltSsCnt[8] = Number(efflWqltSsCnt[8] || 0) + 1;
efflWqltSs[8] = Number(efflWqltSs[8] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[8] = Number(efflWqltTnCnt[8] || 0) + 1;
efflWqltTn[8] = Number(efflWqltTn[8] || 0) + Number(item.efflWqltTn || 0);
efflWqltTpCnt[8] = Number(efflWqltTpCnt[8] || 0) + 1;
efflWqltTp[8] = Number(efflWqltTp[8] || 0) + Number(item.efflWqltTp || 0);
}
});
@@ -1490,7 +1488,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
rainDate[0] = (Number(rainDate[1]) || 0) + (Number(rainDate[2]) || 0) + (Number(rainDate[3]) || 0) +
(Number(rainDate[4]) || 0) + (Number(rainDate[5]) || 0) + (Number(rainDate[6]) || 0) +
(Number(rainDate[7]) || 0);
(Number(rainDate[7]) || 0) + (Number(rainDate[8]) || 0);
// 강수비율
for(let idx=0; idx<rainDate.length; idx++){
@@ -1534,16 +1532,16 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmnt[0] = calculateAverage(calculateTotal(inflAmnt), dataIsCount);
fcltyCpct[0] = calculateTotal(fcltyCpct);
inflAssctAftWqltBod[0] = Number((calculateTotal(inflAssctAftWqltBod)/7).toFixed(1));
inflAssctAftWqltToc[0] = Number((calculateTotal(inflAssctAftWqltToc)/7).toFixed(1));
inflAssctAftWqltSs[0] = Number((calculateTotal(inflAssctAftWqltSs)/7).toFixed(1));
inflAssctAftWqltTn[0] = Number((calculateTotal(inflAssctAftWqltTn)/7).toFixed(3));
inflAssctAftWqltTp[0] = Number((calculateTotal(inflAssctAftWqltTp)/7).toFixed(3));
efflWqltBod[0] = Number((calculateTotal(efflWqltBod)/7).toFixed(1));
efflWqltCod[0] = Number((calculateTotal(efflWqltCod)/7).toFixed(1));
efflWqltSs[0] = Number((calculateTotal(efflWqltSs as number[])/7).toFixed(1));
efflWqltTn[0] = Number((calculateTotal(efflWqltTn as number[])/7).toFixed(3));
efflWqltTp[0] = Number((calculateTotal(efflWqltTp as number[])/7).toFixed(3));
inflAssctAftWqltBod[0] = Number((calculateTotal(inflAssctAftWqltBod)/8).toFixed(1));
inflAssctAftWqltToc[0] = Number((calculateTotal(inflAssctAftWqltToc)/8).toFixed(1));
inflAssctAftWqltSs[0] = Number((calculateTotal(inflAssctAftWqltSs)/8).toFixed(1));
inflAssctAftWqltTn[0] = Number((calculateTotal(inflAssctAftWqltTn)/8).toFixed(3));
inflAssctAftWqltTp[0] = Number((calculateTotal(inflAssctAftWqltTp)/8).toFixed(3));
efflWqltBod[0] = Number((calculateTotal(efflWqltBod)/8).toFixed(1));
efflWqltCod[0] = Number((calculateTotal(efflWqltCod)/8).toFixed(1));
efflWqltSs[0] = Number((calculateTotal(efflWqltSs as number[])/8).toFixed(1));
efflWqltTn[0] = Number((calculateTotal(efflWqltTn as number[])/8).toFixed(3));
efflWqltTp[0] = Number((calculateTotal(efflWqltTp as number[])/8).toFixed(3));
// 최종 리스트
const filteredData = itemList.map((item, index) => ({
+16 -16
View File
@@ -28,7 +28,7 @@ export interface FacilityWaterQltyProps {
inflAssctAftWqltTp: string | '',
inflAssctBfrWqltTp: string | '',
efflWqltBod: string | '',
efflWqltToc: string | '',
efflWqltCod: string | '',
efflWqltSs: string | '',
efflWqltTn: string | '',
efflWqltTp: string | '',
@@ -104,7 +104,7 @@ export type modalExcelType = {
"유출SS(mg/L)": string;
"유출TN(mg/L)": string;
"유출TP(mg/L)": string;
/* "강우량(mm/일)": string; */
"강우량(일)": string;
}
/**====================================
@@ -133,7 +133,7 @@ const upHeadList1: TableUpperProps[] = [
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1 },
{ id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1 },
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1 },
{ id: "efflWqltCod", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1 },
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1 },
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 4, align: "right", row: 1 },
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1 },
@@ -157,7 +157,7 @@ const upHeadList2: TableUpperProps[] = [
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
{ id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 },
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
{ id: "efflWqltCod", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
@@ -185,7 +185,7 @@ const upHeadList3: TableUpperProps[] = [
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
{ id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 },
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
{ id: "efflWqltCod", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 },
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
@@ -203,11 +203,11 @@ const upHeadListModalYear: TableUpperProps[] = [
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" },
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe2", upSequnce: 1, align: "right" },
{ id: "efflWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" },
{ id: "efflWqltCod", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" },
{ 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: "infoRnDay", title: "강우량", align: "right" },
];
// 처리시설 수질현황 헤더(모달-수질TMS)
@@ -409,8 +409,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
if(item.inflAssctAftWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
}
if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
if(item.efflWqltCod){
item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1);
}
if(item.inflAssctAftWqltBod){
item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1);
@@ -427,8 +427,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
if(item.inflAssctAftWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
}
if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
if(item.efflWqltCod){
item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1);
}
return item;
});
@@ -456,7 +456,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
유입TN: item.inflAssctAftWqltTn,
유입TP: item.inflAssctAftWqltTp,
유출BOD: item.efflWqltBod,
유출TOC: item.efflWqltToc,
유출TOC: item.efflWqltCod,
유출SS: item.efflWqltSs,
유출TN: item.efflWqltTn,
유출TP: item.efflWqltTp,
@@ -610,8 +610,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
if(item.inflAssctAftWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
}
if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
if(item.efflWqltCod){
item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1);
}
if(item.inflAssctAftWqltBod){
item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1);
@@ -628,8 +628,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
if(item.inflAssctAftWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1);
}
if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
if(item.efflWqltCod){
item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1);
}
if(item.tpInflWqltBod){
+16 -18
View File
@@ -13,8 +13,8 @@ const FlowRateSearchLabelArray:string[] = ['구분', '시도', '시군구', '용
export type flowRateListProps = {
bscFctCd : string,
sido : string,
gugun : string,
sidoNm : string,
sggNm : string,
bscFctNm : string,
daddr : string,
fctCpc : number,
@@ -50,13 +50,13 @@ export interface ExcelType {
}
export type modalExcelType = {
"날짜": string,
날짜: string,
"총유입량(m³/일)": number | '',
"하수유입량(m³/일)": number | '',
"연계처리량(m³/일)": number | '',
"총인반류수량(m³/일)": number | '',
"방류량(m³/일)": number | '',
/* "강우량(mm/일)": number | string | '', */
"강우량": number | string | '',
}
/**
* (2) 모달
@@ -93,8 +93,8 @@ export type FlowRateModalProps = {
const upHeadList1:TableUpperProps[] = [
{ id: "bscFctCd", title: "시설코드", row:0, rowSpan:2},
{ id: "A", title: "행정명", row: 0 ,colSpan: 2 },
{ id: "sido", title: "시도", upName:"upChangeRe", row:1 },
{ id: "gugun", title: "시군구", upName:"upChangeRe", row:1 },
{ id: "sidoNm", title: "시도", upName:"upChangeRe", row:1 },
{ id: "sggNm", title: "시군구", upName:"upChangeRe", row:1 },
{ 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},
@@ -131,8 +131,8 @@ const upHeadList3:TableUpperProps[] = [
{ id: "mdmbsn", title: "중권역", upName:"upChangeRe1", row:1 },
{ id: "rgnNm", title: "환경청", row:0, rowSpan:2 },
{ id: "B", title: "행정명", row: 0 ,colSpan: 2 },
{ id: "sido", title: "시도", upName:"upChangeRe2", row:1 },
{ id: "gugun", title: "시군구", upName:"upChangeRe2", row:1 },
{ id: "ctpvNm", title: "시도", upName:"upChangeRe2", row:1 },
{ id: "sggNm", title: "시군구", upName:"upChangeRe2", row:1 },
{ 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 },
@@ -157,7 +157,7 @@ const upHeadListFlowRateModal:TableUpperProps[] = [
{ id: "sumFlow", title: "연계처리량(m³/일)", align:"right"},
{ id: "returnAmnt", title: "총인 반류수량(m³/일)", align:"right"},
{ id: "efflAmnt", title: "방류량(m³/일)", align:"right"},
/* { id: "infoRnDay", title: "강우량(mm/일)", align:"right"} */
{ id: "infoRnDay", title: "강우량", align:"right"}
]
const modalFlowRateListYear:FlowRateModalProps[] = [
@@ -268,8 +268,11 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data;
const excelDownList: ExcelType[] = [];
const rtnData = data.map((item: flowRateListProps) => {
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0)
dataFormSetting(item);
return item;
@@ -283,8 +286,8 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
단위유역: item.lgbsn,
중권역: item.mdmbsn,
환경청: item.rgnNm,
시도: item.sido,
시군구: item.gugun,
시도: item.sidoNm,
시군구: item.sggNm,
시설이름: item.bscFctNm,
주소: item.daddr,
용량: item.fctCpc,
@@ -297,6 +300,7 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
});
}
console.log('excelDownList' , excelDownList);
set((state: FlowRateSearchType) => ({
...state,
FlowRateList: pageSize<5000?{
@@ -312,14 +316,8 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => {
const res = await fetchFlowRateModalList(bscFctCd, searchYear);
const data = res.data;
const tmpData:FlowRateModalProps[] = [];
data.forEach((item: FlowRateModalProps) => {
if(item.infoRnDay && item.infoRnDay.toString().trim() === 'x') {
item.infoRnDay = '';
}
});
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용
for(let idx = 0; idx < data.length; idx++) {
const item = data[idx];
+225 -102
View File
@@ -1,3 +1,4 @@
import DataForm from "@/app/components/common/DataForm";
import type { TableUpperProps } from "../dashboard";
import { getFetch } from "@/app/components/api";
export type { TableUpperProps };
@@ -28,14 +29,21 @@ export type SewageOccurProps = {
mdmbsn : string,
msrDt : string,
}
export type modalTableType = { msrDt: string,waterUsage: number,swageChangePercent: number,estimationSewage: number};
export type SewageOccurDetailProps = {
cnt : number,
sum : number,
yr:string,
usege:number
msrDt : string,
waterUsage : number,
swageChangePercent : number,
estimationSewage : number,
}
/**====================================
* Store - data
====================================*/
/**
* (1) 메인페이지
*/
// 검색단
const LabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별'];
@@ -112,13 +120,159 @@ const upHeadList3:TableUpperProps[] = [
const upHeadListSewageOccurDetail:TableUpperProps[] = [
{ id: "msrDt", title: "년월" },
{ id: "waterUsage", title: "물사용량(m³/일)" },
{ id: "swageChangePercent", title: "오수전환율(%)" },
{ id: "swageChangePercent", title: "오수전환율" },
{ id: "estimationSewage", title: "오수발생량 추정(m³/일)", row:0, rowSpan:2 },
];
const sewageOccurList:SewageOccurProps[] = []
const sewageOccurList:SewageOccurProps[] = [
]
const tempSewageOccurList:modalTableType[] = []
const tempSewageOccurList:SewageOccurDetailProps[] = [
{
msrDt: '2024-01',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 60,
},
{
msrDt: '2024-02',
waterUsage: 106,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-03',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-04',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-05',
waterUsage: 100,
swageChangePercent: 10,
estimationSewage: 80,
},
{
msrDt: '2024-06',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-07',
waterUsage: 100,
swageChangePercent: 580,
estimationSewage: 80,
},
{
msrDt: '2024-08',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-09',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-10',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-11',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2024-12',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-01',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-02',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-03',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-04',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-05',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-06',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-07',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-08',
waterUsage: 100,
swageChangePercent: 0.8,
estimationSewage: 80,
},
{
msrDt: '2025-09',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-10',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-11',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
{
msrDt: '2025-12',
waterUsage: 100,
swageChangePercent: 80,
estimationSewage: 80,
},
]
/**====================================
* Store - API
@@ -126,6 +280,11 @@ const tempSewageOccurList:modalTableType[] = []
const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
// 20250701임시시
console.log("partCd", partCd);
console.log("nameCd", nameCd);
console.log("fcltCpct", fcltCpct);
console.log("operationValue", operationValue);
console.log("fcltyNm", fcltyNm);
console.log("searchYear", searchYear);
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
@@ -140,18 +299,11 @@ const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear
return { data: res.data, count: res.count } */
}
const fetchSewageOccurDetailList = async (bscFctCd: string, searchYear: string) => {
const url = '/fclt/flow/' + bscFctCd + '/' + searchYear;
const res = await getFetch('fo', url);
return { data: res.data, count: res.count }
}
/**====================================
* Store - expaort
====================================*/
export type SewageOccurActions = {
searchSewageOccurList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void;
searchSewageOccurDetailList: (bscFctCd: string, searchYear: string) => void;
}
export type SewageOccurType = {
@@ -173,7 +325,7 @@ export type SewageOccurType = {
SewageOccurDetail : {
isInit: boolean;
upHeadListSewageOccurDetail: TableUpperProps[];
gridListSewageOccurDetail: modalTableType[];
gridListSewageOccurDetail: SewageOccurDetailProps[];
}
}
@@ -200,6 +352,14 @@ export const sewageOccurInitState: SewageOccurType = {
}
}
const dataFormSetting=(item : SewageOccurProps)=> {
DataForm({ type: 'float1', column: 'fctCpc', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float1', column: 'waterUsage', item: item as unknown as Record<string, unknown>});
DataForm({ type: 'float2', column: 'estimationSewage', item: item as unknown as Record<string, unknown>});
DataForm({ type: 'float2', column: 'sewageInputYear', item: item as unknown as Record<string, unknown>});
DataForm({ type: 'float2', column: 'sewageInputChungchun', item: item as unknown as Record<string, unknown>});
}
export type SewageOccurStore = SewageOccurType & SewageOccurActions;
// Add type definitions for API responses
@@ -215,7 +375,9 @@ type FlowResponse = {
count: number;
}
export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
type SetStateFunction = (state: SewageOccurType | ((state: SewageOccurType) => SewageOccurType)) => void;
export const sewageOccurReducer:(set:SetStateFunction)=>SewageOccurActions=(set: SetStateFunction) => {
return {
searchSewageOccurList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
const res = await fetchSewageOccurList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
@@ -226,32 +388,67 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.waterUsage = item.fctCpc * 0.6;
item.swageChangePercent = 80;
item.estimationSewage = item.waterUsage * (item.swageChangePercent/100);
const bscFctCd = item.bscFctCd;
const url2 = '/fclt/flow/' + bscFctCd + '/' + searchYear;
const res2 = await getFetch('fo', url2) as FlowResponse;
const sumFlow = res2.data.reduce((acc: number, curr: FlowDataItem) => Number(acc) + Number(curr.inflAmnt), 0);
let sumChungcunDay = 0;
let chungcunSumFlow = 0;
let totWaterUsage = 0;
res2.data.forEach((item: FlowDataItem) => {
if(Number(item.infoRnDay) ===0){
chungcunSumFlow += Number(item.inflAmnt);
sumChungcunDay += 1;
}else{
console.log(item.bscFctCd +' day : ' +' '+item.msrDt);
}
totWaterUsage += Number(item.inflAmnt);
});
const avg = totWaterUsage /res2.count;
item.waterUsage = parseFloat((avg * 0.65).toFixed(2));
item.sewageInputYear = parseFloat(avg.toFixed(2));
item.sewageInputChungchun = parseFloat((chungcunSumFlow===0?0:(chungcunSumFlow / sumChungcunDay)).toFixed(2));
item.estimationSewage = parseFloat((item.waterUsage * (item.swageChangePercent/100)).toFixed(2));
item.sewageInputYear = sumFlow/res2.count;
item.sewageInputChungchun = chungcunSumFlow===0?0:(chungcunSumFlow / sumChungcunDay);
return item;
}));
// 조회 데이터 설정
set((state: any) => ({
console.log('calData : ', calData);
const excelDownList: ExcelType[] = [];
if(pageSize>5000){
calData.forEach(item => {
dataFormSetting(item)
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
/* item.ctpvNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; */
excelDownList.push({
시설코드: item.bscFctCd,
권역: item.rvbsn,
단위유역: item.lgbsn,
중권역: item.mdmbsn,
환경청: item.rgnNm,
시도: item.sidoNm,
시군구: item.sggNm,
시설명: item.bscFctNm,
주소: item.daddr,
시설용량: item.fctCpc,
물사용량: item.waterUsage,
오수전환율: item.swageChangePercent,
오수발생량추정: item.estimationSewage,
연간하수유입량: item.sewageInputYear,
청천시하수유입량: item.sewageInputChungchun,
});
});
}else{
calData.forEach((item: SewageOccurProps) => {
dataFormSetting(item)
/* item.sidoNmNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; */
});
}
set((state: SewageOccurType) => ({
...state,
SewageOccur: pageSize<5000?{
...state.SewageOccur,
@@ -259,81 +456,7 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
sewageOccurCount: res.count,
}:{
...state.SewageOccur,
excelList: [],
}
}))
},
searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string) => {
const res = await fetchSewageOccurDetailList(bscFctCd, searchYear);
const monthData: SewageOccurDetailProps[] = [];
let tot = 0, cnt= 0
res.data.forEach((item: FlowDataItem) => {
const month = item.msrDt?.substring(4, 6);
const monthIdx = month ? Number(month) - 1 : -1;
if (monthIdx >= 0) {
if (typeof monthData[monthIdx] === 'object') {
monthData[monthIdx].sum += Number(item.inflAmnt);
monthData[monthIdx].cnt++;
} else {
monthData[monthIdx] = {cnt:1, sum:Number(item.inflAmnt), yr:item.msrDt.substring(0,4), usege:0};
}
}
tot += Number(item.inflAmnt)
cnt++
})
console.log('tot', tot, cnt, tot/cnt, tot/cnt*0.65);
const tableData:modalTableType[] = []
let maxWaterUsage = 0;
let minWaterUsage = 9999999999;
let avgWaterUsage = 0;
monthData.forEach((item, index) => {
item.usege = item.sum/item.cnt *0.65
tableData.push({
msrDt: item.yr+'-'+(index+1>10?String(index+1):'0'+(index+1)),
waterUsage: Math.round(item.usege*100) /100,
swageChangePercent: Math.round((item.usege/item.usege*0.8) * 100) / 100,
estimationSewage: Math.round(item.usege*0.8 * 100) / 100
})
if (item.usege > maxWaterUsage) {
maxWaterUsage = item.usege;
}
if (item.usege < minWaterUsage) {
minWaterUsage = item.usege;
}
});
avgWaterUsage = tot/cnt*0.65
const newData= [
{
msrDt: '평균',
waterUsage: Math.round(avgWaterUsage*100) /100,
swageChangePercent: 0.8,
estimationSewage: Math.round(avgWaterUsage*0.8*100) /100,
},
{
msrDt: '최대',
waterUsage: Math.round(maxWaterUsage*100) /100,
swageChangePercent: 0.8,
estimationSewage: Math.round(maxWaterUsage*0.8*100) /100,
},
{
msrDt: '최소',
waterUsage: Math.round(minWaterUsage*100) /100,
swageChangePercent: 0.8,
estimationSewage: Math.round(minWaterUsage*0.8*100) /100,
},
...tableData
]
set((state: SewageOccurType) => ({
...state,
SewageOccurDetail: {
...state.SewageOccurDetail,
gridListSewageOccurDetail: newData,
excelList: excelDownList,
}
}))
},
+12 -14
View File
@@ -1,19 +1,13 @@
import { LoginApi } from '@/src/entities/auth/api/login-service';
import { createStore } from 'zustand/vanilla';
import { CommonReducer, commonState, type CommonStore, type CommonType } from './common';
import { dashBoardInitState, dashBoardReducer, type DashBoardStore, type DashBoardType } from './dashboard';
import { dashBoardReducer, dashBoardInitState, type DashBoardStore, type DashBoardType } from './dashboard';
import {
facilityPrecipitationInitState,
facilityPrecipitationReducer,
type FacilityPrecipitationStore, type FacilityPrecipitationType
} from './facilityPrecipitation';
import {
facilityWaterQltyInitState,
facilityWaterQltyReducer,
type FacilityWaterQltyStore, type FacilityWaterQltyType
} from './facilityWaterQlty';
import { flowRateSearchInitState, flowRateSearchReducer, type FlowRateSearchStore, type FlowRateSearchType } from './flowRate';
import { planSewageInitState, planSewageReducer, type PlanSewageStore, type PlanSewageType } from './planSewage';
import { flowRateSearchInitState, flowRateSearchReducer, type FlowRateSearchStore, type FlowRateSearchType } from './flowRate';
import {
processAreaInitState,
processAreaReducer,
@@ -24,12 +18,11 @@ import {
processFacilityReducer,
type ProcessFacilityStore, type ProcessFacilityType
} from './processFacility';
import { tableActionsExport, tableStateExport, type tableState, type tableType } from './publicReuseFaciltyInsert/index';
import {
rdiInitState,
rdiReducer,
type RdiStore, type RdiType
} from './rdi';
facilityWaterQltyInitState,
facilityWaterQltyReducer,
type FacilityWaterQltyStore, type FacilityWaterQltyType
} from './facilityWaterQlty';
import {
sewageOccurInitState,
sewageOccurReducer,
@@ -40,6 +33,12 @@ import {
underWaterReducer,
type UnderWaterStore, type UnderWaterType
} from './underWaterInput';
import {
rdiInitState,
rdiReducer,
type RdiStore, type RdiType
} from './rdi';
import { tableActionsExport, tableStateExport, type tableState, type tableType } from './publicReuseFaciltyInsert/index';
export type FoStore = CommonStore & tableType & DashBoardStore & ProcessFacilityStore & ProcessAreaStore & FlowRateSearchStore & FacilityPrecipitationStore & FacilityWaterQltyStore & PlanSewageStore & SewageOccurStore & UnderWaterStore & RdiStore;
export type FoState = CommonType & tableState & ProcessFacilityType & ProcessAreaType & FacilityPrecipitationType & FlowRateSearchType & DashBoardType & FacilityWaterQltyType & PlanSewageType & SewageOccurType & UnderWaterType & RdiType;
@@ -59,7 +58,6 @@ export const StoreZus =
}
) => {
return createStore<FoStore>()((set) => {
LoginApi.login({userId: "admin1gmail", password: "test1234!"})
return {
...initState,
...CommonReducer(set),
-4
View File
@@ -11,10 +11,6 @@ const compat = new FlatCompat({
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{rules:{
// other rules..
"@typescript-eslint/no-explicit-any": "off",
}},
];
export default eslintConfig;
@@ -20,7 +20,7 @@ export class TokenManager {
public setToken(key: string, value: string): void {
setCookie(key, value, {
secure: location.protocol === "https:",
secure: window.location.protocol === "https:",
sameSite: "lax",
});
}
+418 -411
View File
@@ -41,9 +41,11 @@ import toast, { Toaster } from "react-hot-toast";
import { z } from "zod";
export default function CoMatRvw() {
const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
const { auth, code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
useWrStore((state) => state);
const { coMatRvwRes,coMatRvwCount } = coRvw;
const { coMatRvwRes, coMatRvwCount } = coRvw;
const { regAuthrtYn } = auth;
//init, sub, match
const initRef = useRef<boolean>(false);
const { coRvwHeadList } = coRvw;
@@ -91,10 +93,9 @@ export default function CoMatRvw() {
const form = useForm<z.infer<typeof DmdCoReqSchema>>({
resolver: zodResolver(DmdCoReqSchema),
shouldUnregister: false,
// defaultValues: DmdCoReqSchema.parse({})
// defaultValues: DmdCoReqSchema.parse({})
});
const TableCellClick = (index: number) => {
if (coMatRvwRes && coMatRvwRes[index]) {
setSelectData(coMatRvwRes[index]);
@@ -103,23 +104,21 @@ export default function CoMatRvw() {
};
const useUsgCdWatch = useWatch({ control: form.control, name: "useUsgCd" });
useEffect(() => {
if (useUsgCdWatch) {
form.setValue(
"demandCst.usgPrcsProcs",
usageProcData?.find(
(item) => item.usage === useUsgCdWatch
)?.process ?? ""
usageProcData?.find((item) => item.usage === useUsgCdWatch)?.process ??
""
);
}
}, [useUsgCdWatch, form,selectionVersion]);
}, [useUsgCdWatch, form, selectionVersion]);
useEffect(() => {
if (coMatRvwRes&&coMatRvwRes.length > 0) {
if (coMatRvwRes && coMatRvwRes.length > 0) {
const data = coMatRvwRes?.map((item) => {
let flag = "";
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ||undefined);
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg || undefined);
return {
...item,
@@ -127,7 +126,7 @@ export default function CoMatRvw() {
sggCd: item.demandCo?.sggCd,
dmdCoNm: item.demandCo?.dmdCoNm,
daddr: item.demandCo?.daddr,
telno: formatPhoneNumber(item?.demandCo?.telno||''),
telno: formatPhoneNumber(item?.demandCo?.telno || ""),
dmndTmng: item?.dmndTmng,
splyFcltFlg: flag,
};
@@ -156,7 +155,6 @@ export default function CoMatRvw() {
useEffect(() => {
if (selectData) {
try {
DmdCoReqSchema.parse(selectData);
} catch (e) {
@@ -164,15 +162,14 @@ export default function CoMatRvw() {
console.log(e.flatten());
}
}
form.reset( selectData);
setSelectionVersion((v) => v + 1); // 강제로 바뀌었다고 알리기
form.reset(selectData);
setSelectionVersion((v) => v + 1); // 강제로 바뀌었다고 알리기
}
}, [selectData, form]);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"수요매칭검토"} />
<SearchDiv>
@@ -195,7 +192,7 @@ export default function CoMatRvw() {
<div className="col-span-7 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600 mx-6">
수요신청년도
수요신청년도
</Label>
<SelectBox
className="h-full w-32 text-2xl"
@@ -248,7 +245,10 @@ export default function CoMatRvw() {
if (String(objSearch.city).length > 0) {
con = String(objSearch.city);
}
if (String(objSearch.sgg).length > 0 && String(objSearch.sgg) !== "0") {
if (
String(objSearch.sgg).length > 0 &&
String(objSearch.sgg) !== "0"
) {
con = String(objSearch.sgg);
}
getSearch(fromNum, toNum, con, dmdCoNm);
@@ -279,403 +279,410 @@ export default function CoMatRvw() {
TableCellClick(index);
}
}}
onPageChange={(val) => {setPageNatiion(val)}}
onPageChange={(val) => {
setPageNatiion(val);
}}
></UiTable>
</ListDiv>
<hr />
{/* <ScrollArea className="h-[49vh]"> */}
<ListDiv>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
수요신청 상세현황
</h3>
<Form {...form}>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndTmng"
render={({ field }) => (
<FormUi label="요구시기">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(String(e.target.value));
}}
value={
moment(field.value).format("YYYY-MM-DD") ?? ""
}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndQty"
render={({ field }) => (
<FormUi label="요구수량(m³/일)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="사용용도">
<Input
placeholder=""
type="text"
step="0.1"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="wntUntprc"
render={({ field }) => (
<FormUi label="희망단가(원/m3)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>요구수질</h1>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="grssClfg"
render={({ field }) => (
<FormUi label="총대장균군수 (개/100ml)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="combResdch"
render={({ field }) => (
<FormUi label="결합잔류염소(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="trbt"
render={({ field }) => (
<FormUi label="탁도(NTU)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="blgcOxygDmndQnt"
render={({ field }) => (
<FormUi label="생물학적 산소요구량(BOD)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="smll"
render={({ field }) => (
<FormUi label="냄새">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="crmty"
render={({ field }) => (
<FormUi label="색도(도)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="tn"
render={({ field }) => (
<FormUi label="총질소 (T-N)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="tph"
render={({ field }) => (
<FormUi label="총인(T-P)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="ph"
render={({ field }) => (
<FormUi label="수소이온농도(pH)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="clIonQnt"
render={({ field }) => (
<FormUi label="염화물(mgCL/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="cdtnv"
render={({ field }) => (
<FormUi label="전기전도도(㎲/cm)">
<Input
placeholder=""
type="number"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="rmrk"
render={({ field }) => (
<FormUi label="비고">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>공급처 후보지</h1>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${0}`}
render={({ field }) => (
<FormUi label="후보지1">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(String(e.target.value));
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${1}`}
render={({ field }) => (
<FormUi label="후보지2">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${2}`}
render={({ field }) => (
<FormUi label="후보지3">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<ListDiv>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
수요신청 상세현황
</h3>
<Form {...form}>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndTmng"
render={({ field }) => (
<FormUi label="요구시기">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(String(e.target.value));
}}
value={
moment(field.value).format("YYYY-MM-DD") ?? ""
}
readOnly
/>
</FormUi>
)}
/>
</div>
</Form>
<ConCostForm form={form} type={"mat"} selectionVersion={selectionVersion} />
</ListDiv>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndQty"
render={({ field }) => (
<FormUi label="요구수량(m³/일)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="사용용도">
<Input
placeholder=""
type="text"
step="0.1"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="wntUntprc"
render={({ field }) => (
<FormUi label="희망단가(원/m3)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>요구수질</h1>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="grssClfg"
render={({ field }) => (
<FormUi label="총대장균군수 (개/100ml)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="combResdch"
render={({ field }) => (
<FormUi label="결합잔류염소(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="trbt"
render={({ field }) => (
<FormUi label="탁도(NTU)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="blgcOxygDmndQnt"
render={({ field }) => (
<FormUi label="생물학적 산소요구량(BOD)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="smll"
render={({ field }) => (
<FormUi label="냄새">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="crmty"
render={({ field }) => (
<FormUi label="색도(도)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="tn"
render={({ field }) => (
<FormUi label="총질소 (T-N)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="tph"
render={({ field }) => (
<FormUi label="총인(T-P)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="ph"
render={({ field }) => (
<FormUi label="수소이온농도(pH)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="clIonQnt"
render={({ field }) => (
<FormUi label="염화물(mgCL/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="cdtnv"
render={({ field }) => (
<FormUi label="전기전도도(㎲/cm)">
<Input
placeholder=""
type="number"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="rmrk"
render={({ field }) => (
<FormUi label="비고">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>공급처 후보지</h1>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${0}`}
render={({ field }) => (
<FormUi label="후보지1">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(String(e.target.value));
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${1}`}
render={({ field }) => (
<FormUi label="후보지2">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${2}`}
render={({ field }) => (
<FormUi label="후보지3">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
</div>
</Form>
<ConCostForm
form={form}
type={"mat"}
selectionVersion={selectionVersion}
readonly={regAuthrtYn ==="N"}
/>
</ListDiv>
{/* </ScrollArea> */}
</div>
</div>
@@ -30,6 +30,7 @@ import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
export default function RuseRvwHstry() {
const {
auth,
code,
ruseHist,
ruseRvwHistInit,
@@ -38,6 +39,8 @@ export default function RuseRvwHstry() {
ruseRvwComplete,
} = useWrStore((state) => state);
const { rvwHistRes, ruseHistHeadList, rvwHistCount } = ruseHist;
const { regAuthrtYn } = auth;
const [pageNation, setPageNatiion] = useState<number>(1);
const [dmdCoNm, setDmdCoNm] = useState<string>("");
@@ -305,7 +308,7 @@ export default function RuseRvwHstry() {
>
조회
</Button>
<Button size={"sm"} onClick={confrirmToast}>
<Button size={"sm"} onClick={confrirmToast} disabled={regAuthrtYn==='N'}>
저장
</Button>
</div>
+4
View File
@@ -33,6 +33,7 @@ import toast, { Toaster } from "react-hot-toast";
export default function CoSttn() {
const {
auth,
code,
coSttn,
coSttnInit,
@@ -43,6 +44,7 @@ export default function CoSttn() {
coSttnTxtSearch,
demandCompList,
} = useWrStore((state) => state);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const [bdstTable, setBdstTable] = useState<DemandCompType[]>();
const [pageNation, setPageNation] = useState(1);
@@ -205,6 +207,7 @@ export default function CoSttn() {
setUpdateData(undefined);
setIsDmdModal({ ...isDmdModal, isMoal: true });
}}
disabled={regAuthrtYn === "N"}
>
등록
</Button>
@@ -222,6 +225,7 @@ export default function CoSttn() {
});
}
}}
disabled={mdfcnAuthrtYn === "N"}
>
수정
</Button>
@@ -21,7 +21,7 @@ import { useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
export default function Home() {
const { code, htdfl, initHtdflReg, getHtdflBdstData, htdflNmSearch } =
const { auth,code, htdfl, initHtdflReg, getHtdflBdstData, htdflNmSearch } =
useWrStore((state) => state);
const [searchTxt, setSearchTxt] = useState("");
const [pageNation, setPageNation] = useState(1);
@@ -30,12 +30,9 @@ export default function Home() {
const [bdstTable, setbdstTable] = useState<customHtdflBdst[]>();
const [issNewReg, setIsNewReg] = useState<boolean>(false);
// const [bdstChgProps, setBdstChgProps] = useState<{
// isOpen: boolean;
// chgBuilding: chgBuilding[];
// }>({ isOpen: false, chgBuilding: [] });
const { htdflRes ,htdflResCount} = htdfl;
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
useEffect(() => {
if (!htdfl.isInit) {
@@ -116,7 +113,10 @@ export default function Home() {
>
조회
</Button>
<Button size={"sm"} onClick={() => setIsNewReg(!issNewReg)}>
<Button size={"sm"}
onClick={() => setIsNewReg(!issNewReg)}
disabled={regAuthrtYn === "N"}
>
신규등록
</Button>
</div>
@@ -149,6 +149,7 @@ export default function Home() {
<HtdflRegForm
htdflForm={htdflForm ?? ({} as customHtdflBdst)}
isModal={false}
readonly={mdfcnAuthrtYn === "N"}
/>
</ScrollArea>
</ListDiv>
@@ -38,6 +38,7 @@ import { useTranslation } from "react-i18next";
export default function PublicReuseFaciltyInsert() {
const {
auth,
code,
pbnst,
pubHasuInit,
@@ -47,8 +48,10 @@ export default function PublicReuseFaciltyInsert() {
pubHasuSearch,
pbnstRuseBizUpdate,
} = useWrStore((state) => state);
const { t } = useTranslation("base");
const { pubFacHeadList, pbnstHasuResCount, pbnstHasuRes, pbnstRes } = pbnst;
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const [, setCurrentTab] = useState<string>("mng");
const [isRuseReg, setIsRuseReg] = useState<{
isModal: boolean;
@@ -290,6 +293,7 @@ export default function PublicReuseFaciltyInsert() {
}
isResetPage(true);
}}
>
조회
</Button>
@@ -307,6 +311,7 @@ export default function PublicReuseFaciltyInsert() {
appendPbnstRuseFclt();
}
}}
disabled={regAuthrtYn === "N"}
>
신규등록
</Button>
@@ -319,19 +324,17 @@ export default function PublicReuseFaciltyInsert() {
<div className="grid grid-cols-8 gap-4">
<div className="col-span-5 h-full min-h-0">
<ListDiv className="min-h-0">
{/* <ScrollArea className="h-[60vh]"> */}
{" "}
{/* 높이 조정 */}
<UiTable
tableData={bdstTable || []}
headlist={pubFacHeadList}
pageSize={10}
total={pbnstHasuResCount || 20}
headName={"공공 하수처리시설 목록"}
cellClick={cellClick}
onPageChange={setPageNation}
resetPageNo={resetPage}
/>
{/* <ScrollArea className="h-[60vh]"> */} {/* 높이 조정 */}
<UiTable
tableData={bdstTable || []}
headlist={pubFacHeadList}
pageSize={10}
total={pbnstHasuResCount || 20}
headName={"공공 하수처리시설 목록"}
cellClick={cellClick}
onPageChange={setPageNation}
resetPageNo={resetPage}
/>
{/* </ScrollArea> */}
</ListDiv>
</div>
@@ -351,6 +354,7 @@ export default function PublicReuseFaciltyInsert() {
size={"sm"}
onClick={form.handleSubmit(onSubmit, onInvalid)}
className="mr-5 mt-2"
disabled={mdfcnAuthrtYn === "N"}
>
저장
</Button>
@@ -364,7 +368,7 @@ export default function PublicReuseFaciltyInsert() {
setIndexMng(index);
}}
indexMng={indexMng}
readonly={false}
readonly={mdfcnAuthrtYn === "N"}
/>
</TabsContent>
<TabsContent className="max-h-full" value="buse">
@@ -376,9 +380,9 @@ export default function PublicReuseFaciltyInsert() {
}}
indexMng={indexMng}
indexBiz={indexBiz}
readonly={mdfcnAuthrtYn === "N"}
/>
</TabsContent>
</ScrollArea>
</Tabs>
) : (
@@ -1,8 +1,6 @@
"use client";
import { useWrStore } from "@/app/store";
import {
type customRainBdst,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { type customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { formatCommaNumber, tableData } from "@/components/lib/func/commom";
import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
@@ -19,14 +17,19 @@ import {
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 { Toaster } from "react-hot-toast";
export default function Home() {
const { rain, code, initRain, rainSearch, getRainData } = useWrStore(
const { auth, rain, code, initRain, rainSearch, getRainData } = useWrStore(
(state) => {
return state;
}
);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const { rainRes, rainResCount } = rain;
const [rainForm, setRainForm] = useState<customRainBdst>();
const [issNewReg, setIsNewReg] = useState<boolean>(false);
@@ -53,7 +56,7 @@ export default function Home() {
return {
...item,
archArea: formatCommaNumber(archArea),
bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N",
};
}
);
@@ -64,13 +67,10 @@ export default function Home() {
}
}
}, [code, rainRes]);
const cellClick: (val: number | undefined) => void = (
val
) => {
const cellClick: (val: number | undefined) => void = (val) => {
if (val !== undefined) {
setRainForm(rainRes[val]);
}
};
useEffect(() => {
@@ -99,7 +99,7 @@ export default function Home() {
size={"sm"}
onClick={() => {
rainSearch(searchTxt || "", 1, "41");
//rainSearch(searchTxt || "", pageNation, "41");
//rainSearch(searchTxt || "", pageNation, "41");
}}
>
조회
@@ -107,7 +107,10 @@ export default function Home() {
<Button
size={"sm"}
className=""
onClick={() => setIsNewReg(!issNewReg)}
onClick={() => {
setIsNewReg(!issNewReg);
}}
disabled={regAuthrtYn === "N"}
>
신규등록
</Button>
@@ -143,6 +146,7 @@ export default function Home() {
<RainRegForm
rainForm={rainForm ?? ({} as customRainBdst)}
isModal={false}
readonly={mdfcnAuthrtYn !== "Y"}
></RainRegForm>
</ScrollArea>
</ListDiv>
@@ -20,9 +20,11 @@ import { useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
export default function Home() {
const { code, rswt, initRswt, rswtBdstSearch, getRswtBdstData } = useWrStore(
const { auth,code, rswt, initRswt, rswtBdstSearch, getRswtBdstData } = useWrStore(
(state) => state
);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const [rswtForm, setRswtForm] = useState<customRswtBdst>();
const [searchTxt, setSearchTxt] = useState<string>();
const [issNewReg, setIsNewReg] = useState<boolean>(false);
@@ -114,6 +116,7 @@ export default function Home() {
size={"sm"}
className="mr-4"
onClick={() => setIsNewReg(!issNewReg)}
disabled={regAuthrtYn === "N"}
>
신규등록
</Button>
@@ -146,6 +149,7 @@ export default function Home() {
<RswtrRegForm
rswtForm={rswtForm ?? ({} as customRswtBdst)}
isModal={false}
readonly={mdfcnAuthrtYn === "N"}
/>
</ScrollArea>
</ListDiv>
@@ -99,7 +99,9 @@ export default function Page() {
isRainSttn(true)
rainChkSttnInit(1, rainPageSize, new Date().getFullYear().toString(), commonCd);
setIsModal({ data: {}, open: false });
}
}, [rainChkSttn.isInit, rainChkSttnInit, rainPageSize]);
useEffect(() => {
+1 -16
View File
@@ -1,21 +1,6 @@
import { getFetch, getFetchWithCount } from "@/components/lib/api";
import { getFetchWithCount } from "@/components/lib/api";
import toast from "react-hot-toast";
export const getMenuAuthrts = async (menuCd: number) => {
const response = await getFetch(
"LOCAL",
`/cms-service/api/v1/menu-authrts/pageinfo/${menuCd}`
);
authStateExport.auth = {
mngAuthrtYn: response[0].mngAuthrtYn,
inqAuthrtYn: response[0].mngAuthrtYn,
regAuthrtYn: response[0].mngAuthrtYn,
mdfcnAuthrtYn: response[0].mngAuthrtYn,
delAuthrtYn: response[0].mngAuthrtYn,
};
};
export type authState = {
auth: {
mngAuthrtYn: string;
@@ -31,10 +31,12 @@ export default function ConCostForm({
form,
type,
selectionVersion,
readonly = false,
}: {
form: UseFormReturn<DmdCoReqType>;
type: string;
selectionVersion: number;
readonly: boolean;
}) {
const {
constCostRes,
@@ -58,14 +60,11 @@ export default function ConCostForm({
}
}, [ref, getConstCostFee, getRateFee]);
useEffect(() => {
// 다른 행을 선택하면(selectionVersion 변경) 체크박스 상태를 초기화합니다.
setCheckFinish(false);
}, [selectionVersion]);
const zipDowonLoad = () => {
fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => {
const blobRet = await response.blob();
@@ -165,29 +164,32 @@ export default function ConCostForm({
cstrnCst: value.demandCst.cstrnCst || 0,
fcltSbsdCstrnCst: value.demandCst.fcltSbsdCstrnCst || 0,
prcsFcltCpctCstrnCst: value.demandCst.prcsFcltCpctCstrnCst || 0,
flg: checkFinish?'Checked':'Sub',
flg: checkFinish ? "Checked" : "Sub",
rgtr: TEST_UUID,
};
if (checkFinish) {
toast((t) => (
<span className="flex flex-col items-center text-2xl" >
검토완료 변경시 공사비는 변경할수 없습니다.
<span className="flex flex-col items-center text-2xl">
검토완료 변경시 공사비는 변경할수 없습니다.
<br />
진행하시겠습니까?
<div className="flex gap-2 mt-2">
<Button
size='sm'
onClick={() => {
toast.dismiss(t.id);
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoId"), data);
}}
>
확인
</Button>
<Button
size='sm'
onClick={() => toast.dismiss(t.id)}>취소</Button>
<Button
size="sm"
onClick={() => {
toast.dismiss(t.id);
coMatRvwUpdate(
"11000SW001R1",
form.getValues("dmdInfoId"),
data
);
}}
>
확인
</Button>
<Button size="sm" onClick={() => toast.dismiss(t.id)}>
취소
</Button>
</div>
</span>
));
@@ -229,6 +231,7 @@ export default function ConCostForm({
className="mr-3"
size={"sm"}
onClick={form.handleSubmit(onSubmit)}
disabled={readonly}
>
저장
</Button>
@@ -236,9 +239,14 @@ export default function ConCostForm({
<Checkbox
className="ml-3 mr-6"
checked={checkFinish}
onCheckedChange={(checked) =>
onCheckedChange={
(checked) => {
if (readonly) return;
setCheckFinish(checked === true);
}
// 'indeterminate' 상태를 무시하고 순수 boolean 값으로만 상태를 업데이트합니다.
setCheckFinish(checked === true)}
}
></Checkbox>
<Label>관로 표준공사비 산정 프로그램</Label>
<Button
@@ -350,7 +358,7 @@ export default function ConCostForm({
type="number"
step="0.001"
onChange={(e) => {
console.log('dmndQty ', e)
console.log("dmndQty ", e);
//field.onChange(Number(e.target.value) * 365 );
}}
value={Number(field.value) * 365 || 0}
@@ -377,7 +385,7 @@ export default function ConCostForm({
}
childrenBody={
<>
<ConstCostFeeTable/>
<ConstCostFeeTable />
</>
}
bodyClassName={"w-[40vw] h-full"}
@@ -414,8 +422,7 @@ export default function ConCostForm({
}
childrenBody={
<>
<RateFeeTableModal/>
<RateFeeTableModal />
</>
}
bodyClassName={"w-[22vw]"}
@@ -476,8 +483,7 @@ export default function ConCostForm({
type="number"
step="0.01"
onChange={(e) => {
console.log('totalConstCost ', e)
console.log("totalConstCost ", e);
}}
value={field.value ?? 0}
readOnly
@@ -521,6 +527,9 @@ export default function ConCostForm({
type="number"
step="0.01"
onChange={(e) => {
if(readonly) return;
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
@@ -44,6 +44,7 @@ export function PbnstBuseForm({
indexBiz = 0,
setIndexBiz,
form,
readonly = false,
}: {
formType: string;
firstBizData?: fcBizType[];
@@ -51,6 +52,7 @@ export function PbnstBuseForm({
indexMng: number;
indexBiz: number;
setIndexBiz: (index: number) => void;
readonly?: boolean;
}) {
const {
code,
@@ -329,6 +331,7 @@ export function PbnstBuseForm({
onClick={addRuseFcltObj}
type="button"
size={commonButonSize}
disabled={readonly}
>
추가
</Button>
@@ -343,6 +346,7 @@ export function PbnstBuseForm({
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
readonly={readonly}
/>
<MngRegFormDetail
key={`buziMoney-${indexMng}-${indexBiz}`}
@@ -353,6 +357,7 @@ export function PbnstBuseForm({
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
readonly={readonly}
/>
<MngRegFormDetail
@@ -364,6 +369,7 @@ export function PbnstBuseForm({
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
readonly={readonly}
/>
<MngRegFormDetail
key={`concertedWater-${indexMng}-${indexBiz}`}
@@ -374,6 +380,7 @@ export function PbnstBuseForm({
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
readonly={readonly}
/>
<MngRegFormDetail
key={`wasteFcltinfo-${indexMng}-${indexBiz}`}
@@ -384,6 +391,7 @@ export function PbnstBuseForm({
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
readonly={readonly}
/>
<h1 className={formH1Class}>재이용 원수취수 현황</h1>
@@ -394,6 +402,7 @@ export function PbnstBuseForm({
onClick={() => setIsFcOrgwts(true)}
size={commonButonSize}
className=""
disabled={readonly}
>
추가등록
</Button>
@@ -412,6 +421,7 @@ export function PbnstBuseForm({
indexMng={indexMng}
formNm={"fcOrgwts"}
indexBiz={indexBiz}
readonly={readonly}
/>
</div>
<h1 className={formH1Class}>재이용 공급관로 설치 현황</h1>
@@ -424,6 +434,7 @@ export function PbnstBuseForm({
className="w-32"
selectClass="w-full"
onSelectValue={(val) => setPpiYn(String(val))}
readOnly={readonly}
/>
<Label className="text-right">합계</Label>
<Input
@@ -439,6 +450,7 @@ export function PbnstBuseForm({
size={commonButonSize}
className="!text-xl"
onClick={plusHist}
disabled={readonly}
>
추가등록
</Button>
@@ -447,6 +459,7 @@ export function PbnstBuseForm({
size={commonButonSize}
className="!text-xl !bg-red-500 !text-white ml-1"
onClick={removeSelected}
disabled={readonly}
>
삭제
</Button>
@@ -471,6 +484,7 @@ export function PbnstBuseForm({
form={form}
formNm={"pplInstls"}
upHeadList={[]}
readonly={readonly}
/>
</div>
@@ -494,7 +508,7 @@ export function PbnstBuseForm({
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
readonly={false}
readonly={readonly}
/>
</div>
@@ -510,6 +524,7 @@ export function PbnstBuseForm({
}}
size={commonButonSize}
className="mt-6 mr-3"
disabled={readonly}
>
수요처 추가
</Button>
@@ -523,6 +538,7 @@ export function PbnstBuseForm({
}}
size={commonButonSize}
className="mt-6"
disabled={readonly}
>
수요처 신규등록
</Button>
@@ -575,6 +591,7 @@ export function PbnstBuseForm({
searchPk: item.dmdInfoId,
};
})}
readonly={readonly}
></SearchInputText>
</FormUi>
)}
@@ -611,6 +628,7 @@ export function PbnstBuseForm({
selectArray={code.dmdUszCd}
onSelectValue={f.onChange}
value={f.value ?? code.dmdUszCd[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
@@ -630,6 +648,7 @@ export function PbnstBuseForm({
f.onChange(date),
}}
selectClass={"rounded-lg !w-full"}
readOnly={readonly}
/>
</FormUi>
)}
@@ -652,6 +671,7 @@ export function PbnstBuseForm({
f.onChange(date),
}}
selectClass={"rounded-lg !w-full"}
readOnly={readonly}
/>
</FormUi>
)}
@@ -670,6 +690,7 @@ export function PbnstBuseForm({
handleCommaNumberChange(e, f.onChange);
}}
value={formatCommaNumber(f.value)}
readOnly={readonly}
/>
</FormUi>
)}
@@ -690,6 +711,7 @@ export function PbnstBuseForm({
f.onChange(val)
}
value={f.value ?? code.yn[0]?.val}
readOnly={readonly}
/>
</FormUi>
)}
@@ -41,13 +41,13 @@ export function PbnstMngForm({
formType,
indexMng,
setIndexMng,
readonly
readonly,
}: {
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
formType: string;
indexMng: number;
setIndexMng: (index: number) => void;
readonly:boolean
readonly: boolean;
}) {
const { code, pbnst, fileDelete, fileDownLoad } = useWrStore(
(state) => state
@@ -60,6 +60,7 @@ export function PbnstMngForm({
const [mngMtdCode, setMngMtdCode] =
useState<{ name: string; val: SelectDataType[] }[]>();
const {
fields: fcOpersField,
prepend,
@@ -87,7 +88,6 @@ export function PbnstMngForm({
endDt: new Date(),
});
//trigger(`items.${indexMng}.fcOpers`);
};
const removeSelected = () => {
@@ -318,6 +318,7 @@ export function PbnstMngForm({
size={commonButonSize}
className="!text-xl"
onClick={plusHist}
disabled={readonly}
>
추가등록
</Button>
@@ -326,6 +327,7 @@ export function PbnstMngForm({
size={commonButonSize}
className="!text-xl !bg-red-500 !text-white ml-1"
onClick={removeSelected}
disabled={readonly}
>
삭제
</Button>
@@ -335,20 +337,11 @@ export function PbnstMngForm({
<div className="h-[200px] overflow-y-auto">
<RuseMngTableForm
key={`ruse-table-${indexMng}-${fcOpersField.length}`} // 🔥 length까지 넣어야 동기화됨
tableData={form.getValues(`items.${indexMng}.fcOpers`) ||[]}
headList={
formType === "sttn"
? pbnst.pbnstMngUpHeadList.map((item) => {
return {
...item,
readonly: true,
};
})
: pbnst.pbnstMngUpHeadList
}
tableData={form.getValues(`items.${indexMng}.fcOpers`) || []}
headList={pbnst.pbnstMngUpHeadList}
upHeadList={pbnst.pbnstMngNm}
code={mngMtdCode || []}
readonly={readonly}
indexMng={indexMng}
form={form}
formNm={"fcOpers"}
@@ -372,7 +365,6 @@ export function PbnstMngForm({
maxLength={numSize} //입력제한
type="text"
onChange={(e) => {
if (formType !== "sttn")
handleCommaNumberChange(e, field.onChange);
}}
value={formatCommaNumber(field.value)}
@@ -396,7 +388,6 @@ export function PbnstMngForm({
maxLength={numSize} //입력제한
type="text"
onChange={(e) => {
if (formType !== "sttn")
handleCommaNumberChange(e, field.onChange);
}}
value={formatCommaNumber(field.value)}
@@ -419,7 +410,6 @@ export function PbnstMngForm({
maxLength={numSize} //입력제한
type="text"
onChange={(e) => {
if (formType !== "sttn")
handleCommaNumberChange(e, field.onChange);
}}
value={formatCommaNumber(field.value)}
@@ -435,7 +425,7 @@ export function PbnstMngForm({
</div>
<div className="grid grid-cols-12 gap-4 my-4">
<div className="col-span-6">
{formType === "sttn" ? (
{readonly ? (
relationfiles && relationfiles?.length > 0 ? (
<>
<Label className="text-3xl">계통도</Label>
@@ -472,7 +462,7 @@ export function PbnstMngForm({
)}
</div>
<div className="col-span-6">
{formType === "sttn" ? (
{readonly ? (
planFiles && planFiles?.length > 0 ? (
<>
<Label className="text-3xl">평면도</Label>
@@ -21,6 +21,7 @@ export default function MngRegFormDetail({
sonClass,
indexBiz,
indexMng,
readonly
}: {
formList: formDetailType[];
h1Title?: string;
@@ -30,6 +31,7 @@ export default function MngRegFormDetail({
indexBiz?: number;
indexMng?: number;
sonClass?: string;
readonly?:boolean
}) {
const { code } = useWrStore((state) => state);
@@ -67,7 +69,10 @@ export default function MngRegFormDetail({
field.onChange(date),
}}
selectClass={"w-full"}
disabled={formHead.option === "disabled" ? true : false}
readOnly={readonly
//|| formHead.option === "disabled" ? true : false
}
/>
) : formHead.type === "number" ? (
@@ -81,7 +86,9 @@ export default function MngRegFormDetail({
);
}}
value={formatCommaNumber(field.value)}
readOnly={formHead.option === "readOnly" ? true : false}
readOnly={readonly
// || formHead.option === "readOnly" ? true : false
}
disabled={formHead.option === "disabled" ? true : false}
maxLength={numSize}
/>
@@ -103,7 +110,9 @@ export default function MngRegFormDetail({
}
onSelectValue={field.onChange}
value={field.value?.trim() ?? (Array.isArray(potentialOptions) && potentialOptions[0]?.val)}
readOnly={formHead.option === "readOnly"}
readOnly={readonly
// || formHead.option === "readOnly"
}
/>
);
})()
@@ -113,7 +122,9 @@ export default function MngRegFormDetail({
type="text"
value={field.value ?? ""}
onChange={field.onChange}
readOnly={formHead.option === "readOnly" ? true : false}
readOnly={readonly
// || formHead.option === "readOnly" ? true : false
}
disabled={formHead.option === "disabled" ? true : false}
maxLength={txtSize}
/>
@@ -1,3 +1,4 @@
import { Input } from "@common/components/ui";
import React, { useCallback, useEffect, useRef, useState } from "react";
type SearchType = {
@@ -10,6 +11,7 @@ type thisProps = {
setValue: (searchNm?: string) => void;
setRtnData: (rtnData: any) => void;
searchList?: any[];
readonly?:boolean
};
export default function SearchInputText({
label = undefined,
@@ -17,6 +19,7 @@ export default function SearchInputText({
setValue = () => {},
setRtnData = () => {},
searchList = undefined,
readonly = false, // 추가: readonly prop
}: thisProps) {
const [isOpen, setIsOpen] = useState(false);
@@ -65,13 +68,14 @@ export default function SearchInputText({
return (
<div ref={wrapperRef}>
<input
<Input
type="text"
value={textValue}
onChange={handleInputChange}
/* onFocus={() => setIsOpen(true)} */
className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder={`${label}을(를) 입력하세요`}
readOnly={readonly} // readonly 상태 적용
/>
{isOpen && (
<div className=" z-1 w-full mt-2 bg-white border border-gray-300 rounded-md shadow-lg h-90 overflow-auto">
@@ -35,6 +35,7 @@ type RuseMngTableProps = {
indexBiz?: number;
form?: any;
formNm?: string;
readonly?: boolean;
};
const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
@@ -48,6 +49,7 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
form,
formNm,
indexBiz,
readonly= false
},
ref
) => {
@@ -111,7 +113,7 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
? formatCommaNumber(field.value)
: field.value || ""
}
readOnly={head.readonly ? true : false}
readOnly={readonly|| head.readonly ? true : false}
maxLength={head.maxLength?head.maxLength:15}
/>
) : head.type === "select" ? (
@@ -132,7 +134,7 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
field.onChange(val);
}
}}
readOnly={head.readonly ? true : false}
readOnly={ readonly||head.readonly ? true : false}
// Disabled prop removed as SelectBox does not support it
></SelectBox>
) : head.type === "date" ? (
@@ -149,14 +151,18 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
},
}}
selectClass={"w-full"}
readOnly={head.readonly ? true : false}
readOnly={readonly||head.readonly ? true : false}
/>
) : head.type === "checkbox" ? (
<Checkbox
className=""
checked={field.value || false}
onCheckedChange={(checked) => {
field.onChange(checked);
if(readonly || head.readonly) {
return;
}else{
field.onChange(checked);
}
}}
></Checkbox>
) : (
@@ -6,7 +6,6 @@ import {
type ChartConfig
} from "./lib/chart";
import type { CSSProperties } from "react";
import { formatCommaNumber } from "./lib/function";
const customStyles = {
legendContainer: {
@@ -120,7 +119,6 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle='
fontWeight={500}
domain={[0, globalMax]}
ticks={ticks}
tickFormatter={(value) => formatCommaNumber(value)}
label={yFieldText ? { value: yFieldText, className:"text-[15px] font-bold", position: 'insideLeft', angle: -90, offset: -30 } : undefined}
/>
<ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/>
@@ -94,7 +94,6 @@ export default function LineBarchart({
// 데이터의 최대값 계산
const getMaxValue = (data: any[], keyPrefix: string) => {
if (!data || data.length === 0) return 0;
return Math.max(...data.map(item =>
Object.keys(item)
.filter(key => key.includes(keyPrefix))
@@ -1,186 +0,0 @@
"use client"
import type { CSSProperties } from "react";
import { Bar, CartesianGrid, ComposedChart, Legend, Line, Tooltip, XAxis, YAxis } from "recharts";
import {
ChartContainer,
type ChartConfig
} from "./lib/chart";
import type { ContentType } from "recharts/types/component/DefaultLegendContent";
// 툴크 커스텀 css
/** 차트 기본 스타일 */
const customStyles = {
legendContainer: {
display: "flex",
justifyContent: "center",
gap: "20px",
fontSize: "9px",
fontWeight : "bold",
marginTop: "10px",
} as CSSProperties,
};
type LineBarChartProps = {
chartConfig: ChartConfig | undefined;
chartData: any[] | undefined;
chartTitle: string;
chartClassName?: string;
graphSize?: number;
yFieldText?: string | undefined;
yFieldText2?: string | undefined;
showLegend?: boolean;
}
type LegendEntry = {
value: string;
color: string;
type?: string;
payload?: unknown;
};
type LegendProps = {
payload?: LegendEntry[];
};
// 커스텀 툴팁
const CustomTooltip = ({ active, payload, label }: { active?: boolean; payload?: Array<{ name: string; value: number; color: string }>; label?: string }) => {
if (active && payload && payload.length) {
return (
<div className="w-[180px] rounded bg-white p-2.5 shadow-[0px_2px_10px_rgba(0,0,0,0.2)]">
<p className="text-[12px] font-bold m-3">{label}</p>
{payload.map((item, index) => (
<div key={index} style={{ marginTop: "10px", display: "flex", alignItems: "center", gap: "8px" }}>
{/* 색상 박스 추가 (범례 색상과 동일) */}
<div style={{ width: "10px", height: "10px", backgroundColor: item.color, borderRadius: "50%" }}></div>
<span className="text-[11px] font-bold">{` ${item.name} : ${item.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}`}</span>
</div>
))}
</div>
);
}
return null;
};
// 커스텀 범례 (글씨 크기 키우기 + 스타일 추가)
const CustomLegend = (props: LegendProps) => {
const { payload } = props;
if (!payload) return null;
return (
<div style={customStyles.legendContainer}>
{payload.map((entry: LegendEntry, index: number) => (
<div key={`legend-${index}`} className="flex items-center gap-2">
<div className="w-[14px] h-[14px] ml-10" style={{ backgroundColor: entry.color }}></div>
<span className="text-[12px]">{entry.value}</span>
</div>
))}
</div>
);
};
export default function LineBarchart2({
chartConfig,
chartData,
chartTitle,
chartClassName = 'w-full h-full',
graphSize = 40,
yFieldText,
yFieldText2,
showLegend = true
}: LineBarChartProps) {
if (!chartData || chartData.length === 0) {
return <div>데이터가 없습니다.</div>;
}
// 데이터의 최대값 계산
const getMaxValue = (data: any[], keyPrefix: string) => {
if (!data || data.length === 0) return 0;
return Math.max(...data.map(item =>
Object.keys(item)
.filter(key => key.includes(keyPrefix))
.map(key => item[key])
).flat());
};
const lineMaxValue = getMaxValue(chartData, 'lineVal');
const barMaxValue = getMaxValue(chartData, 'barVal');
return (
<div className={chartClassName}>
{chartTitle && chartTitle !== "" && chartTitle !== "undefined" ? (
<div style={{ textAlign: "left", fontSize: "13px", fontWeight: "bold", marginTop:"13px", marginBottom: "10px" }}>
{chartTitle}
</div>
) : null}
<div className="h-[calc(100%-42px)] flex justify-center">
<ChartContainer config={chartConfig ?? {}} className="h-full w-full">
<ComposedChart
data={chartData}
height={graphSize * 7.5}
width={graphSize * 12.5}
margin={{ top: 5, right: 30, left: 20, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="label" fontSize="8px" fontWeight="bold"/>
{/* 왼쪽 Y축: lineVal */}
{yFieldText && <YAxis
yAxisId="left"
className="text-[12px] font-bold"
tickCount={6}
orientation="left"
domain={[0, Math.ceil(lineMaxValue * 1)+170]}
label={{ value: yFieldText, angle: -90, position: 'insideLeft', offset: -8 }}
/>}
{/* 오른쪽 Y축: barVal */}
{yFieldText2 && <YAxis
yAxisId="right"
className="text-[12px] font-bold"
tickCount={6}
orientation="right"
domain={[0, Math.ceil(barMaxValue * 1)+20]}
label={{ value: yFieldText2, angle: -90, position: 'insideRight' }}
reversed={true}
/>}
<Tooltip content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />} />
{showLegend && <Legend content={CustomLegend as ContentType}/>}
{/* 바 차트 (오른쪽 Y축 사용) */}
{Object.keys(chartData[0]).map((key, index) => {
const config = chartConfig?.[key];
if(key.includes("barVal")) {
return (
<Bar
key={`bar-${key}-${index}`}
yAxisId="right"
dataKey={key}
fill={config?.color || "black"}
name={String(config?.label || "Y축")}
maxBarSize={80}
/>
);
}
return null;
})}
{/* 라인 차트 (왼쪽 Y축 사용) */}
{Object.keys(chartData[0]).map((key, index) => {
const config = chartConfig?.[key];
if(key.includes("lineVal")) {
return (
<Line
key={`line-${key}-${index}`}
yAxisId="left"
type="linear"
dataKey={key}
stroke={config?.color || "black"}
strokeWidth={2}
dot={{r: 0}}
name={String(config?.label || "X축")}
/>
);
}
return null;
})}
</ComposedChart>
</ChartContainer>
</div>
</div>
);
}
@@ -2,7 +2,6 @@
import DoubleBarChart from './DoubleBar';
import DoughnutChart from './DoughnutChart';
import LineBarchart from './LineBarChart';
import LineBarchart2 from './LineBarChart2';
import LineChart from './LineChart';
/**차트 FORM */
@@ -15,8 +14,6 @@ const CHART_FORM = {
DN :'daughnut',
/**LINE,BAR차트 */
LINEBAR : 'linebar',
/**LINE,BAR차트 */
LINEBAR2 : 'linebar2',
/**더블바 차트 형태*/
DOUBLEBAR : 'doublebar'
};
@@ -75,10 +72,6 @@ function MainChart(props: MainChartProps) {
return (
<LineBarchart chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle} chartClassName={props.chartClassName} graphSize={props.graphSize} yFieldText={props.yFieldText} yFieldText2={props.yFieldText2} showLegend={props.showLegend}/>
);
} else if (props.chartForm == CHART_FORM.LINEBAR2){
return (
<LineBarchart2 chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle} chartClassName={props.chartClassName} graphSize={props.graphSize} yFieldText={props.yFieldText} yFieldText2={props.yFieldText2} showLegend={props.showLegend}/>
);
} else if (props.chartForm == CHART_FORM.DOUBLEBAR){
return (
<DoubleBarChart chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle} chartClassName={props.chartClassName} graphSize={props.graphSize} yFieldText={props.yFieldText} showLegend={props.showLegend}/>
@@ -1,12 +0,0 @@
// 숫자입력시 , 삽입
export const formatCommaNumber = (
value: number | string | undefined | null
): string => {
if (value === undefined || value === null || value === "") return "";
const num = Number(value);
// 숫자로 변환할 수 없는 값이 들어올 경우 빈 문자열을 반환하여 예상치 못한 "NaN" 출력을 방지합니다.
if (isNaN(num)) {
return "";
}
return num.toLocaleString();
};
@@ -20,73 +20,6 @@ import GisApp from './lib/gis.core';
export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null });
export const useGisContext = () => useContext(GisContext);
export const searchUpperPpls = async (fcltMngNo) => {
const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || '';
const res = await fetch(`${BASE_URL}/v1/fcltmhl/upperPpls/${fcltMngNo}`, {
method: "GET",
});
let data = null;
if (res.ok) {
try {
// 응답이 비어있는지 확인
const contentLength = res.headers.get('content-length');
if (contentLength === '0') alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`);
// 응답 텍스트를 먼저 가져와서 빈 문자열인지 확인
const text = await res.text();
if (!text || text.trim() === '') alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`);
// JSON 파싱 시도
data = JSON.parse(text);
} catch (error) {
console.error('JSON parsing error:', error);
alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`);
}
}
const select = GisApp.Module.select;
const gisMap = GisApp.Module.core?.map;
let foundFeature = null;
data.forEach(item => {
const pplMngNo = item.ppl_mng_no.trim();
gisMap.getLayers().getArray().filter(e => e.get("lyrTyNm") == 'tb_ms_swage_ppl').forEach(layer => {
const source = layer.getSource?.();
if (source?.getFeatures) {
const features = source.getFeatures();
for (const f of features) {
if (f.values_.fclt_mng_no.trim() === pplMngNo) {
foundFeature = f;
break;
}
}
}
});
if (foundFeature) select.selectMultiFeature(foundFeature, true);
});
if (!foundFeature) alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`);
let geometry = foundFeature?.getGeometry();
if (geometry) {
let extent = geometry.getExtent();
gisMap.getView().fit(extent, {
duration: 300,
padding: [50, 50, 50, 50],
maxZoom: 14,
constrainResolution: true,
nearest: true,
});
}
};
function Gis({
isOpen,
@@ -153,28 +86,20 @@ function Gis({
foundFeature = data;
} else {
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
let featureId = data.fid;
let featureId
const layerName = layerNmRef.current
if (layerName === '하수재이용시설') {
featureId = data.searchPk;
} else if (layerName === '빗물이용시설' || layerName == '중수도시설') {
} else if (layerName === '빗물이용시설'|| layerName == '중수도시설') {
featureId = data.bdstInfoSn;
} else if (layerName === '하수처리시설') {
} else if (layerName === '하수처리시설') {
featureId = data.bscFctCd;
} else if (layerName === '온배수시설') {
} else if (layerName === '온배수시설' ) {
featureId = data.bdstRuseFcltSn;
} else {
} else {
console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm);
featureId = data.fid || data.id || data.ftrIdn;
}
// gisMap.getLayers().getArray().forEach(layer => {
// const source = layer.getSource?.();
// if (source?.getFeatureById) {
// const feature = source.getFeatureById(String(featureId).trim());
// if (feature) foundFeature = feature;
// }
// });
// const [layerType, id] = String(featureId).split('.');
}
gisMap.getLayers().getArray().forEach(layer => {
const source = layer.getSource?.();
if (source?.getFeatures) {
@@ -485,7 +410,7 @@ function Gis({
onFeatureSelect={handleFeatureSelect}
/>
)}
{/* <GisLonLat /> */}
<GisLonLat />
<GisToolBar />
<GisMapToggle />
<GisSelect onFeatureSelect={handleFeatureSelect} />
@@ -429,19 +429,6 @@ GisOlSelect.prototype = {
auto: auto,
});
},
/**
* 피처 다중 셀렉트
*/
selectMultiFeature: function (feature, auto) {
let me = this;
me.selectedFeatures.push(feature);
me.selectInteraction.dispatchEvent({
type: 'select',
selected: me.selectedFeatures,
deselected: [],
auto: auto,
});
},
};
export default GisOlSelect;
@@ -322,7 +322,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun
},
{
name: "bznmTotNo",
label: "",
label: "종사업자등록번호",
component: (field) => (
<FormUi
label="종사업자등록번호"
@@ -419,7 +419,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun
name={name}
render={({ field }) => (
<div className="mb-4">
<label htmlFor={inputId} className="block text-gray-800 font-medium text-xl">
<label htmlFor={inputId} className="block text-gray-800 font-medium">
{label}
{isRequired && <span className="text-red-500 ml-1">*</span>}
</label>
@@ -432,7 +432,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun
})}
{error?.message && (
<p id={errorId} role="alert" className="text-red-500 text-lg mt-1">
<p id={errorId} role="alert" className="text-red-500 text-sm mt-1">
{error.message}
</p>
)}
@@ -0,0 +1,45 @@
/**
* @remarks
* 이 버전은 SearchModal에서 사용하기 위해 `SelectContent`의 z-index를 `z-[101]`로 수정하였습니다.
*/
import { Label } from "@common/components";
import React from "react";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./lib/selectBox";
/** 차트 기본 스타일 */
interface SelectBox1 {
text:string,
val:string|number
}
const SelectBox2 = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & {
label:string,
selectClass:string|undefined,
className:string,
selectArray:SelectBox1[],
onSelectValue:(val:string|number)=>void,
value?: string|number
}
>(({ label, className, selectClass, selectArray, onSelectValue, value }, ref)=>{
const placeHolder = selectArray?.[0]?.text ?? "";
return (
<div className={className+" flex items-center flex-nowrap"} ref={ref}>
{label && <Label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">{label}</Label>}
<Select onValueChange={onSelectValue} value={value !== undefined ? String(value) : undefined}>
<SelectTrigger className={selectClass?selectClass:"flex-1 p-2 border rounded"}>
<SelectValue placeholder={placeHolder} />
</SelectTrigger>
<SelectContent className="z-[101]">
{selectArray.map((selectArray) => (
<SelectItem key={selectArray.val} value={String(selectArray.val)}>{selectArray.text}</SelectItem>
))}
</SelectContent>
</Select>
</div>
)
})
export { SelectBox2 };
@@ -27,7 +27,6 @@ const SelectBox = React.forwardRef<
onSelectValue: (val: string | number) => void;
value?: string | number;
readOnly?: boolean; // readOnly 속성 추가
selectContentClass?: string;
}
>(
(
@@ -39,7 +38,6 @@ const SelectBox = React.forwardRef<
onSelectValue,
value,
readOnly = false,
selectContentClass,
},
ref,
) => {
@@ -89,7 +87,7 @@ const SelectBox = React.forwardRef<
>
<SelectValue placeholder={placeHolder} />
</SelectTrigger>
<SelectContent className={selectContentClass}>
<SelectContent>
{visibleItems.map((selectArray) => (
<SelectItem key={selectArray.val} value={String(selectArray.val)}>
{selectArray.text}
@@ -122,8 +122,8 @@ export function UiTable({
: cellClick
? "cursor-pointer"
: ""
} sticky top-20 z-40 bg-secondary !font-bold`}
style={{ top: `${headerHeight + index * 32-4}px` }}
} sticky z-40 bg-secondary !font-bold`}
style={{ top: `${headerHeight + index * 39}px` }}
onClick={() => handleCellClick(index, head.id)}
key={`cell-${head.id}-${index}`}
>
@@ -31,7 +31,7 @@ const TableHeader = React.forwardRef<
>(({ className, ...props }, ref) => (
<thead
ref={ref}
className={cn("sticky -top-2 z-10 bg-secondary [&_tr]:border-b", className)}
className={cn("sticky top-0 z-10 bg-secondary [&_tr]:border-b", className)}
{...props}
/>
));