maotao hace 2 meses
padre
commit
67cf1ea979
Se han modificado 2 ficheros con 82 adiciones y 20 borrados
  1. 77 17
      components/IncidentListFilter.vue
  2. 5 3
      pages/incidentList/incidentList.vue

+ 77 - 17
components/IncidentListFilter.vue

@@ -21,7 +21,7 @@
21 21
 
22 22
       <view class="area" @click="clickPageRouter('area')">
23 23
         <text class="name">楼栋</text>
24
-        <text class="value ellipsis">{{searchData.area ? searchData.area.buildingName : ''}}</text>
24
+        <text class="value ellipsis">{{searchData.areaName.length>0 ? searchData.areaName.join('/') : ''}}</text>
25 25
       </view>
26 26
 
27 27
       <view class="category">
@@ -63,12 +63,18 @@
63 63
       </view>
64 64
 
65 65
       <scroll-view scroll-y class="areas">
66
-        <view class="areas_item" v-for="area in pageData.areaList" :key="area.id" @click="clickArea(area)">{{area.buildingName}}</view>
66
+				<view class="view-box">
67
+					<view class="areas_item" v-for="area in pageData.areaList"
68
+					:key="area.id" @click="clickAreaItem(area)" 
69
+					:class="searchData.selectBuildingId.indexOf(area.id)!=-1 ? 'ActiveClass': ''"
70
+					>{{area.buildingName}}</view>
71
+				</view>
67 72
       </scroll-view>
68 73
     </view>
69 74
     <view class="container_foot">
70 75
       <view class="foot_btns">
71 76
         <view class="cancel" @click="clickPageRouter('default')">取消</view>
77
+				<view class="cancel submit" @click="clickArea()">确定</view>
72 78
       </view>
73 79
     </view>
74 80
   </view>
@@ -133,21 +139,24 @@
133 139
     pageRouter: 'default',
134 140
     areaList: [],
135 141
     categoryList: [],
136
-		deptList:[]
142
+		deptList:[],
143
+		selectBuildingList:[],
137 144
   });
138
-
145
+	
139 146
 	// 是否开启跨科查看
140 147
 	const showDept = ref(false);
141 148
 
142 149
   const searchData = reactive({
143 150
     hospital: {},
144 151
     selected: 'todoingAll',
145
-    area: {id: 0, area: '全部'},
152
+    area: [],
146 153
     category: {},
147 154
 		categoryValue:{},
148 155
     acceptDate: [],
149 156
 		dept: {},
150
-		deptValue: {}
157
+		deptValue: {},
158
+		selectBuildingId:[],
159
+		areaName:[]
151 160
   })
152 161
 
153 162
   // 显示登记时间
@@ -165,11 +174,29 @@
165 174
   function clickTab(tab){
166 175
     searchData.selected = tab.value;
167 176
   }
