Merge commit '591ff390c6aee9933a5a1ad24c0bd8eec6523a06' into iipbs/wr/gisPopup
This commit is contained in:
@@ -71,6 +71,7 @@ export default function CoSttn() {
|
||||
|
||||
const getSgg = useCallback((val: string | number) => {
|
||||
setObjSearch((prev) => ({ ...prev, sgg: String(val) }));
|
||||
setPageNation(1)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -110,48 +111,41 @@ export default function CoSttn() {
|
||||
}, [coSttnRes, code]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (coSttn.excelList.length > 0) {
|
||||
if (coSttn.excelList.length === 0) return;
|
||||
|
||||
const coExcel = excelCoSttnParsing(coSttn.excelList, code.cityCd, code.sggCd);
|
||||
excelDownload(
|
||||
coSttn.excelList,
|
||||
coExcel as [],
|
||||
"수요처 관리",
|
||||
"sample_coSttn.xlsx",
|
||||
"A1:G1",
|
||||
"A1:H1",
|
||||
2
|
||||
);
|
||||
}
|
||||
}, [coSttn.excelList]);
|
||||
}, [coSttn.excelList, code]);
|
||||
|
||||
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
// const con = objSearch.sgg ? objSearch.sgg : objSearch.city;
|
||||
// if (con) coSttnSearch("1", "10000", String(con));
|
||||
if(bdstTable){
|
||||
const excelData = excelCoSttnParsing(bdstTable);
|
||||
excelDownload(
|
||||
excelData as [],
|
||||
"수요처 관리",
|
||||
"sample_coSttn.xlsx",
|
||||
"A1:F1",
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
// }, [coSttnSearch, objSearch.city, objSearch.sgg]);
|
||||
}, [excelDownload, bdstTable]);
|
||||
const searchClick = () => {
|
||||
const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city;
|
||||
|
||||
if (con) coSttnSearch("1", "10000", String(con));
|
||||
|
||||
|
||||
}, [coSttnSearch, objSearch.city, objSearch.sgg]);
|
||||
// }, [excelDownload, bdstTable]);
|
||||
const searchClick = () => {
|
||||
const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city;
|
||||
if (con) {
|
||||
if (seartchTxt && seartchTxt?.length > 0) {
|
||||
|
||||
coSttnTxtSearch("1", "13", String(con), seartchTxt ?? "");
|
||||
coSttnTxtSearch(String(pageNation), "13", String(con), seartchTxt ?? "");
|
||||
} else {
|
||||
coSttnSearch("1", "13", String(con));
|
||||
coSttnSearch(String(pageNation), "13", String(con));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -166,7 +160,10 @@ export default function CoSttn() {
|
||||
label="시도"
|
||||
selectClass={""}
|
||||
selectArray={code.cityCd || []}
|
||||
onSelectValue={getSelCity}
|
||||
onSelectValue={(val)=>{
|
||||
getSelCity(val)
|
||||
setPageNation(1)
|
||||
} }
|
||||
value={objSearch.city}
|
||||
/>
|
||||
<SelectBox
|
||||
@@ -196,7 +193,6 @@ export default function CoSttn() {
|
||||
size={"sm"}
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
|
||||
setUpdateData(undefined);
|
||||
setIsDmdModal({ ...isDmdModal, isMoal: true });
|
||||
}}
|
||||
@@ -239,17 +235,26 @@ export default function CoSttn() {
|
||||
tableData={bdstTable || []}
|
||||
headlist={coSttn.coSttHeadList}
|
||||
pageSize={20}
|
||||
total={ coSttnResCount || 0 }
|
||||
total={ coSttnResCount+10 || 0 }
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
setUpdateData(coSttnRes[index as number]);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
onPageChange={(page) =>{
|
||||
const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city;
|
||||
setPageNation(page)
|
||||
coSttnSearch( String(page), "13", String(con));
|
||||
|
||||
|
||||
} }
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
bodyClass={"w-[40vw] max-w-none h-[90vh]"}
|
||||
bodyClass={"w-[40vw] max-w-none h-[80vh] "// +upadateData?.dmdInfoPk?'h-[60vh]':'h-[90vh]'
|
||||
|
||||
}
|
||||
|
||||
open={isDmdModal.isMoal}
|
||||
onOpenChange={() => {
|
||||
setIsDmdModal({ isMoal: false, data: {} as DemandCompType });
|
||||
@@ -264,9 +269,9 @@ export default function CoSttn() {
|
||||
}}
|
||||
rtnInputData={ async(data) => {
|
||||
const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city;
|
||||
|
||||
console.log('data ', data)
|
||||
if(upadateData?.dmdInfoPk){
|
||||
|
||||
console.log('data ', data)
|
||||
await updateDemandCompany(data as DemandCompType)
|
||||
coSttnInit("1", "13", String(con));
|
||||
setIsDmdModal({ isMoal: false, data: data as DemandCompType });
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import { type customLdrmnt } from "@/app/store/matDmd/ldrmntCoSttn";
|
||||
import { ldrmntHeadListExport, ldrmntNodeListExport } from "@/app/store/matDmd/ldrmntCoSttn/headList";
|
||||
import { ldrmntHeadListExport } from "@/app/store/matDmd/ldrmntCoSttn/headList";
|
||||
import {
|
||||
excelDownload,
|
||||
getCity,
|
||||
getCityOrSgg,
|
||||
tableData
|
||||
} from "@/components/lib/func/commom";
|
||||
import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcelModal";
|
||||
@@ -24,54 +23,74 @@ import {
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
type ReturnType,
|
||||
type SelectDataType
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
export default function LdrmntCoSttn() {
|
||||
const { code, ldrmnt, ldrmntInit, ldrmntSearch, } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { ldrmntRes, excelList } = ldrmnt;
|
||||
const { ldrmntRes, excelList, ldrmntResCount } = ldrmnt;
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customLdrmnt | undefined }>({ data: undefined, isOpen: false })
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
|
||||
const [bdstTable, setBdstTable] = useState<customLdrmnt[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [excelData, setExcelData] = useState<any[]>();
|
||||
const [isExcelDownload, setIsExcelDownload] = useState(false);
|
||||
// const [isExcelDownload, setIsExcelDownload] = useState(false);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
excelDownload(
|
||||
[[]],
|
||||
"잠재수요처 관리",
|
||||
"잠재수요처 등록양식",
|
||||
"sample_ldrmntCoSttn.xlsx",
|
||||
"A1:AL1",
|
||||
2
|
||||
);
|
||||
}, []);
|
||||
|
||||
const excelDownloadClick = () => {
|
||||
ldrmntSearch(1, "10000", "0", "");
|
||||
setIsExcelDownload(true);
|
||||
}
|
||||
const computeCityNm = () => {
|
||||
let cityTxt = "";
|
||||
let sggTxt = "";
|
||||
|
||||
if (objSearch.city) {
|
||||
cityTxt =
|
||||
code.cityCd.find((c) => c.val === objSearch.city)?.text || "";
|
||||
}
|
||||
if (objSearch.sgg) {
|
||||
sggTxt =
|
||||
code.sggCd.find((s) => s.val === objSearch.sgg)?.text || "";
|
||||
}
|
||||
|
||||
if (cityTxt === "" || cityTxt === "전체") cityTxt = "0";
|
||||
|
||||
return sggTxt && sggTxt !== "0"
|
||||
? `${cityTxt} ${sggTxt}`
|
||||
: cityTxt;
|
||||
};
|
||||
|
||||
const excelDownloadClick = useCallback(() => {
|
||||
const cityNm = computeCityNm();
|
||||
ldrmntSearch(true, pageNation, String(ldrmntResCount), cityNm, searchTxt || "");
|
||||
// setIsExcelDownload(true);
|
||||
}, [objSearch, pageNation, searchTxt, code, ldrmntSearch, computeCityNm, ldrmntResCount]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isExcelDownload && excelData && excelData.length > 0) {
|
||||
if (/*isExcelDownload &&*/ excelData && excelData.length > 0) {
|
||||
downloadExcel({
|
||||
data: excelData,
|
||||
fileName: "잠재수요처 관리",
|
||||
sheetNameArray: ["Sheet1"],
|
||||
headerRange: "A1:F1"
|
||||
});
|
||||
setIsExcelDownload(false);
|
||||
// setIsExcelDownload(false);
|
||||
}
|
||||
}, [excelData, isExcelDownload]);
|
||||
}, [excelData, /*isExcelDownload*/]);
|
||||
|
||||
const [isExcelOpen, setIsExcelOpen] = useState<{
|
||||
isModal: boolean;
|
||||
@@ -141,33 +160,8 @@ export default function LdrmntCoSttn() {
|
||||
}, [excelList])
|
||||
|
||||
useEffect(() => {
|
||||
let cityTxt = ''
|
||||
let sggTxt = ''
|
||||
|
||||
if (objSearch?.city.toString().length > 0) {
|
||||
cityTxt = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? '';
|
||||
}
|
||||
|
||||
if (objSearch?.sgg.toString().length > 1) {
|
||||
sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? '';
|
||||
}
|
||||
|
||||
if (cityTxt === '전체' || cityTxt === '') {
|
||||
cityTxt = '0'
|
||||
}
|
||||
|
||||
let cityNm = ""
|
||||
|
||||
if (sggTxt !== "0") {
|
||||
cityNm = cityTxt + " " + sggTxt
|
||||
} else {
|
||||
cityNm = cityTxt
|
||||
}
|
||||
if (cityNm) {
|
||||
ldrmntSearch(pageNation, '20', cityNm, searchTxt || "");
|
||||
} else {
|
||||
ldrmntSearch(pageNation, '20', '0', searchTxt || "");
|
||||
}
|
||||
const cityNm = computeCityNm();
|
||||
ldrmntSearch(false, pageNation, '20', cityNm, searchTxt || "");
|
||||
}, [pageNation]);
|
||||
|
||||
return (
|
||||
@@ -210,32 +204,8 @@ export default function LdrmntCoSttn() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={(e) => {
|
||||
|
||||
let cityTxt = ''
|
||||
let sggTxt = ''
|
||||
|
||||
if (objSearch?.city.toString().length > 0) {
|
||||
cityTxt = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? '';
|
||||
}
|
||||
|
||||
if (objSearch?.sgg.toString().length > 1) {
|
||||
sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? '';
|
||||
}
|
||||
|
||||
if (cityTxt === '전체' || cityTxt === '') {
|
||||
cityTxt = '0'
|
||||
}
|
||||
|
||||
let cityNm = ""
|
||||
|
||||
if (sggTxt !== "0") {
|
||||
cityNm = cityTxt + " " + sggTxt
|
||||
} else {
|
||||
cityNm = cityTxt
|
||||
}
|
||||
if (cityNm) {
|
||||
ldrmntSearch(pageNation, '20', cityNm, searchTxt || "");
|
||||
}
|
||||
const cityNm = computeCityNm();
|
||||
ldrmntSearch(false, pageNation, '20', cityNm, searchTxt || "");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -273,11 +243,11 @@ export default function LdrmntCoSttn() {
|
||||
<div className="overflow-x-auto">
|
||||
<ListDiv className="min-w-max">
|
||||
<UiTable
|
||||
headName={[]}
|
||||
headName={undefined}
|
||||
tableData={bdstTable || []}
|
||||
headlist={ldrmntHeadListExport}
|
||||
pageSize={20}
|
||||
total={10000}
|
||||
total={ldrmntResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
onPageChange={setPageNation}
|
||||
/>
|
||||
@@ -299,8 +269,9 @@ export default function LdrmntCoSttn() {
|
||||
setIsExcelOpen({ isModal: !isExcelOpen.isModal })
|
||||
}}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<CoRegExcel />}
|
||||
body={<CoRegExcel isModal={(isOpen) => setIsExcelOpen({ isModal: isOpen })} />}
|
||||
/>
|
||||
<Toaster position="top-center"></Toaster>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function Home() {
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
const { htdflRes } = htdfl;
|
||||
const { htdflRes ,htdflResCount} = htdfl;
|
||||
|
||||
useEffect(() => {
|
||||
if (!htdfl.isInit) {
|
||||
@@ -101,7 +101,7 @@ export default function Home() {
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7 !text-3xl"
|
||||
label="건물명"
|
||||
label="시설명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
@@ -137,9 +137,9 @@ export default function Home() {
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={htdfl.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"건축물 목록"}
|
||||
pageSize={20}
|
||||
total={htdflResCount}
|
||||
headName={"시설물 목록"}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val || undefined, headId);
|
||||
}}
|
||||
|
||||
@@ -93,7 +93,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
if (!isDirty) {
|
||||
toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
|
||||
return;
|
||||
} const data = writeRgtrAndMdfr(valuse.items);
|
||||
} const data = writeRgtrAndMdfr(valuse.items);
|
||||
let bizs = [] as fcBizType[];
|
||||
data.forEach((fclt) => {
|
||||
bizs = [...bizs, ...fclt.fcBizs];
|
||||
@@ -118,22 +118,22 @@ export default function PublicReuseFaciltyInsert() {
|
||||
]).then(([resFclt, resBiz]) => {
|
||||
const isFcltSuccess = resFclt.status === "fulfilled";
|
||||
const isBizSuccess = resBiz.status === "fulfilled";
|
||||
|
||||
|
||||
if (isFcltSuccess && isBizSuccess) {
|
||||
toast.success('하수 재이용 시설 및 사업이 수정되었습니다. ')
|
||||
toast.success('하수 재이용 시설 및 사업이 수정되었습니다. ')
|
||||
// 메시지 표시, 페이지 이동 등
|
||||
} else {
|
||||
|
||||
let message =''
|
||||
let message = ''
|
||||
// ✅ 각각 어떤 항목이 실패했는지도 로그/알림 처리
|
||||
if (!isFcltSuccess) {
|
||||
message = '하수재이용 시설 '
|
||||
}
|
||||
if (!isBizSuccess) {
|
||||
message += '하수재이용 시설 사업 '
|
||||
message += '하수재이용 시설 사업 '
|
||||
}
|
||||
|
||||
toast.error(message+'오류 입니다 ')
|
||||
|
||||
toast.error(message + '오류 입니다 ')
|
||||
pubHasuInit("1", "41");
|
||||
}
|
||||
|
||||
@@ -146,45 +146,45 @@ export default function PublicReuseFaciltyInsert() {
|
||||
// 폼 유효성 검사 실패 시 호출될 함수
|
||||
const onInvalid = (errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>) => {
|
||||
console.log("errors:", errors);
|
||||
|
||||
|
||||
const findAllErrors = (
|
||||
errorObject: any,
|
||||
path: (string | number)[] = []
|
||||
): { message: string; path: (string | number)[] }[] => {
|
||||
if (!errorObject) return [];
|
||||
|
||||
|
||||
return Object.keys(errorObject).flatMap((key) => {
|
||||
const value = errorObject[key];
|
||||
const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key;
|
||||
const newPath = [...path, currentKey];
|
||||
|
||||
|
||||
if (value && typeof value === "object") {
|
||||
if (value.message) {
|
||||
return [{ message: value.message, path: newPath }];
|
||||
}
|
||||
|
||||
|
||||
return findAllErrors(value, newPath);
|
||||
}
|
||||
return [];
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const errorList = findAllErrors(errors);
|
||||
|
||||
|
||||
if (errorList.length > 0) {
|
||||
errorList.forEach((errorInfo) => {
|
||||
const { message, path } = errorInfo;
|
||||
let prefix = "";
|
||||
|
||||
|
||||
const itemsIndex = path.indexOf("items");
|
||||
|
||||
|
||||
if (itemsIndex > -1 && path.length > itemsIndex + 1) {
|
||||
const itemIdx = path[itemsIndex + 1] as number;
|
||||
const facilityName = form.getValues(`items.${itemIdx}.ruseUtztnFcltNm`);
|
||||
if (facilityName) {
|
||||
prefix += `[${facilityName}] `;
|
||||
}
|
||||
|
||||
|
||||
const fcBizsIndex = path.indexOf("fcBizs");
|
||||
if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) {
|
||||
const bizIdx = path[fcBizsIndex + 1] as number;
|
||||
@@ -194,7 +194,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 최종 오류 메시지 출력
|
||||
toast.error(`${prefix}${message}`);
|
||||
});
|
||||
@@ -239,7 +239,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}
|
||||
}, [indexMng]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
@@ -266,7 +266,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
// ] as fcBizType[],
|
||||
// })
|
||||
// );
|
||||
append(createDefaultPbnstItem(selecTableRow, pbnstRes.length));
|
||||
append(createDefaultPbnstItem(selecTableRow, pbnstRes.length));
|
||||
|
||||
setIsRuseReg({ isModal: true });
|
||||
}
|
||||
@@ -366,24 +366,24 @@ export default function PublicReuseFaciltyInsert() {
|
||||
</ListDiv>
|
||||
</div>
|
||||
<ListDiv className="col-span-2 pr-6 ">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
{formWatch && formWatch[0]?.pbnstRuseFcltPk ? (
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="mng">
|
||||
시설정보
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="buse">
|
||||
차수별정보
|
||||
</TabsTrigger>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={form.handleSubmit(onSubmit, onInvalid)}
|
||||
className="!justify-end" // 저장 버튼 위치 조정
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
</TabsList>
|
||||
{formWatch && formWatch[0]?.pbnstRuseFcltPk ? (
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="mng">
|
||||
시설정보
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="buse">
|
||||
차수별정보
|
||||
</TabsTrigger>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={form.handleSubmit(onSubmit, onInvalid)}
|
||||
className="!justify-end" // 저장 버튼 위치 조정
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
</TabsList>
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<TabsContent className="max-h-full" value="mng">
|
||||
<PbnstMngForm
|
||||
formType="update"
|
||||
@@ -406,17 +406,19 @@ export default function PublicReuseFaciltyInsert() {
|
||||
indexBiz={indexBiz}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
) : (
|
||||
<>
|
||||
|
||||
</ScrollArea>
|
||||
</Tabs>
|
||||
) : (
|
||||
<>
|
||||
<div className="card-header text-2xl">
|
||||
등록된 재이용시설 정보가 없습니다.
|
||||
등록된 재이용시설 정보가 없습니다.
|
||||
</div>
|
||||
<div className="!mx-[1.6rem] !p-0r flex flex-col items-center justify-center h-64 border rounded-md">
|
||||
<p className="text-3xl mb-4">
|
||||
신규등록 버튼을 클릭하여 재이용시설을 등록해주세요.
|
||||
</p>
|
||||
<Button
|
||||
<div className="!mx-[1.6rem] !p-0r flex flex-col items-center justify-center h-64 border rounded-md">
|
||||
<p className="text-3xl mb-4">
|
||||
신규등록 버튼을 클릭하여 재이용시설을 등록해주세요.
|
||||
</p>
|
||||
<Button
|
||||
size={"sm"}
|
||||
className=""
|
||||
onClick={() => {
|
||||
@@ -433,11 +435,10 @@ export default function PublicReuseFaciltyInsert() {
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
</>
|
||||
|
||||
)}
|
||||
</ScrollArea>
|
||||
)}
|
||||
</ListDiv>
|
||||
<UiModal
|
||||
body={
|
||||
@@ -450,7 +451,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}
|
||||
}}
|
||||
|
||||
onInvalid ={onInvalid}
|
||||
onInvalid={onInvalid}
|
||||
></PbnstRegModal>
|
||||
}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function Home() {
|
||||
return state;
|
||||
}
|
||||
);
|
||||
const { rainRes,rainResCount } = rain;
|
||||
const { rainRes, rainResCount } = rain;
|
||||
const [rainForm, setRainForm] = useState<customRainBdst>();
|
||||
const [issNewReg, setIsNewReg] = useState<boolean>(false);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
@@ -48,26 +48,27 @@ export default function Home() {
|
||||
}, [rain.isInit, initRain]);
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
if (code.sggCd.length > 0) {
|
||||
if (rainRes && rainRes.length > 0) {
|
||||
const rainData = tableData(rainRes, { code }).map(
|
||||
(item: customRainBdst) => {
|
||||
let archArea =
|
||||
item?.archArea.split(".")[0] !== "-1"
|
||||
? item?.archArea.split(".")[0]
|
||||
: "확인불가";
|
||||
return {
|
||||
...item,
|
||||
archArea: archArea,
|
||||
|
||||
if(rainRes&& rainRes.length>0){
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const rainData = tableData(rainRes, { code }).map(
|
||||
(item: customRainBdst) => {
|
||||
let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가'
|
||||
return {
|
||||
...item,
|
||||
archArea:archArea,
|
||||
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
setbdstTable(rainData);
|
||||
}else{
|
||||
setbdstTable([]);
|
||||
}
|
||||
setbdstTable(rainData);
|
||||
} else {
|
||||
setbdstTable([]);
|
||||
}
|
||||
}
|
||||
}, [code, rainRes]);
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
@@ -117,7 +118,8 @@ export default function Home() {
|
||||
className=""
|
||||
size={"sm"}
|
||||
onClick={(e) => {
|
||||
rainSearch(searchTxt || "", pageNation, "41");
|
||||
rainSearch(searchTxt || "", 1, "41");
|
||||
//rainSearch(searchTxt || "", pageNation, "41");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
|
||||
@@ -39,12 +39,13 @@ export default function HtdflSttn() {
|
||||
const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { htdflSttnRes } = htdflSttn;
|
||||
const { htdflSttnRes, htdflSttnResCount } = htdflSttn;
|
||||
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<customRainBdst[]>();
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
|
||||
@@ -61,11 +62,12 @@ export default function HtdflSttn() {
|
||||
const excelClick = useCallback(() => {
|
||||
// 최신 검색 조건 반영
|
||||
const con = getConValue();
|
||||
htdflSttnSearch(true, 1, "20", String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [htdflSttnSearch, objSearch, code.cityCd, code.sggCd]);
|
||||
htdflSttnSearch(true, 1, String(htdflSttnResCount), String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [htdflSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, htdflSttnResCount]);
|
||||
|
||||
useEffect(() => {
|
||||
htdflSttnSearch(false, pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(false)
|
||||
}, [pageNation]);
|
||||
|
||||
const getSelCity = (val: string | number) => {
|
||||
@@ -120,7 +122,7 @@ export default function HtdflSttn() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!htdflSttn.isInit) {
|
||||
initHtdfl(1, "20", "0", fcltNm, code.cityCd, code.sggCd);
|
||||
initHtdfl(false, 1, "20", "0", fcltNm, code.cityCd, code.sggCd);
|
||||
}
|
||||
}, [htdflSttn.isInit, initHtdfl]);
|
||||
|
||||
@@ -181,8 +183,8 @@ export default function HtdflSttn() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
const con = getConValue();
|
||||
htdflSttnSearch(false, pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
htdflSttnSearch(false, 1, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(true)
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -219,11 +221,12 @@ export default function HtdflSttn() {
|
||||
}
|
||||
headlist={htdflSttn.htdflSttHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
total={htdflSttnResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index ?? undefined, headId);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
resetPageNo={resetPage}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
|
||||
@@ -30,8 +30,10 @@ export default function PbnstSttn() {
|
||||
pbnSttnInit,
|
||||
getPbnStnDetail,
|
||||
pbnNmSearch,
|
||||
getFlcts
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const { pbnstSttnRes, fclts,pbnstSttnResCount} =pbnstSttn
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
@@ -48,21 +50,21 @@ export default function PbnstSttn() {
|
||||
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
pbnstSttnSearch(true, String(pageNation), "20", ref.current, "", searchYear);
|
||||
}, [pbnstSttnSearch]);
|
||||
pbnstSttnSearch(true, String(pageNation), "100000", ref.current, pbnRuseNm, searchYear,fclts );
|
||||
}, [pbnstSttnSearch,fclts,pbnRuseNm]);
|
||||
|
||||
const cellCLick = useCallback(
|
||||
(index: number | undefined) => {
|
||||
if (
|
||||
index !== undefined &&
|
||||
pbnstSttn.pbnstSttnRes &&
|
||||
pbnstSttn.pbnstSttnRes[index]
|
||||
pbnstSttnRes &&
|
||||
pbnstSttnRes[index]
|
||||
) {
|
||||
const pbnstRuseFcltPk = pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk;
|
||||
const pbnstRuseFcltPk = pbnstSttnRes[index].pbnstRuseFcltPk;
|
||||
getPbnStnDetail(pbnstRuseFcltPk);
|
||||
}
|
||||
},
|
||||
[getPbnStnDetail, pbnstSttn.pbnstSttnRes]
|
||||
[getPbnStnDetail, pbnstSttnRes]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -71,31 +73,28 @@ export default function PbnstSttn() {
|
||||
pbnstSttn.excelList,
|
||||
"하수재이용시설 현황",
|
||||
"sample_pbnstSttn.xlsx",
|
||||
"A1:U2"
|
||||
"A1:U2",
|
||||
3
|
||||
);
|
||||
}
|
||||
}, [pbnstSttn.excelList]);
|
||||
useEffect(() => {
|
||||
if (!pbnstSttn.isInit) {
|
||||
pbnSttnInit("1", "20", ref.current, searchYear);
|
||||
getFlcts()
|
||||
|
||||
}
|
||||
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
|
||||
useEffect(() => {
|
||||
setBdstTable(pbnstSttn.pbnstSttnRes);
|
||||
}, [pbnstSttn.pbnstSttnRes]);
|
||||
if(pbnstSttnRes && pbnstSttnRes.length>0) {
|
||||
setBdstTable(pbnstSttnRes);
|
||||
}else{
|
||||
setBdstTable([]);
|
||||
}
|
||||
}, [pbnstSttnRes]);
|
||||
|
||||
// useEffect(() => {
|
||||
// pbnstSttnSearch("1", "20", ref.current, pbnRuseNm, searchYear);
|
||||
// }, [pageNation, ref.current, pbnRuseNm, searchYear, pbnstSttnSearch]);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (pbnRuseNm.length > 1)
|
||||
// pbnNmSearch(String(pageNation), "23", ref.current, pbnRuseNm, searchYear);
|
||||
// }, [pbnRuseNm,pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
pbnstSttnSearch(false, String(pageNation), "20", returnType, pbnRuseNm, searchYear);
|
||||
}, [pageNation]);
|
||||
useEffect(() =>{
|
||||
pbnSttnInit("1", "15", ref.current, searchYear, pbnstSttn.fclts);
|
||||
},[fclts])
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk)
|
||||
@@ -157,12 +156,14 @@ export default function PbnstSttn() {
|
||||
</div>
|
||||
}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
console.log("시군구코드", returnType)
|
||||
setReturnType(returnType);
|
||||
pbnstSttnSearch(false, "1", "20", returnType, pbnRuseNm, searchYear);
|
||||
pbnstSttnSearch(false, "1", "15", returnType, pbnRuseNm, searchYear, fclts);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void { }}
|
||||
initClick={function (): void {
|
||||
setPbnRuseNm('')
|
||||
|
||||
}}
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
isAdmin={false}
|
||||
@@ -179,8 +180,8 @@ export default function PbnstSttn() {
|
||||
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
|
||||
}
|
||||
headlist={pbnstSttn.pbnstSttHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
pageSize={15}
|
||||
total={pbnstSttnResCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellCLick(index);
|
||||
}}
|
||||
@@ -188,10 +189,11 @@ export default function PbnstSttn() {
|
||||
pbnstSttnSearch(
|
||||
false,
|
||||
String(page),
|
||||
String(20),
|
||||
String(15),
|
||||
ref.current,
|
||||
pbnRuseNm,
|
||||
searchYear
|
||||
searchYear,
|
||||
fclts
|
||||
);
|
||||
}}
|
||||
></UiTable>
|
||||
|
||||
@@ -39,13 +39,14 @@ export default function RainSttn() {
|
||||
const { code, rainSttn, rainSttnSearch, rainSttnInit } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { rainSttnRes } = rainSttn;
|
||||
const { rainSttnRes, rainSttnResCount } = rainSttn;
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<customRainBdst[]>();
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false })
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
@@ -96,7 +97,7 @@ export default function RainSttn() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainSttn.isInit) {
|
||||
rainSttnInit(1, "20", "0", fcltNm, code.cityCd, code.sggCd);
|
||||
rainSttnInit(false, 1, "20", "0", fcltNm, code.cityCd, code.sggCd);
|
||||
}
|
||||
}, [rainSttn.isInit, rainSttnInit]);
|
||||
|
||||
@@ -132,7 +133,8 @@ export default function RainSttn() {
|
||||
}, [code, rainSttnRes, rainSttn.rainSttHeadList]);
|
||||
|
||||
useEffect(() => {
|
||||
rainSttnSearch(pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
rainSttnSearch(false, pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(false)
|
||||
}, [pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -150,8 +152,8 @@ export default function RainSttn() {
|
||||
const excelClick = useCallback(() => {
|
||||
// 최신 검색 조건 반영
|
||||
const con = getConValue();
|
||||
rainSttnSearch(1, "10000", String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rainSttnSearch, objSearch, code.cityCd, code.sggCd]);
|
||||
rainSttnSearch(true, 1, String(rainSttnResCount), String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rainSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, rainSttnResCount]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -196,8 +198,8 @@ export default function RainSttn() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
const con = getConValue();
|
||||
rainSttnSearch(pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
rainSttnSearch(false, 1, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(true)
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -234,9 +236,10 @@ export default function RainSttn() {
|
||||
}
|
||||
headlist={rainSttn.rainSttHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
total={rainSttnResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
onPageChange={setPageNation}
|
||||
resetPageNo={resetPage}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
|
||||
@@ -40,6 +40,7 @@ export default function RswtSttn() {
|
||||
|
||||
const { rswtSttnRes, rswtSttnResCount } = rswtSttn;
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [bdstTable, setBdstTable] = useState<customRswtBdst[]>();
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
@@ -137,11 +138,13 @@ export default function RswtSttn() {
|
||||
const excelClick = useCallback(() => {
|
||||
// 최신 검색 조건 반영
|
||||
const con = getConValue();
|
||||
rswtSttnSearch(true, pageNation, String(rswtSttnResCount), String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, pageNation, fcltNm, rswtSttnResCount]);
|
||||
|
||||
rswtSttnSearch(true, 1, String(rswtSttnResCount), String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, rswtSttnResCount]);
|
||||
|
||||
useEffect(() => {
|
||||
rswtSttnSearch(false, pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(false)
|
||||
}, [pageNation]);
|
||||
|
||||
return (
|
||||
@@ -158,10 +161,9 @@ export default function RswtSttn() {
|
||||
label="시도"
|
||||
selectClass={""}
|
||||
selectArray={code.cityCd}
|
||||
onSelectValue={(val) => {
|
||||
getSelCity(val)
|
||||
setPageNation(1)
|
||||
}}
|
||||
onSelectValue={
|
||||
getSelCity
|
||||
}
|
||||
/>
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/6 h-full text-2xl ml-4"
|
||||
@@ -169,10 +171,9 @@ export default function RswtSttn() {
|
||||
selectClass={""}
|
||||
selectArray={selectSgg || []}
|
||||
value={objSearch.sgg} // value props 추가
|
||||
onSelectValue={(val) => {
|
||||
getSgg(val)
|
||||
setPageNation(1)
|
||||
}}
|
||||
onSelectValue={
|
||||
getSgg
|
||||
}
|
||||
/>
|
||||
<div className="col-span-2 flex flex-row space-x-2">
|
||||
<Label className="w-28 mt-2 text-xl text-gray-600">
|
||||
@@ -193,8 +194,8 @@ export default function RswtSttn() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
const con = getConValue();
|
||||
rswtSttnSearch(false, pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
rswtSttnSearch(false, 1, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(true)
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -234,6 +235,7 @@ export default function RswtSttn() {
|
||||
total={rswtSttnResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
onPageChange={setPageNation}
|
||||
resetPageNo={resetPage}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
|
||||
@@ -92,6 +92,7 @@ export default function Page() {
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
setRainPageNation(1);
|
||||
} else {
|
||||
rainChkInit(rainPageNation, rainPageSize, searchYear, commonCd);
|
||||
}
|
||||
@@ -104,6 +105,7 @@ export default function Page() {
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
setRswtPageNation(1);
|
||||
} else {
|
||||
rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd);
|
||||
}
|
||||
@@ -202,22 +204,22 @@ export default function Page() {
|
||||
const clickDelete = (data: number[], selFcltDiv: string) => {
|
||||
if (data.length > 0) {
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkDelete(data);
|
||||
rainChkDelete(data, searchYear);
|
||||
} else {
|
||||
rswtChkDelete(data);
|
||||
rswtChkDelete(data, searchYear);
|
||||
}
|
||||
}
|
||||
};
|
||||
const chkUpdateTable = (selFcltDiv: string) => {
|
||||
if (selFcltDiv === "RNB") {
|
||||
if (updateRainDetail && updateRainDetail.length > 0) {
|
||||
rainChkDetilUpdate(updateRainDetail);
|
||||
} else {
|
||||
rainChkDetilUpdate(updateRainDetail, searchYear);
|
||||
} else {
|
||||
toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
|
||||
}
|
||||
} else {
|
||||
if (updateRswtDetail && updateRswtDetail.length > 0) {
|
||||
rswtChkDetilsUpdate(updateRswtDetail);
|
||||
rswtChkDetilsUpdate(updateRswtDetail, searchYear);
|
||||
} else {
|
||||
toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
|
||||
}
|
||||
@@ -297,14 +299,14 @@ export default function Page() {
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
chkUpdateTable(selFcltDiv);
|
||||
}}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
chkUpdateTable(selFcltDiv);
|
||||
}}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom" sideOffset={5}>
|
||||
<h2 className="text-xl">
|
||||
@@ -314,7 +316,6 @@ export default function Page() {
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
@@ -343,7 +344,8 @@ export default function Page() {
|
||||
rainChkData={rainChkgdn.rainChk}
|
||||
pageNation={rainPageNation}
|
||||
onPageChange={rainPageChange}
|
||||
pageCount={rainChkgdn.rainChkCount} />
|
||||
pageCount={rainChkgdn.rainChkCount}
|
||||
/>
|
||||
) : (
|
||||
<RswtChkgdTable
|
||||
detaiRswtlUpdate={setUpdateRSwtDetail}
|
||||
@@ -380,6 +382,9 @@ export default function Page() {
|
||||
<ChkgdExcel
|
||||
type={selFcltDiv}
|
||||
setIsRegExcel={setIsRegExcel}
|
||||
setYearChange={(year) => {
|
||||
setSearchYear(year);
|
||||
}}
|
||||
></ChkgdExcel>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -37,13 +37,12 @@ import {
|
||||
type PrfType,
|
||||
} from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel";
|
||||
import data from "@common/components/ui/icon-finder/data";
|
||||
|
||||
export default function prfmncPrfmncReg() {
|
||||
const { code, prfmnc, prfmncHasuInit, prfmnRegData } = useWrStore(
|
||||
const { code, prfmnc, prfmncHasuInit, prfmnRegData,prfmncHasuNmSearch } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes } = prfmnc;
|
||||
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes,prfmncResCount } = prfmnc;
|
||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [isExcelOpen, setIsExcelOPen] = useState<{
|
||||
@@ -165,11 +164,17 @@ export default function prfmncPrfmncReg() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!prfmnc.isInit) {
|
||||
prfmncHasuInit(1, "41");
|
||||
const year = new Date().getFullYear()
|
||||
prfmncHasuInit(1, "41",String(year));
|
||||
}
|
||||
}, [prfmnc.isInit, prfmncHasuInit]);
|
||||
useEffect(() => {
|
||||
setbdstTable(prfmncRes);
|
||||
|
||||
|
||||
if(prfmncRes&&prfmncRes.length>0){
|
||||
|
||||
setbdstTable(prfmncRes);
|
||||
}
|
||||
|
||||
// cellNum이 0일 경우(첫 번째 행)도 유효한 인덱스이므로 undefined 여부만 체크합니다.
|
||||
if (cellNum !== undefined) {
|
||||
@@ -217,7 +222,17 @@ export default function prfmncPrfmncReg() {
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<div className="space-y">
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button size={"sm"} onClick={(e) => {}}>
|
||||
<Button size={"sm"} onClick={(e) => {
|
||||
|
||||
if(searchTxt&&searchTxt?.length>0){
|
||||
prfmncHasuNmSearch(1,'41',searchYear,searchTxt)
|
||||
setPageNation(1)
|
||||
}else{
|
||||
prfmncHasuInit(1,'41',searchYear)
|
||||
setPageNation(1)
|
||||
}
|
||||
|
||||
}}>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
@@ -260,13 +275,17 @@ export default function prfmncPrfmncReg() {
|
||||
tableData={bdstTable || []}
|
||||
headlist={pbnstPrfmncHeadList}
|
||||
pageSize={10}
|
||||
total={10000}
|
||||
total={prfmncResCount}
|
||||
headName={"하수재이용시설 목록"}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index);
|
||||
setCellNum(index ?? 0);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
onPageChange={
|
||||
(page) =>{
|
||||
prfmncHasuInit(page, "41",searchYear);
|
||||
setPageNation(page)
|
||||
}}
|
||||
children={undefined}
|
||||
/>
|
||||
</ScrollArea>
|
||||
@@ -299,11 +318,11 @@ export default function prfmncPrfmncReg() {
|
||||
data={isExcelOpen.data}
|
||||
setIsExcelOPen={(open) => {
|
||||
setIsExcelOPen({ ...isExcelOpen, isModal: open })
|
||||
|
||||
}}
|
||||
setModalExcelData={ async(excelData ) =>{
|
||||
await prfmnRegData(pageNation,'41',
|
||||
excelData,
|
||||
searchYear
|
||||
);
|
||||
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@ import type { EnvPartSelectDataType, SelectDataType } from "@common/business_com
|
||||
import { bdstFilterYn, bdstGrntchClass, bdstIncenYn, bdstUsgCd, chBuCd, dmdUszCd, erctUswtrPrcsMeth, htdPowerMthdCd, htdUtztnUsgCd, orgwtKndCd, pplLenght, pplQulity, rainFcltCd, rswtPrscCdMthdCd, ruseBizMthdCd, ruseMngMtd, rusePrcsMthdCd, ruseSeCd, yn } from "./basicCode";
|
||||
export const btnClass = "p-4 m-2 text-white rounded-sm text-lg font-medium "
|
||||
|
||||
|
||||
const laeSecd = '41'
|
||||
const ogdpSeCd = '0'
|
||||
|
||||
|
||||
export const buildingType = {
|
||||
RST:"RST",
|
||||
RNB:"RNB",
|
||||
@@ -167,6 +172,8 @@ export type comCodeState = {
|
||||
rswtPrscCdMthdCd:SelectDataType[];
|
||||
htdPowerMthdCd:SelectDataType[]
|
||||
htdUtztnUsgCd:SelectDataType[]
|
||||
userSiSggCd : string;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -203,6 +210,7 @@ export const comCodeStateExport: comCodeState = {
|
||||
rswtPrscCdMthdCd:rswtPrscCdMthdCd,
|
||||
htdPowerMthdCd:htdPowerMthdCd,
|
||||
htdUtztnUsgCd:htdUtztnUsgCd,
|
||||
userSiSggCd:laeSecd,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => {
|
||||
let message = "";
|
||||
if (response.status === 200) {
|
||||
message = "success";
|
||||
toast.success('수요처 정보가 변경되었습니다. ' )
|
||||
} else {
|
||||
message = "fail";
|
||||
}
|
||||
@@ -144,6 +145,8 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => {
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
toast.success('수요처 정보가 오류입니다. ' )
|
||||
|
||||
}
|
||||
},
|
||||
getRateFee: async (year: string) => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import moment from "moment";
|
||||
|
||||
export const excelCoSttnParsing = (data: any[]): string[][] => {
|
||||
export const excelCoSttnParsing = (data: any[],sidoCode:SelectDataType[] , sggCode:SelectDataType[]): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
String(item.cityText)??'',
|
||||
String(item.sggText)??'',
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString().trim() )?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString().trim() )?.text ?? "",
|
||||
item.dmdCoNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.dmdInfoPk ?? ""),
|
||||
|
||||
@@ -77,14 +77,13 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
||||
`/reuseFc/request/${pageNo}/${pageCnt}/${con}`
|
||||
);
|
||||
if (Number(pageCnt) >= 10000) {
|
||||
const coExcel = excelCoSttnParsing(coSttnRes.data);
|
||||
set((state: coSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
coSttn: {
|
||||
...state.coSttn,
|
||||
excelList: coExcel,
|
||||
isInit: false,
|
||||
excelList: coSttnRes.data,
|
||||
//isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { deleteFectch, fetchType, getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { deleteFectch, fetchType, getFetch, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import { z } from "zod";
|
||||
import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
|
||||
@@ -20,6 +20,8 @@ export type ldrmntState = {
|
||||
excelList: ExcelType[];
|
||||
isInit: boolean;
|
||||
ldrmntRes: customLdrmnt[];
|
||||
isLoading: boolean;
|
||||
ldrmntResCount: number;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -32,9 +34,10 @@ const excelDownList: ExcelType[] = [];
|
||||
type ldrmntActions = {
|
||||
ldrmntRegData: (data: any[]) => void,
|
||||
ldrmntInit: (con: string) => void
|
||||
ldrmntSearch: (page: number, sggCd: string, total: string, coNm: string) => void;
|
||||
ldrmntSearch: (isExcel:boolean, page: number, sggCd: string, total: string, coNm: string) => void;
|
||||
ldrmntUpdate: (ldrmntRes: customLdrmnt) => void;
|
||||
ldrmntDelete: () => void;
|
||||
loadingOpen: (isOpen: boolean) => void
|
||||
};
|
||||
|
||||
export type ldrmntType = ldrmntState & ldrmntActions;
|
||||
@@ -46,6 +49,8 @@ export const ldrmntStateExport: ldrmntState = {
|
||||
excelList: [],
|
||||
isInit: false,
|
||||
ldrmntRes: ldrmntRes,
|
||||
isLoading: false,
|
||||
ldrmntResCount: 1,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -55,7 +60,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
return {
|
||||
ldrmntInit: async (con: string) => {
|
||||
try {
|
||||
const ldrmntRes = await getFetch(
|
||||
const ldrmntRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/request/temp/1/20/${con}`
|
||||
);
|
||||
@@ -65,7 +70,8 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
...state,
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
ldrmntRes: ldrmntRes,
|
||||
ldrmntRes: ldrmntRes.data,
|
||||
ldrmntResCount: ldrmntRes.count,
|
||||
isInit: false,
|
||||
excelList: excelDownList,
|
||||
},
|
||||
@@ -75,33 +81,32 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
ldrmntRegData: async (data) => {
|
||||
try {
|
||||
const response = await postFectch(
|
||||
"/reuseFc/request/temp",
|
||||
data,
|
||||
fetchType.WR
|
||||
);
|
||||
|
||||
console.log('response ', response)
|
||||
|
||||
if (response.status === 200) {
|
||||
ToastFormUi({
|
||||
body: "잠재수요처 등록이 완료되었습니다. ",
|
||||
title: "잠재수요처 등록",
|
||||
});
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
ToastFormUi({
|
||||
body: "잠재수요처 등록이 실패하였습니다. ",
|
||||
title: "잠재수요처 등록",
|
||||
});
|
||||
|
||||
}
|
||||
loadingOpen: (isOpen) => {
|
||||
return set((state: ldrmntState) => {
|
||||
return {
|
||||
...state,
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
isLoading: isOpen,
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
ldrmntSearch: async (page: number, total: string, sggCd: string, coNm: string) => {
|
||||
ldrmntRegData: async (data) => {
|
||||
await deleteFectch(
|
||||
`/reuseFc/request/temp`,
|
||||
);
|
||||
|
||||
const response = await postFectch(
|
||||
"/reuseFc/request/temp",
|
||||
data,
|
||||
fetchType.WR
|
||||
);
|
||||
|
||||
console.log('response ', response)
|
||||
|
||||
},
|
||||
ldrmntSearch: async (isExcel:boolean, page: number, total: string, sggCd: string, coNm: string) => {
|
||||
let searchUrl = "";
|
||||
|
||||
if (sggCd !== "") {
|
||||
@@ -112,14 +117,14 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
}
|
||||
}
|
||||
try {
|
||||
const ldrmntRes = await getFetch(
|
||||
const ldrmntRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
searchUrl
|
||||
);
|
||||
|
||||
if (Number(total) > 5000) {
|
||||
console.log("알이에스", ldrmntRes)
|
||||
if (isExcel) {
|
||||
let excelDownList: ExcelType[] = [];
|
||||
ldrmntRes.forEach((item: customLdrmnt) => {
|
||||
ldrmntRes.data.forEach((item: customLdrmnt) => {
|
||||
excelDownList.push({
|
||||
ctpvCd: item.ctpvCd,
|
||||
sggCd: item.sggCd,
|
||||
@@ -135,7 +140,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
excelList: excelDownList,
|
||||
|
||||
ldrmntResCount: ldrmntRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -146,7 +151,8 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
...state,
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
ldrmntRes: ldrmntRes,
|
||||
ldrmntRes: ldrmntRes.data,
|
||||
ldrmntResCount: ldrmntRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
@@ -178,11 +184,30 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
},
|
||||
ldrmntDelete: async () => {
|
||||
try {
|
||||
set((state: ldrmntState) => {
|
||||
return {
|
||||
...state,
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
isLoading: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
const response = await deleteFectch(
|
||||
`/reuseFc/request/temp`,
|
||||
);
|
||||
|
||||
} catch (error) {
|
||||
console.log("error", error)
|
||||
set((state: ldrmntState) => {
|
||||
return {
|
||||
...state,
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
isLoading: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
console.error("Error ldrmntDelete:", error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -87,9 +87,6 @@ export const buildingToExcelType = (
|
||||
export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
const errors: string[] = [];
|
||||
const rainChkgdData: rainChkZodType[] = excelData.map((item: any) => {
|
||||
|
||||
|
||||
console.log('item ', item)
|
||||
if (item["점검일"] !== undefined) {
|
||||
const checkYmd = item["점검일"].replace(/\./g, "")
|
||||
let vltnDt = item["과태료 부과일(위반일)"]
|
||||
@@ -110,7 +107,6 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
flg: "RNB",
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
bdstNm:item["시설명"] ?? "",
|
||||
bdstRuseFcltFk: Number(item["NO"]),
|
||||
@@ -138,64 +134,67 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
}
|
||||
}).filter((el: any) => el !== undefined);
|
||||
|
||||
// ✨ 오류 검사 - 가공된 데이터 기준
|
||||
const isInvalidNumber = (val: any) =>
|
||||
val !== undefined && val !== null && val !== "" && isNaN(Number(val));
|
||||
return rainChkgdData;
|
||||
// // ✨ 오류 검사 - 가공된 데이터 기준
|
||||
// const isInvalidNumber = (val: any) =>
|
||||
// val !== undefined && val !== null && val !== "" && isNaN(Number(val));
|
||||
|
||||
const isInvalidDate = (val: any) =>
|
||||
typeof val === "string" && !/^\d{4}\.\d{2}\.\d{2}$/.test(val.trim());
|
||||
// const isInvalidDate = (val: any) =>
|
||||
// typeof val === "string" && !/^\d{4}\.\d{2}\.\d{2}$/.test(val.trim());
|
||||
|
||||
const buildErrorMessage = (item: any, issues: string[]): string => {
|
||||
const 시설명 = item.bdstNm ?? "";
|
||||
const 점검일 = item.chckYmd ?? "";
|
||||
const 이용용도 = item.utztnUsgCd ?? "";
|
||||
return `시설명: ${시설명}, 점검일: ${점검일}, 이용용도: ${이용용도} (=> ${issues.join(", ")})`;
|
||||
};
|
||||
// const buildErrorMessage = (item: any, issues: string[]): string => {
|
||||
// const 시설명 = item.bdstNm ?? "";
|
||||
// const 점검일 = item.chckYmd ?? "";
|
||||
// const 이용용도 = item.utztnUsgCd ?? "";
|
||||
// return `시설명: ${시설명}, 점검일: ${점검일}, 이용용도: ${이용용도} (=> ${issues.join(", ")})`;
|
||||
// };
|
||||
|
||||
if (rainChkgdData.length > 0) {
|
||||
rainChkgdData.forEach((rain: any) => {
|
||||
const item = rain.__origin; // 원본 item
|
||||
const issues: string[] = [];
|
||||
// if (rainChkgdData.length > 0) {
|
||||
// rainChkgdData.forEach((rain: any) => {
|
||||
// const item = rain.__origin; // 원본 item
|
||||
// const issues: string[] = [];
|
||||
|
||||
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
|
||||
issues.push(`점검일: 날짜 형식 아님 (${rain.chckYmd})`);
|
||||
}
|
||||
// if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
|
||||
// issues.push(`점검일: 날짜 형식 아님 (${rain.chckYmd})`);
|
||||
// }
|
||||
|
||||
if (rain.vltnDt && isInvalidDate(rain.vltnDt)) {
|
||||
issues.push(`과태료 부과일(위반일): 날짜 형식 아님 (${rain.vltnDt})`);
|
||||
}
|
||||
// if (rain.vltnDt && isInvalidDate(rain.vltnDt)) {
|
||||
// issues.push(`과태료 부과일(위반일): 날짜 형식 아님 (${rain.vltnDt})`);
|
||||
// }
|
||||
|
||||
// [
|
||||
// "연간운영비(원/년)", "PH", "탁도", "총대장균군수", "과태료부과금액(천원)"
|
||||
// ].forEach((key) => {
|
||||
// if (isInvalidNumber(item[key])) {
|
||||
// issues.push(`${key}: 숫자 형식 아님 (${item[key]})`);
|
||||
// }
|
||||
// }
|
||||
// // [
|
||||
// // "연간운영비(원/년)", "PH", "탁도", "총대장균군수", "과태료부과금액(천원)"
|
||||
// // ].forEach((key) => {
|
||||
// // if (isInvalidNumber(item[key])) {
|
||||
// // issues.push(`${key}: 숫자 형식 아님 (${item[key]})`);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// );
|
||||
// // );
|
||||
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
const month = `${i}월`;
|
||||
if (isInvalidNumber(item[`대체_${month}`])) {
|
||||
issues.push(`대체_${month}: 숫자 형식 아님 (${item[`대체_${month}`]})`);
|
||||
}
|
||||
if (isInvalidNumber(item[`빗물_${month}`])) {
|
||||
issues.push(`빗물_${month}: 숫자 형식 아님 (${item[`빗물_${month}`]})`);
|
||||
}
|
||||
}
|
||||
// for (let i = 1; i <= 12; i++) {
|
||||
// const month = `${i}월`;
|
||||
// if (isInvalidNumber(item[`대체_${month}`])) {
|
||||
// issues.push(`대체_${month}: 숫자 형식 아님 (${item[`대체_${month}`]})`);
|
||||
// }
|
||||
// if (isInvalidNumber(item[`빗물_${month}`])) {
|
||||
// issues.push(`빗물_${month}: 숫자 형식 아님 (${item[`빗물_${month}`]})`);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (issues.length > 0) {
|
||||
errors.push(buildErrorMessage(item, issues));
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (issues.length > 0) {
|
||||
// errors.push(buildErrorMessage(item, issues));
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
if (errors.length > 0) {
|
||||
return { rainChkgdData: [], errors };
|
||||
}
|
||||
// if (errors.length > 0) {
|
||||
// return { rainChkgdData: [], errors };
|
||||
// }
|
||||
|
||||
return { rainChkgdData, errors: [] };
|
||||
// return { rainChkgdData, errors: [] };
|
||||
|
||||
return rainChkgdData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ type rainChkgdnActions = {
|
||||
sggCd: string,
|
||||
searchTxt: string
|
||||
) => void;
|
||||
rainChkDetilUpdate(rainChk: rainChkZodType[]): Promise<void>;
|
||||
rainChkDetilUpdate(rainChk: rainChkZodType[] ,year:string) : Promise<void>;
|
||||
rainChkGuidUpdate(rainChk: rainChkZodType): Promise<void>;
|
||||
rainChkExcelDownload(
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): Promise<void>;
|
||||
rainChkExcelDataUPload(excelData: rainChkZodType[]): Promise<void>;
|
||||
rainChkDelete(chkgdnPks: number[]): Promise<void>;
|
||||
rainChkExcelDataUPload(excelData: rainChkZodType[] ,year :string) : Promise<void>;
|
||||
rainChkDelete(chkgdnPks: number[] ,year :string): Promise<void>;
|
||||
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void;
|
||||
rainChkNmSearch: (
|
||||
pageNo: number,
|
||||
@@ -165,7 +165,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
},
|
||||
}));
|
||||
},
|
||||
rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => {
|
||||
rainChkExcelDataUPload: async (excelData: rainChkZodType[] ,year:string) => {
|
||||
set((state: rainChkgdnType) => (
|
||||
{ rainChkgdn: { ...state.rainChkgdn, isLoading: true } }));
|
||||
try {
|
||||
@@ -175,7 +175,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
year,
|
||||
commonCd
|
||||
);
|
||||
set((state: rainChkgdnState) => ({
|
||||
@@ -255,7 +255,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
rainChkDetilUpdate: async (rainChk: rainChkZodType[]) => {
|
||||
rainChkDetilUpdate: async (rainChk: rainChkZodType[] ,year:string) => {
|
||||
try {
|
||||
const chData = await makeMdfrChk(rainChk, "rain", "rainDetil");
|
||||
|
||||
@@ -264,11 +264,10 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
toast.success(
|
||||
"지도점검 대체수 및 밋물이용량 수정이 완료되었습니다. "
|
||||
);
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
year,
|
||||
"41"
|
||||
);
|
||||
return set((state: rainChkgdnState) => ({
|
||||
@@ -317,18 +316,17 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
toast.error("지도점검 수질 및 과태료 수정 오류입니다.");
|
||||
}
|
||||
},
|
||||
rainChkDelete: async (chkgdnPks: number[]) => {
|
||||
rainChkDelete: async (chkgdnPks: number[] ,year :string) => {
|
||||
try {
|
||||
const res = await deleteFectch(`/reuseChk/rainy`, chkgdnPks);
|
||||
|
||||
if (res) {
|
||||
toast.success("삭제가 완료되었습니다. ");
|
||||
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
year,
|
||||
"41"
|
||||
);
|
||||
return set((state: rainChkgdnState) => ({
|
||||
|
||||
@@ -78,8 +78,8 @@ type rswtChkgdnActions = {
|
||||
sggCode: SelectDataType[]
|
||||
): Promise<void>;
|
||||
rswtChkExceDataUpload: (excelData: rswtChkZodType[]) => void;
|
||||
rswtChkDelete: (chkgdnPks: number[]) => void;
|
||||
rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[]) => void;
|
||||
rswtChkDelete: (chkgdnPks: number[] ,year:string) => void;
|
||||
rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[] ,year:string) => void;
|
||||
rswtChkPolAndGuide: (chkGdnPk: number) => void;
|
||||
rswtChkPolInit: () => void;
|
||||
rwstPolAndGuideUpdate: (rswtChk: rswtChkZodType[]) => void;
|
||||
@@ -189,7 +189,6 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
try {
|
||||
const rswtChkRes = await initFetch(pageNo, cnt, year, sggCd);
|
||||
|
||||
console.log("rswtChkRes", rswtChkRes)
|
||||
|
||||
set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
@@ -271,7 +270,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
}
|
||||
|
||||
},
|
||||
rswtChkDetilsUpdate: async (rswtChk: rswtrChkDetailsZodType[]) => {
|
||||
rswtChkDetilsUpdate: async (rswtChk: rswtrChkDetailsZodType[] ,year:string) => {
|
||||
try {
|
||||
const chData = await makeMdfrChk(rswtChk);
|
||||
|
||||
@@ -279,8 +278,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
if (res.ok) {
|
||||
toast.success("지도점검 과태료 수정이 완료되었습니다. ",)
|
||||
}
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, year, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
@@ -295,15 +293,14 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
|
||||
}
|
||||
},
|
||||
rswtChkDelete: async (chkgdnPks: number[]) => {
|
||||
rswtChkDelete: async (chkgdnPks: number[] ,year:string) => {
|
||||
try {
|
||||
const res = await deleteFectch(`/reuseChk/reuseWater`, chkgdnPks);
|
||||
|
||||
if (res) {
|
||||
toast.success("삭제가 완료되었습니다.")
|
||||
}
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, year, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
|
||||
@@ -15,6 +15,7 @@ export type pbnstPrfmncState = {
|
||||
pbnstPrfmncHeadList: TableUpperProps[];
|
||||
monthHeadList: TableUpperProps[];
|
||||
prfmncRes: FcPrfType[];
|
||||
prfmncResCount:number;
|
||||
excelList: Number[];
|
||||
pageKey:number
|
||||
};
|
||||
@@ -26,6 +27,7 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = {
|
||||
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
|
||||
monthHeadList: monthHeadList,
|
||||
prfmncRes: [],
|
||||
prfmncResCount:1,
|
||||
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
pageKey:1
|
||||
},
|
||||
@@ -34,16 +36,23 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = {
|
||||
export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
|
||||
|
||||
type pbnstPrfmncActions = {
|
||||
prfmncHasuInit: (page: number, sggOrCity: string) => void;
|
||||
prfmnRegData: (page:number,sggOrCity:string, data: PrfType) => void;
|
||||
prfmncHasuInit: (page: number, sggOrCity: string ,year:string) => void;
|
||||
prfmncHasuNmSearch: (page: number, sggOrCity: string , txt:string ,year:string) => void;
|
||||
prfmnRegData: (page:number,sggOrCity:string, data: PrfType,year:string) => void;
|
||||
};
|
||||
|
||||
const checkWrRegList = async () => {
|
||||
const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`);
|
||||
const checkWrRegList = async (year:string) => {
|
||||
|
||||
let url =`/reuseFc/pubDetailList`
|
||||
|
||||
if(year&& year.length>0){
|
||||
// url+=`/${year}`
|
||||
}
|
||||
const wrRegList = await getFetch("wr", url);
|
||||
return wrRegList;
|
||||
};
|
||||
const hasuListFetch = async (page: number, sggOrCity: string) => {
|
||||
const checkWrRegListRes = await checkWrRegList();
|
||||
const hasuListFetch = async (page: number, sggOrCity: string , year:string,searchNm?:string ) => {
|
||||
const checkWrRegListRes = await checkWrRegList(year);
|
||||
const rainRes = await postFectch(
|
||||
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
|
||||
checkWrRegListRes?.fcltCds,
|
||||
@@ -51,7 +60,7 @@ const hasuListFetch = async (page: number, sggOrCity: string) => {
|
||||
);
|
||||
|
||||
|
||||
const findData = rainRes.data.map((item: pubHasuType) => {
|
||||
let findData = rainRes.data.map((item: pubHasuType) => {
|
||||
const data = checkWrRegListRes?.fcPrfList.find(
|
||||
(fclt: FcPrfType) =>
|
||||
fclt.pbnstRuseFcltPk.substring(0, 11) === item?.bscFctCd
|
||||
@@ -68,22 +77,28 @@ const hasuListFetch = async (page: number, sggOrCity: string) => {
|
||||
prfList: data.prfList,
|
||||
});
|
||||
}
|
||||
});
|
||||
}).filter(Boolean); // undefined 값을 제거합니다.
|
||||
|
||||
return findData;
|
||||
if(searchNm){
|
||||
|
||||
findData= findData.filter((ruse:any) => ruse.ruseUtztnFcltNm.includes(searchNm))
|
||||
}
|
||||
|
||||
return {data:findData, count:findData.length};
|
||||
};
|
||||
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
prfmncHasuInit: async (page: number, sggOrCity: string) => {
|
||||
prfmncHasuInit: async (page: number, sggOrCity: string,year:string) => {
|
||||
try {
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity);
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity, year);
|
||||
return set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
prfmnc: {
|
||||
...state.prfmnc,
|
||||
prfmncRes: prfmncRes,
|
||||
prfmncRes: prfmncRes.data,
|
||||
prfmncResCount: prfmncRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -91,7 +106,23 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
prfmnRegData: async (page:number,sggOrCity:string,data: PrfType) => {
|
||||
prfmncHasuNmSearch: async (page: number, sggOrCity: string,fcltNm:string ,year:string)=> {
|
||||
try {
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity,fcltNm ,year);
|
||||
return set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
prfmnc: {
|
||||
...state.prfmnc,
|
||||
prfmncRes: prfmncRes.data,
|
||||
prfmncResCount: prfmncRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (errorHasu) {
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
prfmnRegData: async (page:number,sggOrCity:string,data: PrfType,year:string) => {
|
||||
try {
|
||||
const ressponse = await postFectch(
|
||||
"/reuseFc/pubFcPrf",
|
||||
@@ -102,12 +133,15 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
|
||||
if (ressponse.status === 200) {
|
||||
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity);
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity,year) ;
|
||||
|
||||
|
||||
return set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
prfmnc: {
|
||||
...state.prfmnc,
|
||||
prfmncRes: prfmncRes,
|
||||
prfmncRes: prfmncRes.data,
|
||||
prfmncResCount: prfmncRes.count,
|
||||
isInit: false,
|
||||
pageKey: state.prfmnc.pageKey + 1
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
export const htdTableHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "발전소명" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "daddr", title: "위치" },
|
||||
{ id: "frstArchPrmsnDt", title: "준공년도" },
|
||||
{ id: "archArea", title: "건축면적" },
|
||||
|
||||
@@ -177,7 +177,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
if (res.status) {
|
||||
toast.success("온배수 건축물 수정이 완료되었습니다.");
|
||||
}
|
||||
const htdflRes = await getFetch(
|
||||
const htdflRes = await getFetchWithCount(
|
||||
"wr",
|
||||
`/drain/facilityList/1/10/${code}`
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@ export const pubFacHeadListExport: TableUpperProps[] = [
|
||||
{ id: "bscFctNm", title: "시설명" },
|
||||
{ id: "addr", title: "위치" },
|
||||
{ id: "efflWqltStndrdNm", title: "지역구분" },
|
||||
{ id: "fctCpc", title: "시설용량" },
|
||||
{ id: "fctCpc", title: "시설용량(m³/일)" },
|
||||
{ id: "ruse", title: "재이용여부" },
|
||||
{ id: "rswtrYn", title: "등록여부" },
|
||||
];
|
||||
|
||||
@@ -28,8 +28,8 @@ const rainyObjSchema = z.object({
|
||||
|
||||
export const rainZod = z.object({
|
||||
bdstInfoPk: z.number().optional(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
ctpvCd: z.number().optional(),
|
||||
sggCd: z.number().optional(),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
@@ -83,6 +83,7 @@ type rainFacSActions = {
|
||||
rainSearch: (txt:string,pageNation:number,code:string|number) => void;
|
||||
rainBdstReg: (data: customRainBdst, code:string|number) => void;
|
||||
rainBdstUpdate: (data: customRainBdst, code:string|number) => void;
|
||||
|
||||
};
|
||||
|
||||
export type rainFacType = rainFacState & rainFacSActions;
|
||||
|
||||
@@ -11,7 +11,10 @@ export const baseReuseBuildingSchema = z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().nullish(),
|
||||
instlCst: z
|
||||
.number()
|
||||
.max(9_999_999, { message: "최대 9,999,999까지 입력 가능합니다." })
|
||||
.nullish(),
|
||||
operMngCd: z.string().optional().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default("Y"),
|
||||
|
||||
@@ -30,8 +30,8 @@ import toast from "react-hot-toast";
|
||||
|
||||
export const rswtZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
ctpvCd: z.number({ required_error: '시도를 선택하세요.' }),
|
||||
sggCd: z.number({ required_error: '시군구를 선택하세요.' }),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
@@ -182,7 +182,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
const chData = await makeRstr(data);
|
||||
const res = await postFectch("/reuseFc/waterreuseFc", chData);
|
||||
if (res.status===200) {
|
||||
if(data.chgBuilding.length > 0){
|
||||
if(data.chgBuilding.length>0 ){
|
||||
|
||||
const chPK = res?.data?.bdstInfoPk
|
||||
const makeCh= res.data.chgBuilding.map((item: chgBuilding) =>
|
||||
@@ -194,7 +194,9 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
const chch= await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
|
||||
if(chch.status ===200) {
|
||||
toast.success("건축물 등록이 완료되었습니다.");
|
||||
|
||||
console.log('chch.status' , chch.status)
|
||||
toast.success("건축물 및 증축/개축/중축 등록이 완료되었습니다.");
|
||||
}else{
|
||||
toast.error("건축물 증축/개축/중축 오류입니다.");
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
|
||||
|
||||
export const excelHtdflSttnParsing = (
|
||||
data: customHtdflBdst[],
|
||||
excel: customHtdflBdst[],
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excel.data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { z } from "zod";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import { excelHtdflSttnParsing } from "./excel";
|
||||
|
||||
@@ -18,16 +18,16 @@ export type htdflSttnState = {
|
||||
htdflSttNodeList: CommonTableProps[];
|
||||
htdflSttnRes: customHtdflBdst[]
|
||||
excelList: [];
|
||||
|
||||
htdflSttnResCount: number;
|
||||
};
|
||||
};
|
||||
type htdflSttnActions = {
|
||||
initHtdfl: (page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
htdflSttnSearch: (isExcel:boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
initHtdfl: (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
htdflSttnSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
htdflChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
) => void;
|
||||
@@ -42,12 +42,13 @@ export const htdflSttnStateExport: htdflSttnState = {
|
||||
htdflSttnRes: [],
|
||||
excelList: [],
|
||||
isInit: false,
|
||||
htdflSttnResCount: 1,
|
||||
},
|
||||
};
|
||||
const initFetch = async (page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
const htdflRes = await getFetch(
|
||||
const htdflRes = await getFetchWithCount(
|
||||
"wr",
|
||||
`/drain/facilityList` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
@@ -63,30 +64,44 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
initHtdfl: async (page: number, total: string, con: string, txt: string,
|
||||
initHtdfl: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const htdflSttnRes = await initFetch(page, total, con, txt, sidoCode, sggCode);
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
if (isExcel) {
|
||||
const htdflExcel = excelHtdflSttnParsing(htdflSttnRes, sidoCode, sggCode);
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
excelList: htdflExcel,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else {
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes.data,
|
||||
htdflSttnResCount: htdflSttnRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
htdflSttnSearch: async (isExcel:boolean, page: number, total: string, con: string, txt: string,
|
||||
htdflSttnSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const htdflSttnRes = await getFetch(
|
||||
const htdflSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/drain/facilityList` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
@@ -112,7 +127,8 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes,
|
||||
htdflSttnRes: htdflSttnRes.data,
|
||||
htdflSttnResCount: htdflSttnRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,15 +13,19 @@ export const excelPbnstSttnParsing = (data: any[]): string[][] => {
|
||||
String(item.gugun ?? ""),
|
||||
String(item.bscFctNm ?? ""),
|
||||
String(item.efflWqltStndrdNm ?? ""),
|
||||
String(item.fctCpc ?? ""),
|
||||
String(item.tel ?? ""),
|
||||
String(item.fctCpc ?? ""),
|
||||
String(item.ruseUtztnFcltNm ?? ""),
|
||||
String(item.fcltCpct ?? ""),
|
||||
String(item.splyExtraCpct ?? ""),
|
||||
String(item.ruseCpct ?? ""),
|
||||
String(item.usageTotal ?? ""),
|
||||
String(item.inUsage ?? ""),
|
||||
String(item.outUsage ?? ""),
|
||||
String(item.outUsage ?? ""),
|
||||
String(item.operMthd ?? ""),
|
||||
String(item.rprtvBzenty ?? ""),
|
||||
String(item.bgngDt ?? ""),
|
||||
String(item.endDt ?? ""),
|
||||
])
|
||||
})
|
||||
return excelExportData;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CommonTableProps, TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { z } from "zod";
|
||||
import { any, type z } from "zod";
|
||||
import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
@@ -27,7 +27,9 @@ export type pbnstSttnState = {
|
||||
ruseGuranteeHeadList: TableUpperProps[]
|
||||
ruseDmdHeadList: TableUpperProps[]
|
||||
ruseFcltHeadList: TableUpperProps[]
|
||||
pbnstSttnResCount:number;
|
||||
excelList: [];
|
||||
fclts:string[]
|
||||
isInit: boolean;
|
||||
};
|
||||
};
|
||||
@@ -41,12 +43,15 @@ type pbnstSttnActions = {
|
||||
reurnValue: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string,
|
||||
fclts:string[]
|
||||
) => void;
|
||||
getFlcts:()=>void;
|
||||
pbnSttnInit: (
|
||||
page: string,
|
||||
total: string,
|
||||
reurnValue: ReturnType,
|
||||
year: string
|
||||
year: string,
|
||||
flcts:string[]
|
||||
) => void;
|
||||
getPbnStnDetail: (pbnstRuseFcltPk: string) => void;
|
||||
pbnNmSearch: (
|
||||
@@ -71,9 +76,11 @@ export const pbnstSttnStateExport: pbnstSttnState = {
|
||||
ruseDmdHeadList: ruseDmdHeadListExport,
|
||||
ruseFcltHeadList: ruseFcltHeadListExport,
|
||||
pbnstSttnRes: [],
|
||||
pbnstSttnResCount:1,
|
||||
pbnstDetail: {} as customPbnst,
|
||||
pbnstSearchData: [],
|
||||
excelList: [],
|
||||
fclts:[],
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
@@ -83,105 +90,112 @@ const hasuListFetch = async (
|
||||
total: string,
|
||||
reurnValue: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string
|
||||
year: string,
|
||||
flcts:string[]
|
||||
) => {
|
||||
let url = `/prcsFclt/ruseInfo/`;
|
||||
|
||||
let url = "";
|
||||
if (reurnValue.partValue === "A") {
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${
|
||||
url+=`${page}/${total}/${reurnValue.partValue}/${
|
||||
// reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
|
||||
reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
|
||||
}/0/1/SW`
|
||||
} else if (reurnValue.partValue === "R") {
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue
|
||||
url += `${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue
|
||||
? reurnValue.regionValue
|
||||
: reurnValue.unitWaterShedValue
|
||||
? reurnValue.unitWaterShedValue
|
||||
: reurnValue.middleRegionValue
|
||||
}/0/1/SW`
|
||||
} else {
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue}/0/1/SW`
|
||||
} else if( reurnValue.partValue === 'G'){
|
||||
|
||||
console.log('reurnValue.sigunValue ', reurnValue.sidoValue)
|
||||
|
||||
console.log('reurnValue.sigunValue ', reurnValue.sigunValue)
|
||||
url += `${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
|
||||
|
||||
}else{
|
||||
url += `1/2/A/0/0/1/SW`
|
||||
}
|
||||
|
||||
if (searchNm && searchNm?.length > 0) {
|
||||
url += "/" + searchNm
|
||||
}
|
||||
|
||||
console.log("주소", url)
|
||||
const pbnList = await getFetch(fetchType.COMMON, url);
|
||||
console.log("pbnList", pbnList)
|
||||
const arrayList = pbnList.map((item: pubHasuType) => item.bscFctCd);
|
||||
console.log("어레이리스트", arrayList)
|
||||
const pbnList = await postFectch(url, flcts,fetchType.COMMON);
|
||||
const getRuseList = await postFectch(
|
||||
`/reuseFc/pubDetailList/${year}`,
|
||||
arrayList,
|
||||
flcts,
|
||||
fetchType.WR
|
||||
);
|
||||
console.log("getRuseList", getRuseList)
|
||||
const checkWrRegListRes = getRuseList.data;
|
||||
const count = getRuseList.count;
|
||||
|
||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||
(item: FcPrfType) => {
|
||||
const findData = pbnList.find(
|
||||
const findData = pbnList.data.find(
|
||||
(fclt: pubHasuType) =>
|
||||
fclt.bscFctCd === item.pbnstRuseFcltPk.substring(0, 11)
|
||||
);
|
||||
if(findData){
|
||||
|
||||
const usage = item.prfList.reduce(
|
||||
(acc, cur) => {
|
||||
acc.inUsage +=
|
||||
cur.wshwtr +
|
||||
cur.coolUswtr +
|
||||
cur.cleanUswtr +
|
||||
cur.drwtUswtr +
|
||||
cur.dltnUswtr +
|
||||
cur.ithlRswtr +
|
||||
cur.ithlEtcUswtr +
|
||||
cur.cleanToilUswtr +
|
||||
cur.resn;
|
||||
acc.outUsage +=
|
||||
cur.lndwtr +
|
||||
cur.hydUswtr +
|
||||
cur.ugwtChr +
|
||||
cur.farmUswtr +
|
||||
cur.rvrKeepUswtr +
|
||||
cur.indstUswtr;
|
||||
acc.total = acc.inUsage + acc.outUsage;
|
||||
const usage = item.prfList.reduce(
|
||||
(acc, cur) => {
|
||||
acc.inUsage +=
|
||||
cur.wshwtr +
|
||||
cur.coolUswtr +
|
||||
cur.cleanUswtr +
|
||||
cur.drwtUswtr +
|
||||
cur.dltnUswtr +
|
||||
cur.ithlRswtr +
|
||||
cur.ithlEtcUswtr +
|
||||
cur.cleanToilUswtr +
|
||||
cur.resn;
|
||||
acc.outUsage +=
|
||||
cur.lndwtr +
|
||||
cur.hydUswtr +
|
||||
cur.ugwtChr +
|
||||
cur.farmUswtr +
|
||||
cur.rvrKeepUswtr +
|
||||
cur.indstUswtr;
|
||||
acc.total = acc.inUsage + acc.outUsage;
|
||||
|
||||
return acc;
|
||||
},
|
||||
{ total: 0, inUsage: 0, outUsage: 0 }
|
||||
);
|
||||
|
||||
return {
|
||||
rvbsn: findData?.rvbsn ||'-',
|
||||
lgbsn: findData?.lgbsn||'-',
|
||||
mdmbsn: findData?.mdmbsn||'-',
|
||||
rgnNm: findData?.rgnNm||'-',
|
||||
sido: findData?.sido||'-',
|
||||
gugun: findData?.gugun||'-',
|
||||
bscFctNm: findData?.bscFctNm||'-',
|
||||
efflWqltStndrdNm: findData?.efflWqltStndrdNm||'-',
|
||||
fctCpc: Number(findData?.fctCpc)||0,
|
||||
tel: findData?.tel ?? "-",
|
||||
ruseUtztnFcltNm: item?.ruseUtztnFcltNm||'-',
|
||||
fcltCpct: item?.fcltCpct||'-',
|
||||
splyExtraCpct: item?.splyExtraCpct||'-',
|
||||
ruseCpct: item?.ruseCpct||'-',
|
||||
pbnstRuseFcltPk: item.pbnstRuseFcltPk||'-',
|
||||
usageTotal: usage?.total,
|
||||
inUsage: usage?.inUsage,
|
||||
outUsage: usage?.outUsage,
|
||||
operMthd: item.operList[0]?.operMthd||'-',
|
||||
rprtvBzenty: item.operList[0]?.rprtvBzenty,
|
||||
bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "",
|
||||
endDt: moment(item.operList[0]?.endDt).format("YYYY-MM-DD") ?? "",
|
||||
searchNm: findData?.bscFctNm||'-',
|
||||
searchPk: findData?.bscFctCd||'-',
|
||||
prfList: item?.prfList ?? []
|
||||
};
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{ total: 0, inUsage: 0, outUsage: 0 }
|
||||
);
|
||||
|
||||
return {
|
||||
rvbsn: findData?.rvbsn,
|
||||
lgbsn: findData?.lgbsn,
|
||||
mdmbsn: findData?.mdmbsn,
|
||||
rgnNm: findData?.rgnNm,
|
||||
sido: findData?.sido,
|
||||
gugun: findData?.gugun,
|
||||
bscFctNm: findData?.bscFctNm,
|
||||
efflWqltStndrdNm: findData?.efflWqltStndrdNm,
|
||||
fctCpc: findData.fctCpc,
|
||||
tel: findData?.tel ?? "-",
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
fcltCpct: item.fcltCpct,
|
||||
splyExtraCpct: item.splyExtraCpct,
|
||||
ruseCpct: item.ruseCpct,
|
||||
pbnstRuseFcltPk: item.pbnstRuseFcltPk,
|
||||
usageTotal: usage.total,
|
||||
inUsage: usage.inUsage,
|
||||
outUsage: usage.outUsage,
|
||||
operMthd: item.operList[0]?.operMthd,
|
||||
rprtvBzenty: item.operList[0]?.rprtvBzenty,
|
||||
bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "",
|
||||
endDt: moment(item.operList[0]?.endDt).format("YYYY-MM-DD") ?? "",
|
||||
searchNm: findData.bscFctNm,
|
||||
searchPk: findData.bscFctCd,
|
||||
prfList: item?.prfList ?? []
|
||||
};
|
||||
}
|
||||
);
|
||||
).filter(Boolean);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -189,6 +203,15 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
getFlcts:async ()=>{
|
||||
const fclts= await getFetch(fetchType.WR,'/reuseFc/pubFc')
|
||||
return set((state: pbnstSttnState) => ({
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
fclts:fclts
|
||||
},
|
||||
}));
|
||||
},
|
||||
pbnstChSttnHead: async (
|
||||
headList: z.infer<typeof sttnHeadListType>
|
||||
): Promise<void> => {
|
||||
@@ -209,22 +232,23 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
reurnValue: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string,
|
||||
fclts:string[]
|
||||
) => {
|
||||
try {
|
||||
console.log("여기")
|
||||
|
||||
|
||||
const pbnstSttnRes = await hasuListFetch(
|
||||
page,
|
||||
total,
|
||||
reurnValue,
|
||||
searchNm,
|
||||
year
|
||||
year,
|
||||
fclts,
|
||||
);
|
||||
|
||||
console.log("pbnstSttnRes", pbnstSttnRes);
|
||||
// if (Number(total) > 9000) {
|
||||
if (isExcel) {
|
||||
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -234,43 +258,48 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
},
|
||||
};
|
||||
});
|
||||
} else
|
||||
} else{
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
pbnstSttnRes: pbnstSttnRes,
|
||||
isInit: false,
|
||||
pbnstSttnResCount:pbnstSttnRes.length
|
||||
// isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (erTxt) {
|
||||
console.log("error", erTxt);
|
||||
}
|
||||
},
|
||||
pbnSttnInit: async (
|
||||
pbnSttnInit: async(
|
||||
page: string,
|
||||
total: string,
|
||||
reurnValue: ReturnType,
|
||||
year: string
|
||||
year: string,
|
||||
fclts:string[]
|
||||
) => {
|
||||
try {
|
||||
|
||||
const pbnstSttnRes = await hasuListFetch(
|
||||
page,
|
||||
total,
|
||||
reurnValue,
|
||||
undefined,
|
||||
year
|
||||
);
|
||||
page,
|
||||
total,
|
||||
reurnValue,
|
||||
undefined,
|
||||
year,
|
||||
fclts
|
||||
);
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
set( (state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
pbnstSttnRes: pbnstSttnRes,
|
||||
pbnstSttnResCount:pbnstSttnRes.length,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
@@ -321,6 +350,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
pbnstSearchData: pbnstSttnRes,
|
||||
pbnstSttnResCount:pbnstSttnRes.length,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -2,13 +2,13 @@ import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { customRainBdst } from "../../fcltReg/rainReg";
|
||||
|
||||
export const excelRainSttnParsing = (
|
||||
data: customRainBdst[],
|
||||
excel: customRainBdst[],
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excel.data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
|
||||
import {
|
||||
type customRainBdst,
|
||||
} from "../../fcltReg/rainReg";
|
||||
@@ -96,15 +96,16 @@ export type rainSttnState = {
|
||||
rainChkRes: rainChkZodType
|
||||
excelList: [];
|
||||
isInit: boolean;
|
||||
rainSttnResCount: number;
|
||||
};
|
||||
};
|
||||
type rainSttnActions = {
|
||||
rainSttnInit: (page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void
|
||||
rainSttnSearch: (page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
rainSttnInit: (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void
|
||||
rainSttnSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
rainChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
) => void;
|
||||
@@ -123,6 +124,7 @@ export const rainSttnStateExport: rainSttnState = {
|
||||
rainChkRes: rainChkRes,
|
||||
excelList: [],
|
||||
isInit: false,
|
||||
rainSttnResCount: 1,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -130,12 +132,12 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rainSttnInit: async (page: number, total: string, con: string, txt: string,
|
||||
rainSttnInit: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
|
||||
const rainSttnRes = await getFetch(
|
||||
const rainSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/rainyInfoList` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
@@ -143,33 +145,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rainSttn: {
|
||||
...state.rainSttn,
|
||||
rainSttnRes: rainSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
rainSttnSearch: async (page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const rainSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/rainyInfoList` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
(total ? `/${total}` : "/20") +
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
if (isExcel) {
|
||||
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
@@ -180,13 +156,54 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
|
||||
},
|
||||
};
|
||||
});
|
||||
} else {
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rainSttn: {
|
||||
...state.rainSttn,
|
||||
rainSttnRes: rainSttnRes.data,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
rainSttnSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const rainSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/rainyInfoList` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
(total ? `/${total}` : "/20") +
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
if (isExcel) {
|
||||
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rainSttn: {
|
||||
...state.rainSttn,
|
||||
excelList: rainExcel,
|
||||
rainSttnResCount: rainSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rainSttn: {
|
||||
...state.rainSttn,
|
||||
rainSttnRes: rainSttnRes,
|
||||
rainSttnRes: rainSttnRes.data,
|
||||
rainSttnResCount: rainSttnRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { bdstUsgCd } from "@/app/store/common/code/basicCode";
|
||||
|
||||
export const excelRSwtSttnParsing = (
|
||||
excel: customRswtBdst[],
|
||||
@@ -14,7 +15,7 @@ export const excelRSwtSttnParsing = (
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
item.bdstNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.bdstUsgCd === -1 || item.bdstUsgCd === undefined ? "확인불가" : item.bdstUsgCd ?? ""), //건축물용도
|
||||
bdstUsgCd.find((cd)=> cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
|
||||
String(item.frstArchPrmsnDt ?? ""),
|
||||
String(item.archArea.split('.')[0] === '-1' ? '확인불가' : item.archArea.split('.')[0]),
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
|
||||
|
||||
@@ -71,7 +71,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
console.log("rswtSttnResㅇㅇ", rswtSttnRes)
|
||||
if (isExcel) {
|
||||
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
|
||||
set((state: rswtSttnState) => {
|
||||
@@ -80,7 +79,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
excelList: rswtExcel,
|
||||
rswtSttnResCount: rswtSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -97,20 +95,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
},
|
||||
};
|
||||
});
|
||||
// }
|
||||
|
||||
// set((state: rswtSttnState) => {
|
||||
// return {
|
||||
// ...state,
|
||||
// rswtSttn: {
|
||||
// ...state.rswtSttn,
|
||||
// rswtSttnRes: rswtSttnRes.data,
|
||||
// rswtSttnResCount: rswtSttnRes.count,
|
||||
// excelList: rswtExcel,
|
||||
// isInit: false,
|
||||
// },
|
||||
// };
|
||||
// });
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
@@ -127,6 +111,12 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
console.log("주소",`/reuseFc/waterreuseFc` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
(total ? `/${total}` : "/20") +
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : ""))
|
||||
console.log("rswtSttnRes", rswtSttnRes)
|
||||
if (isExcel) {
|
||||
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
|
||||
set((state: rswtSttnState) => {
|
||||
@@ -135,7 +125,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
excelList: rswtExcel,
|
||||
rswtSttnResCount: rswtSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -24,6 +24,10 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
return state;
|
||||
});
|
||||
|
||||
const {userSiSggCd } =code
|
||||
const [useCityCd, setUserCityCd] = useState<SelectDataType[]>([])
|
||||
const [useSggCd, setUserSggCd] = useState<SelectDataType[]>([])
|
||||
|
||||
const { fields, append, remove } = useFieldArray({
|
||||
name: "chgBuilding",
|
||||
control: form?.control, // Provide a fallback to avoid errors
|
||||
@@ -52,6 +56,33 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
city: "",
|
||||
});
|
||||
|
||||
useEffect(() =>{
|
||||
if(userSiSggCd.length===2 && code.cityCd.length>0){
|
||||
const city = code.cityCd.filter((item) => item.val === userSiSggCd)
|
||||
const sgg = code.sggCd.filter((item) => item.val.slice(0,2) === userSiSggCd )
|
||||
sgg.unshift({text:'전체' , val:'0'})
|
||||
setUserCityCd(city) // Fix: Ensure city is of type SelectDataType[]
|
||||
setUserSggCd(sgg)
|
||||
if (city[0]?.val) {
|
||||
// 여기 중요
|
||||
queueMicrotask(() => {
|
||||
form.setValue("ctpvCd", Number(city[0]?.val), { shouldDirty: true, shouldTouch: true, shouldValidate: true });
|
||||
});
|
||||
}
|
||||
}else if(userSiSggCd.length===5 && code.cityCd.length>0 && code.sggCd.length>0) {
|
||||
const city = code.cityCd.filter((item) => item.val === userSiSggCd.slice(0,2))
|
||||
const sgg = code.sggCd.filter((item) => item.val === userSiSggCd)
|
||||
setUserSggCd(sgg)
|
||||
setUserCityCd(city)
|
||||
form.setValue('ctpvCd',Number(city[0]?.val) )
|
||||
form.setValue('sggCd',Number(sgg[0]?.val) )
|
||||
|
||||
}
|
||||
},[form, userSiSggCd, code.cityCd, code.sggCd])
|
||||
|
||||
|
||||
|
||||
|
||||
const getSelCity = (val: string) => {
|
||||
const data = getCity(val, code.sggCd);
|
||||
setSelectSgg(data);
|
||||
@@ -87,6 +118,12 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() =>{
|
||||
|
||||
console.log('form.formState ', form.watch())
|
||||
|
||||
},[form.formState])
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1 className={formH1Class}> { type !== "HTB"?"건축물 기본 정보": '시설 기본 정보'}</h1>
|
||||
@@ -101,12 +138,11 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
className="col-span-3"
|
||||
label={""}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.cityCd}
|
||||
selectArray={useCityCd}
|
||||
onSelectValue={(val) => {
|
||||
getSelCity(String(val));
|
||||
field.onChange(Number(val));
|
||||
}}
|
||||
value={field.value}
|
||||
value={typeof field.value !== "undefined" ? field.value : useCityCd[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -122,9 +158,8 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
className="col-span-3"
|
||||
label={""}
|
||||
selectClass={`w-full min-h-[2.9rem] ${selectClass}`}
|
||||
selectArray={selectSgg ? selectSgg : code.sggCd || []}
|
||||
selectArray={useSggCd}
|
||||
onSelectValue={(val) => {
|
||||
getSgg(val);
|
||||
field.onChange(Number(val));
|
||||
}}
|
||||
value={field.value}
|
||||
@@ -145,7 +180,10 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
className={selectClass}
|
||||
placeholder= {type !== "HTB"?"건축물 명 입력하세요":'시설명 입력하세요' }
|
||||
type="text"
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value)
|
||||
}}
|
||||
value={field.value||''}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -161,7 +199,10 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
className={selectClass}
|
||||
placeholder="위치를 입력해주세요"
|
||||
type="search"
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value)
|
||||
}}
|
||||
value={field.value||''}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -180,6 +221,9 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
value: field.value ?? new Date(),
|
||||
onChange: (date: Date | undefined) => field.onChange(date),
|
||||
}}
|
||||
// modifiers={{
|
||||
// disabled: { after: new Date() }
|
||||
// }}
|
||||
selectClass={"w-full"}
|
||||
></DatePicker>
|
||||
</FormUi>
|
||||
@@ -225,7 +269,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value)
|
||||
}}
|
||||
value={field.value}
|
||||
value={field.value||''}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -323,7 +367,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) {
|
||||
placeholder="-"
|
||||
type="text"
|
||||
onChange={(e) => f.onChange}
|
||||
value={f.value}
|
||||
value={f.value||''}
|
||||
className={selectClass}
|
||||
/>
|
||||
</FormUi>
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
hdtflZod,
|
||||
type customHtdflBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
import {
|
||||
formatCommaNumber,
|
||||
@@ -61,7 +61,7 @@ export default function HtdflRegForm({
|
||||
if (setIsModal) setIsModal(false);
|
||||
} else {
|
||||
|
||||
htdflBdstUpdate(values, "41");
|
||||
htdflBdstUpdate(values, "0");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,6 +89,16 @@ export default function HtdflRegForm({
|
||||
})),
|
||||
};
|
||||
};
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(()=>{
|
||||
if(isModal===true){
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
}else if(readonly===true){
|
||||
setDivStyle("h-[62vh]")
|
||||
}else{
|
||||
setDivStyle("h-[53vh]")
|
||||
}
|
||||
},[isModal,readonly]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
@@ -154,7 +164,7 @@ export default function HtdflRegForm({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<ScrollArea className="h-[37vh]">
|
||||
<ScrollArea className={divStyle}>
|
||||
{isModal && htdflForm != undefined ? (
|
||||
<BdstReg form={form} type="HTB" />
|
||||
) : (
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function RainRegForm({
|
||||
const defaultValues: z.infer<typeof rainZod> = rainZod.parse({});
|
||||
const form = useForm<z.infer<typeof rainZod>>({
|
||||
resolver: zodResolver(rainZod),
|
||||
defaultValues: defaultValues,
|
||||
// defaultValues: defaultValues,
|
||||
});
|
||||
const instlCst = form.watch(`reuseBuilding.0.instlCst`);
|
||||
|
||||
@@ -49,6 +49,17 @@ export default function RainRegForm({
|
||||
"reuseBuilding.0.rainyObj.filtrTrtmfctYn",
|
||||
]);
|
||||
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(()=>{
|
||||
if(isModal===true){
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
}else if(readonly===true){
|
||||
setDivStyle("h-[62vh]")
|
||||
}else{
|
||||
setDivStyle("h-[53vh]")
|
||||
}
|
||||
},[isModal,readonly]);
|
||||
|
||||
const cleanRainData = (raw: any): z.infer<typeof rainZod> => {
|
||||
const buildings =
|
||||
raw?.reuseBuilding && raw.reuseBuilding.length > 0
|
||||
@@ -81,6 +92,9 @@ export default function RainRegForm({
|
||||
})),
|
||||
};
|
||||
};
|
||||
useEffect(()=>{
|
||||
console.log("이즈모달", isModal)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (grntchBdstCertYn === "N") {
|
||||
@@ -161,7 +175,7 @@ export default function RainRegForm({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<ScrollArea className="h-[37vh]">
|
||||
<ScrollArea className={divStyle}>
|
||||
{isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>}
|
||||
{isModal ? (
|
||||
<h1 className="pl-3 text-xl col-span-10 mt-4">
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
} from "@common/business_components/ui";
|
||||
import { Button, Input, ScrollArea } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm, type UseFormReturn } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
@@ -40,12 +40,21 @@ export default function RswtrRegForm({
|
||||
const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
|
||||
const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({});
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(()=>{
|
||||
if(isModal===true){
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
}else if(readonly===true){
|
||||
setDivStyle("h-[62vh]")
|
||||
}else{
|
||||
setDivStyle("h-[53vh]")
|
||||
}
|
||||
},[isModal,readonly]);
|
||||
// const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof rswtZod>>({
|
||||
resolver: zodResolver(rswtZod),
|
||||
defaultValues: defaultValues,
|
||||
// defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
const [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctProcs] = form.watch([
|
||||
@@ -80,7 +89,7 @@ export default function RswtrRegForm({
|
||||
instlCmptnDt: item?.instlCmptnDt
|
||||
? new Date(item.instlCmptnDt)
|
||||
: new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화
|
||||
operMngCd: item?.operMngCd ?? "", // null → ""
|
||||
operMngCd: item?.operMngCd || "", // null → ""
|
||||
instlCstSprtYn: item?.instlCstSprtYn || code.yn[0]?.val, // null → "Y"
|
||||
grntchBdstCertYn: item?.grntchBdstCertYn || code.yn[0]?.val,
|
||||
rswtrObj: {
|
||||
@@ -151,7 +160,7 @@ export default function RswtrRegForm({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<ScrollArea className="h-[37vh]">
|
||||
<ScrollArea className={divStyle}>
|
||||
{isModal && rswtForm != undefined ? <BdstReg form={form} /> : <></>}
|
||||
{isModal ? (
|
||||
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
|
||||
@@ -192,7 +201,7 @@ export default function RswtrRegForm({
|
||||
const value = field.value;
|
||||
const isUnknown = value === null || value === -1; // 또는 Number(value) === -1
|
||||
return (
|
||||
<FormUi label="설치비">
|
||||
<FormUi label="설치비(원)">
|
||||
<Input
|
||||
className={selectClass}
|
||||
placeholder="1,000,000"
|
||||
@@ -271,7 +280,7 @@ export default function RswtrRegForm({
|
||||
selectClass={selectClass}
|
||||
selectArray={code.orgwtKndCd}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.orgwtKndCd[0]?.val}
|
||||
value={field.value || code.orgwtKndCd[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -290,7 +299,7 @@ export default function RswtrRegForm({
|
||||
label={""}
|
||||
selectArray={code.rswtPrscCdMthdCd}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.rswtPrscCdMthdCd[0]?.val}
|
||||
value={field.value || code.rswtPrscCdMthdCd[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -303,7 +312,7 @@ export default function RswtrRegForm({
|
||||
<h1 className={formH1Class}>인센티브 정보</h1>
|
||||
</div>
|
||||
<div>
|
||||
<h2 className={formH2Class}>설치비 지원</h2>
|
||||
<h2 className={formH2Class}>설치비(원) 지원</h2>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-2 mt-4">
|
||||
<div className="col-span-1">
|
||||
@@ -311,14 +320,14 @@ export default function RswtrRegForm({
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.instlCstSprtYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="설치비 지원여부">
|
||||
<FormUi label="설치비(원) 지원여부">
|
||||
<SelectBox
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.bdstIncenYn}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.bdstIncenYn[0]?.val}
|
||||
value={field.value || code.bdstIncenYn[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -471,7 +480,7 @@ export default function RswtrRegForm({
|
||||
label={""}
|
||||
selectArray={code.bdstGrntchClass}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.bdstGrntchClass[0]?.val}
|
||||
value={field.value || code.bdstGrntchClass[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
|
||||
@@ -23,7 +23,7 @@ import { useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setIsRegExcel:(open:boolean) =>void }) {
|
||||
export default function ChkgdExcel({ type,setIsRegExcel ,setYearChange }: { type: string, setIsRegExcel:(open:boolean) =>void ,setYearChange:(year:string)=> void }) {
|
||||
const { rswtChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload } =
|
||||
useWrStore((state) => {
|
||||
return state;
|
||||
@@ -71,22 +71,25 @@ export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setI
|
||||
if (file)
|
||||
if (type === "RNB") {
|
||||
filePicked(file, 0).then((res) => {
|
||||
if (res !== undefined){
|
||||
// if (res !== undefined){
|
||||
|
||||
const excelData = excelToRainChkData(res, form.getValues("chckYr"))
|
||||
|
||||
if( excelData&&excelData.errors.length>0){
|
||||
const excelData = excelToRainChkData(res, form.getValues("chckYr"))
|
||||
if(res !== undefined)
|
||||
setExcelData(excelData)
|
||||
// if( excelData&&excelData.errors.length>0){
|
||||
|
||||
excelData.errors.forEach((err) =>{
|
||||
toast.error(err)
|
||||
})
|
||||
}else{
|
||||
// excelData.errors.forEach((err) =>{
|
||||
// toast.error(err)
|
||||
// })
|
||||
// }else{
|
||||
|
||||
setExcelData(excelData.rainChkgdData)
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
} else if (type === "RST") {
|
||||
filePickedArray(file, 0).then((res) => {
|
||||
if (res && res?.length > 1) {
|
||||
@@ -165,9 +168,9 @@ export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setI
|
||||
|
||||
return;
|
||||
} else {
|
||||
|
||||
rainChkExcelDataUPload(excelData as rainChkZodType[]);
|
||||
rainChkExcelDataUPload(excelData as rainChkZodType[] , form.getValues("chckYr")) ;
|
||||
setIsRegExcel(false)
|
||||
setYearChange(form.getValues("chckYr"))
|
||||
}
|
||||
} else if (type === "RST") {
|
||||
if (excelRswtData === undefined || excelRswtData?.length === 0) {
|
||||
@@ -177,10 +180,11 @@ export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setI
|
||||
} else {
|
||||
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]);
|
||||
setIsRegExcel(false)
|
||||
setYearChange(form.getValues("chckYr"))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -213,6 +213,7 @@ export default function ChkgdModal({ type, obj, setIsModal }: { type: string; ob
|
||||
});
|
||||
obj.guideDetails = realGuideDetail;
|
||||
if (type === "RNB") {
|
||||
|
||||
rainChkGuidUpdate(obj);
|
||||
setIsModal(false)
|
||||
} else {
|
||||
|
||||
@@ -4,32 +4,39 @@ import type { customLdrmnt } from "@/app/store/matDmd/ldrmntCoSttn";
|
||||
import { names } from "@/app/store/matDmd/ldrmntCoSttn/excel";
|
||||
import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui";
|
||||
import { Form, FormField } from "@common/business_components/ui/form";
|
||||
import { Button, Progress } from "@common/components/ui";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
import { Button, Input, Progress } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function CoRegExcel() {
|
||||
|
||||
|
||||
export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => void }) {
|
||||
const { ldrmnt, loadingOpen } = useWrStore((state) => state);
|
||||
const { isLoading } = ldrmnt;
|
||||
const form = useForm<z.infer<typeof coRegExcel>>({
|
||||
resolver: zodResolver(coRegExcel),
|
||||
});
|
||||
const { ldrmntRegData, ldrmntDelete } = useWrStore((state) => state);
|
||||
const [excelData, setExcelData] = useState<customLdrmnt[]>();
|
||||
|
||||
|
||||
const [file, setFiles] = useState<File | undefined>();
|
||||
|
||||
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const selectedFile = e.target.files?.[0];
|
||||
if (selectedFile) {
|
||||
setFiles(selectedFile);
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = (values: z.infer<typeof coRegExcel>) => {
|
||||
ldrmntDelete();
|
||||
loadingOpen(true);
|
||||
if (file) {
|
||||
filePicked(file, 0).then((res) => {
|
||||
//TODO:loading
|
||||
filePicked(file, 0).then(async (res) => {
|
||||
|
||||
try {
|
||||
let array: { [key: string]: string | number }[] = []
|
||||
let isError = false;
|
||||
if (Array.isArray(res)) {
|
||||
res.some((item, index) => {
|
||||
let object: { [key: string]: string | number } = {}
|
||||
@@ -43,26 +50,24 @@ export default function CoRegExcel() {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
if (isError === true)
|
||||
return true;
|
||||
|
||||
array.push(object)
|
||||
|
||||
if (index != 0 && index % 5000 == 0) {
|
||||
ldrmntRegData(array);
|
||||
array = []
|
||||
array.length = 0;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
if (isError === false)
|
||||
ldrmntRegData(array);
|
||||
await ldrmntRegData(array);
|
||||
isModal(false);
|
||||
loadingOpen(false);
|
||||
toast.success(`잠재수요처 등록이 완료되었습니다.`);
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
loadingOpen(false);
|
||||
alert(e)
|
||||
return true;
|
||||
}
|
||||
|
||||
}).catch((e) => {
|
||||
console.log("file", e);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -70,6 +75,7 @@ export default function CoRegExcel() {
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<LoadingOverlay isLoading={isLoading}></LoadingOverlay>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<div>
|
||||
@@ -91,14 +97,13 @@ export default function CoRegExcel() {
|
||||
name="file"
|
||||
render={({ field }) => (
|
||||
<FormUi label="">
|
||||
<FileUpload
|
||||
files={file ? [file] : []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files && files?.length === 1) setFiles(files[0]);
|
||||
}}
|
||||
fileTypes=""
|
||||
maxFiles={1}
|
||||
></FileUpload>
|
||||
<div className="space-y-4 p-4">
|
||||
<Input
|
||||
type="file"
|
||||
onChange={handleFileChange}
|
||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
||||
/>
|
||||
</div>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -4,7 +4,12 @@ import {
|
||||
selectClass,
|
||||
type customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { ScrollArea, SelectBox, UiTable, type SelectDataType } from "@common/business_components";
|
||||
import {
|
||||
ScrollArea,
|
||||
SelectBox,
|
||||
UiTable,
|
||||
type SelectDataType,
|
||||
} from "@common/business_components";
|
||||
import { Button, Input, Label } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { getCity, tableData } from "@/components/lib/func/commom";
|
||||
@@ -15,83 +20,117 @@ import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
|
||||
|
||||
export type objSearchType = {
|
||||
sgg: string|number;
|
||||
city: string|number;
|
||||
};
|
||||
sgg: string | number;
|
||||
city: string | number;
|
||||
};
|
||||
//RNB(빗물), RST(중수도), HTB(온배수)
|
||||
type MoType = 'RNB' | 'RST' | 'HTB'; // 여기에 'htdf' 추가
|
||||
type MoType = "RNB" | "RST" | "HTB"; // 여기에 'htdf' 추가
|
||||
|
||||
type BdstTypeMap = {
|
||||
type BdstTypeMap = {
|
||||
RNB: customRainBdst;
|
||||
RST: customRswtBdst;
|
||||
HTB: customRswtBdst; // 해야해// 아직 아노딤
|
||||
HTB: customRswtBdst; // 해야해// 아직 아노딤
|
||||
};
|
||||
|
||||
interface BdstRegProps<T extends MoType> {
|
||||
interface BdstRegProps<T extends MoType> {
|
||||
moType: T;
|
||||
isModal:boolean;
|
||||
isModal: boolean;
|
||||
siSggCode?: string;
|
||||
setIsModal?: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export function BdstReg<T extends MoType>({ moType,setIsModal,isModal }: BdstRegProps<T>) {
|
||||
const { rain, code, bdst,findBdst } = useWrStore((state) => {
|
||||
export function BdstReg<T extends MoType>({
|
||||
moType,
|
||||
setIsModal,
|
||||
siSggCode,
|
||||
isModal,
|
||||
}: BdstRegProps<T>) {
|
||||
const { rain, code, bdst, findBdst } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
|
||||
const { userSiSggCd } = code;
|
||||
|
||||
const [bdstTable, setbdstTable] = useState<BdstTypeMap[T][]>();
|
||||
const [rainBdstForm, setRainBdstForm] = useState<BdstTypeMap[T]>({} as BdstTypeMap[T]);
|
||||
const [searchTxt, setSearchTxt] = useState<string>()
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({sgg:"",city:""});
|
||||
const [rainBdstForm, setRainBdstForm] = useState<BdstTypeMap[T]>(
|
||||
{} as BdstTypeMap[T]
|
||||
);
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({
|
||||
sgg: "",
|
||||
city: "",
|
||||
});
|
||||
const [useCityCd, setUserCityCd] = useState<SelectDataType[]>([]);
|
||||
const [useSggCd, setUserSggCd] = useState<SelectDataType[]>([]);
|
||||
const [dataCode, setDataCode] = useState<string>();
|
||||
|
||||
const getSelCity = (val: string | number) => {
|
||||
const cityValue = String(val); // Ensure val is treated as a string
|
||||
const data = getCity(cityValue, code.sggCd);
|
||||
const searchBdst = (searchTxt: string | undefined) => {
|
||||
let data = objSearch.city;
|
||||
|
||||
setSelectSgg(data);
|
||||
// getSgg(data[0]?.val || "");
|
||||
setObjSearch({ city: cityValue, sgg: '' });
|
||||
if (objSearch.sgg !== "" && objSearch.sgg !== "0") {
|
||||
data = objSearch.sgg;
|
||||
}
|
||||
//RNB(빗물), RST(중수도), HTB(온배수)
|
||||
findBdst(String(data), searchTxt || "", moType);
|
||||
};
|
||||
|
||||
const getSgg = (val: string | number) => {
|
||||
setObjSearch({...objSearch,sgg: String(val)})
|
||||
};
|
||||
|
||||
const searchBdst=(searchTxt: string | undefined)=>{
|
||||
let data =objSearch.city;
|
||||
if(objSearch.city==="" ){
|
||||
|
||||
data = String(code.cityCd[0]?.val)
|
||||
}
|
||||
if(objSearch.sgg !=="" ){
|
||||
data = objSearch.sgg
|
||||
}
|
||||
|
||||
//RNB(빗물), RST(중수도), HTB(온배수)
|
||||
findBdst(String(data), searchTxt || "",moType )
|
||||
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
|
||||
setbdstTable( tableData(bdst.bdstBase, { code }));
|
||||
}
|
||||
}, [ bdst]);
|
||||
const bdstData = bdst.bdstBase.map((bdst) => {
|
||||
let archArea =
|
||||
bdst?.archArea.split(".")[0] !== "-1"
|
||||
? bdst?.archArea.split(".")[0]
|
||||
: "확인불가";
|
||||
return {
|
||||
...bdst,
|
||||
archArea: archArea,
|
||||
};
|
||||
});
|
||||
setbdstTable(tableData(bdstData, { code }));
|
||||
}
|
||||
}, [bdst]);
|
||||
|
||||
useEffect(() => {
|
||||
if (userSiSggCd.length === 2 && code.cityCd.length > 0) {
|
||||
const city = code.cityCd.filter((item) => item.val === userSiSggCd);
|
||||
const sgg = code.sggCd.filter(
|
||||
(item) => item.val.slice(0, 2) === userSiSggCd
|
||||
);
|
||||
sgg.unshift({ text: "전체", val: "0" });
|
||||
setUserCityCd(city); // Fix: Ensure city is of type SelectDataType[]
|
||||
setObjSearch({ ...objSearch, city: String(city[0]?.val) });
|
||||
setUserSggCd(sgg);
|
||||
} else if (
|
||||
userSiSggCd.length === 5 &&
|
||||
code.cityCd.length > 0 &&
|
||||
code.sggCd.length > 0
|
||||
) {
|
||||
const city = code.cityCd.filter(
|
||||
(item) => item.val === userSiSggCd.slice(0, 2)
|
||||
);
|
||||
setUserCityCd(city);
|
||||
const sgg = code.sggCd.filter((item) => item.val === userSiSggCd);
|
||||
setUserSggCd(sgg);
|
||||
setObjSearch({ city: String(city[0]?.val), sgg: String(sgg[0]?.val) });
|
||||
}
|
||||
}, [userSiSggCd, code.cityCd, code.sggCd]);
|
||||
|
||||
const tableClick: (val: number | undefined , headId:string) => void = (val ,headId) => {
|
||||
|
||||
if(val!==undefined && bdst?.bdstBase.length>0){
|
||||
const data:BdstTypeMap[T] =bdst?.bdstBase[val]
|
||||
if (data) {
|
||||
setRainBdstForm(data);
|
||||
}
|
||||
const tableClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
) => {
|
||||
if (val !== undefined && bdst?.bdstBase.length > 0) {
|
||||
const data: BdstTypeMap[T] = bdst?.bdstBase[val];
|
||||
if (data) {
|
||||
setRainBdstForm(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
setbdstTable([]) // 초기화 작업
|
||||
},[])
|
||||
useEffect(() => {
|
||||
setbdstTable([]); // 초기화 작업
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-12 gap-4 mt-4 items-center">
|
||||
@@ -99,31 +138,50 @@ export function BdstReg<T extends MoType>({ moType,setIsModal,isModal }: BdstReg
|
||||
className="col-span-3 h-full"
|
||||
label={"시도"}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.cityCd || []}
|
||||
onSelectValue={getSelCity}
|
||||
>
|
||||
{""}
|
||||
</SelectBox>
|
||||
selectArray={useCityCd}
|
||||
onSelectValue={(val) => {
|
||||
setObjSearch({ ...objSearch, city: String(val) });
|
||||
}}
|
||||
value={objSearch.city || useCityCd[0]?.val}
|
||||
></SelectBox>
|
||||
<SelectBox
|
||||
className="col-span-3 h-full"
|
||||
label={"시군구"}
|
||||
selectClass={selectClass}
|
||||
selectArray={selectSgg || []}
|
||||
onSelectValue={getSgg}
|
||||
value={objSearch.sgg || ""}
|
||||
selectArray={useSggCd || []}
|
||||
onSelectValue={(val) => {
|
||||
if (val) setObjSearch({ ...objSearch, sgg: String(val) });
|
||||
}}
|
||||
value={objSearch.sgg || useSggCd[0]?.val}
|
||||
>
|
||||
{" "}
|
||||
</SelectBox>
|
||||
<Label className="w-full text-xl text-gray-600 text-right">시설명</Label>
|
||||
<Input className="w-full h-full !text-xl col-span-2 col-start-8" type="text" value={searchTxt || ''} onChange={(e) => setSearchTxt(e.target.value)}/>
|
||||
<Button className="" size={"sm"} onClick={()=>{searchBdst(searchTxt)}}>조회</Button>
|
||||
<Label className="w-full text-xl text-gray-600 text-right">
|
||||
시설명
|
||||
</Label>
|
||||
<Input
|
||||
className="w-full h-full !text-xl col-span-2 col-start-8"
|
||||
type="text"
|
||||
value={searchTxt || ""}
|
||||
onChange={(e) => setSearchTxt(e.target.value)}
|
||||
/>
|
||||
<Button
|
||||
className=""
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
searchBdst(searchTxt);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<div className="h-auto">
|
||||
<h1 className="text-2xl font-medium text-label pl-8">
|
||||
건축물 목록
|
||||
<span className="!text-2xl text-base text-blue-500">
|
||||
(유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 정보에 추가하여 주시기 바랍니다.)
|
||||
(유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물
|
||||
정보에 추가하여 주시기 바랍니다.)
|
||||
</span>
|
||||
</h1>
|
||||
<ScrollArea className="h-[30vh]">
|
||||
@@ -134,24 +192,40 @@ export function BdstReg<T extends MoType>({ moType,setIsModal,isModal }: BdstReg
|
||||
pageSize={-10}
|
||||
total={-1}
|
||||
headName={undefined}
|
||||
cellClick={(idx, headId) => (tableClick(idx, headId || ""))}
|
||||
cellClick={(idx, headId) => tableClick(idx, headId || "")}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}>
|
||||
</UiTable>
|
||||
}}
|
||||
></UiTable>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
{/* <ScrollArea className="h-[40vh]"> */}
|
||||
<div>
|
||||
{ moType === 'RNB'?
|
||||
<RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={isModal} setIsModal={setIsModal} />
|
||||
:moType==='RST'
|
||||
? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={isModal} setIsModal={(open) =>{setIsModal && setIsModal(open)}}></RswtrRegForm>
|
||||
:<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true} setIsModal={(open) =>{setIsModal && setIsModal(open)}}></HtdflRegForm>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div>
|
||||
{moType === "RNB" ? (
|
||||
<RainRegForm
|
||||
rainForm={rainBdstForm as customRainBdst}
|
||||
isModal={isModal}
|
||||
setIsModal={setIsModal}
|
||||
/>
|
||||
) : moType === "RST" ? (
|
||||
<RswtrRegForm
|
||||
rswtForm={rainBdstForm as customRswtBdst}
|
||||
isModal={isModal}
|
||||
setIsModal={(open) => {
|
||||
setIsModal && setIsModal(open);
|
||||
}}
|
||||
></RswtrRegForm>
|
||||
) : (
|
||||
<HtdflRegForm
|
||||
htdflForm={rainBdstForm as unknown as customHtdflBdst}
|
||||
isModal={true}
|
||||
setIsModal={(open) => {
|
||||
setIsModal && setIsModal(open);
|
||||
}}
|
||||
></HtdflRegForm>
|
||||
)}
|
||||
</div>
|
||||
{/* </ScrollArea> */}
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user