222 lines
4.7 KiB
JavaScript
222 lines
4.7 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: [],
|
|
// 判断是否户籍或者人员 1、户籍。2、人员
|
|
listAttribute: 1,
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
* 显示/关闭弹窗筛选
|
|
*/
|
|
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.getListPersonnel();
|
|
},
|
|
/**
|
|
* 获取地区
|
|
*/
|
|
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);
|
|
this.getListPersonnel();
|
|
},
|
|
// 下拉获取更多
|
|
dropDown: function (params) {
|
|
this.data.page = this.data.page + 1;
|
|
this.setData(this.data);
|
|
this.getListPersonnel();
|
|
},
|
|
/**
|
|
* 获取人员列表
|
|
*/
|
|
getListPersonnel: 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
|
|
}
|
|
app.axios("GET", "app", `/people/peopleInfoByType`, params).then(res => {
|
|
if (res.code == 1) {
|
|
this.setData({
|
|
list: [...this.data.list, ...res.data.list],
|
|
freshIng: false,
|
|
});
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 获取户籍列表
|
|
*/
|
|
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) {
|
|
wx.navigateTo({
|
|
url: `/pages/statistic/j-b-x-x/detail/index?peopleId=${params.currentTarget.dataset.item.peopleId}`,
|
|
})
|
|
},
|
|
// 跳转户籍详情
|
|
goDomicile:function (params) {
|
|
console.log(params,'params====>');
|
|
wx.navigateTo({
|
|
url: `/pages/statistic/j-b-x-x/domicileDetail/index?id=${params.currentTarget.dataset.item.domicileId}`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log(options, 'options====>');
|
|
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;
|
|
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();
|
|
}
|
|
|
|
this.getAreaTree();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |