잠재수요처 엑셀 다운로드 수정, 페이징 처리 수정

This commit is contained in:
jyha00
2025-07-08 20:59:35 +09:00
parent e314369cbb
commit e30130dc8f
7 changed files with 37 additions and 29 deletions
@@ -5,7 +5,7 @@ import { 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 LoadingOverlay from "@common/business_components/ui/loadingBar";
import { Button, Progress } from "@common/components/ui";
import { Button, Input, Progress } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
@@ -13,7 +13,7 @@ import toast from "react-hot-toast";
import type { z } from "zod";
export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => void }) {
const { ldrmnt,loadingOpen } = useWrStore((state) => state);
const { ldrmnt, loadingOpen } = useWrStore((state) => state);
const { isLoading } = ldrmnt;
const form = useForm<z.infer<typeof coRegExcel>>({
resolver: zodResolver(coRegExcel),
@@ -23,6 +23,13 @@ export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => vo
const [file, setFiles] = useState<File | undefined>();
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const selectedFile = e.target.files?.[0];
if (selectedFile) {
setFiles(selectedFile);
}
};
const onSubmit = (values: z.infer<typeof coRegExcel>) => {
loadingOpen(true);
if (file) {
@@ -59,7 +66,7 @@ export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => vo
alert(e)
return true;
}
}).catch((e)=>{
}).catch((e) => {
console.log("file", e);
});
};
@@ -90,14 +97,13 @@ export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => vo
name="file"
render={({ field }) => (
<FormUi label="">
<FileUpload
files={file ? [file] : []}
setFiles={(files: File[] | null) => {
if (files && files?.length === 1) setFiles(files[0]);
}}
fileTypes=""
maxFiles={1}
></FileUpload>
<div className="space-y-4 p-4">
<Input
type="file"
onChange={handleFileChange}
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
/>
</div>
</FormUi>
)}
/>