basefacility.vue 3.2 KB

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