Merge commit '47ba298157c5fa3039d802e6010912aab8e662d2' into iipbs/wr/dev
This commit is contained in:
@@ -14,8 +14,8 @@ import {
|
||||
tableData,
|
||||
yearOptions,
|
||||
} from "@/components/lib/func/commom";
|
||||
import { CmpttnModal } from "@/components/ui/modal/coMat/cmpttnModal";
|
||||
import { CoMatModal } from "@/components/ui/modal/coMat/coMatModal";
|
||||
import { CmpttnModal } from "@/components/ui/modal/coMat/constCostFeeTable";
|
||||
import { CoMatModal } from "@/components/ui/modal/coMat/rateFeeModal";
|
||||
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
@@ -45,9 +45,8 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import ConCostForm from "@/components/ui/form/coMat/conCostForm/conCostForm";
|
||||
|
||||
export default function CoMatRvw() {
|
||||
const { code, coRvw, coMatRvwInit ,coMatRvwSearch ,coMatRvwInqua} = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
|
||||
useWrStore((state) => state);
|
||||
const { coMatRvwRes } = coRvw;
|
||||
//init, sub, match
|
||||
const initRef = useRef<boolean>(false);
|
||||
@@ -78,9 +77,7 @@ export default function CoMatRvw() {
|
||||
sggCd: string,
|
||||
dmdCoNm: string
|
||||
) => {
|
||||
|
||||
if (dmdCoNm.length>0 ) {
|
||||
|
||||
if (dmdCoNm.length > 0) {
|
||||
coMatRvwSearch(
|
||||
pageNation,
|
||||
13,
|
||||
@@ -101,7 +98,6 @@ export default function CoMatRvw() {
|
||||
const TableCellClick = (index: number) => {
|
||||
console.log(coMatRvwRes);
|
||||
if (coMatRvwRes && coMatRvwRes[index]) {
|
||||
console.log(dmdMatData[index]);
|
||||
|
||||
setSelectData(coMatRvwRes[index]);
|
||||
}
|
||||
@@ -118,21 +114,19 @@ export default function CoMatRvw() {
|
||||
}, [form.watch("useUsgCd")]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
console.log(' coMatRvwRes ', coMatRvwRes)
|
||||
if (coMatRvwRes) {
|
||||
const data = coMatRvwRes?.map((item, index) => {
|
||||
console.log(" item ", item);
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??"");
|
||||
return {
|
||||
...item,
|
||||
ctpvCd: item.demandCo.ctpvCd,
|
||||
sggCd: item.demandCo.sggCd,
|
||||
dmdCoNm: item.demandCo.dmdCoNm,
|
||||
daddr: item.demandCo.daddr,
|
||||
telno: item.demandCo.telno,
|
||||
splyFcltFlg: getdmdMatFlag(item.demandMatching?.splyFcltFlg),
|
||||
ctpvCd: item.demandCo?.ctpvCd,
|
||||
sggCd: item.demandCo?.sggCd,
|
||||
dmdCoNm: item.demandCo?.dmdCoNm,
|
||||
daddr: item.demandCo?.daddr,
|
||||
telno: item.demandCo?.telno,
|
||||
regDt: moment(item?.demandCo?.regDt).format("YYYY-MM-DD"),
|
||||
state: "",
|
||||
splyFcltFlg: flag,
|
||||
};
|
||||
});
|
||||
setDmdMtaData(tableData(data, { code }));
|
||||
@@ -242,16 +236,10 @@ export default function CoMatRvw() {
|
||||
if (String(objSearch.city).length > 0) {
|
||||
con = String(objSearch.city);
|
||||
}
|
||||
if (String(objSearch.sgg).length > 0) {
|
||||
if (String(objSearch.sgg).length > 0 && String(objSearch.sgg) !== "0") {
|
||||
con = String(objSearch.sgg);
|
||||
}
|
||||
getSearch(
|
||||
fromNum,
|
||||
toNum,
|
||||
con,
|
||||
dmdCoNm
|
||||
);
|
||||
|
||||
getSearch(fromNum, toNum, con, dmdCoNm);
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -674,7 +662,7 @@ export default function CoMatRvw() {
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
<ConCostForm form={form} type={'mat'}/>
|
||||
<ConCostForm form={form} type={"mat"} />
|
||||
</ListDiv>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
DmdCoReqSchema,
|
||||
type DmdCoReqType,
|
||||
type RvwHistTableType,
|
||||
} from "@/app/store/matDmd/coMatRvw/type";
|
||||
import {
|
||||
getCity,
|
||||
@@ -32,11 +33,17 @@ import { set, useFieldArray, useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
export default function RuseRvwHstry() {
|
||||
const { code, ruseHist, ruseRvwHistInit, ruseRvwSearch, ruseRvwInqua } =
|
||||
useWrStore((state) => state);
|
||||
const {
|
||||
code,
|
||||
ruseHist,
|
||||
ruseRvwHistInit,
|
||||
ruseRvwSearch,
|
||||
ruseRvwInqua,
|
||||
ruseRvwComplete,
|
||||
} = useWrStore((state) => state);
|
||||
const { rvwHistRes, ruseHistHeadList } = ruseHist;
|
||||
const schema = z.object({});
|
||||
const [pageNation, setPageNatiion] = useState<number>(1);
|
||||
|
||||
const [dmdCoNm, setDmdCoNm] = useState<string>("");
|
||||
@@ -53,7 +60,7 @@ export default function RuseRvwHstry() {
|
||||
const [toDate, setToDate] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
const [rvwHistData, setRvwHistData] = useState<DmdCoReqType[]>();
|
||||
const [rvwHistData, setRvwHistData] = useState<RvwHistTableType[]>();
|
||||
|
||||
const getSelCity = (val: string | number) => {
|
||||
const cityValue = String(val); // Ensure val is treated as a string
|
||||
@@ -85,12 +92,16 @@ export default function RuseRvwHstry() {
|
||||
ruseUtztnFcltNm
|
||||
);
|
||||
} else {
|
||||
|
||||
|
||||
console.log("시도코드", sggCd);
|
||||
ruseRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd);
|
||||
}
|
||||
};
|
||||
|
||||
const form = useForm<DmdCoReqType>({
|
||||
resolver: zodResolver(DmdCoReqSchema),
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
const TableCellClick = useCallback(
|
||||
@@ -106,7 +117,37 @@ export default function RuseRvwHstry() {
|
||||
},
|
||||
[rvwHistRes, form]
|
||||
);
|
||||
|
||||
const confrirmToast = () => {
|
||||
const completeData = rvwHistData
|
||||
?.map((item) => {
|
||||
form.clearErrors;
|
||||
if (item?.completeYn) {
|
||||
return item.dmdInfoSn;
|
||||
}
|
||||
})
|
||||
.filter((item) => item !== undefined);
|
||||
if (form.formState.isDirty) {
|
||||
toast((t) => (
|
||||
<span className="flex flex-col items-center">
|
||||
표준공사비 정보가 변경되었습니다. 검토 완료 진행시 입력한 정보는
|
||||
초기화 됩니다.
|
||||
<br />
|
||||
진행하시겠습니까?
|
||||
<button
|
||||
onClick={() => {
|
||||
toast.dismiss(t.id);
|
||||
ruseRvwComplete(completeData as string[]);
|
||||
}}
|
||||
>
|
||||
확인
|
||||
</button>
|
||||
<button onClick={() => toast.dismiss(t.id)}>취소</button>
|
||||
</span>
|
||||
));
|
||||
} else {
|
||||
ruseRvwComplete(completeData as string[]);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
if (!ruseHist.isInit) {
|
||||
ruseRvwHistInit(
|
||||
@@ -121,13 +162,17 @@ export default function RuseRvwHstry() {
|
||||
useEffect(() => {
|
||||
if (rvwHistRes) {
|
||||
const data = rvwHistRes?.map((item, index) => {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? "");
|
||||
|
||||
console.log("flag", flag);
|
||||
return {
|
||||
...item,
|
||||
ctpvCd: item.demandCo.ctpvCd,
|
||||
sggCd: item.demandCo.sggCd,
|
||||
dmdCoNm: item.demandCo.dmdCoNm,
|
||||
daddr: item.demandCo.daddr,
|
||||
telno: item.demandCo.telno,
|
||||
ctpvCd: item.demandCo?.ctpvCd,
|
||||
sggCd: item.demandCo?.sggCd,
|
||||
dmdCoNm: item.demandCo?.dmdCoNm,
|
||||
daddr: item.demandCo?.daddr,
|
||||
telno: item.demandCo?.telno,
|
||||
regDt: item?.demandCo?.regDt
|
||||
? moment(item?.demandCo?.regDt).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
@@ -137,17 +182,21 @@ export default function RuseRvwHstry() {
|
||||
mtchnCmptnYmd: item?.mtchnCmptnYmd
|
||||
? moment(item?.mtchnCmptnYmd).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
splyFcltFk: item.demandMatching?.splyFcltFk,
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
dmndQty: item.dmndQty,
|
||||
splyFcltFlg: getdmdMatFlag(item.demandMatching?.splyFcltFlg),
|
||||
matYn: false,
|
||||
};
|
||||
splyFcltFlg: flag,
|
||||
completeYn: false,
|
||||
} as unknown as RvwHistTableType;
|
||||
});
|
||||
|
||||
setRvwHistData(tableData(data, { code }));
|
||||
}
|
||||
}, [rvwHistRes]);
|
||||
|
||||
useEffect(() => {}, [form.formState]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("변경여부 ", form.formState.isDirty);
|
||||
}, [form.formState]);
|
||||
|
||||
return (
|
||||
@@ -238,7 +287,7 @@ export default function RuseRvwHstry() {
|
||||
if (String(objSearch.city).length > 0) {
|
||||
con = String(objSearch.city);
|
||||
}
|
||||
if (String(objSearch.sgg).length > 0) {
|
||||
if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") {
|
||||
con = String(objSearch.sgg);
|
||||
}
|
||||
getSearch(
|
||||
@@ -254,7 +303,7 @@ export default function RuseRvwHstry() {
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={(e) => {}}>
|
||||
<Button size={"sm"} onClick={confrirmToast}>
|
||||
검토완료
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,6 @@ import type {
|
||||
chgBuilding,
|
||||
customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
|
||||
import {
|
||||
excelDownload,
|
||||
getCityOrSgg,
|
||||
@@ -23,9 +22,10 @@ import {
|
||||
type ReturnType,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
|
||||
export default function HtdflSttn() {
|
||||
const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore(
|
||||
@@ -119,16 +119,14 @@ export default function HtdflSttn() {
|
||||
selectUnitWaterShedData={code.lgbsnCd}
|
||||
selectMiddleRegionData={code.mdmbsnCd}
|
||||
selectEnvPartData={code.lclgvrnmntCd}
|
||||
rightChildren={
|
||||
<Button
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
setIsChHead(true);
|
||||
}}
|
||||
>
|
||||
조회항목설정
|
||||
</Button>
|
||||
}
|
||||
rightChildren={<Button
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
setIsChHead(true);
|
||||
} }
|
||||
>
|
||||
조회항목설정
|
||||
</Button>}
|
||||
leftChildren={undefined}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
|
||||
@@ -138,13 +136,12 @@ export default function HtdflSttn() {
|
||||
} else {
|
||||
con = returnType.sidoValue;
|
||||
}
|
||||
htdflSttnSearch(pageNation, "20", con);
|
||||
}}
|
||||
htdflSttnSearch(pageNation, "20", con);
|
||||
} }
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {}}
|
||||
initClick={function (): void { } }
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
/>
|
||||
ref={ref} isAdmin={false} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
|
||||
@@ -40,11 +40,9 @@ export default function PbnstSttn() {
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const codeData = getCityOrSgg(ref);
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<WaterReuseFacility[]>();
|
||||
@@ -53,10 +51,8 @@ export default function PbnstSttn() {
|
||||
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]);
|
||||
@@ -69,7 +65,6 @@ export default function PbnstSttn() {
|
||||
pbnstSttn.pbnstSttnRes[index]
|
||||
) {
|
||||
const pbnstRuseFcltPk = pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk;
|
||||
// setClickPk(pbnstRuseFcltPk)
|
||||
getPbnStnDetail(pbnstRuseFcltPk);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -19,7 +19,10 @@ import {
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { chgBuilding, customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type {
|
||||
chgBuilding,
|
||||
customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
@@ -34,7 +37,10 @@ export default function RainSttn() {
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<customRainBdst[]>();
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false })
|
||||
const [detailModal, setDetailModal] = useState<{
|
||||
isOpen: boolean;
|
||||
data: customRainBdst | undefined;
|
||||
}>({ data: undefined, isOpen: false });
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chBuilding: chgBuilding[];
|
||||
@@ -43,20 +49,28 @@ export default function RainSttn() {
|
||||
const codeData = getCityOrSgg(ref);
|
||||
|
||||
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 (
|
||||
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 });
|
||||
setBdstChgProps({
|
||||
isOpen: true,
|
||||
chBuilding: bdstTable[index].chgBuilding,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainSttn.isInit) {
|
||||
@@ -72,8 +86,7 @@ export default function RainSttn() {
|
||||
...item,
|
||||
...item.reuseBuilding[0],
|
||||
...item.reuseBuilding[0].rainyObj,
|
||||
chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? 'Y' : 'N'
|
||||
|
||||
chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N",
|
||||
}))
|
||||
.filter((item: any) => item.rainyObj !== undefined);
|
||||
|
||||
@@ -139,6 +152,7 @@ export default function RainSttn() {
|
||||
initClick={function (): void { }}
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
isAdmin={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,7 +168,9 @@ export default function RainSttn() {
|
||||
headlist={rainSttn.rainSttHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index ?? undefined, headId);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
@@ -179,10 +195,11 @@ export default function RainSttn() {
|
||||
<UiModal
|
||||
open={detailModal.isOpen}
|
||||
onOpenChange={() => {
|
||||
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen })
|
||||
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen });
|
||||
}}
|
||||
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
|
||||
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data} />} />
|
||||
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data} />}
|
||||
/>
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
|
||||
@@ -6,17 +6,23 @@ import {
|
||||
} from "@/components/lib/api";
|
||||
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||
import type { conCostFeeType, rateFeeType } from "./type";
|
||||
export type comFcltState = {
|
||||
searchFclts: pubHasuType;
|
||||
demandCompList: DemandCompType[];
|
||||
dmdIsSucees: string;
|
||||
checkDemand: DemandCompType;
|
||||
constCostRes:conCostFeeType[],
|
||||
rateFeeRes:rateFeeType[],
|
||||
|
||||
};
|
||||
export type comFcltActions = {
|
||||
getSwtrmtFcltNm: (searchNm: string) => void;
|
||||
getDemandCompList: (searchNm: string, cnt: number) => void;
|
||||
regDemandCompany: (data: DemandCompType) => void;
|
||||
updateDemandCompany: (data: DemandCompType) => void;
|
||||
getConstCostFee: (year: string) => void;
|
||||
getRateFee: (year: string) => void;
|
||||
};
|
||||
|
||||
export const searchActions: (set: any) => comFcltActions = (set: any) => {
|
||||
@@ -47,7 +53,7 @@ export const searchActions: (set: any) => comFcltActions = (set: any) => {
|
||||
|
||||
console.log(coList);
|
||||
set((state: comFcltState) => {
|
||||
return state.demandCompList = [...coList];
|
||||
return (state.demandCompList = [...coList]);
|
||||
});
|
||||
},
|
||||
regDemandCompany: async (data: DemandCompType) => {
|
||||
@@ -64,9 +70,8 @@ export const searchActions: (set: any) => comFcltActions = (set: any) => {
|
||||
message = "fail";
|
||||
}
|
||||
set((state: comFcltState) => {
|
||||
state.dmdIsSucees = message;
|
||||
state.dmdIsSucees = message;
|
||||
return state;
|
||||
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
@@ -84,15 +89,34 @@ export const searchActions: (set: any) => comFcltActions = (set: any) => {
|
||||
}
|
||||
|
||||
set((state: comFcltState) => {
|
||||
state.dmdIsSucees = message;
|
||||
state.dmdIsSucees = message;
|
||||
return state;
|
||||
|
||||
});
|
||||
|
||||
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
getRateFee: async (year: string) => {
|
||||
try {
|
||||
const url = `/prcsFclt/CstRt/${year}`;
|
||||
const rateFeeRes = await getFetch(fetchType.COMMON, url);
|
||||
|
||||
set((state: comFcltState) => {
|
||||
return state.rateFeeRes = rateFeeRes;;
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(" error ", e);
|
||||
}
|
||||
},getConstCostFee: async (year: string) => {
|
||||
try {
|
||||
const url = `/prcsFclt/CstRuse/${year}`;
|
||||
const constCost = await getFetch(fetchType.COMMON, url);
|
||||
set((state: comFcltState) => {
|
||||
return state.constCostRes = constCost;;
|
||||
});
|
||||
}catch (e) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
export type conCostFeeType= {
|
||||
yr: string,
|
||||
fctCpc: string,
|
||||
fctCd: string,
|
||||
stdCost: string
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type rateFeeType = {
|
||||
yr: string,
|
||||
incExpCd: string,
|
||||
stdCost: number,
|
||||
rt: number
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type ContCostMap = {
|
||||
gubun: string;
|
||||
"500": number;
|
||||
"1000": number;
|
||||
"2000": number;
|
||||
"3000": number;
|
||||
"5000": number;
|
||||
"10000": number;
|
||||
"20000": number;
|
||||
"30000": number;
|
||||
"50000": number;
|
||||
"100000": number;
|
||||
[key: string]: any;
|
||||
};
|
||||
@@ -1,15 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { CommonTableProps, TableUpperProps } from "../../common/type/header";
|
||||
|
||||
export const sttnHeadListType = z.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
title: z.string(),
|
||||
visible: z.boolean(),
|
||||
})
|
||||
);
|
||||
|
||||
export const coRvwHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
|
||||
export const coRvwHeadListExport: CommonTableProps[]= [
|
||||
{
|
||||
id: "cityText",
|
||||
title: "시도",
|
||||
@@ -47,7 +40,6 @@ export const coRvwHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
// id는 다확인해야함
|
||||
export const coRvwNodeListExport: CommonTableProps[] = [
|
||||
{
|
||||
@@ -81,7 +73,8 @@ export const coRvwNodeListExport: CommonTableProps[] = [
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},{
|
||||
},
|
||||
{
|
||||
id: "telNo",
|
||||
title: "전화번호",
|
||||
visible: true,
|
||||
@@ -105,153 +98,95 @@ export const coRvwNodeListExport: CommonTableProps[] = [
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
export const cmpttnHeadListExport: CommonTableProps[] = [
|
||||
export const constCostHeadListExport: CommonTableProps[] = [
|
||||
{
|
||||
id: "ctpv",
|
||||
id: "gubun",
|
||||
title: "구분",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "sgg",
|
||||
title: "처리시설 용량(m³)",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "500",
|
||||
title: "500",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "1000",
|
||||
title: "1,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},{
|
||||
},
|
||||
{
|
||||
id: "2000",
|
||||
title: "2,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "3000", //바꾸기
|
||||
title: "3,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "5000", //바꾸기
|
||||
title: "5,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "10000", //바꾸기
|
||||
id: "10000", //
|
||||
title: "10,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "20000", //바꾸기
|
||||
id: "20000", //
|
||||
title: "20,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "30000", //바꾸기
|
||||
id: "30000", //
|
||||
title: "30,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "50000", //바꾸기
|
||||
id: "50000", //
|
||||
title: "50,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "100000", //바꾸기
|
||||
title: "100,000",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
export const coModalHeadListExport: CommonTableProps[] = [
|
||||
export const rateFeeHeadListExport: CommonTableProps[] = [
|
||||
{
|
||||
id: "gubun",
|
||||
title: "공사비/구분",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "a",
|
||||
id: "BD",
|
||||
title: "기본조사설계비",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "aa",
|
||||
id: "WD",
|
||||
title: "실시설계비",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "aaa",
|
||||
id: "SE",
|
||||
title: "공사감리비",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "aaaa",
|
||||
id: "CE",
|
||||
title: "시설부대비",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
export const usageProcData =[
|
||||
export const usageProcData = [
|
||||
{ usage: "청소", process: "총인처리시설 + 염소소독" },
|
||||
{ usage: "화장실용수", process: "총인처리시설 + 염소소독" },
|
||||
{ usage: "세척", process: "총인처리시설 + UV소독" },
|
||||
@@ -261,4 +196,4 @@ export const usageProcData =[
|
||||
{ usage: "하천", process: "총인처리시설 + UV소독" },
|
||||
{ usage: "지하수", process: "전처리시설 + RO" },
|
||||
{ usage: "공업", process: "전처리시설 + RO" },
|
||||
]
|
||||
];
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type { z } from "zod";
|
||||
import type { sttnHeadListType } from "../coSttn/headList";
|
||||
import { coRvwHeadListExport, coRvwNodeListExport } from "./headList";
|
||||
import { constCostHeadListExport, coRvwHeadListExport, coRvwNodeListExport, rateFeeHeadListExport } from "./headList";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { DedMatUpdateType, DmdCoReqType } from "./type";
|
||||
import { fetchType, getFetch, putFectch } from "@/components/lib/api";
|
||||
@@ -8,13 +6,16 @@ import toast from "react-hot-toast/headless";
|
||||
|
||||
const coRvwHeadList = coRvwHeadListExport;
|
||||
const coRvwNodeList = coRvwNodeListExport;
|
||||
|
||||
const rateFeeHeadList =rateFeeHeadListExport;
|
||||
const constCostHeadList=constCostHeadListExport
|
||||
export type coRvwState = {
|
||||
coRvw: {
|
||||
isInit: boolean;
|
||||
coMatRvwRes: DmdCoReqType[];
|
||||
coRvwHeadList: CommonTableProps[];
|
||||
coRvwNodeList: CommonTableProps[];
|
||||
rateFeeHeadList: CommonTableProps[];
|
||||
constCostHeadList: CommonTableProps[];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -24,6 +25,8 @@ export const coRvwStateExport: coRvwState = {
|
||||
coMatRvwRes: [],
|
||||
coRvwHeadList: coRvwHeadList,
|
||||
coRvwNodeList: coRvwNodeList,
|
||||
rateFeeHeadList:rateFeeHeadList,
|
||||
constCostHeadList:constCostHeadList
|
||||
},
|
||||
};
|
||||
|
||||
@@ -64,7 +67,7 @@ const coMatInit = async (
|
||||
startYear: string,
|
||||
endYear: string,
|
||||
) => {
|
||||
const url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
|
||||
return coMatRvwRes;
|
||||
@@ -78,8 +81,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
startYear: string,
|
||||
endYear: string,
|
||||
) => {
|
||||
const url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const coMatRvwRes = await coMatInit(pageNo, pageCnt, startYear, endYear);
|
||||
|
||||
return set((state: coRvwState) => ({
|
||||
...state,
|
||||
@@ -127,7 +129,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string,
|
||||
dmdCoNm: string,
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
@@ -159,9 +161,9 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string
|
||||
) => {
|
||||
try {
|
||||
let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
url += `/${sggCd}/0`;
|
||||
}else if(sggCd ==='0'){
|
||||
url += `/0/0`;
|
||||
}
|
||||
@@ -176,6 +178,6 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
} catch (e) {
|
||||
console.log(" error ", e);
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -91,7 +91,8 @@ import { z } from "zod";
|
||||
rvwCmptnYmd: z.string().nullish(),
|
||||
demandCo: DemandCoSchema.nullish(),
|
||||
demandMatching: DemandMatchingSchema.nullish(),
|
||||
demandCst: DemandCstSchema
|
||||
demandCst: DemandCstSchema,
|
||||
ruseUtztnFcltNm:z.string().nullish(),
|
||||
});
|
||||
|
||||
|
||||
@@ -103,7 +104,7 @@ export type DmdMatTableType = {
|
||||
daddr:string,
|
||||
telno:string,
|
||||
regDt:string,
|
||||
state:string
|
||||
splyFcltFlg:string
|
||||
}
|
||||
|
||||
|
||||
@@ -115,4 +116,56 @@ export type DedMatUpdateType =
|
||||
fcltSbsdEpsTrf: number;
|
||||
prcsFcltCpctCstrnCst: number;
|
||||
rgtr: string;
|
||||
}
|
||||
|
||||
|
||||
export type RvwHistTableType = {
|
||||
cityText:string,
|
||||
sggText:string,
|
||||
dmdCoNm:string,
|
||||
daddr:string,
|
||||
telno:string,
|
||||
regDt:string,
|
||||
rvwCmptnYmd:string,
|
||||
mtchnCmptnYmd:string,
|
||||
ruseUtztnFcltNm:string,
|
||||
dmndQty:string,
|
||||
useUsgCd:string,
|
||||
splyFcltFlg:string
|
||||
completeYn:boolean
|
||||
dmdInfoSn :string
|
||||
|
||||
}
|
||||
|
||||
export type RvwHistTableType = {
|
||||
cityText:string,
|
||||
sggText:string,
|
||||
dmdCoNm:string,
|
||||
daddr:string,
|
||||
telno:string,
|
||||
regDt:string,
|
||||
rvwCmptnYmd:string,
|
||||
mtchnCmptnYmd:string,
|
||||
ruseUtztnFcltNm:string,
|
||||
dmndQty:string,
|
||||
useUsgCd:string,
|
||||
splyFcltFlg:string
|
||||
completeYn:boolean
|
||||
dmdInfoSn :string
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type conCostFeeType= {
|
||||
yr: string,
|
||||
fctCpc: string,
|
||||
fctCd: string,
|
||||
stdCost: string
|
||||
}
|
||||
export type rateFeeType = {
|
||||
yr: string,
|
||||
incExpCd: string,
|
||||
stdCost: number,
|
||||
rt: number
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export const ruseHstryHeadListExport:TableUpperProps[]= [
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "splyFcltFk", //바꾸기
|
||||
id: "ruseUtztnFcltNm", //바꾸기
|
||||
title: "공급처",
|
||||
visible: true,
|
||||
},
|
||||
@@ -63,10 +63,9 @@ export const ruseHstryHeadListExport:TableUpperProps[]= [
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "matYn", //바꾸기
|
||||
id: "completeYn", //바꾸기
|
||||
title: "매칭완료 여부",
|
||||
visible: true,
|
||||
type:'check'
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
TableUpperProps,
|
||||
} from "../../common/type/header";
|
||||
import { ruseHstryHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, putFectch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import type { DmdCoReqType } from "../coMatRvw/type";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
@@ -46,7 +46,6 @@ type ruseHstryActions = {
|
||||
sggCd: string,
|
||||
dmdCoNm: string,
|
||||
ruseUtztnFcltNm: string
|
||||
|
||||
) => void;
|
||||
ruseRvwInqua: (
|
||||
pageNo: number,
|
||||
@@ -55,6 +54,7 @@ type ruseHstryActions = {
|
||||
endYear: string,
|
||||
sggCd: string
|
||||
) => void;
|
||||
ruseRvwComplete:( data: string[]) => void;
|
||||
};
|
||||
|
||||
const irvwHistInit = async (
|
||||
@@ -64,7 +64,7 @@ const irvwHistInit = async (
|
||||
endYear: string,
|
||||
sggCd?: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
console.log("sggCd ", sggCd);
|
||||
if (sggCd) {
|
||||
@@ -87,11 +87,6 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
endYear: string,
|
||||
sggCd?: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd) {
|
||||
url += `/${sggCd}`;
|
||||
}
|
||||
const rvwHistRes = await irvwHistInit(
|
||||
pageNo,
|
||||
pageCnt,
|
||||
@@ -122,7 +117,7 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
10,
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
"11"
|
||||
"0"
|
||||
);
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
@@ -146,9 +141,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
sggCd: string,
|
||||
dmdCoNm: string,
|
||||
ruseUtztnFcltNm: string
|
||||
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
@@ -183,11 +177,10 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
sggCd: string
|
||||
) => {
|
||||
try {
|
||||
let url = `/reuseFc/request/infoList/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
url += `/${sggCd}/0`;
|
||||
}
|
||||
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
@@ -200,5 +193,30 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
console.log(" error ", e);
|
||||
}
|
||||
},
|
||||
ruseRvwComplete: async (data: string[]) => {
|
||||
try {
|
||||
const complet = await postFectch(
|
||||
`/reuseFc/request/completeCheck`,
|
||||
JSON.stringify(data),
|
||||
fetchType.WR
|
||||
);
|
||||
if (complet.status === 200) {
|
||||
toast.success("완료 처리가 완료되었습니다.");
|
||||
const rvwHistRes = await irvwHistInit(
|
||||
1,
|
||||
10,
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
"0"
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(" error ", e);
|
||||
toast.error("완료 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -138,21 +138,18 @@ export const yearOptions: { val: string; text: string }[] = Array.from(
|
||||
})
|
||||
);
|
||||
|
||||
export const getdmdMatFlag = (flag: string) => {
|
||||
export const getdmdMatFlag = (flag: string|undefined) => {
|
||||
let flagMat = "";
|
||||
switch (flag) {
|
||||
case "Init":
|
||||
flagMat = "신청";
|
||||
break;
|
||||
case "Sub":
|
||||
flagMat = "검토";
|
||||
break;
|
||||
case "Matched":
|
||||
flagMat = "완료";
|
||||
break;
|
||||
default :
|
||||
flagMat = "";
|
||||
break;
|
||||
|
||||
if(flag === undefined || flag === null) {
|
||||
flagMat = "신청";
|
||||
}else if(flag.trim() === "Sub") {
|
||||
flagMat = "검토";
|
||||
|
||||
}else if(flag.trim() === "matched") {
|
||||
flagMat = "매칭완료";
|
||||
}else {
|
||||
flagMat = "신청";
|
||||
}
|
||||
return flagMat;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@ import type {
|
||||
} from "@/app/store/matDmd/coMatRvw/type";
|
||||
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { formH1Class } from "@/components/lib/class/comClass";
|
||||
import { CmpttnModal } from "@/components/ui/modal/coMat/cmpttnModal";
|
||||
import { CoMatModal } from "@/components/ui/modal/coMat/coMatModal";
|
||||
import { ConstCostFeeTable } from "@/components/ui/modal/coMat/constCostFeeTable";
|
||||
import { RateFeeTableModal } from "@/components/ui/modal/coMat/rateFeeModal";
|
||||
import {
|
||||
Form,
|
||||
FormField,
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
} from "@common/business_components/ui";
|
||||
import PopoverUi from "@common/business_components/ui/popover_ui";
|
||||
import { Button, Input, Label } from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
|
||||
export default function ConCostForm({
|
||||
@@ -27,8 +27,20 @@ export default function ConCostForm({
|
||||
form: UseFormReturn<DmdCoReqType>;
|
||||
type: string;
|
||||
}) {
|
||||
const { coMatRvwUpdate,ruseRvwCalUpdate } = useWrStore((state) => state);
|
||||
const { coMatRvwUpdate, ruseRvwCalUpdate,getRateFee ,getConstCostFee} = useWrStore((state) => state);
|
||||
|
||||
const ref = useRef<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!ref.current) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
getConstCostFee(String(currentYear));
|
||||
getRateFee(String(currentYear));
|
||||
ref.current = true;
|
||||
}
|
||||
}, [ref, getConstCostFee ,getRateFee ]);
|
||||
|
||||
|
||||
const [isTrfMo, setIsTrfMo] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
@@ -36,10 +48,19 @@ export default function ConCostForm({
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
|
||||
|
||||
const zipDowonLoad = () => {
|
||||
fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => {
|
||||
const blobRet = await response.blob();
|
||||
// const blob = new Blob([blobRet], { type: "application/octet-stream" });
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blobRet);
|
||||
link.download =
|
||||
"24년_수도시설 운영비 및 개략공사비 산정프로그램.zip";
|
||||
link.click();
|
||||
});
|
||||
};
|
||||
|
||||
const onSubmit = (value: DmdCoReqType) => {
|
||||
|
||||
if (type === "mat") {
|
||||
const data: DedMatUpdateType = {
|
||||
dmdInfoSn: form.getValues("dmdInfoSn"),
|
||||
@@ -49,11 +70,9 @@ export default function ConCostForm({
|
||||
prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"),
|
||||
rgtr: TEST_UUID,
|
||||
};
|
||||
console.log("mat data ", data);
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data);
|
||||
} else if (type === "hist") {
|
||||
console.log("hist data ", value);
|
||||
ruseRvwCalUpdate(value)
|
||||
ruseRvwCalUpdate(value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -92,7 +111,7 @@ export default function ConCostForm({
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
field.onChange((e.target.value));
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
/>
|
||||
@@ -177,7 +196,7 @@ export default function ConCostForm({
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={(Number(field.value) * 365)|| 0}
|
||||
value={Number(field.value) * 365 || 0}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -295,7 +314,7 @@ export default function ConCostForm({
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
/>
|
||||
@@ -303,9 +322,7 @@ export default function ConCostForm({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-4 mt-4">
|
||||
<div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="demandCst.cstrnCst"
|
||||
@@ -324,12 +341,6 @@ export default function ConCostForm({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<Label>관로 표준공사비 산정 프로그램</Label>
|
||||
<Button size={"sm"} onClick={(e) => {}} className="bg-none">
|
||||
다운로드
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4 mb-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -353,20 +364,30 @@ export default function ConCostForm({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className=" col-span-4 mt-4 ">
|
||||
<Label>관로 표준공사비 산정 프로그램</Label>
|
||||
<Button
|
||||
color="green"
|
||||
size={"sm"}
|
||||
onClick={zipDowonLoad}
|
||||
className="bg-none ml-6"
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
body={<CoMatModal data={[]}></CoMatModal>}
|
||||
bodyClass="w-[40vw] max-w-none h-[70vh]"
|
||||
body={<RateFeeTableModal setReturnData={(e) =>{}}></RateFeeTableModal>}
|
||||
bodyClass="w-[40vw] h-[40vh] "
|
||||
open={isTrfMo.isModal}
|
||||
onOpenChange={(open) => {
|
||||
setIsTrfMo({ isModal: open });
|
||||
}}
|
||||
/>
|
||||
<UiModal
|
||||
body={<CmpttnModal data={[]}></CmpttnModal>}
|
||||
bodyClass="w-[70vw] max-w-none h-[50vh]"
|
||||
open={isCmpttnMo.isModal}
|
||||
body={<ConstCostFeeTable setReturnData={(e) =>{}}></ConstCostFeeTable>}
|
||||
bodyClass="w-[40vw] max-w-none h-[40vh]"
|
||||
open={isCmpttnMo.isModal}
|
||||
onOpenChange={(open) => {
|
||||
setIsCmpttnMo({ isModal: open });
|
||||
}}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import { cmpttnHeadListExport } from "@/app/store/matDmd/coMatRvw/headList";
|
||||
import { yearOptions } from "@/components/lib/func/commom"
|
||||
import { SelectBox, UiTable } from "@common/business_components/ui"
|
||||
import { Label } from "@common/components/ui"
|
||||
import { useState } from "react";
|
||||
|
||||
export function CmpttnModal({ data }: { data: [] }) {
|
||||
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
|
||||
return (
|
||||
<>
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">공사비 산정표 보기</h3>
|
||||
<hr/>
|
||||
<div className="flex items-center">
|
||||
<Label className="text-xl text-gray-600">기준년도</Label>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={"ml-4"}
|
||||
selectArray={yearOptions}
|
||||
value={year}
|
||||
onSelectValue={(val: string | number) => setYear(String(val))} />
|
||||
</div>
|
||||
<UiTable
|
||||
headName={""}
|
||||
tableData={[]}
|
||||
headlist={cmpttnHeadListExport}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={() => { }}
|
||||
onPageChange={() => { }}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import { coModalHeadListExport } from "@/app/store/matDmd/coMatRvw/headList";
|
||||
import { yearOptions } from "@/components/lib/func/commom"
|
||||
import { SelectBox, UiTable } from "@common/business_components/ui"
|
||||
import { Label } from "@common/components/ui"
|
||||
import { useState } from "react";
|
||||
|
||||
export function CoMatModal({ data }: { data: [] }) {
|
||||
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
|
||||
return (
|
||||
<>
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">요율표 보기</h3>
|
||||
<hr/>
|
||||
<div className="flex items-center">
|
||||
<Label className="text-xl text-gray-600">기준년도</Label>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={"ml-4"}
|
||||
selectArray={yearOptions}
|
||||
value={year}
|
||||
onSelectValue={(val: string | number) => setYear(String(val))} />
|
||||
</div>
|
||||
<UiTable
|
||||
headName={""}
|
||||
tableData={[]}
|
||||
headlist={coModalHeadListExport}
|
||||
onPageChange={() => { }} pageSize={0} total={0} cellClick={undefined} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type {
|
||||
conCostFeeType,
|
||||
ContCostMap,
|
||||
} from "@/app/store/common/searchCode/type";
|
||||
import { yearOptions } from "@/components/lib/func/commom";
|
||||
|
||||
import { SelectBox, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Label, ScrollArea } from "@common/components/ui";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
export function ConstCostFeeTable({
|
||||
setReturnData,
|
||||
}: {
|
||||
setReturnData: (data: any) => void;
|
||||
}) {
|
||||
const { coRvw, constCostRes, getConstCostFee } = useWrStore((state) => state);
|
||||
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
|
||||
|
||||
const [constCostData, setConstCostData] = useState<ContCostMap[]>([]);
|
||||
|
||||
|
||||
function getFctDescription(fctCd: string) {
|
||||
const fctMap: { [key: string]: string } = {
|
||||
"001": "총인",
|
||||
"002": "염소.소독",
|
||||
"003": "uv소독",
|
||||
"004": "생물학적탈질",
|
||||
"005": "RO",
|
||||
};
|
||||
|
||||
return fctMap[fctCd];
|
||||
}
|
||||
useEffect(() => {
|
||||
const tableData = constCostRes?.reduce(
|
||||
(acc: ContCostMap[], cur: conCostFeeType) => {
|
||||
const key = cur.fctCd;
|
||||
let target = acc?.find((item: any) => item.gubun === key);
|
||||
if (!target) {
|
||||
target = {
|
||||
gubun: cur.fctCd,
|
||||
"500": 0,
|
||||
"1000": 0,
|
||||
"2000": 0,
|
||||
"3000": 0,
|
||||
"5000": 0,
|
||||
"10000": 0,
|
||||
"20000": 0,
|
||||
"30000": 0,
|
||||
"50000": 0,
|
||||
"100000": 0,
|
||||
};
|
||||
acc?.push(target);
|
||||
}
|
||||
target[cur.fctCpc] = cur.stdCost;
|
||||
|
||||
return acc;
|
||||
},
|
||||
[]
|
||||
);
|
||||
console.log("tableData", tableData);
|
||||
const formattedTableData = tableData?.map((item: ContCostMap) => {
|
||||
return {
|
||||
...item,
|
||||
gubun: getFctDescription(item.gubun) || item.gubun,
|
||||
};
|
||||
});
|
||||
setConstCostData(formattedTableData);
|
||||
}, [constCostRes]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!w-full ">
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
공사비 산정표 보기
|
||||
</h3>
|
||||
<hr />
|
||||
<div className="flex items-center">
|
||||
<Label className="text-xl text-gray-600">기준년도</Label>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={"ml-4"}
|
||||
selectArray={yearOptions}
|
||||
value={year}
|
||||
onSelectValue={(val: string | number) => setYear(String(val))}
|
||||
/>
|
||||
</div>
|
||||
<ScrollArea className="h-[calc(100vh-300px)] w-full">
|
||||
<UiTable
|
||||
headName={""}
|
||||
tableData={constCostData || []}
|
||||
headlist={coRvw.constCostHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={() => {}}
|
||||
onPageChange={() => {}}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { rateFeeType } from "@/app/store/common/searchCode/type";
|
||||
import { yearOptions } from "@/components/lib/func/commom";
|
||||
import { SelectBox, UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Label, ScrollArea } from "@common/components/ui";
|
||||
import { Scroll } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function RateFeeTableModal({
|
||||
setReturnData,
|
||||
}: {
|
||||
setReturnData: (data: any) => void;
|
||||
}) {
|
||||
const { code, coRvw,rateFeeRes } = useWrStore((state) => state);
|
||||
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
|
||||
const [reateFeeTable, setRateFeeTable] = useState<rateFeeType[]>([]);
|
||||
|
||||
const gubunLabelMap: Record<number, string> = {
|
||||
50: "5천만원까지",
|
||||
100: "1억원까지",
|
||||
200: "2억원까지",
|
||||
300: "3억원까지",
|
||||
500: "5억원까지",
|
||||
1000: "10억원까지",
|
||||
2000: "20억원까지",
|
||||
3000: "30억원까지",
|
||||
5000: "50억원까지",
|
||||
10000: "100억원까지",
|
||||
20000: "200억원까지",
|
||||
30000: "300억원까지",
|
||||
40000: "400억원까지",
|
||||
50000: "500억원까지",
|
||||
70000: "700억원까지",
|
||||
100000: "1000억원까지",
|
||||
150000: "1500억원까지",
|
||||
200000: "2000억원까지",
|
||||
300000: "3000억원까지",
|
||||
500000: "5000억원까지",
|
||||
};
|
||||
|
||||
|
||||
const fetchData = async (rateFeeRes: rateFeeType[]) => {
|
||||
const data = await rateFeeRes?.reduce((acc: any, cur: rateFeeType) => {
|
||||
const key = cur.stdCost;
|
||||
let target = acc.find((item: any) => item.stdCost === key);
|
||||
if (!target) {
|
||||
target = {
|
||||
stdCost: cur.stdCost,
|
||||
BD: 0,
|
||||
WD: 0,
|
||||
SE: 0,
|
||||
CE: 0,
|
||||
};
|
||||
acc.push(target);
|
||||
}
|
||||
target[cur.incExpCd] = cur.rt;
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const dataGubun = data?.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
gubun: gubunLabelMap[item.stdCost] || item.stdCost,
|
||||
};
|
||||
});
|
||||
|
||||
return dataGubun?.sort((a: any, b: any) => a.stdCost - b.stdCost);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log("rateFeeRes ", rateFeeRes);
|
||||
if (rateFeeRes?.length >= 0) {
|
||||
fetchData(rateFeeRes).then((data) => {
|
||||
setRateFeeTable(data);
|
||||
});
|
||||
}
|
||||
}, [rateFeeRes]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!h-[calc(100vh-100px)] w-[90vw] max-w-[1200px] min-w-[600px] overflow-hidden">
|
||||
<div className="sticky top-0 z-10 grid grid-cols-6 gap-4 p-4 bg-white">
|
||||
<h3 className="col-span-6 text-2xl font-medium text-label">
|
||||
요율표 보기
|
||||
</h3>
|
||||
<hr className="col-span-6 border-gray-300" />
|
||||
|
||||
<div className="col-span-2 flex items-center">
|
||||
<Label className="text-xl text-gray-600">기준년도</Label>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={"ml-4"}
|
||||
selectArray={yearOptions}
|
||||
value={year}
|
||||
onSelectValue={(val: string | number) => setYear(String(val))}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-6">
|
||||
<ScrollArea className="h-[60vh] overflow-auto">
|
||||
<UiTable
|
||||
className="min-w-full"
|
||||
key={"rateTable" + reateFeeTable?.length}
|
||||
headName={""}
|
||||
tableData={reateFeeTable || []}
|
||||
headlist={coRvw.rateFeeHeadList}
|
||||
onPageChange={() => {}}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</div>
|
||||
</ListDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -129,9 +129,7 @@ export function PbnstRegModal({
|
||||
formType={"reg"}
|
||||
firstFcltData={pbnstBdstForm}
|
||||
indexMng={indexMng}
|
||||
setIndexMng={function (index: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
setIndexMng={setIndexMng}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent className="max-h-full" value="buse">
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
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,
|
||||
import {
|
||||
initValInUsage,
|
||||
initValOutUsage,
|
||||
subTotalObj,
|
||||
totalObj,
|
||||
type PrfType,
|
||||
} from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import {
|
||||
pbnstRegArrayZod,
|
||||
pbnstRegZod,
|
||||
type customPbnst,
|
||||
type 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";
|
||||
@@ -15,11 +23,13 @@ import {
|
||||
Button,
|
||||
TabsContent,
|
||||
} from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect, useState } from "react";
|
||||
import { set } from "react-hook-form";
|
||||
import { set, useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
const { code, pbnstSttn,prfmnc } = useWrStore((state) => state);
|
||||
const { code, pbnstSttn, prfmnc } = useWrStore((state) => state);
|
||||
const [fcltTab, setFcltTab] = useState<string>("fclt");
|
||||
const [ruseTab, setRuseTab] = useState<string>("inoutTotal");
|
||||
const [ruseBizData, setRuseBizData] = useState<{
|
||||
@@ -28,9 +38,22 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
}>();
|
||||
const [ruseHeadList, setRuseHeadList] = useState<TableUpperProps[]>([]);
|
||||
const [ruseTableData, setRuseTableData] = useState<TableUpperProps[]>([]);
|
||||
const [prfData , setPrfData] = useState<{inPrf: any[],outPrf: any[], totalPrf:any[] }> ()
|
||||
const [prfData, setPrfData] = useState<{
|
||||
inPrf: any[];
|
||||
outPrf: any[];
|
||||
totalPrf: any[];
|
||||
}>();
|
||||
const [indexMng, setIndexMng] = useState<number>(0);
|
||||
const [indexBiz, setIndexBiz] = useState<number>(0);
|
||||
const form = useForm<{
|
||||
items: z.infer<typeof pbnstRegZod>[];
|
||||
}>({
|
||||
resolver: zodResolver(z.object({ items: pbnstRegArrayZod })),
|
||||
defaultValues: { items: pbnstRegArrayZod.parse([]) },
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
const {monthHeadList } = prfmnc;
|
||||
const { monthHeadList } = prfmnc;
|
||||
useEffect(() => {
|
||||
let tableData;
|
||||
if (fcltTab === "fclt") {
|
||||
@@ -38,46 +61,46 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
return {
|
||||
cycl: item.cycl + "차",
|
||||
seCd: item.seCd,
|
||||
gvsbs: item.gvsbs??'-',
|
||||
lcep: item.lcep??'-',
|
||||
cusrAlotm: item.cusrAlotm??'-',
|
||||
etc: item.etc??'-',
|
||||
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??'-',
|
||||
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,
|
||||
};
|
||||
})
|
||||
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,
|
||||
};
|
||||
})
|
||||
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) => {
|
||||
@@ -97,18 +120,20 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
});
|
||||
} else if (fcltTab === "dmdCo") {
|
||||
tableData = data.fcBizs?.flatMap((item: fcBizType) => {
|
||||
|
||||
console.log("item.fcDemands", item.fcDemands);
|
||||
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,
|
||||
};
|
||||
})
|
||||
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);
|
||||
@@ -137,85 +162,98 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
pbnstSttn.ruseDmdHeadList,
|
||||
]);
|
||||
|
||||
const getTablePrfData = (prfList:PrfType[]) => {
|
||||
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}월`;
|
||||
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;
|
||||
inUsageData.forEach((inData: any) => {
|
||||
const usageKey = inData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
inData[monthKey] = value;
|
||||
inData.total += value;
|
||||
inData[monthKey] = value;
|
||||
inData.total += value;
|
||||
|
||||
if (inSubtotal && usageKey !== "subtotal") {
|
||||
(inSubtotal as any)[monthKey] =
|
||||
((inSubtotal as any)[monthKey] ?? 0) + value;
|
||||
inSubtotal.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;
|
||||
outUsageData.forEach((outData: any) => {
|
||||
const usageKey = outData.usage;
|
||||
const value = (prfItem as any)[usageKey] ?? 0;
|
||||
|
||||
outData[monthKey] = value;
|
||||
outData.total += value;
|
||||
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);
|
||||
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];
|
||||
(usageTotalObj as any)[key] = val;
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
|
||||
setPrfData({
|
||||
inPrf: inUsageData,
|
||||
outPrf: outUsageData,
|
||||
totalPrf: tableData,
|
||||
});
|
||||
setPrfData({
|
||||
inPrf: inUsageData,
|
||||
outPrf: outUsageData,
|
||||
totalPrf: tableData,
|
||||
});
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstSttnRes && data) {
|
||||
const prfList = pbnstSttn.pbnstSttnRes.find(
|
||||
(item) => item.pbnstRuseFcltPk === data.pbnstRuseFcltPk
|
||||
)?.prfList;
|
||||
|
||||
}
|
||||
useEffect(() => {
|
||||
|
||||
if(pbnstSttn.pbnstSttnRes&&data){
|
||||
const prfList = pbnstSttn.pbnstSttnRes.find((item) => item.pbnstRuseFcltPk=== data.pbnstRuseFcltPk )?.prfList
|
||||
|
||||
if(prfList){
|
||||
getTablePrfData(prfList)
|
||||
if (prfList) {
|
||||
getTablePrfData(prfList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}, [pbnstSttn.pbnstSttnRes, data]);
|
||||
|
||||
useEffect(() => {}, [ruseBizData?.head]);
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
if(data){
|
||||
form.reset({items:[data]})
|
||||
}
|
||||
|
||||
},[data, form])
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<Title title={"하수재이용 시설 상세정보"} />
|
||||
<ScrollArea className={"h-[70vh]"}>
|
||||
<PbnstMngForm firstFcltData={data} formType={"sttn"} />
|
||||
<PbnstMngForm
|
||||
form={form}
|
||||
formType={"sttn"}
|
||||
indexMng={indexMng}
|
||||
setIndexMng={setIndexMng}
|
||||
/>
|
||||
<Tabs defaultValue="mng" onValueChange={setFcltTab}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="fclt">
|
||||
@@ -245,7 +283,11 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
children={fcltTab==='fclt'?<HeadMakeColSpan upHeadList={pbnstSttn.ruseFcltNodeList} />:undefined}
|
||||
children={
|
||||
fcltTab === "fclt" ? (
|
||||
<HeadMakeColSpan upHeadList={pbnstSttn.ruseFcltNodeList} />
|
||||
) : undefined
|
||||
}
|
||||
></UiTable>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
@@ -263,22 +305,21 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
</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>
|
||||
)}
|
||||
{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>
|
||||
</>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user