Commit 11d82dbadfaaf803a97c97bc34ae64c72a771b8d

Authored by fengtao
1 parent 6b7daf7f

fix:DEFECT-351 修改告警筛选弹出框里面样式和时间选择went

@@ -94,10 +94,10 @@ @@ -94,10 +94,10 @@
94 </mescroll-body> 94 </mescroll-body>
95 <!-- 自带分页组件 --> 95 <!-- 自带分页组件 -->
96 <view style="height: 20rpx"></view> 96 <view style="height: 20rpx"></view>
97 - <!-- 告警筛选 --> 97 + <!-- 告警筛选-->
98 <u-popup @close="close" closeable bgColor="transparent" :overlay="true" :show="show" mode="bottom"> 98 <u-popup @close="close" closeable bgColor="transparent" :overlay="true" :show="show" mode="bottom">
99 <view class="popup-page"> 99 <view class="popup-page">
100 - <view class="popup-text"><text class="text">筛选条件</text></view> 100 + <view class="popup-text"><text class="text">告警筛选</text></view>
101 <view class="popup-alarm-page u-flex"> 101 <view class="popup-alarm-page u-flex">
102 <view> 102 <view>
103 <view class="popup-alarm-text"><text class="text">告警状态</text></view> 103 <view class="popup-alarm-text"><text class="text">告警状态</text></view>
@@ -105,61 +105,66 @@ @@ -105,61 +105,66 @@
105 <view 105 <view
106 class="alarm-text" 106 class="alarm-text"
107 @click="getAlertStatus(item, index)" 107 @click="getAlertStatus(item, index)"
108 - :style="[index == current1 ? { background: '#377DFF' } : { background: '#F6F6F6' }]" 108 + :style="[index == current1 ? { background: 'rgba(55, 125, 255, 0.05)', border: '1rpx solid rgba(55, 125, 255, 0.3)' } : { background: '#F6F6F6' }]"
109 v-for="(item, index) in alertStatus" 109 v-for="(item, index) in alertStatus"
110 :key="index" 110 :key="index"
111 > 111 >
112 - <text class="text">{{ item.name }}</text> 112 + <text :class="[index == current1 ? 'select-text' : 'un-select-text']" class="text">{{ item.name }}</text>
113 </view> 113 </view>
114 </view> 114 </view>
115 - <view style="margin-top: 120rpx;"> 115 + <view style="margin-top: 169rpx;">
116 <view class="popup-alarm-text"><text class="text">设备类型</text></view> 116 <view class="popup-alarm-text"><text class="text">设备类型</text></view>
117 <view class="u-flex popup-alarm-child"> 117 <view class="u-flex popup-alarm-child">
118 <view 118 <view
119 class="alarm-text" 119 class="alarm-text"
120 @click="getTypeStatus(item, index)" 120 @click="getTypeStatus(item, index)"
121 - :style="[index == current2 ? { background: '#377DFF' } : { background: '#F6F6F6' }]" 121 + :style="[
  122 + index == current2 ? { background: 'rgba(55, 125, 255, 0.05)', border: '1rpx solid rgba(55, 125, 255, 0.3)' } : { background: '#F6F6F6' }
  123 + ]"
122 v-for="(item, index) in deviceType" 124 v-for="(item, index) in deviceType"
123 :key="index" 125 :key="index"
124 > 126 >
125 - <text class="text">{{ item.name }}</text> 127 + <text :class="[index == current2 ? 'select-text' : 'un-select-text']" class="text">{{ item.name }}</text>
126 </view> 128 </view>
127 </view> 129 </view>
128 130
129 - <view style="margin-top: 120rpx;"> 131 + <view style="margin-top: 169rpx;">
130 <view class="popup-alarm-text"><text class="text">告警等级</text></view> 132 <view class="popup-alarm-text"><text class="text">告警等级</text></view>
131 <view class="u-flex popup-alarm-child"> 133 <view class="u-flex popup-alarm-child">
132 <view 134 <view
133 class="alarm-text" 135 class="alarm-text"
134 @click="getLevelStatus(item, index)" 136 @click="getLevelStatus(item, index)"
135 - :style="[index == current3 ? { background: '#377DFF' } : { background: '#F6F6F6' }]" 137 + :style="[
  138 + index == current3 ? { background: 'rgba(55, 125, 255, 0.05)', border: '1rpx solid rgba(55, 125, 255, 0.3)' } : { background: '#F6F6F6' }
  139 + ]"
