n-safety-monitoring-tab.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view>
  3. <view class="tab">
  4. <view class="tab_title">
  5. <liuyuno-tabs ref="tab" :tabData="tabs" :defaultIndex="defaultIndex" @tabClick='tabClick' />
  6. </view>
  7. <view class="tab_content" @click="go_content()">
  8. <view class="inner">
  9. <view class="section_1">
  10. <view class="item">
  11. <view class="box">
  12. <view class="name">模拟量</view>
  13. <view class="num">{{simulation}}</view>
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="box">
  18. <view class="name">开关量</view>
  19. <view class="num">{{sluice}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="section_2">
  24. <view class="list_item">
  25. <view class="item" v-for="(item,index) in list" :key="index">
  26. <view class="item_title">
  27. <view class="item_icon">
  28. <image v-if="item.typeCode == '0001'" src="./icon/wasi.png" mode=""></image>
  29. <image v-if="item.typeCode == '0004'" src="./icon/Co1.png" mode=""></image>
  30. <image v-if="item.typeCode == '1010'" src="./icon/feng.png" mode=""></image>
  31. </view>
  32. <view class="item_name">{{item.typeCodeDesc}}</view>
  33. </view>
  34. <view class="item_content">
  35. <view class="item_content_list">
  36. <view class="content_item" v-for="(item_2,index_2) in item.normalCount"
  37. :key="index_2">
  38. <view class="name">{{item_2.name}}</view>
  39. <view class="num">{{item_2.count}}个</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. defaultIndex: 0,
  56. // 标签栏目 煤矿名称列表
  57. tabs: [],
  58. // 煤矿编码数组
  59. tabs_mine_code: [],
  60. // 当前煤矿编码
  61. mine_code_index: "",
  62. // 模拟量
  63. simulation: 0,
  64. // 开关量
  65. sluice: 0,
  66. // 列表项
  67. list: []
  68. };
  69. },
  70. mounted() {
  71. // 获取煤矿列表
  72. this.get_tabs()
  73. },
  74. methods: {
  75. tabClick(index) {
  76. this.defaultIndex = index
  77. // console.log(this.tabs_mine_code[index])
  78. // 切换当前煤矿编码
  79. this.mine_code_index = this.tabs_mine_code[index]
  80. // 切换后编码的煤矿详情数据查询
  81. this.get_jt_safety_info_part()
  82. // 将切换后的编码发送给页面
  83. this.$emit("code", this.mine_code_index)
  84. },
  85. // 获取煤矿列表
  86. get_tabs() {
  87. this.$p_api.jt_safety_mine_list({
  88. }).then((res) => {
  89. // console.log(res.data.content.data)
  90. let data = res.data.content.data
  91. let tabs = []
  92. let mine_code = []
  93. data.map(function(item, index) {
  94. //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
  95. var sevm = {};
  96. //给每一项中的参数初始化并赋值
  97. sevm = item.mine_name;
  98. //将项放进新的数组
  99. tabs[index] = sevm
  100. })
  101. data.map(function(item, index) {
  102. //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
  103. var sevm = {};
  104. //给每一项中的参数初始化并赋值
  105. sevm = item.mine_code;
  106. //将项放进新的数组
  107. mine_code[index] = sevm
  108. })
  109. this.tabs = tabs
  110. this.tabs_mine_code = mine_code
  111. // console.log(mine_code[0])
  112. // 定义当前煤矿编码
  113. this.mine_code_index = mine_code[0]
  114. // 当前编码的煤矿详情数据查询
  115. this.get_jt_safety_info_part()
  116. // 将定义后的编码发送给页面
  117. this.$emit("code", this.mine_code_index)
  118. })
  119. },
  120. // 详情数据查询
  121. get_jt_safety_info_part() {
  122. uni.showLoading({
  123. mask: true
  124. })
  125. this.$p_api.jt_safety_info_part({
  126. mine_code: this.mine_code_index
  127. }).then((res) => {
  128. uni.hideLoading()
  129. // console.log(res.data.content)
  130. let data = res.data.content
  131. // 模拟量总数
  132. this.simulation = data.count.simulation
  133. // 开关量总数
  134. this.sluice = data.count.sluice
  135. // 列表项
  136. this.list = data.data
  137. })
  138. },
  139. go_content() {
  140. console.log(this.mine_code_index)
  141. uni.navigateTo({
  142. url: "../../production/safety_monitoring/safety_monitoring?mine=" + this.mine_code_index
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss">
  149. .tab {
  150. box-sizing: border-box;
  151. padding: 0 24rpx;
  152. .tab_title {}
  153. .tab_content {
  154. .inner {
  155. // min-height: 300px;
  156. .section_1 {
  157. margin: 40rpx 0;
  158. display: flex;
  159. justify-content: space-around;
  160. .item {
  161. width: 260rpx;
  162. height: 260rpx;
  163. background-color: #E1EFF8;
  164. border-radius: 50%;
  165. display: flex;
  166. justify-content: center;
  167. align-items: center;
  168. .box {
  169. width: 200rpx;
  170. height: 200rpx;
  171. border: 16rpx solid #FFFFFF;
  172. background-color: #57B3F4;
  173. border-radius: 50%;
  174. display: flex;
  175. flex-direction: column;
  176. justify-content: center;
  177. align-items: center;
  178. color: #FFFFFF;
  179. .name {}
  180. .num {}
  181. }
  182. }
  183. .item:nth-child(2) {
  184. background-color: #B7FFC1;
  185. .box {
  186. background-color: #2ECD73;
  187. }
  188. }
  189. }
  190. .section_2 {
  191. .list_item {
  192. .item {
  193. border-top: 1rpx solid #f3f3f3;
  194. border-bottom: 1rpx solid #f3f3f3;
  195. box-sizing: border-box;
  196. padding: 0 30rpx;
  197. padding-top: 28rpx;
  198. padding-bottom: 26rpx;
  199. .item_title {
  200. display: flex;
  201. box-sizing: border-box;
  202. padding-bottom: 18rpx;
  203. border-bottom: 1rpx solid #f3f3f3;
  204. .item_icon {
  205. margin-left: 6rpx;
  206. image {
  207. width: 83rpx;
  208. height: 83rpx;
  209. }
  210. }
  211. .item_name {
  212. margin-left: 23rpx;
  213. font-size: 29rpx;
  214. font-family: PingFangSC-Regular, PingFang SC;
  215. font-weight: 400;
  216. color: #002257;
  217. line-height: 83rpx;
  218. }
  219. }
  220. .item_content {
  221. .item_content_list {
  222. display: flex;
  223. justify-content: space-between;
  224. .content_item {
  225. width: 158rpx;
  226. text-align: center;
  227. .name {
  228. margin-top: 22rpx;
  229. font-size: 25rpx;
  230. font-family: PingFangSC-Regular, PingFang SC;
  231. font-weight: 400;
  232. color: #97A3B4;
  233. line-height: 33rpx;
  234. }
  235. .num {
  236. margin-top: 6rpx;
  237. font-size: 28rpx;
  238. font-family: PingFangSC-Medium, PingFang SC;
  239. font-weight: 500;
  240. line-height: 33rpx;
  241. color: #2ECC71;
  242. }
  243. }
  244. .content_item:nth-child(2) .num {
  245. color: #E74C3C;
  246. }
  247. .content_item:nth-child(3) .num {
  248. color: #2C3E50;
  249. }
  250. .content_item:nth-child(4) .num {
  251. color: #2F54EB;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. }
  260. }
  261. </style>