water_point.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view>
  3. <view class="common" v-if="data.common" v-for="(item,index) in data.common" :key="index">
  4. <view class="text">
  5. {{item.name}}
  6. </view>
  7. <view class="list">
  8. <view class="item" v-for="(item_2,index_2) in item.data" :key="index_2" @click="show_item(item_2)">
  9. <view class="label">{{item_2.name}}</view>
  10. <view class="value">{{item_2.value}}</view>
  11. <view class="unit">{{item_2.unit}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="title">
  16. <view class="icon">
  17. <image src="../icon/canshu.png" mode=""></image>
  18. </view>
  19. <view class="text">{{data.cabinet.title}}</view>
  20. </view>
  21. <!-- 水泵 -->
  22. <view class="pump_list">
  23. <view class="pump" v-for="(item_2,index_2) in data.cabinet.data" :key="index_2">
  24. <view class="icon" v-if="item_2.state == 1">
  25. <image src="../icon/water_pump_kai.jpg" mode=""></image>
  26. </view>
  27. <view class="icon" v-else>
  28. <image src="../icon/water_pump.png" mode=""></image>
  29. </view>
  30. <view class="name">{{item_2.name}}</view>
  31. <view class="state">
  32. <view class="label">状态</view>
  33. <view class="value value_1" v-if="item_2.state == 1"></view>
  34. <view class="value value_2" v-else></view>
  35. </view>
  36. <view class="list">
  37. <view class="state" v-for="(item_3,index_3) in item_2.state_list" :key="index_3">
  38. <view class="label">{{item_3.name}}</view>
  39. <view class="value value_1" v-if="item_3.state == 1"></view>
  40. <view class="value value_2" v-else></view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import data from "./water_point.json"
  49. export default {
  50. data() {
  51. return {
  52. mine_code: "",
  53. system_type: "",
  54. // 数据刷新定时器
  55. data_timer: {},
  56. data: null
  57. };
  58. },
  59. onLoad(option) {
  60. uni.setNavigationBarTitle({
  61. title: option.name
  62. })
  63. this.mine_code = option.mine_code
  64. this.system_type = option.system_type
  65. this.get_data()
  66. this.data_timer = setInterval(() => {
  67. this.get_data()
  68. }, 10000)
  69. },
  70. methods: {
  71. show_item(item) {
  72. uni.showToast({
  73. icon: "none",
  74. title: item.name + " " + item.value + " " + item.unit
  75. })
  76. },
  77. get_data() {
  78. this.$api.unified_automation_system({
  79. mine_code: 'renjiazhuang',
  80. system_type: this.system_type
  81. }).then((res) => {
  82. console.log(res)
  83. this.data = res.data
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. page {
  91. background-color: #0B163B;
  92. box-sizing: border-box;
  93. padding: 30rpx 10rpx;
  94. }
  95. .common {
  96. margin-bottom: 20rpx;
  97. background-image: url(../icon/common_bg.png);
  98. background-size: 100% 100%;
  99. background-repeat: no-repeat;
  100. padding-top: 12rpx;
  101. .text{
  102. text-align: center;
  103. color: #00FFF4;
  104. font-weight: 700;
  105. }
  106. .list{
  107. margin: 0 auto;
  108. width: 700rpx;
  109. box-sizing: border-box;
  110. padding: 40rpx;
  111. display: flex;
  112. flex-wrap: wrap;
  113. justify-content: space-between;
  114. }
  115. .item {
  116. width: 300rpx;
  117. height: 50rpx;
  118. display: flex;
  119. justify-content: space-between;
  120. color: #4CB1FF;
  121. font-size: 28rpx;
  122. .label {
  123. width: 110rpx;
  124. text-overflow: ellipsis;
  125. white-space: nowrap;
  126. overflow: hidden;
  127. }
  128. .value {
  129. width: 110rpx;
  130. height: 40rpx;
  131. box-sizing: border-box;
  132. padding: 0 10rpx;
  133. background: rgba(0, 4, 15, 0.36);
  134. border: 2rpx solid #3D55A5;
  135. color: #FFF600;
  136. font-size: 24rpx;
  137. text-overflow: ellipsis;
  138. white-space: nowrap;
  139. overflow: hidden;
  140. }
  141. .unit {
  142. width: 50rpx;
  143. text-overflow: ellipsis;
  144. white-space: nowrap;
  145. overflow: hidden;
  146. }
  147. }
  148. }
  149. .title {
  150. margin: 0 auto;
  151. margin-bottom: 50rpx;
  152. display: flex;
  153. justify-content: center;
  154. align-items: center;
  155. width: 320rpx;
  156. height: 60rpx;
  157. background-image: url(../icon/border.png);
  158. background-size: 100% 100%;
  159. background-repeat: no-repeat;
  160. .icon {
  161. margin-right: 10rpx;
  162. image {
  163. width: 30rpx;
  164. height: 30rpx;
  165. }
  166. }
  167. .text {
  168. color: #00FFF6;
  169. font-size: 30rpx;
  170. }
  171. }
  172. .pump_list {
  173. margin-top: 20rpx;
  174. display: flex;
  175. flex-wrap: wrap;
  176. justify-content: space-between;
  177. .pump {
  178. margin-bottom: 40rpx;
  179. width: 360rpx;
  180. .icon {
  181. text-align: center;
  182. image {
  183. width: 164rpx;
  184. height: 138rpx;
  185. }
  186. }
  187. .name {
  188. margin-top: 20rpx;
  189. text-align: center;
  190. color: #DEF1FF;
  191. font-size: 34rpx;
  192. font-weight: 700;
  193. }
  194. .state {
  195. margin-top: 10rpx;
  196. height: 60rpx;
  197. display: flex;
  198. align-items: center;
  199. justify-content: center;
  200. .label {
  201. color: #4CB1FF;
  202. font-size: 28rpx;
  203. }
  204. .value {
  205. margin-left: 20rpx;
  206. width: 40rpx;
  207. height: 40rpx;
  208. border-radius: 50%;
  209. }
  210. .value_1 {
  211. background-color: #00FF00;
  212. }
  213. .value_2 {
  214. background-color: #DCDCDC;
  215. }
  216. }
  217. .list{
  218. overflow: hidden;
  219. .state{
  220. box-sizing: border-box;
  221. float: left;
  222. width: 350rpx;
  223. height: 70rpx;
  224. display: flex;
  225. align-items: center;
  226. .label {
  227. width: 160rpx;
  228. color: #4CB1FF;
  229. font-size: 28rpx;
  230. text-overflow: ellipsis;
  231. white-space: nowrap;
  232. overflow: hidden;
  233. }
  234. .value {
  235. margin-left: 20rpx;
  236. width: 40rpx;
  237. height: 40rpx;
  238. border-radius: 50%;
  239. }
  240. .value_1 {
  241. background-color: #00FF00;
  242. }
  243. .value_2 {
  244. background-color: #DCDCDC;
  245. }
  246. }
  247. }
  248. }
  249. .pump:nth-child(Odd) {
  250. border-right: 2rpx solid;
  251. border-image: linear-gradient(#0B163B, #00B7F5, #0B163B) 10;
  252. }
  253. }
  254. </style>