Commit c1d9485fe6532a5f48c735272d47c30d991aa2ea

Authored by fengtao
1 parent 6d9a271f

fix:修复设备筛选输入名字,分页列表显示数据错误问题

Showing 1 changed file with 52 additions and 41 deletions
@@ -25,63 +25,69 @@ @@ -25,63 +25,69 @@
25 </view> 25 </view>
26 </view> 26 </view>
27 </u-sticky> 27 </u-sticky>
28 - <mescroll-body ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback">  
29 - <view class="device-list">  
30 - <view @click="openDeviceDetail(item.id, item.alarmStatus, item.lastOnlineTime, item.tbDeviceId)" class="list-item" v-for="item in list" :key="item.id">  
31 - <view  
32 - class="u-flex item"  
33 - style=" 28 + <mescroll-body ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback">
  29 + <view class="device-list">
  30 + <view @click="openDeviceDetail(item.id, item.alarmStatus, item.lastOnlineTime, item.tbDeviceId)" class="list-item" v-for="item in list" :key="item.id">
  31 + <view
  32 + class="u-flex item"
  33 + style="
34 justify-content: flex-start; 34 justify-content: flex-start;
35 flex-direction: column; 35 flex-direction: column;
36 align-items: center; 36 align-items: center;
37 " 37 "
38 - >  
39 - <view style="width: 450rpx; text-align: left">  
40 - <text style="color: #333; font-size: 15px;font-weight: bold;">{{ item.name }}</text>  
41 - </view>  
42 - <view style="width: 450rpx; text-align: left; margin-top: 10rpx">  
43 - <view style="color: #666; font-size: 14px;display: flex;">  
44 - 设备编号:  
45 - <view style="margin-left:16rpx">{{ item.sn }}</view>  
46 - </view> 38 + >
  39 + <view style="width: 450rpx; text-align: left">
  40 + <text style="color: #333; font-size: 15px;font-weight: bold;">{{ item.name }}</text>
  41 + </view>
  42 + <view style="width: 450rpx; text-align: left; margin-top: 10rpx">
  43 + <view style="color: #666; font-size: 14px;display: flex;">
  44 + 设备编号:
  45 + <view style="margin-left:16rpx">{{ item.sn }}</view>
47 </view> 46 </view>
48 - <view style="width: 450rpx; text-align: left; margin-top: 10rpx">  
49 - <view style="color: #666; font-size: 14px;display: flex;">  
50 - 所属组织:  
51 - <view style="margin-left:16rpx">{{ item.organizationDTO.name }}</view>  
52 - </view> 47 + </view>
  48 + <view style="width: 450rpx; text-align: left; margin-top: 10rpx">
  49 + <view style="color: #666; font-size: 14px;display: flex;">
  50 + 所属组织:
  51 + <view style="margin-left:16rpx">{{ item.organizationDTO.name }}</view>
53 </view> 52 </view>
54 </view> 53 </view>
55 - <view class="item">  
56 - <view class="u-flex" style="margin-top: -6rpx">  
57 - <image  
58 - style=" 54 + </view>
  55 + <view class="item">
  56 + <view class="u-flex" style="margin-top: -6rpx">
  57 + <image
  58 + style="
59 width: 30rpx; 59 width: 30rpx;
60 height: 30rpx; 60 height: 30rpx;
61 margin-top: 5rpx; 61 margin-top: 5rpx;
62 margin-right: 5rpx; 62 margin-right: 5rpx;
63 " 63 "
64 - :src="item.deviceState === 'ONLINE' ? '../../static/online.png' : item.deviceState === 'INACTIVE' ? '../../static/unonline.png' : '../../static/baojing.png'"  
65 - /> 64 + :src="
  65 + item.deviceState === 'ONLINE'
  66 + ? '../../static/online.png'
  67 + : item.deviceState === 'INACTIVE'
  68 + ? '../../static/unonline.png'
  69 + : '../../static/baojing.png'
  70 + "
  71 + />
