p-i-safety-monitoring.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view>
  3. <!-- navbar -->
  4. <p-i-s-navbar></p-i-s-navbar>
  5. <view style="margin-bottom: 200rpx;">
  6. <!-- 模拟量 -->
  7. <view v-if="active == 1">
  8. <p-i-s-content-1 :simulation="simulation" :simulationList="simulationList"></p-i-s-content-1>
  9. </view>
  10. <!-- 开关量 -->
  11. <view v-if="active == 2">
  12. <p-i-s-content-2 :sluice="sluice" :sluiceList="sluiceList"></p-i-s-content-2>
  13. </view>
  14. </view>
  15. <!-- tabbar -->
  16. <view class="tabbar">
  17. <view class="list_item">
  18. <view class="item" :class="active === 1 ? 'active':''" @click="click_item(1)">
  19. <view class="item_icon icon_one"></view>
  20. <view class="item_name">
  21. 模拟量
  22. </view>
  23. </view>
  24. <view class="item" :class="active === 2 ? 'active':''" @click="click_item(2)">
  25. <view class="item_icon icon_two"></view>
  26. <view class="item_name">
  27. 开关量
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. active:1,
  39. // 模拟量
  40. // 监测统计
  41. simulation:[],
  42. simulationList:[],
  43. // simulationList_img:[],
  44. // 开关量
  45. sluice:[],
  46. sluiceList:[],
  47. };
  48. },
  49. onLoad() {
  50. // 模拟量
  51. this.getSimulation()
  52. this.getSimulationList()
  53. // 开关量
  54. this.getSluice()
  55. this.getSluiceList()
  56. },
  57. methods:{
  58. click_item(item){
  59. this.active = item
  60. },
  61. // 模拟量
  62. // 监测统计
  63. async getSimulation(){
  64. const res = await this.$myRequest({
  65. method:"POST",
  66. url: '/safety/total',
  67. header: {
  68. 'Content-Type': 'application/json',
  69. },
  70. data:{
  71. type:"simulation"
  72. }
  73. })
  74. console.log(res.data.data)
  75. this.simulation = res.data.data
  76. },
  77. // 统计项
  78. async getSimulationList(){
  79. console.log()
  80. const res = await this.$myRequest({
  81. method:"POST",
  82. url: '/safety/simulation/total',
  83. header: {
  84. 'Content-Type': 'application/json',
  85. 'Authorization':uni.getStorageSync('Authorization'),
  86. },
  87. })
  88. console.log(res.data.data)
  89. this.simulationList = res.data.data
  90. // this.originArr = this.simulationList
  91. // // 新数组,用来装数据
  92. // var newArr = [];
  93. // //通过map方法将原始数组中的每一项循环
  94. // this.originArr.map(function(item,index){
  95. // //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
  96. // var sevm = {};
  97. // //给每一项中的参数初始化并赋值
  98. // sevm = item.typeCode;
  99. // //将项放进新的数组
  100. // newArr[index] = sevm
  101. // })
  102. },
  103. // 开关量
  104. async getSluice(){
  105. const res = await this.$myRequest({
  106. method:"POST",
  107. url: '/safety/total',
  108. header: {
  109. 'Content-Type': 'application/json',
  110. },
  111. data:{
  112. type:"sluice"
  113. }
  114. })
  115. console.log(res.data.data)
  116. this.sluice = res.data.data
  117. },
  118. // 统计项
  119. async getSluiceList(){
  120. console.log()
  121. const res = await this.$myRequest({
  122. method:"POST",
  123. url: '/safety/sluice/total',
  124. header: {
  125. 'Content-Type': 'application/json',
  126. 'Authorization':uni.getStorageSync('Authorization'),
  127. },
  128. })
  129. console.log(res.data.data)
  130. this.sluiceList = res.data.data
  131. },
  132. }
  133. }
  134. </script>
  135. <style lang="scss">
  136. .tabbar{
  137. z-index: 999;
  138. background-color: #fff;
  139. position: fixed;
  140. bottom: 0;
  141. width: 750rpx;
  142. .list_item{
  143. width: 100%;
  144. border-top: 2rpx solid #f3f3f3;
  145. box-sizing: border-box;
  146. padding: 12rpx 0;
  147. .item{
  148. float: left;
  149. width: 50%;
  150. .item_icon{
  151. margin: 0 auto;
  152. width: 45rpx;
  153. height: 45rpx;
  154. background-size: cover;
  155. background-repeat: no-repeat;
  156. }
  157. .icon_one{
  158. background-image: url(icon/ss1.png);
  159. }
  160. .icon_two{
  161. background-image: url(icon/work.png);
  162. }
  163. .item_name{
  164. text-align: center;
  165. font-size: 25rpx;
  166. font-family: PingFangSC-Regular, PingFang SC;
  167. font-weight: 400;
  168. color: #929292;
  169. line-height: 40rpx;
  170. }
  171. }
  172. .active{
  173. .icon_one{
  174. background-image: url(icon/ss2.png);
  175. }
  176. .icon_two{
  177. background-image: url(icon/work_active.png);
  178. }
  179. .item_name{
  180. color: #3498DB;
  181. }
  182. }
  183. }
  184. }
  185. </style>