168
-
169
-  // 点击区域
170
-  function clickArea(area){
177
+	
178
+	// 点击区域
179
+	function clickAreaItem(item){
180
+		let index = searchData.selectBuildingId.indexOf(item.id)
181
+		if(index==-1){
182
+			pageData.selectBuildingList.push(item)
183
+		}else{
184
+			pageData.selectBuildingList.splice(index, 1)
185
+		}
186
+		searchData.selectBuildingId = pageData.selectBuildingList.map(i=>{
187
+			return i.id
188
+		})
189
+		// console.log(998998,searchData.selectBuildingId)
190
+	}
191
+	
192
+  // 选中楼栋
193
+  function clickArea(){
171 194
     pageData.pageRouter = 'default';
172
-    searchData.area = area;
195
+    searchData.area = pageData.selectBuildingList
196
+		searchData.areaName = []
197
+		pageData.selectBuildingList.forEach(i=>{
198
+			searchData.areaName.push(i.buildingName)
199
+		})
173 200
   }
174 201
 
175 202
   // 点击故障现象
@@ -182,7 +209,7 @@
182 209
   function clear(){
183 210
     setHospital();
184 211
     searchData.selected = 'todoingAll';
185
-    searchData.area = {id: 0, area: '全部'};
212
+    searchData.area = [];
186 213
     searchData.category = {};
187 214
     searchData.acceptDate = [];
188 215
 		searchData.categoryValue = {};
@@ -270,7 +297,8 @@
270 297
 		  .then((res) => {
271 298
 				uni.hideLoading();
272 299
 		    let list = res.list || [];
273
-		    pageData.areaList = [{ id: 0, area: '全部' }, ...list];
300
+				pageData.areaList = list;
301
+		    // pageData.areaList = [{ id: 0, area: '全部' }, ...list];
274 302
 		  });
275 303
   }
276 304
 
@@ -361,8 +389,18 @@
361 389
 		let data = loginUserStore.loginUser.infoPermission
362 390
 		pageData.deptList = data.dutyList
363 391
     setHospital();
392
+		// console.log(999,evt)
364 393
     searchData.selected = evt.selected;
365 394
     searchData.area = evt.area;
395
+		if(evt.area && evt.area.length>0){
396
+			pageData.selectBuildingList = evt.area
397
+			searchData.selectBuildingId = []
398
+			searchData.areaName = []
399
+			evt.area.forEach(i=>{
400
+				searchData.selectBuildingId.push(i.id)
401
+				searchData.areaName.push(i.buildingName)
402
+			})
403
+		}
366 404
     searchData.category = evt.category;
367 405
 		searchData.categoryValue = evt.categoryValue;
368 406
     searchData.acceptDate = evt.acceptDate;
@@ -436,12 +474,30 @@
436 474
   .areas{
437 475
     flex: 1;
438 476
     min-height: 0;
439
-    margin-top: 16rpx;
477
+    margin-top: 20rpx;
478
+		padding-top: 20rpx;
440 479
     background-color: #fff;
441
-    .areas_item{
442
-      padding: 24rpx;
443
-      border-bottom: 1rpx solid #DEDEDE;
444
-    }
480
+		.view-box{
481
+			display: flex; 
482
+			flex-wrap: wrap;
483
+			.areas_item{
484
+				width: 30%;
485
+				height: 80rpx;
486
+				background: #F6F6F6;
487
+				display: flex;
488
+				align-items: center;
489
+				justify-content: center;
490
+				border-radius: 10rpx;
491
+				margin: 0 10rpx 20rpx 10rpx;
492
+			}
493
+			.ActiveClass{
494
+				background: #FFEAE7;
495
+				color: #D95D4D;
496
+				border: 1px solid #A13728;
497
+				box-sizing: border-box;
498
+			}
499
+		}
500
+    
445 501
   }
446 502
 
447 503
   .categorys{
@@ -530,6 +586,10 @@
530 586
         display: flex;
531 587
         justify-content: center;
532 588
       }
589
+			.submit{
590
+				color: #49b856;
591
+				border-left: 1px solid #BFBFBF;
592
+			}
533 593
       .confirm{
534 594
         flex: 1;
535 595
         font-size: 32rpx;

+ 5 - 3
pages/incidentList/incidentList.vue

@@ -370,10 +370,12 @@
370 370
       postData.incident.acceptDateEnd = format(endOfDay(dataInfo.evtFilter.acceptDate[1]), 'yyyy-MM-dd HH:mm:ss');
371 371
     }
372 372
 
373
-    if(dataInfo.evtFilter && dataInfo.evtFilter.area && dataInfo.evtFilter.area.id){
374
-			let id = dataInfo.evtFilter.area.id
373
+    if(dataInfo.evtFilter && dataInfo.evtFilter.area && dataInfo.evtFilter.area.length>0){
374
+			let id = dataInfo.evtFilter.area.map(i=>{
375
+				return i.id
376
+			})
375 377
 			// postData.incident.area = dataInfo.evtFilter.area
376
-			postData.incident.area = {id:id}
378
+			postData.incident.areas = id.join(',')
377 379
     }
378 380
 
379 381
     incidentListSearchStore.setIncidentListSearchData(dataInfo);