n-safety-monitoring-tab.vue 6.7 KB

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