|
|
@ -1,7 +1,10 @@ |
|
|
|
// pages/resiAndHouse/resiAndHouse.js
|
|
|
|
import api, { |
|
|
|
getAllOrgCategoryCount, |
|
|
|
getResidentBaseInfo, |
|
|
|
getTopTree, |
|
|
|
getNextTree, |
|
|
|
houseSearch, |
|
|
|
allOrgHouseInfo, |
|
|
|
getCommunityHouse |
|
|
|
} from "../../utils/api" |
|
|
|
const App = getApp() |
|
|
@ -14,6 +17,7 @@ Page({ |
|
|
|
activeType: 0, |
|
|
|
tabList: [], |
|
|
|
tableData: [], |
|
|
|
tableFwData: [], |
|
|
|
resiList: [{ |
|
|
|
name: '', |
|
|
|
resiTags: [''], |
|
|
@ -31,21 +35,52 @@ Page({ |
|
|
|
pageSize: 10, |
|
|
|
lowerThreshold: '10', |
|
|
|
loadMoreVisible: false, |
|
|
|
loadFwMoreVisible: false, |
|
|
|
loadMoreType: "none", |
|
|
|
nodata:false, |
|
|
|
loadFwMoreType: "none", |
|
|
|
nodata: false, |
|
|
|
selectVale: 'resi', |
|
|
|
keyWord: '', |
|
|
|
keyWord: '1', |
|
|
|
angencyId: null, |
|
|
|
category: null, |
|
|
|
searchOrgIdPath: '', |
|
|
|
cascaderFwValue: '', |
|
|
|
angencyList: [], //组织树
|
|
|
|
angencyFwList: [], //房屋组织树
|
|
|
|
showAngenCascader: false, |
|
|
|
agencyName:'', |
|
|
|
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' }, |
|
|
|
] |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
@ -54,11 +89,23 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
searchOrgIdPath: App.globalData.user.agencyId, |
|
|
|
cascaderName: App.globalData.user.agencyName, |
|
|
|
agencyName: 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() |
|
|
|
}, |
|
|
|
//
|
|
|
|
/** |
|
|
@ -117,15 +164,119 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
activeType: e.currentTarget.dataset.index, |
|
|
|
category: e.currentTarget.dataset.category, |
|
|
|
tableData:[] |
|
|
|
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 |
|
|
@ -136,6 +287,11 @@ Page({ |
|
|
|
showAngenCascader: true |
|
|
|
}) |
|
|
|
}, |
|
|
|
handelClickShowTreeFw() { |
|
|
|
this.setData({ |
|
|
|
showFw: true |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 组织树
|
|
|
|
getAgencygridtree() { |
|
|
|
|
|
|
@ -148,23 +304,30 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
async handelClickSearch() { |
|
|
|
if (this.data.selectVale === 'resi') { |
|
|
|
this.setData({ |
|
|
|
pageNo:1, |
|
|
|
tableData:[] |
|
|
|
pageNo: 1, |
|
|
|
tableData: [] |
|
|
|
}) |
|
|
|
this.getAllOrgCategoryCount() |
|
|
|
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, |
|
|
|
agencyId: App.globalData.user.agencyId, |
|
|
|
orgId: this.data.searchOrgIdPath, |
|
|
|
level: 'agency' |
|
|
|
} |
|
|
@ -193,17 +356,23 @@ Page({ |
|
|
|
// '1765976717767618562'
|
|
|
|
console.log(e); |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/subpages/searchResult/pages/resiInfo/resiInfo?resiId=${e.currentTarget.dataset.resiid}`, |
|
|
|
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:[] |
|
|
|
searchOrgIdPath: e.detail.selectedOptions[e.detail.selectedOptions.length - 1].agencyId, |
|
|
|
cascaderName: e.detail.selectedOptions.map(item => item.agencyName).join(','), |
|
|
|
tableData: [] |
|
|
|
}) |
|
|
|
this.getAllOrgCategoryCount() |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
onClose() { |
|
|
@ -222,8 +391,18 @@ Page({ |
|
|
|
this.getTableData() |
|
|
|
} |
|
|
|
}, |
|
|
|
getTableData: async function() { |
|
|
|
try{ |
|
|
|
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, |
|
|
@ -233,8 +412,8 @@ Page({ |
|
|
|
searchKey: this.data.keyWord, |
|
|
|
pageSize: this.data.pageSize, |
|
|
|
pageNo: this.data.pageNo, |
|
|
|
category:this.data.category, |
|
|
|
searchOrgIdPath:this.data.searchOrgIdPath |
|
|
|
category: this.data.category, |
|
|
|
searchOrgIdPath: this.data.searchOrgIdPath |
|
|
|
} |
|
|
|
let { |
|
|
|
data, |
|
|
@ -256,17 +435,59 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
loadMoreVisible: false, |
|
|
|
nodata: true, |
|
|
|
loadMoreType:'none' |
|
|
|
loadMoreType: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
} catch(err) { |
|
|
|
} catch (err) { |
|
|
|
console.log(err); |
|
|
|
this.setData({ |
|
|
|
loadMoreVisible: false, |
|
|
|
nodata: true, |
|
|
|
loadMoreType:'none' |
|
|
|
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' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |