95 lines
2.2 KiB
Vue
95 lines
2.2 KiB
Vue
<template>
|
|
<div class="myborrow" :style="hstyle">
|
|
<van-loading v-if="initLoad" size="24" style="text-align: center;height: 300px;line-height: 300px;"/>
|
|
<list v-else @downLoadMore="downLoadMore" :pageSetting="{'loading':loading,'finished':finished}" type="borrow" :list="lists"></list>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import list from '../components/list'
|
|
import awsuiAxios from "../awsuiAxios";
|
|
export default {
|
|
name: 'myborrow',
|
|
components: {list},
|
|
data() {
|
|
return {
|
|
hstyle:"",
|
|
initLoad:true,
|
|
isLoadingData:false,//防止重复加载数据
|
|
loading:false,
|
|
finished:false,
|
|
curPage:0,
|
|
keyWord:"",
|
|
lists: []
|
|
}
|
|
},
|
|
methods: {
|
|
downLoadMore(){
|
|
this.searchMobileList("");
|
|
},
|
|
refreshList() {
|
|
console.log('myborrow:refreshList')
|
|
},
|
|
searchMobileList(key,type){
|
|
if(this.isLoadingData){
|
|
return;
|
|
}
|
|
this.isLoadingData = true;
|
|
let that = this;
|
|
if(type=='search'){
|
|
this.keyWord = key;
|
|
this.curPage =0;
|
|
this.finished = false;
|
|
}
|
|
// 获取知识列表数据
|
|
awsuiAxios.post({
|
|
url: "jd",
|
|
data: {
|
|
cmd: "com.actionsoft.apps.kms_knwl_center_borrow_card_list_json",
|
|
sortIndx:"CREATEDATE",
|
|
sortDir: "down",
|
|
rowsPerPage:0,
|
|
curPage:this.curPage<=0?1:this.curPage+1,
|
|
filter: encodeURIComponent(this.keyWord)
|
|
},
|
|
}).then(function (r) {
|
|
that.initLoad = false;
|
|
that.isLoadingData = false;
|
|
that.loading = false;
|
|
if (r.result == "error") {
|
|
alert(r.msg);
|
|
} else {
|
|
let rowsPerPage = r.data.rowsPerPage;
|
|
if(that.curPage==0){
|
|
that.lists = r.data.data;
|
|
}else{
|
|
that.lists =that.lists.concat( r.data.data);
|
|
}
|
|
that.loading = false;
|
|
that.curPage = r.data.curPage;
|
|
let totalRecords = r.data.totalRecords;
|
|
if(that.curPage*rowsPerPage>=totalRecords){
|
|
that.finished = true;
|
|
}
|
|
if(!that.finished&&that.curPage>=2&&that.lists.length<8){
|
|
that.searchMobileList("");
|
|
}
|
|
|
|
that.$emit("func",r.data.totalRecords,"borrow");
|
|
}
|
|
});
|
|
}
|
|
},
|
|
mounted(){
|
|
// this.hstyle ="height:"+ (window.innerHeight-44-54-51)+"px";
|
|
this.searchMobileList("");
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|
|
|
|
|