basefacility.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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" @click="skip(items)">
  10. <view class="equipment_top">
  11. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app/image/fourMoodBase/'+items.equip_type+'.png'" 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="'http://www.hnyfwlw.com:8006/bigdata_app'+'/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: "/image/fourMoodBase/1.png",
  38. id: 3
  39. }, {
  40. path: "/image/fourMoodBase/5.png",
  41. id: 5
  42. }, {
  43. path: "/image/fourMoodBase/2.png",
  44. id: 6
  45. }, {
  46. path: "/image/fourMoodBase/4.png",
  47. id: 3
  48. }, {
  49. path: "/image/fourMoodBase/qxz.png",
  50. id: 5
  51. }, {
  52. path: "/image/fourMoodBase/jk.png",
  53. id: 6
  54. }, {
  55. path: "/image/fourMoodBase/bzy.png",
  56. id: 7
  57. },{
  58. path: "/image/fourMoodBase/10.png",
  59. id: 10
  60. }],
  61. tishiTF: false,
  62. isTop:false
  63. }
  64. },
  65. methods: {
  66. async ybase(id) { //获取分布位置
  67. const res = await this.$myRequest({
  68. url: '/api/api_gateway?method=base.bases.base_map_list',
  69. data: {
  70. base_id: id
  71. }
  72. })
  73. this.assignments = res
  74. console.log(this.assignments)
  75. if (this.assignments.length == 0) {
  76. this.tishiTF = false
  77. } else {
  78. this.tishiTF = true
  79. }
  80. },
  81. async camera() { //设备列表
  82. const res = await this.$myRequest({
  83. url: '/api/api_gateway?method=camera.camera_manage.list_camera',
  84. data: {
  85. page_size: 1,
  86. }
  87. })
  88. this.accessToken = res.accessToken
  89. },
  90. clickLeft() {
  91. uni.navigateBack({
  92. delta: 1
  93. })
  94. },
  95. top() {
  96. uni.pageScrollTo({
  97. scrollTop: 0,
  98. duration: 500
  99. })
  100. },
  101. skip(items){
  102. console.log(items)
  103. var item = JSON.stringify(items)
  104. switch (items.equip_type){
  105. case 5 :
  106. uni.navigateTo({
  107. url: "../environment/equipment?shebei=" + JSON.stringify(items)
  108. })
  109. break
  110. case 6 :
  111. uni.navigateTo({
  112. url: "/pages/webview?device_id=" + items.device_id + "&accessToken=" + this.accessToken
  113. })
  114. break
  115. case 10 :
  116. uni.navigateTo({
  117. url: '/pages/cb/xy2.0/particulars?info=' + item
  118. });
  119. break
  120. default:
  121. uni.navigateTo({
  122. url: '/pages/cb/equip-detail/equip-detail?info=' + item
  123. });
  124. break
  125. }
  126. }
  127. },
  128. onLoad(option) {
  129. this.base_id = option.id
  130. this.ybase(option.id)
  131. this.camera()
  132. },
  133. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  134. if (e.scrollTop > 200) { //距离大于200时显示
  135. this.isTop = true
  136. } else { //距离小于200时隐藏
  137. this.isTop = false
  138. }
  139. },
  140. }
  141. </script>
  142. <style lang="scss">
  143. .ass_list {
  144. position: absolute;
  145. top: 54px;
  146. width: 100%;
  147. margin-bottom: 40px;
  148. .tishi {
  149. width: 100%;
  150. text-align: center;
  151. height: 100rpx;
  152. line-height: 100rpx;
  153. font-size: 36rpx;
  154. }
  155. .equipment {
  156. width: 90%;
  157. margin: 20rpx auto;
  158. box-shadow: 0 0 10rpx #bcb9ca;
  159. padding: 20rpx 30rpx;
  160. box-sizing: border-box;
  161. .equipment_top {
  162. height: 60rpx;
  163. width: 100%;
  164. border-bottom: 1px solid #dfe5ec;
  165. position: relative;
  166. .equipment_top_img {
  167. width: 40rpx;
  168. height: 40rpx;
  169. position: absolute;
  170. }
  171. .equipment_top_name {
  172. font-size: 28rpx;
  173. margin-left: 60rpx;
  174. }
  175. }
  176. .equipment_bot {
  177. padding: 30rpx 0;
  178. position: relative;
  179. .equipment_bot_id {
  180. font-weight: 700;
  181. font-size: 15px;
  182. margin-bottom: 16rpx;
  183. }
  184. .equipment_bot_name {
  185. font-size: 13px;
  186. }
  187. .equipment_state {
  188. position: absolute;
  189. top: 20rpx;
  190. right: 0;
  191. width: 100rpx;
  192. height: 100rpx;
  193. text-align: center;
  194. line-height: 100rpx;
  195. color: #42b983;
  196. }
  197. }
  198. }
  199. }
  200. .top {
  201. position: fixed;
  202. right: 30px;
  203. bottom: 100px;
  204. z-index: 100;
  205. image{
  206. width: 100rpx;
  207. height: 100rpx;
  208. }
  209. }
  210. </style>