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

222 lines
4.7 KiB
JavaScript
Raw Normal View History

2024-06-06 17:12:17 +08:00
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: '',
2024-06-19 15:42:55 +08:00
areaPathName: ''
2024-06-06 17:12:17 +08:00
},
typeId: '',
//筛选树结构
areaCode: '',
areaPathName: '',
unitTreepros: {
key: 'orgname',
val: 'orgcode'
},
unitTreelist: [],
2024-06-19 15:42:55 +08:00
// 判断是否户籍或者人员 1、户籍。2、人员
listAttribute: 1,
2024-06-06 17:12:17 +08:00
},
/**
* 显示/关闭弹窗筛选
*/
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 对象
2024-06-19 15:42:55 +08:00
this.getListPersonnel();
2024-06-06 17:12:17 +08:00
},
/**
* 获取地区
*/
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;
this.setData(this.data)
}
})
},
/**
* 上拉刷新
*/
refresh: function () {
this.data.page = 1;
this.data.list = [];
this.setData(this.data);
2024-06-19 15:42:55 +08:00
this.getListPersonnel();
2024-06-06 17:12:17 +08:00
},
2024-06-19 15:42:55 +08:00
// 下拉获取更多
2024-06-06 17:12:17 +08:00
dropDown: function (params) {
this.data.page = this.data.page + 1;
this.setData(this.data);
2024-06-19 15:42:55 +08:00
this.getListPersonnel();
2024-06-06 17:12:17 +08:00
},
/**
2024-06-19 15:42:55 +08:00
* 获取人员列表
2024-06-06 17:12:17 +08:00
*/
2024-06-19 15:42:55 +08:00
getListPersonnel: function (id) {
2024-06-06 17:12:17 +08:00
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
}
app.axios("GET", "app", `/people/peopleInfoByType`, params).then(res => {
if (res.code == 1) {
this.setData({
list: [...this.data.list, ...res.data.list],
freshIng: false,
});
}
})
},
2024-06-19 15:42:55 +08:00
/**
* 获取户籍列表
*/
getListDomicile: function (id) {
let params = {
limit: this.data.pageSize,
page: this.data.page,
userId:this.data.userInfo.userId,
};
if (this.data.postData.orgcode) {
params.orgCode = this.data.postData.orgcode
}
console.log(params,'params===>');
app.axios("GET", "app", `/people/domicilePage`, params).then(res => {
if (res.code == 1) {
console.log(res.data,'data===>');
this.setData({
list: [...this.data.list, ...res.data.list],
freshIng: false,
});
}
})
},
// 跳转人员详情
goItem: function (params) {
2024-06-06 17:12:17 +08:00
wx.navigateTo({
url: `/pages/statistic/j-b-x-x/detail/index?peopleId=${params.currentTarget.dataset.item.peopleId}`,
})
},
2024-06-19 15:42:55 +08:00
// 跳转户籍详情
goDomicile:function (params) {
console.log(params,'params====>');
wx.navigateTo({
url: `/pages/statistic/j-b-x-x/domicileDetail/index?id=${params.currentTarget.dataset.item.domicileId}`,
})
},
2024-06-06 17:12:17 +08:00
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2024-06-19 15:42:55 +08:00
console.log(options, 'options====>');
2024-06-06 17:12:17 +08:00
this.data.postData.orgcode = options.orgcode;
this.data.postData.areaPathName = options.areaPathName;
this.data.typeId = options.typeId;
this.data.freshIng = true;
this.data.userInfo = app.globalData.userInfo;
2024-06-19 15:42:55 +08:00
if (options.typeId) {
this.data.listAttribute = 2;
this.data.title = options.typeName;
this.setData(this.data);
this.getListPersonnelPersonnel();
} else {
this.data.listAttribute = 1;
this.data.title = '户籍';
this.setData(this.data);
this.getListDomicile();
}
2024-06-06 17:12:17 +08:00
this.getAreaTree();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})