Kaynağa Gözat

modify get dynamic data

haojianlong 5 yıl önce
ebeveyn
işleme
926df05307
1 değiştirilmiş dosya ile 58 ekleme ve 8 silme
  1. 58 8
      src/views/ledger/facility/parts/index.vue

+ 58 - 8
src/views/ledger/facility/parts/index.vue

@@ -84,7 +84,8 @@ import {
   getEquipPartsType,
   getDataDictionary,
   getEquipPartsCon,
-  deleteParts
+  deleteParts,
+  BeatchQueryParam
 } from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
 export default {
@@ -220,6 +221,7 @@ export default {
           this.page.pageNumber = response.PageNumber;
           this.page.total = response.Total;
           if (this.tableData && this.tableData.length) {
+            this.getBatch(response.Content)
             this.initTable();
           }
         } else {
@@ -410,7 +412,7 @@ export default {
       if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
         //选择保单
         let falg = null;
-        let data = this.tableData[row.row].DPInsurerID
+        let data = this.tableData[row.row].DPInsurerID;
         if (data) {
           falg = data.split("-")[0];
         }
@@ -424,11 +426,11 @@ export default {
       //保险文件--设备文档--安装质检报告
       if (
         val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
-        val == "LedgerParam.PhotoDoc.Archive" || 
+        val == "LedgerParam.PhotoDoc.Archive" ||
         val == "LedgerParam.Siteinstall.CheckReport"
       ) {
         let data = tools.dataForKey(this.tableData[row.row], val);
-        this.filesArr = data? data: [];
+        this.filesArr = data ? data : [];
         this.myDialog.uploadFiles = true;
       }
       //安装照片--安装图纸--设备铭牌照片--设备图纸
@@ -438,14 +440,14 @@ export default {
         val == "LedgerParam.PhotoDoc.Nameplate" ||
         val == "LedgerParam.PhotoDoc.Drawing"
       ) {
-        let data = tools.dataForKey(this.tableData[row.row], val)
-        this.imgsArr = data? data: []
+        let data = tools.dataForKey(this.tableData[row.row], val);
+        this.imgsArr = data ? data : [];
         this.myDialog.uploadImgs = true;
       }
       //设备照片
       if (val == "LedgerParam.PhotoDoc.Pic") {
-        let data = tools.dataForKey(this.tableData[row.row], val)
-        this.picsArr = data? data: []
+        let data = tools.dataForKey(this.tableData[row.row], val);
+        this.picsArr = data ? data : [];
         this.myDialog.pic = true;
       }
       this.row = row.row;
@@ -508,6 +510,54 @@ export default {
     changePics(keys) {
       this.setDataToMain(keys, this.messKey, this.row);
     },
+    //获取动态参数
+    getBatch(data) {
+      let param = {
+        secret: this.secret,
+        ProjId: this.projectId,
+        data: {
+          criterias: []
+        }
+      };
+      this.tableHeader.map(head => {
+        if (
+          head.InputMode == "L" ||
+          head.InputMode == "L1" ||
+          head.InputMode == "L2"
+        ) {
+          data.map(item => {
+            let cur = tools.dataForKey(item, head.Path);
+            if (cur) {
+              param.data.criterias.push({
+                id: item.EquipID,
+                code: head.Path
+              });
+            }
+          });
+        }
+      });
+      if (param.data.criterias.length) {
+        BeatchQueryParam(param, res => {
+          this.tableData = data.map(item => {
+            res.Content.map(child => {
+              if (item.EquipID == child.id) {
+                if (child.data || child.data == 0) {
+                  tools.setDataForKey(item, child.code, child.data);
+                } else {
+                  tools.setDataForKey(
+                    item,
+                    child.code,
+                    child.error ? "表号功能号格式错误" : "表号功能号不存在"
+                  );
+                }
+              }
+            });
+            return item;
+          });
+          this.tableExample.loadData(this.tableData);
+        });
+      }
+    }
   }
 };
 </script>