basefacility.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 44px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="基地设备"></uni-nav-bar>
  7. </view>
  8. <view class="ass_list">
  9. <view class="equipment" v-for="(items,indexs) in assignments" :key="items.id" v-if="tishiTF">
  10. <view class="equipment_top">
  11. <image :src="items.src" mode="" class="equipment_top_img"></image>
  12. <span class="equipment_top_name">{{items.type_name}}</span>
  13. </view>
  14. <view class="equipment_bot">
  15. <p class="equipment_bot_id">设备ID:{{items.d_id}}</p>
  16. <p class="equipment_bot_name">设备名称:{{items.device_id}}</p>
  17. <view class="equipment_state">在线</view>
  18. </view>
  19. </view>
  20. <view class="tishi" v-if="!tishiTF">
  21. 暂无数据
  22. </view>
  23. </view>
  24. </view>
  25. <view class="top" v-if="isTop" @click="top">
  26. <image src="../../static/image/6209a98f0cb3b5086f2ca36152c9269.png" mode=""></image>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. base_id: "",
  35. assignments: [],
  36. images: [{
  37. path: "../../static/image/fourMoodBase/1.png",
  38. id: 3
  39. }, {
  40. path: "../../static/image/fourMoodBase/5.png",
  41. id: 5
  42. }, {
  43. path: "../../static/image/fourMoodBase/2.png",
  44. id: 6
  45. }, {
  46. path: "../../static/image/fourMoodBase/4.png",
  47. id: 3
  48. }, {
  49. path: "../../static/image/fourMoodBase/qxz.png",
  50. id: 5
  51. }, {
  52. path: "../../static/image/fourMoodBase/jk.png",
  53. id: 6
  54. }, {
  55. path: "../../static/image/fourMoodBase/bzy.png",
  56. id: 7
  57. }],
  58. tishiTF: false,
  59. isTop:false
  60. }
  61. },
  62. methods: {
  63. async ybase(id) { //获取分布位置
  64. const res = await this.$myRequest({
  65. url: '/api/api_gateway?method=base.bases.base_map_list',
  66. data: {
  67. base_id: id
  68. }
  69. })
  70. this.assignments = res
  71. console.log(this.assignments)
  72. for (var i = 0; i < this.images.length; i++) {
  73. for (var j = 0; j < this.assignments.length; j++) {
  74. if (this.assignments[j].equip_type == this.images[i].id) {
  75. this.assignments[j].src = this.images[i].path
  76. }
  77. }
  78. }
  79. if (this.assignments.length == 0) {
  80. this.tishiTF = false
  81. } else {
  82. this.tishiTF = true
  83. }
  84. },
  85. clickLeft() {
  86. uni.navigateBack({
  87. delta: 1
  88. })
  89. },
  90. top() {
  91. uni.pageScrollTo({
  92. scrollTop: 0,
  93. duration: 500
  94. })
  95. }
  96. },
  97. onLoad(option) {
  98. this.base_id = option.id
  99. this.ybase(option.id)
  100. },
  101. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  102. if (e.scrollTop > 200) { //距离大于200时显示
  103. this.isTop = true
  104. } else { //距离小于200时隐藏
  105. this.isTop = false
  106. }
  107. },
  108. }
  109. </script>
  110. <style lang="scss">
  111. .ass_list {
  112. position: absolute;
  113. top: 54px;
  114. width: 100%;
  115. margin-bottom: 40px;
  116. .tishi {
  117. width: 100%;
  118. text-align: center;
  119. height: 100rpx;
  120. line-height: 100rpx;
  121. font-size: 36rpx;
  122. }
  123. .equipment {
  124. width: 90%;
  125. margin: 20rpx auto;
  126. box-shadow: 0 0 10rpx #bcb9ca;
  127. padding: 20rpx 30rpx;
  128. box-sizing: border-box;
  129. .equipment_top {
  130. height: 60rpx;
  131. width: 100%;
  132. border-bottom: 1px solid #dfe5ec;
  133. position: relative;
  134. .equipment_top_img {
  135. width: 40rpx;
  136. height: 40rpx;
  137. position: absolute;
  138. }
  139. .equipment_top_name {
  140. font-size: 28rpx;
  141. margin-left: 60rpx;
  142. }
  143. }
  144. .equipment_bot {
  145. padding: 30rpx 0;
  146. position: relative;
  147. .equipment_bot_id {
  148. font-weight: 700;
  149. font-size: 15px;
  150. margin-bottom: 16rpx;
  151. }
  152. .equipment_bot_name {
  153. font-size: 13px;
  154. }
  155. .equipment_state {
  156. position: absolute;
  157. top: 20rpx;
  158. right: 0;
  159. width: 100rpx;
  160. height: 100rpx;
  161. text-align: center;
  162. line-height: 100rpx;
  163. color: #42b983;
  164. }
  165. }
  166. }
  167. }
  168. .top {
  169. position: fixed;
  170. right: 30px;
  171. bottom: 100px;
  172. z-index: 100;
  173. image{
  174. width: 100rpx;
  175. height: 100rpx;
  176. }
  177. }
  178. </style>