Browse Source

设备动态信息点取值

haojianlong 4 years ago
parent
commit
feb394d70c
1 changed files with 16 additions and 1 deletions
  1. 16 1
      src/components/ledger/handsontables/device.vue

+ 16 - 1
src/components/ledger/handsontables/device.vue

@@ -509,10 +509,21 @@ export default {
         };
         getDataDictionary(params, res => {
           this.tableHeader = res.content;
+          this.codeToDataSource = {}
           this.tableHeader.forEach(item => {
             if (item.path) {
               this.inputMap[item.path] = item;
             }
+            if (item.dataSource) {
+              try {
+                this.codeToDataSource[item.code] = {}
+                item.dataSource.forEach(dic => {
+                  this.codeToDataSource[item.code][dic.code] = dic.name;
+                })
+              } catch (e) {
+                console.log(e);
+              }
+            }
           });
           this.getTableData();
           this.getAllData();
@@ -676,7 +687,11 @@ export default {
                 if (!!child.data || child.data == 0) {
                   this.tableHeader.map(head => {
                     if (head.code == child.infoCode) {
-                      tools.setDataForKey(item, head.path, child.data);
+                      let contentVal = child.data
+                      if (this.codeToDataSource[child.infoCode]) {
+                        contentVal = this.codeToDataSource[child.infoCode][child.data]
+                      }
+                      tools.setDataForKey(item, head.path, contentVal);
                     }
                   });
                 } else {