Merge commit '5a681420465af0ffe153b9fce121484947c53b9c' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run
iipbs_wr / build (push) Waiting to run
This commit is contained in:
@@ -111,9 +111,9 @@ export function PbnstBuseForm({
|
||||
const fcOrgwts = form.watch(`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("fcOrgwts ", fcOrgwts);
|
||||
console.log("fcOrgwts", fcOrgwts);
|
||||
if (fcOrgwts && fcOrgwts?.length > 0) {
|
||||
const swtrmtFcltFkList = fcOrgwts.map((item) => item.swtrmtFcltFk);
|
||||
const swtrmtFcltFkList = fcOrgwts?.map((item) => item.swtrmtFcltFk);
|
||||
|
||||
console.log("swtrmtFcltFkList ", swtrmtFcltFkList);
|
||||
|
||||
@@ -128,8 +128,6 @@ export function PbnstBuseForm({
|
||||
|
||||
useEffect(() => {
|
||||
if (fcOrgwtsNmList && fcOrgwtsNmList.length > 0) {
|
||||
console.log("fcOrgwtsNmList ", fcOrgwtsNmList);
|
||||
console.log("fcOrgwts ", fcOrgwts);
|
||||
|
||||
fcOrgwts?.forEach((item, index) => {
|
||||
const orgwtNm = fcOrgwtsNmList.find(
|
||||
@@ -421,6 +419,7 @@ export function PbnstBuseForm({
|
||||
</div>
|
||||
<RuseMngTable
|
||||
key={`fcOrgwts-${indexMng}-${indexBiz}`} // 이게 핵심!
|
||||
|
||||
tableData={
|
||||
form.getValues(
|
||||
`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`
|
||||
@@ -724,6 +723,9 @@ export function PbnstBuseForm({
|
||||
bodyClass={"w-[70vw] max-w-none max-h-[90vh] overflow-y-auto"}
|
||||
body={
|
||||
<FcOrgwtsRegModal
|
||||
initTableData={form.getValues(
|
||||
`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`
|
||||
) ?? []}
|
||||
closeModal={() => {
|
||||
setIsFcOrgwts(false);
|
||||
}}
|
||||
|
||||
@@ -7,11 +7,9 @@ import {
|
||||
excelToRswtGuideData,
|
||||
excelToRswtPolution,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import {
|
||||
filePicked,
|
||||
filePickedArray,
|
||||
FileUpload,
|
||||
Form,
|
||||
FormField,
|
||||
FormUi,
|
||||
@@ -26,7 +24,7 @@ import { useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdExcel({ type }: { type: string }) {
|
||||
export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setIsRegExcel:(open:boolean) =>void }) {
|
||||
const { rswtChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload } =
|
||||
useWrStore((state) => {
|
||||
return state;
|
||||
@@ -146,29 +144,28 @@ export default function ChkgdExcel({ type }: { type: string }) {
|
||||
|
||||
const onSubmit = (values: z.infer<typeof chkgdRegExcel>) => {
|
||||
if (values.chckYr === "") {
|
||||
ToastFormUi({ body: "등록년도를 작성해주세요", title: "지도점검 등록" });
|
||||
toast.error("등록년도를 작성해주세요");
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === "RNB") {
|
||||
if (excelData === undefined || excelData?.length === 0) {
|
||||
ToastFormUi({
|
||||
body: "빈 파일 및 파일 오류 입니다.",
|
||||
title: "지도점검 등록",
|
||||
});
|
||||
toast.error("빈 파일 및 파일 오류 입니다.");
|
||||
|
||||
return;
|
||||
} else {
|
||||
rainChkExcelDataUPload(excelData as rainChkZodType[]);
|
||||
setIsRegExcel(false)
|
||||
}
|
||||
} else if (type === "RST") {
|
||||
if (excelRswtData === undefined || excelRswtData?.length === 0) {
|
||||
ToastFormUi({
|
||||
body: "빈 파일 및 파일 오류 입니다.",
|
||||
title: "중수지도점검 등록",
|
||||
});
|
||||
toast.error("빈 파일 및 파일 오류 입니다.");
|
||||
|
||||
return;
|
||||
} else {
|
||||
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]);
|
||||
setIsRegExcel(false)
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@common/components/ui";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
export default function ChkgdModal({ type, obj, setIsModal }: { type: string; obj: any, setIsModal: (open: boolean) => void }) {
|
||||
const {
|
||||
rainChkgdn,
|
||||
rswtChkgdn,
|
||||
|
||||
@@ -14,13 +14,16 @@ import { Button } from "@common/business_components/ui/table/lib/button";
|
||||
import { Input } from "@common/components/ui";
|
||||
import { ArrowLeft, ArrowRight } from "lucide-react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default function FcOrgwtsRegModal({
|
||||
onRightSet,
|
||||
closeModal,
|
||||
initTableData,
|
||||
}: {
|
||||
onRightSet?: (rightData: fcOrgwtType[]) => void;
|
||||
closeModal?: (val: boolean) => void;
|
||||
initTableData?: any[];
|
||||
}) {
|
||||
const { code, pbnst, getSwtrmtFcltNm, searchFclts } = useWrStore(
|
||||
(state) => state
|
||||
@@ -31,6 +34,30 @@ export default function FcOrgwtsRegModal({
|
||||
const leftRef = useRef<pubHasuType[] | null>([] as pubHasuType[]);
|
||||
const [rightData, setRightData] = useState<pubHasuType[]>();
|
||||
const [inputVal, setInputVal] = useState<string>("");
|
||||
const saveData = () => {
|
||||
if (rightData && rightData?.length > 0) {
|
||||
if (onRightSet)
|
||||
onRightSet(
|
||||
(rightData as pubHasuType[])?.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
swtrmtFcltFk: item.bscFctCd, // 임시값, 실제 데이터에 맞게 수정
|
||||
orgwtWtritQnt: Number(item.fctCpc), // 임시값, 실제 데이터에 맞게 수정
|
||||
tmsYn: "N", // 임시값, 실제 데이터에 맞게 수정
|
||||
dschgFmYn: "N", // 임시값, 실제 데이터에 맞게 수정
|
||||
dtlPstnExpln: item.addr, // 임시값, 실제 데이터에 맞게 수정
|
||||
choose: false, // 임시값, 실제 데이터에 맞게 수정
|
||||
}
|
||||
// 필요한 경우 다른 속성들도 추가
|
||||
}) as unknown as fcOrgwtType[]
|
||||
);
|
||||
|
||||
closeModal?.(false)
|
||||
}
|
||||
else {
|
||||
toast.error("취수하수처리장 목록을 선택해주세요.")
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (Array.isArray(searchFclts)) {
|
||||
@@ -48,46 +75,50 @@ export default function FcOrgwtsRegModal({
|
||||
}, [searchFclts]);
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) {
|
||||
setbdstTable(tableData(pbnstHasuRes, { code }));
|
||||
|
||||
console.log("bdstTable ", bdstTable);
|
||||
const data = pbnstHasuRes.filter((item) => !initTableData?.find((initItem) => initItem.ruseUtztnFcltNm === item.bscFctNm))
|
||||
leftRef.current?.filter((item) => !initTableData?.find((initItem) => initItem.ruseUtztnFcltNm === item.bscFctNm));
|
||||
setbdstTable(tableData(data, { code }));
|
||||
}
|
||||
}, [code, pbnstHasuRes]);
|
||||
}, [code, pbnstHasuRes, initTableData]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log("rightData ", rightData);
|
||||
if (onRightSet)
|
||||
onRightSet(
|
||||
(rightData as pubHasuType[])?.map((item) => ({
|
||||
swtrmtFcltFk: item.bscFctCd, // 임시값, 실제 데이터에 맞게 수정
|
||||
orgwtWtritQnt: Number(item.fctCpc), // 임시값, 실제 데이터에 맞게 수정
|
||||
tmsYn: "N", // 임시값, 실제 데이터에 맞게 수정
|
||||
dschgFmYn: "N", // 임시값, 실제 데이터에 맞게 수정
|
||||
dtlPstnExpln: item.addr, // 임시값, 실제 데이터에 맞게 수정
|
||||
choose: false, // 임시값, 실제 데이터에 맞게 수정
|
||||
// 필요한 경우 다른 속성들도 추가
|
||||
})) as unknown as fcOrgwtType[]
|
||||
);
|
||||
}, [rightData]);
|
||||
if (initTableData && Array.isArray(initTableData)) {
|
||||
setRightData(initTableData.map(item => ({
|
||||
...item,
|
||||
choose: item.choose,
|
||||
sido: item.dtlPstnExpln?.split(" ")[0] || "",
|
||||
gugun: item.dtlPstnExpln?.split(" ")[1] || "",
|
||||
bscFctNm: item.ruseUtztnFcltNm,
|
||||
addr: item.dtlPstnExpln,
|
||||
orgwtWtritQnt: String(item.orgwtWtritQnt),
|
||||
fctCpc: String(item.orgwtWtritQnt),
|
||||
swtrmtFcltFk: item.swtrmtFcltFk,
|
||||
})));
|
||||
rightRef.current = initTableData.map(item => ({ ...item }));
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-[80vh]">
|
||||
<div className="shrink-0 p-4 border-b z-10 bg-white">
|
||||
<div className="flex items-center">
|
||||
<Title title="취수하수처리장 추가" />
|
||||
{/* <Button size="sm" onClick={() => closeModal?.(false)}>저장</Button> */}
|
||||
|
||||
<div className="flex items-center gap-2 mt-8">
|
||||
|
||||
<Label className="text-xl text-gray-600">시설명</Label>
|
||||
<Input
|
||||
className="w-48 text-xl"
|
||||
type="text"
|
||||
value={inputVal}
|
||||
onChange={(e) => setInputVal(e.target.value)}
|
||||
/>
|
||||
<Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}>
|
||||
조회
|
||||
</Button>
|
||||
|
||||
<Label className="text-xl text-gray-600">시설명</Label>
|
||||
<Input
|
||||
className="w-48 text-xl"
|
||||
type="text"
|
||||
value={inputVal}
|
||||
onChange={(e) => setInputVal(e.target.value)}
|
||||
/>
|
||||
<Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}>
|
||||
조회
|
||||
</Button>
|
||||
<Button size="sm" onClick={saveData}>저장</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -107,10 +138,10 @@ export default function FcOrgwtsRegModal({
|
||||
|
||||
{/* 테이블 영역 */}
|
||||
<div className="flex flex-row gap-4 flex-grow p-4 overflow-x-auto">
|
||||
{/* 왼쪽 테이블 */}
|
||||
{/* 왼쪽 테이블 */}
|
||||
|
||||
<div className="w-5/12 min-w-[400px]">
|
||||
<Label className="text-2xl text-gray-600 mb-2 block text-right">
|
||||
<div className="w-5/12 min-w-[400px]">
|
||||
<Label className="text-2xl text-gray-600 mb-2 block text-right">
|
||||
공공하수처리시설 목록
|
||||
</Label>
|
||||
<RuseMngTable
|
||||
@@ -123,7 +154,7 @@ export default function FcOrgwtsRegModal({
|
||||
|
||||
{/* 중간 이동 버튼 */}
|
||||
<div className="flex flex-col justify-center items-center gap-4 w-[200px] min-w-[120px]">
|
||||
<ArrowRight
|
||||
<ArrowRight
|
||||
onClick={() => {
|
||||
const checked = leftRef.current?.filter((item) => item.choose);
|
||||
const unchecked = leftRef.current?.filter((item) => !item.choose);
|
||||
@@ -159,7 +190,7 @@ export default function FcOrgwtsRegModal({
|
||||
|
||||
{/* 오른쪽 테이블 */}
|
||||
<div className="w-5/12 min-w-[400px]">
|
||||
<Label className="text-2xl text-gray-600 mb-2 block text-right">
|
||||
<Label className="text-2xl text-gray-600 mb-2 block text-right">
|
||||
취수하수처리장 목록
|
||||
</Label>
|
||||
<RuseMngTable
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type {
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import {
|
||||
Input,
|
||||
@@ -13,16 +14,18 @@ import {
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components/ui";
|
||||
import { useEffect, useState, type Dispatch, type SetStateAction } from "react";
|
||||
import { useEffect, useState, type Dispatch, type SetStateAction } from "react";
|
||||
|
||||
export function GuideDetailsTable({
|
||||
chgRes,
|
||||
headList,
|
||||
upheadList,
|
||||
type,
|
||||
setChGuidData,
|
||||
}: {
|
||||
chgRes: any[];
|
||||
headList: TableUpperProps[];
|
||||
headList: TableUpperProps[];
|
||||
upheadList: chHeadType[];
|
||||
type: string;
|
||||
setChGuidData: (chgRes: any[]) => void;
|
||||
}) {
|
||||
@@ -35,21 +38,21 @@ export function GuideDetailsTable({
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setChGuidData(inputData??[] );
|
||||
setChGuidData(inputData ?? []);
|
||||
|
||||
}, [inputData]);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`card !m-[1.2rem] !p-0r `}>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">{headMakeprfmnc(headList, rainChkgdn?.rainHeadNm)}</TableHeader>
|
||||
<TableBody >
|
||||
{InputTableBody(inputData ?? [],headList, setInputData) }
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
<div className={`card !m-[1.2rem] !p-0r `}>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">{headMakeprfmnc(headList, upheadList)}</TableHeader>
|
||||
<TableBody >
|
||||
{InputTableBody(inputData ?? [], headList, setInputData)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ export default function RswtChkgdTable({
|
||||
}, [rswtChkgdn.rswtChkPolGuide]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("makeTableData ", makeTableData)
|
||||
getRswtSttnExcel(makeTableData)
|
||||
const selectedData = makeTableData
|
||||
.map((item) => {
|
||||
|
||||
Reference in New Issue
Block a user