Browse Source

Merge branch 'master' of git.sagacloud.cn:web/ibms

zhangyu 5 years ago
parent
commit
13185f5ddd

+ 7 - 3
src/components/dialogs/list/supplyDialog.vue

@@ -51,6 +51,7 @@
 import myPagination from "@/components/ledger/lib/myPagination";
 import { getListForSupplier } from "@/api/scan/request"
 import tools from "@/utils/scan/tools"
+import { mapGetters, mapActions } from "vuex";
 
 export default {
   components: {
@@ -70,6 +71,9 @@ export default {
       default: 0
     }
   },
+  computed: {
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
+  },
   data() {
     return {
       search: "", //搜索文案
@@ -126,11 +130,11 @@ export default {
       if (!!this.id) {
         let param = {
           data: {
-            projectId: this.$route.query.projId,
+            projectId: this.projectId,
             venderId: this.id
           },
-          ProjId: this.$route.query.projId,
-          secret: this.$route.query.secret,
+          ProjId: this.projectId,
+          secret: this.secret,
         }
         getListForSupplier(param, res => {
           _this.$refs.ruleForm.resetFields()

+ 86 - 40
src/views/ledger/facility/parts/index.vue

@@ -41,6 +41,25 @@
     ></el-pagination>
     <!-- 二维码弹窗 -->
     <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
+    <upload-files-dialog
+      :read="onlyRead ? true : false"
+      ref="upload"
+      @changeFile="fileChange"
+      :keysArr="filesArr"
+      :dialog="myDialog"
+    ></upload-files-dialog>
+    <upload-img-dialog
+      :read="onlyRead ? true : false"
+      @changeFile="imgChange"
+      :keysArr="imgsArr"
+      :dialog="myDialog"
+    ></upload-img-dialog>
+    <pic-dialog
+      :read="onlyRead ? true : false"
+      :dialog="myDialog"
+      :keysArr="picsArr"
+      @change="changePics"
+    ></pic-dialog>
   </div>
 </template>
 <script>
@@ -50,6 +69,16 @@ import showTools from "@/utils/handsontable/notShow";
 import text from "@/utils/handsontable/mainText";
 
 import qrcode from "@/components/ledger/lib/qrcode";
+import firm from "@/components/dialogs/list/firm";
+import supplyDialog from "@/components/dialogs/list/supplyDialog";
+import supplierDialog from "@/components/dialogs/list/supplierDialog";
+import maintainerDialog from "@/components/dialogs/list/maintainerDialog";
+import insurerDialog from "@/components/dialogs/list/insurerDialog";
+import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog";
+import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
+import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
+import picDialog from "@/components/dialogs/list/picDialog";
+import systemType from "@/components/dialogs/list/systemType";
 import handsonTable from "@/components/common/handsontable";
 import {
   getEquipPartsType,
@@ -61,6 +90,16 @@ import { mapGetters, mapActions } from "vuex";
 export default {
   components: {
     qrcode, //二维码页面
+    firm, //品牌型号弹窗
+    supplyDialog,
+    supplierDialog,
+    maintainerDialog,
+    insurerDialog,
+    guaranteeDialog,
+    uploadFilesDialog,
+    uploadImgDialog,
+    picDialog,
+    systemType,
     handsonTable
   },
   data() {
@@ -97,7 +136,6 @@ export default {
         "L2",
         "X"
       ],
-      qrcodeUrl: "",
       myDialog: {
         qrcode: false, //二维码弹窗
         firm: false, //厂商弹窗
@@ -114,7 +152,17 @@ export default {
         details: false, //详情页
         changeRea: false,
         lookPic: false //图片查看
-      }
+      },
+      qrcodeUrl: "", //二维码图片地址
+      filesArr: [], //保存临时的文件key
+      imgsArr: [], //临时保存的图片key数组
+      picsArr: [], //临时设备图片keys数组
+      systemId: null,
+      graphyId: null,
+      mess: {},
+      id: 0,
+      EquipmentList: [],
+      firmId: "" //品牌型号所需字段
     };
   },
   computed: {
@@ -195,12 +243,14 @@ export default {
       arr.map(item => {
         item.Visible = true;
       });
-      let data = showTools.changeHeader(
+      let data = showTools.tableHeadFilter(
         arr,
         this.readArr,
         this.onlyRead,
         false,
-        this.allMess
+        this.allMess,
+        false,
+        true
       );
       data.unshift("查看详情", "当前关联的资产");
       return data;
@@ -212,12 +262,14 @@ export default {
         //缺少信息点
         item.Visible = true;
       });
-      let data = showTools.showHeaderTypes(
+      let data = showTools.tableHeaderTypes(
         arr,
         this.readArr,
         this.onlyRead,
         false,
-        this.allMess
+        this.allMess,
+        false,
+        true
       );
       data.unshift(
         {
@@ -343,10 +395,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 = this.tableData[row.row].DPSupplierID;
+        if (data) {
+          falg = data.split("-")[0];
         }
         if (!!falg) {
           this.id = falg;
@@ -359,10 +410,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 = this.tableData[row.row].DPInsurerID
+        if (data) {
+          falg = data.split("-")[0];
         }
         if (!!falg) {
           this.id = falg;
@@ -371,16 +421,14 @@ export default {
           this.$message("请先选择保险商");
         }
       }
-      //保险文件--设备文档
+      //保险文件--设备文档--安装质检报告
       if (
         val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
-        val == "LedgerParam.PhotoDoc.Archive"
+        val == "LedgerParam.PhotoDoc.Archive" || 
+        val == "LedgerParam.Siteinstall.CheckReport"
       ) {
-        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.myDialog.uploadFiles = true;
       }
       //安装照片--安装图纸--设备铭牌照片--设备图纸
@@ -390,28 +438,14 @@ 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.imgsArr = data? data: []
         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.myDialog.pic = true;
       }
       this.row = row.row;
@@ -461,7 +495,19 @@ export default {
         this.$message.success("删除成功!");
         this.getTypes();
       });
-    }
+    },
+    //上传文件弹窗触发事件
+    fileChange(keys) {
+      this.setDataToMain(keys, this.messKey, this.row);
+    },
+    //上传图片弹窗触发事件
+    imgChange(keys) {
+      this.setDataToMain(keys, this.messKey, this.row);
+    },
+    //设备图片弹窗改变事件
+    changePics(keys) {
+      this.setDataToMain(keys, this.messKey, this.row);
+    },
   }
 };
 </script>

+ 6 - 5
src/views/ledger/facility/partsmanage/addparts/index.vue

@@ -506,7 +506,7 @@ export default {
       //供应合同编号
       if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
         let falg = null;
-        let data = tools.dataForKey(this.tableData[row.row], val)
+        let data = this.tableData[row.row].DPSupplierID;
         if (data) {
           falg = data.split("-")[0];
         }
@@ -521,7 +521,7 @@ export default {
       if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
         //选择保单
         let falg = null;
-        let data = tools.dataForKey(this.tableData[row.row], val)
+        let data = this.tableData[row.row].DPInsurerID
         if (data) {
           falg = data.split("-")[0];
         }
@@ -532,10 +532,11 @@ export default {
           this.$message("请先选择保险商");
         }
       }
-      //保险文件--设备文档
+      //保险文件--设备文档--安装质检报告
       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: []
@@ -554,7 +555,7 @@ export default {
         val == "LedgerParam.PhotoDoc.Drawing"
       ) {
         let data = tools.dataForKey(this.tableData[row.row], val)
-        this.filesArr = data? data: []
+        this.imgsArr = data? data: []
         // if (val == "LedgerParam.PhotoDoc.Nameplate") {
         //   this.imgsArr = this.tableData[row.row].infos
         //     ? this.tableData[row.row].infos[val.split(".")[1]]

+ 14 - 38
src/views/ledger/facility/partsmanage/index.vue

@@ -627,11 +627,7 @@ 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 = this.tableData[row.row].DPSupplierID;
         if (!!falg) {
           this.id = falg;
           this.myDialog.supply = true;
@@ -643,11 +639,7 @@ 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 = this.tableData[row.row].DPInsurerID
         if (!!falg) {
           this.id = falg;
           this.myDialog.guarantee = true;
@@ -655,16 +647,14 @@ export default {
           this.$message("请先选择保险商");
         }
       }
-      //保险文件--设备文档
+      //保险文件--设备文档--安装质检报告
       if (
         val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
-        val == "LedgerParam.PhotoDoc.Archive"
+        val == "LedgerParam.PhotoDoc.Archive" || 
+        val == "LedgerParam.Siteinstall.CheckReport"
       ) {
-        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.myDialog.uploadFiles = true;
       }
       //安装照片--安装图纸--设备铭牌照片--设备图纸
@@ -674,28 +664,14 @@ 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.imgsArr = data? data: []
         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.myDialog.pic = true;
       }
       this.row = row.row;
@@ -722,14 +698,14 @@ export default {
     setDataToMain(data, key, row) {
       if (!!data && data != "--") {
         if (!!this.tableData[row]) {
-          this.tableData[row][key] = data;
+          tools.setDataForKey(this.tableData[row], key, data)
           this.handleUpdataTable([[row, key, null, data]], "edit");
         } 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, "")
       }
     }
   }