alarm-record.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view :class="$isEmpty(list)?'bg-white':'container'">
  3. <u-calendar v-model="dateShow" mode="date" @change="change"></u-calendar>
  4. <view class="top bg-white " style="position: fixed;top: 0;z-index: 999;width: 100%;">
  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/icon/yangan.png"></image>
  9. <image v-if="fireType==1" style="width: 80rpx;height: 80rpx;" src="../../../static/icon/ranqi.png"></image>
  10. <image v-if="fireType==2" style="width: 80rpx;height: 80rpx;" src="../../../static/icon/xiaofang.png"></image>
  11. <image v-if="fireType==3" style="width: 80rpx;height: 80rpx;" src="../../../static/icon/dianbiao.png"></image>
  12. </view>
  13. <view class="padding-left-40">
  14. <view >
  15. <text class="text-bold">设备类型:</text>
  16. <text v-if="fireType==0">烟感报警器</text>
  17. <text v-if="fireType==1">燃气报警器</text>
  18. <text v-if="fireType==2">消防栓</text>
  19. <text v-if="fireType==3">电表设备</text>
  20. </view>
  21. <view class="padding-top-10">
  22. <text class="text-bold" v-text="fireType==3?'抄表记录:':'告警记录:'"></text>
  23. <text class="text-red padding-right-10 text-bold text-lg">{{total?total:0}}</text>条
  24. </view>
  25. </view>
  26. </view>
  27. <view @click="dateShow=true" class="flex base-color flex-direction justify-center align-center">
  28. <view class="padding-bottom-20 text-bold">
  29. <text class="cuIcon-filter padding-right-20"></text>
  30. <text class="">筛选</text>
  31. </view>
  32. <u-tag :text="filterDate" @close="tagClick" :show="!$isEmpty(filterDate)" size="mini" :closeable="true" mode="plain" type="error"/>
  33. </view>
  34. </view>
  35. </view>
  36. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  37. <view v-if="!$isEmpty(list)" class="history">
  38. <u-time-line>
  39. <u-time-line-item nodeTop="2" v-for="(item,index) in list" :key="index">
  40. <template v-slot:node>
  41. <view class="u-node bg-white" >
  42. <u-icon name="clock-fill" color="#5064eb" :size="28"></u-icon>
  43. </view>
  44. </template>
  45. <template v-slot:content>
  46. <view v-if="fireType==3">
  47. <view class="u-order-title">抄表时间:{{item.readTime}}</view>
  48. <view class="content" style="width: 636rpx;">
  49. <view class="nav-title">
  50. <text class="">设备厂家:</text>
  51. <text >{{item.deviceFactory}}</text>
  52. </view>
  53. <view class="nav-title">
  54. <text class="">安装位置:</text>
  55. <text v-text="item.installAddress"></text>
  56. </view>
  57. <view class="nav-title">
  58. <text class="">年用量:</text>
  59. <text>{{item.yearValue}} Kwh</text>
  60. </view>
  61. <view class="nav-title">
  62. <text class="">月用量:</text>
  63. <text>{{item.monthValue}} Kwh</text>
  64. </view>
  65. <view class="nav-title">
  66. <text class="">日用量:</text>
  67. <text>{{item.dayValue}} Kwh</text>
  68. </view>
  69. <view class="nav-title">
  70. <text class="">总用量:</text>
  71. <text>{{item.totalValue}} Kwh</text>
  72. </view>
  73. </view>
  74. </view>
  75. <view v-else>
  76. <view class="u-order-title">{{item.recordTime}}</view>
  77. <view class="content" style="width: 636rpx;">
  78. <view >
  79. <text >告警等级:</text>
  80. <text v-if="item.level==1" class="text-red">严重告警</text>
  81. <text v-else-if="item.level==2" class="text-orange">警告告警</text>
  82. <text v-else >提示告警</text>
  83. </view>
  84. <view class="nav-title">
  85. <text class="">告警类型:</text>
  86. <text v-text="item.alarmType==0?'业务报警':'设备报警'"></text>
  87. </view>
  88. <view class="nav-title">
  89. <text class="">设备名称:</text>
  90. <text>{{item.deviceName}}</text>
  91. </view>
  92. <view class="nav-title">
  93. <text class="">告警原因:</text>
  94. <text>{{item.name}}</text>
  95. </view>
  96. <view v-if="item.monitorValue" class="nav-title">
  97. <text class="">监测值:</text>
  98. <text class="text-red text-bold">{{item.monitorValue}}</text>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. </u-time-line-item>
  104. </u-time-line>
  105. </view>
  106. </mescroll-body>
  107. </view>
  108. </template>
  109. <script>
  110. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  111. export default {
  112. mixins:[MescrollMixin],
  113. data() {
  114. return {
  115. //设备类型
  116. fireType:0,
  117. deviceId:'' ,//设备列表的imei等于设备告警记录的deviceId
  118. //日期筛选
  119. dateShow:false,
  120. filterDate:'',
  121. filterTagShow:false,
  122. list:[],
  123. total:'',
  124. downOption: {
  125. use: false,
  126. auto: false
  127. },
  128. upOption: {
  129. page: {
  130. page: 0,
  131. size: 10
  132. },
  133. noMoreSize: 3,
  134. empty: {
  135. tip: '暂无相关数据'
  136. }
  137. },
  138. }
  139. },
  140. onLoad(options) {
  141. this.deviceId=options.imei || ''
  142. },
  143. onShow() {
  144. this.fireType=getApp().globalData.fireType || 0
  145. if (this.fireType==0) {
  146. uni.setNavigationBarTitle({
  147. title:"烟感报警记录"
  148. })
  149. }else if (this.fireType==1) {
  150. uni.setNavigationBarTitle({
  151. title:"气感报警记录"
  152. })
  153. }else if (this.fireType==2) {
  154. uni.setNavigationBarTitle({
  155. title:"消防水压报警记录"
  156. })
  157. }
  158. },
  159. methods: {
  160. change(e) {
  161. this.filterDate=e.result
  162. this.mescroll.resetUpScroll()
  163. },
  164. tagClick(){
  165. this.filterDate=''
  166. this.mescroll.resetUpScroll()
  167. },
  168. downCallback(){
  169. setTimeout(()=>{
  170. this.list=[]
  171. this.mescroll.resetUpScroll()
  172. },1500)
  173. },
  174. async upCallback(mescroll) {
  175. let params={
  176. current:mescroll.num,
  177. size:mescroll.size,
  178. deviceId:this.deviceId
  179. }
  180. if (!this.$isEmpty(this.filterDate)) {
  181. params.recordTime=this.filterDate
  182. }
  183. try{
  184. let res=null
  185. if (this.fireType==3) {
  186. //抄表记录
  187. res=await this.$api.fireDevice.electricmeterrecord({imei:this.deviceId})
  188. }else{
  189. //设备报警记录
  190. res=await this.$api.fireDevice.alarmRecord(params)
  191. }
  192. let data=res.data.records
  193. let length=data.length
  194. this.total=res.data.total
  195. mescroll.endBySize(length, this.total);
  196. if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  197. this.list=this.list.concat(data); //追加新数据
  198. }catch(e){
  199. console.log(e);
  200. mescroll.endErr();
  201. }
  202. },
  203. }
  204. }
  205. </script>
  206. <style lang="scss">
  207. .container {
  208. height: calc(100vh );
  209. padding: 140rpx 0rpx 0rpx;
  210. .fixed {
  211. position: fixed;
  212. top: 0rpx;
  213. left: 0;
  214. width: 100%;
  215. background-color: #FFFFFF;
  216. box-sizing: border-box;
  217. z-index: 999;
  218. }
  219. }
  220. .text-red{
  221. color: #ca0000;
  222. }
  223. .nav-title {
  224. font-size: 28upx;
  225. font-weight: 300;
  226. padding-top: 20rpx;
  227. }
  228. .top{
  229. padding: 30rpx;
  230. box-shadow: 0 4rpx 6rpx rgba(204, 204, 204,.2);
  231. // border-bottom: 1rpx solid #efefef;
  232. }
  233. .history{
  234. background-color: #FFFFFF;
  235. padding: 40rpx 20rpx 20rpx 50rpx;
  236. }
  237. .content{
  238. 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);
  239. background-color: #FFFFFF;
  240. padding: 20rpx;
  241. border-radius: 10rpx;
  242. margin-top: 20rpx;
  243. }
  244. </style>