测试
This commit is contained in:
@@ -110,12 +110,9 @@ export default {
|
||||
url: "api.cqygjk.com",
|
||||
orgCode: "A01A86"
|
||||
},
|
||||
personnelType: "department", // 员工:staff / 部门:department
|
||||
personnelType: "staff", // 员工:staff / 部门:department
|
||||
|
||||
currentPage: 1,
|
||||
totalCount: 0,
|
||||
pageSize: 0,
|
||||
maxPagesToLoad: 0,
|
||||
|
||||
currentData: "",
|
||||
doingDay: "-",
|
||||
@@ -137,30 +134,18 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
pageTimerCallback() {
|
||||
this.currentData = getCurrentDate();
|
||||
const hasMoreToLoadInCurrentType = this.currentPage < this.maxPagesToLoad;
|
||||
const hasMoreOnServer = (this.currentPage * this.pageSize) < this.totalCount;
|
||||
if (hasMoreToLoadInCurrentType && hasMoreOnServer) {
|
||||
this.currentPage++;
|
||||
this.loadDataSequential();
|
||||
} else {
|
||||
this.personnelType = this.personnelType === "staff" ? "department" : "staff";
|
||||
this.startSequentialLoading();
|
||||
}
|
||||
this.personnelType = this.personnelType === "staff" ? "department" : "staff";
|
||||
this.startSequentialLoading();
|
||||
},
|
||||
|
||||
// 启动或重置顺序加载流程
|
||||
startSequentialLoading() {
|
||||
this.list = [];
|
||||
this.currentPage = 1;
|
||||
this.totalCount = 0;
|
||||
|
||||
if (this.personnelType === "staff") {
|
||||
this.pageSize = 15;
|
||||
this.maxPagesToLoad = 3;
|
||||
this.pageSize = 45;
|
||||
} else {
|
||||
this.pageSize = 10;
|
||||
this.maxPagesToLoad = 1;
|
||||
}
|
||||
this.loadDataSequential();
|
||||
},
|
||||
@@ -176,7 +161,7 @@ export default {
|
||||
apiUrl = urlPrefix + '/deptRank';
|
||||
}
|
||||
|
||||
let url = this_.requestConfig.agreement + '://' + this_.requestConfig.url + apiUrl + '?orgCode=' + this_.requestConfig.orgCode + '&pageNo=' + this_.currentPage + '&pageSize=' + this_.pageSize;
|
||||
let url = this_.requestConfig.agreement + '://' + this_.requestConfig.url + apiUrl + '?orgCode=' + this_.requestConfig.orgCode + '&pageNo=1&pageSize=' + this_.pageSize;
|
||||
|
||||
if (this_.isRequesting) {
|
||||
console.warn('请求正在进行中,跳过本次调用。');
|
||||
@@ -191,9 +176,6 @@ export default {
|
||||
}
|
||||
|
||||
this_.list = res.result.rankList;
|
||||
if (this_.currentPage === 1) {
|
||||
this_.totalCount = this_.personnelType === "staff" ? (res.result.joinNum || 0) : (res.result.joinDept || 0);
|
||||
}
|
||||
} else {
|
||||
this_.list = [];
|
||||
}
|
||||
@@ -202,15 +184,15 @@ export default {
|
||||
}).finally(() => {
|
||||
this_.isRequesting = false;
|
||||
|
||||
if (this_.setTimeoutParams.status) {
|
||||
if (this_.timerId) {
|
||||
clearTimeout(this_.timerId);
|
||||
}
|
||||
this_.timerId = setTimeout(() => {
|
||||
this_.pageTimerCallback();
|
||||
this_.timerId = null;
|
||||
}, this_.setTimeoutParams.times * 1000);
|
||||
}
|
||||
// if (this_.setTimeoutParams.status) {
|
||||
// if (this_.timerId) {
|
||||
// clearTimeout(this_.timerId);
|
||||
// }
|
||||
// this_.timerId = setTimeout(() => {
|
||||
// this_.pageTimerCallback();
|
||||
// this_.timerId = null;
|
||||
// }, this_.setTimeoutParams.times * 1000);
|
||||
// }
|
||||
});
|
||||
|
||||
}
|
||||
@@ -432,7 +414,8 @@ export default {
|
||||
|
||||
.staffContent {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
height: calc(100% - 142px);
|
||||
|
||||
.staffContentList {
|
||||
|
||||
Reference in New Issue
Block a user