Browse Source

modify noshow and device interface

haojianlong 5 years ago
parent
commit
3d4a6d4f74

+ 2 - 2
src/components/dialogs/list/insurerDialog.vue

@@ -3,7 +3,7 @@
 
 -->
 <template>
-  <el-dialog title="选择型号" :visible.sync="dialog.insurer" width="1000px">
+  <el-dialog title="选择保险公司" :visible.sync="dialog.insurer" width="1000px">
     <div>
       <div id="firm">
         <div class="title-search query-form" style="padding: 10px;margin-bottom: 10px;">
@@ -18,7 +18,7 @@
         </div>
         <el-radio-group v-model="radio" style="width:100%;">
           <el-table class="data-table" border ref="maintenance" :data="tableData" style="width: 100%" height="300px">
-            <el-table-column header-align='center' label="供应商名称">
+            <el-table-column header-align='center' label="保险公司名称">
               <template slot-scope="scope">
                 <el-tooltip :content="scope.row.name" placement="top">
                   <el-radio v-model="radio" :label="scope.row">{{scope.row.name}}</el-radio>

+ 1 - 1
src/components/dialogs/list/supplierDialog.vue

@@ -3,7 +3,7 @@
 
 -->
 <template>
-  <el-dialog title="选择型号" :visible.sync="dialog.supplier" width="1000px">
+  <el-dialog title="选择供应商" :visible.sync="dialog.supplier" width="1000px">
     <div>
       <div id="firm">
         <div class="title-search query-form" style="padding: 10px;margin-bottom: 10px;">

+ 27 - 33
src/components/ledger/handsontables/device.vue

@@ -6,26 +6,17 @@
       </span>
       <span>当前筛选条件下共{{page.total || '--'}}设备</span>
       <div style="float:right;overflow:hidden;">
+        <el-select v-model="onlyRead" @change="getHeaderData(mess)" style="width:100px;margin-right:20px;vertical-align:bottom;">
+          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
+        </el-select>
+        <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
+          <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
+        </el-select>
         <el-button size="small" style='width: 80px;' @click="download" icon="iconfont icon-xiazai">下载</el-button>
         <el-button size="small" style='width: 80px;' @click="addDevice" icon="iconfont icon-tianjia">添加设备</el-button>
         <el-button size="small" style='width: 80px;' @click="reset" icon="iconfont icon-shuaxin">刷新</el-button>
         <el-button size="small" style='width: 80px;' v-show="!onlyRead" @click="undo" icon="iconfont icon-undo">撤销</el-button>
       </div>
-      <div style="width:200px;color:gray;float:right;font-size:12px;">
-        <span v-if="!onlyRead">隐藏自动填充的信息点:</span>
-        <el-tooltip v-if="!onlyRead" :content="'' + (isWatch ? '隐藏' : '不隐藏')" placement="top">
-          <el-checkbox v-model="isWatch" @change="reset"></el-checkbox>
-        </el-tooltip>
-        <span v-if="onlyRead">只看要采集的信息</span>
-        <el-tooltip v-if="onlyRead" :content="'' + (allMess ? '部分' : '全集')" placement="top">
-          <el-checkbox v-model="allMess" @change="reset"></el-checkbox>
-        </el-tooltip>
-      </div>
-      <div style="width:100px;cursor: pointer;float:right; font-size:14px;margin-right:10px">
-        <el-select v-model="onlyRead" @change="changeRead" size="small">
-          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
-        </el-select>
-      </div>
     </div>
     <!-- 二维码弹窗 -->
     <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
