dm: 수요신청현황 api 수정, 수정시 비번 처리,무한루프처리
This commit is contained in:
@@ -558,7 +558,7 @@ const getDemandCompList = async (searchText: string, pageCnt: number) => {
|
||||
|
||||
const getSdmInfoStatusList = async (dmdInfoId: string) => {
|
||||
try {
|
||||
const url = '/reuseFc/request/' + dmdInfoId;
|
||||
const url = '/reuseFc/request/' + dmdInfoId + '?infoListYn=Y';
|
||||
const res = await getFetch(fetchType.WR, url);
|
||||
return res?.data || [];
|
||||
} catch (error) {
|
||||
|
||||
@@ -70,6 +70,16 @@ export default function CoSttn() {
|
||||
const [updateData, setUpdateData] = useState<DemandCompType>();
|
||||
const [isResetSelection, setIsResetSelection] = useState<boolean>(false);
|
||||
|
||||
const sanitizeDemandForPopup = useCallback((data?: DemandCompType) => {
|
||||
if (!data) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const nextData = { ...data };
|
||||
delete nextData.dmdAplyPswd;
|
||||
return nextData;
|
||||
}, []);
|
||||
|
||||
const getSelCity = useCallback(
|
||||
(val: string | number) => {
|
||||
const cityValue = String(val);
|
||||
@@ -330,11 +340,13 @@ export default function CoSttn() {
|
||||
total={coSttnResCount || 0}
|
||||
cellClick={async(index: number | undefined) => {
|
||||
const uuid = await getMyUUID();
|
||||
const updateData = coSttnRes[index as number];
|
||||
if (updateData && typeof uuid === "string") {
|
||||
updateData.mdfr = uuid;
|
||||
const selectedData = sanitizeDemandForPopup(
|
||||
coSttnRes[index as number]
|
||||
);
|
||||
if (selectedData && typeof uuid === "string") {
|
||||
selectedData.mdfr = uuid;
|
||||
}
|
||||
setUpdateData(coSttnRes[index as number]);
|
||||
setUpdateData(selectedData);
|
||||
}}
|
||||
onPageChange={(page) => {
|
||||
const con =
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Label, Table, TableBody, TableHeader } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useAlertStore } from "@/src/shared/lib";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
|
||||
@@ -150,6 +150,7 @@ export default function PrfmncPrfmncReg() {
|
||||
const [searchTxt, setSearchTxt] = useState<string>("");
|
||||
const [selectedFacilityId, setSelectedFacilityId] = useState<string>("");
|
||||
const [selectedIndex, setSelectedIndex] = useState<number>(0);
|
||||
const [shouldLoadFirstRow, setShouldLoadFirstRow] = useState(true);
|
||||
const [inputData, setInputData] = useState<any[]>([]);
|
||||
const [isExcelOpen, setIsExcelOPen] = useState<{
|
||||
isModal: boolean;
|
||||
@@ -159,6 +160,7 @@ export default function PrfmncPrfmncReg() {
|
||||
const { confirm } = useConfirm();
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const { t } = useTranslation("base");
|
||||
const prevSearchYearRef = useRef(searchYear);
|
||||
|
||||
const bdstTable = useMemo<PbnstPrfmncRow[]>(
|
||||
() =>
|
||||
@@ -190,7 +192,6 @@ export default function PrfmncPrfmncReg() {
|
||||
|
||||
const detail = await getPbnstPrfRegDtl(searchYear, facilityId);
|
||||
if (detail) {
|
||||
setSelectedFacilityId(facilityId);
|
||||
setIsExcelOPen((prev) => ({
|
||||
...prev,
|
||||
data: detail,
|
||||
@@ -203,6 +204,7 @@ export default function PrfmncPrfmncReg() {
|
||||
const handleSearch = useCallback(() => {
|
||||
if (!laeSeCd) return;
|
||||
|
||||
setShouldLoadFirstRow(true);
|
||||
setIsReset(true);
|
||||
}, [laeSeCd]);
|
||||
|
||||
@@ -233,6 +235,7 @@ export default function PrfmncPrfmncReg() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!laeSeCd) return;
|
||||
setShouldLoadFirstRow(true);
|
||||
void prfmncHasuInit(1, laeSeCd);
|
||||
}, [laeSeCd, prfmncHasuInit]);
|
||||
|
||||
@@ -245,20 +248,21 @@ export default function PrfmncPrfmncReg() {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextIndex = Math.max(
|
||||
prfmncRes.findIndex((item) => item.pbnstRuseFcltId === selectedFacilityId),
|
||||
0
|
||||
);
|
||||
const nextFacility = prfmncRes[nextIndex];
|
||||
if (!nextFacility) {
|
||||
return;
|
||||
}
|
||||
if (!shouldLoadFirstRow) return;
|
||||
|
||||
setSelectedIndex(nextIndex);
|
||||
void loadDetail(nextFacility.pbnstRuseFcltId);
|
||||
}, [loadDetail, prfmncRes]);
|
||||
const firstFacility = prfmncRes[0];
|
||||
if (!firstFacility) return;
|
||||
|
||||
setSelectedIndex(0);
|
||||
setSelectedFacilityId(firstFacility.pbnstRuseFcltId);
|
||||
void loadDetail(firstFacility.pbnstRuseFcltId);
|
||||
setShouldLoadFirstRow(false);
|
||||
}, [loadDetail, prfmncRes, shouldLoadFirstRow]);
|
||||
|
||||
useEffect(() => {
|
||||
if (prevSearchYearRef.current === searchYear) return;
|
||||
|
||||
prevSearchYearRef.current = searchYear;
|
||||
if (!selectedFacilityId) return;
|
||||
void loadDetail(selectedFacilityId);
|
||||
}, [loadDetail, searchYear, selectedFacilityId]);
|
||||
@@ -356,9 +360,12 @@ export default function PrfmncPrfmncReg() {
|
||||
if (!selected) return;
|
||||
|
||||
setSelectedIndex(index);
|
||||
setSelectedFacilityId(selected.pbnstRuseFcltId);
|
||||
setShouldLoadFirstRow(false);
|
||||
void loadDetail(selected.pbnstRuseFcltId);
|
||||
}}
|
||||
onPageChange={(page: number) => {
|
||||
setShouldLoadFirstRow(true);
|
||||
if (searchTxt.trim().length > 0) {
|
||||
void prfmncHasuNmSearch(page, laeSeCd, searchTxt);
|
||||
} else {
|
||||
|
||||
@@ -20,7 +20,7 @@ export type pbnstPrfmncState = {
|
||||
isInit: boolean;
|
||||
pbnstPrfmncHeadList: TableUpperProps[];
|
||||
monthHeadList: TableUpperProps[];
|
||||
prfmncRes: PbnstPrfRegListType[];
|
||||
prfmncRes: PbnstPrfRegListType[]; // 하수재이용시설 목록
|
||||
prfmncResCount: number;
|
||||
excelList: number[];
|
||||
pageKey: number;
|
||||
|
||||
@@ -7,6 +7,8 @@ export default function CoSttnDetailPopup({isDetail} :{isDetail:DemandCompType})
|
||||
code
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const detailData = { ...isDetail };
|
||||
delete detailData.dmdAplyPswd;
|
||||
|
||||
return(
|
||||
<div>
|
||||
@@ -21,7 +23,7 @@ export default function CoSttnDetailPopup({isDetail} :{isDetail:DemandCompType})
|
||||
console.log(data)
|
||||
}}
|
||||
bodyClassNm={"w-full mx-auto bg-background rounded-lg shadow-md p-6"}
|
||||
updateList={isDetail}
|
||||
updateList={detailData}
|
||||
readOnly={true}
|
||||
openNetwork={false}
|
||||
></SdmInsertForm>
|
||||
|
||||
Reference in New Issue
Block a user