Procházet zdrojové kódy

fix: 修复场景联动的productKey参数

yanglzh před 1 rokem
rodič
revize
7b31ec4905

+ 1 - 1
src/views/iot/property/dossier/edit.vue

@@ -192,7 +192,7 @@ const open = async (row: any, productInfo: any) => {
         }
       }
       //根据产品ID获取设备列表
-      api.device.allList({ productId: productInfo.id }).then((resd: any) => {
+      api.device.allList({ productKey: productInfo.key }).then((resd: any) => {
         deviceList.value = resd.device || [];
       });
     })

+ 7 - 7
src/views/iot/scene/manage/component/actionType/deviceOut.vue

@@ -142,18 +142,18 @@ const selectAction=(val:string)=>{
 const getAction = (val: string) => {
   switch (val) {
     case 'functionCall':
-      product.tabDeviceFucntion.getList({ key: productKey.value }).then((res: any) => {
+      product.tabDeviceFucntion.getList({ productKey: productKey.value }).then((res: any) => {
         functionCallList.value = res
       })
       break;
     case 'getProperties':
-      datahub.node.getpropertyList({ key: productKey.value }).then((re: any) => {
+      datahub.node.getpropertyList({ productKey: productKey.value }).then((re: any) => {
         propertyCallList.value = re;
       });
 
       break;
     case 'setProperties':
-      datahub.node.getpropertyList({ key: productKey.value }).then((re: any) => {
+      datahub.node.getpropertyList({ productKey: productKey.value }).then((re: any) => {
         propertyCallList.value = re;
       });
       break;
@@ -185,8 +185,8 @@ const saveData = () => {
   emit('SetSaveData', newdata);
 }
 
-const getDeviceList = (_id: any) => {
-  product.device.allList({ productId: _id }).then((res: any) => {
+const getDeviceList = (productKey: any) => {
+  product.device.allList({ productKey }).then((res: any) => {
     deviceListData.value = res.device
   })
 }
@@ -197,7 +197,7 @@ const seletChange = (val: string) => {
   if (info) {
     // 重置 deviceKey 的值
     fromData.value.deviceKey = '';
-    getDeviceList(info.id)
+    getDeviceList(info.key)
   }
   saveData();
 }
@@ -208,7 +208,7 @@ onMounted(() => {
     productKey.value = infoc.productKey;
     let info = props.sourceData?.find((pro: testIValueType) => pro.key === infoc.productKey);
     if (info) {
-       getDeviceList(info.id)
+       getDeviceList(info.key)
     }
   }
 

+ 8 - 8
src/views/iot/scene/manage/component/sceneItem.vue

@@ -159,13 +159,13 @@ const seletChange = (index: number, val: string) => {
       'operator': '',
       'value': ''
     }]];
-    getDeviceList(info.id)
+    getDeviceList(info.key)
   }
   EditPen(index);
 }
-const getDeviceList = (_id: any) => {
-  product.device.allList({ productId: _id }).then((res: any) => {
-    deviceListData.value = res.device
+const getDeviceList = (productKey: any) => {
+  product.device.allList({ productKey }).then((res: any) => {
+    deviceListData.value = res.device || []
   })
 }
 const getSelectcolumns=(index: number, val: string) => {
@@ -183,18 +183,18 @@ const getSelectcolumns=(index: number, val: string) => {
 const getAction = (val: string) => {
   switch (val) {
     case 'functionCall':
-      product.tabDeviceFucntion.getList({ key: product_key }).then((res: any) => {
+      product.tabDeviceFucntion.getList({ product_key }).then((res: any) => {
         functionCallList.value = res
       })
       break;
     case 'readAttribute':
-      datahub.node.getpropertyList({ key: product_key }).then((re: any) => {
+      datahub.node.getpropertyList({ product_key }).then((re: any) => {
         propertyCallList.value = re;
       });
 
       break;
     case 'modifyAttribute':
-      datahub.node.getpropertyList({ key: product_key }).then((re: any) => {
+      datahub.node.getpropertyList({ product_key }).then((re: any) => {
         propertyCallList.value = re;
       });
       break;
@@ -268,7 +268,7 @@ const intScenel=()=>{
           let info = props.sourceData?.find((pro: { key: any; }) => pro.key === val.productKey);
 
           if (info) {
-            getDeviceList(info.id)
+            getDeviceList(info.key)
           }
       }
       if(val.triggerType){