66 72
67 - <view>  
68 - <text  
69 - style=" 73 + <view>
  74 + <text
  75 + style="
70 color: #377dff; 76 color: #377dff;
71 font-size: 13px; 77 font-size: 13px;
72 margin-left: 5rpx; 78 margin-left: 5rpx;
73 margin-top: 20rpx; 79 margin-top: 20rpx;
74 " 80 "
75 - :style="{ color: item.deviceState === 'ONLINE' ? '#377DFF' : item.deviceState === 'INACTIVE' ? '#666666' : '#DE4437' }"  
76 - >  
77 - {{ item.deviceState === 'ONLINE' ? '在线' : item.deviceState === 'INACTIVE' ? '待激活' : '离线' }}  
78 - </text>  
79 - </view> 81 + :style="{ color: item.deviceState === 'ONLINE' ? '#377DFF' : item.deviceState === 'INACTIVE' ? '#666666' : '#DE4437' }"
  82 + >
  83 + {{ item.deviceState === 'ONLINE' ? '在线' : item.deviceState === 'INACTIVE' ? '待激活' : '离线' }}
  84 + </text>
80 </view> 85 </view>
81 </view> 86 </view>
82 </view> 87 </view>
83 </view> 88 </view>
84 - </mescroll-body> 89 + </view>
  90 + </mescroll-body>
85 <!-- 设备筛选 --> 91 <!-- 设备筛选 -->
86 <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll"> 92 <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll">
87 <view class="filter" @touchmove.stop.prevent="disabledScroll"> 93 <view class="filter" @touchmove.stop.prevent="disabledScroll">
@@ -188,7 +194,8 @@ export default { @@ -188,7 +194,8 @@ export default {
188 num: 0, 194 num: 0,
189 size: 10 195 size: 10
190 }, 196 },
191 - deviceState: '' 197 + deviceState: '',
  198 + deviceName: ''
192 }; 199 };
193 }, 200 },
194 async onLoad(options) { 201 async onLoad(options) {
@@ -224,6 +231,7 @@ export default { @@ -224,6 +231,7 @@ export default {
224 }, 231 },
225 /*下拉刷新的回调 */ 232 /*下拉刷新的回调 */
226 downCallback() { 233 downCallback() {
  234 + this.deviceName = '';
227 //联网加载数据 235 //联网加载数据
228 this.list = []; 236 this.list = [];
229 this.page.num = 1; 237 this.page.num = 1;
@@ -242,7 +250,8 @@ export default { @@ -242,7 +250,8 @@ export default {
242 this.loadData(this.page.num, { 250 this.loadData(this.page.num, {
243 deviceState: deviceState.type ? deviceState.type : undefined, 251 deviceState: deviceState.type ? deviceState.type : undefined,
244 deviceType: deviceType.type ? deviceType.type : undefined, 252 deviceType: deviceType.type ? deviceType.type : undefined,
245 - alarmStatus: alarmStatus.type === '0' || alarmStatus.type === '1' ? alarmStatus.type : undefined 253 + alarmStatus: alarmStatus.type === '0' || alarmStatus.type === '1' ? alarmStatus.type : undefined,
  254 + name: this.deviceName == null ? null : this.deviceName
246 }); 255 });
247 }, 256 },
248 257
@@ -308,11 +317,13 @@ export default { @@ -308,11 +317,13 @@ export default {
308 }); 317 });
309 this.show = false; 318 this.show = false;
310 }, 319 },
311 - inputChanged: debounce(function(name) { 320 + inputChanged(e) {
  321 + this.page.num = 1;
  322 + this.deviceName = e;
312 this.loadData(1, { 323 this.loadData(1, {
313 - name 324 + name: this.deviceName
314 }); 325 });
315 - }, 500) 326 + }
316 } 327 }
317 }; 328 };
318 </script> 329 </script>
@@ -384,4 +395,4 @@ export default { @@ -384,4 +395,4 @@ export default {
384 } 395 }
385 } 396 }
386 } 397 }
387 -</style> 398 +</style>