فهرست منبع

fix equip get batch bug

haojianlong 5 سال پیش
والد
کامیت
378fc83120
1فایلهای تغییر یافته به همراه46 افزوده شده و 36 حذف شده
  1. 46 36
      src/components/ledger/handsontables/device.vue

+ 46 - 36
src/components/ledger/handsontables/device.vue

@@ -273,47 +273,57 @@ export default {
           criterias: []
         }
       }
-      if (!!data && data.length) {
-        //一级遍历list
-        data.map(item => {
-          if (!!item.infos) {
-            // 二级遍历对象infos
-            for (let key in item.infos) {
-              //判断是否是设定参数和动态参数
-              if (!!item.infos[key]) {
-                this.tableHeader.map(child => {
-                  //如果一级标签为动态参数或者设定参数放入数据等待请求
-                  if (key == child.InfoPointCode && (child.InputMode == "L" || child.InputMode == "L1" || child.InputMode == "L2" || child.InputMode == "M")) {
-                    param.data.criterias.push({
-                      id: item.id,
-                      code: key
-                    })
-                  }
-                })
-              }
+      //一级遍历list
+      this.tableHeader.map(head => {
+        //如果一级标签为动态参数或者设定参数放入数据等待请求
+        if (
+          head.InputMode == "L" ||
+          head.InputMode == "L1" ||
+          head.InputMode == "L2" ||
+          head.InputMode == "M"
+        ) {
+          data.map(item => {
+            let cur = tools.dataForKey(item, head.Path);
+            if (cur) {
+              param.data.criterias.push({
+                id: item.EquipID,
+                code: head.InfoPointCode
+              });
             }
+          });
+        }
+      })
+      if (param.data.criterias.length) {
+        BeatchQueryParam(param, res => {
+          if (!this.onlyRead) {
+            return false
           }
-        })
-        if (param.data.criterias.length) {
-          BeatchQueryParam(param, res => {
-            if (!this.onlyRead) {
-              return false
-            }
-            this.tableData = data.map(item => {
-              res.Content.map(child => {
-                if (item.id == child.id) {
-                  if (!!child.data || child.data == 0) {
-                    item.infos[child.code] = child.data
-                  } else {
-                    item.infos[child.code] = child.error ? "表号功能号格式错误" : "表号功能号不存在"
-                  }
+          this.tableData = data.map(item => {
+            res.Content.map(child => {
+              if (item.EquipID == child.id) {
+                if (!!child.data || child.data == 0) {
+                  this.tableHeader.map(head => {
+                    if (head.InfoPointCode == child.code) {
+                      tools.setDataForKey(item, head.Path, child.data);
+                    }
+                  });
+                } else {
+                  this.tableHeader.map(head => {
+                    if (head.InfoPointCode == child.code) {
+                      tools.setDataForKey(
+                        item,
+                        head.Path,
+                        child.error ? "表号功能号格式错误" : "表号功能号不存在"
+                      );
+                    }
+                  });
                 }
-              })
-              return item
+              }
             })
-            this.hot.loadData(this.tableData)
+            return item
           })
-        }
+          this.hot.loadData(this.tableData)
+        })
       }
     },
     //修改资产