diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index ac68c4a66..5e4bddaad 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store"; import { ruseUtzType } from "@/app/store/matDmd/ruseCaseMng/headList"; -import { getCity } from "@/components/lib/func/commom"; +import { excelDownload, getCity } from "@/components/lib/func/commom"; import RuseCaseMngExcel from "@/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { @@ -23,36 +23,61 @@ import { useState } from "react"; export default function RuseCaseMng() { const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); - const [selectSgg, setSelectSgg] = useState(); + const [selectSgg, setSelectSgg] = useState([{val: "0", text: "전체"}]); const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); - const [selectUtz, setSelectUtz] = useState(); - const [searchTxt, setSearchTxt] = useState(); - + const [sidoCd, setSidoCd] = useState(""); const [sigunguCd, setSigunguCd] = useState(""); - const [usageCd, setUsageCd] = useState(""); + const [selectUtz, setSelectUtz] = useState(["조경용수"]); const [name, setName] = useState(""); + // 물재이용사례 조회 const searchRuseCaseMng = async () => { - const res = await selectRuseCaseMng(sidoCd, sigunguCd, usageCd, name); + console.log(selectUtz); + const res = await selectRuseCaseMng(sidoCd, sigunguCd, selectUtz, name); console.log('res : ', res); } + // 시도 선택 const getSelCity = (val: string | number) => { const cityValue = String(val); + const cityText = code.cityCd.find((item: any) => item.cityCd === cityValue)?.text; + setSidoCd(cityText || ""); + const data = getCity(cityValue, code.sggCd); setSelectSgg(data); setObjSearch({ city: cityValue, sgg: "" }); }; + // 시군구 선택 const getSgg = (val: string | number) => { + const sggValue = String(val); + const sggText = selectSgg?.find((item: any) => item.sggCd === sggValue)?.sggNm; + setSigunguCd(sggText || ""); setObjSearch({ ...objSearch, sgg: String(val) }); }; + // 엑셀 등록 모달 const [isExcelOpen, setIsExcelOpen] = useState<{ isModal: boolean; }>({ isModal: false }); + // 다운로드 + const download = () => { + console.log("다운로드"); + } + + // 양식받기 + const sampleDownLoad = () => { + excelDownload( + [[]], + "물재이용사례 관리", + "sample_ruseCaseMng.xlsx", + "A1:AX1", + 2 + ); + } + return ( <> @@ -88,9 +113,9 @@ export default function RuseCaseMng() { { - setSearchTxt(e); + setName(e); }} /> @@ -98,7 +123,7 @@ export default function RuseCaseMng() {
- -
@@ -119,16 +144,18 @@ export default function RuseCaseMng() {
- {}} - onPageChange={() => {}} - /> +
+ {}} + onPageChange={() => {}} + /> +
diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx index 274af07af..0b40c1826 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx @@ -1,4 +1,4 @@ -import { fetchType, postFectch } from "@/components/lib/api"; +import { fetchType, getFetch, postFectch } from "@/components/lib/api"; import type { TableUpperProps } from "../../common/type/header"; import { ruseCaseHeadListExport } from "./headList"; import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; @@ -71,8 +71,9 @@ type ruseCaseActions = { export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { const tailUrl = (sidoCd && !sigunguCd ? `/${sigunguCd}` : sigunguCd ? `/${sigunguCd}` : '/0') + (usageCd ? `/${usageCd}` : '') + (name ? `/${name}` : ''); console.log('tailUrl : ', tailUrl); - const response = await postFectch(`/reuseFc/pubFcRuseCase${tailUrl}`, {usageCd, name}, fetchType.WR); - return []; + const resp = await getFetch(fetchType.WR,`/reuseFc/pubFcRuseCase${tailUrl}`); + console.log('resp : ', resp); + return resp; }; export const fetchInsertRuseCaseMng = async (data: any) => { @@ -96,7 +97,7 @@ export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( return { selectRuseCaseMng: async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { const res = await fetchSearchRuseCaseMng(sidoCd, sigunguCd, usageCd, name); - + console.log('res : ', res); set((state: ruseCaseState) => ({ ruseCaseMng: { ...state.ruseCaseMng, diff --git a/apps/wr/public/sample_ruseCaseMng.xlsx b/apps/wr/public/sample_ruseCaseMng.xlsx new file mode 100644 index 000000000..3a88e0623 Binary files /dev/null and b/apps/wr/public/sample_ruseCaseMng.xlsx differ