@@ -46,7 +46,7 @@ import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/b
|
||||
export default function CoMatRvw() {
|
||||
const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
|
||||
useWrStore((state) => state);
|
||||
const { coMatRvwRes } = coRvw;
|
||||
const { coMatRvwRes,coMatRvwCount } = coRvw;
|
||||
//init, sub, match
|
||||
const initRef = useRef<boolean>(false);
|
||||
const { coRvwHeadList } = coRvw;
|
||||
@@ -276,7 +276,7 @@ export default function CoMatRvw() {
|
||||
tableData={dmdMatData || []}
|
||||
headlist={coRvwHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
total={coMatRvwCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
if (index !== undefined && index >= 0) {
|
||||
TableCellClick(index);
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
type RvwHistTableType,
|
||||
} from "@/app/store/matDmd/coMatRvw/type";
|
||||
import {
|
||||
formatPhoneNumber,
|
||||
getCity,
|
||||
getdmdMatFlag,
|
||||
yearOptions,
|
||||
@@ -43,7 +44,7 @@ export default function RuseRvwHstry() {
|
||||
ruseRvwInqua,
|
||||
ruseRvwComplete,
|
||||
} = useWrStore((state) => state);
|
||||
const { rvwHistRes, ruseHistHeadList } = ruseHist;
|
||||
const { rvwHistRes, ruseHistHeadList,rvwHistCount } = ruseHist;
|
||||
const [pageNation, setPageNatiion] = useState<number>(1);
|
||||
|
||||
const [dmdCoNm, setDmdCoNm] = useState<string>("");
|
||||
@@ -69,6 +70,36 @@ export default function RuseRvwHstry() {
|
||||
setObjSearch({ city: cityValue, sgg: "0" });
|
||||
};
|
||||
|
||||
useEffect(() =>{
|
||||
getButtonSearch()
|
||||
},[pageNation])
|
||||
|
||||
const getButtonSearch=()=>{
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
if (fromNum > toNum) {
|
||||
toast.error(
|
||||
"시작년도가 종료년도 이후로 설정할 수 없습니다."
|
||||
);
|
||||
} else {
|
||||
let con: string | number = "";
|
||||
if (String(objSearch.city).length > 0) {
|
||||
con = String(objSearch.city);
|
||||
}
|
||||
if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") {
|
||||
con = String(objSearch.sgg);
|
||||
}
|
||||
getSearch(
|
||||
fromNum,
|
||||
toNum,
|
||||
con,
|
||||
dmdCoNm,
|
||||
ruseUtztnFcltNm
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
const getSgg = (val: string | number) => {
|
||||
console.log(val);
|
||||
setObjSearch({ ...objSearch, sgg: String(val) });
|
||||
@@ -163,23 +194,29 @@ export default function RuseRvwHstry() {
|
||||
const data = rvwHistRes?.map((item, index) => {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? "");
|
||||
|
||||
const formatDate = (dateStr: string | null | undefined) => {
|
||||
// null, undefined, 빈 문자열인 경우 '없음'을 반환합니다.
|
||||
if (!dateStr) return "없음";
|
||||
// "YYYYMMDD" 형식으로 날짜를 파싱합니다.
|
||||
const d = moment(dateStr, "YYYYMMDD");
|
||||
// 파싱된 날짜가 유효한 경우에만 포맷하고, 그렇지 않으면 '없음'을 반환합니다.
|
||||
return d.isValid() ? d.format("YYYY-MM-DD") : "없음";
|
||||
};
|
||||
|
||||
return {
|
||||
...item,
|
||||
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")
|
||||
: "없음",
|
||||
rvwCmptnYmd: item?.rvwCmptnYmd
|
||||
? moment(item?.rvwCmptnYmd).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
mtchnCmptnYmd: item?.mtchnCmptnYmd
|
||||
? moment(item?.mtchnCmptnYmd).format("YYYY-MM-DD")
|
||||
telno: formatPhoneNumber(item.demandCo?.telno ||''),
|
||||
dmndTmng: item?.dmndTmng
|
||||
? moment(item?.dmndTmng).format("YYYY-MM-DD")
|
||||
: "없음",
|
||||
|
||||
rvwCmptnYmd: formatDate(item.demandMatching?.rvwCmptnYmd),
|
||||
mtchnCmptnYmd: formatDate(item.demandMatching?.mtchnCmptnYmd),
|
||||
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
dmndQty: item.dmndQty,
|
||||
splyFcltFlg: flag,
|
||||
@@ -272,30 +309,7 @@ export default function RuseRvwHstry() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={(e) => {
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
if (fromNum > toNum) {
|
||||
toast.error(
|
||||
"시작년도가 종료년도 이후로 설정할 수 없습니다."
|
||||
);
|
||||
} else {
|
||||
let con: string | number = "";
|
||||
if (String(objSearch.city).length > 0) {
|
||||
con = String(objSearch.city);
|
||||
}
|
||||
if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") {
|
||||
con = String(objSearch.sgg);
|
||||
}
|
||||
getSearch(
|
||||
fromNum,
|
||||
toNum,
|
||||
con,
|
||||
dmdCoNm,
|
||||
ruseUtztnFcltNm
|
||||
);
|
||||
}
|
||||
}
|
||||
getButtonSearch()
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -318,17 +332,23 @@ export default function RuseRvwHstry() {
|
||||
tableData={rvwHistData || []}
|
||||
headlist={ruseHistHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
total={rvwHistCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
TableCellClick(index);
|
||||
}}
|
||||
onPageChange={setPageNatiion}
|
||||
onPageChange={
|
||||
(page)=>{
|
||||
setPageNatiion(page)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
></UiTable>
|
||||
<hr />
|
||||
{/* <hr />
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
수요신청 상세현황
|
||||
</h3>
|
||||
<ConCostForm form={form} type={"hist"} />
|
||||
<ConCostForm form={form} type={"hist"} selectionVersion={0} /> */}
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from "./headList";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { DedMatUpdateType, DmdCoReqType } from "./type";
|
||||
import { fetchType, getFetch, putFectch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount, putFectch } from "@/components/lib/api";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
const coRvwHeadList = coRvwHeadListExport;
|
||||
@@ -21,6 +21,7 @@ export type coRvwState = {
|
||||
coRvwNodeList: CommonTableProps[];
|
||||
rateFeeHeadList: CommonTableProps[];
|
||||
constCostHeadList: CommonTableProps[];
|
||||
coMatRvwCount:number;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -32,6 +33,7 @@ export const coRvwStateExport: coRvwState = {
|
||||
coRvwNodeList: coRvwNodeList,
|
||||
rateFeeHeadList: rateFeeHeadList,
|
||||
constCostHeadList: constCostHeadList,
|
||||
coMatRvwCount:1
|
||||
},
|
||||
};
|
||||
|
||||
@@ -72,8 +74,8 @@ const coMatInit = async (
|
||||
startYear: string,
|
||||
endYear: string
|
||||
) => {
|
||||
const url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
const coMatRvwRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return coMatRvwRes;
|
||||
};
|
||||
@@ -93,7 +95,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
init: false,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count
|
||||
},
|
||||
}));
|
||||
},
|
||||
@@ -119,7 +122,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
...state,
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count,
|
||||
init: false,
|
||||
},
|
||||
}));
|
||||
@@ -138,7 +142,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string,
|
||||
dmdCoNm: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
@@ -152,13 +156,14 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
}
|
||||
|
||||
console.log(" url ", url);
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const coMatRvwRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return set((state: coRvwState) => ({
|
||||
...state,
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count,
|
||||
},
|
||||
}));
|
||||
},
|
||||
@@ -170,18 +175,19 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
sggCd: string
|
||||
) => {
|
||||
try {
|
||||
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}/0`;
|
||||
} else if (sggCd === "0") {
|
||||
url += `/0/0`;
|
||||
}
|
||||
const coMatRvwRes = await getFetch(fetchType.WR, url);
|
||||
const coMatRvwRes = await getFetchWithCount(fetchType.WR, url);
|
||||
return set((state: coRvwState) => ({
|
||||
...state,
|
||||
coRvw: {
|
||||
...state.coRvw,
|
||||
coMatRvwRes: coMatRvwRes,
|
||||
coMatRvwRes: coMatRvwRes.data,
|
||||
coMatRvwCount:coMatRvwRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
|
||||
@@ -19,8 +19,6 @@ const DemandInfoSchema = z.object({
|
||||
cdtnv: z.number().nullish(),
|
||||
rmrk: z.string().nullish(),
|
||||
useUsgCd: z.string().nullish(),
|
||||
mtchnCmptnYmd: z.string().nullish(),
|
||||
rvwCmptnYmd: z.string().nullish(),
|
||||
});
|
||||
|
||||
const DemandMatchingSchema = z.object({
|
||||
@@ -35,6 +33,8 @@ const DemandMatchingSchema = z.object({
|
||||
useUsgCd: z.string().nullish(),
|
||||
dmdInfoSn: z.number().nullish(),
|
||||
splyCndtList: z.array(z.string().nullish()).nullish(),
|
||||
mtchnCmptnYmd: z.string().nullish(),
|
||||
rvwCmptnYmd: z.string().nullish(),
|
||||
});
|
||||
|
||||
const DemandCoSchema = z.object({
|
||||
@@ -114,6 +114,7 @@ export type DedMatUpdateType = {
|
||||
fcltSbsdCstrnCst: number;
|
||||
prcsFcltCpctCstrnCst: number;
|
||||
rgtr: string;
|
||||
flg?:string;
|
||||
};
|
||||
|
||||
export type RvwHistTableType = {
|
||||
|
||||
@@ -28,7 +28,7 @@ export const ruseHstryHeadListExport:TableUpperProps[]= [
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "regDt", //바꾸기
|
||||
id: "dmndTmng", //바꾸기
|
||||
title: "신청일자",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
TableUpperProps,
|
||||
} from "../../common/type/header";
|
||||
import { ruseHstryHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api";
|
||||
import type { DmdCoReqType } from "../coMatRvw/type";
|
||||
import toast from "react-hot-toast";
|
||||
import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
|
||||
@@ -16,6 +16,7 @@ export type ruseHstryState = {
|
||||
ruseHist: {
|
||||
isInit: boolean;
|
||||
rvwHistRes: DmdCoReqType[];
|
||||
rvwHistCount:number;
|
||||
ruseHistHeadList: TableUpperProps[];
|
||||
};
|
||||
};
|
||||
@@ -25,6 +26,7 @@ export const ruseHstryStateExport: ruseHstryState = {
|
||||
isInit: false,
|
||||
rvwHistRes: [],
|
||||
ruseHistHeadList: ruseHistHeadList,
|
||||
rvwHistCount:1,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -79,14 +81,14 @@ const irvwHistInit = async (
|
||||
startYear: string,
|
||||
endYear: string,
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
// console.log("sggCd ", sggCd);
|
||||
// if (sggCd) {
|
||||
// url += `/${sggCd}`;
|
||||
// }
|
||||
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
const rvwHistRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return rvwHistRes;
|
||||
};
|
||||
@@ -115,7 +117,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
init: false,
|
||||
rvwHistRes: rvwHistRes,
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count
|
||||
},
|
||||
}));
|
||||
},
|
||||
@@ -140,8 +143,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
init: false,
|
||||
rvwHistRes: rvwHistRes,
|
||||
},
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count },
|
||||
}));
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -158,7 +161,7 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
dmdCoNm: string,
|
||||
ruseUtztnFcltNm: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}`;
|
||||
@@ -175,14 +178,14 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
} else {
|
||||
url += `/0`;
|
||||
}
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
const rvwHistRes = await getFetchWithCount(fetchType.WR, url);
|
||||
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
rvwHistRes: rvwHistRes,
|
||||
},
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count },
|
||||
}));
|
||||
},
|
||||
ruseRvwInqua: async (
|
||||
@@ -193,16 +196,17 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
sggCd: string
|
||||
) => {
|
||||
try {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
if (sggCd.length > 0) {
|
||||
url += `/${sggCd}/0`;
|
||||
}
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
const rvwHistRes = await getFetchWithCount(fetchType.WR, url);
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
rvwHistRes: rvwHistRes,
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
@@ -224,6 +228,15 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
);
|
||||
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
ruseHist: {
|
||||
...state.ruseHist,
|
||||
rvwHistRes: rvwHistRes.data,
|
||||
rvwHistCount:rvwHistRes.count
|
||||
},
|
||||
}));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(" error ", e);
|
||||
|
||||
@@ -169,12 +169,13 @@ export const getdmdMatFlag = (flag: string | undefined | null) => {
|
||||
const cleanFlag = (flag ?? "").trim();
|
||||
|
||||
|
||||
console.log('cleanFlag ', cleanFlag)
|
||||
switch (cleanFlag) {
|
||||
case "Sub":
|
||||
return "검토";
|
||||
case "matched":
|
||||
case "Matched":
|
||||
return "매칭완료";
|
||||
case "Checked":
|
||||
return '검토완료';
|
||||
default:
|
||||
return "신청";
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ import {
|
||||
UiTable,
|
||||
} from "@common/business_components/ui";
|
||||
import PopoverUi from "@common/business_components/ui/popover_ui";
|
||||
import { Button, Input, Label } from "@common/components/ui";
|
||||
import type { read } from "fs";
|
||||
import { Button, Checkbox, Input, Label } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
@@ -48,6 +47,8 @@ export default function ConCostForm({
|
||||
|
||||
const ref = useRef<boolean>(false);
|
||||
|
||||
const [checkFinish, setCheckFinish] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!ref.current) {
|
||||
const currentYear = new Date().getFullYear();
|
||||
@@ -57,6 +58,13 @@ export default function ConCostForm({
|
||||
}
|
||||
}, [ref, getConstCostFee, getRateFee]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// 다른 행을 선택하면(selectionVersion 변경) 체크박스 상태를 초기화합니다.
|
||||
setCheckFinish(false);
|
||||
}, [selectionVersion]);
|
||||
|
||||
|
||||
const zipDowonLoad = () => {
|
||||
fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => {
|
||||
const blobRet = await response.blob();
|
||||
@@ -74,36 +82,38 @@ export default function ConCostForm({
|
||||
const cstrnCst = form.watch("demandCst.cstrnCst");
|
||||
const useUsgCdWatch = form.watch("useUsgCd");
|
||||
|
||||
|
||||
|
||||
const calculateConstCost = useCallback(() => {
|
||||
const usgPrcsProcs = usgPrcsProcsWatch;
|
||||
if(!dmndQtyWatch){
|
||||
toast.error('요구수량(M3/d)을 확인해주세요 계산할수 없습니다. ')
|
||||
return
|
||||
if (!dmndQtyWatch) {
|
||||
toast.error("요구수량(M3/d)을 확인해주세요 계산할수 없습니다. ");
|
||||
return;
|
||||
}
|
||||
if (usgPrcsProcs === null || usgPrcsProcs === undefined) {
|
||||
toast.error(
|
||||
"용도에 따른 처리공정을 확인할수 없습니다. 용도를 확인해주세요. "
|
||||
);
|
||||
return;
|
||||
}
|
||||
if(usgPrcsProcs === null || usgPrcsProcs === undefined){
|
||||
toast.error('용도에 따른 처리공정을 확인할수 없습니다. 용도를 확인해주세요. ')
|
||||
return
|
||||
}
|
||||
|
||||
const dmndQtyYear = dmndQtyWatch * 365;
|
||||
if (usgPrcsProcs && usgPrcsProcs?.length > 0) {
|
||||
const firstProc = getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || "";
|
||||
const secondProc = getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || "";
|
||||
const firstProc =
|
||||
getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || "";
|
||||
const secondProc =
|
||||
getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || "";
|
||||
|
||||
const { lower: firstLower, upper: firstUpper } = findBounds(
|
||||
constCostRes,
|
||||
firstProc || "",
|
||||
'fctCd',
|
||||
'fctCpc',
|
||||
"fctCd",
|
||||
"fctCpc",
|
||||
Number(dmndQtyYear)
|
||||
);
|
||||
const { lower: secondLower, upper: secondUpper } = findBounds(
|
||||
constCostRes,
|
||||
secondProc || "",
|
||||
'fctCd',
|
||||
'fctCpc',
|
||||
"fctCd",
|
||||
"fctCpc",
|
||||
Number(dmndQtyYear)
|
||||
);
|
||||
|
||||
@@ -122,52 +132,56 @@ export default function ConCostForm({
|
||||
const groupCodes = ["BD", "CE", "SE", "WD"];
|
||||
const groupedBounds: { [key: string]: { lower?: any; upper?: any } } = {};
|
||||
for (const code of groupCodes) {
|
||||
|
||||
groupedBounds[code] = findBounds(rateFeeRes, code, 'incExpCd', 'stdCost',result);
|
||||
groupedBounds[code] = findBounds(
|
||||
rateFeeRes,
|
||||
code,
|
||||
"incExpCd",
|
||||
"stdCost",
|
||||
result
|
||||
);
|
||||
}
|
||||
const resultRate = transformAndInterpolate(groupedBounds, result);
|
||||
const fcltSbsdCstrnCst = (result* (resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD) / 100);
|
||||
const fcltSbsdCstrnCst =
|
||||
(result *
|
||||
(resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD)) /
|
||||
100;
|
||||
const realResult = result + fcltSbsdCstrnCst;
|
||||
|
||||
form.setValue("demandCst.prcsFcltCpctCstrnCst", Math.round(result) );
|
||||
form.setValue("demandCst.fcltSbsdCstrnCst", Math.round(fcltSbsdCstrnCst)) ;
|
||||
form.setValue("totalConstCost", Math.round(realResult));
|
||||
form.setValue("demandCst.prcsFcltCpctCstrnCst", Math.round(result));
|
||||
form.setValue("demandCst.fcltSbsdCstrnCst", Math.round(fcltSbsdCstrnCst));
|
||||
form.setValue("totalConstCost", Math.round(realResult));
|
||||
}
|
||||
}, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]);
|
||||
const onSubmit = (value: DmdCoReqType) => {
|
||||
|
||||
if(value.demandCst&& !value.demandCst.prcsFcltCpctCstrnCst ){
|
||||
toast.error('공사비 계산 진행 후 저장을 눌러주새요')
|
||||
return
|
||||
if (value.demandCst && !value.demandCst.prcsFcltCpctCstrnCst) {
|
||||
toast.error("공사비 계산 진행 후 저장을 눌러주새요");
|
||||
return;
|
||||
}
|
||||
if (type === "mat") {
|
||||
|
||||
if(value.demandCst ){
|
||||
if (value.demandCst) {
|
||||
const data: DedMatUpdateType = {
|
||||
dmdInfoSn: value.dmdInfoSn,
|
||||
usgPrcsProcs: value.demandCst.usgPrcsProcs|| "",
|
||||
cstrnCst: value.demandCst.cstrnCst ||0,
|
||||
fcltSbsdCstrnCst: value.demandCst.fcltSbsdCstrnCst ||0,
|
||||
prcsFcltCpctCstrnCst: value.demandCst.prcsFcltCpctCstrnCst ||0,
|
||||
usgPrcsProcs: value.demandCst.usgPrcsProcs || "",
|
||||
cstrnCst: value.demandCst.cstrnCst || 0,
|
||||
fcltSbsdCstrnCst: value.demandCst.fcltSbsdCstrnCst || 0,
|
||||
prcsFcltCpctCstrnCst: value.demandCst.prcsFcltCpctCstrnCst || 0,
|
||||
flg: checkFinish?'Checked':'Sub',
|
||||
rgtr: TEST_UUID,
|
||||
};
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data);
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data);
|
||||
}
|
||||
} else if (type === "hist") {
|
||||
|
||||
delete value.totalConstCost
|
||||
delete value.ruseUtztnFcltNm
|
||||
|
||||
delete value.totalConstCost;
|
||||
delete value.ruseUtztnFcltNm;
|
||||
|
||||
ruseRvwCalUpdate(value);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log(" form ", form.formState.errors);
|
||||
console.log(" form ", form.formState.errors);
|
||||
}, [form.formState]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
form.register("dmdInfoSn");
|
||||
form.register("dmdInfoFk");
|
||||
@@ -187,18 +201,30 @@ export default function ConCostForm({
|
||||
<Button className="mx-3" size={"sm"} onClick={calculateConstCost}>
|
||||
계산
|
||||
</Button>
|
||||
<Button className="mr-3" size={"sm"} onClick={form.handleSubmit(onSubmit)}>
|
||||
<Button
|
||||
className="mr-3"
|
||||
size={"sm"}
|
||||
onClick={form.handleSubmit(onSubmit)}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
<Label>관로 표준공사비 산정 프로그램</Label>
|
||||
<Button
|
||||
color="green"
|
||||
size={"sm"}
|
||||
onClick={zipDowonLoad}
|
||||
className="bg-none ml-6"
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
<Label>검토완료</Label>
|
||||
<Checkbox
|
||||
className="ml-3 mr-6"
|
||||
checked={checkFinish}
|
||||
onCheckedChange={(checked) =>
|
||||
// 'indeterminate' 상태를 무시하고 순수 boolean 값으로만 상태를 업데이트합니다.
|
||||
setCheckFinish(checked === true)}
|
||||
></Checkbox>
|
||||
<Label>관로 표준공사비 산정 프로그램</Label>
|
||||
<Button
|
||||
color="green"
|
||||
size={"sm"}
|
||||
onClick={zipDowonLoad}
|
||||
className="bg-none ml-6"
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-12 w-full">
|
||||
<h1 className={formH1Class}>기본사항</h1>
|
||||
@@ -310,14 +336,14 @@ export default function ConCostForm({
|
||||
<h1 className={formH1Class}>공사비 입력사항</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="col-span-2 mt-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<PopoverUi
|
||||
childrenTriger={
|
||||
<>
|
||||
<Label className="underline">
|
||||
처리시설용량에 따른 공사비(백만원) <i className="diveicon di-search" />
|
||||
처리시설용량에 따른 공사비(백만원){" "}
|
||||
<i className="diveicon di-search" />
|
||||
</Label>
|
||||
</>
|
||||
}
|
||||
@@ -394,7 +420,8 @@ export default function ConCostForm({
|
||||
childrenTriger={
|
||||
<>
|
||||
<Label className="underline">
|
||||
처리시설 총사업비(백만원) <i className="diveicon di-search" />
|
||||
처리시설 총사업비(백만원){" "}
|
||||
<i className="diveicon di-search" />
|
||||
</Label>
|
||||
</>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user