136 v-for="(item, index) in alertLevel" 140 v-for="(item, index) in alertLevel"
137 :key="index" 141 :key="index"
138 > 142 >
139 - <text class="text">{{ item.name }}</text> 143 + <text :class="[index == current3 ? 'select-text' : 'un-select-text']" class="text">{{ item.name }}</text>
140 </view> 144 </view>
141 </view> 145 </view>
142 - <view style="margin-top: 120rpx;"> 146 + <view style="margin-top: 169rpx;">
143 <view class="popup-alarm-text"><text class="text">选择时间</text></view> 147 <view class="popup-alarm-text"><text class="text">选择时间</text></view>
144 <view class="u-flex popup-alarm-child"> 148 <view class="u-flex popup-alarm-child">
145 <view 149 <view
146 class="alarm-text" 150 class="alarm-text"
147 @click="getTimeStatus(item, index)" 151 @click="getTimeStatus(item, index)"
148 - :style="[index == current4 ? { background: '#377DFF' } : { background: '#F6F6F6' }]" 152 + :style="[
  153 + index == current4
  154 + ? { background: 'rgba(55, 125, 255, 0.05)', border: '1rpx solid rgba(55, 125, 255, 0.3)' }
  155 + : { background: '#F6F6F6' }
  156 + ]"
149 v-for="(item, index) in timeArea" 157 v-for="(item, index) in timeArea"
150 :key="index" 158 :key="index"
151 > 159 >
152 - <text class="text">{{ item.name }}</text> 160 + <text :class="[index == current4 ? 'select-text' : 'un-select-text']" class="text">{{ item.name }}</text>
153 </view> 161 </view>
154 </view> 162 </view>
155 - <view style="margin-top: 120rpx;"> 163 + <view style="margin-top: 169rpx;margin-left: 22rpx;">
156 <view class="u-flex popup-alarm-child"> 164 <view class="u-flex popup-alarm-child">
157 - <view>  
158 - <u--form :label-style="{ 'font-size': '29rpx', 'margin-left': '10rpx' }" labelPosition="left" :model="timeData">  
159 - <u-form-item style="font-size: 14px" label="选择日期" prop="selectTime" labelWidth="80" borderBottom @click="openTime">  
160 - <u--input v-model="timeData.selectTime" placeholder="请选择日期" border="none"></u--input>  
161 - </u-form-item>  
162 - </u--form> 165 + <view class="home-text-muted">选择日期</view>
  166 + <view style="width: 623rpx;margin-left: 5rpx;margin-right: 70rpx;margin-top: 35rpx;">
  167 + <uni-datetime-picker v-model="range" type="daterange" />
