Merge remote-tracking branch 'origin/iipbs/sn/dev'
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 956 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 941 B |
@@ -114,10 +114,11 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
});
|
||||
},
|
||||
ldrmntRegData: async (data) => {
|
||||
await deleteFectch(
|
||||
`/reuseFc/request/temp`,
|
||||
);
|
||||
console.log("deleteFectch", deleteFectch)
|
||||
// 잠재수요처 - 삭제 주석 처리
|
||||
// await deleteFectch(
|
||||
// `/reuseFc/request/temp`,
|
||||
// );
|
||||
// console.log("deleteFectch", deleteFectch)
|
||||
|
||||
const response = await postFectch(
|
||||
"/reuseFc/request/temp",
|
||||
@@ -125,7 +126,8 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
fetchType.WR
|
||||
);
|
||||
|
||||
console.log('response ', response)
|
||||
console.log('response ', response);
|
||||
return response;
|
||||
|
||||
},
|
||||
ldrmntSearch: async (isExcel: boolean, page: number, total: string, sggCd: string, coNm: string) => {
|
||||
|
||||
@@ -10,18 +10,20 @@ import { useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
import type { z } from "zod";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
|
||||
export default function CoRegExcel({
|
||||
isModal,
|
||||
}: {
|
||||
isModal: (open: boolean) => void;
|
||||
}) {
|
||||
const { confirm } = useConfirm();
|
||||
const { ldrmnt, loadingOpen } = useWrStore((state) => state);
|
||||
const { isLoading } = ldrmnt;
|
||||
const form = useForm<z.infer<typeof coRegExcel>>({
|
||||
resolver: zodResolver(coRegExcel),
|
||||
});
|
||||
const { ldrmntRegData } = useWrStore((state) => state);
|
||||
const { ldrmntRegData, ldrmntDelete } = useWrStore((state) => state);
|
||||
|
||||
const [file, setFiles] = useState<File | undefined>();
|
||||
|
||||
@@ -32,8 +34,7 @@ export default function CoRegExcel({
|
||||
// }
|
||||
// };
|
||||
|
||||
//TODO:Onsubmit을 써야하는지
|
||||
const onSubmit = () => {
|
||||
const onSubmit = (isReplaceAll = false) => {
|
||||
loadingOpen(true);
|
||||
if (file) {
|
||||
filePicked(file, 0)
|
||||
@@ -59,10 +60,23 @@ export default function CoRegExcel({
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if (isReplaceAll) {
|
||||
const isConfirmed = await confirm(
|
||||
"기존 등록된 잠재수요처를 \n모두 삭제후 등록처리됩니다. 실행하시겠습니까?",
|
||||
);
|
||||
|
||||
if (!isConfirmed) {
|
||||
loadingOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
await ldrmntDelete();
|
||||
}
|
||||
|
||||
await ldrmntRegData(array);
|
||||
isModal(false);
|
||||
loadingOpen(false);
|
||||
toast.success(`잠재수요처 등록이 완료되었습니다.`);
|
||||
toast.success(`잠재수요처 등록이 요청되었습니다.`);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
loadingOpen(false);
|
||||
@@ -72,7 +86,10 @@ export default function CoRegExcel({
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("file", e);
|
||||
loadingOpen(false);
|
||||
});
|
||||
} else {
|
||||
loadingOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,7 +98,7 @@ export default function CoRegExcel({
|
||||
<div>
|
||||
<LoadingOverlay isLoading={isLoading}></LoadingOverlay>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<form onSubmit={(e) => e.preventDefault()}>
|
||||
<div>
|
||||
<Title title={"잠재수요처 등록"}></Title>
|
||||
</div>
|
||||
@@ -89,9 +106,24 @@ export default function CoRegExcel({
|
||||
<h3 className="text-2xl font-bold text-gray-900 mt-1 ml-7">
|
||||
{"잠재수요처 파일"}
|
||||
</h3>
|
||||
<Button className="" type="submit" size={"sm"}>
|
||||
저장
|
||||
</Button>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
className=""
|
||||
type="button"
|
||||
size={"sm"}
|
||||
onClick={form.handleSubmit(() => onSubmit(true))}
|
||||
>
|
||||
전체등록
|
||||
</Button>
|
||||
<Button
|
||||
className=""
|
||||
type="button"
|
||||
size={"sm"}
|
||||
onClick={form.handleSubmit(() => onSubmit(false))}
|
||||
>
|
||||
추가등록
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
|
Before Width: | Height: | Size: 919 B After Width: | Height: | Size: 980 B |
|
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 896 B After Width: | Height: | Size: 943 B |
|
Before Width: | Height: | Size: 837 B After Width: | Height: | Size: 935 B |
|
Before Width: | Height: | Size: 923 B After Width: | Height: | Size: 956 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 941 B |