Browse Source

fix(alarm): alarm config

lind 3 years ago
parent
commit
560eef1a88
1 changed files with 13 additions and 5 deletions
  1. 13 5
      src/pages/rule-engine/Alarm/Configuration/Save/index.tsx

+ 13 - 5
src/pages/rule-engine/Alarm/Configuration/Save/index.tsx

@@ -85,20 +85,28 @@ const Save = (props: Props) => {
   );
 
   const getScene = () => {
+    const map = {
+      product: 'device',
+      device: 'device',
+      org: 'device',
+      other: undefined,
+    };
     return service
       .getScene(
         encodeQuery({
           terms: {
-            triggerType: form.getValuesIn('targetType'),
+            triggerType: map[form.getValuesIn('targetType')],
           },
         }),
       )
       .then((resp) => {
         Store.set('scene-data', resp.result);
-        return resp.result.map((item: { id: string; name: string }) => ({
-          label: item.name,
-          value: item.id,
-        }));
+        return form.getValuesIn('targetType')
+          ? resp.result.map((item: { id: string; name: string }) => ({
+              label: item.name,
+              value: item.id,
+            }))
+          : [];
       });
   };