163 </view> 168 </view>
164 </view> 169 </view>
165 </view> 170 </view>
@@ -168,7 +173,7 @@ @@ -168,7 +173,7 @@
168 <view style="width: 300rpx"><u-button @click="resetData" type="info" shape="circle" text="重置"></u-button></view> 173 <view style="width: 300rpx"><u-button @click="resetData" type="info" shape="circle" text="重置"></u-button></view>
169 <view style="width: 300rpx; margin-left: 46rpx"><u-button @click="queryData" type="primary" shape="circle" text="确认"></u-button></view> 174 <view style="width: 300rpx; margin-left: 46rpx"><u-button @click="queryData" type="primary" shape="circle" text="确认"></u-button></view>
170 </view> 175 </view>
171 - <view style="height: 30rpx;"></view> 176 + <view style="height: 90rpx;"></view>
172 </view> 177 </view>
173 </view> 178 </view>
174 </view> 179 </view>
@@ -176,17 +181,6 @@ @@ -176,17 +181,6 @@
176 </view> 181 </view>
177 </view> 182 </view>
178 </u-popup> 183 </u-popup>
179 - <!-- 告警筛选 -->  
180 - <u-calendar  
181 - :show="showCalendar"  
182 - mode="range"  
183 - @confirm="calendarConfirm"  
184 - @close="calendarClose"  
185 - startText="开始时间"  
186 - endText="结束时间"  
187 - confirmDisabledText="请选择日期"  
188 - :formatter="formatter"  
189 - ></u-calendar>  
190 <f-tabbar></f-tabbar> 184 <f-tabbar></f-tabbar>
191 </view> 185 </view>
192 </template> 186 </template>
@@ -194,7 +188,6 @@ @@ -194,7 +188,6 @@
194 <script> 188 <script>
195 import fTabbar from '@/components/module/f-tabbar/f-tabbar'; 189 import fTabbar from '@/components/module/f-tabbar/f-tabbar';
196 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; 190 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
197 -import { pageNumber, pageSize } from '@/config/constant.js';  
198 import { alertStatus, deviceType, alertLevel, timeArea } from './static/data.js'; 191 import { alertStatus, deviceType, alertLevel, timeArea } from './static/data.js';
199 192
200 export default { 193 export default {
@@ -204,12 +197,11 @@ export default { @@ -204,12 +197,11 @@ export default {
204 }, 197 },
205 data() { 198 data() {
206 return { 199 return {
  200 + range: ['', ''],
207 alertStatusVal: '', 201 alertStatusVal: '',
208 deviceTypeVal: '', 202 deviceTypeVal: '',
209 alertLevelVal: '', 203 alertLevelVal: '',
210 selectTimeVal: '', 204 selectTimeVal: '',
211 - startTime: '',  
212 - endTime: '',  
213 current1: 0, 205 current1: 0,
214 current2: 0, 206 current2: 0,
215 current3: 0, 207 current3: 0,
@@ -225,11 +217,10 @@ export default { @@ -225,11 +217,10 @@ export default {
225 auto: false // 不自动加载 217 auto: false // 不自动加载
226 }, 218 },
227 timeData: { 219 timeData: {
228 - selectTime: '',  
229 - getTimeGap: '',  
230 - getDateVal: '' 220 + selectTime: [],
  221 + getTimeGapS: '',
  222 + getTimeGapE: ''
231 }, 223 },
232 - showCalendar: false,  
233 show: false, 224 show: false,
234 list: [], 225 list: [],
235 alertStatus, 226 alertStatus,
@@ -269,6 +260,11 @@ export default { @@ -269,6 +260,11 @@ export default {
269 this.loadData(1, type, null, null, null, null, null); 260 this.loadData(1, type, null, null, null, null, null);
270 } 261 }
271 }, 262 },
  263 + watch: {
  264 + range(newval) {
  265 + this.timeData.selectTime = this.range;
  266 + }
  267 + },
272 methods: { 268 methods: {
273 inputChanged(e) { 269 inputChanged(e) {
274 this.loadData(1, null, null, null, null, null, null, e); 270 this.loadData(1, null, null, null, null, null, null, e);
@@ -288,19 +284,45 @@ export default { @@ -288,19 +284,45 @@ export default {
288 getTimeStatus(e, i) { 284 getTimeStatus(e, i) {
289 this.current4 = i; 285 this.current4 = i;
290 this.selectTimeVal = e.value; 286 this.selectTimeVal = e.value;
  287 + let curTime = new Date();
  288 + const formatS = curTime
  289 + .getTime()
  290 + .toString()
  291 + .substring(0, 10);
  292 + let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() + this.selectTimeVal));
  293 + const formatE = addMinute
  294 + .getTime()
  295 + .toString()
  296 + .substring(0, 10);
  297 + this.timeData.getTimeGapS = formatS;
  298 + this.timeData.getTimeGapE = formatE;
291 }, 299 },
292 queryData() { 300 queryData() {
293 - let date1 = new Date(this.timeData.getDateVal[0]);  
294 - let date2 = new Date(this.timeData.getDateVal[this.timeData.getDateVal.length - 1]); 301 + let date1 = new Date(this.timeData.selectTime[0]);
  302 + let date2 = new Date(this.timeData.selectTime[1]);
295 let startTimeVa, endTimeVa; 303 let startTimeVa, endTimeVa;
296 - if (this.timeData.getDateVal.length == 0) { 304 + if (this.timeData.selectTime.length == 0) {
297 startTimeVa = ''; 305 startTimeVa = '';
298 endTimeVa = ''; 306 endTimeVa = '';
299 } else { 307 } else {
300 - startTimeVa = date1.getTime();  
301 - endTimeVa = date2.getTime(); 308 + startTimeVa = date1
  309 + .getTime()
  310 + .toString()
  311 + .substring(0, 10);
  312 + endTimeVa = date2
  313 + .getTime()
  314 + .toString()
  315 + .substring(0, 10);
  316 + }
  317 + let startTimeArea, endTimeArea;
  318 + if (this.timeData.getTimeGapS == '') {
  319 + startTimeArea = '';
  320 + endTimeArea = '';
  321 + } else {
  322 + startTimeArea = this.timeData.getTimeGapS;
  323 + endTimeArea = this.timeData.getTimeGapE;
302 } 324 }
303 - this.loadData(1, this.alertStatusVal, startTimeVa, endTimeVa, this.alertLevelVal, this.deviceTypeVal); 325 + this.loadData(1, this.alertStatusVal, startTimeVa ? startTimeVa : startTimeArea, endTimeVa ? endTimeVa : endTimeArea, this.alertLevelVal, this.deviceTypeVal);
304 this.show = false; 326 this.show = false;
305 }, 327 },
306 resetData() { 328 resetData() {
@@ -312,8 +334,10 @@ export default { @@ -312,8 +334,10 @@ export default {
312 this.alertLevelVal = ''; 334 this.alertLevelVal = '';
313 this.current4 = 0; 335 this.current4 = 0;
314 this.selectTimeVal = ''; 336 this.selectTimeVal = '';
315 - this.timeData.getDateVal = '';  
316 - this.timeData.selectTime = ''; 337 + this.timeData.selectTime = [];
  338 + this.timeDatagetTimeGapS = '';
  339 + this.timeDatagetTimeGapE = '';
  340 + this.range = [];
317 }, 341 },
318 bindImageUrl(e) { 342 bindImageUrl(e) {
319 switch (e) { 343 switch (e) {
@@ -351,6 +375,7 @@ export default { @@ -351,6 +375,7 @@ export default {
351 this.loadData(this.page.num); 375 this.loadData(this.page.num);
352 }, 376 },
353 loadData(pageNo, statusV, startTimeV, endTimeV, severityV, deviceTypeV, organizationV, alarmName) { 377 loadData(pageNo, statusV, startTimeV, endTimeV, severityV, deviceTypeV, organizationV, alarmName) {
  378 + let that = this;
354 let httpData = { 379 let httpData = {
355 page: pageNo, 380 page: pageNo,
356 pageSize: 10, 381 pageSize: 10,
@@ -372,18 +397,18 @@ export default { @@ -372,18 +397,18 @@ export default {
372 .get('/yt/alarm', { params: httpData, custom: { load: false } }) 397 .get('/yt/alarm', { params: httpData, custom: { load: false } })
373 .then(res => { 398 .then(res => {
374 uni.stopPullDownRefresh(); 399 uni.stopPullDownRefresh();
375 - this.mescroll.endByPage(res.items.length, res.total);  
376 - this.alertTotal = res.total; 400 + that.mescroll.endByPage(res.items.length, res.total); //必传参数(当前页的数据个数, 总页数)
  401 + that.alertTotal = res.total;
377 if (pageNo == 1) { 402 if (pageNo == 1) {
378 - this.list = res.items; 403 + that.list = res.items;
379 } else { 404 } else {
380 - this.list = this.list.concat(res.items); 405 + that.list = that.list.concat(res.items);
381 } 406 }
382 }) 407 })
383 .catch(e => { 408 .catch(e => {
384 uni.$u.toast(e.data?.message); 409 uni.$u.toast(e.data?.message);
385 //联网失败, 结束加载 410 //联网失败, 结束加载
386 - this.mescroll.endErr(); 411 + that.mescroll.endErr();
387 }); 412 });
388 }, 413 },
389 openOrg() { 414 openOrg() {
@@ -398,18 +423,6 @@ export default { @@ -398,18 +423,6 @@ export default {
398 this.show = true; 423 this.show = true;
399 this.resetData(); 424 this.resetData();
400 }, 425 },
401 - openTime() {  
402 - this.showCalendar = true;  
403 - uni.hideKeyboard();  
404 - },  
405 - calendarConfirm(e) {  
406 - this.showCalendar = false;  
407 - this.timeData.selectTime = `${e[0]} / ${e[e.length - 1]}`;  
408 - this.timeData.getDateVal = e;  
409 - },  
410 - calendarClose() {  
411 - this.showCalendar = false;  
412 - },  
413 //跳转告警详情 426 //跳转告警详情
414 openAlertDetail(e) { 427 openAlertDetail(e) {
415 let obj = { 428 let obj = {
@@ -449,4 +462,7 @@ export default { @@ -449,4 +462,7 @@ export default {
449 /deep/ .u-cell__right-icon-wrap { 462 /deep/ .u-cell__right-icon-wrap {
450 margin-top: -55rpx !important; 463 margin-top: -55rpx !important;
451 } 464 }
  465 +/deep/ .uni-calendar--fixed {
  466 + bottom: 72rpx !important;
  467 +}
452 </style> 468 </style>
@@ -196,35 +196,28 @@ @@ -196,35 +196,28 @@
196 margin-left: 98rpx; 196 margin-left: 98rpx;
197 flex-direction: column; 197 flex-direction: column;
198 justify-content: space-between; 198 justify-content: space-between;
199 -  
200 .popup-alarm-text { 199 .popup-alarm-text {
201 width: 750rpx; 200 width: 750rpx;
202 margin-left: 14rpx; 201 margin-left: 14rpx;
203 -  
204 .text { 202 .text {
205 color: #333333; 203 color: #333333;
206 font-size: 14px; 204 font-size: 14px;
207 } 205 }
208 } 206 }
209 -  
210 .popup-alarm-child { 207 .popup-alarm-child {
211 margin-top: 15rpx; 208 margin-top: 15rpx;
212 - width: 650rpx; 209 + width: 750rpx;
213 height: 60rpx; 210 height: 60rpx;
214 - flex-direction: row;  
215 flex-wrap: wrap; 211 flex-wrap: wrap;
216 - justify-content: space-between;  
217 - align-content: space-between;  
218 - 212 + margin-left: -10rpx;
219 .alarm-text { 213 .alarm-text {
220 - margin: 10rpx; 214 + margin: 25rpx;
221 line-height: 50rpx; 215 line-height: 50rpx;
222 text-align: center; 216 text-align: center;
223 width: 180rpx; 217 width: 180rpx;
224 height: 60rpx; 218 height: 60rpx;
225 background-color: #f6f6f6; 219 background-color: #f6f6f6;
226 border-radius: 32px; 220 border-radius: 32px;
227 -  
228 .text { 221 .text {
229 color: #333333; 222 color: #333333;
230 font-size: 13px; 223 font-size: 13px;
@@ -110,35 +110,35 @@ const alertLevel = [{ @@ -110,35 +110,35 @@ const alertLevel = [{
110 const timeArea = [{ 110 const timeArea = [{
111 index: 1, 111 index: 1,
112 name: '全部', 112 name: '全部',
113 - value: '全部', 113 + value: 0,
114 bgColor: '#F6F6F6', 114 bgColor: '#F6F6F6',
115 textColor: '#F6F6F6' 115 textColor: '#F6F6F6'
116 }, 116 },
117 { 117 {
118 index: 2, 118 index: 2,
119 name: '30分钟', 119 name: '30分钟',
120 - value: '30', 120 + value: 30,
121 bgColor: '#F6F6F6', 121 bgColor: '#F6F6F6',
122 textColor: '#F6F6F6' 122 textColor: '#F6F6F6'
123 }, 123 },
124 { 124 {
125 index: 3, 125 index: 3,
126 name: '1小时', 126 name: '1小时',
127 - value: '30', 127 + value: 60,
128 bgColor: '#F6F6F6', 128 bgColor: '#F6F6F6',
129 textColor: '#F6F6F6' 129 textColor: '#F6F6F6'
130 }, 130 },
131 { 131 {
132 index: 4, 132 index: 4,
133 name: '2小时', 133 name: '2小时',
134 - value: '120', 134 + value: 120,
135 bgColor: '#F6F6F6', 135 bgColor: '#F6F6F6',
136 textColor: '#F6F6F6' 136 textColor: '#F6F6F6'
137 }, 137 },
138 { 138 {
139 index: 5, 139 index: 5,
140 name: '近一天', 140 name: '近一天',
141 - value: '24', 141 + value: 1440,
142 bgColor: '#F6F6F6', 142 bgColor: '#F6F6F6',
143 textColor: '#F6F6F6' 143 textColor: '#F6F6F6'
144 } 144 }