From 605e2212c2b8fe3a07deb66a0925127f08fe6ee7 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Thu, 5 Jun 2025 10:15:20 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EC=A1=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/matDmd/coMatRvw/page.tsx | 2 +- apps/wr/app/matMng/matDmd/coSttn/page.tsx | 44 +++--- .../wr/app/matMng/matDmd/ruseCaseMng/page.tsx | 127 ++++++++++++++++++ .../app/matMng/matDmd/ruseRvwHstry/page.tsx | 2 +- apps/wr/app/page.tsx | 5 + apps/wr/app/store/matDmd/coSttn/headList.tsx | 25 ++-- apps/wr/app/store/matDmd/coSttn/index.tsx | 49 +++++-- .../app/store/matDmd/ruseCaseMng/headList.tsx | 48 +++++++ 8 files changed, 264 insertions(+), 38 deletions(-) create mode 100644 apps/wr/app/matMng/matDmd/ruseCaseMng/page.tsx create mode 100644 apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx diff --git a/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx b/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx index b7bafc693..aeaf07ec8 100644 --- a/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/matDmd/coMatRvw/page.tsx @@ -13,7 +13,7 @@ import { useFieldArray, useForm } from "react-hook-form"; import { z } from "zod"; -export default function coMatRvw() { +export default function CoMatRvw() { const { code, coRvw, } = useWrStore((state) => state); const { coRvwHeadList, } = coRvw; const [fromDate, setFromDate] = useState(new Date()); diff --git a/apps/wr/app/matMng/matDmd/coSttn/page.tsx b/apps/wr/app/matMng/matDmd/coSttn/page.tsx index 06f624a65..3900bf61f 100644 --- a/apps/wr/app/matMng/matDmd/coSttn/page.tsx +++ b/apps/wr/app/matMng/matDmd/coSttn/page.tsx @@ -1,34 +1,51 @@ "use client"; import { useWrStore } from "@/app/store"; -import { Button } from "@common/components/ui"; import { btnClass } from "@/app/store/common/code"; -import ListDiv from "@common/business_components/ui/list_div"; -import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; -import type { customCoBdst } from "@/app/store/matDmd/coReg"; +import type { customCoSttnBdst } from "@/app/store/matDmd/coSttn"; +import { getCityOrSgg, tableData } from "@/components/lib/func/commom"; import { ContentsDiv, SearchBaseForm, Title, - UiModal, UiTable, - type ReturnType, + type ReturnType } from "@common/business_components/ui"; +import ListDiv from "@common/business_components/ui/list_div"; +import { Button } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; export default function coSttn() { - const [bdstTable, setBdstTable] = useState(); + const [bdstTable, setBdstTable] = useState(); const [pageNation, setPageNation] = useState(1); - const { code, coSttn } = useWrStore( - (state) => state - ); - + const { code, coSttn, coSttnInit } = useWrStore((state) => state); + const { coSttnRes } = coSttn; + const ref = useRef({} as ReturnType); - + const codeData = getCityOrSgg(ref); + const excelClick = useCallback(() => { }, []); + useEffect(() => { + if (!coSttn.isInit) { + coSttnInit(codeData ?? "0"); + } + }, [coSttn.isInit, coSttnInit]); + + useEffect(() => { + if (coSttnRes.length > 0 && code.cityCd.length > 0) { + const data = tableData(coSttnRes, { code }); + const chData = data + .map((item: any) => ({ + ...item + })) + // .filter((item: any) => item !== undefined); + setBdstTable(chData); + } + }, [coSttnRes]) + return( <> @@ -86,9 +103,6 @@ export default function coSttn() { - } headlist={coSttn.coSttHeadList} pageSize={20} total={10000} diff --git a/apps/wr/app/matMng/matDmd/ruseCaseMng/page.tsx b/apps/wr/app/matMng/matDmd/ruseCaseMng/page.tsx new file mode 100644 index 000000000..6b0d73fd2 --- /dev/null +++ b/apps/wr/app/matMng/matDmd/ruseCaseMng/page.tsx @@ -0,0 +1,127 @@ +"use client"; +import { useWrStore } from "@/app/store"; +import { getCity } from "@/components/lib/func/commom"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; +import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui"; +import ListDiv from "@common/business_components/ui/list_div"; +import { Button } from "@common/components/ui"; +import { useState } from "react"; + +export default function RuseCaseMng() { + const { code, } = useWrStore((state) => state); + const [selectSgg, setSelectSgg] = useState() + const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); + + const getSelCity = (val: string | number) => { + const cityValue = String(val); + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + setObjSearch({ city: cityValue, sgg: '' }); + }; + + const getSgg = (val: string | number) => { + console.log(val); + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + return ( + <> + +
+
+ + <SearchDiv> + <SearchFormLeft> + <div className="col-span-8 flex flex-row"> + <SelectBox + className="col-span-2 w-1/3 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd || []} + onSelectValue={getSelCity} + /> + <SelectBox + className="col-span-2 w-1/3 h-full text-2xl" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + onSelectValue={getSgg} + /> + <SelectBox + className="col-span-2 w-1/3 h-full text-2xl" + label="용도" + selectClass={""} + selectArray={[]} + onSelectValue={() => { }} + /> + <SelectBox + className="ml-4 col-span-2 w-1/3 h-full text-2xl" + label=" " + selectClass={""} + selectArray={[]} + onSelectValue={() => { }} + /> + <SearchInput + className={"text-2xl"} + label="" + textValue={""} + setText={(e) => { + }} + /> + </div> + + </SearchFormLeft> + <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 + size={"sm"} + onClick={(e) => { }} + > + 조회 + </Button> + <Button + size={"sm"} + onClick={(e) => { }} + > + 엑셀등록 + </Button> + <Button + size={"sm"} + onClick={(e) => { }} + > + 다운로드 + </Button> + <Button + size={"sm"} + onClick={(e) => { }} + > + 양식받기 + </Button> + </div> + </div> + </SearchFormRight> + </SearchDiv> + </div> + </div> + <div className="grid grid-cols-6 gap-4 "> + <div className="col-span-6"> + <ListDiv> + <UiTable + headName={"물재이용사례 현황"} + tableData={[]} + children={undefined} + headlist={[]} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + }} + onPageChange={() => { }} + ></UiTable> + </ListDiv> + </div> + </div> + </ContentsDiv> + </> + ) +} \ No newline at end of file diff --git a/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx b/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx index 9b3d2262f..166e1902c 100644 --- a/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx +++ b/apps/wr/app/matMng/matDmd/ruseRvwHstry/page.tsx @@ -13,7 +13,7 @@ import { useFieldArray, useForm } from "react-hook-form"; import { z } from "zod"; -export default function ruseRvwHstry() { +export default function RuseRvwHstry() { const { code, ruseHstry, } = useWrStore((state) => state); const { ruseHstryHeadList, } = ruseHstry; const [fromDate, setFromDate] = useState<Date>(new Date()); diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index ff6ef558d..4798d2856 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -134,6 +134,11 @@ export default function Home() { <Link href="matMng/matDmd/ruseRvwHstry">재이용검토이력</Link> </Button> </div> + <div className="col-span-2"> + <Button className="w-full"> + <Link href="matMng/matDmd/ruseCaseMng">물재이용사례관리</Link> + </Button> + </div> </div> </div> </div> diff --git a/apps/wr/app/store/matDmd/coSttn/headList.tsx b/apps/wr/app/store/matDmd/coSttn/headList.tsx index 79e5b6a3a..32466f2d1 100644 --- a/apps/wr/app/store/matDmd/coSttn/headList.tsx +++ b/apps/wr/app/store/matDmd/coSttn/headList.tsx @@ -15,41 +15,40 @@ export const coRegExcel = z.object({ export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [ { - id: "ctpv", + id: "ctpvCd", title: "시도", visible: true, }, { - id: "sgg", + id: "sggCd", title: "시군구", visible: true, }, { - id: "coNm", + id: "dmdCoNm", title: "회사명", visible: true, }, { - id: "addr", + id: "daddr", title: "공장주소", visible: true, }, { - id: "bznmNo", + id: "dmdInfoPk", title: "공장관리번호", visible: true, }, { - id: "telNo", + id: "telno", title: "전화번호", visible: true, }, ]; -// id는 다확인해야함 export const coSttNodeListExport: CommonTableProps[] = [ { - id: "ctpv", + id: "ctpvCd", title: "시도", visible: true, row: 1, @@ -57,7 +56,7 @@ export const coSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "sgg", + id: "sggCd", title: "시군구", visible: true, row: 1, @@ -65,7 +64,7 @@ export const coSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "coNm", + id: "dmdCoNm", title: "회사명", visible: true, row: 1, @@ -73,7 +72,7 @@ export const coSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "addr", + id: "daddr", title: "공장주소", visible: true, row: 1, @@ -81,7 +80,7 @@ export const coSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "bznmNo", + id: "dmdInfoPk", title: "공장관리번호", visible: true, row: 1, @@ -89,7 +88,7 @@ export const coSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "telNo", + id: "telno", title: "전화번호", visible: true, row: 1, diff --git a/apps/wr/app/store/matDmd/coSttn/index.tsx b/apps/wr/app/store/matDmd/coSttn/index.tsx index 00157ec6e..702808740 100644 --- a/apps/wr/app/store/matDmd/coSttn/index.tsx +++ b/apps/wr/app/store/matDmd/coSttn/index.tsx @@ -1,16 +1,28 @@ -import type { z } from "zod"; import type { CommonTableProps } from "@/app/store/common/type/headder"; -import { coSttNodeListExport, coSttHeadListExport } from "./headList"; -import type { customCoBdst } from "../../matDmd/coReg"; -import type { sttnHeadListType } from "../coSttn/headList"; +import { fetchType, getFetch } from "@/components/lib/api"; +import { z } from "zod"; +import { coSttHeadListExport, coSttNodeListExport } from "./headList"; // 테이블 헤드 리스트 const coSttNodeList = coSttNodeListExport; const coSttHeadList = coSttHeadListExport; +const coSttnRes: customCoSttnBdst[] = []; + +const coSttnZod = z.object({ + ctpvCd: z.string(), + sggCd: z.string(), + dmdCoNm: z.string().min(1).max(20), + dmdInfoPk: z.string().min(1).min(10).max(14), + daddr: z.string().min(1).min(6).max(20), + telno: z.string().min(11).max(12) + +}); + +export type customCoSttnBdst = z.infer<typeof coSttnZod>; export type coSttnState = { coSttn: { - coSttnRes: customCoBdst[]; + coSttnRes: customCoSttnBdst[]; coSttHeadList: CommonTableProps[]; coSttNodeList: CommonTableProps[]; excelList: []; @@ -19,7 +31,7 @@ export type coSttnState = { }; type coSttnActions = { - + coSttnInit:(con:string) => void }; export type coSttnType = coSttnState & coSttnActions; @@ -28,7 +40,7 @@ export const coSttnStateExport: coSttnState = { coSttn: { coSttHeadList: coSttHeadList, coSttNodeList: coSttNodeList, - coSttnRes: [], + coSttnRes: coSttnRes, excelList: [], isInit: false, }, @@ -38,6 +50,27 @@ export const coSttnActionsExport: (set: any) => coSttnActions = ( set: any ) => { return { - + coSttnInit: async (con: string) => { + try { + + const coSttnRes = await getFetch( + fetchType.WR, + `/reuseFc/request/마인드원/3` + ); + console.log(coSttnRes, "ㅠㅠ") + set((state: coSttnState) => { + return { + ...state, + coSttn: { + ...state.coSttn, + coSttnRes: coSttnRes, + isInit: false, + }, + }; + }); + } catch (e) { + console.log(e) + } + }, } } \ No newline at end of file diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx new file mode 100644 index 000000000..643e61fc5 --- /dev/null +++ b/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx @@ -0,0 +1,48 @@ +import { z } from "zod"; + +export const sttnHeadListType = z.array( + z.object({ + id: z.string(), + title: z.string(), + visible: z.boolean(), + }) +); + +//★☆★☆ 여기서부터 수정하기 ★☆★☆ +export const coRvwHeadListExport: z.infer<typeof sttnHeadListType> = [ + { + id: "ctpv", + title: "시도", + visible: true, + }, + { + id: "sgg", + title: "시군구", + visible: true, + }, + { + id: "coNm", + title: "회사명", + visible: true, + }, + { + id: "addr", + title: "공장주소", + visible: true, + }, + { + id: "telNo", + title: "전화번호", + visible: true, + }, + { + id: "regDt", //바꾸기 + title: "신청일자", + visible: true, + }, + { + id: "state", //바꾸기 + title: "진행상태", + visible: true, + }, +]; \ No newline at end of file