@@ -195,6 +186,7 @@ export default {
       id: 0,
       isWatch: true,
       onlyRead: true,
+      showType: 'all',
       allMess: true,
       linkNameFalg: false,
       qrcodeUrl: "",//二维码图片地址
@@ -205,7 +197,12 @@ export default {
   },
   created() { },
   computed: {
-    ...mapGetters("layout", ["projectId", "secret", "userId"])
+    ...mapGetters("layout", ["projectId", "secret", "userId"]),
+    showTypes () {
+      return this.onlyRead?
+        [{value: "all", label: '全部'}, {value: "Visible", label: '只看要采集的信息'}]: 
+        [{value: "all", label: '全部'}, {value: "Visible", label: '只看要采集的信息'}, {value: "partInfo", label: '隐藏自动填充的信息点'}]
+    }
   },
   methods: {
     //只读-编辑
@@ -383,27 +380,14 @@ export default {
     //格式化表头
     formatHeaderData(list) {
       let arr = tools.copyArr(list)
-      // 如果不是只读状态,添加四大厂商选择
-      if (!this.onlyRead) {
-        arr = showTools.arrToArr(arr)
-      }
-      let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "X", "L", "L1", "L2", "F1", "F2", "M"]
-      if (!this.onlyRead) {
-        readArr.push("Own")
-      }
-      let data = showTools.tableHeadFilter(arr, readArr, this.onlyRead, this.isWatch, this.allMess)
+      let data = showTools.headerTextFilter(arr, 'equipment', this.onlyRead, this.showType, true)
       data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
       return data;
     },
     //格式化表内容
     formatHeaderType(list) {
       let arr = tools.copyArr(list)
-      // 如果不是只读状态,添加四大厂商选择
-      if (!this.onlyRead) {
-        arr = showTools.arrToArr(arr)
-      }
-      let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "X", "L", "L1", "L2", "F1", "F2", "M"]
-      let data = showTools.tableHeaderTypes(arr, readArr, this.onlyRead, this.isWatch, this.allMess)
+      let data = showTools.headerTypeFilter(arr, 'equipment', this.onlyRead, this.showType, true)
       data.unshift(
         {
           data: "caozuo",
@@ -423,7 +407,7 @@ export default {
           renderer: tools.lookDetails
         }
       );
-      if (!!this.onlyRead) {
+      if (this.onlyRead) {
         data.map(item => {
           item.readOnly = true
         })
@@ -599,7 +583,6 @@ export default {
       this.row = row.row;
       this.messKey = val;
       this.systemId = infos.EquipID;
-      console.log(val)
       switch (val) {
         //操作
         case 'caozuo':
@@ -871,6 +854,17 @@ export default {
       this.tableData = []
       this.mess.deviceId = null
       this.page.total = 0
+    },
+    showTypes: {
+      handler(newName, oldName) {
+        if (newName && newName[0] && newName[0].value) {
+          this.showType = newName[0].value
+        } else {
+          this.showType = ""
+        }
+      },
+      immediate: true,
+      deep: true
     }
   }
 };

+ 19 - 2
src/utils/handsontable/mainText.js

@@ -61,11 +61,28 @@ const text = {
     },
     //四大厂商
     idType: (instance, td, row, col, prop, value, cellProperties) => {
+        let html = ''
+        switch (prop){
+            case 'DPManufacturerID':
+                html = instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Specification') + '/' + instance.getDataAtRowProp(row,'LedgerParam.EquipManufactor.Brand')
+                break;
+            case 'DPSupplierID':
+                html = instance.getDataAtRowProp(row,'LedgerParam.SupplyPurchase.Supplier')
+                break;
+            case 'DPMaintainerID':
+                html = instance.getDataAtRowProp(row,'LedgerParam.OperationMainte.Maintainer')
+                break;
+            case 'DPInsurerID':
+                html = instance.getDataAtRowProp(row,'LedgerParam.InsuranceDoc.Insurer')
+                break;
+            default:
+                break;
+        }
         td.style.color = "#409EFF";
         td.style.cursor = "pointer";
         if (!!value) {
-            let data = value.split("-")[1] || "空名"
-            td.innerHTML = data
+            // let data = value.split("-")[1] || "空名"
+            td.innerHTML = html
         } else {
             td.innerHTML = "点击选择"
         }

+ 5 - 2
src/utils/handsontable/notShow.js

@@ -91,6 +91,10 @@ let firmArr = [
     'InsurerEmail',//保险公司电子邮件
     "InsurerWeb",//保险公司网址
     "InsurerFax"//保险公司传真
+    // "DPManufacturerID",//品牌型号Id
+    // "DPSupplierID",//供应商信息Id
+    // "DPMaintainerID",//维修商信息Id
+    // "DPInsurerID"//保险公司信息Id
 ]
 
 let cutArr = [{
@@ -1054,7 +1058,7 @@ const showTools = {
             item.InfoPointCode == "DPSupplierID" ||
             item.InfoPointCode == "DPMaintainerID" ||
             item.InfoPointCode == "DPInsurerID" ||
-            item.InfoPointCode == "insurer"
+            item.InfoPointCode == "DPManufacturerID"
         ) {
             return {
                 data: item.Path,
@@ -1124,7 +1128,6 @@ const showTools = {
     },
     filterUnshow: (onlyRead, type, code) => {
         let falg = true, data = fieldData[type]
-        console.log(fieldData)
         if (onlyRead) {
             data.onlyRead.map(item => {
                 if (item == code) {

+ 121 - 148
src/views/ledger/facility/addfacility.vue

@@ -362,7 +362,6 @@ export default {
       if (this.floorFlag) {
         data.splice(1, 0, "所属建筑楼层")
       }
-      console.log(this.showTypeFlag)
       return data;
     },
     formatHeaderType(list) {
@@ -435,16 +434,9 @@ export default {
     },
     //选择型号修改
     firmChange(data) {
-      tools.setDataForKey(this.tableData[this.row], "DPSpecificationID", data.specificationId)
       tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Brand", data.brand)
       tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Specification", data.name)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Manufacturer", data.venderName)
-      for (let key in data) {
-        if (key == "venderId") {
-          data[key] = data[key] + "-" + data.name + "/" + data.brand;
-          this.utilToKey(key, "venderId", data, "DPManufacturerID");
-        }
-      }
+      tools.setDataForKey(this.tableData[this.row], "DPManufacturerID", data.venderId)
     },
     supplyChange(data) {
       let changeData = { id: data };
@@ -453,17 +445,7 @@ export default {
     //如果选择供应商之后
     supplierChange(data) {
       tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.Supplier", data.name)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierWeb", data.website)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierContactor", data.man)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierPhone", data.phone)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierFax", data.fox)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierEmail", data.email)
-      for (let key in data) {
-        if (key == "venderId") {
-          data[key] = data[key] + "-" + data.name;
-          this.utilToKey(key, "venderId", data, "DPSupplierID");
-        }
-      }
+      tools.setDataForKey(this.tableData[this.row], "DPSupplierID", data.venderId)
     },
     //保险合同
     guaranteeChange(data) {
@@ -488,32 +470,12 @@ export default {
     //维修商变更
     changeMaintainer(data) {
       tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.Maintainer", data.name)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.MaintainerWeb", data.website)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.MaintainerContactor", data.man)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.MaintainerPhone", data.phone)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.MaintainerFax", data.fox)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.MaintainerEmail", data.email)
-      for (let key in data) {
-        if (key == "venderId") {
-          data[key] = data[key] + "-" + data.name;
-          this.utilToKey(key, "venderId", data, "DPMaintainerID");
-        }
-      }
+      tools.setDataForKey(this.tableData[this.row], "DPMaintainerID", data.venderId)
     },
     //保险商变更
     changeInsurer(data) {
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.InsurerEmail", data.email)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.InsurerFax", data.fox)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.InsurerPhone", data.phone)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.InsurerContactor", data.man)
-      tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.InsurerWeb", data.website)
       tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.Insurer", data.name)
-      for (let key in data) {
-        if (key == "venderId") {
-          data[key] = data[key] + "-" + data.name;
-          this.utilToKey(key, "venderId", data, "DPInsurerID");
-        }
-      }
+      tools.setDataForKey(this.tableData[this.row], "DPInsurerID", data.venderId)
     },
     //设备图片弹窗改变事件
     changePics(keys) {
@@ -568,113 +530,124 @@ export default {
       return dataArr || [];
     },
     getInfors(infos, row) {
-      //其他的开始判断
       let val = this.tableExample.colToProp(row.col);
-      console.log(val)
-      //设备二维码图片
-      if (val == "EquipQRCode") {
-        this.myDialog.qrcode = true;
-        this.$refs.qrcode.getCanvas(1111);
-      }
-      //关联系统
-      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.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;
-      }
-      //安装照片--安装图纸--设备铭牌照片--设备图纸
-      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 : []
-        // 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") {
-        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;
+      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.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;
       }
       this.row = row.row;
       this.messKey = val;