drainage.vue 5.7 KB

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