diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx index 84413fbc2..35e2a9d60 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx @@ -1,3 +1,4 @@ +import { numSize, txtSize } from "@/app/store/common/code/basicCode"; import type { TableUpperProps } from "@/app/store/common/type/header"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; @@ -14,8 +15,13 @@ export const pubFacHeadListExport: TableUpperProps[] = [ export const pbnstMngUpHeadListExport: TableUpperProps[] = [ { id: "choose", title: "선택", type: "checkbox" }, - { id: "operMthd", title: "운영방식",type: "select", selectData: "ruseMngMtd" }, - { id: "rprtvBzenty", title: "대행업체", edit: true ,maxLength:10 }, + { + id: "operMthd", + title: "운영방식", + type: "select", + selectData: "ruseMngMtd", + }, + { id: "rprtvBzenty", title: "대행업체", edit: true, maxLength: 10 }, { id: "bgngDt", title: "시작일", @@ -47,7 +53,7 @@ export const pbnstDemandHeadListExport: TableUpperProps[] = [ export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [ { id: "ruseUtztnFcltNm", title: "하수처리장명" }, - { id: "orgwtWtritQnt", title: "원수취수량" , type:'number'}, + { id: "orgwtWtritQnt", title: "원수취수량", type: "number" }, { id: "tmsYn", title: "하수처리량TMS 전후" }, { id: "dschgFmYn", title: "하수처리장 방류 유량계 전·후​" }, { id: "dtlPstnExpln", title: "상세위치", edit: true }, @@ -60,7 +66,6 @@ export const fcOrgwtsHeadListExport: TableUpperProps[] = [ { id: "addr", title: "위치" }, ]; - export const pbnstMngNmExport: chHeadType[] = [ { headNm: "upChangeRe", text: "운영대행기간", length: 2 }, ]; @@ -69,65 +74,91 @@ export type formDetailType = { id: string; lable: string; type?: string; + maxLenght?: number; selectData?: string; // select box일 경우 - option?:string + option?: string; }; export const wasteWaterFcltINfo: formDetailType[] = [ - { id: "wwtEmsnFcltPrmsnYn", lable: "폐수배출물신고 허가여부", type: "select" , selectData: "yn"}, - { id: "tmsInstlYn", lable: "Tms설치여부", type: "select" , selectData: "yn" }, - { id: "pbnstDrngInflwExclYn", lable: "공공하수도유입제외 허가여부", type: "select" , selectData: "yn" }, + { + id: "wwtEmsnFcltPrmsnYn", + lable: "폐수배출물신고 허가여부", + type: "select", + selectData: "yn", + }, + { id: "tmsInstlYn", lable: "Tms설치여부", type: "select", selectData: "yn" }, + { + id: "pbnstDrngInflwExclYn", + lable: "공공하수도유입제외 허가여부", + type: "select", + selectData: "yn", + }, ]; export const concentratedWaterInfo: formDetailType[] = [ - { id: "erctWtrOcrnCpct", lable: "눙축수 발생량(m³/일)", type: "number" }, - { id: "erctUswtrLinkSpt", lable: "눙축수연계지점" }, - { id: "erctUswtrFcltCpct", lable: "시설용량(m³/일)", type: "number" }, - { id: "erctUswtrPrcsMeth", lable: "눙축수처리방식", type : "select", selectData: "erctUswtrPrcsMeth" }, - { id: "erctUswtrPrcsMsrcCd", lable: "눙축수처리공법" }, + { id: "erctWtrOcrnCpct", lable: "눙축수 발생량(m³/일)", type: "number",maxLenght:numSize }, + { id: "erctUswtrLinkSpt", lable: "눙축수연계지점", maxLenght:txtSize }, + { id: "erctUswtrFcltCpct", lable: "시설용량(m³/일)", type: "number" ,maxLenght:numSize }, + { + id: "erctUswtrPrcsMeth", + lable: "눙축수처리방식", + type: "select", + selectData: "erctUswtrPrcsMeth", + }, + { id: "erctUswtrPrcsMsrcCd", lable: "눙축수처리공법" ,maxLenght:txtSize}, ]; export const ruseFcltinfo: formDetailType[] = [ - { id: "rprcsFcltCpct", lable: "시설용량(m³/일)", type: "number" }, - { id: "majorPrcsMsrcCd", lable: "주처리공법" }, - { id: "addr", lable: "위치(주소)" }, - { id: "rprcsMthdCd", lable: "재처리방식", type: "select", selectData: "rusePrcsMthdCd" }, - { id: "inoutYn", lable: "위치(처리장 내외)" ,type: "select" , selectData: "yn"}, // 머가 내? 외?, - { id: "mainSplyPumpCpct", lable: "메인공급펌프 용량", type: "number" }, + { id: "rprcsFcltCpct", lable: "시설용량(m³/일)", type: "number", maxLenght:numSize }, + { id: "majorPrcsMsrcCd", lable: "주처리공법", maxLenght:txtSize }, + { id: "addr", lable: "위치(주소)", maxLenght:txtSize}, + { + id: "rprcsMthdCd", + lable: "재처리방식", + type: "select", + selectData: "rusePrcsMthdCd", + + }, + { + id: "inoutYn", + lable: "위치(처리장 내외)", + type: "select", + selectData: "yn", + }, // 머가 내? 외?, + { id: "mainSplyPumpCpct", lable: "메인공급펌프 용량", type: "number" , maxLenght:numSize}, ]; export const businessMoneyInfo: formDetailType[] = [ - { id: "gvsbs", lable: "국고", type: "number" }, - { id: "lcep", lable: "지방비", type: "number" }, - { id: "cusrAlotm", lable: "민간투자비", type: "number" }, - { id: "etc", lable: "기타" }, - { id: "totalMoney", lable: "합계", type: "number" ,option:"disabled" }, + { id: "gvsbs", lable: "국고", type: "number" , maxLenght:numSize}, + { id: "lcep", lable: "지방비", type: "number" , maxLenght:numSize}, + { id: "cusrAlotm", lable: "민간투자비", type: "number" , maxLenght:numSize}, + { id: "etc", lable: "기타" , maxLenght:numSize}, + { id: "totalMoney", lable: "합계", type: "number", option: "disabled" }, ]; export const businessSttnInfo: formDetailType[] = [ - { id: "seCd", lable: "구분", type: "select", selectData: "ruseSeCd" }, - { id: "bizMthdCd", lable: "사업방식", type: "select", selectData: "ruseBizMthdCd" }, + { id: "seCd", lable: "구분", type: "select", selectData: "ruseSeCd" }, + { + id: "bizMthdCd", + lable: "사업방식", + type: "select", + selectData: "ruseBizMthdCd", + }, { id: "bizCmcnDay", lable: "사업준공일", type: "date" }, { id: "instlAprvSncnDt", lable: "설치승인인가일", type: "date" }, ]; -export const ruseFcltIntakeList: formDetailType[] = [ - { id: "seCd", lable: "구분" }, - { id: "bizMthdCd", lable: "사업방식" }, - { id: "bizCmcnDay", lable: "사업준공일", type: "date" }, - { id: "instlAprvSncnDt", lable: "설치승인인가일", type: "date" }, -]; export const ruseWaterQulityList: formDetailType[] = [ - { id: "bod", lable: "BOD(mg/L)", type: "text" }, - { id: "grssClfg", lable: "총대장균군수(개/mg)", type: "text" }, - { id: "combResdch", lable: "결합잔류염소(mh/L)", type: "text" }, - { id: "trbt", lable: "탁도(NTU)", type: "text" }, - { id: "smll", lable: "냄새", type: "text" }, - { id: "crmty", lable: "색도", type: "text" }, - { id: "tn", lable: "총질소(mg/L)", type: "text" }, - { id: "tph", lable: "총인(mg/L)", type: "text" }, - { id: "ph", lable: "수소이온농도", type: "text" }, - { id: "clIonQnt", lable: "염화물(mg/L)", type: "text" }, - { id: "cdtnv", lable: "전기전도도(μs/cm)​", type: "text" }, + { id: "bod", lable: "BOD(mg/L)", type: "text", maxLenght:numSize }, + { id: "grssClfg", lable: "총대장균군수(개/mg)", type: "text" , maxLenght:numSize}, + { id: "combResdch", lable: "결합잔류염소(mh/L)", type: "text" , maxLenght:numSize}, + { id: "trbt", lable: "탁도(NTU)", type: "text" , maxLenght:numSize}, + { id: "smll", lable: "냄새", type: "text", maxLenght:numSize }, + { id: "crmty", lable: "색도", type: "text", maxLenght:numSize }, + { id: "tn", lable: "총질소(mg/L)", type: "text", maxLenght:numSize }, + { id: "tph", lable: "총인(mg/L)", type: "text" , maxLenght:numSize}, + { id: "ph", lable: "수소이온농도", type: "text", maxLenght:numSize}, + { id: "clIonQnt", lable: "염화물(mg/L)", type: "text", maxLenght:numSize }, + { id: "cdtnv", lable: "전기전도도(μs/cm)​", type: "text", maxLenght:numSize }, ]; diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index 37e6d3a5c..fb52d7dda 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -38,6 +38,7 @@ import SdmInsertForm from "@common/business_components/ui/sdmInsertForm"; import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import RuseMngTableForm from "@/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm"; import type { SelectDataType } from "@common/business_components"; +import { BuseWaterQulity } from "./buseWaterQulity/buseWaterQulity"; export function PbnstBuseForm({ indexMng = 0, @@ -474,7 +475,7 @@ export function PbnstBuseForm({ /> - */} +
+ + +
+

{"하수처리수 재이용수 수요처"} diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/buseWaterQulity/buseWaterQulity.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/buseWaterQulity/buseWaterQulity.tsx new file mode 100644 index 000000000..54e21e6c0 --- /dev/null +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/buseWaterQulity/buseWaterQulity.tsx @@ -0,0 +1,416 @@ +import { txtSize } from "@/app/store/common/code/basicCode"; +import type { PbnstRegArrrayType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; +import { formH1Class } from "@/components/lib/class/comClass"; +import { FormField, FormUi } from "@common/business_components/ui"; +import { Input, Label } from "@common/components/ui"; +import { useCallback, useEffect, useState } from "react"; +import type { UseFormReturn } from "react-hook-form"; + +export function BuseWaterQulity({ + form, + h1Title, + subTitle, + moClass, + sonClass, + indexMng, + indexBiz, + formType, +}: { + form: UseFormReturn<{ items: PbnstRegArrrayType }>; + h1Title: string; + subTitle: string; + moClass: string; + sonClass: string; + indexMng: number; + indexBiz: number; + formType?: string; +}) { + const [frontPHdata, setFrontPHdata] = useState("0"); + const [backPHdata, setBackPHdata] = useState("0"); + const [chekcPk, setCheakPk] = useState(""); + + // const watchPH = useWatch({ + // name: `items.${indexMng}.fcBizs.${indexBiz}.ph`, + // control: form.control, // useForm에서 받은 control 전달 + // }); + + useEffect(() => { + const watchPH = form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.ph`); + const checkPkAndCycle = + form.getValues(`items.${indexMng}.pbnstRuseFcltId`) + + String(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cycl`)); + + console.log('checkPkAndCycle ', checkPkAndCycle) + if (chekcPk !== checkPkAndCycle) { + if (watchPH && watchPH !== undefined) { + const [frontPH, backPH] = watchPH.split("~"); + if (frontPH) { + setFrontPHdata(frontPH); + } + if (backPH) { + setBackPHdata(backPH); + } + } else { + setFrontPHdata("0"); + setBackPHdata("0"); + } + setCheakPk(checkPkAndCycle); + } + }, [form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.ph`), + + chekcPk]); + + const isSetFrontPh = useCallback( + (frontPHdata: string) => { + if (frontPHdata && frontPHdata.length > 0) { + const PHdata = form.getValues( + `items.${indexMng}.fcBizs.${indexBiz}.ph` + ); + if (PHdata) { + const backPH = PHdata.split("~")[1]; + const MatchData = frontPHdata + "~" + backPH; + form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.ph`, MatchData); + setFrontPHdata(frontPHdata); + }else{ + const MatchData = frontPHdata+ "~" + '0'; + form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.ph`, MatchData); + setFrontPHdata(frontPHdata); + + } + } + }, + [frontPHdata, form, indexMng, indexBiz] + ); + + const isSetBackPh = useCallback( + (backPHdata: string) => { + if (backPHdata && backPHdata.length > 0) { + const PHdata = form.getValues( + `items.${indexMng}.fcBizs.${indexBiz}.ph` + ); + + if (PHdata) { + const frontPH = PHdata.split("~")[0]; + const MatchData = frontPH + "~" + backPHdata + + console.log(' backPHdata ', MatchData) + form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.ph`, MatchData); + setBackPHdata(backPHdata); + }else{ + const MatchData = '0' + "~" + backPHdata; + + form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.ph`, MatchData); + setBackPHdata(backPHdata); + } + } + }, + [backPHdata, form, indexMng, indexBiz] + ); + + return ( + <> + {h1Title ?

{h1Title}

: <>} + {subTitle ?

{subTitle}

: <>} + +
+
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이하` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ { + //TODO 불검춣확인필요 + } + ( + + { + field.onChange(String(e.target.value)); + }} + value={field.value ?? ""} + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이상` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이상` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ { + //TODO : 확인필요 + } + ( + + { + field.onChange(String(e.target.value)); + }} + value={field.value ?? ""} + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이하` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이하` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+ +
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이하` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이하` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+ +
+ ( + + { + const inputValue = e.target.value.replace(/[^0-9.]/g, ""); // 숫자만 저장 + field.onChange(inputValue); + }} + value={ + field.value !== undefined && field.value !== "" + ? `${field.value} 이하` + : "" + } + readOnly={formType === "sttn" ? true : false} + maxLength={txtSize} + /> + + )} + /> +
+
+ +
+ + //setFrontPHdata(e.target.value) + isSetFrontPh(e.target.value) + } + value={frontPHdata ?? ""} + readOnly={formType === "sttn"} + maxLength={txtSize} + /> + ~ + { + isSetBackPh(e.target.value); + }} + value={backPHdata ?? ""} + readOnly={formType === "sttn"} + maxLength={txtSize} + /> +
+
+
+ + ); +}