daofu-applet/pages/statistic/j-b-x-x/index/index.js

190 lines
3.8 KiB
JavaScript
Raw Permalink Normal View History

2024-01-29 17:42:38 +08:00
// 工作统计
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
topBarH: app.globalData.CustomBar,
currentIndex: 0,
2024-06-04 14:45:44 +08:00
tab: [],
list: [],
// startTime: '',
// endTime: '',
page: 1,
pageSize: 10,
userInfo:{},
search:"",
TypeData: [],
showTypePop: false,
postData:{
2024-06-06 17:12:17 +08:00
orgcode:'',
areaPathName:''
2024-06-04 14:45:44 +08:00
},
typeId:'',
2024-06-06 17:12:17 +08:00
//筛选树结构
areaCode:'',
areaPathName:'',
unitTreepros: {
key: 'orgname',
val: 'orgcode'
},
unitTreelist: [],
2024-01-29 17:42:38 +08:00
},
/**
* 切换tab
*/
changeItem: function (params) {
2024-06-06 17:12:17 +08:00
wx.navigateTo({
url: `/pages/statistic/j-b-x-x/personnel/index?typeId=${params.currentTarget.dataset.item.typeId}&typeName=${params.currentTarget.dataset.item.typeName}&orgcode=${this.data.postData.orgcode}&areaPathName=${this.data.postData.areaPathName}`,
})
2024-06-04 14:45:44 +08:00
},
handleselectunit(e) {
// e.detail 选中的id数组
this.data.page = 1;
this.data.list = [];
let postData = this.data.postData; // 获取当前的 postData 对象
2024-06-06 17:12:17 +08:00
console.log(postData,'postData==>');
postData.orgcode = e.detail.item.orgcode;
postData.areaPathName = e.detail.item.orgname;
this.setData({
postData: postData,
showTypePop:false
}); // 设置更新后的 postData 对象
2024-06-06 17:12:17 +08:00
this.getType();
},
2024-06-04 14:45:44 +08:00
/**
* 查看详情
*/
toDetail: function (params) {
wx.navigateTo({
url: `/pages/statistic/j-b-x-x/detail/index?peopleId=${params.currentTarget.dataset.item.peopleId}`,
})
},
/**
* 显示/关闭弹窗筛选
*/
popModal: function (params) {
const type = params.currentTarget.dataset.type;
this.data[type] = !this.data[type];
2024-01-29 17:42:38 +08:00
this.setData(this.data)
},
2024-06-04 14:45:44 +08:00
/**
* 地址
*/
typeChange: function (params) {
this.data.page = 1;
this.data.list = [];
this.setData(this.data);
const index = params.currentTarget.dataset.index;
this.data.postData.type = index + 1;
this.data.postData.orgcode = this.data.TypeData[index].orgcode;
this.data.showTypePop = false;
this.setData(this.data);
},
/**
* 获取地区
*/
getAreaTree: function () {
app.axios("GET", "common", "/sysorg/areaTree", {
classify: 2
}).then(res => {
if (res.code == 1) {
this.data.TypeData = res.data[0].children;
this.data.unitTreelist = res.data;
2024-06-04 14:45:44 +08:00
this.setData(this.data)
}
})
},
/**
* 获取工作统计类型
*/
getType: function () {
2024-06-06 17:12:17 +08:00
let params = {
areaCode:this.data.postData.orgcode
}
app.axios("GET", "app", `/people/populationByType`,params).then(res => {
2024-06-04 14:45:44 +08:00
if (res.code == 1) {
this.data.tab = res.data;
this.setData(this.data);
this.data.typeId = res.data[0].typeId;
}
})
},
/**
* 上拉刷新
*/
refresh: function () {
2024-06-06 17:12:17 +08:00
this.data.freshIng = false;
2024-06-04 14:45:44 +08:00
this.setData(this.data);
},
dropDown: function (params) {
this.data.page = this.data.page+1;
2024-06-06 17:12:17 +08:00
this.data.freshIng = false;
2024-06-04 14:45:44 +08:00
this.setData(this.data);
},
2024-01-29 17:42:38 +08:00
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2024-06-04 14:45:44 +08:00
this.data.freshIng = true;
this.data.userInfo = app.globalData.userInfo;
this.setData(this.data);
this.getType();
this.getAreaTree();
2024-01-29 17:42:38 +08:00
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
2024-06-04 14:45:44 +08:00
onReachBottom(data) {
2024-01-29 17:42:38 +08:00
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})