From 8b6ade0541e7473a597a5c5dc52e001a9cbc8274 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 9 Jul 2025 01:35:29 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMng/coSttn/page.tsx | 55 ++++++++------------ apps/wr/app/store/common/searchCode/index.ts | 3 ++ apps/wr/app/store/matDmd/coSttn/excel.tsx | 7 +-- apps/wr/app/store/matDmd/coSttn/index.tsx | 5 +- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index 781a02210..20a0fa945 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -110,40 +110,32 @@ export default function CoSttn() { } }, [coSttnRes, code]); - // useEffect(() => { - // if (coSttn.excelList.length > 0) { - // if (coSttn.excelList.length === 0) return; - // excelDownload( - // coSttn.excelList, - // "수요처 관리", - // "sample_coSttn.xlsx", - // "A1:H1", - // 2 - // ); - // } - // }, [coSttn.excelList]); + useEffect(() => { + if (coSttn.excelList.length > 0) { + if (coSttn.excelList.length === 0) return; - - const excelClick = useCallback(() => { - // const con = objSearch.sgg ? objSearch.sgg : objSearch.city; - // if (con) coSttnSearch("1", "10000", String(con)); - if(bdstTable){ - const excelData = excelCoSttnParsing(bdstTable); + const coExcel = excelCoSttnParsing(coSttn.excelList, code.cityCd, code.sggCd); excelDownload( - excelData as [], + coExcel as [], "수요처 관리", "sample_coSttn.xlsx", - "A1:G1", + "A1:H1", 2 ); } + }, [coSttn.excelList, code]); - // }, [coSttnSearch, objSearch.city, objSearch.sgg]); -}, [excelDownload, bdstTable]); - const searchClick = () => { + const excelClick = useCallback(() => { const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; + if (con) coSttnSearch("1", "10000", String(con)); + + + }, [coSttnSearch, objSearch.city, objSearch.sgg]); +// }, [excelDownload, bdstTable]); + const searchClick = () => { + const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; if (con) { if (seartchTxt && seartchTxt?.length > 0) { @@ -154,12 +146,6 @@ export default function CoSttn() { } }; - useEffect(() =>{ - - },[pageNation]) - - - return ( <> @@ -249,7 +235,7 @@ export default function CoSttn() { tableData={bdstTable || []} headlist={coSttn.coSttHeadList} pageSize={20} - total={ coSttnResCount || 0 } + total={ coSttnResCount+10 || 0 } cellClick={(index: number | undefined, headId: string) => { setUpdateData(coSttnRes[index as number]); }} @@ -265,7 +251,10 @@ export default function CoSttn() { { setIsDmdModal({ isMoal: false, data: {} as DemandCompType }); @@ -280,9 +269,9 @@ export default function CoSttn() { }} rtnInputData={ async(data) => { const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; - + console.log('data ', data) if(upadateData?.dmdInfoPk){ - + console.log('data ', data) await updateDemandCompany(data as DemandCompType) coSttnInit("1", "13", String(con)); setIsDmdModal({ isMoal: false, data: data as DemandCompType }); diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts index 4e383b4a4..9c0f266ab 100644 --- a/apps/wr/app/store/common/searchCode/index.ts +++ b/apps/wr/app/store/common/searchCode/index.ts @@ -132,6 +132,7 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { let message = ""; if (response.status === 200) { message = "success"; + toast.success('수요처 정보가 변경되었습니다. ' ) } else { message = "fail"; } @@ -144,6 +145,8 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { }); } catch (err) { console.log(err); + toast.success('수요처 정보가 오류입니다. ' ) + } }, getRateFee: async (year: string) => { diff --git a/apps/wr/app/store/matDmd/coSttn/excel.tsx b/apps/wr/app/store/matDmd/coSttn/excel.tsx index 3b6d73c8b..e22f71367 100644 --- a/apps/wr/app/store/matDmd/coSttn/excel.tsx +++ b/apps/wr/app/store/matDmd/coSttn/excel.tsx @@ -1,11 +1,12 @@ +import type { SelectDataType } from "@common/business_components/ui"; import moment from "moment"; -export const excelCoSttnParsing = (data: any[]): string[][] => { +export const excelCoSttnParsing = (data: any[],sidoCode:SelectDataType[] , sggCode:SelectDataType[]): string[][] => { const excelExportData: string[][] = []; data.forEach((item) => { excelExportData.push([ - String(item.cityText)??'', - String(item.sggText)??'', + sidoCode.find((sido) => sido.val === item.ctpvCd.toString().trim() )?.text ?? "", + sggCode.find((sgg) => sgg.val === item.sggCd.toString().trim() )?.text ?? "", item.dmdCoNm ?? "", item.daddr ?? "", String(item.dmdInfoPk ?? ""), diff --git a/apps/wr/app/store/matDmd/coSttn/index.tsx b/apps/wr/app/store/matDmd/coSttn/index.tsx index 4c9a7fcce..d80b36420 100644 --- a/apps/wr/app/store/matDmd/coSttn/index.tsx +++ b/apps/wr/app/store/matDmd/coSttn/index.tsx @@ -77,14 +77,13 @@ export const coSttnActionsExport: (set: any) => coSttnActions = ( `/reuseFc/request/${pageNo}/${pageCnt}/${con}` ); if (Number(pageCnt) >= 10000) { - const coExcel = excelCoSttnParsing(coSttnRes.data); set((state: coSttnState) => { return { ...state, coSttn: { ...state.coSttn, - excelList: coExcel, - isInit: false, + excelList: coSttnRes.data, + //isInit: false, }, }; });