daofu-applet/pages/statistic/g-z-t-j/index/index.js

160 lines
3.0 KiB
JavaScript
Raw Normal View History

2024-01-29 17:42:38 +08:00
// 工作统计
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
topBarH: app.globalData.CustomBar,
currentIndex: 0,
2024-03-25 17:29:56 +08:00
tab: [],
list: [],
startTime: '',
endTime: '',
page: 1,
pageSize: 10,
2024-06-04 14:45:44 +08:00
userInfo:{}
2024-01-29 17:42:38 +08:00
},
/**
* 切换tab
*/
changeItem: function (params) {
this.data.currentIndex = params.currentTarget.dataset.index;
2024-03-25 17:29:56 +08:00
this.data.page = 1;
this.data.list = [];
this.setData(this.data);
this.getList(params.currentTarget.dataset.item.typeId);
2024-01-29 17:42:38 +08:00
},
/**
* 开始时间
*/
2024-03-25 17:29:56 +08:00
startTimeChange: function (e) {
this.data.startTime = e.detail.value;
2024-06-04 14:45:44 +08:00
this.timeGetList();
},
2024-03-25 17:29:56 +08:00
/**
* 开始时间
*/
2024-03-25 17:29:56 +08:00
endTimeChange: function (e) {
this.data.endTime = e.detail.value;
2024-06-04 14:45:44 +08:00
this.timeGetList();
},
//时间请求
timeGetList: function () {
2024-03-25 17:29:56 +08:00
this.data.page = 1;
this.data.currentIndex = 0;
this.data.list = [];
this.setData(this.data);
this.getList(this.data.tab[0].typeId);
},
/**
* 获取工作统计类型
*/
getType: function () {
app.axios("GET", "app", `/work/workCount/${1}`).then(res => {
if (res.code == 1) {
this.data.tab = res.data;
this.setData(this.data);
this.getList(res.data[0].typeId);
}
})
},
/**
* 上拉刷新
*/
refresh: function () {
this.data.page = 1;
this.data.currentIndex = 0;
this.data.list = [];
this.setData(this.data);
this.getList(this.data.tab[0].typeId);
},
dropDown: function (params) {
this.data.page = this.data.page+1;
this.setData(this.data);
2024-06-04 14:45:44 +08:00
this.getList(this.data.tab[this.data.currentIndex].typeId);
2024-03-25 17:29:56 +08:00
},
/**
* 获取工作统计每项数据列表
*/
getList: function (id) {
let params = {
limit:this.data.pageSize,
page:this.data.page,
endTime:this.data.endTime,
startTime:this.data.startTime,
typeId:id,
2024-06-04 14:45:44 +08:00
userId:this.data.userInfo.userId,
2024-03-25 17:29:56 +08:00
};
app.axios("GET", "app", `/work/workListPage`, params).then(res => {
if (res.code == 1) {
this.data.freshIng = false;
console.log(res, 'res===>');
this.data.list = [...this.data.list,...res.data.list];
this.setData(this.data);
}
})
},
2024-01-29 17:42:38 +08:00
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2024-03-25 17:29:56 +08:00
this.data.freshIng = true;
2024-06-04 14:45:44 +08:00
this.data.userInfo = app.globalData.userInfo;
2024-03-25 17:29:56 +08:00
this.setData(this.data);
this.getType();
2024-01-29 17:42:38 +08:00
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
2024-03-25 17:29:56 +08:00
onReachBottom(data) {
2024-01-29 17:42:38 +08:00
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})