온배수 시설 수정 , 주석 삭제
This commit is contained in:
@@ -74,15 +74,12 @@ export default function Home() {
|
||||
}
|
||||
}, [code, htdflRes]);
|
||||
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val
|
||||
) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
setHtdflForm(htdflRes[val]);
|
||||
}
|
||||
}
|
||||
};
|
||||
const cellClick: (val: number, headId: string) => void = (val) => {
|
||||
if (!htdflRes || !Array.isArray(htdflRes)) return;
|
||||
const idx = Number(val);
|
||||
console.log('htdflRes[idx]', htdflRes[idx]);
|
||||
setHtdflForm(htdflRes[idx]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getHtdflBdstData(pageNation, "0");
|
||||
@@ -142,7 +139,9 @@ export default function Home() {
|
||||
total={htdflResCount}
|
||||
headName={"시설물 목록"}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val || undefined, headId);
|
||||
if (val !== null && val !== undefined) {
|
||||
cellClick(val, headId);
|
||||
}
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
></UiTable>
|
||||
|
||||
@@ -16,8 +16,6 @@ export const btnClass = "p-4 m-2 text-white rounded-sm text-lg font-medium ";
|
||||
const laeSecd = "41";
|
||||
export const lwCds: Record<string, SelectDataType[]> = {};
|
||||
|
||||
|
||||
|
||||
const codeMApping = {
|
||||
WR001: "bdstUsgCd",
|
||||
WR002: "rswtBdstType",
|
||||
@@ -27,73 +25,72 @@ const codeMApping = {
|
||||
WR006: "orgwtKndCd", //작업 완ㅛ
|
||||
WR007: "ruseMngMtd", // 작업완료
|
||||
WR008: "rusePrcsMthdCd", //w작업완료
|
||||
WR009: "erctUswtrPrcsMeth",//w작업완료
|
||||
WR010: "ruseFcltSpot",// inout은 yn 만 사용해야 함으로 해당 코드는 사용안함.
|
||||
WR009: "erctUswtrPrcsMeth", //w작업완료
|
||||
WR010: "ruseFcltSpot", // inout은 yn 만 사용해야 함으로 해당 코드는 사용안함.
|
||||
WR011: "pplQulity",
|
||||
WR012: "pplLenght",
|
||||
WR013: "bdstFilterYn", // 사용 불가 yn만 사용해야함으로 해당코드 사용 안함
|
||||
WR014: "rainRswtMng", // 지도점검 등록 시변경
|
||||
WR015: "rainFcltFlowRate", //지도점검 등록 시변경
|
||||
WR016: "dmdUszCd", // 지도점검 등록 시변경
|
||||
WR014: "rainRswtMng", // 지도점검 등록 시변경
|
||||
WR015: "rainFcltFlowRate", //지도점검 등록 시변경
|
||||
WR016: "dmdUszCd", // 지도점검 등록 시변경
|
||||
WR017: "sewageInFcltUse", //하수재이용 장내
|
||||
WR018: "sewageOutFclttUse", // 하수재이용 장외
|
||||
WR019: "htdPowerMthdCd",
|
||||
WR020: "htdUtztnUsgCd",
|
||||
};
|
||||
export const getCommonUpCd = async (set:any) => {
|
||||
|
||||
export const getCommonUpCd = async (set: any) => {
|
||||
try {
|
||||
let lwCdCode :Record<string, SelectDataType[]> = {};
|
||||
let lwCdCode: Record<string, SelectDataType[]> = {};
|
||||
const upCd = await getFetchWithCount(
|
||||
fetchType.LOCAL,
|
||||
"/cms-service/api/v1/up-codes?keyword=&upCd=&cdSe=&useYn=Y&siteId=WR&page=0&size=100&sort=string"
|
||||
);
|
||||
|
||||
|
||||
const upWrCode: string[] = upCd.content
|
||||
.filter((item: any) => item.upCd.slice(0, 2) === "WR")
|
||||
.map((cd: any) => cd.upCd);
|
||||
|
||||
|
||||
await Promise.all(
|
||||
upWrCode.map(async (cd) => {
|
||||
const mapping = codeMApping[cd as keyof typeof codeMApping];
|
||||
if (!mapping) return;
|
||||
|
||||
|
||||
const lwCd = await getFetchWithCount(
|
||||
fetchType.LOCAL,
|
||||
`/cms-service/api/v1/lwpo-cds/up-cd/${cd}`
|
||||
);
|
||||
|
||||
const list = Array.isArray(lwCd) ? lwCd : lwCd.content ?? [];
|
||||
lwCds[mapping] = list.map((it: any) => ({
|
||||
text: it.lwpoCdNm,
|
||||
val: it.lwpoCd,
|
||||
}));
|
||||
|
||||
const list = Array.isArray(lwCd) ? lwCd : (lwCd.content ?? []);
|
||||
lwCds[mapping] = list.map((it: any) => ({
|
||||
text: it.lwpoCdNm,
|
||||
val: it.lwpoCd,
|
||||
}));
|
||||
})
|
||||
);
|
||||
lwCdCode=lwCds
|
||||
lwCdCode = lwCds;
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
rainFcltCd: lwCdCode['rainFcltCd']??[],
|
||||
bdstUsgCd: lwCdCode['bdstUsgCd']??[],
|
||||
orgwtKndCd: lwCdCode['orgwtKndCd']??[] ,
|
||||
pplQulity: lwCdCode['pplQulity']??[] ,
|
||||
pplLenght: lwCdCode['pplLenght']??[] ,
|
||||
dmdUszCd: lwCdCode['dmdUszCd']??[] ,
|
||||
ruseMngMtd: lwCdCode['ruseMngMtd']??[],
|
||||
rusePrcsMthdCd: lwCdCode['rusePrcsMthdCd']??[],
|
||||
erctUswtrPrcsMeth: lwCdCode['erctUswtrPrcsMeth']??[],
|
||||
bdstGrntchClass: lwCdCode['bdstGrntchClass']??[],
|
||||
htdPowerMthdCd: lwCdCode['htdPowerMthdCd']??[],
|
||||
htdUtztnUsgCd: lwCdCode['htdUtztnUsgCd']??[],
|
||||
rswtBdstType:lwCdCode['rswtBdstType']??[] ,
|
||||
bdstTotalUsgType:lwCdCode['bdstUsgCd']?.concat(lwCdCode['rswtBdstType'] || [])??[]
|
||||
rainFcltCd: lwCdCode["rainFcltCd"] ?? [],
|
||||
bdstUsgCd: lwCdCode["bdstUsgCd"] ?? [],
|
||||
orgwtKndCd: lwCdCode["orgwtKndCd"] ?? [],
|
||||
pplQulity: lwCdCode["pplQulity"] ?? [],
|
||||
pplLenght: lwCdCode["pplLenght"] ?? [],
|
||||
dmdUszCd: lwCdCode["dmdUszCd"] ?? [],
|
||||
ruseMngMtd: lwCdCode["ruseMngMtd"] ?? [],
|
||||
rusePrcsMthdCd: lwCdCode["rusePrcsMthdCd"] ?? [],
|
||||
erctUswtrPrcsMeth: lwCdCode["erctUswtrPrcsMeth"] ?? [],
|
||||
bdstGrntchClass: lwCdCode["bdstGrntchClass"] ?? [],
|
||||
htdPowerMthdCd: lwCdCode["htdPowerMthdCd"] ?? [],
|
||||
htdUtztnUsgCd: lwCdCode["htdUtztnUsgCd"] ?? [],
|
||||
rswtBdstType: lwCdCode["rswtBdstType"] ?? [],
|
||||
bdstTotalUsgType:
|
||||
lwCdCode["bdstUsgCd"]?.concat(lwCdCode["rswtBdstType"] || []) ?? [],
|
||||
},
|
||||
}));
|
||||
}catch(e){
|
||||
console.log('com code error ', e)
|
||||
} catch (e) {
|
||||
console.log("com code error ", e);
|
||||
}
|
||||
|
||||
};
|
||||
//물재이용 주소 코드: devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
export const buildingType = {
|
||||
@@ -219,9 +216,6 @@ export const getEnvPartCd = async (set: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
export type comCodeState = {
|
||||
code: {
|
||||
isInit: boolean;
|
||||
@@ -252,11 +246,11 @@ export type comCodeState = {
|
||||
bdstFilterYn: SelectDataType[];
|
||||
bdstIncenYn: SelectDataType[];
|
||||
bdstGrntchClass: SelectDataType[];
|
||||
// rswtPrscCdMthdCd: SelectDataType[];
|
||||
// rswtPrscCdMthdCd: SelectDataType[];
|
||||
htdPowerMthdCd: SelectDataType[];
|
||||
htdUtztnUsgCd: SelectDataType[];
|
||||
rswtBdstType:SelectDataType[];
|
||||
bdstTotalUsgType:SelectDataType[]
|
||||
rswtBdstType: SelectDataType[];
|
||||
bdstTotalUsgType: SelectDataType[];
|
||||
userSiSggCd: string;
|
||||
};
|
||||
};
|
||||
@@ -266,60 +260,56 @@ export type comCodeType = comCodeState & comCodeActions;
|
||||
export const comCodeStateExport: comCodeState = {
|
||||
code: {
|
||||
isInit: false,
|
||||
rainFcltCd: lwCds['rainFcltCd']??[],
|
||||
bdstUsgCd: lwCds['bdstUsgCd']??[] ,
|
||||
rainFcltCd: lwCds["rainFcltCd"] ?? [],
|
||||
bdstUsgCd: lwCds["bdstUsgCd"] ?? [],
|
||||
chBuCd: chBuCd,
|
||||
orgwtKndCd: lwCds['orgwtKndCd']??[] ,
|
||||
orgwtKndCd: lwCds["orgwtKndCd"] ?? [],
|
||||
cityCd: [],
|
||||
sggCd: [],
|
||||
rvbsnCd: [],
|
||||
mdmbsnCd: [],
|
||||
lgbsnCd: [],
|
||||
lclgvrnmntCd: [],
|
||||
pplQulity: lwCds['pplQulity']??[] ,
|
||||
pplLenght: lwCds['pplLenght']??[] ,
|
||||
pplQulity: lwCds["pplQulity"] ?? [],
|
||||
pplLenght: lwCds["pplLenght"] ?? [],
|
||||
yn: yn,
|
||||
dmdUszCd: lwCds['dmdUszCd']??[] ,
|
||||
dmdUszCd: lwCds["dmdUszCd"] ?? [],
|
||||
buildingType: buildingType,
|
||||
ruseMngMtd: lwCds['ruseMngMtd']??[],
|
||||
ruseMngMtd: lwCds["ruseMngMtd"] ?? [],
|
||||
ruseSeCd: ruseSeCd,
|
||||
ruseBizMthdCd: ruseBizMthdCd,
|
||||
rusePrcsMthdCd: lwCds['rusePrcsMthdCd']??[],
|
||||
erctUswtrPrcsMeth: lwCds['erctUswtrPrcsMeth']??[],
|
||||
rusePrcsMthdCd: lwCds["rusePrcsMthdCd"] ?? [],
|
||||
erctUswtrPrcsMeth: lwCds["erctUswtrPrcsMeth"] ?? [],
|
||||
bdstFilterYn: bdstFilterYn,
|
||||
bdstIncenYn: bdstIncenYn,
|
||||
bdstGrntchClass: lwCds['bdstGrntchClass']??[],
|
||||
// rswtPrscCdMthdCd: rswtPrscCdMthdCd, // 공단연락오면 바꿔야함
|
||||
htdPowerMthdCd: lwCds['htdPowerMthdCd']??[],
|
||||
htdUtztnUsgCd: lwCds['htdUtztnUsgCd']??[],
|
||||
bdstGrntchClass: lwCds["bdstGrntchClass"] ?? [],
|
||||
// rswtPrscCdMthdCd: rswtPrscCdMthdCd, // 공단연락오면 바꿔야함
|
||||
htdPowerMthdCd: lwCds["htdPowerMthdCd"] ?? [],
|
||||
htdUtztnUsgCd: lwCds["htdUtztnUsgCd"] ?? [],
|
||||
userSiSggCd: laeSecd,
|
||||
rswtBdstType:lwCds['rswtBdstType']??[] ,
|
||||
bdstTotalUsgType:lwCds['bdstTotalUsgType']??[]
|
||||
rswtBdstType: lwCds["rswtBdstType"] ?? [],
|
||||
bdstTotalUsgType: lwCds["bdstTotalUsgType"] ?? [],
|
||||
},
|
||||
};
|
||||
|
||||
export type comCodeActions = {
|
||||
returnCodeText: (val: string, codeName: string) => string;
|
||||
returnTextCode: (text: string, codeName: string) => string;
|
||||
returnTextCode: (text: string, codeName: string) => string;
|
||||
};
|
||||
|
||||
export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
|
||||
export const codeActionExport: (set: any, get:any) => comCodeActions = (set: any, get:any) => {
|
||||
return {
|
||||
returnCodeText: (val: string, codeName: string) => {
|
||||
return set((state: comCodeState) => {
|
||||
const codeList = state.code[codeName] || [];
|
||||
const found = codeList.find((item) => item.val === val);
|
||||
return found ? found.text : val;
|
||||
}
|
||||
);
|
||||
|
||||
const codeList = get().code[codeName] || [];
|
||||
const found = codeList.find((item) => item.val === val);
|
||||
|
||||
return found ? found.text : val;
|
||||
},
|
||||
returnTextCode: (text: string, codeName: string) => {
|
||||
return set((state: comCodeState) => {
|
||||
const codeList = state.code[codeName] || [];
|
||||
const codeList = get().code[codeName] || [];
|
||||
const found = codeList.find((item) => item.text === text);
|
||||
return found ? found.val : text;
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -351,7 +351,7 @@ export const StoreZus = (
|
||||
...rswtFacActionsExport(set),
|
||||
...matDmdActionsExport(set),
|
||||
...htdflFacActionsExport(set),
|
||||
...codeActionExport(set),
|
||||
...codeActionExport(set,get),
|
||||
...bdstActionsExport(set),
|
||||
...rainChkgdnActionsExport(set),
|
||||
...rswtChkgdnActionsExport(set),
|
||||
|
||||
@@ -9,19 +9,16 @@ import {
|
||||
SelectBox,
|
||||
type SelectDataType,
|
||||
} from "@common/business_components";
|
||||
import SearchInputAddress from "@common/business_components/ui/search_input_address";
|
||||
import type { addressType } from "@common/business_components/ui/search_input_address/findAddress";
|
||||
import { Input } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
const { code } = useWrStore((state) => {
|
||||
const { code, returnCodeText } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
const { userSiSggCd } = code;
|
||||
const [useCityCd, setUserCityCd] = useState<SelectDataType[]>([]);
|
||||
const [useSggCd, setUserSggCd] = useState<SelectDataType[]>([]);
|
||||
const [initDaddr, setInitDaddr] = useState<string>();
|
||||
|
||||
useEffect(() => {
|
||||
if (userSiSggCd.length === 2 && code.cityCd.length > 0) {
|
||||
@@ -56,10 +53,8 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
form.setValue("ctpvCd", Number(city[0]?.val));
|
||||
form.setValue("sggCd", Number(sgg[0]?.val));
|
||||
}
|
||||
|
||||
}, [form, userSiSggCd, code.cityCd, code.sggCd]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const subscription = form.form?.watch((value: any) => {
|
||||
console.log("vale", value);
|
||||
@@ -72,12 +67,40 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
// console.log("form ", form.watch());
|
||||
// }, [form.formState]);
|
||||
|
||||
useEffect(() => {
|
||||
const bdstInfoSn = form.getValues("bdstInfoSn");
|
||||
if (bdstInfoSn && bdstInfoSn > 0) form.setValue("daddr", bdstInfoSn);
|
||||
}, [form.getValues("bdstInfoSn")]);
|
||||
|
||||
const userCtpvCd = form.watch("ctpvCd");
|
||||
const userSggCd = form.watch("sggCd");
|
||||
|
||||
useEffect(() => {
|
||||
const bdstInfoSn = form.getValues("bdstInfoSn");
|
||||
if(bdstInfoSn&&bdstInfoSn>0)
|
||||
setInitDaddr(form.getValues("daddr"));
|
||||
}, [form.getValues("bdstInfoSn")]);
|
||||
const strCtpvCd = String(userCtpvCd);
|
||||
|
||||
if (strCtpvCd && strCtpvCd !== "0") {
|
||||
const city = returnCodeText(strCtpvCd, "cityCd");
|
||||
form?.setValue("daddr", city);
|
||||
} else if (strCtpvCd === "0") {
|
||||
form?.setValue("daddr", "");
|
||||
}
|
||||
}, [userCtpvCd]);
|
||||
|
||||
useEffect(() => {
|
||||
const strSggCd = String(userSggCd);
|
||||
if (strSggCd && strSggCd !== "0") {
|
||||
const city = returnCodeText(strSggCd.slice(0, 2), "cityCd");
|
||||
const sgg = returnCodeText(strSggCd, "sggCd");
|
||||
|
||||
form?.setValue("daddr", city + " " + sgg);
|
||||
} else if (strSggCd === "0") {
|
||||
const ctpvCdText = returnCodeText(
|
||||
String(form.getValues("ctpvCd")),
|
||||
"cityCd"
|
||||
);
|
||||
form?.setValue("daddr", ctpvCdText);
|
||||
}
|
||||
}, [userSggCd]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -162,24 +185,17 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
name="daddr"
|
||||
render={({ field }) => (
|
||||
<FormUi label={type !== "HTB" ? "건축물 주소" : "시설 주소"}>
|
||||
{/* <Input
|
||||
className={selectClass}
|
||||
placeholder="위치를 입력해주세요"
|
||||
type="search"
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value)
|
||||
}}
|
||||
value={field.value || ''}
|
||||
maxLength={50}
|
||||
/> */}
|
||||
<div>
|
||||
<SearchInputAddress
|
||||
initValue={initDaddr}
|
||||
setRtnData={(rtnData: addressType) => {
|
||||
console.log("rtnData", rtnData);
|
||||
field.onChange(rtnData.roadAddrPart1);
|
||||
<Input
|
||||
className={selectClass}
|
||||
placeholder="위치를 입력해주세요"
|
||||
type="search"
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
></SearchInputAddress>
|
||||
value={field.value || ""}
|
||||
maxLength={50}
|
||||
/>
|
||||
</div>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -222,9 +238,9 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.bdstUsgCd}
|
||||
selectArray={ type ==='RNB'?code.bdstUsgCd:code.rswtBdstType}
|
||||
onSelectValue={(val) => {
|
||||
field.onChange(Number(val));
|
||||
field.onChange(val);
|
||||
}}
|
||||
value={field.value ?? code.bdstUsgCd[0]?.val}
|
||||
/>
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function HtdflRegForm({
|
||||
isModal,
|
||||
readonly = false,
|
||||
setIsModal,
|
||||
isMap
|
||||
isMap,
|
||||
}: {
|
||||
htdflForm: customHtdflBdst;
|
||||
isModal: boolean;
|
||||
@@ -79,9 +79,29 @@ export default function HtdflRegForm({
|
||||
|
||||
const cleanHtdflData = (raw: any): z.infer<typeof hdtflZod> => {
|
||||
const buildings =
|
||||
raw?.reuseBuilding && raw.reuseBuilding.length > 0
|
||||
? raw.reuseBuilding
|
||||
: [{}];
|
||||
raw?.reuseBuilding && raw.reuseBuilding.length > 0
|
||||
? raw.reuseBuilding
|
||||
: [{}];
|
||||
|
||||
if (htdflForm.reuseBuilding && htdflForm.reuseBuilding[0]?.htdflObj.ph) {
|
||||
const htdflPH = htdflForm.reuseBuilding[0]?.htdflObj.ph;
|
||||
if (htdflPH && String(htdflPH).includes("~")) {
|
||||
const [frontPH, backPH] = htdflPH.split("~");
|
||||
if (frontPH) {
|
||||
setFrontPHdata(frontPH);
|
||||
}
|
||||
if (backPH) {
|
||||
setBackPHdata(backPH);
|
||||
}
|
||||
} else {
|
||||
setFrontPHdata("");
|
||||
setBackPHdata("");
|
||||
}
|
||||
} else {
|
||||
setFrontPHdata("");
|
||||
setBackPHdata("");
|
||||
}
|
||||
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null),
|
||||
@@ -96,7 +116,7 @@ export default function HtdflRegForm({
|
||||
: new Date(item?.archChgPrmsnDt),
|
||||
bdstChgNm: item?.bdstChgNm ?? "", // null → ""
|
||||
})),
|
||||
reuseBuilding:buildings.map((item: any) => ({
|
||||
reuseBuilding: buildings.map((item: any) => ({
|
||||
...item,
|
||||
instlCmptnDt: new Date(item?.instlCmptnDt),
|
||||
htdflObj: {
|
||||
@@ -146,16 +166,16 @@ export default function HtdflRegForm({
|
||||
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(() => {
|
||||
if(isMap){
|
||||
setDivStyle("h-[100vh]")
|
||||
}else if (isModal === true) {
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
if (isMap) {
|
||||
setDivStyle("h-[100vh]");
|
||||
} else if (isModal === true) {
|
||||
setDivStyle("h-[53vh] max-h-[37vh]");
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]")
|
||||
setDivStyle("h-[62vh]");
|
||||
} else {
|
||||
setDivStyle("h-[57vh]")
|
||||
setDivStyle("h-[57vh]");
|
||||
}
|
||||
}, [isModal, readonly ,isMap]);
|
||||
}, [isModal, readonly, isMap]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
@@ -164,25 +184,9 @@ export default function HtdflRegForm({
|
||||
// form.reset은 비동기로 동작할 수 있어, useEffect 하나로 관리하여 의도치 않은 초기화를 방지합니다.
|
||||
useEffect(() => {
|
||||
// Case 1: 수정 또는 '복사하여 등록' 등 데이터가 주입되는 경우
|
||||
if (htdflForm && Object.keys(htdflForm).length > 0) {
|
||||
|
||||
const htdflPH = htdflForm.reuseBuilding[0]?.htdflObj.ph
|
||||
if(htdflPH && String(htdflPH).includes("~")){
|
||||
const [frontPH, backPH] = htdflPH.split("~");
|
||||
if (frontPH) {
|
||||
setFrontPHdata(frontPH);
|
||||
}
|
||||
if (backPH) {
|
||||
setBackPHdata(backPH);
|
||||
}
|
||||
} else {
|
||||
setFrontPHdata("");
|
||||
setBackPHdata("");
|
||||
}
|
||||
|
||||
|
||||
if (htdflForm) {
|
||||
form.reset(cleanHtdflData(htdflForm));
|
||||
}else{
|
||||
} else {
|
||||
form.reset();
|
||||
}
|
||||
// Case 2: 데이터가 없는 순수 신규 등록 모드인 경우
|
||||
@@ -227,37 +231,12 @@ export default function HtdflRegForm({
|
||||
if (!isPowerPlant) {
|
||||
form.setValue(
|
||||
"reuseBuilding.0.htdflObj.etgtType",
|
||||
"해당없음", // 빈 문자열로 초기화
|
||||
"01", // 빈 문자열로 초기화
|
||||
{ shouldDirty: true } // dirty 상태로 남길지 여부는 취사선택
|
||||
);
|
||||
}
|
||||
}, [isPowerPlant, form]);
|
||||
|
||||
|
||||
// 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]);
|
||||
|
||||
return (
|
||||
<div className="!mx-[1.6rem] !p-0r">
|
||||
<Form {...form}>
|
||||
@@ -310,12 +289,8 @@ export default function HtdflRegForm({
|
||||
selectArray={code.htdPowerMthdCd}
|
||||
onSelectValue={readonly ? () => {} : field.onChange}
|
||||
// value={field.value ?? ""}
|
||||
value={
|
||||
field.value ||
|
||||
(code?.htdPowerMthdCd[0] &&
|
||||
code?.htdPowerMthdCd[0].val)
|
||||
}
|
||||
readOnly={readonly || !isPowerPlant}
|
||||
value={field.value}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
|
||||
@@ -77,9 +77,6 @@ export default function RswtrRegForm({
|
||||
}
|
||||
};
|
||||
|
||||
const filtrTrtmfctCpct = form.watch(
|
||||
"reuseBuilding.0.rswtrObj.filtrTrtmfctCpct"
|
||||
);
|
||||
const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => {
|
||||
const buildings =
|
||||
raw?.reuseBuilding && raw.reuseBuilding.length > 0
|
||||
@@ -113,12 +110,6 @@ export default function RswtrRegForm({
|
||||
})),
|
||||
};
|
||||
};
|
||||
// useEffect(() =>{
|
||||
// console.log(' formform ', form.watch())
|
||||
// },[form.formState])
|
||||
useEffect(() => {
|
||||
console.log(" filtrTrtmfctCpct ", filtrTrtmfctCpct);
|
||||
}, [filtrTrtmfctCpct]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
@@ -146,12 +137,6 @@ export default function RswtrRegForm({
|
||||
}, [rswtForm, form]);
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
console.log('code orgin ', code)
|
||||
|
||||
console.log('code ', code.orgwtKndCd)
|
||||
},[code])
|
||||
|
||||
return (
|
||||
<div className="!mx-[1.6rem] !p-0r">
|
||||
<Form {...form}>
|
||||
@@ -269,7 +254,6 @@ export default function RswtrRegForm({
|
||||
onFocus={() => {
|
||||
// 입력 시 자동으로 확인불가 해제
|
||||
if (isUnknown && !readonly) {
|
||||
console.log("value");
|
||||
field.onChange(""); // 초기화
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user