수요 매칭 및 재이용 검토 이력 저장 수정 및 실적 수정
This commit is contained in:
@@ -14,9 +14,6 @@ import {
|
||||
tableData,
|
||||
yearOptions,
|
||||
} from "@/components/lib/func/commom";
|
||||
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,
|
||||
Form,
|
||||
@@ -43,6 +40,7 @@ import moment from "moment";
|
||||
import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import ConCostForm from "@/components/ui/form/coMat/conCostForm/conCostForm";
|
||||
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
|
||||
|
||||
export default function CoMatRvw() {
|
||||
const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
|
||||
@@ -114,7 +112,7 @@ export default function CoMatRvw() {
|
||||
}, [form.watch("useUsgCd")]);
|
||||
|
||||
useEffect(() => {
|
||||
if (coMatRvwRes) {
|
||||
if (coMatRvwRes.length > 0) {
|
||||
const data = coMatRvwRes?.map((item, index) => {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??"");
|
||||
|
||||
@@ -121,7 +121,7 @@ export default function RuseRvwHstry() {
|
||||
?.map((item) => {
|
||||
form.clearErrors;
|
||||
if (item?.completeYn) {
|
||||
return item.dmdInfoSn;
|
||||
return Number(item.dmdInfoSn);
|
||||
}
|
||||
})
|
||||
.filter((item) => item !== undefined);
|
||||
@@ -135,7 +135,7 @@ export default function RuseRvwHstry() {
|
||||
<button
|
||||
onClick={() => {
|
||||
toast.dismiss(t.id);
|
||||
ruseRvwComplete(completeData as string[]);
|
||||
ruseRvwComplete(completeData as Number[]);
|
||||
}}
|
||||
>
|
||||
확인
|
||||
@@ -144,7 +144,7 @@ export default function RuseRvwHstry() {
|
||||
</span>
|
||||
));
|
||||
} else {
|
||||
ruseRvwComplete(completeData as string[]);
|
||||
ruseRvwComplete(completeData as Number[]);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
@@ -164,7 +164,6 @@ export default function RuseRvwHstry() {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? "");
|
||||
|
||||
console.log("flag", flag);
|
||||
return {
|
||||
...item,
|
||||
ctpvCd: item.demandCo?.ctpvCd,
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function Page() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainChkgdn.isInit) {
|
||||
rainChkInit("2024", "0");
|
||||
rainChkInit(new Date().getFullYear().toString(), "0");
|
||||
isRainSttn(false)
|
||||
|
||||
setIsModal({ data: {}, open: false });
|
||||
@@ -78,7 +78,7 @@ export default function Page() {
|
||||
}
|
||||
|
||||
if (!rswtChkgdn.isInit) {
|
||||
rswtChkgdnInit("2024", "0");
|
||||
rswtChkgdnInit(new Date().getFullYear().toString(), "0");
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ import { z } from "zod";
|
||||
dmdInfoSn: z.number(),
|
||||
usgPrcsProcs: z.string().nullish(),
|
||||
cstrnCst: z.number(),
|
||||
fcltSbsdEpsTrf: z.number(),
|
||||
fcltSbsdCstrnCst: z.number(),
|
||||
prcsFcltCpctCstrnCst: z.number()
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ export type DedMatUpdateType =
|
||||
dmdInfoSn: number;
|
||||
usgPrcsProcs: string;
|
||||
cstrnCst: number;
|
||||
fcltSbsdEpsTrf: number;
|
||||
fcltSbsdCstrnCst: number;
|
||||
prcsFcltCpctCstrnCst: number;
|
||||
rgtr: string;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { ruseHstryHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, 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";
|
||||
|
||||
const ruseHistHeadList = ruseHstryHeadListExport;
|
||||
|
||||
@@ -29,6 +30,21 @@ export const ruseHstryStateExport: ruseHstryState = {
|
||||
|
||||
export type ruseHstryType = ruseHstryState & ruseHstryActions;
|
||||
|
||||
//
|
||||
export const addRgtrAndMdfrToDemandObj = (data: DmdCoReqType) => {
|
||||
// 최상위 demand 객체
|
||||
// demandCo가 있을 경우
|
||||
if (data.demandCo) {
|
||||
data.demandCo.rgtr = TEST_UUID;
|
||||
data.demandCo.mdfr = TEST_UUID;
|
||||
}
|
||||
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
type ruseHstryActions = {
|
||||
ruseRvwHistInit: (
|
||||
pageNo: number,
|
||||
@@ -54,7 +70,7 @@ type ruseHstryActions = {
|
||||
endYear: string,
|
||||
sggCd: string
|
||||
) => void;
|
||||
ruseRvwComplete:( data: string[]) => void;
|
||||
ruseRvwComplete:( data: Number[]) => void;
|
||||
};
|
||||
|
||||
const irvwHistInit = async (
|
||||
@@ -106,9 +122,11 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
},
|
||||
ruseRvwCalUpdate: async (data: DmdCoReqType) => {
|
||||
try {
|
||||
|
||||
const updatedData = addRgtrAndMdfrToDemandObj(data);
|
||||
const update = await putFectch(
|
||||
`/reuseFc/request/cst`,
|
||||
JSON.stringify(data)
|
||||
updatedData
|
||||
);
|
||||
if (update.status === 200) {
|
||||
toast.success("매칭 계산 저장이 완료입니다.");
|
||||
@@ -193,11 +211,11 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
console.log(" error ", e);
|
||||
}
|
||||
},
|
||||
ruseRvwComplete: async (data: string[]) => {
|
||||
ruseRvwComplete: async (data: Number[]) => {
|
||||
try {
|
||||
const complet = await postFectch(
|
||||
`/reuseFc/request/completeCheck`,
|
||||
JSON.stringify(data),
|
||||
data,
|
||||
fetchType.WR
|
||||
);
|
||||
if (complet.status === 200) {
|
||||
@@ -207,7 +225,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
10,
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
"0"
|
||||
"0",
|
||||
'0'
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -164,6 +164,9 @@ export const initValInUsage = [
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
];
|
||||
|
||||
export const initValOutUsage = [
|
||||
{
|
||||
usage: "resn",
|
||||
용수명: "세척살수용수",
|
||||
@@ -198,9 +201,6 @@ export const initValInUsage = [
|
||||
"11월": 0,
|
||||
"12월": 0,
|
||||
},
|
||||
];
|
||||
|
||||
export const initValOutUsage = [
|
||||
{
|
||||
usage: "lndwtr",
|
||||
용수명: "조경용수",
|
||||
|
||||
@@ -132,11 +132,11 @@ const dmdColist = z.object({
|
||||
dmdInfoFk: z.string().default(''),
|
||||
dmdCoNm: z.string().default(''),
|
||||
daddr: z.string(),
|
||||
useUsgCd: z.string().default(""),
|
||||
useUsgCd: z.string().nullish(),
|
||||
splyBgngDay: zDateDefaultNow,
|
||||
splyEndDay: zDateDefaultNow,
|
||||
splyCpct: zNumDefaultZero,
|
||||
splyFmYn: z.string().default('Y'),
|
||||
splyFmYn: z.string().nullish(),
|
||||
rgtr: z.string().nullish(),
|
||||
mdfr: z.string().nullish(),
|
||||
pbnstRuseFcltBizPk: zNumDefaultZero,
|
||||
@@ -208,7 +208,7 @@ export const fcBizSchema = z.object({
|
||||
ruseFcltCstClcln: zNumNullish,
|
||||
fcOrgwts: z.array(fcOrgwtSchema).nullish(),
|
||||
pplInstls: z.array(pplInstlSchema).nullish(),
|
||||
fcDemands: z.array(dmdColist).default([]).nullish(),
|
||||
fcDemands: z.array(dmdColist).nullish(),
|
||||
flg: z.string().nullish(),
|
||||
regDt: z.string().nullish(),
|
||||
rgtr: z.string().nullish(),
|
||||
|
||||
@@ -8,7 +8,7 @@ export const LOCAL_URL_WR = `http://localhost:${LOCAL_PORT}/api/v1`;
|
||||
export const DEV_URL_WR = `http://con.mind-one.co.kr:${DEV_PORT}/api/v1`;
|
||||
// export const DEV_URL_WR = `http://192.168.0.91:8880/api/v1`;
|
||||
|
||||
// export const DEV_URL_FO = `http://192.168.0.91:8882/api/v1`;
|
||||
/// export const DEV_URL_FO = `http://192.168.0.91:8882/api/v1`;
|
||||
export const DEV_URL_FO = `http://con.mind-one.co.kr:${DEV_PORT_NEW}/api/v1`;
|
||||
|
||||
|
||||
|
||||
@@ -55,13 +55,6 @@ export default function ConCostForm({
|
||||
}
|
||||
}, [ref, getConstCostFee, getRateFee]);
|
||||
|
||||
const [isTrfMo, setIsTrfMo] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
const [isCmpttnMo, setIsCmpttnMo] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
|
||||
const zipDowonLoad = () => {
|
||||
fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => {
|
||||
const blobRet = await response.blob();
|
||||
@@ -82,10 +75,8 @@ export default function ConCostForm({
|
||||
const usgPrcsProcs = usgPrcsProcsWatch;
|
||||
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,
|
||||
@@ -120,40 +111,37 @@ export default function ConCostForm({
|
||||
|
||||
groupedBounds[code] = findBounds(rateFeeRes, code, 'incExpCd', 'stdCost',result);
|
||||
}
|
||||
|
||||
const resultRate = transformAndInterpolate(groupedBounds, result);
|
||||
const fcltSbsdEpsTrf =
|
||||
result *
|
||||
(resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD);
|
||||
|
||||
const realResult = result + fcltSbsdEpsTrf;
|
||||
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.fcltSbsdEpsTrf", Math.round(fcltSbsdEpsTrf)) ;
|
||||
form.setValue("demandCst.fcltSbsdCstrnCst", Math.round(fcltSbsdCstrnCst)) ;
|
||||
form.setValue("totalConstCost", Math.round(realResult));
|
||||
}
|
||||
}, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]);
|
||||
const onSubmit = (value: DmdCoReqType) => {
|
||||
|
||||
if( !form.getValues('demandCst.prcsFcltCpctCstrnCst') ){
|
||||
|
||||
console.log(" form ", form.getValues());
|
||||
toast.error('공사비 계산 진행 후 저장을 눌러주새요')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (type === "mat") {
|
||||
const data: DedMatUpdateType = {
|
||||
dmdInfoSn: form.getValues("dmdInfoSn"),
|
||||
usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs"),
|
||||
cstrnCst: form.getValues("demandCst.cstrnCst"),
|
||||
fcltSbsdEpsTrf: form.getValues("demandCst.fcltSbsdEpsTrf"),
|
||||
fcltSbsdCstrnCst: form.getValues("demandCst.fcltSbsdCstrnCst"),
|
||||
prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"),
|
||||
rgtr: TEST_UUID,
|
||||
};
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data);
|
||||
} else if (type === "hist") {
|
||||
|
||||
delete value.totalConstCost
|
||||
delete value.ruseUtztnFcltNm
|
||||
|
||||
|
||||
ruseRvwCalUpdate(value);
|
||||
}
|
||||
};
|
||||
@@ -172,12 +160,21 @@ export default function ConCostForm({
|
||||
<div className="flex items-center mx-3 mb-3">
|
||||
<h1 className="">처리시설 표준공사비 산정</h1>
|
||||
|
||||
<Button size={"sm"} onClick={calculateConstCost}>
|
||||
<Button className="mx-3" size={"sm"} onClick={calculateConstCost}>
|
||||
계산
|
||||
</Button>
|
||||
<Button 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>
|
||||
</div>
|
||||
<div className="col-span-12 w-full">
|
||||
<h1 className={formH1Class}>기본사항</h1>
|
||||
@@ -349,7 +346,7 @@ export default function ConCostForm({
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="demandCst.fcltSbsdEpsTrf"
|
||||
name="demandCst.fcltSbsdCstrnCst"
|
||||
render={({ field }) => (
|
||||
<FormUi label="">
|
||||
<Input
|
||||
@@ -463,17 +460,6 @@ export default function ConCostForm({
|
||||
value={(totalConstCost ?? 0) + (cstrnCst ?? 0)}
|
||||
/>
|
||||
</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>
|
||||
</Form>
|
||||
</>
|
||||
|
||||
@@ -61,7 +61,6 @@ export function ConstCostFeeTable({
|
||||
},
|
||||
[]
|
||||
);
|
||||
console.log("tableData", tableData);
|
||||
const formattedTableData = tableData?.map((item: ContCostMap) => {
|
||||
return {
|
||||
...item,
|
||||
|
||||
@@ -59,7 +59,6 @@ export function RateFeeTableModal({
|
||||
}, []);
|
||||
|
||||
|
||||
console.log(' data ', data)
|
||||
const dataGubun = data?.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
|
||||
Reference in New Issue
Block a user