Browse Source

perf: 历史警情列表弹窗实现

TwoKe945 1 year ago
parent
commit
706c922857

+ 9 - 5
app/src/views/Home/components/AlarmingSituationDynamics/AlaemList.vue

@@ -111,7 +111,11 @@
 				};
 			},
 		},
-		props: ['list', 'pId', 'selectTimes'],
+		props: {
+      list: Array,
+      pId: [String, Number],
+      selectTimes: Array
+    },
     watch: {
       list: {
         handler(data) {
@@ -121,23 +125,24 @@
       },
       selectTimes: {
         handler(data) {
+          this.resetData()
           if (data.length === 1) {
             this.times = [new Date(data[0]), new Date(data[0])]
           } else if (data.length === 2) {
             this.times = [new Date(data[0]), new Date(data[1])]
           }
+          this.searchTab()
         }
       }
     },
 		methods: {
 			searchTab() {
         let tempTimes = []
-        if (this.times[0] === this.times[1]) {
+        if (this.times.length > 0 && this.times[0] === this.times[1]) {
           tempTimes = [moment(this.times[0]).format('YYYY-MM-DD')]
-        } else {
+        } else if (this.times.length > 0) {
           tempTimes = this.times.map(item => moment(item).format('YYYY-MM-DD'))
         }
-        
 				const params = {
 					pageSize: 100,
 					pageNum: 1,
@@ -201,7 +206,6 @@
 		height: 40px;
 		background: rgba(0, 194, 255, 0.14) !important;
 		box-shadow: 0px 0px 2px 0px #44f1ff !important;
-		// background: red !important;
 	}
 
 	.el-input {

+ 0 - 8
app/src/views/Home/components/AlarmingSituationDynamics/ModalContent.vue

@@ -77,14 +77,6 @@
 				mapData: null,
 			};
 		},
-    watch: {
-      selectTimes: {
-        handler() {
-          this.getList()
-        },
-        deep: true
-      }
-    },
 		methods: {
 			getMapData() {
 				// console.log(this.params.id);

+ 1 - 1
app/src/views/Home/components/AlarmingSituationDynamics/index.vue

@@ -34,7 +34,7 @@
 			<div>{{ item.type }}</div>
 		</div>
     <basic-modal  top="0px" width="100%"  name="历史警情查询" ref="alarmingSituationDynamics">
-      <ModalContent :selectTimes="times"></ModalContent>
+      <ModalContent  :selectTimes="times"></ModalContent>
     </basic-modal>
 	</div>
 </template>