물재이용 지도 전반적인 수정 트리에서 클릭시 까지 완료(검색바 해야함)
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
import { fetchType, getFetchWithCount } from "@/components/lib/api";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { customLdrmnt } from "../../matDmd/ldrmntCoSttn";
|
||||
import {
|
||||
ldrmntHeadListExport,
|
||||
ldrmntNodeListExport,
|
||||
} from "../../matDmd/ldrmntCoSttn/headList";
|
||||
|
||||
|
||||
export const ldrmntMapSize = 20;
|
||||
export type ldrmntMapState = {
|
||||
ldrmntMap: {
|
||||
ldrmntMapHeadList: CommonTableProps[];
|
||||
ldrmntMapNodeList: CommonTableProps[];
|
||||
isInit: boolean;
|
||||
ldrmntMapRes: customLdrmnt[];
|
||||
ldrmntMapResCount: number;
|
||||
};
|
||||
};
|
||||
|
||||
type ldrmntMapActions = {
|
||||
ldrmntMapInit: (page: number, total: number, con: string) => void;
|
||||
ldrmntMapSearch: (
|
||||
page: number,
|
||||
total: number,
|
||||
con: string,
|
||||
coNm: string
|
||||
) => void;
|
||||
};
|
||||
|
||||
export type ldrmntMapType = ldrmntMapState & ldrmntMapActions;
|
||||
|
||||
export const ldrmntMapStateExport: ldrmntMapState = {
|
||||
ldrmntMap: {
|
||||
ldrmntMapHeadList: ldrmntHeadListExport,
|
||||
ldrmntMapNodeList: ldrmntNodeListExport,
|
||||
isInit: false,
|
||||
ldrmntMapRes: [],
|
||||
ldrmntMapResCount: 1,
|
||||
},
|
||||
};
|
||||
|
||||
export const ldrmntMapActionsExport: (set: any) => ldrmntMapActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
ldrmntMapInit: async (page: number, total: number, con: string) => {
|
||||
try {
|
||||
const ldrmntMapRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/request/temp/${page}/${total}/${con}`
|
||||
);
|
||||
|
||||
set((state: ldrmntMapState) => {
|
||||
return {
|
||||
...state,
|
||||
ldrmntMap: {
|
||||
...state.ldrmntMap,
|
||||
ldrmntMapRes: ldrmntMapRes.data,
|
||||
ldrmntMapResCount: ldrmntMapRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
ldrmntMapSearch: async (
|
||||
page: number,
|
||||
total: number,
|
||||
con: string,
|
||||
coNm: string
|
||||
) => {
|
||||
let searchUrl = "";
|
||||
|
||||
if (con !== "") {
|
||||
if (coNm !== "") {
|
||||
searchUrl = `/reuseFc/request/temp/${page}/${total}/${con}/${coNm}`;
|
||||
} else {
|
||||
searchUrl = `/reuseFc/request/temp/${page}/${total}/${con}`;
|
||||
}
|
||||
}
|
||||
try {
|
||||
const ldrmntMapRes = await getFetchWithCount(fetchType.WR, searchUrl);
|
||||
set((state: ldrmntMapState) => {
|
||||
return {
|
||||
...state,
|
||||
ldrmntMap: {
|
||||
...state.ldrmntMap,
|
||||
ldrmntMapRes: ldrmntMapRes.data,
|
||||
ldrmntMapResCount: ldrmntMapRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user