deviceOffLine.vue 3.6 KB

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