alarm-record.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view :class="$isEmpty(list)?'bg-white':'container'">
  3. <u-calendar v-model="dateShow" mode="date" @change="change"></u-calendar>
  4. <view v-if="!$isEmpty(list)" class="top fixed" >
  5. <view class="flex justify-between">
  6. <view class="flex">
  7. <view class="flex justify-center align-center">
  8. <image v-if="fireType==0" style="width: 80rpx;height: 80rpx;" src="/static/index/fire/yanwu1.png"></image>
  9. <image v-if="fireType==1" style="width: 80rpx;height: 80rpx;" src="/static/index/fire/ranqi2.png"></image>
  10. <image v-if="fireType==2" style="width: 80rpx;height: 80rpx;" src="/static/index/fire/xiaofang.png"></image>
  11. </view>
  12. <view class="padding-left-40">
  13. <view >
  14. <text class="text-bold">设备类型:</text>
  15. <text v-if="fireType==0">烟感报警器</text>
  16. <text v-if="fireType==1">燃气报警器</text>
  17. <text v-if="fireType==2">消防栓</text>
  18. </view>
  19. <view class="padding-top-10">
  20. <text class="text-bold">告警记录:</text>
  21. <text class="text-red padding-right-10 text-bold text-lg">{{total?total:0}}</text>条
  22. </view>
  23. </view>
  24. </view>
  25. <view @click="dateShow=true" class="flex text-blue justify-center align-center">
  26. <text class="cuIcon-filter padding-right-20"></text>
  27. <text class="">筛选</text>
  28. </view>
  29. </view>
  30. </view>
  31. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  32. <view v-if="!$isEmpty(list)" class="history">
  33. <u-time-line>
  34. <u-time-line-item nodeTop="2" v-for="(item,index) in list" :key="index">
  35. <template v-slot:node>
  36. <view class="u-node bg-white" >
  37. <u-icon name="clock-fill" color="#59a5f0" :size="28"></u-icon>
  38. </view>
  39. </template>
  40. <template v-slot:content>
  41. <view>
  42. <view class="u-order-title">{{item.recordTime}}</view>
  43. <view class="content" style="width: 636rpx;">
  44. <view >
  45. <text >告警等级:</text>
  46. <text v-if="item.level==1" class="text-red">严重告警</text>
  47. <text v-else-if="item.level==2" class="text-orange">警告告警</text>
  48. <text v-else >提示告警</text>
  49. </view>
  50. <view class="nav-title">
  51. <text class="">告警类型:</text>
  52. <text v-text="item.alarmType==0?'业务报警':'设备报警'"></text>
  53. </view>
  54. <view class="nav-title">
  55. <text class="">设备名称:</text>
  56. <text>{{item.deviceName}}</text>
  57. </view>
  58. <view class="nav-title">
  59. <text class="">告警原因:</text>
  60. <text>{{item.name}}</text>
  61. </view>
  62. <view v-if="item.monitorValue" class="nav-title">
  63. <text class="">监测值:</text>
  64. <text class="text-red text-bold">{{item.monitorValue}}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. </u-time-line-item>
  70. </u-time-line>
  71. </view>
  72. </mescroll-body>
  73. </view>
  74. </template>
  75. <script>
  76. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  77. export default {
  78. mixins:[MescrollMixin],
  79. data() {
  80. return {
  81. fireType:0,
  82. dateShow:false,
  83. list:[],
  84. total:'',
  85. deviceId:'' ,//设备列表的imei等于设备告警激励的deviceId
  86. downOption: {
  87. use: true,
  88. auto: false
  89. },
  90. upOption: {
  91. page: {
  92. page: 0,
  93. size: 10
  94. },
  95. noMoreSize: 3,
  96. empty: {
  97. tip: '暂无相关数据'
  98. }
  99. },
  100. }
  101. },
  102. onLoad(options) {
  103. this.deviceId=options.imei || ''
  104. },
  105. onShow() {
  106. this.fireType=getApp().globalData.fireType || 0
  107. if (this.fireType==0) {
  108. uni.setNavigationBarTitle({
  109. title:"烟感报警记录"
  110. })
  111. }else if (this.fireType==1) {
  112. uni.setNavigationBarTitle({
  113. title:"气感报警记录"
  114. })
  115. }else if (this.fireType==2) {
  116. uni.setNavigationBarTitle({
  117. title:"消防水压报警记录"
  118. })
  119. }
  120. },
  121. methods: {
  122. change(e) {
  123. console.log(e);
  124. },
  125. downCallback(){
  126. setTimeout(()=>{
  127. this.list=[]
  128. this.mescroll.resetUpScroll()
  129. },1500)
  130. },
  131. upCallback(mescroll) {
  132. let params={
  133. current:mescroll.num,
  134. size:mescroll.size,
  135. deviceId:this.deviceId
  136. }
  137. try{
  138. this.$api.fireDevice.alarmRecord(params).then(res=>{
  139. let data=res.data.records
  140. let length=data.length
  141. this.total=res.data.total
  142. mescroll.endBySize(length, this.total);
  143. if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  144. this.list=this.list.concat(data); //追加新数据
  145. })
  146. }catch(e){
  147. console.log(e);
  148. mescroll.endErr();
  149. }
  150. },
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .container {
  156. height: calc(100vh );
  157. padding: 140rpx 0rpx 0rpx;
  158. .fixed {
  159. position: fixed;
  160. top: 0rpx;
  161. left: 0;
  162. width: 100%;
  163. background-color: #FFFFFF;
  164. box-sizing: border-box;
  165. z-index: 999;
  166. }
  167. }
  168. .nav-title {
  169. font-size: 28upx;
  170. font-weight: 300;
  171. padding-top: 20rpx;
  172. }
  173. .top{
  174. padding: 30rpx;
  175. box-shadow: 0 4rpx 6rpx rgba(204, 204, 204,.2);
  176. // border-bottom: 1rpx solid #efefef;
  177. }
  178. .history{
  179. background-color: #FFFFFF;
  180. padding: 40rpx 20rpx 20rpx 50rpx;
  181. }
  182. .content{
  183. box-shadow: 0 8rpx 2rpx rgba(204, 204, 204,.2),0 -8rpx 6rpx rgba(204, 204, 204,.1),8rpx 0rpx 6rpx rgba(204, 204, 204,.1),-8rpx 0rpx 6rpx rgba(204, 204, 204,.1);
  184. background-color: #FFFFFF;
  185. padding: 20rpx;
  186. border-radius: 10rpx;
  187. margin-top: 20rpx;
  188. }
  189. </style>