浏览代码

完成筛选条件设置和复显的功能

yanglzh 11 月之前
父节点
当前提交
8a1f20f4dc
共有 1 个文件被更改,包括 15 次插入8 次删除
  1. 15 8
      src/views/iot/property/relationship/filter.vue

+ 15 - 8
src/views/iot/property/relationship/filter.vue

@@ -75,16 +75,23 @@ const open = async (row: any) => {
   formData.id = row.id
   formData.id = row.id
   const productKey = row.assetInfo.productKey
   const productKey = row.assetInfo.productKey
 
 
+  const ruleInfo = JSON.parse(row.ruleInfo || '[]')
+
   //获取属性列表
   //获取属性列表
   api.dev_asset_metadata.detail({ productKey }).then((res: any) => {
   api.dev_asset_metadata.detail({ productKey }).then((res: any) => {
-    const list = res.map((row: any) => ({
-      id: row.id,
-      name: row.name,
-      title: row.title,
-      types: row.types,
-      value: null,
-      isCheck: false,
-    }))
+    const list = res.map((row: any) => {
+
+      const hasFindItem = ruleInfo.find((item2: any) => item2.id === row.id)
+      const item = {
+        id: row.id,
+        name: row.name,
+        title: row.title,
+        types: row.types,
+        value: hasFindItem ? hasFindItem.value : null,
+        isCheck: hasFindItem?.isCheck ? true : false,
+      }
+      return item
+    })
     ruleList.value = list
     ruleList.value = list
   })
   })
 };
 };