지도점검 엑셀 등록시 lodingbar추가
This commit is contained in:
@@ -84,6 +84,7 @@ type rswtChkgdnActions = {
|
||||
rswtChkPolInit: () => void;
|
||||
rwstPolAndGuideUpdate: (rswtChk: rswtChkZodType[]) => void;
|
||||
rswtChkHeadChange: (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => void;
|
||||
setRswtChkLoading:(status:boolean) =>void
|
||||
};
|
||||
|
||||
export type rswtChkgdnType = rswtChkgdnState & rswtChkgdnActions;
|
||||
@@ -394,6 +395,15 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
},setRswtChkLoading:(status:boolean) =>{
|
||||
set((state: rswtChkgdnState) => ({
|
||||
...state,
|
||||
rswtChkgdn: {
|
||||
...state.rswtChkgdn,
|
||||
isLoading: status,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
SelectBox,
|
||||
Title,
|
||||
} from "@common/business_components/ui";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
@@ -35,9 +36,12 @@ export default function ChkgdExcel({
|
||||
setYearChange: (year: string) => void;
|
||||
}) {
|
||||
const {
|
||||
rswtChkgdn,
|
||||
rainChkgdn,
|
||||
rainChkExcelDataUPload,
|
||||
rswtChkExceDataUpload,
|
||||
setRainChkLoading,
|
||||
setRswtChkLoading,
|
||||
} = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
@@ -110,43 +114,38 @@ export default function ChkgdExcel({
|
||||
setRainChkLoading(false);
|
||||
});
|
||||
} else if (type === "RST") {
|
||||
filePickedArray(file, 0).then((res) => {
|
||||
|
||||
setRswtChkLoading(true);
|
||||
filePickedArray(file, 0)
|
||||
.then((res) => {
|
||||
if (res && res?.length > 1) {
|
||||
const guideData = excelToRswtGuideData(
|
||||
res[0],
|
||||
form.getValues("chckYr")
|
||||
);
|
||||
const polutionData = excelToRswtPolution(res[1]);
|
||||
|
||||
if (res && res?.length > 1) {
|
||||
const guideData = excelToRswtGuideData(
|
||||
res[0],
|
||||
form.getValues("chckYr"),
|
||||
);
|
||||
const polutionData = excelToRswtPolution(res[1]);
|
||||
|
||||
|
||||
|
||||
|
||||
const keyGenerator = (item: rswtChkZodType) =>
|
||||
`${item.bdstRuseFcltSn}|${item.chckYmd}|${item.utztnUsgCd}`;
|
||||
const totalData: rswtChkZodType[] = guideData.map(
|
||||
(guide) => {
|
||||
const fusion = polutionData.find(
|
||||
(polution) =>
|
||||
guide.bdstRuseFcltSn === polution.bdstRuseFcltSn &&
|
||||
guide.chckYmd === polution.chckYmd &&
|
||||
guide.utztnUsgCd === polution.utztnUsgCd
|
||||
);
|
||||
const totalData: rswtChkZodType[] = guideData.map((guide) => {
|
||||
const fusion = polutionData.find(
|
||||
(polution) =>
|
||||
guide.bdstRuseFcltSn === polution.bdstRuseFcltSn &&
|
||||
guide.chckYmd === polution.chckYmd &&
|
||||
guide.utztnUsgCd === polution.utztnUsgCd
|
||||
);
|
||||
|
||||
if (fusion) {
|
||||
return {
|
||||
...guide,
|
||||
rswtrPollutions: fusion?.rswtrPollutions,
|
||||
rswtrDetails: fusion?.rswtrDetails,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
...guide,
|
||||
};
|
||||
}
|
||||
if (fusion) {
|
||||
return {
|
||||
...guide,
|
||||
rswtrPollutions: fusion?.rswtrPollutions,
|
||||
rswtrDetails: fusion?.rswtrDetails,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
...guide,
|
||||
};
|
||||
}
|
||||
);
|
||||
});
|
||||
const guideKey = new Set(guideData.map(keyGenerator));
|
||||
const onlypolution = polutionData.filter(
|
||||
(item) => !guideKey.has(keyGenerator(item))
|
||||
@@ -158,7 +157,7 @@ export default function ChkgdExcel({
|
||||
];
|
||||
const issues: string[] = [];
|
||||
|
||||
rswtExcelDataCheck(listTotalData,issues)
|
||||
rswtExcelDataCheck(listTotalData, issues);
|
||||
|
||||
if (issues && issues.length > 0) {
|
||||
issues.some((err, index) => {
|
||||
@@ -169,8 +168,9 @@ export default function ChkgdExcel({
|
||||
} else {
|
||||
setExcelRswtData(listTotalData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => setRswtChkLoading(false));
|
||||
}
|
||||
}
|
||||
}, [file]);
|
||||
@@ -222,6 +222,11 @@ export default function ChkgdExcel({
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay
|
||||
isLoading={type === "RNB" ? rainChkgdn.isLoading : rswtChkgdn.isLoading}
|
||||
customZindex={"z-100"}
|
||||
></LoadingOverlay>
|
||||
|
||||
<div>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { codeToText } from "@/components/lib/func/commom";
|
||||
import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable";
|
||||
import { ScrollArea, Title } from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdModal({
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
chRowspanTable,
|
||||
rainChkTableData
|
||||
} from "@/components/lib/func/TableData";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
|
||||
import {
|
||||
Table,
|
||||
@@ -191,7 +190,6 @@ export default function RainChkgdTable({
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
chRowspanTable,
|
||||
rswtChkTableData,
|
||||
} from "@/components/lib/func/TableData";
|
||||
import LoadingOverlay from "@common/business_components/ui/loadingBar";
|
||||
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
|
||||
import { Table, TableBody, TableHeader } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
@@ -138,7 +137,6 @@ export default function RswtChkgdTable({
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingOverlay isLoading={rswtChkgdn.isLoading}></LoadingOverlay>
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(headList?.headList, headList?.upHeadList)}
|
||||
|
||||
Reference in New Issue
Block a user