Merge remote-tracking branch 'origin/iipbs/wr/hasuReg' into iipbs/wr/gis

This commit is contained in:
swcho
2025-06-20 10:22:19 +09:00
120 changed files with 9918 additions and 3575 deletions
+674
View File
@@ -0,0 +1,674 @@
"use client";
import { useWrStore } from "@/app/store";
import {
DmdCoReqSchema,
type DedMatUpdateType,
type DmdCoReqType,
type DmdMatTableType,
} from "@/app/store/matDmd/coMatRvw/type";
import { formH1Class, formTableName } from "@/components/lib/class/comClass";
import {
getCity,
getdmdMatFlag,
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,
FormField,
FormUi,
ScrollArea,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiModal,
UiTable,
type SelectDataType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, Input, Label } from "@common/components/ui";
import { useEffect, useRef, useState } from "react";
import { useForm } from "react-hook-form";
import toast, { Toaster } from "react-hot-toast";
import { z } from "zod";
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";
export default function CoMatRvw() {
const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } =
useWrStore((state) => state);
const { coMatRvwRes } = coRvw;
//init, sub, match
const initRef = useRef<boolean>(false);
const { coRvwHeadList } = coRvw;
const [pageNation, setPageNatiion] = useState<number>(1);
const [dmdCoNm, setDmdCoNm] = useState<string>("");
const [dmdMatData, setDmdMtaData] = useState<DmdMatTableType[]>([]);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
const [objSearch, setObjSearch] = useState<objSearchType>({
sgg: "",
city: "",
});
const [fromDate, setFromDate] = useState<string>(
String(new Date().getFullYear())
);
const [toDate, setToDate] = useState<string>(
String(new Date().getFullYear())
);
const [selectData, setSelectData] = useState<DmdCoReqType>(
{} as DmdCoReqType
);
const getSearch = (
startYear: number,
endYear: number,
sggCd: string,
dmdCoNm: string
) => {
if (dmdCoNm.length > 0) {
coMatRvwSearch(
pageNation,
13,
String(startYear),
String(endYear),
sggCd,
dmdCoNm
);
} else {
coMatRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd);
}
};
const form = useForm<z.infer<typeof DmdCoReqSchema>>({
resolver: zodResolver(DmdCoReqSchema),
});
const TableCellClick = (index: number) => {
console.log(coMatRvwRes);
if (coMatRvwRes && coMatRvwRes[index]) {
setSelectData(coMatRvwRes[index]);
}
};
useEffect(() => {
if (form?.getValues("useUsgCd")) {
form.setValue(
"demandCst.usgPrcsProcs",
usageProcData?.find(
(item) => item.usage === (form?.getValues("useUsgCd") as string)
)?.process ?? ""
);
}
}, [form.watch("useUsgCd")]);
useEffect(() => {
if (coMatRvwRes) {
const data = coMatRvwRes?.map((item, index) => {
let flag = "";
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??"");
return {
...item,
ctpvCd: item.demandCo?.ctpvCd,
sggCd: item.demandCo?.sggCd,
dmdCoNm: item.demandCo?.dmdCoNm,
daddr: item.demandCo?.daddr,
telno: item.demandCo?.telno,
regDt: moment(item?.demandCo?.regDt).format("YYYY-MM-DD"),
splyFcltFlg: flag,
};
});
setDmdMtaData(tableData(data, { code }));
}
}, [coMatRvwRes]);
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "" });
};
const getSgg = (val: string | number) => {
setObjSearch({ ...objSearch, sgg: String(val) });
};
useEffect(() => {
if (!initRef.current) {
coMatRvwInit(1, 13, fromDate, toDate);
initRef.current = true;
}
}, [coMatRvwInit, initRef, fromDate, toDate]);
useEffect(() => {
if (selectData) {
console.log(selectData);
form.reset(selectData);
}
}, [selectData, form]);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"수요매칭검토"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl ml-4"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<div className="col-span-7 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600 mx-6">
하수 재이용년도
</Label>
<SelectBox
className="h-full w-32 text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={fromDate}
onSelectValue={(val: string | number) =>
setFromDate(String(val))
}
/>
<span className="mx-6">~</span>
<SelectBox
className="h-full w-32 text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={toDate}
onSelectValue={(val: string | number) =>
setToDate(String(val))
}
/>
<div className="col-span-2 ml-6">
<SearchInput
className={"text-2xl"}
label="회사명"
textValue={dmdCoNm}
setText={setDmdCoNm}
/>
</div>
</div>
</div>
</div>
</SearchFormLeft>
<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
size={"sm"}
onClick={(e) => {
if (fromDate && toDate) {
const fromNum = Number(fromDate);
const toNum = Number(toDate);
if (fromNum > toNum) {
toast.error(
"시작년도가 종료년도 이후로 설정할 수 없습니다."
);
} else {
let con: string | number = "";
if (String(objSearch.city).length > 0) {
con = String(objSearch.city);
}
if (String(objSearch.sgg).length > 0 && String(objSearch.sgg) !== "0") {
con = String(objSearch.sgg);
}
getSearch(fromNum, toNum, con, dmdCoNm);
}
}
}}
>
조회
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 g ap-4">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={"수요매칭검토현황"}
tableData={dmdMatData || []}
headlist={coRvwHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
if (index !== undefined && index >= 0) {
TableCellClick(index);
}
}}
onPageChange={() => {}}
></UiTable>
</ListDiv>
<hr />
<ScrollArea className="h-[49vh]">
<ListDiv>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
수요신청 상세현황
</h3>
<Form {...form}>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="demandCo.regDt"
render={({ field }) => (
<FormUi label="요구시기">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(String(e.target.value));
}}
value={
moment(field.value).format("YYYY-MM-DD") ?? ""
}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndQty"
render={({ field }) => (
<FormUi label="요구수량(M3/d)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="사용용도">
<Input
placeholder=""
type="text"
step="0.1"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="wntUntprc"
render={({ field }) => (
<FormUi label="희망단가(원/m3)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>요구수질</h1>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="grssClfg"
render={({ field }) => (
<FormUi label="총대장균군수 (개/100ml)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="combResdch"
render={({ field }) => (
<FormUi label="결합잔류염소(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="trbt"
render={({ field }) => (
<FormUi label="탁도(NTU)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="blgcOxygDmndQnt"
render={({ field }) => (
<FormUi label="생물학적 산소요구량(BOD)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="smll"
render={({ field }) => (
<FormUi label="냄새">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="crmty"
render={({ field }) => (
<FormUi label="색도(도)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="tn"
render={({ field }) => (
<FormUi label="총질소 (T-N)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="tph"
render={({ field }) => (
<FormUi label="총인(T-P)(mg/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="ph"
render={({ field }) => (
<FormUi label="수소이온농도(pH)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="clIonQnt"
render={({ field }) => (
<FormUi label="염화물(mgCL/L)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="cdtnv"
render={({ field }) => (
<FormUi label="전기전도도(㎲/cm)">
<Input
placeholder=""
type="number"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="rmrk"
render={({ field }) => (
<FormUi label="비고">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>공급처 후보지</h1>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${0}`}
render={({ field }) => (
<FormUi label="후보지1">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(String(e.target.value));
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${1}`}
render={({ field }) => (
<FormUi label="후보지2">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${2}`}
render={({ field }) => (
<FormUi label="후보지3">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
</div>
</Form>
<ConCostForm form={form} type={"mat"} />
</ListDiv>
</ScrollArea>
</div>
</div>
</ContentsDiv>
<Toaster position="top-center" />
</>
);
}
@@ -0,0 +1,126 @@
"use client";
import { useWrStore } from "@/app/store";
import { ruseUtzType } from "@/app/store/matDmd/ruseCaseMng/headList";
import { getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useState } from "react";
export default function RuseCaseMng() {
const { code,ruseCase} = useWrStore((state) => state);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const [selectUtz, setSelectUtz] = useState<string[] | []>()
const [searchTxt, setSearchTxt] = useState<string>()
const getSelCity = (val: string | number) => {
const cityValue = String(val);
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
setObjSearch({ ...objSearch, sgg: String(val) })
};
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"물재이용사례 관리"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-8 flex flex-row">
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="용도"
selectClass={""}
selectArray={ruseUtzType}
onSelectValue={(val) => {
if(val)
setSelectUtz([String(val)])}}
/>
<SearchInput
className={"text-2xl"}
label="수요처명"
textValue={""}
setText={(e) => {
setSearchTxt(e)
}}
/>
</div>
</SearchFormLeft>
<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
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
엑셀등록
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
다운로드
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
양식받기
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={"물재이용사례 현황"}
tableData={[]}
children={undefined}
headlist={ruseCase.ruseHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
}}
onPageChange={() => { }}
></UiTable>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
@@ -0,0 +1,341 @@
"use client";
import { useWrStore } from "@/app/store";
import {
DmdCoReqSchema,
type DmdCoReqType,
type RvwHistTableType,
} from "@/app/store/matDmd/coMatRvw/type";
import {
getCity,
getdmdMatFlag,
yearOptions,
} from "@/components/lib/func/commom";
import ConCostForm from "@/components/ui/form/coMat/conCostForm/conCostForm";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiTable,
type SelectDataType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Input, Label } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import moment from "moment";
import { useCallback, useEffect, useState } from "react";
import { set, useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
import { tableData } from "@/components/lib/func/commom";
import toast, { Toaster } from "react-hot-toast";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
export default function RuseRvwHstry() {
const {
code,
ruseHist,
ruseRvwHistInit,
ruseRvwSearch,
ruseRvwInqua,
ruseRvwComplete,
} = useWrStore((state) => state);
const { rvwHistRes, ruseHistHeadList } = ruseHist;
const [pageNation, setPageNatiion] = useState<number>(1);
const [dmdCoNm, setDmdCoNm] = useState<string>("");
const [ruseUtztnFcltNm, setRuseUtztnFcltNm] = useState<string>("");
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
const [objSearch, setObjSearch] = useState<objSearchType>({
sgg: "",
city: "",
});
const [fromDate, setFromDate] = useState<string>(
String(new Date().getFullYear())
);
const [toDate, setToDate] = useState<string>(
String(new Date().getFullYear())
);
const [rvwHistData, setRvwHistData] = useState<RvwHistTableType[]>();
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "0" });
};
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) });
};
const getSearch = (
startYear: number,
endYear: number,
sggCd: string,
dmdCoNm: string,
ruseUtztnFcltNm: string
) => {
if (dmdCoNm || ruseUtztnFcltNm) {
ruseRvwSearch(
pageNation,
13,
String(startYear),
String(endYear),
sggCd,
dmdCoNm,
ruseUtztnFcltNm
);
} else {
console.log("시도코드", sggCd);
ruseRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd);
}
};
const form = useForm<DmdCoReqType>({
resolver: zodResolver(DmdCoReqSchema),
mode: "onChange",
});
const TableCellClick = useCallback(
(index: number | undefined) => {
if (
index !== undefined &&
index >= 0 &&
rvwHistRes &&
rvwHistRes[index]
) {
form.reset(rvwHistRes[index]);
}
},
[rvwHistRes, form]
);
const confrirmToast = () => {
const completeData = rvwHistData
?.map((item) => {
form.clearErrors;
if (item?.completeYn) {
return item.dmdInfoSn;
}
})
.filter((item) => item !== undefined);
if (form.formState.isDirty) {
toast((t) => (
<span className="flex flex-col items-center">
표준공사비 정보가 변경되었습니다. 검토 완료 진행시 입력한 정보는
초기화 됩니다.
<br />
진행하시겠습니까?
<button
onClick={() => {
toast.dismiss(t.id);
ruseRvwComplete(completeData as string[]);
}}
>
확인
</button>
<button onClick={() => toast.dismiss(t.id)}>취소</button>
</span>
));
} else {
ruseRvwComplete(completeData as string[]);
}
};
useEffect(() => {
if (!ruseHist.isInit) {
ruseRvwHistInit(
1,
13,
new Date().getFullYear().toString(),
new Date().getFullYear().toString()
);
}
}, [ruseHist.isInit]);
useEffect(() => {
if (rvwHistRes) {
const data = rvwHistRes?.map((item, index) => {
let flag = "";
flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? "");
console.log("flag", flag);
return {
...item,
ctpvCd: item.demandCo?.ctpvCd,
sggCd: item.demandCo?.sggCd,
dmdCoNm: item.demandCo?.dmdCoNm,
daddr: item.demandCo?.daddr,
telno: item.demandCo?.telno,
regDt: item?.demandCo?.regDt
? moment(item?.demandCo?.regDt).format("YYYY-MM-DD")
: "없음",
rvwCmptnYmd: item?.rvwCmptnYmd
? moment(item?.rvwCmptnYmd).format("YYYY-MM-DD")
: "없음",
mtchnCmptnYmd: item?.mtchnCmptnYmd
? moment(item?.mtchnCmptnYmd).format("YYYY-MM-DD")
: "없음",
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
dmndQty: item.dmndQty,
splyFcltFlg: flag,
completeYn: false,
} as unknown as RvwHistTableType;
});
setRvwHistData(tableData(data, { code }));
}
}, [rvwHistRes]);
useEffect(() => {}, [form.formState]);
useEffect(() => {
console.log("변경여부 ", form.formState.isDirty);
}, [form.formState]);
return (
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"재이용검토이력"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="w-80 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
>
{""}
</SelectBox>
<SelectBox
className="w-80 h-full text-2xl ml-4"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
>
{""}
</SelectBox>
<div className="col-span-4 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600 ml-4 mr-4">
수요신청년도
</Label>
<div className="flex flex-row mt-2">
<SelectBox
className="h-full w-32 text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={fromDate}
onSelectValue={(val: string | number) =>
setFromDate(String(val))
}
/>
<span className="mx-6">~</span>
<SelectBox
className="h-full w-32 text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={toDate}
onSelectValue={(val: string | number) =>
setToDate(String(val))
}
/>
<SearchInput
className={"text-2xl w-60 ml-4 "}
label="시설명"
textValue={ruseUtztnFcltNm}
setText={setRuseUtztnFcltNm}
/>
<SearchInput
className={"text-2xl w-60 ml-4 "}
label="회사명"
textValue={dmdCoNm}
setText={setDmdCoNm}
/>
</div>
</div>
</div>
</div>
</SearchFormLeft>
<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
size={"sm"}
onClick={(e) => {
if (fromDate && toDate) {
const fromNum = Number(fromDate);
const toNum = Number(toDate);
if (fromNum > toNum) {
toast.error(
"시작년도가 종료년도 이후로 설정할 수 없습니다."
);
} else {
let con: string | number = "";
if (String(objSearch.city).length > 0) {
con = String(objSearch.city);
}
if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") {
con = String(objSearch.sgg);
}
getSearch(
fromNum,
toNum,
con,
dmdCoNm,
ruseUtztnFcltNm
);
}
}
}}
>
조회
</Button>
<Button size={"sm"} onClick={confrirmToast}>
검토완료
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={"재이용검토현황"}
tableData={rvwHistData || []}
headlist={ruseHistHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
TableCellClick(index);
}}
onPageChange={setPageNatiion}
></UiTable>
<hr />
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
수요신청 상세현황
</h3>
<ConCostForm form={form} type={"hist"} />
</ListDiv>
</div>
</div>
<Toaster position="top-center" />
</ContentsDiv>
);
}
+261
View File
@@ -0,0 +1,261 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import {
excelDownload,
getCity,
getCityOrSgg,
tableData,
} from "@/components/lib/func/commom";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiModal,
UiTable,
type SelectDataType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useState } from "react";
import SdmInsertForm, {
} from "@common/business_components/ui/sdmInsertForm";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import toast, { Toaster } from "react-hot-toast";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import { fetchType, getFetch } from "@/components/lib/api";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
export default function CoSttn() {
const {
code,
coSttn,
coSttnInit,
coSttnSearch,
getDemandCompList,
regDemandCompany,
updateDemandCompany,
coSttnTxtSearch,
checkDemand,
demandCompList,
dmdIsSucees
} = useWrStore((state) => state);
const [bdstTable, setBdstTable] = useState<DemandCompType[]>();
const [pageNation, setPageNation] = useState(1);
const { coSttnRes } = coSttn;
const [isDmdModal, setIsDmdModal] = useState<{
isMoal: boolean;
data: DemandCompType;
}>({ isMoal: false, data: {} as DemandCompType });
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
const [objSearch, setObjSearch] = useState<objSearchType>({
sgg: "",
city: "",
});
const [seartchTxt, setSearchTxt] = useState<string>();
const [upadateData, setUpdateData] = useState<DemandCompType>();
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "" });
};
const getSgg = (val: string | number) => {
setObjSearch({ ...objSearch, sgg: String(val) });
};
useEffect(() => {
if (!coSttn.isInit) {
coSttnInit("1", "13", "0");
}
}, [coSttn.isInit, coSttnInit]);
useEffect(() => {
if (coSttnRes?.length > 0 && code.cityCd.length > 0) {
const data = tableData(coSttnRes, { code });
const chData = data.map((item: any) => ({
...item,
}));
// .filter((item: any) => item !== undefined);
setBdstTable(chData);
} else if (coSttnRes.length == 0) {
setBdstTable([]);
}
}, [coSttnRes]);
useEffect(() => {
if (coSttn.excelList.length > 0) {
if (coSttn.excelList.length === 0) return;
excelDownload(
coSttn.excelList,
"수요처 관리",
"sample_coSttn.xlsx",
"A1:F1",
2
);
}
}, [coSttn.excelList]);
const excelClick = useCallback(() => {
const con = objSearch.sgg ? objSearch.sgg : objSearch.city;
if (con) coSttnSearch("1", "10000", String(con));
}, [coSttnSearch, objSearch.city, objSearch.sgg]);
const searchClick = () => {
const con = objSearch.sgg ? objSearch.sgg : objSearch.city;
if (con) {
if (seartchTxt && seartchTxt?.length > 0) {
coSttnTxtSearch("1", "13", String(con), seartchTxt ?? "");
} else {
coSttnSearch("1", "13", String(con));
}
}
};
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"수요처 관리"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<SearchInput
className={"!text-3xl"}
label="회사명"
textValue={seartchTxt ?? ""}
setText={(e) => {
setSearchTxt(e);
}}
/>
</div>
</SearchFormLeft>
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button size={"sm"} onClick={searchClick}>
조회
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => {
setUpdateData(undefined);
setIsDmdModal({ ...isDmdModal, isMoal: true });
}}
>
등록
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => {
/* 저장 로직 */
if (!upadateData) {
<ToastFormUi body={"수요처 변경을 원하는 행을 선택해주세요"} title={"수요처관리"}></ToastFormUi>;
}else{
setIsDmdModal({
...isDmdModal,
isMoal: true})
}
}}
>
저장
</Button>
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={excelClick}
>
다운로드
</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
headlist={coSttn.coSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined, headId: string) => {
setUpdateData(coSttnRes[index as number]);
}}
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
</div>
<UiModal
bodyClass={"w-[40vw] max-w-none h-[90vh]"}
open={isDmdModal.isMoal}
onOpenChange={() => {
setIsDmdModal({ isMoal: false, data: {} as DemandCompType });
}}
body={
<SdmInsertForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
dataList={demandCompList}
rtnValue={(searchText: string, pageCnt: number) => {
getDemandCompList(searchText, pageCnt);
}}
rtnInputData={ async(data) => {
if(upadateData?.dmdInfoPk){
updateDemandCompany(data as DemandCompType)
}else{
const dmd= await getFetch(fetchType.WR,`/reuseFc/request/${data.dmdInfoPk}`)
if(dmd) {
toast.error(`사업자번호 ${dmd.dmdInfoPk}는 이미 등록되었습니다. 다시등록해주세요`)
return
}
regDemandCompany(data as DemandCompType);
}
if(dmdIsSucees ==='success'){
toast.success(`수요처 등록 및 수정 완료되었습니다..`)
setIsDmdModal({ isMoal: false, data: data as DemandCompType });
}else{
toast.error(`수요처 등록 및 수정 에러입니다.`)
}
}}
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
updateList={upadateData}
></SdmInsertForm>
}
></UiModal>
</ContentsDiv>
<Toaster position="top-center" />
</>
);
}
+132
View File
@@ -0,0 +1,132 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import type { customCoSttnBdst } from "@/app/store/matDmd/coSttn";
import { drgtHeadListExport } from "@/app/store/matDmd/drgtSttn/headList";
import { excelDownload, getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Label } from "@common/components/ui";
import { useCallback, useState } from "react";
export default function DrgtSttn() {
const { code, } = useWrStore((state) => state);
const [fromDate, setFromDate] = useState<Date>(new Date());
const [toDate, setToDate] = useState<Date>(new Date());
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>();
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) })
};
const excelClick = useCallback(() => {
excelDownload(
[[]],
"우리동네가뭄",
"sample_drgtSttn.xlsx",
"A1:H1"
);
}, []);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"우리동네가뭄"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<div className="col-span-5 w-auto">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">조회기간</Label>
<div className="flex flex-row w-1/4">
<DatePicker mode={'single'}
selected={fromDate}
onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} />
<span>~</span>
<DatePicker mode={'single'}
selected={toDate}
onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} />
</div>
</div>
</div>
</div>
</SearchFormLeft>
<SearchFormRight
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => { }}
>
상세보기
</Button>
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={excelClick}
>
다운로드
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => { }}
>
지도보기
</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={[]}
headlist={drgtHeadListExport}
pageSize={20}
total={10000}
cellClick={(index: number | undefined, headId: string) => { }}
onPageChange={() => { }}
></UiTable>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
@@ -0,0 +1,239 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import { type customLdrmntBdst } from "@/app/store/matDmd/ldrmntCoSttn";
import { ldrmntNodeListExport } from "@/app/store/matDmd/ldrmntCoSttn/headList";
import {
excelDownload,
getCity,
tableData
} from "@/components/lib/func/commom";
import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcelModal";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiModal,
UiTable,
type ReturnType,
type SelectDataType
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
export default function LdrmntCoSttn() {
const { code, ldrmnt, ldrmntInit, ldrmntSearch, } = useWrStore(
(state) => state
);
const { ldrmntRes } = ldrmnt;
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customLdrmntBdst | undefined }>({ data: undefined, isOpen: false })
const [pageNation, setPageNation] = useState(1);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const ref = useRef<ReturnType>({} as ReturnType);
const [bdstTable, setBdstTable] = useState<customLdrmntBdst[]>();
const [codeData, setCodeData] = useState<string>();
const [searchTxt, setSearchTxt] = useState<string>();
const [bdstChgProps, setBdstChgProps] = useState<{
isOpen: boolean;
data: customLdrmntBdst[];
}>({ isOpen: false, data: [] });
const excelClick = useCallback(() => {
excelDownload(
[[]],
"잠재수요처 관리",
"sample_ldrmnt.xlsx",
"A1:AL1",
2
);
}, []);
const [isExcelOpen, setIsExcelOpen] = useState<{
isModal: boolean;
}>({ isModal: false });
const cellClick = (index: number | undefined, headId: string) => {
if (index !== undefined) {
setDetailModal({ isOpen: true, data: ldrmntRes[index] });
}
}
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
setObjSearch({ ...objSearch, sgg: String(val) })
};
useEffect(() => {
if (!ldrmnt.isInit) {
ldrmntInit();
}
}, [ldrmnt.isInit, ldrmntInit]);
useEffect(() => {
const data = tableData(ldrmntRes, { code });
const tbData = Array.isArray(data)
? data.map((item: customLdrmntBdst) => ({
...item,
ctpvCd: item.fctryAddr.split(" ")[0] || "",
sggCd: item.fctryAddr.split(" ")[1] || ""
}))
: [];
setBdstTable(tbData);
}, [ldrmntRes, code]);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"잠재수요처 관리"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl ml-4"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<SearchInput
className={"text-2xl ml-4"}
label="회사명"
textValue={searchTxt || ""}
setText={(e) => {
setSearchTxt(e);
}}
/>
</div>
</SearchFormLeft>
<SearchFormRight
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
onClick={(e) => {
let cityTxt = ''
let sggTxt = ''
if (objSearch?.city.toString().length > 0) {
cityTxt = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? '';
}
if (objSearch?.sgg.toString().length > 1) {
sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? '';
}
let url = ""
if (sggTxt !== "0") {
url = cityTxt + " " + sggTxt
} else {
url = cityTxt
}
if (url) {
if(cityTxt === '') url = "0";
ldrmntSearch(url, searchTxt || "");
}
}}
>
조회
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => {
setIsExcelOpen({ isModal: true });
}}
>
엑셀등록
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => {
/* 저장 로직 */
}}
>
다운로드
</Button>
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={excelClick}
>
양식받기
</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<div className="overflow-x-auto">
<ListDiv className="min-w-max">
<UiTable
headName={[]}
tableData={bdstTable || []}
headlist={ldrmntNodeListExport}
pageSize={20}
total={10000}
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
onPageChange={setPageNation}
/>
</ListDiv>
</div>
</div>
<UiModal
open={detailModal.isOpen}
onOpenChange={() => {
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen })
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<CoDetailModal formObj={detailModal.data} />}
/>
<UiModal
open={isExcelOpen.isModal}
onOpenChange={() => {
setIsExcelOpen({ isModal: !isExcelOpen.isModal })
}}
bodyClass={"w-[40vw] max-w-none"}
body={<CoRegExcel />}
/>
</div>
</ContentsDiv>
</>
)
}
-409
View File
@@ -1,409 +0,0 @@
"use client";
import { useWrStore } from "@/app/store";
import { formTableName } from "@/components/lib/class/comClass";
import { getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Input, Label } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
export default function coMatRvw() {
const { code, coRvw, } = useWrStore((state) => state);
const { coRvwHeadList, } = coRvw;
const [fromDate, setFromDate] = useState<Date>(new Date());
const [toDate, setToDate] = useState<Date>(new Date());
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const schema = z.object({
fcltCpct: z.number().optional(),
});
const form = useForm<z.infer<typeof schema>>({
resolver: zodResolver(schema),
defaultValues: {
fcltCpct: 0,
}
});
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) })
};
const {
fields: [],
append,
remove,
} = useFieldArray({
control: form.control,
name: "",
});
useEffect(() => {
if (fromDate > toDate) {
const newFromDate = new Date(toDate);
newFromDate.setDate(toDate.getDate() - 1);
setFromDate(newFromDate);
}
}, [toDate]);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"수요매칭검토"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-8 flex flex-row">
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<div className="col-span-5 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">수요신청년도</Label>
<div className="flex flex-row">
<DatePicker mode={'single'}
selected={fromDate}
onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} />
<span>~</span>
<DatePicker mode={'single'}
selected={toDate}
onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} />
</div>
</div>
</div>
<SearchInput
className={"text-2xl"}
label="회사명"
textValue={""}
setText={(e) => {
}}
/>
</div>
</SearchFormLeft>
<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
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={"수요매칭검토현황"}
tableData={[]}
children={undefined}
headlist={coRvwHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
}}
onPageChange={() => { }}
></UiTable>
<hr />
<Form {...form}>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">표준공사비 산정</h3>
<div className="flex items-center mx-3 mb-3">
<h1 className="">처리시설 표준공사비 산정</h1>
<Button
size={"sm"}
onClick={(e) => { }}
>
계산
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
저장
</Button>
</div>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="용도">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="요구수량(M3/d)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<Label className="">용도에 따른 처리공정<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value || ""}
className="mt-2"
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="처리시설 용량(요구수량 * 365일)">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>처리시설용량에 따른 공사비(백만원)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
공사비 산정표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>시설부대경비 요율(%)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
>
요율표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
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-3 mt-4">
<Label>총사업비 (백만원)<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
className="mt-2"
type="number"
step="0.01"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>공급처 선정</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
후보지 선택
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<div>
<FormField
control={form.control}
name=""
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="mt-4">
<Label>관로 표준공사비 산정 프로그램</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
다운로드
</Button>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<Label className="text-xl">처리시설 + 공급관로 총사업비(백만원)
<FormUi label="">
<Input
placeholder=""
type="text"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
readOnly={true}
value={field.value ?? 0}
/>
</FormUi>
</Label>
)}
/>
</div>
</div>
</div>
</Form>
</ListDiv>
</div>
</div>
</ContentsDiv >
</>
)
}
-84
View File
@@ -1,84 +0,0 @@
"use client";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import {
Form,
FormField,
FormUi,
ScrollArea,
SelectBox,
} from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { CoRegForm } from "@/components/ui/form/matDmd/coRegForm/component";
import toast, { Toaster } from "react-hot-toast";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
const formSchema = z.object({
ctpv: z.string(),
sgg: z.string(),
coNm: z.string().min(1).max(20),
bznmNo: z.string().min(1).min(9).max(12),
addr: z.string().min(1).min(6).max(20),
telNo: z.string().min(8).max(12),
});
export default function MyForm() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
coNm:'',
bznmNo:'',
addr:'',
telNo:'',
},
});
function onSubmit(values: z.infer<typeof formSchema>) {
try {
toast.dismiss();
//ToastFormUi("수요신청 화면으로 이동하시겠습니까?", "수요처 등록 완료", "./dmdReg", "이동")
} catch (error) {
console.error("Form submission error", error);
toast.error("수요처 등록이 실패하였습니다.");
}
}
return (
<>
<div className="grid h-40 grid-cols-3 place-content-center">
<h1 className=" col-start-2 col-span-1 text-4xl underline">
수요처 정보입력
</h1>
</div>
<div className="grid grid-cols-5 gap-4 overflow-hidden">
<div className="col-span-1 "/>
<div className="col-span-3 ">
<div>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 max-w-3xl mx-auto"
>
<CoRegForm>{form}</CoRegForm>
<Button type="submit">수요처등록</Button>
</form>
</Form>
</div>
</div>
<div className="col-span-1 " >
<Toaster position="top-center" />
</div>
</div>
</>
);
}
-107
View File
@@ -1,107 +0,0 @@
"use client";
import { useWrStore } from "@/app/store";
import { Button } from "@common/components/ui";
import { btnClass } from "@/app/store/common/code";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import {
ContentsDiv,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
export default function coSttn() {
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [pageNation, setPageNation] = useState(1);
const { code, coSttn } = useWrStore(
(state) => state
);
const ref = useRef<ReturnType>({} as ReturnType);
const excelClick = useCallback(() => {
}, []);
return(
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"수요처 관리"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<div>
<Button
className={btnClass}
onClick={() => {
/* 등록 로직 */
}}
>
등록
</Button>
<Button
className={btnClass}
onClick={() => {
/* 저장 로직 */
}}
>
저장
</Button>
</div>
}
leftChildren={undefined}
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;
}
// coSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={coSttn.coSttNodeList} />
}
headlist={coSttn.coSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined,headId:string)=>{} }
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
-106
View File
@@ -1,106 +0,0 @@
"use client";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import { Form } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { DmdRegForm } from "@/components/ui/form/matDmd/dmdRegform/component";
import toast, { Toaster } from "react-hot-toast";
import { useRouter } from "next/navigation";
const formSchema = z.object({
dmdSel: z.string().min(1),
dmdTmng: z.coerce.date(),
dmdWq: z.string().min(1).optional(),
useUsgCd: z.string(),
wntUntprc: z.string().min(1),
grssClfg: z.string().min(1),
tn: z.string().min(1).optional(),
combResdch: z.string().min(1).optional(),
tp: z.string().min(1).optional(),
trbt: z.string().min(1).optional(),
ph: z.string().min(1).optional(),
bod: z.string().min(1).optional(),
clIonQnt: z.string().min(1).optional(),
smll: z.string().min(1).optional(),
cdtnv: z.string().min(1).optional(),
crmty: z.string().min(1).optional(),
rmrk: z.string().min(1).optional(),
sply1: z.string().min(1).optional(),
sply2: z.string().min(1).optional(),
sply3: z.string().min(1).optional(),
password: z.string().min(1),
});
export default function MyForm() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
dmdSel:'',
dmdTmng: new Date(),
dmdWq: "",
useUsgCd: "",
wntUntprc: "",
grssClfg: "",
tn: "",
combResdch: "",
tp: "",
trbt: "",
ph: "",
bod: "",
clIonQnt: "",
smll: "",
cdtnv: "",
crmty: "",
rmrk: "",
sply1: "",
sply2: "",
sply3: "",
password: "",
},
});
const router = useRouter();
async function onSubmit(values: z.infer<typeof formSchema>) {
try {
toast.success("✅ 수요신청이 완료되었습니다.");
await new Promise((resolve) => setTimeout(resolve, 3000));
router.push("../../")
} catch (error) {
toast.error("수요신청을 다시입력해주시길 바랍니다.");
}
}
return (
<>
<div className="grid h-40 grid-cols-3 place-content-center">
<h1 className=" col-start-2 col-span-1 text-4xl underline">
수요 신청정보입력
</h1>
</div>
<div className="grid grid-cols-5 gap-4 overflow-hidden">
<div className="col-span-1 " />
<div className="col-span-3 max-h-[78vh] overflow-y-scroll ">
<div>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 max-w-3xl mx-auto"
>
<DmdRegForm> {form}</DmdRegForm>
<Button type="submit"> 수요신청</Button>
</form>
</Form>
</div>
</div>
<div className="col-span-1 ">
<Toaster position="top-center" />
</div>
</div>
</>
);
}
@@ -1,147 +0,0 @@
"use client";
import { useWrStore } from "@/app/store";
import { Button } from "@common/components/ui";
import { btnClass } from "@/app/store/common/code";
import ListDiv from "@common/business_components/ui/list_div";
import {
tableData,
} from "@/components/lib/func/commom";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import {
ContentsDiv,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcel";
import { useCallback, useEffect, useRef, useState } from "react";
export default function ldrmntCoSttn() {
const { code, ldrmntCoSttn } = useWrStore(
(state) => state
);
const { ldrmntCoSttnRes } = ldrmntCoSttn;
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customCoBdst|undefined}>({data:undefined,isOpen:false })
const [pageNation, setPageNation] = useState(1);
const [isRegExcel, setIsRegExcel] = useState(false);
const ref = useRef<ReturnType>({} as ReturnType);
const excelClick = useCallback(() => {
}, []);
const cellClick=(index:number|undefined, headId: string)=>{
if(index!==undefined && bdstTable!==undefined){
setDetailModal({isOpen:true ,data:bdstTable[index] })
}
}
useEffect(() => {
if (ldrmntCoSttnRes.length > 0 && code.cityCd.length > 0) {
const data = tableData(ldrmntCoSttnRes, { code });
console.log("data", data);
const chData = data
.map((item: any) => ({
...item
}))
.filter((item: any) => item !== undefined);
setBdstTable(chData);
}
}, [code, ldrmntCoSttnRes, ldrmntCoSttn.ldrmntCoSttHeadList]);
return(
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"잠재수요처 관리"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<div>
<Button
className={btnClass}
onClick={() => setIsRegExcel(!isRegExcel)}
>
엑셀등록
</Button>
<Button
className={btnClass}
onClick={() => {
// 저장 로직
}}
>
양식받기
</Button>
</div>
}
leftChildren={undefined}
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;
}
// ldrmntCoSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={ldrmntCoSttn.ldrmntCoSttNodeList} />
}
headlist={ldrmntCoSttn.ldrmntCoSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
<UiModal
open={detailModal.isOpen}
onOpenChange={()=>{
setDetailModal({...detailModal, isOpen:!detailModal.isOpen})
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<CoDetailModal formObj={detailModal.data}/>}/>
<UiModal
bodyClass={"w-[40vw] max-w-none"}
open={isRegExcel}
body={<CoRegExcel></CoRegExcel>}
onOpenChange={setIsRegExcel}
/>
</div>
</ContentsDiv>
</>
)
}
@@ -1,367 +0,0 @@
"use client";
import { useWrStore } from "@/app/store";
import { formTableName } from "@/components/lib/class/comClass";
import { getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, Form, FormField, FormUi, ScrollArea, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Input, Label } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
export default function ruseRvwHstry() {
const { code, ruseHstry, } = useWrStore((state) => state);
const { ruseHstryHeadList, } = ruseHstry;
const [fromDate, setFromDate] = useState<Date>(new Date());
const [toDate, setToDate] = useState<Date>(new Date());
const schema = z.object({});
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) })
};
const form = useForm<z.infer<typeof schema>>({
resolver: zodResolver(schema),
defaultValues: {
fcltCpct: 0,
}
});
const {
fields: [],
append,
remove,
} = useFieldArray({
control: form.control,
name: "",
});
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"재이용검토이력"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-8 flex flex-row">
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
>
{""}
</SelectBox>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
>
{""}
</SelectBox>
<div className="col-span-5 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">수요신청년도</Label>
<div className="flex flex-row">
<DatePicker mode={'single'}
className="w-full"
selected={fromDate}
onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} />
<span>~</span>
<DatePicker mode={'single'}
selected={toDate}
onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} />
</div>
</div>
</div>
<SearchInput
className={"text-2xl"}
label="시설명"
textValue={""}
setText={(e) => {
}}
/>
<SearchInput
className={"text-2xl"}
label="회사명"
textValue={""}
setText={(e) => {
}}
/>
</div>
</SearchFormLeft>
<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
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
검토완료
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={"재이용검토현황"}
tableData={[]}
children={undefined}
headlist={ruseHstryHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
}}
onPageChange={() => { }}
></UiTable>
<hr />
<Form {...form}>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">수요신청 상세현황</h3>
<h1 className="mt-1 ml-3">표준공사비 산정</h1>
<div className="flex items-center mx-3 mb-3">
<h1 className="">처리시설 표준공사비 산정</h1>
<Button
size={"sm"}
onClick={(e) => { }}
>
재계산
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
저장
</Button>
</div>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="용도">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="요구수량(M3/d)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<Label className="">용도에 따른 처리공정<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value || ""}
className="mt-2"
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="처리시설 용량(요구수량 * 365일)">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>처리시설용량에 따른 공사비(백만원)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
공사비 산정표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>시설부대경비 요율(%)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
>
요율표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
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-3 mt-4">
<Label>총사업비 (백만원)<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
className="mt-2"
type="number"
step="0.01"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>공급처 선정</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
후보지 선택
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<div className="mt-4">
<Label>관로 표준공사비 산정</Label>
</div>
</div>
</div>
</Form>
</ListDiv>
</div>
</div>
</ContentsDiv >
</>
)
}
+39 -5
View File
@@ -48,6 +48,13 @@ export default function Home() {
</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="ruseFcltMng/prfmncSttn/pbnstPrfmncSttn">
하수재이용실적 현황
</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="ruseFcltMng/prfmncReg/chkgdnReg">
@@ -102,19 +109,20 @@ export default function Home() {
<div>
<h2 className="text-xl font-semibold mb-4">수요처 관리</h2>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
<Link href="matMng/coMng/coSttn">수요처 관리</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/coSttn">수요처 관리</Link>
<Link href="matMng/coMng/ldrmntCoSttn">잠재수요처 관리</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/ldrmntCoSttn">잠재수요처 관리</Link>
<Link href="matMng/coMng/drgtSttn">우리동네가뭄</Link>
</Button>
</div>
</div>
@@ -126,12 +134,38 @@ export default function Home() {
<div className="grid grid-cols-12 gap-4">
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/coMatRvw">수요처 매칭 검토</Link>
<Link href="matMng/coMat/coMatRvw">수요처 매칭 검토</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/ruseRvwHstry">재이용검토이력</Link>
<Link href="matMng/coMat/ruseRvwHstry">재이용검토이력</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/coMat/ruseCaseMng">물재이용사례 관리</Link>
</Button>
</div>
</div>
</div>
{/* 통계*/}
<div>
<h2 className="text-xl font-semibold mb-4">통계 매칭</h2>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-2">
<Button className="w-full">
<Link href="stats/rainStat">빗물재이용시설통계</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="stats/rswtStat">중수도시설통계</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="stats/matStat">물재이용사례 관리</Link>
</Button>
</div>
</div>
@@ -20,7 +20,6 @@ import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import { headMakeColSpan } from "../rainReg/TableHead";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
export default function Home() {
+129 -43
View File
@@ -9,26 +9,31 @@ import {
UiModal,
UiTable,
} from "@common/business_components";
import { Button, Input } from "@common/components";
import { Button } from "@common/components";
import { useWrStore } from "../../../store";
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import ListDiv from "@common/business_components/ui/list_div";
import { tableData } from "@/components/lib/func/commom";
import type {
customPbnst,
fcBizSchema,
fcBizType,
PbnstRegArrrayType,
pubHasuType,
ruseFcltType,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import {
pbnstRegZod,
pbnstRegArrayZod,
fcBizSchema,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
import { z } from "zod";
import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal";
import { Toaster } from "react-hot-toast";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import toast, { Toaster } from "react-hot-toast";
import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import { useFieldArray, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
export default function PublicReuseFaciltyInsert() {
const {
@@ -37,9 +42,9 @@ export default function PublicReuseFaciltyInsert() {
searchFclts,
pubHasuInit,
pbnstRegClick,
getSwtrmtFcltNm,
pbnstMngData,
pbnstRuseFcltUpdate,
pubHasuSearch,
pbnstRuseBizUpdate,
} = useWrStore((state) => state);
const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst;
@@ -50,54 +55,68 @@ export default function PublicReuseFaciltyInsert() {
data: pubHasuType;
}>({ isModal: false, data: {} as pubHasuType });
const [indexMng, setIndexMng] = useState<number>(0);
const [indexBiz, setIndexBiz] = useState<number>(0);
const [searchTxt, setSearchTxt] = useState<string>();
const [bdstTable, setbdstTable] = useState<pubHasuType[]>();
const [selectBdst, setSelectBdst] = useState<customPbnst | null>(null);
const [selectRow, setSelectRow] = useState<pubHasuType>();
// const form = useForm<z.infer<typeof pbnstRegArrayZod>>({
// resolver: zodResolver(pbnstRegArrayZod),
// defaultValues: pbnstRegArrayZod.parse([]),
// mode: "onChange",
// });
const form = useForm<{
items: z.infer<typeof pbnstRegZod>[];
}>({
resolver: zodResolver(z.object({ items: pbnstRegArrayZod })),
defaultValues: { items: pbnstRegArrayZod.parse([]) },
mode:"onChange"
});
const {
fields: items,
append,
remove,
} = useFieldArray({
control: form.control,
name: `items`,
});
useEffect(() => {
if (!pbnst.isInit) {
pubHasuInit("1", "11");
}
}, [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 saveRuseData = async ()=>{
const data = writeRgtrAndMdfr(pbnst.pbnstMngRegData)
let bizs =[] as fcBizType[]
data.forEach((fclt) =>{
bizs = [
...bizs,
...fclt.fcBizs
]
})
await pbnstRuseFcltUpdate(data);
await pbnstRuseFcltUpdate(data)
console.log('bizs ', bizs)
await pbnstRuseBizUpdate(bizs)
console.log(' data ', data)
}
await pbnstRuseBizUpdate(bizs);
};
useEffect(() => {
if(code.sggCd.length){
if(searchFclts){
if (code.sggCd.length) {
if (searchFclts) {
setbdstTable(tableData(searchFclts, { code }));
}else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) {
} else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) {
setbdstTable(tableData(pbnstHasuRes, { code }));
}
}
}, [code, pbnstHasuRes,searchFclts]);
}, [code, pbnstHasuRes, searchFclts]);
const cellClick = (val: number | undefined) => {
if (val === undefined) return;
const selectRow = pbnstHasuRes?.[val];
setSelectRow(pbnstHasuRes?.[val])
if (selectRow) {
setIsRuseReg({ ...isRuseReg, data: selectRow });
//setIsRuseReg({ ...isRuseReg, data: selectRow });
pbnstRegClick(selectRow);
}
};
@@ -106,6 +125,51 @@ export default function PublicReuseFaciltyInsert() {
setCurrentTab(value);
};
useEffect(() => {
if (pbnst.pbnstRes) {
form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) });
}
}, [pbnst.pbnstRes]);
useEffect(() => {
if (indexMng) {
setIndexBiz(0);
}
}, [indexMng]);
useEffect(() => {
console.log("form errors:", form.formState.errors);
}, [form.formState.errors]);
const appendPbnstRuseFclt = useCallback(() => {
if (pbnstRes && pbnstRes.length > 0) {
const lastPbnst = pbnstRes[pbnstRes.length - 1];
console.log('lastPbnst.swtrmtFcltFk ', lastPbnst)
if(lastPbnst){
append(
pbnstRegZod.parse({
pbnstRuseFcltPk: String(lastPbnst.pbnstRuseFcltPk) + String(pbnstRes.length + 1),
ruseUtztnFcltNm: "",
fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(lastPbnst.pbnstRuseFcltPk) + String(pbnstRes.length + 1),cycl:1})] as fcBizType[],
})
);
setIsRuseReg({ ...isRuseReg, isModal: true })
}
} else {
if(selectRow){
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,pbnstRes,append,selectRow])
return (
<>
<ContentsDiv>
@@ -128,8 +192,8 @@ export default function PublicReuseFaciltyInsert() {
size={"sm"}
onClick={(e) => {
searchTxt && searchTxt?.length > 0
? getSwtrmtFcltNm(searchTxt)
: pubHasuInit("1", "11")
? pubHasuSearch("1", "11", searchTxt)
: pubHasuInit("1", "11");
}}
>
조회
@@ -139,12 +203,13 @@ export default function PublicReuseFaciltyInsert() {
className=""
onClick={() => {
pbnstMngData([] as customPbnst[]);
isRuseReg.data.bscFctCd
? setIsRuseReg({ ...isRuseReg, isModal: true })
: ToastFormUi({
body: "하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요",
title: "재이용시설 등록",
});
if(!selectRow){
toast.error("하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요")
return
}else{
appendPbnstRuseFclt()
}
}}
>
신규등록
@@ -182,15 +247,34 @@ export default function PublicReuseFaciltyInsert() {
<TabsTrigger className="!text-xl" value="buse">
차수별정보
</TabsTrigger>
<Button size={"sm"} onClick={ saveRuseData}className="!justify-end">
<Button
size={"sm"}
onClick={form.handleSubmit(onSubmit)}
className="!justify-end"
>
저장
</Button>
</TabsList>
<TabsContent className="max-h-full" value="mng">
<PbnstMngForm formType="update" />
<PbnstMngForm
formType="update"
form={form}
setIndexMng={(index: number) => {
setIndexMng(index);
}}
indexMng={indexMng}
/>
</TabsContent>
<TabsContent className="max-h-full" value="buse">
<PbnstBuseForm formType="update" />
<PbnstBuseForm
formType="update"
form={form}
setIndexBiz={(index: number) => {
setIndexBiz(index);
}}
indexMng={indexMng}
indexBiz={indexBiz}
/>
</TabsContent>
</Tabs>
</ScrollArea>
@@ -198,12 +282,14 @@ export default function PublicReuseFaciltyInsert() {
<UiModal
body={
<PbnstRegModal
form={form}
data={isRuseReg.data || ({} as customPbnst)}
></PbnstRegModal>
}
bodyClass="w-[68vw] max-w-none h-[90vh]"
open={isRuseReg.isModal}
onOpenChange={(open) => {
remove(form.getValues("items").length - 1)
setIsRuseReg({ data: {} as pubHasuType, isModal: open });
}}
/>
@@ -1,7 +1,7 @@
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
import { TableRow, TableHead } from "@common/components/ui";
export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
export const makeFcltRegHead = (upHeadList: TableUpperProps[]) => {
return (
<>
<TableRow>
@@ -19,7 +19,7 @@ import { tableData } from "@/components/lib/func/commom";
import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { headMakeColSpan } from "../rainReg/TableHead";
import { makeFcltRegHead } from "../rainReg/TableHead";
import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
export default function Home() {
@@ -21,7 +21,7 @@ import {
type ReturnType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import { makeFcltRegHead } from "@common/business_components/ui/table/makeFcltRegHead";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
import { Button } from "@common/components/ui";
@@ -155,7 +155,7 @@ export default function HtdflSttn() {
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />
<makeFcltRegHead upHeadList={htdflSttn.htdflSttNodeList} />
}
headlist={htdflSttn.htdflSttHeadList}
pageSize={20}
@@ -4,39 +4,109 @@ import { btnClass } from "@/app/store/common/code";
import {
ContentsDiv,
SearchBaseForm,
SearchInput,
SelectBox,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
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 } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { excelDownload, getCityOrSgg } from "@/components/lib/func/commom";
import type {
customPbnst,
pubHasuType,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import {
excelDownload,
getCityOrSgg,
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";
export default function PbnstSttn() {
const { code, pbnstSttn, pbnstSttnSearch } = useWrStore((state) => state);
const {
code,
pbnstSttn,
pbnstSttnSearch,
pbnSttnInit,
getPbnStnDetail,
pbnNmSearch,
} = useWrStore((state) => state);
const ref = useRef<ReturnType>({} as ReturnType);
const codeData = getCityOrSgg(ref);
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
const [pageNation, setPageNation] = useState(1);
const [isChHead, setIsChHead] = useState(false);
const [bdstTable, setBdstTable] = useState<customPbnst[]>();
const [bdstTable, setBdstTable] = useState<WaterReuseFacility[]>();
const [pbnDetaileData, setPbnDetaileData] = useState<{
isModal: boolean;
data: customPbnst;
}>({ isModal: false, data: {} as customPbnst });
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
const excelClick = useCallback(() => {
// if (codeData) pbnstSttnSearch(1, "10000", codeData);
excelDownload(
[[]],
"하수재이용시설 현황",
"sample_pbnstSttn.xlsx",
"A1:U2"
);
}, [pbnstSttnSearch, codeData]);
pbnstSttnSearch("1", "10000", ref.current, "", searchYear);
}, [pbnstSttnSearch, searchYear, ref.current]);
const cellCLick = useCallback(
(index: number | undefined) => {
if (
index !== undefined &&
pbnstSttn.pbnstSttnRes &&
pbnstSttn.pbnstSttnRes[index]
) {
const pbnstRuseFcltPk = pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk;
getPbnStnDetail(pbnstRuseFcltPk);
}
},
[getPbnStnDetail, pbnstSttn.pbnstSttnRes]
);
useEffect(() => {
if (pbnstSttn.excelList.length >= 0) {
excelDownload(
pbnstSttn.excelList,
"하수재이용시설 현황",
"sample_pbnstSttn.xlsx",
"A1:U2"
);
}
}, [pbnstSttn.excelList]);
useEffect(() => {
if (!pbnstSttn.isInit) {
pbnSttnInit("1", "13", ref.current, searchYear);
}
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
useEffect(() => {
setBdstTable(pbnstSttn.pbnstSttnRes);
}, [pbnstSttn.pbnstSttnRes]);
useEffect(() => {
if (pbnRuseNm.length > 1)
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear);
}, [pbnRuseNm]);
useEffect(() => {
if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk)
setPbnDetaileData({
isModal: true,
data: pbnstSttn.pbnstDetail,
});
}, [pbnstSttn.pbnstDetail]);
useEffect(() => {
console.log('pbnDetaileData.isModal ', pbnDetaileData.isModal)
},[pbnDetaileData.isModal])
return (
<>
<ContentsDiv>
@@ -60,7 +130,33 @@ export default function PbnstSttn() {
조회항목설정
</Button>
}
leftChildren={undefined}
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>
</>
}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
@@ -72,9 +168,10 @@ export default function PbnstSttn() {
// pbnstSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void { }}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
isAdmin={false}
/>
</div>
</div>
@@ -90,7 +187,9 @@ export default function PbnstSttn() {
headlist={pbnstSttn.pbnstSttHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => { }}
cellClick={(index: number | undefined, headId: string) => {
cellCLick(index);
}}
onPageChange={setPageNation}
></UiTable>
</ListDiv>
@@ -112,6 +211,18 @@ export default function PbnstSttn() {
/>
}
/>
<UiModal
body={
<PbnstSttnModal
data={pbnDetaileData.data || ({} as customPbnst)}
></PbnstSttnModal>
}
bodyClass="w-[68vw] max-w-none h-[90vh]"
open={pbnDetaileData.isModal}
onOpenChange={(open) => {
setPbnDetaileData({ data: {} as customPbnst, isModal: false });
}}
/>
</ContentsDiv>
</>
);
@@ -1,5 +1,5 @@
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { TableHead, TableRow } from "@common/components/ui";
export const headMakeprfmnc = (
@@ -16,44 +16,143 @@ import {
UiModal,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, Label } from "@common/components/ui";
import {
Button,
Label,
Table,
TableBody,
TableHeader,
} from "@common/components/ui";
import { useState, useEffect, useCallback } from "react";
import { set } from "react-hook-form";
import { Toaster } from "react-hot-toast";
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
import { InputTableBody } from "@/components/lib/func/TableData";
import {
initValInUsage,
initValOutUsage,
subTotalObj,
totalObj,
type FcPrfType,
type PrfType,
} from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel";
export default function prfmncPrfmncReg() {
const { code, prfmnc, prfmncHasuInit, } = useWrStore(
const { code, prfmnc, prfmncHasuInit, prfmnRegData } = useWrStore(
(state) => state
);
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes } = prfmnc;
const [bdstTable, setbdstTable] = useState<pubHasuType[]>();
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
const [searchTxt, setSearchTxt] = useState<string>();
const [isExcelOpen, setIsExcelOPen] = useState<boolean>(false);
const [isExcelOpen, setIsExcelOPen] = useState<{
isModal: boolean;
data: FcPrfType;
}>({ isModal: false, data: {} as FcPrfType });
const [inputData, setInputData] = useState<any[]>();
const [pbnstRuseFcltPk, setPbnstRuseFcltPk] = useState<string>();
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
const excelClick = useCallback(() => {
excelDownload(
[[]],
"하수재이용실적",
"sample_pbnstPrfmncReg.xlsx",
"A1:O1"
);
}, [prfmnc.excelList]);
const onSave = useCallback(() => {
if (pbnstRuseFcltPk) {
prfmnRegData(
excelToPbnPrfData(
inputData as unknown as JSON[],
searchYear,
pbnstRuseFcltPk
) as unknown as PrfType
);
prfmncHasuInit("1", "11");
}
}, [inputData, searchYear, pbnstRuseFcltPk,prfmncHasuInit]);
const excelClick = useCallback(() => {
console.log("dd")
excelDownload(
[[]],
"하수재이용실적",
"sample_pbnstPrfmncReg.xlsx",
"A1:O1"
);
}, [prfmnc.excelList])
const cellClick = useCallback(
(index: number | undefined, headId: string) => {
if (index !== undefined) {
setIsExcelOPen({
isModal: false,
data: prfmncRes[index] || ({} as FcPrfType),
});
const inUsageData = [...initValInUsage];
const outUsageData = [...initValOutUsage];
const inSubtotal = subTotalObj;
const outSubtotal = subTotalObj;
if (prfmncRes[index]?.prfList) {
prfmncRes[index].prfList?.forEach((prfItem) => {
const month = Number(prfItem?.ym?.slice(4)); // "MM"
const monthKey = `${month}월`;
useEffect(() => {
if (!prfmnc.isInit) {
prfmncHasuInit("1", "11");
inUsageData.forEach((inData: any) => {
const usageKey = inData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
inData[monthKey] = value;
inData.total += value;
if (inSubtotal && usageKey !== "subtotal") {
(inSubtotal as any)[monthKey] =
((inSubtotal as any)[monthKey] ?? 0) + value;
inSubtotal.total += value;
}
});
outUsageData.forEach((outData: any) => {
const usageKey = outData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
outData[monthKey] = value;
outData.total += value;
if (usageKey !== "subtotal") {
(outSubtotal as any)[monthKey] =
((outSubtotal as any)[monthKey] ?? 0) + value;
outSubtotal.total += value;
}
});
});
inUsageData.push(inSubtotal);
outUsageData.push(outSubtotal);
const usageTotalObj: { [key: string]: any } = totalObj;
for (const key in usageTotalObj) {
if (["usage", "gubun", "edit"].includes(key)) continue;
const val =
(Number((inSubtotal as any)[key]) || 0) +
(Number((outSubtotal as any)[key]) || 0);
(usageTotalObj as any)[key] = val;
}
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
setPbnstRuseFcltPk(prfmncRes[index].pbnstRuseFcltPk);
console.log(' tableData ' ,tableData)
setInputData(tableData);
} else {
setInputData([]);
}
}, [prfmnc.isInit, prfmncHasuInit]);
useEffect(() => {
setbdstTable(prfmncRes)
console.log("prfmnc.prfmncRes", prfmncRes)
}, [prfmncRes]);
}
},
[prfmncRes]
);
useEffect(() => {
if (!prfmnc.isInit) {
prfmncHasuInit("1", "11");
}
}, [prfmnc.isInit, prfmncHasuInit]);
useEffect(() => {
setbdstTable(prfmncRes);
}, [prfmncRes]);
return (
<>
@@ -98,10 +197,20 @@ export default function prfmncPrfmncReg() {
<Button size={"sm"} onClick={(e) => {}}>
조회
</Button>
<Button size={"sm"} onClick={() => {}}>
<Button
size={"sm"}
onClick={() => {
onSave();
}}
>
저장
</Button>
<Button size={"sm"} onClick={() => {setIsExcelOPen(true)}}>
<Button
size={"sm"}
onClick={() => {
setIsExcelOPen({ ...isExcelOpen, isModal: true });
}}
>
파일등록
</Button>
<Button color="green" size={"sm"} onClick={excelClick}>
@@ -124,7 +233,9 @@ export default function prfmncPrfmncReg() {
pageSize={100}
total={10}
headName={"하수재이용시설 목록"}
cellClick={() => {}}
cellClick={(index: number | undefined, headId: string) => {
cellClick(index, headId);
}}
onPageChange={(page: number) => {}}
children={undefined}
/>
@@ -133,23 +244,33 @@ export default function prfmncPrfmncReg() {
</div>
<ListDiv className="col-span-8 pr-6 ">
<ScrollArea className="h-[60vh]">
<UiTable
tableData={[]}
headlist={monthHeadList}
pageSize={100}
total={10}
headName={"하수처리수재이용 실적(m3) 등록결과"}
cellClick={() => {}}
onPageChange={() => {}}
children={undefined}
/>
<div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m3) 등록결과"}
</h3>
</div>
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(monthHeadList, [])}
</TableHeader>
<TableBody>
{InputTableBody(inputData ?? [], monthHeadList, setInputData)}
</TableBody>
</Table>
</ScrollArea>
</ListDiv>
</div>
</ContentsDiv>
<UiModal bodyClass={""} body={<PbnPrfExcelModal></PbnPrfExcelModal>} open={isExcelOpen} onOpenChange={() => {setIsExcelOPen(!isExcelOpen)}}></UiModal>
<UiModal
bodyClass={""}
body={<PbnPrfExcelModal data={isExcelOpen.data}></PbnPrfExcelModal>}
open={isExcelOpen.isModal}
onOpenChange={() => {
setIsExcelOPen({ isModal: false, data: {} as FcPrfType });
}}
></UiModal>
<Toaster position="top-center" />
</>
);
}
}
@@ -0,0 +1,686 @@
"use client";
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 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 toast, { Toaster } from "react-hot-toast";
export default function PbnstPrfmncSttn() {
const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncInit, pbnstPrfmncSearch, prfmnc } = useWrStore((state) => state);
const { monthHeadList } = prfmnc
const { pbnstPrfHeadList, pbnstPrfmncRes, 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()));
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
const ref = useRef<ReturnType>({} as ReturnType);
const [swtrmtFcltNm, setSwtrmtFcltNm] = useState<string>();
const [chartConfig, setChartConfig] = useState<ChartConfig>({});
const [chartData, setChartData] = useState<dnChartForm[]>([]);
const [dnInUsage, setDnInUsage] = useState<dnChartForm[]>([]);
const [dnInChartConfig, setDnInChartConfig] = useState<ChartConfig>({});
const [dnOutUsage, setDnOutUsage] = useState<dnChartForm[]>([]);
const [dnOutChartConfig, setDnOutChartConfig] = useState<ChartConfig>({});
const [barData, setBarData] = useState<barChartForm[]>([]);
const [barChartConfig, setBarChartConfig] = useState<ChartConfig>({});
const [prfData, setPrfData] = useState<any[]>();
const [lnInChartConfig, setLnInChartConfig] = useState<ChartConfig>({});
const [lnOutChartConfig, setLnOutChartConfig] = useState<ChartConfig>({});
const [inLineData, setInLineData] = useState<{
chartData1: lineChartDataProps[];
chartData2: lineChartDataProps[];
chartData3: lineChartDataProps[];
chartData4: lineChartDataProps[];
chartData5: lineChartDataProps[];
chartData6: lineChartDataProps[];
chartData7: lineChartDataProps[];
chartData8: lineChartDataProps[];
chartData9: lineChartDataProps[];
}>();
// const [lnInChartConfig, setLnInChartConfig] = useState<ChartConfig>({});
const [outLineData, setOutLineData] = useState<{
chartData1: lineChartDataProps[];
chartData2: lineChartDataProps[];
chartData3: lineChartDataProps[];
chartData4: lineChartDataProps[];
chartData5: lineChartDataProps[];
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 inSubtotal = subTotalObj;
const outSubtotal = subTotalObj;
console.log(' prfList ', prfList)
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}월`;
inUsageData.forEach((inData: any) => {
const usageKey = inData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
inData[monthKey] = value;
inData.total += value;
if (inSubtotal && usageKey !== "subtotal") {
(inSubtotal as any)[monthKey] =
((inSubtotal as any)[monthKey] ?? 0) + value;
inSubtotal.total += value;
}
});
outUsageData.forEach((outData: any) => {
const usageKey = outData.usage;
const value = (prfItem as any)[usageKey] ?? 0;
outData[monthKey] = value;
outData.total += value;
if (usageKey !== "subtotal") {
(outSubtotal as any)[monthKey] =
((outSubtotal as any)[monthKey] ?? 0) + value;
outSubtotal.total += value;
}
});
});
inUsageData.push(inSubtotal);
outUsageData.push(outSubtotal);
const usageTotalObj: { [key: string]: any } = totalObj;
for (const key in usageTotalObj) {
if (["usage", "gubun", "edit"].includes(key)) continue;
const val =
(Number((inSubtotal as any)[key]) || 0) +
(Number((outSubtotal as any)[key]) || 0);
(usageTotalObj as any)[key] = val;
}
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
setPrfData(tableData);
} else {
setPrfData([]);
}
}
useEffect(() => {
let wshwtr = 0;
let coolUswtr = 0;
let cleanUswtr = 0;
let drwtUswtr = 0;
let dltnUswtr = 0;
let ithlRswtr = 0;
let ithlEtcUswtr = 0;
let cleanToilUswtr = 0;
let resn = 0;
let lndwtr = 0;
let hydUswtr = 0;
let ugwtChr = 0;
let farmUswtr = 0;
let rvrKeepUswtr = 0;
let indstUswtr = 0;
if (rawData) {
rawData.forEach((item) => {
prfTableData(item.prfList, year);
item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => {
wshwtr += element.wshwtr; //세척수
coolUswtr += element.coolUswtr; //냉각수
cleanUswtr += element.cleanUswtr; //청소수
drwtUswtr += element.drwtUswtr; //식수대
dltnUswtr += element.dltnUswtr //희석용수
ithlRswtr += element.ithlRswtr //중수도
ithlEtcUswtr += element.ithlEtcUswtr //기타
cleanToilUswtr += element.cleanToilUswtr //청소화장실용수
resn += element.resn //세척살수용수
lndwtr += element.lndwtr; //조경용수
hydUswtr += element.hydUswtr; //친수용수
ugwtChr += element.ugwtChr; //지하수충전
farmUswtr += element.farmUswtr //농업용수
rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수
indstUswtr += element.indstUswtr //공업용수
});
})
const data: dnChartForm[] = []
data?.push({ label: "세척수", val: wshwtr, fill: "red" })
data?.push({ label: "냉각수", val: coolUswtr, fill: "orange" })
data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" })
data?.push({ label: "식수대", val: drwtUswtr, fill: "green" })
data?.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" })
data?.push({ label: "중수도", val: ithlRswtr, fill: "blue" })
data?.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" })
data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" })
data?.push({ label: "세척살수용수", val: resn, fill: "orange" })
data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" })
data?.push({ label: "친수용수", val: hydUswtr, fill: "green" })
data?.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" })
data?.push({ label: "농업용수", val: farmUswtr, fill: "blue" })
data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" })
data?.push({ label: "공업용수", val: indstUswtr, fill: "black" })
setChartData(data);
}
}, [rawData, year])
useEffect(() => {
const newChartConfig = chartData.reduce((config, element) => {
config[element.label] = {
label: element.label,
fill: element.fill
};
return config;
}, {} as Record<string, { label: string; fill?: string }>) satisfies ChartConfig;
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] = {
label: element.label,
fill: element.fill
};
return config;
}, {} as Record<string, { label: string; color: string; }>) satisfies ChartConfig;
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] = {
label: element.label,
fill: element.fill
};
return config;
}, {} as Record<string, { label: string; color: string; }>) satisfies ChartConfig;
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] = {
label: element.label,
};
return config;
}, {} as Record<string, { label: string }>) satisfies ChartConfig;
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 = {
chartData1: {
label: '세척수',
color: "red",
},
chartData2: {
label: '냉각수',
color: "orange",
},
chartData3: {
label: '청소수',
color: "yellow",
},
chartData4: {
label: '식수대',
color: "pink",
},
chartData5: {
label: '희석용수',
color: "purple",
},
chartData6: {
label: '중수도',
color: "green",
},
chartData7: {
label: '기타',
color: "blue",
},
chartData8: {
label: '청소화장실용수',
color: "magenta",
},
chartData9: {
label: '세척살수용수',
color: "skyblue",
},
} satisfies ChartConfig;
setLnInChartConfig(newChartConfig);
}
}, [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) {
const newChartConfig = {
chartData1: {
label: '조경용수',
color: "red",
},
chartData2: {
label: '친수용수',
color: "orange",
},
chartData3: {
label: '지하수충전',
color: "yellow",
},
chartData4: {
label: '농업용수',
color: "green",
},
chartData5: {
label: '하천등유지용수',
color: "blue",
},
chartData6: {
label: '공업용수',
color: "purple",
},
} satisfies ChartConfig;
setLnOutChartConfig(newChartConfig);
}
}, [outLineData]);
useEffect(() => {
if (!pbnstPrfmncSttn.isInit) {
pbnstPrfmncInit("1", "11");
}
}, [pbnstPrfmncSttn.isInit, pbnstPrfmncInit]);
useEffect(() => {
setbdstTable(prfmncRes);
}, [prfmncRes]);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"하수재이용실적 현황"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={<Button
className={btnClass}
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>}
leftChildren={<div className="col-span-5">
<div className="flex flex-row">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">하수 재이용년도</Label>
<SelectBox
className="h-full text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={fromDate}
onSelectValue={(val: string | number) => setFromDate(String(val))} />
<SelectBox
className="h-full text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={toDate}
onSelectValue={(val: string | number) => setToDate(String(val))} />
</div>
<SearchInput
className={"text-2xl"}
label="시설명"
textValue={swtrmtFcltNm ?? ""}
setText={(e) => {
setSwtrmtFcltNm(e);
}} />
<SelectBox
className="h-full text-2xl"
label="재이용시설명"
selectClass={""}
selectArray={[]}
value={""}
onSelectValue={() => { }} />
</div>
</div>}
queryClick={function (returnType: ReturnType): void {
pbnstPrfmncSearch(returnType, swtrmtFcltNm ?? "", fromDate, toDate);
if (fromDate && toDate) {
const fromNum = Number(fromDate);
const toNum = Number(toDate);
if (fromNum > toNum) {
toast.error("시작년도가 종료년도 이후로 설정할 수 없습니다.");
} else {
if (toNum - fromNum > 5) {
toast.error("최대 5년까지 선택 가능합니다.");
} else {
tableHeadMaker(fromNum, toNum);
}
}
}
}}
excelClick={() => { }}
initClick={function (): void { }}
btnClass={btnClass}
ref={ref} isAdmin={false} />
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
headlist={pbnstPrfHeadList}
pageSize={20}
total={10000}
cellClick={() => { }}
onPageChange={() => { }}
/>
<hr />
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">하수재이용실적 상세현황</h3>
<SelectBox
className="h-full w-1/12 text-2xl"
label=""
selectClass={""}
selectArray={selectYearList}
value={year}
onSelectValue={(val: string | number) => setYear(String(val))} />
<h1 className="">장내·외 용도별 하수재이용실적 현황(계)</h1>
<div className="flex">
<div className="w-1/3">
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적"} chartForm={CHART_FORM.DN} />
</div>
<div className="w-1/3">
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적"} chartForm={CHART_FORM.DN} />
</div>
<div className="w-1/3">
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적"} chartForm={CHART_FORM.DN} />
</div>
</div>
<h1 className="">장내·외 월별 하수재이용실적 현황</h1>
<div className="flex">
<div className="w-1/3">
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} />
</div>
<div className="w-1/3">
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적"} chartForm={CHART_FORM.LINE} />
</div>
<div className="w-1/3">
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적"} chartForm={CHART_FORM.LINE} />
</div>
</div>
<h1 className="">하수재이용실적 현황</h1>
<ListDiv className="col-span-8 pr-6 ">
<ScrollArea className="h-[60vh]">
<div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m3) 등록결과"}
</h3>
</div>
<UiTable
headName={undefined}
tableData={prfData || []}
headlist={monthHeadList}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}>
</UiTable>
</ScrollArea>
</ListDiv>
</ListDiv>
</div>
</div>
</ContentsDiv>
<Toaster position="top-center"/>
</>
)
}
+74
View File
@@ -0,0 +1,74 @@
'use client'
import { useWrStore } from "@/app/store";
import { yearOptions } from "@/components/lib/func/commom";
import { ContentsDiv, Title, SearchDiv, SearchFormLeft, SelectBox, UiTable } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useState } from "react";
export default function MatStat(){
const { code, matStat } = useWrStore((state) => {
return state;
});
const [pageNation, setPageNation] = useState(1);
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
return(
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"재이용 통계"} />
<SearchDiv>
<SearchFormLeft>
<SelectBox
className="w-full h-full text-2xl"
label="통계년도"
selectClass={""}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
/>
<div className="flex flex-row space-x-2 items-center">
<Button className="" size={"sm"} onClick={(e) => {}}>
조회
</Button>
<Button className="" size={"sm"} onClick={(e) => {}}>
다운로드
</Button>
<Button className="" size={"sm"} onClick={(e) => {}}>
전체통계다운로드
</Button>
</div>
</SearchFormLeft>
{/* <SearchFormRight>
</SearchFormRight> */}
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4">
<div className="col-span-6 h-full min-h-0">
<ListDiv className="min-h-0">
{/* <ScrollArea className="h-[60vh]"> */}
<UiTable
tableData={[]}
headlist={matStat.matStatHeadList}
pageSize={20}
total={10000}
headName={"건축물 목록"}
cellClick={(val, headId) => {}}
onPageChange={setPageNation}
></UiTable>
{/* </ScrollArea> */}
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
+81
View File
@@ -0,0 +1,81 @@
"use client";
import { useWrStore } from "@/app/store";
import { yearOptions } from "@/components/lib/func/commom";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SelectBox,
Title,
UiTable,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useState } from "react";
export default function rainStat() {
const { code, rainStat } = useWrStore((state) => {
return state;
});
const [pageNation, setPageNation] = useState(1);
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"재이용 통계"} />
<SearchDiv>
<SearchFormLeft>
<SelectBox
className="w-full h-full text-2xl"
label="통계년도"
selectClass={""}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
/>
<div className="flex flex-row space-x-2 items-center">
<Button className="" size={"sm"} onClick={(e) => {}}>
조회
</Button>
<Button className="" size={"sm"} onClick={(e) => {}}>
다운로드
</Button>
<Button className="" size={"sm"} onClick={(e) => {}}>
전체통계다운로드
</Button>
</div>
</SearchFormLeft>
{/* <SearchFormRight>
</SearchFormRight> */}
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4">
<div className="col-span-6 h-full min-h-0">
<ListDiv className="min-h-0">
{/* <ScrollArea className="h-[60vh]"> */}
<UiTable
tableData={[]}
headlist={rainStat.rainStatHeadList}
pageSize={20}
total={10000}
headName={"건축물 목록"}
cellClick={(val, headId) => {}}
onPageChange={setPageNation}
></UiTable>
{/* </ScrollArea> */}
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
);
}
+75
View File
@@ -0,0 +1,75 @@
'use client'
import { useWrStore } from "@/app/store";
import { yearOptions } from "@/components/lib/func/commom";
import { ContentsDiv, SearchDiv, SearchFormLeft, SelectBox, Title, UiTable } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useState } from "react";
export default function RswtStat() {
const { code, rswtStat } = useWrStore((state) => {
return state;
});
const [pageNation, setPageNation] = useState(1);
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
return(
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"재이용 통계"} />
<SearchDiv>
<SearchFormLeft>
<SelectBox
className="w-full h-full text-2xl"
label="통계년도"
selectClass={""}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
/>
<div className="flex flex-row space-x-2 items-center">
<Button className="" size={"sm"} onClick={(e) => {}}>
조회
</Button>
<Button className="" size={"sm"} onClick={(e) => {}}>
다운로드
</Button>
<Button className="" size={"sm"} onClick={(e) => {}}>
전체통계다운로드
</Button>
</div>
</SearchFormLeft>
{/* <SearchFormRight>
</SearchFormRight> */}
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4">
<div className="col-span-6 h-full min-h-0">
<ListDiv className="min-h-0">
{/* <ScrollArea className="h-[60vh]"> */}
<UiTable
tableData={[]}
headlist={rswtStat.rswtStatHeadList}
pageSize={20}
total={10000}
headName={"건축물 목록"}
cellClick={(val, headId) => {}}
onPageChange={setPageNation}
></UiTable>
{/* </ScrollArea> */}
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
+8
View File
@@ -102,6 +102,12 @@ const dmdUszCd = [
]
const ruseMngMtd = [
{ val: "자체운영", text: "자체운영" },
{ val: "공기업", text: "공기업" },
{ val: "민간(대행)", text: "민간(대행)" },
]
const pplQulity = [
{ val: "도복장강관", text: "도복장강관" },
@@ -154,6 +160,7 @@ export type comCodeState = {
RNB:string,
HTB:string
}
ruseMngMtd:SelectDataType[]
};
};
@@ -292,6 +299,7 @@ export const comCodeStateExport: comCodeState = {
yn: yn,
dmdUszCd:dmdUszCd,
buildingType:buildingType,
ruseMngMtd:ruseMngMtd,
},
};
+92 -21
View File
@@ -1,14 +1,28 @@
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
import {
fetchType,
getFetch,
postFectch,
putFectch,
} from "@/components/lib/api";
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
import type { DemandCompType } from "@common/business_components/ui";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
import type { conCostFeeType, rateFeeType } from "./type";
export type comFcltState = {
searchFclts: pubHasuType;
demandCompList: DemandCompType[];
dmdIsSucees: string;
checkDemand: DemandCompType;
constCostRes:conCostFeeType[],
rateFeeRes:rateFeeType[],
};
export type comFcltActions = {
getSwtrmtFcltNm: (searchNm: string) => void;
getDemandCompList :(searchNm: string,cnt:number) => void
regDemandCompany:(data:DemandCompType ) => void
getDemandCompList: (searchNm: string, cnt: number) => void;
regDemandCompany: (data: DemandCompType) => void;
updateDemandCompany: (data: DemandCompType) => void;
getConstCostFee: (year: string) => void;
getRateFee: (year: string) => void;
};
export const searchActions: (set: any) => comFcltActions = (set: any) => {
@@ -16,9 +30,9 @@ export const searchActions: (set: any) => comFcltActions = (set: any) => {
getSwtrmtFcltNm: async (searchNm: string) => {
const fcltNm = await getFetch(
"common",
`/prcsFclt/info/1/20/${searchNm}`
`/prcsFclt/info/1/11/${searchNm}`
);
const fcltNmCd: pubHasuType[] = fcltNm.map((item: any) => ({
const searchFclts: pubHasuType[] = fcltNm.map((item: any) => ({
bscFctCd: item.bscFctCd,
sido: item.sido,
gugun: item.gugun,
@@ -26,27 +40,84 @@ export const searchActions: (set: any) => comFcltActions = (set: any) => {
addr: item.addr,
fctCpc: item.fctCpc,
}));
return set((state: comFcltState) => ({
set((state: comFcltState) => ({
...state,
searchFclts: fcltNmCd,
searchFclts: searchFclts,
}));
},
getDemandCompList: async (searchNm: string ,cnt:number) => {
getDemandCompList: async (searchNm: string, cnt: number) => {
const coList = await getFetch(
fetchType.WR,
`/reuseFc/request/${searchNm}/${cnt}`
`/reuseFc/request/${searchNm}/${cnt}`
);
return set((state: comFcltState) => ({
...state,
demandCompList: coList,
}));
},regDemandCompany: async (data:DemandCompType)=>{
try{
const response = await postFectch('/reuseFc/request',data,fetchType.WR )
}catch(err){
console.log(err)
}
console.log(coList);
set((state: comFcltState) => {
return (state.demandCompList = [...coList]);
});
},
regDemandCompany: async (data: DemandCompType) => {
try {
const response = await postFectch(
"/reuseFc/request",
data,
fetchType.WR
);
let message = "";
if (response.status === 200) {
message = "success";
} else {
message = "fail";
}
set((state: comFcltState) => {
state.dmdIsSucees = message;
return state;
});
} catch (err) {
console.log(err);
}
},
updateDemandCompany: async (data: DemandCompType) => {
try {
const response = await putFectch("/reuseFc/request", data);
let message = "";
if (response.status === 200) {
message = "success";
} else {
message = "fail";
}
set((state: comFcltState) => {
state.dmdIsSucees = message;
return state;
});
} catch (err) {
console.log(err);
}
},
getRateFee: async (year: string) => {
try {
const url = `/prcsFclt/CstRt/${year}`;
const rateFeeRes = await getFetch(fetchType.COMMON, url);
set((state: comFcltState) => {
state.rateFeeRes = rateFeeRes;
return state;
});
} catch (e) {
console.log(" error ", e);
}
},getConstCostFee: async (year: string) => {
try {
const url = `/prcsFclt/CstRuse/${year}`;
const constCost = await getFetch(fetchType.COMMON, url);
set((state: comFcltState) => {
state.constCostRes = constCost;
return state;
});
}catch (e) {
}
}
};
};
@@ -0,0 +1,12 @@
export type conCostFeeType= {
yr: string,
fctCpc: string,
fctCd: string,
stdCost: string
}
export type rateFeeType = {
yr: string,
incExpCd: string,
stdCost: number,
rt: number
}
@@ -15,9 +15,12 @@ export type TableUpperProps = {
upName?: string;
upSequnce?: number;
edit?:boolean;
visible?:boolean;
rowSpan?: true;
visible?:boolean;
rowSpan?: number;
colSpan?: number;
type?: string;
selectData ?:string; // type 이 seelct 일경우 selectarray 정하기 위해
row?:number;
mergeCell?:boolean // 셀을 합칠경우
};
+144 -7
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import type { CommonTableProps } from "../../common/type/headder";
import type { CommonTableProps } from "../../common/type/header";
export const sttnHeadListType = z.array(
z.object({
@@ -11,27 +11,27 @@ export const sttnHeadListType = z.array(
export const coRvwHeadListExport: z.infer<typeof sttnHeadListType> = [
{
id: "ctpv",
id: "cityText",
title: "시도",
visible: true,
},
{
id: "sgg",
id: "sggText",
title: "시군구",
visible: true,
},
{
id: "coNm",
id: "dmdCoNm",
title: "회사명",
visible: true,
},
{
id: "addr",
id: "daddr",
title: "공장주소",
visible: true,
},
{
id: "telNo",
id: "telno",
title: "전화번호",
visible: true,
},
@@ -106,4 +106,141 @@ export const coRvwNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
];
];
export const cmpttnHeadListExport: CommonTableProps[] = [
{
id: "",
title: "구분",
visible: true,
},
{
id: "BD",
title: "처리시설 용량(m³)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "500",
title: "500",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "1000",
title: "1,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "2000",
title: "2,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "3000", //바꾸기
title: "3,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "5000", //바꾸기
title: "5,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "10000", //바꾸기
title: "10,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "20000", //바꾸기
title: "20,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "30000", //바꾸기
title: "30,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "50000", //바꾸기
title: "50,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "100000", //바꾸기
title: "100,000",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
export const coModalHeadListExport: CommonTableProps[] = [
{
id: "gubun",
title: "공사비/구분",
visible: true,
},
{
id: "BD",
title: "기본조사설계비",
visible: true,
},
{
id: "WD",
title: "실시설계비",
visible: true,
},
{
id: "SE",
title: "공사감리비",
visible: true,
},
{
id: "CE",
title: "시설부대비",
visible: true,
},
]
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" },
]
+153 -7
View File
@@ -1,7 +1,10 @@
import type { z } from "zod";
import type { sttnHeadListType } from "../coSttn/headList";
import { coRvwHeadListExport, coRvwNodeListExport } from "./headList";
import type { CommonTableProps } from "../../common/type/headder";
import type { CommonTableProps } from "../../common/type/header";
import type { DedMatUpdateType, DmdCoReqType } from "./type";
import { fetchType, getFetch, putFectch } from "@/components/lib/api";
import toast from "react-hot-toast/headless";
const coRvwHeadList = coRvwHeadListExport;
const coRvwNodeList = coRvwNodeListExport;
@@ -9,26 +12,169 @@ const coRvwNodeList = coRvwNodeListExport;
export type coRvwState = {
coRvw: {
isInit: boolean;
coRvwHeadList: z.infer<typeof sttnHeadListType>;
coMatRvwRes: DmdCoReqType[];
coRvwHeadList: CommonTableProps[];
coRvwNodeList: CommonTableProps[];
};
};
export const coRvwStateExport: coRvwState = {
coRvw: {
isInit: false,
coMatRvwRes: [],
coRvwHeadList: coRvwHeadList,
coRvwNodeList: coRvwNodeList,
}
}
},
};
export type coRvwType = coRvwState & coRvwActions;
type coRvwActions = {
coMatRvwInit: (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
) => void;
coMatRvwUpdate: (
splyCd: string,
dmdCd: string,
data: DedMatUpdateType
) => void;
coMatRvwSearch: (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string,
dmdCoNm: string,
) => void;
coMatRvwInqua: (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string
) => void;
};
const coMatInit = async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
) => {
const url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
const coMatRvwRes = await getFetch(fetchType.WR, url);
return coMatRvwRes;
};
export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
return {
}
}
coMatRvwInit: async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
) => {
const coMatRvwRes = await coMatInit(pageNo, pageCnt, startYear, endYear);
return set((state: coRvwState) => ({
...state,
coRvw: {
...state.coRvw,
init: false,
coMatRvwRes: coMatRvwRes,
},
}));
},
coMatRvwUpdate: async (
splyCd: string,
dmdCd: string,
data: DedMatUpdateType
) => {
try {
const isUpdate = await putFectch(
`/reuseFc/request/cst/${splyCd}/${dmdCd}`,
data
);
const coMatRvwRes = coMatInit(
1,
10,
new Date().getFullYear().toString(),
new Date().getFullYear().toString(),
);
return set((state: coRvwState) => ({
...state,
coRvw: {
...state.coRvw,
init: false,
coMatRvwRes: coMatRvwRes,
},
}));
} catch (e) {
toast.error("매칭 검토 저장 오류입니다.");
}
},
coMatRvwSearch: async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string,
dmdCoNm: string,
) => {
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
if (sggCd.length > 0) {
url += `/${sggCd}`;
} else {
url += `/0`;
}
if (dmdCoNm?.length > 0) {
url += `/${dmdCoNm}`;
} else {
url += `/0`;
}
console.log(' url ', url)
const coMatRvwRes = await getFetch(fetchType.WR, url);
return set((state: coRvwState) => ({
...state,
coRvw: {
...state.coRvw,
coMatRvwRes: coMatRvwRes,
},
}));
},
coMatRvwInqua: async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string
) => {
try {
let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
if (sggCd.length > 0) {
url += `/${sggCd}/0`;
}else if(sggCd ==='0'){
url += `/0/0`;
}
const coMatRvwRes = await getFetch(fetchType.WR, url);
return set((state: coRvwState) => ({
...state,
coRvw: {
...state.coRvw,
coMatRvwRes: coMatRvwRes,
},
}));
} catch (e) {
console.log(" error ", e);
}
}
};
};
+171
View File
@@ -0,0 +1,171 @@
import { z } from "zod";
const DemandInfoSchema = z.object({
dmdInfoSn: z.number(),
dmdInfoFk: z.string(),
dmndTmng: z.coerce.date(),
dmndQty: z.number(),
wntUntprc: z.number(),
grssClfg: z.number(),
combResdch: z.number(),
trbt: z.number(),
blgcOxygDmndQnt: z.number(),
smll: z.number(),
crmty: z.number().nullish(),
tn: z.number(),
tph: z.number(),
ph: z.number(),
clIonQnt: z.number(),
cdtnv: z.number(),
rmrk: z.string(),
useUsgCd: z.string(),
mtchnCmptnYmd: z.string().nullish(),
rvwCmptnYmd: z.string().nullish()
});
const DemandMatchingSchema = z.object({
dmdInfoFk: z.string().nullish(),
splyFcltFk: z.string().nullish(),
splyFcltFlg: z.string().nullish(),
pbnstRuseFcltBizFk: z.number().nullish(),
splyBgngDay: z.coerce.date().nullish(),
splyEndDay: z.coerce.date().nullish(),
splyCpct: z.number().nullish(),
splyFmYn: z.string().nullish(),
useUsgCd: z.string().nullish(),
dmdInfoSn: z.number().nullish(),
splyCndtList:z.array(z.string().nullish() ).nullish()
});
const DemandCoSchema = z.object({
dmdInfoPk: z.string(),
dmdCoNm: z.string(),
ctpvCd: z.string(),
sggCd: z.string(),
daddr: z.string(),
splyBgngDay: z.coerce.date(),
splyEndDay: z.coerce.date(),
splyCpct: z.number(),
splyFmYn: z.string().nullish(),
telno: z.string(),
useUsgCd: z.string().nullish(),
regDt: z.coerce.date().nullish(),
rgtr: z.string().nullish(),
mdfcnDt: z.coerce.date().nullish(),
mdfr: z.string().nullish(),
dmdAplyPswd: z.string(),
demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임
demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish()// 안쓰는 거임
});
const DemandCstSchema = z.object({
dmdInfoSn: z.number(),
usgPrcsProcs: z.string().nullish(),
cstrnCst: z.number(),
fcltSbsdEpsTrf: z.number(),
prcsFcltCpctCstrnCst: z.number()
});
export const DmdCoReqSchema = z.object({
cityText:z.string().nullish(),
sggText:z.string().nullish(),
dmdInfoSn: z.number(),
dmdInfoFk: z.string(),
dmndTmng: z.coerce.date(),
dmndQty: z.number(),
wntUntprc: z.number(),
grssClfg: z.number(),
combResdch: z.number(),
trbt: z.number(),
blgcOxygDmndQnt: z.number(),
smll: z.number(),
crmty: z.number(),
tn: z.number(),
tph: z.number(),
ph: z.number(),
clIonQnt: z.number(),
cdtnv: z.number(),
rmrk: z.string(),
useUsgCd: z.string().nullish(),
mtchnCmptnYmd: z.string().nullish(),
rvwCmptnYmd: z.string().nullish(),
demandCo: DemandCoSchema.nullish(),
demandMatching: DemandMatchingSchema.nullish(),
demandCst: DemandCstSchema,
ruseUtztnFcltNm:z.string().nullish(),
});
export type DmdCoReqType = z.infer<typeof DmdCoReqSchema>;
export type DmdMatTableType = {
cityText:string,
sggText:string,
dmdCoNm:string,
daddr:string,
telno:string,
regDt:string,
splyFcltFlg:string
}
export type DedMatUpdateType =
{
dmdInfoSn: number;
usgPrcsProcs: string;
cstrnCst: number;
fcltSbsdEpsTrf: number;
prcsFcltCpctCstrnCst: number;
rgtr: string;
}
export type RvwHistTableType = {
cityText:string,
sggText:string,
dmdCoNm:string,
daddr:string,
telno:string,
regDt:string,
rvwCmptnYmd:string,
mtchnCmptnYmd:string,
ruseUtztnFcltNm:string,
dmndQty:string,
useUsgCd:string,
splyFcltFlg:string
completeYn:boolean
dmdInfoSn :string
}
export type RvwHistTableType = {
cityText:string,
sggText:string,
dmdCoNm:string,
daddr:string,
telno:string,
regDt:string,
rvwCmptnYmd:string,
mtchnCmptnYmd:string,
ruseUtztnFcltNm:string,
dmndQty:string,
useUsgCd:string,
splyFcltFlg:string
completeYn:boolean
dmdInfoSn :string
}
export type conCostFeeType= {
yr: string,
fctCpc: string,
fctCd: string,
stdCost: string
}
export type rateFeeType = {
yr: string,
incExpCd: string,
stdCost: number,
rt: number
}
-13
View File
@@ -1,13 +0,0 @@
import { z } from "zod";
export const coZod = z.object({
ctpv: z.string(),
sgg: z.string(),
coNm: z.string().min(1).max(20),
bznmNo: z.string().min(1).min(9).max(12),
addr: z.string().min(1).min(6).max(20),
telNo: z.string().min(8).max(12)
});
export type customCoBdst = z.infer<typeof coZod>;
+17
View File
@@ -0,0 +1,17 @@
import type { customCoSttnBdst } from ".";
export const excelCoSttnParsing = (data: customCoSttnBdst[]): string[][] => {
const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
String(item.ctpvCd),
String(item.sggCd),
item.dmdCoNm ?? "",
item.daddr ?? "",
String(item.dmdInfoPk ?? ""),
item.telno ?? ""
]);
});
return excelExportData;
};
+18 -19
View File
@@ -1,4 +1,4 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
import { z } from "zod";
export const sttnHeadListType = z.array(
@@ -10,46 +10,45 @@ export const sttnHeadListType = z.array(
);
export const coRegExcel = z.object({
file: z.instanceof(File)
file: z.any()
});
export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{
id: "ctpv",
id: "cityText",
title: "시도",
visible: true,
},
{
id: "sgg",
id: "sggText",
title: "시군구",
visible: true,
},
{
id: "coNm",
id: "dmdCoNm",
title: "회사명",
visible: true,
},
{
id: "addr",
title: "공장주소",
id: "daddr",
title: "주소",
visible: true,
},
{
id: "bznmNo",
title: "공장관리번호",
id: "dmdInfoPk",
title: "사업자번호",
visible: true,
},
{
id: "telNo",
id: "telno",
title: "전화번호",
visible: true,
},
];
// id는 다확인해야함
export const coSttNodeListExport: CommonTableProps[] = [
{
id: "ctpv",
id: "cityText",
title: "시도",
visible: true,
row: 1,
@@ -57,7 +56,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "sgg",
id: "sggText",
title: "시군구",
visible: true,
row: 1,
@@ -65,7 +64,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "coNm",
id: "dmdCoNm",
title: "회사명",
visible: true,
row: 1,
@@ -73,23 +72,23 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "addr",
title: "공장주소",
id: "daddr",
title: "주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "bznmNo",
title: "공장관리번호",
id: "dmdInfoPk",
title: "사업자번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "telNo",
id: "telno",
title: "전화번호",
visible: true,
row: 1,
+86 -9
View File
@@ -1,16 +1,18 @@
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { coSttNodeListExport, coSttHeadListExport } from "./headList";
import type { customCoBdst } from "../../matDmd/coReg";
import type { sttnHeadListType } from "../coSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/header";
import { fetchType, getFetch } from "@/components/lib/api";
import { coSttHeadListExport, coSttNodeListExport } from "./headList";
import { excelCoSttnParsing } from "./excel";
import type { DemandCompType } from "@common/business_components/ui";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
const coSttHeadList = coSttHeadListExport;
const coSttnRes: DemandCompType[] = [];
export type coSttnState = {
coSttn: {
coSttnRes: customCoBdst[];
coSttnRes: DemandCompType[];
coSttHeadList: CommonTableProps[];
coSttNodeList: CommonTableProps[];
excelList: [];
@@ -19,7 +21,9 @@ export type coSttnState = {
};
type coSttnActions = {
coSttnInit:(pageNo:string, pageCnt:string, con: string) => void;
coSttnSearch: (pageNo:string, pageCnt:string, con: string) => void;
coSttnTxtSearch:(pageNo:string, pageCnt:string, con: string,txt:string) => void;
};
export type coSttnType = coSttnState & coSttnActions;
@@ -28,16 +32,89 @@ export const coSttnStateExport: coSttnState = {
coSttn: {
coSttHeadList: coSttHeadList,
coSttNodeList: coSttNodeList,
coSttnRes: [],
coSttnRes: coSttnRes,
excelList: [],
isInit: false,
},
};
export const coSttnActionsExport: (set: any) => coSttnActions = (
set: any
) => {
return {
coSttnInit: async (pageNo:string, pageCnt:string, con: string) => {
try {
const coSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/request/${pageNo}/${pageCnt}/${con}`
);
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
coSttnRes: coSttnRes,
isInit: false,
},
};
});
} catch (e) {
console.log(e)
}
},
coSttnSearch: async (pageNo:string, pageCnt:string, con: string) => {
try {
const coSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/request/${pageNo}/${pageCnt}/${con}`
);
if (Number(pageCnt) >= 10000) {
const coExcel = excelCoSttnParsing(coSttnRes);
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
excelList: coExcel,
isInit: false,
},
};
});
} else
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
coSttnRes: coSttnRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
coSttnTxtSearch: async (pageNo:string, pageCnt:string, con: string, txt: string) => {
try {
const coSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/request/${pageNo}/${pageCnt}/${con}/${txt}`)
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
coSttnRes: coSttnRes,
isInit: false,
}}})
} catch (erTxt) {
console.log("error", erTxt);
}
}
}
}
@@ -0,0 +1,102 @@
import type { CommonTableProps } from "../../common/type/header";
export const drgtHeadListExport: CommonTableProps[] = [
{
id: "ctpvCd",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sggCd",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "haengjung",
title: "행정동",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "normal",
title: "정상(횟수)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "attention",
title: "관심(횟수)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "caution",
title: "주의(횟수)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "warning",
title: "관심+주의(횟수)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "ranking",
title: "가뭄순위",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
export const drgtDetailHeadListExport: CommonTableProps[] = [
{
id: "year",
title: "년",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "month",
title: "월",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "day",
title: "일",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "state",
title: "가뭄상태",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
]
@@ -0,0 +1,27 @@
import type { CommonTableProps } from "../../common/type/header";
import { drgtHeadListExport } from "./headList";
const drgtHeadList = drgtHeadListExport;
export type drgtState = {
drgt:{
drgtHeadList: CommonTableProps[];
}
}
type drgtActions = {
};
export type drgtType = drgtState & drgtActions;
export const drgtStateExport: drgtState = {
drgt: {
drgtHeadList: drgtHeadList,
}
}
export const drgtActionsExport: (set: any) => drgtActions = (
set: any
) => {
return {};
};
@@ -0,0 +1,61 @@
import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
type nameMap = {
[key: string]: string;
}
export const names: nameMap = {
"시도": "ctpvCd",
"시군구명": "sggCd",
"관리기관": "mngInst",
"회사명": "dmdCoNm",
"공장구분": "fctrySe",
"단지명": "cmpxNm",
"설립구분": "fndnSe",
"입주형태": "mvnShp",
"보유구분": "hldSe",
"최초승인일": "frstAprvYmd",
"최초등록일": "frstRegYmd",
"등록구분": "regSe",
"등록일": "regYmd",
"전화번호": "telno",
"남자종업원": "maleEmpCnt",
"여자종업원": "fmaleEmpCnt",
"외국인남자종업원": "frgnrMaleEmpCnt",
"외국인여자종업원": "frgnrFmaleEmpCnt",
"종업원합계": "totalEmpCnt",
"생산품": "prdctnItem",
"원자재": "splyMtrl",
"공장규모": "fctryScl",
"용도지역": "usgRgn",
"지목": "ldcg",
"용지면적": "usgRgnArea",
"제조시설면적": "mnftrFcltArea",
"부대시설면적": "sbsdFcltArea",
"건축면적": "archArea",
"지식산업센터명": "knwlIndstCntrNm",
"대표업종": "rprsTpbiz",
"업종명": "tpbizNm",
"업종코드": "tpbizCd",
"차수": "cycl",
"법인주소": "corpAddr",
"필지수": "esntlIdx",
"공장주소": "fctryAddr",
"공장주소_지번": "fctryLotnoAddr",
"공장관리번호": "fctryMngNo",
}
export const excelToLdrmntData = (excelData: File[],) => {
const ldrmntData = Object.values(excelData);
const data = ldrmntData.map((item) => {
return ({
...(item as object),
rgtr: TEST_UUID,
mdfr: TEST_UUID,
})
})
return data;
};
@@ -0,0 +1,401 @@
import { z } from "zod";
import type { CommonTableProps } from "../../common/type/header";
export const ldrmntZod = z.object({
ctpvCd: z.string().default(''),
sggCd: z.string().default(''),
mngInst: z.string().default('').nullish(),
dmdCoNm: z.string().default(''),
fctrySe: z.string().default(''),
cmpxNm: z.string().default(''),
fndnSe: z.string().default(''),
mvnShp: z.string().default(''),
hldSe: z.string().default(''),
frstAprvYmd: z.string().default(''),
frstRegYmd: z.string().default(''),
regSe: z.string().default(''),
regYmd: z.string().default(''),
telno: z.string().default(''),
maleEmpCnt: z.number().default(0),
fmaleEmpCnt: z.number().default(0),
frgnrMaleEmpCnt: z.number().default(0),
frgnrFmaleEmpCnt: z.number().default(0),
totalEmpCnt: z.number().default(0),
prdctnItem: z.string().default(''),
splyMtrl: z.string().default(''),
fctryScl: z.string().default(''),
usgRgn: z.string().default(''),
ldcg: z.string().default(''),
usgRgnArea: z.number().default(0),
mnftrFcltArea: z.number().default(0),
sbsdFcltArea: z.number().default(0),
archArea: z.number().default(0),
knwlIndstCntrNm: z.string().default(''),
rprsTpbiz: z.string().default(''),
tpbizNm: z.string().default(''),
tpbizCd: z.string().default(''),
cycl: z.number().default(0),
corpAddr: z.string().default(''),
esntlIdx: z.number().default(0),
fctryAddr: z.string().default(''),
fctryLotnoAddr: z.string().default(''),
fctryMngNo: z.string().default(''),
})
export const ldrmntHeadListExport: CommonTableProps[] = [
{
id: "ctpvCd",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sggCd",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "dmdCoNm",
title: "회사명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctryAddr",
title: "공장주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctryMngNo",
title: "공장관리번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "telno",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
]
export const ldrmntNodeListExport: CommonTableProps[] = [
{
id: "ctpvCd",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sggCd",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "mngInst",
title: "관리기관",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "dmdCoNm",
title: "회사명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctrySe",
title: "공장구분",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "cmpxNm",
title: "단지명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fndnSe",
title: "설립구분",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "mvnShp",
title: "입주형태",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "hldSe",
title: "보유구분",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "frstAprvYmd",
title: "최초승인일",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "frstRegYmd",
title: "최초등록일",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "regSe",
title: "등록구분",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "regYmd",
title: "등록일",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "telno",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "maleEmpCnt",
title: "남자종업원",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fmaleEmpCnt",
title: "여자종업원",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "frgnrMaleEmpCnt",
title: "외국인남자종업원",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "frgnrFmaleEmpCnt",
title: "외국인여자종업원",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "totalEmpCnt",
title: "종업원합계",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "prdctnItem",
title: "생산품",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "splyMtrl",
title: "원자재",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctryScl",
title: "공장규모",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "usgRgn",
title: "용도지역",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "ldcg",
title: "지목",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "usgRgnArea",
title: "용지면적",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "mnftrFcltArea",
title: "제조시설면적",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sbsdFcltArea",
title: "부대시설면적",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "archArea",
title: "건축면적",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "knwlIndstCntrNm",
title: "지식산업센터명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "rprsTpbiz",
title: "대표업종",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "tpbizNm",
title: "업종명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "tpbizCd",
title: "업종코드",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "cycl",
title: "차수",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "corpAddr",
title: "법인주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "esntlIdx",
title: "필지수",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctryAddr",
title: "공장주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctryLotnoAddr",
title: "공장주소_지번",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "fctryMngNo",
title: "공장관리번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
+117 -43
View File
@@ -1,66 +1,140 @@
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { coSttNodeListExport, coSttHeadListExport } from "../coSttn/headList";
import type { customCoBdst } from "../../matDmd/coReg";
import type { sttnHeadListType } from "../coSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/header";
import { fetchType, getFetch, postFectch, putFectch } from "@/components/lib/api";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import { z } from "zod";
import { ldrmntHeadListExport, ldrmntNodeListExport, ldrmntZod } from "./headList";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
const coSttHeadList = coSttHeadListExport;
const ldrmntHeadList = ldrmntHeadListExport;
const ldrmntNodeList = ldrmntNodeListExport;
const ldrmntCoSttnRes: customCoBdst[] = [];
export type customLdrmntBdst = z.infer<typeof ldrmntZod>;
const ldrmntCoList = {ctpv: "이거머임",
sgg: "01",
coNm: "회사요",
bznmNo: "abc123",
addr: "서울 강남구",
telNo: "010-1234-5678"}
export type ldrmntCoSttnState = {
ldrmntCoSttn: {
ldrmntCoSttnRes: customCoBdst[];
ldrmntCoSttHeadList: CommonTableProps[];
ldrmntCoSttNodeList: CommonTableProps[];
const ldrmntRes: customLdrmntBdst[] = [];
export type ldrmntState = {
ldrmnt: {
ldrmntHeadList: CommonTableProps[];
ldrmntNodeList: CommonTableProps[];
excelList: [];
isInit: boolean;
ldrmntRes: customLdrmntBdst[];
};
};
type ldrmntCoSttnActions = {
type ldrmntActions = {
ldrmntRegData: (data: any[]) => void,
ldrmntInit: () => void;
ldrmntSearch: (sggCd: string, coNm: string) => void;
};
export type ldrmntCoSttnType = ldrmntCoSttnState & ldrmntCoSttnActions;
export type ldrmntType = ldrmntState & ldrmntActions;
export const ldrmntCoSttnStateExport: ldrmntCoSttnState = {
ldrmntCoSttn: {
ldrmntCoSttHeadList: coSttHeadList,
ldrmntCoSttNodeList: coSttNodeList,
ldrmntCoSttnRes: [ldrmntCoList],
export const ldrmntStateExport: ldrmntState = {
ldrmnt: {
ldrmntHeadList: ldrmntHeadList,
ldrmntNodeList: ldrmntNodeList,
excelList: [],
isInit: false,
ldrmntRes: ldrmntRes,
},
};
export const ldrmntCoSttnActionsExport: (set: any) => ldrmntCoSttnActions = (
export const ldrmntActionsExport: (set: any) => ldrmntActions = (
set: any
) => {
return {
ldrmntCoSttnInit: async (code: string | number) => {
try{
set((state: ldrmntCoSttnState) => {
return {
...state,
ldrmntCoSttn: {
...state.ldrmntCoSttn,
ldrmntCoSttnRes: ldrmntCoSttnRes,
isInit: false,
},
};
});
}catch(e){
console.log(e)
ldrmntInit: async () => {
try {
const ldrmntRes = await getFetch(
fetchType.WR,
`/reuseFc/request/temp/1/20/0`
);
return set((state: ldrmntState) => ({
...state,
rain: {
...state.ldrmnt,
ldrmntRes: ldrmntRes,
isInit: false,
},
}));
} catch (e) {
console.log(e)
}
},
ldrmntRegData: async (data) => {
try {
const response = await postFectch(
"/reuseFc/request/temp",
data,
fetchType.WR
);
console.log('response ', response)
if (response.status === 200) {
ToastFormUi({
body: "잠재수요처 등록이 완료되었습니다. ",
title: "잠재수요처 등록",
});
}
} catch (e) {
console.log(e)
ToastFormUi({
body: "잠재수요처 등록이 실패하였습니다. ",
title: "잠재수요처 등록",
});
}
},
ldrmntSearch: async (sggCd: string, coNm: string) => {
let searchUrl = "";
console.log("인덱스", sggCd)
if (sggCd !== "") {
if (coNm !== "") {
searchUrl = `/reuseFc/request/temp/1/20/${sggCd}/${coNm}`;
} else {
searchUrl = `/reuseFc/request/temp/1/20/${sggCd}`;
}
}
console.log("searchUrl", searchUrl)
try {
const ldrmntRes = await getFetch(
fetchType.WR,
searchUrl
);
console.log("search", ldrmntRes)
set((state: ldrmntState) => {
return {
...state,
ldrmnt: {
...state.ldrmnt,
ldrmntRes: ldrmntRes,
},
}
},
})
} catch (e) {
console.log(e)
}
},
ldrmntUpdate: async (ldrmntRes: customLdrmntBdst[]) => {
try {
const response = await putFectch(
`/reuseFc/request/temp`,
ldrmntRes
);
} catch (error) {
console.error("Error ldrmntUpdate:", error);
}
},
}
}
@@ -0,0 +1,355 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { TableUpperProps } from "../../common/type/header";
//★☆★☆ 여기서부터 수정하기 ★☆★☆
export const ruseCaseHeadListExport: TableUpperProps[] = [
{
id: "a",
title: "사업명",
visible: true,
row: 0,
rowSpan: 2,
},
{
id: "b",
title: "사업기간",
visible: true,
row: 0,
rowSpan: 2,
},
{
id: "c",
title: "공급처",
visible: true,
row: 0,
colSpan: 3,
},
{
id: "d",
title: "시설종류",
visible: true,
row: 1,
},
{
id: "e",
title: "공급처명",
visible: true,
row: 1,
},
{
id: "f",
title: "시설용량(m³/일)",
visible: true,
row: 1,
},
{
id: "g",
title: "수요처",
visible: true,
row: 0,
colSpan: 2,
},
{
id: "h",
title: "수요처명",
visible: true,
row: 1,
},
{
id: "i",
title: "주소",
visible: true,
row: 1,
},
{
id: "q",
title: "재이용시설",
visible: true,
row: 0,
colSpan: 5,
},
{
id: "q2",
title: "시설용량(m³/일)",
visible: true,
row: 1,
},
{
id: "q3",
title: "관로(km)",
visible: true,
row: 1,
},
{
id: "q4",
title: "용도",
visible: true,
row: 1,
},
{
id: "q5",
title: "공급량(m³/일)",
visible: true,
row: 1,
},
{
id: "q6",
title: "처리공법",
visible: true,
row: 1,
},
{
id: "k",
title: "보증수질",
visible: true,
row: 0,
colSpan: 13,
},
{
id: "k1",
title: "용도별",
visible: true,
row: 1,
},
{
id: "k2",
title: "총대장균군수​(개/100ml)",
visible: true,
row: 1,
},
{
id: "k3",
title: "결합잔류염소(mg/L)",
visible: true,
row: 1,
},
{
id: "k4",
title: "탁도(NTU)",
visible: true,
row: 1,
},
{
id: "k5",
title: "생물학적​산소요구량(BOD)(mg/L)​",
visible: true,
row: 1,
},
{
id: "k6",
title: "냄새​",
visible: true,
row: 1,
},
{
id: "k7",
title: "색도​",
visible: true,
row: 1,
},
{
id: "k8",
title: "총질소(T-N)(mg/L)​",
visible: true,
row: 1,
},
{
id: "k9",
title: "총인(T-P)(mg/L)",
visible: true,
row: 1,
},
{
id: "k10",
title: "수소이온농도(PH)​",
visible: true,
row: 1,
},
{
id: "k11",
title: "수소이온농도(PH)​",
visible: true,
row: 1,
},
{
id: "k12",
title: "전기전도도​(㎲/cm",
visible: true,
row: 1,
},
{
id: "k13",
title: "비고​",
visible: true,
row: 1,
},
{
id: "h",
title: "소요사업비(백만원)",
visible: true,
row: 0,
colSpan: 14,
},
{
id: "h1",
title: "총",
visible: true,
row: 1,
},
{
id: "h2",
title: "토목재이용시설",
visible: true,
row: 1,
},
{
id: "h3",
title: "토목관로",
visible: true,
row: 1,
},
{
id: "h4",
title: "건축",
visible: true,
row: 1,
},
{
id: "h5",
title: "기계",
visible: true,
row: 1,
},
{
id: "h6",
title: "전기・계측",
visible: true,
row: 1,
},
{
id: "h7",
title: "GIS・DB",
visible: true,
row: 1,
},
{
id: "h8",
title: "CCTV",
visible: true,
row: 1,
},
{
id: "h9",
title: "시공및준공",
visible: true,
row: 1,
},
{
id: "h10",
title: "페기물",
visible: true,
row: 1,
},
{
id: "h11",
title: "설계비",
visible: true,
row: 1,
},
{
id: "h12",
title: "감리비",
visible: true,
row: 1,
},
{
id: "h13",
title: "시설부대비",
visible: true,
row: 1,
},
{
id: "h14",
title: "기타",
visible: true,
row: 1,
},
{
id: "i",
title: "자원조달계획(백만원)",
visible: true,
row: 0,
colSpan: 4,
},
{
id: "i1",
title: "총",
visible: true,
row: 1,
},
{
id: "i2",
title: "국비",
visible: true,
row: 1,
},
{
id: "i3",
title: "지방비",
visible: true,
row: 1,
},
{
id: "i4",
title: "원인자부담",
visible: true,
row: 1,
},
{
id: "j",
title: "사업비정산(백만원)",
visible: true,
row: 0,
colSpan: 5,
},
{
id: "j1",
title: "총",
visible: true,
row: 1,
},
{
id: "j2",
title: "국비",
visible: true,
row: 1,
},
{
id: "j3",
title: "지방비",
visible: true,
row: 1,
},
{
id: "j4",
title: "원인자부담",
visible: true,
row: 1,
},
{
id: "j5",
title: "국고비율",
visible: true,
row: 1,
},
];
export const ruseUtzType: SelectDataType[] = [
{ text: "조경용수", val: "조경용수" },
{ text: "청소화장실용수", val: "청소화장실용수" },
{ text: "세척살수용수", val: "세척살수용수" },
{ text: "농업용수", val: "농업용수" },
{ text: "공업용수", val: "공업용수" },
{ text: "친수용수", val: "친수용수" },
{ text: "기타", val: "기타" },
];
@@ -0,0 +1,24 @@
import type { TableUpperProps } from "../../common/type/header";
import { ruseCaseHeadListExport } from "./headList";
export type ruseCaseState = {
ruseCase: {
ruseHeadList:TableUpperProps[];
};
};
type ruseCaseActions = {
};
export type ruseCaseType = ruseCaseState & ruseCaseActions;
export const ruseCaseStateExport: ruseCaseState = {
ruseCase: {
ruseHeadList:ruseCaseHeadListExport,
},
};
export const ruseCaseActionsExport: (set: any) => ruseCaseActions = (
set: any
) => {
return {
};
};
@@ -1,37 +1,29 @@
import { z } from "zod";
import type { CommonTableProps } from "../../common/type/headder";
import type { TableUpperProps } from "../../common/type/header";
export const sttnHeadListType = z.array(
z.object({
id: z.string(),
title: z.string(),
visible: z.boolean(),
})
);
export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [
export const ruseHstryHeadListExport:TableUpperProps[]= [
{
id: "ctpv",
id: "cityText",
title: "시도",
visible: true,
},
{
id: "sgg",
id: "sggText",
title: "시군구",
visible: true,
},
{
id: "coNm",
id: "dmdCoNm",
title: "회사명",
visible: true,
},
{
id: "addr",
id: "daddr",
title: "공장주소",
visible: true,
},
{
id: "telNo",
id: "telno",
title: "전화번호",
visible: true,
},
@@ -41,17 +33,17 @@ export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "rvwDt", //바꾸기
id: "rvwCmptnYmd", //바꾸기
title: "검토일자",
visible: true,
},
{
id: "matDt", //바꾸기
id: "mtchnCmptnYmd", //바꾸기
title: "매칭 완료일자",
visible: true,
},
{
id: "gong", //바꾸기
id: "ruseUtztnFcltNm", //바꾸기
title: "공급처",
visible: true,
},
@@ -66,120 +58,14 @@ export const ruseHstryHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "state", //바꾸기
id: "splyFcltFlg", //바꾸기
title: "진행상태",
visible: true,
},
{
id: "matYn", //바꾸기
id: "completeYn", //바꾸기
title: "매칭완료 여부",
visible: true,
},
];
// id는 다확인해야함
export const ruseHstryNodeListExport: CommonTableProps[] = [
{
id: "ctpv",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sgg",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "coNm",
title: "회사명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "addr",
title: "공장주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "telNo",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "regDt", //바꾸기
title: "신청일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "rvwDt", //바꾸기
title: "검토일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "matDt", //바꾸기
title: "매칭 완료일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "gong", //바꾸기
title: "공급처",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "dmndQty", //바꾸기
title: "요구수량(M3/d)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "useUsgCd", //바꾸기
title: "사용용도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "state", //바꾸기
title: "진행상태",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "matYn", //바꾸기
title: "매칭완료 여부",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
+204 -16
View File
@@ -1,34 +1,222 @@
import type { z } from "zod";
import type { sttnHeadListType } from "../coSttn/headList";
import type { CommonTableProps } from "../../common/type/headder";
import { ruseHstryHeadListExport, ruseHstryNodeListExport } from "./headList";
import type {
CommonTableProps,
TableUpperProps,
} from "../../common/type/header";
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";
const ruseHstryHeadList = ruseHstryHeadListExport;
const ruseHstryNodeList = ruseHstryNodeListExport;
const ruseHistHeadList = ruseHstryHeadListExport;
export type ruseHstryState = {
ruseHstry: {
ruseHist: {
isInit: boolean;
ruseHstryHeadList: z.infer<typeof sttnHeadListType>;
ruseHstryNodeList: CommonTableProps[];
rvwHistRes: DmdCoReqType[];
ruseHistHeadList: TableUpperProps[];
};
};
export const ruseHstryStateExport: ruseHstryState = {
ruseHstry: {
ruseHist: {
isInit: false,
ruseHstryHeadList: ruseHstryHeadList,
ruseHstryNodeList: ruseHstryNodeList,
}
}
rvwHistRes: [],
ruseHistHeadList: ruseHistHeadList,
},
};
export type ruseHstryType = ruseHstryState & ruseHstryActions;
type ruseHstryActions = {
ruseRvwHistInit: (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd?: string
) => void;
ruseRvwCalUpdate: (data: DmdCoReqType) => void;
ruseRvwSearch: (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string,
dmdCoNm: string,
ruseUtztnFcltNm: string
) => void;
ruseRvwInqua: (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string
) => void;
ruseRvwComplete:( data: string[]) => void;
};
export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (set: any) => {
return {
const irvwHistInit = async (
pageNo: number,
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}`;
}
}
const rvwHistRes = await getFetch(fetchType.WR, url);
return rvwHistRes;
};
export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (
set: any
) => {
return {
ruseRvwHistInit: async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd?: string
) => {
const rvwHistRes = await irvwHistInit(
pageNo,
pageCnt,
startYear,
endYear,
sggCd
);
return set((state: ruseHstryState) => ({
...state,
ruseHist: {
...state.ruseHist,
init: false,
rvwHistRes: rvwHistRes,
},
}));
},
ruseRvwCalUpdate: async (data: DmdCoReqType) => {
try {
const update = await putFectch(
`/reuseFc/request/cst`,
JSON.stringify(data)
);
if (update.status === 200) {
toast.success("매칭 계산 저장이 완료입니다.");
const rvwHistRes = await irvwHistInit(
1,
10,
new Date().getFullYear().toString(),
new Date().getFullYear().toString(),
"0"
);
return set((state: ruseHstryState) => ({
...state,
ruseHist: {
...state.ruseHist,
init: false,
rvwHistRes: rvwHistRes,
},
}));
}
} catch (e) {
toast.error("매칭 계산 저장이 오류입니다.");
console.log(e);
}
},
ruseRvwSearch: async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string,
dmdCoNm: string,
ruseUtztnFcltNm: string
) => {
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
if (sggCd.length > 0) {
url += `/${sggCd}`;
} else {
url += `/0`;
}
if (dmdCoNm?.length > 0) {
url += `/${dmdCoNm}`;
} else {
url += `/0`;
}
if (ruseUtztnFcltNm?.length > 0) {
url += `/${ruseUtztnFcltNm}`;
} else {
url += `/0`;
}
const rvwHistRes = await getFetch(fetchType.WR, url);
return set((state: ruseHstryState) => ({
...state,
ruseHist: {
...state.ruseHist,
rvwHistRes: rvwHistRes,
},
}));
},
ruseRvwInqua: async (
pageNo: number,
pageCnt: number,
startYear: string,
endYear: string,
sggCd: string
) => {
try {
let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`;
if (sggCd.length > 0) {
url += `/${sggCd}/0`;
}
const rvwHistRes = await getFetch(fetchType.WR, url);
return set((state: ruseHstryState) => ({
...state,
ruseHist: {
...state.ruseHist,
rvwHistRes: rvwHistRes,
},
}));
} catch (e) {
console.log(" error ", e);
}
},
ruseRvwComplete: async (data: string[]) => {
try {
const complet = await postFectch(
`/reuseFc/request/completeCheck`,
JSON.stringify(data),
fetchType.WR
);
if (complet.status === 200) {
toast.success("완료 처리가 완료되었습니다.");
const rvwHistRes = await irvwHistInit(
1,
10,
new Date().getFullYear().toString(),
new Date().getFullYear().toString(),
"0"
);
}
} catch (e) {
console.log(" error ", e);
toast.error("완료 처리 중 오류가 발생했습니다.");
}
},
};
};
@@ -1,4 +1,4 @@
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
import { z } from "zod";
export const chkgdRegExcel = z.object({
@@ -123,16 +123,16 @@ export const rainHeadNmExport: chHeadType[] = [
];
export const rainChkgdnHeadListExport: TableUpperProps[] = [
{ id: "order", title: "순번", rowSpan: true },
{ id: "checkBox", title: "선택", rowSpan: true },
{ id: "cityText", title: "시도", rowSpan: true },
{ id: "sggText", title: "시군구", rowSpan: true },
{ id: "bdstNm", title: "시설명", rowSpan: true },
{ id: "operMngCd", title: "운영관리형태", rowSpan: true },
{ id: "oilqMeasMthd", title: "유량측정방법", rowSpan: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", rowSpan: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", rowSpan: true },
{ id: "chckYmd", title: "점검일", rowSpan: true },
{ id: "order", title: "순번", mergeCell: true },
{ id: "checkBox", title: "선택", mergeCell: true },
{ id: "cityText", title: "시도", mergeCell: true },
{ id: "sggText", title: "시군구", mergeCell: true },
{ id: "bdstNm", title: "시설명", mergeCell: true },
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "totalSplyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
@@ -1,7 +1,6 @@
import { buildingType } from "@/app/store/common/code";
import {
TEST_UUID,
type TableUpperProps,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import {
deleteFectch,
@@ -22,6 +21,7 @@ import {
splHeadListExport,
type chHeadType,
} from "./headList";
import type { TableUpperProps } from "@/app/store/common/type/header";
export type rainChkZodType = z.infer<typeof rainChkZod>;
const fcltDiv = [
@@ -217,7 +217,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
try {
const res = await deleteFectch(`/reuseChk/rainy`, chkgdnPks);
if (res.ok) {
if (res) {
ToastFormUi({
body: "삭제가 완료되었습니다. ",
title: "지도점검 삭제",
@@ -1,6 +1,6 @@
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { z } from "zod";
import { guideDetail, type chHeadType } from "../rainChkgdn/headList";
import type { TableUpperProps } from "@/app/store/common/type/header";
export type polutionType = {
chkgdnDtlFk: number;
@@ -115,16 +115,16 @@ export const rswtHeadNmExport: chHeadType[] = [
];
export const rswtChkHeadListExport: TableUpperProps[] = [
{ id: "order", title: "순번", rowSpan: true },
{ id: "checkBox", title: "선택", rowSpan: true },
{ id: "cityText", title: "시도" ,rowSpan: true },
{ id: "sggText", title: "시군구",rowSpan: true },
{ id: "bdstNm", title: "시설명" ,rowSpan: true},
{ id: "operMngCd", title: "운영관리형태" ,rowSpan: true},
{ id: "anlOperCst", title: "연간운영비(원/년)" ,rowSpan: true},
{ id: "prcsCpct", title: "처리용량(m³)" ,rowSpan: true},
{ id: "spwtPositn", title: "채수지점" ,rowSpan: true},
{ id: "chckYmd", title: "점검일" ,rowSpan: true},
{ id: "order", title: "순번", mergeCell: true },
{ id: "checkBox", title: "선택", mergeCell: true },
{ id: "cityText", title: "시도" ,mergeCell: true },
{ id: "sggText", title: "시군구",mergeCell: true },
{ id: "bdstNm", title: "시설명" ,mergeCell: true},
{ id: "operMngCd", title: "운영관리형태" ,mergeCell: true},
{ id: "anlOperCst", title: "연간운영비(원/년)" ,mergeCell: true},
{ id: "prcsCpct", title: "처리용량(m³)" ,mergeCell: true},
{ id: "spwtPositn", title: "채수지점" ,mergeCell: true},
{ id: "chckYmd", title: "점검일" ,mergeCell: true},
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" ,type: "number"},
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)",type: "number"},
@@ -1,7 +1,10 @@
import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
type NameMap = {
[key: string]: string;
};
const nameMap = {
const nameMap:NameMap = {
"세척수": "wshwtr",
"냉각수": "coolUswtr",
"청소수": "cleanUswtr",
@@ -20,24 +23,33 @@ import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg";
};
export const excelToPbnPrfData = (excelData: any[], year: string) => {
export const excelToPbnPrfData = (excelData: JSON[], year: string,pbnstRuseFcltFk:string) => {
// 월별 데이터 하나로 병합
const merged = {} as any;
excelData.forEach((item: any) => {
const key = nameMap[item["용수명"]];
const usageNm = item["용수명"]
const key = nameMap[usageNm as any];
if (!key) return;
for (let i = 1; i <= 12; i++) {
const month = i.toString().padStart(2, "0");
const ym = year + month;
if (!merged[ym]) merged[ym] = { ym };
merged[ym][key] = Number(item[`${i}월`] ?? 0);
}
});
const pbnPrfData = Object.values(merged);
console.log(pbnPrfData);
const data = pbnPrfData.map((item) => {
return pbnPrfData;
return({
...(item as object),
pbnstRuseFcltFk:pbnstRuseFcltFk,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
})
})
return data;
};
@@ -1,9 +1,10 @@
import { z } from "zod";
import type { TableUpperProps } from "../../ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "../../common/type/header";
export const pbnPrfRegExcelZod = z.object({
ym: z.string().default(""),
bscFctNm: z.string().default(""),
pbnstRuseFcltFk:z.string(),
pbnstRuseFcltNm: z.string().default(""),
file: z.instanceof(File).optional(),
});
@@ -12,23 +13,26 @@ export const pbnstPrfmncHeadListExport: TableUpperProps[] = [
{ id: "sido", title: "시도" },
{ id: "gugun", title: "시군구" },
{ id: "bscFctNm", title: "시설명" },
{ id: "sisul", title: "재이용시설명" },
{ id: "sisulCd", title: "재이용시설코드" },
{ id: "ruseUtztnFcltNm", title: "재이용시설명" },
{ id: "pbnstRuseFcltPk", title: "재이용시설코드" },
];
export const monthHeadListExport: TableUpperProps[] = [
{ id: "gubun", title: "구분" },
{ id: "용수명", title: "용수명" },
{ id: "total", title: "계" },
{ id: "mon1", title: "1월" },
{ id: "mon2", title: "2월" },
{ id: "mon3", title: "3월" },
{ id: "mon4", title: "4월" },
{ id: "mon5", title: "5월" },
{ id: "mon6", title: "6월" },
{ id: "mon7", title: "7월" },
{ id: "mon8", title: "8월" },
{ id: "mon9", title: "9월" },
{ id: "mon10", title: "10월" },
{ id: "mon11", title: "11월" },
{ id: "mon12", title: "12월" },
{ id: "1월", title: "1월" ,edit: true },
{ id: "2월", title: "2월" ,edit: true },
{ id: "3월", title: "3월" ,edit: true },
{ id: "4월", title: "4월" ,edit: true },
{ id: "5월", title: "5월" ,edit: true },
{ id: "6월", title: "6월" ,edit: true },
{ id: "7월", title: "7월" ,edit: true },
{ id: "8월", title: "8월" ,edit: true },
{ id: "9월", title: "9월" ,edit: true },
{ id: "10월", title: "10월" ,edit: true },
{ id: "11월", title: "11월" ,edit: true },
{ id: "12월", title: "12월" ,edit: true },
];
@@ -1,79 +1,113 @@
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
import type { TableUpperProps } from "../../ruseFcltMng/fcltReg/rainReg";
import {
pbnstPrfmncHeadListExport,
monthHeadListExport,
} from "./headList";
import { pbnstPrfmncHeadListExport, monthHeadListExport } from "./headList";
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";
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
const monthHeadList = monthHeadListExport;
export type pbnstPrfmncState = {
prfmnc: {
isInit: boolean;
pbnstPrfmncHeadList: TableUpperProps[];
monthHeadList: TableUpperProps[];
prfmncRes: pubHasuType[];
excelList: Number[];
}
}
prfmnc: {
isInit: boolean;
pbnstPrfmncHeadList: TableUpperProps[];
monthHeadList: TableUpperProps[];
prfmncRes: FcPrfType[];
excelList: Number[];
};
};
export const pbnstPrfmncStateExport: pbnstPrfmncState = {
prfmnc: {
isInit: false,
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
monthHeadList: monthHeadList,
prfmncRes: [],
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
}
}
prfmnc: {
isInit: false,
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
monthHeadList: monthHeadList,
prfmncRes: [],
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
},
};
export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
type pbnstPrfmncActions = {
prfmncHasuInit: (page: string, sggOrCity: string) => void;
}
prfmncHasuInit: (page: string, sggOrCity: string) => void;
prfmnRegData: (data:PrfType) =>void
};
const checkWrRegList = async () => {
const wrRegList = await getFetch("wr", `/reuseFc/pubFc`);
return wrRegList;
const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`);
return wrRegList;
};
const hasuListFetch = async (page: string, sggOrCity: string) => {
const checkWrRegListRes = await checkWrRegList();
const rainRes = await postFectch(
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
checkWrRegListRes,
fetchType.COMMON
const checkWrRegListRes = await checkWrRegList();
const rainRes = await postFectch(
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
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 hasuList = rainRes.data.map((item: any) => {
return {
...item,
ruse: item.ruse === false ? "N" : "Y",
};
});
return hasuList;
};
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (set: any) => {
return {
prfmncHasuInit: async (page: string, sggOrCity: string) => {
try {
const prfmncRes = await hasuListFetch(page, sggOrCity);
console.log("prfmncRes", prfmncRes)
return set((state: pbnstPrfmncState) => ({
...state,
prfmnc: {
...state.prfmnc,
prfmncRes: prfmncRes,
isInit: false,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
}
}
sido: findData?.sido,
gugun: findData?.gugun,
bscFctNm: findData?.bscFctNm,
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
pbnstRuseFcltPk: item.pbnstRuseFcltPk,
prfList : item.prfList
};
});
return data;
};
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
set: any
) => {
return {
prfmncHasuInit: async (page: string, sggOrCity: string) => {
try {
const prfmncRes = await hasuListFetch(page, sggOrCity);
console.log("prfmncRes", prfmncRes);
return set((state: pbnstPrfmncState) => ({
...state,
prfmnc: {
...state.prfmnc,
prfmncRes: prfmncRes,
isInit: false,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
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: "하수재이용 시설 실적 등록",
});
}
},
};
};
@@ -0,0 +1,346 @@
import { z } from "zod";
import type { TableUpperProps } from "../../common/type/header";
import { fcOperSchema } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
export const PrfSchema = z.object({
pbnstRuseFcltFk: z.string(),
ym: z.string(), // 예: "202310"
wshwtr: z.number(),
coolUswtr: z.number(),
cleanUswtr: z.number(),
drwtUswtr: z.number(),
dltnUswtr: z.number(),
ithlRswtr: z.number(),
ithlEtcUswtr: z.number(),
cleanToilUswtr: z.number(),
resn: z.number(),
lndwtr: z.number(),
hydUswtr: z.number(),
rvrKeepUswtr: z.number(),
farmUswtr: z.number(),
ugwtChr: z.number(),
indstUswtr: z.number(),
regDt: z.date().default(new Date()).nullish(),
rgtr: z.string().nullish(),
mdfcnDt: z.date().default(new Date()).nullish(),
mdfr: z.string().nullish(),
});
export const FcPrfSchema = z.object({
pbnstRuseFcltPk: z.string(),
ruseUtztnFcltNm: z.string(),
fcltCpct: z.number(),
ruseCpct: z.number(),
splyExtraCpct: z.number(),
regDt: z.date().default(new Date()),
rgtr: z.string(),
mdfcnDt: z.date().default(new Date()),
mdfr: z.string(),
prfList: z.array(PrfSchema),
operList:z.array(fcOperSchema),
bscFctNm: z.string().nullish(),
});
export type FcPrfType = z.infer<typeof FcPrfSchema>;
export type PrfType = z.infer<typeof PrfSchema>;
export const initValInUsage = [
{
usage: "wshwtr",
용수명: "세척수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "coolUswtr",
용수명: "냉각수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "cleanUswtr",
용수명: "청소수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "drwtUswtr",
용수명: "식수대",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "dltnUswtr",
용수명: "희석용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "ithlRswtr",
용수명: "중수도",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "ithlEtcUswtr",
용수명: "기타",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "resn",
용수명: "세척살수용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "cleanToilUswtr",
용수명: "청소화장실용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
];
export const initValOutUsage = [
{
usage: "lndwtr",
용수명: "조경용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "hydUswtr",
용수명: "친수용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "ugwtChr",
용수명: "지하수충전",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "farmUswtr",
용수명: "농업용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "rvrKeepUswtr",
용수명: "하천등유지용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
{
usage: "indstUswtr",
용수명: "공업용수",
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
},
];
export const subTotalObj = {
usage: "subtotal",
용수명: "소계",
edit: false,
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
};
export const totalObj = {
usage: "total",
용수명: "총합계",
edit: false,
total: 0,
"1월": 0,
"2월": 0,
"3월": 0,
"4월": 0,
"5월": 0,
"6월": 0,
"7월": 0,
"8월": 0,
"9월": 0,
"10월": 0,
"11월": 0,
"12월": 0,
};
@@ -1,15 +1,15 @@
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
export const rainChkgdnHeadSttnExport: TableUpperProps[] = [
{ id: 'order', title: "순번", rowSpan: true },
{ id: "cityText", title: "시도", rowSpan: true },
{ id: "sggText", title: "시군구", rowSpan: true },
{ id: "bdstNm", title: "시설명", rowSpan: true },
{ id: "operMngCd", title: "운영관리형태", rowSpan: true },
{ id: "oilqMeasMthd", title: "유량측정방법", rowSpan: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", rowSpan: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", rowSpan: true },
{ id: "chckYmd", title: "점검일", rowSpan: true },
{ id: 'order', title: "순번", mergeCell: true },
{ id: "cityText", title: "시도", mergeCell: true },
{ id: "sggText", title: "시군구", mergeCell: true },
{ id: "bdstNm", title: "시설명", mergeCell: true },
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "totalSplyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
@@ -1,4 +1,4 @@
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
export const rswtChkSttnHeadListExport: TableUpperProps[] = [
{ id: "order", title: "순번", rowSpan: true },
@@ -1,8 +1,7 @@
import { rswtHeadNmExport } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
import { rswtChkSttnHeadListExport, rswtDetailSttnHeadListExport } from "./headList";
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { sheetParameter } from "@common/business_components/ui";
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
import { getFetch } from "@/components/lib/api";
import { buildingExcelRswtSttn } from "./excel";
@@ -0,0 +1,59 @@
import { z } from "zod";
import type { TableUpperProps } from "../../ruseFcltMng/fcltReg/rainReg";
export const pbnstPrfmncSttnHeadListExport: TableUpperProps[] = [
{
id: "number",
title: "No",
rowSpan: 2,
row: 0
},
{
id: "sido",
title: "시도",
rowSpan: 2,
row: 0
},
{
id: "gugun",
title: "시군구",
rowSpan: 2,
row: 0
},
{
id: "bscFctNm",
title: "시설명",
rowSpan: 2,
row: 0
},
{
id: "ruseUtztnFcltNm",
title: "재이용시설명",
rowSpan: 2,
row: 0
},
]
export const pbnstYearHeadListExport: TableUpperProps[] = [
{
title: "년도",
colSpan: 3,
row: 0
},
{
id: "total",
title: "계",
row: 1
},
{
id: "inUsage",
title: "장내용수",
row: 1
},
{
id: "outUsage",
title: "장외용수",
row: 1
},
]
@@ -0,0 +1,192 @@
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
import type { TableUpperProps } from "../../common/type/header";
import { pbnstPrfmncSttnHeadListExport, pbnstYearHeadListExport } from "./headList";
import type { FcPrfType, PrfType } from "../../prfmncReg/pbnstPrfmncReg/type";
import type { pubHasuType, selectLabel } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
import type { ReturnType } from "@common/business_components";
type pbnstPrfmncSttnActions = {
tableHeadMaker: (startYear: number, endYear: number) => void;
pbnstPrfmncInit: (page: string, sggOrCity: string) => void;
pbnstPrfmncSearch: (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => void;
}
const pbnstPrfmncRes: PrfType[] = [];
const prfmncRes: FcPrfType[] = [];
export type pbnstPrfmncSttnState = {
pbnstPrfmncSttn: {
pbnstPrfHeadList: TableUpperProps[];
pbnstPrfmncRes: PrfType[];
prfmncRes: any[];
isInit: boolean;
rawData: any[];
selectYearList: selectLabel[]
}
}
export type pbnstPrfmncSttnType = pbnstPrfmncSttnState & pbnstPrfmncSttnActions;
export const pbnstPrfmncSttnExport: pbnstPrfmncSttnState = {
pbnstPrfmncSttn: {
pbnstPrfHeadList: [...pbnstPrfmncSttnHeadListExport],
pbnstPrfmncRes: pbnstPrfmncRes,
prfmncRes: prfmncRes,
isInit: false,
rawData: [],
selectYearList: []
}
}
const checkWrRegList = async () => {
const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`);
return wrRegList;
};
const hasuListFetch = async (page: string, sggOrCity: string) => {
const checkWrRegListRes = await checkWrRegList();
const rainRes = await postFectch(
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
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)
);
return {
sido: findData?.sido,
gugun: findData?.gugun,
bscFctNm: findData?.bscFctNm,
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
pbnstRuseFcltPk: item.pbnstRuseFcltPk,
};
});
return data;
}
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
set: any
) => {
return {
tableHeadMaker: (startYear: number, endYear: number) => {
let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport];
const selectList = [] as unknown as selectLabel[]
for (let i = startYear; i <= endYear; i++) {
const yearHead = JSON.parse(JSON.stringify(pbnstYearHeadListExport));
if (yearHead) {
yearHead.forEach((item: { id?: number; }) => {
if (item.id) {
item.id = i + item.id;
}
})
if (yearHead[0])
yearHead[0].title = i + "년도"
}
yearHeader = [...yearHeader, ...yearHead]
selectList.push({text: i + "년도", val: String(i)} )
}
set((state: pbnstPrfmncSttnState) => {
return {
...state,
pbnstPrfmncSttn: {
pbnstPrfHeadList: [...yearHeader],
selectYearList: selectList
},
};
});
},
pbnstPrfmncInit: async (page: string, sggOrCity: string) => {
try {
const prfmncRes = await hasuListFetch(page, sggOrCity);
return set((state: pbnstPrfmncSttnState) => ({
...state,
pbnstPrfmncSttn: {
...state.pbnstPrfmncSttn,
prfmncRes: prfmncRes,
isInit: false,
},
}));
} catch (e) {
console.log(e)
}
},
pbnstPrfmncSearch: async (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => {
let searchUrl = "";
if (returnType.sigunValue !== undefined) {
if (swtrmtFcltNm !== "") {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW${'/' + swtrmtFcltNm}`;
} else {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW`;
}
} else {
if (swtrmtFcltNm !== "") {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW${'/' + swtrmtFcltNm}`;
} else {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW`;
}
}
const pbnstRes = await getFetch(
fetchType.COMMON,
searchUrl
);
const bscFctCdList = pbnstRes.map((item: any) => {
return item.bscFctCd;
})
const res = await postFectch(
`/reuseFc/pubDetailList/${fromDate}/${toDate}`,
bscFctCdList,
`wr`,
)
let inUsageSum = 0;
let outUsageSum = 0;
let usageSum = 0;
let year = "";
const yearsData = []
res.data.forEach((item) => {
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)
if (yearData) {
yearData.inUsageSum += inUsageSum;
yearData.outUsageSum += outUsageSum;
} else {
const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk }
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 })
}
})
return set((state: pbnstPrfmncSttnState) => ({
...state,
pbnstPrfmncSttn: {
...state.pbnstPrfmncSttn,
prfmncRes: resData,
rawData: res.data
},
}));
}
}
}
@@ -2,13 +2,9 @@ import { getFetch } from "@/components/lib/api";
import { TEST_UUID, type customRainBdst } from "../rainReg";
import type { customHtdflBdst } from "../htdflReg";
import type { customRswtBdst } from "../rswtReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
type TableUpperProps = {
id: string;
title: string;
upName?: string;
upSequnce?: number;
};
const moUpHeadList: TableUpperProps[] = [
{ id: "cityText", title: "시도" },
{ id: "sggText", title: "시군구" },
@@ -16,9 +12,6 @@ type TableUpperProps = {
{ id: "daddr", title: "위치" },
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
{ id: "archArea", title: "건축면적", },
// { id: "archChgYn", title: "여부", upName: "upChangeRe", upSequnce: 1 },
// { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 },
// { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
];
@@ -1,8 +1,9 @@
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { upHeadList, type chgBuilding, type TableUpperProps } from "../rainReg";
import { upHeadList, type chgBuilding} from "../rainReg";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
export const hdtflZod = z.object({
bdstInfoPk: z.number().nullish(),
@@ -1,5 +1,5 @@
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { TableUpperProps } from "../rainReg";
export const pubFacHeadListExport: TableUpperProps[] = [
{ id: "sido", title: "시도" },
@@ -14,20 +14,16 @@ export const pubFacHeadListExport: TableUpperProps[] = [
export const pbnstMngUpHeadListExport: TableUpperProps[] = [
{ id: "choose", title: "선택", type: "checkbox" },
{ id: "operMthd", title: "운영방식", edit: true },
{ id: "operMthd", title: "운영방식",type: "select", selectData: "ruseMngMtd" },
{ id: "rprtvBzenty", title: "대행업체", edit: true },
{
id: "bgngDt",
title: "시작일",
upName: "upChangeRe",
upSequnce: 1,
type: "date",
},
{
id: "endDt",
title: "종료일",
upName: "upChangeRe",
upSequnce: 2,
type: "date",
},
];
@@ -50,7 +46,7 @@ export const pbnstDemandHeadListExport: TableUpperProps[] = [
];
export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [
{ id: "ruseUtztnFcltNm", title: "운영방식" },
{ id: "ruseUtztnFcltNm", title: "하수처리장명" },
{ id: "orgwtWtritQnt", title: "원수취수량" },
{ id: "tmsYn", title: "하수처리량TMS 전후" },
{ id: "dschgFmYn", title: "하수처리장 방류 유량계 전·후​" },
@@ -73,6 +69,7 @@ export type formDetailType = {
id: string;
lable: string;
type?: string;
option?:string
};
export const wasteWaterFcltINfo: formDetailType[] = [
@@ -103,7 +100,7 @@ export const businessMoneyInfo: formDetailType[] = [
{ id: "lcep", lable: "지방비", type: "number" },
{ id: "cusrAlotm", lable: "민간투자비", type: "number" },
{ id: "etc", lable: "기타" },
{ id: "totalMoney", lable: "합계", type: "number" },
{ id: "totalMoney", lable: "합계", type: "number" ,option:"readOnly" },
];
export const businessSttnInfo: formDetailType[] = [
@@ -1,5 +1,4 @@
import { z } from "zod";
import { TEST_UUID, type TableUpperProps } from "../rainReg";
import { TEST_UUID } from "../rainReg";
import {
deleteFectch,
fetchType,
@@ -9,8 +8,6 @@ import {
} from "@/components/lib/api";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import {
exampleData,
fcBizSchema,
type customPbnst,
type fcBizType,
type pbnstInsertIndex,
@@ -26,6 +23,7 @@ import {
pbnstDemandHeadListExport,
fcOrgwtsHeadListExport,
} from "./headList";
import type { TableUpperProps } from "@/app/store/common/type/header";
const selectLabel: SelectDataType[] = [{ text: "test", val: "1" }];
const pubFacHeadList = pubFacHeadListExport;
@@ -70,8 +68,8 @@ type pubFacActions = {
getpbnstInsertIndex: (data: pbnstInsertIndex) => void;
pbnstRuseFcltUpdate: (ruseRes: customPbnst[]) => void;
pbnstRuseBizUpdate: (ruseRes: fcBizType[]) => void;
pubHasuSearch :(page: string, sggOrCity: string , searchTxt:string) => void
};
export type pubFacType = pubFacState & pubFacActions;
export const pubFacStateExport: pubFacState = {
@@ -81,14 +79,14 @@ export const pubFacStateExport: pubFacState = {
pbnstMngUpHeadList: pbnstMngUpHeadList,
pbnstMngNm: pbnstMngNm,
pbnstOrgwtHeadList: pbnstOrgwtHeadList,
pbnstHasuRes: [],
pbnstResObj: null, // 초기값을 null로 변경
pbnstRes: [], // 초기값을 null로 변경
pbnstBizCycle: [{ text: "없음", val: "1" }],
selectLabel: selectLabel,
pplInstlsHeadLisat: pplInstlsHeadLisat,
pbnstDemandHeadList: pbnstDemandHeadList,
fcOrgwtsHeadList: fcOrgwtsHeadList,
selectLabel: selectLabel,
pbnstResObj: null, // 초기값을 null로 변경
pbnstHasuRes: [],
pbnstRes: [], // 초기값을 null로 변경
pbnstBizCycle: [{ text: "없음", val: "1" }],
pbnstMngRegData: [],
pbnsUpdateIndex: {} as pbnstInsertIndex,
dmdComList: [],
@@ -100,11 +98,15 @@ const checkWrRegList = async () => {
return wrRegList;
};
const hasuListFetch = async (page: string, sggOrCity: string) => {
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`;
if(searchTxt){
url= url +`/${searchTxt}`
}
const rainRes = await postFectch(
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
url,
checkWrRegListRes,
fetchType.COMMON
);
@@ -146,12 +148,12 @@ export const writeRgtrAndMdfr = (data: customPbnst[]) => {
});
return item;
});
pbnst.fcOpers = pbnst.fcOpers.map((oper) => {
pbnst.fcOpers = pbnst?.fcOpers?.map((oper) => {
oper.rgtr = TEST_UUID;
oper.mdfr = TEST_UUID;
return oper;
});
pbnst.fcFiles = pbnst.fcFiles.map((file) => {
pbnst.fcFiles = pbnst.fcFiles?.map((file) => {
file.rgtr = TEST_UUID;
file.mdfr = TEST_UUID;
return file;
@@ -179,8 +181,22 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
} catch (errorHasu) {
console.log(errorHasu);
}
},
},pubHasuSearch : async(page: string, sggOrCity: string , searchTxt:string)=> {
try{
const pbnstHasuRes = await hasuListFetch(page, sggOrCity,searchTxt);
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstHasuRes: pbnstHasuRes,
isInit: false,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
pbnstRegClick: async (pubHasuRes: pubHasuType) => {
try {
const pbnstRes = await initFetch(pubHasuRes.bscFctCd);
@@ -218,7 +234,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
const response = await postFectch(
`/reuseFc/pubFc`,
JSON.stringify( writeRgtrAndMdfr([pbnstRes]))
JSON.stringify( pbnstRes)
);
return set((state: pubFacState) => ({
@@ -273,7 +289,6 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
};
});
console.log(" pbnstBizCycle ", pbnstBizCycle);
return set((state: pubFacState) => ({
...state,
pbnst: {
@@ -322,7 +337,6 @@ 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 =
@@ -374,6 +388,6 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
} catch (e) {
console.log(e);
}
},
}
};
};
@@ -58,67 +58,8 @@ export type PbnstDemandComType = {
splyCpct: number | 0;
splyFmYn:string|'Y'
dmdInfoFk:string|''
}
export type fcBizType = z.infer<typeof fcBizSchema>;
export type fcOrgwtType = z.infer<typeof fcOrgwtSchema>;
export type ppInstlType = z.infer<typeof pplInstlSchema>;
export type operType = z.infer<typeof fcOperSchema>;
export type fcFileType = z.infer<typeof fcFileSchema>;
const pplInstlSchema = z.object({
ruseFcltBizFk: z.number(),
choose:z.boolean().default(false),
pdmt: z.string().default(''),
ppMqlt: z.string().default(""),
cpct: z.number().default(0),
});
const fcFileSchema = z.object({
ruseFcltFk: z.number().nullish(),
fileTkn: z.string(),
filePath: z.string(),
fileKnd: z.string(),
regDt: z.date().default(new Date()).nullish(),
rgtr: z.string().nullish(),
mdfcnDt: z.date().default(new Date()).nullish(),
mdfr: z.string().nullish(),
});
const fcOperSchema = z.object({
pbnstRuseFcltOperInfoPk: z.number().nullish(),
pbnstRuseFcltFk: z.string().nullish(),
operMthd: z.string(),
rprtvBzenty: z.string(),
bgngDt: z.date().default(new Date()),
endDt: z.date().default(new Date()),
regDt: z.date().nullish(),
rgtr: z.string().default(""),
mdfcnDt: z.date().nullish(),
mdfr: z.string().default(""),
choose: z.boolean().default(false),
});
const fcOrgwtSchema = z.object({
pbnstRuseFcltBizFk: z.string().nullish(),
swtrmtFcltFk: z.number().default(0),
orgwtWtritQnt: z.number(),
tmsYn: z.enum(["Y", "N"] ).default("N"),
dschgFmYn: z.enum(["Y", "N"] ).default("N"),
dtlPstnExpln: z.string().default(''),
regDt: z.date().nullish(),
rgtr: z.string().default(''),
mdfcnDt: z.date().nullish(),
mdfr: z.string().default(''),
choose: z.boolean().default(false),
});
const pubHasuZod = z.object({
choose: z.boolean().default(false),
bscFctCd: z.string(),
@@ -130,98 +71,141 @@ const pubHasuZod = z.object({
addr:z.string().nullish()
});
const demandInfoList = z.object({
})
export type pubHasuType = z.infer<typeof pubHasuZod>;
const zDate = z.preprocess((v) => (v ? new Date(v as string) : undefined), z.date()).nullish() ;
const zDateNullish = zDate.nullish();
const zDateDefaultNow = zDate.default(new Date());
const zNum = z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number());
const zNumNullish = zNum.nullish();
const zNumDefaultZero = zNum.default(0).nullish();
const pplInstlSchema = z.object({
ruseFcltBizFk: zNumNullish,
choose: z.boolean().default(false),
pdmt: z.string().default(''),
ppMqlt: z.string().default(""),
cpct: zNumDefaultZero,
});
const fcFileSchema = z.object({
ruseFcltFk: z.string().nullish(),
fileTkn: z.string(),
filePath: z.string(),
fileKnd: z.string(),
regDt: zDateDefaultNow.nullish(),
rgtr: z.string().nullish(),
mdfcnDt: zDateDefaultNow.nullish(),
mdfr: z.string().nullish(),
});
export const fcOperSchema = z.object({
pbnstRuseFcltOperInfoPk: zNumNullish,
pbnstRuseFcltFk: z.string().nullish(),
operMthd: z.string(),
rprtvBzenty: z.string(),
bgngDt: zDateDefaultNow,
endDt: zDateDefaultNow,
regDt: zDateNullish,
rgtr: z.string().default(""),
mdfcnDt: zDateNullish,
mdfr: z.string().default(""),
choose: z.boolean().default(false),
});
const fcOrgwtSchema = z.object({
pbnstRuseFcltBizFk:zNumNullish,
swtrmtFcltFk: z.string().nullish(),
orgwtWtritQnt: zNum,
tmsYn: z.enum(["Y", "N"]).default("N"),
dschgFmYn: z.enum(["Y", "N"]).default("N"),
dtlPstnExpln: z.string().default(''),
regDt: zDateNullish,
rgtr: z.string().default(''),
mdfcnDt: zDateNullish,
mdfr: z.string().default(''),
choose: z.boolean().default(false),
});
const dmdColist = z.object({
dmdInfoFk:z.string().default(''),
dmdInfoFk: z.string().default(''),
dmdCoNm: z.string().default(''),
daddr: z.string(),
useUsgCd: z.string().default(""),
splyBgngDay: z.date().default(new Date()),
splyEndDay: z.date().default(new Date()),
splyCpct: z.number().default(0),
splyBgngDay: zDateDefaultNow,
splyEndDay: zDateDefaultNow,
splyCpct: zNumDefaultZero,
splyFmYn: z.string().default('Y'),
rgtr: z.string().nullish(),
mdfr: z.string().nullish(),
pbnstRuseFcltBizPk: z.number(),
pbnstRuseFcltFk: z.string(),
//telno:z.string().default('')
pbnstRuseFcltBizPk: zNumDefaultZero,
pbnstRuseFcltFk: z.string().nullish(),
});
export const fcBizSchema = z.object({
pbnstRuseFcltBizPk: z.number().default(1),
pbnstRuseFcltBizPk: zNumNullish,
pbnstRuseFcltFk: z.string().nullish(),
superkey: z.string().default("").nullish(),
cycl: z.number().default(1),
cycl: zNum.default(1),
seCd: z.string().default(""),
bizMthdCd: z.string().default(""),
instlAprvSncnDt: z.date().nullish(),
bizCmcnDay: z.date().nullish(),
gvsbs: z.number().default(0),
lcep: z.number().default(0),
cusrAlotm: z.number().default(0),
instlAprvSncnDt: zDateDefaultNow,
bizCmcnDay: zDateDefaultNow,
gvsbs: zNumDefaultZero,
lcep: zNumDefaultZero,
cusrAlotm: zNumDefaultZero,
etc: z.string().default(''),
totalMoney: z.number().default(0).nullish(),
rprcsFcltCpct: z.number().default(0),
totalMoney: zNumNullish.default(0),
rprcsFcltCpct: zNumDefaultZero,
majorPrcsMsrcCd: z.string().default(""),
addr: z.string().default(''),
rprcsMthdCd: z.string().default(""),
inoutYn: z.enum(["Y", "N"]).default("Y"),
mainSplyPumpCpct: z.number().nullish(),
erctWtrOcrnCpct: z.number().nullish(),
mainSplyPumpCpct: zNumNullish,
erctWtrOcrnCpct: zNumNullish,
erctUswtrLinkSpt: z.string().nullish(),
erctUswtrFcltCpct: z.number().nullish(),
erctUswtrFcltCpct: zNumNullish,
erctUswtrPrcsMeth: z.string().nullish(),
erctUswtrPrcsMsrcCd: z.string().nullish(),
wwtEmsnFcltPrmsnYn: z.enum(["Y", "N"]).default("Y"),
tmsInstlYn: z.enum(["Y", "N"]).default("Y"),
pbnstDrngInflwExclYn: z.enum(["Y", "N"]).default("Y"),
bod: z.number().default(0),
grssClfg: z.number().default(0),
combResdch: z.number().default(0),
trbt: z.number().default(0),
clIonQnt: z.number().default(0),
smll: z.number().default(0),
crmty: z.number().default(0),
tph: z.number().default(0),
tn: z.number().default(0),
ph: z.number().default(0),
cdtnv: z.number().default(0),
designCst: z.number().nullish(),
cstrnSpvsCst: z.number().nullish(),
fcltSbsdCst: z.number().nullish(),
wstCst: z.number().nullish(),
cnstCmcnCst: z.number().nullish(),
mntrgEqpmntInstlCst: z.number().nullish(),
gisDbCst: z.number().nullish(),
elpwrMtrngCst: z.number().nullish(),
mchnCst: z.number().nullish(),
archCst: z.number().nullish(),
pplCst: z.number().nullish(),
ruseFcltCst: z.number().nullish(),
designCstClcln: z.number().nullish(),
cstrnSpvsCstClcln: z.number().nullish(),
fcltSbsdCstClcln: z.number().nullish(),
wstCstClcln: z.number().nullish(),
cnstCmcnCstClcln: z.number().nullish(),
mntrgEqpmntInstlCstClcln: z.number().default(0),
gisDbCstClcln: z.number().nullish(),
elpwrMtrngCstClcln: z.number().nullish(),
mchnCstClcln: z.number().nullish(),
archCstClcln: z.number().nullish(),
pplCstClcln: z.number().nullish(),
ruseFcltCstClcln: z.number().nullish(),
wwtEmsnFcltPrmsnYn: z.string().default("Y"),
tmsInstlYn: z.string().default("Y"),
pbnstDrngInflwExclYn: z.string().default("Y"),
bod: zNumDefaultZero,
grssClfg: zNumDefaultZero,
combResdch: zNumDefaultZero,
trbt: zNumDefaultZero,
clIonQnt: zNumDefaultZero,
smll: zNumDefaultZero,
crmty: zNumDefaultZero,
tph: zNumDefaultZero,
tn: zNumDefaultZero,
ph: zNumDefaultZero,
cdtnv: zNumDefaultZero,
designCst: zNumNullish,
cstrnSpvsCst: zNumNullish,
fcltSbsdCst: zNumNullish,
wstCst: zNumNullish,
cnstCmcnCst: zNumNullish,
mntrgEqpmntInstlCst: zNumNullish,
gisDbCst: zNumNullish,
elpwrMtrngCst: zNumNullish,
mchnCst: zNumNullish,
archCst: zNumNullish,
pplCst: zNumNullish,
ruseFcltCst: zNumNullish,
designCstClcln: zNumNullish,
cstrnSpvsCstClcln: zNumNullish,
fcltSbsdCstClcln: zNumNullish,
wstCstClcln: zNumNullish,
cnstCmcnCstClcln: zNumNullish,
mntrgEqpmntInstlCstClcln: zNumDefaultZero,
gisDbCstClcln: zNumNullish,
elpwrMtrngCstClcln: zNumNullish,
mchnCstClcln: zNumNullish,
archCstClcln: zNumNullish,
pplCstClcln: zNumNullish,
ruseFcltCstClcln: zNumNullish,
fcOrgwts: z.array(fcOrgwtSchema).nullish(),
pplInstls: z.array(pplInstlSchema).nullish(),
fcDemands: z.array(dmdColist).default([]).nullish(),
@@ -231,452 +215,30 @@ export const fcBizSchema = z.object({
mdfcnDt: z.string().nullish(),
mdfr: z.string().nullish(),
});
export const pbnstRegZod = z.object({
pbnstRuseFcltPk: z.string().default(''),
swtrmtFcltFk: z.string().default(""),
ruseUtztnFcltNm: z.string().default(""),
fcltCpct: z.number().default(0),
ruseCpct: z.number().default(0),
splyExtraCpct: z.number().default(0),
regDt: z.date().default(new Date()),
fcltCpct: zNumDefaultZero,
ruseCpct: zNumDefaultZero,
splyExtraCpct: zNumDefaultZero,
regDt: zDateDefaultNow,
rgtr: z.string().default("test"),
mdfcnDt: z.date().default(new Date()),
mdfcnDt: zDateDefaultNow,
mdfr: z.string().default("test"),
fcFiles: z.array(fcFileSchema).default([]),
fcFiles: z.array(fcFileSchema).default([]).nullish(),
fcBizs: z.array(fcBizSchema).default([]),
fcOpers: z.array(fcOperSchema).default([]),
hasuhasu: z.number().default(0),
fcOpers: z.array(fcOperSchema).default([]).nullish(),
});
//관경 제외
export const exampleData = [
{
"swtrmtFcltFk": "11000SW001R",
"pbnstRuseFcltPk": "11000SW001R1",
"ruseUtztnFcltNm":'난지',
"fcltCpct": 123,
"ruseCpct": 123,
"splyExtraCpct": 123,
"hasuhasu": 123,
"fcFiles": [],
"fcBizs": [
{
"pbnstRuseFcltFk": "11000SW001R1",
"cycl": 1,
"seCd": "123",
"bizMthdCd": "123",
"gvsbs": 123,
"lcep": 123,
"cusrAlotm": 123,
"etc": "123",
"rprcsFcltCpct": 123,
"majorPrcsMsrcCd": "123",
"addr": "123",
"rprcsMthdCd": "123",
"inoutYn": "123",
"mainSplyPumpCpct": 123,
"erctWtrOcrnCpct": 123,
"erctUswtrLinkSpt": "123",
"erctUswtrFcltCpct": 123,
"erctUswtrPrcsMeth": "123",
"erctUswtrPrcsMsrcCd": "123",
"bod": 123,
"grssClfg": 123,
"combResdch": 123,
"trbt": 123,
"smll": 1230,
"crmty": 123,
"tn": 123,
"tph": 1230,
"ph": 123,
"clIonQnt": 123,
"cdtnv": 123,
"pplInstls": [
{
"ruseFcltBizFk": "",
"choose": false,
"ppMqlt": "PE관",
"pdmt": "D250",
"cpct": "123",
"id": "e1472f7c-7033-44ae-a953-f69e6b90fbc1"
}
]
export const pbnstRegArrayZod = z.array(pbnstRegZod)
},
{
"pbnstRuseFcltFk": "11000SW001R1",
"cycl": 2,
"seCd": "하하",
"bizMthdCd": "호호",
"gvsbs": 12,
"lcep": 12,
"cusrAlotm": 12,
"etc": "1",
"rprcsFcltCpct": 12,
"majorPrcsMsrcCd": "12",
"addr": "12",
"rprcsMthdCd": "12",
"inoutYn": "12",
"mainSplyPumpCpct": 12,
"erctWtrOcrnCpct": 13,
"erctUswtrLinkSpt": "12",
"erctUswtrFcltCpct": 13,
"erctUswtrPrcsMeth": "12",
"erctUswtrPrcsMsrcCd": "12",
"bod": 1,
"grssClfg": 1,
"combResdch": 1,
"trbt": 1,
"smll": 1,
"crmty": 1,
"tn": 1,
"tph": 1,
"ph": 1,
"clIonQnt": 1,
"cdtnv": 1,
"pplInstls": [
{
"ruseFcltBizFk": "",
"choose": false,
"ppMqlt": "PE관",
"pdmt": "D300",
"cpct": "1",
"id": "e1472f7c-7033-44ae-a953-f69e6b90fbc1"
}
]
}
],
"fcOpers": [
{
"choose": false,
"rgtr": "",
"mdfr": "",
"operMthd": "1",
"rprtvBzenty": "1",
"bgngDt": "20250513",
"endDt": "20250529",
"id": "cbef8f84-33df-406b-a85f-edd2a5d3618e"
}
]
},
{
"swtrmtFcltFk": "11000SW001R",
"ruseUtztnFcltNm":'난지',
"pbnstRuseFcltPk": "11000SW001R2",
"fcltCpct": 123,
"ruseCpct": 123,
"splyExtraCpct": 123,
"hasuhasu": 123,
"fcFiles": [],
"fcBizs": [
{
"pbnstRuseFcltFk": "11000SW001R2",
"cycl": 1,
"seCd": "123",
"bizMthdCd": "123",
"gvsbs": 123,
"lcep": 123,
"cusrAlotm": 123,
"etc": "123",
"rprcsFcltCpct": 123,
"majorPrcsMsrcCd": "123",
"addr": "123",
"rprcsMthdCd": "123",
"inoutYn": "123",
"mainSplyPumpCpct": 123,
"erctWtrOcrnCpct": 123,
"erctUswtrLinkSpt": "123",
"erctUswtrFcltCpct": 123,
"erctUswtrPrcsMeth": "123",
"erctUswtrPrcsMsrcCd": "123",
"bod": 123,
"grssClfg": 123,
"combResdch": 123,
"trbt": 123,
"smll": 1230,
"crmty": 123,
"tn": 123,
"tph": 1230,
"ph": 123,
"clIonQnt": 123,
"cdtnv": 123,
"pplInstls": [
{
"ruseFcltBizFk": "",
"choose": false,
"ppMqlt": "PE관",
"pdmt": "D250",
"cpct": "123",
"id": "e1472f7c-7033-44ae-a953-f69e6b90fbc1"
}
]
}
],
"fcOpers": [
{
"choose": false,
"rgtr": "",
"mdfr": "",
"operMthd": "123",
"rprtvBzenty": "123",
"bgngDt": "20250513",
"endDt": "20250529",
"id": "cbef8f84-33df-406b-a85f-edd2a5d3618e"
}
]
}
]
export type PbnstRegArrrayType = z.infer<typeof pbnstRegArrayZod>
export type fcBizType = z.infer<typeof fcBizSchema>;
export type fcOrgwtType = z.infer<typeof fcOrgwtSchema>;
export type ppInstlType = z.infer<typeof pplInstlSchema>;
export type operType = z.infer<typeof fcOperSchema>;
export type fcFileType = z.infer<typeof fcFileSchema>;
// [{
// pbnstRuseFcltPk: 1,
// swtrmtFcltFk: "11000SW001R",
// ruseUtztnFcltNm: "재이용시설 A",
// hasuhasu: 0,
// fcltCpct: "100",
// ruseCpct: "90",
// splyExtraCpct: "10",
// rgtr: TEST_UUID,
// mdfr: TEST_UUID,
// fcFiles: [],
// fcBizs: [
// {
// pbnstRuseFcltBizPk: 1,
// pbnstRuseFcltFk: 1,
// cycl: "1",
// seCd: "A010",
// bizMthdCd: "M02",
// instlAprvSncnDt: "2022-01-01",
// bizCmcnDay: "2022-02-01",
// gvsbs: "정부지원",
// lcep: "지자체",
// cusrAlotm: "고객",
// etc: "비고 없음",
// totalMoney: "100000000",
// rprcsFcltCpct: "50",
// majorPrcsMsrcCd: "MP01",
// addr: "서울시 종로구",
// rprcsMthdCd: "RP01",
// inoutYn: "Y",
// mainSplyPumpCpct: "30",
// erctWtrOcrnCpct: "5",
// erctUswtrLinkSpt: "있음",
// erctUswtrFcltCpct: "20",
// erctUswtrPrcsMeth: "생물학적",
// erctUswtrPrcsMsrcCd: "EM01",
// wwtEmsnFcltPrmsnYn: "Y",
// tmsInstlYn: "N",
// pbnstDrngInflwExclYn: "Y",
// bod: "30",
// grssClfg: "양호",
// combResdch: "적정",
// trbt: "10",
// clIonQnt: "5",
// smll: "없음",
// crmty: "정상",
// tph: "0.2",
// tn: "2",
// ph: "7.2",
// cdtnv: "100",
// designCst: "1000",
// cstrnSpvsCst: "500",
// fcltSbsdCst: "200",
// wstCst: "300",
// cnstCmcnCst: "1000",
// mntrgEqpmntInstlCst: "150",
// gisDbCst: "200",
// elpwrMtrngCst: "180",
// mchnCst: "700",
// archCst: "400",
// pplCst: "300",
// ruseFcltCst: "5000",
// designCstClcln: "990",
// cstrnSpvsCstClcln: "480",
// fcltSbsdCstClcln: "190",
// wstCstClcln: "280",
// cnstCmcnCstClcln: "980",
// mntrgEqpmntInstlCstClcln: "140",
// gisDbCstClcln: "190",
// elpwrMtrngCstClcln: "170",
// mchnCstClcln: "680",
// archCstClcln: "380",
// pplCstClcln: "290",
// ruseFcltCstClcln: "4800",
// pplInstls: [
// {
// ruseFcltBizFk: "10",
// pdmt: "D200",
// ppMqlt: "도복장강관",
// cpct: "1",
// },
// {
// ruseFcltBizFk: "10",
// pdmt: "D100",
// ppMqlt: "PE관",
// cpct: "2",
// },
// ],
// fcOrgwts: [
// {
// pbnstRuseFcltBizFk: 1,
// swtrmtFcltFk: "11000SW001R",
// orgwtWtritQnt: "100",
// tmsYn: "Y",
// dschgFmYn: "N",
// dtlPstnExpln: "배출 위치",
// regDt: "20250221",
// rgtr: "admin",
// mdfcnDt: "20250321",
// mdfr: "admin",
// },
// {
// pbnstRuseFcltBizFk: 1,
// swtrmtFcltFk: "11200PB001R",
// orgwtWtritQnt: "153",
// tmsYn: "Y",
// dschgFmYn: "N",
// dtlPstnExpln: "배출 위치22",
// regDt: "20250221",
// rgtr: "admin",
// mdfcnDt: "20250421",
// mdfr: "admin",
// },
// ],
// flg: "N",
// rgtr: TEST_UUID,
// mdfr: TEST_UUID,
// },
// {
// pbnstRuseFcltBizPk: 11,
// pbnstRuseFcltFk: 1,
// cycl: "2",
// seCd: "A011",
// bizMthdCd: "M02",
// instlAprvSncnDt: "2022-01-01",
// bizCmcnDay: "2022-02-01",
// gvsbs: "민간",
// lcep: "지자체",
// cusrAlotm: "고객",
// etc: "비고 없음",
// totalMoney: "100000000",
// rprcsFcltCpct: "50",
// majorPrcsMsrcCd: "MP01",
// addr: "부산시 해운대구",
// rprcsMthdCd: "RP01",
// inoutYn: "Y",
// mainSplyPumpCpct: "30",
// erctWtrOcrnCpct: "5",
// erctUswtrLinkSpt: "있음",
// erctUswtrFcltCpct: "20",
// erctUswtrPrcsMeth: "생물학적",
// erctUswtrPrcsMsrcCd: "EM01",
// wwtEmsnFcltPrmsnYn: "Y",
// tmsInstlYn: "N",
// pbnstDrngInflwExclYn: "Y",
// bod: "30",
// grssClfg: "양호",
// combResdch: "적정",
// trbt: "10",
// clIonQnt: "5",
// smll: "없음",
// crmty: "정상",
// tph: "0.2",
// tn: "2",
// ph: "7.2",
// cdtnv: "100",
// designCst: "1000",
// cstrnSpvsCst: "500",
// fcltSbsdCst: "200",
// wstCst: "300",
// cnstCmcnCst: "1000",
// mntrgEqpmntInstlCst: "150",
// gisDbCst: "200",
// elpwrMtrngCst: "180",
// mchnCst: "700",
// archCst: "400",
// pplCst: "300",
// ruseFcltCst: "5000",
// designCstClcln: "990",
// cstrnSpvsCstClcln: "480",
// fcltSbsdCstClcln: "190",
// wstCstClcln: "280",
// cnstCmcnCstClcln: "980",
// mntrgEqpmntInstlCstClcln: "140",
// gisDbCstClcln: "190",
// elpwrMtrngCstClcln: "170",
// mchnCstClcln: "680",
// archCstClcln: "380",
// pplCstClcln: "290",
// ruseFcltCstClcln: "4800",
// pplInstls: [
// {
// ruseFcltBizFk: "11",
// pdmt: "관경",
// ppMqlt: "1",
// cpct: "100",
// },
// {
// ruseFcltBizFk: "11",
// pdmt: "관경",
// ppMqlt: "2",
// cpct: "200",
// },
// ],
// fcOrgwts: [
// {
// pbnstRuseFcltBizFk: 11,
// swtrmtFcltFk: "11000SW001R",
// orgwtWtritQnt: "152",
// tmsYn: "Y",
// dschgFmYn: "N",
// dtlPstnExpln: "배출 위치1",
// rgtr: TEST_UUID,
// mdfr: TEST_UUID,
// },
// {
// pbnstRuseFcltBizFk: 11,
// swtrmtFcltFk: "11200PB001R",
// orgwtWtritQnt: "150",
// tmsYn: "Y",
// dschgFmYn: "N",
// dtlPstnExpln: "배출 위치",
// rgtr: TEST_UUID,
// mdfr: TEST_UUID,
// },
// ],
// flg: "N",
// rgtr: TEST_UUID,
// mdfr: TEST_UUID,
// },
// ],
// fcOpers: [
// {
// pbnstRuseFcltOperInfoPk: 100,
// pbnstRuseFcltFk: 1,
// operMthd: "위탁",
// rprtvBzenty: "기관명",
// bgngDt: new Date("2023-09-30"),
// endDt: new Date("2023-12-31"),
// rgtr: TEST_UUID,
// mdfr: TEST_UUID,
// },
// {
// pbnstRuseFcltOperInfoPk: 101,
// pbnstRuseFcltFk: 1,
// operMthd: "직영",
// rprtvBzenty: "기관명",
// bgngDt: new Date("2024-11-30"),
// endDt: new Date("2024-12-31"),
// rgtr:TEST_UUID ,
// mdfr: TEST_UUID,
// },
// ],
// }
// ]
@@ -1,7 +1,7 @@
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
import type { SelectDataType } from "@common/business_components/ui";
import type { TableUpperProps } from "@/app/store/common/type/header";
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
export const rainZod = z.object({
@@ -82,17 +82,6 @@ export type chgBuilding={
mdfr?:string|null;
}
export type customRainBdst = z.infer<typeof rainZod>
export type TableUpperProps = {
id: string;
title: string;
upName?: string;
upSequnce?: number;
edit?:boolean;
visible?:boolean;
rowSpan?: true;
type?: string;
selectData ?:string;
};
export const upHeadList: TableUpperProps[] = [
{ id: "cityText", title: "시도" },
@@ -1,8 +1,9 @@
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { upHeadList, type chgBuilding, type TableUpperProps } from "../rainReg";
import { upHeadList, type chgBuilding } from "../rainReg";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
export const rswtZod = z.object({
bdstInfoPk: z.number().nullish(),
@@ -59,7 +60,7 @@ export const rswtZod = z.object({
wtrUsqty: z.number().default(0),
oblgTrgtWtrUsqty: z.number().nullish().default(0),
orgwtKndCd: z.string().default(""),
filtrTrtmfctCpct: z.string().default(""),
filtrTrtmfctCpct: z.number().default(0),
filtrTrtmfctProcs: z.string().default(""),
filtrTrtmfctUsgCd: z.string().default(""),
rswtrUsqty: z.number().default(0),
@@ -1,6 +1,6 @@
import type { z } from "zod";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
export const htdflSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{
@@ -1,12 +1,10 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
import { htdflSttHeadListExport, htdflSttNodeListExport } from "./headList";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { z } from "zod";
import { controlHeadView } from "../rainSttn";
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
import { fetchType, getFetch } from "@/components/lib/api";
import { excelHtdflSttnParsing } from "./excel";
import { tableData } from "@/components/lib/func/commom";
const htdflSttHeadList = htdflSttHeadListExport;
const htdflSttNodeList = htdflSttNodeListExport;
@@ -5,23 +5,23 @@ export const excelPbnstSttnParsing = (data: any[]): string[][] => {
data.forEach((item) => {
excelExportData.push([
item.a,
String(item.aaa),
item.aaaa ?? "",
item.operMngCd ?? "",
String(item.cityText ?? ""),
String(item.sggText ?? ""),
String(item.bdnstNm ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
item.rvbsn,
String(item.lgbsn),
item.mdmbsn ?? "",
item.rgnNm ?? "",
String(item.sido ?? ""),
String(item.gugun ?? ""),
String(item.bscFctNm ?? ""),
String(item.efflWqltStndrdNm ?? ""),
String(item.fctCpc ?? ""),
String(item.tel ?? ""),
String(item.ruseUtztnFcltNm ?? ""),
String(item.fcltCpct ?? ""),
String(item.splyExtraCpct ?? ""),
String(item.ruseCpct ?? ""),
String(item.usageTotal ?? ""),
String(item.inUsage ?? ""),
String(item.outUsage ?? ""),
])
})
return excelExportData;
@@ -1,36 +1,39 @@
import type { sttnHeadListType } from "../rainSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type {
CommonTableProps,
TableUpperProps,
} from "@/app/store/common/type/header";
import { z } from "zod";
export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{ id: "a", title: "권역", visible: true },
{ id: "rvbsn", title: "권역", visible: true },
{
id: "aaa",
id: "lgbsn",
title: "단위유역",
visible: true,
},
{
id: "aaaa",
id: "mdmbsn",
title: "중권역",
visible: true,
},
{ id: "operMngCd", title: "환경청", visible: true },
{ id: "rgnNm", title: "환경청", visible: true },
{
id: "cityText",
id: "sido",
title: "시도",
visible: true,
},
{
id: "sggText",
id: "gugun",
title: "시군구",
visible: true,
},
{ id: "bdnstNm", title: "시설명", visible: true },
{ id: "locDiv", title: "지역구분", visible: true },
{ id: "phone", title: "전화번호", visible: true },
{ id: "bscFctNm", title: "시설명", visible: true },
{ id: "efflWqltStndrdNm", title: "지역구분", visible: true },
{ id: "fcltQuantity", title: "시설용량(톤/일)", visible: true },
{ id: "rusNm", title: "재이용시설명", visible: true },
{ id: "fctCpc", title: "시설용량(톤/일)", visible: true },
{ id: "tel", title: "전화번호", visible: true },
{ id: "ruseUtztnFcltNm", title: "재이용시설명", visible: true },
{
id: "fcltCpct",
@@ -38,7 +41,7 @@ export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "trbt",
id: "splyExtraCpct",
title: "하수처리량(m³/일)",
visible: true,
},
@@ -49,23 +52,23 @@ export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
},
{
id: "total",
id: "usageTotal",
title: "합계",
visible: true,
},
{
id: "ithlWtr",
id: "inUsage",
title: "장내용수",
visible: true,
},
{
id: "othlWtr",
id: "outUsage",
title: "장외용수",
visible: true,
},
{
id: "mngMeth",
id: "operMthd",
title: "운영방식",
visible: true,
},
@@ -75,12 +78,12 @@ export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "firstDay",
id: "bgngDt",
title: "시작일",
visible: true,
},
{
id: "LastDay",
id: "endDt",
title: "종료일",
visible: true,
},
@@ -203,7 +206,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
rowSpan: 1,
colSpan: 1,
},
{
{
id: "cityText",
title: "시도",
upName: "adminDiv",
@@ -310,5 +313,240 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
row: 2,
rowSpan: 1,
colSpan: 1,
}
];
},
];
export const ruseFcltNodeListExport: TableUpperProps[] = [
{ id: "cycl", title: "차수", visible: true, row: 1, rowSpan: 3, colSpan: 1 },
{ id: "seCd", title: "구분", visible: true, row: 1, rowSpan: 3, colSpan: 1 },
{
id: "busiTotal",
title: "사업개요",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 10,
},
{
id: "ruseFclt",
title: "재처리시설",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 5,
},
{
id: "mainSply",
title: "메인공급펌프용량",
visible: true,
row: 1,
rowSpan: 3,
colSpan: 1,
},
{
id: "buziFee",
title: "사업비(백만원)",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 6,
},
{
id: "instlAprvSncnDt",
title: "설치승인・인가일",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "bizCmcnDay",
title: "사업준공일",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "rprcsFcltCpct",
title: "시설용량(m³/일)",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "rprcsMthdCd",
title: "재처리방식",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "majorPrcsMsrcCd",
title: "주처리공법",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "inoutYn",
title: "위치처리장(내・외)",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "addr",
title: "위치(주소)",
visible: true,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{ id: "gvsbs", title: "국고", visible: true, row: 3, rowSpan: 1, colSpan: 1 },
{
id: "lcep",
title: "지방비",
visible: true,
row: 3,
rowSpan: 1,
colSpan: 1,
},
{
id: "cusrAlotm",
title: "민간투자비",
visible: true,
row: 3,
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",
title: "합계",
visible: true,
row: 3,
rowSpan: 1,
colSpan: 1,
},
];
export const ruseSplyHeadListExport: TableUpperProps[] = [
{ id: "cycl", title: "차수", visible: true },
{ id: "orgwtWtritQnt", title: "원수취수량", visible: true },
{ id: "tmsYn", title: "하수처리량TMS 전후", visible: true },
{ id: "dschgFmYn", title: "하수처리장 방류 유량계 전·후​", visible: true },
{ id: "dtlPstnExpln", title: "상세위치 설명", visible: true },
];
export const rusePplHeadListExport: TableUpperProps[] = [
{ id: "cycl", title: "차수", visible: true },
{ id: "ppMqlt", title: "관재질", type: "select", visible: true },
{ id: "pdmt", title: "관경", type: "select", visible: true },
{ id: "cpct", title: "연장", edit: true, visible: true },
];
export const ruseGuranteeHeadListExport: TableUpperProps[] = [
{ id: "cycl", title: "차수", visible: true },
{ id: "bod", title: "BOD(mg/L)", visible: true },
{ id: "grssClfg", title: "총대장균군수(개/mg)", visible: true },
{ id: "combResdch", title: "결합잔류염소(mh/L)", visible: true },
{ id: "trbt", title: "탁도(NTU)", visible: true },
{ id: "smll", title: "냄새", visible: true },
{ id: "crmty", title: "색도", visible: true },
{ id: "tn", title: "총질소(mg/L)", visible: true },
{ id: "tph", title: "총인(mg/L)", visible: true },
{ id: "ph", title: "수소이온농도", visible: true },
{ id: "clIonQnt", title: "염화물(mg/L)", visible: true },
{ id: "cdtnv", title: "전기전도도(μs/cm)​", visible: true },
];
export const ruseDmdHeadListExport: TableUpperProps[] = [
{ id: "cycl", title: "차수", visible: true },
{ id: "dmdCoNm", title: "수요처명", visible: true },
{ id: "daddr", title: "위치(주소)", visible: true },
{ id: "useUsgCd", title: "사용용도", visible: true },
{ id: "splyBgngDay", title: "공급시작일", visible: true },
{ id: "splyEndDay", title: "공급종료일", visible: true },
{ id: "splyCpct", title: "공급량(m³/일)", visible: true },
{ id: "splyFmYon", title: "공급유량계 유무", visible: true },
];
export const ruseFcltHeadListExport: CommonTableProps[] = [
{ id: "cycl", title: "차수", visible: true},
{ id: "seCd", title: "구분", visible: true},
{ id: "gvsbs", title: "국고", visible: true },
{
id: "lcep",
title: "지방비",
visible: true,
},
{
id: "cusrAlotm",
title: "민간투자비",
visible: true,
},
{
id: "cusrAlotm2",
title: "원인자부담금",
visible: true,
},
{ id: "etc", title: "기타", visible: true },
{
id: "totalMoney",
title: "합계",
visible: true,
},
{
id: "instlAprvSncnDt",
title: "설치승인・인가일",
visible: true,
},
{
id: "bizCmcnDay",
title: "사업준공일",
visible: true,
},
{
id: "rprcsFcltCpct",
title: "시설용량(m³/일)",
visible: true,
},
{
id: "rprcsMthdCd",
title: "재처리방식",
visible: true,
},
{
id: "majorPrcsMsrcCd",
title: "주처리공법",
visible: true,
},
{
id: "inoutYn",
title: "위치처리장(내・외)",
visible: true,
},
{
id: "addr",
title: "위치(주소)",
visible: true,
},
{
id: "mainSply",
title: "메인공급펌프용량",
visible: true,
},
];
@@ -1,33 +1,59 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps, TableUpperProps } from "@/app/store/common/type/header";
import type { z } from "zod";
import {
pbnSttHeadListExport,
pbnstSttNodeListExport
} from "./headList";
import { fetchType, getFetch } from "@/components/lib/api";
import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList";
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { customPbnst } from "../../fcltReg/pbnstReg/type";
import type { customPbnst, pubHasuType } from "../../fcltReg/pbnstReg/type";
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";
const pbnstSttHeadList = pbnSttHeadListExport;
const pbnstSttNodeList = pbnstSttNodeListExport;
export type pbnstSttnState = {
pbnstSttn: {
pbnstSttnRes: customPbnst[];
pbnstSttnRes: WaterReuseFacility[];
pbnstSearchData: WaterReuseFacility[];
pbnstSttHeadList: CommonTableProps[];
pbnstSttNodeList: CommonTableProps[];
pbnstDetail: customPbnst;
ruseFcltNodeList:TableUpperProps[]
ruseSplyHeadList:TableUpperProps[]
rusePplHeadList:TableUpperProps[]
ruseGuranteeHeadList:TableUpperProps[]
ruseDmdHeadList:TableUpperProps[]
ruseFcltHeadList:TableUpperProps[]
excelList: [];
isInit: boolean;
};
};
type pbnstSttnActions = {
pbnstChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
pbnstChSttnHead: (headList: z.infer<typeof sttnHeadListType>) => void;
pbnstSttnSearch: (
page: string,
total: string,
reurnValue: ReturnType,
searchNm: string | undefined,
year: string
) => void;
pbnSttnInit: (
page: string,
total: string,
reurnValue: ReturnType,
year: string
) => void;
getPbnStnDetail: (pbnstRuseFcltPk: string) => void;
pbnNmSearch: (
page: string,
total: string,
reurnValue: ReturnType,
searchNm: string | undefined,
year: string
) => void;
pbnstSttnSearch: (page: number, total: string, con: string) => void;
};
export type pbnstSttnType = pbnstSttnState & pbnstSttnActions;
@@ -36,12 +62,121 @@ export const pbnstSttnStateExport: pbnstSttnState = {
pbnstSttn: {
pbnstSttHeadList: pbnstSttHeadList,
pbnstSttNodeList: pbnstSttNodeList,
ruseFcltNodeList:ruseFcltNodeListExport,
ruseSplyHeadList:ruseSplyHeadListExport,
rusePplHeadList:rusePplHeadListExport,
ruseGuranteeHeadList:ruseGuranteeHeadListExport,
ruseDmdHeadList:ruseDmdHeadListExport,
ruseFcltHeadList:ruseFcltHeadListExport,
pbnstSttnRes: [],
pbnstDetail: {} as customPbnst,
pbnstSearchData: [],
excelList: [],
isInit: false,
},
};
const hasuListFetch = async (
page: string,
total: string,
reurnValue: ReturnType,
searchNm: string | undefined,
year: string
) => {
let url = "";
if (reurnValue.partValue === "A") {
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${
reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
}/0/1/SW`
} else if (reurnValue.partValue === "R") {
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${
reurnValue.regionValue
? reurnValue.regionValue
: reurnValue.unitWaterShedValue
? reurnValue.unitWaterShedValue
: reurnValue.middleRegionValue
}/0/1/SW`
} else {
url = `/prcsFclt/info/${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue}/0/1/SW`
}
if( searchNm&& searchNm?.length>0){
url+="/"+searchNm
}
const pbnList = await getFetch(fetchType.COMMON, url);
const arrayList = pbnList.map((item: pubHasuType) => item.bscFctCd);
const getRuseList = await postFectch(
`/reuseFc/pubDetailList/${year}`,
arrayList,
fetchType.WR
);
const checkWrRegListRes = getRuseList.data;
const data: WaterReuseFacility[] = checkWrRegListRes.map(
(item: FcPrfType) => {
const findData = pbnList.find(
(fclt: pubHasuType) =>
fclt.bscFctCd === item.pbnstRuseFcltPk.substring(0, 11)
);
const usage = item.prfList.reduce(
(acc, cur) => {
acc.inUsage +=
cur.wshwtr +
cur.coolUswtr +
cur.cleanUswtr +
cur.drwtUswtr +
cur.dltnUswtr +
cur.ithlRswtr +
cur.ithlEtcUswtr +
cur.cleanToilUswtr +
cur.resn;
acc.outUsage +=
cur.lndwtr +
cur.hydUswtr +
cur.ugwtChr +
cur.farmUswtr +
cur.rvrKeepUswtr +
cur.indstUswtr;
acc.total = acc.inUsage + acc.outUsage;
return acc;
},
{ total: 0, inUsage: 0, outUsage: 0 }
);
return {
rvbsn: findData?.rvbsn,
lgbsn: findData?.lgbsn,
mdmbsn: findData?.mdmbsn,
rgnNm: findData?.rgnNm,
sido: findData?.sido,
gugun: findData?.gugun,
bscFctNm: findData?.bscFctNm,
efflWqltStndrdNm: findData?.efflWqltStndrdNm,
fctCpc: findData.fctCpc,
tel: findData?.tel ?? "-",
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
fcltCpct: item.fcltCpct,
splyExtraCpct: item.splyExtraCpct,
ruseCpct: item.ruseCpct,
pbnstRuseFcltPk: item.pbnstRuseFcltPk,
usageTotal: usage.total,
inUsage: usage.inUsage,
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?? "",
searchNm: findData.bscFctNm,
searchPk: findData.bscFctCd,
prfList:item?.prfList??[]
};
}
);
return data;
};
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
set: any
) => {
@@ -49,9 +184,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
pbnstChSttnHead: async (
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
console.log('head ', headList)
const changeNodeList = controlHeadView(headList, pbnstSttNodeList)
const changeNodeList = controlHeadView(headList, pbnstSttNodeList);
return set((state: pbnstSttnState) => ({
pbnstSttn: {
@@ -61,12 +194,22 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
},
}));
},
pbnstSttnSearch: async (page: number, total: string, con: string) => {
pbnstSttnSearch: async (
page: string,
total: string,
reurnValue: ReturnType,
searchNm: string | undefined,
year: string
) => {
try {
const pbnstSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/waterreuseFc/${page}/${total}/${con}`
const pbnstSttnRes = await hasuListFetch(
page,
total,
reurnValue,
searchNm,
year
);
console.log("pbnstSttnRes", pbnstSttnRes);
if (Number(total) > 9000) {
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
set((state: pbnstSttnState) => {
@@ -80,7 +223,6 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
});
} else
set((state: pbnstSttnState) => {
return {
...state,
pbnstSttn: {
@@ -94,5 +236,86 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
console.log("error", erTxt);
}
},
}
}
pbnSttnInit: async (
page: string,
total: string,
reurnValue: ReturnType,
year: string
) => {
try {
const pbnstSttnRes = await hasuListFetch(
page,
total,
reurnValue,
undefined,
year
);
console.log('pbnstSttnRes ', pbnstSttnRes)
set((state: pbnstSttnState) => {
return {
...state,
pbnstSttn: {
...state.pbnstSttn,
pbnstSttnRes: pbnstSttnRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
getPbnStnDetail: async (pbnstRuseFcltPk: string) => {
try {
let pbnstDetail = await getFetch("wr", `/reuseFc/pubFc/${pbnstRuseFcltPk}`);
if(pbnstDetail.length>=0){
pbnstDetail= pbnstDetail.find((item: customPbnst) =>item.pbnstRuseFcltPk === pbnstRuseFcltPk)
}
console.log( 'pbnstDetail ', pbnstDetail)
set((state: pbnstSttnState) => {
return {
...state,
pbnstSttn: {
...state.pbnstSttn,
pbnstDetail: pbnstDetail,
},
};
});
} catch (errorHasu) {
console.log(errorHasu);
}
},
pbnNmSearch: async (
page: string,
total: string,
reurnValue: ReturnType,
searchNm: string | undefined,
year: string
) => {
try {
const pbnstSttnRes = await hasuListFetch(
page,
total,
reurnValue,
searchNm,
year
);
set((state: pbnstSttnState) => {
return {
...state,
pbnstSttn: {
...state.pbnstSttn,
pbnstSearchData: pbnstSttnRes,
},
};
});
} catch (e) {
console.log(e);
}
},
};
};
@@ -0,0 +1,27 @@
import type { PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
export type WaterReuseFacility = {
bscFctNm: string; // 기본시설명 (예: "난지")
efflWqltStndrdNm: string; // 방류수 수질 기준명 (예: "500톤 이상(Ⅲ지역)")
fcltCpct: number; // 시설 용량 (숫자형, 예: 1)
fctCpc: string; // 시설 처리 능력 (예: "2360000")
gugun: string; // 구군 정보 (예: " ")
inUsage: number; // 유입량 (예: 1387)
lgbsn: string; // 대수계 (예: "한강본류")
mdmbsn: string; // 중권역 (예: "한강서울")
outUsage: number; // 유출량 (예: 900)
pbnstRuseFcltPk: string; // 공공하수 재이용 시설 PK (예: "11000SW001R1")
rgnNm: string; // 관할 기관명 (예: "한강유역환경청")
ruseCpct: number; // 재이용 가능 용량 (예: 123)
ruseUtztnFcltNm: string; // 재사용 활용 시설명 (예: "난지 재사용")
rvbsn: string; // 소수계 (예: "한강")
sido: string; // 시도 정보 (예: "서울특별시")
splyExtraCpct: number; // 추가 공급 용량 (예: 123)
tel: string; // 전화번호 (예: "-")
usageTotal: number; // 총 사용량 (예: 2287)
operMthd: string;
rprtvBzenty: string;
bgngDt: string;
endDt: string;
prfList:PrfType[];
};
@@ -1,4 +1,4 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
import { z } from "zod";
export const sttnHeadListType = z.array(
@@ -12,7 +12,7 @@ import {
rainSttnDetailNodeListExport,
} from "./headList";
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
// 테이블 헤드 리스트
const rainSttHeadList = rainSttHeadListExport;
@@ -1,6 +1,6 @@
import type { z } from "zod";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{
@@ -1,4 +1,4 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { CommonTableProps } from "@/app/store/common/type/header";
import type { customRswtBdst } from "../../fcltReg/rswtReg";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { z } from "zod";
@@ -0,0 +1,68 @@
import type { TableUpperProps } from "../../common/type/header";
export const matStatHeadListExport :TableUpperProps[]=[
{
id: "시도",
title: "시도",
row:0,
rowSpan:2
},
{
id: "개소",
title: "개소",
row:0,
rowSpan:2
},
{
id: "요구수량",
title: "요구수량",
row:0,
rowSpan:2
},
{
id: "용도",
title: "용도",
row:0,
colSpan:6
},
{
id: "조경용수",
title: "조경용수",
row:1,
},
{
id: "청소화장실용수",
title: "청소화장실용수",
row:1,
},
{
id: "농업용수",
title: "농업용수",
row:1,
},
{
id: "공업용수",
title: "공업용수",
row:1,
},
{
id: "친수용수",
title: "친수용수",
row:1,
},
{
id: "기타",
title: "기타",
row:1,
},
{
id: "사업비",
title: "사업비(천원)",
row:0,
rowSpan:2
},
]
+28
View File
@@ -0,0 +1,28 @@
import type { TableUpperProps } from "../../common/type/header";
import { matStatHeadListExport } from "./headList";
type matStatActions = {
}
export type matStatState = {
matStat: {
matStatHeadList:TableUpperProps[]
}
}
export type matStatType = matStatState & matStatActions;
export const matStatExport: matStatState = {
matStat: {
matStatHeadList:matStatHeadListExport
}
}
export const matStatActionsExport: (set: any) => matStatActions = (
set: any
) => {
return {
}
}
@@ -0,0 +1,70 @@
import type { TableUpperProps } from "../../common/type/header";
export const rainStatHeadListExport: TableUpperProps[] = [
{
id: "시도",
title: "시도",
row:0,
rowSpan:2
},
{
id: "개소",
title: "개소",
row:0,
rowSpan:2
},
{
id: "설치비",
title: "설치비(백만원)",
row:0,
rowSpan:2
},
{
id: "저류조용량",
title: "저류조용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "이용용도",
title: "이용용도",
row:0,
colSpan:6
},
{
id: "조경용수",
title: "조경용수",
row:1,
},
{
id: "청소화장실용수",
title: "청소화장실용수",
row:1,
},
{
id: "농업용수",
title: "농업용수",
row:1,
},
{
id: "공업용수",
title: "공업용수",
row:1,
},
{
id: "친수용수",
title: "친수용수",
row:1,
},
{
id: "기타",
title: "기타",
row:1,
},
{
id: "연간운영비",
title: "연간운영비(백만원/년)",
row:0,
rowSpan:2
},
];
@@ -0,0 +1,28 @@
import type { TableUpperProps } from "../../common/type/header";
import { rainStatHeadListExport } from "./headList";
type rainStatActions = {
}
export type rainStatState = {
rainStat: {
rainStatHeadList:TableUpperProps[]
}
}
export type rainStatType = rainStatState & rainStatActions;
export const rainStatExport: rainStatState = {
rainStat: {
rainStatHeadList:rainStatHeadListExport
}
}
export const rainStatActionsExport: (set: any) => rainStatActions = (
set: any
) => {
return {
}
}
@@ -0,0 +1,101 @@
import type { TableUpperProps } from "../../common/type/header";
export const rswtStatHeadListExport :TableUpperProps[]=[
{
id: "시도",
title: "시도",
row:0,
rowSpan:2
},
{
id: "개소",
title: "개소",
row:0,
rowSpan:2
},
{
id: "시설현황",
title: "시설현황",
row:0,
colSpan:2
},
{
id: "건축연면적(m³)",
title: "건축연면적(m³)",
row:1,
},
{
id: "처리용량",
title: "처리용량(m³)",
row:1,
},
{
id: "물사용량",
title: "물사용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "청소화장실용수",
title: "중수도+대체수이용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "중수도이용량",
title: "중수도이용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "대체수이용량",
title: "대체수이용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "용도",
title: "용도",
row:0,
colSpan:6
},
{
id: "조경용수",
title: "조경용수",
row:1,
},
{
id: "청소화장실용수",
title: "청소화장실용수",
row:1,
},
{
id: "농업용수",
title: "농업용수",
row:1,
},
{
id: "공업용수",
title: "공업용수",
row:1,
},
{
id: "친수용수",
title: "친수용수",
row:1,
},
{
id: "기타",
title: "기타",
row:1,
},
{
id: "연간운영비",
title: "연간운영비(백만원/년)",
row:0,
rowSpan:2
},
]
@@ -0,0 +1,28 @@
import type { TableUpperProps } from "../../common/type/header";
import { rswtStatHeadListExport } from "./headList";
type rswtStatActions = {
}
export type rswtStatState = {
rswtStat: {
rswtStatHeadList:TableUpperProps[]
}
}
export type rswtStatType = rswtStatState & rswtStatActions;
export const rswtStatExport: rswtStatState = {
rswtStat: {
rswtStatHeadList:rswtStatHeadListExport
}
}
export const rswtStatActionsExport: (set: any) => rswtStatActions = (
set: any
) => {
return {
}
}
+37 -7
View File
@@ -86,11 +86,17 @@ import {
import { rswtChkStateExport, rswtChkSttnActionsExport, type rswtChkSttnState, type rswtChkSttnType } from "./prfmncSttn/chkgdnSttn/rswtChkgdnSttn";
import { pbnstSttnActionsExport, pbnstSttnStateExport, type pbnstSttnState, type pbnstSttnType } from "./ruseFcltMng/fcltSttn/pbnstSttn";
import { coSttnActionsExport, coSttnStateExport, type coSttnState, type coSttnType } from "./matDmd/coSttn"; // 옮겨야함
import { ldrmntCoSttnActionsExport, ldrmntCoSttnStateExport, type ldrmntCoSttnState, type ldrmntCoSttnType } from "./matDmd/ldrmntCoSttn"; // 옮겨야함
import { searchActions, type comFcltActions, type comFcltState } from "./common/searchCode";
import { pbnstPrfmncActionsExport, pbnstPrfmncStateExport, type pbnstPrfmncState, type pbnstPrfmncType } from "./prfmncReg/pbnstPrfmncReg";
import { coRvwActionsExport, coRvwStateExport, type coRvwState, type coRvwType } from "./matDmd/coMatRvw";
import { ruseHstryActionsExport, ruseHstryStateExport, type ruseHstryState, type ruseHstryType } from "./matDmd/ruseRvwHstry";
import { pbnstPrfmncSttnActionsExport, pbnstPrfmncSttnExport, type pbnstPrfmncSttnState, type pbnstPrfmncSttnType } from "./prfmncSttn/pbnstPrfmncSttn";
import { drgtActionsExport, drgtStateExport, type drgtState, type drgtType } from "./matDmd/drgtSttn";
import { ruseCaseActionsExport, ruseCaseStateExport, type ruseCaseType, type ruseCaseState } from "./matDmd/ruseCaseMng";
import { rainStatActionsExport, rainStatExport, type rainStatState, type rainStatType } from "./stats/rainStat";
import { type rswtStatType, type rswtStatState, rswtStatExport, rswtStatActionsExport } from "./stats/rswtStat";
import { matStatActionsExport, matStatExport, type matStatState, type matStatType } from "./stats/matStat";
import { ldrmntActionsExport, ldrmntStateExport, type ldrmntState, type ldrmntType } from "./matDmd/ldrmntCoSttn";
export type WrStore = comCodeType &
pubFacType &
@@ -109,10 +115,16 @@ export type WrStore = comCodeType &
pbnstSttnType&
comFcltActions&comFcltState&
coSttnType& // 옮겨야함
ldrmntCoSttnType& // 옮겨야함
ldrmntType& // 옮겨야함
pbnstPrfmncType&
coRvwType&
ruseHstryType
ruseHstryType&
pbnstPrfmncSttnType&
drgtType&
ruseCaseType&
rainStatType&
rswtStatType&
matStatType
;
export const StoreZus = (
@@ -132,10 +144,16 @@ export const StoreZus = (
rswtChkSttnState &
pbnstSttnState&
coSttnState& // 옮겨야함
ldrmntCoSttnState& // 옮겨야함
ldrmntState& // 옮겨야함
pbnstPrfmncState&
coRvwState&
ruseHstryState
ruseHstryState&
pbnstPrfmncSttnState&
drgtState&
ruseCaseState&
rainStatState&
rswtStatState&
matStatState
= {
...comCodeStateExport,
...pubFacStateExport,
@@ -153,10 +171,16 @@ export const StoreZus = (
...rswtChkStateExport,
...pbnstSttnStateExport,
...coSttnStateExport, // 옮겨야함
...ldrmntCoSttnStateExport, // 옮겨야함
...ldrmntStateExport, // 옮겨야함
...pbnstPrfmncStateExport,
...coRvwStateExport,
...ruseHstryStateExport,
...pbnstPrfmncSttnExport,
...drgtStateExport,
...ruseCaseStateExport,
...rainStatExport,
...rswtStatExport,
...matStatExport
}
) => {
return createStore<WrStore>()((set) => {
@@ -185,10 +209,16 @@ export const StoreZus = (
...rswtChkSttnActionsExport(set),
...pbnstSttnActionsExport(set),
...coSttnActionsExport(set), // 옮겨야함
...ldrmntCoSttnActionsExport(set), // 옮겨야함
...ldrmntActionsExport(set), // 옮겨야함
...pbnstPrfmncActionsExport(set),
...coRvwActionsExport(set),
...ruseHstryActionsExport(set),
...pbnstPrfmncSttnActionsExport(set),
...drgtActionsExport(set),
...ruseCaseActionsExport(set),
...rainStatActionsExport(set),
...rswtStatActionsExport(set),
...matStatActionsExport(set)
};
});
};
+63 -2
View File
@@ -1,6 +1,6 @@
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { Checkbox, Input, TableCell, TableRow } from "@common/components/ui";
export const rainChkTableData = (chkData: rainChkZodType[]) => {
@@ -101,7 +101,7 @@ export const chRowspanTable = (
.map((head) => {
const key = head.id;
const isMerged = head.rowSpan;
const isMerged = head.mergeCell;
const value = row[key];
// 병합 대상이면 중복 렌더링 여부 판단
if (isMerged) {
@@ -184,4 +184,65 @@ export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean)
}
});
}
const handleChange = (
rowIndex: number,
field: any,
value: string | number,
setInputData: (data:any) => void
) => {
if(Number(value) < 0 ||! Number(value)){
value = 0;
}else{
value = Number(value);
}
setInputData((prevData:any) =>
prevData?.map((row:any, index: number) => {
if (index === rowIndex) {
return {
...row,
[field ]: value,
};
}
return row;
})
);
};
;
export const InputTableBody = (chgRes: any[] | [] ,headList:TableUpperProps[], setInputData: (data: any[]) => void) => {
return (
<>
{chgRes.map((data, dataIndex) => (
<TableRow key={dataIndex + "row"}>
{headList.map((head, headIndex) => (
<TableCell key={head.id + headIndex} className="w-36" >
{head.edit ===true && data.edit !==false?
<Input
className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`}
onChange={(e) =>
handleChange(dataIndex, head.id, e.target.value,setInputData)
}
value={data[head.id as keyof any] ?? ""}
/> : (
<div
className={`
${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
!text-xl w-full h-10
`}
>
{data[head.id as keyof any] ?? ""}
</div>
)
}
</TableCell>
))}
</TableRow>
))}
</>
);
}
+22 -10
View File
@@ -4,7 +4,6 @@ import {
type SelectDataType,
type ReturnType,
filePickedBlobArray,
sheetParameter,
} from "@common/business_components/ui";
import type { RefObject } from "react";
@@ -15,12 +14,14 @@ export const getCity = (val: string, sggCd: SelectDataType[]) => {
val: item.val,
text: item.text, // 한국어 텍스트
}));
data.unshift({ val: "0", text: "전체" });
return data;
};
// cd text 넣기
export const tableData = (data: any, code: comCodeState) => {
const chCode = code.code;
return data?.map(
(item: {
sggCd: string;
@@ -29,17 +30,16 @@ export const tableData = (data: any, code: comCodeState) => {
}) => {
let returnData = {};
const sggText = chCode.sggCd.find(
(cd) => cd.val === String(item.sggCd)
(cd) => cd.val === String(item.sggCd).trim()
)?.text;
const cityText = chCode.cityCd.find(
(cd) => cd.val === String(item.ctpvCd)
(cd) => cd.val === String(item.ctpvCd).trim()
)?.text;
if (item?.reuseBuilding?.length > 0) {
const bdsgUsgText = chCode.bdstUsgCd.find(
(cd) => Number(cd.val) === item?.reuseBuilding[0]?.bdstUsgCd
)?.text;
const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn;
returnData = {
...item,
sggText: sggText ?? "없음",
@@ -54,7 +54,6 @@ export const tableData = (data: any, code: comCodeState) => {
cityText: cityText ?? "없음",
};
}
return returnData;
}
);
@@ -82,7 +81,7 @@ export const excelDownload = (
export const excelArrayDownload = (
fileNm: string,
sampleFile: string,
sheetArray: [typeof sheetParameter]
sheetArray: []
) => {
if (!sheetArray) return;
fetch(`/${sampleFile}`, {}).then(async (response) => {
@@ -96,8 +95,6 @@ export const excelArrayDownload = (
});
};
// onchange 텍스트를 숫자로 and ,제거
export const handleCommaNumberChange = (
e: React.ChangeEvent<HTMLInputElement>,
@@ -127,7 +124,6 @@ export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
return con;
};
export const safeDate = (value: any): Date | undefined => {
const date = new Date(value);
return isNaN(date.getTime()) ? undefined : date;
@@ -140,4 +136,20 @@ export const yearOptions: { val: string; text: string }[] = Array.from(
val: String(1970 + i),
text: `${1970 + i}년`,
})
);
);
export const getdmdMatFlag = (flag: string|undefined) => {
let flagMat = "";
if(flag === undefined || flag === null) {
flagMat = "신청";
}else if(flag.trim() === "Sub") {
flagMat = "검토";
}else if(flag.trim() === "matched") {
flagMat = "매칭완료";
}else {
flagMat = "신청";
}
return flagMat;
};
@@ -0,0 +1,388 @@
import { useWrStore } from "@/app/store";
import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList";
import type {
DedMatUpdateType,
DmdCoReqType,
} from "@/app/store/matDmd/coMatRvw/type";
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { formH1Class } from "@/components/lib/class/comClass";
import { ConstCostFeeTable } from "@/components/ui/modal/coMat/constCostFeeTable";
import { RateFeeTableModal } from "@/components/ui/modal/coMat/rateFeeModal";
import {
Form,
FormField,
FormUi,
UiModal,
UiTable,
} from "@common/business_components/ui";
import PopoverUi from "@common/business_components/ui/popover_ui";
import { Button, Input, Label } from "@common/components/ui";
import { useEffect, useState } from "react";
import { type UseFormReturn } from "react-hook-form";
export default function ConCostForm({
form,
type,
}: {
form: UseFormReturn<DmdCoReqType>;
type: string;
}) {
const { coMatRvwUpdate, ruseRvwCalUpdate } = useWrStore((state) => state);
const [isTrfMo, setIsTrfMo] = useState<{
isModal: boolean;
}>({ isModal: false });
const [isCmpttnMo, setIsCmpttnMo] = useState<{
isModal: boolean;
}>({ isModal: false });
const zipDowonLoad = () => {
fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => {
const blobRet = await response.blob();
// const blob = new Blob([blobRet], { type: "application/octet-stream" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blobRet);
link.download =
"24년_수도시설 운영비 및 개략공사비 산정프로그램.zip";
link.click();
});
};
const onSubmit = (value: DmdCoReqType) => {
if (type === "mat") {
const data: DedMatUpdateType = {
dmdInfoSn: form.getValues("dmdInfoSn"),
usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs"),
cstrnCst: form.getValues("demandCst.cstrnCst"),
fcltSbsdEpsTrf: form.getValues("demandCst.fcltSbsdEpsTrf"),
prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"),
rgtr: TEST_UUID,
};
console.log("mat data ", data);
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data);
} else if (type === "hist") {
console.log("hist data ", value);
ruseRvwCalUpdate(value);
}
};
useEffect(() => {
console.log(" form ", form.formState.errors);
}, [form.formState]);
return (
<>
<hr className="mt-8" />
<Form {...form}>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
표준공사비 산정
</h3>
<div className="flex items-center mx-3 mb-3">
<h1 className="">처리시설 표준공사비 산정</h1>
<Button size={"sm"} onClick={(e) => {}}>
계산
</Button>
<Button size={"sm"} onClick={form.handleSubmit(onSubmit)}>
저장
</Button>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>기본사항</h1>
</div>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="용도">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndQty"
render={({ field }) => (
<FormUi label="요구수량(M3/d)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<PopoverUi
childrenTriger={
<>
<Label className="underline">
용도에 따른 처리공정
<i className="diveicon di-search" />
</Label>
</>
}
childrenBody={
<>
<UiTable
className=""
headName={"용도에 따른 처리공정"}
tableData={usageProcData}
headlist={[
{ id: "usage", title: "용도" },
{ id: "process", title: "단위공정" },
]}
pageSize={0}
total={0}
cellClick={() => {}}
onPageChange={() => {}}
/>
</>
}
bodyClassName={"w-[25vw] max-w-none h-[54vh]"}
></PopoverUi>
<FormField
control={form.control}
name="demandCst.usgPrcsProcs"
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={field.onChange}
value={form.getValues("demandCst.usgPrcsProcs") ?? ""}
className="mt-2"
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="dmndQty"
render={({ field }) => (
<FormUi label="처리시설 용량(요구수량 * 365일)">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={Number(field.value) * 365 || 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-12 w-full">
<h1 className={formH1Class}>공사비 입력사항</h1>
</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>
</div>
<FormField
control={form.control}
name="demandCst.prcsFcltCpctCstrnCst"
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</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>
</div>
<FormField
control={form.control}
name="demandCst.fcltSbsdEpsTrf"
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-3 mt-4">
<PopoverUi
childrenTriger={
<>
<Label className="underline">
총사업비 (백만원) <i className="diveicon di-search" />
</Label>
</>
}
childrenBody={
<>
<div className="!w-full ">
<div className=" items-center font-bold mb-1 !text-3xl">
총사업비 계산방법
</div>
<div className=" items-center !text-2xl">
하수처리수 재이용시설 총 사업비 =
공사비+시설부대경비{" "}
</div>
</div>
</>
}
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
}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>공급처 선정</Label>
<Button size={"sm"} onClick={(e) => {}} className="bg-none">
후보지 조회
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</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>
</div>
<UiModal
body={<ConstCostFeeTable setReturnData={(e) =>{}}></ConstCostFeeTable>}
bodyClass="w-[40vw] max-w-none h-[30vh]"
open={isTrfMo.isModal}
onOpenChange={(open) => {
setIsTrfMo({ isModal: open });
}}
/>
<UiModal
body={<RateFeeTableModal setReturnData={(e) =>{}}></RateFeeTableModal>}
bodyClass="w-[70vw] max-w-none h-[30vh]"
open={isCmpttnMo.isModal}
onOpenChange={(open) => {
setIsCmpttnMo({ isModal: open });
}}
/>
</Form>
</>
);
}
@@ -13,7 +13,7 @@ import {
fcBizSchema,
type customPbnst,
type fcBizType,
type PbnstDemandComType,
type PbnstRegArrrayType,
type ppInstlType,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
@@ -39,22 +39,29 @@ import {
Input,
Label,
} from "@common/components";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useRef, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { useFieldArray, useForm, type UseFormReturn } from "react-hook-form";
import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail";
import { safeDate } from "@/components/lib/func/commom";
import SearchInputText from "@/components/ui/searchInput/searchInput";
import SdmInsertForm, {
type DemandCompType,
} from "@common/business_components/ui/sdmInsertForm";
import SdmInsertForm from "@common/business_components/ui/sdmInsertForm";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
import RuseMngTableForm from "@/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm";
export function PbnstBuseForm({
formType,
firstBizData,
indexMng = 0,
indexBiz = 0,
setIndexBiz,
form,
}: {
formType: string;
firstBizData?: fcBizType[];
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
indexMng: number;
indexBiz: number;
setIndexBiz: (index: number) => void;
}) {
const ref = useRef<ppInstlType[] | null>(null);
const {
@@ -73,62 +80,98 @@ export function PbnstBuseForm({
const [ppiSelectList, setPpiSelectList] =
useState<[{ name: string; val: SelectDataType[] }]>();
const [ppiYn, setPpiYn] = useState("Y");
const [selectBizCycle, setSelectBizCycle] = useState<
{
text: string;
val: number;
}[]
>([{ text: "없음", val: 0 }]);
const [isFcOrgwts, setIsFcOrgwts] = useState<boolean>(false);
const [sumCpct, setSumCpct] = useState<number>(0);
const [getDmdList, setGetFmdList] = useState<number>(0);
const [isDmdModal, setIsDmdModal] = useState<{
isMoal: boolean;
data: DemandCompType;
}>({ isMoal: false, data: {} as DemandCompType });
const form = useForm<fcBizType>({
resolver: zodResolver(fcBizSchema),
defaultValues:
formType === "reg" &&
pbnst.pbnstMngRegData &&
pbnst.pbnstMngRegData[0]?.fcBizs
? (pbnst.pbnstMngRegData[0].fcBizs[0] ?? {})
: formType === "update" &&
typeof pbnst.pbnsUpdateIndex.biz === "number" &&
pbnst.pbnsUpdateIndex.biz >= 0 &&
pbnst.pbnstRes
? pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]?.fcBizs[
pbnst.pbnsUpdateIndex.biz
]
: fcBizSchema.parse({}),
});
// 2. Define a submit handler.
function onSubmit(values: fcBizType) {
// console.log(values);
}
useEffect(() => {
const total =
(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`) ?? 0) +
(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`) ?? 0) +
(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`) ?? 0);
form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.totalMoney`, total);
}, [
form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`),
form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`),
form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`)
]);
// const form = useForm<fcBizType>({
// resolver: zodResolver(fcBizSchema),
// defaultValues:
// formType === "reg" &&
// pbnst.pbnstMngRegData &&
// pbnst.pbnstMngRegData[0]?.fcBizs
// ? (pbnst.pbnstMngRegData[0].fcBizs[0] ?? {})
// : formType === "update" &&
// typeof pbnst.pbnsUpdateIndex.biz === "number" &&
// pbnst.pbnsUpdateIndex.biz >= 0 &&
// pbnst.pbnstRes
// ? pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]?.fcBizs[
// pbnst.pbnsUpdateIndex.biz
// ]
// : fcBizSchema.parse({}),
// mode: "onChange",
// });
useEffect(() => {
if (form) {
const cycleLength = form.getValues(`items.${indexMng}.fcBizs`).length;
setSelectBizCycle(
Array.from({ length: cycleLength }, (_, index) => ({
text: `${index + 1}차`, // ✅ index + 1
val: index, // 이건 그대로 유지 (value로는 0부터 시작)
}))
);
}
}, [indexMng, form]);
// 2. Define a submit handler.
function addRuseFcltObj() {
const newItem = fcBizSchema.parse({});
const formRuse = form.getValues(`items.${indexMng}`);
const formBizs = form.getValues(`items.${indexMng}.fcBizs`);
const pbnstBizCycle = formBizs.length;
// 🧩 새로운 fcBizs 기본 객체 생성 (필수값만 채우고 나머지는 default로)
const newItem = fcBizSchema.parse({
cycl: pbnstBizCycle + 1,
pbnstRuseFcltFk: formRuse.pbnstRuseFcltPk,
fcOrgwts: undefined,
pplInstls: undefined,
fcDemands: undefined,
});
const index = pbnst.pbnsUpdateIndex.mng;
let regData: fcBizType = {} as fcBizType;
if (
pbnst.pbnstRes &&
pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng] &&
pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]?.fcBizs
) {
regData = {
pbnstRuseFcltFk:
String(pbnst.pbnstRes[0]?.swtrmtFcltFk) +
String(pbnst.pbnstRes.length + 1),
cycl: Number(
(pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]?.fcBizs?.length || 0) + 1
),
} as fcBizType;
const newPbnstRes = [...(pbnst.pbnstRes as customPbnst[])];
newPbnstRes[index]?.fcBizs?.length &&
newPbnstRes[index]?.fcBizs?.push(regData);
getBizCycle(newPbnstRes[index] as customPbnst);
appendRuseFclt(newPbnstRes);
}
appendBiz(newItem);
const cycleLength = form.getValues(`items.${indexMng}.fcBizs`).length;
setSelectBizCycle(
Array.from({ length: cycleLength }, (_, index) => ({
text: `${index + 1}차`, // ✅ index + 1
val: index, // 이건 그대로 유지 (value로는 0부터 시작)
}))
);
}
useEffect(() => {
console.log("form ", form.watch());
}, [form.formState]);
const { fields: fcBizs, append: appendBiz } = useFieldArray({
control: form.control,
name: `items.${indexMng}.fcBizs`,
});
const {
fields: fcDemands,
@@ -136,78 +179,54 @@ export function PbnstBuseForm({
remove: removeDemand,
} = useFieldArray({
control: form.control,
name: "fcDemands",
name: `items.${indexMng}.fcBizs.${indexBiz}.fcDemands`,
});
const { fields: fcOrgwtFiled } = useFieldArray({
control: form.control,
name: "fcOrgwts",
name: `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`,
});
console.log(" fcOrgwtFiled ", fcOrgwtFiled);
const {
fields: pplInstls,
append,
remove,
append: appendPpl,
remove: removePpl,
} = useFieldArray({
control: form.control,
name: "pplInstls",
name: `items.${indexMng}.fcBizs.${indexBiz}.pplInstls`,
});
// 등록할때 신규 값을 계속 가지고 있으려고
useEffect(() => {
const formData = form.watch();
formData.pplInstls = ref.current ? [...ref.current] : []; // ← form 내부 상태 기준으로 복사
if (formType === "reg") {
if (
firstBizData &&
firstBizData[0] &&
(form.getValues("pbnstRuseFcltFk") === "" ||
form.getValues("pbnstRuseFcltFk") === undefined)
) {
form.setValue(
"pbnstRuseFcltFk",
String(firstBizData[0].pbnstRuseFcltFk)
);
form.setValue("cycl", firstBizData[0].cycl);
}
pbnstBizData(formData as fcBizType);
}else if(formType === "update"){
console.log('formdata ', formData)
pbnstBizData(formData as fcBizType);
}
}, [firstBizData, form.formState, formType, pbnst.pbnstRes]);
useEffect(() => {
if (ppiYn === "N") {
form.setValue("pplInstls", []);
form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.pplInstls`, []);
}
}, [ppiYn]);
}, [ppiYn, indexMng, indexBiz]);
useEffect(() => {
console.log("pbnst. bug pbnstMngRegData ", pbnst.pbnstMngRegData);
}, [pbnst.pbnstMngRegData]);
const plusHist = () => {
const regData = {
ruseFcltBizFk: ref.current?.[0]?.ruseFcltBizFk ?? form.getValues('pbnstRuseFcltBizPk'),
choose: false,
ppMqlt: "",
pdmt: "",
cpct: 0,
};
const currentTableDataFromRef = ref.current ? [...ref.current] : [];
const newDataForRHF = [...currentTableDataFromRef, regData];
form.setValue("pplInstls", newDataForRHF, {
shouldValidate: true, // 필요하다면 유효성 검사 실행
shouldDirty: true, // 폼 상태를 dirty로 변경
});
const latestOpers = form.getValues("pplInstls");
ref.current = [...latestOpers];
if (
form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltBizPk`)
) {
appendPpl({
ruseFcltBizFk: form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltBizPk`
),
choose: false,
ppMqlt: "",
pdmt: "",
cpct: 0,
});
} else {
appendPpl({
choose: false,
ppMqlt: "",
pdmt: "",
cpct: 0,
});
}
};
const plusArray = () => {
@@ -219,28 +238,31 @@ export function PbnstBuseForm({
splyEndDay: new Date(),
splyCpct: 0,
splyFmYn: "Y",
pbnstRuseFcltBizPk: form.getValues('pbnstRuseFcltBizPk'),
pbnstRuseFcltFk: form.getValues('pbnstRuseFcltFk')??'',
pbnstRuseFcltBizPk: form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltBizPk`
),
pbnstRuseFcltFk:
form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltFk`
) ?? "",
dmdInfoFk: "",
//telno: "",
});
};
const removeSelected = () => {
if (!ref.current) return;
const selectedIdxs = ref.current
const nowPPl = form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.pplInstls`
);
if (!nowPPl) return;
const selectedIdxs = nowPPl
.map((item, idx) => (item.choose ? idx : -1))
.filter((idx) => idx !== -1);
selectedIdxs.reverse().forEach((idx) => remove(idx));
selectedIdxs.reverse().forEach((idx) => removePpl(idx));
};
useEffect(() => {
if (bizCycle && formType !== "reg") {
const index = Number(bizCycle) - 1;
form.reset(pbnst.pbnstResObj?.fcBizs[index]);
ref.current = pbnst.pbnstResObj?.fcBizs[index]?.pplInstls ?? [];
}
}, [bizCycle, pbnst.pbnstResObj, formType]);
useEffect(() => {
const ppl = [] as { name: string; val: SelectDataType[] }[];
if (code.pplLenght) {
@@ -256,10 +278,23 @@ export function PbnstBuseForm({
}
}, [code]);
useEffect(() => {
console.log(" demandCompList ", demandCompList);
}, [demandCompList]);
useEffect(() => {
console.log("form errors:", form.formState.errors);
}, [form.formState.errors]);
useEffect(() => {
const pplSum = form.watch(`items.${indexMng}.fcBizs.${indexBiz}.pplInstls`);
if (!pplSum) return;
let sum = 0;
pplSum.forEach((item) => {
sum += Number(item.cpct) || 0;
});
setSumCpct(sum);
}, [form.formState, indexMng, indexBiz]);
return (
<>
<div className=" !mx-[1.6rem] !p-0r">
@@ -267,25 +302,23 @@ export function PbnstBuseForm({
<div className="justify-between">
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
key={indexBiz}
// onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 mx-auto w-full mt-7"
>
<div className="flex justify-between items-center mx-3 mb-3">
<h1 className=" text-xl"></h1>
<div className="flex items-center gap-2 mx-3">
<h1 className={formTableName}>등록차수</h1>
<SelectBox
label=""
selectArray={pbnstBizCycle}
value={bizCycle ?? pbnstBizCycle[0]?.val}
selectArray={selectBizCycle || []}
value={selectBizCycle[indexBiz]?.val}
className={""}
selectClass={selectClass}
onSelectValue={(val) => {
setBizCycle(String(val));
getpbnstInsertIndex({
...pbnst.pbnsUpdateIndex,
biz: Number(val),
});
setIndexBiz(Number(val));
}}
></SelectBox>
@@ -294,7 +327,7 @@ export function PbnstBuseForm({
type="button"
size={commonButonSize}
>
저장
추가
</Button>
</div>
</div>
@@ -304,6 +337,8 @@ export function PbnstBuseForm({
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/>
<MngRegFormDetail
formList={businessMoneyInfo}
@@ -311,13 +346,18 @@ export function PbnstBuseForm({
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/>
<MngRegFormDetail
formList={ruseFcltinfo}
h1Title={"재처리시설"}
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/>
<MngRegFormDetail
formList={concentratedWaterInfo}
@@ -325,6 +365,8 @@ export function PbnstBuseForm({
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/>
<MngRegFormDetail
formList={wasteWaterFcltINfo}
@@ -332,6 +374,8 @@ export function PbnstBuseForm({
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/>
<h1 className={formH1Class}>재이용 원수취수 현황</h1>
@@ -347,9 +391,17 @@ export function PbnstBuseForm({
</Button>
</div>
<RuseMngTable
tableData={fcOrgwtFiled}
key={`fcOrgwts-${indexMng}-${indexBiz}`} // 이게 핵심!
tableData={
form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`
) ?? []
}
headList={pbnst.pbnstOrgwtHeadList}
upHeadList={[]}
indexMng={indexMng}
indexBiz={indexBiz}
formNm={"fcOrgwts"}
/>
</div>
<h1 className={formH1Class}>재이용 공급관로 설치 현황</h1>
@@ -394,16 +446,28 @@ export function PbnstBuseForm({
)}
</div>
<div>
<RuseMngTable
tableData={pplInstls}
<RuseMngTableForm
key={`pplInstls-${indexMng}-${indexBiz}`} // 이게 핵심!
tableData={
form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.pplInstls`
) ?? []
}
headList={pbnst.pplInstlsHeadLisat}
code={ppiSelectList ?? []}
ref={ref}
//ref={ref}
indexMng={indexMng}
indexBiz={indexBiz}
form={form}
formNm={"pplInstls"}
upHeadList={[]}
onTableSet={(val) => {
if (!ref.current) return;
const pplSum = form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.pplInstls`
);
if (!pplSum) return;
let sum = 0;
ref.current.forEach((item) => {
pplSum.forEach((item) => {
sum += Number(item.cpct) || 0;
});
setSumCpct(sum);
@@ -417,6 +481,8 @@ export function PbnstBuseForm({
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/>
<div key={"hasu"}>
<h1 className={formH1Class}>{"하수처리수 재이용수 수요처"}</h1>
@@ -445,68 +511,61 @@ export function PbnstBuseForm({
수요처 추가
</Button>
</div>
{fcDemands.map((field, index) => (
{(
form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.fcDemands`
) || []
).map((field, index) => (
<div
key={index + "loot"}
key={`fcDemands-${indexMng}-${indexBiz}`} // 이게 핵심!
className="grid grid-cols-12 gap-4 mt-3"
>
<div key={index + "keySon1"} className="col-span-4">
<FormField
control={form.control}
name={`fcDemands.${index}.dmdCoNm`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.dmdCoNm`}
render={({ field: f }) => (
<FormUi label="수요처명">
<SearchInputText
label={undefined}
label={"수요처"}
initValue={f.value}
setValue={(val) => {
f.onChange(val);
if (val) getDemandCompList(val, 3);
if (val && val.length > 2) {
getDemandCompList(val, 3);
}
}}
setRtnData={(valList: PbnstDemandComType[]) => {
console.log('valList[0] ', index)
if (
valList.length > 0 &&
valList['0']
) {
setRtnData={(valList: any) => {
if (valList) {
form.setValue(
`fcDemands.${index}.pbnstRuseFcltBizPk`,
form.getValues('pbnstRuseFcltBizPk')
`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.dmdInfoFk`,
valList.dmdInfoPk
);
form.setValue(
`fcDemands.${index}.pbnstRuseFcltFk`,
form.getValues('pbnstRuseFcltFk')??''
`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.daddr`,
valList.daddr
);
form.setValue(
`fcDemands.${index}.dmdCoNm`,
valList['0'].dmdCoNm
`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.useUsgCd`,
valList.useUsgCd
);
form.setValue(
`fcDemands.${index}.daddr`,
valList['0'].daddr
`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyCpct`,
valList.splyCpct
);
form.setValue(
`fcDemands.${index}.useUsgCd`,
valList['0'].useUsgCd
);
form.setValue(
`fcDemands.${index}.splyCpct`,
valList['0'].splyCpct
);
form.setValue(
`fcDemands.${index}.splyFmYn`,
valList['0'].splyFmYn ?? "Y"
);
form.setValue(
`fcDemands.${index}.dmdInfoPk`,
valList['0'].dmdInfoPk ?? "Y"
`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.dmdInfoFk`,
valList.dmdInfoPk?.toString()
);
}
}}
searchList={demandCompList?.map((item) => {
return {
...item,
searchNm: item.dmdCoNm,
searchPk: item.dmdInfoPk,
};
})}
></SearchInputText>
</FormUi>
)}
@@ -515,7 +574,7 @@ export function PbnstBuseForm({
<div key={index + "keySon2"} className="col-span-4">
<FormField
control={form.control}
name={`fcDemands.${index}.daddr`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.daddr`}
render={({ field: f }) => (
<FormUi label="위치(주소)">
<Input
@@ -533,18 +592,16 @@ export function PbnstBuseForm({
<div key={index + "keySon3"} className="col-span-4">
<FormField
control={form.control}
name={`fcDemands.${index}.useUsgCd`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.useUsgCd`}
render={({ field: f }) => (
<FormUi label="사용용도">
<SelectBox
<SelectBox
label={""}
selectClass={""}
className="w-full"
selectArray={code.dmdUszCd}
onSelectValue={(val: string | number) =>
f.onChange(val)
}
value={f.value}
onSelectValue={f.onChange}
value={f.value ?? code.dmdUszCd[0]?.val}
/>
</FormUi>
)}
@@ -553,7 +610,7 @@ export function PbnstBuseForm({
<div key={index + "keySon4"} className="col-span-3">
<FormField
control={form.control}
name={`fcDemands.${index}.splyBgngDay`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyBgngDay`}
render={({ field: f }) => (
<FormUi label="공급시작일">
<DatePicker
@@ -571,7 +628,7 @@ export function PbnstBuseForm({
<div key={index + "keySon5"} className="col-span-3">
<FormField
control={form.control}
name={`fcDemands.${index}.splyEndDay`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyEndDay`}
render={({ field: f }) => (
<FormUi label="공급종료일">
<DatePicker
@@ -589,7 +646,7 @@ export function PbnstBuseForm({
<div key={index + "keySon6"} className="col-span-3">
<FormField
control={form.control}
name={`fcDemands.${index}.splyCpct`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyCpct`}
render={({ field: f }) => (
<FormUi label="(계약)공급량(m3/일)">
<Input
@@ -607,7 +664,7 @@ export function PbnstBuseForm({
<div key={index + "keySon7"} className="col-span-3">
<FormField
control={form.control}
name={`fcDemands.${index}.splyFmYn`}
name={`items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyFmYn`}
render={({ field: f }) => (
<FormUi label="공급 유량계 유무">
<SelectBox
@@ -634,14 +691,17 @@ export function PbnstBuseForm({
<UiModal
open={isFcOrgwts}
onOpenChange={(open: boolean) => setIsFcOrgwts(open)}
bodyClass={"w-[50vw] max-w-none h-[60vh]"}
bodyClass={"w-[50vw] max-w-none h-[90vh]"}
body={
<FcOrgwtsRegModal
closeModal={() => {
setIsFcOrgwts(false);
}}
onRightSet={(val) => {
form.setValue("fcOrgwts", val);
form.setValue(
`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`,
val
);
}}
></FcOrgwtsRegModal>
}
@@ -662,7 +722,6 @@ export function PbnstBuseForm({
getDemandCompList(searchText, pageCnt);
}}
rtnInputData={(data) => {
console.log(" rtn data ", data);
regDemandCompany(data as DemandCompType);
setIsDmdModal({ isMoal: false, data: data as DemandCompType });
}}
@@ -1,12 +1,16 @@
"use client";
import { useWrStore } from "@/app/store";
import { FileUpload, FormUi, SelectBox } from "@common/business_components/ui";
import {
FileUpload,
FormUi,
SelectBox,
type SelectDataType,
} from "@common/business_components/ui";
import { Form, FormField } from "@common/business_components/ui/form";
import { Button, Input } from "@common/components";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useRef, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { useFieldArray, useForm, type UseFormReturn } from "react-hook-form";
import { z } from "zod";
import {
commonButonSize,
@@ -14,31 +18,37 @@ import {
formTableName,
} from "@/components/lib/class/comClass";
import { TusClientUpload } from "@/components/lib/useTus_wr/useTusWr";
import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable";
import {
pbnstRegZod,
type customPbnst,
type fcBizType,
type fcFileType,
type operType,
type PbnstRegArrrayType,
type selectLabel,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { Label } from "@common/business_components/ui/form/lib/label";
import React from "react";
import RuseMngTableForm from "@/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm";
export type FilesType = {
atflCd: string;
file: File;
};
export function PbnstMngForm({
form,
formType,
firstFcltData,
indexMng ,
setIndexMng,
}: {
form: UseFormReturn<{items:PbnstRegArrrayType}>;
formType: string;
firstFcltData?: customPbnst;
indexMng: number;
setIndexMng: (index: number) => void;
}) {
const {
code,
pbnst,
pbnstInsert,
pbnstMngData,
@@ -46,78 +56,87 @@ export function PbnstMngForm({
fileDownLoad,
getBizCycle,
getpbnstInsertIndex,
appendRuseFclt
appendRuseFclt,
} = useWrStore((state) => state);
const { pbnstRes } = pbnst;
const [regFileList, setRegFileList] = useState<fcFileType[] | null>(null);
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 [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 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]
: pbnstRegZod.parse({}),
});
// 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,
remove,
} = useFieldArray({
control: form.control,
name: "fcOpers",
name: `items.${indexMng}.fcOpers`,
});
const handleProgress = (percentage: string) => {
setProgress(Number(percentage));
};
const selectFclt = (val: number) => {
if (pbnst.pbnstRes && pbnst.pbnstRes[val]) {
getBizCycle(pbnst.pbnstRes[val]);
form.reset(pbnst.pbnstRes[val]);
getpbnstInsertIndex({ ...pbnst.pbnsUpdateIndex, mng: val });
}
// if (pbnst.pbnstRes && pbnst.pbnstRes[val]) {
// getBizCycle(pbnst.pbnstRes[val]);
// // form.reset(pbnst.pbnstRes[val]);
// getpbnstInsertIndex({ ...pbnst.pbnsUpdateIndex, mng: val });
// }
};
const plusHist = () => {
const currentTableDataFromRef = ref.current ? [...ref.current] : [];
const regData = {
append( {
choose: false,
pbnstRuseFcltFk:form.getValues('pbnstRuseFcltPk')??"",
pbnstRuseFcltFk: form.getValues(`items.${indexMng}.pbnstRuseFcltPk`) ?? "",
rgtr: "",
mdfr: "",
operMthd: "",
rprtvBzenty: "",
bgngDt: new Date(),
endDt: new Date(),
};
const newDataForRHF = [...currentTableDataFromRef, regData];
form.setValue("fcOpers", newDataForRHF, {
shouldValidate: true, // 필요하다면 유효성 검사 실행
shouldDirty: true, // 폼 상태를 dirty로 변경
});
})
};
const removeSelected = () => {
if (!ref.current) return;
const selectedIdxs = ref.current
.map((item, idx) => (item.choose ? idx : -1))
.filter((idx) => idx !== -1);
selectedIdxs.reverse().forEach((idx) => remove(idx));
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 fileHandler = (files: File[], type: string) => {
@@ -192,109 +211,109 @@ export function PbnstMngForm({
// 등록할때 신규 값을 계속 가지고 있으려고
useEffect(() => {
if (
firstFcltData &&
(form.getValues("swtrmtFcltFk") === "" ||
form.getValues("swtrmtFcltFk") === undefined)
) {
form.setValue("swtrmtFcltFk", firstFcltData.swtrmtFcltFk);
form.setValue(
"pbnstRuseFcltPk",
String(firstFcltData.swtrmtFcltFk + "1")
);
form.setValue("fcBizs", firstFcltData.fcBizs);
}
}, [firstFcltData]);
// 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(() => {
const defaultFiles = form.getValues("fcFiles");
if (defaultFiles && defaultFiles.length > 0) {
const relationFileList = defaultFiles.filter(
(item) => item.fileKnd === "계통도"
);
const planFileList = defaultFiles.filter(
(item) => item.fileKnd === "평면도"
);
if (relationFileList.length > 0)
setRelationFiles(
relationFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([] as BlobPart[], item.filePath),
}))
); // 또는 파일 형식 변환 로직이 있다면 여기에 추가
if (planFileList.length > 0)
setPlanFiles(
planFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([] as BlobPart[], item.filePath),
}))
if(indexMng>=0){
const defaultFiles = form.getValues(`items.${indexMng}.fcFiles`);
if (defaultFiles && defaultFiles.length > 0) {
const relationFileList = defaultFiles.filter(
(item) => item.fileKnd === "계통도"
);
const planFileList = defaultFiles.filter(
(item) => item.fileKnd === "평면도"
);
if (relationFileList.length > 0)
setRelationFiles(
relationFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([] as BlobPart[], item.filePath),
}))
); // 또는 파일 형식 변환 로직이 있다면 여기에 추가
if (planFileList.length > 0)
setPlanFiles(
planFileList.map((item) => ({
atflCd: item.fileTkn,
file: new File([] as BlobPart[], item.filePath),
}))
);
}else{
setRelationFiles(null);
setPlanFiles(null);
}
}
}, [form.formState.defaultValues]); // 초기화 이후 1회 실행
}, [form.watch(`items.${indexMng}`),indexMng]); // 초기화 이후 1회 실행
// 등록할때 신규 값을 계속 가지고 있으려고
useEffect(() => {
if (
formType === "update" &&
pbnst.pbnsUpdateIndex.biz >= 0 &&
pbnst.pbnstRes
) {
const bizData = pbnst.pbnstRes[pbnst.pbnsUpdateIndex.biz];
// if (
// formType === "update" &&
// pbnst.pbnsUpdateIndex.biz >= 0 &&
// pbnst.pbnstRes
// ) {
// const bizData = pbnst.pbnstRes[pbnst.pbnsUpdateIndex.biz];
if (bizData) {
getBizCycle(bizData);
}
}
// 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") {
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[]);
}
// 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]);
useEffect(() => {
pbnstMngData(pbnst.pbnstMngRegData);
// pbnstMngData(pbnst.pbnstMngRegData);
}, [pbnst.pbnstMngRegData]);
useEffect(() => {
if ( pbnst.pbnstRes && pbnst.pbnstRes?.length<= 0) return;
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 (fcltNmList) setFcltNm(fcltNmList);
}, [pbnst.pbnstRes]);
// 2. Define a submit handler.
function onSubmit(values: z.infer<typeof pbnstRegZod>) {
values.fcOpers = fcOpresData || [];
values.fcOpers = [];
values.fcFiles = regFileList || [];
pbnstInsert(values);
}
useEffect(() => {
if (relationfiles) {
setRegFileList(regFileFilter(relationfiles, "계통도", regFileList || []));
@@ -306,25 +325,52 @@ export function PbnstMngForm({
}
}, [planFiles]);
useEffect(() => {
console.log("form errors:", form.formState.errors);
}, [form.formState.errors]);
if (code.ruseMngMtd) {
setMngMtdCode([{ name: "ruseMngMtd", val: code.ruseMngMtd }]);
}
}, [code]);
return (
<div className=" !mx-[1.6rem] !p-0r">
<div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
{/* <form onSubmit={form.handleSubmit()}> */}
<form>
<div className="flex justify-between items-center mx-3 mb-3">
<div className="col-span-2 flex items-top">
<Label className={formTableName + "pr-3 col-span-2 "}>
재이용 시설명
</Label>
{formType === "reg" ? (
{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>
)}
/>
) : (
<FormField
control={form.control}
name="ruseUtztnFcltNm"
name={`items.${indexMng}.ruseUtztnFcltNm`}
render={({ field }) => (
<FormUi label="">
<Input
@@ -339,23 +385,8 @@ export function PbnstMngForm({
</FormUi>
)}
/>
) : (
<SelectBox
label=""
className="mt-4 ml-2"
selectClass={undefined}
selectArray={fcltNm ?? []}
onSelectValue={(val) => {
selectFclt(Number(val));
}}
value={""}
/>
)}
</div>
{/* <Button onClick={addRuseFcltObj} type="button" size={commonButonSize}>
추가
</Button> */}
</div>
<div>
@@ -381,27 +412,33 @@ export function PbnstMngForm({
</Button>
</div>
</div>
<RuseMngTable
tableData={fcOpersField}
<RuseMngTableForm
tableData={form.getValues(`items.${indexMng}.fcOpers`)||[]}
headList={pbnst.pbnstMngUpHeadList}
upHeadList={pbnst.pbnstMngNm}
code={mngMtdCode || []}
onTableSet={(val) => {
setFcOpresData(val);
//setFcOpresData(val);
}}
ref={ref}
></RuseMngTable>
indexMng={indexMng}
form={form}
formNm={"fcOpers"}
// ref={ref}
></RuseMngTableForm>
</div>
</div>
<div>
<h1 className={formH1Class}>재이용수 공급 가능량</h1>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-3 mt-4">
<div className="col-span-4 mt-4">
<FormField
key={`FormField-items.${indexMng}.splyExtraCpct`}
control={form.control}
name="fcltCpct"
name={`items.${indexMng}.fcltCpct`}
render={({ field }) => (
<FormUi label="시설용량(m³/일)">
<FormUi label="재이용 시설용량(m³/일)">
<Input
key={`items.${indexMng}.fcltCpct`}
placeholder=""
type="number"
onChange={(e) => {
@@ -413,13 +450,16 @@ export function PbnstMngForm({
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="col-span-4 mt-4">
<FormField
key={`FormField-items.${indexMng}.ruseCpct`}
control={form.control}
name="hasuhasu"
name={`items.${indexMng}.ruseCpct`}
render={({ field }) => (
<FormUi label="하수처리량(m³/일)">
<FormUi label="재이용수공급량(m³/일)">
<Input
key={`items.${indexMng}.ruseCpct`}
placeholder=""
type="number"
onChange={(e) => {
@@ -431,31 +471,15 @@ export function PbnstMngForm({
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="col-span-4 mt-4">
<FormField
key={`FormField-items.${indexMng}.splyExtraCpct`}
control={form.control}
name="ruseCpct"
render={({ field }) => (
<FormUi label="재이용량(m³/일)">
<Input
placeholder=""
type="number"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name="splyExtraCpct"
name={`items.${indexMng}.splyExtraCpct`}
render={({ field }) => (
<FormUi label="공급여유량(m³/일)">
<Input
key={`items.${indexMng}.splyExtraCpct`}
placeholder=""
type="number"
onChange={(e) => {
@@ -1,16 +1,17 @@
'use client'
"use client";
import { useWrStore } from "@/app/store";
import type { formDetailType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList";
import { formH1Class } from "@/components/lib/class/comClass";
import { safeDate } from "@/components/lib/func/commom";
import {
DatePicker,
FormField,
FormUi,
SearchInputSelect,
SelectBox,
type SelectDataType,
} from "@common/business_components/ui";
import { DatePicker, Input } from "@common/components/ui";
import { Input } from "@common/components/ui";
import { useState } from "react";
export default function MngRegFormDetail({
@@ -19,48 +20,55 @@ export default function MngRegFormDetail({
form,
moClass,
sonClass,
cycle,
onIputData,
searchSelectData
indexBiz,
indexMng,
}: {
formList: formDetailType[];
h1Title?: string;
form: any;
moClass?: string;
cycle?: string;
indexBiz?: number;
indexMng?: number;
sonClass?: string;
onIputData?: (data: any) => void;
searchSelectData?: SelectDataType[];
}) {
const { code } = useWrStore((state) => state);
const [searchData, setSearchData]= useState<string>('')
return (
<>
{h1Title ? <h1 className={formH1Class}>{h1Title}</h1> : <></>}
<div className={moClass}>
{formList?.map((item, index) => {
const fieldId = cycle ? `${cycle}.${item.id}` : item.id;
{formList?.map((formHead, index) => {
const fieldId =
typeof indexMng === "number" &&
indexMng >= 0 &&
typeof indexBiz === "number" &&
indexBiz >= 0
? `items.${indexMng}.fcBizs.${indexBiz}.${formHead.id}`
: typeof indexMng === "number" && indexMng >= 0
? `items.${indexMng}.${formHead.id}`
: formHead.id;
return (
<div className={sonClass} key={index + `${item.id}`}>
<div className={sonClass} key={index + `${formHead.id}`}>
<FormField
control={form.control}
name={fieldId}
render={({ field }) => (
<FormUi label={item.lable}>
{item.type === "select" ? (
<FormUi label={formHead.lable}>
{formHead.type === "select" ? (
<Input placeholder="" type="text" {...field} />
) : item.type === "date" ? (
) : formHead.type === "date" ? (
<DatePicker
mode={"single"}
selected={safeDate(field.value) || new Date()}
onSelect={(date: Date | undefined) =>
field.onChange(date)
}
className={"rounded-lg !w-full"}
field={{
value: safeDate(field.value) || new Date(),
onChange: (date: Date | undefined) =>
field.onChange(date),
}}
selectClass={"w-full"}
/>
) : item.type === "number" ? (
) : formHead.type === "number" ? (
<Input
placeholder=""
type="number"
@@ -68,8 +76,9 @@ export default function MngRegFormDetail({
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
readOnly={formHead.option === "readOnly"?true:false}
/>
) : item.type === "selectYn" ? (
) : formHead.type === "selectYn" ? (
<SelectBox
label={""}
selectClass={""}
@@ -78,7 +87,7 @@ export default function MngRegFormDetail({
onSelectValue={(val: string | number) =>
field.onChange(val)
}
value={field.value}
value={field.value ?? "Y"}
/>
) : (
<Input
@@ -86,6 +95,7 @@ export default function MngRegFormDetail({
type="text"
value={field.value ?? ""}
onChange={field.onChange}
readOnly={formHead.option === "readOnly"?true:false}
/>
)}
</FormUi>
@@ -98,4 +108,3 @@ export default function MngRegFormDetail({
</>
);
}
@@ -32,7 +32,9 @@ export default function RswtrRegForm({
rswtForm: customRswtBdst;
isModal: boolean;
}) {
const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore((state) => state);
const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore(
(state) => state
);
const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({});
@@ -49,9 +51,9 @@ export default function RswtrRegForm({
const onSubmit = (values: z.infer<typeof rswtZod>) => {
if (isModal) {
rswtBdstReg(values,'41');
rswtBdstReg(values, "41");
} else {
rswtBdstUpdate(values,'41');
rswtBdstUpdate(values, "41");
}
};
const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => {
@@ -102,7 +104,9 @@ export default function RswtrRegForm({
{/* <div className="flex justify-between items-center mx-3"> */}
<div>
<div className="grid grid-cols-12 flex items-center card-header">
<h1 className="text-2xl font-medium text-label col-span-10">건축물 운영정보</h1>
<h1 className="text-2xl font-medium text-label col-span-10">
건축물 운영정보
</h1>
<Button
size={"sm"}
type="submit"
@@ -121,9 +125,7 @@ export default function RswtrRegForm({
) : (
<></>
)}
<h1 className={formH1Class}>
기본정보
</h1>
<h1 className={formH1Class}>기본정보</h1>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-2">
<FormField
@@ -209,13 +211,28 @@ export default function RswtrRegForm({
</div>
</div>
<div className=" my-4">
<h1 className={formH1Class}>
중수도 시설 정보
</h1>
<h1 className={formH1Class}>중수도 시설 정보</h1>
</div>
<div className="grid grid-cols-10 gap-1 mt-4">
<div className="col-span-5">
<div className="grid grid-cols-12 gap-1 mt-4">
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.filtrTrtmfctCpct"
render={({ field }) => (
<FormUi label="처리시설 용량">
<Input
className={selectClass}
placeholder=""
type="number"
value={field.value ?? 0}
onChange={(e)=>{field.onChange(Number(e.target.value))} }
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.orgwtKndCd"
@@ -233,7 +250,7 @@ export default function RswtrRegForm({
)}
/>
</div>
<div className="col-span-5">
<div className="col-span-4">
<FormField
control={form.control}
name="reuseBuilding.0.rswtrObj.filtrTrtmfctProcs"
@@ -241,7 +258,7 @@ export default function RswtrRegForm({
<FormUi label="주요처리공정">
<Input
className={selectClass}
placeholder="1,000,000"
placeholder=""
type=""
value={field.value ?? ""}
onChange={field.onChange}
@@ -253,9 +270,7 @@ export default function RswtrRegForm({
</div>
<div className=" my-2">
<h1 className={formH1Class}>
인센티브 정보
</h1>
<h1 className={formH1Class}>인센티브 정보</h1>
</div>
<div>
<h2 className={formH2Class}>설치비 지원</h2>
@@ -1,91 +0,0 @@
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components";
import { Button, Input } from "@common/components";
import { useState } from "react";
export function CoRegForm(form:any){
const { dmd } = useWrStore((state) => state);
return(
<>
<FormField
control={form.control}
name="ctpv"
render={({ field }) => (
<FormUi label="시도">
<SelectBox selectClass={selectClass} label={""} selectArray={dmd.selectSido} onSelectValue={field.onChange} className={""} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="sgg"
render={({ field }) => (
<FormUi label="시군구">
<SelectBox selectClass={selectClass} label={""} selectArray={dmd.selectSgg} onSelectValue={field.onChange} className={""} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="coNm"
render={({ field }) => (
<FormUi label="회사명">
<Input placeholder="" type="text" {...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="bznmNo"
render={({ field }) => (
<FormUi label="사업자번호">
<Input
placeholder="a0123456789"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="addr"
render={({ field }) => (
<FormUi label="주소">
<Input
placeholder="성북로24길 16"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="telNo"
render={({ field }) => (
<FormUi label="전화번호">
<Input
placeholder="01033332222"
type="text"
{...field} />
</FormUi>
)}
/>
</>
)
}
@@ -1,316 +0,0 @@
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components";
import { Button, Input } from "@common/components";
import { useState } from "react";
export function DmdRegForm(form: any) {
const { dmd } = useWrStore((state) => state);
const [dmdDate, setDmdDate] = useState(new Date())
const onChangeDate = (val: Date|undefined) => {
if(val)setDmdDate(val)
}
return (
<>
<FormField
control={form.control}
name="dmdSel"
render={({ field }) => (
<FormUi label="수요처명">
<Input
placeholder="수요처명 검색"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="dmdTmng"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>요구시기</FormLabel>
<DatePicker mode={"single"} field={{ value: dmdDate, onChange: onChangeDate }} selectClass={undefined} />
</FormItem>
)}
/>
<FormField
control={form.control}
name="dmdWq"
render={({ field }) => (
<FormUi label="요구수질">
<Input
placeholder="55.22"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="사용용도">
<SelectBox selectClass={selectClass} label={""} selectArray={dmd.selectUsg} onSelectValue={field.onChange} className={""} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="wntUntprc"
render={({ field }) => (
<FormUi label="희망단가">
<Input
placeholder="1000000000000000"
type="text"
{...field} />
</FormUi>
)}
/>
<div className="grid grid-cols-4">
<h1 className=" col-span-2 pl-5 text-2xl underline">
요구수질
</h1>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="grssClfg"
render={({ field }) => (
<FormUi label="총대장균군">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="tn"
render={({ field }) => (
<FormUi label="총질소">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="combResdch"
render={({ field }) => (
<FormUi label="결합잔류염소">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="tp"
render={({ field }) => (
<FormUi label="총인">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="trbt"
render={({ field }) => (
<FormUi label="탁도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="ph"
render={({ field }) => (
<FormUi label="수소이온농도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="bod"
render={({ field }) => (
<FormUi label="생물학적 산소요구량">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="clIonQnt"
render={({ field }) => (
<FormUi label="염화물">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="smll"
render={({ field }) => (
<FormUi label="냄새">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="cdtnv"
render={({ field }) => (
<FormUi label="전기전도도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="crmty"
render={({ field }) => (
<FormUi label="색도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="rmrk"
render={({ field }) => (
<FormUi label="비고">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-4">
<h1 className=" col-span-1 pl-2 text-2xl underline">
공급후보지 선택
</h1>
<div className=" col-start-3 col-span-1 ">
<Button >
후보지 조회
</Button>
</div>
<div className=" col-start-4 col-span-1 ">
<Button >
유사사례조회
</Button>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-4">
<FormField
control={form.control}
name="sply1"
render={({ field }) => (
<FormUi label="후보지_1">
<Input placeholder="후보지1" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-4">
<FormField
control={form.control}
name="sply2"
render={({ field }) => (
<FormUi label="후보지_2">
<Input placeholder="후보지2" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-4">
<FormField
control={form.control}
name="sply3"
render={({ field }) => (
<FormUi label="후보지_3">
<Input placeholder="후보지3" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-4">
<h1 className=" col-span-2 pl-2 text-2xl underline">
수요신청 비밀번호
</h1>
<div className="col-start-3 col-span-2">
<FormField
control={form.control}
name="password"
render={({ field }) => (
<FormUi label="">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
</>
);
}
@@ -8,7 +8,7 @@ import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgd
import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
import type { z } from "zod";
import React from "react";
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
const {
@@ -1,6 +1,7 @@
import { useWrStore } from "@/app/store";
import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel";
import { pbnPrfRegExcelZod } from "@/app/store/prfmncReg/pbnstPrfmncReg/headList";
import type { FcPrfType, PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
import { yearOptions } from "@/components/lib/func/commom";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import {
@@ -13,19 +14,17 @@ import {
type SelectDataType,
filePicked,
} from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { Button, Input } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import type { z } from "zod";
export default function PbnPrfExcelModal() {
const { code, prfmnc, searchFclts } = useWrStore((state) => state);
export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) {
const { prfmnRegData } = useWrStore((state) => state);
const [bscFctNmList, setBscFctNmList] = useState<SelectDataType[] | null>(null);
const [files, setFiles] = useState<File[] | null>(null);
const [excelData, setExcelData] = useState<any[]>();
const [excelData, setExcelData] = useState<PrfType[]>();
const form = useForm<z.infer<typeof pbnPrfRegExcelZod>>({
resolver: zodResolver(pbnPrfRegExcelZod),
defaultValues: {
@@ -33,28 +32,26 @@ const [excelData, setExcelData] = useState<any[]>();
},
});
const onSubmit = (values: z.infer<typeof pbnPrfRegExcelZod>) => {
console.log(values);
};
useEffect(() => {
if(prfmnc.prfmncRes.length > 0){
const basFctNmList = prfmnc.prfmncRes.map((item)=>(
{
val:item.bscFctCd,
text:item.bscFctNm
}
))
setBscFctNmList(basFctNmList)
if (excelData) {
prfmnRegData(excelData as unknown as PrfType);
}
}, [prfmnc.prfmncRes]);
};
useEffect(() => {
if (data && data.bscFctNm)
form.setValue("pbnstRuseFcltFk", data.pbnstRuseFcltPk);
form.setValue("bscFctNm", data.bscFctNm || "");
form.setValue("pbnstRuseFcltNm", data.ruseUtztnFcltNm);
}, [data]);
useEffect(()=>{
if(files){
useEffect(() => {
console.log("excelData", excelData);
}, [excelData]);
useEffect(() => {
if (files) {
const file = files[0];
if (form.getValues("ym").length < 1) {
ToastFormUi({
@@ -65,15 +62,13 @@ const [excelData, setExcelData] = useState<any[]>();
return;
}
if(file)
filePicked(file, 0).then((res) => {
if (res !== undefined)
console.log(excelToPbnPrfData(res, form.getValues("ym")))
});
if (file)
filePicked(file, 0).then((res) => {
if (res !== undefined)
setExcelData(excelToPbnPrfData(res as unknown as JSON[], form.getValues("ym"),form.getValues('pbnstRuseFcltFk') ) as PrfType[])
});
}
},[files])
}, [files]);
return (
<>
@@ -116,13 +111,11 @@ const [excelData, setExcelData] = useState<any[]>();
name="bscFctNm"
render={({ field }) => (
<FormUi label="시설명">
<SelectBox
<Input
className="w-1/4 text-3xl"
selectClass={""}
label=""
selectArray={bscFctNmList || [] }
value={field.value}
onSelectValue={(val) => field.onChange(String(val))}
onChange={field.onChange}
readOnly
/>
</FormUi>
)}
@@ -132,13 +125,11 @@ const [excelData, setExcelData] = useState<any[]>();
name="pbnstRuseFcltNm"
render={({ field }) => (
<FormUi label="재이용시설명">
<SelectBox
<Input
className="w-1/4 text-3xl"
selectClass={""}
label=""
selectArray={yearOptions}
value={field.value}
onSelectValue={(val) => field.onChange(String(val))}
onChange={field.onChange}
readOnly
/>
</FormUi>
)}
@@ -0,0 +1,60 @@
"use client";
import { useWrStore } from "@/app/store";
import { cmpttnHeadListExport } from "@/app/store/matDmd/coMatRvw/headList";
import { yearOptions } from "@/components/lib/func/commom";
import { SelectBox, UiTable } from "@common/business_components/ui";
import { Label } from "@common/components/ui";
import { useEffect, useState } from "react";
export function ConstCostFeeTable({
setReturnData,
}: {
setReturnData: (data: any) => void;
}) {
const { constCostRes,getConstCostFee } = useWrStore((state) => state);
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
useEffect(() => {
getConstCostFee(year)
}, [year,getConstCostFee]);
useEffect(() => {
const tableData = constCostRes.map((item) => {})
console.log(' constCostRes : ', constCostRes);
},[constCostRes])
return (
<>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
공사비 산정표 보기
</h3>
<hr />
<div className="flex items-center">
<Label className="text-xl text-gray-600">기준년도</Label>
<SelectBox
className="h-full text-2xl"
label=""
selectClass={"ml-4"}
selectArray={yearOptions}
value={year}
onSelectValue={(val: string | number) => setYear(String(val))}
/>
</div>
<UiTable
headName={""}
tableData={[]}
headlist={cmpttnHeadListExport}
pageSize={0}
total={0}
cellClick={() => {}}
onPageChange={() => {}}
/>
</>
);
}
@@ -0,0 +1,48 @@
"use client"
import { btnClass } from "@/app/store/common/code"
import { drgtDetailHeadListExport } from "@/app/store/matDmd/drgtSttn/headList"
import { ContentsDiv, Title, UiTable } from "@common/business_components/ui"
import ListDiv from "@common/business_components/ui/list_div"
import { Button } from "@common/components/ui"
export default function DrgtDetailModal() {
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"우리동네가뭄 상세내용"} />
<div className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={() => { }}
>
다운로드
</Button>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={[]}
headlist={drgtDetailHeadListExport}
pageSize={10}
total={10000}
cellClick={(index: number | undefined, headId: string) => { }}
onPageChange={() => { }}
></UiTable>
</ListDiv>
</div>
</div>
</div>
</div>
</div>
</ContentsDiv>
</>
)
}
@@ -0,0 +1,83 @@
"use client";
import { useWrStore } from "@/app/store";
import type { rateFeeType } from "@/app/store/common/searchCode/type";
import { coModalHeadListExport } from "@/app/store/matDmd/coMatRvw/headList";
import { yearOptions } from "@/components/lib/func/commom";
import { SelectBox, UiTable } from "@common/business_components/ui";
import { Label } from "@common/components/ui";
import { useEffect, useState } from "react";
export function RateFeeTableModal({ setReturnData}: { setReturnData: (data: any) => void }) {
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
const { rateFeeRes,getRateFee } = useWrStore((state) => state);
useEffect(() => {
getRateFee(year)
},[year,getRateFee])
useEffect(() => {
let tableData = []
const data = rateFeeRes.reduce((acc: any,cur:rateFeeType) =>{
const key = cur.stdCost;
let target = acc.find((item: any) => item.stdCost === key);
if(!target){
target={
gubun: cur.stdCost,
BD: 0,
WD: 0,
SE: 0,
CE: 0,
}
acc.push(target);
}
target[cur.incExpCd] = cur.rt;
return acc
},[])
console.log('data : ', data);
},[rateFeeRes])
return (
<>
<div className="sticky top-0 z-10 bg-white pb-4">
<h3 className="text-2xl font-medium text-label">요율표 보기</h3>
<hr />
<div className="flex items-center">
<Label className="text-xl text-gray-600">기준년도</Label>
<SelectBox
className="h-full text-2xl"
label=""
selectClass={"ml-4"}
selectArray={yearOptions}
value={year}
onSelectValue={(val: string | number) => setYear(String(val))}
/>
</div>
<UiTable
headName={""}
tableData={[]}
headlist={coModalHeadListExport}
onPageChange={() => {}}
pageSize={0}
total={0}
cellClick={undefined}
/>
</div>
</>
);
}
@@ -1,63 +0,0 @@
import { useState, useEffect } from "react";
import { useForm, FormProvider } from "react-hook-form";
import { useWrStore } from "@/app/store";
import { type customCoBdst } from "@/app/store/matDmd/coReg";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import type { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { coRegExcel } from "@/app/store/matDmd/coSttn/headList";
export default function CoRegExcel() {
const [excelData, setExcelData] = useState<customCoBdst[]>();
const [files, setFiles] = useState<File[] | null>(null);
const form = useForm<z.infer<typeof coRegExcel>>({
resolver: zodResolver(coRegExcel),
defaultValues: { file: undefined },
});
useEffect(() => {
if (!files || files.length === 0) return;
const file = files[0];
if (!file) return;
filePicked(file, 0).then((res) => {
if (res) {
}
});
}, [files]);
const onSubmit = (values: z.infer<typeof coRegExcel>) => {
if (!excelData || excelData.length === 0) {
ToastFormUi({
title: "잠재수요처 등록",
body: "빈 파일 및 파일 오류 입니다.",
});
return;
}
// rainChkExcelDataUPload(excelData);
};
return (
<FormProvider {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<Title title="잠재수요처 등록" />
<div className="flex justify-between items-center mb-4">
<h3 className="text-2xl font-bold text-gray-900">○ 잠재수요처</h3>
<Button type="submit">등록</Button>
</div>
<FormUi label="잠재수요처 파일">
<FileUpload
files={files || []}
setFiles={(files: File[] | null) => {if (files) setFiles(files);}}
fileTypes="xlsx"
></FileUpload>
</FormUi>
</form>
</FormProvider>
);
}
@@ -0,0 +1,106 @@
import { useWrStore } from "@/app/store";
import { coRegExcel } from "@/app/store/matDmd/coSttn/headList";
import type { customLdrmntBdst } from "@/app/store/matDmd/ldrmntCoSttn";
import { excelToLdrmntData, names } from "@/app/store/matDmd/ldrmntCoSttn/excel";
import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui";
import { Form, FormField } from "@common/business_components/ui/form";
import { Button, Input } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import type { z } from "zod";
export default function CoRegExcel() {
const form = useForm<z.infer<typeof coRegExcel>>({
resolver: zodResolver(coRegExcel),
});
const { ldrmntRegData } = useWrStore((state) => state);
const [excelData, setExcelData] = useState<customLdrmntBdst[]>();
const [file, setFiles] = useState<File | undefined>();
const onSubmit = (values: z.infer<typeof coRegExcel>) => {
if (file) {
filePicked(file, 0).then((res) => {
try {
console.log("res", res)
let array: { [key: string]: string | number }[] = []
if (Array.isArray(res))
res.forEach((item, index) => {
let object: { [key: string]: string | number } = {}
Object.keys(names).forEach((key) => {
if (item && names[key] !== undefined) {
if (key === "공장관리번호")
item[key] = String(item[key])
object[names[key] as string] = item[key];
}
})
array.push(object)
if (index != 0 && index % 5000 == 0) {
ldrmntRegData(array);
console.log("array", array)
array = []
array.length = 0;
// throw new Error("error")
}
})
ldrmntRegData(array);
console.log("array22", array)
} catch (e) {
console.log(e)
}
});
};
}
return (
<>
<div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div>
<Title title={"잠재수요처 등록"}></Title>
</div>
<div className="flex justify-between">
<h3 className="text-2xl font-bold text-gray-900 mt-1 ml-7">
{"잠재수요처 파일"}
</h3>
<Button className="" type="submit" size={"sm"}>
저장
</Button>
</div>
<div>
<FormField
control={form.control}
name="file"
render={({ field }) => (
<FormUi label="">
<FileUpload
files={file ? [file] : []}
setFiles={(files: File[] | null) => {
console.log("files", files)
if (files && files?.length === 1) setFiles(files[0]);
}}
fileTypes=""
maxFiles={1}
></FileUpload>
</FormUi>
)}
/>
</div>
</form>
</Form>
</div>
</>
);
}
@@ -10,7 +10,6 @@ import { useEffect, useState } from "react";
import { getCity, tableData } from "@/components/lib/func/commom";
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import { headMakeColSpan } from "@/app/ruseFcltMng/fcltReg/rainReg/TableHead";
import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm";
import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
@@ -94,7 +93,6 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
useEffect(()=>{
setbdstTable([]) // 초기화 작업
},[])
const nodeList = headMakeColSpan(bdst.moUpHeadList);
return (
<>
<div className="grid grid-cols-12 gap-4 mt-4 items-center">
@@ -135,7 +133,6 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}>
{nodeList}
</UiTable>
</div>
</ScrollArea>
@@ -1,7 +1,7 @@
"use client";
import { useWrStore } from "@/app/store";
import type { pubHasuType, fcBizType, fcOrgwtType,} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { TableUpperProps } from "@/app/store/common/type/header";
import { tableData } from "@/components/lib/func/commom";
import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable";
import { Title, UiTable } from "@common/business_components/ui";
@@ -10,7 +10,6 @@ import { Button } from "@common/business_components/ui/table/lib/button";
import { Input } from "@common/components/ui";
import { ArrowLeft, ArrowRight } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { useFieldArray } from "react-hook-form";
export default function FcOrgwtsRegModal({ onRightSet, closeModal }: { onRightSet?: (rightData:fcOrgwtType[]) => void,closeModal?:(val:boolean) =>void }) {
const { code, pbnst, getSwtrmtFcltNm, searchFclts } = useWrStore((state) => state);
@@ -22,7 +21,6 @@ export default function FcOrgwtsRegModal({ onRightSet, closeModal }: { onRightS
const [inputVal, setInputVal] = useState<string>("");
useEffect(()=>{
console.log("searchFclts", searchFclts);
if(Array.isArray(searchFclts)){
const filteredData = searchFclts.filter((item) => {
if(rightData){
@@ -1,9 +1,9 @@
"use client";
import { useWrStore } from "@/app/store";
import type {
customPbnst,
fcBizType,
pubHasuType,
import {
type customPbnst,
type PbnstRegArrrayType,
type pubHasuType,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
import { ScrollArea } from "@common/business_components";
@@ -16,43 +16,89 @@ import {
} from "@common/components/ui";
import { useEffect, useState } from "react";
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
import { useFieldArray, type UseFormReturn } from "react-hook-form";
import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
export function PbnstRegModal({ data }: { data: pubHasuType }) {
const { pbnst, pbnstInsert } = useWrStore((state) => {
export function PbnstRegModal({
data,
form,
}: {
data: pubHasuType;
form: UseFormReturn<{ items: PbnstRegArrrayType }>;
}) {
const { pbnst, pbnstInsert, pbnstMngData } = useWrStore((state) => {
return state;
});
const [pbnstBdstForm, setPbnstBdstForm] = useState<customPbnst>(
{} as customPbnst
);
const [currentTab, setCurrentTab] = useState<string>("mng");
const [indexMng, setIndexMng] = useState<number>(0);
const [indexBiz, setIndexBiz] = useState<number>(0);
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
const item = valuse.items[indexMng];
const data = item ? writeRgtrAndMdfr([item]) : [];
const pbnstRegTotal = () => {
if (pbnst.pbnstMngRegData[0]) pbnstInsert(pbnst.pbnstMngRegData[0]);
};
if(data && data[0]){
pbnstInsert(data[0])
}
};
const handleTabChange = (value: string) => {
setCurrentTab(value);
};
};
useEffect(() => {
console.log("form errors:", form.formState.errors);
}, [form.formState.errors]);
useEffect(() => {
if (data) {
let regData = {
swtrmtFcltFk: String(data.bscFctCd),
pbnstRuseFcltPk: String(data.bscFctCd + "1"),
fcBizs: [
{
pbnstRuseFcltFk: String(data.bscFctCd + "1"),
cycl: 1,
} as unknown as fcBizType,
],
};
const firstForm = form.getValues("items");
setPbnstBdstForm(regData as unknown as customPbnst);
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);
}
}, [data]);
}, [data, form]);
useEffect(() => {}, [pbnstBdstForm]);
useEffect(() => {}, [pbnst.pbnstMngRegData]);
return (
<>
<h1 className="text-2xl font-medium text-label pl-8">
@@ -70,7 +116,7 @@ export function PbnstRegModal({ data }: { data: pubHasuType }) {
차수별정보
</TabsTrigger>
<Button
onClick={pbnstRegTotal}
onClick={ form.handleSubmit(onSubmit)}
size={"sm"}
className="!justify-end"
>
@@ -78,10 +124,23 @@ export function PbnstRegModal({ data }: { data: pubHasuType }) {
</Button>
</TabsList>
<TabsContent className="max-h-full" value="mng">
<PbnstMngForm formType={"reg"} firstFcltData={pbnstBdstForm} />
<PbnstMngForm
form={form}
formType={"reg"}
firstFcltData={pbnstBdstForm}
indexMng={indexMng}
setIndexMng={setIndexMng}
/>
</TabsContent>
<TabsContent className="max-h-full" value="buse">
<PbnstBuseForm formType={"reg"} firstBizData={pbnstBdstForm.fcBizs} />
<PbnstBuseForm
form={form}
indexMng={indexMng}
indexBiz={indexBiz}
setIndexBiz={setIndexBiz}
formType={"reg"}
firstBizData={pbnstBdstForm.fcBizs}
/>
</TabsContent>
</Tabs>
</ScrollArea>

Some files were not shown because too many files have changed in this diff Show More