@@ -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<SelectDataType[] | []>();
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>([{val: "0", text: "전체"}]);
|
||||
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
|
||||
const [selectUtz, setSelectUtz] = useState<string[] | []>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
|
||||
|
||||
const [sidoCd, setSidoCd] = useState<string>("");
|
||||
const [sigunguCd, setSigunguCd] = useState<string>("");
|
||||
const [usageCd, setUsageCd] = useState<string>("");
|
||||
const [selectUtz, setSelectUtz] = useState<string[] | []>(["조경용수"]);
|
||||
const [name, setName] = useState<string>("");
|
||||
|
||||
// 물재이용사례 조회
|
||||
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 (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -88,9 +113,9 @@ export default function RuseCaseMng() {
|
||||
<SearchInput
|
||||
className={"text-2xl"}
|
||||
label="수요처명"
|
||||
textValue={""}
|
||||
textValue={name}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
setName(e);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -98,7 +123,7 @@ export default function RuseCaseMng() {
|
||||
<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={() => {}}>
|
||||
<Button size={"sm"} onClick={() => { searchRuseCaseMng() }}>
|
||||
조회
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={() => { setIsExcelOpen({ isModal: true }); }}>
|
||||
@@ -107,7 +132,7 @@ export default function RuseCaseMng() {
|
||||
<Button size={"sm"} onClick={() => {}}>
|
||||
다운로드
|
||||
</Button>
|
||||
<Button size={"sm"} onClick={() => {}}>
|
||||
<Button size={"sm"} onClick={() => { sampleDownLoad() }}>
|
||||
양식받기
|
||||
</Button>
|
||||
</div>
|
||||
@@ -119,16 +144,18 @@ export default function RuseCaseMng() {
|
||||
<div className="grid grid-cols-6 gap-4">
|
||||
<div className="col-span-6">
|
||||
<ListDiv className="overflow-x-auto">
|
||||
<UiTable
|
||||
headName={"물재이용사례 현황"}
|
||||
tableData={[]}
|
||||
children={undefined}
|
||||
headlist={ruseCaseMng.ruseHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
cellClick={(index: number | undefined, headId: string) => {}}
|
||||
onPageChange={() => {}}
|
||||
/>
|
||||
<div className="w-[350%]">
|
||||
<UiTable
|
||||
headName={"물재이용사례 현황"}
|
||||
tableData={[]}
|
||||
children={undefined}
|
||||
headlist={ruseCaseMng.ruseHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
cellClick={(index: number | undefined, headId: string) => {}}
|
||||
onPageChange={() => {}}
|
||||
/>
|
||||
</div>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user