다운로드 숫자로 변경 및 숫자 형식 지정하여 엑셀다운로드 지정할 수 있도록 수정
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
export default function CommaToNumber (data: any){
|
||||
const rtnValue = data&&data.toString().trim()!=''&&data!=undefined?Number(data.toString().replaceAll(',','')):'';
|
||||
return rtnValue;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ export default function DashBoard() {
|
||||
const excelData1 = planFcltyList.map((item) => {
|
||||
return [
|
||||
item.item,
|
||||
item.provisionalApproval,
|
||||
Number(item.provisionalApproval.toString().replaceAll(',',''))?Number(item.provisionalApproval.toString().replaceAll(',','')):item.provisionalApproval,
|
||||
item.now,
|
||||
item.stepOne,
|
||||
item.stepTwo,
|
||||
@@ -171,23 +171,24 @@ export default function DashBoard() {
|
||||
// operationalStatusList를 2차원 배열로 변환
|
||||
const excelData2 = operationalStatusList.map((item, index) => {
|
||||
const baseData = [
|
||||
item.yearAvg,
|
||||
item.yearMax,
|
||||
item.yearMin,
|
||||
item.summerAll,
|
||||
item.summerThree,
|
||||
item.summerRain,
|
||||
item.winterAll,
|
||||
item.winterSunnyAvg,
|
||||
item.winterSunnyMax,
|
||||
item.winterSunnyMin,
|
||||
item.groundWaterAvg,
|
||||
item.groundWaterSummer,
|
||||
item.groundWaterWinter
|
||||
Number(item.yearAvg?.replaceAll(',','')),
|
||||
Number(item.yearMax?.replaceAll(',','')),
|
||||
Number(item.yearMin?.replaceAll(',','')),
|
||||
Number(item.summerAll?.replaceAll(',','')),
|
||||
Number(item.summerThree?.replaceAll(',','')),
|
||||
Number(item.summerRain?.replaceAll(',','')),
|
||||
Number(item.winterAll?.replaceAll(',','')),
|
||||
Number(item.winterSunnyAvg?.replaceAll(',','')),
|
||||
Number(item.winterSunnyMax?.replaceAll(',','')),
|
||||
Number(item.winterSunnyMin?.replaceAll(',','')),
|
||||
Number(item.groundWaterAvg?.replaceAll(',','').replaceAll('%','')),
|
||||
Number(item.groundWaterSummer?.replaceAll(',','').replaceAll('%','')),
|
||||
Number(item.groundWaterWinter?.replaceAll(',','').replaceAll('%',''))
|
||||
];
|
||||
|
||||
// index가 0일 때만 rdi와 rdiRain 추가
|
||||
return index === 0 ? [...baseData, item.rdi, item.rdiRain] : baseData;
|
||||
console.log(item.rdiRain);
|
||||
return index === 0 ? [...baseData, item.rdi&&item.rdi.toString().trim()!=''?Number(item.rdi.toString().replaceAll(',','')):'', item.rdiRain&&item.rdiRain.toString().trim()!=''?Number(item.rdiRain.toString().replaceAll(',','')):''] : baseData;
|
||||
});
|
||||
|
||||
const sheetParameter = [
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"use client"
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { FacilityWaterQltyProps, modalExcelType } from "@/app/store/facilityWaterQlty";
|
||||
import { downloadExcel, UITab, UiTable } from "@common/business_components/ui";
|
||||
import { downloadExcel, downloadExcelFormat, UITab, UiTable } from "@common/business_components/ui";
|
||||
import { Button, TabsContent } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader";
|
||||
@@ -15,6 +15,7 @@ import FacilityTermModalHeader from "../../../../components/common/FacilityTermM
|
||||
import { HeadMakeColSpan } from "../HeadMakeColSpan";
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import UnderComment from "@/app/components/common/UnderComment";
|
||||
import CommaToNumber from "@/app/components/common/CommaToNumber";
|
||||
|
||||
const commentArrayChungchun = [
|
||||
"청천시 : 강우량이 3mm미만의 날"
|
||||
@@ -355,22 +356,29 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
|
||||
copyYearList.forEach((item) => {
|
||||
excelDownList.push({
|
||||
날짜: item.msrDt,
|
||||
"유입BOD(mg/L)": item.inflAssctBfrWqltBod,
|
||||
"유입TOC(COD)(mg/L)": item.inflAssctBfrWqltToc,
|
||||
"유입SS(mg/L)": item.inflAssctBfrWqltSs,
|
||||
"유입TN(mg/L)": item.inflAssctBfrWqltTn,
|
||||
"유입TP(mg/L)": item.inflAssctBfrWqltTp,
|
||||
"유출BOD(mg/L)": item.efflWqltBod,
|
||||
"유출TOC(COD)(mg/L)": item.efflWqltToc,
|
||||
"유출SS(mg/L)": item.efflWqltSs,
|
||||
"유출TN(mg/L)": item.efflWqltTn,
|
||||
"유출TP(mg/L)": item.efflWqltTp,
|
||||
/* "강우량(mm/일)": item.infoRnDay?item.infoRnDay.toString():"0.0", */
|
||||
"유입BOD(mg/L)": CommaToNumber(item.inflAssctBfrWqltBod),
|
||||
"유입TOC(COD)(mg/L)": CommaToNumber(item.inflAssctBfrWqltToc),
|
||||
"유입SS(mg/L)": CommaToNumber(item.inflAssctBfrWqltSs),
|
||||
"유입TN(mg/L)": CommaToNumber(item.inflAssctBfrWqltTn),
|
||||
"유입TP(mg/L)": CommaToNumber(item.inflAssctBfrWqltTp),
|
||||
"유출BOD(mg/L)": CommaToNumber(item.efflWqltBod),
|
||||
"유출TOC(COD)(mg/L)": CommaToNumber(item.efflWqltToc),
|
||||
"유출SS(mg/L)": CommaToNumber(item.efflWqltSs),
|
||||
"유출TN(mg/L)": CommaToNumber(item.efflWqltTn),
|
||||
"유출TP(mg/L)": CommaToNumber(item.efflWqltTp),
|
||||
"강우량(mm/일)": CommaToNumber(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' });
|
||||
downloadExcelFormat(
|
||||
{ data: JSON.parse(JSON.stringify(excelDownList))
|
||||
, fileName: searchYear+'년 '+fcltyName + ' 수질현황'
|
||||
, sheetNameArray: [fcltyName + ' 수질현황']
|
||||
, headerRange: 'A1:L1'
|
||||
, decimalArray1: [1,2,3,6,7,8,11]
|
||||
, decimalArray3: [4,5,9,10]
|
||||
});
|
||||
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
|
||||
alert('다운받을 데이터가 없습니다.');
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/common";
|
||||
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components";
|
||||
import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty";
|
||||
import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import WaterQualityModal from "./modal/page";
|
||||
import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function ProcessFacilitySearch() {
|
||||
const { Common
|
||||
@@ -144,12 +144,23 @@ export default function ProcessFacilitySearch() {
|
||||
|
||||
useEffect(() => {
|
||||
if (excelList && excelList.length > 0) {
|
||||
downloadExcel({
|
||||
downloadExcelFormat(
|
||||
{
|
||||
data: excelList as unknown as JSON[],
|
||||
fileName: '시설별 수질현황',
|
||||
sheetNameArray: ['시설별 수질현황'],
|
||||
headerRange: 'A1:T1',
|
||||
decimalArray1:[10,11,12,15,16,17],
|
||||
decimalArray3:[13,14,18,19]
|
||||
}
|
||||
);
|
||||
|
||||
/* downloadExcel({
|
||||
data: excelList as unknown as JSON[],
|
||||
fileName: '시설별 수질현황',
|
||||
sheetNameArray: ['시설별 수질현황'],
|
||||
headerRange: 'A1:T1'
|
||||
});
|
||||
}); */
|
||||
}
|
||||
}, [excelList]);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { roundNumber } from "@/app/components/common/DataForm";
|
||||
import { useFoStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/dashboard";
|
||||
import { downloadExcel, filePickedBlobArray, UITab, UiTable } from "@common/business_components/ui";
|
||||
import { downloadExcel, downloadExcelFormat, filePickedBlobArray, UITab, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import {
|
||||
TabsContent
|
||||
@@ -137,12 +137,12 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
|
||||
"준공일": item.cmplDt,
|
||||
"시운전완료일": item.trlrnCmplDt,
|
||||
"가동개시일": item.rnDt,
|
||||
"시설용량(m³/일)": roundNumber(item.fctCpc,0),
|
||||
"시설용량(m³/일)": item.fctCpc&&item.fctCpc.toString().trim()!=''?Number(item.fctCpc.toString().replaceAll(',','')):'',
|
||||
});
|
||||
});
|
||||
}
|
||||
if (excelDownList && excelDownList.length > 0) {
|
||||
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.fcltyName + ' 시설이력관리', sheetNameArray: [props.fcltyName + ' 시설이력관리'], headerRange: 'A1:I1' });
|
||||
downloadExcelFormat({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.fcltyName + ' 시설이력관리', sheetNameArray: [props.fcltyName + ' 시설이력관리'], headerRange: 'A1:I1' });
|
||||
} else if (gridListFcltyHistInfo.length == 0) {
|
||||
alert('다운받을 데이터가 없습니다.');
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ export type planFcltyListProps = {
|
||||
export type OperationalStatusListProps = {
|
||||
flowRate : string,
|
||||
waterQlty : string,
|
||||
yearAvg : number | string | '',
|
||||
yearMax : number | string | '',
|
||||
yearMin : number | string | '',
|
||||
yearAvg : number | '',
|
||||
yearMax : number | '',
|
||||
yearMin : number | '',
|
||||
summerAll : number | string | '',
|
||||
summerThree : number | string | '',
|
||||
summerRain : number | string | '',
|
||||
@@ -1246,9 +1246,7 @@ const changeValue=(operationalStatus, data, keyTxt = 'INFL_AMNT')=>{
|
||||
operationalStatus.winterSunnyAvg = data.winterSunny ? (keyTxt.includes('_TP') || keyTxt.includes("_TN"))? data.winterSunny?Number(Math.round(data.winterSunny["AVG_" + keyTxt] * 1000) / 1000).toFixed(3).toString():'': data.winterSunny["AVG_" + keyTxt] : '';
|
||||
operationalStatus.winterSunnyMax = data.winterSunny ? (keyTxt.includes('_TP') || keyTxt.includes("_TN"))? data.winterSunny?Number(Math.round(data.winterSunny["MAX_" + keyTxt] * 1000) / 1000).toFixed(3).toString():'': data.winterSunny["MAX_" + keyTxt] : '';
|
||||
// 지하수
|
||||
operationalStatus.groundWaterAvg = 10;
|
||||
operationalStatus.groundWaterSummer = 11;
|
||||
operationalStatus.groundWaterWinter = 12;
|
||||
|
||||
// 오염물질
|
||||
// RDII 추정 = 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD))
|
||||
const summerLowFlow = data.summerBod && data.summerBod.INFL_AMNT && data.summerBod.INFL_AMNT != 'null' ? Number(data.summerBod.INFL_AMNT) : 0;
|
||||
|
||||
@@ -3,6 +3,7 @@ import DataForm, { roundNumber } from "@/app/components/common/DataForm";
|
||||
import type { TableUpperProps } from "../dashboard";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { COD_YEAR } from "../common";
|
||||
import CommaToNumber from "@/app/components/common/CommaToNumber";
|
||||
export type { TableUpperProps };
|
||||
|
||||
/**====================================
|
||||
@@ -70,17 +71,17 @@ export interface ExcelType {
|
||||
시군구: string,
|
||||
시설이름: string,
|
||||
주소: string,
|
||||
"시설용량(m³/일)": number,
|
||||
"유입BOD(mg/L)": string | '',
|
||||
"유입TOC(mg/L)": string | '',
|
||||
"유입SS(mg/L)": string | '',
|
||||
"유입TN(mg/L)": string | '',
|
||||
"유입TP(mg/L)": string | '',
|
||||
"유출BOD(mg/L)": string | '',
|
||||
"유출TOC(mg/L)": string | '',
|
||||
"유출SS(mg/L)": string | '',
|
||||
"유출TN(mg/L)": string | '',
|
||||
"유출TP(mg/L)": string | '',
|
||||
"시설용량(m³/일)": number | '',
|
||||
"유입BOD(mg/L)": number | '',
|
||||
"유입TOC(mg/L)": number | '',
|
||||
"유입SS(mg/L)": number | '',
|
||||
"유입TN(mg/L)": number | '',
|
||||
"유입TP(mg/L)": number | '',
|
||||
"유출BOD(mg/L)": number | '',
|
||||
"유출TOC(mg/L)": number | '',
|
||||
"유출SS(mg/L)": number | '',
|
||||
"유출TN(mg/L)": number | '',
|
||||
"유출TP(mg/L)": number | '',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,17 +105,17 @@ export interface WaterQualityHistoryResponse {
|
||||
|
||||
export type modalExcelType = {
|
||||
날짜: string;
|
||||
"유입BOD(mg/L)": string;
|
||||
"유입TOC(COD)(mg/L)": string;
|
||||
"유입SS(mg/L)": string;
|
||||
"유입TN(mg/L)": string;
|
||||
"유입TP(mg/L)": string;
|
||||
"유출BOD(mg/L)": string;
|
||||
"유출TOC(COD)(mg/L)": string;
|
||||
"유출SS(mg/L)": string;
|
||||
"유출TN(mg/L)": string;
|
||||
"유출TP(mg/L)": string;
|
||||
/* "강우량(mm/일)": string; */
|
||||
"유입BOD(mg/L)": number | '';
|
||||
"유입TOC(COD)(mg/L)": number | '';
|
||||
"유입SS(mg/L)": number | '';
|
||||
"유입TN(mg/L)": number | '';
|
||||
"유입TP(mg/L)": number | '';
|
||||
"유출BOD(mg/L)": number | '';
|
||||
"유출TOC(COD)(mg/L)": number | '';
|
||||
"유출SS(mg/L)": number | '';
|
||||
"유출TN(mg/L)": number | '';
|
||||
"유출TP(mg/L)": number | '';
|
||||
"강우량(mm/일)": number | '';
|
||||
}
|
||||
|
||||
/**====================================
|
||||
@@ -486,17 +487,17 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
|
||||
시군구: item.sggNm,
|
||||
시설이름: item.bscFctNm,
|
||||
주소: item.addr,
|
||||
"시설용량(m³/일)": item.fctCpc,
|
||||
"유입BOD(mg/L)": item.inflAssctBfrWqltBod,
|
||||
"유입TOC(mg/L)": item.inflAssctBfrWqltToc,
|
||||
"유입SS(mg/L)": item.inflAssctBfrWqltSs,
|
||||
"유입TN(mg/L)": item.inflAssctBfrWqltTn,
|
||||
"유입TP(mg/L)": item.inflAssctBfrWqltTp,
|
||||
"유출BOD(mg/L)": item.efflWqltBod,
|
||||
"유출TOC(mg/L)": item.efflWqltToc,
|
||||
"유출SS(mg/L)": item.efflWqltSs,
|
||||
"유출TN(mg/L)": item.efflWqltTn,
|
||||
"유출TP(mg/L)": item.efflWqltTp,
|
||||
"시설용량(m³/일)": CommaToNumber(item.fctCpc),
|
||||
"유입BOD(mg/L)": CommaToNumber(item.inflAssctBfrWqltBod),
|
||||
"유입TOC(mg/L)": CommaToNumber(item.inflAssctBfrWqltToc),
|
||||
"유입SS(mg/L)": CommaToNumber(item.inflAssctBfrWqltSs),
|
||||
"유입TN(mg/L)": CommaToNumber(item.inflAssctBfrWqltTn),
|
||||
"유입TP(mg/L)": CommaToNumber(item.inflAssctBfrWqltTp),
|
||||
"유출BOD(mg/L)": CommaToNumber(item.efflWqltBod),
|
||||
"유출TOC(mg/L)": CommaToNumber(item.efflWqltToc),
|
||||
"유출SS(mg/L)": CommaToNumber(item.efflWqltSs),
|
||||
"유출TN(mg/L)": CommaToNumber(item.efflWqltTn),
|
||||
"유출TP(mg/L)": CommaToNumber(item.efflWqltTp),
|
||||
});
|
||||
});
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user