엑셀 중수도 지도점검 데이터 확인
This commit is contained in:
@@ -34,7 +34,6 @@ export default function ChkgdExcel({
|
||||
setYearChange: (year: string) => void;
|
||||
}) {
|
||||
const {
|
||||
rainChkgdn,
|
||||
rainChkExcelDataUPload,
|
||||
rswtChkExceDataUpload,
|
||||
setRainChkLoading,
|
||||
@@ -97,8 +96,9 @@ export default function ChkgdExcel({
|
||||
form.getValues("chckYr")
|
||||
);
|
||||
if (excelData.issues && excelData.issues.length > 0) {
|
||||
excelData.issues.forEach((err) => {
|
||||
excelData.issues.some((err, index) => {
|
||||
showConfirmToast(err);
|
||||
return index === 4; // true 반환 시 반복 종료
|
||||
});
|
||||
clearFile();
|
||||
} else {
|
||||
@@ -110,48 +110,61 @@ export default function ChkgdExcel({
|
||||
});
|
||||
} else if (type === "RST") {
|
||||
filePickedArray(file, 0).then((res) => {
|
||||
let issues: string[] = [];
|
||||
|
||||
if (res && res?.length > 1) {
|
||||
const guideData = excelToRswtGuideData(
|
||||
res[0],
|
||||
form.getValues("chckYr")
|
||||
form.getValues("chckYr"),
|
||||
issues
|
||||
);
|
||||
const polutionData = excelToRswtPolution(res[1]);
|
||||
const polutionData = excelToRswtPolution(res[1], issues);
|
||||
|
||||
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
|
||||
issues = [...guideData.issues, ...polutionData.issues];
|
||||
|
||||
if (issues && issues.length > 0) {
|
||||
issues.some((err, index) => {
|
||||
showConfirmToast(err);
|
||||
return index === 6; // true 반환 시 반복 종료
|
||||
});
|
||||
clearFile();
|
||||
} else {
|
||||
const keyGenerator = (item: rswtChkZodType) =>
|
||||
`${item.bdstRuseFcltSn}|${item.chckYmd}|${item.utztnUsgCd}`;
|
||||
const totalData: rswtChkZodType[] = guideData.data.map(
|
||||
(guide) => {
|
||||
const fusion = polutionData.data.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,
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
const guideKey = new Set(guideData.data.map(keyGenerator));
|
||||
const onlypolution = polutionData.data.filter(
|
||||
(item) => !guideKey.has(keyGenerator(item))
|
||||
);
|
||||
|
||||
if (fusion) {
|
||||
return {
|
||||
...guide,
|
||||
rswtrPollutions: fusion?.rswtrPollutions,
|
||||
rswtrDetails: fusion?.rswtrDetails,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
...guide,
|
||||
};
|
||||
}
|
||||
});
|
||||
const listTotalData: rswtChkZodType[] = [
|
||||
...totalData,
|
||||
...onlypolution,
|
||||
];
|
||||
|
||||
const guideKey = new Set(guideData.map(keyGenerator));
|
||||
|
||||
const onlypolution = polutionData.filter(
|
||||
(item) => !guideKey.has(keyGenerator(item))
|
||||
);
|
||||
|
||||
const listTotalData: rswtChkZodType[] = [
|
||||
...totalData,
|
||||
...onlypolution,
|
||||
];
|
||||
|
||||
setExcelRswtData(listTotalData);
|
||||
setExcelRswtData(listTotalData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -202,7 +215,7 @@ export default function ChkgdExcel({
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user