import { request, type ApiResponse } from './request'
|
|
interface DeviceAdapterDto {
|
adapterId: number
|
adapterCode: string
|
adapterName: string | null
|
adapterType: string | null
|
host: string | null
|
connectionStatus: string | null
|
}
|
|
interface DeviceAdapterListResponse extends ApiResponse {
|
rows: DeviceAdapterDto[]
|
}
|
|
export interface DeviceAdapterOption {
|
id: number
|
code: string
|
name: string
|
type: string
|
connectionStatus: string
|
}
|
|
/** 供采集器登记选择「数据来源」:采集器的辅助测量由所链接来源实例提供(ADR-0064)。 */
|
export async function getDeviceAdapterOptions(): Promise<DeviceAdapterOption[]> {
|
const result = await request<DeviceAdapterListResponse>('/system/deviceAdapter/list?pageNum=1&pageSize=200')
|
return (result.rows || []).map(item => ({
|
id: item.adapterId,
|
code: item.adapterCode,
|
name: item.adapterName || item.adapterCode,
|
type: item.adapterType || '-',
|
connectionStatus: item.connectionStatus || '',
|
}))
|
}
|