列表丢数据问题修改

This commit is contained in:
weidizhu_admin 2024-07-16 17:44:16 +08:00
parent 85e7a0b34b
commit 50f264d684
1 changed files with 21 additions and 27 deletions

View File

@ -1,5 +1,7 @@
<template>
<z-paging ref="paging" v-model="dataList" @query="queryList" usePageScroll>
<view class="">
<tm-nav-bar left-icon="arrow-left" :title="desc? getNameByKey(desc) : getNameByKey(type)" @clickLeft="back" />
<view class="content">
<view class="over" style="margin-top: 30rpx" @click="flag = !flag">
@ -9,11 +11,12 @@
<view class="time" v-show="flag">
<punch-calendar @switchMonth="switchMonth" @chooseDay="chooseDay" :errorList="errorList" :successList="successList" ref="calendar"></punch-calendar>
</view>
<view class="list" v-if="dataList.length">
<view class="row" v-for="(item, index) in dataList" :key="index" >
<view class="list" v-for="(item, index) in dataList" :key="index">
<view class="row" >
<view class="data">
<image src="https://img.agrimedia.cn/apptest/%E6%89%8B%E8%A1%A8-%E7%BA%BF%E6%80%A73-0.png" mode="widthFix"></image>
<view v-if="type == 'step'">
123
<!-- 疲劳{{item.data_msg.wear}} -->
运动量{{item.data_msg.stepCount}}
</view>
@ -61,7 +64,7 @@
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script>
@ -116,6 +119,7 @@
onLoad(e) {
this.type = e.type;
this.desc = e.desc||'';
this.queryList()
},
onShow(e) {
@ -138,29 +142,18 @@
methods: {
getArrMaxValue,
queryList(pageNo, pageSize) {
queryList() {
this.$store.dispatch('api/getDeviceListDays', {
type: this.type,
type: (this.type == 'step'?'step_split':this.type),
// type: (this.type),
device_real_time: this.time,
device_id:this.getActiceDevice.device_id
}).then(res => {
let arrData = []
let a = res.data.filter((v) => {
return v.data_msg.stepCount > 0;
if(this.type == 'step'){
// if(v.data_msg.stepCount > 0){
// console.log(v)
// return v;
// // arrData = [...arrData,v]
// // console.log(arrData)
// }
}else{
return v;
// arrData.push(v)
}
})
// let arrData = res.data.filter((v) => {
// return v.data_msg.stepCount > 0
// })
// let arrData = []
// res.data.map((v,i) => {
// if(this.type == 'step'){
// if(v.data_msg.stepCount > 0){
@ -173,9 +166,9 @@
// }
// })
// // arrData = [...arrData,11]
console.log(a)
this.$refs.paging.completeByTotal(arrData,res.last_page);
// console.log(arrData,'end')
// this.$refs.paging.completeByTotal(res.data,res.last_page);
this.dataList = res.data
});
},
@ -190,7 +183,8 @@
//
chooseDay(val) {
this.time = val.year + '-' + val.month + '-' + val.day;
this.$refs.paging.reload();
this.queryList()
// this.$refs.paging.reload();
},
back() {