basefacility.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;">
  4. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="基地设备"></uni-nav-bar>
  5. </view>
  6. <view class="ass_list">
  7. <view class="equipment" v-for="(items,indexs) in assignments" :key="items.id" v-if="tishiTF">
  8. <view class="equipment_top">
  9. <image :src="items.src" mode="" class="equipment_top_img"></image>
  10. <span class="equipment_top_name">{{items.type_name}}</span>
  11. </view>
  12. <view class="equipment_bot">
  13. <p class="equipment_bot_id">设备ID:{{items.d_id}}</p>
  14. <p class="equipment_bot_name">设备名称:{{items.device_id}}</p>
  15. <view class="equipment_state">在线</view>
  16. </view>
  17. </view>
  18. <view class="tishi" v-if="!tishiTF">
  19. 暂无数据
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. base_id:"",
  29. assignments:[],
  30. images: [{
  31. path: "../../static/image/fourMoodBase/测报灯.png",
  32. id: 3
  33. }, {
  34. path: "../../static/image/fourMoodBase/环境监测.png",
  35. id: 5
  36. }, {
  37. path: "../../static/image/fourMoodBase/监控.png",
  38. id: 6
  39. }, {
  40. path: "../../static/image/fourMoodBase/孢子仪.png",
  41. id: 7
  42. }],
  43. tishiTF:false
  44. }
  45. },
  46. methods: {
  47. async ybase(id) { //获取分布位置
  48. const res = await this.$myRequest({
  49. url: '/api/api_gateway?method=base.bases.base_map_list',
  50. data:{
  51. base_id:id
  52. }
  53. })
  54. this.assignments = res
  55. console.log(this.assignments)
  56. for(var i=0;i<this.images.length;i++){
  57. for(var j=0;j<this.assignments.length;j++){
  58. if(this.assignments[j].equip_type == this.images[i].id){
  59. this.assignments[j].src = this.images[i].path
  60. }
  61. }
  62. }
  63. if(this.assignments.length == 0){
  64. this.tishiTF = false
  65. }else{
  66. this.tishiTF = true
  67. }
  68. },
  69. clickLeft(){
  70. uni.navigateBack({
  71. delta:1
  72. })
  73. }
  74. },
  75. onLoad(option) {
  76. this.base_id = option.id
  77. this.ybase(option.id)
  78. },
  79. }
  80. </script>
  81. <style lang="scss">
  82. .ass_list {
  83. position: absolute;
  84. top: 54px;
  85. width: 100%;
  86. margin-bottom: 40px;
  87. .tishi{
  88. width: 100%;
  89. text-align: center;
  90. height: 100rpx;
  91. line-height: 100rpx;
  92. font-size: 36rpx;
  93. }
  94. .equipment {
  95. width: 90%;
  96. margin: 20rpx auto;
  97. box-shadow: 0 0 10rpx #bcb9ca;
  98. padding: 20rpx 30rpx;
  99. box-sizing: border-box;
  100. .equipment_top {
  101. height: 60rpx;
  102. width: 100%;
  103. border-bottom: 1px solid #dfe5ec;
  104. position: relative;
  105. .equipment_top_img {
  106. width: 40rpx;
  107. height: 40rpx;
  108. position: absolute;
  109. }
  110. .equipment_top_name {
  111. font-size: 24rpx;
  112. margin-left: 60rpx;
  113. }
  114. }
  115. .equipment_bot {
  116. padding: 30rpx 0;
  117. position: relative;
  118. .equipment_bot_id {
  119. font-weight: 700;
  120. font-size: 15px;
  121. margin-bottom: 16rpx;
  122. }
  123. .equipment_bot_name {
  124. font-size: 10px;
  125. }
  126. .equipment_state {
  127. position: absolute;
  128. top: 20rpx;
  129. right: 0;
  130. width: 100rpx;
  131. height: 100rpx;
  132. text-align: center;
  133. line-height: 100rpx;
  134. color: #42b983;
  135. }
  136. }
  137. }
  138. }
  139. </style>