alarmRecord.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view>
  3. <view class="alarm" v-for="item in deviceAlarmRecords" :key="item.code">
  4. <text class="title">{{item.alarmName}}</text>
  5. <view class="content">
  6. <text>报警时间:{{item.createTime | timeFilter}}</text>
  7. <text>变量ID:{{item.variableId}}</text>
  8. <text>报警状态:{{item.status}}</text>
  9. <text>持续时长:{{item.createTime | timeFilter}}-{{item.endTime | timeFilter}}</text>
  10. </view>
  11. </view>
  12. <view class="anniu">
  13. <image class="anniu" src="../../static/设备菜单/前往列表@2x.png" @tap="back"></image>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. deviceAlarmRecords: [],
  22. }
  23. },
  24. filters: {
  25. timeFilter(data) {
  26. if(data!=='') {
  27. let time = uni.$moment(data).format("YYYY-MM-DD HH:mm:ss")
  28. return time
  29. }
  30. }
  31. },
  32. onLoad() {
  33. uni.request({
  34. url: 'http://127.0.0.1:9999/deviceAlarmRecord/list',
  35. method: 'GET',
  36. data: {},
  37. success: res => {
  38. this.deviceAlarmRecords = res.data.data.deviceAlarmRecords;
  39. console.log(res.data.data.deviceAlarmRecords);
  40. },
  41. })
  42. },
  43. methods: {
  44. back() {
  45. uni.navigateTo({
  46. url: '/pages/device/deviceInfo/deviceInfo'
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style>
  53. .anniu {
  54. width: 116rpx;
  55. height: 116rpx;
  56. float: right;
  57. margin-top: 10rpx;
  58. margin-right: 4rpx;
  59. }
  60. .alarm {
  61. width: 702rpx;
  62. height: 329rpx;
  63. background-color: white;
  64. margin-top: 30rpx;
  65. margin-left: 24rpx;
  66. border-radius: 10rpx;
  67. padding-top: 30rpx;
  68. }
  69. .content {
  70. display: flex;
  71. flex-direction: column;
  72. margin-top: 30rpx;
  73. margin-left: 30rpx;
  74. line-height: 55rpx;
  75. font-size: 28rpx;
  76. color: #444546;
  77. }
  78. .title {
  79. font-size: 36rpx;
  80. margin-left: 30rpx;
  81. color: #282828;
  82. font-weight: 600;
  83. }
  84. </style>