| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="u-flex f-d-c m-w u-p-l-30 u-p-r-30">
- <view class="m-w">
- <u-dropdown>
- <u-dropdown-item @change="drowcitem1" :title="title" :options="options1"></u-dropdown-item>
- </u-dropdown>
- </view>
- <scroll-view v-if="!opendata" :scroll-y="true" @scrolltolower="lazyGetRooms()" class="scr-height">
- <block v-for="(index,key) in list" :key="key">
- <cDisk :more="1" :parobj="index"
- :prourl="`/scan_pages/patrol/patrol?taskId=${index.id}&status=${index.status}`" />
- </block>
- <view style="overflow: hidden;">
- <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
- </view>
- </scroll-view>
- <u-empty text="正在搜索中" v-else mode="list"></u-empty>
- <u-toast ref="sacast" />
- </view>
- </template>
- <script>
- import cDisk from '@/components/c-disk/index.vue'
- import {
- getTaskPageOfScan,
- patrolTask
- } from '@/api/index.js'
- import dayjs from "dayjs";
- import {
- mapState
- } from 'vuex'
- export default {
- components: {
- cDisk
- },
- data() {
- return {
- options1: [{
- label: '今天',
- value: [dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime())).format(
- "YYYY-MM-DD HH:mm:ss"), dayjs(new Date(new Date(new Date().toLocaleDateString())
- .getTime() + 24 * 60 * 60 * 1000 - 1)).format("YYYY-MM-DD HH:mm:ss")],
- },
- {
- label: '昨天',
- value: [dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime() - 24 * 60 * 60 *
- 1000)).format("YYYY-MM-DD HH:mm:ss"), dayjs(new Date(new Date(new Date()
- .toLocaleDateString()).getTime() - 1)).format("YYYY-MM-DD HH:mm:ss")],
- },
- {
- label: '近7日',
- value: [dayjs(new Date(new Date(new Date().toLocaleDateString()).getTime() - (24 * 60 * 60 *
- 1000) * 3)).format("YYYY-MM-DD HH:mm:ss"), dayjs(new Date(new Date(new Date()
- .toLocaleDateString()).getTime() + (24 * 60 * 60 * 1000) * 3)).format(
- "YYYY-MM-DD HH:mm:ss")],
- }
- ],
- options2: [{
- label: '合格的',
- value: 1,
- },
- {
- label: '不合格',
- value: 2,
- },
- ],
- list: [],
- totalCount: -1,
- curPage: 1,
- totalPage: 0, //总页数
- queryform: {
- // value1:undefined,
- // beginTimeStart:undefined,
- // beginTimeEnd:undefined,
- // pointId: 0 ,
- },
- opendata: false,
- title: "时间",
- //下拉加载配置
- status: 'loadmore',
- iconType: 'flower',
- loadText: {
- loadmore: '轻轻上拉',
- loading: '努力加载中',
- nomore: '实在没有了'
- }
- }
- },
- computed: {
- ...mapState({
- timer: state => state.user.timer
- })
- },
- onLoad() {
- // this.queryform.beginTimeStart = this.timer.beginTimeStart
- // this.queryform.beginTimeEnd = this.timer.beginTimeEnd
- this.getlist(-1)
- },
- methods: {
- // open(){
- // this.opendata=true
- // },
- // close(){
- // this.opendata=false
- // },
- drowcitem1(row) {
- let row1 = (JSON.parse(JSON.stringify(row))).toString()
- let text = this.options1.find(e => {
- let _evalue = (JSON.parse(JSON.stringify(e.value))).toString()
- return _evalue == row1
- })
- this.title = text.label
- this.queryform.beginTimeStart = row[0]
- this.queryform.beginTimeEnd = row[1]
- this.$nextTick(() => {
- this.getlist(-1)
- })
- },
- async getlist(index) {
- if (this.totalCount == -1 || index == -1) {
- this.list = []
- this.curPage = 1
- let data = await patrolTask({
- page: 1,
- size: 10,
- ...this.queryform
- })
- const {
- list,
- total,
- } = data.data
- this.totalCount = total //总个数
- this.list = list //列表
- } else {
- let curPage = this.curPage + 1
- if (this.list.length < this.totalCount) {
- let {
- data
- } = await patrolTask({
- page: curPage,
- size: 10,
- ...this.queryform
- })
- this.curPage = this.curPage + 1
- data.list.forEach(i => {
- this.list.push(i)
- })
- } else if (this.list.length == this.totalCount) {
- this.$refs.sacast.show({
- title: '没有更多了',
- type: 'info',
- })
- }
- }
- },
- //懒加载房间数据
- lazyGetRooms() {
- var timer = null;
- if (this.list.length == this.totalCount) this.status = 'nomore';
- this.status = 'loading';
- clearTimeout(timer)
- timer = setTimeout(() => {
- this.getlist(1)
- if (this.list.length == this.totalCount) this.status = 'nomore';
- else this.status = 'loading';
- }, 2000)
- }
- }
- }
- </script>
- <style scoped>
- .scr-height {
- height: calc(100vh - 74rpx);
- background: #FFFFFF;
- box-shadow: 0px 0px 6rpx 0px rgba(6, 0, 1, .3);
- border-radius: 10rpx 10rpx 0px 0px;
- width: 690rpx;
- /* padding-bottom: 10rpx; */
- }
- </style>
|