alarm.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区:</text>
  7. <text>客户名称:</text>
  8. <text>报警类型:{{item.alarmType}}</text>
  9. <text>报警时间:{{item.createTime | timeFilter}}</text>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. deviceAlarmRecords: [],
  19. }
  20. },
  21. filters: {
  22. timeFilter(data) {
  23. if(data!=='') {
  24. let time = uni.$moment(data).format("YYYY-MM-DD HH:mm:ss")
  25. return time
  26. }
  27. }
  28. },
  29. onLoad() {
  30. uni.request({
  31. url: 'http://127.0.0.1:9999/deviceAlarmRecord/list',
  32. method: 'GET',
  33. data: {},
  34. success: res => {
  35. this.deviceAlarmRecords = res.data.data.deviceAlarmRecords;
  36. console.log(res.data.data.deviceAlarmRecords);
  37. },
  38. })
  39. },
  40. methods: {
  41. }
  42. }
  43. </script>
  44. <style>
  45. .alarm {
  46. width: 702rpx;
  47. height: 329rpx;
  48. background-color: white;
  49. margin-top: 30rpx;
  50. margin-left: 24rpx;
  51. border-radius: 10rpx;
  52. padding-top: 30rpx;
  53. }
  54. .content {
  55. font-size: 28rpx;
  56. display: flex;
  57. flex-direction: column;
  58. margin-top: 30rpx;
  59. margin-left: 30rpx;
  60. line-height: 55rpx;
  61. color: #444546;
  62. }
  63. .title {
  64. font-size: 36rpx;
  65. margin-left: 30rpx;
  66. color: #282828;
  67. font-weight: 600;
  68. }
  69. </style>