life_water.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <view>
  3. <view v-if="data.cabinet" v-for="(item,index) in data.cabinet" :key="index">
  4. <view class="title">
  5. <view class="icon">
  6. <image src="../icon/canshu.png" mode=""></image>
  7. </view>
  8. <view class="text">{{item.title}}</view>
  9. </view>
  10. <!-- 水泵 -->
  11. <view class="pump_list">
  12. <view class="pump" v-for="(item_2,index_2) in item.data" :key="index_2">
  13. <view class="icon" v-if="item_2.state == 1">
  14. <image src="../icon/water_pump_kai.jpg" mode=""></image>
  15. </view>
  16. <view class="icon" v-else>
  17. <image src="../icon/water_pump.png" mode=""></image>
  18. </view>
  19. <view class="name">{{item_2.name}}</view>
  20. <view class="state">
  21. <view class="label">状态</view>
  22. <!-- 1-开 2-关 -->
  23. <view class="value value_1" v-if="item_2.state == 1"></view>
  24. <view class="value value_2" v-else></view>
  25. </view>
  26. <view class="list">
  27. <view class="state" v-for="(item_3,index_3) in item_2.state_list" :key="index_3">
  28. <view class="label">{{item_3.name}}</view>
  29. <!-- 1-开 2-关 -->
  30. <view class="value value_1" v-if="item_3.state == 1"></view>
  31. <view class="value value_2" v-else></view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 状态 -->
  38. <view class="state_list" v-if="data.state_list">
  39. <view class="title">
  40. <view class="icon">
  41. <image src="../icon/canshu.png" mode=""></image>
  42. </view>
  43. <view class="text">状态</view>
  44. </view>
  45. <view class="list">
  46. <view class="state" v-for="(item,index) in data.state_list" :key="index">
  47. <view class="label">{{item.label}}</view>
  48. <!-- 1-开 2-关 -->
  49. <view class="value value_1" v-if="item.state == 1"></view>
  50. <view class="value value_2" v-else></view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 控制参数 -->
  55. <view class="parameter" v-if="data.parameter">
  56. <view class="title">
  57. <view class="icon">
  58. <image src="../icon/canshu.png" mode=""></image>
  59. </view>
  60. <view class="text">控制参数</view>
  61. </view>
  62. <view class="list">
  63. <view class="item" v-for="(item_2,index_2) in data.parameter" :key="index_2"
  64. @click="show_item(item_2)">
  65. <view class="label">{{item_2.label}}</view>
  66. <view class="value">{{item_2.state}}</view>
  67. <view class="unit">{{item_2.unit}}</view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import data from "./life_water.json"
  75. export default {
  76. data() {
  77. return {
  78. mine_code: "",
  79. system_type: "",
  80. // 数据刷新定时器
  81. data_timer: {},
  82. data: null
  83. };
  84. },
  85. onLoad(option) {
  86. uni.setNavigationBarTitle({
  87. title: option.name
  88. })
  89. this.mine_code = option.mine_code
  90. this.system_type = option.system_type
  91. this.get_data()
  92. this.data_timer = setInterval(() => {
  93. this.get_data()
  94. }, 10000)
  95. },
  96. methods: {
  97. show_item(item) {
  98. uni.showToast({
  99. icon: "none",
  100. title: item.label + " " + item.value + " " + item.unit
  101. })
  102. },
  103. get_data() {
  104. this.$api.unified_automation_system({
  105. mine_code: this.mine_code,
  106. system_type: this.system_type
  107. }).then((res) => {
  108. console.log(res)
  109. this.data = res.data
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. page {
  117. background-color: #0B163B;
  118. box-sizing: border-box;
  119. padding: 30rpx 10rpx;
  120. }
  121. .title {
  122. margin: 0 auto;
  123. margin-bottom: 50rpx;
  124. display: flex;
  125. justify-content: center;
  126. align-items: center;
  127. width: 290rpx;
  128. height: 60rpx;
  129. background-image: url(../icon/border.png);
  130. background-size: 100% 100%;
  131. background-repeat: no-repeat;
  132. .icon {
  133. margin-right: 10rpx;
  134. image {
  135. width: 30rpx;
  136. height: 30rpx;
  137. }
  138. }
  139. .text {
  140. color: #00FFF6;
  141. font-size: 30rpx;
  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. margin-top: 10rpx;
  168. height: 60rpx;
  169. display: flex;
  170. align-items: center;
  171. justify-content: center;
  172. .label {
  173. color: #4CB1FF;
  174. font-size: 28rpx;
  175. }
  176. .value {
  177. margin-left: 20rpx;
  178. width: 40rpx;
  179. height: 40rpx;
  180. border-radius: 50%;
  181. }
  182. .value_1 {
  183. background-color: #00FF00;
  184. }
  185. .value_2 {
  186. background-color: #DCDCDC;
  187. }
  188. }
  189. .list{
  190. overflow: hidden;
  191. .state{
  192. box-sizing: border-box;
  193. float: left;
  194. width: 350rpx;
  195. height: 70rpx;
  196. display: flex;
  197. align-items: center;
  198. .label {
  199. width: 160rpx;
  200. color: #4CB1FF;
  201. font-size: 28rpx;
  202. text-overflow: ellipsis;
  203. white-space: nowrap;
  204. overflow: hidden;
  205. }
  206. .value {
  207. margin-left: 20rpx;
  208. width: 40rpx;
  209. height: 40rpx;
  210. border-radius: 50%;
  211. }
  212. .value_1 {
  213. background-color: #00FF00;
  214. }
  215. .value_2 {
  216. background-color: #DCDCDC;
  217. }
  218. }
  219. }
  220. }
  221. .pump:nth-child(Odd) {
  222. border-right: 2rpx solid;
  223. border-image: linear-gradient(#0B163B, #00B7F5, #0B163B) 10;
  224. }
  225. }
  226. .state_list{
  227. margin-top: 40rpx;
  228. .title {
  229. margin: 20rpx auto;
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. width: 230rpx;
  234. height: 60rpx;
  235. background-image: url(../icon/border.png);
  236. background-size: 100% 100%;
  237. background-repeat: no-repeat;
  238. .icon {
  239. margin-right: 20rpx;
  240. image {
  241. width: 30rpx;
  242. height: 30rpx;
  243. }
  244. }
  245. .text {
  246. color: #00FFF6;
  247. font-size: 30rpx;
  248. }
  249. }
  250. .list{
  251. margin: 0 auto;
  252. width: 700rpx;
  253. overflow: hidden;
  254. display: flex;
  255. flex-wrap: wrap;
  256. justify-content: space-between;
  257. .state{
  258. box-sizing: border-box;
  259. width: 350rpx;
  260. height: 70rpx;
  261. display: flex;
  262. align-items: center;
  263. .label {
  264. width: 240rpx;
  265. color: #4CB1FF;
  266. font-size: 28rpx;
  267. text-align: justify;
  268. text-align-last: justify;
  269. text-overflow: ellipsis;
  270. white-space: nowrap;
  271. overflow: hidden;
  272. }
  273. .value {
  274. margin-left: 20rpx;
  275. width: 40rpx;
  276. height: 40rpx;
  277. border-radius: 50%;
  278. }
  279. .value_1 {
  280. background-color: #00FF00;
  281. }
  282. .value_2 {
  283. background-color: #DCDCDC;
  284. }
  285. }
  286. }
  287. }
  288. .parameter {
  289. box-sizing: border-box;
  290. margin-top: 40rpx;
  291. .title {
  292. margin: 0 auto;
  293. display: flex;
  294. justify-content: center;
  295. align-items: center;
  296. width: 230rpx;
  297. height: 60rpx;
  298. background-image: url(../icon/border.png);
  299. background-size: 100% 100%;
  300. background-repeat: no-repeat;
  301. .icon {
  302. margin-right: 20rpx;
  303. image {
  304. width: 30rpx;
  305. height: 30rpx;
  306. }
  307. }
  308. .text {
  309. color: #00FFF6;
  310. font-size: 30rpx;
  311. }
  312. }
  313. .list {
  314. margin-left: 20rpx;
  315. margin-top: 40rpx;
  316. .item {
  317. height: 60rpx;
  318. display: flex;
  319. color: #4CB1FF;
  320. font-size: 28rpx;
  321. .label {
  322. width: 200rpx;
  323. text-overflow: ellipsis;
  324. white-space: nowrap;
  325. overflow: hidden;
  326. }
  327. .value {
  328. margin: 0 20rpx;
  329. width: 200rpx;
  330. height: 40rpx;
  331. box-sizing: border-box;
  332. padding: 0 10rpx;
  333. background: rgba(0, 4, 15, 0.36);
  334. border: 2rpx solid #3D55A5;
  335. color: #FFF600;
  336. font-size: 24rpx;
  337. text-overflow: ellipsis;
  338. white-space: nowrap;
  339. overflow: hidden;
  340. }
  341. .unit {
  342. width: 100rpx;
  343. }
  344. }
  345. }
  346. }
  347. </style>