2024-02-23 16:51:39 +08:00

148 lines
3.9 KiB
Vue

<template>
<view class="content">
<!-- <view style="flex: 1;overflow: hidden;" >
<scroll-view scroll-y="true" style="height: 100%;width: 100%;" @scrolltolower="loadMore"> -->
<view v-if="pageList.length>0">
<list-unit v-for="(item,index) in pageList" :key="index" :item="item" :i="index" @goDetail="goDetail"></list-unit>
</view>
<view v-else-if="!pageData.isLoading" style="height: 100%;">
<noFound :nodata="pageList.length>0 ? false : true"/>
</view>
<view class="load-more" v-if="pageList.length>0">
<text>{{!pageData.isEnd ? '正在加载,请稍后...':'——— 我是有底线的 ———'}}</text>
</view>
<!-- </scroll-view>
</view> -->
</view>
</template>
<script>
import {mapGetters,mapMutations} from 'vuex'
import ListUnit from './components/newBusinessUnit.vue'
export default {
data() {
return {
pageData: {
pageIndex:1,
pageSize:10,
isEnd: false,
isLoading: true,
list:[]
},
pageList:[]
}
},
components:{
ListUnit
},
computed:{
...mapGetters({reloading:'shouldReLoadingList'})
},
methods: {
...mapMutations(['shouldReLoadingList']),
loadMore(){
if(!this.pageData.isEnd) {
this.pageData.pageIndex += 1
this.getData()
}
},
goDetail(item) {
let pageName = ''
this.$util.toNextRoute('navigateTo', "/pages/businessApproval/newDetail?id=" + item.BusinessProcess_ID)
},
getData() {
let _this = this
this.$request.$webPost('EShangApiMain/BusinessProcess/GetBusinessProcessList', {
QueryType:"0",
SearchParameter:{
Operation_Type: "10",
BusinessProcess_StateSearch: "2000,2010,2020,2030,2040,2050,2060,2070,2080,2090,3000,9000,9999",
},
ShowWholePower: true,
PageIndex:this.pageData.pageIndex,
PageSize: 10,
SortStr:'BUSINESSAPPROVAL_STATE,BUSINESS_STARTDATE desc'
// SortStr: 'BusinessProcess_State,BusinessProcess_StartDate desc'
}).then(res => {
console.log('res',res)
if(!res.Result_Code ||res.Result_Code!='100'){
_this.pageList = []
}else{
let list = res.Result_Data.List
if (list.length > 0) {
_this.pageList = this.pageData.pageIndex==1 ? list : [..._this.pageList,...list]
}
if (list.length < _this.pageData.pageSize) { // 返回条数小于每页条数
_this.pageData.isEnd = true
}
_this.$forceUpdate()
}
uni.hideLoading()
setTimeout(function(){
_this.pageData.isLoading = false
},500)
})
},
},
onPullDownRefresh() {
this.pageData.pageIndex = 1
this.pageData.isEnd = false
uni.showLoading({
title:'正在加载'
})
this.getData()
setTimeout(function() {
uni.stopPullDownRefresh()
}, 1000)
},
onReachBottom(){
this.loadMore()
},
onShow() {
let _this = this
if(this.reloading) {
uni.showLoading({
title:'正在加载'
})
_this.pageData.pageIndex = 1
_this.pageData.isEnd = false
// _this.getData()
console.log('onShow')
_this.getData()
this.shouldReLoadingList(false)
}else{
console.log('onShow')
_this.getData()
}
},
onLoad() {
this.pageData.isLoading= true
uni.showLoading({
title:'正在加载'
})
// this.getData()
this.getData()
},
onUnload() {
this.$util.addUserBehavior()
},
onHide() {
}
}
</script>
<style scoped>
.content {
display: flex;
flex-direction: column;
justify-content: center;
/* height: 100%; */
}
</style>