183 lines
3.6 KiB
JavaScript
183 lines
3.6 KiB
JavaScript
const app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
topBarH: app.globalData.CustomBar,
|
|
title: '',
|
|
typeId: '',
|
|
currentIndex: 0,
|
|
tab: [],
|
|
list: [],
|
|
page: 1,
|
|
pageSize: 10,
|
|
userInfo: {},
|
|
search: "",
|
|
TypeData: [],
|
|
showTypePop: false,
|
|
postData: {
|
|
orgcode: '',
|
|
areaPathName:''
|
|
},
|
|
typeId: '',
|
|
|
|
//筛选树结构
|
|
areaCode: '',
|
|
areaPathName: '',
|
|
unitTreepros: {
|
|
key: 'orgname',
|
|
val: 'orgcode'
|
|
},
|
|
unitTreelist: [],
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
* 显示/关闭弹窗筛选
|
|
*/
|
|
popModal: function (params) {
|
|
const type = params.currentTarget.dataset.type;
|
|
this.data[type] = !this.data[type];
|
|
this.setData(this.data)
|
|
},
|
|
handleselectunit(e) {
|
|
// e.detail 选中的id数组
|
|
this.data.page = 1;
|
|
this.data.list = [];
|
|
let postData = this.data.postData; // 获取当前的 postData 对象
|
|
postData.orgcode = e.detail.item.orgcode;
|
|
postData.areaPathName = e.detail.item.orgname;
|
|
this.setData({
|
|
postData: postData,
|
|
showTypePop: false
|
|
}); // 设置更新后的 postData 对象
|
|
this.getList();
|
|
},
|
|
/**
|
|
* 获取地区
|
|
*/
|
|
getAreaTree: function () {
|
|
app.axios("GET", "common", "/sysorg/areaTree", {
|
|
classify: 2
|
|
}).then(res => {
|
|
if (res.code == 1) {
|
|
console.log(res, 'res===>');
|
|
this.data.TypeData = res.data[0].children;
|
|
this.data.unitTreelist = res.data;
|
|
this.setData(this.data)
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 上拉刷新
|
|
*/
|
|
refresh: function () {
|
|
this.data.page = 1;
|
|
this.data.list = [];
|
|
this.setData(this.data);
|
|
this.getList();
|
|
},
|
|
dropDown: function (params) {
|
|
this.data.page = this.data.page + 1;
|
|
this.setData(this.data);
|
|
this.getList();
|
|
},
|
|
/**
|
|
* 获取工作统计每项数据列表
|
|
*/
|
|
getList: function (id) {
|
|
let params = {
|
|
limit: this.data.pageSize,
|
|
page: this.data.page,
|
|
typeId: this.data.typeId,
|
|
condition: this.data.search,
|
|
};
|
|
|
|
if (this.data.postData.orgcode) {
|
|
params.orgCode = this.data.postData.orgcode
|
|
}
|
|
console.log(params, 'params==>');
|
|
app.axios("GET", "app", `/people/peopleInfoByType`, params).then(res => {
|
|
console.log(res.data, 'res.data=====>');
|
|
if (res.code == 1) {
|
|
this.setData({
|
|
list: [...this.data.list, ...res.data.list],
|
|
freshIng: false,
|
|
});
|
|
}
|
|
})
|
|
},
|
|
goItem:function (params) {
|
|
wx.navigateTo({
|
|
url: `/pages/statistic/j-b-x-x/detail/index?peopleId=${params.currentTarget.dataset.item.peopleId}`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log(options, 'options==>');
|
|
this.data.postData.orgcode = options.orgcode;
|
|
this.data.postData.areaPathName = options.areaPathName;
|
|
this.data.title = options.typeName;
|
|
this.data.typeId = options.typeId;
|
|
this.data.freshIng = true;
|
|
this.data.userInfo = app.globalData.userInfo;
|
|
this.setData(this.data);
|
|
this.getList();
|
|
this.getAreaTree();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |