basefacility.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. base_id: "",
  32. assignments: [],
  33. images: [{
  34. path: "../../static/image/fourMoodBase/1.png",
  35. id: 3
  36. }, {
  37. path: "../../static/image/fourMoodBase/5.png",
  38. id: 5
  39. }, {
  40. path: "../../static/image/fourMoodBase/2.png",
  41. id: 6
  42. }, {
  43. path: "../../static/image/fourMoodBase/4.png",
  44. id: 3
  45. }, {
  46. path: "../../static/image/fourMoodBase/qxz.png",
  47. id: 5
  48. }, {
  49. path: "../../static/image/fourMoodBase/jk.png",
  50. id: 6
  51. }, {
  52. path: "../../static/image/fourMoodBase/bzy.png",
  53. id: 7
  54. }],
  55. tishiTF: false
  56. }
  57. },
  58. methods: {
  59. async ybase(id) { //获取分布位置
  60. const res = await this.$myRequest({
  61. url: '/api/api_gateway?method=base.bases.base_map_list',
  62. data: {
  63. base_id: id
  64. }
  65. })
  66. this.assignments = res
  67. console.log(this.assignments)
  68. for (var i = 0; i < this.images.length; i++) {
  69. for (var j = 0; j < this.assignments.length; j++) {
  70. if (this.assignments[j].equip_type == this.images[i].id) {
  71. this.assignments[j].src = this.images[i].path
  72. }
  73. }
  74. }
  75. if (this.assignments.length == 0) {
  76. this.tishiTF = false
  77. } else {
  78. this.tishiTF = true
  79. }
  80. },
  81. clickLeft() {
  82. uni.navigateBack({
  83. delta: 1
  84. })
  85. }
  86. },
  87. onLoad(option) {
  88. this.base_id = option.id
  89. this.ybase(option.id)
  90. },
  91. }
  92. </script>
  93. <style lang="scss">
  94. .ass_list {
  95. position: absolute;
  96. top: 54px;
  97. width: 100%;
  98. margin-bottom: 40px;
  99. .tishi {
  100. width: 100%;
  101. text-align: center;
  102. height: 100rpx;
  103. line-height: 100rpx;
  104. font-size: 36rpx;
  105. }
  106. .equipment {
  107. width: 90%;
  108. margin: 20rpx auto;
  109. box-shadow: 0 0 10rpx #bcb9ca;
  110. padding: 20rpx 30rpx;
  111. box-sizing: border-box;
  112. .equipment_top {
  113. height: 60rpx;
  114. width: 100%;
  115. border-bottom: 1px solid #dfe5ec;
  116. position: relative;
  117. .equipment_top_img {
  118. width: 40rpx;
  119. height: 40rpx;
  120. position: absolute;
  121. }
  122. .equipment_top_name {
  123. font-size: 24rpx;
  124. margin-left: 60rpx;
  125. }
  126. }
  127. .equipment_bot {
  128. padding: 30rpx 0;
  129. position: relative;
  130. .equipment_bot_id {
  131. font-weight: 700;
  132. font-size: 15px;
  133. margin-bottom: 16rpx;
  134. }
  135. .equipment_bot_name {
  136. font-size: 12px;
  137. }
  138. .equipment_state {
  139. position: absolute;
  140. top: 20rpx;
  141. right: 0;
  142. width: 100rpx;
  143. height: 100rpx;
  144. text-align: center;
  145. line-height: 100rpx;
  146. color: #42b983;
  147. }
  148. }
  149. }
  150. }
  151. </style>