From b5f430b249189049cf0a9234dc9197e4e6136544 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 08 May 2021 15:37:48 +0800
Subject: [PATCH] j解决that.form.securityArr=null没有length问题

---
 src/views/policeTracking/policeTracking.vue |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/views/policeTracking/policeTracking.vue b/src/views/policeTracking/policeTracking.vue
index 434c630..15d3165 100644
--- a/src/views/policeTracking/policeTracking.vue
+++ b/src/views/policeTracking/policeTracking.vue
@@ -585,6 +585,16 @@
   },
   created() {
     this.form = this.$route.query;
+    if (
+      !(
+        this.form.securityArr &&
+        this.form.securityArr != null &&
+        this.form.securityArr != undefined &&
+        this.form.securityArr.length > 0
+      )
+    ) {
+      this.form.securityArr = [];
+    }
     this.updatedPageData();
     this.vaddress = this.form.vaddress;
     this.getReceivingAlarm();
@@ -730,7 +740,7 @@
         bz: this.form.bz,
         snumber: this.form.alarmId,
         sname: this.form.alarmPeople,
-        deviceNumber:this.form.deviceNumber,
+        deviceNumber: this.form.deviceNumber,
         zc: zc,
         zctime: this.getDate().current,
       };
@@ -762,7 +772,7 @@
 
     getList() {
       var that = this;
-      var deptid = that.form.deptId.slice(0,19);//报错deptId格式不对liu.2021.5.7
+      var deptid = that.form.deptId.slice(0, 19); //报错deptId格式不对liu.2021.5.7
       axios
         .get(
           `/api/blade-user/pages?current=1&size=9999&work_status=&deptId=${deptid}`
@@ -770,8 +780,13 @@
         .then(function (res) {
           that.tableData = [];
           var i = 0;
-
-          if (that.form.securityArr.length > 0) {
+          console.log(that.form, 89);
+          if (
+            that.form.securityArr &&
+            that.form.securityArr != null &&
+            that.form.securityArr != undefined &&
+            that.form.securityArr.length > 0
+          ) {
             res.data.data.records.forEach((item) => {
               if (item.id == that.form.securityId) {
                 that.tableData.push({
@@ -937,7 +952,17 @@
         },
       }).then(function (res) {
         that.form = res.data.data.records[0];
-        that.getList();//报错deptId格式不对liu.2021.5.7
+        if (
+          !(
+            that.form.securityArr &&
+            that.form.securityArr != null &&
+            that.form.securityArr != undefined &&
+            that.form.securityArr.length > 0
+          )
+        ) {
+          that.form.securityArr = [];
+        }
+        that.getList(); //报错deptId格式不对liu.2021.5.7
       });
     },
   },

--
Gitblit v1.9.3