diff --git a/pages/resiAndHouse/resiAndHouse.js b/pages/resiAndHouse/resiAndHouse.js index 1df26ae..0864023 100644 --- a/pages/resiAndHouse/resiAndHouse.js +++ b/pages/resiAndHouse/resiAndHouse.js @@ -52,15 +52,11 @@ Page({ showAngenCascader: false, agencyName: '', fieldName: { - text: 'agencyName', - value: 'agencyId', - children: 'subAgencyList' - }, - fieldNameFw: { text: 'label', value: 'id', children: 'children' }, + cascaderNameFw: null, showFw: false, params: { @@ -83,7 +79,8 @@ Page({ { name: '闲置', num: 0, value: '2' }, { name: '未出售', num: 0, value: '3' }, ], - tempList:[] + tempList:[], + angencyJmList:[] }, /** * 生命周期函数--监听页面加载 @@ -106,7 +103,6 @@ Page({ statusHeight: App.globalData.deviceInfo.statusHeight, navigationHeight: App.globalData.deviceInfo.navigationHeight, }) - this.getAgencygridtree() this.getAllOrgCategoryCount() this.getTableData() this.getTopTreeData() @@ -240,6 +236,7 @@ Page({ }) this.setData({ angencyFwList: [{ ...res.data, children: arr }], + angencyJmList:[{ ...res.data, children: arr }] }) }) }, @@ -260,6 +257,55 @@ Page({ return item }) }, + onChangeJm(e) { + const { value, tabIndex, selectedOptions } = e.detail; + if (tabIndex > 0 && selectedOptions[selectedOptions.length - 1].level != 'house') { + const level = selectedOptions[selectedOptions.length - 1].level + const orgId = selectedOptions[selectedOptions.length - 1].id + this.setData({ + searchOrgIdPath:orgId, + cascaderName:selectedOptions.map(item=>item.label).join(','), + tableData:[], + pageNo: 1, + }) + getNextTree({ level, id: value }).then(res => { + if (res.data.length > 0) { + const data = res.data.map(item => { + if (item.level != 'house') { + return { + ...item, + children: [] + } + } + return { + ...item, + children: null + } + }); + const arr = this.getTreeFun(value, this.data.angencyJmList, data); + this.setData({ + angencyJmList: arr, + }) + } else { + const arr = this.getTreeFun(value, this.data.angencyJmList, null); + this.setData({ + angencyJmList: arr, + }) + } + }) + } + this.getTableData() + this.getAllOrgCategoryCount() + }, + onFinishJm(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.getAllOrgCategoryCount() + }, onChangeFw(e) { const { value, tabIndex, selectedOptions } = e.detail; if (tabIndex > 0 && selectedOptions[selectedOptions.length - 1].level != 'unit') { @@ -350,17 +396,7 @@ Page({ showFw: true }) }, - // 组织树 - getAgencygridtree () { - api.getAgencygridtree().then(res => { - this.getUnitoption( [res.data]) - this.setData({ - angencyList: [res.data], - }) - }).catch(err => { - console.log(err); - }) - }, + async handelClickSearch() { if (this.data.selectVale === 'resi') { this.setData({ @@ -422,16 +458,7 @@ Page({ 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() - this.getAllOrgCategoryCount() - }, + onClose() { this.setData({ showAngenCascader: false diff --git a/pages/resiAndHouse/resiAndHouse.wxml b/pages/resiAndHouse/resiAndHouse.wxml index f9fb350..368f096 100644 --- a/pages/resiAndHouse/resiAndHouse.wxml +++ b/pages/resiAndHouse/resiAndHouse.wxml @@ -148,8 +148,8 @@ - + - + \ No newline at end of file