import { defHttp } from '#/api/request';
|
|
/** 正式路径:/api/tms/place/** */
|
const prefix = '/api/tms/place';
|
|
export interface PlaceOption {
|
id: string;
|
placeNo?: string;
|
fullName: string;
|
placeGroup?: string;
|
}
|
|
async function unwrapData<T>(promise: Promise<any>): Promise<T> {
|
const res = await promise;
|
if (res && typeof res === 'object' && 'data' in res && ('code' in res || 'msg' in res)) {
|
return res.data as T;
|
}
|
return res as T;
|
}
|
|
/** 启用中的培训地点(来自培训地点管理 / tms_place) */
|
export function getPlaceOptions() {
|
return unwrapData<PlaceOption[]>(defHttp.get({ url: `${prefix}/options` }));
|
}
|