10 changed files with 304 additions and 367 deletions
@ -1,322 +1,268 @@ |
|||||
// pages/resiAndHouse/resiAndHouse.js
|
// pages/resiAndHouse/resiAndHouse.js
|
||||
import api, {getAllOrgCategoryCount,getResidentBaseInfo,getCommunityHouse} from "../../utils/api" |
import api, { |
||||
|
getAllOrgCategoryCount, |
||||
|
getResidentBaseInfo, |
||||
|
getCommunityHouse |
||||
|
} from "../../utils/api" |
||||
const App = getApp() |
const App = getApp() |
||||
Page({ |
Page({ |
||||
|
|
||||
/** |
/** |
||||
* 页面的初始数据 |
* 页面的初始数据 |
||||
*/ |
*/ |
||||
data: { |
data: { |
||||
selectValue:0, |
activeType: 0, |
||||
activeType:0, |
tabList: [], |
||||
tabList:[], |
tableData: [], |
||||
tableData:[], |
resiList: [{ |
||||
resiList:[ |
name: '', |
||||
{ |
resiTags: [''], |
||||
name:'', |
nationalityName: '', |
||||
resiTags:[''], |
nationName: '', |
||||
nationalityName:'', |
mobile: '', |
||||
nationName:'', |
idNum: '', |
||||
mobile:'', |
agencyName: '', |
||||
idNum:'', |
homeName: '', |
||||
agencyName:'', |
updatedTime: '' |
||||
homeName:'', |
} |
||||
updatedTime:'' |
|
||||
} |
|
||||
|
|
||||
], |
|
||||
selectedText:[], |
|
||||
pageNo:1, |
|
||||
pageSize:10, |
|
||||
lowerThreshold:'10', |
|
||||
cascaderValue:'同德路社区居委会', |
|
||||
loadMoreVisible:false, |
|
||||
loadMoreType: "none", |
|
||||
selectVale:'resi', |
|
||||
keyWord:'', |
|
||||
angencyId:null, |
|
||||
category:'', |
|
||||
searchOrgIdPath:'', |
|
||||
angencyList:[],//组织树
|
|
||||
showAngenCascader:false, |
|
||||
fieldName:{text: 'agencyName', value: 'agencyId', children: 'subAgencyList' } |
|
||||
}, |
|
||||
/** |
|
||||
* 生命周期函数--监听页面加载 |
|
||||
*/ |
|
||||
onLoad(options) { |
|
||||
this.setData({ |
|
||||
angencyId:App.globalData.user.agencyId, |
|
||||
angencyName:App.globalData.user.angencyName, |
|
||||
|
|
||||
}) |
|
||||
this.getAgencygridtree() |
|
||||
this.getAllOrgCategoryCount() |
|
||||
this.onSearchMessage() |
|
||||
}, |
|
||||
//
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面初次渲染完成 |
|
||||
*/ |
|
||||
onReady() { |
|
||||
|
|
||||
}, |
], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
lowerThreshold: '10', |
||||
|
loadMoreVisible: false, |
||||
|
loadMoreType: "none", |
||||
|
nodata:false, |
||||
|
selectVale: 'resi', |
||||
|
keyWord: null, |
||||
|
angencyId: null, |
||||
|
category: null, |
||||
|
searchOrgIdPath: '', |
||||
|
angencyList: [], //组织树
|
||||
|
showAngenCascader: false, |
||||
|
agencyName:'', |
||||
|
fieldName: { |
||||
|
text: 'agencyName', |
||||
|
value: 'agencyId', |
||||
|
children: 'subAgencyList' |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad(options) { |
||||
|
this.setData({ |
||||
|
searchOrgIdPath: App.globalData.user.agencyId, |
||||
|
cascaderName: App.globalData.user.agencyName, |
||||
|
agencyName: App.globalData.user.agencyName |
||||
|
}) |
||||
|
this.getAgencygridtree() |
||||
|
this.getAllOrgCategoryCount() |
||||
|
this.getTableData() |
||||
|
}, |
||||
|
//
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面初次渲染完成 |
||||
|
*/ |
||||
|
onReady() { |
||||
|
|
||||
/** |
}, |
||||
* 生命周期函数--监听页面显示 |
|
||||
*/ |
|
||||
onShow() { |
|
||||
this.onAllSearchMessage() |
|
||||
}, |
|
||||
|
|
||||
/** |
/** |
||||
* 生命周期函数--监听页面隐藏 |
* 生命周期函数--监听页面显示 |
||||
*/ |
*/ |
||||
onHide() { |
onShow() { |
||||
|
}, |
||||
|
|
||||
}, |
/** |
||||
|
* 生命周期函数--监听页面隐藏 |
||||
|
*/ |
||||
|
onHide() { |
||||
|
|
||||
/** |
}, |
||||
* 生命周期函数--监听页面卸载 |
|
||||
*/ |
|
||||
onUnload() { |
|
||||
|
|
||||
}, |
/** |
||||
|
* 生命周期函数--监听页面卸载 |
||||
|
*/ |
||||
|
onUnload() { |
||||
|
|
||||
/** |
}, |
||||
* 页面相关事件处理函数--监听用户下拉动作 |
|
||||
*/ |
|
||||
onPullDownRefresh() { |
|
||||
this.getIntelligentMessage() |
|
||||
}, |
|
||||
|
|
||||
/** |
/** |
||||
* 页面上拉触底事件的处理函数 |
* 页面相关事件处理函数--监听用户下拉动作 |
||||
*/ |
*/ |
||||
onReachBottom() { |
onPullDownRefresh() { |
||||
|
this.getIntelligentMessage() |
||||
|
}, |
||||
|
|
||||
}, |
/** |
||||
|
* 页面上拉触底事件的处理函数 |
||||
|
*/ |
||||
|
onReachBottom() { |
||||
|
|
||||
/** |
}, |
||||
* 用户点击右上角分享 |
|
||||
*/ |
|
||||
onShareAppMessage() { |
|
||||
|
|
||||
}, |
/** |
||||
toOCRCard(){ |
* 用户点击右上角分享 |
||||
wx.navigateTo({ |
*/ |
||||
url: '/subpages/OCRCard/pages/index/index', |
onShareAppMessage() { |
||||
}) |
|
||||
}, |
|
||||
handelClickTab(e){ |
|
||||
this.setData({ |
|
||||
activeType: e.currentTarget.dataset.index |
|
||||
}) |
|
||||
}, |
|
||||
handelBlurKeyWord(e){ |
|
||||
this.setData({ |
|
||||
keyWord:e.detail.value |
|
||||
}) |
|
||||
}, |
|
||||
handelClickSearchType(e){ |
|
||||
this.setData({ |
|
||||
selectVale:e.currentTarget.dataset.type |
|
||||
}) |
|
||||
}, |
|
||||
handelClickShowTree(){ |
|
||||
this.setData({ |
|
||||
showAngenCascader:true |
|
||||
}) |
|
||||
}, |
|
||||
// 组织树
|
|
||||
getAgencygridtree() { |
|
||||
// let parm ={
|
|
||||
// agencyId:this.data.angencyId,
|
|
||||
// purpose:'query'
|
|
||||
// }
|
|
||||
api.getAgencygridtree().then(res => { |
|
||||
this.setData({ |
|
||||
angencyList: [res.data], |
|
||||
|
|
||||
}) |
|
||||
console.log('zuzhishu',angencyList) |
|
||||
|
|
||||
}).catch(err => { |
|
||||
console.log(err); |
|
||||
}) |
|
||||
}, |
|
||||
async handelClickSearch(){ |
|
||||
this.setData({ |
|
||||
loadMoreVisible: true, |
|
||||
nodata: false, |
|
||||
loadMoreType: "more", |
|
||||
}) |
|
||||
let parm ={ |
|
||||
searchKey:this.data.keyWord, |
|
||||
pageSize:this.data.pageSize, |
|
||||
pageNo:this.data.pageNo |
|
||||
} |
|
||||
let {data,code,msg} = await getResidentBaseInfo(parm) |
|
||||
if(code == 0){ |
|
||||
console.log(this.data.tableData), |
|
||||
this.setData({ |
|
||||
loadMoreType:data.list.length === this.data.pageSize ? 'more' : 'none', |
|
||||
tableData: this.data.tableData.concat(data.list), |
|
||||
}) |
|
||||
if (this.data.tableData.length == 0) { |
|
||||
this.setData({ |
|
||||
loadMoreVisible: false, |
|
||||
nodata: true |
|
||||
}) |
|
||||
} |
|
||||
}else{ |
|
||||
this.setData({ |
|
||||
loadMoreVisible: false, |
|
||||
nodata: true, |
|
||||
}) |
|
||||
} |
|
||||
}, |
|
||||
handelClickToOcr(){ |
|
||||
wx.navigateTo({ |
|
||||
url: '/subpages/OCRCard/pages/index/index', |
|
||||
}) |
|
||||
}, |
|
||||
|
|
||||
getAllOrgCategoryCount(){ |
}, |
||||
let parm ={ |
toOCRCard() { |
||||
residentInfo:this.data.keyWord, |
wx.navigateTo({ |
||||
agencyId: this.data.searchOrgIdPath, |
url: '/subpages/OCRCard/pages/index/index', |
||||
orgId:'e723c89ee5ed0cc382576833e7c6a220', |
}) |
||||
level:'community' |
}, |
||||
} |
handelClickTab(e) { |
||||
api.getAllOrgCategoryCount(parm).then(res=>{ |
this.setData({ |
||||
if(res.code == 0){ |
activeType: e.currentTarget.dataset.index, |
||||
this.setData({ |
category: e.currentTarget.dataset.category |
||||
tabList:res.data.filter(item=>item.categoryName =='党员'||item.categoryName =='关注人群' || item.categoryName =='特殊人群'||item.categoryName =='非健康人群'||item.categoryName =='居民') |
}) |
||||
}) |
this.getTableData() |
||||
|
}, |
||||
} |
handelBlurKeyWord(e) { |
||||
}).catch(err=>{ |
this.setData({ |
||||
console.log(err); |
keyWord: e.detail.value |
||||
}) |
}) |
||||
}, |
}, |
||||
toResiDetail(e){ |
handelClickSearchType(e) { |
||||
// '1765976717767618562'
|
this.setData({ |
||||
console.log(e); |
selectVale: e.currentTarget.dataset.type |
||||
wx.navigateTo({ |
}) |
||||
url: `/subpages/searchResult/pages/punchCard/punchCard?resiId=${e.currentTarget.dataset.resiid}`, |
}, |
||||
}) |
handelClickShowTree() { |
||||
}, |
this.setData({ |
||||
onFinish(e){ |
showAngenCascader: true |
||||
const selectedValues = e.detail.type |
}) |
||||
console.log("123",selectedValues) |
}, |
||||
|
// 组织树
|
||||
|
getAgencygridtree() { |
||||
|
|
||||
|
api.getAgencygridtree().then(res => { |
||||
this.setData({ |
this.setData({ |
||||
cascaderValue:selectedValues, |
angencyList: [res.data], |
||||
showAngenCascader: false |
|
||||
}); |
|
||||
let parm={ |
|
||||
searchOrgIdPath:e.detail.value, |
|
||||
searchKey:this.data.keyWord, |
|
||||
pageSize:this.data.pageSize, |
|
||||
pageNo:this.data.pageNo |
|
||||
} |
|
||||
getResidentBaseInfo(parm).then(res=>{ |
|
||||
this.setData({ |
|
||||
'resiList':res.data.list |
|
||||
}) |
|
||||
}) |
}) |
||||
}, |
}).catch(err => { |
||||
onClose(){ |
console.log(err); |
||||
|
}) |
||||
|
}, |
||||
|
async handelClickSearch() { |
||||
|
this.setData({ |
||||
|
pageNo:1, |
||||
|
tableData:[] |
||||
|
}) |
||||
|
this.getTableData() |
||||
|
}, |
||||
|
handelClickToOcr() { |
||||
|
wx.navigateTo({ |
||||
|
url: '/subpages/OCRCard/pages/index/index', |
||||
|
}) |
||||
|
}, |
||||
|
// 获取居民概览
|
||||
|
getAllOrgCategoryCount() { |
||||
|
let parm = { |
||||
|
residentInfo: this.data.keyWord, |
||||
|
agencyId: this.data.searchOrgIdPath, |
||||
|
orgId: 'e723c89ee5ed0cc382576833e7c6a220', |
||||
|
level: 'community' |
||||
|
} |
||||
|
api.getAllOrgCategoryCount(parm).then(res => { |
||||
|
if (res.code == 0) { |
||||
|
res.data.forEach(item => { |
||||
|
if (item.categoryName === '党员') { |
||||
|
item.category = 'party' |
||||
|
} else if (item.categoryName === '关注人群') { |
||||
|
item.category = 'attention' |
||||
|
} else if (item.categoryName === '特殊人群') { |
||||
|
item.category = 'special' |
||||
|
} else if (item.categoryName === '非健康人群') { |
||||
|
item.category = 'health' |
||||
|
} |
||||
|
}) |
||||
this.setData({ |
this.setData({ |
||||
showAngenCascader:false |
tabList: res.data.filter(item => item.categoryName == '党员' || item.categoryName == '关注人群' || item.categoryName == '特殊人群' || item.categoryName == '非健康人群' || item.categoryName == '居民') |
||||
}) |
}) |
||||
}, |
|
||||
onSearchMessage(){ |
|
||||
let parm ={ |
|
||||
searchKey:this.data.keyWord, |
|
||||
pageSize:this.data.pageSize, |
|
||||
pageNo:this.data.pageNo |
|
||||
} |
|
||||
getResidentBaseInfo(parm).then(res=>{ |
|
||||
console.log("11111",res); |
|
||||
this.setData({ |
|
||||
'resiList':res.data.list |
|
||||
}) |
|
||||
console.log("123",this.resiList); |
|
||||
}).catch(err=>{ |
|
||||
console.log(err); |
|
||||
}) |
|
||||
}, |
|
||||
onAllSearchMessage(){ |
|
||||
let parm ={ |
|
||||
searchKey:this.data.keyWord, |
|
||||
pageSize:this.data.pageSize, |
|
||||
pageNo:this.data.pageNo, |
|
||||
category:this.data.category, |
|
||||
searchOrgIdPath:this.data.searchOrgIdPath |
|
||||
} |
} |
||||
getResidentBaseInfo(parm).then(res=>{ |
}).catch(err => { |
||||
|
console.log(err); |
||||
this.setData({ |
}) |
||||
'resiList':res.data.list |
}, |
||||
}) |
toResiDetail(e) { |
||||
}).catch(err=>{ |
// '1765976717767618562'
|
||||
console.log(err); |
console.log(e); |
||||
}) |
wx.navigateTo({ |
||||
}, |
url: `/subpages/searchResult/pages/punchCard/punchCard?resiId=${e.currentTarget.dataset.resiid}`, |
||||
onScrollToLower(e){ |
}) |
||||
console.log("111"+e) |
}, |
||||
if (this.data.loadMoreType === 'more') { |
onFinish(e) { |
||||
this.setData({ |
this.setData({ |
||||
loadMoreVisible: true, |
pageNo: 1, |
||||
}) |
searchOrgIdPath:e.detail.selectedOptions[e.detail.selectedOptions.length-1].agencyId, |
||||
this.data.pageNo += 1 |
cascaderName:e.detail.selectedOptions.map(item=>item.agencyName).join(',') |
||||
this.onAllSearchMessage() |
}) |
||||
|
this.getTableData() |
||||
|
}, |
||||
|
onClose() { |
||||
|
this.setData({ |
||||
|
showAngenCascader: false |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
onScrollToLower(e) { |
||||
|
|
||||
} |
if (this.data.loadMoreType === 'more') { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true, |
||||
|
}) |
||||
|
this.data.pageNo += 1 |
||||
|
this.getTableData() |
||||
|
} |
||||
}, |
}, |
||||
onAllSearchMessage(){ |
getTableData: async function() { |
||||
|
try{ |
||||
this.setData({ |
this.setData({ |
||||
// 加载更多为true
|
|
||||
loadMoreVisible: true, |
loadMoreVisible: true, |
||||
nodata: false, |
nodata: false, |
||||
loadMoreType: "more", |
loadMoreType: "more", |
||||
}) |
}) |
||||
const parm={ |
let parm = { |
||||
searchKey:this.data.keyWord, |
searchKey: this.data.keyWord, |
||||
pageSize:this.data.pageSize, |
pageSize: this.data.pageSize, |
||||
pageNo:this.data.pageNo, |
pageNo: this.data.pageNo, |
||||
category:this.data.category, |
category:this.data.category, |
||||
searchOrgIdPath:this.data.searchOrgIdPat |
searchOrgIdPath:this.data.searchOrgIdPath |
||||
} |
} |
||||
|
let { |
||||
getResidentBaseInfo(parm).then(res=>{ |
data, |
||||
res.data.resiList = res.data.resiList.map(item => { |
code, |
||||
if (item.createdByName && item.createdByName.length >= 3) { |
msg |
||||
item.createdByName = item.createdByName.slice(1,3); |
} = await getResidentBaseInfo(parm) |
||||
} |
if (code == 0) { |
||||
return item; |
|
||||
}); |
|
||||
this.setData({ |
this.setData({ |
||||
loadMoreType: res.data.resiList.length === this.data.pageSize ? 'more' : 'none', |
loadMoreType: data.list.length === this.data.pageSize ? 'more' : 'none', |
||||
resiList: this.data.resiList.concat(res.data.list), |
tableData: this.data.tableData.concat(data.list), |
||||
|
|
||||
}) |
}) |
||||
if(TouchList) |
if (this.data.tableData.length == 0) { |
||||
console.log(resiList) |
|
||||
if (this.data.resiList.length == 0) { |
|
||||
this.setData({ |
|
||||
loadMoreVisible: false, |
|
||||
nodata: true |
|
||||
}) |
|
||||
} |
|
||||
}).catch(err=>{ |
|
||||
console.log(err); |
|
||||
this.setData({ |
this.setData({ |
||||
loadMoreVisible: false, |
loadMoreVisible: false, |
||||
nodata: true, |
nodata: true |
||||
}) |
}) |
||||
|
} |
||||
|
} else { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: false, |
||||
|
nodata: true, |
||||
|
loadMoreType:'none' |
||||
|
}) |
||||
|
} |
||||
|
} catch(err) { |
||||
|
console.log(err); |
||||
|
this.setData({ |
||||
|
loadMoreVisible: false, |
||||
|
nodata: true, |
||||
|
loadMoreType:'none' |
||||
}) |
}) |
||||
}, |
} |
||||
|
}, |
||||
}) |
|
||||
|
}) |
Loading…
Reference in new issue