Browse Source

Merge branch 'master' of http://39.106.8.246:3003/web/ibms

haojianlong 5 years ago
parent
commit
dec9ebf7cd

+ 1 - 1
src/assets/scss/point/point_config/common.scss

@@ -48,7 +48,7 @@ body .htFiltersConditionsMenu:not(.htGhostTable) {
 }
 
 .margin5 {
-    margin: 18px 18px 18px 10px;
+    margin: 10px 18px 18px 10px;
 }
 
 .dcenter {

+ 14 - 9
src/components/ledger/handsontables/device.vue

@@ -5,7 +5,7 @@
         style="width:20px;float:left;display:block;height:20px;cursor: pointer;"
         @click="changeAssetsFalg"
       >
-        <i class="el-icon-fa  el-icon-fa-compass"></i>
+        <i v-show="!onlyRead" class="el-icon-fa  el-icon-fa-compass"></i>
       </span>
       <span>当前筛选条件下共{{page.total || '--'}}设备</span>
       <div style="float:right;overflow:hidden;">
@@ -881,18 +881,18 @@ export default {
         let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
           .__arrayMap;
         let infos = this.main[trimmedArr[sortArr[rowArr.row]]];
-        this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
+        this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col }, el);
       } else if (isSort) {
         //排序后的数组
         let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
         let infos = this.main[sortArr[rowArr.row]];
-        this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
+        this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col }, el);
       } else if (trimmedArr.length) {
         let infos = this.main[trimmedArr[rowArr.row]];
-        this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
+        this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col }, el);
       } else {
         let infos = this.main[rowArr.row];
-        this.getInfors(infos, rowArr);
+        this.getInfors(infos, rowArr, el);
       }
     },
 
@@ -1029,7 +1029,7 @@ export default {
     },
 
     //获取到了正确的信息
