하스재이용 시설 현황 완료
This commit is contained in:
@@ -20,10 +20,14 @@ import type {
|
||||
customPbnst,
|
||||
pubHasuType,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { excelDownload, getCityOrSgg, yearOptions } from "@/components/lib/func/commom";
|
||||
import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal";
|
||||
import {
|
||||
excelDownload,
|
||||
getCityOrSgg,
|
||||
yearOptions,
|
||||
} from "@/components/lib/func/commom";
|
||||
import SearchInputText from "@/components/ui/searchInput/searchInput";
|
||||
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||
import { PbnstSttnModal } from "@/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal";
|
||||
|
||||
export default function PbnstSttn() {
|
||||
const {
|
||||
@@ -37,10 +41,6 @@ export default function PbnstSttn() {
|
||||
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const codeData = getCityOrSgg(ref);
|
||||
const [isRuseReg, setIsRuseReg] = useState<{
|
||||
isModal: boolean;
|
||||
data: pubHasuType;
|
||||
}>({ isModal: false, data: {} as pubHasuType });
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
@@ -52,11 +52,14 @@ export default function PbnstSttn() {
|
||||
isModal: boolean;
|
||||
data: customPbnst;
|
||||
}>({ isModal: false, data: {} as customPbnst });
|
||||
|
||||
const [clickPk , setClickPk] = useState<string>("")
|
||||
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
|
||||
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
pbnstSttnSearch("1", '10000', ref.current , '', searchYear);
|
||||
}, [pbnstSttnSearch, searchYear,ref.current]);
|
||||
pbnstSttnSearch("1", "10000", ref.current, "", searchYear);
|
||||
}, [pbnstSttnSearch, searchYear, ref.current]);
|
||||
|
||||
const cellCLick = useCallback(
|
||||
(index: number | undefined) => {
|
||||
@@ -66,7 +69,8 @@ export default function PbnstSttn() {
|
||||
pbnstSttn.pbnstSttnRes[index]
|
||||
) {
|
||||
const pbnstRuseFcltPk = pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk;
|
||||
getPbnStnDetail(pbnstRuseFcltPk.slice(0, 11));
|
||||
// setClickPk(pbnstRuseFcltPk)
|
||||
getPbnStnDetail(pbnstRuseFcltPk);
|
||||
}
|
||||
},
|
||||
[getPbnStnDetail, pbnstSttn.pbnstSttnRes]
|
||||
@@ -86,17 +90,28 @@ export default function PbnstSttn() {
|
||||
if (!pbnstSttn.isInit) {
|
||||
pbnSttnInit("1", "13", ref.current, searchYear);
|
||||
}
|
||||
}, [pbnstSttn.isInit, pbnSttnInit,ref.current]);
|
||||
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
|
||||
useEffect(() => {
|
||||
setBdstTable(pbnstSttn.pbnstSttnRes);
|
||||
}, [pbnstSttn.pbnstSttnRes]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (pbnRuseNm.length > 1)
|
||||
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear);
|
||||
}, [pbnRuseNm]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk)
|
||||
setPbnDetaileData({
|
||||
isModal: true,
|
||||
data: pbnstSttn.pbnstDetail,
|
||||
});
|
||||
}, [pbnstSttn.pbnstDetail]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log('pbnDetaileData.isModal ', pbnDetaileData.isModal)
|
||||
},[pbnDetaileData.isModal])
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -122,18 +137,18 @@ export default function PbnstSttn() {
|
||||
}
|
||||
leftChildren={
|
||||
<>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<SelectBox
|
||||
className="w-48 h-full text-2xl"
|
||||
label="연도"
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<SelectBox
|
||||
className="w-48 h-full text-2xl"
|
||||
label="연도"
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<SearchInputText
|
||||
label={"하수처리시설"}
|
||||
initValue={pbnRuseNm ?? ""}
|
||||
@@ -143,10 +158,9 @@ export default function PbnstSttn() {
|
||||
setRtnData={function (rtnData: any[]): void {
|
||||
setBdstTable(rtnData);
|
||||
}}
|
||||
searchList={pbnstSttn.pbnstSearchData||[]}
|
||||
searchList={pbnstSttn.pbnstSearchData || []}
|
||||
></SearchInputText>
|
||||
</>
|
||||
|
||||
</>
|
||||
}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
|
||||
@@ -162,6 +176,7 @@ export default function PbnstSttn() {
|
||||
initClick={function (): void {}}
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
isAdmin={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -203,14 +218,14 @@ export default function PbnstSttn() {
|
||||
/>
|
||||
<UiModal
|
||||
body={
|
||||
<PbnstRegModal
|
||||
data={isRuseReg.data || ({} as customPbnst)}
|
||||
></PbnstRegModal>
|
||||
<PbnstSttnModal
|
||||
data={pbnDetaileData.data || ({} as customPbnst)}
|
||||
></PbnstSttnModal>
|
||||
}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
open={isRuseReg.isModal}
|
||||
open={pbnDetaileData.isModal}
|
||||
onOpenChange={(open) => {
|
||||
setIsRuseReg({ data: {} as pubHasuType, isModal: open });
|
||||
setPbnDetaileData({ data: {} as customPbnst, isModal: false });
|
||||
}}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -84,12 +84,10 @@ export default function prfmncPrfmncReg() {
|
||||
isModal: false,
|
||||
data: prfmncRes[index] || ({} as FcPrfType),
|
||||
});
|
||||
const inUsageData = initValInUsage;
|
||||
const outUsageData = initValOutUsage;
|
||||
|
||||
const inUsageData = [...initValInUsage];
|
||||
const outUsageData = [...initValOutUsage];
|
||||
const inSubtotal = subTotalObj;
|
||||
const outSubtotal = subTotalObj;
|
||||
|
||||
if (prfmncRes[index]?.prfList) {
|
||||
prfmncRes[index].prfList?.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
|
||||
@@ -158,7 +158,6 @@ const dmdColist = z.object({
|
||||
|
||||
|
||||
|
||||
|
||||
export const fcBizSchema = z.object({
|
||||
pbnstRuseFcltBizPk: z.number().nullish(),
|
||||
pbnstRuseFcltFk: z.string().nullish(),
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import type {
|
||||
CommonTableProps,
|
||||
TableUpperProps,
|
||||
} from "@/app/store/common/type/header";
|
||||
import { z } from "zod";
|
||||
|
||||
export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
@@ -27,7 +30,7 @@ export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
},
|
||||
{ id: "bscFctNm", title: "시설명", visible: true },
|
||||
{ id: "efflWqltStndrdNm", title: "지역구분", visible: true },
|
||||
|
||||
|
||||
{ id: "fctCpc", title: "시설용량(톤/일)", visible: true },
|
||||
{ id: "tel", title: "전화번호", visible: true },
|
||||
{ id: "ruseUtztnFcltNm", title: "재이용시설명", visible: true },
|
||||
@@ -203,7 +206,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
{
|
||||
id: "cityText",
|
||||
title: "시도",
|
||||
upName: "adminDiv",
|
||||
@@ -310,5 +313,240 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
row: 2,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
}
|
||||
];
|
||||
},
|
||||
];
|
||||
|
||||
export const ruseFcltNodeListExport: TableUpperProps[] = [
|
||||
{ id: "cycl", title: "차수", visible: true, row: 1, rowSpan: 3, colSpan: 1 },
|
||||
{ id: "seCd", title: "구분", visible: true, row: 1, rowSpan: 3, colSpan: 1 },
|
||||
{
|
||||
id: "busiTotal",
|
||||
title: "사업개요",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 10,
|
||||
},
|
||||
{
|
||||
id: "ruseFclt",
|
||||
title: "재처리시설",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 5,
|
||||
},
|
||||
{
|
||||
id: "mainSply",
|
||||
title: "메인공급펌프용량",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 3,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "buziFee",
|
||||
title: "사업비(백만원)",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 1,
|
||||
colSpan: 6,
|
||||
},
|
||||
{
|
||||
id: "instlAprvSncnDt",
|
||||
title: "설치승인・인가일",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "bizCmcnDay",
|
||||
title: "사업준공일",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "rprcsFcltCpct",
|
||||
title: "시설용량(m³/일)",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "rprcsMthdCd",
|
||||
title: "재처리방식",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "majorPrcsMsrcCd",
|
||||
title: "주처리공법",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "inoutYn",
|
||||
title: "위치처리장(내・외)",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "addr",
|
||||
title: "위치(주소)",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{ id: "gvsbs", title: "국고", visible: true, row: 3, rowSpan: 1, colSpan: 1 },
|
||||
{
|
||||
id: "lcep",
|
||||
title: "지방비",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "cusrAlotm",
|
||||
title: "민간투자비",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "cusrAlotm2",
|
||||
title: "원인자부담금",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{ id: "etc", title: "기타", visible: true, row: 3, rowSpan: 1, colSpan: 1 },
|
||||
{
|
||||
id: "totalMoney",
|
||||
title: "합계",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
];
|
||||
|
||||
export const ruseSplyHeadListExport: TableUpperProps[] = [
|
||||
{ id: "cycl", title: "차수", visible: true },
|
||||
{ id: "orgwtWtritQnt", title: "원수취수량", visible: true },
|
||||
{ id: "tmsYn", title: "하수처리량TMS 전후", visible: true },
|
||||
{ id: "dschgFmYn", title: "하수처리장 방류 유량계 전·후", visible: true },
|
||||
{ id: "dtlPstnExpln", title: "상세위치 설명", visible: true },
|
||||
];
|
||||
|
||||
export const rusePplHeadListExport: TableUpperProps[] = [
|
||||
{ id: "cycl", title: "차수", visible: true },
|
||||
{ id: "ppMqlt", title: "관재질", type: "select", visible: true },
|
||||
{ id: "pdmt", title: "관경", type: "select", visible: true },
|
||||
{ id: "cpct", title: "연장", edit: true, visible: true },
|
||||
];
|
||||
|
||||
export const ruseGuranteeHeadListExport: TableUpperProps[] = [
|
||||
{ id: "cycl", title: "차수", visible: true },
|
||||
{ id: "bod", title: "BOD(mg/L)", visible: true },
|
||||
{ id: "grssClfg", title: "총대장균군수(개/mg)", visible: true },
|
||||
{ id: "combResdch", title: "결합잔류염소(mh/L)", visible: true },
|
||||
{ id: "trbt", title: "탁도(NTU)", visible: true },
|
||||
{ id: "smll", title: "냄새", visible: true },
|
||||
{ id: "crmty", title: "색도", visible: true },
|
||||
{ id: "tn", title: "총질소(mg/L)", visible: true },
|
||||
{ id: "tph", title: "총인(mg/L)", visible: true },
|
||||
{ id: "ph", title: "수소이온농도", visible: true },
|
||||
{ id: "clIonQnt", title: "염화물(mg/L)", visible: true },
|
||||
{ id: "cdtnv", title: "전기전도도(μs/cm)", visible: true },
|
||||
];
|
||||
|
||||
export const ruseDmdHeadListExport: TableUpperProps[] = [
|
||||
{ id: "cycl", title: "차수", visible: true },
|
||||
{ id: "dmdCoNm", title: "수요처명", visible: true },
|
||||
{ id: "daddr", title: "위치(주소)", visible: true },
|
||||
{ id: "useUsgCd", title: "사용용도", visible: true },
|
||||
{ id: "splyBgngDay", title: "공급시작일", visible: true },
|
||||
{ id: "splyEndDay", title: "공급종료일", visible: true },
|
||||
{ id: "splyCpct", title: "공급량(m³/일)", visible: true },
|
||||
{ id: "splyFmYon", title: "공급유량계 유무", visible: true },
|
||||
];
|
||||
|
||||
export const ruseFcltHeadListExport: CommonTableProps[] = [
|
||||
{ id: "cycl", title: "차수", visible: true},
|
||||
{ id: "seCd", title: "구분", visible: true},
|
||||
{ id: "gvsbs", title: "국고", visible: true },
|
||||
{
|
||||
id: "lcep",
|
||||
title: "지방비",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "cusrAlotm",
|
||||
title: "민간투자비",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "cusrAlotm2",
|
||||
title: "원인자부담금",
|
||||
visible: true,
|
||||
},
|
||||
{ id: "etc", title: "기타", visible: true },
|
||||
{
|
||||
id: "totalMoney",
|
||||
title: "합계",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "instlAprvSncnDt",
|
||||
title: "설치승인・인가일",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "bizCmcnDay",
|
||||
title: "사업준공일",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "rprcsFcltCpct",
|
||||
title: "시설용량(m³/일)",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "rprcsMthdCd",
|
||||
title: "재처리방식",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "majorPrcsMsrcCd",
|
||||
title: "주처리공법",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "inoutYn",
|
||||
title: "위치처리장(내・외)",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "addr",
|
||||
title: "위치(주소)",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "mainSply",
|
||||
title: "메인공급펌프용량",
|
||||
visible: true,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import type { CommonTableProps, TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { z } from "zod";
|
||||
import { pbnSttHeadListExport, pbnstSttNodeListExport } from "./headList";
|
||||
import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
@@ -20,6 +20,12 @@ export type pbnstSttnState = {
|
||||
pbnstSttHeadList: CommonTableProps[];
|
||||
pbnstSttNodeList: CommonTableProps[];
|
||||
pbnstDetail: customPbnst;
|
||||
ruseFcltNodeList:TableUpperProps[]
|
||||
ruseSplyHeadList:TableUpperProps[]
|
||||
rusePplHeadList:TableUpperProps[]
|
||||
ruseGuranteeHeadList:TableUpperProps[]
|
||||
ruseDmdHeadList:TableUpperProps[]
|
||||
ruseFcltHeadList:TableUpperProps[]
|
||||
excelList: [];
|
||||
isInit: boolean;
|
||||
};
|
||||
@@ -40,7 +46,7 @@ type pbnstSttnActions = {
|
||||
reurnValue: ReturnType,
|
||||
year: string
|
||||
) => void;
|
||||
getPbnStnDetail: (bscFctCd: string) => void;
|
||||
getPbnStnDetail: (pbnstRuseFcltPk: string) => void;
|
||||
pbnNmSearch: (
|
||||
page: string,
|
||||
total: string,
|
||||
@@ -56,6 +62,12 @@ export const pbnstSttnStateExport: pbnstSttnState = {
|
||||
pbnstSttn: {
|
||||
pbnstSttHeadList: pbnstSttHeadList,
|
||||
pbnstSttNodeList: pbnstSttNodeList,
|
||||
ruseFcltNodeList:ruseFcltNodeListExport,
|
||||
ruseSplyHeadList:ruseSplyHeadListExport,
|
||||
rusePplHeadList:rusePplHeadListExport,
|
||||
ruseGuranteeHeadList:ruseGuranteeHeadListExport,
|
||||
ruseDmdHeadList:ruseDmdHeadListExport,
|
||||
ruseFcltHeadList:ruseFcltHeadListExport,
|
||||
pbnstSttnRes: [],
|
||||
pbnstDetail: {} as customPbnst,
|
||||
pbnstSearchData: [],
|
||||
@@ -158,6 +170,7 @@ const hasuListFetch = async (
|
||||
endDt: item.operList[0]?.endDt.toLocaleDateString?? "",
|
||||
searchNm: findData.bscFctNm,
|
||||
searchPk: findData.bscFctCd,
|
||||
prfList:item?.prfList??[]
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -254,10 +267,13 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
console.log("error", erTxt);
|
||||
}
|
||||
},
|
||||
getPbnStnDetail: async (bscFctCd: string) => {
|
||||
getPbnStnDetail: async (pbnstRuseFcltPk: string) => {
|
||||
try {
|
||||
const pbnstDetail = await getFetch("wr", `/reuseFc/pubFc/${bscFctCd}`);
|
||||
console.log("pbnstDetail ", pbnstDetail);
|
||||
let pbnstDetail = await getFetch("wr", `/reuseFc/pubFc/${pbnstRuseFcltPk}`);
|
||||
if(pbnstDetail.length>=0){
|
||||
pbnstDetail= pbnstDetail.find((item: customPbnst) =>item.pbnstRuseFcltPk === pbnstRuseFcltPk)
|
||||
}
|
||||
console.log( 'pbnstDetail ', pbnstDetail)
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
|
||||
export type WaterReuseFacility = {
|
||||
bscFctNm: string; // 기본시설명 (예: "난지")
|
||||
efflWqltStndrdNm: string; // 방류수 수질 기준명 (예: "500톤 이상(Ⅲ지역)")
|
||||
@@ -21,4 +23,5 @@ export type WaterReuseFacility = {
|
||||
rprtvBzenty: string;
|
||||
bgngDt: string;
|
||||
endDt: string;
|
||||
prfList:PrfType[];
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ export function PbnstMngForm({
|
||||
fileDownLoad,
|
||||
getBizCycle,
|
||||
getpbnstInsertIndex,
|
||||
appendRuseFclt
|
||||
appendRuseFclt,
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const [regFileList, setRegFileList] = useState<fcFileType[] | null>(null);
|
||||
@@ -69,7 +69,17 @@ export function PbnstMngForm({
|
||||
pbnst.pbnsUpdateIndex.mng >= 0 &&
|
||||
pbnst.pbnstRes
|
||||
? pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]
|
||||
: pbnstRegZod.parse({}),
|
||||
: formType === "sttn" && firstFcltData
|
||||
? {
|
||||
ruseUtztnFcltNm: firstFcltData?.ruseUtztnFcltNm,
|
||||
fcltCpct: firstFcltData?.fcltCpct,
|
||||
hasuhasu: firstFcltData?.hasuhasu,
|
||||
ruseCpct: firstFcltData?.ruseCpct,
|
||||
splyExtraCpct: firstFcltData?.splyExtraCpct,
|
||||
fcOpers: firstFcltData?.fcOpers,
|
||||
fcFiles: firstFcltData?.fcFiles,
|
||||
}
|
||||
: pbnstRegZod.parse({}),
|
||||
});
|
||||
const {
|
||||
fields: fcOpersField,
|
||||
@@ -89,17 +99,16 @@ export function PbnstMngForm({
|
||||
getBizCycle(pbnst.pbnstRes[val]);
|
||||
form.reset(pbnst.pbnstRes[val]);
|
||||
|
||||
form.setValue('hasuhasu' , Number(pbnst.efflAmnt)??0)
|
||||
form.setValue("hasuhasu", Number(pbnst.efflAmnt) ?? 0);
|
||||
getpbnstInsertIndex({ ...pbnst.pbnsUpdateIndex, mng: val });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const plusHist = () => {
|
||||
const currentTableDataFromRef = ref.current ? [...ref.current] : [];
|
||||
const regData = {
|
||||
choose: false,
|
||||
pbnstRuseFcltFk:form.getValues('pbnstRuseFcltPk')??"",
|
||||
pbnstRuseFcltFk: form.getValues("pbnstRuseFcltPk") ?? "",
|
||||
rgtr: "",
|
||||
mdfr: "",
|
||||
operMthd: "",
|
||||
@@ -195,15 +204,13 @@ export function PbnstMngForm({
|
||||
// 등록할때 신규 값을 계속 가지고 있으려고
|
||||
useEffect(() => {
|
||||
if (
|
||||
formType === "reg" &&
|
||||
firstFcltData &&
|
||||
(form.getValues("swtrmtFcltFk") === "" ||
|
||||
form.getValues("swtrmtFcltFk") === undefined)
|
||||
) {
|
||||
form.setValue("swtrmtFcltFk", firstFcltData.swtrmtFcltFk);
|
||||
form.setValue(
|
||||
"pbnstRuseFcltPk",
|
||||
String(firstFcltData.pbnstRuseFcltPk)
|
||||
);
|
||||
form.setValue("pbnstRuseFcltPk", String(firstFcltData.pbnstRuseFcltPk));
|
||||
form.setValue("fcBizs", firstFcltData.fcBizs);
|
||||
}
|
||||
}, [firstFcltData]);
|
||||
@@ -251,41 +258,38 @@ export function PbnstMngForm({
|
||||
}
|
||||
}
|
||||
}, [pbnst.pbnsUpdateIndex, pbnst.pbnstRes, formType, getBizCycle]);
|
||||
|
||||
|
||||
//신규 등록시 입력할때 데이터 넣기
|
||||
useEffect(() => {
|
||||
const formData = form.watch();
|
||||
formData.fcOpers = ref.current ? [...ref.current] : [];
|
||||
formData.fcFiles = regFileList ? [...regFileList] : [];
|
||||
if (formType === "reg") {
|
||||
console.log('formData ', formData)
|
||||
console.log("formData ", formData);
|
||||
pbnstMngData([formData] as customPbnst[]);
|
||||
} else if (formType === "update"){
|
||||
const updateRes = pbnst.pbnstRes?.map((item)=>{
|
||||
if(item.pbnstRuseFcltPk === item.pbnstRuseFcltPk){
|
||||
item=formData as customPbnst
|
||||
} else if (formType === "update") {
|
||||
const updateRes = pbnst.pbnstRes?.map((item) => {
|
||||
if (item.pbnstRuseFcltPk === item.pbnstRuseFcltPk) {
|
||||
item = formData as customPbnst;
|
||||
}
|
||||
return item
|
||||
})
|
||||
return item;
|
||||
});
|
||||
pbnstMngData(updateRes as customPbnst[]);
|
||||
}
|
||||
}, [form.formState, regFileList, formType, pbnst.pbnstRes]);
|
||||
|
||||
useEffect(() => {
|
||||
// pbnstMngData(pbnst.pbnstMngRegData);
|
||||
// pbnstMngData(pbnst.pbnstMngRegData);
|
||||
}, [pbnst.pbnstMngRegData]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if ( pbnst.pbnstRes && pbnst.pbnstRes?.length<= 0) return;
|
||||
if (pbnst.pbnstRes && pbnst.pbnstRes?.length <= 0) return;
|
||||
const fcltNmList = pbnst.pbnstRes?.map((item, index) => ({
|
||||
text: item.ruseUtztnFcltNm,
|
||||
val: String(index),
|
||||
}));
|
||||
|
||||
if(fcltNmList)
|
||||
setFcltNm(fcltNmList);
|
||||
|
||||
if (fcltNmList) setFcltNm(fcltNmList);
|
||||
}, [pbnst.pbnstRes]);
|
||||
|
||||
// 2. Define a submit handler.
|
||||
@@ -295,9 +299,6 @@ export function PbnstMngForm({
|
||||
pbnstInsert(values);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (relationfiles) {
|
||||
setRegFileList(regFileFilter(relationfiles, "계통도", regFileList || []));
|
||||
@@ -324,7 +325,18 @@ export function PbnstMngForm({
|
||||
재이용 시설명
|
||||
</Label>
|
||||
|
||||
{formType === "reg" ? (
|
||||
{formType === "update" ? (
|
||||
<SelectBox
|
||||
label=""
|
||||
className="mt-4 ml-2"
|
||||
selectClass={undefined}
|
||||
selectArray={fcltNm ?? []}
|
||||
onSelectValue={(val) => {
|
||||
selectFclt(Number(val));
|
||||
}}
|
||||
value={""}
|
||||
/>
|
||||
) : (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="ruseUtztnFcltNm"
|
||||
@@ -342,17 +354,6 @@ export function PbnstMngForm({
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
<SelectBox
|
||||
label=""
|
||||
className="mt-4 ml-2"
|
||||
selectClass={undefined}
|
||||
selectArray={fcltNm ?? []}
|
||||
onSelectValue={(val) => {
|
||||
selectFclt(Number(val));
|
||||
}}
|
||||
value={""}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import type {
|
||||
customPbnst,
|
||||
fcBizType,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
|
||||
import { ScrollArea, Title, UiTable } from "@common/business_components/ui";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import {
|
||||
Tabs,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
Button,
|
||||
TabsContent,
|
||||
} from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { set } from "react-hook-form";
|
||||
|
||||
export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
const { code, pbnstSttn,prfmnc } = useWrStore((state) => state);
|
||||
const [fcltTab, setFcltTab] = useState<string>("fclt");
|
||||
const [ruseTab, setRuseTab] = useState<string>("inoutTotal");
|
||||
const [ruseBizData, setRuseBizData] = useState<{
|
||||
data: any[];
|
||||
head: TableUpperProps[];
|
||||
}>();
|
||||
const [ruseHeadList, setRuseHeadList] = useState<TableUpperProps[]>([]);
|
||||
const [ruseTableData, setRuseTableData] = useState<TableUpperProps[]>([]);
|
||||
const [prfData , setPrfData] = useState<{inPrf: any[],outPrf: any[], totalPrf:any[] }> ()
|
||||
|
||||
const {monthHeadList } = prfmnc;
|
||||
useEffect(() => {
|
||||
let tableData;
|
||||
if (fcltTab === "fclt") {
|
||||
tableData = data.fcBizs?.map((item: fcBizType) => {
|
||||
return {
|
||||
cycl: item.cycl + "차",
|
||||
seCd: item.seCd,
|
||||
gvsbs: item.gvsbs??'-',
|
||||
lcep: item.lcep??'-',
|
||||
cusrAlotm: item.cusrAlotm??'-',
|
||||
etc: item.etc??'-',
|
||||
totalMoney:
|
||||
Number(item.addr) +
|
||||
Number(item.gvsbs) +
|
||||
Number(item.lcep) +
|
||||
Number(item.cusrAlotm),
|
||||
instlAprvSncnDt: item.instlAprvSncnDt?.toISOString??'-',
|
||||
bizCmcnDay: item.bizCmcnDay?.toISOString??'-',
|
||||
rprcsFcltCpct: item.rprcsFcltCpct??'-',
|
||||
rprcsMthdCd: item.rprcsMthdCd??'-',
|
||||
majorPrcsMsrcCd: item.majorPrcsMsrcCd??'-',
|
||||
inoutYn: item.inoutYn??'-',
|
||||
addr: item.addr??'-',
|
||||
};
|
||||
});
|
||||
} else if (fcltTab === "sply") {
|
||||
tableData = data.fcBizs.flatMap((item: fcBizType) => {
|
||||
return item?.fcOrgwts?.map((fcOrgwt) => {
|
||||
return {
|
||||
cycl: item.cycl + "차",
|
||||
orgwtWtritQnt: fcOrgwt.orgwtWtritQnt,
|
||||
tmsYn: fcOrgwt.tmsYn,
|
||||
dschgFmYn: fcOrgwt.dschgFmYn,
|
||||
dtlPstnExpln: fcOrgwt.dtlPstnExpln,
|
||||
};
|
||||
})
|
||||
});
|
||||
} else if (fcltTab === "ppi") {
|
||||
tableData = data.fcBizs?.flatMap((item: fcBizType) => {
|
||||
return item?.pplInstls?.map((ppl) => {
|
||||
return {
|
||||
cycl: item.cycl + "차",
|
||||
ppMqlt: ppl.ppMqlt,
|
||||
pdmt: ppl.pdmt,
|
||||
cpct: ppl.cpct,
|
||||
};
|
||||
})
|
||||
});
|
||||
} else if (fcltTab === "guarantee") {
|
||||
tableData = data.fcBizs?.map((item: fcBizType) => {
|
||||
return {
|
||||
cycl: item.cycl + "차",
|
||||
bod: item.bod,
|
||||
grssClfg: item.grssClfg,
|
||||
combResdch: item.combResdch,
|
||||
trbt: item.trbt,
|
||||
smll: item.smll,
|
||||
crmty: item.crmty,
|
||||
tph: item.tph,
|
||||
tn: item.tn,
|
||||
ph: item.ph,
|
||||
cdtnv: item.cdtnv,
|
||||
};
|
||||
});
|
||||
} else if (fcltTab === "dmdCo") {
|
||||
tableData = data.fcBizs?.flatMap((item: fcBizType) => {
|
||||
return item?.fcDemands?.map((dmd) => {
|
||||
return {
|
||||
cycl: item.cycl + "차",
|
||||
dmdCoNm: dmd.dmdCoNm,
|
||||
daddr: dmd.daddr,
|
||||
useUsgCd: dmd.useUsgCd,
|
||||
splyBgngDay: dmd.splyBgngDay?.toISOString,
|
||||
splyEndDay: dmd.splyEndDay?.toISOString,
|
||||
splyCpct: dmd.splyCpct,
|
||||
splyFmYn: dmd.splyFmYn,
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
console.log(tableData);
|
||||
if (tableData && tableData.length > 0) {
|
||||
setRuseTableData(tableData as any[]);
|
||||
}
|
||||
}, [fcltTab, data]);
|
||||
useEffect(() => {
|
||||
if (fcltTab === "fclt") {
|
||||
setRuseHeadList(pbnstSttn.ruseFcltHeadList);
|
||||
} else if (fcltTab === "sply") {
|
||||
setRuseHeadList(pbnstSttn.ruseSplyHeadList);
|
||||
} else if (fcltTab === "ppi") {
|
||||
setRuseHeadList(pbnstSttn.rusePplHeadList);
|
||||
} else if (fcltTab === "guarantee") {
|
||||
setRuseHeadList(pbnstSttn.ruseGuranteeHeadList);
|
||||
} else if (fcltTab === "dmdCo") {
|
||||
setRuseHeadList(pbnstSttn.ruseDmdHeadList);
|
||||
}
|
||||
}, [
|
||||
fcltTab,
|
||||
pbnstSttn.ruseFcltHeadList,
|
||||
pbnstSttn.ruseSplyHeadList,
|
||||
pbnstSttn.rusePplHeadList,
|
||||
pbnstSttn.ruseGuranteeHeadList,
|
||||
pbnstSttn.ruseDmdHeadList,
|
||||
]);
|
||||
|
||||
const getTablePrfData = (prfList:PrfType[]) => {
|
||||
const inUsageData = [...initValInUsage];
|
||||
const outUsageData = [...initValOutUsage];
|
||||
const inSubtotal = subTotalObj;
|
||||
const outSubtotal = subTotalObj;
|
||||
|
||||
if (prfList) {
|
||||
prfList?.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
|
||||
inUsageData.forEach((inData: any) => {
|
||||
const usageKey = inData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
inData[monthKey] = value;
|
||||
inData.total += value;
|
||||
|
||||
if (inSubtotal && usageKey !== "subtotal") {
|
||||
(inSubtotal as any)[monthKey] =
|
||||
((inSubtotal as any)[monthKey] ?? 0) + value;
|
||||
inSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
|
||||
outUsageData.forEach((outData: any) => {
|
||||
const usageKey = outData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
outData[monthKey] = value;
|
||||
outData.total += value;
|
||||
|
||||
if (usageKey !== "subtotal") {
|
||||
(outSubtotal as any)[monthKey] =
|
||||
((outSubtotal as any)[monthKey] ?? 0) + value;
|
||||
outSubtotal.total += value;
|
||||
}
|
||||
});
|
||||
});
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = totalObj;
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
(Number((inSubtotal as any)[key]) || 0) +
|
||||
(Number((outSubtotal as any)[key]) || 0);
|
||||
|
||||
(usageTotalObj as any)[key] = val;
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
|
||||
setPrfData({
|
||||
inPrf: inUsageData,
|
||||
outPrf: outUsageData,
|
||||
totalPrf: tableData,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
useEffect(() => {
|
||||
|
||||
if(pbnstSttn.pbnstSttnRes&&data){
|
||||
const prfList = pbnstSttn.pbnstSttnRes.find((item) => item.pbnstRuseFcltPk=== data.pbnstRuseFcltPk )?.prfList
|
||||
|
||||
if(prfList){
|
||||
getTablePrfData(prfList)
|
||||
}
|
||||
|
||||
}
|
||||
}, [pbnstSttn.pbnstSttnRes, data]);
|
||||
|
||||
useEffect(() => {}, [ruseBizData?.head]);
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<Title title={"하수재이용 시설 상세정보"} />
|
||||
<ScrollArea className={"h-[70vh]"}>
|
||||
<PbnstMngForm firstFcltData={data} formType={"sttn"} />
|
||||
<Tabs defaultValue="mng" onValueChange={setFcltTab}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="fclt">
|
||||
하수처리수 재이용시설 현황
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="sply">
|
||||
재이용 원수 취수 현황
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="ppi">
|
||||
재이용 공급관로 현황
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="guarantee">
|
||||
재이용 보증수질 현황
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="dmdCo">
|
||||
재이용 수요처 현황
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="max-h-full" value={fcltTab}>
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={ruseTableData || []}
|
||||
headlist={ruseHeadList || []}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
children={fcltTab==='fclt'?<HeadMakeColSpan upHeadList={pbnstSttn.ruseFcltNodeList} />:undefined}
|
||||
></UiTable>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
<Tabs defaultValue="mng" onValueChange={setRuseTab}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="totalPrf">
|
||||
장내외합계
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="inPrf">
|
||||
장내용수
|
||||
</TabsTrigger>
|
||||
<TabsTrigger className="!text-xl" value="outPrf">
|
||||
장외용수
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="max-h-full" value={ruseTab}>
|
||||
{prfData && (
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={prfData[ruseTab as keyof typeof prfData] || []}
|
||||
headlist={monthHeadList || []}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
></UiTable>
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user