basefacility.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 40px;">
  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(JSON.stringify(items))">
  10. <view class="equipment_top">
  11. <image :src="$imageURL+'/bigdata_app'+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="$imageURL+'/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. for (var i = 0; i < this.images.length; i++) {
  76. for (var j = 0; j < this.assignments.length; j++) {
  77. if (this.assignments[j].equip_type == this.images[i].id) {
  78. this.assignments[j].src = this.images[i].path
  79. }
  80. }
  81. }
  82. if (this.assignments.length == 0) {
  83. this.tishiTF = false
  84. } else {
  85. this.tishiTF = true
  86. }
  87. },
  88. async camera() { //设备列表
  89. const res = await this.$myRequest({
  90. url: '/api/api_gateway?method=camera.camera_manage.list_camera',
  91. data: {
  92. page_size: 1,
  93. }
  94. })
  95. this.accessToken = res.accessToken
  96. },
  97. clickLeft() {
  98. // uni.navigateTo({
  99. // url:"./index"
  100. // })
  101. // 返回上一页
  102. uni.navigateBack({
  103. delta: 1
  104. })
  105. },
  106. top() {
  107. uni.pageScrollTo({
  108. scrollTop: 0,
  109. duration: 500
  110. })
  111. },
  112. skip(items){
  113. console.log(items)
  114. var item = JSON.parse(items)
  115. switch (item.equip_type){
  116. case 5 :
  117. uni.navigateTo({
  118. url: "../environment/equipment?shebei=" + items
  119. })
  120. break
  121. case 6 :
  122. uni.navigateTo({
  123. url: "/pages/webview/webview?device_id=" + item.device_id + "&accessToken=" + this.accessToken
  124. })
  125. break
  126. case 44:
  127. uni.navigateTo({
  128. url: "/pages/webview?device_id=" + item.device_id + "&accessToken=" + uni
  129. .getStorageSync('session_key') +
  130. '&type=dgp'
  131. })
  132. break;
  133. case 10 :
  134. uni.navigateTo({
  135. url: '/pages/cb/xy2.0/particulars?info=' + items
  136. });
  137. break
  138. default:
  139. uni.navigateTo({
  140. url: '/pages/cb/equip-detail/equip-detail?info=' + items
  141. });
  142. break
  143. }
  144. }
  145. },
  146. onLoad(option) {
  147. this.base_id = option.id
  148. this.ybase(option.id)
  149. this.camera()
  150. },
  151. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  152. if (e.scrollTop > 200) { //距离大于200时显示
  153. this.isTop = true
  154. } else { //距离小于200时隐藏
  155. this.isTop = false
  156. }
  157. },
  158. }
  159. </script>
  160. <style lang="scss">
  161. .ass_list {
  162. position: absolute;
  163. top: 54px;
  164. width: 100%;
  165. margin-bottom: 40px;
  166. .tishi {
  167. width: 100%;
  168. text-align: center;
  169. height: 100rpx;
  170. line-height: 100rpx;
  171. font-size: 36rpx;
  172. }
  173. .equipment {
  174. width: 90%;
  175. margin: 20rpx auto;
  176. box-shadow: 0 0 10rpx #bcb9ca;
  177. padding: 20rpx 30rpx;
  178. box-sizing: border-box;
  179. .equipment_top {
  180. height: 60rpx;
  181. width: 100%;
  182. border-bottom: 1px solid #dfe5ec;
  183. position: relative;
  184. .equipment_top_img {
  185. width: 40rpx;
  186. height: 40rpx;
  187. position: absolute;
  188. }
  189. .equipment_top_name {
  190. font-size: 28rpx;
  191. margin-left: 60rpx;
  192. }
  193. }
  194. .equipment_bot {
  195. padding: 30rpx 0;
  196. position: relative;
  197. .equipment_bot_id {
  198. font-weight: 700;
  199. font-size: 15px;
  200. margin-bottom: 16rpx;
  201. }
  202. .equipment_bot_name {
  203. font-size: 13px;
  204. }
  205. .equipment_state {
  206. position: absolute;
  207. top: 20rpx;
  208. right: 0;
  209. width: 100rpx;
  210. height: 100rpx;
  211. text-align: center;
  212. line-height: 100rpx;
  213. color: #42b983;
  214. }
  215. }
  216. }
  217. }
  218. .top {
  219. position: fixed;
  220. right: 30px;
  221. bottom: 100px;
  222. z-index: 100;
  223. image{
  224. width: 100rpx;
  225. height: 100rpx;
  226. }
  227. }
  228. </style>