diff --git a/apps/wr/app/base.tsx b/apps/wr/app/base.tsx new file mode 100644 index 000000000..8ffaa42fe --- /dev/null +++ b/apps/wr/app/base.tsx @@ -0,0 +1,24 @@ +"use client" +import { BaseLayout } from "@common/components/ui" +import { useWrStore } from "./store" +import { MainDiv } from "@common/business_components/ui" +import type { MenuItem } from "./store/common/type/menu" +import { useRouter } from "next/navigation" +export default function Base({ + children, +}: Readonly<{ + children: React.ReactNode +}>) { + const { getMenuAuthrts } = useWrStore((state) => state) + const router = useRouter() + + const changeMenu = (path: MenuItem) => { + getMenuAuthrts(path.menuCd) + router.push(path.urlPath) + } + return ( + + {children} + + ) +} diff --git a/apps/wr/app/layout.tsx b/apps/wr/app/layout.tsx index 38ce0ec4b..add988817 100644 --- a/apps/wr/app/layout.tsx +++ b/apps/wr/app/layout.tsx @@ -1,12 +1,10 @@ -'use client' -import { BaseLayout } from "@common/components"; +"use client"; import "./globals.css"; -import { StoreProvider } from "./store"; -import { MainDiv } from "@common/business_components"; -import koBase from '../public/locales/ko/message.json'; +import { StoreProvider} from "./store"; +import koBase from "../public/locales/ko/message.json"; import i18next from "i18next"; import { I18nextProvider } from "react-i18next"; -import { useRouter } from "next/navigation"; +import Base from "./base"; export default function RootLayout({ children, @@ -14,34 +12,26 @@ export default function RootLayout({ children: React.ReactNode; }>) { i18next.init({ - lng: 'ko', - fallbackLng: 'ko', + lng: "ko", + fallbackLng: "ko", resources: { ko: { base: koBase, }, - } + }, }); - const router = useRouter(); - return ( - { - router.push(e.urlPath) - }} - > - - {children} - - + + {children} + - + ); } diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index a1f484b83..d33611128 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -316,7 +316,7 @@ export default function CoMatRvw() { control={form.control} name="dmndQty" render={({ field }) => ( - + ( String(new Date().getFullYear()) @@ -116,53 +113,65 @@ export default function RuseRvwHstry() { } }; - const form = useForm({ - resolver: zodResolver(DmdCoReqSchema), - mode: "onChange", - }); - const TableCellClick = useCallback( - (index: number | undefined) => { - if ( - index !== undefined && - index >= 0 && - rvwHistRes && - rvwHistRes[index] - ) { - form.reset(rvwHistRes[index]); + (index: number | undefined, headId: string) => { + if (index !== undefined && index >= 0) { + const selectedData = rvwHistData; + if (selectedData && selectedData.length > 0) { + if ( + selectedData[index]?.splyFcltFlg === "검토완료" && + headId === "completeYn" + ) { + setRvwHistData([...selectedData]); + } else if ( + selectedData[index]?.splyFcltFlg === "매칭완료" && + headId === "completeYn" + ) { + toast.error(t("canNotChangeMatStateMsg")); + return; + } + } } }, - [rvwHistRes, form] + [rvwHistData] ); const confrirmToast = () => { const completeData = rvwHistData ?.map((item) => { - form.clearErrors(); - if (item?.completeYn) { + if (item?.completeYn.chk && item.splyFcltFlg === "검토완료") { return Number(item.dmdInfoSn); } }) .filter((item) => item !== undefined); - if (form.formState.isDirty) { - toast((t) => ( - - 표준공사비 정보가 변경되었습니다. 검토 완료 진행시 입력한 정보는 - 초기화 됩니다. -
- 진행하시겠습니까? - - -
- )); + + if (completeData && completeData?.length > 0) { + confirmToast(t('isMatchFinishMsg'), () => ruseRvwComplete(completeData as number[])); + + // const handleConfirm = async () => { + // ruseRvwComplete(completeData as number[]); + // }; + // toast((t) => ( + // + // 매칭완료를 진행하시겠습니까? + //
+ //
+ // + // + //
+ //
+ // )); } else { - ruseRvwComplete(completeData as number[]); + toast.error( t('isNotMatchFinishMsg')); } }; useEffect(() => { @@ -203,11 +212,10 @@ export default function RuseRvwHstry() { rvwCmptnYmd: formatDate(item.demandMatching?.rvwCmptnYmd), mtchnCmptnYmd: formatDate(item.demandMatching?.mtchnCmptnYmd), - ruseUtztnFcltNm: item.ruseUtztnFcltNm, dmndQty: item.dmndQty, splyFcltFlg: flag, - completeYn: false, + completeYn: {chk:flag=="매칭완료", readonly:flag=="매칭완료"}, } as unknown as RvwHistTableType; }); @@ -215,9 +223,6 @@ export default function RuseRvwHstry() { } }, [rvwHistRes]); - useEffect(() => { - console.log("변경여부 ", form.formState.isDirty); - }, [form.formState]); return ( @@ -301,7 +306,7 @@ export default function RuseRvwHstry() { 조회 @@ -319,18 +324,14 @@ export default function RuseRvwHstry() { headlist={ruseHistHeadList} pageSize={20} total={rvwHistCount} - cellClick={(index: number | undefined) => { - TableCellClick(index); + cellClick={(index: number | undefined, headId: string) => { + console.log("테이블 클릭", index); + TableCellClick(index, headId); }} onPageChange={(page) => { setPageNatiion(page); }} > - {/*
-

- 수요신청 상세현황 -

- */} diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index d385493d9..992b1bdd1 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -101,7 +101,9 @@ export default function CoSttn() { ...item, telno: formatPhoneNumber(item.telno || undefined), regDt: moment(item.regDt).format("YYYY-MM-DD"), - })); + dmdInfoId: `${item.dmdInfoId.slice(0, 3)}-${item.dmdInfoId.slice(3, 5)}-${item.dmdInfoId.slice(5,10)}-${item.dmdInfoId.slice(10)}` + })); + console.log("chData:", chData) // .filter((item: any) => item !== undefined); setBdstTable(chData); } else if (coSttnRes?.length == 0) { diff --git a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx index 910923499..36a8b7151 100644 --- a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx @@ -43,8 +43,9 @@ export default function LdrmntCoSttn() { const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); const [bdstTable, setBdstTable] = useState(); const [searchTxt, setSearchTxt] = useState(); - const [excelData, setExcelData] = useState(); + const [excelData, setExcelData] = useState() const [resetPage, isResetPage] = useState(false); + const [isDownloadClicked, setIsDownloadClicked] = useState(false); const { t } = useTranslation('base'); const excelClick = useCallback(() => { @@ -79,10 +80,31 @@ export default function LdrmntCoSttn() { const excelDownloadClick = useCallback(() => { const cityNm = computeCityNm(); + setExcelData(undefined); + setIsDownloadClicked(true); ldrmntSearch(true, 1, String(ldrmntResCount), cityNm, searchTxt || ""); }, [objSearch, searchTxt, code, ldrmntSearch, computeCityNm, ldrmntResCount]); useEffect(() => { + const transData = Array.isArray(excelList) ? excelList : [excelList]; + const exData = tableData(transData, { code }); + const data = Array.isArray(exData) + ? exData.map((item: customLdrmnt) => { + return { + "시도": item.fctryAddr?.split(" ")[0] || "", + "시군구": item.fctryAddr?.split(" ")[1] || "", + "회사명": item.dmdCoNm, + "공장주소": item.fctryAddr, + "공장관리번호": item.fctryMngNo, + "전화번호": item.telno + } + }) : []; + setExcelData(data) + }, [excelList]) + + useEffect(() => { + if (!isDownloadClicked) return; + if (excelData === undefined) return; if (excelData && excelData.length > 0) { downloadExcel({ data: excelData, @@ -93,7 +115,8 @@ export default function LdrmntCoSttn() { } else { toast.error(t('excelDownErrMsg')); } - }, [excelData]); + setIsDownloadClicked(false); + }, [excelData, isDownloadClicked]); const [isExcelOpen, setIsExcelOpen] = useState<{ isModal: boolean; @@ -125,7 +148,7 @@ export default function LdrmntCoSttn() { useEffect(() => { if (!ldrmnt.isInit) { - ldrmntInit("0"); + ldrmntInit(false, "0"); } }, [ldrmnt.isInit, ldrmntInit]); @@ -144,23 +167,6 @@ export default function LdrmntCoSttn() { setBdstTable(tbData); }, [ldrmntRes, code]); - useEffect(() => { - const transData = Array.isArray(excelList) ? excelList : [excelList]; - const exData = tableData(transData, { code }); - const data = Array.isArray(exData) - ? exData.map((item: customLdrmnt) => { - return { - "시도": item.fctryAddr?.split(" ")[0] || "", - "시군구": item.fctryAddr?.split(" ")[1] || "", - "회사명": item.dmdCoNm, - "공장주소": item.fctryAddr, - "공장관리번호": item.fctryMngNo, - "전화번호": item.telno - } - }) : []; - setExcelData(data) - }, [excelList]) - useEffect(() => { ldrmntSearch(false, pageNation, '20', computeCityNm(), searchTxt || ""); isResetPage(false) @@ -264,10 +270,6 @@ export default function LdrmntCoSttn() { }} bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"} body={ { - // confirmToast(t('isUpdateMsg'), await ldrmntUpdate(value)) - // // await ldrmntUpdate(value) - // setDetailModal({ ...detailModal, isOpen: false }) - // ldrmntSearch(false, pageNation, '20', computeCityNm(), searchTxt || ""); const handleConfirm = async () => { await ldrmntUpdate(value); setDetailModal({ ...detailModal, isOpen: false }); @@ -286,12 +288,8 @@ export default function LdrmntCoSttn() { body={ setIsExcelOpen({ isModal: isOpen })} />} /> - -
- ) - } \ No newline at end of file diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 5a962fc0a..614a8f90e 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -364,6 +364,7 @@ export default function PublicReuseFaciltyInsert() { setIndexMng(index); }} indexMng={indexMng} + readonly={false} /> diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 5f81a0ae8..bd0b9bb8e 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -3,7 +3,7 @@ import { useWrStore } from "@/app/store"; import { type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { tableData } from "@/components/lib/func/commom"; +import { formatCommaNumber, tableData } from "@/components/lib/func/commom"; import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm"; import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { @@ -52,7 +52,7 @@ export default function Home() { : "확인불가"; return { ...item, - archArea: archArea, + archArea: formatCommaNumber(archArea), }; } diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index 147b9a674..46528bcf7 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -166,8 +166,8 @@ export default function HtdflSttn() { value={objSearch.sgg} // value props 추가 onSelectValue={getSgg} /> -
-