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