Merge branch 'iipbs/wr/dev'

This commit is contained in:
2026-07-09 10:01:38 +09:00
7 changed files with 84 additions and 32 deletions
+30 -2
View File
@@ -43,6 +43,34 @@ export const sdmInfoFormSchema = z.object({
export type SdmInfoFormData = z.infer<typeof sdmInfoFormSchema>;
const formatTelno = (telno?: string | null) => {
const digits = (telno ?? '').replace(/\D/g, '');
if (!digits) {
return '';
}
if (digits.startsWith('02')) {
if (digits.length === 9) {
return digits.replace(/(02)(\d{3})(\d{4})/, '$1-$2-$3');
}
if (digits.length === 10) {
return digits.replace(/(02)(\d{4})(\d{4})/, '$1-$2-$3');
}
}
if (digits.length === 10) {
return digits.replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3');
}
if (digits.length === 11) {
return digits.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');
}
return telno ?? '';
};
// 수요처 정보
export type DemandCompBizType = {
@@ -530,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) {
@@ -694,7 +722,7 @@ export const SdmReducer = (set: any): SdmActions => {
dmdInfoId: res.dmdInfoId,
zip: res.zip || '',
daddr: res.daddr,
telno: res.telno.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'),
telno: formatTelno(res.telno),
rgtr: res.rgtr,
ctpvCd: res.ctpvCd,
sggCd: res.sggCd,
@@ -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 };
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]);
@@ -342,7 +346,7 @@ export default function PrfmncPrfmncReg() {
<div className="grid grid-cols-12 gap-4 h-full">
<div className="col-span-4 h-full min-h-0">
<ListDiv className="min-h-0">
<ScrollArea className="h-[60vh]">
<ScrollArea className="h-[75vh]">
<UiTable
key={"leftTable"}
tableData={bdstTable}
@@ -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 {
@@ -373,7 +380,7 @@ export default function PrfmncPrfmncReg() {
</ListDiv>
</div>
<ListDiv className="col-span-8 pr-6 ">
<ScrollArea className="h-[60vh]">
<ScrollArea className="h-[75vh]">
<div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m³) 등록결과"}
@@ -10,11 +10,11 @@ export const pbnPrfRegExcelZod = z.object({
});
export const pbnstPrfmncHeadListExport: TableUpperProps[] = [
{ id: "sido", title: "시도" },
{ id: "gugun", title: "시군구" },
{ id: "bscFctNm", title: "시설명" },
{ id: "ruseUtztnFcltNm", title: "재이용시설명" },
{ id: "pbnstRuseFcltId", title: "재이용시설코드" },
{ id: "sido", title: "시도", widthPercent: 13 },
{ id: "gugun", title: "시군구", widthPercent: 16 },
{ id: "bscFctNm", title: "시설명", widthPercent: 24 },
{ id: "ruseUtztnFcltNm", title: "재이용시설명", widthPercent: 27 },
{ id: "pbnstRuseFcltId", title: "재이용시설코드", widthPercent: 20 },
];
export const monthHeadListExport: TableUpperProps[] = [
@@ -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 };
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>
+7 -4
View File
@@ -49,10 +49,13 @@ function CommonCodeInitializer() {
useEffect(() => {
if (isLoginPage) return;
if (isInit) return;
setTimeout(() => {
initCommonCodes();
}, 3000); // 3초 후에 하는 것으로 왜냐하면 로그인 처리가 먼저 되어야 하기 때문에
// 첫 페인트 이후 바로 공통 코드를 불러와 초기 화면 지연을 줄입니다.
const timer = window.setTimeout(() => {
void initCommonCodes();
}, 2000);
return () => window.clearTimeout(timer);
}, [isInit, initCommonCodes, isLoginPage]);
return null;