지도점검 현황 모달 오류 수정, 평균값 소수점 자리수 설정, 엑셀 다운로드 시 누락된 값 추가, 테이블 merge 수정
This commit is contained in:
@@ -68,7 +68,12 @@ export default function Page() {
|
||||
data: {},
|
||||
});
|
||||
const cellClick = () => {
|
||||
if (searchYear) rainChkInit(searchYear, "0");
|
||||
if (searchYear)
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkInit(searchYear, "0");
|
||||
} else {
|
||||
rswtChkgdnInit(searchYear, "0");
|
||||
}
|
||||
};
|
||||
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
@@ -91,8 +96,7 @@ export default function Page() {
|
||||
}, [rainChkgdn.isInit, rainChkInit]);
|
||||
|
||||
useEffect(() => {
|
||||
if (rswtChkgdn.excelList[0]&&rswtChkgdn.excelList[0]?.data.length > 1) {
|
||||
|
||||
if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) {
|
||||
excelArrayDownload(
|
||||
"중수도시설 지도점검",
|
||||
"sample_rs_chk.xlsx",
|
||||
@@ -189,10 +193,10 @@ export default function Page() {
|
||||
label={""}
|
||||
selectClass={""}
|
||||
selectArray={rainChkgdn.fcltDiv}
|
||||
onSelectValue={(val: string | number) =>{
|
||||
if(val === "RST") rswtChkPolInit();
|
||||
setSelFcltDiv(String(val))
|
||||
}
|
||||
onSelectValue={(val: string | number) => {
|
||||
if (val === "RST") rswtChkPolInit();
|
||||
setSelFcltDiv(String(val))
|
||||
}
|
||||
}
|
||||
value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val}
|
||||
/>
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import {
|
||||
excelArrayDownload,
|
||||
excelDownload,
|
||||
yearOptions,
|
||||
yearOptions
|
||||
} from "@/components/lib/func/commom";
|
||||
import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel";
|
||||
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
||||
import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable";
|
||||
import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable";
|
||||
@@ -17,17 +13,15 @@ import {
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiModal
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
//-----------------------
|
||||
export default function Page() {
|
||||
const {
|
||||
code,
|
||||
@@ -38,7 +32,8 @@ export default function Page() {
|
||||
rswtChkSttnSearch,
|
||||
rswtChkSttnInit,
|
||||
isRainSttn,
|
||||
isRswtSttn
|
||||
isRswtSttn,
|
||||
rswtChkPolInit,
|
||||
} = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
@@ -51,9 +46,9 @@ export default function Page() {
|
||||
const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear()));
|
||||
const cellClick = () => {
|
||||
if (searchYear) {
|
||||
if(selFcltDiv === "RNB"){
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkSttnSearch(searchYear, "0");
|
||||
}else{
|
||||
} else {
|
||||
rswtChkSttnSearch(searchYear, "0");
|
||||
}
|
||||
}
|
||||
@@ -130,9 +125,11 @@ export default function Page() {
|
||||
label={""}
|
||||
selectClass={""}
|
||||
selectArray={rainChkSttn.fcltDiv}
|
||||
onSelectValue={(val: string | number) =>
|
||||
onSelectValue={(val: string | number) => {
|
||||
if (val === "RST") rswtChkPolInit();
|
||||
setSelFcltDiv(String(val))
|
||||
}
|
||||
}
|
||||
value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +61,7 @@ type rainChkgdnActions = {
|
||||
): Promise<void>;
|
||||
rainChkExcelDataUPload(excelData: rainChkZodType[]): Promise<void>;
|
||||
rainChkDelete(chkgdnPks: number[]): Promise<void>;
|
||||
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit :boolean) => void;
|
||||
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void;
|
||||
};
|
||||
|
||||
export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
|
||||
@@ -99,9 +99,10 @@ const makeMdfrChk = (data: rainChkZodType[], type: string, toDo: string) => {
|
||||
};
|
||||
|
||||
const initFetch = async (txt: string | undefined, sgg: string | undefined) => {
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainRes = await getFetch(
|
||||
"wr",
|
||||
`/reuseChk/rainy` + (txt ? `/${txt}` : "2024") + (sgg ? `/${sgg}` : "/0")
|
||||
`/reuseChk/rainy` + (txt ? `/${txt}` : currentYear) + (sgg ? `/${sgg}` : "/0")
|
||||
);
|
||||
return rainRes;
|
||||
};
|
||||
@@ -130,13 +131,16 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => {
|
||||
try {
|
||||
const res = await postFectch("/reuseChk/rainy", excelData);
|
||||
console.log("res", res);
|
||||
console.log("res.ok", res.ok)
|
||||
if (res.ok) {
|
||||
ToastFormUi({
|
||||
body: "지도점검 등록이 완료되었습니다. ",
|
||||
title: "지도점검 등록",
|
||||
});
|
||||
}
|
||||
const rainChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
@@ -178,7 +182,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
}
|
||||
const rainChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
@@ -201,7 +206,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
}
|
||||
const rainChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
@@ -223,7 +229,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
title: "지도점검 삭제",
|
||||
});
|
||||
}
|
||||
const rainChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
@@ -235,23 +242,23 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
ToastFormUi({ body: "삭제를 실패했습니다.. ", title: "지도점검 삭제" });
|
||||
}
|
||||
},
|
||||
rainChkHeadChange: async (rainChkgdn: rainChkgdnState , isEdit :boolean) => {
|
||||
rainChkHeadChange: async (rainChkgdn: rainChkgdnState, isEdit: boolean) => {
|
||||
try {
|
||||
const rainChkgdnHeadList = rainChkgdn.rainChkgdn.rainChkgdnHeadList;
|
||||
const splHeadList = rainChkgdn.rainChkgdn.splHeadList;
|
||||
const ruseHeadList = rainChkgdn.rainChkgdn.ruseHeadList;
|
||||
|
||||
rainChkgdnHeadList.forEach(( head) => {
|
||||
if(head.edit!== undefined)
|
||||
head.edit=isEdit;
|
||||
rainChkgdnHeadList.forEach((head) => {
|
||||
if (head.edit !== undefined)
|
||||
head.edit = isEdit;
|
||||
});
|
||||
splHeadList.forEach((head) => {
|
||||
if(head.edit!== undefined)
|
||||
head.edit=isEdit;
|
||||
if (head.edit !== undefined)
|
||||
head.edit = isEdit;
|
||||
});
|
||||
ruseHeadList.forEach((head) => {
|
||||
if(head.edit!== undefined)
|
||||
head.edit=isEdit;
|
||||
if (head.edit !== undefined)
|
||||
head.edit = isEdit;
|
||||
});
|
||||
|
||||
return set((state: rainChkgdnState) => ({
|
||||
@@ -259,8 +266,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChkgdnHeadList: rainChkgdnHeadList,
|
||||
splHeadList:splHeadList,
|
||||
ruseHeadList:ruseHeadList
|
||||
splHeadList: splHeadList,
|
||||
ruseHeadList: ruseHeadList
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
|
||||
@@ -80,10 +80,11 @@ export const rswtChkgdnStateExport: rswtChkgdnState = {
|
||||
};
|
||||
|
||||
const initFetch = async (year: string | undefined, sgg: string | undefined) => {
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await getFetch(
|
||||
"wr",
|
||||
`/reuseChk/reuseWater/` +
|
||||
(year ? `${year}` : "2024") +
|
||||
(year ? `${year}` : currentYear) +
|
||||
(sgg ? `/${sgg}` : "/0")
|
||||
);
|
||||
return rswtChkRes;
|
||||
@@ -121,12 +122,12 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
excelList.push({
|
||||
data: exceldata.guideDetail,
|
||||
headerNum: 0,
|
||||
headerRange: "A1:AI1",
|
||||
headerRange: "A1:AJ1",
|
||||
});
|
||||
excelList.push({
|
||||
data: exceldata.polutions,
|
||||
headerNum: 0,
|
||||
headerRange: "A1:AZ1",
|
||||
headerRange: "A1:BB1",
|
||||
});
|
||||
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
@@ -138,7 +139,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
},
|
||||
rswtChkgdnInit: async (year: string, sggCd: string) => {
|
||||
try {
|
||||
const rswtChkRes = await initFetch("2024", sggCd);
|
||||
const rswtChkRes = await initFetch(year, sggCd);
|
||||
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
@@ -161,11 +162,13 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
title: "지도점검 등록",
|
||||
});
|
||||
}
|
||||
// const rainChkRes = await initFetch('2024', '0');
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
@@ -184,7 +187,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
}
|
||||
const rswtChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
@@ -207,7 +211,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
title: "지도점검 삭제",
|
||||
});
|
||||
}
|
||||
const rswtChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
@@ -259,7 +264,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
}
|
||||
const rswtChkRes = await initFetch("2024", "0");
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch(currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
|
||||
@@ -19,6 +19,7 @@ export const buildingExcelRswtSttn = (excelList: any[]) => {
|
||||
String(item.trbt) ?? "",
|
||||
String(item.bod) ?? "",
|
||||
String(item.smll) ?? "",
|
||||
String(item.crmty) ?? "",
|
||||
String(item.tn) ?? "",
|
||||
String(item.tph) ?? "",
|
||||
String(item.ph) ?? "",
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const rswtChkSttnHeadListExport: TableUpperProps[] = [
|
||||
{ id: "order", title: "순번", rowSpan: true },
|
||||
{ id: "cityText", title: "시도", rowSpan: true },
|
||||
{ id: "sggText", title: "시군구", rowSpan: true },
|
||||
{ id: "bdstNm", title: "시설명", rowSpan: true },
|
||||
{ id: "operMngCd", title: "운영관리형태", rowSpan: true },
|
||||
{ id: "anlOperCst", title: "연간운영비(원/년)", rowSpan: true },
|
||||
{ id: "prcsCpct", title: "처리용량(m³)", rowSpan: true },
|
||||
{ id: "spwtPositn", title: "채수지점", rowSpan: true },
|
||||
{ id: "chckYmd", title: "점검일", rowSpan: true },
|
||||
{ id: "order", title: "순번", mergeCell: true },
|
||||
{ id: "cityText", title: "시도", mergeCell: true },
|
||||
{ id: "sggText", title: "시군구", mergeCell: true },
|
||||
{ id: "bdstNm", title: "시설명", mergeCell: true },
|
||||
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
|
||||
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
|
||||
{ id: "prcsCpct", title: "처리용량(m³)", mergeCell: true },
|
||||
{ id: "spwtPositn", title: "채수지점", mergeCell: true },
|
||||
{ id: "chckYmd", title: "점검일", mergeCell: true },
|
||||
{ id: "utztnUsgCd", title: "이용용도" },
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)", type: "number" },
|
||||
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)", type: "number" },
|
||||
|
||||
@@ -144,16 +144,16 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
const average = {
|
||||
utztnUsgCd: "평균",
|
||||
edit: false,
|
||||
grssClfgUswtr: total.grssClfgUswtr / onlyData.length,
|
||||
combResdch: total.combResdch / onlyData.length,
|
||||
trbt: total.trbt / onlyData.length,
|
||||
bod: total.bod / onlyData.length,
|
||||
smll: total.smll / onlyData.length,
|
||||
crmty: total.crmty / onlyData.length,
|
||||
tph: total.tph / onlyData.length,
|
||||
tn: total.tn / onlyData.length,
|
||||
ph: total.ph / onlyData.length,
|
||||
clIonQnt: total.clIonQnt / onlyData.length,
|
||||
grssClfgUswtr: (total.grssClfgUswtr / onlyData.length).toFixed(1),
|
||||
combResdch: (total.combResdch / onlyData.length).toFixed(1),
|
||||
trbt: (total.trbt / onlyData.length).toFixed(1),
|
||||
bod: (total.bod / onlyData.length).toFixed(1),
|
||||
smll: (total.smll / onlyData.length).toFixed(1),
|
||||
crmty: (total.crmty / onlyData.length).toFixed(1),
|
||||
tph: (total.tph / onlyData.length).toFixed(1),
|
||||
tn: (total.tn / onlyData.length).toFixed(1),
|
||||
ph: (total.ph / onlyData.length).toFixed(1),
|
||||
clIonQnt: (total.clIonQnt / onlyData.length).toFixed(1),
|
||||
};
|
||||
|
||||
if (!resultPolution[nodeKey]) {
|
||||
|
||||
Reference in New Issue
Block a user