yeg
4 天以前 f4d7007b89cf565746af4623623a294b82666ff1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 || '',
  }))
}