seemore.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="u-flex f-d-c m-w u-p-l-30 u-p-r-30">
  3. <view class="m-w">
  4. <u-dropdown>
  5. <u-dropdown-item @change="drowcitem1" :title="title" :options="options1"></u-dropdown-item>
  6. </u-dropdown>
  7. </view>
  8. <scroll-view v-if="!opendata" :scroll-y="true" @scrolltolower="lazyGetRooms()" class="scr-height">
  9. <block v-for="(index,key) in list" :key="key">
  10. <cDisk :more="1" :parobj="index"
  11. :prourl="`/scan_pages/patrol/patrol?taskId=${index.id}&status=${index.status}`" />
  12. </block>
  13. <view style="overflow: hidden;">
  14. <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
  15. </view>
  16. </scroll-view>
  17. <u-empty text="正在搜索中" v-else mode="list"></u-empty>
  18. <u-toast ref="sacast" />
  19. </view>
  20. </template>
  21. <script>
  22. import cDisk from '@/components/c-disk/index.vue'
  23. import {
  24. getTaskPageOfScan,
  25. patrolTask
  26. } from '@/api/index.js'
  27. import dayjs from "dayjs";
  28. import {
  29. mapState
  30. } from 'vuex'
  31. export default {
  32. components: {
  33. cDisk
  34. },
  35. data() {
  36. return {
  37. options1: [{
  38. label: '今天',
  39. value: [dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime())).format(
  40. "YYYY-MM-DD HH:mm:ss"), dayjs(new Date(new Date(new Date().toLocaleDateString())
  41. .getTime() + 24 * 60 * 60 * 1000 - 1)).format("YYYY-MM-DD HH:mm:ss")],
  42. },
  43. {
  44. label: '昨天',
  45. value: [dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime() - 24 * 60 * 60 *
  46. 1000)).format("YYYY-MM-DD HH:mm:ss"), dayjs(new Date(new Date(new Date()
  47. .toLocaleDateString()).getTime() - 1)).format("YYYY-MM-DD HH:mm:ss")],
  48. },
  49. {
  50. label: '近7日',
  51. value: [dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime() - (24 * 60 * 60 *
  52. 1000) * 3)).format("YYYY-MM-DD HH:mm:ss"), dayjs(new Date(new Date(new Date()
  53. .toLocaleDateString()).getTime() + (24 * 60 * 60 * 1000) * 3)).format(
  54. "YYYY-MM-DD HH:mm:ss")],
  55. }
  56. ],
  57. options2: [{
  58. label: '合格的',
  59. value: 1,
  60. },
  61. {
  62. label: '不合格',
  63. value: 2,
  64. },
  65. ],
  66. list: [],
  67. totalCount: -1,
  68. curPage: 1,
  69. totalPage: 0, //总页数
  70. queryform: {
  71. // value1:undefined,
  72. // beginTimeStart:undefined,
  73. // beginTimeEnd:undefined,
  74. // pointId: 0 ,
  75. },
  76. opendata: false,
  77. title: "时间",
  78. //下拉加载配置
  79. status: 'loadmore',
  80. iconType: 'flower',
  81. loadText: {
  82. loadmore: '轻轻上拉',
  83. loading: '努力加载中',
  84. nomore: '实在没有了'
  85. }
  86. }
  87. },
  88. computed: {
  89. ...mapState({
  90. timer: state => state.user.timer
  91. })
  92. },
  93. onLoad() {
  94. // this.queryform.beginTimeStart = this.timer.beginTimeStart
  95. // this.queryform.beginTimeEnd = this.timer.beginTimeEnd
  96. this.getlist(-1)
  97. },
  98. methods: {
  99. // open(){
  100. // this.opendata=true
  101. // },
  102. // close(){
  103. // this.opendata=false
  104. // },
  105. drowcitem1(row) {
  106. let row1 = (JSON.parse(JSON.stringify(row))).toString()
  107. let text = this.options1.find(e => {
  108. let _evalue = (JSON.parse(JSON.stringify(e.value))).toString()
  109. return _evalue == row1
  110. })
  111. this.title = text.label
  112. this.queryform.beginTimeStart = row[0]
  113. this.queryform.beginTimeEnd = row[1]
  114. this.$nextTick(() => {
  115. this.getlist(-1)
  116. })
  117. },
  118. async getlist(index) {
  119. if (this.totalCount == -1 || index == -1) {
  120. this.list = []
  121. this.curPage = 1
  122. let data = await patrolTask({
  123. page: 1,
  124. size: 10,
  125. ...this.queryform
  126. })
  127. const {
  128. list,
  129. total,
  130. } = data.data
  131. this.totalCount = total //总个数
  132. this.list = list //列表
  133. } else {
  134. let curPage = this.curPage + 1
  135. if (this.list.length < this.totalCount) {
  136. let {
  137. data
  138. } = await patrolTask({
  139. page: curPage,
  140. size: 10,
  141. ...this.queryform
  142. })
  143. this.curPage = this.curPage + 1
  144. data.list.forEach(i => {
  145. this.list.push(i)
  146. })
  147. } else if (this.list.length == this.totalCount) {
  148. this.$refs.sacast.show({
  149. title: '没有更多了',
  150. type: 'info',
  151. })
  152. }
  153. }
  154. },
  155. //懒加载房间数据
  156. lazyGetRooms() {
  157. var timer = null;
  158. if (this.list.length == this.totalCount) this.status = 'nomore';
  159. this.status = 'loading';
  160. clearTimeout(timer)
  161. timer = setTimeout(() => {
  162. this.getlist(1)
  163. if (this.list.length == this.totalCount) this.status = 'nomore';
  164. else this.status = 'loading';
  165. }, 2000)
  166. }
  167. }
  168. }
  169. </script>
  170. <style scoped>
  171. .scr-height {
  172. height: calc(100vh - 74rpx);
  173. background: #FFFFFF;
  174. box-shadow: 0px 0px 6rpx 0px rgba(6, 0, 1, .3);
  175. border-radius: 10rpx 10rpx 0px 0px;
  176. width: 690rpx;
  177. /* padding-bottom: 10rpx; */
  178. }
  179. </style>