Ver código fonte

chore(api): 添加设备工况相关接口

wangcong 2 meses atrás
pai
commit
18101a7870
2 arquivos alterados com 64 adições e 0 exclusões
  1. 35 0
      src/api/index.ts
  2. 29 0
      src/types/index.ts

+ 35 - 0
src/api/index.ts

@@ -15,6 +15,10 @@ import type {
   DeviceParams,
   DevicesList,
   DevicesListItemData,
+  DeviceTypeCount,
+  DevWorkHisDataQuery,
+  DevWorkHistoryData,
+  DevWorkRealTimeData,
   DictTypeData,
   DictTypeDataParams,
   EquipmentDetailsItem,
@@ -268,6 +272,37 @@ export const getDeviceListSimple = async (deviceId: number) => {
   return data;
 };
 
+// 设备工况
+
+export const getDevWorkTypeCount = async (deviceGroupId: number) => {
+  const data = await request<DeviceTypeCount[]>(apiBiz('/deviceCondition/getTypeCount', { deviceGroupId }), {
+    method: 'POST',
+  });
+
+  return data;
+};
+
+export const getDevWorkRealTimeData = async (deviceIds: number[], deviceParamCode: string[]) => {
+  const data = await request<DevWorkRealTimeData[]>(apiBiz('/deviceCondition/getRTDList'), {
+    method: 'POST',
+    body: JSON.stringify({
+      deviceIds,
+      deviceParamCode,
+    }),
+  });
+
+  return data;
+};
+
+export const getDevWorkHistoryData = async (params: DevWorkHisDataQuery) => {
+  const data = await request<DevWorkHistoryData[]>(apiBiz('/deviceCondition/getHisList'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+
+  return data;
+};
+
 // 设备网关
 
 export const deviceGatewayUpdate = async (equipmentUpdateForm: EquipmentUpdateForm[]) => {

+ 29 - 0
src/types/index.ts

@@ -903,6 +903,35 @@ export interface DeviceGroup {
   orgId: number;
 }
 
+export interface DeviceTypeCount {
+  deviceType: number;
+  deviceTypeName: string;
+  count: number;
+}
+
+export interface DevWorkRealTimeData {
+  deviceId: number;
+  deviceParamMapList: {
+    time: string;
+    [key: string]: string | number;
+  }[];
+}
+
+export interface DevWorkHisDataQuery {
+  deviceIds: number[];
+  deviceParamCode: string[];
+  startTime?: string;
+  endTime?: string;
+}
+
+export interface DevWorkHistoryData {
+  deviceId: number;
+  deviceParamMapList: {
+    time: string;
+    [key: string]: string | number;
+  }[];
+}
+
 export interface GatewayInfos {
   id: number;
   createTime: string;