From 14e02654e0545ee69456d64aef2f35c7c219d708 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 07 May 2021 11:26:49 +0800
Subject: [PATCH] 地图模式设备状态修改

---
 src/views/clientManagement/clientManagement.vue |  149 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 99 insertions(+), 50 deletions(-)

diff --git a/src/views/clientManagement/clientManagement.vue b/src/views/clientManagement/clientManagement.vue
index bdc9ea3..bc94ea0 100644
--- a/src/views/clientManagement/clientManagement.vue
+++ b/src/views/clientManagement/clientManagement.vue
@@ -30,7 +30,7 @@
                    @refresh-change="refreshChange"
                    @on-load="onLoad"
                    @row-click="rowClick">
-                   
+
           <template slot="menuLeft">
             <el-button type="danger"
                        size="mini"
@@ -69,14 +69,14 @@
 
           <template slot-scope="{ row }" slot="dxzt">
             <el-tag>{{
-              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "在线" : "无"
+              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "正常" :row.dxzt == "2" ? "报警":row.dxzt == "3" ? "故障":"无"
               }}
             </el-tag>
           </template>
 
-          <template slot-scope="{ row }" slot="jfzt">
-            <i class="el-icon-check client-jf" v-if="row.type == 0"></i>
-            <i class="el-icon-close client-qf" v-else-if="row.type == 1"></i>
+          <template slot-scope="{ row }" slot="type">
+            <i class="el-icon-check client-jf" v-if="row.type == '0' "></i>
+            <i class="el-icon-close client-qf" v-else-if="row.type == '1' "></i>
           </template>
 
         </avue-crud>
@@ -141,7 +141,7 @@
             </el-form-item>
           </el-col>
         </el-form>
-        
+
       </el-dialog>
 
 
@@ -231,6 +231,7 @@
         initFlag: true,
         loading: true,
         menuVisible:false,
+        isEdit:false,
         page: {
           pageSize: 10,
           currentPage: 1,
@@ -406,10 +407,29 @@
               }],
             }, {
               label: "缴费状态",
-              prop: "jfzt",
+              prop: "type",
               slot: true,
+              sortable:true,
               addDisplay: false,
               editDisplay: false,
+            }, {
+              label: "设备厂商",
+              prop: "manufacturers",
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=manufacturers",
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
+              search:true,
+              type:"select",
+              rules: [{
+                required: true,
+                message: "请选择设备厂商",
+                trigger: "blur"
+              }],
             }, {
               label: "布撤防状态",
               prop: "devicestate",
@@ -436,6 +456,7 @@
               label: "设备状态",
               prop: "dxzt",
               slot: true,
+              sortable:true,
               addDisplay: false,
               editDisplay: false,
             },
@@ -443,24 +464,14 @@
               label: "故障状态",
               prop: "state",
               addDisplay: false,
-              editDisplay: false
+              editDisplay: false,
+              hide:true
             },
             {
               label: "故障原因",
               prop: "reason",
               addDisplay: false,
               editDisplay: false
-            },{
-              label: "心跳时间",
-              prop: "heartbeat",
-              type: "datetime",
-              format: "yyyy-MM-dd",
-              valueFormat: "yyyy-MM-dd HH:mm:ss",
-              width: 130,
-              hide: true,
-              addDisplay: true,
-              editDisplay: true,
-              viewDisplay: true,
             },
             {
               label: "省份",
@@ -566,7 +577,7 @@
               },
               span:5,
             },
-             
+
             {
               label: "主要负责人",
               prop: "oneId",
@@ -673,6 +684,18 @@
               editDisplay: true,
               viewDisplay: true,
             },
+            {
+              label: "心跳时间",
+              prop: "heartbeat",
+              type: "datetime",
+              format: "yyyy-MM-dd",
+              valueFormat: "yyyy-MM-dd HH:mm:ss",
+              width: 130,
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            }
 
           ]
         },
