drainage.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. if(this.mine_code == "jinfeng"){
  84. this.$api.opcdata_getTurboData({
  85. mine_code: this.mine_code,
  86. system_type: this.system_type
  87. }).then((res)=>{
  88. this.data = res.data.sys_point
  89. })
  90. }else{
  91. this.$api.unified_automation_system({
  92. mine_code: this.mine_code,
  93. system_type: this.system_type
  94. }).then((res)=>{
  95. this.data = res.data
  96. })
  97. }
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. page {
  104. background-color: #0B163B;
  105. box-sizing: border-box;
  106. padding: 30rpx 10rpx;
  107. }
  108. .common {
  109. margin: 0 auto;
  110. width: 700rpx;
  111. background-image: url(./icon/common.png);
  112. background-size: 100% 100%;
  113. background-repeat: no-repeat;
  114. box-sizing: border-box;
  115. padding: 40rpx;
  116. display: flex;
  117. flex-wrap: wrap;
  118. justify-content: space-between;
  119. .item {
  120. width: 300rpx;
  121. height: 50rpx;
  122. display: flex;
  123. justify-content: space-between;
  124. color: #4CB1FF;
  125. font-size: 28rpx;
  126. .label {
  127. width: 110rpx;
  128. text-overflow: ellipsis;
  129. white-space: nowrap;
  130. overflow: hidden;
  131. }
  132. .value {
  133. width: 110rpx;
  134. height: 40rpx;
  135. box-sizing: border-box;
  136. padding: 0 10rpx;
  137. background: rgba(0, 4, 15, 0.36);
  138. border: 2rpx solid #3D55A5;
  139. color: #FFF600;
  140. font-size: 24rpx;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. overflow: hidden;
  144. }
  145. .unit {
  146. width: 50rpx;
  147. text-overflow: ellipsis;
  148. white-space: nowrap;
  149. overflow: hidden;
  150. }
  151. }
  152. }
  153. .pump_list {
  154. margin-top: 20rpx;
  155. display: flex;
  156. flex-wrap: wrap;
  157. justify-content: space-between;
  158. .pump {
  159. margin-bottom: 40rpx;
  160. width: 360rpx;
  161. .icon {
  162. text-align: center;
  163. image {
  164. width: 164rpx;
  165. height: 138rpx;
  166. }
  167. }
  168. .name {
  169. margin-top: 20rpx;
  170. text-align: center;
  171. color: #DEF1FF;
  172. font-size: 34rpx;
  173. font-weight: 700;
  174. }
  175. .state {
  176. height: 60rpx;
  177. display: flex;
  178. align-items: center;
  179. justify-content: center;
  180. .label {
  181. color: #4CB1FF;
  182. font-size: 28rpx;
  183. }
  184. .value {
  185. margin-left: 20rpx;
  186. width: 40rpx;
  187. height: 40rpx;
  188. border-radius: 50%;
  189. }
  190. .value_1 {
  191. background-color: #00FF00;
  192. }
  193. .value_2 {
  194. background-color: #DCDCDC;
  195. }
  196. }
  197. .parameter {
  198. box-sizing: border-box;
  199. margin-top: 20rpx;
  200. .title {
  201. margin: 0 auto;
  202. display: flex;
  203. justify-content: center;
  204. align-items: center;
  205. width: 230rpx;
  206. height: 60rpx;
  207. background-image: url(./icon/border.png);
  208. background-size: 100% 100%;
  209. background-repeat: no-repeat;
  210. .icon {
  211. margin-right: 10rpx;
  212. image {
  213. width: 30rpx;
  214. height: 30rpx;
  215. }
  216. }
  217. .text {
  218. color: #00FFF6;
  219. font-size: 30rpx;
  220. }
  221. }
  222. .list {
  223. margin-top: 40rpx;
  224. .item {
  225. height: 60rpx;
  226. display: flex;
  227. justify-content: space-between;
  228. color: #4CB1FF;
  229. font-size: 28rpx;
  230. .label {
  231. margin-left: 10rpx;
  232. width: 130rpx;
  233. text-overflow: ellipsis;
  234. white-space: nowrap;
  235. overflow: hidden;
  236. }
  237. .value {
  238. width: 120rpx;
  239. height: 40rpx;
  240. box-sizing: border-box;
  241. padding: 0 10rpx;
  242. background: rgba(0, 4, 15, 0.36);
  243. border: 2rpx solid #3D55A5;
  244. color: #FFF600;
  245. font-size: 24rpx;
  246. text-overflow: ellipsis;
  247. white-space: nowrap;
  248. overflow: hidden;
  249. }
  250. .unit {
  251. width: 70rpx;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. .pump:nth-child(Odd) {
  258. .parameter {
  259. border-right: 2rpx solid;
  260. border-image: linear-gradient(#0B163B, #00B7F5, #0B163B) 10;
  261. }
  262. }
  263. }
  264. </style>