Merge commit 'f1054763e1e395f0fb665c5e8fa838d5376ed4d2' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run
iipbs_wr / build (push) Waiting to run
This commit is contained in:
@@ -14,7 +14,7 @@ import { useWrStore } from "../../../store";
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { confirmToast, tableData } from "@/components/lib/func/commom";
|
||||
import type {
|
||||
customPbnst,
|
||||
fcBizType,
|
||||
@@ -34,6 +34,7 @@ import { useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // F
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { z } from "zod";
|
||||
import { createDefaultPbnstItem } from "./utilsZod";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function PublicReuseFaciltyInsert() {
|
||||
const {
|
||||
@@ -46,7 +47,8 @@ export default function PublicReuseFaciltyInsert() {
|
||||
pubHasuSearch,
|
||||
pbnstRuseBizUpdate,
|
||||
} = useWrStore((state) => state);
|
||||
const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst;
|
||||
const { t } = useTranslation("base");
|
||||
const { pubFacHeadList, pbnstHasuResCount, pbnstHasuRes, pbnstRes } = pbnst;
|
||||
const [, setCurrentTab] = useState<string>("mng");
|
||||
const [isRuseReg, setIsRuseReg] = useState<{
|
||||
isModal: boolean;
|
||||
@@ -108,28 +110,31 @@ export default function PublicReuseFaciltyInsert() {
|
||||
};
|
||||
});
|
||||
|
||||
Promise.allSettled([
|
||||
pbnstRuseFcltUpdate(pbnst as customPbnst[]),
|
||||
pbnstRuseBizUpdate(bizs),
|
||||
]).then(([resFclt, resBiz]) => {
|
||||
const isFcltSuccess = resFclt.status === "fulfilled";
|
||||
const isBizSuccess = resBiz.status === "fulfilled";
|
||||
if (isFcltSuccess && isBizSuccess) {
|
||||
toast.success("하수 재이용 시설 및 사업이 수정되었습니다. ");
|
||||
// 메시지 표시, 페이지 이동 등
|
||||
} else {
|
||||
let message = "";
|
||||
// ✅ 각각 어떤 항목이 실패했는지도 로그/알림 처리
|
||||
if (!isFcltSuccess) {
|
||||
message = "하수재이용 시설 ";
|
||||
const handleConfirm = async () => {
|
||||
Promise.allSettled([
|
||||
pbnstRuseFcltUpdate(pbnst as customPbnst[]),
|
||||
pbnstRuseBizUpdate(bizs),
|
||||
]).then(([resFclt, resBiz]) => {
|
||||
const isFcltSuccess = resFclt.status === "fulfilled";
|
||||
const isBizSuccess = resBiz.status === "fulfilled";
|
||||
if (isFcltSuccess && isBizSuccess) {
|
||||
toast.success("하수 재이용 시설 및 사업이 수정되었습니다. ");
|
||||
// 메시지 표시, 페이지 이동 등
|
||||
} else {
|
||||
let message = "";
|
||||
// ✅ 각각 어떤 항목이 실패했는지도 로그/알림 처리
|
||||
if (!isFcltSuccess) {
|
||||
message = "하수재이용 시설 ";
|
||||
}
|
||||
if (!isBizSuccess) {
|
||||
message += "하수재이용 시설 사업 ";
|
||||
}
|
||||
toast.error(message + "오류 입니다 ");
|
||||
pubHasuInit("1", "41");
|
||||
}
|
||||
if (!isBizSuccess) {
|
||||
message += "하수재이용 시설 사업 ";
|
||||
}
|
||||
toast.error(message + "오류 입니다 ");
|
||||
pubHasuInit("1", "41");
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
confirmToast(t("isUpdatetMsg"), handleConfirm);
|
||||
};
|
||||
|
||||
// 폼 유효성 검사 실패 시 호출될 함수
|
||||
@@ -230,7 +235,6 @@ export default function PublicReuseFaciltyInsert() {
|
||||
useEffect(() => {
|
||||
if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) {
|
||||
form.reset({ items: pbnst.pbnstRes });
|
||||
|
||||
} else {
|
||||
form.reset({ items: [] });
|
||||
}
|
||||
@@ -238,14 +242,16 @@ export default function PublicReuseFaciltyInsert() {
|
||||
|
||||
const appendPbnstRuseFclt = useCallback(() => {
|
||||
if (pbnstRes && pbnstRes.length > 0) {
|
||||
if (selectRow) { // pbnstRes.length를 사용하여 새로운 항목의 인덱스를 결정
|
||||
append(createDefaultPbnstItem(selectRow, pbnstRes.length));
|
||||
if (selectRow) {
|
||||
// pbnstRes.length를 사용하여 새로운 항목의 인덱스를 결정
|
||||
append(createDefaultPbnstItem(selectRow, pbnstRes.length));
|
||||
setIsRuseReg({ isModal: true });
|
||||
}
|
||||
} else {
|
||||
if (selectRow) { // pbnstRes가 비어있으면 첫 항목이므로 인덱스 0
|
||||
if (selectRow) {
|
||||
// pbnstRes가 비어있으면 첫 항목이므로 인덱스 0
|
||||
|
||||
append(createDefaultPbnstItem(selectRow, 0));
|
||||
append(createDefaultPbnstItem(selectRow, 0));
|
||||
setIsRuseReg({ isModal: true });
|
||||
}
|
||||
}
|
||||
@@ -277,14 +283,12 @@ export default function PublicReuseFaciltyInsert() {
|
||||
className=""
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
if(searchTxt && searchTxt?.length > 0) {
|
||||
pubHasuSearch(String(pageNation), "41", searchTxt)
|
||||
|
||||
}else{
|
||||
pubHasuInit(String(pageNation), "41");
|
||||
}
|
||||
isResetPage(true);
|
||||
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
pubHasuSearch(String(pageNation), "41", searchTxt);
|
||||
} else {
|
||||
pubHasuInit(String(pageNation), "41");
|
||||
}
|
||||
isResetPage(true);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -322,7 +326,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
tableData={bdstTable || []}
|
||||
headlist={pubFacHeadList}
|
||||
pageSize={10}
|
||||
total={100000}
|
||||
total={pbnstHasuResCount || 20}
|
||||
headName={"공공 하수처리시설 목록"}
|
||||
cellClick={cellClick}
|
||||
onPageChange={setPageNation}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
type chgBuilding,
|
||||
type customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
@@ -35,10 +33,6 @@ export default function Home() {
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [bdstTable, setbdstTable] = useState<customRainBdst[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
useEffect(() => {
|
||||
setIsNewReg(false);
|
||||
@@ -60,7 +54,6 @@ export default function Home() {
|
||||
...item,
|
||||
archArea: archArea,
|
||||
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -71,26 +64,13 @@ export default function Home() {
|
||||
}
|
||||
}
|
||||
}, [code, rainRes]);
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
const cellClick: (val: number | undefined) => void = (
|
||||
val
|
||||
) => {
|
||||
if (val !== undefined) {
|
||||
setRainForm(rainRes[val]);
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
rainRes[val]?.bdstInfoPk != null &&
|
||||
rainRes[val]?.chgBuilding.length > 0
|
||||
) {
|
||||
bdstChgModal(rainRes[val].chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -149,8 +129,8 @@ export default function Home() {
|
||||
pageSize={20}
|
||||
total={rainResCount}
|
||||
headName={"건축물 목록"}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
cellClick={(val) => {
|
||||
cellClick(val);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
></UiTable>
|
||||
@@ -183,17 +163,6 @@ export default function Home() {
|
||||
}}
|
||||
/>
|
||||
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
|
||||
<Toaster position="top-center" />
|
||||
</ContentsDiv>
|
||||
</>
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
@@ -32,10 +30,6 @@ export default function Home() {
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [selectVal, setSelect] = useState<number>();
|
||||
const [bdstTable, setbdstTable] = useState<customRswtBdst[]>();
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
const { rswtRes, rswtResCount } = rswt;
|
||||
useEffect(() => {
|
||||
if (!rswt.isInit) {
|
||||
@@ -77,28 +71,16 @@ export default function Home() {
|
||||
}, [rswtRes, selectVal]);
|
||||
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
val
|
||||
) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
setSelect(val);
|
||||
// setRswtForm(rswtRes[val]);
|
||||
}
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
rswtRes[val]?.bdstInfoPk != null &&
|
||||
rswtRes[val]?.chgBuilding?.length > 0
|
||||
) {
|
||||
bdstChgModal(rswtRes[val].chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getRswtBdstData(pageNation, "41");
|
||||
}, [pageNation]);
|
||||
@@ -184,16 +166,6 @@ export default function Home() {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
|
||||
<Toaster position="top-center" />
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import type {
|
||||
chgBuilding,
|
||||
customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
excelDownload,
|
||||
getCity,
|
||||
tableData
|
||||
tableData,
|
||||
} from "@/components/lib/func/commom";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
@@ -25,7 +22,7 @@ import {
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
type SelectDataType
|
||||
type SelectDataType,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
@@ -43,24 +40,24 @@ export default function RainSttn() {
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<customRainBdst[]>();
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const isDownloadTriggered = useRef(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<{
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({
|
||||
sgg: "",
|
||||
city: "",
|
||||
});
|
||||
const [detailModal, setDetailModal] = useState<{
|
||||
isOpen: boolean;
|
||||
chBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chBuilding: [] });
|
||||
data: customRainBdst | undefined;
|
||||
}>({ data: undefined, isOpen: false });
|
||||
|
||||
const [fcltNm, setFcltNm] = useState<string>("");
|
||||
const { t } = useTranslation('base');
|
||||
const cellClick = (index: number | undefined, headId: string) => {
|
||||
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
setDetailModal({ isOpen: true, data: bdstTable[index] })
|
||||
} else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
if (bdstTable[index] && bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null) {
|
||||
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
|
||||
}
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
const cellClick = (index: number | undefined) => {
|
||||
if (index !== undefined && bdstTable !== undefined) {
|
||||
setDetailModal({ isOpen: true, data: bdstTable[index] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,13 +69,14 @@ export default function RainSttn() {
|
||||
} else {
|
||||
const data = getCity(cityValue, code.sggCd);
|
||||
setSelectSgg(data);
|
||||
const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? "");
|
||||
const firstSggVal =
|
||||
data.find((item) => item.val === "0")?.val || (data[0]?.val ?? "");
|
||||
setObjSearch({ city: cityValue, sgg: firstSggVal });
|
||||
}
|
||||
};
|
||||
|
||||
const getSgg = (val: string | number) => {
|
||||
setObjSearch({ ...objSearch, sgg: String(val) })
|
||||
setObjSearch({ ...objSearch, sgg: String(val) });
|
||||
};
|
||||
|
||||
const getConValue = () => {
|
||||
@@ -105,23 +103,29 @@ export default function RainSttn() {
|
||||
...item,
|
||||
...item.reuseBuilding[0],
|
||||
...item.reuseBuilding[0].rainyObj,
|
||||
dtfcltCpct: item.reuseBuilding[0].rainyObj.dtfcltCpct === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].rainyObj.dtfcltCpct,
|
||||
instlCst: item.reuseBuilding[0].instlCst === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].instlCst,
|
||||
instlCstSprtAmt: item.reuseBuilding[0].instlCstSprtAmt === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].instlCstSprtAmt,
|
||||
dtfcltCpct:
|
||||
item.reuseBuilding[0].rainyObj.dtfcltCpct === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].rainyObj.dtfcltCpct,
|
||||
instlCst:
|
||||
item.reuseBuilding[0].instlCst === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].instlCst,
|
||||
instlCstSprtAmt:
|
||||
item.reuseBuilding[0].instlCstSprtAmt === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].instlCstSprtAmt,
|
||||
chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N",
|
||||
pntfColArea: item.reuseBuilding[0].rainyObj.pntfColArea === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].rainyObj.pntfColArea,
|
||||
filtrTrtmfctCpct: item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct,
|
||||
archArea: Math.floor(item.archArea) === -1 ? "확인불가" : item.archArea,
|
||||
pntfColArea:
|
||||
item.reuseBuilding[0].rainyObj.pntfColArea === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].rainyObj.pntfColArea,
|
||||
filtrTrtmfctCpct:
|
||||
item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct === -1
|
||||
? "확인불가"
|
||||
: item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct,
|
||||
archArea:
|
||||
Math.floor(item.archArea) === -1 ? "확인불가" : item.archArea,
|
||||
};
|
||||
})
|
||||
.filter((item: any) => item.rainyObj !== undefined);
|
||||
@@ -129,8 +133,16 @@ export default function RainSttn() {
|
||||
}, [code, rainSttnRes]);
|
||||
|
||||
useEffect(() => {
|
||||
rainSttnSearch(false, pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(false)
|
||||
rainSttnSearch(
|
||||
false,
|
||||
pageNation,
|
||||
"20",
|
||||
String(getConValue()),
|
||||
fcltNm,
|
||||
code.cityCd,
|
||||
code.sggCd
|
||||
);
|
||||
isResetPage(false);
|
||||
}, [pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -145,15 +157,30 @@ export default function RainSttn() {
|
||||
"A1:W3"
|
||||
);
|
||||
} else {
|
||||
toast.error(t('excelDownErrMsg'));
|
||||
toast.error(t("excelDownErrMsg"));
|
||||
}
|
||||
isDownloadTriggered.current = false;
|
||||
}, [rainSttn.excelList]);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
isDownloadTriggered.current = true;
|
||||
rainSttnSearch(true, 1, String(rainSttnResCount), String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rainSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, rainSttnResCount]);
|
||||
rainSttnSearch(
|
||||
true,
|
||||
1,
|
||||
String(rainSttnResCount),
|
||||
String(getConValue()),
|
||||
fcltNm,
|
||||
code.cityCd,
|
||||
code.sggCd
|
||||
);
|
||||
}, [
|
||||
rainSttnSearch,
|
||||
objSearch,
|
||||
code.cityCd,
|
||||
code.sggCd,
|
||||
fcltNm,
|
||||
rainSttnResCount,
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -192,14 +219,21 @@ export default function RainSttn() {
|
||||
</div>
|
||||
</div>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight
|
||||
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<div className="flex flex-row space-x-2 items-center">
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
rainSttnSearch(false, 1, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
isResetPage(true)
|
||||
rainSttnSearch(
|
||||
false,
|
||||
1,
|
||||
"20",
|
||||
String(getConValue()),
|
||||
fcltNm,
|
||||
code.cityCd,
|
||||
code.sggCd
|
||||
);
|
||||
isResetPage(true);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -234,7 +268,9 @@ export default function RainSttn() {
|
||||
headlist={rainSttn.rainSttHeadList}
|
||||
pageSize={20}
|
||||
total={rainSttnResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
cellClick={(index: number | undefined) => {
|
||||
cellClick(index ?? undefined);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
resetPageNo={resetPage}
|
||||
>
|
||||
@@ -267,16 +303,6 @@ export default function RainSttn() {
|
||||
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
|
||||
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data} />}
|
||||
/>
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
<Toaster position="top-center" />
|
||||
</>
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import {
|
||||
excelDownload,
|
||||
getCity,
|
||||
tableData
|
||||
} from "@/components/lib/func/commom";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
@@ -45,24 +43,13 @@ export default function RswtSttn() {
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false })
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chBuilding: [] });
|
||||
const [fcltNm, setFcltNm] = useState<string>("");
|
||||
const { t } = useTranslation('base');
|
||||
const cellClick = (index: number | undefined, headId: string) => {
|
||||
const cellClick = (index: number | undefined) => {
|
||||
|
||||
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
if ( index !== undefined && bdstTable !== undefined) {
|
||||
setDetailModal({ isOpen: true, data: bdstTable[index] })
|
||||
} else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
if (
|
||||
bdstTable[index] &&
|
||||
bdstTable[index]?.chBuildingYn === 'Y'
|
||||
) {
|
||||
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getSelCity = (val: string | number) => {
|
||||
@@ -232,7 +219,7 @@ export default function RswtSttn() {
|
||||
headlist={rswtSttn.rswtSttHeadList}
|
||||
pageSize={20}
|
||||
total={rswtSttnResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
cellClick={(index: number | undefined) => { cellClick(index ?? undefined) }}
|
||||
onPageChange={setPageNation}
|
||||
resetPageNo={resetPage}
|
||||
>
|
||||
@@ -266,16 +253,6 @@ export default function RswtSttn() {
|
||||
body={<SttnDetailModal type={"RST"} formObj={detailModal.data} />}
|
||||
/>
|
||||
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
<Toaster position="top-center" />
|
||||
</>
|
||||
|
||||
@@ -55,6 +55,7 @@ export type pubFacState = {
|
||||
fcOrgwtsNmList:pubHasuType[];
|
||||
dmdComList: any[];
|
||||
apiMessage:string;
|
||||
pbnstHasuResCount:number
|
||||
};
|
||||
};
|
||||
type pubFacActions = {
|
||||
@@ -91,7 +92,8 @@ export const pubFacStateExport: pubFacState = {
|
||||
pbnsUpdateIndex: {} as pbnstInsertIndex,
|
||||
fcOrgwtsNmList:[],
|
||||
dmdComList: [],
|
||||
apiMessage:''
|
||||
apiMessage:'',
|
||||
pbnstHasuResCount:1
|
||||
},
|
||||
};
|
||||
|
||||
@@ -125,7 +127,7 @@ if(searchTxt){
|
||||
};
|
||||
});
|
||||
|
||||
return hasuList;
|
||||
return {data: hasuList, count:rainRes.count};
|
||||
};
|
||||
|
||||
const initFetch = async (ruseFcltPk: string | undefined) => {
|
||||
@@ -180,7 +182,8 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
...state,
|
||||
pbnst: {
|
||||
...state.pbnst,
|
||||
pbnstHasuRes: pbnstHasuRes,
|
||||
pbnstHasuRes: pbnstHasuRes.data,
|
||||
pbnstHasuResCount:pbnstHasuRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -195,7 +198,8 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
...state,
|
||||
pbnst: {
|
||||
...state.pbnst,
|
||||
pbnstHasuRes: pbnstHasuRes,
|
||||
pbnstHasuRes: pbnstHasuRes.data,
|
||||
pbnstHasuResCount:pbnstHasuRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -233,7 +237,8 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
...state,
|
||||
pbnst: {
|
||||
...state.pbnst,
|
||||
pbnstRes: pbnstHasuRes,
|
||||
pbnstHasuRes: pbnstHasuRes.data,
|
||||
pbnstHasuResCount:pbnstHasuRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -15,42 +15,42 @@ import {
|
||||
} from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
|
||||
import {
|
||||
type FieldErrors,
|
||||
type UseFormReturn,
|
||||
} from "react-hook-form";
|
||||
import { type FieldErrors, type UseFormReturn } from "react-hook-form";
|
||||
import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
|
||||
import type { z } from "zod";
|
||||
import { confirmToast } from "@/components/lib/func/commom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function PbnstRegModal({
|
||||
form,
|
||||
setPbnstInsert,
|
||||
onInvalid
|
||||
onInvalid,
|
||||
}: {
|
||||
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
|
||||
setPbnstInsert: (data: customPbnst) => void;
|
||||
onInvalid:(errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>) => void
|
||||
onInvalid: (
|
||||
errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>
|
||||
) => void;
|
||||
}) {
|
||||
|
||||
// const [pbnstBdstForm, setPbnstBdstForm] = useState<customPbnst>(
|
||||
// {} as customPbnst
|
||||
// );
|
||||
const { t } = useTranslation("base");
|
||||
|
||||
//TODO: 유즈 스테이트에 set만해도 되나?
|
||||
const [, setCurrentTab] = useState<string>("mng");
|
||||
//const setCurrentTab = "mng"
|
||||
const [indexMng, setIndexMng] = useState<number>(0);
|
||||
const [indexBiz, setIndexBiz] = useState<number>(0);
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
const item = valuse.items[indexMng];
|
||||
const data = item ? writeRgtrAndMdfr([item]) : [];
|
||||
//
|
||||
const handleConfirm = () => {
|
||||
if (data && data[0]) {
|
||||
setPbnstInsert(data[0]);
|
||||
}
|
||||
};
|
||||
confirmToast(t("isInsertMsg"), handleConfirm);
|
||||
};
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
const item = valuse.items[indexMng];
|
||||
const data = item ? writeRgtrAndMdfr([item]) : [];
|
||||
if (data && data[0]) {
|
||||
setPbnstInsert(data[0]);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTabChange = (value: string) => {
|
||||
setCurrentTab(value);
|
||||
};
|
||||
@@ -60,7 +60,6 @@ export function PbnstRegModal({
|
||||
}, [form.formState.errors]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
const firstForm = form.getValues("items");
|
||||
if (firstForm) {
|
||||
setIndexMng(firstForm.length - 1);
|
||||
@@ -94,7 +93,6 @@ export function PbnstRegModal({
|
||||
<PbnstMngForm
|
||||
form={form}
|
||||
formType={"reg"}
|
||||
// firstFcltData={pbnstBdstForm}
|
||||
indexMng={indexMng}
|
||||
setIndexMng={setIndexMng}
|
||||
/>
|
||||
@@ -106,7 +104,6 @@ export function PbnstRegModal({
|
||||
indexBiz={indexBiz}
|
||||
setIndexBiz={setIndexBiz}
|
||||
formType={"reg"}
|
||||
// firstBizData={pbnstBdstForm.fcBizs}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"isDeleteMsg": "선택한 정보를 삭제하시겠습니까?",
|
||||
"isUpdateMsg": "수정한 정보를 저장하시겠습니까?",
|
||||
"isInsertMsg": "등록하시겠습니까?",
|
||||
"isUpdatetMsg": "수정하시겠습니까?",
|
||||
|
||||
"excelDownErrMsg": "다운로드할 데이터가 없습니다.",
|
||||
|
||||
"alreadyInsertedErrMsg": "사업자번호 {{num}}(은)는 이미 등록되었습니다. 다시 등록해주세요.",
|
||||
|
||||
Reference in New Issue
Block a user