결함대장 수정중
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
DmdCoReqSchema,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
} from "@/app/store/matDmd/coMatRvw/type";
|
||||
import { formH1Class, formTableName } from "@/components/lib/class/comClass";
|
||||
import {
|
||||
formatPhoneNumber,
|
||||
getCity,
|
||||
getdmdMatFlag,
|
||||
tableData,
|
||||
@@ -112,18 +112,20 @@ export default function CoMatRvw() {
|
||||
}, [form.watch("useUsgCd")]);
|
||||
|
||||
useEffect(() => {
|
||||
if (coMatRvwRes.length > 0) {
|
||||
if (coMatRvwRes&&coMatRvwRes.length > 0) {
|
||||
const data = coMatRvwRes?.map((item, index) => {
|
||||
let flag = "";
|
||||
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??"");
|
||||
|
||||
flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg||undefined);
|
||||
|
||||
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"),
|
||||
telno: formatPhoneNumber(item.demandCo?.telno||'') ,
|
||||
|
||||
splyFcltFlg: flag,
|
||||
};
|
||||
});
|
||||
@@ -181,7 +183,7 @@ export default function CoMatRvw() {
|
||||
<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"
|
||||
@@ -269,7 +271,7 @@ export default function CoMatRvw() {
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
<hr />
|
||||
<ScrollArea className="h-[49vh]">
|
||||
{/* <ScrollArea className="h-[49vh]"> */}
|
||||
<ListDiv>
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
수요신청 상세현황
|
||||
@@ -662,7 +664,7 @@ export default function CoMatRvw() {
|
||||
</Form>
|
||||
<ConCostForm form={form} type={"mat"} />
|
||||
</ListDiv>
|
||||
</ScrollArea>
|
||||
{/* </ScrollArea> */}
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -26,6 +26,7 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import SdmInsertForm from "@common/business_components/ui/sdmInsertForm";
|
||||
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||
import { Button } from "@common/components/ui";
|
||||
import moment from "moment";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
|
||||
@@ -83,6 +84,10 @@ export default function CoSttn() {
|
||||
const data = tableData(coSttnRes, { code });
|
||||
const chData = data.map((item: any) => ({
|
||||
...item,
|
||||
regDt: moment(item.regDt).format("YYYY-MM-DD")
|
||||
|
||||
|
||||
|
||||
}));
|
||||
// .filter((item: any) => item !== undefined);
|
||||
setBdstTable(chData);
|
||||
@@ -182,7 +187,7 @@ export default function CoSttn() {
|
||||
onClick={() => {
|
||||
/* 저장 로직 */
|
||||
if (!upadateData) {
|
||||
<ToastFormUi body={"수요처 변경을 원하는 행을 선택해주세요"} title={"수요처관리"}></ToastFormUi>;
|
||||
toast.error("수요처 변경을 원하는 행을 선택해주세요")
|
||||
}else{
|
||||
setIsDmdModal({
|
||||
...isDmdModal,
|
||||
@@ -190,7 +195,7 @@ export default function CoSttn() {
|
||||
}
|
||||
}}
|
||||
>
|
||||
저장
|
||||
수정
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type {
|
||||
rswtChkZodType,
|
||||
rswtrChkDetailsZodType,
|
||||
import {
|
||||
commonCd,
|
||||
rainPageSize,
|
||||
type rainChkZodType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import {
|
||||
rswtPageSize,
|
||||
type rswtrChkDetailsZodType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import {
|
||||
excelArrayDownload,
|
||||
@@ -15,6 +19,7 @@ import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel";
|
||||
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
||||
import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable";
|
||||
import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable";
|
||||
import { SearchInput } from "@common/business_components";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchDiv,
|
||||
@@ -25,9 +30,16 @@ import {
|
||||
UiModal,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@common/components/ui/tooltip";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
|
||||
export default function Page() {
|
||||
const {
|
||||
@@ -39,8 +51,10 @@ export default function Page() {
|
||||
rainChkDelete,
|
||||
rainChkExcelDownload,
|
||||
rainChkHeadChange,
|
||||
rainChkNmSearch,
|
||||
isRainSttn,
|
||||
rswtChkgdnInit,
|
||||
rswtChkNmSearch,
|
||||
rswtChkPolInit,
|
||||
rswtChkDetilsUpdate,
|
||||
rswtChkDelete,
|
||||
@@ -57,39 +71,84 @@ export default function Page() {
|
||||
rswtrChkDetailsZodType[]
|
||||
>([]);
|
||||
const [deleteIdx, setDeleteIdx] = useState<number[]>([]);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [rainPageNation, setRainPageNation] = useState(1);
|
||||
const [rswtPageNation, setRswtPageNation] = useState(1);
|
||||
const [fcltNm, setFcltNm] = useState<string>("");
|
||||
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
|
||||
const [isModal, setIsModal] = useState({
|
||||
open: false,
|
||||
data: {},
|
||||
});
|
||||
const cellClick = () => {
|
||||
if (searchYear)
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkInit("1", "20", searchYear, "0");
|
||||
} else {
|
||||
rswtChkgdnInit("1", "20", searchYear, "0");
|
||||
}
|
||||
};
|
||||
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
);
|
||||
const cellClick = () => {
|
||||
if (searchYear)
|
||||
if (selFcltDiv === "RNB") {
|
||||
if (fcltNm) {
|
||||
rainChkNmSearch(
|
||||
rainPageNation,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rainChkInit(rainPageNation, rainPageSize, searchYear, commonCd);
|
||||
}
|
||||
} else {
|
||||
if (fcltNm) {
|
||||
rswtChkNmSearch(
|
||||
rainPageNation,
|
||||
rainPageSize,
|
||||
searchYear,
|
||||
commonCd,
|
||||
fcltNm
|
||||
);
|
||||
} else {
|
||||
rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd);
|
||||
}
|
||||
}
|
||||
};
|
||||
const rainPageChange = (pageNo: number) => {
|
||||
if (pageNo > 0) {
|
||||
setRainPageNation(pageNo);
|
||||
rainChkInit(pageNo, rainPageSize, searchYear, commonCd);
|
||||
}
|
||||
};
|
||||
const rswtPageChange = (pageNo: number) => {
|
||||
if (pageNo > 0) {
|
||||
setRswtPageNation(pageNo);
|
||||
rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainChkgdn.isInit) {
|
||||
rainChkInit("1", "20", new Date().getFullYear().toString(), "0");
|
||||
rainChkInit(
|
||||
1,
|
||||
rainPageSize,
|
||||
new Date().getFullYear().toString(),
|
||||
commonCd
|
||||
);
|
||||
isRainSttn(false);
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
}, [rainChkgdn.isInit, rainChkInit, rainPageSize]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswtChkgdn.isInit) {
|
||||
rswtChkgdnInit("1", "20", new Date().getFullYear().toString(), "0");
|
||||
rswtChkgdnInit(
|
||||
1,
|
||||
rswtPageSize,
|
||||
new Date().getFullYear().toString(),
|
||||
commonCd
|
||||
);
|
||||
setIsModal({ data: {}, open: false });
|
||||
setIsRegExcel(false);
|
||||
}
|
||||
}, [rainChkgdn.isInit, rainChkInit]);
|
||||
}, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize]);
|
||||
|
||||
useEffect(() => {
|
||||
if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) {
|
||||
@@ -133,8 +192,8 @@ export default function Page() {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
//rainChkgdn.isSttn = false;
|
||||
//rswtChkgdn.isSttn = false;
|
||||
rainChkgdn.isSttn = false;
|
||||
rswtChkgdn.isSttn = false;
|
||||
if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) {
|
||||
rainChkHeadChange({ rainChkgdn }, true);
|
||||
rswtChkHeadChange({ rswtChkgdn }, true);
|
||||
@@ -152,9 +211,17 @@ export default function Page() {
|
||||
};
|
||||
const chkUpdateTable = (selFcltDiv: string) => {
|
||||
if (selFcltDiv === "RNB") {
|
||||
rainChkDetilUpdate(updateRainDetail);
|
||||
if (updateRainDetail && updateRainDetail.length > 0) {
|
||||
rainChkDetilUpdate(updateRainDetail);
|
||||
} else {
|
||||
toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
|
||||
}
|
||||
} else {
|
||||
rswtChkDetilsUpdate(updateRswtDetail);
|
||||
if (updateRswtDetail && updateRswtDetail.length > 0) {
|
||||
rswtChkDetilsUpdate(updateRswtDetail);
|
||||
} else {
|
||||
toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 ");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -176,10 +243,8 @@ export default function Page() {
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) => {
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
|
||||
}
|
||||
setSearchYear(String(val));
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2 flex flex-row space-x-2">
|
||||
@@ -193,12 +258,22 @@ export default function Page() {
|
||||
selectArray={rainChkgdn.fcltDiv}
|
||||
onSelectValue={(val: string | number) => {
|
||||
if (val === "RST") rswtChkPolInit();
|
||||
setSelFcltDiv(String(val))
|
||||
}
|
||||
}
|
||||
setSelFcltDiv(String(val));
|
||||
}}
|
||||
value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2 flex flex-row space-x-2">
|
||||
<Label className="w-28 mt-2 text-xl text-gray-600">
|
||||
{"시설명"}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={"w-full h-full text-2xl"}
|
||||
label={""}
|
||||
textValue={fcltNm || ""}
|
||||
setText={setFcltNm}
|
||||
/>
|
||||
</div>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||
<div className="space-y">
|
||||
@@ -219,14 +294,28 @@ export default function Page() {
|
||||
>
|
||||
삭제
|
||||
</Button>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
chkUpdateTable(selFcltDiv);
|
||||
}}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
chkUpdateTable(selFcltDiv);
|
||||
}}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom" sideOffset={5}>
|
||||
<h2 className="text-xl">
|
||||
아래 테이블에 선택을 체크하면 입력셀이 활성화 됩니다.
|
||||
</h2>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
|
||||
<Button
|
||||
size={"sm"}
|
||||
onClick={() => {
|
||||
@@ -253,8 +342,8 @@ export default function Page() {
|
||||
detailUp={setUpdateRainDetail}
|
||||
handleClick={handleClick}
|
||||
rainChkData={rainChkgdn.rainChk}
|
||||
pageNation={pageNation}
|
||||
onPageChange={setPageNation}
|
||||
pageNation={rainPageNation}
|
||||
onPageChange={rainPageChange}
|
||||
/>
|
||||
) : (
|
||||
<RswtChkgdTable
|
||||
@@ -262,8 +351,8 @@ export default function Page() {
|
||||
deleteRswtData={setDeleteIdx}
|
||||
handleRswtClick={handleClick}
|
||||
rswtChkData={rswtChkgdn.rswtChkRes}
|
||||
pageNation={pageNation}
|
||||
onPageChange={setPageNation}
|
||||
pageNation={rswtPageNation}
|
||||
onPageChange={rswtPageChange}
|
||||
/>
|
||||
)}
|
||||
</ListDiv>
|
||||
@@ -271,17 +360,28 @@ export default function Page() {
|
||||
</div>
|
||||
<UiModal
|
||||
open={isModal.open}
|
||||
onOpenChange={() => {
|
||||
setIsModal({ open: !open, data: {} });
|
||||
onOpenChange={(open: boolean) => {
|
||||
setIsModal((prev) => ({ ...prev, open }));
|
||||
}}
|
||||
bodyClass={"w-[80vw] max-w-none"}
|
||||
body={<ChkgdModal type={selFcltDiv} obj={isModal.data} />}
|
||||
body={
|
||||
<ChkgdModal
|
||||
type={selFcltDiv}
|
||||
obj={isModal.data}
|
||||
setIsModal={(open) => setIsModal((prev) => ({ ...prev, open }))}
|
||||
/>
|
||||
}
|
||||
></UiModal>
|
||||
<UiModal
|
||||
open={isRegExcel}
|
||||
onOpenChange={setIsRegExcel}
|
||||
bodyClass={"w-[30vw] max-w-none"}
|
||||
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
|
||||
body={
|
||||
<ChkgdExcel
|
||||
type={selFcltDiv}
|
||||
setIsRegExcel={setIsRegExcel}
|
||||
></ChkgdExcel>
|
||||
}
|
||||
/>
|
||||
<Toaster position="top-center" />
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -29,12 +29,12 @@ export const coRvwHeadListExport: CommonTableProps[]= [
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "regDt", //바꾸기
|
||||
id: "dmndTmng", //바꾸기
|
||||
title: "신청일자",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "state", //바꾸기
|
||||
id: "splyFcltFlg", //바꾸기
|
||||
title: "진행상태",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
@@ -103,12 +103,18 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
|
||||
data
|
||||
);
|
||||
|
||||
if(isUpdate){
|
||||
toast.error("수요 매칭 검토 검토로 저장되었습니다.");
|
||||
}
|
||||
|
||||
const coMatRvwRes = coMatInit(
|
||||
1,
|
||||
10,
|
||||
new Date().getFullYear().toString(),
|
||||
new Date().getFullYear().toString(),
|
||||
);
|
||||
|
||||
|
||||
return set((state: coRvwState) => ({
|
||||
...state,
|
||||
coRvw: {
|
||||
|
||||
@@ -53,7 +53,7 @@ import { z } from "zod";
|
||||
rgtr: z.string().nullish(),
|
||||
mdfcnDt: z.coerce.date().nullish(),
|
||||
mdfr: z.string().nullish(),
|
||||
dmdAplyPswd: z.string(),
|
||||
dmdAplyPswd: z.string().nullish(),
|
||||
demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임
|
||||
demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish()// 안쓰는 거임
|
||||
});
|
||||
|
||||
@@ -44,6 +44,11 @@ export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
title: "전화번호",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "regDt",
|
||||
title: "등록일자",
|
||||
visible: true,
|
||||
},
|
||||
];
|
||||
|
||||
export const coSttNodeListExport: CommonTableProps[] = [
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
|
||||
import { coSttHeadListExport, coSttNodeListExport } from "./headList";
|
||||
import { excelCoSttnParsing } from "./excel";
|
||||
import type { DemandCompType } from "@common/business_components/ui";
|
||||
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||
|
||||
// 테이블 헤드 리스트
|
||||
const coSttNodeList = coSttNodeListExport;
|
||||
|
||||
@@ -124,9 +124,9 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
trbt: Number(item["탁도"] || 0),
|
||||
grssClfg: Number(item["총대장균군수"] || 0),
|
||||
etc: item["기타"] || "", // 필드 누락 방지
|
||||
vltnDt: vltnDt || "-",
|
||||
vltnMttr: item["위반사항"] || "-",
|
||||
levyAmt: Number(item["과태료부과금액(천원)"] || 0),
|
||||
vltnDt: vltnDt || null,
|
||||
vltnMttr: item["위반사항"] || "",
|
||||
levyAmt: Number(item["과태료부과금액(천원)"] || null),
|
||||
rgtr: TEST_UUID,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -114,10 +114,22 @@ export type splRuseWaterType = {
|
||||
ruse12: number;
|
||||
};
|
||||
|
||||
export const rainHeadNmExport: chHeadType[] = [
|
||||
export const rainMainHeadNmExport: chHeadType[] = [
|
||||
{ headNm: "useQuilty", text: "이용수질(필요시)", length: 3 },
|
||||
{ headNm: "feeHist", text: "과태료 부과내역", length: 3 },
|
||||
];
|
||||
|
||||
export const rainRuseHeadNmExport: chHeadType[] = [
|
||||
{ headNm: "useQuilty", text: "이용수질(필요시)", length: 3 },
|
||||
{ headNm: "feeHist", text: "과태료 부과내역", length: 3 },
|
||||
{ headNm: "ruseWater", text: "연간대체수 이용량(m³)", length: 13 },
|
||||
{ headNm: "detailQulity", text: "분기", length: 11 },
|
||||
];
|
||||
|
||||
|
||||
export const rainSplHeadNmExport: chHeadType[] = [
|
||||
{ headNm: "useQuilty", text: "이용수질(필요시)", length: 3 },
|
||||
{ headNm: "feeHist", text: "과태료 부과내역", length: 3 },
|
||||
{ headNm: "ruseWater", text: "연간보급수 이용량(m³)", length: 13 },
|
||||
{ headNm: "detailQulity", text: "분기", length: 11 },
|
||||
{ headNm: "splWater", text: "연간빗물 이용량(m³)", length: 13 },
|
||||
];
|
||||
|
||||
@@ -3,18 +3,20 @@ import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
deleteFectch,
|
||||
fetchType,
|
||||
getCountFetch,
|
||||
getFetch,
|
||||
postFectch,
|
||||
putFectch,
|
||||
} from "@/components/lib/api";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import { z } from "zod";
|
||||
import { buildingToExcelType } from "./excel";
|
||||
import {
|
||||
rainChkgdnHeadListExport,
|
||||
rainChkZod,
|
||||
rainHeadNmExport,
|
||||
rainMainHeadNmExport,
|
||||
rainRuseHeadNmExport,
|
||||
rainSplHeadNmExport,
|
||||
ruseHeadListExport,
|
||||
splHeadListExport,
|
||||
type chHeadType,
|
||||
@@ -22,38 +24,47 @@ import {
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export const rainPageSize = 10;
|
||||
export const commonCd = "41";
|
||||
|
||||
export type rainChkZodType = z.infer<typeof rainChkZod>;
|
||||
const fcltDiv = [
|
||||
{ val: "RST", text: "중수도시설" },
|
||||
{ val: "RNB", text: "빗물이용시설" },
|
||||
];
|
||||
|
||||
const rainHeadNm = rainHeadNmExport;
|
||||
const rainRuseHeadNm = rainRuseHeadNmExport;
|
||||
const rainSplHeadNm = rainSplHeadNmExport;
|
||||
const rainChkgdnHeadList = rainChkgdnHeadListExport;
|
||||
const ruseHeadList = ruseHeadListExport;
|
||||
const splHeadList = splHeadListExport;
|
||||
const rainMainHeadNm = rainMainHeadNmExport
|
||||
|
||||
const rainChk: rainChkZodType[] = [];
|
||||
|
||||
export type rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList: TableUpperProps[];
|
||||
rainSplHeadNm:chHeadType[]
|
||||
rainRuseHeadNm:chHeadType[]
|
||||
rainChk: rainChkZodType[];
|
||||
rainHeadNm: chHeadType[];
|
||||
ruseHeadList: TableUpperProps[];
|
||||
splHeadList: TableUpperProps[];
|
||||
isInit: boolean;
|
||||
isModalClose: boolean;
|
||||
fcltDiv: SelectDataType[];
|
||||
rainMainHeadNm:chHeadType[]
|
||||
excelList: [];
|
||||
isSttn: boolean;
|
||||
rainChkCount: number;
|
||||
isLoading: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
type rainChkgdnActions = {
|
||||
rainChkInit: (
|
||||
pageNo: string,
|
||||
cnt: string,
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
sggCd: string,
|
||||
searchTxt: string
|
||||
) => void;
|
||||
@@ -66,6 +77,13 @@ type rainChkgdnActions = {
|
||||
rainChkExcelDataUPload(excelData: rainChkZodType[]): Promise<void>;
|
||||
rainChkDelete(chkgdnPks: number[]): Promise<void>;
|
||||
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void;
|
||||
rainChkNmSearch: (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string,
|
||||
txt: string
|
||||
) => void;
|
||||
};
|
||||
|
||||
export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
|
||||
@@ -73,7 +91,9 @@ export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
|
||||
export const rainChkgdnStateExport: rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList: rainChkgdnHeadList,
|
||||
rainHeadNm: rainHeadNm,
|
||||
rainRuseHeadNm: rainRuseHeadNm,
|
||||
rainSplHeadNm:rainSplHeadNm,
|
||||
rainMainHeadNm:rainMainHeadNm,
|
||||
rainChk: rainChk,
|
||||
splHeadList: splHeadList,
|
||||
ruseHeadList: ruseHeadList,
|
||||
@@ -82,6 +102,8 @@ export const rainChkgdnStateExport: rainChkgdnState = {
|
||||
excelList: [],
|
||||
fcltDiv: fcltDiv,
|
||||
isSttn: false,
|
||||
rainChkCount: 1,
|
||||
isLoading: false,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -103,20 +125,24 @@ const makeMdfrChk = (data: rainChkZodType[], type: string, toDo: string) => {
|
||||
};
|
||||
|
||||
const initFetch = async (
|
||||
pageNo: string,
|
||||
cnt: string,
|
||||
txt: string | undefined,
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string | undefined,
|
||||
sgg: string | undefined
|
||||
) => {
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainRes = await getFetch(
|
||||
|
||||
console.log("cnt ", cnt);
|
||||
const rainRes = await getCountFetch(
|
||||
"wr",
|
||||
`/reuseChk/rainy` +
|
||||
(pageNo ? `/${pageNo}` : "/1") +
|
||||
(cnt ? `/${cnt}` : "/20") +
|
||||
(txt ? `/${txt}` : `/${currentYear}`) +
|
||||
(cnt ? `/${cnt}` : "/10") +
|
||||
(year ? `/${year}` : `/${currentYear}`) +
|
||||
(sgg ? `/${sgg}` : "/0")
|
||||
);
|
||||
|
||||
console.log(" rainRes ", rainRes);
|
||||
return rainRes;
|
||||
};
|
||||
|
||||
@@ -142,16 +168,24 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
}));
|
||||
},
|
||||
rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => {
|
||||
set((state: rainChkgdnType) => (
|
||||
{ rainChkgdn: { ...state.rainChkgdn, isLoading: true } }));
|
||||
try {
|
||||
const res = await postFectch("/reuseChk/rainy", excelData);
|
||||
if (res.status === 200) {
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch("1", "20", currentYear, "0");
|
||||
return set((state: rainChkgdnState) => ({
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
commonCd
|
||||
);
|
||||
set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChk: rainChkRes,
|
||||
rainChk: rainChkRes.data,
|
||||
rainChkCount: rainChkRes.count,
|
||||
},
|
||||
}));
|
||||
toast.success("지도점검 등록이 완료되었습니다.");
|
||||
@@ -161,22 +195,62 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
toast.error("지도점검 등록이 실패되었습니다.");
|
||||
} finally {
|
||||
set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } }));
|
||||
}
|
||||
},
|
||||
rainChkInit: async (
|
||||
pageNo: string,
|
||||
cnt: string,
|
||||
searchTxt: string,
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string
|
||||
) => {
|
||||
set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } }));
|
||||
try {
|
||||
const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd);
|
||||
|
||||
const rainChkRes = await initFetch(pageNo, cnt, year, sggCd);
|
||||
set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChk: rainChkRes.data,
|
||||
rainChkCount: rainChkRes.count,
|
||||
isInit: true, // 무한 루프 방지를 위해 isInit을 true로 설정
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
// 에러가 발생하더라도 무한 루프에 빠지지 않도록 isInit을 true로 설정합니다.
|
||||
set((state: rainChkgdnType) => ({
|
||||
rainChkgdn: { ...state.rainChkgdn, isInit: true },
|
||||
}));
|
||||
} finally {
|
||||
set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } }));
|
||||
}
|
||||
},
|
||||
rainChkNmSearch: async (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string,
|
||||
txt: string
|
||||
) => {
|
||||
try {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const rainChkRes = await getCountFetch(
|
||||
"wr",
|
||||
`/reuseChk/rainy` +
|
||||
(pageNo ? `/${pageNo}` : "/1") +
|
||||
(cnt ? `/${cnt}` : "/10") +
|
||||
(year ? `/${year}` : `/${currentYear}`) +
|
||||
(sggCd ? `/${sggCd}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChk: rainChkRes,
|
||||
rainChk: rainChkRes.data,
|
||||
rainChkCount: rainChkRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
@@ -187,26 +261,32 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
try {
|
||||
const chData = await makeMdfrChk(rainChk, "rain", "rainDetil");
|
||||
|
||||
const res = await postFectch("/reuseChk/rainy", chData);
|
||||
if (res.staus === 200) {
|
||||
const res = await putFectch("/reuseChk/rainy/list", chData);
|
||||
if (res) {
|
||||
toast.success(
|
||||
"지도점검 보급수 및 밋물이용량 수정이 완료되었습니다. "
|
||||
"지도점검 대체수 및 밋물이용량 수정이 완료되었습니다. "
|
||||
);
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch("1", "20", currentYear, "11");
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
"41"
|
||||
);
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChk: rainChkRes,
|
||||
rainChk: rainChkRes.data,
|
||||
rainChkCount: rainChkRes.count,
|
||||
},
|
||||
}));
|
||||
} else {
|
||||
toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다.");
|
||||
toast.error("지도점검 대체수 및 밋물이용량 수정 오류입니다.");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다.");
|
||||
toast.error("지도점검 대체수 및 밋물이용량 수정 오류입니다.");
|
||||
}
|
||||
},
|
||||
rainChkGuidUpdate: async (rainChk: rainChkZodType) => {
|
||||
@@ -217,17 +297,22 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
toast.success("지도점검 수질 및 과태료 수정이 완료되었습니다. ");
|
||||
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch("1", "20", currentYear, "11");
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
"41"
|
||||
);
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChk: rainChkRes,
|
||||
rainChk: rainChkRes.data,
|
||||
rainChkCount: rainChkRes.count,
|
||||
},
|
||||
}));
|
||||
}else{
|
||||
} else {
|
||||
toast.error("지도점검 수질 및 과태료 수정 오류입니다.");
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error("지도점검 수질 및 과태료 수정 오류입니다.");
|
||||
@@ -241,17 +326,22 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
toast.success("삭제가 완료되었습니다. ");
|
||||
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rainChkRes = await initFetch("1", "20", currentYear, "11");
|
||||
const rainChkRes = await initFetch(
|
||||
1,
|
||||
rainPageSize,
|
||||
currentYear,
|
||||
"41"
|
||||
);
|
||||
return set((state: rainChkgdnState) => ({
|
||||
...state,
|
||||
rainChkgdn: {
|
||||
...state.rainChkgdn,
|
||||
rainChk: rainChkRes,
|
||||
rainChk: rainChkRes.data,
|
||||
rainChkCount: rainChkRes.count,
|
||||
},
|
||||
}));
|
||||
}else{
|
||||
} else {
|
||||
toast.error("삭제시 오류가 발생하였습니다.. ");
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error("삭제시 오류가 발생하였습니다.. ");
|
||||
|
||||
@@ -109,6 +109,24 @@ export const rswtChkgdZod = z.object({
|
||||
rswtrPollutions: z.array(rswtrPolutionsZode),
|
||||
});
|
||||
|
||||
|
||||
|
||||
export const rswtRuseHeadNmExport: chHeadType[] = [
|
||||
{ headNm: "useQuilty", text: "이용수질(필요시)", length: 3 },
|
||||
{ headNm: "feeHist", text: "과태료 부과내역", length: 3 },
|
||||
{ headNm: "ruseWater", text: "연간중수 이용량(m³)", length: 13 },
|
||||
{ headNm: "detailQulity", text: "분기", length: 11 },
|
||||
];
|
||||
|
||||
export const rswtSplHeadNmExport: chHeadType[] = [
|
||||
{ headNm: "useQuilty", text: "이용수질(필요시)", length: 3 },
|
||||
{ headNm: "feeHist", text: "과태료 부과내역", length: 3 },
|
||||
{ headNm: "detailQulity", text: "분기", length: 11 },
|
||||
{ headNm: "splWater", text: "연간대체수 이용량(m³)", length: 13 },
|
||||
];
|
||||
|
||||
|
||||
|
||||
export const rswtHeadNmExport: chHeadType[] = [
|
||||
{ headNm: "useQuilty", text: "연간 평균 이용수질", length: 10 },
|
||||
{ headNm: "feeHist", text: "과태료 부과내역", length: 3 },
|
||||
@@ -126,7 +144,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
|
||||
{ id: "spwtPositn", title: "채수지점" ,mergeCell: true},
|
||||
{ id: "chckYmd", title: "점검일" ,mergeCell: true},
|
||||
{ id: "utztnUsgCd", title: "이용용도" },
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" ,type: "number"},
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)" ,type: "number"},
|
||||
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)",type: "number"},
|
||||
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
TEST_UUID,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type {
|
||||
SelectDataType,
|
||||
SheetParameter,
|
||||
@@ -8,6 +6,7 @@ import type {
|
||||
import {
|
||||
deleteFectch,
|
||||
fetchType,
|
||||
getCountFetch,
|
||||
getFetch,
|
||||
postFectch,
|
||||
putFectch,
|
||||
@@ -20,15 +19,24 @@ import {
|
||||
rswtDetailHeadListExport,
|
||||
rswtHeadNmExport,
|
||||
rswtrDetailsZod,
|
||||
rswtRuseHeadNmExport,
|
||||
rswtSplHeadNmExport,
|
||||
} from "./headList";
|
||||
import { z } from "zod";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import { type chHeadType } from "../rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export const rswtPageSize = 10;
|
||||
|
||||
const rswtChkHeadList = rswtChkHeadListExport;
|
||||
const rswtDetailHeadList = rswtDetailHeadListExport;
|
||||
const rswtHeadNm = rswtHeadNmExport;
|
||||
const rswtRuseHeadNm =rswtRuseHeadNmExport
|
||||
const rswtSplHeadNm =rswtSplHeadNmExport
|
||||
|
||||
|
||||
export type rswtChkZodType = z.infer<typeof rswtChkgdZod>;
|
||||
export type rswtrChkDetailsZodType = z.infer<typeof rswtrDetailsZod>;
|
||||
export type rswtChkgdnState = {
|
||||
@@ -40,13 +48,29 @@ export type rswtChkgdnState = {
|
||||
excelList: SheetParameter[];
|
||||
rswtChkRes: rswtChkZodType[];
|
||||
rswtChkPolGuide: rswtChkZodType[];
|
||||
rswtSplHeadNm:chHeadType[]
|
||||
rswtRuseHeadNm:chHeadType[]
|
||||
isInit: boolean;
|
||||
isSttn: boolean
|
||||
isSttn: boolean;
|
||||
isLoading:boolean;
|
||||
rswtChkCount: number;
|
||||
};
|
||||
};
|
||||
|
||||
type rswtChkgdnActions = {
|
||||
rswtChkgdnInit: (pageNo: string, cnt: string, year: string, sggCd: string) => void;
|
||||
rswtChkgdnInit: (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string
|
||||
) => void;
|
||||
rswtChkNmSearch: (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string,
|
||||
txt: string
|
||||
) => void;
|
||||
rswtrChkExcelDownload(
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
@@ -67,27 +91,41 @@ export const rswtChkgdnStateExport: rswtChkgdnState = {
|
||||
rswtChkHeadList: rswtChkHeadList,
|
||||
rswtDetailHeadList: rswtDetailHeadList,
|
||||
rswtHeadNm: rswtHeadNm,
|
||||
excelList: [{
|
||||
data: [[]], headerNum: 0, headerRange: "A1:V3",
|
||||
sheetName: "",
|
||||
startCol: '1'
|
||||
}],
|
||||
rswtRuseHeadNm:rswtRuseHeadNm,
|
||||
rswtSplHeadNm:rswtSplHeadNm,
|
||||
|
||||
excelList: [
|
||||
{
|
||||
data: [[]],
|
||||
headerNum: 0,
|
||||
headerRange: "A1:V3",
|
||||
sheetName: "",
|
||||
startCol: "1",
|
||||
},
|
||||
],
|
||||
rswtChkRes: [],
|
||||
rswtChkPolGuide: [],
|
||||
isInit: false,
|
||||
isSttn: false,
|
||||
isLoading:false,
|
||||
rswtChkCount: 1,
|
||||
},
|
||||
};
|
||||
|
||||
const initFetch = async (pageNo: string, cnt: string, year: string | undefined, sgg: string | undefined) => {
|
||||
const initFetch = async (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string | undefined,
|
||||
sgg: string | undefined
|
||||
) => {
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await getFetch(
|
||||
const rswtChkRes = await getCountFetch(
|
||||
"wr",
|
||||
`/reuseChk/reuseWater` +
|
||||
(pageNo ? `/${pageNo}` : "/1") +
|
||||
(cnt ? `/${cnt}` : "/20") +
|
||||
(year ? `/${year}` : `/${currentYear}`) +
|
||||
(sgg ? `/${sgg}` : "/0")
|
||||
(pageNo ? `/${pageNo}` : "/1") +
|
||||
(cnt ? `/${cnt}` : "/20") +
|
||||
(year ? `/${year}` : `/${currentYear}`) +
|
||||
(sgg ? `/${sgg}` : "/0")
|
||||
);
|
||||
return rswtChkRes;
|
||||
};
|
||||
@@ -139,15 +177,59 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
},
|
||||
}));
|
||||
},
|
||||
rswtChkgdnInit: async (pageNo: string, cnt: string, year: string, sggCd: string) => {
|
||||
rswtChkgdnInit: async (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string
|
||||
) => {
|
||||
set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } }));
|
||||
try {
|
||||
const rswtChkRes = await initFetch(pageNo, cnt, year, sggCd);
|
||||
|
||||
set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
isInit: true, // 무한 루프를 방지하기 위해 isInit을 true로 설정
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
set((state: rswtChkgdnType) => ({
|
||||
rswtChkgdn: { ...state.rswtChkgdn, isInit: true },
|
||||
}));
|
||||
} finally {
|
||||
set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } }));
|
||||
}
|
||||
},
|
||||
rswtChkNmSearch: async (
|
||||
pageNo: number,
|
||||
cnt: number,
|
||||
year: string,
|
||||
sggCd: string,
|
||||
txt: string
|
||||
) => {
|
||||
try {
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await getCountFetch(
|
||||
"wr",
|
||||
`/reuseChk/reuseWater` +
|
||||
(pageNo ? `/${pageNo}` : "/1") +
|
||||
(cnt ? `/${cnt}` : "/20") +
|
||||
(year ? `/${year}` : `/${currentYear}`) +
|
||||
(sggCd ? `/${sggCd}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes,
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -157,6 +239,9 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
},
|
||||
rswtChkExceDataUpload: async (excelData: rswtChkZodType[]) => {
|
||||
try {
|
||||
set((state: rswtChkgdnType) => (
|
||||
{ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } }));
|
||||
console.log('excelData ', excelData)
|
||||
const res = await postFectch("/reuseChk/reuseWater", excelData);
|
||||
if (res.ok) {
|
||||
ToastFormUi({
|
||||
@@ -165,65 +250,66 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
});
|
||||
}
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch("1", "20", currentYear, "0");
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}finally{
|
||||
set((state: rswtChkgdnType) => (
|
||||
{ rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } }));
|
||||
}
|
||||
|
||||
},
|
||||
rswtChkDetilsUpdate: async (rswtChk: rswtrChkDetailsZodType[]) => {
|
||||
try {
|
||||
const chData = await makeMdfrChk(rswtChk);
|
||||
|
||||
|
||||
const res = await putFectch("/reuseChk/reuseWater", chData);
|
||||
if (res.ok) {
|
||||
ToastFormUi({
|
||||
body: "지도점검 과태료 수정 수정이 완료되었습니다. ",
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
toast.success("지도점검 과태료 수정이 완료되었습니다. ",)
|
||||
}
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch("1", "20", currentYear, "0");
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes,
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
alert("수정에 실패하였습니다.");
|
||||
toast.error("지도점검 과태료 수정 오류입니다. ",)
|
||||
|
||||
}
|
||||
},
|
||||
rswtChkDelete: async (chkgdnPks: number[]) => {
|
||||
try {
|
||||
const res = await deleteFectch(`/reuseChk/reuseWater`, chkgdnPks);
|
||||
|
||||
if (res.ok) {
|
||||
ToastFormUi({
|
||||
body: "삭제가 완료되었습니다. ",
|
||||
title: "지도점검 삭제",
|
||||
});
|
||||
if (res) {
|
||||
toast.success("삭제가 완료되었습니다.")
|
||||
}
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch("1", "20", currentYear, "0");
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
rswtChkRes: rswtChkRes,
|
||||
rswtChkRes: rswtChkRes.data,
|
||||
rswtChkCount: rswtChkRes.count,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
ToastFormUi({ body: "삭제를 실패했습니다.. ", title: "지도점검 삭제" });
|
||||
toast.error("삭제 오류입니다.")
|
||||
}
|
||||
},
|
||||
rswtChkPolAndGuide: async (chkGdnPk: number) => {
|
||||
@@ -240,7 +326,11 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
rswtChkPolGuide: rswtChkPolGuide,
|
||||
},
|
||||
}));
|
||||
} catch (error) { }
|
||||
} catch (error) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
rswtChkPolInit: () => {
|
||||
try {
|
||||
@@ -251,7 +341,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
rswtChkPolGuide: undefined,
|
||||
},
|
||||
}));
|
||||
} catch (error) { }
|
||||
} catch (error) {}
|
||||
},
|
||||
rwstPolAndGuideUpdate: async (rswtChk: rswtChkZodType[]) => {
|
||||
try {
|
||||
@@ -261,13 +351,10 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
chData[0]
|
||||
);
|
||||
if (res.ok) {
|
||||
ToastFormUi({
|
||||
body: "지도점검 연간 수질 및 보급수/중수도 수정이 완료되었습니다. ",
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
toast.success("지도점검 연간 수질 및 대체수/중수도 수정이 완료되었습니다.")
|
||||
}
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
const rswtChkRes = await initFetch("1", "20", currentYear, "0");
|
||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
||||
return set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
@@ -277,10 +364,9 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ToastFormUi({
|
||||
body: "지도점검 연간 수질 및 보급수/중수도 수정이 실패하였습니다.. ",
|
||||
title: "지도점검 수정",
|
||||
});
|
||||
|
||||
toast.error("지도점검 연간 수질 및 대체수/중수도 수정 오류입니다.")
|
||||
|
||||
}
|
||||
},
|
||||
rswtChkHeadChange: async (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => {
|
||||
@@ -301,7 +387,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
rswtDetailHeadList: rswtDetailHeadList,
|
||||
},
|
||||
}));
|
||||
} catch (e) { }
|
||||
} catch (e) {}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"
|
||||
import { getFetch } from "@/components/lib/api";
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList";
|
||||
import { rainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import { rainMainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import { buildingExcelRainSttn } from "./excel";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
@@ -15,7 +15,7 @@ const fcltDiv = [
|
||||
const rainChkgdnHeadList = rainChkgdnHeadSttnExport;
|
||||
const ruseHeadList = ruseSttnHeadListExport;
|
||||
const splHeadList = splSttnHeadListExport;
|
||||
const rainHeadNm = rainHeadNmExport
|
||||
const rainHeadNm = rainMainHeadNmExport
|
||||
|
||||
const rainChk: rainChkZodType[] = [];
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
|
||||
{ id: "spwtPositn", title: "채수지점", mergeCell: true },
|
||||
{ id: "chckYmd", title: "점검일", mergeCell: true },
|
||||
{ id: "utztnUsgCd", title: "이용용도" },
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)", type: "number" },
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)", type: "number" },
|
||||
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)", type: "number" },
|
||||
|
||||
{
|
||||
|
||||
@@ -426,7 +426,7 @@ export const rainSttNodeListExport: CommonTableProps[] = [
|
||||
|
||||
export const rainSttnDetailNodeListExport:CommonTableProps[] = [
|
||||
{ id: "totalSplyUswtrUtztnQnt",
|
||||
title: "연간보급수이용량(m³)",
|
||||
title: "연간대체수이용량(m³)",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 2,
|
||||
@@ -511,7 +511,7 @@ export const rainSttnDetailNodeListExport:CommonTableProps[] = [
|
||||
|
||||
export const rainSttnDetailHeadListExport:CommonTableProps[] = [
|
||||
{ id: "totalSplyUswtrUtztnQnt",
|
||||
title: "연간보급수이용량(m³)",
|
||||
title: "연간대체수이용량(m³)",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
|
||||
@@ -46,6 +46,29 @@ export const getFetch = async (type: string, url: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const getCountFetch = async (type: string, url: string) => {
|
||||
const div =
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ''
|
||||
: DEV_URL_WR;
|
||||
|
||||
const response = await fetch(div + url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
},
|
||||
});
|
||||
// JSON 응답 처리
|
||||
const res = await response.json();
|
||||
return res;
|
||||
|
||||
};
|
||||
|
||||
export const getFetchWithCount = async (type: string, url: string) => {
|
||||
const div =
|
||||
type === fetchType.COMMON
|
||||
|
||||
@@ -54,27 +54,30 @@ export const rainChkTableData = (chkData: rainChkZodType[]) => {
|
||||
export const rswtChkTableData = (chkData: rswtChkZodType[]) => {
|
||||
// 1. chkgdnFk + utztnUsgCd 기준 누계 정보 만들기
|
||||
const makeRswtData: any[] = [];
|
||||
chkData?.forEach((root) => {
|
||||
root.rswtrDetails.forEach((detail) => {
|
||||
let flatRswtChk = {};
|
||||
const findGuide = root.guideDetails.find(
|
||||
(guide) => guide.utztnUsgCd === detail.utztnUsgCd
|
||||
);
|
||||
const findPoluttion = root.rswtrPollutions.find(
|
||||
(polution) => polution.utztnUsgCd === detail.utztnUsgCd
|
||||
);
|
||||
const operMngCd = root?.reuseBuilding.operMngCd;
|
||||
flatRswtChk = {
|
||||
...root,
|
||||
...detail,
|
||||
...findGuide,
|
||||
...findPoluttion,
|
||||
...flatRswtChk,
|
||||
operMngCd: operMngCd,
|
||||
};
|
||||
makeRswtData.push(flatRswtChk);
|
||||
if(chkData&& chkData.length>0){
|
||||
|
||||
chkData?.forEach((root) => {
|
||||
root.rswtrDetails.forEach((detail) => {
|
||||
let flatRswtChk = {};
|
||||
const findGuide = root.guideDetails.find(
|
||||
(guide) => guide.utztnUsgCd === detail.utztnUsgCd
|
||||
);
|
||||
const findPoluttion = root.rswtrPollutions.find(
|
||||
(polution) => polution.utztnUsgCd === detail.utztnUsgCd
|
||||
);
|
||||
const operMngCd = root?.reuseBuilding.operMngCd;
|
||||
flatRswtChk = {
|
||||
...root,
|
||||
...detail,
|
||||
...findGuide,
|
||||
...findPoluttion,
|
||||
...flatRswtChk,
|
||||
operMngCd: operMngCd,
|
||||
};
|
||||
makeRswtData.push(flatRswtChk);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
return makeRswtData;
|
||||
};
|
||||
|
||||
|
||||
@@ -165,18 +165,34 @@ export const yearOptions: { val: string; text: string }[] = Array.from(
|
||||
})
|
||||
);
|
||||
|
||||
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 = "신청";
|
||||
export const getdmdMatFlag = (flag: string | undefined | null): string => {
|
||||
// 1. undefined나 null인 경우, '신청'을 반환합니다.
|
||||
// (이 검사를 먼저 함으로써 아래에서 .trim()을 안전하게 사용할 수 있습니다.)
|
||||
if (flag == null) {
|
||||
return "신청";
|
||||
}
|
||||
return flagMat;
|
||||
|
||||
// 2. 이제 flag가 문자열임이 보장되므로 .trim()을 호출해 앞뒤 공백을 제거합니다.
|
||||
const trimmedFlag = flag.trim();
|
||||
|
||||
if (trimmedFlag === "Sub") {
|
||||
return "검토";
|
||||
} else if (trimmedFlag === "matched") {
|
||||
return "매칭완료";
|
||||
}
|
||||
// 3. 그 외 모든 경우(빈 문자열 포함)는 '신청'으로 처리합니다.
|
||||
return "신청";
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const formatPhoneNumber=(tel:string) => {
|
||||
const onlyNums = tel.replace(/[^0-9]/g, '');
|
||||
if (onlyNums.length === 10) {
|
||||
return onlyNums.replace(/(\d{2})(\d{4})(\d{4})/, '$1-$2-$3');
|
||||
} else if (onlyNums.length === 11) {
|
||||
return onlyNums.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');
|
||||
} else {
|
||||
return tel; // 유효하지 않으면 빈 문자열
|
||||
}
|
||||
}
|
||||
@@ -368,7 +368,7 @@ export default function ConCostForm({
|
||||
childrenTriger={
|
||||
<>
|
||||
<Label className="underline">
|
||||
총사업비 (백만원) <i className="diveicon di-search" />
|
||||
처리시설 총사업비(백만원) <i className="diveicon di-search" />
|
||||
</Label>
|
||||
</>
|
||||
}
|
||||
@@ -405,7 +405,7 @@ export default function ConCostForm({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-3 mt-4">
|
||||
{/* <div className="col-span-3 mt-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label>공급처 선정</Label>
|
||||
<Button size={"sm"} onClick={(e) => {}} className="bg-none">
|
||||
@@ -428,7 +428,7 @@ export default function ConCostForm({
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
|
||||
@@ -7,11 +7,9 @@ import {
|
||||
excelToRswtGuideData,
|
||||
excelToRswtPolution,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel";
|
||||
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
|
||||
import {
|
||||
filePicked,
|
||||
filePickedArray,
|
||||
FileUpload,
|
||||
Form,
|
||||
FormField,
|
||||
FormUi,
|
||||
@@ -26,7 +24,7 @@ import { useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdExcel({ type }: { type: string }) {
|
||||
export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setIsRegExcel:(open:boolean) =>void }) {
|
||||
const { rswtChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload } =
|
||||
useWrStore((state) => {
|
||||
return state;
|
||||
@@ -146,29 +144,28 @@ export default function ChkgdExcel({ type }: { type: string }) {
|
||||
|
||||
const onSubmit = (values: z.infer<typeof chkgdRegExcel>) => {
|
||||
if (values.chckYr === "") {
|
||||
ToastFormUi({ body: "등록년도를 작성해주세요", title: "지도점검 등록" });
|
||||
toast.error("등록년도를 작성해주세요");
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === "RNB") {
|
||||
if (excelData === undefined || excelData?.length === 0) {
|
||||
ToastFormUi({
|
||||
body: "빈 파일 및 파일 오류 입니다.",
|
||||
title: "지도점검 등록",
|
||||
});
|
||||
toast.error("빈 파일 및 파일 오류 입니다.");
|
||||
|
||||
return;
|
||||
} else {
|
||||
rainChkExcelDataUPload(excelData as rainChkZodType[]);
|
||||
setIsRegExcel(false)
|
||||
}
|
||||
} else if (type === "RST") {
|
||||
if (excelRswtData === undefined || excelRswtData?.length === 0) {
|
||||
ToastFormUi({
|
||||
body: "빈 파일 및 파일 오류 입니다.",
|
||||
title: "중수지도점검 등록",
|
||||
});
|
||||
toast.error("빈 파일 및 파일 오류 입니다.");
|
||||
|
||||
return;
|
||||
} else {
|
||||
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]);
|
||||
setIsRegExcel(false)
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { z } from "zod";
|
||||
import React from "react";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
|
||||
export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
export default function ChkgdModal({ type, obj ,setIsModal }: { type: string; obj: any , setIsModal:(open:boolean)=>void}) {
|
||||
const {
|
||||
rainChkgdn,
|
||||
rswtChkgdn,
|
||||
@@ -79,6 +79,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('obj ', obj)
|
||||
|
||||
const result = obj.guideDetails?.reduce((acc: any, cur: any) => {
|
||||
const code = cur.utztnUsgCd;
|
||||
const month = cur.ym?.slice(4); // "MM"
|
||||
@@ -114,9 +116,10 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
});
|
||||
}
|
||||
|
||||
console.log("result ", result);
|
||||
setGuidData(result as splRuseWaterType[]);
|
||||
|
||||
|
||||
console.log('obj ', obj)
|
||||
if (obj.rswtrPollutions) {
|
||||
const resultPolution: Record<string, any[]> = {
|
||||
"1": [],
|
||||
@@ -217,12 +220,14 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
obj.guideDetails = realGuideDetail;
|
||||
if (type === "RNB") {
|
||||
rainChkGuidUpdate(obj);
|
||||
setIsModal(false)
|
||||
} else {
|
||||
const polution = Object.values(upPolutionData)
|
||||
.flat()
|
||||
.filter((item) => item.utztnUsgCd !== "평균");
|
||||
obj.rswtrPollutions = polution;
|
||||
rwstPolAndGuideUpdate([obj]);
|
||||
setIsModal(false)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -262,12 +267,13 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{`연간보급수이용량`}
|
||||
{`연간대체수이용량`}
|
||||
</h3>
|
||||
</div>
|
||||
<GuideDetailsTable
|
||||
chgRes={guidData || []}
|
||||
headList={headList.ruseHeadList}
|
||||
headList={headList.splHeadList}
|
||||
upheadList={type === "RNB"? rainChkgdn.rainSplHeadNm :rswtChkgdn.rswtSplHeadNm}
|
||||
type={""}
|
||||
setChGuidData={(data) => {
|
||||
setChGuidData(data);
|
||||
@@ -280,7 +286,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
</div>
|
||||
<GuideDetailsTable
|
||||
chgRes={guidData || []}
|
||||
headList={headList.splHeadList}
|
||||
headList={headList.ruseHeadList}
|
||||
upheadList={type === "RNB"? rainChkgdn.rainRuseHeadNm :rswtChkgdn.rswtRuseHeadNm}
|
||||
type={""}
|
||||
setChGuidData={(data) => {
|
||||
setChGuidData(data);
|
||||
@@ -302,6 +309,7 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
||||
<GuideDetailsTable
|
||||
chgRes={value}
|
||||
headList={headList?.rswtDetailHeadList}
|
||||
upheadList={rswtChkgdn.rswtSplHeadNm}
|
||||
type={""}
|
||||
setChGuidData={(data) => {
|
||||
getPolutionData(data);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type {
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import {
|
||||
Input,
|
||||
@@ -18,11 +19,13 @@ import { useEffect, useState, type Dispatch, type SetStateAction } from "react"
|
||||
export function GuideDetailsTable({
|
||||
chgRes,
|
||||
headList,
|
||||
upheadList,
|
||||
type,
|
||||
setChGuidData,
|
||||
}: {
|
||||
chgRes: any[];
|
||||
headList: TableUpperProps[];
|
||||
upheadList:chHeadType[]
|
||||
type: string;
|
||||
setChGuidData: (chgRes: any[]) => void;
|
||||
}) {
|
||||
@@ -44,7 +47,7 @@ export function GuideDetailsTable({
|
||||
<>
|
||||
<div className={`card !m-[1.2rem] !p-0r `}>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">{headMakeprfmnc(headList, rainChkgdn?.rainHeadNm)}</TableHeader>
|
||||
<TableHeader className="font-bold">{headMakeprfmnc(headList, upheadList)}</TableHeader>
|
||||
<TableBody >
|
||||
{InputTableBody(inputData ?? [],headList, setInputData) }
|
||||
</TableBody>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import { rainPageSize, type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
export default function RainChkgdTable({
|
||||
detailUp,
|
||||
handleClick = () => { },
|
||||
@@ -70,16 +71,12 @@ export default function RainChkgdTable({
|
||||
}, [makeTableData, handleClick]);
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
|
||||
|
||||
},[rainChkgdn.rainChk])
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedIds([])// 셀렉트 초기화를 위한 작업
|
||||
if (rainChkData) {
|
||||
if (rainChkData&&rainChkData.length>0) {
|
||||
|
||||
const rainChg = rainChkData.map((item: any) => {
|
||||
const rainChg = rainChkData?.map((item: any) => {
|
||||
const bud = tableData([item.building], { code });
|
||||
return {
|
||||
...item,
|
||||
@@ -89,6 +86,8 @@ export default function RainChkgdTable({
|
||||
});
|
||||
|
||||
setMakeTableData(rainChkTableData(rainChg));
|
||||
}else{
|
||||
setMakeTableData([]);
|
||||
}
|
||||
}, [rainChkData, code]);
|
||||
|
||||
@@ -167,7 +166,7 @@ export default function RainChkgdTable({
|
||||
} else {
|
||||
setHeadList({
|
||||
headList: rainChkgdn.rainChkgdnHeadList,
|
||||
upHeadList: rainChkgdn.rainHeadNm
|
||||
upHeadList: rainChkgdn.rainMainHeadNm
|
||||
})
|
||||
|
||||
}
|
||||
@@ -175,9 +174,15 @@ export default function RainChkgdTable({
|
||||
}, [rainChkSttn.isSttn, rainChkgdn.rainChkgdnHeadList, rainChkSttn.rainChkgdnHeadList]);
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
console.log('rainChkgdn.count ', rainChkgdn.rainChkCount)
|
||||
},[rainChkgdn.rainChkCount])
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay>
|
||||
<Table variant="secondary">
|
||||
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(
|
||||
headList?.headList,
|
||||
@@ -197,9 +202,9 @@ export default function RainChkgdTable({
|
||||
</TableBody>
|
||||
</Table>
|
||||
<UiPageNations
|
||||
total={rainChkData?.length ?? 0}
|
||||
total={rainChkgdn.rainChkCount||20}
|
||||
cur={pageNation}
|
||||
pageSize={20}
|
||||
pageSize={rainPageSize}
|
||||
onPageChange={onPageChange}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
|
||||
import type {
|
||||
rswtChkZodType,
|
||||
rswtrChkDetailsZodType,
|
||||
import {
|
||||
rswtPageSize,
|
||||
type rswtChkZodType,
|
||||
type rswtrChkDetailsZodType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
import { Table, TableBody, TableHeader } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
|
||||
export default function RswtChkgdTable({
|
||||
detaiRswtlUpdate,
|
||||
@@ -72,7 +74,6 @@ export default function RswtChkgdTable({
|
||||
}, [rswtChkgdn.rswtChkPolGuide]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("makeTableData ", makeTableData)
|
||||
getRswtSttnExcel(makeTableData)
|
||||
const selectedData = makeTableData
|
||||
.map((item) => {
|
||||
@@ -133,6 +134,7 @@ export default function RswtChkgdTable({
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay isLoading={rswtChkgdn.isLoading}></LoadingOverlay>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(headList?.headList, headList?.upHeadList)}
|
||||
@@ -150,9 +152,9 @@ export default function RswtChkgdTable({
|
||||
</TableBody>
|
||||
</Table>
|
||||
<UiPageNations
|
||||
total={rswtChkData?.length ?? 0}
|
||||
total={rswtChkgdn.rswtChkCount}
|
||||
cur={pageNation}
|
||||
pageSize={20}
|
||||
pageSize={rswtPageSize}
|
||||
onPageChange={onPageChange}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user