water_point.vue 5.7 KB

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