From 1982a6e18e8d57028ef8302dedb3eb68ed8570c3 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 09 Jan 2023 17:38:25 +0800
Subject: [PATCH] 完善警情动态显示及弹窗无数据显示

---
 src/styles/base/index.scss                    |    6 +++++-
 src/views/home/index.vue                      |   15 +++++++++++----
 src/views/home/components/bottomContainer.vue |    6 +++---
 src/components/map/components/mapPopup.vue    |   19 +++++++++++++++++--
 4 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/src/components/map/components/mapPopup.vue b/src/components/map/components/mapPopup.vue
index 2f78d03..3b32398 100644
--- a/src/components/map/components/mapPopup.vue
+++ b/src/components/map/components/mapPopup.vue
@@ -62,7 +62,8 @@
                                     </div>
                                 </div>
 
-                                <div v-show="currentBtn == '出警信息'" class="label-content">
+                                <div v-show="currentBtn == '出警信息' && JSON.stringify(CJdata) != '{}'"
+                                    class="label-content">
                                     <div class="item">
                                         <div>处警单位:</div>
                                         <div>{{ CJdata.CJDWMC }}</div>
@@ -99,6 +100,11 @@
                                         <div>备注:</div>
                                         <div>{{ CJdata.MEMO }}</div>
                                     </div>
+                                </div>
+
+                                <div v-show="currentBtn == '出警信息' && JSON.stringify(CJdata) == '{}'"
+                                    class="label-content no-data">
+                                    暂无数据
                                 </div>
                             </div>
                         </div>
@@ -156,8 +162,11 @@
             this.currentBtn = type
 
             this.CJdata = {}
+
             getActAsPoliceList(this.dataPopup.JJDBH, '').then(res => {
-                this.CJdata = res.data.data.records[0]
+                if (res.data.data.records.length > 0) {
+                    this.CJdata = res.data.data.records[0]
+                }
             })
         },
 
@@ -337,6 +346,12 @@
 
     }
 
+    .label-content.no-data {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        min-height: 240px;
+    }
 }
 
 .divForms .title {
diff --git a/src/styles/base/index.scss b/src/styles/base/index.scss
index e546a3f..d2e8703 100644
--- a/src/styles/base/index.scss
+++ b/src/styles/base/index.scss
@@ -433,7 +433,11 @@
                 }
             }
 
-
+            .box.no-data {
+                align-items: center;
+                justify-content: center;
+                align-content: center;
+            }
         }
     }
 }
diff --git a/src/views/home/components/bottomContainer.vue b/src/views/home/components/bottomContainer.vue
index 6922e3c..70bf190 100644
--- a/src/views/home/components/bottomContainer.vue
+++ b/src/views/home/components/bottomContainer.vue
@@ -42,7 +42,7 @@
                     <ul class="item">
                         <li v-for="(item, index) in policeSituationRealtimeArr" :key="index"
                             :data-obj="JSON.stringify(item)" class="row">
-                            <span class="num" v-text="index"></span>
+                            <span class="num" v-text="item.index"></span>
                             <span class="receiving-alarm-unit" v-text="item.JJDWMC"></span>
                             <span class="receiving-alarm-people" v-text="item.JJYXM"></span>
                             <span class="receiving-alarm-time" :title="item.JJSJ"
@@ -264,7 +264,7 @@
                 return this.dateFormat(item)
             })
 
-            this.getAlarmList({ start: date[0], end: date[1] })
+            this.getAlarmList({ start: date[0], end: date[1], page: this.currentPage })
         },
 
         // 获取当前日期
@@ -374,7 +374,7 @@
             // }]
 
             // this.policeSituationRealtimeArr = this.policeSituationRealtimeArr.map((item, index) => {
-            //     return { ...item, lng: item.ZDDWXZB, lat: item.ZDDWYZB }
+            //     return { ...item, index: index + 1, lng: item.ZDDWXZB, lat: item.ZDDWYZB }
             // })
         },
 
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index dcefbbd..c890f9a 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -2,7 +2,7 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2022-08-18 16:18:17
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-01-07 16:23:24
+ * @LastEditTime: 2023-01-09 17:28:12
  * @FilePath: \srs-police-affairs\src\views\home\index.vue
  * @Description: 小区-栋-层-房屋
  *
@@ -280,7 +280,7 @@
                 </div>
             </div>
 
-            <div v-show="policeInformationType == '出警信息'" class="box">
+            <div v-show="policeInformationType == '出警信息' && JSON.stringify(CJdata) != '{}'" class="box">
                 <div class="item">
                     <div>处警单位编号:</div>
                     <div>{{ CJdata.CJDWBH }}</div>
@@ -335,6 +335,10 @@
                     <div>备注:</div>
                     <div>{{ CJdata.MEMO }}</div>
                 </div>
+            </div>
+
+            <div v-show="policeInformationType == '出警信息' && JSON.stringify(CJdata) == '{}'" class="box no-data">
+                暂无数据
             </div>
         </el-dialog>
     </div>
@@ -670,10 +674,13 @@
         alarmOrActAsPolice (type) {
             this.policeInformationType = type
 
-            this.CJdata = {}
             if (type == '出警信息') {
+                this.CJdata = {}
+
                 getActAsPoliceList(this.policeSituationDetailArr.JJDBH).then(res => {
-                    this.CJdata = res.data.data.records[0]
+                    if (res.data.data.records.length > 0) {
+                        this.CJdata = res.data.data.records[0]
+                    }
                 })
             }
         },

--
Gitblit v1.9.3