Merge branch 'iipbs/sn/dev'
This commit is contained in:
@@ -501,6 +501,7 @@ export const upHeadSdmInfoStatus: TableUpperProps[] = [
|
||||
const postSdmData = async (data: DemandCompType) => {
|
||||
try {
|
||||
await postFetch("/reuseFc/request", data);
|
||||
sessionStorage.setItem("user", JSON.stringify(data) );
|
||||
toast.success("수요처 등록에 성공하였습니다.");
|
||||
return true;
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { getFetch, postFetch } from "@/app/components/api";
|
||||
//import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
export type { TableUpperProps };
|
||||
@@ -130,47 +130,109 @@ const upHeadListPrecipitationDetail:TableUpperProps[] = [
|
||||
const gridListPrecipitationDetail:PrecipitationPropsDetailProps[] = [
|
||||
]
|
||||
|
||||
export interface FacilityRainDetailProps {
|
||||
bscFctCd: string, // 시설코드
|
||||
rainDt: string, // 측정일
|
||||
stnKo: string, // 관측소명
|
||||
infoRnDay: number | string | '', // 강수량 (mm/일)
|
||||
rainDay: number, // 강우일 (일)
|
||||
rainEffectDay: number, // 강우영향일 (일)
|
||||
}
|
||||
|
||||
/**====================================
|
||||
* Store - api
|
||||
====================================*/
|
||||
// 시설정보 목록 []
|
||||
export const fetchFacilityRainDetailList = async (searchYear: string|undefined, fcltCdList: string[]): Promise<FacilityRainDetailProps | null> => {
|
||||
try {
|
||||
const res = await postFetch('fo', '/fclt/rain/detail/'+searchYear, fcltCdList);
|
||||
return res;
|
||||
} catch (error) {
|
||||
console.error('시설정보 목록 데이터를 가져오는데 실패했습니다:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
|
||||
const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ;
|
||||
const url = '/fclt/rain' + tailStr;
|
||||
const res = await getFetch('fo', url);
|
||||
const tmpData:PrecipitationPropsDetailProps[] = [];
|
||||
if(res!= null && res.data.length > 0){
|
||||
for(let idx=0; idx<res.data.length; idx++){
|
||||
for(let idx2=0; idx2<res.data[idx].rainyDayObjList.length; idx2++){
|
||||
const bscFctCd = res.data[idx].rainyDayObjList[idx2].bscFctCd;
|
||||
const rainDt = res.data[idx].rainyDayObjList[idx2].rainDt;
|
||||
const infoRnDay = res.data[idx].rainyDayObjList[idx2].infoRnDay;
|
||||
const rainDay = res.data[idx].rainyDayObjList[idx2].infoRnDay>=3?1:0;
|
||||
|
||||
|
||||
tmpData.push({
|
||||
bscFctCd : bscFctCd,
|
||||
rainDt : rainDt,
|
||||
infoRnDay : infoRnDay,
|
||||
rainDay : rainDay,
|
||||
rainEffectDay : rainDay
|
||||
})
|
||||
const fcltCdList : string[]= [];
|
||||
res?.data.forEach(item => {
|
||||
fcltCdList.push(item.bscFctCd);
|
||||
});
|
||||
|
||||
const rainDetailListRes: Record<string, any[]> = {};
|
||||
const promises: Promise<any>[] = [];
|
||||
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
|
||||
const slicedItems = fcltCdList.slice(idx, idx + 100);
|
||||
// 각 fetch 호출을 Promise 배열에 담기
|
||||
promises.push(fetchFacilityRainDetailList(searchYear, slicedItems));
|
||||
}
|
||||
// 모든 요청을 병렬로 실행
|
||||
const results = await Promise.all(promises);
|
||||
//console.log(results);
|
||||
// 결과를 합치기
|
||||
for (const res of results) {
|
||||
if (res.status === 200 && res.data) {
|
||||
for (const [key, value] of Object.entries(res.data)) {
|
||||
const keyStr = String(key);
|
||||
rainDetailListRes[keyStr] = [...(rainDetailListRes[keyStr] || []), ...(value as any[])];
|
||||
}
|
||||
}
|
||||
|
||||
res.data.map((item: FacilityPrecipitationProps) => {
|
||||
const filteredList = tmpData.filter((gridItem) => {
|
||||
return gridItem.bscFctCd === item.bscFctCd;
|
||||
});
|
||||
|
||||
const rtnData = CalcRainEffect(filteredList);
|
||||
item.rainEffectDay = rtnData.reduce((acc, curr) => acc + curr.rainEffectDay, 0);
|
||||
item.totalYearRain = rtnData.reduce((acc, curr) => acc + Number(curr.infoRnDay), 0);
|
||||
item.infoRnDay = filteredList.reduce((acc, curr) => acc + curr.rainDay, 0);
|
||||
});
|
||||
|
||||
}
|
||||
//console.log(rainDetailListRes);
|
||||
|
||||
return { data: res.data, count: res.count, detailData: tmpData };
|
||||
const tmpData:PrecipitationPropsDetailProps[] = [];
|
||||
|
||||
for (const item of res?.data) {
|
||||
const rainDetailList = rainDetailListRes[item.bscFctCd];
|
||||
|
||||
let rainDayCnt = 0; // 강우일수
|
||||
let rainEffectDayCnt = 0; // 강우영향일수
|
||||
let totalRain = 0; // 총강수량
|
||||
if (rainDetailList) {
|
||||
item.stnKo = rainDetailList[0]?.stnKo || ''; // 관측소명
|
||||
|
||||
let rainEffectDayEval = 0; // 강우영향일 평가 변수
|
||||
rainDetailList.forEach(item2 => {
|
||||
|
||||
if (item2.infoRnDay == null) item2.infoRnDay = 0;
|
||||
if (item2.infoRnDay >= 3) { // 강우량이 3mm 이상인 경우 강우일
|
||||
rainEffectDayEval = 2;
|
||||
item2.rainDay = 1;
|
||||
rainDayCnt++; // 강우일수 증가
|
||||
} else {
|
||||
rainEffectDayEval--;
|
||||
item2.rainDay = 0;
|
||||
}
|
||||
|
||||
if (rainEffectDayEval < 0) { // 청천일
|
||||
item2.rainEffectDay = 0;
|
||||
} else { // 강우영향일
|
||||
item2.rainEffectDay = 1;
|
||||
rainEffectDayCnt++; // 강우영향일수 증가
|
||||
}
|
||||
totalRain += Number(item2.infoRnDay);
|
||||
item2.rainDt = item2.rainDt;
|
||||
tmpData.push({
|
||||
bscFctCd: item.bscFctCd,
|
||||
rainDt: item2.rainDt.substring(0,10),
|
||||
infoRnDay: item2.infoRnDay,
|
||||
rainEffectDay: item2.rainEffectDay,
|
||||
rainDay: item2.rainDay
|
||||
});
|
||||
});
|
||||
item.infoRnDay = rainDayCnt;
|
||||
item.rainEffectDay = rainEffectDayCnt;
|
||||
item.totalYearRain = totalRain;
|
||||
item.rainDetailList = rainDetailList;
|
||||
}
|
||||
}
|
||||
|
||||
return { data: res.data, count: res.count, detailData: tmpData};
|
||||
}
|
||||
|
||||
/**====================================
|
||||
|
||||
@@ -17,7 +17,7 @@ export type { TableUpperProps };
|
||||
export type RdiProps = {
|
||||
bscFctCd : string,
|
||||
sido : string,
|
||||
sigungo : string,
|
||||
gugun : string,
|
||||
bscFctNm : string,
|
||||
lclgvrnmntNm : string,
|
||||
daddr : string,
|
||||
@@ -40,7 +40,7 @@ export type RdiProps = {
|
||||
export interface RdiInterface {
|
||||
bscFctCd : string,
|
||||
sido : string,
|
||||
sigungo : string,
|
||||
gugun : string,
|
||||
bscFctNm : string,
|
||||
lclgvrnmntNm : string,
|
||||
daddr : string,
|
||||
@@ -103,7 +103,7 @@ export interface ExcelType {
|
||||
const upHeadList1:TableUpperProps[] = [
|
||||
{ id: "A", title: "행정구역", row:0, colSpan:2 },
|
||||
{ id: "sido", title: "시도", row:1, widthPercent: 6 },
|
||||
{ id: "sigungo", title: "시군구", row:1, widthPercent: 6 },
|
||||
{ id: "gugun", title: "시군구", row:1, widthPercent: 6 },
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 7 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 7 },
|
||||
@@ -147,7 +147,7 @@ const upHeadList3:TableUpperProps[] = [
|
||||
{ id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 6 },
|
||||
{ id: "B", title: "행정구역", row:0, colSpan:2 },
|
||||
{ id: "sido", title: "시도", upName:"upChangeRe2", upSequnce:1, row:1, widthPercent: 4 },
|
||||
{ id: "sigungo", title: "시군구", upName:"upChangeRe2",upSequnce:2, row:1, widthPercent: 4 },
|
||||
{ id: "gugun", title: "시군구", upName:"upChangeRe2",upSequnce:2, row:1, widthPercent: 4 },
|
||||
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 6 },
|
||||
{ id: "daddr", title: "주소", row:0, rowSpan:2 },
|
||||
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 5 },
|
||||
@@ -184,8 +184,10 @@ const fetchRdiList = async (pageNo: number, pageSize: number, searchYear: string
|
||||
item.rdiiValue = '';
|
||||
item.infoRnDay = '';
|
||||
item.properYn = '';
|
||||
item.sido = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
|
||||
item.sigungo = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
|
||||
// item.sido = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
|
||||
// item.gugun = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
|
||||
item.sido = item.sido;
|
||||
item.gugun = item.gugun;
|
||||
});
|
||||
return { data: res.data, count: res.count }
|
||||
}catch(error){
|
||||
@@ -307,8 +309,10 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
const rtnData = res.data.map((item: RdiProps) => {
|
||||
return {
|
||||
...item,
|
||||
sido: item.lclgvrnmntNm.split(' ')[0]?.toString() || '',
|
||||
sigungo: item.lclgvrnmntNm.split(' ')[1]?.toString() || '',
|
||||
//sido: item.lclgvrnmntNm.split(' ')[0]?.toString() || '',
|
||||
//gugun: item.lclgvrnmntNm.split(' ')[1]?.toString() || '',
|
||||
sido: item.sido,
|
||||
gugun : item.gugun,
|
||||
inflAmnt: item.inflAmnt?Number(item.inflAmnt).toFixed(1): '' // 유입유량 (강우량)
|
||||
}
|
||||
})
|
||||
@@ -427,7 +431,7 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
|
||||
환경청: item.rgnNm,
|
||||
시설명: item.bscFctNm,
|
||||
시도: item.sido,
|
||||
시군구: item.sigungo,
|
||||
시군구: item.gugun,
|
||||
주소: item.daddr,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"청천시유입하수량(m³/일)": item.chungchunFlow,
|
||||
|
||||
@@ -231,11 +231,12 @@ const Ssc = ({ featureData, isMainSsc, chmbrXcnts, chmbrYdnts, onSaveClick }: {
|
||||
|
||||
const renderModalBody = () => (
|
||||
<div className='grid grid-cols-1 gap-4 p-4 mr-4 mt-4'>
|
||||
<div className='border rounded-lg p-4 bg-white'>
|
||||
<Label className='text-3xl font-medium text-label '>강우/측정 정보</Label>
|
||||
<div className='border rounded-lg pt-4 bg-white'>
|
||||
<Label className='text-2xl font-bold text-label ml-4'>강우/측정 정보</Label>
|
||||
<hr className="my-4 ml-4 mr-4 border-t border-gray-300" />
|
||||
{/* 강우정보 테이블 */}
|
||||
<UiTable
|
||||
headName='강우정보'
|
||||
headName=''
|
||||
tableData={rainMeasureData}
|
||||
headlist={untrtSwgRainCol3}
|
||||
pageSize={3}
|
||||
@@ -249,7 +250,7 @@ const Ssc = ({ featureData, isMainSsc, chmbrXcnts, chmbrYdnts, onSaveClick }: {
|
||||
|
||||
{/* 측정정보 테이블 */}
|
||||
<UiTable
|
||||
headName='측정정보'
|
||||
headName=''
|
||||
tableData={rainMeasureData}
|
||||
headlist={untrtSwgRainCol4}
|
||||
pageSize={3}
|
||||
@@ -278,11 +279,12 @@ const Ssc = ({ featureData, isMainSsc, chmbrXcnts, chmbrYdnts, onSaveClick }: {
|
||||
</UiTable>
|
||||
</div>
|
||||
|
||||
<div className='border rounded-lg p-4 bg-white'>
|
||||
<div className='border rounded-lg pt-4 bg-white'>
|
||||
{/* 수량/수질측정 정보 테이블 */}
|
||||
<Label className='text-3xl font-medium text-label '>수량/수질측정 정보</Label>
|
||||
<Label className='text-2xl font-bold text-label ml-4'>수량/수질측정 정보</Label>
|
||||
<hr className="my-4 ml-4 mr-4 border-t border-gray-300" />
|
||||
<UiTable
|
||||
headName=' '
|
||||
headName=''
|
||||
tableData={mntrngsData}
|
||||
headlist={untrtSwgRainCol5}
|
||||
pageSize={3}
|
||||
@@ -340,8 +342,7 @@ const Ssc = ({ featureData, isMainSsc, chmbrXcnts, chmbrYdnts, onSaveClick }: {
|
||||
`}
|
||||
body={renderModalBody()}
|
||||
noHeaderYn='Y'
|
||||
noFooterYn='N'
|
||||
// footerContent={renderFooterContent()}
|
||||
noFooterYn='Y'
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -723,6 +723,12 @@ export default function CoMatRvw() {
|
||||
))}
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
</ListDiv>
|
||||
<ListDiv>
|
||||
<div className="card-header flex items-center justify-between">
|
||||
<h3 className="text-2xl font-medium text-label">표준공사비 산정</h3>
|
||||
</div>
|
||||
<ConCostForm
|
||||
form={form}
|
||||
type={"mat"}
|
||||
|
||||
@@ -68,6 +68,15 @@ export default function DrgtSttn() {
|
||||
sggNm: code.sggCd.find(sgg => sgg.text == item.sggNm)?.text
|
||||
}
|
||||
})
|
||||
.sort((a, b) => {
|
||||
// ctpvCd 기준 1차 정렬
|
||||
const ctpvCompare = (a.ctpvCd || '').localeCompare(b.ctpvCd || '');
|
||||
if (ctpvCompare !== 0) return ctpvCompare;
|
||||
|
||||
// sggNm 기준 2차 정렬
|
||||
return (a.sggNm || '').localeCompare(b.sggNm || '');
|
||||
});
|
||||
|
||||
const data = Array.isArray(resData)
|
||||
? resData.map((item: customDrgt) => {
|
||||
return {
|
||||
|
||||
@@ -301,12 +301,12 @@ export default function ConCostForm({
|
||||
|
||||
return (
|
||||
<>
|
||||
<hr className="mt-8" />
|
||||
|
||||
<Form {...form}>
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
{/* <h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
표준공사비 산정
|
||||
</h3>
|
||||
<div className="flex items-center mx-3 mb-3">
|
||||
</h3> */}
|
||||
<div className="flex items-center mx-3 mb-3 pt-5">
|
||||
<h1 className="">처리시설 표준공사비 산정</h1>
|
||||
|
||||
<Button className="mx-3" size={"sm"} onClick={calculateConstCost}>
|
||||
|
||||
Reference in New Issue
Block a user