Browse Source

fix:附加数据功能接口联调

xiebeibei 3 years ago
parent
commit
883a60c009
3 changed files with 165 additions and 141 deletions
  1. 29 34
      src/views/equipment/addDataDialog.vue
  2. 28 16
      src/views/equipment/addDataTable.vue
  3. 108 91
      src/views/equipment/index.vue

+ 29 - 34
src/views/equipment/addDataDialog.vue

@@ -123,8 +123,6 @@
                     {dataIndex: 'hostNum', title: '主机编号', align: 'center', customRender: (text, row, index) => {
                             var self = this;
                             var child = self.$createElement("a-input", {
-                                domProps: {
-                                },
                                 attrs:{
                                     value: text,
                                     placeholder:'请输入',
@@ -154,8 +152,6 @@
                                 },
                                 on:{
                                     change(event){
-                                        console.log(event);
-                                        console.log(self.addDataTableData[index]);
                                         self.$set(self.addDataTableData[index],'manageScope',event.id);
                                     }
                                 }
@@ -172,9 +168,6 @@
                     {dataIndex: 'loopNum', title: '回路编号', align: 'center', customRender: (text, row, index) => {
                             var self = this;
                             var child = self.$createElement("a-input", {
-                                domProps: {
-
-                                },
                                 attrs:{
                                     value: text,
                                     placeholder:'请输入',
@@ -182,8 +175,8 @@
                                 },
                                 on:{
                                     change(event){
-                                        if(row.isFm=='yes') {
-                                            self.$set(self.examplesTableData2[index], 'loopNum', event.target.value);
+                                        if(row.isFm=='1') {
+                                            self.$set(self.addDataTableData[index], 'loopNum', event.target.value);
                                         }
                                     }
                                 }
@@ -315,7 +308,7 @@
                             }
                             return obj;
                         },},
-                    {dataIndex: 'fireHydrantCount', title: '消火栓数量', align: 'center', customRender: (text, row, index) => {
+                    {dataIndex: 'fireHydrantCount', title: '消火栓数量', align: 'center',width:87, customRender: (text, row, index) => {
                             var self = this;
                             var child = self.$createElement("a-input", {
                                 attrs:{
@@ -634,7 +627,6 @@
             deleteFun(index){
                 if(this.systemName=='弱电系统'){
                     if( this.addDataTableData.length==4){
-                        console.log(1);
                         this.addDataTableData.splice(index,4)
                         let arr =   [
                             {
@@ -667,10 +659,7 @@
                     }else{
                         this.addDataTableData.splice(index,4)
                     }
-
-                    console.log(this.addDataTableData);
-
-                }
+                                    }
                 if(this.systemName=='消防系统'){
 
                    if( this.addDataTableData.length==1){
@@ -732,7 +721,6 @@
                         },
                     ];
                     this.addDataTableData.push(...arr);
-                    // console.log( this.addDataTableData);
                 }
                 if(this.systemName=='消防系统'){
                     let obj =  {
@@ -794,16 +782,22 @@
                     }
 
                 })
-                console.log(data);
                 postParams.data = data
                 addDataSaveFireControl({postParams}).then(res=>{
-
-                })
-                this.$message({
-                    message: '保存成功',
-                    type: 'success',
+                   if(res.data.result=='success'){
+                       this.$message({
+                           message: '保存成功',
+                           type: 'success',
+                       })
+                       this.handelCancel();
+                   }else{
+                       this.$message({
+                           message: '保存失败',
+                           type: 'error',
+                       })
+                   }
                 })
-                this.handelCancel();
+
             },
             //弱电系统数据处理成保存提交的格式
             checkDataFunR(){
@@ -814,7 +808,6 @@
                     data:[]
                 }
                 let data = [];
-                console.log(this.addDataTableData);
                 this.addDataTableData.length &&  this.addDataTableData.map((item,index)=>{
                     let obj = {
                         fireZone:'',      //分区
@@ -834,16 +827,21 @@
 
 
                 })
-                console.log(data);
                 postParams.data = data
                 addDataSaveWeakCurrent({postParams}).then(res=>{
-
-                })
-                this.$message({
-                    message: '保存成功',
-                    type: 'success',
+                    if(res.data.result=='success'){
+                        this.$message({
+                            message: '保存成功',
+                            type: 'success',
+                        })
+                        this.handelCancel();
+                    }else{
+                        this.$message({
+                            message: '保存失败',
+                            type: 'error',
+                        })
+                    }
                 })
-                this.handelCancel();
             },
             //保存
             handelSave(){
@@ -878,7 +876,6 @@
                             flag = true;
                         }
                     });
-                    console.log(flag);
                     if(flag){
                         this.visibleDisabled = false;
                         return ;
@@ -886,8 +883,6 @@
                         this.visibleDisabled = true;
                         this.checkDataFunX();
                     }
-                    console.log(this.addDataTableData);
-
                 }
             },
             //核实

+ 28 - 16
src/views/equipment/addDataTable.vue

@@ -8,10 +8,10 @@
                                 return {
                                   background:'#E5EEF6'
                                 }
-                              }"   :span-method="objectSpanMethod">
+                              }"   :span-method="objectSpanMethod" :tooltip-effect="'dark'">
             <el-table-column
                     prop="fireZone"
-                    label="分区">
+                    label="分区" show-overflow-tooltip>
             </el-table-column>
             <el-table-column
                     prop="system"
@@ -34,15 +34,15 @@
                    :show-summary="!examplesBoo"
                    style="width: 100%;" :header-cell-style="()=>{return { background:'#E5EEF6'  } }" :cell-style="({row, column, rowIndex, columnIndex})=>{
                         return { background:examplesBoo&&rowIndex==2&&columnIndex==1?'#EFF0F1':'#fff'  }
-                     }"   :span-method="objectSpanMethod">
+                     }"   :span-method="objectSpanMethod" :tooltip-effect="'dark'">
             <el-table-column
                     prop="fireZone"
-                    label="防火分区"
+                    label="防火分区" show-overflow-tooltip
             >
             </el-table-column>
             <el-table-column
                     prop="hostNum"
-                    label="主机编号">
+                    label="主机编号" show-overflow-tooltip>
                 <template slot-scope="scope">
                     <div v-if="scope.row.isFm==0">{{scope.row.manageScope}}</div>
                     <span v-if="scope.row.isFm==1">{{scope.row.hostNum}}</span>
@@ -50,7 +50,7 @@
             </el-table-column>
             <el-table-column
                     prop="loopNum"
-                    label="回路编号">
+                    label="回路编号" show-overflow-tooltip>
             </el-table-column>
             <el-table-column
                     prop="smokeCount"
@@ -160,7 +160,6 @@
                     }
                 }
                 if(this.systemName=='消防系统'){
-                    console.log(row, column, rowIndex, columnIndex);
                     if (row.isFm == 0) {
                         if (columnIndex === 1) {
                             return {
@@ -172,29 +171,29 @@
                 }
                 this.$nextTick(() => {
                     if(this.systemName=='弱电系统'){
-                        var lastLine = document.getElementsByClassName("el-table__footer")[0]
+                        let lastLine = document.getElementsByClassName("el-table__footer")[0]
                             .children[1];
                         lastLine.innerHTML = ''
                         for(let i=0;i<4;i++){
                             var newnode = document.createElement("tr");
                             if(i==0){
                                 newnode.innerHTML = "<td class='cell' style='font-size: 12px!important;background: #E5EEF6!important;'>合计</td>" +
-                                    "<td class='cell cellbg'>监控系统</td>" + `<td class='cell'>${this.totalCount.monitorTotalCount}</td>`;
+                                    "<td class='cell cellbg'>监控系统</td>" + `<td class='cell'>${this.totalCount.monitorTotalCount||''}</td>`;
                             }
                             if(i==1){
                                 newnode.innerHTML =
                                     "<td  class='cell cellbg'>BA系统</td>" +
-                                    `<td  class='cell'>${this.totalCount.baTotalCount}</td>`;
+                                    `<td  class='cell'>${this.totalCount.baTotalCount||''}</td>`;
                             }
                             if(i==2){
                                 newnode.innerHTML =
                                     "<td class='cell cellbg'>DDC</td>" +
-                                    `<td  class='cell'>${this.totalCount.ddcTotalCount}</td>`;
+                                    `<td  class='cell'>${this.totalCount.ddcTotalCount||''}</td>`;
                             }
                             if(i==3){
                                 newnode.innerHTML =
                                     "<td  class='cell cellbg'>门禁系统</td>" +
-                                    `<td class='cell'>${this.totalCount.accessTotalCount}</td>`;
+                                    `<td class='cell'>${this.totalCount.accessTotalCount||''}</td>`;
                             }
 
                             lastLine.appendChild(newnode);
@@ -203,10 +202,21 @@
                         tds[0].rowSpan = 4;
                     }
                     if(this.systemName=='消防系统'){
-                        let tds = document.querySelectorAll(".el-table__footer-wrapper tr>td");
-                        tds[0].colSpan = 3;
-                        tds[1].style.display = "none";
-                        tds[2].style.display = "none";
+                        var lastLine = document.getElementsByClassName("el-table__footer")[0]
+                            .children[1];
+                        lastLine.innerHTML = '';
+                        var newnode = document.createElement("tr");
+                        newnode.innerHTML = "<td class='cell' colSpan='3' style='font-size: 12px!important;background: #E5EEF6!important;'>合计</td>" +
+                            `<td class='cell cellbg'>${this.totalCount.smokeTotalCount||''}</td>`
+                            + `<td class='cell'>${this.totalCount.warmTotalCount||''}</td>`
+                            + `<td class='cell'>${this.totalCount.handNewTotalCount||''}</td>`
+                            + `<td class='cell'>${this.totalCount.handNewTotalCount||''}</td>`
+                            + `<td class='cell'>${this.totalCount.moduleTotalCount||''}</td>`;
+                        lastLine.appendChild(newnode);
+                        // let tds = document.querySelectorAll(".el-table__footer-wrapper tr>td");
+                        // tds[0].colSpan = 3;
+                        // tds[1].style.display = "none";
+                        // tds[2].style.display = "none";
                     }
                 });
             },
@@ -217,6 +227,8 @@
 <style scoped lang="less">
     /deep/ .el-table{
         .cell{
+            height: 30px!important;
+            line-height:30px!important;
             color: #000000!important;
             text-align: center!important;
         }

+ 108 - 91
src/views/equipment/index.vue

@@ -52,7 +52,7 @@
               :loadName="loadName"
               :type="'system'"
             ></floorMap>
-            <div class="legend-boxs">
+            <div class="legend-boxs" ref="legendBoxs">
               <Legend
                 :key="keyLd"
                 :systemName="systemName"
@@ -99,8 +99,10 @@
                     v-show="showView === 3"
                     class="add-img-container"
                     ref="addImgContainer"
-                    :style="`bottom: ${bottomOffset}px;`"
+
+                    :style="`top: ${bottomOffset}px;bottom:unset`"
                   >
+                      <!--                    :style="`bottom: ${bottomOffset}px;`"-->
                     <!-- <div class="add-img" ref="addImg">
                       <img :src="fqPic[0].url" alt />
                     </div> -->
@@ -203,6 +205,13 @@ export default {
       //附加数据弹窗取消
       handelCancel(data){
           this.addDataVisible = data;
+          this.addDataCheckCompleteFun();
+          if(this.systemName =='消防系统'){
+              this.addDataPreviewFireControlFun();
+          }
+          if(this.systemName =='弱电系统'){
+              this.addDataPreviewWeakCurrentFun();
+          }
       },
     showToolTip() {
       this.showExeclTooltip = true;
@@ -418,7 +427,6 @@ export default {
     },
     //附加数据图片查看 showView为3展示状态
     additionalColl() {
-        console.log('this.floorInfo',this.floorInfo);
         // // 走预览接口
       // this.previewExl();
       // 调整样式
@@ -427,9 +435,10 @@ export default {
         this.$nextTick(() => {
           let p = this.$refs.additionalBox.offsetTop;
           let d = this.$refs.addImgContainer.offsetHeight;
+          let lb= this.$refs.legendBoxs.offsetHeight;
           let bottomOffset = p + 44 - d;
-          if (bottomOffset >= 0) {
-            this.bottomOffset = this.visibleTooltip?0:-100;
+            if (bottomOffset >= 0) {
+            this.bottomOffset = this.systemName =='消防系统'?-lb+44:-lb-1+44;
           } else {
             this.bottomOffset = bottomOffset;
           }
@@ -508,7 +517,7 @@ export default {
           }
           addDataCheckComplete({postParams}).then(res=>{
               if (res.data.result == 'success') {
-              if (res.data.data.isComplate) {
+                  if (res.data.data.isComplete=='true') {
                   this.visibleTooltip = false;
               } else {
                   this.visibleTooltip = true;
@@ -522,37 +531,36 @@ export default {
             projectId: this.plazaId,
             systemCode: this.smsxt,
             floor: this.floorInfo.gname,
-            getTotal:'0'
+            getTotal:'1'
         }
         addDataPreviewFireControl({postParams}).then(res=>{
-        // let res = {
-        //     "result": "success",                       //状态信息 success:调用成功  fail:调用失败
-        //     "data":{
-        //         "infoList":[{
-        //             "fireZone":"C1-C1-C1-C1-9",      //防火分区
-        //             "isFm": "1",            //是否属于工程物业管理范围,0:否,1:是
-        //             "hostNum":"2",          //主机编号
-        //                //烟感数量
-        //             "warmCount":"999999",       //温感数量
-        //             "handNewCount":"13",    //手报数量
-        //
-        //             "moduleCount":"999999"       //模块数量
-        //         },{
-        //             "fireZone":"C1-10",      //防火分区
-        //             "isFm": "0",            //是否属于工程物业管理范围,0:否,1:是
-        //             "manageScope":"合作方管理范围"   //管理范围
-        //         } ],
-        //         "totalCount":{          //总数量,当传入的参数getTotal的值为1时有该数据
-        //             "smokeTotalCount":"20",      //烟感总数量
-        //             "warmTotalCount":"12",       //温感总数量
-        //             "handNewTotalCount":"13",    //手报总数量
-        //             "fireHydrantTotalCount":"15",  //消火栓总数量
-        //             "moduleTotalCount":"33"       //模块总数量
-        //         }
-        //     }
-        // };
+            this.tableData= [];
           if(res.data.result=='success'){
-              this.tableData = res.data.infoList;
+              if(res.data.data&&res.data.data.infoList.length){
+                  this.tableData = res.data.data.infoList;
+              }else{
+                  let obj =  {
+                      key :''+new Date().getTime(),
+                      fireZone:"",      //防火分区
+                      isFm: "1",            //是否属于工程物业管理范围,0:否,1:是
+                      hostNum:"",          //主机编号
+                      loopNum:"",          //回路编号
+                      smokeCount:"",      //烟感数量
+                      warmCount:"",       //温感数量
+                      handNewCount:"",    //手报数量
+                      fireHydrantCount:"",  //消火栓数量
+                      moduleCount:"",       //模块数量
+                      manageScope:'',
+                      errorMsg1:true,
+                      errorMsg2:true,
+                      errorMsg3:true,
+                      errorMsg4:true,
+                      errorMsg5:true,
+                  };
+                  this.tableData.push(obj)
+              }
+              this.totalCount =  res.data.data && res.data.data.totalCount ? res.data.data.totalCount :{};
+
           }else{
               this.$message({
                   message: res.message,
@@ -571,65 +579,75 @@ export default {
               getTotal:'1'
           }
           addDataPreviewWeakCurrent({postParams}).then(res=>{
-         // let res =  {
-         //      "result": "success",                       //状态信息 success:调用成功  fail:调用失败
-         //      "data":{
-         //      "infoList":[{
-         //          "fireZone":"C区",      //分区
-         //          "monitorCount":"2",   //监控系统数量
-         //          "baCount":"3",        //BA系统数量
-         //          "ddcCount":"4",       //DDC数量
-         //          "accessCount":"20"    //门禁系统数量
-         //      },{
-         //          "fireZone":"C区",      //分区
-         //          "monitorCount":"2",   //监控系统数量
-         //          "baCount":"5",        //BA系统数量
-         //          "ddcCount":"4",       //DDC数量
-         //          "accessCount":"20"    //门禁系统数量
-         //      } ],
-         //          "totalCount":{            //总数量,当传入的参数getTotal的值为1时有该数据
-         //          "monitorTotalCount":"2",   //监控系统总数量
-         //              "baTotalCount":"3",        //BA系统总数量
-         //              "ddcTotalCount":"4",       //DDC总数量
-         //              "accessTotalCount":"20"    //门禁系统总数量
-         //      }
-         //  }
-         //  }
           this.tableData =[];
           if(res.data.result=='success'){
+               if(res.data.data && res.data.data.infoList.length){
+                   res.data.data.infoList.length && res.data.data.infoList.map(item=>{
+                       let arr =   [
+                           {
+                               fireZone: '',
+                               system: '监控系统',
+                               monitorCount: '',
+                           },
+                           {
+                               fireZone: '',
+                               system: 'BA系统',
+                               baCount: '',
+                           },
+                           {
+                               fireZone: '',
+                               system: 'DDC',
+                               ddcCount: '',
+                           },
+                           {
+                               fireZone: '',
+                               system: '门禁系统',
+                               accessCount: '',
+                           },
+                       ];
+                       arr[0].fireZone = item.fireZone;
+                       arr[0].monitorCount = item.monitorCount;
+                       arr[1].baCount = item.baCount;
+                       arr[2].ddcCount = item.ddcCount;
+                       arr[3].accessCount = item.accessCount;
+                       this.tableData.push(...arr);
+                   })
+               }else{
+                   let arr =   [
+                       {
+                           key :''+new Date().getTime()+1,
+                           fireZone: '',
+                           system: '监控系统',
+                           monitorCount: '',
+                           errorMsg:true
+                       },
+                       {
+                           key :''+new Date().getTime()+2,
+                           fireZone: '',
+                           system: 'BA系统',
+                           baCount: '',
+                           errorMsg:true
+                       },
+                       {
+                           key :''+new Date().getTime()+3,
+                           fireZone: '',
+                           system: 'DDC',
+                           ddcCount: '',
+                           errorMsg:true
+                       },
+                       {
+                           key :''+new Date().getTime()+4,
+                           fireZone: '',
+                           system: '门禁系统',
+                           accessCount: '',
+                           errorMsg:true
+                       },
+                   ];
+                   this.tableData.push(...arr);
+               }
+
+              this.totalCount =  res.data.data && res.data.data.totalCount ? res.data.data.totalCount :{};
 
-              res.data.infoList.length && res.data.infoList.map(item=>{
-                  let arr =   [
-                      {
-                          fireZone: '',
-                          system: '监控系统',
-                          monitorCount: '',
-                      },
-                      {
-                          fireZone: '',
-                          system: 'BA系统',
-                          baCount: '',
-                      },
-                      {
-                          fireZone: '',
-                          system: 'DDC',
-                          ddcCount: '',
-                      },
-                      {
-                          fireZone: '',
-                          system: '门禁系统',
-                          accessCount: '',
-                      },
-                  ];
-                   arr[0].fireZone = item.fireZone;
-                   arr[0].monitorCount = item.monitorCount;
-                   arr[1].baCount = item.baCount;
-                   arr[2].ddcCount = item.ddcCount;
-                   arr[3].accessCount = item.accessCount;
-                  this.tableData.push(...arr);
-              })
-              console.log(this.tableData);
-              this.totalCount = res.data.totalCount
 
           }else{
               this.$message({
@@ -661,7 +679,6 @@ export default {
      */
     // this.$refs.floorMap.init(this.floorInfo.gname)
     if (this.$route.query.smsxt) {
-      console.log(this.$route.query.smsxt);
       this.smsxt = this.$route.query.smsxt;
       this.smsxtQuery();
       this.system.forEach((el) => {