st: feat: 일반검증 관리 기능 작업 중
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export { CodeApi } from "./api/code-service";
|
||||
export type { ICode } from "./model/code-interface";
|
||||
export { CodeSelect } from "./ui/code-select";
|
||||
export { CodeSelectWithAll } from "./ui/code-select-with-all";
|
||||
|
||||
export { UpCodeApi } from "./api/upcode-service";
|
||||
export {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
cn,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@common/components";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { CodeApi } from "../api/code-service";
|
||||
|
||||
type CodeSelectProps = {
|
||||
upCd: string;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
} & React.ComponentPropsWithoutRef<typeof Select>;
|
||||
|
||||
function CodeSelectWithAll({
|
||||
upCd,
|
||||
placeholder = "선택",
|
||||
className,
|
||||
...props
|
||||
}: CodeSelectProps) {
|
||||
const { data: code } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.CODE, upCd],
|
||||
queryFn: () => CodeApi.getCode(upCd),
|
||||
enabled: !!upCd,
|
||||
});
|
||||
|
||||
return (
|
||||
<Select {...props}>
|
||||
<SelectTrigger className={cn("w-[12rem]", className)}>
|
||||
<SelectValue placeholder={placeholder} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ALL">전체</SelectItem>
|
||||
{code?.map((item) => (
|
||||
<SelectItem key={item.lwpoCd} value={item.lwpoCd}>
|
||||
{item.lwpoCdNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
|
||||
export { CodeSelectWithAll };
|
||||
@@ -0,0 +1,66 @@
|
||||
import { stClient } from "@/shared/api/client";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
GeneralverificationRequest,
|
||||
GeneralverificationResponse,
|
||||
GeneralverificationService,
|
||||
GeneralverificationInfoResponse,
|
||||
CheckVerificationNameRequest,
|
||||
CheckVerificationNameResponse,
|
||||
UpdateVrfcMasterRequest,
|
||||
UpdateVrfcMasterResponse,
|
||||
RegistVrfcMasterRequest,
|
||||
RegistVrfcMasterResponse,
|
||||
DeleteVrfcMasterResponse,
|
||||
} from "../model/general-verification-interface";
|
||||
|
||||
export class GeneralverificationApiService implements GeneralverificationService {
|
||||
public async getGeneralverificationList(param: GeneralverificationRequest): Promise<GeneralverificationResponse> {
|
||||
const response = await stClient.get<GeneralverificationResponse> (
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/masters`,
|
||||
{ params: param },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getGeneralverificationInfo(param: string): Promise<GeneralverificationInfoResponse> {
|
||||
const response = await stClient.get<GeneralverificationInfoResponse> (
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/masters/${param}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async checkVerificationName(param: CheckVerificationNameRequest): Promise<CheckVerificationNameResponse> {
|
||||
const response = await stClient.get<CheckVerificationNameResponse> (
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/check-name`,
|
||||
{ params: param },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async UpdateVrfcMaster(param: UpdateVrfcMasterRequest): Promise<UpdateVrfcMasterResponse> {
|
||||
const response = await stClient.put<UpdateVrfcMasterResponse> (
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/masters/${param.vrfcSn}`,
|
||||
param,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async RegistVrfcMaster(param: RegistVrfcMasterRequest): Promise<RegistVrfcMasterResponse> {
|
||||
const response = await stClient.post<RegistVrfcMasterResponse> (
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/master`,
|
||||
param,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async DeleteVrfcMaster(param: string): Promise<DeleteVrfcMasterResponse> {
|
||||
const response = await stClient.delete<DeleteVrfcMasterResponse> (
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/${param}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const generalverificationApiService = new GeneralverificationApiService();
|
||||
@@ -1,12 +1,89 @@
|
||||
export interface GeneralverificationList {
|
||||
vrfSn: number;
|
||||
tabNm: string;
|
||||
vrfNm: string;
|
||||
vrfClsCd: string;
|
||||
statsCd: string;
|
||||
vrfcSn: string;
|
||||
vrfcNm: string;
|
||||
vrfcClsfCd: string;
|
||||
vrfcClsfNm: string;
|
||||
trgtStatsCd: string;
|
||||
trgtStatsNm: string;
|
||||
dcptDigtCnt: number;
|
||||
dcptPrcsMthCd: string;
|
||||
dcptPrcsMthNm: string;
|
||||
useYn: string;
|
||||
rgtrId?: string;
|
||||
regDt?: string;
|
||||
mdfrId?: string;
|
||||
mdfcnDt?: string;
|
||||
rgtrId?: string;
|
||||
mdfrId?: string;
|
||||
}
|
||||
|
||||
export interface GeneralverificationRequest {
|
||||
trgtStatsCd?: string;
|
||||
vrfcClsfCd?: string;
|
||||
useYn?: string;
|
||||
}
|
||||
|
||||
export interface GeneralverificationResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: GeneralverificationList[];
|
||||
}
|
||||
|
||||
export interface GeneralverificationInfoResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: GeneralverificationList;
|
||||
}
|
||||
|
||||
export interface CheckVerificationNameRequest {
|
||||
trgtStatsCd: string;
|
||||
vrfcNm: string;
|
||||
vrfcClsfCd: string;
|
||||
}
|
||||
|
||||
export interface CheckVerificationNameResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateVrfcMasterRequest {
|
||||
vrfcSn?: string | null;
|
||||
vrfcNm?: string | null;
|
||||
vrfcClsfCd?: string | null;
|
||||
dcptDigtCnt?: number | null;
|
||||
dcptPrcsMthCd?: string | null;
|
||||
useYn?: string | null;
|
||||
mdfrId?: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateVrfcMasterResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface RegistVrfcMasterRequest {
|
||||
vrfcNm?: string | null;
|
||||
vrfcClsfCd?: string | null;
|
||||
dcptDigtCnt?: number | null;
|
||||
dcptPrcsMthCd?: string | null;
|
||||
rgtrId?: string | null;
|
||||
trgtStatsCd?: string | null;
|
||||
}
|
||||
|
||||
export interface RegistVrfcMasterResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface DeleteVrfcMasterResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface GeneralverificationService {
|
||||
getGeneralverificationList(param: GeneralverificationRequest): Promise<GeneralverificationResponse>;
|
||||
getGeneralverificationInfo(param: string): Promise<GeneralverificationInfoResponse>;
|
||||
checkVerificationName(param: CheckVerificationNameRequest): Promise<CheckVerificationNameResponse>;
|
||||
UpdateVrfcMaster(param: UpdateVrfcMasterRequest): Promise<UpdateVrfcMasterResponse>;
|
||||
RegistVrfcMaster(param: RegistVrfcMasterRequest): Promise<RegistVrfcMasterResponse>;
|
||||
DeleteVrfcMaster(param: string): Promise<DeleteVrfcMasterResponse>;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const generalVerificationMasterSubmitSchema = z
|
||||
.object({
|
||||
vrfcSn: z.string().nullable().optional(),
|
||||
vrfcNm: z.string().min(1, "검증명을 입력하세요"),
|
||||
vrfcClsfCd: z.string().min(1, "검증분류를 선택하세요"),
|
||||
trgtStatsCd: z.string().min(1, "통계항목을 선택하세요"),
|
||||
trgtStatsNm: z.string().nullable().optional(),
|
||||
dcptDigtCnt: z.coerce.number(),
|
||||
dcptPrcsMthCd: z.string().nullable().optional(),
|
||||
useYn: z.string().nullable().optional(),
|
||||
rgtrId: z.string().nullable().optional(),
|
||||
regDt: z.string().nullable().optional(),
|
||||
mdfrId: z.string().nullable().optional(),
|
||||
mdfcnDt: z.string().nullable().optional(),
|
||||
})
|
||||
.refine(
|
||||
(data) => data.dcptDigtCnt === 0 || !!data.dcptPrcsMthCd,
|
||||
{
|
||||
path: ["dcptPrcsMthCd"],
|
||||
message: "소수점 처리방식을 선택하세요",
|
||||
},
|
||||
);
|
||||
|
||||
export type GeneralVerificationMasterSubmitFormData = z.infer<
|
||||
typeof generalVerificationMasterSubmitSchema
|
||||
>;
|
||||
Reference in New Issue
Block a user