하수재이용 추가, 삭제 버튼 기능 추가

This commit is contained in:
jyha00
2025-05-27 16:30:42 +09:00
parent 299129a1f1
commit 7ed55d59d9
7 changed files with 132 additions and 57 deletions
@@ -1,9 +1,9 @@
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { customPbnst, fcltOperInfoType, fcOrgwtType, operType, ppInstlType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { selectClass, type TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { DatePicker, SelectBox, type SelectDataType } from "@common/business_components/ui";
import {
Checkbox,
Input,
Table,
TableBody,
@@ -12,7 +12,6 @@ import {
TableHeader,
TableRow,
} from "@common/components/ui";
import moment from "moment";
import React, { useEffect, useState } from "react";
type RuseMngTableProps = {
@@ -31,6 +30,7 @@ const RuseMngTable = React.forwardRef<any[], RuseMngTableProps>(
}, ref) => {
const [tableState, setTableState] = useState([...tableData]);
useEffect(() => {
console.log("tableState", tableState);
if (ref && typeof ref === "object" && "current" in ref) {
ref.current = tableState;
}
@@ -71,11 +71,11 @@ const RuseMngTable = React.forwardRef<any[], RuseMngTableProps>(
type={head.type}
onChange={(txt) => {
setTableState(prev => {
const next = [...prev];
next[i] = { ...next[i], [head.id]: txt.target.value };
return next;
})
}}
const next = [...prev];
next[i] = { ...next[i], [head.id]: txt.target.value };
return next;
})
}}
value={tableState[i][head.id] || ""}
/>
) : head.type === "select" ? (
@@ -83,7 +83,7 @@ const RuseMngTable = React.forwardRef<any[], RuseMngTableProps>(
label=""
selectArray={code.find(item => item.name === head.selectData)?.val ?? []}
value={
item[head.id]
tableState[i][head.id] || ""
}
className={""}
selectClass={selectClass}
@@ -99,18 +99,31 @@ const RuseMngTable = React.forwardRef<any[], RuseMngTableProps>(
mode="single"
field={{
value:
tableState[i][head.id], // Provide a default Date value
tableState[i][head.id], // Provide a default Date value
onChange: (date) => {
setTableState(prev => {
const next = [...prev];
next[i] = { ...next[i], [head.id]: date };
return next;
})
}
}
}
}
selectClass={"w-full"}
/>
) : head.type === "checkbox" ? (
<Checkbox
className=""
checked={!!tableState[i][head.id]}
onCheckedChange={(checked) => {
console.log("checked", checked);
setTableState((prev) => {
prev[i][head.id] = checked
return [...prev]
})
}}
>
</Checkbox>
) : (
`${item[head.id] || ""}`
)}