From 298d99e55ceb27365617187f4f8898204693ff7d Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 21 May 2025 11:56:09 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=EC=98=A8=EB=B0=B0=EC=88=98=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20css=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/htdflReg/page.tsx | 48 +++++++++---------- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 4 +- .../ui/form/fcltReg/htdflReg/htdflRegForm.tsx | 48 ++++++++++--------- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 2 +- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index 7f9b31fbf..c0d6d4377 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -95,7 +95,7 @@ export default function Home() { { @@ -104,8 +104,8 @@ export default function Home() { /> -
- +
+
-
- +
+
-
+
- +
} - bodyClass="w-[68vw] max-w-none h-[90vh]" - open={issNewReg} - onOpenChange={(open) => { - setIsNewReg(open); - }} - /> + body={} + bodyClass="w-[68vw] max-w-none h-[90vh]" + open={issNewReg} + onOpenChange={(open) => { + setIsNewReg(open); + }} + /> - } - onOpenChange={(open) => { - setBdstChgProps({ ...bdstChgProps, isOpen: open }); - } - } - /> - - + } + onOpenChange={(open) => { + setBdstChgProps({ ...bdstChgProps, isOpen: open }); + } + } + /> ); diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 955a4f7d6..1bab8d09a 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -164,11 +164,11 @@ export default function Page() {
- + <Title title={"지도점검 결과 등록"} /> <SearchDiv> <SearchFormLeft> <SearchInput - className="col-span-3 my-7 !text-xl" + className="col-span-3 my-7 !text-xl whitespace-nowrap" label=" 지도점검년도" textValue={searchTxt ?? ""} setText={(e) => { diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index 17027335c..9f6869706 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -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> ); } diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 9cc23d1e9..8c6f5f1db 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -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> ) : ( From 9a854339ab617fd90cefb54cd52fa91dc3b36f61 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Wed, 21 May 2025 13:22:00 +0900 Subject: [PATCH 2/7] =?UTF-8?q?lineBarChcart=20=EC=83=81=EB=8B=A8=20?= =?UTF-8?q?=EC=98=81=EC=97=AD=EC=9D=B4=20=EC=83=9D=EA=B8=B0=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/chart/LineBarChart.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index 17deacd73..2e83458d8 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -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} />} From 56dd0734a0df770d72113b4608a1f775bdca14ad Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Wed, 21 May 2025 16:54:48 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20number?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=84=B8=EC=9E=90=EB=A6=AC=EB=A7=88?= =?UTF-8?q?=EB=8B=A4=20,=20=ED=8F=AC=EB=A7=B7=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/table/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index c9d0bf251..791eddffe 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -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('.') From 07bd859563d03465d81942d121c74476e2d12751 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Thu, 22 May 2025 16:52:31 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=EC=97=91=EC=85=80=20=EB=8B=A4=EC=A4=91=20?= =?UTF-8?q?=EC=8B=9C=ED=8A=B8=20=EB=B0=8F=20=EC=8A=A4=ED=83=80=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/excel/excelStyle.tsx | 12 ++++++- .../src/ui/excel/index.tsx | 32 +++++++++++++++---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/packages/common/business_components/src/ui/excel/excelStyle.tsx b/packages/common/business_components/src/ui/excel/excelStyle.tsx index adc21880b..6674720dc 100644 --- a/packages/common/business_components/src/ui/excel/excelStyle.tsx +++ b/packages/common/business_components/src/ui/excel/excelStyle.tsx @@ -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) diff --git a/packages/common/business_components/src/ui/excel/index.tsx b/packages/common/business_components/src/ui/excel/index.tsx index e33b0c88d..edc1c707a 100644 --- a/packages/common/business_components/src/ui/excel/index.tsx +++ b/packages/common/business_components/src/ui/excel/index.tsx @@ -15,6 +15,27 @@ 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> =>{ @@ -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.`); From 7f7a780b7a1d9aa12a598460ea01ad0f0abdf62c Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 22 May 2025 16:59:14 +0900 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20filePicked=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EC=97=90=20dateType=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/excel/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/excel/index.tsx b/packages/common/business_components/src/ui/excel/index.tsx index edc1c707a..76b4ba2f9 100644 --- a/packages/common/business_components/src/ui/excel/index.tsx +++ b/packages/common/business_components/src/ui/excel/index.tsx @@ -38,7 +38,7 @@ export const downloadMultipleExcel = (fileName = new Date().getTime().toString() }; -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) => { @@ -51,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 ) { From 56596f0a85c7d6e0929347b454176803d7f22df6 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 22 May 2025 17:41:38 +0900 Subject: [PATCH 6/7] =?UTF-8?q?css=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 97 +++++++------- .../prfmncSttn/chkgdnSttn/page.tsx | 48 ++++--- apps/wr/components/lib/func/TableData.tsx | 123 +++++++++--------- apps/wr/components/lib/func/commom.tsx | 15 ++- .../ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx | 29 ++++- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 8 +- .../guideDetailTable/guideDetailTable.tsx | 8 +- 7 files changed, 183 insertions(+), 145 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 1bab8d09a..d0dc1ab47 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -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,40 +126,34 @@ 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 "> @@ -167,26 +161,35 @@ export default function Page() { <Title title={"지도점검 결과 등록"} /> <SearchDiv> <SearchFormLeft> - <SearchInput - className="col-span-3 my-7 !text-xl whitespace-nowrap" - 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" /> diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index 8716c5cbf..b6510fb42 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -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(() => { @@ -111,24 +113,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"> @@ -141,8 +151,6 @@ const excelDown=() =>{ > 조회 </Button> - </div> - <div className="flex flex-row space-x-2 pt-3"> <Button color="green" size={"sm"} onClick={(e) =>{excelDown()}}> 다운로드 </Button> diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index 250a431da..c969c613c 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -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 + } - }); + }); } \ No newline at end of file diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index b1acf43ed..e7e2d4ed1 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -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; -}; \ No newline at end of file +}; + +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}년`, + }) +); \ No newline at end of file diff --git a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx index 976405a0f..5df602771 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx @@ -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), @@ -176,8 +189,8 @@ export default function ChkgdExcel({ type }: { type: string }) { >
-

- {"○점검정보 입력"} +

+ {"점검정보 입력"}

-

- {"○" + "" + `(${obj.bdstNm})`} +

+ {`(${obj.bdstNm})`}

{!rainChkSttn.isSttn ? (