- 사업유형 SelectArray에 ‘AAAAA‘ 항목 빼고 '전체' 항목 추가 - 하수관로, 맨홀에도 '전체' 항목 추가 - 맨홀에서 용도 조회 조건이 적용 안되는 에러 수정 - 맨홀 조회 결과 컬럼에서 '재질'을 '용도'로 변경
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import { getCmsData } from "@/components/lib/api";
|
|
|
|
|
|
export type BIZ_CD_TYPE = {
|
|
lwpoCd: string,
|
|
upCd: string,
|
|
lwpoCdNm: string,
|
|
unit: string,
|
|
prntLwpoCd: null
|
|
};
|
|
|
|
export const fetchCtpv = async (set: (state: any) => void) => {
|
|
const url = `/geoserver/hasudo/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=hasudo:tb_ms_ctpv&outputFormat=application/json&propertyName=mctpv_korn_nm,mctpv_cd`;
|
|
const res = await fetch(url).then(res => res.json());
|
|
|
|
const list = res.features
|
|
.map((f: any) => ({
|
|
text: f.properties.mctpv_korn_nm,
|
|
val: f.properties.mctpv_cd,
|
|
}))
|
|
.sort((a, b) => a.text.localeCompare(b.text, 'ko'));
|
|
|
|
console.log('시도 데이터', list);
|
|
set({ ctpv: list });
|
|
};
|
|
|
|
export const fetchSgg = async (set: (state: any) => void) => {
|
|
const url = `/geoserver/hasudo/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=hasudo:tb_ms_sgg&outputFormat=application/json&propertyName=sgg_cd,sgg_korn_nm`;
|
|
const res = await fetch(url).then(res => res.json());
|
|
|
|
const list = res.features
|
|
.map((f: any) => ({
|
|
text: f.properties.sgg_korn_nm,
|
|
val: f.properties.sgg_cd,
|
|
}))
|
|
.sort((a, b) => a.text.localeCompare(b.text, 'ko'));
|
|
|
|
console.log('시군구 데이터', list);
|
|
set({ sgg: list });
|
|
};
|
|
|
|
export const fetchBIZ_SE_CD = async (set: (state: any) => void) => {
|
|
try {
|
|
const res = await getCmsData(`/api/v1/code/cache/BIZSECD`);
|
|
set({ BIZ_SE_CD: res });
|
|
} catch (e: any) {
|
|
// alert("BIZ_SE_CD 데이터 로드 실패: " + e.message);
|
|
console.error("BIZ_SE_CD 데이터 로드 실패:", e);
|
|
}
|
|
};
|
|
|
|
export const fetchBIZ_TY_CD = async (set: (state: any) => void) => {
|
|
try {
|
|
const res = await getCmsData(`/api/v1/code/cache/BIZTYCD`);
|
|
const filtered: BIZ_CD_TYPE[] = Array.isArray(res)
|
|
? (res as BIZ_CD_TYPE[]).filter(item => item?.lwpoCd !== "AQAAA")
|
|
: [];
|
|
set({ BIZ_TY_CD: filtered });
|
|
} catch (e: any) {
|
|
// alert("BIZ_TY_CD 데이터 로드 실패: " + e.message);
|
|
console.error("BIZ_TY_CD 데이터 로드 실패:", e);
|
|
}
|
|
}; |