简单分页
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
export default {
options: {
},
init(that) {
},
loadDataComm(that) {
//过滤条件
let filterT = {
// pageSize: 4
};
filterT = {
...filterT,
...that.filter
};
let metaT = that.rootMeta;
if (that.firstLoad === true) {
that.used.descriptionEmpty = null; // window.$appConfig.empty.init;
}
that.loading = true;
that.$bsAjax.getPage(metaT.mkey, metaT.field, filterT).then((res) => {
that.used.firstLoad = false;
that.used.descriptionEmpty = window.$appConfig.empty.nodata;
//debugger;
if (!res.data || !res.data.data || res.data.success !== true) {
that.used.loading = false;
return;
}
that["tag"] = [];
that.used.data = res.data.data;
let obj = {};
that.used.paging = res.data.paging;
that.used.firstLoad = false;
that.used.loading = false;
}).catch(() => {
that.used.firstLoad = false;
that.used.loading = false;
});
},
}
下拉分页
loadDataComm(that) {
//过滤条件
let filterT = {
// pageSize: 4
// mercId: that.$route.query.mercId
};
filterT = {
...filterT,
...that.filter
};
let metaT = that.rootMeta;
if (that.firstLoad === true) {
that.descriptionEmpty = null; // window.$appConfig.empty.init;
}
that.loading = true;
that.$bsAjax.getPage(metaT.mkey, metaT.field, filterT).then((res) => {
that.firstLoad = false;
that.descriptionEmpty = window.$appConfig.empty.nodata;
//debugger;
if (!res.data || !res.data.data || res.data.success !== true) {
that.loading = false;
return;
}
that["tag"] = [];
that.used.data = [...that.used.data, ...res.data.data];
let obj = {};
that.used.data = that.used.data.reduce((cur, next) => {
obj[next.policyId] ? "" : obj[next.policyId] = true && cur.push(next);
return cur;
}, [])
that.used.paging = res.data.paging;
that.pullToBottom.finished = that.filter.pageIndex >= that.used.paging.totalPage;
if (!that.pullToBottom.finished) {
that.pullToBottom.finished = false;
that.pullToBottom.loading = false;
} else {
that.pullToBottom.finished = true;
that.pullToBottom.loading = false;
}
// if (that.used.paging.pageIndex === that.used.paging.totalPage) {
// that.pullToBottom.finished = true; //
// }
// that.pullToBottom.finished = true; //
that.firstLoad = false;
that.loading = false;
});
},
文档更新时间: 2022-12-16 19:08 作者:admin