Merge commit 'ed5fa161f56b2d0f34abaa138d7df04292e55f07' into iipbs/wr/form_fuction
iipbs_wr / build (push) Waiting to run
iipbs_wr / build (push) Waiting to run
This commit is contained in:
@@ -95,7 +95,7 @@ export default function Home() {
|
|||||||
<SearchDiv>
|
<SearchDiv>
|
||||||
<SearchFormLeft>
|
<SearchFormLeft>
|
||||||
<SearchInput
|
<SearchInput
|
||||||
className="col-span-3 my-7"
|
className="col-span-3 my-7 !text-3xl"
|
||||||
label="건물명"
|
label="건물명"
|
||||||
textValue={searchTxt || ""}
|
textValue={searchTxt || ""}
|
||||||
setText={(e) => {
|
setText={(e) => {
|
||||||
@@ -104,8 +104,8 @@ export default function Home() {
|
|||||||
/>
|
/>
|
||||||
</SearchFormLeft>
|
</SearchFormLeft>
|
||||||
<SearchFormRight>
|
<SearchFormRight>
|
||||||
<div className="flex flex-row space-x-2">
|
<div className="flex flex-row space-x-2 items-center">
|
||||||
<Button size={"sm"} onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button>
|
<Button size={"sm"} onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button>
|
||||||
<Button
|
<Button
|
||||||
size={"sm"}
|
size={"sm"}
|
||||||
onClick={() => setIsNewReg(!issNewReg)}
|
onClick={() => setIsNewReg(!issNewReg)}
|
||||||
@@ -119,8 +119,8 @@ export default function Home() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-6 gap-4 ">
|
<div className="grid grid-cols-6 gap-4 ">
|
||||||
<div className="col-span-4">
|
<div className="col-span-4 h-full min-h-0">
|
||||||
<ListDiv>
|
<ListDiv className="min-h-0">
|
||||||
<UiTable
|
<UiTable
|
||||||
tableData={bdstTable || []}
|
tableData={bdstTable || []}
|
||||||
headlist={htdfl.upHeadList}
|
headlist={htdfl.upHeadList}
|
||||||
@@ -133,9 +133,9 @@ export default function Home() {
|
|||||||
</UiTable>
|
</UiTable>
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-2 max-h-full">
|
<div className="col-span-2 max-h-full">
|
||||||
<ListDiv>
|
<ListDiv>
|
||||||
<ScrollArea>
|
<ScrollArea className="h-[60vh]">
|
||||||
<HtdflRegForm
|
<HtdflRegForm
|
||||||
htdflForm={htdflForm ?? ({} as customHtdflBdst)}
|
htdflForm={htdflForm ?? ({} as customHtdflBdst)}
|
||||||
isModal={false}
|
isModal={false}
|
||||||
@@ -145,25 +145,23 @@ export default function Home() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<UiModal
|
<UiModal
|
||||||
body={<BdstReg moType="HTB"></BdstReg>}
|
body={<BdstReg moType="HTB"></BdstReg>}
|
||||||
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
bodyClass="w-[68vw] max-w-none h-[90vh]"
|
||||||
open={issNewReg}
|
open={issNewReg}
|
||||||
onOpenChange={(open) => {
|
onOpenChange={(open) => {
|
||||||
setIsNewReg(open);
|
setIsNewReg(open);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<UiModal
|
|
||||||
bodyClass={""}
|
|
||||||
open={bdstChgProps.isOpen}
|
|
||||||
body={<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>}
|
|
||||||
onOpenChange={(open) => {
|
|
||||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
|
<UiModal
|
||||||
|
bodyClass={""}
|
||||||
|
open={bdstChgProps.isOpen}
|
||||||
|
body={<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>}
|
||||||
|
onOpenChange={(open) => {
|
||||||
|
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</ContentsDiv>
|
</ContentsDiv>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { rswtChkZodType, rswtrChkDetailsZodType } from "@/app/store/prfmncR
|
|||||||
import {
|
import {
|
||||||
excelArrayDownload,
|
excelArrayDownload,
|
||||||
excelDownload,
|
excelDownload,
|
||||||
|
yearOptions,
|
||||||
} from "@/components/lib/func/commom";
|
} from "@/components/lib/func/commom";
|
||||||
import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel";
|
import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel";
|
||||||
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
||||||
@@ -22,7 +23,7 @@ import {
|
|||||||
UiModal,
|
UiModal,
|
||||||
} from "@common/business_components/ui";
|
} from "@common/business_components/ui";
|
||||||
import ListDiv from "@common/business_components/ui/list_div";
|
import ListDiv from "@common/business_components/ui/list_div";
|
||||||
import { Button } from "@common/components/ui";
|
import { Button, Label } from "@common/components/ui";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { Toaster } from "react-hot-toast";
|
import { Toaster } from "react-hot-toast";
|
||||||
|
|
||||||
@@ -48,7 +49,6 @@ export default function Page() {
|
|||||||
return state;
|
return state;
|
||||||
});
|
});
|
||||||
const [isRegExcel, setIsRegExcel] = useState(false);
|
const [isRegExcel, setIsRegExcel] = useState(false);
|
||||||
const [searchTxt, setSearchTxt] = useState<string>();
|
|
||||||
const [updateRainDetail, setUpdateRainDetail] = useState<rainChkZodType[]>(
|
const [updateRainDetail, setUpdateRainDetail] = useState<rainChkZodType[]>(
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
@@ -63,10 +63,10 @@ export default function Page() {
|
|||||||
data: {},
|
data: {},
|
||||||
});
|
});
|
||||||
const cellClick = () => {
|
const cellClick = () => {
|
||||||
if (searchTxt) rainChkInit(searchTxt, "0");
|
if (searchYear) rainChkInit(searchYear, "0");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear()));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!rainChkgdn.isInit) {
|
if (!rainChkgdn.isInit) {
|
||||||
@@ -126,67 +126,70 @@ export default function Page() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
rainChkgdn.isSttn=false
|
rainChkgdn.isSttn = false
|
||||||
rswtChkgdn.isSttn=false
|
rswtChkgdn.isSttn = false
|
||||||
if (!rainChkgdn.isSttn &&!rswtChkgdn.isSttn) {
|
if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) {
|
||||||
rainChkHeadChange({rainChkgdn}, true);
|
rainChkHeadChange({ rainChkgdn }, true);
|
||||||
rswtChkHeadChange({rswtChkgdn}, true);
|
rswtChkHeadChange({ rswtChkgdn }, true);
|
||||||
}
|
}
|
||||||
}, [rainChkgdn.isSttn ,rswtChkgdn.isSttn]);
|
}, [rainChkgdn.isSttn, rswtChkgdn.isSttn]);
|
||||||
|
|
||||||
|
const clickDelete = (data: number[], selFcltDiv: string) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const clickDelete = (data: number[],selFcltDiv:string) => {
|
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
if(selFcltDiv === "RNB"){
|
if (selFcltDiv === "RNB") {
|
||||||
rainChkDelete(data);
|
rainChkDelete(data);
|
||||||
}else{
|
} else {
|
||||||
rswtChkDelete(data)
|
rswtChkDelete(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const chkUpdateTable =(selFcltDiv:string) =>{
|
const chkUpdateTable = (selFcltDiv: string) => {
|
||||||
if(selFcltDiv === "RNB"){
|
if (selFcltDiv === "RNB") {
|
||||||
|
|
||||||
rainChkDetilUpdate(updateRainDetail)
|
rainChkDetilUpdate(updateRainDetail)
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
rswtChkDetilsUpdate(updateRswtDetail)
|
rswtChkDetilsUpdate(updateRswtDetail)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContentsDiv>
|
<ContentsDiv>
|
||||||
<div className="grid grid-cols-4 gap-4 ">
|
<div className="grid grid-cols-4 gap-4 ">
|
||||||
<div className="col-span-4">
|
<div className="col-span-4">
|
||||||
<Title title={"지도점검 결과 등록 "} />
|
<Title title={"지도점검 결과 등록"} />
|
||||||
<SearchDiv>
|
<SearchDiv>
|
||||||
<SearchFormLeft>
|
<SearchFormLeft>
|
||||||
<SearchInput
|
<div className="col-span-2 flex flex-row space-x-2">
|
||||||
className="col-span-3 my-7 !text-xl"
|
<Label className="w-48 mt-2 text-xl text-gray-600">{'지도점검년도'}</Label>
|
||||||
label=" 지도점검년도"
|
<SelectBox
|
||||||
textValue={searchTxt ?? ""}
|
className="w-full h-full text-2xl"
|
||||||
setText={(e) => {
|
label=""
|
||||||
setSearchTxt(e);
|
selectClass={""}
|
||||||
}}
|
selectArray={yearOptions}
|
||||||
/>
|
value={searchYear}
|
||||||
<SelectBox
|
onSelectValue={(val: string | number) =>
|
||||||
className={"col-span-3 w-full h-full text-2xl"}
|
setSearchYear(String(val))
|
||||||
label={"시설구분"}
|
}
|
||||||
selectClass={""}
|
/>
|
||||||
selectArray={rainChkgdn.fcltDiv}
|
</div>
|
||||||
onSelectValue={(val: string | number) =>
|
<div className="col-span-2 flex flex-row space-x-2">
|
||||||
setSelFcltDiv(String(val))
|
<Label className="w-28 mt-2 text-xl text-gray-600">{'시설구분'}</Label>
|
||||||
}
|
<SelectBox
|
||||||
value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val}
|
className={"w-full h-full text-2xl"}
|
||||||
/>
|
label={""}
|
||||||
|
selectClass={""}
|
||||||
|
selectArray={rainChkgdn.fcltDiv}
|
||||||
|
onSelectValue={(val: string | number) =>
|
||||||
|
setSelFcltDiv(String(val))
|
||||||
|
}
|
||||||
|
value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</SearchFormLeft>
|
</SearchFormLeft>
|
||||||
<SearchFormRight>
|
<SearchFormRight
|
||||||
|
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||||
<div className="space-y">
|
<div className="space-y">
|
||||||
<div className="flex flex-row space-x-2">
|
<div className="flex flex-row space-x-2">
|
||||||
<Button
|
<Button
|
||||||
@@ -200,7 +203,7 @@ export default function Page() {
|
|||||||
<Button
|
<Button
|
||||||
size={"sm"}
|
size={"sm"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
clickDelete( deleteIdx,selFcltDiv);
|
clickDelete(deleteIdx, selFcltDiv);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
삭제
|
삭제
|
||||||
@@ -213,8 +216,6 @@ export default function Page() {
|
|||||||
>
|
>
|
||||||
저장
|
저장
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
<div className="flex flex-row space-x-2 pt-3">
|
|
||||||
<Button
|
<Button
|
||||||
size={"sm"}
|
size={"sm"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -249,7 +250,7 @@ export default function Page() {
|
|||||||
handleRswtClick={handleClick}
|
handleRswtClick={handleClick}
|
||||||
rswtChkData={rswtChkgdn.rswtChkRes}
|
rswtChkData={rswtChkgdn.rswtChkRes}
|
||||||
/>
|
/>
|
||||||
) }
|
)}
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -264,7 +265,7 @@ export default function Page() {
|
|||||||
<UiModal
|
<UiModal
|
||||||
open={isRegExcel}
|
open={isRegExcel}
|
||||||
onOpenChange={setIsRegExcel}
|
onOpenChange={setIsRegExcel}
|
||||||
bodyClass={"w-[40vw] max-w-none"}
|
bodyClass={"w-[30vw] max-w-none"}
|
||||||
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
|
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
|
||||||
/>
|
/>
|
||||||
<Toaster position="top-center" />
|
<Toaster position="top-center" />
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn
|
|||||||
import {
|
import {
|
||||||
excelArrayDownload,
|
excelArrayDownload,
|
||||||
excelDownload,
|
excelDownload,
|
||||||
|
yearOptions,
|
||||||
} from "@/components/lib/func/commom";
|
} from "@/components/lib/func/commom";
|
||||||
import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel";
|
import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel";
|
||||||
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
||||||
@@ -22,7 +23,7 @@ import {
|
|||||||
UiModal,
|
UiModal,
|
||||||
} from "@common/business_components/ui";
|
} from "@common/business_components/ui";
|
||||||
import ListDiv from "@common/business_components/ui/list_div";
|
import ListDiv from "@common/business_components/ui/list_div";
|
||||||
import { Button } from "@common/components/ui";
|
import { Button, Label } from "@common/components/ui";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { Toaster } from "react-hot-toast";
|
import { Toaster } from "react-hot-toast";
|
||||||
|
|
||||||
@@ -42,14 +43,15 @@ export default function Page() {
|
|||||||
} = useWrStore((state) => {
|
} = useWrStore((state) => {
|
||||||
return state;
|
return state;
|
||||||
});
|
});
|
||||||
const [searchTxt, setSearchTxt] = useState<string>();
|
|
||||||
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
|
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
|
||||||
const [isModal, setIsModal] = useState({
|
const [isModal, setIsModal] = useState({
|
||||||
open: false,
|
open: false,
|
||||||
data: {},
|
data: {},
|
||||||
});
|
});
|
||||||
|
const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear()));
|
||||||
const cellClick = () => {
|
const cellClick = () => {
|
||||||
if (searchTxt) rainChkSttnSearch(searchTxt, "0");
|
if (searchYear) rainChkSttnSearch(searchYear, "0");
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -103,24 +105,32 @@ const excelDown=() =>{
|
|||||||
<Title title={"지도점검 결과 현황"} />
|
<Title title={"지도점검 결과 현황"} />
|
||||||
<SearchDiv>
|
<SearchDiv>
|
||||||
<SearchFormLeft>
|
<SearchFormLeft>
|
||||||
<SearchInput
|
<div className="col-span-2 flex flex-row space-x-2">
|
||||||
className="col-span-3 my-7 !text-xl"
|
<Label className="w-48 mt-2 text-xl text-gray-600">{'지도점검년도'}</Label>
|
||||||
label=" 지도점검년도"
|
<SelectBox
|
||||||
textValue={searchTxt ?? ""}
|
className="w-full h-full text-2xl"
|
||||||
setText={(e) => {
|
label=""
|
||||||
setSearchTxt(e);
|
selectClass={""}
|
||||||
}}
|
selectArray={yearOptions}
|
||||||
/>
|
value={searchYear}
|
||||||
<SelectBox
|
onSelectValue={(val: string | number) =>
|
||||||
className={"col-span-3 w-full h-full text-2xl"}
|
setSearchYear(String(val))
|
||||||
label={"시설구분"}
|
}
|
||||||
selectClass={""}
|
/>
|
||||||
selectArray={rainChkSttn.fcltDiv}
|
</div>
|
||||||
onSelectValue={(val: string | number) =>
|
<div className="col-span-2 flex flex-row space-x-2">
|
||||||
|
<Label className="w-28 mt-2 text-xl text-gray-600">{'시설구분'}</Label>
|
||||||
|
<SelectBox
|
||||||
|
className={"w-full h-full text-2xl"}
|
||||||
|
label={""}
|
||||||
|
selectClass={""}
|
||||||
|
selectArray={rainChkSttn.fcltDiv}
|
||||||
|
onSelectValue={(val: string | number) =>
|
||||||
setSelFcltDiv(String(val))
|
setSelFcltDiv(String(val))
|
||||||
}
|
}
|
||||||
value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val}
|
value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</SearchFormLeft>
|
</SearchFormLeft>
|
||||||
<SearchFormRight>
|
<SearchFormRight>
|
||||||
<div className="space-y">
|
<div className="space-y">
|
||||||
@@ -133,8 +143,6 @@ const excelDown=() =>{
|
|||||||
>
|
>
|
||||||
조회
|
조회
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
<div className="flex flex-row space-x-2 pt-3">
|
|
||||||
<Button color="green" size={"sm"} onClick={(e) =>{excelDown()}}>
|
<Button color="green" size={"sm"} onClick={(e) =>{excelDown()}}>
|
||||||
다운로드
|
다운로드
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export const chRowspanTable = (
|
|||||||
selectedIds: number[],
|
selectedIds: number[],
|
||||||
handleCellClick: (index: number, headId: string) => void
|
handleCellClick: (index: number, headId: string) => void
|
||||||
) => {
|
) => {
|
||||||
let order =0
|
let order = 0
|
||||||
// rowspan된 셀 렌더링 여부 추적용
|
// rowspan된 셀 렌더링 여부 추적용
|
||||||
const renderedMap = new Map<string, Set<number>>();
|
const renderedMap = new Map<string, Set<number>>();
|
||||||
return (
|
return (
|
||||||
@@ -100,68 +100,73 @@ export const chRowspanTable = (
|
|||||||
{headList
|
{headList
|
||||||
.map((head) => {
|
.map((head) => {
|
||||||
|
|
||||||
|
const key = head.id;
|
||||||
|
const isMerged = head.rowSpan;
|
||||||
|
const value = row[key];
|
||||||
|
// 병합 대상이면 중복 렌더링 여부 판단
|
||||||
|
if (isMerged) {
|
||||||
|
const renderedSet = renderedMap.get(key) ?? new Set<number>();
|
||||||
|
if (renderedSet.has(rowIndex)) {
|
||||||
|
|
||||||
const key = head.id;
|
return null; // 이미 렌더링된 셀은 skip
|
||||||
const isMerged = head.rowSpan;
|
}
|
||||||
const value = row[key];
|
|
||||||
// 병합 대상이면 중복 렌더링 여부 판단
|
|
||||||
if (isMerged) {
|
|
||||||
const renderedSet = renderedMap.get(key) ?? new Set<number>();
|
|
||||||
if (renderedSet.has(rowIndex)) {
|
|
||||||
|
|
||||||
return null; // 이미 렌더링된 셀은 skip
|
const rowspan = row.rowspan ?? 1;
|
||||||
|
for (let i = 0; i < rowspan; i++) {
|
||||||
|
renderedSet.add(rowIndex + i);
|
||||||
|
}
|
||||||
|
renderedMap.set(key, renderedSet);
|
||||||
|
return (
|
||||||
|
<TableCell
|
||||||
|
key={key}
|
||||||
|
rowSpan={rowspan}
|
||||||
|
className="align-middle text-center whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{key === "checkBox" ? (
|
||||||
|
<Checkbox
|
||||||
|
checked={selectedIds.includes(row.chkgdnPk)}
|
||||||
|
onCheckedChange={(checked) =>
|
||||||
|
toggleSelection(row.chkgdnPk, checked === true)
|
||||||
|
}
|
||||||
|
></Checkbox>
|
||||||
|
) : key === "order" ? (
|
||||||
|
++order
|
||||||
|
) : (
|
||||||
|
value
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rowspan = row.rowspan ?? 1;
|
// 기본 셀
|
||||||
for (let i = 0; i < rowspan; i++) {
|
|
||||||
renderedSet.add(rowIndex + i);
|
|
||||||
}
|
|
||||||
renderedMap.set(key, renderedSet);
|
|
||||||
return (
|
return (
|
||||||
<TableCell
|
<TableCell
|
||||||
key={key}
|
key={key}
|
||||||
rowSpan={rowspan}
|
className="text-center whitespace-nowrap"
|
||||||
className="align-middle text-center whitespace-nowrap"
|
onClick={() => handleCellClick(rowIndex, head.id)}
|
||||||
>
|
>
|
||||||
{key === "checkBox" ? (
|
{head.edit === true ? (
|
||||||
<Checkbox
|
<Input
|
||||||
checked={selectedIds.includes(row.chkgdnPk)}
|
className={`${head.type === "number" ? "text-right" : "text-center"} !text-xl`}
|
||||||
onCheckedChange={(checked) =>
|
type={head.type}
|
||||||
toggleSelection(row.chkgdnPk, checked === true)
|
onChange={(e) => {
|
||||||
}
|
handleChange(rowIndex, head.id, e.target.value);
|
||||||
></Checkbox>
|
}}
|
||||||
) : key === "order" ? (
|
value={value}
|
||||||
++order
|
/>
|
||||||
) : (
|
) : (
|
||||||
value
|
(head.id === "totalSplyUswtrUtztnQnt" || head.id === "totalRuseFcltUtztnQnt" || head.id === "splyUswtrUtztnQnt" || head.id === "ruseFcltUtztnQnt") ? (
|
||||||
|
<span className="underline text-blue-600 cursor-pointer">
|
||||||
|
{value}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<>{value}</>
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// 기본 셀
|
})}
|
||||||
return (
|
|
||||||
<TableCell
|
|
||||||
key={key}
|
|
||||||
className="text-center whitespace-nowrap"
|
|
||||||
onClick={() => handleCellClick(rowIndex, head.id)}
|
|
||||||
>
|
|
||||||
{head.edit === true ? (
|
|
||||||
<Input
|
|
||||||
className={`${head.type === "number" ? "text-right" : "text-center"} !text-xl`}
|
|
||||||
type={head.type}
|
|
||||||
onChange={(e) => {
|
|
||||||
handleChange(rowIndex, head.id, e.target.value);
|
|
||||||
}}
|
|
||||||
value={value}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
`${value}`
|
|
||||||
)}
|
|
||||||
</TableCell>
|
|
||||||
);
|
|
||||||
|
|
||||||
})}
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
@@ -170,13 +175,13 @@ export const chRowspanTable = (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const headVisibleChange= (headList: TableUpperProps[] , isEdit :boolean) => {
|
export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean) => {
|
||||||
return headList.forEach(( head) => {
|
return headList.forEach((head) => {
|
||||||
if(head.edit!== undefined)
|
if (head.edit !== undefined)
|
||||||
head.edit=isEdit;
|
head.edit = isEdit;
|
||||||
if(head.id==='checkBox' ){
|
if (head.id === 'checkBox') {
|
||||||
head.visible=false
|
head.visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ export const excelDownload = (
|
|||||||
fileNm: string,
|
fileNm: string,
|
||||||
sampleFile: string,
|
sampleFile: string,
|
||||||
headerRange = "A1:V3",
|
headerRange = "A1:V3",
|
||||||
writeLine=4
|
writeLine = 4
|
||||||
) => {
|
) => {
|
||||||
if (excelList.length === 0) return;
|
if (excelList.length === 0) return;
|
||||||
fetch(`/${sampleFile}`, {}).then(async (response) => {
|
fetch(`/${sampleFile}`, {}).then(async (response) => {
|
||||||
@@ -82,7 +82,7 @@ export const excelDownload = (
|
|||||||
export const excelArrayDownload = (
|
export const excelArrayDownload = (
|
||||||
fileNm: string,
|
fileNm: string,
|
||||||
sampleFile: string,
|
sampleFile: string,
|
||||||
sheetArray:[typeof sheetParameter]
|
sheetArray: [typeof sheetParameter]
|
||||||
) => {
|
) => {
|
||||||
if (!sheetArray) return;
|
if (!sheetArray) return;
|
||||||
fetch(`/${sampleFile}`, {}).then(async (response) => {
|
fetch(`/${sampleFile}`, {}).then(async (response) => {
|
||||||
@@ -132,3 +132,12 @@ export const safeDate = (value: any): Date | undefined => {
|
|||||||
const date = new Date(value);
|
const date = new Date(value);
|
||||||
return isNaN(date.getTime()) ? undefined : date;
|
return isNaN(date.getTime()) ? undefined : date;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
export const yearOptions: { val: string; text: string }[] = Array.from(
|
||||||
|
{ length: currentYear - 1969 },
|
||||||
|
(_, i) => ({
|
||||||
|
val: String(1970 + i),
|
||||||
|
text: `${1970 + i}년`,
|
||||||
|
})
|
||||||
|
);
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
formatCommaNumber,
|
formatCommaNumber,
|
||||||
handleCommaNumberChange,
|
handleCommaNumberChange,
|
||||||
} from "@/components/lib/func/commom";
|
} from "@/components/lib/func/commom";
|
||||||
|
import { formH1Class } from "@/components/lib/class/comClass";
|
||||||
|
|
||||||
export default function HtdflRegForm({
|
export default function HtdflRegForm({
|
||||||
htdflForm,
|
htdflForm,
|
||||||
@@ -82,17 +83,17 @@ export default function HtdflRegForm({
|
|||||||
}, [htdflForm]);
|
}, [htdflForm]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className="!mx-[1.6rem] !p-0r">
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||||
{/* <div className="flex justify-between items-center mx-3"> */}
|
{/* <div className="flex justify-between items-center mx-3"> */}
|
||||||
<div>
|
<div>
|
||||||
<div className="grid grid-cols-12">
|
<div className="grid grid-cols-12 flex items-center card-header">
|
||||||
<h1 className="pl-3 text-xl col-span-10">○온배수 시설 정보</h1>
|
<h1 className="text-2xl font-medium text-label col-span-10">온배수 시설 정보</h1>
|
||||||
<Button
|
<Button
|
||||||
size={"sm"}
|
size={"sm"}
|
||||||
type="submit"
|
type="submit"
|
||||||
className="col-start-12 col-span-1"
|
className="col-start-12 col-span-1">
|
||||||
>
|
|
||||||
저장
|
저장
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -100,14 +101,14 @@ export default function HtdflRegForm({
|
|||||||
|
|
||||||
{isModal && htdflForm != undefined ? <BdstReg form={form} /> : <></>}
|
{isModal && htdflForm != undefined ? <BdstReg form={form} /> : <></>}
|
||||||
{isModal ? (
|
{isModal ? (
|
||||||
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
|
<h1 className="text-xl col-span-10 mt-4">
|
||||||
○ 중수도 시설 정보{" "}
|
온배수 시설 정보{" "}
|
||||||
</h1>
|
</h1>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="grid grid-cols-6 gap-2 mt-4 pl-6">
|
<div className="grid grid-cols-6 gap-2 mt-4">
|
||||||
<div className="col-span-2">
|
<div className="col-span-2">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -165,13 +166,13 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className=" my-4">
|
<div className=" my-4">
|
||||||
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6">
|
<h1 className={formH1Class}>
|
||||||
온배수 시설 운영현황
|
온배수 시설 운영현황
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-10 gap-1 mt-4">
|
<div className="grid grid-cols-10 gap-1 mt-4">
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.orgwtWtritSpt"
|
name="reuseBuilding.0.htdflObj.orgwtWtritSpt"
|
||||||
@@ -207,7 +208,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.wtritEntrcTp"
|
name="reuseBuilding.0.htdflObj.wtritEntrcTp"
|
||||||
@@ -226,7 +227,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.amtgnr"
|
name="reuseBuilding.0.htdflObj.amtgnr"
|
||||||
@@ -245,7 +246,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.prcsProcsYn"
|
name="reuseBuilding.0.htdflObj.prcsProcsYn"
|
||||||
@@ -263,7 +264,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.prcsFcltCpct"
|
name="reuseBuilding.0.htdflObj.prcsFcltCpct"
|
||||||
@@ -282,7 +283,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.fmYn"
|
name="reuseBuilding.0.htdflObj.fmYn"
|
||||||
@@ -300,7 +301,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.utztnCpct"
|
name="reuseBuilding.0.htdflObj.utztnCpct"
|
||||||
@@ -319,7 +320,7 @@ export default function HtdflRegForm({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5 pl-6">
|
<div className="col-span-5">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="reuseBuilding.0.htdflObj.utztnUsg"
|
name="reuseBuilding.0.htdflObj.utztnUsg"
|
||||||
@@ -339,12 +340,12 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className=" my-2">
|
<div className=" my-2">
|
||||||
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 ">
|
<h1 className={formH1Class}>
|
||||||
요구수질
|
요구수질
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
<div className="grid grid-cols-12 gap-4">
|
||||||
<div className="col-span-6">
|
<div className="col-span-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -386,7 +387,7 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
<div className="grid grid-cols-12 gap-4">
|
||||||
<div className="col-span-6">
|
<div className="col-span-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -428,7 +429,7 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
<div className="grid grid-cols-12 gap-4">
|
||||||
<div className="col-span-6">
|
<div className="col-span-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -470,7 +471,7 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
<div className="grid grid-cols-12 gap-4">
|
||||||
<div className="col-span-6">
|
<div className="col-span-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -512,7 +513,7 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
<div className="grid grid-cols-12 gap-4">
|
||||||
<div className="col-span-6">
|
<div className="col-span-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -554,7 +555,7 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
<div className="grid grid-cols-12 gap-4">
|
||||||
<div className="col-span-6">
|
<div className="col-span-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
@@ -597,5 +598,6 @@ export default function HtdflRegForm({
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export default function RainRegForm({
|
|||||||
</div>
|
</div>
|
||||||
{isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>}
|
{isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>}
|
||||||
{isModal ? (
|
{isModal ? (
|
||||||
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
|
<h1 className="pl-3 text-xl col-span-10 mt-4">
|
||||||
빗물이용시설 정보{" "}
|
빗물이용시설 정보{" "}
|
||||||
</h1>
|
</h1>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
Form,
|
Form,
|
||||||
FormField,
|
FormField,
|
||||||
FormUi,
|
FormUi,
|
||||||
|
SelectBox,
|
||||||
Title,
|
Title,
|
||||||
} from "@common/business_components/ui";
|
} from "@common/business_components/ui";
|
||||||
import { Button, Input } from "@common/components/ui";
|
import { Button, Input } from "@common/components/ui";
|
||||||
@@ -37,7 +38,19 @@ export default function ChkgdExcel({ type }: { type: string }) {
|
|||||||
>();
|
>();
|
||||||
const [excelRswtData, setExcelRswtData] = useState<rswtChkZodType[]>();
|
const [excelRswtData, setExcelRswtData] = useState<rswtChkZodType[]>();
|
||||||
|
|
||||||
const defaultValues: z.infer<typeof chkgdRegExcel> = chkgdRegExcel.parse({});
|
const currentYear = new Date().getFullYear();
|
||||||
|
const startYear = 1970;
|
||||||
|
const yearOptions: { val: string; text: string }[] = Array.from(
|
||||||
|
{ length: currentYear - startYear + 1 },
|
||||||
|
(_, i) => {
|
||||||
|
const y = startYear + i;
|
||||||
|
return { val: String(y), text: `${y}년` };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const defaultValues: z.infer<typeof chkgdRegExcel> = chkgdRegExcel.parse({
|
||||||
|
chckYr: String(currentYear)
|
||||||
|
});
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof chkgdRegExcel>>({
|
const form = useForm<z.infer<typeof chkgdRegExcel>>({
|
||||||
resolver: zodResolver(chkgdRegExcel),
|
resolver: zodResolver(chkgdRegExcel),
|
||||||
@@ -178,8 +191,8 @@ export default function ChkgdExcel({ type }: { type: string }) {
|
|||||||
></Title>
|
></Title>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<h3 className="text-2xl font-bold text-gray-900">
|
<h3 className="text-2xl font-bold text-gray-900 mt-1 ml-7">
|
||||||
{"○점검정보 입력"}
|
{"점검정보 입력"}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<Button className="" type="submit">
|
<Button className="" type="submit">
|
||||||
@@ -193,11 +206,13 @@ export default function ChkgdExcel({ type }: { type: string }) {
|
|||||||
name="chckYr"
|
name="chckYr"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormUi label="등록년도">
|
<FormUi label="등록년도">
|
||||||
<Input
|
<SelectBox
|
||||||
className={`text-3xl`}
|
className="w-1/4 text-3xl"
|
||||||
type="text"
|
selectClass={""}
|
||||||
|
label=""
|
||||||
|
selectArray={yearOptions}
|
||||||
value={field.value}
|
value={field.value}
|
||||||
onChange={field.onChange}
|
onSelectValue={(val) => field.onChange(String(val))}
|
||||||
/>
|
/>
|
||||||
</FormUi>
|
</FormUi>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -224,14 +224,14 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
|
|||||||
<Title
|
<Title
|
||||||
title={
|
title={
|
||||||
type === "RNB"
|
type === "RNB"
|
||||||
? "빗물이용시설"
|
? "빗물이용시설 " + "지도점검 결과등록"
|
||||||
: "중수도 이용시설" + "지도점검 결과등록"
|
: "중수도 이용시설 " + "지도점검 결과등록"
|
||||||
}
|
}
|
||||||
></Title>
|
></Title>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<h3 className="text-2xl font-bold text-gray-900">
|
<h3 className="text-2xl font-bold text-gray-900 mt-2 ml-6">
|
||||||
{"○" + "" + `(${obj.bdstNm})`}
|
{`(${obj.bdstNm})`}
|
||||||
</h3>
|
</h3>
|
||||||
{!rainChkSttn.isSttn ? (
|
{!rainChkSttn.isSttn ? (
|
||||||
<Button className="" onClick={allDataUpdate}>
|
<Button className="" onClick={allDataUpdate}>
|
||||||
|
|||||||
@@ -60,19 +60,19 @@ export function GuideDetailsTable({
|
|||||||
<TableCell key={head.id + headIndex} className="w-36" >
|
<TableCell key={head.id + headIndex} className="w-36" >
|
||||||
{head.edit ===true && data.edit !==false?
|
{head.edit ===true && data.edit !==false?
|
||||||
<Input
|
<Input
|
||||||
className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-2xl h-10 w-full`}
|
className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
handleChange(dataIndex, head.id, e.target.value)
|
handleChange(dataIndex, head.id, e.target.value)
|
||||||
}
|
}
|
||||||
value={data[head.id as keyof any] || ""}
|
value={data[head.id as keyof any] ?? ""}
|
||||||
/> : (
|
/> : (
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`
|
||||||
${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
|
${head.id !== "utztnUsgCd" ? "text-right" : "text-center"}
|
||||||
!text-2xl w-full h-10
|
!text-xl w-full h-10
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
{data[head.id as keyof any] || ""}
|
{data[head.id as keyof any] ?? ""}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ export default function LineBarchart({
|
|||||||
className="text-[12px] font-bold"
|
className="text-[12px] font-bold"
|
||||||
tickCount={6}
|
tickCount={6}
|
||||||
orientation="left"
|
orientation="left"
|
||||||
domain={[0, Math.ceil(lineMaxValue * 1.1)]}
|
domain={[0, Math.ceil(lineMaxValue * 1)]}
|
||||||
label={{ value: yFieldText, angle: -90, position: 'insideLeft' }}
|
label={{ value: yFieldText, angle: -90, position: 'insideLeft' }}
|
||||||
/>}
|
/>}
|
||||||
{/* 오른쪽 Y축: barVal */}
|
{/* 오른쪽 Y축: barVal */}
|
||||||
@@ -139,7 +139,7 @@ export default function LineBarchart({
|
|||||||
className="text-[12px] font-bold"
|
className="text-[12px] font-bold"
|
||||||
tickCount={6}
|
tickCount={6}
|
||||||
orientation="right"
|
orientation="right"
|
||||||
domain={[0, Math.ceil(barMaxValue * 1.1)]}
|
domain={[0, Math.ceil(barMaxValue * 1)]}
|
||||||
label={{ value: yFieldText2, angle: -90, position: 'insideRight' }}
|
label={{ value: yFieldText2, angle: -90, position: 'insideRight' }}
|
||||||
reversed={true}
|
reversed={true}
|
||||||
/>}
|
/>}
|
||||||
|
|||||||
@@ -47,7 +47,17 @@ export const excelArrayStyle = async (data: ArrayBuffer, range: [typeof sheetPar
|
|||||||
rangeCells?.style((styleQ)=>{
|
rangeCells?.style((styleQ)=>{
|
||||||
makeCellStyle(styleQ)
|
makeCellStyle(styleQ)
|
||||||
});
|
});
|
||||||
} )
|
|
||||||
|
// 모든 데이터 셀에 세로 가운데 정렬 적용
|
||||||
|
if (item.data && item.data.length > 0) {
|
||||||
|
const numCols = item.data[0]?.length || 0;
|
||||||
|
const numRows = item.data.length;
|
||||||
|
const dataRange = workbook.activeSheet(index)?.sheet(index)?.range(`A1:${String.fromCharCode(65 + numCols - 1)}${numRows}`);
|
||||||
|
dataRange?.style((styleQ) => {
|
||||||
|
styleQ.verticalAlignment("center");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
makeExcelFile(workbook, fileNm)
|
makeExcelFile(workbook, fileNm)
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,30 @@ export const downloadExcel = ({ data, fileName = new Date().getTime().toString()
|
|||||||
excelStyle(XLSX.write(workbook, { bookType: "xlsx", type: "buffer" }), headerRange, fileName);
|
excelStyle(XLSX.write(workbook, { bookType: "xlsx", type: "buffer" }), headerRange, fileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const sheetParameter ={
|
||||||
|
data:[[]], headerNum:0, headerRange:'A1:V3', sheetName:'Sheet1', startCol:0
|
||||||
|
}
|
||||||
|
|
||||||
|
export const downloadMultipleExcel = (fileName = new Date().getTime().toString() + '.xlsx', sheetArray: Array<typeof sheetParameter>): Promise<JSON | undefined> => {
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
for (let i = 0; i < sheetArray.length; i++) {
|
||||||
|
// Create a new worksheet for each sheet
|
||||||
|
const worksheet = XLSX.utils.aoa_to_sheet(sheetArray[i]?.data || [[]]);
|
||||||
|
// Add data to the worksheet starting from the specified header number
|
||||||
|
if (sheetArray&&sheetArray[i]?.headerNum) {
|
||||||
|
XLSX.utils.sheet_add_aoa(worksheet, sheetArray[i]?.data || [[]], { origin: `A${sheetArray[i]?.headerNum}` });
|
||||||
|
}
|
||||||
|
// Append the worksheet to the workbook with the specified sheet name
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, sheetArray[i]?.sheetName);
|
||||||
|
}
|
||||||
|
if (sheetArray.length > 0) {
|
||||||
|
excelArrayStyle(XLSX.write(workbook, { bookType: "xlsx", type: "buffer" }), sheetArray, fileName);
|
||||||
|
}
|
||||||
|
return Promise.resolve(undefined);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export const filePicked=(oFile: File, headerNum:number=0):Promise<JSON | undefined> =>{
|
export const filePicked=(oFile: File, headerNum:number=0, dateType="yyyymmdd"):Promise<JSON | undefined> =>{
|
||||||
// Create A File Reader HTML5
|
// Create A File Reader HTML5
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
return new Promise<JSON | undefined>((resolve, reject) => {
|
return new Promise<JSON | undefined>((resolve, reject) => {
|
||||||
@@ -30,7 +51,7 @@ export const filePicked=(oFile: File, headerNum:number=0):Promise<JSON | undefin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//셀데이터에서 데이트 형식으로 입력하면 yyyymmdd 형식으로 변환
|
//셀데이터에서 데이트 형식으로 입력하면 yyyymmdd 형식으로 변환
|
||||||
const wb = XLSX.read(data, { type: 'binary', cellDates: true, dateNF: "yyyymmdd" });
|
const wb = XLSX.read(data, { type: 'binary', cellDates: true, dateNF: dateType });
|
||||||
let jsonXls: JSON | undefined;
|
let jsonXls: JSON | undefined;
|
||||||
// Loop Over Each Sheet
|
// Loop Over Each Sheet
|
||||||
wb.SheetNames.forEach(function (sheetName,index ) {
|
wb.SheetNames.forEach(function (sheetName,index ) {
|
||||||
@@ -104,7 +125,7 @@ export const filePickedArray=(oFile: File, headerNum:number=0):Promise<JSON[] |
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, headerNum:number=0, headerRange='A1:V3'):Promise<JSON | undefined> =>{ // Create A File Reader HTML5
|
export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, headerNum:number=0, headerRange='A1:V3', startCol?:number):Promise<JSON | undefined> =>{ // Create A File Reader HTML5
|
||||||
return new Promise<JSON | undefined>(() => {
|
return new Promise<JSON | undefined>(() => {
|
||||||
// Ready The Event For When A File Gets Selected
|
// Ready The Event For When A File Gets Selected
|
||||||
const wb = XLSX.read(oFile, { type: 'binary' });
|
const wb = XLSX.read(oFile, { type: 'binary' });
|
||||||
@@ -116,7 +137,8 @@ export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, header
|
|||||||
if (sheet) {
|
if (sheet) {
|
||||||
//오리진 확인 test 필요
|
//오리진 확인 test 필요
|
||||||
// const sheet = XLSX.utils.json_to_sheet(data);
|
// const sheet = XLSX.utils.json_to_sheet(data);
|
||||||
XLSX.utils.sheet_add_aoa(sheet, data, { origin: 'A'+headerNum });
|
const excelStartCol = startCol?startCol.toString():'A';
|
||||||
|
XLSX.utils.sheet_add_aoa(sheet, data, { origin: excelStartCol+headerNum });
|
||||||
// XLSX.utils.book_append_sheet(wb, sheet, 'test');
|
// XLSX.utils.book_append_sheet(wb, sheet, 'test');
|
||||||
await excelStyle(XLSX.write(wb, { bookType: "xlsx", type: "buffer" }), headerRange, fileNm)
|
await excelStyle(XLSX.write(wb, { bookType: "xlsx", type: "buffer" }), headerRange, fileNm)
|
||||||
} else {
|
} else {
|
||||||
@@ -127,9 +149,6 @@ export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, header
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sheetParameter ={
|
|
||||||
data:[[]], headerNum:0, headerRange:'A1:V3'
|
|
||||||
}
|
|
||||||
export const filePickedBlobArray= (oFile: ArrayBuffer,fileNm:string, sheetArray: [typeof sheetParameter]):Promise<JSON | undefined> =>{ // Create A File Reader HTML5
|
export const filePickedBlobArray= (oFile: ArrayBuffer,fileNm:string, sheetArray: [typeof sheetParameter]):Promise<JSON | undefined> =>{ // Create A File Reader HTML5
|
||||||
return new Promise<JSON | undefined> (async () => {
|
return new Promise<JSON | undefined> (async () => {
|
||||||
// Ready The Event For When A File Gets Selected
|
// Ready The Event For When A File Gets Selected
|
||||||
@@ -142,7 +161,8 @@ export const sheetParameter ={
|
|||||||
if (sheet) {
|
if (sheet) {
|
||||||
//오리진 확인 test 필요
|
//오리진 확인 test 필요
|
||||||
// const sheet = XLSX.utils.json_to_sheet(data);
|
// const sheet = XLSX.utils.json_to_sheet(data);
|
||||||
XLSX.utils.sheet_add_aoa(sheet, sheetArray[index].data, { origin: 'A'+sheetArray[index].headerNum });
|
const startCol = sheetArray[index].startCol?sheetArray[index].startCol.toString():'A';
|
||||||
|
XLSX.utils.sheet_add_aoa(sheet, sheetArray[index].data, { origin: startCol+sheetArray[index].headerNum });
|
||||||
// XLSX.utils.book_append_sheet(wb, sheet, 'test');
|
// XLSX.utils.book_append_sheet(wb, sheet, 'test');
|
||||||
} else {
|
} else {
|
||||||
console.error(`Sheet "${sheetName}" is undefined.`);
|
console.error(`Sheet "${sheetName}" is undefined.`);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
function SearchFormRight(props: {children: React.ReactNode}) {
|
function SearchFormRight(props: {children: React.ReactNode, className?: string}) {
|
||||||
return (
|
return (
|
||||||
<div className="w-1/12 mx-5 flex flex-col items-center justify-center space-x-2">
|
<div className={props.className?props.className:`w-1/12 mx-5 flex flex-col items-center justify-center space-x-2 `}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr
|
|||||||
onClick={() => handleCellClick(index, head.id)}
|
onClick={() => handleCellClick(index, head.id)}
|
||||||
key={`cell-${head.id}-${index}`}
|
key={`cell-${head.id}-${index}`}
|
||||||
>
|
>
|
||||||
{String(el[head.id]).includes('.')
|
{typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.')
|
||||||
? String(el[head.id]).split('.').map((part, index) =>
|
? String(el[head.id]).split('.').map((part, index) =>
|
||||||
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
|
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
|
||||||
).join('.')
|
).join('.')
|
||||||
@@ -86,7 +86,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr
|
|||||||
onClick={() => handleCellClick(index, head.id)}
|
onClick={() => handleCellClick(index, head.id)}
|
||||||
key={`cell-${head.id}-${index}`}
|
key={`cell-${head.id}-${index}`}
|
||||||
>
|
>
|
||||||
{String(el[head.id]).includes('.')
|
{typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.')
|
||||||
? String(el[head.id]).split('.').map((part, index) =>
|
? String(el[head.id]).split('.').map((part, index) =>
|
||||||
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
|
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
|
||||||
).join('.')
|
).join('.')
|
||||||
|
|||||||
Reference in New Issue
Block a user