Merge commit '19621c17b43c3872c350fc0cf646a4dce9b1a215' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run

This commit is contained in:
leedj312
2025-06-30 20:19:10 +09:00
5 changed files with 370 additions and 135 deletions
@@ -1,48 +1,62 @@
"use client"
import { btnClass } from "@/app/store/common/code"
import type { customDrgt } from "@/app/store/matDmd/drgtSttn"
import { drgtDetailHeadListExport } from "@/app/store/matDmd/drgtSttn/headList"
import { ContentsDiv, Title, UiTable } from "@common/business_components/ui"
import { excelDownload } from "@/components/lib/func/commom"
import { Title, UiTable } from "@common/business_components/ui"
import ListDiv from "@common/business_components/ui/list_div"
import { Button } from "@common/components/ui"
import { useCallback, useEffect } from "react"
export default function DrgtDetailModal({
data,
}: {
data: customDrgt;
}) {
const excelClick = useCallback(() => {
excelDownload(
[[]],
"우리동네가뭄",
"sample_drgtSttn.xlsx",
"A1:H1"
);
}, []);
export default function DrgtDetailModal() {
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"우리동네가뭄 상세내용"} />
<div className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={() => { }}
>
다운로드
</Button>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={[]}
headlist={drgtDetailHeadListExport}
pageSize={10}
total={10000}
cellClick={(index: number | undefined, headId: string) => { }}
onPageChange={() => { }}
></UiTable>
</ListDiv>
</div>
</div>
<div className="grid grid-cols-4 gap-4 h-full">
<div className="col-span-4">
<div className="flex items-center justify-between">
<Title title={`우리동네가뭄 상세내용 - ${data[0].sggNm}`} />
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
className={`${btnClass} green mt-12`}
onClick={excelClick}
>
다운로드
</Button>
</div>
</div>
<hr className="mt-2 mb-2" />
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={data}
headlist={drgtDetailHeadListExport}
pageSize={10}
total={10000}
cellClick={(index: number | undefined, headId: string) => { }}
onPageChange={() => { }}
></UiTable>
</ListDiv>
</div>
</div>
</div>
</ContentsDiv>
</div>
</>
)
}
@@ -1,12 +1,12 @@
import { useWrStore } from "@/app/store";
import { coRegExcel } from "@/app/store/matDmd/coSttn/headList";
import type { customLdrmnt } from "@/app/store/matDmd/ldrmntCoSttn";
import { excelToLdrmntData, names } from "@/app/store/matDmd/ldrmntCoSttn/excel";
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 { Button, Input } from "@common/components/ui";
import { Button } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useState } from "react";
import { useForm } from "react-hook-form";
import type { z } from "zod";
@@ -26,34 +26,41 @@ export default function CoRegExcel() {
ldrmntDelete();
if (file) {
filePicked(file, 0).then((res) => {
//TODO:loading
try {
console.log("res", res)
let array: { [key: string]: string | number }[] = []
if (Array.isArray(res))
res.forEach((item, index) => {
let isError = false;
if (Array.isArray(res)){
res.some((item, index) => {
let object: { [key: string]: string | number } = {}
Object.keys(names).forEach((key) => {
Object.keys(names).some((key) => {
if (item && names[key] !== undefined) {
if (key === "공장관리번호")
if (key === "공장관리번호") {
item[key] = String(item[key])
object[names[key] as string] = item[key];
} else {
object[names[key] as string] = item[key];
}
}
return false;
})
if(isError === true)
return true;
array.push(object)
if (index != 0 && index % 5000 == 0) {
ldrmntRegData(array);
console.log("array", array)
array = []
array.length = 0;
// throw new Error("error")
}
return false;
})
}
if(isError === false)
ldrmntRegData(array);
console.log("array끝", array)
} catch (e) {
console.log(e)
alert(e)
return true;
}
});
@@ -61,47 +68,46 @@ export default function CoRegExcel() {
}
return (
<>
<div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div>
<Title title={"잠재수요처 등록"}></Title>
</div>
<div className="flex justify-between">
<h3 className="text-2xl font-bold text-gray-900 mt-1 ml-7">
{"잠재수요처 파일"}
</h3>
return (
<>
<div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div>
<Title title={"잠재수요처 등록"}></Title>
</div>
<div className="flex justify-between">
<h3 className="text-2xl font-bold text-gray-900 mt-1 ml-7">
{"잠재수요처 파일"}
</h3>
<Button className="" type="submit" size={"sm"}>
저장
</Button>
</div>
<Button className="" type="submit" size={"sm"}>
저장
</Button>
</div>
<div>
<div>
<FormField
control={form.control}
name="file"
render={({ field }) => (
<FormUi label="">
<FileUpload
files={file ? [file] : []}
setFiles={(files: File[] | null) => {
console.log("files", files)
if (files && files?.length === 1) setFiles(files[0]);
}}
fileTypes=""
maxFiles={1}
></FileUpload>
</FormUi>
)}
/>
</div>
</form>
</Form>
</div>
</>
);
}
<FormField
control={form.control}
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>
</FormUi>
)}
/>
</div>
</form>
</Form>
</div>
</>
);
}