deviceOffLine.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="site-wrapper" ref="contentWrapper">
  3. <!-- 筛选框start -->
  4. <view class="ding">
  5. <view class="cu-bar search bg-gray filter-section" style="with:50%;">
  6. <view class="search-form round bg-white" >
  7. <select name="" id="" placeholder="">
  8. <option value="">请选择设备类型</option>
  9. <option value="">类型1</option>
  10. <option value="">类型2</option>
  11. </select>
  12. </view>
  13. <view class="search-form round bg-white">
  14. <input type="text"
  15. placeholder="选输入设备点位" confirm-type="search"></input>
  16. </view>
  17. </view>
  18. <view class="cu-bar search bg-gray filter-section">
  19. <view class="search-form round bg-white" style="margin-bottom:26rpx">
  20. <input class="" @focus="InputFocus" v-model="siteName" @blur="InputBlur" :adjust-position="false" type="text"
  21. placeholder="选择传输方式" confirm-type="search"></input>
  22. </view>
  23. <view class="action">
  24. <button class="cu-btn bg-blue round" @click="searchData()">查询</button>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 筛选框end -->
  29. <!-- 设备列表start -->
  30. <block class="">
  31. <view class="processList" style="margin-top:206rpx">
  32. <view class="cu-list menu-avatar ">
  33. <view class="cu-item" v-for="(item,index) in deviceOffLineData" :key="index" >
  34. <view class="cu-avatar lg" style="background-image:url(../../static/device-icon.png);"></view>
  35. <view class="content">
  36. <view class="pro-title">
  37. <view class="cut">{{item.title}}</view>
  38. </view>
  39. <view class="pro-des ">
  40. <view class="text-cut">
  41. {{item.subTitle}}
  42. </view>
  43. </view>
  44. <view class="pro-date ">{{item.time}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </block>
  50. <!-- 设备列表end -->
  51. </view>
  52. </template>
  53. <script>
  54. import json from '../../data/json.js';
  55. export default {
  56. data() {
  57. return {
  58. deviceOffLineData:json.deviceOffLineData,
  59. siteListRes: 0,
  60. siteName: '',
  61. type: '0',
  62. siteListData: [],
  63. modalName: null,
  64. listTouchStart: 0,
  65. listTouchDirection: null,
  66. CustomBar: this.CustomBar,
  67. };
  68. },
  69. onPullDownRefresh() {
  70. console.log('refresh');
  71. setTimeout(function() {
  72. uni.stopPullDownRefresh();
  73. }, 1000);
  74. },
  75. computed: {
  76. newSiteListData() {
  77. return this.siteListData.map(item => {
  78. this.$set(item, "isShow", false)
  79. return item
  80. })
  81. }
  82. },
  83. mounted() {
  84. document.addEventListener('click', (e) => {
  85. if (e.target.className != 'showDetail') {
  86. this.siteListData.forEach(item => {
  87. item.isShow = false
  88. })
  89. }
  90. })
  91. },
  92. onLoad() {
  93. this.getSiteList()
  94. },
  95. methods: {
  96. searchData() {
  97. this.getSiteList({
  98. "siteName": this.siteName
  99. })
  100. },
  101. async getSiteList(ming) {
  102. const res = await this.$myRequest({
  103. url: 'OperationMonitoring/getSiteList',
  104. showLoading: true,
  105. data: ming
  106. })
  107. this.siteListRes = 1;
  108. console.log(res.data.data)
  109. this.siteListData = res.data.data
  110. },
  111. // 隐藏显示
  112. showDetail(e) {
  113. // 存储点击那一项的状态
  114. const nowStatu = e.isShow;
  115. // 将每一项列表的isShow设置为false,让所有的列表都隐藏
  116. this.siteListData.forEach(item => {
  117. item.isShow = false
  118. })
  119. // 用于再次点击该项的取反
  120. e.isShow = !nowStatu
  121. },
  122. InputFocus(e) {
  123. this.InputBottom = e.detail.height
  124. },
  125. InputBlur(e) {
  126. this.InputBottom = 0
  127. },
  128. }
  129. }
  130. </script>
  131. <style>
  132. </style>