Merge remote-tracking branch 'origin/iipbs/wr/dev' into iipbs/wr/gis
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 ??"");
|
||||
|
||||
@@ -105,7 +105,7 @@ export default function RuseCaseMng() {
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-6">
|
||||
<ListDiv>
|
||||
<ListDiv className="overflow-x-auto">
|
||||
<UiTable
|
||||
headName={"물재이용사례 현황"}
|
||||
tableData={[]}
|
||||
|
||||
@@ -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;
|
||||
@@ -60,19 +58,15 @@ export default function PublicReuseFaciltyInsert() {
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [bdstTable, setbdstTable] = useState<pubHasuType[]>();
|
||||
const [selectRow, setSelectRow] = useState<pubHasuType>();
|
||||
const [pageNation, setPageNation] = useState<number>(1);
|
||||
|
||||
// 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 +78,31 @@ export default function PublicReuseFaciltyInsert() {
|
||||
});
|
||||
useEffect(() => {
|
||||
if (!pbnst.isInit) {
|
||||
pubHasuInit("1", "11");
|
||||
pubHasuInit("1", "41");
|
||||
}
|
||||
}, [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 +118,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 +129,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 +145,57 @@ 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()]);
|
||||
|
||||
useEffect(() =>{
|
||||
pubHasuInit(String(pageNation), "41");
|
||||
},[pageNation,pubHasuInit])
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -192,8 +218,8 @@ export default function PublicReuseFaciltyInsert() {
|
||||
size={"sm"}
|
||||
onClick={(e) => {
|
||||
searchTxt && searchTxt?.length > 0
|
||||
? pubHasuSearch("1", "11", searchTxt)
|
||||
: pubHasuInit("1", "11");
|
||||
? pubHasuSearch(String(pageNation), "41", searchTxt)
|
||||
: pubHasuInit(String(pageNation), "41");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
@@ -202,13 +228,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();
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -227,11 +254,11 @@ export default function PublicReuseFaciltyInsert() {
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={pubFacHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
pageSize={10}
|
||||
total={100000}
|
||||
headName={"공공 하수처리시설 등록"}
|
||||
cellClick={cellClick}
|
||||
onPageChange={(page: number) => {}}
|
||||
onPageChange={setPageNation}
|
||||
children={undefined}
|
||||
/>
|
||||
</ScrollArea>
|
||||
@@ -260,6 +287,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
formType="update"
|
||||
form={form}
|
||||
setIndexMng={(index: number) => {
|
||||
console.log("setIndexMng", index);
|
||||
setIndexMng(index);
|
||||
}}
|
||||
indexMng={indexMng}
|
||||
@@ -286,10 +314,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) => ({
|
||||
|
||||
@@ -16,15 +16,8 @@ import { Button, Label } from "@common/components/ui";
|
||||
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import type {
|
||||
customPbnst,
|
||||
pubHasuType,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import {
|
||||
excelDownload,
|
||||
getCityOrSgg,
|
||||
yearOptions,
|
||||
} from "@/components/lib/func/commom";
|
||||
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
import SearchInputText from "@/components/ui/searchInput/searchInput";
|
||||
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||
import { PbnstSttnModal } from "@/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal";
|
||||
@@ -43,7 +36,6 @@ export default function PbnstSttn() {
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<WaterReuseFacility[]>();
|
||||
const [pbnDetaileData, setPbnDetaileData] = useState<{
|
||||
@@ -90,10 +82,14 @@ export default function PbnstSttn() {
|
||||
setBdstTable(pbnstSttn.pbnstSttnRes);
|
||||
}, [pbnstSttn.pbnstSttnRes]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnRuseNm.length > 1)
|
||||
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear);
|
||||
}, [pbnRuseNm]);
|
||||
// useEffect(() => {
|
||||
// pbnstSttnSearch("1", "20", ref.current, pbnRuseNm, searchYear);
|
||||
// }, [pageNation, ref.current, pbnRuseNm, searchYear, pbnstSttnSearch]);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (pbnRuseNm.length > 1)
|
||||
// pbnNmSearch(String(pageNation), "23", ref.current, pbnRuseNm, searchYear);
|
||||
// }, [pbnRuseNm,pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk)
|
||||
@@ -103,15 +99,14 @@ export default function PbnstSttn() {
|
||||
});
|
||||
}, [pbnstSttn.pbnstDetail]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log('pbnDetaileData.isModal ', pbnDetaileData.isModal)
|
||||
},[pbnDetaileData.isModal])
|
||||
useEffect(() => {
|
||||
console.log("pbnDetaileData.isModal ", pbnDetaileData.isModal);
|
||||
}, [pbnDetaileData.isModal]);
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<div className="grid grid-cols-2 gap-4 ">
|
||||
<div className="col-span-2">
|
||||
<Title title={"하수재이용 시설 현황"} />
|
||||
<SearchBaseForm
|
||||
selectSidoData={code.cityCd}
|
||||
@@ -131,41 +126,32 @@ export default function PbnstSttn() {
|
||||
</Button>
|
||||
}
|
||||
leftChildren={
|
||||
<>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<SelectBox
|
||||
className="w-48 h-full text-2xl"
|
||||
label="연도"
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<SearchInputText
|
||||
label={"하수처리시설"}
|
||||
initValue={pbnRuseNm ?? ""}
|
||||
setValue={(searchNm?: string) => {
|
||||
setPbnRuseNm(searchNm || "");
|
||||
}}
|
||||
setRtnData={function (rtnData: any[]): void {
|
||||
setBdstTable(rtnData);
|
||||
}}
|
||||
searchList={pbnstSttn.pbnstSearchData || []}
|
||||
></SearchInputText>
|
||||
</>
|
||||
<div className="col-span-3 flex items-center">
|
||||
<SelectBox
|
||||
className="w-48 h-full text-2xl"
|
||||
label="연도"
|
||||
selectClass={"w-full "}
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
/>
|
||||
<Label className="w-64 mt-2 mx-4 text-xl text-gray-600">
|
||||
{"하수처리시설명 "}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={"text-2xl w-full ㅍ"}
|
||||
label=""
|
||||
textValue={pbnRuseNm || ""}
|
||||
setText={(e) => {
|
||||
setPbnRuseNm(e || "");
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
|
||||
let con;
|
||||
if (returnType.sigunValue != "0") {
|
||||
con = returnType.sigunValue;
|
||||
} else {
|
||||
con = returnType.sidoValue;
|
||||
}
|
||||
// pbnstSttnSearch(1, "20", con);
|
||||
pbnstSttnSearch("1", "20", returnType, pbnRuseNm, searchYear);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {}}
|
||||
@@ -190,7 +176,15 @@ export default function PbnstSttn() {
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellCLick(index);
|
||||
}}
|
||||
onPageChange={setPageNation}
|
||||
onPageChange={(page: number) => {
|
||||
pbnstSttnSearch(
|
||||
String(page),
|
||||
String(13),
|
||||
ref.current,
|
||||
pbnRuseNm,
|
||||
searchYear
|
||||
);
|
||||
}}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,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(() => {
|
||||
@@ -95,8 +95,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 (
|
||||
<>
|
||||
@@ -130,7 +130,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 ">
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { rswtChkZodType, rswtrChkDetailsZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import type {
|
||||
rswtChkZodType,
|
||||
rswtrChkDetailsZodType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import {
|
||||
excelArrayDownload,
|
||||
excelDownload,
|
||||
@@ -26,6 +29,7 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { shallow } from "zustand/shallow";
|
||||
|
||||
//-----------------------
|
||||
export default function Page() {
|
||||
@@ -41,6 +45,7 @@ export default function Page() {
|
||||
isRainSttn,
|
||||
|
||||
rswtChkgdnInit,
|
||||
rswtChkPolInit,
|
||||
rswtChkDetilsUpdate,
|
||||
rswtChkDelete,
|
||||
rswtrChkExcelDownload,
|
||||
@@ -52,9 +57,9 @@ export default function Page() {
|
||||
const [updateRainDetail, setUpdateRainDetail] = useState<rainChkZodType[]>(
|
||||
[]
|
||||
);
|
||||
const [updateRswtDetail, setUpdateRSwtDetail] = useState<rswtrChkDetailsZodType[]>(
|
||||
[]
|
||||
);
|
||||
const [updateRswtDetail, setUpdateRSwtDetail] = useState<
|
||||
rswtrChkDetailsZodType[]
|
||||
>([]);
|
||||
const [deleteIdx, setDeleteIdx] = useState<number[]>([]);
|
||||
|
||||
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
|
||||
@@ -66,32 +71,34 @@ export default function Page() {
|
||||
if (searchYear) rainChkInit(searchYear, "0");
|
||||
};
|
||||
|
||||
const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear()));
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainChkgdn.isInit) {
|
||||
rainChkInit("2024", "0");
|
||||
isRainSttn(false)
|
||||
|
||||
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);
|
||||
}
|
||||
}, [rainChkgdn.isInit, rainChkInit]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (rswtChkgdn.excelList[0]?.data.length > 1)
|
||||
if (rswtChkgdn.excelList[0]&&rswtChkgdn.excelList[0]?.data.length > 1) {
|
||||
|
||||
excelArrayDownload(
|
||||
"중수도시설 지도점검",
|
||||
"sample_rs_chk.xlsx",
|
||||
rswtChkgdn.excelList
|
||||
);
|
||||
}
|
||||
}, [rswtChkgdn.excelList]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -99,7 +106,8 @@ export default function Page() {
|
||||
rainChkgdn.excelList,
|
||||
"빗물이용시설 지도점검",
|
||||
"sample_rainy.xlsx",
|
||||
"A1:AN1"
|
||||
"A1:AN1",
|
||||
2
|
||||
);
|
||||
}, [rainChkgdn.excelList]);
|
||||
|
||||
@@ -119,15 +127,14 @@ export default function Page() {
|
||||
|
||||
const handleClick = useCallback(
|
||||
(data: any) => {
|
||||
|
||||
if (data) setIsModal({ open: !isModal.open, data: data });
|
||||
},
|
||||
[isModal]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
rainChkgdn.isSttn = false
|
||||
rswtChkgdn.isSttn = false
|
||||
rainChkgdn.isSttn = false;
|
||||
rswtChkgdn.isSttn = false;
|
||||
if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) {
|
||||
rainChkHeadChange({ rainChkgdn }, true);
|
||||
rswtChkHeadChange({ rswtChkgdn }, true);
|
||||
@@ -139,20 +146,17 @@ export default function Page() {
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkDelete(data);
|
||||
} else {
|
||||
rswtChkDelete(data)
|
||||
rswtChkDelete(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
const chkUpdateTable = (selFcltDiv: string) => {
|
||||
if (selFcltDiv === "RNB") {
|
||||
|
||||
rainChkDetilUpdate(updateRainDetail)
|
||||
rainChkDetilUpdate(updateRainDetail);
|
||||
} else {
|
||||
|
||||
rswtChkDetilsUpdate(updateRswtDetail)
|
||||
rswtChkDetilsUpdate(updateRswtDetail);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ContentsDiv>
|
||||
@@ -162,7 +166,9 @@ export default function Page() {
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<div className="col-span-2 flex flex-row space-x-2">
|
||||
<Label className="w-48 mt-2 text-xl text-gray-600">{'지도점검년도'}</Label>
|
||||
<Label className="w-48 mt-2 text-xl text-gray-600">
|
||||
{"지도점검년도"}
|
||||
</Label>
|
||||
<SelectBox
|
||||
className="w-full h-full text-2xl"
|
||||
label=""
|
||||
@@ -175,21 +181,24 @@ export default function Page() {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2 flex flex-row space-x-2">
|
||||
<Label className="w-28 mt-2 text-xl text-gray-600">{'시설구분'}</Label>
|
||||
<Label className="w-28 mt-2 text-xl text-gray-600">
|
||||
{"시설구분"}
|
||||
</Label>
|
||||
<SelectBox
|
||||
className={"w-full h-full text-2xl"}
|
||||
label={""}
|
||||
selectClass={""}
|
||||
selectArray={rainChkgdn.fcltDiv}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSelFcltDiv(String(val))
|
||||
onSelectValue={(val: string | number) =>{
|
||||
if(val === "RST") rswtChkPolInit();
|
||||
setSelFcltDiv(String(val))
|
||||
}
|
||||
}
|
||||
value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val}
|
||||
/>
|
||||
</div>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight
|
||||
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<div className="space-y">
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button
|
||||
@@ -211,7 +220,7 @@ export default function Page() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
chkUpdateTable(selFcltDiv)
|
||||
chkUpdateTable(selFcltDiv);
|
||||
}}
|
||||
>
|
||||
저장
|
||||
|
||||
@@ -51,6 +51,7 @@ export default function prfmncPrfmncReg() {
|
||||
}>({ isModal: false, data: {} as FcPrfType });
|
||||
const [inputData, setInputData] = useState<any[]>();
|
||||
const [pbnstRuseFcltPk, setPbnstRuseFcltPk] = useState<string>();
|
||||
const [pageNation , setPageNation] = useState<number>(1);
|
||||
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
@@ -73,9 +74,12 @@ export default function prfmncPrfmncReg() {
|
||||
pbnstRuseFcltPk
|
||||
) as unknown as PrfType
|
||||
);
|
||||
prfmncHasuInit("1", "11");
|
||||
prfmncHasuInit(String(pageNation), "41");
|
||||
}
|
||||
}, [inputData, searchYear, pbnstRuseFcltPk,prfmncHasuInit]);
|
||||
}, [inputData, searchYear, pbnstRuseFcltPk,prfmncHasuInit,pageNation]);
|
||||
|
||||
|
||||
|
||||
|
||||
const cellClick = useCallback(
|
||||
(index: number | undefined, headId: string) => {
|
||||
@@ -84,10 +88,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 +127,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 +139,6 @@ export default function prfmncPrfmncReg() {
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPbnstRuseFcltPk(prfmncRes[index].pbnstRuseFcltPk);
|
||||
|
||||
console.log(' tableData ' ,tableData)
|
||||
setInputData(tableData);
|
||||
} else {
|
||||
setInputData([]);
|
||||
@@ -147,7 +150,7 @@ export default function prfmncPrfmncReg() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!prfmnc.isInit) {
|
||||
prfmncHasuInit("1", "11");
|
||||
prfmncHasuInit('1', "41");
|
||||
}
|
||||
}, [prfmnc.isInit, prfmncHasuInit]);
|
||||
useEffect(() => {
|
||||
@@ -230,13 +233,13 @@ export default function prfmncPrfmncReg() {
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={pbnstPrfmncHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
pageSize={10}
|
||||
total={10000}
|
||||
headName={"하수재이용시설 목록"}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index, headId);
|
||||
}}
|
||||
onPageChange={(page: number) => {}}
|
||||
onPageChange={setPageNation}
|
||||
children={undefined}
|
||||
/>
|
||||
</ScrollArea>
|
||||
|
||||
@@ -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,21 @@ 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 [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
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 +69,6 @@ export default function PbnstPrfmncSttn() {
|
||||
chartData8: lineChartDataProps[];
|
||||
chartData9: lineChartDataProps[];
|
||||
}>();
|
||||
// const [lnInChartConfig, setLnInChartConfig] = useState<ChartConfig>({});
|
||||
const [outLineData, setOutLineData] = useState<{
|
||||
chartData1: lineChartDataProps[];
|
||||
chartData2: lineChartDataProps[];
|
||||
@@ -58,22 +78,20 @@ 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"
|
||||
const monthKey = `${month}월`;
|
||||
@@ -108,7 +126,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 +137,195 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPrfData(tableData);
|
||||
|
||||
setExcelData(excelPrfmncSttnParsing(prfData ?? []))
|
||||
} else {
|
||||
setPrfData([]);
|
||||
}
|
||||
}
|
||||
|
||||
const [chartId, setChartId] = useState<string>();
|
||||
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) {
|
||||
prfTableData([], year)
|
||||
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 //세척살수용수
|
||||
// 실적 테이블 데이터
|
||||
if (chartId){
|
||||
if(item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltFk === chartId){
|
||||
prfTableData(item.prfList, year);
|
||||
}
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltFk === chartId).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;
|
||||
|
||||
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 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);
|
||||
// 막대차트
|
||||
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" });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 도넛차트 데이터
|
||||
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])
|
||||
|
||||
}, [rawData, year, chartId]);
|
||||
|
||||
useEffect(() => {
|
||||
const newChartConfig = chartData.reduce((config, element) => {
|
||||
@@ -196,46 +338,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 +349,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 +360,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 +371,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 +415,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) {
|
||||
@@ -517,15 +449,39 @@ export default function PbnstPrfmncSttn() {
|
||||
}, [outLineData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!pbnstPrfmncSttn.isInit) {
|
||||
pbnstPrfmncInit("1", "11");
|
||||
const returnType: ReturnType = {
|
||||
sidoValue: "0",
|
||||
sigunValue: "0",
|
||||
partValue: "A",
|
||||
regionValue: "0",
|
||||
unitWaterShedValue: "",
|
||||
middleRegionValue: "",
|
||||
envPartValue: "",
|
||||
sidoText: "",
|
||||
sigunText: ""
|
||||
}
|
||||
}, [pbnstPrfmncSttn.isInit, pbnstPrfmncInit]);
|
||||
tableHeadMaker(Number(searchYear), Number(searchYear));
|
||||
pbnstPrfmncSearch(returnType, "", searchYear, searchYear)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setbdstTable(prfmncRes);
|
||||
if(prfmncRes?.[0]?.pbnstRuseFcltPk) setChartId(prfmncRes[0].pbnstRuseFcltPk)
|
||||
}, [prfmncRes]);
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnRuseNm.length > 1)
|
||||
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear);
|
||||
}, [pbnRuseNm]);
|
||||
|
||||
const cellClick = (index: number | undefined, headId: string) => {
|
||||
if (index !== undefined && headId !== undefined) {
|
||||
setChartId(prfmncRes[index].pbnstRuseFcltPk)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -566,24 +522,28 @@ 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);
|
||||
}} />
|
||||
<SelectBox
|
||||
<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="재이용시설명"
|
||||
selectClass={""}
|
||||
selectArray={[]}
|
||||
value={""}
|
||||
onSelectValue={() => { }} />
|
||||
onSelectValue={() => { }} /> */}
|
||||
</div>
|
||||
</div>}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
pbnstPrfmncSearch(returnType, swtrmtFcltNm ?? "", fromDate, toDate);
|
||||
pbnstPrfmncSearch(returnType, pbnRuseNm ?? "", fromDate, toDate);
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
@@ -599,7 +559,7 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}
|
||||
}}
|
||||
excelClick={() => { }}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void { }}
|
||||
btnClass={btnClass}
|
||||
ref={ref} isAdmin={false} />
|
||||
@@ -614,8 +574,12 @@ export default function PbnstPrfmncSttn() {
|
||||
headlist={pbnstPrfHeadList}
|
||||
pageSize={20}
|
||||
total={10000}
|
||||
cellClick={() => { }}
|
||||
onPageChange={() => { }}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index ?? undefined, headId);
|
||||
}}
|
||||
onPageChange={() => { }
|
||||
}
|
||||
index={0}
|
||||
/>
|
||||
|
||||
<hr />
|
||||
@@ -680,7 +644,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;
|
||||
@@ -168,10 +181,20 @@ export type comCodeType = comCodeState & comCodeActions;
|
||||
|
||||
export const getSggCd = async (set: any) => {
|
||||
const sgg = await getFetch("common", "/addr/sgg");
|
||||
const sggCd = sgg.map((item: any) => ({
|
||||
/* const sggCd = sgg.map((item: any) => ({
|
||||
val: item.adstDstrCd,
|
||||
text: item.gugun,
|
||||
}));
|
||||
})); */
|
||||
|
||||
const sggCd = [
|
||||
{ text: "전체", val: '0' },
|
||||
...sgg
|
||||
.map((item: any) => ({
|
||||
text: item.gugun || '',
|
||||
val: String(item.adstDstrCd) || ''
|
||||
}))
|
||||
];
|
||||
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
@@ -319,7 +342,7 @@ export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
|
||||
val: item.adstDstrCd,
|
||||
text: item.gugun,
|
||||
}));
|
||||
|
||||
|
||||
const city = await getFetch("common", "/addr/city");
|
||||
const cityCd = city.map((item: any) => ({
|
||||
val: item.adstDstrCd,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -32,106 +32,106 @@ export const buildingToExcelType = (
|
||||
sggCdoe: SelectDataType[],
|
||||
) => {
|
||||
const excelData: string[][] = [];
|
||||
buildings.forEach((building) => {
|
||||
useTypes.forEach((useType) => {
|
||||
excelData.push([
|
||||
building.bdstInfoPk.toString(),
|
||||
sidoCode.find((sido) => sido.val === building.ctpvCd.toString())
|
||||
?.text || "",
|
||||
sggCdoe.find((sido) => sido.val === building.sggCd.toString())
|
||||
?.text || "",
|
||||
building.daddr,
|
||||
building.bdstNm,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
useType,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
]);
|
||||
});
|
||||
buildings.forEach((building) => {
|
||||
useTypes.forEach((useType) => {
|
||||
excelData.push([
|
||||
building.bdstInfoPk.toString(),
|
||||
sidoCode.find((sido) => sido.val === building.ctpvCd.toString())
|
||||
?.text || "",
|
||||
sggCdoe.find((sido) => sido.val === building.sggCd.toString())
|
||||
?.text || "",
|
||||
building.daddr,
|
||||
building.bdstNm,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
useType,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
]);
|
||||
});
|
||||
return excelData;
|
||||
|
||||
});
|
||||
return excelData;
|
||||
|
||||
};
|
||||
|
||||
export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
const rainChkgdData: rainChkZodType[] = excelData.map((item: any) => {
|
||||
if (item["점검일"] !== undefined) {
|
||||
const checkYmd = item["점검일"].replace(/\./g, "")
|
||||
let vltnDt = item["과태료 부과일(위반일)"]
|
||||
if (vltnDt !== undefined) {
|
||||
vltnDt = vltnDt .replace(/\./g, "")
|
||||
}
|
||||
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
|
||||
let month = `${i + 1}`;
|
||||
const splyData = item[`보급_${month}월`];
|
||||
const ruseData = item[`빗물_${month}월`];
|
||||
if (month.length < 2) month = "0" + month;
|
||||
return {
|
||||
utztnUsgCd: item["이용용도"],
|
||||
ym: year + month,
|
||||
chckYmd: checkYmd,
|
||||
splyUswtrUtztnQnt: splyData !== undefined ? splyData : 0,
|
||||
ruseFcltUtztnQnt: ruseData !== undefined ? ruseData : 0,
|
||||
flg: "RNB",
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
bdstRuseFcltFk: Number(item["NO"]),
|
||||
chckYmd: checkYmd,
|
||||
spwtPositn: item["유량측정방법"],
|
||||
rgtr: TEST_UUID,
|
||||
oilqMeasMthd: item["운영관리형태"],
|
||||
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
|
||||
operMngCd: item["유량측정방법"],
|
||||
guideDetails: makeGuidDetail,
|
||||
rainyDetails: [
|
||||
{
|
||||
const checkYmd = item["점검일"].replace(/\./g, "")
|
||||
let vltnDt = item["과태료 부과일(위반일)"]
|
||||
if (vltnDt !== undefined) {
|
||||
vltnDt = vltnDt ? vltnDt.replace(/\./g, "") : "";
|
||||
}
|
||||
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
|
||||
let month = `${i + 1}`;
|
||||
const splyData = item[`보급_${month}월`];
|
||||
const ruseData = item[`빗물_${month}월`];
|
||||
if (month.length < 2) month = "0" + month;
|
||||
return {
|
||||
utztnUsgCd: item["이용용도"],
|
||||
ph: Number(item["PH"]) ?? 0,
|
||||
trbt: Number(item["탁도"]) ?? 0,
|
||||
grssClfg: Number(item["총대장균군수"]) ?? 0,
|
||||
etc: item["기타"] ?? "", // 필드 누락 방지
|
||||
vltnDt: vltnDt,
|
||||
vltnMttr: item["위반사항"],
|
||||
levyAmt: Number(item["과태료부과금액(천원)"]) ?? 0,
|
||||
rgtr: TEST_UUID,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
ym: year + month,
|
||||
chckYmd: checkYmd,
|
||||
splyUswtrUtztnQnt: Number(splyData ?? 0),
|
||||
ruseFcltUtztnQnt: Number(ruseData ?? 0),
|
||||
flg: "RNB",
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
bdstRuseFcltFk: Number(item["NO"]),
|
||||
chckYmd: checkYmd,
|
||||
spwtPositn: item["유량측정방법"] ?? "",
|
||||
rgtr: TEST_UUID,
|
||||
oilqMeasMthd: item["운영관리형태"] ?? "",
|
||||
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
|
||||
operMngCd: item["유량측정방법"] ?? "",
|
||||
guideDetails: makeGuidDetail,
|
||||
rainyDetails: [
|
||||
{
|
||||
utztnUsgCd: item["이용용도"] ?? "",
|
||||
ph: Number(item["PH"] ?? 0),
|
||||
trbt: Number(item["탁도"] ?? 0),
|
||||
grssClfg: Number(item["총대장균군수"] ?? 0),
|
||||
etc: item["기타"] ?? "", // 필드 누락 방지
|
||||
vltnDt: vltnDt ?? "",
|
||||
vltnMttr: item["위반사항"] ?? "",
|
||||
levyAmt: Number(item["과태료부과금액(천원)"] ?? 0),
|
||||
rgtr: TEST_UUID,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}).filter((el: any) => el !== undefined);
|
||||
return rainChkgdData;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import {
|
||||
TEST_UUID,
|
||||
type TableUpperProps,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type {
|
||||
SelectDataType,
|
||||
sheetParameter,
|
||||
SheetParameter,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
deleteFectch,
|
||||
@@ -25,6 +24,7 @@ import {
|
||||
import { z } from "zod";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import { type chHeadType } from "../rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
const rswtChkHeadList = rswtChkHeadListExport;
|
||||
const rswtDetailHeadList = rswtDetailHeadListExport;
|
||||
@@ -37,7 +37,7 @@ export type rswtChkgdnState = {
|
||||
rswtDetailHeadList: TableUpperProps[];
|
||||
|
||||
rswtHeadNm: chHeadType[];
|
||||
excelList: [typeof sheetParameter];
|
||||
excelList: SheetParameter[];
|
||||
rswtChkRes: rswtChkZodType[];
|
||||
rswtChkPolGuide: rswtChkZodType[];
|
||||
isInit: boolean;
|
||||
@@ -55,6 +55,7 @@ type rswtChkgdnActions = {
|
||||
rswtChkDelete: (chkgdnPks: number[]) => void;
|
||||
rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[]) => void;
|
||||
rswtChkPolAndGuide: (chkGdnPk: number) => void;
|
||||
rswtChkPolInit: () => void;
|
||||
rwstPolAndGuideUpdate: (rswtChk: rswtChkZodType[]) => void;
|
||||
rswtChkHeadChange: (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => void;
|
||||
};
|
||||
@@ -69,7 +70,7 @@ export const rswtChkgdnStateExport: rswtChkgdnState = {
|
||||
excelList: [{
|
||||
data: [[]], headerNum: 0, headerRange: "A1:V3",
|
||||
sheetName: "",
|
||||
startCol: 0
|
||||
startCol: '1'
|
||||
}],
|
||||
rswtChkRes: [],
|
||||
rswtChkPolGuide: [],
|
||||
@@ -175,9 +176,6 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
try {
|
||||
const chData = await makeMdfrChk(rswtChk);
|
||||
|
||||
console.log("chData ", chData);
|
||||
|
||||
console.log("rswtChk ", rswtChk);
|
||||
|
||||
const res = await putFectch("/reuseChk/reuseWater", chData);
|
||||
if (res.ok) {
|
||||
@@ -237,6 +235,17 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
}));
|
||||
} catch (error) {}
|
||||
},
|
||||
rswtChkPolInit: () => {
|
||||
try {
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkPolGuide: undefined,
|
||||
},
|
||||
}));
|
||||
} catch (error) {}
|
||||
},
|
||||
rwstPolAndGuideUpdate: async (rswtChk: rswtChkZodType[]) => {
|
||||
try {
|
||||
const chData = await makeMdfrChk(rswtChk);
|
||||
|
||||
@@ -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;
|
||||
@@ -32,7 +33,7 @@ export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
|
||||
|
||||
type pbnstPrfmncActions = {
|
||||
prfmncHasuInit: (page: string, sggOrCity: string) => void;
|
||||
prfmnRegData: (data:PrfType) =>void
|
||||
prfmnRegData: (data: PrfType) => void;
|
||||
};
|
||||
|
||||
const checkWrRegList = async () => {
|
||||
@@ -46,21 +47,28 @@ const hasuListFetch = async (page: string, sggOrCity: string) => {
|
||||
checkWrRegListRes?.fcltCds,
|
||||
fetchType.COMMON
|
||||
);
|
||||
const data = checkWrRegListRes.fcPrfList.map((item: FcPrfType) => {
|
||||
const findData = rainRes.data.find(
|
||||
(fclt: pubHasuType) =>
|
||||
fclt.bscFctCd === item.pbnstRuseFcltPk.substring(0, 11)
|
||||
|
||||
|
||||
const findData = rainRes.data.map((item: pubHasuType) => {
|
||||
const data = checkWrRegListRes?.fcPrfList.find(
|
||||
(fclt: FcPrfType) =>
|
||||
fclt.pbnstRuseFcltPk.substring(0, 11) === item?.bscFctCd
|
||||
);
|
||||
return {
|
||||
sido: findData?.sido,
|
||||
gugun: findData?.gugun,
|
||||
bscFctNm: findData?.bscFctNm,
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltPk: item.pbnstRuseFcltPk,
|
||||
prfList : item.prfList
|
||||
};
|
||||
if(data !==undefined){
|
||||
return( {
|
||||
|
||||
sido: item.sido,
|
||||
gugun: item.gugun,
|
||||
bscFctNm: item.bscFctNm,
|
||||
bscFctCd: item.bscFctCd,
|
||||
ruseUtztnFcltNm: data.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltPk: data.pbnstRuseFcltPk,
|
||||
prfList: data.prfList,
|
||||
});
|
||||
}
|
||||
});
|
||||
return data;
|
||||
|
||||
return findData;
|
||||
};
|
||||
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
set: any
|
||||
@@ -82,31 +90,21 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
prfmnRegData: async (data:PrfType,) => {
|
||||
try{
|
||||
|
||||
prfmnRegData: async (data: PrfType) => {
|
||||
try {
|
||||
const ressponse = await postFectch(
|
||||
"/reuseFc/pubFcPrf",
|
||||
data,
|
||||
fetchType.WR
|
||||
);
|
||||
|
||||
console.log('ressponse ', ressponse)
|
||||
|
||||
if(ressponse.status === 200){
|
||||
ToastFormUi({
|
||||
body: "하수재이용 시설 실적 등록이 완료되었습니다. ",
|
||||
title: "하수재이용 시설 실적 등록",
|
||||
});
|
||||
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
ToastFormUi({
|
||||
body: "하수재이용 시설 실적 등록이 실패하였습니다. ",
|
||||
title: "하수재이용 시설 실적 등록",
|
||||
});
|
||||
|
||||
if (ressponse.status === 200) {
|
||||
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
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;
|
||||
};
|
||||
@@ -75,7 +75,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
for (let i = startYear; i <= endYear; i++) {
|
||||
const yearHead = JSON.parse(JSON.stringify(pbnstYearHeadListExport));
|
||||
if (yearHead) {
|
||||
yearHead.forEach((item: { id?: number; }) => {
|
||||
yearHead.forEach((item: { id?: string; }) => {
|
||||
if (item.id) {
|
||||
item.id = i + item.id;
|
||||
|
||||
@@ -86,12 +86,13 @@ 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 {
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
pbnstPrfHeadList: [...yearHeader],
|
||||
selectYearList: selectList
|
||||
},
|
||||
@@ -106,7 +107,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
prfmncRes: prfmncRes,
|
||||
isInit: false,
|
||||
isInit: true,
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
@@ -115,8 +116,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
},
|
||||
pbnstPrfmncSearch: async (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => {
|
||||
let searchUrl = "";
|
||||
|
||||
if (returnType.sigunValue !== undefined) {
|
||||
if (returnType.sigunValue !== "0") {
|
||||
if (swtrmtFcltNm !== "") {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW${'/' + swtrmtFcltNm}`;
|
||||
} else {
|
||||
@@ -134,6 +134,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
fetchType.COMMON,
|
||||
searchUrl
|
||||
);
|
||||
|
||||
const bscFctCdList = pbnstRes.map((item: any) => {
|
||||
return item.bscFctCd;
|
||||
})
|
||||
@@ -142,43 +143,66 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
bscFctCdList,
|
||||
`wr`,
|
||||
)
|
||||
|
||||
let inUsageSum = 0;
|
||||
let outUsageSum = 0;
|
||||
let usageSum = 0;
|
||||
let year = "";
|
||||
const yearsData = []
|
||||
|
||||
res.data.forEach((item) => {
|
||||
if (item.prfList.length === 0) {
|
||||
const year = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출
|
||||
const yearVal = { year: year, pbnstRuseFcltPk: item.pbnstRuseFcltPk ?? "", ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[year + "inUsage"] = 0;
|
||||
yearVal[year + "outUsage"] = 0;
|
||||
yearVal[year + "total"] = 0;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
item.prfList.forEach((acc) => {
|
||||
year = acc.ym.substring(0, 4);
|
||||
inUsageSum = acc.wshwtr + acc.coolUswtr + acc.cleanUswtr + acc.drwtUswtr +
|
||||
acc.dltnUswtr + acc.ithlRswtr + acc.ithlEtcUswtr + acc.cleanToilUswtr + acc.resn;
|
||||
outUsageSum = acc.lndwtr + acc.hydUswtr + acc.ugwtChr + acc.farmUswtr + acc.rvrKeepUswtr + acc.indstUswtr;
|
||||
const yearData = yearsData.find(yearItem => yearItem.year === year && yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltPk)
|
||||
year = acc.ym?.substring(0, 4) ?? "";
|
||||
inUsageSum =
|
||||
(acc.wshwtr ?? 0) +
|
||||
(acc.coolUswtr ?? 0) +
|
||||
(acc.cleanUswtr ?? 0) +
|
||||
(acc.drwtUswtr ?? 0) +
|
||||
(acc.dltnUswtr ?? 0) +
|
||||
(acc.ithlRswtr ?? 0) +
|
||||
(acc.ithlEtcUswtr ?? 0) +
|
||||
(acc.cleanToilUswtr ?? 0) +
|
||||
(acc.resn ?? 0);
|
||||
outUsageSum =
|
||||
(acc.lndwtr ?? 0) +
|
||||
(acc.hydUswtr ?? 0) +
|
||||
(acc.ugwtChr ?? 0) +
|
||||
(acc.farmUswtr ?? 0) +
|
||||
(acc.rvrKeepUswtr ?? 0) +
|
||||
(acc.indstUswtr ?? 0);
|
||||
const yearData = yearsData.find(
|
||||
(yearItem) =>
|
||||
yearItem.year === year &&
|
||||
yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltPk
|
||||
);
|
||||
|
||||
if (yearData) {
|
||||
yearData.inUsageSum += inUsageSum;
|
||||
yearData.outUsageSum += outUsageSum;
|
||||
yearData[year + "inUsage"] += inUsageSum;
|
||||
yearData[year + "outUsage"] += outUsageSum;
|
||||
yearData[year + "total"] += (inUsageSum + outUsageSum);
|
||||
} else {
|
||||
const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk }
|
||||
yearVal[year + 'inUsage'] = inUsageSum;
|
||||
yearVal[year + 'outUsage'] = outUsageSum;
|
||||
yearVal[year + 'total'] = inUsageSum + outUsageSum;
|
||||
const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk, ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[year + "inUsage"] = inUsageSum;
|
||||
yearVal[year + "outUsage"] = outUsageSum;
|
||||
yearVal[year + "total"] = inUsageSum + outUsageSum;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
const resData: any[] = []
|
||||
pbnstRes.forEach((acc) => {
|
||||
let data = yearsData.find((item) => item.pbnstRuseFcltPk.substring(0, 11) === acc.bscFctCd)
|
||||
if (data) {
|
||||
resData.push({ ...data, ...acc })
|
||||
resData.push({ ...acc, ...data })
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
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(),
|
||||
|
||||
@@ -3,7 +3,76 @@ import { getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
|
||||
const validationMessages = {
|
||||
required: (field: string) => `${field}을(를) 입력해주세요.`,
|
||||
requiredSelect: (field: string) => `${field}을(를) 선택해주세요.`,
|
||||
yearFormat: '4자리 연도만 입력하세요',
|
||||
};
|
||||
|
||||
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
|
||||
|
||||
const rainyObjSchema = z.object({
|
||||
bdstReuseFcltFk: z.number().nullish(),
|
||||
pntfColKnd: z.string().default(""),
|
||||
pntfColArea: z.number().default(0),
|
||||
dtfcltCpct: z.number().default(0),
|
||||
filtrTrtmfctYn: z.string().default("Y").nullish(),
|
||||
filtrTrtmfctCpct: z.number().nullish().default(0),
|
||||
filtrTrtmfctPrs: z.string().default(""),
|
||||
annRnwtQty: z.number().default(0),
|
||||
oilqMeasMthd: z.string().default("").nullish(),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
}).refine((data) => data.pntfColKnd.length > 0, {
|
||||
message: validationMessages.requiredSelect("종류"),
|
||||
path: ["pntfColKnd"],
|
||||
}).refine((data) => data.pntfColArea > 0, {
|
||||
message: validationMessages.required("면적(m³)"),
|
||||
path: ["pntfColArea"],
|
||||
});
|
||||
|
||||
const reuseBuildingSchema = z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk:z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().nullish(),
|
||||
operMngCd: z.string().optional().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default("Y"),
|
||||
instlCstSprtAmt: z.number().nullish(),
|
||||
grntchBdstCertYn: z.string().default("Y"),
|
||||
grntchBdstCertYr: z.string().default("")
|
||||
.refine((year)=> year.length===0 || /^\d{4}$/.test(year),{
|
||||
message: validationMessages.yearFormat
|
||||
}),
|
||||
grntchBdstCertNo: z.string().default(""),
|
||||
grntchBdstCertGrd: z.string().default(""),
|
||||
crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값
|
||||
crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값
|
||||
crgRdctAmt: z.number().default(0), // 안쓰는 값
|
||||
ruseFcltFlg: z.string().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default("Y"),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
rainyObj: rainyObjSchema.default({})
|
||||
}).refine((data) => data.bdstUsgCd > 0, {
|
||||
message: validationMessages.requiredSelect("건축물용도"),
|
||||
path: ["bdstUsgCd"],
|
||||
});
|
||||
|
||||
const chgBuildingSchema = z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date({required_error: validationMessages.required("허가일")}),
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
}).refine(data => data.bdstChgNm.length > 0, {
|
||||
message: validationMessages.requiredSelect("구분"),
|
||||
path: ["bdstChgNm"]
|
||||
});
|
||||
|
||||
export const rainZod = z.object({
|
||||
bdstInfoPk: z.number().optional(),
|
||||
ctpvCd: z.number().default(0),
|
||||
@@ -16,62 +85,9 @@ export const rainZod = z.object({
|
||||
archChgArea: z.number().default(0),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
reuseBuilding: z.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk:z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().nullish(),
|
||||
operMngCd: z.string().optional().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().nullish(),
|
||||
grntchBdstCertYn: z.enum(["Y", "N"]).nullish(),
|
||||
grntchBdstCertYr: z.string().default("")
|
||||
.refine((year)=> year.length===0 || /^\d{4}$/.test(year),{
|
||||
message:'4자리 연도만 입력하세요'
|
||||
}),
|
||||
grntchBdstCertNo: z.string().default(""),
|
||||
grntchBdstCertGrd: z.string().default(""),
|
||||
crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값
|
||||
crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값
|
||||
crgRdctAmt: z.number().default(0), // 안쓰는 값
|
||||
ruseFcltFlg: z.string().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.enum(["Y", "N"]),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
|
||||
rainyObj: z.object({
|
||||
bdstReuseFcltFk: z.number().nullish(),
|
||||
pntfColKnd: z.string().default(""),
|
||||
pntfColArea: z.number().default(0),
|
||||
dtfcltCpct: z.number().default(0),
|
||||
filtrTrtmfctYn: z.enum(["Y", "N"]).nullish(),
|
||||
filtrTrtmfctCpct: z.number().nullish().default(0),
|
||||
filtrTrtmfctPrs: z.string().default(""),
|
||||
annRnwtQty: z.number().default(0),
|
||||
oilqMeasMthd: z.string().default("").nullish(),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
|
||||
|
||||
}).default({})
|
||||
})
|
||||
).default([]),
|
||||
|
||||
chgBuilding: z.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date(),
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
|
||||
})
|
||||
).default([])
|
||||
});
|
||||
reuseBuilding: z.array(reuseBuildingSchema).default([]),
|
||||
chgBuilding: z.array(chgBuildingSchema).default([])
|
||||
})
|
||||
|
||||
export type chgBuilding={
|
||||
bdstInfoFk?: number|null,
|
||||
@@ -254,6 +270,3 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ import { excelPbnstSttnParsing } from "./excel";
|
||||
import type { FcPrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import type { ReturnType } from "@common/business_components/ui";
|
||||
import type { WaterReuseFacility } from "./type";
|
||||
import moment from "moment";
|
||||
|
||||
const pbnstSttHeadList = pbnSttHeadListExport;
|
||||
const pbnstSttNodeList = pbnstSttNodeListExport;
|
||||
@@ -166,8 +167,8 @@ const hasuListFetch = async (
|
||||
outUsage: usage.outUsage,
|
||||
operMthd: item.operList[0]?.operMthd,
|
||||
rprtvBzenty: item.operList[0]?.rprtvBzenty,
|
||||
bgngDt: item.operList[0]?.bgngDt.toLocaleDateString ?? "",
|
||||
endDt: item.operList[0]?.endDt.toLocaleDateString?? "",
|
||||
bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "",
|
||||
endDt: moment(item.operList[0]?.endDt).format("YYYY-MM-DD") ?? "",
|
||||
searchNm: findData.bscFctNm,
|
||||
searchPk: findData.bscFctCd,
|
||||
prfList:item?.prfList??[]
|
||||
|
||||
@@ -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`;
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +152,8 @@ export const chRowspanTable = (
|
||||
onChange={(e) => {
|
||||
handleChange(rowIndex, head.id, e.target.value);
|
||||
}}
|
||||
value={value}
|
||||
value={value ?? ""}
|
||||
disabled={!selectedIds.includes(row.chkgdnPk)}
|
||||
/>
|
||||
) : (
|
||||
(head.id === "totalSplyUswtrUtztnQnt" || head.id === "totalRuseFcltUtztnQnt" || head.id === "splyUswtrUtztnQnt" || head.id === "ruseFcltUtztnQnt") ? (
|
||||
|
||||
@@ -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];
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
type SelectDataType,
|
||||
type ReturnType,
|
||||
filePickedBlobArray,
|
||||
type SheetParameter,
|
||||
} from "@common/business_components/ui";
|
||||
import type { RefObject } from "react";
|
||||
|
||||
@@ -81,7 +82,7 @@ export const excelDownload = (
|
||||
export const excelArrayDownload = (
|
||||
fileNm: string,
|
||||
sampleFile: string,
|
||||
sheetArray: []
|
||||
sheetArray:SheetParameter []
|
||||
) => {
|
||||
if (!sheetArray) return;
|
||||
fetch(`/${sampleFile}`, {}).then(async (response) => {
|
||||
@@ -110,7 +111,12 @@ export const formatCommaNumber = (
|
||||
value: number | string | undefined | null
|
||||
): string => {
|
||||
if (value === undefined || value === null || value === "") return "";
|
||||
return Number(value).toLocaleString();
|
||||
const num = Number(value);
|
||||
// 숫자로 변환할 수 없는 값이 들어올 경우 빈 문자열을 반환하여 예상치 못한 "NaN" 출력을 방지합니다.
|
||||
if (isNaN(num)) {
|
||||
return "";
|
||||
}
|
||||
return num.toLocaleString();
|
||||
};
|
||||
|
||||
export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
|
||||
|
||||
@@ -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,10 @@ export default function RainRegForm({
|
||||
typeof item?.grntchBdstCertYr === "string"
|
||||
? item?.grntchBdstCertYr
|
||||
: "", // null → ""
|
||||
rainObj: {
|
||||
...item?.rainObj,
|
||||
// Ensure enum fields are null if empty string to trigger Zod default
|
||||
rainyObj: {
|
||||
...item?.rainyObj,
|
||||
filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn === "" ? null : item?.rainyObj?.filtrTrtmfctYn,
|
||||
},
|
||||
})),
|
||||
};
|
||||
@@ -84,8 +86,6 @@ export default function RainRegForm({
|
||||
useEffect(() => {
|
||||
const subscription = form.watch((value) => {
|
||||
});
|
||||
|
||||
|
||||
return () => subscription.unsubscribe();
|
||||
}, [form]);
|
||||
|
||||
@@ -105,7 +105,6 @@ export default function RainRegForm({
|
||||
if (rainZod) form.reset(cleanRainData(rainForm));
|
||||
}, [rainForm]);
|
||||
|
||||
|
||||
return (
|
||||
<div className="!mx-[1.6rem] !p-0r">
|
||||
<Form {...form}>
|
||||
@@ -115,9 +114,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 +148,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 +169,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 +199,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 +218,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 +244,9 @@ export default function RainRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
onSelectValue={readonly ? () => { } : field.onChange}
|
||||
value={field.value || code.yn[0]?.val}
|
||||
readOnly={readonly}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -256,7 +263,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"}
|
||||
@@ -273,8 +280,8 @@ export default function RainRegForm({
|
||||
<FormUi label="처리공정">
|
||||
<Input
|
||||
className={selectClass}
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
placeholder=""
|
||||
type="text"
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
readOnly={filtrTrtmfctYn !== "Y"}
|
||||
@@ -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>
|
||||
|
||||
@@ -45,7 +45,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
|
||||
const cityValue = String(val); // Ensure val is treated as a string
|
||||
const data = getCity(cityValue, code.sggCd);
|
||||
setSelectSgg(data);
|
||||
|
||||
getSgg(data[0]?.val || "");
|
||||
setObjSearch({ city: cityValue, sgg: '' });
|
||||
};
|
||||
|
||||
@@ -111,6 +111,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
|
||||
selectClass={selectClass}
|
||||
selectArray={selectSgg || []}
|
||||
onSelectValue={getSgg}
|
||||
value={objSearch.sgg || ""}
|
||||
>
|
||||
{" "}
|
||||
</SelectBox>
|
||||
|
||||
@@ -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, titleVisible }: { data: customPbnst; titl
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
|
||||
const { monthHeadList } = prfmnc;
|
||||
useEffect(() => {
|
||||
let tableData;
|
||||
@@ -77,6 +78,7 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl
|
||||
majorPrcsMsrcCd: item.majorPrcsMsrcCd ?? "-",
|
||||
inoutYn: item.inoutYn ?? "-",
|
||||
addr: item.addr ?? "-",
|
||||
mainSplyPumpCpct: item.mainSplyPumpCpct ?? "-",
|
||||
};
|
||||
});
|
||||
} else if (fcltTab === "sply") {
|
||||
@@ -113,6 +115,7 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl
|
||||
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, titleVisible }: { data: customPbnst; titl
|
||||
} 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, titleVisible }: { data: customPbnst; titl
|
||||
]);
|
||||
|
||||
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, titleVisible }: { data: customPbnst; titl
|
||||
});
|
||||
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, titleVisible }: { data: customPbnst; titl
|
||||
(item) => item.pbnstRuseFcltPk === data.pbnstRuseFcltPk
|
||||
)?.prfList;
|
||||
|
||||
if (prfList) {
|
||||
if (prfList) {console.log("prfList", prfList);
|
||||
|
||||
getTablePrfData(prfList);
|
||||
}
|
||||
}
|
||||
}, [pbnstSttn.pbnstSttnRes, data]);
|
||||
|
||||
useEffect(() => { }, [ruseBizData?.head]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -242,7 +243,12 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl
|
||||
form.reset({ items: [data] })
|
||||
}
|
||||
|
||||
}, [data, form])
|
||||
},[data, form])
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
console.log("prfData", prfData);
|
||||
},[prfData])
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
@@ -258,7 +264,7 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl
|
||||
indexMng={indexMng}
|
||||
setIndexMng={setIndexMng}
|
||||
/>
|
||||
<Tabs defaultValue="mng" onValueChange={setFcltTab}>
|
||||
<Tabs defaultValue="fclt" onValueChange={setFcltTab}>
|
||||
<TabsList className="">
|
||||
<TabsTrigger className="!text-xl" value="fclt">
|
||||
하수처리수 재이용시설 현황
|
||||
@@ -296,7 +302,7 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl
|
||||
</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
|
||||
|
||||
@@ -62,7 +62,7 @@ export default function RswtChkgdTable({
|
||||
[makeTableData, handleRswtClick]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (rswtChkgdn.rswtChkPolGuide.length > 0)
|
||||
if (rswtChkgdn.rswtChkPolGuide?.length > 0)
|
||||
handleRswtClick(rswtChkgdn.rswtChkPolGuide[0]);
|
||||
}, [rswtChkgdn.rswtChkPolGuide]);
|
||||
|
||||
|
||||
@@ -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.
Binary file not shown.
@@ -53,7 +53,8 @@ export const excelArrayStyle = async (data: ArrayBuffer, range: SheetParameter[]
|
||||
if (item.data && item.data.length > 0) {
|
||||
const numCols = item.data[0]?.length || 0;
|
||||
const numRows = item.data.length;
|
||||
const dataRange = workbook.activeSheet(index)?.sheet(index)?.range(`A1:${String.fromCharCode(65 + numCols - 1)}${numRows}`);
|
||||
const lastColLetter = getExcelColumnLetter(numCols);
|
||||
const dataRange = workbook.activeSheet(index)?.sheet(index)?.range(`A1:${lastColLetter}${numRows}`);
|
||||
dataRange?.style((styleQ) => {
|
||||
styleQ.verticalAlignment("center");
|
||||
});
|
||||
@@ -62,4 +63,60 @@ export const excelArrayStyle = async (data: ArrayBuffer, range: SheetParameter[]
|
||||
}
|
||||
makeExcelFile(workbook, fileNm)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const excelStyleWithKoreanHeaders = async (
|
||||
data: ArrayBuffer,
|
||||
range: string = "A1:V3",
|
||||
fileNm: string,
|
||||
headerMapping: { [key: string]: string },
|
||||
sampleData: any
|
||||
) => {
|
||||
const workbook = await XlsxPopulate.Workbook.fromData(data);
|
||||
const sheet = workbook.activeSheet();
|
||||
|
||||
if (!sheet) {
|
||||
throw new Error('워크시트를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
// 1. 영문 헤더를 한글로 교체
|
||||
const englishHeaders = Object.keys(sampleData);
|
||||
englishHeaders.forEach((englishHeader, index) => {
|
||||
const koreanHeader = headerMapping[englishHeader] || englishHeader;
|
||||
const cellAddress = String.fromCharCode(65 + index) + '1'; // A1, B1, C1, ...
|
||||
sheet.cell(cellAddress).value(koreanHeader);
|
||||
});
|
||||
|
||||
// 2. 헤더 스타일 적용
|
||||
const headerCells = sheet.range(range);
|
||||
headerCells?.style((styleQ) => {
|
||||
makeCellStyle(styleQ);
|
||||
});
|
||||
|
||||
// 3. 모든 데이터 셀에 세로 가운데 정렬 적용
|
||||
const numCols = englishHeaders.length;
|
||||
const numRows = sheet.usedRange()?.endCell()?.rowNumber() || 1;
|
||||
|
||||
if (numRows > 1) {
|
||||
const dataRange = sheet.range(`A1:${String.fromCharCode(65 + numCols - 1)}${numRows}`);
|
||||
dataRange?.style((styleQ) => {
|
||||
styleQ.verticalAlignment("center");
|
||||
styleQ.borderEach({ style: "thin", color: { rgb: "CCCCCC" } });
|
||||
});
|
||||
}
|
||||
|
||||
// 4. 파일 다운로드
|
||||
await makeExcelFile(workbook, fileNm);
|
||||
};
|
||||
|
||||
|
||||
const getExcelColumnLetter = (colIndex: number): string => {
|
||||
let letter = '';
|
||||
while (colIndex > 0) {
|
||||
const mod = (colIndex - 1) % 26;
|
||||
letter = String.fromCharCode(65 + mod) + letter;
|
||||
colIndex = Math.floor((colIndex - 1) / 26);
|
||||
}
|
||||
return letter;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as XLSX from 'xlsx';
|
||||
import { excelArrayStyle, excelStyle } from './excelStyle';
|
||||
import { excelArrayStyle, excelStyle, excelStyleWithKoreanHeaders } from './excelStyle';
|
||||
|
||||
type ExcelDownloadProps = {
|
||||
data: JSON | JSON[];
|
||||
@@ -164,4 +164,38 @@ export const filePickedBlobArray = (oFile: ArrayBuffer, fileNm: string, sheetArr
|
||||
});
|
||||
await excelArrayStyle(XLSX.write(wb, { bookType: "xlsx", type: "buffer" }), sheetArray, fileNm)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
type ExcelDownloadWithHeaderProps = {
|
||||
data: JSON | JSON[];
|
||||
fileName: string;
|
||||
sheetNameArray: string[];
|
||||
headerRange?: string;
|
||||
headerMapping: { [key: string]: string };
|
||||
}
|
||||
|
||||
export const downloadExcelWithKoreanHeaders = async ({
|
||||
data,
|
||||
fileName = new Date().getTime().toString() + '.xlsx',
|
||||
sheetNameArray = ["Sheet1"],
|
||||
headerRange = 'A1:V3',
|
||||
headerMapping
|
||||
}: ExcelDownloadWithHeaderProps) => {
|
||||
|
||||
const dataArray = Array.isArray(data) ? data : [data];
|
||||
|
||||
if (dataArray.length === 0) {
|
||||
throw new Error('데이터가 없습니다.');
|
||||
}
|
||||
|
||||
// 1. 원본 데이터로 워크시트 생성
|
||||
const worksheet = XLSX.utils.json_to_sheet(dataArray);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, sheetNameArray[0]);
|
||||
|
||||
// 2. 워크북을 ArrayBuffer로 변환
|
||||
const buffer = XLSX.write(workbook, { bookType: "xlsx", type: "buffer" });
|
||||
|
||||
// 3. 헤더만 한글로 교체하는 커스텀 스타일 함수 호출
|
||||
await excelStyleWithKoreanHeaders(buffer, headerRange, fileName, headerMapping, dataArray[0]);
|
||||
};
|
||||
@@ -308,7 +308,6 @@ export const FileUploaderItem = forwardRef<
|
||||
{children}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
"absolute",
|
||||
"!w-1/5 z-50",
|
||||
|
||||
@@ -381,7 +381,6 @@ function Gis({
|
||||
{isSearch && (
|
||||
<div className="absolute right-8 top-[305px] z-20">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsSearchModalOpen(true)}
|
||||
className="overflow-hidden w-[40px] h-[40px] bg-white
|
||||
border border-[#9aa7b8]
|
||||
|
||||
@@ -56,7 +56,6 @@ export default function GisContent({ edit = false, onFeatureSelect, isSearch, se
|
||||
{isSearch && (
|
||||
<div className="absolute right-8 top-[254px] z-20">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsSearchModalOpen(true)}
|
||||
className="overflow-hidden w-[40px] h-[40px] bg-white
|
||||
border border-[#9aa7b8]
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
// <TabsTrigger value="layers" className="flex-1 h-10">레이어</TabsTrigger>
|
||||
// {/* {isSearch && (
|
||||
// <button
|
||||
// type="button"
|
||||
// onClick={() => setIsSearchModalOpen(true)}
|
||||
// className="h-10 w-10 flex items-center justify-center px-0"
|
||||
// >
|
||||
|
||||
@@ -24,8 +24,8 @@ const SelectBox = React.forwardRef<
|
||||
|
||||
return (
|
||||
<div className={className+" flex items-center"} ref={ref}>
|
||||
{label && <Label className="w-20 text-xl text-gray-600">{label}</Label>}
|
||||
<Select onValueChange={onSelectValue} value={value !== undefined ? String(value) : undefined} disabled={readOnly}>
|
||||
{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} />
|
||||
</SelectTrigger>
|
||||
|
||||
@@ -19,6 +19,8 @@ type UiTableProps = {
|
||||
resetPageNo?: boolean;
|
||||
children?: React.ReactNode | undefined;
|
||||
boldArray?: number[];
|
||||
resetSelection?: boolean;
|
||||
index?:number;
|
||||
}
|
||||
|
||||
type UiHeadProps = {
|
||||
@@ -28,9 +30,9 @@ type UiHeadProps = {
|
||||
visible?:boolean;
|
||||
}
|
||||
|
||||
export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [] }: UiTableProps) {
|
||||
export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false, index=-1 }: UiTableProps) {
|
||||
const [cur, setCur] = useState<number>(1);
|
||||
const [idx, setIdx] = useState<number>(-1);
|
||||
const [idx, setIdx] = useState<number>(index);
|
||||
const [isCheck, seIsCheck] = useState<boolean>(false);
|
||||
|
||||
|
||||
@@ -41,6 +43,12 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr
|
||||
}
|
||||
}, [onPageChange, resetPageNo]);
|
||||
|
||||
useEffect(() => {
|
||||
if (resetSelection) {
|
||||
setIdx(-1);
|
||||
}
|
||||
}, [resetSelection]);
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
setCur(page);
|
||||
onPageChange(page);
|
||||
|
||||
Reference in New Issue
Block a user