records.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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 fixed">
  5. <view style="display: flex; justify-content: space-between;">
  6. <view style="display: flex;">
  7. <view style="display: flex;" class="justify-center align-center">
  8. <image v-if="fireType==0" style="width: 80rpx;height: 80rpx;" src="https://szsq.nxzhsq.cn/community/miniofile/app/yangan.png"></image>
  9. <image v-if="fireType==1" style="width: 80rpx;height: 80rpx;" src="https://szsq.nxzhsq.cn/community/miniofile/app/ranqi.png"></image>
  10. <image v-if="fireType==2" style="width: 80rpx;height: 80rpx;" src="https://szsq.nxzhsq.cn/community/miniofile/app/xiaofang.png"></image>
  11. <image v-if="fireType==3" style="width: 80rpx;height: 80rpx;" src="https://szsq.nxzhsq.cn/community/miniofile/app/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" style="display: flex;justify-content: center;align-items: center;flex-direction: column;" class="base-color">
  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">
  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 "@/comps/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. alarmDesc: "",
  124. alarmId: "",
  125. alarmMetric: "",
  126. alarmTimes: null,
  127. alarmType: 1,
  128. alarmTypeSplice: "",
  129. alarmValue: "",
  130. appId: "",
  131. createDept: null,
  132. createTime: null,
  133. createUser: null,
  134. deviceId: "869951040795936",
  135. deviceName: "德锐斯园区智能烟感6",
  136. deviceType: 100004,
  137. id: "607",
  138. isAlarm: 1,
  139. isDeleted: 0,
  140. lastNoticeDate: null,
  141. lastSyncDate: null,
  142. level: "",
  143. metric: "",
  144. monitorValue: "8",
  145. name: "",
  146. orderId: "",
  147. orgPosition: "/640000/640100/640121/1333195565676253185/1333195722832629761/1336244940601810945/1336718963186040833",
  148. prefix: "",
  149. recordTime: "2020-12-17 13:01:07",
  150. status: null,
  151. tenantId: "804981",
  152. updateTime: null,
  153. updateUser: null,
  154. }],
  155. total:'',
  156. downOption: {
  157. use: false,
  158. auto: false
  159. },
  160. upOption: {
  161. page: {
  162. page: 0,
  163. size: 10
  164. },
  165. noMoreSize: 3,
  166. empty: {
  167. tip: '暂无相关数据'
  168. }
  169. },
  170. }
  171. },
  172. onLoad(options) {
  173. this.deviceId = options.imei || ''
  174. },
  175. onShow() {
  176. // this.fireType=getApp().globalData.fireType || 0
  177. // if (this.fireType==0) {
  178. // uni.setNavigationBarTitle({
  179. // title:"烟感报警记录"
  180. // })
  181. // }else if (this.fireType==1) {
  182. // uni.setNavigationBarTitle({
  183. // title:"气感报警记录"
  184. // })
  185. // }else if (this.fireType==2) {
  186. // uni.setNavigationBarTitle({
  187. // title:"消防水压报警记录"
  188. // })
  189. // }
  190. },
  191. methods: {
  192. change(e) {
  193. this.filterDate=e.result
  194. this.mescroll.resetUpScroll()
  195. },
  196. tagClick(){
  197. this.filterDate=''
  198. this.mescroll.resetUpScroll()
  199. },
  200. downCallback(){
  201. setTimeout(()=>{
  202. this.list=[]
  203. this.mescroll.resetUpScroll()
  204. },1500)
  205. },
  206. async upCallback(mescroll) {
  207. let params={
  208. current:mescroll.num,
  209. size:mescroll.size,
  210. deviceId:this.deviceId
  211. }
  212. if (!this.$isEmpty(this.filterDate)) {
  213. params.recordTime=this.filterDate
  214. }
  215. try{
  216. let res=null
  217. if (this.fireType==3) {
  218. //抄表记录
  219. res=await this.$api.fireDevice.electricmeterrecord({imei:this.deviceId})
  220. }else{
  221. //设备报警记录
  222. res=await this.$api.fireDevice.alarmRecord(params)
  223. }
  224. let data=res.data.records
  225. let length=data.length
  226. this.total=res.data.total
  227. mescroll.endBySize(length, this.total);
  228. if(mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  229. this.list=this.list.concat(data); //追加新数据
  230. }catch(e){
  231. console.log(e);
  232. mescroll.endErr();
  233. }
  234. },
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .container {
  240. height: calc(100vh );
  241. padding: 140rpx 0rpx 0rpx;
  242. .fixed {
  243. position: fixed;
  244. top: 0rpx;
  245. left: 0;
  246. width: 100%;
  247. background-color: #FFFFFF;
  248. box-sizing: border-box;
  249. z-index: 999;
  250. }
  251. }
  252. .text-red{
  253. color: #ca0000;
  254. }
  255. .nav-title {
  256. font-size: 28upx;
  257. font-weight: 300;
  258. padding-top: 20rpx;
  259. }
  260. .top{
  261. padding: 30rpx;
  262. box-shadow: 0 4rpx 6rpx rgba(204, 204, 204,.2);
  263. // border-bottom: 1rpx solid #efefef;
  264. }
  265. .history{
  266. background-color: #FFFFFF;
  267. padding: 40rpx 20rpx 20rpx 50rpx;
  268. }
  269. .content{
  270. 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);
  271. background-color: #FFFFFF;
  272. padding: 20rpx;
  273. border-radius: 10rpx;
  274. margin-top: 20rpx;
  275. }
  276. </style>