stationIndex.vue 4.6 KB

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