[st] feat: IMR 검증이력 시도/시군구 셀렉트 API 변경

This commit is contained in:
2026-03-23 17:16:26 +09:00
parent b2d528dc78
commit fe930d4773
3 changed files with 21 additions and 28 deletions
@@ -23,8 +23,9 @@ import {
import dayjs from "dayjs";
import { ENDPOINT } from "@/shared/config";
import { CodeApi, CodeSelect } from "@/entities/code";
import { CodeSelect } from "@/entities/code";
import type {
AdstZoneResponseDto,
StAnlsMstResponse,
StAnlsMstSearchParams,
StAnlsRsltResponse,
@@ -35,6 +36,10 @@ import {
} from "@/entities/statistics";
import { stAnlsMstApi } from "@/entities/statistics/api/statistics-analysis-master-api";
import { imrApi } from "@/entities/statistics/api/imr-api";
import {
useStAnlsSidoCombo,
useStAnlsSigunguCombo,
} from "@/entities/statistics/api/queries";
import { stAnlsRsltApi } from "@/entities/statistics/api/statistics-analysis-result-api";
import {
Button,
@@ -67,6 +72,7 @@ type DateRangeValue = {
};
const EMPTY_DATA: never[] = [];
const EMPTY_ADST_LIST: AdstZoneResponseDto[] = [];
const ImrVerificationHistory = () => {
// Area A Search States
@@ -103,25 +109,10 @@ const ImrVerificationHistory = () => {
pageSize: 5,
});
// Codes for Filter
const { data: lwpoCodes } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.CODE, "LAESECD"],
queryFn: () => CodeApi.getCode("LAESECD"),
});
const sidoOptions = useMemo(() => {
if (!lwpoCodes) return [];
return lwpoCodes.filter(
(c) => c.lwpoCd.startsWith("G3") && c.lwpoCd.length === 4,
);
}, [lwpoCodes]);
const sigunguOptions = useMemo(() => {
if (!lwpoCodes || searchSido === "") return [];
return lwpoCodes.filter(
(c) => c.lwpoCd.startsWith(searchSido) && c.lwpoCd.length === 7,
);
}, [lwpoCodes, searchSido]);
const { data: sidoData } = useStAnlsSidoCombo();
const { data: sigunguData } = useStAnlsSigunguCombo(searchSido);
const sidoOptions = sidoData ?? EMPTY_ADST_LIST;
const sigunguOptions = sigunguData ?? EMPTY_ADST_LIST;
// Area A Data Fetching
const { data: historyData } = useQuery({
@@ -369,10 +360,10 @@ const ImrVerificationHistory = () => {
<SelectContent>
{sidoOptions.map((opt) => (
<SelectItem
key={opt.lwpoCd}
value={opt.lwpoCd}
key={opt.adstCd}
value={opt.adstCd}
>
{opt.lwpoCdNm}
{opt.adstNm}
</SelectItem>
))}
</SelectContent>
@@ -394,10 +385,10 @@ const ImrVerificationHistory = () => {
<SelectContent>
{sigunguOptions.map((opt) => (
<SelectItem
key={opt.lwpoCd}
value={opt.lwpoCd}
key={opt.adstCd}
value={opt.adstCd}
>
{opt.lwpoCdNm}
{opt.adstNm}
</SelectItem>
))}
</SelectContent>
@@ -40,7 +40,9 @@ export class StAnlsMstApiService {
return response.data;
}
public async getSigunguCombo(sidoCd: string): Promise<AdstZoneResponseDto[]> {
public async getSigunguCombo(
sidoCd: string,
): Promise<AdstZoneResponseDto[]> {
const response = await client.get<AdstZoneResponseDto[]>(
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}/sigungu`,
{ params: { sidoCd } },
@@ -57,7 +57,7 @@ export interface StAnlsMstResponseDto {
/**
* 분석 현황 마스터 검색 DTO
*/
export interface StAnlsMstSearchDto extends PageableParams {
export interface StAnlsMstSearchDto extends PageableParams {
/** 분석상태코드 (COMPLETED, FAILED, QUEUED, PROCESSING) */
anlsSttsCd?: string;
/** 작업UUID */