basefacility.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. @click="skip(items)">
  11. <view class="equipment_top">
  12. <image :src="$imageURL+'/bigdata_app/image/fourMoodBase/'+items.equip_type+'.png'" mode=""
  13. class="equipment_top_img"></image>
  14. <span class="equipment_top_name">{{items.type_name}}</span>
  15. </view>
  16. <view class="equipment_bot">
  17. <p class="equipment_bot_id">设备ID:{{items.d_id}}</p>
  18. <p class="equipment_bot_name">设备名称:{{items.device_id}}</p>
  19. <view class="equipment_state">在线</view>
  20. </view>
  21. </view>
  22. <view class="tishi" v-if="!tishiTF">
  23. 暂无数据
  24. </view>
  25. </view>
  26. </view>
  27. <view class="top" v-if="isTop" @click="top">
  28. <image :src="$imageURL+ '/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. base_id: "",
  37. assignments: [],
  38. images: [{
  39. path: "/image/fourMoodBase/1.png",
  40. id: 3
  41. }, {
  42. path: "/image/fourMoodBase/5.png",
  43. id: 5
  44. }, {
  45. path: "/image/fourMoodBase/2.png",
  46. id: 6
  47. }, {
  48. path: "/image/fourMoodBase/4.png",
  49. id: 3
  50. }, {
  51. path: "/image/fourMoodBase/qxz.png",
  52. id: 5
  53. }, {
  54. path: "/image/fourMoodBase/jk.png",
  55. id: 6
  56. }, {
  57. path: "/image/fourMoodBase/bzy.png",
  58. id: 7
  59. }, {
  60. path: "/image/fourMoodBase/10.png",
  61. id: 10
  62. }],
  63. tishiTF: false,
  64. isTop: false
  65. }
  66. },
  67. methods: {
  68. async ybase(id) { //获取分布位置
  69. const res = await this.$myRequest({
  70. url: '/api/api_gateway?method=base.bases.base_map_list',
  71. data: {
  72. base_id: id
  73. }
  74. })
  75. this.assignments = res
  76. console.log(this.assignments)
  77. if (this.assignments.length == 0) {
  78. this.tishiTF = false
  79. } else {
  80. this.tishiTF = true
  81. }
  82. },
  83. async camera() { //设备列表
  84. const res = await this.$myRequest({
  85. url: '/api/api_gateway?method=camera.camera_manage.list_camera',
  86. data: {
  87. page_size: 1,
  88. }
  89. })
  90. this.accessToken = res.accessToken
  91. },
  92. clickLeft() {
  93. uni.navigateBack({
  94. delta: 1
  95. })
  96. },
  97. top() {
  98. uni.pageScrollTo({
  99. scrollTop: 0,
  100. duration: 500
  101. })
  102. },
  103. async skip(items) {
  104. const resDefault = await this.$myRequest({
  105. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  106. data: {
  107. device_type_id: items.equip_type,
  108. page: 1,
  109. page_size: "10",
  110. device_id: items.device_id,
  111. }
  112. })
  113. let itemDefault = {
  114. ...items
  115. }
  116. if (resDefault.counts == 1) {
  117. itemDefault = {
  118. ...items,
  119. ...resDefault.data[0]
  120. }
  121. }
  122. var item = JSON.stringify(itemDefault)
  123. switch (items.equip_type) {
  124. case 5:
  125. uni.navigateTo({
  126. url: "../environment/equipment?shebei=" + item
  127. })
  128. break
  129. case 6:
  130. uni.navigateTo({
  131. url: "/pages/webview?device_id=" + items.device_id + "&accessToken=" + this
  132. .accessToken
  133. })
  134. break
  135. case 44:
  136. uni.navigateTo({
  137. url: "/pages/webview?device_id=" + items.device_id + "&accessToken=" + uni
  138. .getStorageSync('session_key') + '&type=dgp'
  139. })
  140. break
  141. case 43:
  142. uni.navigateTo({
  143. url: "../fmSys/details?info=" + item
  144. })
  145. break;
  146. case 10:
  147. uni.navigateTo({
  148. url: '/pages/cb/xy2.0/particulars?info=' + item
  149. });
  150. break
  151. case 8:
  152. // item.type = this.type_id;
  153. uni.navigateTo({
  154. url: '../cb/thxydetail/thxydetail?imei=' + items.device_id,
  155. });
  156. break;
  157. case 26:
  158. case 11:
  159. uni.navigateTo({
  160. url: '../disease/cmb?shebei=' + item,
  161. });
  162. break;
  163. default:
  164. uni.navigateTo({
  165. url: '/pages/cb/equip-detail/equip-detail?info=' + item
  166. });
  167. break
  168. }
  169. }
  170. },
  171. onLoad(option) {
  172. this.base_id = option.id
  173. this.ybase(option.id)
  174. this.camera()
  175. },
  176. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  177. if (e.scrollTop > 200) { //距离大于200时显示
  178. this.isTop = true
  179. } else { //距离小于200时隐藏
  180. this.isTop = false
  181. }
  182. },
  183. }
  184. </script>
  185. <style lang="scss">
  186. .ass_list {
  187. position: absolute;
  188. top: 54px;
  189. width: 100%;
  190. margin-bottom: 40px;
  191. .tishi {
  192. width: 100%;
  193. text-align: center;
  194. height: 100rpx;
  195. line-height: 100rpx;
  196. font-size: 36rpx;
  197. }
  198. .equipment {
  199. width: 90%;
  200. margin: 20rpx auto;
  201. box-shadow: 0 0 10rpx #bcb9ca;
  202. padding: 20rpx 30rpx;
  203. box-sizing: border-box;
  204. .equipment_top {
  205. height: 60rpx;
  206. width: 100%;
  207. border-bottom: 1px solid #dfe5ec;
  208. position: relative;
  209. .equipment_top_img {
  210. width: 40rpx;
  211. height: 40rpx;
  212. position: absolute;
  213. }
  214. .equipment_top_name {
  215. font-size: 28rpx;
  216. margin-left: 60rpx;
  217. }
  218. }
  219. .equipment_bot {
  220. padding: 30rpx 0;
  221. position: relative;
  222. .equipment_bot_id {
  223. font-weight: 700;
  224. font-size: 15px;
  225. margin-bottom: 16rpx;
  226. }
  227. .equipment_bot_name {
  228. font-size: 13px;
  229. }
  230. .equipment_state {
  231. position: absolute;
  232. top: 20rpx;
  233. right: 0;
  234. width: 100rpx;
  235. height: 100rpx;
  236. text-align: center;
  237. line-height: 100rpx;
  238. color: #42b983;
  239. }
  240. }
  241. }
  242. }
  243. .top {
  244. position: fixed;
  245. right: 30px;
  246. bottom: 100px;
  247. z-index: 100;
  248. image {
  249. width: 100rpx;
  250. height: 100rpx;
  251. }
  252. }
  253. </style>