<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了!" @load="onLoad">
<div class="clockBox2" v-for="(item,index) in filterDetail" :key="index"></div>
</van-list>
</van-pull-refresh>
<van-popup v-model="popupShow" position="top">
<div class="search_form">
<van-form ref="clockForm" alidate-first @submit="onSubmit">
<van-field
style="border-style: solid;border-color:#D5D5D5;border-width:1px;margin-top:10px"
readonly
clickable
is-link
required
v-model="orgName"
name="orgName"
label="机构:"
placeholder="请选择机构"
@click="chooseOrgan"
:rules="[{ required: true, message: '请选择机构' }]"
/>
<van-field
style="border-style: solid;border-color:#D5D5D5;border-width:1px;margin-top:10px"
readonly
clickable
required
is-link
v-model="managerName"
name="managerName"
label="客户经理:"
placeholder="请选择客户经理"
@click="chooseManager"
:rules="[{ required: true, message: '请选择客户经理' }]"
/>
</van-form>
<div class="searchBtn">
<van-button block type="info" @click="toSearch">查询</van-button>
<van-button type="info" @click="toClear">清空</van-button>
</div>
</div>
</van-popup>
export default {
data() {
return {
refreshing:false,
finished: false,
loading: false,
popupShow:false,
pIndex:0,
filterDetail:[]
}
},
mounted() {
},
methods: {
//刷新
onRefresh() {
this.pIndex = 1;
this.finished = false;
this.loading = true;
this.getData();//获取列表数据
},
//自动加载更多
onLoad() {
console.log("xxxxxx666666xxxxxxxx",this.finished,this.loading,this.refreshing)
this.pIndex += 1;
if (this.refreshing) {
this.filterDetail = [];
this.refreshing = false;
}
this.getData()
},
toSearch(){
this.popupShow = false;
this.pIndex = 1;
this.filterDetail = [];
this.getData();
this.finished = false;
this.loading = true;
},
//重置
toClear() {
this.popupShow = false;
this.orgName = "";
this.managerName = "";
this.filterDetail = [];
this.managerColumns = [];//清空客户经理列表
this.pIndex = 1;
this.getData();
this.finished = false;
this.loading = true;
},
getData(){
if(this.finished){
this.finished = false;
this.loading = true;
}
const toast = this.$toast.loading({
duration: 0,
message: '加载中...',
forbidClick: true,
loadingType: 'spinner',
});
var params = Object.assign(
{userId:this.userIdSelect},
{date:this.dateTime},
{orgId:this.orgIdParam},
{pidx:this.pIndex},
{psize:10}
)
console.log("params====",params)
searchLocationTracking(params).then(res => {
toast.clear()
let num = res.data.data.data.total;
let list = res.data.data.data["locationTracking"];
if (this.refreshing) {
this.filterDetail = [];
this.refreshing = false;
}
for (let i in list) {
this.filterDetail.push(list[i]);
}
this.loading = false;
console.log(this.filterDetail)
console.log(this.filterDetail.length,num)
if (this.filterDetail.length >= num) {
this.finished = true;
}
console.log("this.finished-----------",this.finished,this.loading,this.refreshing)
})
},
}
}
vant上拉加载下拉刷新
最新推荐文章于 2024-06-28 07:30:00 发布