-    getInfors(infos, row) {
+    getInfors(infos, row, el) {
       //其他的开始判断
       let val = this.hot.colToProp(row.col);
       this.row = row.row
@@ -1037,6 +1037,7 @@ export default {
       this.systemId = infos.id
       if (val == "caozuo") {
          window.open(`http://47.94.89.44:8058/spread?id=${infos.id}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
+         el.target.blur()
         // this.iframeSrc =
         //   process.env.BASE_URL +
         //   ":8889/#/details?perjectId=" +
@@ -1091,9 +1092,13 @@ export default {
         this.filesArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
         this.dialog.uploadFiles = true
       }
-      if (val == "linkName" && this.linkNameFalg) {
-        this.category = this.main[row.row]
-        this.dialog.changeRea = true
+      if (val == "linkName") {
+        if (this.linkNameFalg && !this.onlyRead) {
+          this.category = this.main[row.row]
+          this.dialog.changeRea = true
+        } else if(this.onlyRead) {
+          window.open(`http://47.94.89.44:8058/asset?id=${infos.linkId}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
+        }
       }
       if (val == "infos.EquipQRCode") {
         this.qrcodeUrl = this.main[row.row].infos.EquipQRCode

+ 31 - 0
src/utils/scan/tools.js

@@ -494,6 +494,37 @@ tools.isObjectValueEqual = function (a, b) {//判断两个对象的可枚举属
 
 }
 
+tools.dataForKey = function (data, key) {
+    let arr = key.split(".")
+    if (arr && arr[0]) {
+      for (let i = 0; i < arr.length; i++) {
+        if (arr[i] && data[arr[i]]) {
+            data = data[arr[i]]
+        } else {
+            return ''
+        }
+      }
+      return data
+    }
+}
+
+tools.setDataForKey = function (data, key, value) {
+    let arr = key.split(".")
+    if (arr && arr[0]) {
+      for (let i = 0; i < arr.length; i++) {
+        if (!(arr[i] && data[arr[i]])) {
+            data[arr[i]] = {}
+        }
+        if (value !== undefined) {
+            if (i == arr.length - 1) {
+                data[arr[i]] = value
+            }
+        }
+        data = data[arr[i]]
+      }
+    }
+}
+
 function dateToDate(date) {
     var sDate = new Date();
     if (typeof date == 'object' && typeof new Date().getMonth == "function") {

+ 44 - 37
src/views/ledger/facility/partsmanage/addparts/index.vue

@@ -393,11 +393,11 @@ export default {
     },
     //上传文件弹窗触发事件
     fileChange(keys) {
-      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+      this.setDataToMain(keys, this.messKey, this.row);
     },
     //上传图片弹窗触发事件
     imgChange(keys) {
-      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+      this.setDataToMain(keys, this.messKey, this.row);
     },
     //维修商变更
     changeMaintainer(data) {
@@ -419,7 +419,7 @@ export default {
     },
     //设备图片弹窗改变事件
     changePics(keys) {
-      this.setDataToMain(keys, this.messKey.split(".")[1], this.row);
+      this.setDataToMain(keys, this.messKey, this.row);
     },
     setGraphyId(graphyId, assetGroupList) {
       this.graphyId = graphyId;
@@ -506,10 +506,9 @@ export default {
       //供应合同编号
       if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
         let falg = null;
-        if (!!this.tableData[row.row].infos) {
-          if (!!this.tableData[row.row].infos) {
-            falg = this.tableData[row.row].infos.DPSupplierID.split("-")[0];
-          }
+        let data = tools.dataForKey(this.tableData[row.row], val)
+        if (data) {
+          falg = data.split("-")[0];
         }
         if (!!falg) {
           this.id = falg;
@@ -522,10 +521,9 @@ export default {
       if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
         //选择保单
         let falg = null;
-        if (!!this.tableData[row.row].infos) {
-          if (!!this.tableData[row.row].infos) {
-            falg = this.tableData[row.row].infos.DPInsurerID.split("-")[0];
-          }
+        let data = tools.dataForKey(this.tableData[row.row], val)
+        if (data) {
+          falg = data.split("-")[0];
         }
         if (!!falg) {
           this.id = falg;
@@ -539,11 +537,13 @@ export default {
         val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
         val == "LedgerParam.PhotoDoc.Archive"
       ) {
-        this.filesArr = this.tableData[row.row].infos
-          ? this.tableData[row.row].infos[val.split(".")[1]]
-            ? [this.tableData[row.row].infos[val.split(".")[1]]]
-            : []
-          : [];
+        let data = tools.dataForKey(this.tableData[row.row], val)
+        this.filesArr = data? data: []
+        // this.filesArr = this.tableData[row.row].infos
+        //   ? this.tableData[row.row].infos[val.split(".")[1]]
+        //     ? [this.tableData[row.row].infos[val.split(".")[1]]]
+        //     : []
+        //   : [];
         this.myDialog.uploadFiles = true;
       }
       //安装照片--安装图纸--设备铭牌照片--设备图纸
@@ -553,28 +553,32 @@ export default {
         val == "LedgerParam.PhotoDoc.Nameplate" ||
         val == "LedgerParam.PhotoDoc.Drawing"
       ) {
-        if (val == "LedgerParam.PhotoDoc.Nameplate") {
-          this.imgsArr = this.tableData[row.row].infos
-            ? this.tableData[row.row].infos[val.split(".")[1]]
-              ? [this.tableData[row.row].infos[val.split(".")[1]].key]
-              : []
-            : [];
-        } else {
-          this.imgsArr = this.tableData[row.row].infos
-            ? this.tableData[row.row].infos[val.split(".")[1]]
-              ? [this.tableData[row.row].infos[val.split(".")[1]]]
-              : []
-            : [];
-        }
+        let data = tools.dataForKey(this.tableData[row.row], val)
+        this.filesArr = data? data: []
+        // if (val == "LedgerParam.PhotoDoc.Nameplate") {
+        //   this.imgsArr = this.tableData[row.row].infos
+        //     ? this.tableData[row.row].infos[val.split(".")[1]]
+        //       ? [this.tableData[row.row].infos[val.split(".")[1]].key]
+        //       : []
+        //     : [];
+        // } else {
+        //   this.imgsArr = this.tableData[row.row].infos
+        //     ? this.tableData[row.row].infos[val.split(".")[1]]
+        //       ? [this.tableData[row.row].infos[val.split(".")[1]]]
+        //       : []
+        //     : [];
+        // }
         this.myDialog.uploadImgs = true;
       }
       //设备照片
       if (val == "LedgerParam.PhotoDoc.Pic") {
-        this.picsArr = this.tableData[row.row].infos
-          ? this.tableData[row.row].infos[val.split(".")[1]]
-            ? this.tableData[row.row].infos[val.split(".")[1]]
-            : []
-          : [];
+        let data = tools.dataForKey(this.tableData[row.row], val)
+        this.picsArr = data? data: []
+        // this.picsArr = this.tableData[row.row].infos
+        //   ? this.tableData[row.row].infos[val.split(".")[1]]
+        //     ? this.tableData[row.row].infos[val.split(".")[1]]
+        //     : []
+        //   : [];
         this.myDialog.pic = true;
       }
       this.row = row.row;
@@ -599,17 +603,20 @@ export default {
     },
     //判断是否有值,有值赋值
     setDataToMain(data, key, row) {
+      console.log("start+++++++++++++++++",this.tableData[row])
       if (!!data && data != "--") {
         if (!!this.tableData[row]) {
           //铭牌照片特殊处理
-          this.tableData[row][key] = data;
+          tools.setDataForKey(this.tableData[row], key, data)
+          // this.tableData[row][key] = data;
         } else {
           this.tableData[row] = {};
-          this.tableData[row][key] = data;
+          tools.setDataForKey(this.tableData[row], key, data)
         }
       } else {
-        this.tableData[row][key] = "";
+        tools.setDataForKey(this.tableData[row], key, "")
       }
+      console.log("end+++++++++++++++++",this.tableData[row])
     }
   }
 };

+ 1 - 1
src/views/point/config_point/index.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="saga-config-point">
         <div style="line-height:34px;padding-left:10px">
-            <span style="display:inline-block;height: 34px;line-height:34px;">此项目包括<i style="color:#409EFF;">{{list.length}}</i>个数据源</span>
+            <span style="display:inline-block;height: 35px;line-height:34px;">此项目包括<i style="color:#409EFF;">{{list.length}}</i>个数据源</span>
             <div style="float:right;height:34px;line-height:34px;padding-bottom: 1px;">
                 <el-button @click="sameData">同步配置文件到云端</el-button>
                 <el-button style="width:140px;" @click="addItem">添加数据源</el-button>