From 1d1e327a1cbf8bd822078a9f71894f25ddcee437 Mon Sep 17 00:00:00 2001 From: queenwuli <942534046@qq.com> Date: Mon, 11 Jan 2021 10:32:49 +0800 Subject: [PATCH] gx --- hive-app/pages/manager/employeeReport.vue | 68 ++++++++++++++++++++++++++------- 1 files changed, 53 insertions(+), 15 deletions(-) diff --git a/hive-app/pages/manager/employeeReport.vue b/hive-app/pages/manager/employeeReport.vue index a7aee95..89cca28 100644 --- a/hive-app/pages/manager/employeeReport.vue +++ b/hive-app/pages/manager/employeeReport.vue @@ -62,6 +62,9 @@ </view> </view> </view> + <view v-if="list.length"> + <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more> + </view> </view> <view v-else> <view class="list-item"> @@ -116,10 +119,12 @@ </template> <script> + import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'; import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue"; export default { components: { - HTabs + HTabs, + uniLoadMore }, data() { return { @@ -139,11 +144,26 @@ } ], list: [], - staffId: '' + staffId: '', + loadStatus: 'more', + pageNum: 1 } }, onLoad(options) { + this.initTitle(); this.loadEmloyeeList(); + this.loadList() + }, + onPullDownRefresh(){ + this.reloadData(); + let timer = setTimeout(function () { + uni.startPullDownRefresh(); + clearTimeout(timer); + timer = null; + }, 800); + }, + onReachBottom(){ + this.loadList() }, onNavigationBarButtonTap(e){ if(e.index==0){ @@ -158,6 +178,21 @@ } }, methods:{ + reloadData(){ + this.list = []; + this.pageNum = 1; + this.loadStatus = 'more'; + this.loadList(); + }, + initTitle(){ + let roleInfo = this.$httpUtils.getRoleInfo(); + if(roleInfo){ + this.staffId = roleInfo.id; + uni.setNavigationBarTitle({ + title: roleInfo.name+'的业绩报表' + }) + } + }, tabChange(index){ let val = index + 1; if(val == this.tabIndex){ @@ -165,7 +200,7 @@ } this.tabIndex = val; if(val != 3){ - this.loadList() + this.reloadData() } }, toAnalyse(title, type){ @@ -177,14 +212,7 @@ this.$httpUtils.request('/api/user/findAllUsers', {}, 'POST').then((res) => { if(res.status == 200){ let result = res.rows; - if(result.length){ - this.staffId = result[0].id; - uni.setNavigationBarTitle({ - title: result[0].name+'的业绩报表' - }) - this.loadList() - }else{ - this.loadList() + if(!result.length){ // #ifdef APP-PLUS let webView = this.$mp.page.$getAppWebview(); webView.setTitleNViewButtonStyle(1, { @@ -196,20 +224,30 @@ }) }, loadList(){ + if(this.loadStatus!=='more'){ + return; + } this.$httpUtils.request('/api/statistics/findVipAchieve', { - "pageNum": 1, - "pageSize": 100, + "pageNum": this.pageNum, + "pageSize": 10, "staffId": this.staffId, "type": this.tabIndex }, 'POST').then((res) => { if(res.status == 200){ - this.list = res.rows; + let result = res.rows; + if(result.length < 10){ + this.loadStatus = 'noMore'; + } else { + this.pageNum ++ ; + this.loadStatus = 'more'; + } + this.list = this.list.concat(result); } }) }, setData(item){ this.staffId = item.id; - this.loadList(); + this.reloadData(); setTimeout(() => { uni.setNavigationBarTitle({ title: item.name+'的业绩报表' -- Gitblit v1.9.1