Merge commit 'c8e0cb1f033d61d18dfedf7cf37ac570a1b1e9cd' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run
iipbs_wr / build (push) Waiting to run
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 ??"");
|
||||
|
||||
@@ -94,7 +94,6 @@ export default function RuseRvwHstry() {
|
||||
} else {
|
||||
|
||||
|
||||
console.log("시도코드", sggCd);
|
||||
ruseRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd);
|
||||
}
|
||||
};
|
||||
@@ -122,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);
|
||||
@@ -136,7 +135,7 @@ export default function RuseRvwHstry() {
|
||||
<button
|
||||
onClick={() => {
|
||||
toast.dismiss(t.id);
|
||||
ruseRvwComplete(completeData as string[]);
|
||||
ruseRvwComplete(completeData as Number[]);
|
||||
}}
|
||||
>
|
||||
확인
|
||||
@@ -145,7 +144,7 @@ export default function RuseRvwHstry() {
|
||||
</span>
|
||||
));
|
||||
} else {
|
||||
ruseRvwComplete(completeData as string[]);
|
||||
ruseRvwComplete(completeData as Number[]);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
@@ -165,7 +164,6 @@ export default function RuseRvwHstry() {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? "");
|
||||
|
||||
console.log("flag", flag);
|
||||
return {
|
||||
...item,
|
||||
ctpvCd: item.demandCo?.ctpvCd,
|
||||
@@ -193,7 +191,6 @@ export default function RuseRvwHstry() {
|
||||
}
|
||||
}, [rvwHistRes]);
|
||||
|
||||
useEffect(() => {}, [form.formState]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("변경여부 ", form.formState.isDirty);
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function Home() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!htdfl.isInit) {
|
||||
initHtdfl('41');
|
||||
initHtdfl('0');
|
||||
}
|
||||
}, [htdfl.isInit, initHtdfl]);
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function Home() {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
useEffect(() => {
|
||||
getHtdflBdstData(pageNation, "41");
|
||||
getHtdflBdstData(pageNation, "0");
|
||||
}, [pageNation]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -42,14 +42,12 @@ export default function PublicReuseFaciltyInsert() {
|
||||
searchFclts,
|
||||
pubHasuInit,
|
||||
pbnstRegClick,
|
||||
pbnstMngData,
|
||||
pbnstRuseFcltUpdate,
|
||||
pubHasuSearch,
|
||||
pbnstRuseBizUpdate,
|
||||
} = useWrStore((state) => state);
|
||||
const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst;
|
||||
const [currentTab, setCurrentTab] = useState<string>("mng");
|
||||
const [pbnstBiz, setPbnstBiz] = useState<fcBizType[]>();
|
||||
const [isRuseReg, setIsRuseReg] = useState<{
|
||||
isModal: boolean;
|
||||
data: pubHasuType;
|
||||
@@ -61,18 +59,12 @@ export default function PublicReuseFaciltyInsert() {
|
||||
const [bdstTable, setbdstTable] = useState<pubHasuType[]>();
|
||||
const [selectRow, setSelectRow] = useState<pubHasuType>();
|
||||
|
||||
// const form = useForm<z.infer<typeof pbnstRegArrayZod>>({
|
||||
// resolver: zodResolver(pbnstRegArrayZod),
|
||||
// defaultValues: pbnstRegArrayZod.parse([]),
|
||||
// mode: "onChange",
|
||||
// });
|
||||
|
||||
const form = useForm<{
|
||||
items: z.infer<typeof pbnstRegZod>[];
|
||||
}>({
|
||||
resolver: zodResolver(z.object({ items: pbnstRegArrayZod })),
|
||||
defaultValues: { items: pbnstRegArrayZod.parse([]) },
|
||||
mode:"onChange"
|
||||
// defaultValues: { items: pbnstRegArrayZod.parse([]) },
|
||||
mode: "onChange",
|
||||
});
|
||||
const {
|
||||
fields: items,
|
||||
@@ -84,21 +76,31 @@ export default function PublicReuseFaciltyInsert() {
|
||||
});
|
||||
useEffect(() => {
|
||||
if (!pbnst.isInit) {
|
||||
pubHasuInit("1", "11");
|
||||
pubHasuInit("1", "0");
|
||||
}
|
||||
}, [pbnst.isInit, pubHasuInit]);
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
|
||||
const data = writeRgtrAndMdfr(valuse.items);
|
||||
let bizs = [] as fcBizType[];
|
||||
data.forEach((fclt) => {
|
||||
bizs = [...bizs, ...fclt.fcBizs];
|
||||
});
|
||||
const pbnst =data.map((fclt) => {
|
||||
return({
|
||||
pbnstRuseFcltPk: fclt.pbnstRuseFcltPk,
|
||||
fcltCpct: fclt.fcltCpct,
|
||||
ruseCpct: fclt.ruseCpct,
|
||||
splyExtraCpct: fclt.splyExtraCpct,
|
||||
rgtr: fclt.rgtr,
|
||||
mdfr: fclt.mdfr,
|
||||
fcFiles: fclt.fcFiles,
|
||||
fcOpers: fclt.fcOpers,
|
||||
})
|
||||
})
|
||||
await pbnstRuseFcltUpdate(pbnst as customPbnst[]);
|
||||
|
||||
await pbnstRuseFcltUpdate(data);
|
||||
|
||||
await pbnstRuseBizUpdate(bizs);
|
||||
await pbnstRuseBizUpdate(bizs);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -114,9 +116,8 @@ export default function PublicReuseFaciltyInsert() {
|
||||
const cellClick = (val: number | undefined) => {
|
||||
if (val === undefined) return;
|
||||
const selectRow = pbnstHasuRes?.[val];
|
||||
setSelectRow(pbnstHasuRes?.[val])
|
||||
setSelectRow(pbnstHasuRes?.[val]);
|
||||
if (selectRow) {
|
||||
//setIsRuseReg({ ...isRuseReg, data: selectRow });
|
||||
pbnstRegClick(selectRow);
|
||||
}
|
||||
};
|
||||
@@ -126,8 +127,13 @@ export default function PublicReuseFaciltyInsert() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnst.pbnstRes) {
|
||||
if (pbnst.pbnstRes&& pbnst.pbnstRes?.length>0) {
|
||||
console.log("pbnst.pbnstRes", pbnstRes);
|
||||
form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) });
|
||||
}else{
|
||||
|
||||
console.log("pbnst.pbnstRes is null", pbnstRes);
|
||||
form.reset({ items: [] });
|
||||
}
|
||||
}, [pbnst.pbnstRes]);
|
||||
useEffect(() => {
|
||||
@@ -137,39 +143,55 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}, [indexMng]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
|
||||
const appendPbnstRuseFclt = useCallback(() => {
|
||||
const selecTableRow = selectRow;
|
||||
|
||||
const appendPbnstRuseFclt = useCallback(() => {
|
||||
if (pbnstRes && pbnstRes.length > 0) {
|
||||
const lastPbnst = pbnstRes[pbnstRes.length - 1];
|
||||
console.log('lastPbnst.swtrmtFcltFk ', lastPbnst)
|
||||
if(lastPbnst){
|
||||
if (lastPbnst && selecTableRow) {
|
||||
|
||||
append(
|
||||
pbnstRegZod.parse({
|
||||
pbnstRuseFcltPk: String(lastPbnst.pbnstRuseFcltPk) + String(pbnstRes.length + 1),
|
||||
pbnstRuseFcltPk:
|
||||
String(selecTableRow.bscFctCd) + String(pbnstRes.length + 1),
|
||||
ruseUtztnFcltNm: "",
|
||||
fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(lastPbnst.pbnstRuseFcltPk) + String(pbnstRes.length + 1),cycl:1})] as fcBizType[],
|
||||
fcBizs: [
|
||||
fcBizSchema.parse({
|
||||
pbnstRuseFcltFk:
|
||||
String(lastPbnst.pbnstRuseFcltPk) +
|
||||
String(pbnstRes.length + 1),
|
||||
cycl: 1,
|
||||
}),
|
||||
] as fcBizType[],
|
||||
})
|
||||
);
|
||||
setIsRuseReg({ ...isRuseReg, isModal: true })
|
||||
setIsRuseReg({ ...isRuseReg, isModal: true });
|
||||
}
|
||||
} else {
|
||||
if(selectRow){
|
||||
if (selecTableRow) {
|
||||
append(
|
||||
pbnstRegZod.parse({
|
||||
pbnstRuseFcltPk: String(selectRow.bscFctCd)+'1',
|
||||
ruseUtztnFcltNm: "",
|
||||
regDt: null,
|
||||
mdfcnDt: null,
|
||||
fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(selectRow.bscFctCd)+'1',cycl:1})] as fcBizType[],
|
||||
})
|
||||
);
|
||||
setIsRuseReg({ ...isRuseReg, isModal: true })
|
||||
pbnstRegZod.parse({
|
||||
pbnstRuseFcltPk: String(selecTableRow.bscFctCd)+'1',
|
||||
ruseUtztnFcltNm: "",
|
||||
regDt: null,
|
||||
mdfcnDt: null,
|
||||
fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(selecTableRow.bscFctCd)+'1',cycl:1})] as fcBizType[],
|
||||
})
|
||||
)
|
||||
setIsRuseReg({ ...isRuseReg, isModal: true });
|
||||
}
|
||||
}
|
||||
},[pbnstRegZod,pbnstRes,append,selectRow])
|
||||
}, [pbnstRegZod, pbnstRes, append, selectRow, form]);
|
||||
|
||||
useEffect(() => {
|
||||
// console.log(" page getgetvaslue ", form.getValues());
|
||||
}, [form.getValues()]);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -192,8 +214,8 @@ export default function PublicReuseFaciltyInsert() {
|
||||
size={"sm"}
|
||||
onClick={(e) => {
|
||||
searchTxt && searchTxt?.length > 0
|
||||
? pubHasuSearch("1", "11", searchTxt)
|
||||
: pubHasuInit("1", "11");
|
||||
? pubHasuSearch("1", "0", searchTxt)
|
||||
: pubHasuInit("1", "0");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -202,13 +224,14 @@ export default function PublicReuseFaciltyInsert() {
|
||||
size={"sm"}
|
||||
className=""
|
||||
onClick={() => {
|
||||
pbnstMngData([] as customPbnst[]);
|
||||
if(!selectRow){
|
||||
toast.error("하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요")
|
||||
return
|
||||
}else{
|
||||
appendPbnstRuseFclt()
|
||||
|
||||
// pbnstMngData([] as customPbnst[]);
|
||||
if (!selectRow) {
|
||||
toast.error(
|
||||
"하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요"
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
appendPbnstRuseFclt();
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -260,6 +283,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
formType="update"
|
||||
form={form}
|
||||
setIndexMng={(index: number) => {
|
||||
console.log("setIndexMng", index);
|
||||
setIndexMng(index);
|
||||
}}
|
||||
indexMng={indexMng}
|
||||
@@ -286,10 +310,10 @@ export default function PublicReuseFaciltyInsert() {
|
||||
data={isRuseReg.data || ({} as customPbnst)}
|
||||
></PbnstRegModal>
|
||||
}
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||
open={isRuseReg.isModal}
|
||||
onOpenChange={(open) => {
|
||||
remove(form.getValues("items").length - 1)
|
||||
remove(form.getValues("items").length - 1);
|
||||
setIsRuseReg({ data: {} as pubHasuType, isModal: open });
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -71,7 +71,7 @@ export default function HtdflSttn() {
|
||||
if (htdflSttn.excelList.length > 0) {
|
||||
if (htdflSttn.excelList.length === 0) return;
|
||||
const excelData = await tableData(htdflSttn.excelList, { code });
|
||||
const htdflExcel = excelHtdflSttnParsing(excelData);
|
||||
const htdflExcel = excelHtdflSttnParsing(excelData, code.cityCd, code.sggCd);
|
||||
excelDownload(
|
||||
htdflExcel as [[]],
|
||||
"온배수시설 현황",
|
||||
@@ -91,7 +91,6 @@ export default function HtdflSttn() {
|
||||
|
||||
useEffect(() => {
|
||||
if (htdflSttnRes.length > 0 && code.cityCd.length > 0) {
|
||||
console.log("htdflSttnRes", htdflSttnRes);
|
||||
const data = tableData(htdflSttnRes, { code });
|
||||
const chData = data
|
||||
.map((item: any) => ({
|
||||
|
||||
@@ -87,6 +87,7 @@ export default function PbnstSttn() {
|
||||
}
|
||||
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
|
||||
useEffect(() => {
|
||||
|
||||
setBdstTable(pbnstSttn.pbnstSttnRes);
|
||||
}, [pbnstSttn.pbnstSttnRes]);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ export default function RainSttn() {
|
||||
}, [code, rainSttnRes, rainSttn.rainSttHeadList]);
|
||||
|
||||
useEffect(() => {
|
||||
if (codeData != null) rainSttnSearch(pageNation, "20", codeData);
|
||||
if (codeData != null) rainSttnSearch(pageNation, "20", codeData, code.cityCd, code.sggCd);
|
||||
}, [pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -111,8 +111,8 @@ export default function RainSttn() {
|
||||
}, [rainSttn.excelList]);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
if (codeData) rainSttnSearch(1, "10000", codeData);
|
||||
}, [rainSttnSearch, codeData]);
|
||||
if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd);
|
||||
}, [rainSttnSearch, codeData, code.cityCd, code.sggCd]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -146,7 +146,7 @@ export default function RainSttn() {
|
||||
} else {
|
||||
con = returnType.sidoValue;
|
||||
}
|
||||
rainSttnSearch(1, "20", con);
|
||||
rainSttnSearch(1, "20", con, code.cityCd, code.sggCd);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void { }}
|
||||
|
||||
@@ -42,7 +42,6 @@ export default function RswtSttn() {
|
||||
|
||||
const codeCityOrSgg = getCityOrSgg(ref);
|
||||
|
||||
|
||||
const cellClick = (index: number | undefined, headId: string) => {
|
||||
|
||||
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
@@ -57,7 +56,6 @@ export default function RswtSttn() {
|
||||
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -100,13 +98,13 @@ export default function RswtSttn() {
|
||||
const excelClick = useCallback(
|
||||
(returnType: ReturnType) => {
|
||||
if (codeCityOrSgg)
|
||||
rswtSttnSearch(1, "10000", codeCityOrSgg);
|
||||
rswtSttnSearch(1, "10000", codeCityOrSgg, code.cityCd, code.sggCd);
|
||||
},
|
||||
[rswtSttnSearch, codeCityOrSgg]
|
||||
[rswtSttnSearch, code.cityCd, code.sggCd, codeCityOrSgg]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg);
|
||||
if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg, code.cityCd, code.sggCd);
|
||||
}, [pageNation]);
|
||||
|
||||
return (
|
||||
@@ -122,27 +120,24 @@ export default function RswtSttn() {
|
||||
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', …}'
|
||||
if (codeCityOrSgg)
|
||||
rswtSttnSearch(1, "20", codeCityOrSgg);
|
||||
}}
|
||||
rswtSttnSearch(1, "20", codeCityOrSgg, code.cityCd, code.sggCd);
|
||||
} }
|
||||
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 ">
|
||||
|
||||
@@ -70,15 +70,14 @@ export default function Page() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainChkgdn.isInit) {
|
||||
rainChkInit("2024", "0");
|
||||
rainChkInit(new Date().getFullYear().toString(), "0");
|
||||
isRainSttn(false)
|
||||
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
|
||||
if (!rswtChkgdn.isInit) {
|
||||
rswtChkgdnInit("2024", "0");
|
||||
rswtChkgdnInit(new Date().getFullYear().toString(), "0");
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ export default function prfmncPrfmncReg() {
|
||||
isModal: false,
|
||||
data: prfmncRes[index] || ({} as FcPrfType),
|
||||
});
|
||||
const inUsageData = [...initValInUsage];
|
||||
const outUsageData = [...initValOutUsage];
|
||||
const inSubtotal = subTotalObj;
|
||||
const outSubtotal = subTotalObj;
|
||||
const inUsageData = structuredClone(initValInUsage);
|
||||
const outUsageData = structuredClone(initValOutUsage);
|
||||
const inSubtotal = structuredClone(subTotalObj);
|
||||
const outSubtotal = structuredClone(subTotalObj);
|
||||
if (prfmncRes[index]?.prfList) {
|
||||
prfmncRes[index].prfList?.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
@@ -123,7 +123,7 @@ export default function prfmncPrfmncReg() {
|
||||
});
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = totalObj;
|
||||
const usageTotalObj: { [key: string]: any } = structuredClone(totalObj);
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
@@ -135,7 +135,6 @@ export default function prfmncPrfmncReg() {
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPbnstRuseFcltPk(prfmncRes[index].pbnstRuseFcltPk);
|
||||
|
||||
console.log(' tableData ' ,tableData)
|
||||
setInputData(tableData);
|
||||
} else {
|
||||
setInputData([]);
|
||||
|
||||
@@ -3,22 +3,28 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType, type PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import { yearOptions } from "@/components/lib/func/commom";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import { ContentsDiv, Title, SearchBaseForm, SelectBox, SearchInput, UiTable, type ReturnType, MainChart, type ChartConfig, CHART_FORM, ScrollArea } from "@common/business_components";
|
||||
import DoughnutChart from "@common/business_components/ui/chart/DoughnutChart";
|
||||
import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel";
|
||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
import SearchInputText from "@/components/ui/searchInput/searchInput";
|
||||
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Label, Table, TableBody, TableHeader } from "@common/components/ui";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
|
||||
|
||||
|
||||
export default function PbnstPrfmncSttn() {
|
||||
const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncInit, pbnstPrfmncSearch, prfmnc } = useWrStore((state) => state);
|
||||
const {
|
||||
code,
|
||||
tableHeadMaker,
|
||||
pbnstPrfmncSttn,
|
||||
pbnstPrfmncInit,
|
||||
pbnstPrfmncSearch,
|
||||
prfmnc,
|
||||
pbnstSttn,
|
||||
pbnNmSearch
|
||||
} = useWrStore((state) => state);
|
||||
const { monthHeadList } = prfmnc
|
||||
const { pbnstPrfHeadList, pbnstPrfmncRes, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn;
|
||||
const { pbnstPrfHeadList, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn;
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear()));
|
||||
const [toDate, setToDate] = useState<string>(String(new Date().getFullYear()));
|
||||
@@ -26,6 +32,18 @@ export default function PbnstPrfmncSttn() {
|
||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [swtrmtFcltNm, setSwtrmtFcltNm] = useState<string>();
|
||||
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
|
||||
const [excelData, setExcelData] = useState<any[]>([]);
|
||||
const excelClick = useCallback(() => {
|
||||
excelDownload(
|
||||
excelData,
|
||||
"하수재이용실적 현황",
|
||||
"sample_pbnstPrfmncSttn.xlsx",
|
||||
"A1:N1",
|
||||
2
|
||||
);
|
||||
}, [excelData]);
|
||||
|
||||
const [chartConfig, setChartConfig] = useState<ChartConfig>({});
|
||||
const [chartData, setChartData] = useState<dnChartForm[]>([]);
|
||||
const [dnInUsage, setDnInUsage] = useState<dnChartForm[]>([]);
|
||||
@@ -48,7 +66,6 @@ export default function PbnstPrfmncSttn() {
|
||||
chartData8: lineChartDataProps[];
|
||||
chartData9: lineChartDataProps[];
|
||||
}>();
|
||||
// const [lnInChartConfig, setLnInChartConfig] = useState<ChartConfig>({});
|
||||
const [outLineData, setOutLineData] = useState<{
|
||||
chartData1: lineChartDataProps[];
|
||||
chartData2: lineChartDataProps[];
|
||||
@@ -58,21 +75,18 @@ export default function PbnstPrfmncSttn() {
|
||||
chartData6: lineChartDataProps[];
|
||||
}>();
|
||||
|
||||
|
||||
|
||||
type dnChartForm = { label: string, val: number, fill?: string };
|
||||
type barChartForm = { label: string, "장내용수": number, "장외용수": number };
|
||||
type lineChartDataProps = { label: string, val: number, color: string };
|
||||
|
||||
const prfTableData = (prfList: PrfType[], year:string) => {
|
||||
const inUsageData = initValInUsage;
|
||||
const outUsageData = initValOutUsage;
|
||||
const prfTableData = (prfList: PrfType[], year: string) => {
|
||||
const inUsageData = structuredClone(initValInUsage);
|
||||
const outUsageData = structuredClone(initValOutUsage);
|
||||
|
||||
const inSubtotal = subTotalObj;
|
||||
const outSubtotal = subTotalObj;
|
||||
const inSubtotal = structuredClone(subTotalObj);
|
||||
const outSubtotal = structuredClone(subTotalObj);
|
||||
|
||||
console.log(' prfList ', prfList)
|
||||
const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year)
|
||||
const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year)
|
||||
if (prfList && prfFilter.length > 0) {
|
||||
prfList?.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
@@ -108,7 +122,7 @@ export default function PbnstPrfmncSttn() {
|
||||
});
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = totalObj;
|
||||
const usageTotalObj: { [key: string]: any } = structuredClone(totalObj);
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
@@ -119,71 +133,190 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPrfData(tableData);
|
||||
|
||||
setExcelData(excelPrfmncSttnParsing(prfData ?? []))
|
||||
} else {
|
||||
setPrfData([]);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let wshwtr = 0;
|
||||
let coolUswtr = 0;
|
||||
let cleanUswtr = 0;
|
||||
let drwtUswtr = 0;
|
||||
let dltnUswtr = 0;
|
||||
let ithlRswtr = 0;
|
||||
let ithlEtcUswtr = 0;
|
||||
let cleanToilUswtr = 0;
|
||||
let resn = 0;
|
||||
let lndwtr = 0;
|
||||
let hydUswtr = 0;
|
||||
let ugwtChr = 0;
|
||||
let farmUswtr = 0;
|
||||
let rvrKeepUswtr = 0;
|
||||
let indstUswtr = 0;
|
||||
// 누적 변수 초기화
|
||||
let wshwtr = 0,
|
||||
coolUswtr = 0,
|
||||
cleanUswtr = 0,
|
||||
drwtUswtr = 0,
|
||||
dltnUswtr = 0,
|
||||
ithlRswtr = 0,
|
||||
ithlEtcUswtr = 0,
|
||||
cleanToilUswtr = 0,
|
||||
resn = 0;
|
||||
|
||||
let lndwtr = 0,
|
||||
hydUswtr = 0,
|
||||
ugwtChr = 0,
|
||||
farmUswtr = 0,
|
||||
rvrKeepUswtr = 0,
|
||||
indstUswtr = 0;
|
||||
|
||||
let inUsageSum = 0,
|
||||
outUsageSum = 0;
|
||||
|
||||
let inUsageArr: number[] = [],
|
||||
outUsageArr: number[] = [];
|
||||
|
||||
// 라인차트용 데이터
|
||||
const wshwtrData: lineChartDataProps[] = [],
|
||||
coolUswtrData: lineChartDataProps[] = [],
|
||||
cleanUswtrData: lineChartDataProps[] = [],
|
||||
drwtUswtrData: lineChartDataProps[] = [],
|
||||
dltnUswtrData: lineChartDataProps[] = [],
|
||||
ithlRswtrData: lineChartDataProps[] = [],
|
||||
ithlEtcUswtrData: lineChartDataProps[] = [],
|
||||
cleanToilUswtrData: lineChartDataProps[] = [],
|
||||
resnData: lineChartDataProps[] = [];
|
||||
const lndwtrData: lineChartDataProps[] = [],
|
||||
hydUswtrData: lineChartDataProps[] = [],
|
||||
ugwtChrData: lineChartDataProps[] = [],
|
||||
farmUswtrData: lineChartDataProps[] = [],
|
||||
rvrKeepUswtrData: lineChartDataProps[] = [],
|
||||
indstUswtrData: lineChartDataProps[] = [];
|
||||
|
||||
// 막대차트 데이터
|
||||
const barData: barChartForm[] = [];
|
||||
|
||||
// 도넛차트 데이터
|
||||
const dnData: dnChartForm[] = [];
|
||||
const dnInData: dnChartForm[] = [];
|
||||
const dnOutData: dnChartForm[] = [];
|
||||
|
||||
if (rawData) {
|
||||
rawData.forEach((item) => {
|
||||
// 실적 테이블 데이터
|
||||
prfTableData(item.prfList, year);
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
|
||||
|
||||
wshwtr += element.wshwtr; //세척수
|
||||
coolUswtr += element.coolUswtr; //냉각수
|
||||
cleanUswtr += element.cleanUswtr; //청소수
|
||||
drwtUswtr += element.drwtUswtr; //식수대
|
||||
dltnUswtr += element.dltnUswtr //희석용수
|
||||
ithlRswtr += element.ithlRswtr //중수도
|
||||
ithlEtcUswtr += element.ithlEtcUswtr //기타
|
||||
cleanToilUswtr += element.cleanToilUswtr //청소화장실용수
|
||||
resn += element.resn //세척살수용수
|
||||
|
||||
lndwtr += element.lndwtr; //조경용수
|
||||
hydUswtr += element.hydUswtr; //친수용수
|
||||
ugwtChr += element.ugwtChr; //지하수충전
|
||||
farmUswtr += element.farmUswtr //농업용수
|
||||
rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수
|
||||
indstUswtr += element.indstUswtr //공업용수
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => {
|
||||
// 누적
|
||||
wshwtr += element.wshwtr;
|
||||
coolUswtr += element.coolUswtr;
|
||||
cleanUswtr += element.cleanUswtr;
|
||||
drwtUswtr += element.drwtUswtr;
|
||||
dltnUswtr += element.dltnUswtr;
|
||||
ithlRswtr += element.ithlRswtr;
|
||||
ithlEtcUswtr += element.ithlEtcUswtr;
|
||||
cleanToilUswtr += element.cleanToilUswtr;
|
||||
resn += element.resn;
|
||||
lndwtr += element.lndwtr;
|
||||
hydUswtr += element.hydUswtr;
|
||||
ugwtChr += element.ugwtChr;
|
||||
farmUswtr += element.farmUswtr;
|
||||
rvrKeepUswtr += element.rvrKeepUswtr;
|
||||
indstUswtr += element.indstUswtr;
|
||||
|
||||
// 월별 합계
|
||||
inUsageSum = element.wshwtr
|
||||
+ element.coolUswtr
|
||||
+ element.cleanUswtr
|
||||
+ element.drwtUswtr
|
||||
+ element.dltnUswtr
|
||||
+ element.ithlRswtr
|
||||
+ element.ithlEtcUswtr
|
||||
+ element.cleanToilUswtr
|
||||
+ element.resn;
|
||||
outUsageSum = element.lndwtr
|
||||
+ element.hydUswtr
|
||||
+ element.ugwtChr
|
||||
+ element.farmUswtr
|
||||
+ element.rvrKeepUswtr
|
||||
+ element.indstUswtr;
|
||||
inUsageArr.push(inUsageSum);
|
||||
outUsageArr.push(outUsageSum);
|
||||
|
||||
// 막대차트
|
||||
const month = Number(element.ym.slice(4, 6));
|
||||
barData.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum });
|
||||
|
||||
// 라인차트
|
||||
wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" });
|
||||
coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "orange" });
|
||||
cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "yellow" });
|
||||
drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "pink" });
|
||||
dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "purple" });
|
||||
ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "green" });
|
||||
ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "blue" });
|
||||
cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "magenta" });
|
||||
resnData.push({ label: `${month}월`, val: element.resn, color: "skyblue" });
|
||||
|
||||
lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" });
|
||||
hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "orange" });
|
||||
ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "yellow" });
|
||||
farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "green" });
|
||||
rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "blue" });
|
||||
indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "purple" });
|
||||
});
|
||||
})
|
||||
const data: dnChartForm[] = []
|
||||
data?.push({ label: "세척수", val: wshwtr, fill: "red" })
|
||||
data?.push({ label: "냉각수", val: coolUswtr, fill: "orange" })
|
||||
data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" })
|
||||
data?.push({ label: "식수대", val: drwtUswtr, fill: "green" })
|
||||
data?.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" })
|
||||
data?.push({ label: "중수도", val: ithlRswtr, fill: "blue" })
|
||||
data?.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" })
|
||||
data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" })
|
||||
data?.push({ label: "세척살수용수", val: resn, fill: "orange" })
|
||||
data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" })
|
||||
data?.push({ label: "친수용수", val: hydUswtr, fill: "green" })
|
||||
data?.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" })
|
||||
data?.push({ label: "농업용수", val: farmUswtr, fill: "blue" })
|
||||
data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" })
|
||||
data?.push({ label: "공업용수", val: indstUswtr, fill: "black" })
|
||||
setChartData(data);
|
||||
}
|
||||
}, [rawData, year])
|
||||
});
|
||||
|
||||
// 도넛차트 데이터
|
||||
dnData.push({ label: "세척수", val: wshwtr, fill: "red" });
|
||||
dnData.push({ label: "냉각수", val: coolUswtr, fill: "orange" });
|
||||
dnData.push({ label: "청소수", val: cleanUswtr, fill: "yellow" });
|
||||
dnData.push({ label: "식수대", val: drwtUswtr, fill: "green" });
|
||||
dnData.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" });
|
||||
dnData.push({ label: "중수도", val: ithlRswtr, fill: "blue" });
|
||||
dnData.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" });
|
||||
dnData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" });
|
||||
dnData.push({ label: "세척살수용수", val: resn, fill: "orange" });
|
||||
dnData.push({ label: "조경용수", val: lndwtr, fill: "yellow" });
|
||||
dnData.push({ label: "친수용수", val: hydUswtr, fill: "green" });
|
||||
dnData.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" });
|
||||
dnData.push({ label: "농업용수", val: farmUswtr, fill: "blue" });
|
||||
dnData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" });
|
||||
dnData.push({ label: "공업용수", val: indstUswtr, fill: "black" });
|
||||
|
||||
// 장내용수 도넛
|
||||
dnInData.push({ label: "세척수", val: wshwtr, fill: "yellow" });
|
||||
dnInData.push({ label: "냉각수", val: coolUswtr, fill: "green" });
|
||||
dnInData.push({ label: "청소수", val: cleanUswtr, fill: "yellow" });
|
||||
dnInData.push({ label: "식수대", val: drwtUswtr, fill: "green" });
|
||||
dnInData.push({ label: "희석용수", val: dltnUswtr, fill: "yellow" });
|
||||
dnInData.push({ label: "중수도", val: ithlRswtr, fill: "green" });
|
||||
dnInData.push({ label: "기타", val: ithlEtcUswtr, fill: "yellow" });
|
||||
dnInData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "green" });
|
||||
dnInData.push({ label: "세척살수용수", val: resn, fill: "yellow" });
|
||||
|
||||
// 장외용수 도넛
|
||||
dnOutData.push({ label: "조경용수", val: lndwtr, fill: "yellow" });
|
||||
dnOutData.push({ label: "친수용수", val: hydUswtr, fill: "black" });
|
||||
dnOutData.push({ label: "지하수충전", val: ugwtChr, fill: "yellow" });
|
||||
dnOutData.push({ label: "농업용수", val: farmUswtr, fill: "black" });
|
||||
dnOutData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "yellow" });
|
||||
dnOutData.push({ label: "공업용수", val: indstUswtr, fill: "black" });
|
||||
|
||||
// 라인차트 데이터
|
||||
setInLineData({
|
||||
chartData1: wshwtrData,
|
||||
chartData2: coolUswtrData,
|
||||
chartData3: cleanUswtrData,
|
||||
chartData4: drwtUswtrData,
|
||||
chartData5: dltnUswtrData,
|
||||
chartData6: ithlRswtrData,
|
||||
chartData7: ithlEtcUswtrData,
|
||||
chartData8: cleanToilUswtrData,
|
||||
chartData9: resnData
|
||||
});
|
||||
setOutLineData({
|
||||
chartData1: lndwtrData,
|
||||
chartData2: hydUswtrData,
|
||||
chartData3: ugwtChrData,
|
||||
chartData4: farmUswtrData,
|
||||
chartData5: rvrKeepUswtrData,
|
||||
chartData6: indstUswtrData,
|
||||
});
|
||||
setBarData(barData);
|
||||
setChartData(dnData);
|
||||
setDnInUsage(dnInData);
|
||||
setDnOutUsage(dnOutData);
|
||||
}
|
||||
}, [rawData, year]);
|
||||
|
||||
useEffect(() => {
|
||||
const newChartConfig = chartData.reduce((config, element) => {
|
||||
@@ -196,46 +329,6 @@ export default function PbnstPrfmncSttn() {
|
||||
setChartConfig(newChartConfig);
|
||||
}, [chartData]);
|
||||
|
||||
// 장내용수 도넛차트
|
||||
useEffect(() => {
|
||||
let wshwtr = 0;
|
||||
let coolUswtr = 0;
|
||||
let cleanUswtr = 0;
|
||||
let drwtUswtr = 0;
|
||||
let dltnUswtr = 0;
|
||||
let ithlRswtr = 0;
|
||||
let ithlEtcUswtr = 0;
|
||||
let cleanToilUswtr = 0;
|
||||
let resn = 0;
|
||||
if (rawData) {
|
||||
rawData.forEach((item) => {
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
|
||||
|
||||
wshwtr += element.wshwtr; //세척수
|
||||
coolUswtr += element.coolUswtr; //냉각수
|
||||
cleanUswtr += element.cleanUswtr; //청소수
|
||||
drwtUswtr += element.drwtUswtr; //식수대
|
||||
dltnUswtr += element.dltnUswtr //희석용수
|
||||
ithlRswtr += element.ithlRswtr //중수도
|
||||
ithlEtcUswtr += element.ithlEtcUswtr //기타
|
||||
cleanToilUswtr += element.cleanToilUswtr //청소화장실용수
|
||||
resn += element.resn //세척살수용수
|
||||
});
|
||||
})
|
||||
const data: dnChartForm[] = []
|
||||
data?.push({ label: "세척수", val: wshwtr, fill: "yellow" })
|
||||
data?.push({ label: "냉각수", val: coolUswtr, fill: "green" })
|
||||
data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" })
|
||||
data?.push({ label: "식수대", val: drwtUswtr, fill: "green" })
|
||||
data?.push({ label: "희석용수", val: dltnUswtr, fill: "yellow" })
|
||||
data?.push({ label: "중수도", val: ithlRswtr, fill: "green" })
|
||||
data?.push({ label: "기타", val: ithlEtcUswtr, fill: "yellow" })
|
||||
data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "green" })
|
||||
data?.push({ label: "세척살수용수", val: resn, fill: "yellow" })
|
||||
setDnInUsage(data);
|
||||
}
|
||||
}, [rawData, year])
|
||||
|
||||
useEffect(() => {
|
||||
const newChartConfig = dnInUsage.reduce((config, element) => {
|
||||
config[element.label] = {
|
||||
@@ -247,37 +340,6 @@ export default function PbnstPrfmncSttn() {
|
||||
setDnInChartConfig(newChartConfig);
|
||||
}, [dnInUsage]);
|
||||
|
||||
// 장외용수 도넛차트
|
||||
useEffect(() => {
|
||||
let lndwtr = 0;
|
||||
let hydUswtr = 0;
|
||||
let ugwtChr = 0;
|
||||
let farmUswtr = 0;
|
||||
let rvrKeepUswtr = 0;
|
||||
let indstUswtr = 0;
|
||||
if (rawData) {
|
||||
rawData.forEach((item) => {
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
|
||||
lndwtr += element.lndwtr; //조경용수
|
||||
hydUswtr += element.hydUswtr; //친수용수
|
||||
ugwtChr += element.ugwtChr; //지하수충전
|
||||
farmUswtr += element.farmUswtr //농업용수
|
||||
rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수
|
||||
indstUswtr += element.indstUswtr //공업용수
|
||||
|
||||
});
|
||||
})
|
||||
const data: dnChartForm[] = []
|
||||
data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" })
|
||||
data?.push({ label: "친수용수", val: hydUswtr, fill: "black" })
|
||||
data?.push({ label: "지하수충전", val: ugwtChr, fill: "yellow" })
|
||||
data?.push({ label: "농업용수", val: farmUswtr, fill: "black" })
|
||||
data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "yellow" })
|
||||
data?.push({ label: "공업용수", val: indstUswtr, fill: "black" })
|
||||
setDnOutUsage(data);
|
||||
}
|
||||
}, [rawData, year])
|
||||
|
||||
useEffect(() => {
|
||||
const newChartConfig = dnOutUsage.reduce((config, element) => {
|
||||
config[element.label] = {
|
||||
@@ -289,69 +351,6 @@ export default function PbnstPrfmncSttn() {
|
||||
setDnOutChartConfig(newChartConfig);
|
||||
}, [dnOutUsage]);
|
||||
|
||||
//월별 장내외 용수 총 실적 막대차트
|
||||
useEffect(() => {
|
||||
let wshwtr = 0;
|
||||
let coolUswtr = 0;
|
||||
let cleanUswtr = 0;
|
||||
let drwtUswtr = 0;
|
||||
let dltnUswtr = 0;
|
||||
let ithlRswtr = 0;
|
||||
let ithlEtcUswtr = 0;
|
||||
let cleanToilUswtr = 0;
|
||||
let resn = 0;
|
||||
let lndwtr = 0;
|
||||
let hydUswtr = 0;
|
||||
let ugwtChr = 0;
|
||||
let farmUswtr = 0;
|
||||
let rvrKeepUswtr = 0;
|
||||
let indstUswtr = 0;
|
||||
let inUsageSum = 0;
|
||||
let outUsageSum = 0;
|
||||
let inUsageArr = [];
|
||||
let outUsageArr = [];
|
||||
|
||||
|
||||
if (rawData) {
|
||||
const data: barChartForm[] = []
|
||||
rawData.forEach((item) => {
|
||||
item.prfList
|
||||
.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
|
||||
|
||||
wshwtr = element.wshwtr; //세척수
|
||||
coolUswtr = element.coolUswtr; //냉각수
|
||||
cleanUswtr = element.cleanUswtr; //청소수
|
||||
drwtUswtr = element.drwtUswtr; //식수대
|
||||
dltnUswtr = element.dltnUswtr //희석용수
|
||||
ithlRswtr = element.ithlRswtr //중수도
|
||||
ithlEtcUswtr = element.ithlEtcUswtr //기타
|
||||
cleanToilUswtr = element.cleanToilUswtr //청소화장실용수
|
||||
resn = element.resn //세척살수용수
|
||||
|
||||
lndwtr = element.lndwtr; //조경용수
|
||||
hydUswtr = element.hydUswtr; //친수용수
|
||||
ugwtChr = element.ugwtChr; //지하수충전
|
||||
farmUswtr = element.farmUswtr //농업용수
|
||||
rvrKeepUswtr = element.rvrKeepUswtr //하천등유지용수
|
||||
indstUswtr = element.indstUswtr //공업용수
|
||||
|
||||
inUsageSum = wshwtr + coolUswtr + cleanUswtr + drwtUswtr + dltnUswtr + ithlRswtr + ithlEtcUswtr + cleanToilUswtr + resn;
|
||||
inUsageArr.push(inUsageSum)
|
||||
outUsageSum = lndwtr + hydUswtr + ugwtChr + farmUswtr + rvrKeepUswtr + indstUswtr;
|
||||
outUsageArr.push(outUsageSum)
|
||||
|
||||
const month = Number(element.ym.slice(4, 6))
|
||||
data.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum })
|
||||
|
||||
},
|
||||
);
|
||||
|
||||
})
|
||||
|
||||
setBarData(data);
|
||||
}
|
||||
}, [rawData, year])
|
||||
|
||||
useEffect(() => {
|
||||
const newChartConfig = barData.reduce((config, element) => {
|
||||
config[element.label] = {
|
||||
@@ -363,51 +362,6 @@ export default function PbnstPrfmncSttn() {
|
||||
setBarChartConfig(newChartConfig);
|
||||
}, [barData]);
|
||||
|
||||
//월별 장내 용수 실적 라인차트
|
||||
useEffect(() => {
|
||||
|
||||
if (rawData) {
|
||||
const wshwtrData: lineChartDataProps[] = []
|
||||
const coolUswtrData: lineChartDataProps[] = []
|
||||
const cleanUswtrData: lineChartDataProps[] = []
|
||||
const drwtUswtrData: lineChartDataProps[] = []
|
||||
const dltnUswtrData: lineChartDataProps[] = []
|
||||
const ithlRswtrData: lineChartDataProps[] = []
|
||||
const ithlEtcUswtrData: lineChartDataProps[] = []
|
||||
const cleanToilUswtrData: lineChartDataProps[] = []
|
||||
const resnData: lineChartDataProps[] = []
|
||||
rawData.forEach((item) => {
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
|
||||
const month = Number(element.ym.slice(4, 6))
|
||||
wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" })
|
||||
coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "red" })
|
||||
cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "red" })
|
||||
drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "red" })
|
||||
dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "red" })
|
||||
ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "red" })
|
||||
ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "red" })
|
||||
cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "red" })
|
||||
resnData.push({ label: `${month}월`, val: element.resn, color: "red" })
|
||||
|
||||
},
|
||||
);
|
||||
})
|
||||
const rtndata = {
|
||||
chartData1: wshwtrData,
|
||||
chartData2: coolUswtrData,
|
||||
chartData3: cleanUswtrData,
|
||||
chartData4: drwtUswtrData,
|
||||
chartData5: dltnUswtrData,
|
||||
chartData6: ithlRswtrData,
|
||||
chartData7: ithlEtcUswtrData,
|
||||
chartData8: cleanToilUswtrData,
|
||||
chartData9: resnData
|
||||
}
|
||||
|
||||
setInLineData(rtndata)
|
||||
}
|
||||
}, [rawData, year])
|
||||
|
||||
useEffect(() => {
|
||||
if (inLineData?.chartData1) {
|
||||
const newChartConfig = {
|
||||
@@ -452,37 +406,6 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}, [inLineData]);
|
||||
|
||||
//월별 장외 용수 실적 라인차트
|
||||
useEffect(() => {
|
||||
if (rawData) {
|
||||
const lndwtrData: lineChartDataProps[] = []
|
||||
const hydUswtrData: lineChartDataProps[] = []
|
||||
const ugwtChrData: lineChartDataProps[] = []
|
||||
const farmUswtrData: lineChartDataProps[] = []
|
||||
const rvrKeepUswtrData: lineChartDataProps[] = []
|
||||
const indstUswtrData: lineChartDataProps[] = []
|
||||
rawData.forEach((item) => {
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
|
||||
const month = Number(element.ym.slice(4, 6))
|
||||
lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" })
|
||||
hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "red" })
|
||||
ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "red" })
|
||||
farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "red" })
|
||||
rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "red" })
|
||||
indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "red" })
|
||||
},
|
||||
);
|
||||
})
|
||||
setOutLineData({
|
||||
chartData1: lndwtrData,
|
||||
chartData2: hydUswtrData,
|
||||
chartData3: ugwtChrData,
|
||||
chartData4: farmUswtrData,
|
||||
chartData5: rvrKeepUswtrData,
|
||||
chartData6: indstUswtrData,
|
||||
})
|
||||
}
|
||||
}, [rawData, year])
|
||||
|
||||
useEffect(() => {
|
||||
if (outLineData?.chartData1) {
|
||||
@@ -526,6 +449,16 @@ export default function PbnstPrfmncSttn() {
|
||||
setbdstTable(prfmncRes);
|
||||
}, [prfmncRes]);
|
||||
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnRuseNm.length > 1)
|
||||
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear);
|
||||
}, [pbnRuseNm]);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -566,13 +499,17 @@ export default function PbnstPrfmncSttn() {
|
||||
value={toDate}
|
||||
onSelectValue={(val: string | number) => setToDate(String(val))} />
|
||||
</div>
|
||||
<SearchInput
|
||||
className={"text-2xl"}
|
||||
label="시설명"
|
||||
textValue={swtrmtFcltNm ?? ""}
|
||||
setText={(e) => {
|
||||
setSwtrmtFcltNm(e);
|
||||
}} />
|
||||
<SearchInputText
|
||||
label={"하수처리시설"}
|
||||
initValue={pbnRuseNm ?? ""}
|
||||
setValue={(searchNm?: string) => {
|
||||
setPbnRuseNm(searchNm || "");
|
||||
}}
|
||||
setRtnData={function (rtnData: any[]): void {
|
||||
setbdstTable(rtnData);
|
||||
}}
|
||||
searchList={pbnstSttn.pbnstSearchData || []}
|
||||
></SearchInputText>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label="재이용시설명"
|
||||
@@ -599,7 +536,7 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}
|
||||
}}
|
||||
excelClick={() => { }}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void { }}
|
||||
btnClass={btnClass}
|
||||
ref={ref} isAdmin={false} />
|
||||
@@ -680,7 +617,7 @@ export default function PbnstPrfmncSttn() {
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
<Toaster position="top-center"/>
|
||||
<Toaster position="top-center" />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -31,18 +31,18 @@ const bdstUsgCd: SelectDataType[] = [
|
||||
{ val: '16', text: "기타" },
|
||||
];
|
||||
//빗물 집수면 종류 용도
|
||||
const rainFcltCd = [
|
||||
{ val: "1", text: "지붕" },
|
||||
{ val: "2", text: "건물옥상" },
|
||||
{ val: "3", text: "골프장 연못" },
|
||||
{ val: "4", text: "운동장 바닥" },
|
||||
{ val: "5", text: "운동장 지붕" },
|
||||
{ val: "6", text: "주차장" },
|
||||
{ val: "7", text: "태양광패널" },
|
||||
{ val: "8", text: "연못" },
|
||||
{ val: "9", text: "기타" },
|
||||
{ val: "10", text: "확인불가" },
|
||||
];
|
||||
// const rainFcltCd = [
|
||||
// { val: "1", text: "지붕" },
|
||||
// { val: "2", text: "건물옥상" },
|
||||
// { val: "3", text: "골프장 연못" },
|
||||
// { val: "4", text: "운동장 바닥" },
|
||||
// { val: "5", text: "운동장 지붕" },
|
||||
// { val: "6", text: "주차장" },
|
||||
// { val: "7", text: "태양광패널" },
|
||||
// { val: "8", text: "연못" },
|
||||
// { val: "9", text: "기타" },
|
||||
// { val: "10", text: "확인불가" },
|
||||
// ];
|
||||
// 중수도 필수 원수종류
|
||||
const rswtBdstType: SelectDataType[] = [
|
||||
{ text: "숙박업", val: "17" },
|
||||
@@ -138,6 +138,19 @@ export const buildingType = {
|
||||
HTB:"HTB"
|
||||
}
|
||||
|
||||
const rainFcltCd = [
|
||||
{ val: "지붕", text: "지붕" },
|
||||
{ val: "건물옥상", text: "건물옥상" },
|
||||
{ val: "골프장 연못", text: "골프장 연못" },
|
||||
{ val: "운동장 바닥", text: "운동장 바닥" },
|
||||
{ val: "운동장 지붕", text: "운동장 지붕" },
|
||||
{ val: "주차장", text: "주차장" },
|
||||
{ val: "태양광패널", text: "태양광패널" },
|
||||
{ val: "연못", text: "연못" },
|
||||
{ val: "기타", text: "기타" },
|
||||
{ val: "확인불가", text: "확인불가" },
|
||||
];
|
||||
|
||||
export type comCodeState = {
|
||||
code: {
|
||||
isInit: boolean;
|
||||
|
||||
@@ -22,5 +22,6 @@ export type TableUpperProps = {
|
||||
selectData ?:string; // type 이 seelct 일경우 selectarray 정하기 위해
|
||||
row?:number;
|
||||
mergeCell?:boolean // 셀을 합칠경우
|
||||
readonly?:boolean
|
||||
};
|
||||
|
||||
|
||||
@@ -187,13 +187,13 @@ export const rateFeeHeadListExport: CommonTableProps[] = [
|
||||
];
|
||||
|
||||
export const usageProcData = [
|
||||
{ usage: "청소", process: "총인처리시설 + 염소소독" },
|
||||
{ usage: "화장실용수", process: "총인처리시설 + 염소소독" },
|
||||
{ usage: "세척", process: "총인처리시설 + UV소독" },
|
||||
{ usage: "살수", process: "총인처리시설 + UV소독" },
|
||||
{ usage: "조경", process: "총인처리시설 + UV소독" },
|
||||
{ usage: "농업", process: "총인처리시설 + UV소독" },
|
||||
{ usage: "하천", process: "총인처리시설 + UV소독" },
|
||||
{ usage: "지하수", process: "전처리시설 + RO" },
|
||||
{ usage: "공업", process: "전처리시설 + RO" },
|
||||
{ usage: "청소", process: "총인처리시설+염소소독" },
|
||||
{ usage: "화장실용수", process: "총인처리시설+염소소독" },
|
||||
{ usage: "세척", process: "총인처리시설+UV소독" },
|
||||
{ usage: "살수", process: "총인처리시설+UV소독" },
|
||||
{ usage: "조경", process: "총인처리시설+UV소독" },
|
||||
{ usage: "농업", process: "총인처리시설+UV소독" },
|
||||
{ usage: "하천", process: "총인처리시설+UV소독" },
|
||||
{ usage: "지하수", process: "전처리시설+RO" },
|
||||
{ usage: "공업", process: "전처리시설+RO" },
|
||||
];
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
|
||||
@@ -73,19 +73,19 @@ import { z } from "zod";
|
||||
dmdInfoFk: z.string(),
|
||||
dmndTmng: z.coerce.date(),
|
||||
dmndQty: z.number(),
|
||||
wntUntprc: z.number(),
|
||||
grssClfg: z.number(),
|
||||
combResdch: z.number(),
|
||||
trbt: z.number(),
|
||||
wntUntprc: z.number().nullish(),
|
||||
grssClfg: z.number().nullish(),
|
||||
combResdch: z.number().nullish(),
|
||||
trbt: z.number().nullish(),
|
||||
blgcOxygDmndQnt: z.number(),
|
||||
smll: z.number(),
|
||||
crmty: z.number(),
|
||||
tn: z.number(),
|
||||
tph: z.number(),
|
||||
ph: z.number(),
|
||||
clIonQnt: z.number(),
|
||||
smll: z.number().nullish(),
|
||||
crmty: z.number().nullish(),
|
||||
tn: z.number().nullish(),
|
||||
tph: z.number().nullish(),
|
||||
ph: z.number().nullish(),
|
||||
clIonQnt: z.number().nullish(),
|
||||
cdtnv: z.number(),
|
||||
rmrk: z.string(),
|
||||
rmrk: z.string().nullish(),
|
||||
useUsgCd: z.string().nullish(),
|
||||
mtchnCmptnYmd: z.string().nullish(),
|
||||
rvwCmptnYmd: z.string().nullish(),
|
||||
@@ -93,6 +93,8 @@ import { z } from "zod";
|
||||
demandMatching: DemandMatchingSchema.nullish(),
|
||||
demandCst: DemandCstSchema,
|
||||
ruseUtztnFcltNm:z.string().nullish(),
|
||||
totalConstCost:z.number().nullish(),
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -113,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 (
|
||||
@@ -62,14 +78,13 @@ const irvwHistInit = async (
|
||||
pageCnt: number,
|
||||
startYear: string,
|
||||
endYear: string,
|
||||
sggCd?: string
|
||||
) => {
|
||||
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
|
||||
|
||||
console.log("sggCd ", sggCd);
|
||||
if (sggCd) {
|
||||
url += `/${sggCd}`;
|
||||
}
|
||||
// console.log("sggCd ", sggCd);
|
||||
// if (sggCd) {
|
||||
// url += `/${sggCd}`;
|
||||
// }
|
||||
|
||||
const rvwHistRes = await getFetch(fetchType.WR, url);
|
||||
|
||||
@@ -92,7 +107,7 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
pageCnt,
|
||||
startYear,
|
||||
endYear,
|
||||
sggCd
|
||||
// sggCd
|
||||
);
|
||||
|
||||
return set((state: ruseHstryState) => ({
|
||||
@@ -106,9 +121,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("매칭 계산 저장이 완료입니다.");
|
||||
@@ -117,7 +134,6 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
10,
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
"0"
|
||||
);
|
||||
return set((state: ruseHstryState) => ({
|
||||
...state,
|
||||
@@ -193,11 +209,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 +223,6 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
|
||||
10,
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
"0"
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { FcPrfType, PrfType } from "./type";
|
||||
import type { TableUpperProps } from "../../common/type/header";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
|
||||
const monthHeadList = monthHeadListExport;
|
||||
@@ -94,18 +95,13 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
console.log('ressponse ', ressponse)
|
||||
|
||||
if(ressponse.status === 200){
|
||||
ToastFormUi({
|
||||
body: "하수재이용 시설 실적 등록이 완료되었습니다. ",
|
||||
title: "하수재이용 시설 실적 등록",
|
||||
});
|
||||
|
||||
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.")
|
||||
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
ToastFormUi({
|
||||
body: "하수재이용 시설 실적 등록이 실패하였습니다. ",
|
||||
title: "하수재이용 시설 실적 등록",
|
||||
});
|
||||
toast.error("하수재이용 시설 실적 등록이 실패하였습니다.")
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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",
|
||||
용수명: "조경용수",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
export const excelPrfmncSttnParsing = (
|
||||
data: any[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
item.용수명,
|
||||
item.total,
|
||||
item["1월"],
|
||||
item["2월"],
|
||||
item["3월"],
|
||||
item["4월"],
|
||||
item["5월"],
|
||||
item["6월"],
|
||||
item["7월"],
|
||||
item["8월"],
|
||||
item["9월"],
|
||||
item["10월"],
|
||||
item["11월"],
|
||||
item["12월"],
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
};
|
||||
@@ -86,7 +86,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
yearHead[0].title = i + "년도"
|
||||
}
|
||||
yearHeader = [...yearHeader, ...yearHead]
|
||||
selectList.push({text: i + "년도", val: String(i)} )
|
||||
selectList.push({ text: i + "년도", val: String(i) })
|
||||
}
|
||||
set((state: pbnstPrfmncSttnState) => {
|
||||
return {
|
||||
@@ -142,7 +142,6 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
bscFctCdList,
|
||||
`wr`,
|
||||
)
|
||||
|
||||
let inUsageSum = 0;
|
||||
let outUsageSum = 0;
|
||||
let usageSum = 0;
|
||||
@@ -176,9 +175,6 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
resData.push({ ...data, ...acc })
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
fcOrgwtsHeadListExport,
|
||||
} from "./headList";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
const selectLabel: SelectDataType[] = [{ text: "test", val: "1" }];
|
||||
const pubFacHeadList = pubFacHeadListExport;
|
||||
@@ -62,9 +63,9 @@ type pubFacActions = {
|
||||
appendRuseFclt(array: customPbnst[]): void;
|
||||
fileDelete: (atflCd: string) => void;
|
||||
fileDownLoad: (atflCd: string) => void;
|
||||
pbnstMngData: (data: customPbnst[]) => void;
|
||||
pbnstBizData(data: fcBizType): void;
|
||||
getBizCycle: (pbnstObj: customPbnst) => void;
|
||||
//pbnstMngData: (data: customPbnst[]) => void;
|
||||
//pbnstBizData(data: fcBizType): void;
|
||||
// getBizCycle: (pbnstObj: customPbnst) => void;
|
||||
getpbnstInsertIndex: (data: pbnstInsertIndex) => void;
|
||||
pbnstRuseFcltUpdate: (ruseRes: customPbnst[]) => void;
|
||||
pbnstRuseBizUpdate: (ruseRes: fcBizType[]) => void;
|
||||
@@ -100,14 +101,20 @@ const checkWrRegList = async () => {
|
||||
|
||||
const hasuListFetch = async (page: string, sggOrCity: string, searchTxt?:string) => {
|
||||
const checkWrRegListRes = await checkWrRegList();
|
||||
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`;
|
||||
|
||||
console.log(' checkWrRegListRes ', checkWrRegListRes)
|
||||
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity? sggOrCity : "11"}/0/1/SW`;
|
||||
|
||||
|
||||
const data = checkWrRegListRes.filter((item:string) => item !== "")
|
||||
console.log(' checkWrRegListRes ' )
|
||||
if(searchTxt){
|
||||
url= url +`/${searchTxt}`
|
||||
|
||||
}
|
||||
const rainRes = await postFectch(
|
||||
url,
|
||||
checkWrRegListRes,
|
||||
data,
|
||||
fetchType.COMMON
|
||||
);
|
||||
|
||||
@@ -200,7 +207,6 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
pbnstRegClick: async (pubHasuRes: pubHasuType) => {
|
||||
try {
|
||||
const pbnstRes = await initFetch(pubHasuRes.bscFctCd);
|
||||
console.log('pbnstRes ' , pbnstRes)
|
||||
return set((state: pubFacState) => ({
|
||||
...state,
|
||||
pbnst: {
|
||||
@@ -234,14 +240,19 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
|
||||
const response = await postFectch(
|
||||
`/reuseFc/pubFc`,
|
||||
JSON.stringify( pbnstRes)
|
||||
pbnstRes
|
||||
);
|
||||
if( response.status === 200) {
|
||||
toast.success(`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`);
|
||||
}
|
||||
const pbnstHasuRes = await hasuListFetch('1', '0');
|
||||
|
||||
|
||||
return set((state: pubFacState) => ({
|
||||
...state,
|
||||
pbnst: {
|
||||
...state.pbnst,
|
||||
pbnstRes: response.data,
|
||||
pbnstRes: pbnstHasuRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -334,41 +345,41 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
|
||||
}
|
||||
},
|
||||
|
||||
pbnstMngData: (data: customPbnst[]) => {
|
||||
if (data.length > 0) {
|
||||
}
|
||||
return set((state: pubFacState) => {
|
||||
state.pbnst.pbnstMngRegData = data;
|
||||
state.pbnst.pbnstBizCycle =
|
||||
data.length <= 0
|
||||
? [{ text: "없음", val: "1" }]
|
||||
: state.pbnst.pbnstBizCycle;
|
||||
return state;
|
||||
});
|
||||
},
|
||||
// pbnstMngData: (data: customPbnst[]) => {
|
||||
// if (data.length > 0) {
|
||||
// }
|
||||
// return set((state: pubFacState) => {
|
||||
// state.pbnst.pbnstMngRegData = data;
|
||||
// state.pbnst.pbnstBizCycle =
|
||||
// data.length <= 0
|
||||
// ? [{ text: "없음", val: "1" }]
|
||||
// : state.pbnst.pbnstBizCycle;
|
||||
// return state;
|
||||
// });
|
||||
// },
|
||||
|
||||
pbnstBizData: (data: fcBizType) => {
|
||||
return set((state: pubFacState) => {
|
||||
if (state.pbnst.pbnstMngRegData) {
|
||||
const regData = state.pbnst.pbnstMngRegData.find(
|
||||
(item) => data.pbnstRuseFcltFk === item.pbnstRuseFcltPk
|
||||
);
|
||||
if (regData) {
|
||||
const bizIdx = regData.fcBizs.findIndex(
|
||||
(item) => item.pbnstRuseFcltBizPk == data.pbnstRuseFcltBizPk
|
||||
);
|
||||
// pbnstBizData: (data: fcBizType) => {
|
||||
// return set((state: pubFacState) => {
|
||||
// if (state.pbnst.pbnstMngRegData) {
|
||||
// const regData = state.pbnst.pbnstMngRegData.find(
|
||||
// (item) => data.pbnstRuseFcltFk === item.pbnstRuseFcltPk
|
||||
// );
|
||||
// if (regData) {
|
||||
// const bizIdx = regData.fcBizs.findIndex(
|
||||
// (item) => item.pbnstRuseFcltBizPk == data.pbnstRuseFcltBizPk
|
||||
// );
|
||||
|
||||
if (bizIdx >= 0) {
|
||||
regData.fcBizs[bizIdx] = data;
|
||||
const pbnstData = state.pbnst.pbnstMngRegData
|
||||
state.pbnst.pbnstMngRegData= [...pbnstData]
|
||||
// if (bizIdx >= 0) {
|
||||
// regData.fcBizs[bizIdx] = data;
|
||||
// const pbnstData = state.pbnst.pbnstMngRegData
|
||||
// state.pbnst.pbnstMngRegData= [...pbnstData]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
});
|
||||
},
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return state;
|
||||
// });
|
||||
// },
|
||||
getpbnstInsertIndex: async (data: pbnstInsertIndex) => {
|
||||
return set((state: pubFacState) => {
|
||||
state.pbnst.pbnsUpdateIndex = data;
|
||||
|
||||
@@ -57,7 +57,7 @@ export type PbnstDemandComType = {
|
||||
dmdAplyPswd: string | '';
|
||||
splyCpct: number | 0;
|
||||
splyFmYn:string|'Y'
|
||||
dmdInfoFk:string|''
|
||||
// dmdInfoFk:string|''
|
||||
}
|
||||
|
||||
const pubHasuZod = z.object({
|
||||
@@ -129,14 +129,14 @@ const fcOrgwtSchema = z.object({
|
||||
});
|
||||
|
||||
const dmdColist = z.object({
|
||||
dmdInfoFk: z.string().default(''),
|
||||
dmdInfoPk: 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(),
|
||||
|
||||
@@ -1,30 +1,34 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
|
||||
|
||||
export const excelHtdflSttnParsing = (data: customHtdflBdst[]): string[][] => {
|
||||
export const excelHtdflSttnParsing = (
|
||||
data: customHtdflBdst[],
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
String(item.cityText??""),
|
||||
String(item.sggText??""),
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
item.bdstNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.frstArchPrmsnDt ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.etgtType ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.fclCpct ?? ""), // fix: added missing parenthesis
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.plwtYn ? "Y" :"N"), // fix: added missing parenthesis
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.plwtYn ? "Y" : "N"), // fix: added missing parenthesis
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.orgwtWtritSpt ?? ""), // fix: added missing parenthesis
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.wtritEntrcTp ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj.orgwtOcrnProcs ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String( item.reuseBuilding?.[0]?.htdflObj?.amtgnr ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.amtgnr ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.prcsProcsYn ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String( '컬럼확인'), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.prcsFcltCpct ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.fmYn ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.utztnCpct ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.utztnUsg ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
String(item.reuseBuilding?.[0]?.htdflObj?.emsnExitTp ?? ""), // fix: removed as it doesn't exist in the provided context
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
};
|
||||
|
||||
@@ -70,13 +70,6 @@ export const htdflSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
title: "처리공정여부",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "prcsProcstest",
|
||||
title: "처리공정여부??",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
id: "prcsFcltCpct",
|
||||
title: "처리시설용량(m³)",
|
||||
@@ -259,36 +252,15 @@ export const htdflSttNodeListExport: CommonTableProps[] = [
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "prcsProcs",
|
||||
title: "처리공정",
|
||||
upName: "htdflMngInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 1,
|
||||
colSpan: 2,
|
||||
},
|
||||
{
|
||||
id: "prcsProcsYn",
|
||||
title: "처리공정여부",
|
||||
upName: "prcsProcs",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{
|
||||
id: "prcsProcstest",
|
||||
title: "처리공정여부??",
|
||||
upName: "prcsProcs",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
id: "prcsFcltCpct",
|
||||
title: "처리시설용량(m³)",
|
||||
|
||||
@@ -31,8 +31,8 @@ export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
{ id: "bscFctNm", title: "시설명", visible: true },
|
||||
{ id: "efflWqltStndrdNm", title: "지역구분", visible: true },
|
||||
|
||||
{ id: "fctCpc", title: "시설용량(톤/일)", visible: true },
|
||||
{ id: "tel", title: "전화번호", visible: true },
|
||||
{ id: "fctCpc", title: "시설용량(톤/일)", visible: true },
|
||||
{ id: "ruseUtztnFcltNm", title: "재이용시설명", visible: true },
|
||||
|
||||
{
|
||||
@@ -132,7 +132,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "phone",
|
||||
id: "tel",
|
||||
title: "전화번호",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -140,7 +140,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "fcltQuantity",
|
||||
id: "fctCpc",
|
||||
title: "시설용량(톤/일)",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -325,7 +325,7 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 10,
|
||||
colSpan: 9,
|
||||
},
|
||||
{
|
||||
id: "ruseFclt",
|
||||
@@ -333,10 +333,10 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 5,
|
||||
colSpan: 3,
|
||||
},
|
||||
{
|
||||
id: "mainSply",
|
||||
id: "mainSplyPumpCpct",
|
||||
title: "메인공급펌프용량",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -349,7 +349,7 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 1,
|
||||
colSpan: 6,
|
||||
colSpan: 5,
|
||||
},
|
||||
{
|
||||
id: "instlAprvSncnDt",
|
||||
@@ -424,14 +424,7 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "cusrAlotm2",
|
||||
title: "원인자부담금",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{ id: "etc", title: "기타", visible: true, row: 3, rowSpan: 1, colSpan: 1 },
|
||||
{
|
||||
id: "totalMoney",
|
||||
@@ -498,11 +491,7 @@ export const ruseFcltHeadListExport: CommonTableProps[] = [
|
||||
title: "민간투자비",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "cusrAlotm2",
|
||||
title: "원인자부담금",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{ id: "etc", title: "기타", visible: true },
|
||||
{
|
||||
id: "totalMoney",
|
||||
@@ -545,7 +534,7 @@ export const ruseFcltHeadListExport: CommonTableProps[] = [
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "mainSply",
|
||||
id: "mainSplyPumpCpct",
|
||||
title: "메인공급펌프용량",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { customRainBdst } from "../../fcltReg/rainReg";
|
||||
|
||||
export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => {
|
||||
export const excelRainSttnParsing = (
|
||||
data: customRainBdst[],
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
String(item.ctpvCd),
|
||||
String(item.sggCd),
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
item.bdstNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.bdstInfoPk ?? ""),
|
||||
String(item.frstArchPrmsnDt ?? ""),
|
||||
String(item.archArea ?? ""),
|
||||
String(item.chgBuilding.length>0 ? "Y" :"N"),
|
||||
String(item.chgBuilding.length > 0 ? "Y" : "N"),
|
||||
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCst ?? ""),
|
||||
@@ -28,8 +33,8 @@ export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => {
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "")
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from "./headList";
|
||||
import type { z } from "zod";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
|
||||
// 테이블 헤드 리스트
|
||||
const rainSttHeadList = rainSttHeadListExport;
|
||||
@@ -101,7 +102,7 @@ export type rainSttnState = {
|
||||
};
|
||||
type rainSttnActions = {
|
||||
rainSttnInit:(con:string) => void
|
||||
rainSttnSearch: (page: number, total: string, con: string) => void;
|
||||
rainSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], sggCode: SelectDataType[]) => void;
|
||||
rainChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
) => void;
|
||||
@@ -148,14 +149,16 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
rainSttnSearch: async (page: number, total: string, con: string) => {
|
||||
rainSttnSearch: async (page: number, total: string, con: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const rainSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/rainyInfoList/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
const rainExcel = excelRainSttnParsing(rainSttnRes);
|
||||
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import { useWrStore } from "@/app/store";
|
||||
|
||||
export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => {
|
||||
export const excelRSwtSttnParsing = (
|
||||
data: customRswtBdst[],
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
String(item.ctpvCd),
|
||||
String(item.sggCd),
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
item.bdstNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.bdstUsgText ?? ""),
|
||||
String(item.frstArchPrmsnDt ?? ""),
|
||||
String(item.archArea ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
|
||||
String(item.chgBuilding.length>0 ? "Y" :"N"), //중축・개축・재축여부
|
||||
String(item.chgBuilding.length > 0 ? "Y" : "N"), //중축・개축・재축여부
|
||||
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), //법적의무대상여부
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), //의무대상물사용량
|
||||
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시
|
||||
@@ -28,7 +34,7 @@ export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => {
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "")
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
};
|
||||
@@ -6,6 +6,7 @@ import { controlHeadView } from "../rainSttn";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import { excelRSwtSttnParsing } from "./excel";
|
||||
import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
|
||||
|
||||
|
||||
@@ -26,11 +27,10 @@ export type rswtSttnState = {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
type rswtSttnActions = {
|
||||
rswtSttnInit: (con: string) => void;
|
||||
rswtSttnSearch: (page: number, total: string, con: string) => void;
|
||||
rswtSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
rswtChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
) => void;
|
||||
@@ -38,8 +38,6 @@ type rswtSttnActions = {
|
||||
|
||||
export type rswtSttnType = rswtSttnState & rswtSttnActions;
|
||||
|
||||
|
||||
|
||||
export const rswtSttnStateExport: rswtSttnState = {
|
||||
rswtSttn: {
|
||||
rswtSttHeadList: rswtSttHeadList,
|
||||
@@ -77,14 +75,16 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
rswtSttnSearch: async (page: number, total: string, con: string) => {
|
||||
rswtSttnSearch: async (page: number, total: string, con: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const rswtSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes);
|
||||
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
|
||||
set((state: rswtSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -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`;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
export const findBounds = (
|
||||
data: any[],
|
||||
fctCd: string,
|
||||
dataCode: string,
|
||||
qtyCode:string,
|
||||
qty: number
|
||||
): { lower: any; upper: any } => {
|
||||
|
||||
|
||||
const filtered = data.filter((item) => item[dataCode] === fctCd);
|
||||
|
||||
const lowers = filtered.filter((item) => Number(item[qtyCode]) <= qty);
|
||||
const uppers = filtered.filter((item) => Number(item[qtyCode]) > qty);
|
||||
|
||||
const lower =
|
||||
lowers.length > 0
|
||||
? lowers.reduce((acc, curr) =>
|
||||
Number(curr[qtyCode]) > Number(acc[qtyCode]) ? curr : acc
|
||||
)
|
||||
: undefined;
|
||||
|
||||
const upper =
|
||||
uppers.length > 0
|
||||
? uppers.reduce((acc, curr) =>
|
||||
Number(curr[qtyCode]) < Number(acc[qtyCode]) ? curr : acc
|
||||
)
|
||||
: undefined;
|
||||
|
||||
// ✅ 바운더리 하나만 있을 경우 대체 처리
|
||||
if (!lower && upper) return { lower: upper, upper };
|
||||
if (!upper && lower) return { lower, upper: lower };
|
||||
|
||||
// ✅ 정상 보간 구간
|
||||
if (lower && upper) return { lower, upper };
|
||||
|
||||
// ❌ 둘 다 없을 경우 (fctCd 필터 결과가 없음)
|
||||
throw new Error(`No matching bounds found for fctCd: ${fctCd}, qty: ${qty}`);
|
||||
};
|
||||
|
||||
|
||||
// (기울기) a = (y2 - y1) / (x2 - x1)
|
||||
// (절편) b = y1 - a * x1
|
||||
// ↓
|
||||
// 결과값 y = a * x + b
|
||||
|
||||
|
||||
export const getInterpolation = (
|
||||
Upper: { stdCost: number; fctCpc: number },
|
||||
Lower: { stdCost: number; fctCpc: number },
|
||||
qtyYear: number
|
||||
): number => {
|
||||
const x1 = Number(Lower.fctCpc); // 최소 처리 용량
|
||||
const y1 = Number(Lower.stdCost); // 최소 공사비/요율
|
||||
const x2 = Number(Upper.fctCpc); // 최대 처리 용량
|
||||
const y2 = Number(Upper.stdCost); // 최대 공사비/요율
|
||||
|
||||
if (qtyYear <= x1) return y1; // 최소 이하면 y1 반환
|
||||
if (qtyYear >= x2) return y2; // 최대 이상이면 y2 반환
|
||||
|
||||
const slope = (y2 - y1) / (x2 - x1); // 기울기 a
|
||||
const intercept = y1 - slope * x1; // 절편 b
|
||||
|
||||
return slope * qtyYear + intercept; // 보간 계산
|
||||
};
|
||||
|
||||
export const transformAndInterpolate = (
|
||||
rawData: any,
|
||||
dmndQtyYear: number
|
||||
): any => {
|
||||
const result: any = {};
|
||||
|
||||
for (const key in rawData) {
|
||||
const item = rawData[key];
|
||||
|
||||
const range = {
|
||||
Lower: {
|
||||
fctCpc: item.lower?.stdCost,
|
||||
stdCost: item.lower?.rt,
|
||||
},
|
||||
Upper: {
|
||||
fctCpc: item.upper?.stdCost,
|
||||
stdCost: item.upper?.rt,
|
||||
},
|
||||
};
|
||||
result[key] = getInterpolation(range.Upper, range.Lower, dmndQtyYear);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export const getConstFctCode = (fctCd: string) => {
|
||||
const fctMap: { [key: string]: string } = {
|
||||
총인처리시설: "001",
|
||||
염소소독: "002",
|
||||
UV소독: "003",
|
||||
전처리시설: "004",
|
||||
RO: "005",
|
||||
};
|
||||
|
||||
return fctMap[fctCd];
|
||||
};
|
||||
@@ -153,3 +153,6 @@ export const getdmdMatFlag = (flag: string|undefined) => {
|
||||
}
|
||||
return flagMat;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,12 @@ 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 {
|
||||
findBounds,
|
||||
getConstFctCode,
|
||||
getInterpolation,
|
||||
transformAndInterpolate,
|
||||
} from "@/components/lib/func/calculateConstCost ";
|
||||
import { ConstCostFeeTable } from "@/components/ui/modal/coMat/constCostFeeTable";
|
||||
import { RateFeeTableModal } from "@/components/ui/modal/coMat/rateFeeModal";
|
||||
import {
|
||||
@@ -17,8 +23,10 @@ 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, useRef, useState } from "react";
|
||||
import type { read } from "fs";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default function ConCostForm({
|
||||
form,
|
||||
@@ -27,7 +35,14 @@ export default function ConCostForm({
|
||||
form: UseFormReturn<DmdCoReqType>;
|
||||
type: string;
|
||||
}) {
|
||||
const { coMatRvwUpdate, ruseRvwCalUpdate,getRateFee ,getConstCostFee} = useWrStore((state) => state);
|
||||
const {
|
||||
constCostRes,
|
||||
rateFeeRes,
|
||||
coMatRvwUpdate,
|
||||
ruseRvwCalUpdate,
|
||||
getRateFee,
|
||||
getConstCostFee,
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const ref = useRef<boolean>(false);
|
||||
|
||||
@@ -38,15 +53,7 @@ export default function ConCostForm({
|
||||
getRateFee(String(currentYear));
|
||||
ref.current = true;
|
||||
}
|
||||
}, [ref, getConstCostFee ,getRateFee ]);
|
||||
|
||||
|
||||
const [isTrfMo, setIsTrfMo] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
const [isCmpttnMo, setIsCmpttnMo] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
}, [ref, getConstCostFee, getRateFee]);
|
||||
|
||||
const zipDowonLoad = () => {
|
||||
fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => {
|
||||
@@ -59,25 +66,88 @@ export default function ConCostForm({
|
||||
link.click();
|
||||
});
|
||||
};
|
||||
const usgPrcsProcsWatch = form.watch("demandCst.usgPrcsProcs");
|
||||
const dmndQtyWatch = form.watch("dmndQty");
|
||||
const totalConstCost = form.watch("totalConstCost");
|
||||
const cstrnCst = form.watch("demandCst.cstrnCst");
|
||||
|
||||
const calculateConstCost = useCallback(() => {
|
||||
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 { lower: firstLower, upper: firstUpper } = findBounds(
|
||||
constCostRes,
|
||||
firstProc || "",
|
||||
'fctCd',
|
||||
'fctCpc',
|
||||
Number(dmndQtyYear)
|
||||
);
|
||||
const { lower: secondLower, upper: secondUpper } = findBounds(
|
||||
constCostRes,
|
||||
secondProc || "",
|
||||
'fctCd',
|
||||
'fctCpc',
|
||||
Number(dmndQtyYear)
|
||||
);
|
||||
|
||||
const firstConstFee = getInterpolation(
|
||||
firstUpper,
|
||||
firstLower,
|
||||
dmndQtyYear
|
||||
);
|
||||
const secondConstFee = getInterpolation(
|
||||
secondUpper,
|
||||
secondLower,
|
||||
dmndQtyYear
|
||||
);
|
||||
const result = Math.round(firstConstFee + secondConstFee) / 100;
|
||||
|
||||
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);
|
||||
}
|
||||
const resultRate = transformAndInterpolate(groupedBounds, result);
|
||||
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));
|
||||
}
|
||||
}, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]);
|
||||
const onSubmit = (value: DmdCoReqType) => {
|
||||
|
||||
if( !form.getValues('demandCst.prcsFcltCpctCstrnCst') ){
|
||||
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);
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data);
|
||||
} else if (type === "hist") {
|
||||
|
||||
delete value.totalConstCost
|
||||
delete value.ruseUtztnFcltNm
|
||||
|
||||
|
||||
ruseRvwCalUpdate(value);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log(" form ", form.formState.errors);
|
||||
console.log(" form ", form.formState.errors);
|
||||
}, [form.formState]);
|
||||
|
||||
return (
|
||||
@@ -90,12 +160,21 @@ export default function ConCostForm({
|
||||
<div className="flex items-center mx-3 mb-3">
|
||||
<h1 className="">처리시설 표준공사비 산정</h1>
|
||||
|
||||
<Button size={"sm"} onClick={(e) => {}}>
|
||||
<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>
|
||||
@@ -111,7 +190,7 @@ export default function ConCostForm({
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange((e.target.value));
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
/>
|
||||
@@ -194,9 +273,10 @@ export default function ConCostForm({
|
||||
type="number"
|
||||
step="0.001"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
//field.onChange(Number(e.target.value) * 365 );
|
||||
}}
|
||||
value={Number(field.value) * 365 || 0}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -207,14 +287,23 @@ export default function ConCostForm({
|
||||
</div>
|
||||
<div className="col-span-3 mt-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label>처리시설용량에 따른 공사비(백만원)</Label>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={(e) => setIsCmpttnMo({ isModal: true })}
|
||||
className="bg-none"
|
||||
>
|
||||
공사비 산정표 보기
|
||||
</Button>
|
||||
<PopoverUi
|
||||
childrenTriger={
|
||||
<>
|
||||
<Label className="underline">
|
||||
처리시설용량에 따른 공사비(백만원) <i className="diveicon di-search" />
|
||||
</Label>
|
||||
</>
|
||||
}
|
||||
childrenBody={
|
||||
<>
|
||||
<ConstCostFeeTable
|
||||
setReturnData={(e) => {}}
|
||||
></ConstCostFeeTable>
|
||||
</>
|
||||
}
|
||||
bodyClassName={"w-[40vw] h-full"}
|
||||
></PopoverUi>
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -229,6 +318,7 @@ export default function ConCostForm({
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -236,17 +326,27 @@ export default function ConCostForm({
|
||||
</div>
|
||||
<div className="col-span-3 mt-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label>시설부대경비 요율(%)</Label>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={(e) => setIsTrfMo({ isModal: true })}
|
||||
>
|
||||
요율표 보기
|
||||
</Button>
|
||||
<PopoverUi
|
||||
childrenTriger={
|
||||
<>
|
||||
<Label className="underline">
|
||||
시설부대경비 <i className="diveicon di-search" />
|
||||
</Label>
|
||||
</>
|
||||
}
|
||||
childrenBody={
|
||||
<>
|
||||
<RateFeeTableModal
|
||||
setReturnData={(e) => {}}
|
||||
></RateFeeTableModal>
|
||||
</>
|
||||
}
|
||||
bodyClassName={"w-[22vw]"}
|
||||
></PopoverUi>
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="demandCst.fcltSbsdEpsTrf"
|
||||
name="demandCst.fcltSbsdCstrnCst"
|
||||
render={({ field }) => (
|
||||
<FormUi label="">
|
||||
<Input
|
||||
@@ -257,6 +357,7 @@ export default function ConCostForm({
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -286,16 +387,22 @@ export default function ConCostForm({
|
||||
}
|
||||
bodyClassName={"w-[22vw]"}
|
||||
></PopoverUi>
|
||||
<Input
|
||||
placeholder=""
|
||||
className="mt-2"
|
||||
type="number"
|
||||
step="0.01"
|
||||
onChange={(e) => {}}
|
||||
value={
|
||||
form.getValues("demandCst.prcsFcltCpctCstrnCst") +
|
||||
form.getValues("demandCst.fcltSbsdEpsTrf") || 0
|
||||
}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="totalConstCost"
|
||||
render={({ field }) => (
|
||||
<FormUi label="">
|
||||
<Input
|
||||
placeholder=""
|
||||
className="mt-2"
|
||||
type="number"
|
||||
step="0.01"
|
||||
onChange={(e) => {}}
|
||||
value={field.value ?? 0}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-3 mt-4">
|
||||
@@ -323,75 +430,37 @@ export default function ConCostForm({
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="demandCst.cstrnCst"
|
||||
render={({ field }) => (
|
||||
<FormUi label="공급관로 표준공사비(백만원)">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
step="0.001"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4 mb-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name=""
|
||||
render={({ field }) => (
|
||||
<Label className="text-xl">
|
||||
처리시설 + 공급관로 총사업비(백만원)
|
||||
<FormUi label="">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="number"
|
||||
step="0.001"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
readOnly={true}
|
||||
value={field.value ?? 0}
|
||||
/>
|
||||
</FormUi>
|
||||
</Label>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className=" col-span-4 mt-4 ">
|
||||
<Label>관로 표준공사비 산정 프로그램</Label>
|
||||
<Button
|
||||
color="green"
|
||||
size={"sm"}
|
||||
onClick={zipDowonLoad}
|
||||
className="bg-none ml-6"
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="demandCst.cstrnCst"
|
||||
render={({ field }) => (
|
||||
<FormUi label="공급관로 표준공사비(백만원)">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="number"
|
||||
step="0.01"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4 mb-3">
|
||||
<Label className="text-xl">
|
||||
처리시설 + 공급관로 총사업비(백만원)
|
||||
</Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
type="number"
|
||||
step="0.001"
|
||||
readOnly={true}
|
||||
value={(totalConstCost ?? 0) + (cstrnCst ?? 0)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
body={<RateFeeTableModal setReturnData={(e) =>{}}></RateFeeTableModal>}
|
||||
bodyClass="w-[40vw] h-[40vh] "
|
||||
open={isTrfMo.isModal}
|
||||
onOpenChange={(open) => {
|
||||
setIsTrfMo({ isModal: open });
|
||||
}}
|
||||
/>
|
||||
<UiModal
|
||||
body={<ConstCostFeeTable setReturnData={(e) =>{}}></ConstCostFeeTable>}
|
||||
bodyClass="w-[40vw] max-w-none h-[40vh]"
|
||||
open={isCmpttnMo.isModal}
|
||||
onOpenChange={(open) => {
|
||||
setIsCmpttnMo({ isModal: open });
|
||||
}}
|
||||
/>
|
||||
</Form>
|
||||
</>
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,8 @@ import {
|
||||
} from "@common/business_components/ui";
|
||||
import { Form, FormField } from "@common/business_components/ui/form";
|
||||
import { Button, Input } from "@common/components";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useFieldArray, useForm, type UseFormReturn } from "react-hook-form";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useFieldArray, useWatch, type UseFormReturn } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
commonButonSize,
|
||||
@@ -37,11 +37,10 @@ export type FilesType = {
|
||||
export function PbnstMngForm({
|
||||
form,
|
||||
formType,
|
||||
firstFcltData,
|
||||
indexMng ,
|
||||
indexMng,
|
||||
setIndexMng,
|
||||
}: {
|
||||
form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
|
||||
formType: string;
|
||||
firstFcltData?: customPbnst;
|
||||
indexMng: number;
|
||||
@@ -51,12 +50,8 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
code,
|
||||
pbnst,
|
||||
pbnstInsert,
|
||||
pbnstMngData,
|
||||
fileDelete,
|
||||
fileDownLoad,
|
||||
getBizCycle,
|
||||
getpbnstInsertIndex,
|
||||
appendRuseFclt,
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const { pbnstRes } = pbnst;
|
||||
@@ -64,37 +59,9 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
const [planFiles, setPlanFiles] = useState<FilesType[] | null>(null);
|
||||
const [relationfiles, setRelationFiles] = useState<FilesType[] | null>(null);
|
||||
const [fcltNm, setFcltNm] = useState<selectLabel[] | null>(null);
|
||||
//const [fcOpresData, setFcOpresData] = useState<operType[] | null>(null);
|
||||
const [mngMtdCode, setMngMtdCode] =
|
||||
useState<{ name: string; val: SelectDataType[] }[]>();
|
||||
|
||||
const [progress, setProgress] = useState(0);
|
||||
//const new File([] as BlobPart[], "") 파일 다운로드 활용
|
||||
//const ref = useRef<operType[] | null>(null);
|
||||
|
||||
|
||||
// const form = useForm<z.infer<typeof pbnstRegZod>>({
|
||||
// resolver: zodResolver(pbnstRegZod),
|
||||
// defaultValues:
|
||||
// formType === "reg" && pbnst.pbnstMngRegData
|
||||
// ? pbnst.pbnstMngRegData[0]
|
||||
// : formType === "update" &&
|
||||
// typeof pbnst.pbnsUpdateIndex.mng === "number" &&
|
||||
// pbnst.pbnsUpdateIndex.mng >= 0 &&
|
||||
// pbnst.pbnstRes
|
||||
// ? pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]
|
||||
// : formType === "sttn" && firstFcltData
|
||||
// ? {
|
||||
// ruseUtztnFcltNm: firstFcltData?.ruseUtztnFcltNm,
|
||||
// fcltCpct: firstFcltData?.fcltCpct,
|
||||
// ruseCpct: firstFcltData?.ruseCpct,
|
||||
// splyExtraCpct: firstFcltData?.splyExtraCpct,
|
||||
// fcOpers: firstFcltData?.fcOpers,
|
||||
// fcFiles: firstFcltData?.fcFiles,
|
||||
// }
|
||||
// : pbnstRegZod.parse({}),
|
||||
// mode: "onChange",
|
||||
// });
|
||||
const {
|
||||
fields: fcOpersField,
|
||||
append,
|
||||
@@ -104,39 +71,33 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
name: `items.${indexMng}.fcOpers`,
|
||||
});
|
||||
|
||||
|
||||
|
||||
const selectFclt = (val: number) => {
|
||||
// if (pbnst.pbnstRes && pbnst.pbnstRes[val]) {
|
||||
// getBizCycle(pbnst.pbnstRes[val]);
|
||||
// // form.reset(pbnst.pbnstRes[val]);
|
||||
|
||||
// getpbnstInsertIndex({ ...pbnst.pbnsUpdateIndex, mng: val });
|
||||
// }
|
||||
};
|
||||
const watchedItem = useWatch({
|
||||
control: form.control,
|
||||
name: `items.${indexMng}`,
|
||||
});
|
||||
|
||||
const plusHist = () => {
|
||||
append( {
|
||||
append({
|
||||
choose: false,
|
||||
pbnstRuseFcltFk: form.getValues(`items.${indexMng}.pbnstRuseFcltPk`) ?? "",
|
||||
pbnstRuseFcltFk:
|
||||
form.getValues(`items.${indexMng}.pbnstRuseFcltPk`) ?? "",
|
||||
rgtr: "",
|
||||
mdfr: "",
|
||||
operMthd: "",
|
||||
rprtvBzenty: "",
|
||||
bgngDt: new Date(),
|
||||
endDt: new Date(),
|
||||
})
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
const removeSelected = () => {
|
||||
const nowOpers = form.getValues(`items.${indexMng}.fcOpers`);
|
||||
if (!nowOpers) return;
|
||||
|
||||
const nowOpers = form.getValues(`items.${indexMng}.fcOpers`);
|
||||
if(!nowOpers) return;
|
||||
|
||||
const selectedIdxs = nowOpers.map((item, idx) => (item.choose ? idx : -1))
|
||||
.filter((idx) => idx !== -1);
|
||||
selectedIdxs.reverse().forEach((idx) => remove(idx));
|
||||
const selectedIdxs = nowOpers
|
||||
.map((item, idx) => (item.choose ? idx : -1))
|
||||
.filter((idx) => idx !== -1);
|
||||
selectedIdxs.reverse().forEach((idx) => remove(idx));
|
||||
};
|
||||
|
||||
const fileHandler = (files: File[], type: string) => {
|
||||
@@ -209,32 +170,14 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
return [...exFileDatas, ...currentdata];
|
||||
};
|
||||
|
||||
// 등록할때 신규 값을 계속 가지고 있으려고
|
||||
useEffect(() => {
|
||||
// if (
|
||||
// formType === "reg" &&
|
||||
// firstFcltData &&
|
||||
// (form.getValues(`items.${indexMng}.swtrmtFcltFk`) === "" ||
|
||||
// form.getValues(`items.${indexMng}.swtrmtFcltFk`) === undefined)
|
||||
// ) {
|
||||
// form.setValue(`items.${indexMng}.swtrmtFcltFk`, firstFcltData.swtrmtFcltFk);
|
||||
// form.setValue(
|
||||
// `items.${indexMng}.pbnstRuseFcltPk`,
|
||||
// String(firstFcltData.pbnstRuseFcltPk)
|
||||
// );
|
||||
// form.setValue(`items.${indexMng}.fcBizs`, firstFcltData.fcBizs);
|
||||
// }
|
||||
console.log('indexMng ', indexMng)
|
||||
}, [indexMng]);
|
||||
|
||||
useEffect(() => {
|
||||
if(indexMng>=0){
|
||||
const defaultFiles = form.getValues(`items.${indexMng}.fcFiles`);
|
||||
if (indexMng >= 0) {
|
||||
const defaultFiles = watchedItem?.fcFiles;
|
||||
if (defaultFiles && defaultFiles.length > 0) {
|
||||
const relationFileList = defaultFiles.filter(
|
||||
(item) => item.fileKnd === "계통도"
|
||||
);
|
||||
|
||||
|
||||
const planFileList = defaultFiles.filter(
|
||||
(item) => item.fileKnd === "평면도"
|
||||
);
|
||||
@@ -244,8 +187,11 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
atflCd: item.fileTkn,
|
||||
file: new File([] as BlobPart[], item.filePath),
|
||||
}))
|
||||
); // 또는 파일 형식 변환 로직이 있다면 여기에 추가
|
||||
|
||||
);
|
||||
else {
|
||||
setRelationFiles(null);
|
||||
}
|
||||
|
||||
if (planFileList.length > 0)
|
||||
setPlanFiles(
|
||||
planFileList.map((item) => ({
|
||||
@@ -253,63 +199,39 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
file: new File([] as BlobPart[], item.filePath),
|
||||
}))
|
||||
);
|
||||
}else{
|
||||
else {
|
||||
setPlanFiles(null);
|
||||
}
|
||||
} else {
|
||||
setRelationFiles(null);
|
||||
setPlanFiles(null);
|
||||
}
|
||||
}
|
||||
}, [form.watch(`items.${indexMng}`),indexMng]); // 초기화 이후 1회 실행
|
||||
|
||||
// 등록할때 신규 값을 계속 가지고 있으려고
|
||||
useEffect(() => {
|
||||
// if (
|
||||
// formType === "update" &&
|
||||
// pbnst.pbnsUpdateIndex.biz >= 0 &&
|
||||
// pbnst.pbnstRes
|
||||
// ) {
|
||||
// const bizData = pbnst.pbnstRes[pbnst.pbnsUpdateIndex.biz];
|
||||
|
||||
// if (bizData) {
|
||||
// getBizCycle(bizData);
|
||||
// }
|
||||
// }
|
||||
}, [pbnst.pbnsUpdateIndex, pbnst.pbnstRes, formType, getBizCycle]);
|
||||
|
||||
//신규 등록시 입력할때 데이터 넣기
|
||||
useEffect(() => {
|
||||
// const formData = form.watch();
|
||||
// formData.fcOpers = ref.current ? [...ref.current] : [];
|
||||
// formData.fcFiles = regFileList ? [...regFileList] : [];
|
||||
// if (formType === "reg") {
|
||||
// console.log("formData ", formData);
|
||||
// pbnstMngData([formData] as customPbnst[]);
|
||||
// } else if (formType === "update") {
|
||||
// const updateRes = pbnst.pbnstRes?.map((item) => {
|
||||
// if (item.pbnstRuseFcltPk === item.pbnstRuseFcltPk) {
|
||||
// item = formData as customPbnst;
|
||||
// }
|
||||
// return item;
|
||||
// });
|
||||
// pbnstMngData(updateRes as customPbnst[]);
|
||||
// }
|
||||
}, [form.formState, regFileList, formType, pbnst.pbnstRes]);
|
||||
}, [watchedItem, indexMng]);
|
||||
|
||||
useEffect(() => {
|
||||
// pbnstMngData(pbnst.pbnstMngRegData);
|
||||
}, [pbnst.pbnstMngRegData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnst.pbnstRes && pbnst.pbnstRes?.length <= 0) return;
|
||||
const fcltNmList = pbnst.pbnstRes?.map((item, index) => ({
|
||||
text: item.ruseUtztnFcltNm,
|
||||
val: String(index),
|
||||
}));
|
||||
if (fcltNmList) setFcltNm(fcltNmList);
|
||||
if (pbnst.pbnstRes && pbnst.pbnstRes?.length >= 0) {
|
||||
|
||||
const fcltNmList = pbnst.pbnstRes?.map((item, index) => ({
|
||||
text: item.ruseUtztnFcltNm,
|
||||
val: String(index),
|
||||
}));
|
||||
|
||||
|
||||
console.log(' fcltNmList ', fcltNmList)
|
||||
if (fcltNmList) setFcltNm(fcltNmList);
|
||||
}else{
|
||||
setFcltNm(null);
|
||||
}
|
||||
}, [pbnst.pbnstRes]);
|
||||
|
||||
// 2. Define a submit handler.
|
||||
function onSubmit(values: z.infer<typeof pbnstRegZod>) {
|
||||
values.fcOpers = [];
|
||||
values.fcOpers = [];
|
||||
values.fcFiles = regFileList || [];
|
||||
pbnstInsert(values);
|
||||
}
|
||||
@@ -325,7 +247,6 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
}
|
||||
}, [planFiles]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (code.ruseMngMtd) {
|
||||
setMngMtdCode([{ name: "ruseMngMtd", val: code.ruseMngMtd }]);
|
||||
@@ -333,7 +254,15 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
}, [code]);
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
// console.log(' fcltNm ', watchedItem?.ruseUtztnFcltNm)
|
||||
},[watchedItem])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log(" form indexMng ", indexMng);
|
||||
}, [indexMng]);
|
||||
|
||||
return (
|
||||
<div className=" !mx-[1.6rem] !p-0r">
|
||||
<div>
|
||||
@@ -347,33 +276,29 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
</Label>
|
||||
|
||||
{formType === "update" ? (
|
||||
<FormField
|
||||
key={`items.${indexMng}.ruseUtztnFcltNm-key`}
|
||||
control={form.control}
|
||||
name={`items.${indexMng}.ruseUtztnFcltNm`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="">
|
||||
<SelectBox
|
||||
label=""
|
||||
selectArray={fcltNm ?? []}
|
||||
onSelectValue={(val) => {
|
||||
setIndexMng(Number(val));
|
||||
field.onChange(val);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
className={""}
|
||||
selectClass={undefined}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
<FormUi label="">
|
||||
<SelectBox
|
||||
label=""
|
||||
key={`fclt-selector-${indexMng}`}
|
||||
selectArray={fcltNm ?? []}
|
||||
onSelectValue={(val) => {
|
||||
setIndexMng(Number(val));
|
||||
}}
|
||||
value={String(indexMng)}
|
||||
className={""}
|
||||
selectClass={undefined}
|
||||
/>
|
||||
</FormUi>
|
||||
) : (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`items.${indexMng}.ruseUtztnFcltNm`}
|
||||
key={`items-ruseUtztnFcltNm-${indexMng}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="">
|
||||
<Input
|
||||
|
||||
|
||||
className="!text-2xl"
|
||||
placeholder=""
|
||||
type="text"
|
||||
@@ -381,6 +306,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
field.onChange(String(e.target.value));
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly={formType === "sttn" ? true : false}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -393,28 +319,41 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
<div className="h-[200px] overflow-y-auto">
|
||||
<div className="flex justify-between items-center mx-3 mb-3">
|
||||
<span className={formTableName}>재이용시설 운영정보</span>
|
||||
<div>
|
||||
<Button
|
||||
type="button"
|
||||
size={commonButonSize}
|
||||
className="!text-xl"
|
||||
onClick={plusHist}
|
||||
>
|
||||
추가등록
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
size={commonButonSize}
|
||||
className="!text-xl !bg-red-500 !text-white ml-1"
|
||||
onClick={removeSelected}
|
||||
>
|
||||
삭제
|
||||
</Button>
|
||||
</div>
|
||||
{formType === "sttn" ? (
|
||||
<></>
|
||||
) : (
|
||||
<div>
|
||||
<Button
|
||||
type="button"
|
||||
size={commonButonSize}
|
||||
className="!text-xl"
|
||||
onClick={plusHist}
|
||||
>
|
||||
추가등록
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
size={commonButonSize}
|
||||
className="!text-xl !bg-red-500 !text-white ml-1"
|
||||
onClick={removeSelected}
|
||||
>
|
||||
삭제
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<RuseMngTableForm
|
||||
tableData={form.getValues(`items.${indexMng}.fcOpers`)||[]}
|
||||
headList={pbnst.pbnstMngUpHeadList}
|
||||
tableData={form.getValues(`items.${indexMng}.fcOpers`) || []}
|
||||
headList={
|
||||
formType === "sttn"
|
||||
? pbnst.pbnstMngUpHeadList.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
readonly: true,
|
||||
};
|
||||
})
|
||||
: pbnst.pbnstMngUpHeadList
|
||||
}
|
||||
upHeadList={pbnst.pbnstMngNm}
|
||||
code={mngMtdCode || []}
|
||||
onTableSet={(val) => {
|
||||
@@ -423,7 +362,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
indexMng={indexMng}
|
||||
form={form}
|
||||
formNm={"fcOpers"}
|
||||
// ref={ref}
|
||||
// ref={ref}
|
||||
></RuseMngTableForm>
|
||||
</div>
|
||||
</div>
|
||||
@@ -445,6 +384,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
readOnly={formType === "sttn" ? true : false}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -453,19 +393,20 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
key={`FormField-items.${indexMng}.ruseCpct`}
|
||||
key={`FormField-items.${indexMng}.ruseCpct`}
|
||||
control={form.control}
|
||||
name={`items.${indexMng}.ruseCpct`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="재이용수공급량(m³/일)">
|
||||
<Input
|
||||
key={`items.${indexMng}.ruseCpct`}
|
||||
key={`items.${indexMng}.ruseCpct`}
|
||||
placeholder=""
|
||||
type="number"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
readOnly={formType === "sttn" ? true : false}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -473,19 +414,20 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
key={`FormField-items.${indexMng}.splyExtraCpct`}
|
||||
key={`FormField-items.${indexMng}.splyExtraCpct`}
|
||||
control={form.control}
|
||||
name={`items.${indexMng}.splyExtraCpct`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="공급여유량(m³/일)">
|
||||
<Input
|
||||
key={`items.${indexMng}.splyExtraCpct`}
|
||||
key={`items.${indexMng}.splyExtraCpct`}
|
||||
placeholder=""
|
||||
type="number"
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
readOnly={formType === "sttn" ? true : false}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -497,40 +439,78 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
|
||||
</div>
|
||||
<div className="grid grid-cols-12 gap-4 my-4">
|
||||
<div className="col-span-6">
|
||||
<FormUi label="계통도">
|
||||
<FileUpload
|
||||
files={relationfiles?.map((item) => item.file) || []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files) fileHandler(files, "relation");
|
||||
}}
|
||||
fileTypes="PDF"
|
||||
onFileClick={(index) => {
|
||||
fileDownLoad(
|
||||
relationfiles?.find(
|
||||
(item, fileIndex) => fileIndex === index
|
||||
)?.atflCd as string
|
||||
);
|
||||
}}
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
{formType === "sttn" ? (
|
||||
relationfiles && relationfiles?.length > 0 ? (
|
||||
<>
|
||||
<Label className="text-3xl">계통도</Label>
|
||||
{relationfiles?.map((item, index) => (
|
||||
<span
|
||||
key={index + "plan"}
|
||||
className="text-2xl block cursor-pointer text-blue-600 hover:underline"
|
||||
onClick={() => fileDownLoad(item.atflCd)}
|
||||
>
|
||||
{item.file.name}
|
||||
</span>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)
|
||||
) : (
|
||||
<FormUi label="계통도">
|
||||
<FileUpload
|
||||
files={relationfiles?.map((item) => item.file) || []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files) fileHandler(files, "relation");
|
||||
}}
|
||||
fileTypes="PDF"
|
||||
onFileClick={(index) => {
|
||||
fileDownLoad(
|
||||
relationfiles?.find(
|
||||
(item, fileIndex) => fileIndex === index
|
||||
)?.atflCd as string
|
||||
);
|
||||
}}
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
)}
|
||||
</div>
|
||||
<div className="col-span-6">
|
||||
<FormUi label="평면도">
|
||||
<FileUpload
|
||||
files={planFiles?.map((item) => item.file) || []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files) fileHandler(files, "plan");
|
||||
}}
|
||||
fileTypes="PDF"
|
||||
onFileClick={(index) => {
|
||||
fileDownLoad(
|
||||
planFiles?.find(
|
||||
(item, fileIndex) => fileIndex === index
|
||||
)?.atflCd as string
|
||||
);
|
||||
}}
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
{formType === "sttn" ? (
|
||||
planFiles && planFiles?.length > 0 ? (
|
||||
<>
|
||||
<Label className="text-3xl">평면도</Label>
|
||||
{planFiles?.map((item, index) => (
|
||||
<span
|
||||
key={index + "plan"}
|
||||
className="text-2xl block cursor-pointer text-blue-600 hover:underline"
|
||||
onClick={() => fileDownLoad(item.atflCd)}
|
||||
>
|
||||
{item.file.name}
|
||||
</span>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)
|
||||
) : (
|
||||
<FormUi label="평면도">
|
||||
<FileUpload
|
||||
files={planFiles?.map((item) => item.file) || []}
|
||||
setFiles={(files: File[] | null) => {
|
||||
if (files) fileHandler(files, "plan");
|
||||
}}
|
||||
fileTypes="PDF"
|
||||
onFileClick={(index) => {
|
||||
fileDownLoad(
|
||||
planFiles?.find(
|
||||
(item, fileIndex) => fileIndex === index
|
||||
)?.atflCd as string
|
||||
);
|
||||
}}
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,36 +4,36 @@ import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
rainZod,
|
||||
selectClass,
|
||||
TEST_UUID,
|
||||
type customRainBdst,
|
||||
type customRainBdst
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { DatePicker, FormUi } from "@common/business_components";
|
||||
import { Form, FormField, SelectBox } from "@common/business_components/ui";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm, useWatch, type UseFormReturn } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
import { formH1Class, formH2Class } from "@/components/lib/class/comClass";
|
||||
import {
|
||||
formatCommaNumber,
|
||||
handleCommaNumberChange,
|
||||
} from "@/components/lib/func/commom";
|
||||
import { formH1Class, formH2Class } from "@/components/lib/class/comClass";
|
||||
import { DatePicker, FormUi } from "@common/business_components";
|
||||
import { Form, FormField, SelectBox } from "@common/business_components/ui";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export default function RainRegForm({
|
||||
rainForm,
|
||||
isModal,
|
||||
readonly = false
|
||||
}: {
|
||||
rainForm: customRainBdst;
|
||||
isModal: boolean;
|
||||
readonly?: boolean;
|
||||
}) {
|
||||
const { code, rainBdstReg, rainBdstUpdate, rain } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { rainFcltCd } = code;
|
||||
const defaultValues: z.infer<typeof rainZod> = rainZod.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof rainZod>>({
|
||||
resolver: zodResolver(rainZod),
|
||||
defaultValues: defaultValues,
|
||||
@@ -60,8 +60,8 @@ export default function RainRegForm({
|
||||
typeof item?.grntchBdstCertYr === "string"
|
||||
? item?.grntchBdstCertYr
|
||||
: "", // null → ""
|
||||
rainObj: {
|
||||
...item?.rainObj,
|
||||
rainyObj: {
|
||||
...item?.rainyObj,
|
||||
},
|
||||
})),
|
||||
};
|
||||
@@ -84,8 +84,6 @@ export default function RainRegForm({
|
||||
useEffect(() => {
|
||||
const subscription = form.watch((value) => {
|
||||
});
|
||||
|
||||
|
||||
return () => subscription.unsubscribe();
|
||||
}, [form]);
|
||||
|
||||
@@ -105,7 +103,6 @@ export default function RainRegForm({
|
||||
if (rainZod) form.reset(cleanRainData(rainForm));
|
||||
}, [rainForm]);
|
||||
|
||||
|
||||
return (
|
||||
<div className="!mx-[1.6rem] !p-0r">
|
||||
<Form {...form}>
|
||||
@@ -115,9 +112,11 @@ export default function RainRegForm({
|
||||
<h1 className="text-2xl font-medium text-label col-span-10">
|
||||
{isModal ? "건축물 운영정보" : "빗물이용시설 정보"}
|
||||
</h1>
|
||||
<Button type="submit" className="col-start-12 col-span-1" size={"sm"}>
|
||||
저장
|
||||
</Button>
|
||||
{!readonly && (
|
||||
<Button type="submit" className="col-start-12 col-span-1" size={"sm"}>
|
||||
저장
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>}
|
||||
@@ -147,8 +146,10 @@ export default function RainRegForm({
|
||||
? new Date(field.value)
|
||||
: new Date(), // Provide a default Date value
|
||||
onChange: (date) => field.onChange(date),
|
||||
|
||||
}}
|
||||
selectClass={"w-full"}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -166,9 +167,10 @@ export default function RainRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -195,8 +197,9 @@ export default function RainRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={rainFcltCd}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? rainFcltCd[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -213,9 +216,10 @@ export default function RainRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -238,8 +242,9 @@ export default function RainRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -256,7 +261,7 @@ export default function RainRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={filtrTrtmfctYn !== "Y"}
|
||||
@@ -276,7 +281,9 @@ export default function RainRegForm({
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
readOnly={filtrTrtmfctYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -304,8 +311,9 @@ export default function RainRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -322,7 +330,7 @@ export default function RainRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={instlCstSprtYn !== "Y"}
|
||||
@@ -348,7 +356,7 @@ export default function RainRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -366,7 +374,9 @@ export default function RainRegForm({
|
||||
placeholder="2024"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange(e);
|
||||
}}
|
||||
readOnly={grntchBdstCertYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -384,7 +394,9 @@ export default function RainRegForm({
|
||||
placeholder="ab1234678"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange(e);
|
||||
}}
|
||||
readOnly={grntchBdstCertYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -402,7 +414,9 @@ export default function RainRegForm({
|
||||
placeholder="A"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange(e);
|
||||
}}
|
||||
readOnly={grntchBdstCertYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
|
||||
@@ -28,9 +28,11 @@ import BdstReg from "../bdstReg/bdstReg";
|
||||
export default function RswtrRegForm({
|
||||
rswtForm,
|
||||
isModal,
|
||||
readonly = false
|
||||
}: {
|
||||
rswtForm: customRswtBdst;
|
||||
isModal: boolean;
|
||||
readonly?: boolean;
|
||||
}) {
|
||||
const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore(
|
||||
(state) => state
|
||||
@@ -78,6 +80,10 @@ export default function RswtrRegForm({
|
||||
};
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
console.log("rswtForm:", rswtForm)
|
||||
}, [rswtForm])
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
@@ -105,13 +111,11 @@ export default function RswtrRegForm({
|
||||
<h1 className="text-2xl font-medium text-label col-span-10">
|
||||
건축물 운영정보
|
||||
</h1>
|
||||
<Button
|
||||
size={"sm"}
|
||||
type="submit"
|
||||
className="col-start-12 col-span-1"
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
{!readonly && (
|
||||
<Button type="submit" className="col-start-12 col-span-1" size={"sm"}>
|
||||
저장
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -141,6 +145,7 @@ export default function RswtrRegForm({
|
||||
onChange: (date) => field.onChange(date),
|
||||
}}
|
||||
selectClass={"w-full"}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -158,9 +163,10 @@ export default function RswtrRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -179,9 +185,10 @@ export default function RswtrRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -199,9 +206,10 @@ export default function RswtrRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -225,8 +233,9 @@ export default function RswtrRegForm({
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
if (!readonly) field.onChange(Number(e.target.value));
|
||||
}}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -243,8 +252,9 @@ export default function RswtrRegForm({
|
||||
label={""}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.orgwtKndCd}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.orgwtKndCd[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -261,7 +271,10 @@ export default function RswtrRegForm({
|
||||
placeholder=""
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange
|
||||
}}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -287,8 +300,9 @@ export default function RswtrRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -305,7 +319,7 @@ export default function RswtrRegForm({
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
handleCommaNumberChange(e, field.onChange);
|
||||
if (!readonly) handleCommaNumberChange(e, field.onChange);
|
||||
}}
|
||||
value={formatCommaNumber(field.value)}
|
||||
readOnly={instlCstSprtYn !== "Y"}
|
||||
@@ -331,8 +345,9 @@ export default function RswtrRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -350,7 +365,9 @@ export default function RswtrRegForm({
|
||||
type="text"
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange(e)
|
||||
}}
|
||||
readOnly={grntchBdstCertYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -368,7 +385,9 @@ export default function RswtrRegForm({
|
||||
placeholder="ab1234678"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange(e)
|
||||
}}
|
||||
readOnly={grntchBdstCertYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -386,7 +405,9 @@ export default function RswtrRegForm({
|
||||
placeholder="A"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
onChange={(e) => {
|
||||
if (!readonly) field.onChange(e)
|
||||
}}
|
||||
readOnly={grntchBdstCertYn !== "Y"}
|
||||
/>
|
||||
</FormUi>
|
||||
|
||||
@@ -99,7 +99,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
|
||||
selectClass={""}
|
||||
label=""
|
||||
selectArray={yearOptions}
|
||||
value={field.value}
|
||||
value={field.value||new Date().getFullYear()}
|
||||
onSelectValue={(val) => field.onChange(val)}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -113,7 +113,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
|
||||
<FormUi label="시설명">
|
||||
<Input
|
||||
className="w-1/4 text-3xl"
|
||||
value={field.value}
|
||||
value={field.value||''}
|
||||
onChange={field.onChange}
|
||||
readOnly
|
||||
/>
|
||||
@@ -127,7 +127,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
|
||||
<FormUi label="재이용시설명">
|
||||
<Input
|
||||
className="w-1/4 text-3xl"
|
||||
value={field.value}
|
||||
value={field.value||''}
|
||||
onChange={field.onChange}
|
||||
readOnly
|
||||
/>
|
||||
@@ -146,6 +146,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
|
||||
if (files) setFiles(files);
|
||||
}}
|
||||
fileTypes="xlsx"
|
||||
maxFiles={1}
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
)}
|
||||
|
||||
@@ -23,12 +23,12 @@ export function ConstCostFeeTable({
|
||||
const [constCostData, setConstCostData] = useState<ContCostMap[]>([]);
|
||||
|
||||
|
||||
function getFctDescription(fctCd: string) {
|
||||
const getFctDescription = (fctCd: string) => {
|
||||
const fctMap: { [key: string]: string } = {
|
||||
"001": "총인",
|
||||
"002": "염소.소독",
|
||||
"003": "uv소독",
|
||||
"004": "생물학적탈질",
|
||||
"001": "총인처리시설",
|
||||
"002": "염소소독",
|
||||
"003": "UV소독",
|
||||
"004": "전처리시설",
|
||||
"005": "RO",
|
||||
};
|
||||
|
||||
@@ -61,7 +61,6 @@ export function ConstCostFeeTable({
|
||||
},
|
||||
[]
|
||||
);
|
||||
console.log("tableData", tableData);
|
||||
const formattedTableData = tableData?.map((item: ContCostMap) => {
|
||||
return {
|
||||
...item,
|
||||
@@ -73,7 +72,7 @@ export function ConstCostFeeTable({
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!w-full ">
|
||||
<ListDiv className="h-[calc(100vh-60vh)] overflow-auto">
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
공사비 산정표 보기
|
||||
</h3>
|
||||
@@ -89,7 +88,6 @@ export function ConstCostFeeTable({
|
||||
onSelectValue={(val: string | number) => setYear(String(val))}
|
||||
/>
|
||||
</div>
|
||||
<ScrollArea className="h-[calc(100vh-300px)] w-full">
|
||||
<UiTable
|
||||
headName={""}
|
||||
tableData={constCostData || []}
|
||||
@@ -99,7 +97,6 @@ export function ConstCostFeeTable({
|
||||
cellClick={() => {}}
|
||||
onPageChange={() => {}}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ 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 { Input, Label, ScrollArea } from "@common/components/ui";
|
||||
import { Scroll } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
@@ -14,7 +14,7 @@ export function RateFeeTableModal({
|
||||
}: {
|
||||
setReturnData: (data: any) => void;
|
||||
}) {
|
||||
const { code, coRvw,rateFeeRes } = useWrStore((state) => state);
|
||||
const { code, coRvw, rateFeeRes } = useWrStore((state) => state);
|
||||
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
|
||||
const [reateFeeTable, setRateFeeTable] = useState<rateFeeType[]>([]);
|
||||
|
||||
@@ -31,26 +31,24 @@ export function RateFeeTableModal({
|
||||
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 data = await rateFeeRes?.filter((item: rateFeeType) => {
|
||||
return item.incExpCd !== "SS";
|
||||
})
|
||||
.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,
|
||||
};
|
||||
@@ -60,18 +58,18 @@ export function RateFeeTableModal({
|
||||
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);
|
||||
@@ -81,28 +79,26 @@ export function RateFeeTableModal({
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv className="!h-[calc(100vh-100px)] w-[90vw] max-w-[1200px] min-w-[600px] overflow-hidden">
|
||||
<ListDiv className="min-w-[600px] h-[calc(100vh-60vh)] overflow-auto">
|
||||
<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 className="col-span-5 flex items-center">
|
||||
<Label className=" text-xl text-gray-600">기준년도</Label>
|
||||
<Input
|
||||
className="col-span-1 text-2xl text-right ml-2 w-32"
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {}}
|
||||
value={new Date().getFullYear() || ""}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-6">
|
||||
<ScrollArea className="h-[60vh] overflow-auto">
|
||||
<div className="col-span-6 pr-6">
|
||||
<UiTable
|
||||
className="min-w-full"
|
||||
className="min-w-full pr-12"
|
||||
key={"rateTable" + reateFeeTable?.length}
|
||||
headName={""}
|
||||
tableData={reateFeeTable || []}
|
||||
@@ -112,7 +108,6 @@ export function RateFeeTableModal({
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</div>
|
||||
</ListDiv>
|
||||
|
||||
@@ -26,7 +26,7 @@ export function PbnstRegModal({
|
||||
data: pubHasuType;
|
||||
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
|
||||
}) {
|
||||
const { pbnst, pbnstInsert, pbnstMngData } = useWrStore((state) => {
|
||||
const { pbnst, pbnstInsert } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
const [pbnstBdstForm, setPbnstBdstForm] = useState<customPbnst>(
|
||||
@@ -57,48 +57,18 @@ export function PbnstRegModal({
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
|
||||
const firstForm = form.getValues("items");
|
||||
|
||||
console.log('mngIndex ', firstForm.length)
|
||||
setIndexMng(firstForm.length - 1)
|
||||
// console.log(' firstForm ', firstForm)
|
||||
// let regData;
|
||||
// if (pbnstRes && pbnstRes?.length > 0) {
|
||||
// regData = {
|
||||
// swtrmtFcltFk: String(data.bscFctCd),
|
||||
// pbnstRuseFcltPk: String(data.bscFctCd) + String(pbnstRes.length + 1),
|
||||
// fcBizs: [
|
||||
// {
|
||||
// pbnstRuseFcltFk:
|
||||
// String(data.bscFctCd) + String(pbnstRes.length + 1),
|
||||
// cycl: 1,
|
||||
// } as unknown as fcBizType,
|
||||
// ],
|
||||
// };
|
||||
// //regData= pbnstRegZod.parse(regData)
|
||||
// //setPbnstBdstForm(regData as unknown as customPbnst);
|
||||
// // pbnstMngData([regData] as unknown as customPbnst[])
|
||||
// } else {
|
||||
// regData = {
|
||||
// swtrmtFcltFk: String(data.bscFctCd),
|
||||
// pbnstRuseFcltPk: String(data.bscFctCd + "1"),
|
||||
// fcBizs: [
|
||||
// {
|
||||
// pbnstRuseFcltFk: String(data.bscFctCd + "1"),
|
||||
// cycl: 1,
|
||||
// } as unknown as fcBizType,
|
||||
// ],
|
||||
// };
|
||||
// //regData= pbnstRegZod.parse(regData)
|
||||
// // setPbnstBdstForm(regData as unknown as customPbnst);
|
||||
|
||||
// // pbnstMngData([regData] as unknown as customPbnst[])
|
||||
// }
|
||||
// regData = pbnstRegZod.parse(regData);
|
||||
// setPbnstBdstForm(regData as unknown as customPbnst);
|
||||
}
|
||||
setIndexMng(firstForm.length - 1) }
|
||||
}, [data, form]);
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log(' form.getValues() ' ,form.getValues())
|
||||
|
||||
}, [form.getValues()]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1 className="text-2xl font-medium text-label pl-8">
|
||||
|
||||
@@ -53,6 +53,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
|
||||
const { monthHeadList } = prfmnc;
|
||||
useEffect(() => {
|
||||
let tableData;
|
||||
@@ -77,6 +78,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
majorPrcsMsrcCd: item.majorPrcsMsrcCd ?? "-",
|
||||
inoutYn: item.inoutYn ?? "-",
|
||||
addr: item.addr ?? "-",
|
||||
mainSplyPumpCpct: item.mainSplyPumpCpct ?? "-",
|
||||
};
|
||||
});
|
||||
} else if (fcltTab === "sply") {
|
||||
@@ -113,6 +115,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
smll: item.smll,
|
||||
crmty: item.crmty,
|
||||
tph: item.tph,
|
||||
|
||||
tn: item.tn,
|
||||
ph: item.ph,
|
||||
cdtnv: item.cdtnv,
|
||||
@@ -121,7 +124,6 @@ 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 + "차",
|
||||
@@ -163,10 +165,10 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
]);
|
||||
|
||||
const getTablePrfData = (prfList: PrfType[]) => {
|
||||
const inUsageData = [...initValInUsage];
|
||||
const outUsageData = [...initValOutUsage];
|
||||
const inSubtotal = subTotalObj;
|
||||
const outSubtotal = subTotalObj;
|
||||
const inUsageData = structuredClone(initValInUsage);
|
||||
const outUsageData = structuredClone(initValOutUsage);
|
||||
const inSubtotal = structuredClone(subTotalObj);
|
||||
const outSubtotal = structuredClone(subTotalObj);
|
||||
|
||||
if (prfList) {
|
||||
prfList?.forEach((prfItem) => {
|
||||
@@ -203,7 +205,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
});
|
||||
inUsageData.push(inSubtotal);
|
||||
outUsageData.push(outSubtotal);
|
||||
const usageTotalObj: { [key: string]: any } = totalObj;
|
||||
const usageTotalObj: { [key: string]: any } = structuredClone(totalObj);
|
||||
for (const key in usageTotalObj) {
|
||||
if (["usage", "gubun", "edit"].includes(key)) continue;
|
||||
const val =
|
||||
@@ -227,14 +229,13 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
(item) => item.pbnstRuseFcltPk === data.pbnstRuseFcltPk
|
||||
)?.prfList;
|
||||
|
||||
if (prfList) {
|
||||
if (prfList) {console.log("prfList", prfList);
|
||||
|
||||
getTablePrfData(prfList);
|
||||
}
|
||||
}
|
||||
}, [pbnstSttn.pbnstSttnRes, data]);
|
||||
|
||||
useEffect(() => {}, [ruseBizData?.head]);
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
@@ -243,6 +244,11 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
}
|
||||
|
||||
},[data, form])
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
console.log("prfData", prfData);
|
||||
},[prfData])
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
@@ -254,7 +260,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
indexMng={indexMng}
|
||||
setIndexMng={setIndexMng}
|
||||
/>
|
||||
<Tabs defaultValue="mng" onValueChange={setFcltTab}>
|
||||
<Tabs defaultValue="fclt" onValueChange={setFcltTab}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="fclt">
|
||||
하수처리수 재이용시설 현황
|
||||
@@ -292,7 +298,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) {
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
<Tabs defaultValue="mng" onValueChange={setRuseTab}>
|
||||
<Tabs onValueChange={setRuseTab}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="totalPrf">
|
||||
장내외합계
|
||||
|
||||
@@ -90,10 +90,10 @@ export default function SttnDetailModal({
|
||||
: "온배수시설 상세정보"}></Title>
|
||||
<ScrollArea className={detailData.data.length>0?"h-[80vh]":"h-[70vh]"} >
|
||||
{type === "RNB" ? (
|
||||
<RainRegForm rainForm={formObj as customRainBdst} isModal={false} />
|
||||
<RainRegForm rainForm={formObj as customRainBdst} isModal={false} readonly={true}/>
|
||||
) : type === "RST" ? (
|
||||
<RswtrRegForm rswtForm={formObj as customRswtBdst} isModal={false} />
|
||||
) : (<HtdflRegForm htdflForm={formObj as customHtdflBdst} isModal={false} />)}
|
||||
<RswtrRegForm rswtForm={formObj as customRswtBdst} isModal={false} readonly={true}/>
|
||||
) : (<HtdflRegForm htdflForm={formObj as customHtdflBdst} isModal={false} readonly={true}/>)}
|
||||
|
||||
{detailData.data.length>0?
|
||||
<UiTable
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components/ui";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
|
||||
type RuseMngTableProps = {
|
||||
tableData: any[];
|
||||
@@ -37,22 +37,7 @@ type RuseMngTableProps = {
|
||||
|
||||
const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
|
||||
({ tableData, headList, upHeadList, code, onTableSet, indexMng, form,formNm,indexBiz }, ref) => {
|
||||
// const [tableState, setTableState] = useState([...tableData]);
|
||||
|
||||
// // useEffect(() => {
|
||||
|
||||
// // if (ref && typeof ref === "object" && "current" in ref) {
|
||||
// // ref.current = tableState;
|
||||
// // }
|
||||
// // if (onTableSet) onTableSet(tableState);
|
||||
// // }, [tableState, onTableSet]);
|
||||
|
||||
// useEffect(() => {
|
||||
|
||||
// if (tableData)
|
||||
// setTableState(tableData);
|
||||
// }, [tableData]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Table key={`table-${indexMng}-${indexBiz}`} variant="secondary">
|
||||
@@ -107,6 +92,7 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
|
||||
? (Number(field.value) ?? 0)
|
||||
: field.value || ""
|
||||
}
|
||||
readOnly ={head.readonly ? true : false}
|
||||
/>
|
||||
) : head.type === "select" ? (
|
||||
<SelectBox
|
||||
@@ -122,18 +108,30 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
onSelectValue={(val) => {
|
||||
field.onChange(val);
|
||||
|
||||
if(head.readonly === true){
|
||||
return
|
||||
}else{
|
||||
|
||||
field.onChange(val);
|
||||
}
|
||||
}}
|
||||
readOnly ={head.readonly ? true : false}
|
||||
// Disabled prop removed as SelectBox does not support it
|
||||
></SelectBox>
|
||||
) : head.type === "date" ? (
|
||||
<DatePicker
|
||||
mode="single"
|
||||
field={{
|
||||
value: field.value || new Date(),
|
||||
onChange: (date: Date | undefined) =>
|
||||
field.onChange(date),
|
||||
value:typeof field.value === "string" ? new Date(field.value) : field.value,
|
||||
onChange: (date: Date | undefined) => {
|
||||
|
||||
console.log("date", date);
|
||||
field.onChange(date); // readonly 상태가 아닐 때만 값 변경
|
||||
},
|
||||
}}
|
||||
selectClass={"w-full"}
|
||||
readOnly ={head.readonly ? true : false}
|
||||
/>
|
||||
) : head.type === "checkbox" ? (
|
||||
<Checkbox
|
||||
@@ -141,7 +139,6 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
|
||||
checked={ field.value || false}
|
||||
onCheckedChange={(checked) => {
|
||||
field.onChange(checked);
|
||||
|
||||
}}
|
||||
></Checkbox>
|
||||
) : (
|
||||
|
||||
Binary file not shown.
@@ -12,37 +12,39 @@ import { FormControl } from "../form";
|
||||
import { ko } from "date-fns/locale";
|
||||
import { useState } from "react";
|
||||
|
||||
type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void } ,selectClass:string|undefined };
|
||||
|
||||
|
||||
export function DatePicker({ field, selectClass }: DatePickerProps) {
|
||||
type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void }, selectClass: string | undefined, readOnly?: boolean };
|
||||
|
||||
|
||||
export function DatePicker({ field, selectClass, readOnly = false, ...props }: DatePickerProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const handleSelect = (date: Date | undefined) => {
|
||||
field.onChange(date); // React Hook Form 업데이트
|
||||
setOpen(false);
|
||||
};
|
||||
if (!readOnly) { // readOnly가 아닐 때만 변경 허용
|
||||
field.onChange(date); // React Hook Form 업데이트
|
||||
setOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<Popover open={open && !readOnly} onOpenChange={readOnly ? undefined : setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl>
|
||||
<Button
|
||||
color="white"
|
||||
variant={"outline"}
|
||||
className={!selectClass? cn(
|
||||
disabled={readOnly} // readOnly일 때 버튼 비활성화
|
||||
className={!selectClass ? cn(
|
||||
"w-[240px] pl-3 text-left font-normal",
|
||||
!field?.value && "text-muted-foreground",
|
||||
|
||||
):selectClass}
|
||||
readOnly && "opacity-60 cursor-not-allowed" // readOnly 스타일 추가
|
||||
) : cn(selectClass, readOnly && "opacity-60 cursor-not-allowed")}
|
||||
>
|
||||
{field?.value ? (
|
||||
format(
|
||||
field.value instanceof Date && !isNaN(field.value.getTime())
|
||||
? field.value
|
||||
: new Date()
|
||||
|
||||
? field.value
|
||||
: new Date()
|
||||
|
||||
, "PPP", { locale: ko })
|
||||
) : (
|
||||
<span>Pick a date</span>
|
||||
|
||||
@@ -16,14 +16,15 @@ const SelectBox = React.forwardRef<
|
||||
className:string,
|
||||
selectArray:SelectBox1[],
|
||||
onSelectValue:(val:string|number)=>void,
|
||||
value?: string|number
|
||||
value?: string|number,
|
||||
readOnly?: boolean // readOnly 속성 추가
|
||||
}
|
||||
>(({ label, className, selectClass, selectArray, onSelectValue, value }, ref)=>{
|
||||
>(({ label, className, selectClass, selectArray, onSelectValue, value, readOnly = false }, ref)=>{
|
||||
const placeHolder = selectArray?.[0]?.text ?? "";
|
||||
|
||||
return (
|
||||
<div className={className+" flex items-center"} ref={ref}>
|
||||
{label && <Label className="w-20 text-xl text-gray-600">{label}</Label>}
|
||||
{label && <Label className="whitespace-nowrap w-20 text-xl text-gray-600">{label}</Label>}
|
||||
<Select onValueChange={onSelectValue} value={value !== undefined ? String(value) : undefined}>
|
||||
<SelectTrigger className={selectClass?selectClass:"flex-1 p-2 border rounded"}>
|
||||
<SelectValue placeholder={placeHolder} />
|
||||
|
||||
Reference in New Issue
Block a user