Bläddra i källkod

chore(api): 添加 AI 智控相关接口

wangcong 2 veckor sedan
förälder
incheckning
eb12ab62c0
2 ändrade filer med 71 tillägg och 1 borttagningar
  1. 64 1
      src/api/index.ts
  2. 7 0
      src/types/index.ts

+ 64 - 1
src/api/index.ts

@@ -5,6 +5,11 @@ import { request } from '@/utils';
 import type {
   AddInterface,
   AgreementUpdate,
+  AIAdvancedDeviceItem,
+  AIOptimizeDetail,
+  AIStartStopDeviceItem,
+  AIStartStopDeviceParams,
+  AIStartStopOptimizeInfo,
   AlarmEvent,
   AlarmEventHistoryItemData,
   AlarmHistory,
@@ -275,7 +280,7 @@ export const getAlgorithmConfigInfo = async (devGroupId: number) => {
   return data;
 };
 
-export const addAlgorithmConfigUpdate = async (params: AlgorithmConfigInfo) => {
+export const addAlgorithmConfigUpdate = async (params: Partial<AlgorithmConfigInfo>) => {
   await request(apiBiz('/algorithmConfig/update'), {
     method: 'POST',
     body: JSON.stringify(params),
@@ -1081,3 +1086,61 @@ export const getGroupModuleDevStatus = async (groupId: number) => {
     }),
   });
 };
+
+// AI智能启停和寻优,高级设置
+
+export const getAIStartStopData = async (groupId: number, startType: number) => {
+  const data = await request<AIStartStopDeviceItem[]>(apiBiz('/moduleInfoAi/info/startType'), {
+    method: 'POST',
+    body: JSON.stringify({
+      groupId,
+      startType,
+    }),
+  });
+
+  return data;
+};
+
+export const updateAIStartStopData = async (params: AIStartStopDeviceParams) => {
+  await request(apiBiz('/moduleInfoAi/update/startType'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+};
+
+export const getAIOptimizeDetail = async (groupId: number, deviceType: number) => {
+  const data = await request<AIOptimizeDetail>(apiBiz('/moduleInfoAi/infoDetail'), {
+    method: 'POST',
+    body: JSON.stringify({
+      groupId,
+      deviceType,
+    }),
+  });
+
+  return data;
+};
+
+export const updateAIStartStopOptimize = async (params: AIStartStopOptimizeInfo) => {
+  await request(apiBiz('/moduleInfoAi/update'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+};
+
+export const updateAIOptimizeSetting = async (params: AIOptimizeDetail) => {
+  await request(apiBiz('/moduleInfoAi/update/infoDetail'), {
+    method: 'POST',
+    body: JSON.stringify(params),
+  });
+};
+
+export const getAIAdvancedSetting = async (groupId: number) => {
+  const data = await request<AIAdvancedDeviceItem[]>(apiBiz('/moduleInfoAi/info/advancedSetting'), {
+    method: 'POST',
+    body: JSON.stringify({
+      groupId,
+    }),
+  });
+
+  return data;
+};

+ 7 - 0
src/types/index.ts

@@ -2240,6 +2240,13 @@ export interface AIOptimizeDeviceItem {
   enableCopSet: boolean;
 }
 
+export interface AIAdvancedDeviceItem {
+  device: string;
+  dataMap: {
+    [key: string]: string | number | null | undefined;
+  };
+}
+
 export interface UploadLogo {
   etag: string;
   versionId: string;