ventilation.vue 6.9 KB

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