faultWarnIndex.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="faultwarn">
  3. <company-header></company-header>
  4. <view class="falutWarn_main">
  5. <view class="faultwarn_main_com flex" style="margin:10px 0" v-for="(item,index) in faultwarnData"
  6. :key="index">
  7. <view class="faultwarn_main_com_left">
  8. <view class="faultwarnLeftTop">{{item.name}}</view>
  9. <view class="faultwarnLeftBot">{{item.code}}</view>
  10. </view>
  11. <view class="faultwarn_main_com_right">
  12. <view class="faultwarnRightTop" :style="getSty(item)">{{item.description}}
  13. </view>
  14. <view class="faultwarnRightBot" :style="getSty(item)">{{getTimeDaya(item.ts)}}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import companyHeader from '../common/companyHeader.vue'
  23. import {
  24. companyhistoryFindAlarmlistApi
  25. } from '../../api/warn.js'
  26. export default {
  27. onLoad: function() {},
  28. components: {
  29. companyHeader
  30. },
  31. data() {
  32. return {
  33. faultwarnData: []
  34. }
  35. },
  36. created() {
  37. this.faultwarnData = [{
  38. name: '乌力吉',
  39. code: 'A25',
  40. reson: '通讯站点诊断类故障',
  41. date: '2017-01-06 13:34:34'
  42. },
  43. {
  44. name: '宝龙山',
  45. code: 'A25',
  46. reson: '通讯站点诊断类故障通讯站点诊断类故障通 讯站点诊断类故障',
  47. date: '2017-01-06 13:34:34'
  48. },
  49. ]
  50. this.getcompanyhistoryFindAlarmlist()
  51. },
  52. methods: {
  53. //获取故障数据
  54. getcompanyhistoryFindAlarmlist() {
  55. let that = this
  56. that.faultwarnData = []
  57. let params = {
  58. pageNum: 1,
  59. pageSize: 50,
  60. alarmId: "",
  61. alarmType: 'windturbine',
  62. deviceType: '',
  63. stationid: "",
  64. deviceid: "",
  65. modelId: "",
  66. components: "",
  67. description: "",
  68. isclose: false,
  69. begin: that.getTimeDaya(new Date().getTime() - 60 * 60 * 1000),
  70. end: that.getTimeDaya(new Date().getTime()),
  71. };
  72. companyhistoryFindAlarmlistApi(params).then(res => {
  73. if (res && res.data.ls.length > 0) {
  74. that.faultwarnData = res.data.ls
  75. }
  76. })
  77. },
  78. //获取时间
  79. getTimeDaya(date) {
  80. let currentDate = new Date(date)
  81. let year = currentDate.getFullYear()
  82. let month = currentDate.getMonth() + 1
  83. let day = currentDate.getDate()
  84. let hour = currentDate.getHours() + ':'
  85. let minute = currentDate.getMinutes() < 10 ? '0' + currentDate.getMinutes() : currentDate
  86. .getMinutes()
  87. let second = currentDate.getSeconds();
  88. return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
  89. },
  90. getSty(item) {
  91. let sty = ''
  92. if (item.reson.length > 16) {
  93. sty = 'top: 5px'
  94. } else {
  95. sty = 'top: 15px'
  96. }
  97. return sty
  98. },
  99. changeMsg() {
  100. this.$tab.navigateTo('/pages/common/messagePage')
  101. },
  102. changeStation() {
  103. this.$tab.navigateTo('/pages/common/stationListPage')
  104. },
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. page {
  110. background-color: #202246;
  111. }
  112. .faultwarn {
  113. width: 100vw;
  114. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  115. background-repeat: no-repeat, repeat;
  116. background-size: 100% 260px, 100% 5px;
  117. .falutWarn_main {
  118. padding: 0 20px;
  119. .faultwarn_main_com {
  120. height: 60px;
  121. background: #3F4572;
  122. border-radius: 5px;
  123. .faultwarn_main_com_left {
  124. width: 20%;
  125. background-color: #610900;
  126. color: #fff;
  127. border-radius: 5px 0 0 5px;
  128. text-align: center;
  129. .faultwarnLeftTop {
  130. font-size: 30upx;
  131. position: relative;
  132. top: 15px;
  133. }
  134. .faultwarnLeftBot {
  135. position: relative;
  136. top: 20px;
  137. }
  138. }
  139. .faultwarn_main_com_right {
  140. padding-left: 10px;
  141. width: 80%;
  142. .faultwarnRightTop {
  143. margin-bottom: 5px;
  144. color: #6A98CB;
  145. font-size: 30upx;
  146. position: relative;
  147. // top: 5px;
  148. }
  149. .faultwarnRightBot {
  150. color: #9A9BA6;
  151. position: relative;
  152. // top: 5px;
  153. }
  154. }
  155. }
  156. }
  157. }
  158. </style>