|
|
|
import api, {
|
|
|
|
getAllOrgCategoryCount,
|
|
|
|
getResidentBaseInfo,
|
|
|
|
getTopTree,
|
|
|
|
getNextTree,
|
|
|
|
houseSearch,
|
|
|
|
allOrgHouseInfo,
|
|
|
|
getCommunityHouse
|
|
|
|
} from "../../utils/api"
|
|
|
|
const App = getApp()
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
activeType: 0,
|
|
|
|
tabList: [],
|
|
|
|
tableData: [],
|
|
|
|
tableFwData: [],
|
|
|
|
resiList: [{
|
|
|
|
name: '',
|
|
|
|
resiTags: [''],
|
|
|
|
nationalityName: '',
|
|
|
|
nationName: '',
|
|
|
|
mobile: '',
|
|
|
|
idNum: '',
|
|
|
|
agencyName: '',
|
|
|
|
homeName: '',
|
|
|
|
updatedTime: ''
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
lowerThreshold: '10',
|
|
|
|
loadMoreVisible: false,
|
|
|
|
loadFwMoreVisible: false,
|
|
|
|
loadMoreType: "none",
|
|
|
|
loadFwMoreType: "none",
|
|
|
|
nodata: false,
|
|
|
|
selectVale: 'resi',
|
|
|
|
keyWord: '1',
|
|
|
|
angencyId: null,
|
|
|
|
category: null,
|
|
|
|
searchOrgIdPath: '',
|
|
|
|
cascaderFwValue: '',
|
|
|
|
angencyList: [], //组织树
|
|
|
|
angencyFwList: [], //房屋组织树
|
|
|
|
showAngenCascader: false,
|
|
|
|
agencyName: '',
|
|
|
|
fieldName: {
|
|
|
|
text: 'agencyName',
|
|
|
|
value: 'agencyId',
|
|
|
|
children: 'subAgencyList'
|
|
|
|
},
|
|
|
|
fieldNameFw: {
|
|
|
|
text: 'label',
|
|
|
|
value: 'id',
|
|
|
|
children: 'children'
|
|
|
|
},
|
|
|
|
cascaderNameFw: null,
|
|
|
|
showFw: false,
|
|
|
|
params: {
|
|
|
|
agencyId: '',
|
|
|
|
orgId: '',
|
|
|
|
level: 'district',
|
|
|
|
orgInfo:''
|
|
|
|
},
|
|
|
|
params1: {
|
|
|
|
"searchKey": "",
|
|
|
|
"pageSize": 50,
|
|
|
|
"pageNo": 1,
|
|
|
|
"searchOrgIdPath": "7b6f9a9f9f38d5f9fa7ce94a93d6eb28",
|
|
|
|
},
|
|
|
|
activeFwType: 0,
|
|
|
|
fwTypes: [
|
|
|
|
{ name: '房屋', num: 0, value: '' },
|
|
|
|
{ name: '自住', num: 0, value: '0' },
|
|
|
|
{ name: '出租', num: 0, value: '1' },
|
|
|
|
{ name: '闲置', num: 0, value: '2' },
|
|
|
|
{ name: '未出售', num: 0, value: '3' },
|
|
|
|
]
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
this.setData({
|
|
|
|
searchOrgIdPath: App.globalData.user.agencyId,
|
|
|
|
cascaderName: App.globalData.user.agencyName,
|
|
|
|
cascaderNameFw: App.globalData.user.agencyName,
|
|
|
|
agencyName: App.globalData.user.agencyName,
|
|
|
|
params: {
|
|
|
|
...this.data.params,
|
|
|
|
agencyId:App.globalData.user.agencyId,
|
|
|
|
orgId:App.globalData.user.agencyId
|
|
|
|
},
|
|
|
|
params1: {
|
|
|
|
...this.data.params1,
|
|
|
|
searchOrgIdPath:App.globalData.user.agencyId,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.getTableFwData()
|
|
|
|
this.getAgencygridtree()
|
|
|
|
this.getAllOrgCategoryCount()
|
|
|
|
this.getTableData()
|
|
|
|
this.getTopTreeData()
|
|
|
|
},
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow() {
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {
|
|
|
|
this.getIntelligentMessage()
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
},
|
|
|
|
toOCRCard() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/subpages/OCRCard/pages/index/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handelClickTab(e) {
|
|
|
|
this.setData({
|
|
|
|
activeType: e.currentTarget.dataset.index,
|
|
|
|
category: e.currentTarget.dataset.category,
|
|
|
|
tableData: []
|
|
|
|
})
|
|
|
|
this.getTableData()
|
|
|
|
},
|
|
|
|
handelClickTabFw(e) {
|
|
|
|
this.setData({
|
|
|
|
activeFwType: e.currentTarget.dataset.index,
|
|
|
|
// category: e.currentTarget.dataset.category,
|
|
|
|
tableFwData: [],
|
|
|
|
params1: {
|
|
|
|
...this.data.params1,
|
|
|
|
pageNo: 1,
|
|
|
|
"category": e.currentTarget.dataset.category,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
this.getTableFwData()
|
|
|
|
},
|
|
|
|
handelBlurKeyWord(e) {
|
|
|
|
this.setData({
|
|
|
|
keyWord: e.detail.value
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getTopTreeData() {
|
|
|
|
getTopTree().then(res => {
|
|
|
|
const arr = res.data.children.map(item => {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
children: []
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
angencyFwList: [{ ...res.data, children: arr }],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getTreeFun(id, arr, data) {
|
|
|
|
return arr.map(item => {
|
|
|
|
if (id == item.id) {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
children: data,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
children: this.getTreeFun(id, item.children, data),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return item
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onChangeFw(e) {
|
|
|
|
const { value, tabIndex, selectedOptions } = e.detail;
|
|
|
|
if (tabIndex > 0 && selectedOptions[selectedOptions.length - 1].level != 'building') {
|
|
|
|
const level = selectedOptions[selectedOptions.length - 1].level
|
|
|
|
getNextTree({ level, id: value }).then(res => {
|
|
|
|
if (res.data.length > 0) {
|
|
|
|
const data = res.data.map(item => {
|
|
|
|
if (item.level != 'building') {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
children: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
children: null
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const arr = this.getTreeFun(value, this.data.angencyFwList, data);
|
|
|
|
this.setData({
|
|
|
|
angencyFwList: arr,
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
const arr = this.getTreeFun(value, this.data.angencyFwList, null);
|
|
|
|
this.setData({
|
|
|
|
angencyFwList: arr,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onCloseFw() {
|
|
|
|
this.setData({
|
|
|
|
showFw: false,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onFinishFw(e) {
|
|
|
|
const { selectedOptions, value } = e.detail;
|
|
|
|
// const fieldNameFw = selectedOptions
|
|
|
|
// .map((option) => option.text || option.name)
|
|
|
|
// .join('/');
|
|
|
|
const level = selectedOptions[selectedOptions.length - 1].level
|
|
|
|
this.setData({
|
|
|
|
cascaderNameFw: e.detail.selectedOptions.map(item => item.label).join(' '),
|
|
|
|
showFw: false,
|
|
|
|
cascaderFwValue: value,
|
|
|
|
params: {
|
|
|
|
...this.data.params,
|
|
|
|
orgId: value,
|
|
|
|
level,
|
|
|
|
},
|
|
|
|
params1: {
|
|
|
|
...this.data.params1,
|
|
|
|
searchOrgIdPath: value,
|
|
|
|
orgId: value,
|
|
|
|
level,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
this.getTableFwData()
|
|
|
|
},
|
|
|
|
handelClickSearchType(e) {
|
|
|
|
this.setData({
|
|
|
|
selectVale: e.currentTarget.dataset.type
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handelClickShowTree() {
|
|
|
|
this.setData({
|
|
|
|
showAngenCascader: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handelClickShowTreeFw() {
|
|
|
|
this.setData({
|
|
|
|
showFw: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 组织树
|
|
|
|
getAgencygridtree() {
|
|
|
|
|
|
|
|
api.getAgencygridtree().then(res => {
|
|
|
|
this.setData({
|
|
|
|
angencyList: [res.data],
|
|
|
|
})
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
async handelClickSearch() {
|
|
|
|
if (this.data.selectVale === 'resi') {
|
|
|
|
this.setData({
|
|
|
|
pageNo: 1,
|
|
|
|
tableData: []
|
|
|
|
})
|
|
|
|
this.getTableData()
|
|
|
|
}else{
|
|
|
|
this.setData({
|
|
|
|
pageNo: 1,
|
|
|
|
tableFwData: []
|
|
|
|
})
|
|
|
|
this.getTableFwData()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handelClickToOcr() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/subpages/OCRCard/pages/index/index',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取居民概览
|
|
|
|
getAllOrgCategoryCount() {
|
|
|
|
let parm = {
|
|
|
|
residentInfo: this.data.keyWord,
|
|
|
|
agencyId: App.globalData.user.agencyId,
|
|
|
|
orgId: this.data.searchOrgIdPath,
|
|
|
|
level: 'agency'
|
|
|
|
}
|
|
|
|
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({
|
|
|
|
tabList: res.data.filter(item => item.categoryName == '党员' || item.categoryName == '关注人群' || item.categoryName == '特殊人群' || item.categoryName == '非健康人群' || item.categoryName == '居民').reverse()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toResiDetail(e) {
|
|
|
|
// '1765976717767618562'
|
|
|
|
console.log(e);
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/searchResult/pages/punchCard/punchCard?resiId=${e.currentTarget.dataset.resiid}`,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onClickJump(e) {
|
|
|
|
console.log('e::', e)
|
|
|
|
// '1765976717767618562'?resiId=${e.currentTarget.dataset.resiid}
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/house/pages/housePortrait/housePortrait?resiId=${e.currentTarget.dataset.resiid}`,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onFinish(e) {
|
|
|
|
this.setData({
|
|
|
|
pageNo: 1,
|
|
|
|
searchOrgIdPath: e.detail.selectedOptions[e.detail.selectedOptions.length - 1].agencyId,
|
|
|
|
cascaderName: e.detail.selectedOptions.map(item => item.agencyName).join(','),
|
|
|
|
tableData: []
|
|
|
|
})
|
|
|
|
this.getTableData()
|
|
|
|
},
|
|
|
|
onClose() {
|
|
|
|
this.setData({
|
|
|
|
showAngenCascader: false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
onScrollToLower(e) {
|
|
|
|
|
|
|
|
if (this.data.loadMoreType === 'more') {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true,
|
|
|
|
})
|
|
|
|
this.data.pageNo += 1
|
|
|
|
this.getTableData()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onScrollFwToLower(e) {
|
|
|
|
console.log('this.data.loadFwMoreType::','zoule', this.data.loadFwMoreType)
|
|
|
|
if (this.data.loadFwMoreType === 'more') {
|
|
|
|
this.setData({
|
|
|
|
loadFwMoreVisible: true,
|
|
|
|
})
|
|
|
|
this.data.params1.pageNo += 1
|
|
|
|
this.getTableFwData()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getTableData: async function () {
|
|
|
|
try {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true,
|
|
|
|
nodata: false,
|
|
|
|
loadMoreType: "more",
|
|
|
|
})
|
|
|
|
let parm = {
|
|
|
|
searchKey: this.data.keyWord,
|
|
|
|
pageSize: this.data.pageSize,
|
|
|
|
pageNo: this.data.pageNo,
|
|
|
|
category: this.data.category,
|
|
|
|
searchOrgIdPath: this.data.searchOrgIdPath
|
|
|
|
}
|
|
|
|
let {
|
|
|
|
data,
|
|
|
|
code,
|
|
|
|
msg
|
|
|
|
} = await getResidentBaseInfo(parm)
|
|
|
|
if (code == 0) {
|
|
|
|
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,
|
|
|
|
loadMoreType: 'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.log(err);
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: false,
|
|
|
|
nodata: true,
|
|
|
|
loadMoreType: 'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getTableFwData: async function () {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true,
|
|
|
|
nodata: false,
|
|
|
|
loadMoreType: "more",
|
|
|
|
})
|
|
|
|
await allOrgHouseInfo({ ...this.data.params }).then(res => {
|
|
|
|
const data = [];
|
|
|
|
let num = 0;
|
|
|
|
res.data.forEach((item, index) => {
|
|
|
|
if (index < 4) {
|
|
|
|
let value = item.name == '自住' ? '0' : item.name == '出租' ? '1' : item.name == '闲置' ? '2' : item.name == '未出售' ? '3' : '';
|
|
|
|
data.push({ ...item, value });
|
|
|
|
num = num + parseInt(item.num);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
const arr = [{ name: '房屋', num, value: '' }, ...data];
|
|
|
|
this.setData({
|
|
|
|
fwTypes: arr
|
|
|
|
})
|
|
|
|
})
|
|
|
|
await houseSearch({ ...this.data.params1, searchKey: this.data.keyWord }).then(res => {
|
|
|
|
const { code, data } = res;
|
|
|
|
if (code == 0) {
|
|
|
|
this.setData({
|
|
|
|
loadFwMoreType: data.list.length === this.data.params1.pageSize ? 'more' : 'none',
|
|
|
|
tableFwData: this.data.tableFwData.concat(data.list),
|
|
|
|
})
|
|
|
|
if (this.data.tableData.length == 0) {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: false,
|
|
|
|
nodata: true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: false,
|
|
|
|
nodata: true,
|
|
|
|
loadMoreType: 'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|