중복 타입 제거 및 실적등록 완료
This commit is contained in:
@@ -20,7 +20,6 @@ import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import { headMakeColSpan } from "../rainReg/TableHead";
|
||||
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -17,14 +17,11 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import type {
|
||||
customPbnst,
|
||||
fcBizSchema,
|
||||
fcBizType,
|
||||
pubHasuType,
|
||||
ruseFcltType,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
|
||||
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
|
||||
import { z } from "zod";
|
||||
import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { TableRow, TableHead } from "@common/components/ui";
|
||||
|
||||
export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
export const makeFcltRegHead = (upHeadList: TableUpperProps[]) => {
|
||||
return (
|
||||
<>
|
||||
<TableRow>
|
||||
|
||||
@@ -19,7 +19,7 @@ import { tableData } from "@/components/lib/func/commom";
|
||||
import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { headMakeColSpan } from "../rainReg/TableHead";
|
||||
import { makeFcltRegHead } from "../rainReg/TableHead";
|
||||
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
type ReturnType,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import { makeFcltRegHead } from "@common/business_components/ui/table/makeFcltRegHead";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import { Button } from "@common/components/ui";
|
||||
@@ -155,7 +155,7 @@ export default function HtdflSttn() {
|
||||
headName={[]}
|
||||
tableData={bdstTable || []}
|
||||
children={
|
||||
<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />
|
||||
<makeFcltRegHead upHeadList={htdflSttn.htdflSttNodeList} />
|
||||
}
|
||||
headlist={htdflSttn.htdflSttHeadList}
|
||||
pageSize={20}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { TableHead, TableRow } from "@common/components/ui";
|
||||
|
||||
export const headMakeprfmnc = (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { FcPrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import type { pubHasuType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
import PbnPrfExcelModal from "@/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal";
|
||||
@@ -17,17 +16,41 @@ import {
|
||||
UiModal,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
import {
|
||||
Button,
|
||||
Label,
|
||||
Table,
|
||||
TableBody,
|
||||
TableHeader,
|
||||
} from "@common/components/ui";
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import { set } from "react-hook-form";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import {
|
||||
initValInUsage,
|
||||
initValOutUsage,
|
||||
subTotalObj,
|
||||
totalObj,
|
||||
type FcPrfType,
|
||||
type PrfType,
|
||||
} from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel";
|
||||
|
||||
export default function prfmncPrfmncReg() {
|
||||
const { code, prfmnc, prfmncHasuInit } = useWrStore((state) => state);
|
||||
const { code, prfmnc, prfmncHasuInit, prfmnRegData } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes } = prfmnc;
|
||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [isExcelOpen, setIsExcelOPen] = useState<{isModal:boolean, data:FcPrfType}>({isModal:false, data:{} as FcPrfType });
|
||||
const [isExcelOpen, setIsExcelOPen] = useState<{
|
||||
isModal: boolean;
|
||||
data: FcPrfType;
|
||||
}>({ isModal: false, data: {} as FcPrfType });
|
||||
const [inputData, setInputData] = useState<any[]>();
|
||||
const [pbnstRuseFcltPk, setPbnstRuseFcltPk] = useState<string>();
|
||||
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
@@ -41,15 +64,86 @@ export default function prfmncPrfmncReg() {
|
||||
);
|
||||
}, [prfmnc.excelList]);
|
||||
|
||||
const onSave = useCallback(() => {
|
||||
if (pbnstRuseFcltPk) {
|
||||
prfmnRegData(
|
||||
excelToPbnPrfData(
|
||||
inputData as unknown as JSON[],
|
||||
searchYear,
|
||||
pbnstRuseFcltPk
|
||||
) as unknown as PrfType
|
||||
);
|
||||
prfmncHasuInit("1", "11");
|
||||
}
|
||||
}, [inputData, searchYear, pbnstRuseFcltPk,prfmncHasuInit]);
|
||||
|
||||
const cellClick = useCallback(
|
||||
(index: number | undefined, headId: string) => {
|
||||
if (index !== undefined) {
|
||||
setIsExcelOPen({
|
||||
isModal: false,
|
||||
data: prfmncRes[index] || ({} as FcPrfType),
|
||||
});
|
||||
const inUsageData = initValInUsage;
|
||||
const outUsageData = initValOutUsage;
|
||||
|
||||
const inSubtotal = subTotalObj;
|
||||
const outSubtotal = subTotalObj;
|
||||
|
||||
const cellClick = useCallback((index:number|undefined, headId:string) => {
|
||||
if (prfmncRes[index]?.prfList) {
|
||||
prfmncRes[index].prfList?.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
|
||||
if(index !== undefined)
|
||||
setIsExcelOPen({isModal:false, data:prfmncRes[index] || {} as FcPrfType})
|
||||
inUsageData.forEach((inData: any) => {
|
||||
const usageKey = inData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
}, [prfmncRes]);
|
||||
inData[monthKey] = value;
|
||||
inData.total += value;
|
||||
|
||||
if (inSubtotal && usageKey !== "subtotal") {
|
||||
(inSubtotal as any)[monthKey] =
|
||||
((inSubtotal as any)[monthKey] ?? 0) + value;
|
||||
inSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
|
||||
outUsageData.forEach((outData: any) => {
|
||||
const usageKey = outData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
outData[monthKey] = value;
|
||||
outData.total += value;
|
||||
|
||||
if (usageKey !== "subtotal") {
|
||||
(outSubtotal as any)[monthKey] =
|
||||
((outSubtotal as any)[monthKey] ?? 0) + value;
|
||||
outSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
});
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = totalObj;
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
(Number((inSubtotal as any)[key]) || 0) +
|
||||
(Number((outSubtotal as any)[key]) || 0);
|
||||
|
||||
(usageTotalObj as any)[key] = val;
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPbnstRuseFcltPk(prfmncRes[index].pbnstRuseFcltPk);
|
||||
setInputData(tableData);
|
||||
} else {
|
||||
setInputData([]);
|
||||
}
|
||||
}
|
||||
},
|
||||
[prfmncRes]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!prfmnc.isInit) {
|
||||
@@ -103,13 +197,18 @@ export default function prfmncPrfmncReg() {
|
||||
<Button size={"sm"} onClick={(e) => {}}>
|
||||
조회
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={() => {}}>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
onSave();
|
||||
}}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
setIsExcelOPen( { ...isExcelOpen, isModal:true } );
|
||||
setIsExcelOPen({ ...isExcelOpen, isModal: true });
|
||||
}}
|
||||
>
|
||||
파일등록
|
||||
@@ -134,7 +233,9 @@ export default function prfmncPrfmncReg() {
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"하수재이용시설 목록"}
|
||||
cellClick={(index:number|undefined, headId:string) => {cellClick(index,headId)}}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index, headId);
|
||||
}}
|
||||
onPageChange={(page: number) => {}}
|
||||
children={undefined}
|
||||
/>
|
||||
@@ -143,26 +244,30 @@ export default function prfmncPrfmncReg() {
|
||||
</div>
|
||||
<ListDiv className="col-span-8 pr-6 ">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<UiTable
|
||||
tableData={[]}
|
||||
headlist={monthHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"하수처리수재이용 실적(m3) 등록결과"}
|
||||
cellClick={() => {}}
|
||||
onPageChange={() => {}}
|
||||
children={undefined}
|
||||
/>
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{"하수처리수재이용 실적(m3) 등록결과"}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(monthHeadList, [])}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{InputTableBody(inputData ?? [], monthHeadList, setInputData)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
body={<PbnPrfExcelModal data={isExcelOpen.data}></PbnPrfExcelModal>}
|
||||
body={<PbnPrfExcelModal data={isExcelOpen.data}></PbnPrfExcelModal>}
|
||||
open={isExcelOpen.isModal}
|
||||
onOpenChange={() => {
|
||||
setIsExcelOPen({isModal:false, data:{} as pubHasuType});
|
||||
setIsExcelOPen({ isModal: false, data: {} as FcPrfType });
|
||||
}}
|
||||
></UiModal>
|
||||
<Toaster position="top-center" />
|
||||
|
||||
+4
-2
@@ -15,10 +15,12 @@ export type TableUpperProps = {
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
edit?:boolean;
|
||||
visible?:boolean;
|
||||
visible?:boolean;
|
||||
rowSpan?: number;
|
||||
colSpan?: number;
|
||||
type?: string;
|
||||
selectData ?:string; // type 이 seelct 일경우 selectarray 정하기 위해
|
||||
row?:number;
|
||||
mergeCell?:boolean // 셀을 합칠경우
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import type { CommonTableProps } from "../../common/type/headder";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
|
||||
export const sttnHeadListType = z.array(
|
||||
z.object({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { z } from "zod";
|
||||
import type { sttnHeadListType } from "../coSttn/headList";
|
||||
import { coRvwHeadListExport, coRvwNodeListExport } from "./headList";
|
||||
import type { CommonTableProps } from "../../common/type/headder";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
|
||||
const coRvwHeadList = coRvwHeadListExport;
|
||||
const coRvwNodeList = coRvwNodeListExport;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { z } from "zod";
|
||||
|
||||
export const sttnHeadListType = z.array(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { z } from "zod";
|
||||
import { coSttHeadListExport, coSttNodeListExport } from "./headList";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { coSttHeadListExport, coSttNodeListExport } from "../coSttn/headList";
|
||||
import type { customCoSttnBdst } from "../coSttn";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import type { CommonTableProps } from "../../common/type/headder";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
|
||||
export const sttnHeadListType = z.array(
|
||||
z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { z } from "zod";
|
||||
import type { sttnHeadListType } from "../coSttn/headList";
|
||||
import type { CommonTableProps } from "../../common/type/headder";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import { ruseHstryHeadListExport, ruseHstryNodeListExport } from "./headList";
|
||||
|
||||
const ruseHstryHeadList = ruseHstryHeadListExport;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { z } from "zod";
|
||||
|
||||
export const chkgdRegExcel = z.object({
|
||||
@@ -123,16 +123,16 @@ export const rainHeadNmExport: chHeadType[] = [
|
||||
];
|
||||
|
||||
export const rainChkgdnHeadListExport: TableUpperProps[] = [
|
||||
{ id: "order", title: "순번", rowSpan: true },
|
||||
{ id: "checkBox", title: "선택", rowSpan: true },
|
||||
{ id: "cityText", title: "시도", rowSpan: true },
|
||||
{ id: "sggText", title: "시군구", rowSpan: true },
|
||||
{ id: "bdstNm", title: "시설명", rowSpan: true },
|
||||
{ id: "operMngCd", title: "운영관리형태", rowSpan: true },
|
||||
{ id: "oilqMeasMthd", title: "유량측정방법", rowSpan: true },
|
||||
{ id: "anlOperCst", title: "연간운영비(원/년)", rowSpan: true },
|
||||
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", rowSpan: true },
|
||||
{ id: "chckYmd", title: "점검일", rowSpan: true },
|
||||
{ id: "order", title: "순번", mergeCell: true },
|
||||
{ id: "checkBox", title: "선택", mergeCell: true },
|
||||
{ id: "cityText", title: "시도", mergeCell: true },
|
||||
{ id: "sggText", title: "시군구", mergeCell: true },
|
||||
{ id: "bdstNm", title: "시설명", mergeCell: true },
|
||||
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
|
||||
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
|
||||
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
|
||||
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
|
||||
{ id: "chckYmd", title: "점검일", mergeCell: true },
|
||||
{ id: "utztnUsgCd", title: "이용용도" },
|
||||
{ id: "totalSplyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
|
||||
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { buildingType } from "@/app/store/common/code";
|
||||
import {
|
||||
TEST_UUID,
|
||||
type TableUpperProps,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
deleteFectch,
|
||||
@@ -22,6 +21,7 @@ import {
|
||||
splHeadListExport,
|
||||
type chHeadType,
|
||||
} from "./headList";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export type rainChkZodType = z.infer<typeof rainChkZod>;
|
||||
const fcltDiv = [
|
||||
@@ -217,7 +217,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
try {
|
||||
const res = await deleteFectch(`/reuseChk/rainy`, chkgdnPks);
|
||||
|
||||
if (res.ok) {
|
||||
if (res) {
|
||||
ToastFormUi({
|
||||
body: "삭제가 완료되었습니다. ",
|
||||
title: "지도점검 삭제",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { z } from "zod";
|
||||
import { guideDetail, type chHeadType } from "../rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export type polutionType = {
|
||||
chkgdnDtlFk: number;
|
||||
@@ -115,16 +115,16 @@ export const rswtHeadNmExport: chHeadType[] = [
|
||||
];
|
||||
|
||||
export const rswtChkHeadListExport: TableUpperProps[] = [
|
||||
{ id: "order", title: "순번", rowSpan: true },
|
||||
{ id: "checkBox", 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: "checkBox", 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"},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type { z } from "zod";
|
||||
import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
|
||||
import type { PrfSchema } from "./type";
|
||||
|
||||
|
||||
const nameMap = {
|
||||
@@ -22,7 +20,7 @@ import type { PrfSchema } from "./type";
|
||||
};
|
||||
|
||||
|
||||
export const excelToPbnPrfData = (excelData: any[], year: string,pbnstRuseFcltFk:string) => {
|
||||
export const excelToPbnPrfData = (excelData: JSON[], year: string,pbnstRuseFcltFk:string) => {
|
||||
// 월별 데이터 하나로 병합
|
||||
const merged = {} as any;
|
||||
excelData.forEach((item: any) => {
|
||||
@@ -34,7 +32,6 @@ export const excelToPbnPrfData = (excelData: any[], year: string,pbnstRuseFcltFk
|
||||
const ym = year + month;
|
||||
|
||||
|
||||
console.log('pbnstRuseFcltFk ', pbnstRuseFcltFk)
|
||||
if (!merged[ym]) merged[ym] = { ym };
|
||||
merged[ym][key] = Number(item[`${i}월`] ?? 0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import type { TableUpperProps } from "../../ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "../../common/type/header";
|
||||
|
||||
export const pbnPrfRegExcelZod = z.object({
|
||||
ym: z.string().default(""),
|
||||
@@ -18,18 +18,21 @@ export const pbnstPrfmncHeadListExport: TableUpperProps[] = [
|
||||
];
|
||||
|
||||
export const monthHeadListExport: TableUpperProps[] = [
|
||||
{ id: "gubun", title: "구분" },
|
||||
{ id: "용수명", title: "용수명" },
|
||||
{ id: "total", title: "계" },
|
||||
{ id: "ym01", title: "1월" },
|
||||
{ id: "ym02", title: "2월" },
|
||||
{ id: "ym03", title: "3월" },
|
||||
{ id: "ym04", title: "4월" },
|
||||
{ id: "ym05", title: "5월" },
|
||||
{ id: "ym06", title: "6월" },
|
||||
{ id: "ym07", title: "7월" },
|
||||
{ id: "ym08", title: "8월" },
|
||||
{ id: "ym09", title: "9월" },
|
||||
{ id: "ym10", title: "10월" },
|
||||
{ id: "ym11", title: "11월" },
|
||||
{ id: "ym12", title: "12월" },
|
||||
{ id: "1월", title: "1월" ,edit: true },
|
||||
{ id: "2월", title: "2월" ,edit: true },
|
||||
{ id: "3월", title: "3월" ,edit: true },
|
||||
{ id: "4월", title: "4월" ,edit: true },
|
||||
{ id: "5월", title: "5월" ,edit: true },
|
||||
{ id: "6월", title: "6월" ,edit: true },
|
||||
{ id: "7월", title: "7월" ,edit: true },
|
||||
{ id: "8월", title: "8월" ,edit: true },
|
||||
{ id: "9월", title: "9월" ,edit: true },
|
||||
{ id: "10월", title: "10월" ,edit: true },
|
||||
{ id: "11월", title: "11월" ,edit: true },
|
||||
{ id: "12월", title: "12월" ,edit: true },
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
|
||||
import type { TableUpperProps } from "../../ruseFcltMng/fcltReg/rainReg";
|
||||
import { pbnstPrfmncHeadListExport, monthHeadListExport } from "./headList";
|
||||
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { FcPrfType, PrfType } from "./type";
|
||||
import type { TableUpperProps } from "../../common/type/header";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
|
||||
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
|
||||
const monthHeadList = monthHeadListExport;
|
||||
@@ -56,6 +57,7 @@ const hasuListFetch = async (page: string, sggOrCity: string) => {
|
||||
bscFctNm: findData?.bscFctNm,
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltPk: item.pbnstRuseFcltPk,
|
||||
prfList : item.prfList
|
||||
};
|
||||
});
|
||||
return data;
|
||||
@@ -80,7 +82,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
prfmnRegData: async (data:PrfType) => {
|
||||
prfmnRegData: async (data:PrfType,) => {
|
||||
try{
|
||||
|
||||
const ressponse = await postFectch(
|
||||
@@ -88,8 +90,23 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
data,
|
||||
fetchType.WR
|
||||
);
|
||||
|
||||
console.log('ressponse ', ressponse)
|
||||
|
||||
if(ressponse.status === 200){
|
||||
ToastFormUi({
|
||||
body: "하수재이용 시설 실적 등록이 완료되었습니다. ",
|
||||
title: "하수재이용 시설 실적 등록",
|
||||
});
|
||||
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
ToastFormUi({
|
||||
body: "하수재이용 시설 실적 등록이 실패하였습니다. ",
|
||||
title: "하수재이용 시설 실적 등록",
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,47 +1,344 @@
|
||||
import { z } from "zod";
|
||||
import type { TableUpperProps } from "../../common/type/headder";
|
||||
|
||||
|
||||
import type { TableUpperProps } from "../../common/type/header";
|
||||
|
||||
export const PrfSchema = z.object({
|
||||
pbnstRuseFcltFk: z.string(),
|
||||
ym: z.string(), // 예: "202310"
|
||||
wshwtr: z.number(),
|
||||
coolUswtr: z.number(),
|
||||
cleanUswtr: z.number(),
|
||||
drwtUswtr: z.number(),
|
||||
dltnUswtr: z.number(),
|
||||
ithlRswtr: z.number(),
|
||||
ithlEtcUswtr: z.number(),
|
||||
cleanToilUswtr: z.number(),
|
||||
resn: z.number(),
|
||||
lndwtr: z.number(),
|
||||
hydUswtr: z.number(),
|
||||
rvrKeepUswtr: z.number(),
|
||||
farmUswtr: z.number(),
|
||||
ugwtChr: z.number(),
|
||||
indstUswtr: z.number(),
|
||||
regDt: z.date().default(new Date()),
|
||||
rgtr: z.string(),
|
||||
mdfcnDt: z.date().default(new Date()),
|
||||
mdfr: z.string()
|
||||
});
|
||||
|
||||
export const FcPrfSchema = z.object({
|
||||
pbnstRuseFcltPk: z.string(),
|
||||
ruseUtztnFcltNm: z.string(),
|
||||
fcltCpct: z.number(),
|
||||
ruseCpct: z.number(),
|
||||
splyExtraCpct: z.number(),
|
||||
regDt:z.date().default(new Date()),
|
||||
rgtr: z.string(),
|
||||
mdfcnDt: z.date().default(new Date()),
|
||||
mdfr: z.string(),
|
||||
prfList: z.array(PrfSchema),
|
||||
bscFctNm:z.string().nullish()
|
||||
});
|
||||
pbnstRuseFcltFk: z.string(),
|
||||
ym: z.string(), // 예: "202310"
|
||||
wshwtr: z.number(),
|
||||
coolUswtr: z.number(),
|
||||
cleanUswtr: z.number(),
|
||||
drwtUswtr: z.number(),
|
||||
dltnUswtr: z.number(),
|
||||
ithlRswtr: z.number(),
|
||||
ithlEtcUswtr: z.number(),
|
||||
cleanToilUswtr: z.number(),
|
||||
resn: z.number(),
|
||||
lndwtr: z.number(),
|
||||
hydUswtr: z.number(),
|
||||
rvrKeepUswtr: z.number(),
|
||||
farmUswtr: z.number(),
|
||||
ugwtChr: z.number(),
|
||||
indstUswtr: z.number(),
|
||||
regDt: z.date().default(new Date()).nullish(),
|
||||
rgtr: z.string().nullish(),
|
||||
mdfcnDt: z.date().default(new Date()).nullish(),
|
||||
mdfr: z.string().nullish(),
|
||||
});
|
||||
|
||||
export const FcPrfSchema = z.object({
|
||||
pbnstRuseFcltPk: z.string(),
|
||||
ruseUtztnFcltNm: z.string(),
|
||||
fcltCpct: z.number(),
|
||||
ruseCpct: z.number(),
|
||||
splyExtraCpct: z.number(),
|
||||
regDt: z.date().default(new Date()),
|
||||
rgtr: z.string(),
|
||||
mdfcnDt: z.date().default(new Date()),
|
||||
mdfr: z.string(),
|
||||
prfList: z.array(PrfSchema),
|
||||
bscFctNm: z.string().nullish(),
|
||||
});
|
||||
|
||||
export type FcPrfType = z.infer<typeof FcPrfSchema>
|
||||
export type PrfType = z.infer<typeof PrfSchema>
|
||||
|
||||
export type FcPrfType = z.infer<typeof FcPrfSchema>;
|
||||
export type PrfType = z.infer<typeof PrfSchema>;
|
||||
|
||||
export const initValInUsage = [
|
||||
{
|
||||
usage: "wshwtr",
|
||||
용수명: "세척수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "coolUswtr",
|
||||
용수명: "냉각수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "cleanUswtr",
|
||||
용수명: "청소수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "drwtUswtr",
|
||||
용수명: "식수대",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "dltnUswtr",
|
||||
용수명: "희석용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "ithlRswtr",
|
||||
용수명: "중수도",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "ithlEtcUswtr",
|
||||
용수명: "기타",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "resn",
|
||||
용수명: "세척살수용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "cleanToilUswtr",
|
||||
용수명: "청소화장실용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
];
|
||||
|
||||
export const initValOutUsage = [
|
||||
{
|
||||
usage: "lndwtr",
|
||||
용수명: "조경용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "hydUswtr",
|
||||
용수명: "친수용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "ugwtChr",
|
||||
용수명: "지하수충전",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
{
|
||||
usage: "farmUswtr",
|
||||
용수명: "농업용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
|
||||
{
|
||||
usage: "rvrKeepUswtr",
|
||||
용수명: "하천등유지용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
|
||||
{
|
||||
usage: "indstUswtr",
|
||||
용수명: "공업용수",
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
];
|
||||
|
||||
export const subTotalObj = {
|
||||
usage: "subtotal",
|
||||
용수명: "소계",
|
||||
edit: false,
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
};
|
||||
|
||||
export const totalObj = {
|
||||
usage: "total",
|
||||
용수명: "총합계",
|
||||
edit: false,
|
||||
total: 0,
|
||||
"1월": 0,
|
||||
"2월": 0,
|
||||
"3월": 0,
|
||||
"4월": 0,
|
||||
"5월": 0,
|
||||
"6월": 0,
|
||||
"7월": 0,
|
||||
"8월": 0,
|
||||
"9월": 0,
|
||||
"10월": 0,
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const rainChkgdnHeadSttnExport: 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: "oilqMeasMthd", title: "유량측정방법", rowSpan: true },
|
||||
{ id: "anlOperCst", title: "연간운영비(원/년)", rowSpan: true },
|
||||
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", 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: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
|
||||
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
|
||||
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
|
||||
{ id: "chckYmd", title: "점검일", mergeCell: true },
|
||||
{ id: "utztnUsgCd", title: "이용용도" },
|
||||
{ id: "totalSplyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
|
||||
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const rswtChkSttnHeadListExport: TableUpperProps[] = [
|
||||
{ id: "order", title: "순번", rowSpan: true },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { rswtHeadNmExport } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
|
||||
import { rswtChkSttnHeadListExport, rswtDetailSttnHeadListExport } from "./headList";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type { sheetParameter } from "@common/business_components/ui";
|
||||
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import type { TableUpperProps } from "../../common/type/headder";
|
||||
import type { TableUpperProps } from "../../common/type/header";
|
||||
import { pbnstPrfmncSttnHeadListExport, pbnstYearHeadListExport } from "./headList";
|
||||
|
||||
type pbnstPrfmncSttnActions = {
|
||||
|
||||
@@ -2,13 +2,9 @@ import { getFetch } from "@/components/lib/api";
|
||||
import { TEST_UUID, type customRainBdst } from "../rainReg";
|
||||
import type { customHtdflBdst } from "../htdflReg";
|
||||
import type { customRswtBdst } from "../rswtReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
|
||||
type TableUpperProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
};
|
||||
const moUpHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
@@ -16,9 +12,6 @@ type TableUpperProps = {
|
||||
{ id: "daddr", title: "위치" },
|
||||
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
|
||||
{ id: "archArea", title: "건축면적", },
|
||||
// { id: "archChgYn", title: "여부", upName: "upChangeRe", upSequnce: 1 },
|
||||
// { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 },
|
||||
// { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { upHeadList, type chgBuilding, type TableUpperProps } from "../rainReg";
|
||||
import { upHeadList, type chgBuilding} from "../rainReg";
|
||||
|
||||
import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const hdtflZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "../rainReg";
|
||||
|
||||
export const pubFacHeadListExport: TableUpperProps[] = [
|
||||
{ id: "sido", title: "시도" },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
|
||||
export const rainZod = z.object({
|
||||
@@ -82,19 +82,7 @@ export type chgBuilding={
|
||||
mdfr?:string|null;
|
||||
}
|
||||
export type customRainBdst = z.infer<typeof rainZod>
|
||||
export type TableUpperProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
edit?:boolean;
|
||||
visible?:boolean;
|
||||
rowSpan?: number;
|
||||
type?: string;
|
||||
selectData ?:string;
|
||||
colSpan?:number;
|
||||
row?:number;
|
||||
};
|
||||
|
||||
|
||||
export const upHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { upHeadList, type chgBuilding, type TableUpperProps } from "../rainReg";
|
||||
import { upHeadList, type chgBuilding } from "../rainReg";
|
||||
|
||||
import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const rswtZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { z } from "zod";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const htdflSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
{
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { htdflSttHeadListExport, htdflSttNodeListExport } from "./headList";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { z } from "zod";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { excelHtdflSttnParsing } from "./excel";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
|
||||
const htdflSttHeadList = htdflSttHeadListExport;
|
||||
const htdflSttNodeList = htdflSttNodeListExport;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { z } from "zod";
|
||||
|
||||
export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import type { z } from "zod";
|
||||
import {
|
||||
pbnSttHeadListExport,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { z } from "zod";
|
||||
|
||||
export const sttnHeadListType = z.array(
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
rainSttnDetailNodeListExport,
|
||||
} from "./headList";
|
||||
import type { z } from "zod";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
|
||||
// 테이블 헤드 리스트
|
||||
const rainSttHeadList = rainSttHeadListExport;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { z } from "zod";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
|
||||
export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { z } from "zod";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { Checkbox, Input, TableCell, TableRow } from "@common/components/ui";
|
||||
|
||||
export const rainChkTableData = (chkData: rainChkZodType[]) => {
|
||||
@@ -101,7 +101,7 @@ export const chRowspanTable = (
|
||||
.map((head) => {
|
||||
|
||||
const key = head.id;
|
||||
const isMerged = head.rowSpan;
|
||||
const isMerged = head.mergeCell;
|
||||
const value = row[key];
|
||||
// 병합 대상이면 중복 렌더링 여부 판단
|
||||
if (isMerged) {
|
||||
@@ -184,4 +184,65 @@ export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean)
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const handleChange = (
|
||||
rowIndex: number,
|
||||
field: any,
|
||||
value: string | number,
|
||||
setInputData: (data:any) => void
|
||||
) => {
|
||||
if(Number(value) < 0 ||! Number(value)){
|
||||
value = 0;
|
||||
}else{
|
||||
value = Number(value);
|
||||
}
|
||||
setInputData((prevData:any) =>
|
||||
prevData?.map((row:any, index: number) => {
|
||||
if (index === rowIndex) {
|
||||
return {
|
||||
...row,
|
||||
[field ]: value,
|
||||
};
|
||||
}
|
||||
return row;
|
||||
})
|
||||
);
|
||||
};
|
||||
;
|
||||
|
||||
|
||||
|
||||
export const InputTableBody = (chgRes: any[] | [] ,headList:TableUpperProps[], setInputData: (data: any[]) => void) => {
|
||||
return (
|
||||
<>
|
||||
{chgRes.map((data, dataIndex) => (
|
||||
<TableRow key={dataIndex + "row"}>
|
||||
{headList.map((head, headIndex) => (
|
||||
<TableCell key={head.id + headIndex} className="w-36" >
|
||||
{head.edit ===true && data.edit !==false?
|
||||
<Input
|
||||
className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`}
|
||||
onChange={(e) =>
|
||||
handleChange(dataIndex, head.id, e.target.value,setInputData)
|
||||
}
|
||||
value={data[head.id as keyof any] ?? ""}
|
||||
/> : (
|
||||
<div
|
||||
className={`
|
||||
${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
|
||||
!text-xl w-full h-10
|
||||
`}
|
||||
>
|
||||
{data[head.id as keyof any] ?? ""}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgd
|
||||
import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
|
||||
import type { z } from "zod";
|
||||
import React from "react";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
const {
|
||||
|
||||
@@ -32,9 +32,10 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
|
||||
},
|
||||
});
|
||||
const onSubmit = (values: z.infer<typeof pbnPrfRegExcelZod>) => {
|
||||
console.log(values);
|
||||
|
||||
prfmnRegData(excelData )
|
||||
if (excelData) {
|
||||
prfmnRegData(excelData as unknown as PrfType);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
@@ -64,7 +65,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
|
||||
if (file)
|
||||
filePicked(file, 0).then((res) => {
|
||||
if (res !== undefined)
|
||||
setExcelData(excelToPbnPrfData(res as any, form.getValues("ym"),form.getValues('pbnstRuseFcltFk') ))
|
||||
setExcelData(excelToPbnPrfData(res as unknown as JSON[], form.getValues("ym"),form.getValues('pbnstRuseFcltFk') ) as PrfType[])
|
||||
});
|
||||
}
|
||||
}, [files]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { pubHasuType, fcBizType, fcOrgwtType,} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable";
|
||||
import { Title, UiTable } from "@common/business_components/ui";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { Title } from "@common/business_components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { useEffect, useState } from "react";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { rainChkTableData, rswtChkTableData } from "@/components/lib/func/TableData";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
"use client";
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type {
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import {
|
||||
Input,
|
||||
Table,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useState, type Dispatch, type SetStateAction } from "react";
|
||||
|
||||
export function GuideDetailsTable({
|
||||
chgRes,
|
||||
@@ -26,80 +27,26 @@ export function GuideDetailsTable({
|
||||
setChGuidData: (chgRes: any[]) => void;
|
||||
}) {
|
||||
const { code, rainChkgdn } = useWrStore((state) => state);
|
||||
const [guidData, setGuidData] = useState<any[]>();
|
||||
const [inputData, setInputData] = useState<any[]>();
|
||||
|
||||
|
||||
const handleChange = (
|
||||
rowIndex: number,
|
||||
field: any,
|
||||
value: string | number
|
||||
) => {
|
||||
if(Number(value) < 0 ||! Number(value)){
|
||||
value = 0;
|
||||
}else{
|
||||
value = Number(value);
|
||||
}
|
||||
setGuidData((prevData) =>
|
||||
prevData?.map((row, index) => {
|
||||
if (index === rowIndex) {
|
||||
return {
|
||||
...row,
|
||||
[field as any]: value,
|
||||
};
|
||||
}
|
||||
return row;
|
||||
})
|
||||
);
|
||||
};
|
||||
const tableBody = (chgRes: any[] | []) => {
|
||||
return (
|
||||
<>
|
||||
{chgRes.map((data, dataIndex) => (
|
||||
<TableRow key={dataIndex + "row"}>
|
||||
{headList.map((head, headIndex) => (
|
||||
<TableCell key={head.id + headIndex} className="w-36" >
|
||||
{head.edit ===true && data.edit !==false?
|
||||
<Input
|
||||
className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`}
|
||||
onChange={(e) =>
|
||||
handleChange(dataIndex, head.id, e.target.value)
|
||||
}
|
||||
value={data[head.id as keyof any] ?? ""}
|
||||
/> : (
|
||||
<div
|
||||
className={`
|
||||
${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
|
||||
!text-xl w-full h-10
|
||||
`}
|
||||
>
|
||||
{data[head.id as keyof any] ?? ""}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
useEffect(() => {
|
||||
setGuidData(chgRes);
|
||||
setInputData(chgRes);
|
||||
}, [chgRes]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setChGuidData(guidData??[] );
|
||||
setChGuidData(inputData??[] );
|
||||
|
||||
}, [guidData]);
|
||||
}, [inputData]);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`card !m-[1.2rem] !p-0r `}>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">{headMakeprfmnc(headList, rainChkgdn?.rainHeadNm)}</TableHeader>
|
||||
<TableBody >
|
||||
{tableBody(guidData ?? [])}
|
||||
{InputTableBody(inputData ?? [],headList, setInputData) }
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import {
|
||||
chRowspanTable,
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
rswtChkZodType,
|
||||
rswtrChkDetailsZodType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import {
|
||||
chRowspanTable,
|
||||
|
||||
Reference in New Issue
Block a user