faultWarnIndex.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.devicename.substring(0, 3)}}</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. that.$modal.loading("数据查询中,请耐心等待...")
  58. let params = {
  59. pageNum: 1,
  60. pageSize: 50,
  61. alarmId: "",
  62. alarmType: 'windturbine',
  63. deviceType: '',
  64. stationid: "",
  65. deviceid: "",
  66. modelId: "",
  67. components: "",
  68. description: "",
  69. isclose: false,
  70. begin: that.getTimeDaya(new Date().getTime() - 60 * 60 * 1000),
  71. end: that.getTimeDaya(new Date().getTime()),
  72. };
  73. companyhistoryFindAlarmlistApi(params).then(res => {
  74. if (res && res.data.ls.length > 0) {
  75. that.$modal.closeLoading()
  76. that.faultwarnData = res.data.ls
  77. }
  78. })
  79. },
  80. //获取时间
  81. getTimeDaya(date) {
  82. let currentDate = new Date(date)
  83. let year = currentDate.getFullYear()
  84. let month = currentDate.getMonth() + 1
  85. let day = currentDate.getDate()
  86. let hour = currentDate.getHours()
  87. let minute = currentDate.getMinutes() < 10 ? '0' + currentDate.getMinutes() : currentDate
  88. .getMinutes()
  89. let second = currentDate.getSeconds();
  90. return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
  91. },
  92. getSty(item) {
  93. let sty = ''
  94. if (item.description.length > 16) {
  95. sty = 'top: 5px'
  96. } else {
  97. sty = 'top: 15px'
  98. }
  99. return sty
  100. },
  101. changeMsg() {
  102. this.$tab.navigateTo('/pages/common/messagePage')
  103. },
  104. changeStation() {
  105. this.$tab.navigateTo('/pages/common/stationListPage')
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. page {
  112. background-color: #202246;
  113. }
  114. .faultwarn {
  115. width: 100vw;
  116. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  117. background-repeat: no-repeat, repeat;
  118. background-size: 100% 260px, 100% 5px;
  119. .falutWarn_main {
  120. padding: 0 20px;
  121. .faultwarn_main_com {
  122. height: 60px;
  123. background: #3F4572;
  124. border-radius: 5px;
  125. .faultwarn_main_com_left {
  126. width: 20%;
  127. background-color: #610900;
  128. color: #fff;
  129. border-radius: 5px 0 0 5px;
  130. text-align: center;
  131. .faultwarnLeftTop {
  132. font-size: 30upx;
  133. position: relative;
  134. top: 15px;
  135. }
  136. .faultwarnLeftBot {
  137. position: relative;
  138. top: 20px;
  139. }
  140. }
  141. .faultwarn_main_com_right {
  142. padding-left: 10px;
  143. width: 80%;
  144. .faultwarnRightTop {
  145. margin-bottom: 5px;
  146. color: #6A98CB;
  147. font-size: 30upx;
  148. position: relative;
  149. // top: 5px;
  150. }
  151. .faultwarnRightBot {
  152. color: #9A9BA6;
  153. position: relative;
  154. // top: 5px;
  155. }
  156. }
  157. }
  158. }
  159. }
  160. </style>