zhangyu 5 vuotta sitten
vanhempi
commit
6551637508

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

@@ -204,10 +204,6 @@ export default {
     }
   },
   methods: {
-    //触发父组件change
-    getClose(val) {
-      this.$emit("close", val)
-    },
     //获取表头
     getHeaderData(code) {
       this.page.currentPage = 1
@@ -540,6 +536,7 @@ export default {
     async removeDevice(param) {
       await deleteEquip(param, res => {
         this.$message.success("删除成功")
+        this.$emit('close','')
         this.getTableData()
       })
     },

+ 33 - 28
src/views/ledger/facility/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <div id="deviceList">
+  <div id="deviceList">
     <router-link to="/ledger/facility/addfacility"></router-link>
     <router-view></router-view>
     <saga-title :mess="mess"></saga-title>
@@ -21,8 +21,8 @@ import hansonTable from "@/components/ledger/handsontables/device";
 import tableTransfers from "@/components/ledger/tableTransfers";
 import { getNumber, getFamilyList, getSpaceName, getGraphyId, getEquipmentFamily } from "@/api/scan/request"
 import {
-    mapGetters,
-    mapActions
+  mapGetters,
+  mapActions
 } from "vuex";
 export default {
   components: {
@@ -59,23 +59,30 @@ export default {
     };
   },
   computed: {
-        ...mapGetters("layout", [
-            "projectId",
-            "secret",
-            "userId"
-        ])
+    ...mapGetters("layout", [
+      "projectId",
+      "secret",
+      "userId"
+    ])
   },
   created() {
     this.param.ProjId = this.projectId
     this.param.secret = this.secret
     this.getProjName()
+
+    let deviceId = this.$route.query.deviceId;
+    if (deviceId) {
+      this.$nextTick(() => {
+        this.$refs.cascader.changeVal([deviceId])
+      })
+    }
   },
   watch: {
-      projectId() {
-          this.param.ProjId = this.projectId
-          this.param.secret = this.secret
-          this.getProjName()
-      }
+    projectId() {
+      this.param.ProjId = this.projectId
+      this.param.secret = this.secret
+      this.getProjName()
+    }
   },
   methods: {
     getProjName() {
@@ -97,9 +104,8 @@ export default {
     },
     close(val) {
       this.getEqCode()
-      console.log(val)
-      if(this.$refs.cascader)
-      this.$refs.cascader.changeVal([val.code])
+      if (val && this.$refs.cascader)
+        this.$refs.cascader.changeVal([val.code])
       //   this.$refs.tableMain.getHeaderData(this.param);
     },
     getEqCode() {
@@ -115,10 +121,10 @@ export default {
         data: { type: "Eq" }
       }
       getFamilyList(param, res => {
-          if (this.$refs.cascader) {
-              this.$refs.cascader.pushData(res.Content)
-          }
-        
+        if (this.$refs.cascader) {
+          this.$refs.cascader.pushData(res.Content)
+        }
+
       })
     },
     //获取header的list
@@ -129,7 +135,6 @@ export default {
         data: { type: "Eq" }
       }
       getNumber(param, res => {
-        console.log(res)
         this.mess.name[0].num = res.content.count
         this.mess.name[1].num = res.content.bindingCount
         this.getFamilyList()
@@ -145,8 +150,8 @@ export default {
       getGraphyId(param).then(res => {
         if (res.data.Result == "success") {
           this.graphyId = res.data.graph_id
-          if(this.$refs.tableMain)
-          this.$refs.tableMain.setGraphyId(this.graphyId, this.assetGroupList);
+          if (this.$refs.tableMain)
+            this.$refs.tableMain.setGraphyId(this.graphyId, this.assetGroupList);
           this.getNumber()
         } else {
           this.$message.error("请求错误:" + res.data.ResultMsg)
@@ -166,8 +171,8 @@ export default {
         this.param.floorId = null
       }
       if (!!this.param.deviceId) {
-          if(this.$refs.tableMain)
-        this.$refs.tableMain.getHeaderData(this.param);
+        if (this.$refs.tableMain)
+          this.$refs.tableMain.getHeaderData(this.param);
       } else {
         return;
       }
@@ -178,8 +183,8 @@ export default {
       this.param.deviceId = value.code
       this.param.name = value.facility
       if (!!value) {
-          if(this.$refs.tableMain)
-        this.$refs.tableMain.getHeaderData(this.param);
+        if (this.$refs.tableMain)
+          this.$refs.tableMain.getHeaderData(this.param);
       } else {
         return;
       }
@@ -206,7 +211,7 @@ export default {
   }
   .search-header {
     overflow: hidden;
-    padding:0 10px 10px 10px;
+    padding: 0 10px 10px 10px;
     border-bottom: 1px solid #bcbcbc;
   }
 }

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

@@ -2,16 +2,8 @@
   <div id="deviceList">
     <el-row class="left">
       <span style="float:right;">当前选择的部件类型:{{category.Name}}</span>
-      <!-- <div style="width:200px;display:inline-block;text-align:left;color:gray;">
-        <span>隐藏自动填充的信息</span>
-        <el-checkbox v-model="isWatch" @change="getTableHeader"></el-checkbox>
-      </div> -->
       <el-select v-model="showType" @change="initTable" style="width:130px;margin-right:10px;vertical-align:bottom;">
-        <el-option
-          v-for="item in showTypes"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
+        <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value">
         </el-option>
       </el-select>
       <span>增加</span>
@@ -42,7 +34,8 @@
     <!-- 供应商弹窗 -->
     <supplier-dialog ref="supplier" @changeSupplier="supplierChange" :dialog="myDialog"></supplier-dialog>
     <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"></guarantee-dialog>
-    <upload-files-dialog :read="onlyRead ? true : false" ref="upload" @changeFile="fileChange" :keysArr="filesArr" :dialog="myDialog"></upload-files-dialog>
+    <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>
     <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
     <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
@@ -104,6 +97,7 @@ export default {
         {value: "partInfo", label: '隐藏信息点'},
         {value: "Visible", label: '只看采集信息'},
         {value: "all", label: '全部'}
+
       ],
       showType: "partInfo",
       copyTableData: [],
@@ -207,38 +201,44 @@ export default {
       for (let i = 0; i < newData.length; i++) {
         let params = newData[i]
         params.ParentId = this.category.deviceId, //当前设备id
-        params.Category = this.category.Code //当前部件分类
+          params.Category = this.category.Code //当前部件分类
         params.Family = this.firmId;
-        if (newData[i].Checked) {//同时创建资产
-          await createPropertyData([params], async res => {
-            params.PropertyId = res.Id
-            await createPart([params], res => {
-              if (i == newData.length - 1) {
-                this.$router.push({
-                  path: "/ledger/partsmanage",
-                  query: {
-                    deviceId: this.category.deviceId,
-                    typeId: this.category.ParentId
-                  }
-                });
-                session.remove("partsAddData")
-              }
-            })
-          })
-        } else {
-          await createPart(params, res => {
-            if (i == newData.length - 1) {
-              this.$router.push({
-                path: "/ledger/partsmanage",
-                query: {
-                  deviceId: this.category.deviceId,
-                  typeId: this.category.ParentId
-                }
-              });
-              session.remove("partsAddData")
+
+        await createPart([params], async res => {
+          if (newData[i].Checked) {//同时创建资产
+            params.EquipID = res.EntityList[0].EquipID
+            await createPropertyData([params], res => { })
+          }
+          this.$router.push({
+            path: "/ledger/partsmanage",
+            query: {
+              deviceId: this.category.deviceId,
+              typeId: this.category.ParentId
             }
           });
-        }
+          session.remove("partsAddData")
+        })
+
+        // if (newData[i].Checked) {//同时创建资产
+        //   await createPropertyData([params], async res => {
+        //     params.PropertyId = res.Id
+
+        //   })
+        // } 
+        // else {
+        //   await createPart(params, res => {
+        //     if (i == newData.length - 1) {
+        //       this.$router.push({
+        //         path: "/ledger/partsmanage",
+        //         query: {
+        //           deviceId: this.category.deviceId,
+        //           typeId: this.category.ParentId
+        //         }
+        //       });
+        //       session.remove("partsAddData")
+        //     }
+        //   });
+        // }
       }
     },
     // 删除表格行

+ 156 - 98
src/views/ledger/facility/partsmanage/index.vue

@@ -17,6 +17,12 @@
       <el-button @click="handleCreateTableData">添加部件</el-button>
       <el-button @click="getTableHeader">刷新</el-button>
       <el-button v-show="!onlyRead" @click="undo">撤销</el-button>
+      <div style="float:right;overflow:hidden;">
+        <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
+          <i v-show="!onlyRead" class="el-icon-fa  el-icon-fa-compass"></i>
+        </span>
+        <span>当前筛选条件下共{{page.total || '--'}}部件</span>
+      </div>
     </el-row>
     <div class="tableBox">
       <div class="center middle_sty" v-show="tableData && !tableData.length">
@@ -134,7 +140,6 @@ export default {
         addDevice: false,
         systemType: false,
         details: false, //详情页
-        changeRea: false,
         lookPic: false, //图片查看
         changeRea: false, //关联的资产
       },
@@ -147,7 +152,8 @@ export default {
       mess: {},
       id: 0,
       EquipmentList: [],
-      firmId: "" //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
+      firmId: "", //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
+      deviceType:{}
     };
   },
   computed: {
@@ -169,7 +175,11 @@ export default {
         }
       }
       getEquipBelongs(params, res => {
-        this.firmId = res.Content[0].Family;
+        if (res.Content.length) {
+          this.firmId = res.Content[0].Family;
+          this.deviceType.assetType = res.Content[0].Family
+          this.deviceType.assetName = res.Content[0].FamilyName
+        }
       })
     },
     //tab页点击事件
@@ -376,8 +386,9 @@ export default {
           readOnly: true
         },
         {
-          data: "PropertyLocalName",
-          readOnly: true
+          data: "LinkEquipLocalName",
+          readOnly: true,
+          renderer: tools.LinkEquipLocalName
         }
       );
       return data;
@@ -526,100 +537,129 @@ export default {
       return dataArr || [];
     },
     getInfors(infos, row) {
-      //其他的开始判断
-      let val = this.tableExample.colToProp(row.col);
-      if (val == "caozuo") {
-        // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
-        this.$message("开发中...")
-      }
-      //设备二维码图片
-      if (val == "EquipQRCode") {
-        this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
-        if (!!this.qrcodeUrl) {
-          this.myDialog.qrcode = true;
-        } else {
-          this.$message("此设备没有设备二维码");
-        }
-      }
-      //关联系统
-      if (val == "linkSystem") {
-        // this.systemList = this.tableData[row.row].linkSystem || [];
-        this.myDialog.systemType = true;
-      }
-      //品牌型号弹窗
-      if (val == "DPManufacturerID") {
-        this.myDialog.firm = true;
-      }
-      //供应商信息弹窗
-      if (val == "DPSupplierID") {
-        this.myDialog.supplier = true;
-      }
-      //维修商信息弹窗
-      if (val == "DPMaintainerID") {
-        this.myDialog.maintainer = true;
-      }
-      //保险公司信息
-      if (val == "DPInsurerID") {
-        this.myDialog.insurer = true;
-      }
-      //供应合同编号
-      if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
-        let falg = null;
-        let data = this.tableData[row.row].DPSupplierID;
-        if (data) {
-          falg = data.split("-")[0];
-        }
-        if (!!falg) {
-          this.id = falg;
-          this.myDialog.supply = true;
-        } else {
-          this.$message("请先选择供应商");
-        }
-      }
-      //保险单号
-      if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
-        //选择保单
-        let falg = null;
-        let data = this.tableData[row.row].DPInsurerID;
-        if (data) {
-          falg = data.split("-")[0];
-        }
-        if (!!falg) {
-          this.id = falg;
-          this.myDialog.guarantee = true;
-        } else {
-          this.$message("请先选择保险商");
-        }
-      }
-      //保险文件--设备文档--安装质检报告
-      if (
-        val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
-        val == "LedgerParam.PhotoDoc.Archive" ||
-        val == "LedgerParam.Siteinstall.CheckReport"
-      ) {
-        let data = tools.dataForKey(this.tableData[row.row], val);
-        this.filesArr = data ? data : [];
-        this.myDialog.uploadFiles = true;
-      }
-      //安装照片--安装图纸--设备铭牌照片--设备图纸
-      if (
-        val == "LedgerParam.Siteinstall.InstallPic" ||
-        val == "LedgerParam.Siteinstall.InstallDrawing" ||
-        val == "LedgerParam.PhotoDoc.Nameplate" ||
-        val == "LedgerParam.PhotoDoc.Drawing"
-      ) {
-        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 : [];
-        this.myDialog.pic = true;
-      }
       this.row = row.row;
       this.messKey = val;
+      let val = this.tableExample.colToProp(row.col);
+      console.log(val)
+      switch (val) {
+        //操作
+        case 'caozuo':
+          // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
+          this.$message("开发中...")
+          break;
+        //设备二维码图片
+        case 'EquipQRCode':
+          this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
+          if (!!this.qrcodeUrl) {
+            this.myDialog.qrcode = true;
+          } else {
+            this.$message("此设备没有设备二维码");
+          }
+          break;
+        //关联系统
+        case 'LinkSystem':
+          if (!this.onlyRead) {
+            this.curDevice = infos.EquipID;
+            this.systemList = this.tableData[row.row].LinkSystem || [];
+            this.myDialog.systemType = true;
+          }
+          break;
+        //关联资产
+        case 'LinkEquipLocalName':
+          if (this.linkNameFalg) {
+            this.myDialog.changeRea = true;
+          }
+          break;
+        //品牌型号弹窗
+        case 'DPManufacturerID':
+          if (!this.onlyRead) {
+            this.myDialog.firm = true;
+          }
+          break;
+        //供应商信息弹窗
+        case 'DPSupplierID':
+          if (!this.onlyRead) {
+            this.myDialog.supplier = true;
+          }
+          break;
+        //维修商信息弹窗
+        case 'DPMaintainerID':
+          if (!this.onlyRead) {
+            this.myDialog.maintainer = true;
+          }
+          break;
+        //保险公司信息
+        case 'DPInsurerID':
+          if (!this.onlyRead) {
+            this.myDialog.insurer = true;
+          }
+          break;
+        //供应合同编号
+        case 'LedgerParam.SupplyPurchase.SupplierContractID':
+          if (!this.onlyRead) {
+            let ContractIDflag = null;
+            let DPSdata = this.tableData[row.row].DPSupplierID;
+            if (DPSdata) {
+              ContractIDflag = DPSdata.split("-")[0];
+            }
+            if (!!ContractIDflag) {
+              this.id = ContractIDflag;
+              this.myDialog.supply = true;
+            } else {
+              this.$message("请先选择供应商");
+            }
+          }
+          break;
+        //保险单号
+        case 'LedgerParam.InsuranceDoc.InsuranceNum':
+          if (!this.onlyRead) {
+            let DPInsurerIDflag = null;
+            let DPIdata = this.tableData[row.row].DPInsurerID;
+            if (DPIdata) {
+              DPInsurerIDflag = DPIdata.split("-")[0];
+            }
+            if (!!DPInsurerIDflag) {
+              this.id = DPInsurerIDflag;
+              this.myDialog.guarantee = true;
+            } else {
+              this.$message("请先选择保险商");
+            }
+          }
+          break;
+        //保险文件--设备文档--安装质检报告
+        case 'LedgerParam.InsuranceDoc.InsuranceFile':
+        case 'LedgerParam.PhotoDoc.Archive':
+        case 'LedgerParam.Siteinstall.CheckReport':
+          let IPSdata = tools.dataForKey(this.tableData[row.row], val);
+          this.filesArr = IPSdata ? IPSdata : [];
+          this.myDialog.uploadFiles = true;
+          break;
+        //安装照片--安装图纸--设备铭牌照片--设备图纸
+        case 'LedgerParam.Siteinstall.InstallPic':
+        case 'LedgerParam.Siteinstall.InstallDrawing':
+        case 'LedgerParam.PhotoDoc.Nameplate':
+        case 'LedgerParam.PhotoDoc.Drawing':
+          let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
+          this.imgsArr = SSPPdata ? SSPPdata : [];
+          this.myDialog.uploadImgs = true;
+          break;
+        //设备照片
+        case 'LedgerParam.PhotoDoc.Pic':
+          let Pdata = tools.dataForKey(this.tableData[row.row], val);
+          this.picsArr = Pdata ? Pdata : [];
+          this.myDialog.pic = true;
+          break;
+        //包含的部件字段
+        case 'Count':
+          if (this.onlyRead) {
+            this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.EquipID } });
+          } else {
+            this.$router.push({ path: '/ledger/partsmanage', query: { deviceId: infos.EquipID, typeId: this.mess.deviceId } });
+          }
+          break;
+        default:
+          break;
+      }
     },
     utilToKey(key, name, data, messName) {
       if (key == name) {
@@ -639,7 +679,25 @@ export default {
       } else {
         tools.setDataForKey(this.tableData[row], key, "");
       }
-    }
+    },
+    //修改资产
+    changeAssetsFalg() {
+      if (this.linkNameFalg) {
+        this.linkNameFalg = false
+      } else {
+        this.$confirm('<p>真的要在这里修改部件关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>', '提示', {
+          dangerouslyUseHTMLString: true,
+          confirmButtonText: '没错!我要改关联的资产',
+          cancelButtonText: '我就点开看看',
+          confirmButtonClass: 'cancelButtonClass',
+          cancelButtonClass: 'cancelButtonClass'
+        }).then(_ => {
+          this.linkNameFalg = true
+        }).catch(_ => {
+          this.$message("取消")
+        })
+      }
+    },
   }
 };
 </script>