substation.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view>
  3. <view class="switch">
  4. <view class="img">
  5. <image src="./img/top.png" mode="widthFix"></image>
  6. </view>
  7. <view class="content" v-if="data">
  8. <view class="item" v-for="(item,index) in data.switch">
  9. <view class="box" :style="{backgroundColor: item.value?'#00FD05':''}"></view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="table">
  14. <view class="title">
  15. <view class="icon">
  16. <image src="./icon/canshu.png" mode=""></image>
  17. </view>
  18. <view class="text">运行参数</view>
  19. </view>
  20. <uni-table border emptyText="暂无更多数据">
  21. <uni-tr>
  22. <uni-th align="center" style="vertical-align: middle;">·</uni-th>
  23. <uni-th align="center" style="vertical-align: middle;" v-for="(item,index) in data.power_parameter">{{item.label}}</uni-th>
  24. </uni-tr>
  25. <uni-tr v-for="(item,index) in data.power_parameter[0].data">
  26. <uni-td align="center" style="vertical-align: middle;">{{item.label}}</uni-td>
  27. <template v-for="(item_2,index_2) in data.power_parameter">
  28. <template v-for="(item_3,index_3) in item_2.data" v-if="index_3 == 0">
  29. <uni-td align="center" style="vertical-align: middle;">{{item_3.value}}</uni-td>
  30. </template>
  31. </template>
  32. </uni-tr>
  33. </uni-table>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. mine_code: "",
  42. system_type: "",
  43. // 数据刷新定时器
  44. data_timer: {},
  45. data: null
  46. }
  47. },
  48. onLoad(option) {
  49. uni.setNavigationBarTitle({
  50. title: option.name
  51. })
  52. this.mine_code = option.mine_code
  53. this.system_type = option.system_type
  54. this.get_data()
  55. this.data_timer = setInterval(()=>{
  56. this.get_data()
  57. },5000)
  58. },
  59. onUnload() {
  60. clearInterval(this.data_timer)
  61. },
  62. methods: {
  63. get_data() {
  64. if (this.mine_code == "jinfeng") {
  65. this.$api.opcdata_getTurboData({
  66. mine_code: this.mine_code,
  67. system_type: this.system_type
  68. }).then((res) => {
  69. this.data = res.data.sys_point
  70. console.log(this.data)
  71. })
  72. } else {
  73. this.$api.unified_automation_system({
  74. mine_code: this.mine_code,
  75. system_type: this.system_type
  76. }).then((res) => {
  77. this.data = res.data
  78. })
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. page {
  86. background-color: #0B163B;
  87. box-sizing: border-box;
  88. padding: 30rpx 10rpx;
  89. }
  90. .switch {
  91. position: relative;
  92. .img {
  93. text-align: center;
  94. image {
  95. width: 640rpx;
  96. }
  97. }
  98. .content {
  99. .item {
  100. position: absolute;
  101. top: 168rpx;
  102. left: 50rpx;
  103. .box {
  104. width: 34rpx;
  105. height: 82rpx;
  106. background-color: red;
  107. }
  108. }
  109. .item:nth-child(2) {
  110. left: 100rpx;
  111. }
  112. .item:nth-child(3) {
  113. left: 148rpx;
  114. }
  115. .item:nth-child(4) {
  116. left: 200rpx;
  117. }
  118. .item:nth-child(5) {
  119. left: 262rpx;
  120. }
  121. .item:nth-child(6) {
  122. left: 326rpx;
  123. }
  124. .item:nth-child(7) {
  125. left: 390rpx;
  126. }
  127. .item:nth-child(8) {
  128. left: 454rpx;
  129. }
  130. .item:nth-child(9) {
  131. left: 534rpx;
  132. }
  133. .item:nth-child(10) {
  134. left: 590rpx;
  135. }
  136. .item:nth-child(11) {
  137. left: 648rpx;
  138. }
  139. }
  140. }
  141. .table {
  142. margin-top: 30rpx;
  143. .title {
  144. margin: 30rpx auto;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. width: 230rpx;
  149. height: 60rpx;
  150. background-image: url(./icon/border.png);
  151. background-size: 100% 100%;
  152. background-repeat: no-repeat;
  153. .icon {
  154. margin-right: 10rpx;
  155. image {
  156. width: 30rpx;
  157. height: 30rpx;
  158. }
  159. }
  160. .text {
  161. color: #00FFF6;
  162. font-size: 30rpx;
  163. }
  164. }
  165. /deep/.uni-table {
  166. background-color: #06102B;
  167. min-width: 2600rpx !important;
  168. .uni-table-th {
  169. color: #3271A4;
  170. }
  171. .uni-table-tr {
  172. .uni-table-th:first-child {
  173. position: fixed;
  174. width: 140rpx;
  175. background-color: #06102B;
  176. }
  177. .uni-table-td:first-child {
  178. color: #3271A4;
  179. position: fixed;
  180. width: 140rpx;
  181. background-color: #06102B;
  182. }
  183. .uni-table-th:nth-child(2) {
  184. padding-left: 140rpx;
  185. }
  186. .uni-table-td:nth-child(2) {
  187. padding-left: 140rpx;
  188. }
  189. }
  190. .uni-table-td {
  191. color: #EDE20D;
  192. width: 240rpx;
  193. }
  194. .table--border {
  195. border-color: #3271A4;
  196. }
  197. }
  198. /deep/.table--border {
  199. border-color: #3271A4;
  200. }
  201. }
  202. </style>