stationIndex.vue 4.4 KB

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