windStatusPage.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="windStatus">
  3. <view class="box-bg">
  4. <uni-nav-bar :fixed="true" dark left-icon="left" background-color='#202246' :title="stationTit"
  5. @clickLeft="back" />
  6. </view>
  7. <view class="windPowerStatus">
  8. <view class="windStatusMain" v-if="statusFrom === 'wind'">
  9. <view class="windAllStatus flex justify-between">
  10. <view class="statusAllName" v-for="(item, index) in statusAll" :key="index" :style="backSty(item)">
  11. {{item.name}}
  12. </view>
  13. </view>
  14. <view class="windAllStatusData" v-for="(item, index) in windData" :key="index">
  15. <view class="statusOneName">{{item.name}}</view>
  16. <view class="statusAllValue flex justify-between">
  17. <view class="statusOneVal" :style="`color: ${colorAll[index]}`"
  18. v-for="(itv, index) in item.value" :key="index">
  19. {{itv}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="windStatusMain" v-else>
  25. <view class="windAllStatus flex justify-between">
  26. <view class="statusAllName" v-for="(item, index) in statusAll" :key="index" :style="backSty(item)">
  27. {{item.name}}
  28. </view>
  29. </view>
  30. <view class="windAllStatusData" v-for="(item, index) in powerData" :key="index">
  31. <view class="statusOneName">{{item.name}}</view>
  32. <view class="statusAllValue flex justify-between">
  33. <view class="statusOneVal" :style="`color: ${colorAll[index]}`"
  34. v-for="(itv, index) in item.value" :key="index">
  35. {{itv}}
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. windPowerDataApi
  46. } from '../../api/common.js'
  47. export default {
  48. onLoad: function(e) {
  49. this.statusFrom = e.status
  50. },
  51. data() {
  52. return {
  53. stationTit: '',
  54. statusFrom: '',
  55. statusAll: [],
  56. windData: [],
  57. powerData: [],
  58. colorAll: ['#1d99ff', '#05bb4c', '#ba3237', '#e17e23', '#c531c7', '#fff', '#606769']
  59. }
  60. },
  61. created() {
  62. this.stationTit = this.statusFrom === 'wind' ? '各风场状态' : '各电站状态'
  63. this.statusAll = [{
  64. name: '待机',
  65. color: '#1d99ff'
  66. },
  67. {
  68. name: '运行',
  69. color: '#05bb4c'
  70. },
  71. {
  72. name: '故障',
  73. color: '#ba3237'
  74. },
  75. {
  76. name: '检修',
  77. color: '#e17e23'
  78. },
  79. {
  80. name: '限电',
  81. color: '#c531c7'
  82. },
  83. {
  84. name: '受累',
  85. color: '#fff'
  86. },
  87. {
  88. name: '离线',
  89. color: '#606769'
  90. },
  91. ]
  92. this.requestData("0", "-1");
  93. this.requestData("0", "-2");
  94. },
  95. mounted() {},
  96. methods: {
  97. requestData(type1, type2) {
  98. windPowerDataApi({
  99. company: type1,
  100. type: type2
  101. })
  102. .then((res) => {
  103. if (Object.values(res.data.data).length) {
  104. if (res.data.data.powerVos.length > 0) {
  105. res.data.data.powerVos.forEach(item => {
  106. let obj = {
  107. name: item.wpname,
  108. value: [Math.ceil(item.djts), Math.ceil(item.bwts), Math.ceil(
  109. item
  110. .gzts), Math.ceil(item.jxts), Math.ceil(item.xdts),
  111. Math.ceil(item.slts), Math.ceil(item.lxts)
  112. ]
  113. }
  114. if (type2 === "-1") {
  115. this.windData.push(obj)
  116. } else {
  117. this.powerData.push(obj)
  118. }
  119. })
  120. }
  121. } else {
  122. this.windData = [];
  123. this.powerData = [];
  124. }
  125. });
  126. },
  127. backSty(item) {
  128. let backSty = ''
  129. if (item.name === '受累') {
  130. backSty = `color: #000;background-color: ${item.color};`
  131. } else {
  132. backSty = `background-color: ${item.color};`
  133. }
  134. return backSty
  135. },
  136. back() {
  137. this.$tab.switchTab('/pages/home/index')
  138. },
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. page {
  144. background-color: #202246;
  145. }
  146. .windStatus {
  147. width: 100vw;
  148. background: url('../../static/jnImage/loginPage/windBack.png'), url('../../static/jnImage/loginPage/backWav.png');
  149. background-repeat: no-repeat, repeat;
  150. background-size: 100% 260px, 100% 5px;
  151. .box-bg {
  152. width: 100vw;
  153. padding: 0;
  154. .uni-navbar {
  155. .uni-navbar__content {
  156. padding: 5px 0;
  157. height: 50px;
  158. }
  159. }
  160. }
  161. .windPowerStatus {
  162. padding: 0 20px;
  163. .windStatusMain {
  164. margin-top: 20px;
  165. .windAllStatus {
  166. width: 100%;
  167. .statusAllName {
  168. border-right: 2px solid #202246;
  169. text-align: center;
  170. line-height: 23px;
  171. color: #fff;
  172. font-size: 24upx;
  173. width: 14%;
  174. height: 23px;
  175. }
  176. }
  177. .windAllStatusData {
  178. .statusOneName {
  179. margin-top: 10px;
  180. font-size: 28upx;
  181. color: #B2B5C5;
  182. }
  183. .statusAllValue {
  184. width: 100%;
  185. margin-top: 5px;
  186. .statusOneVal {
  187. border-right: 2px solid #202246;
  188. text-align: center;
  189. line-height: 23px;
  190. color: #fff;
  191. font-size: 24upx;
  192. width: 14%;
  193. height: 23px;
  194. background-color: rgba(63, 69, 114, 0.7);
  195. }
  196. }
  197. }
  198. }
  199. }
  200. }
  201. </style>