물재이용 감리 지적사항 수정

This commit is contained in:
leedj312
2025-08-13 17:17:18 +09:00
parent 7c3d4e8f13
commit aacadcb929
10 changed files with 79 additions and 69 deletions
@@ -236,6 +236,7 @@ export default function PublicReuseFaciltyInsert() {
}, [indexMng]);
useEffect(() => {
if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) {
form.reset({ items: pbnst.pbnstRes });
} else {
+33 -36
View File
@@ -17,7 +17,7 @@ export type ruseMapState = {
ruseMapCount: number;
isInit: boolean;
fclts: string[];
ruseExcelList:[];
ruseExcelList: [];
ruseDetailList: customPbnst[];
ruseMapHeadList: CommonTableProps[];
ruseMapNodeList: CommonTableProps[];
@@ -31,22 +31,21 @@ type ruseMapActions = {
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[],
isExcel:boolean
fclts: string[]
) => void;
ruseMapSearch: (
isExcel: boolean,
page: number,
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[],
fcltNm:string
fcltNm: string
) => void;
ruseMapDetail: (ruseFcltId: string) => Promise<customPbnst | undefined>;
getRuseMaplList: (bscFctCd: string) => void;
};
export type ruseMapType = ruseMapState & ruseMapActions;
export const ruseMapStateExport: ruseMapState = {
@@ -56,7 +55,7 @@ export const ruseMapStateExport: ruseMapState = {
ruseDetailList: [],
fclts: [],
ruseMapCount: 1,
ruseExcelList:[],
ruseExcelList: [],
ruseMapHeadList: pbnSttHeadListExport,
ruseMapNodeList: pbnstSttNodeListExport,
},
@@ -81,8 +80,7 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[],
isExcel:boolean
fclts: string[]
) => {
try {
const ruseMapRes = await hasuListFetch(
@@ -93,7 +91,6 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
year,
fclts
);
if(!isExcel){
set((state: ruseMapState) => {
return {
...state,
@@ -105,19 +102,6 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
},
};
});
}else{
const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data);
set((state: ruseMapState) => {
return {
...state,
ruseMap: {
...state.ruseMap,
ruseExcelList: ruseMapExcel,
},
};
});
}
} catch (e) {
console.log(e);
}
@@ -175,12 +159,13 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
}
},
ruseMapSearch: async (
isExcel: boolean,
page: number,
total: number,
reurnValue: ReturnType,
year: string,
fclts: string[],
fcltNm:string
fcltNm: string
) => {
try {
const ruseMapRes = await hasuListFetch(
@@ -189,20 +174,32 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
reurnValue,
fcltNm,
year,
fclts,
fclts
);
set((state: ruseMapState) => {
return {
...state,
ruseMap: {
...state.ruseMap,
ruseMapRes: ruseMapRes.data,
ruseMapCount: ruseMapRes.count,
isInit: false,
},
};
});
if (isExcel) {
const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data);
set((state: ruseMapState) => {
return {
...state,
ruseMap: {
...state.ruseMap,
ruseExcelList: ruseMapExcel,
},
};
});
} else {
set((state: ruseMapState) => {
return {
...state,
ruseMap: {
...state.ruseMap,
ruseMapRes: ruseMapRes.data,
ruseMapCount: ruseMapRes.count,
isInit: false,
},
};
});
}
} catch (e) {
console.log(e);
}
@@ -232,7 +232,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
if( response.status === 200) {
toast.success(`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`);
}
const pbnstHasuRes = await hasuListFetch('1', '0');
const pbnstHasuRes = await hasuListFetch('1', '41');
return set((state: pubFacState) => ({
...state,
pbnst: {
@@ -172,15 +172,17 @@ export function PbnstMngForm({
return [...exFileDatas, ...currentdata];
};
useEffect(() =>{
console.log('로그')
},[])
useEffect(() => {
setRelationFiles([])
setPlanFiles([])
setRegFileList([])
const currentItem = form.getValues(`items.${indexMng}`);
const currentKey = JSON.stringify(currentItem);
const isNewItem =
!fileInitRef.current ||
fileInitRef.current.index !== indexMng ||
fileInitRef.current.key !== currentKey;
if (!isNewItem) return; //
const defaultFiles = currentItem?.fcFiles || [];
@@ -190,24 +192,24 @@ export function PbnstMngForm({
const planFileList = defaultFiles.filter(
(item) => item.fileKnd === "평면도"
);
setRelationFiles(
relationFileList.length > 0
? relationFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([], item.filePath),
}))
: null
);
setPlanFiles(
planFileList.length > 0
? planFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([], item.filePath),
}))
: null
);
setRelationFiles(
relationFileList.length > 0
? relationFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([], item.filePath),
}))
: null
);
setPlanFiles(
planFileList.length > 0
? planFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([], item.filePath),
}))
: null
);
// ✅ 다음 루프에선 다시 안 하도록 저장
fileInitRef.current = {
index: indexMng,
@@ -217,6 +219,7 @@ export function PbnstMngForm({
useEffect(
() => {
//폼이 들어오면 폼에 대한 이름 셀렉트박스를만들기 위해
if (mngRegForm && mngRegForm.length >= 0) {
const fcltNmList = mngRegForm?.map((item, index) => ({
@@ -232,28 +235,36 @@ export function PbnstMngForm({
);
useEffect(() => {
console.log('regFileList ', regFileList)
if (regFileList && regFileList?.length > 0) {
form.setValue(`items.${indexMng}.fcFiles`, regFileList);
}
}, [regFileList, indexMng]);
useEffect(() => {
console.log('relationfiles ' ,relationfiles)
if (relationfiles) {
setRegFileList(regFileFilter(relationfiles, "계통도", regFileList || []));
}
}, [relationfiles]);
useEffect(() => {
console.log('planFiles ' ,planFiles)
if (planFiles) {
setRegFileList(regFileFilter(planFiles, "평면도", regFileList || []));
}
}, [planFiles]);
useEffect(() => {
if (code.ruseMngMtd) {
setMngMtdCode([{ name: "ruseMngMtd", val: code.ruseMngMtd }]);
}
}, [code]);
return (
<div className=" !mx-[1.6rem] !p-0r">
<div>
@@ -104,7 +104,7 @@ export function HasuFacility({rtnFeature}:{rtnFeature:(feature:any)=>void } ) {
console.log("pbnstSttnSearch ", returnType);
pbnMapSearch(true,1, 100000, returnType,'' )
pbnMapSearch(true,1, 100000, returnType,pbnRuseNm??'' )
}}
/>
@@ -174,7 +174,7 @@ export function HtdflFacility({
1,
"1000000",
String(con),
"",
seartchTxt||'',
code.cityCd,
code.sggCd
);
@@ -190,7 +190,7 @@ export function RainFacility({
1,
"1000000",
String(con),
"",
seartchTxt ?? "",
code.cityCd,
code.sggCd
);
@@ -186,7 +186,7 @@ export function RswtFacility({
1,
"1000000",
String(con),
"",
seartchTxt ?? "",
code.cityCd,
code.sggCd
);
@@ -51,7 +51,7 @@ export function RuseFacility({
}
}, [ruseMap.isInit]);
useEffect(() => {
ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts,false);
ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts);
}, [fclts]);
@@ -133,7 +133,7 @@ export function RuseFacility({
ref={ref}
isAdmin={false}
excelClick={function (returnType: ReturnType): void {
ruseMapInit(1,100000 , returnType, searchYear, fclts,true);
ruseMapSearch(true,1,1000000 , returnType, searchYear, fclts,pbnRuseNm??'')
}}
/>
</div>
@@ -148,9 +148,9 @@ export function RuseFacility({
cellClick={ruseCellClick}
onPageChange={(page) => {
if(pbnRuseNm&&pbnRuseNm.length>0){
ruseMapSearch(page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm)
ruseMapSearch(false,page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm)
}else{
ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts,false);
ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts);
}
setIsReset(false);
@@ -61,6 +61,7 @@ export function PbnstRegModal({
useEffect(() => {
const firstForm = form.getValues("items");
if (firstForm) {
setIndexMng(firstForm.length - 1);
}