jyha product

This commit is contained in:
truthwing
2025-07-04 15:40:13 +09:00
parent df55c3fe12
commit cec35e6724
8 changed files with 439 additions and 178 deletions
@@ -1,14 +1,12 @@
import { useWrStore } from "@/app/store";
import { ScrollArea, Title } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { useEffect, useState } from "react";
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable";
import { ScrollArea, Title } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import React, { useEffect, useState } from "react";
import type { z } from "zod";
import React from "react";
import type { TableUpperProps } from "@/app/store/common/type/header";
export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
const {
@@ -114,7 +112,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
});
}
console.log("result ", result);
setGuidData(result as splRuseWaterType[]);
if (obj.rswtrPollutions) {
@@ -217,12 +214,14 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
obj.guideDetails = realGuideDetail;
if (type === "RNB") {
rainChkGuidUpdate(obj);
setIsModal(false)
} else {
const polution = Object.values(upPolutionData)
.flat()
.filter((item) => item.utztnUsgCd !== "평균");
obj.rswtrPollutions = polution;
rwstPolAndGuideUpdate([obj]);
setIsModal(false)
}
};
@@ -248,7 +247,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
</div>
<div className="flex justify-between">
<h3 className="text-2xl font-bold text-gray-900 mt-2 ml-6">
{`(${obj.bdstNm})`}
{type === "RNB"
? `(${obj.bdstNm})` : `(${obj.building.bdstNm})`}
</h3>
{!rainChkSttn.isSttn ? (
<Button className="" onClick={allDataUpdate}>
@@ -262,12 +262,13 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
<ScrollArea className="h-[60vh]">
<div className="card-header">
<h3 className="text-2xl font-medium text-label">
{`연간보급수이용량`}
{`연간대체수이용량`}
</h3>
</div>
<GuideDetailsTable
chgRes={guidData || []}
headList={headList.ruseHeadList}
headList={headList.splHeadList}
upheadList={type === "RNB" ? rainChkgdn.rainSplHeadNm : rswtChkgdn.rswtSplHeadNm}
type={""}
setChGuidData={(data) => {
setChGuidData(data);
@@ -280,7 +281,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
</div>
<GuideDetailsTable
chgRes={guidData || []}
headList={headList.splHeadList}
headList={headList.ruseHeadList}
upheadList={type === "RNB" ? rainChkgdn.rainRuseHeadNm : rswtChkgdn.rswtRuseHeadNm}
type={""}
setChGuidData={(data) => {
setChGuidData(data);
@@ -302,6 +304,7 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
<GuideDetailsTable
chgRes={value}
headList={headList?.rswtDetailHeadList}
upheadList={rswtChkgdn.rswtSplHeadNm}
type={""}
setChGuidData={(data) => {
getPolutionData(data);
@@ -1,22 +1,22 @@
"use client";
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/common/type/header";
import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import { tableData } from "@/components/lib/func/commom";
import {
chRowspanTable,
headVisibleChange,
rainChkTableData
} from "@/components/lib/func/TableData";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
import {
Table,
TableBody,
TableHeader,
} from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
export default function RainChkgdTable({
detailUp,
handleClick = () => { },
@@ -24,6 +24,7 @@ export default function RainChkgdTable({
rainChkData,
pageNation,
onPageChange,
pageCount,
}: {
detailUp: (data: rainChkZodType[]) => void;
handleClick?: (data: any) => void;
@@ -31,6 +32,7 @@ export default function RainChkgdTable({
rainChkData?: rainChkZodType[];
pageNation: number;
onPageChange: (page: number) => void;
pageCount: number;
}) {
const { code, rainChkgdn, rainChkSttn, getRainSttnExcel } = useWrStore((state) => state);
const [makeTableData, setMakeTableData] = useState<any[]>([]);
@@ -70,16 +72,12 @@ export default function RainChkgdTable({
}, [makeTableData, handleClick]);
useEffect(() =>{
},[rainChkgdn.rainChk])
useEffect(() => {
setSelectedIds([])// 셀렉트 초기화를 위한 작업
if (rainChkData) {
if (rainChkData && rainChkData.length > 0) {
const rainChg = rainChkData.map((item: any) => {
const rainChg = rainChkData?.map((item: any) => {
const bud = tableData([item.building], { code });
return {
...item,
@@ -89,6 +87,8 @@ export default function RainChkgdTable({
});
setMakeTableData(rainChkTableData(rainChg));
} else {
setMakeTableData([]);
}
}, [rainChkData, code]);
@@ -167,16 +167,15 @@ export default function RainChkgdTable({
} else {
setHeadList({
headList: rainChkgdn.rainChkgdnHeadList,
upHeadList: rainChkgdn.rainHeadNm
upHeadList: rainChkgdn.rainMainHeadNm
})
}
}, [rainChkSttn.isSttn, rainChkgdn.rainChkgdnHeadList, rainChkSttn.rainChkgdnHeadList]);
return (
<>
<LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay>
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(
@@ -197,9 +196,9 @@ export default function RainChkgdTable({
</TableBody>
</Table>
<UiPageNations
total={rainChkData?.length ?? 0}
total={pageCount}
cur={pageNation}
pageSize={20}
pageSize={rainPageSize}
onPageChange={onPageChange}
/>
</>
@@ -1,20 +1,22 @@
"use client";
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
import { useWrStore } from "@/app/store";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type {
rswtChkZodType,
rswtrChkDetailsZodType,
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import {
rswtPageSize,
type rswtChkZodType,
type rswtrChkDetailsZodType,
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
import { tableData } from "@/components/lib/func/commom";
import {
chRowspanTable,
rswtChkTableData,
} from "@/components/lib/func/TableData";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
import { Table, TableBody, TableHeader } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
export default function RswtChkgdTable({
detaiRswtlUpdate,
@@ -23,6 +25,7 @@ export default function RswtChkgdTable({
rswtChkData,
pageNation,
onPageChange,
pageCount,
}: {
detaiRswtlUpdate: (data: rswtrChkDetailsZodType[]) => void;
handleRswtClick?: (data: any) => void;
@@ -30,6 +33,7 @@ export default function RswtChkgdTable({
rswtChkData: rswtChkZodType[];
pageNation: number;
onPageChange: (page: number) => void;
pageCount: number;
}) {
const { code, rswtChkgdn, rswtChkSttn, rswtChkgdnInit, rswtChkPolAndGuide, getRswtSttnExcel } = useWrStore(
(state) => state
@@ -133,6 +137,7 @@ export default function RswtChkgdTable({
return (
<>
<LoadingOverlay isLoading={rswtChkgdn.isLoading}></LoadingOverlay>
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(headList?.headList, headList?.upHeadList)}
@@ -150,9 +155,9 @@ export default function RswtChkgdTable({
</TableBody>
</Table>
<UiPageNations
total={rswtChkData?.length ?? 0}
total={pageCount}
cur={pageNation}
pageSize={20}
pageSize={rswtPageSize}
onPageChange={onPageChange}
/>
</>