@@ -686,30 +709,34 @@
           if (val) {
             var that = this;
             //重新加载一次页面详情数据,解决新的省市区无法写入问题
-            getclient(this.form.id).then(res => {
-              debugger;
-              this.form = res.data.data;
-              //经纬度替换
-              this.form.wd = val.latitude;
-              this.form.jd = val.longitude;
-              //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
-              var address = val.formattedAddress.toString();
-              if(address.search("县") != -1){
-                  this.form.street = address.substring(address.indexOf("县")+1,address.length);
+            //判断是新增还是修改
+            if(that.isEdit){
+                getclient(this.form.id).then(res => {
+                  // that.province = res.data.data.province;
+                  // that.city = res.data.data.city;
+                  // that.district = res.data.data.district;
+                });
               }
-              if(address.search("区") != -1){
-                this.form.street = address.substring(address.indexOf("区")+1,address.length);
-              }
-              //写入新的省市区
-              that.form.province = val.addressComponent.province;
-              if(val.addressComponent.city==""){
-                  that.form.city = val.addressComponent.province;
-              }else{
-                  that.form.city = val.addressComponent.city;
-              }
-              
-              that.form.district = val.addressComponent.district;
-            });
+
+            //经纬度替换
+            this.form.wd = val.latitude;
+            this.form.jd = val.longitude;
+            //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
+            var address = val.formattedAddress.toString();
+            if(address.search("县") != -1){
+                this.form.street = address.substring(address.indexOf("县")+1,address.length);
+            }
+            if(address.search("区") != -1){
+              this.form.street = address.substring(address.indexOf("区")+1,address.length);
+            }
+            //写入新的省市区
+            that.form.province = val.addressComponent.province;
+            if(val.addressComponent.city==""){
+                that.form.city = val.addressComponent.province;
+            }else{
+                that.form.city = val.addressComponent.city;
+            }
+            that.form.district = val.addressComponent.district;
           }
         },
         immediate: true,
@@ -760,7 +787,7 @@
       //     this.initData();
       //   }
       // }
-      
+
     },
     computed: {
       ...mapGetters(["permission"]),
@@ -800,7 +827,7 @@
         });
       },
 
-      //初始化数据  
+      //初始化数据
       // initData() {
       //   //部门tree数据
       //   getDeptTree().then(res => {
@@ -808,7 +835,7 @@
       //     column.dicData = res.data.data;
       //   });
       // },
-      
+
       handleClick(row) {
         this.form = row;
         this.dialogTableVisible = true;
@@ -820,6 +847,7 @@
         this.onLoad(this.page);
       },
       rowSave(row, done, loading) {
+        row.deptId = row.deptId.join(",");
         add(row).then(() => {
           this.onLoad(this.page);
           this.$message({
@@ -833,8 +861,9 @@
         });
       },
       rowUpdate(row, index, done, loading) {
-        // row.jd=row.map.latitude;
-        // row.wd=row.map.longitude;
+        if(Array.isArray(row.deptId)){
+            row.deptId = row.deptId.join(",");
+        }
         update(row).then(() => {
           // this.initFlag = false;
           this.onLoad(this.page);
@@ -907,11 +936,14 @@
           });
       },
       beforeOpen(done, type) {
-        debugger;
         if (["edit", "view"].includes(type)) {
           getclient(this.form.id).then(res => {
             this.form = res.data.data;
+            this.isEdit=true;
           });
+        }
+        if (["add"].includes(type)) {
+          this.isEdit=false;
         }
         // this.initFlag = true;
         done();
@@ -968,7 +1000,19 @@
             } else if (data.records[i].heartbeat == "") {
               data.records[i].dxzt = 0;
             } else {
-              data.records[i].dxzt = 1;
+              if(data.records[i].dtype==1){
+                  data.records[i].dxzt = data.records[i].dtype;
+              }
+              if(data.records[i].dtype==2){
+                  data.records[i].dxzt = 2;
+              }
+              if(data.records[i].dtype==3){
+                  data.records[i].dxzt = 3;
+              }
+              if(data.records[i].dtype=="" || data.records[i].dtype==0){
+                  data.records[i].dxzt = 1;
+              }
+             
             }
           }
 
@@ -1020,14 +1064,19 @@
         });
 
       }, handleStart(row) {
+
+        console.log(row,11111111111);
         row = this.selectRow;
+        console.log(row,22222222222);
         var arr = [];
+        console.log(this.$store.state.tags.tagList,3333333);
         this.$store.state.tags.tagList.forEach(item => {
           if (item.label != "视频") {
             arr.push(item);
           }
         });
         this.$store.state.tags.tagList = arr;
+        console.log(arr,444444444444);
         this.$router.push({
           path: `/real/video/`, query: row
         });

--
Gitblit v1.9.3