From ddcf6a763a70e987fe90e2e41f0dc5254e06f32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=AF=E5=B0=8F=E7=8E=8B=E5=91=80=5C24601?= <819653817@qq.com> Date: Mon, 8 Apr 2024 16:55:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=99=A4=E4=BA=86?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=B0=83=E5=8F=96=E6=8E=A5=E5=8F=A3=E6=84=8F?= =?UTF-8?q?=E5=A4=96=EF=BC=8C=E5=85=B6=E4=BD=99=E9=83=BD=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 6 + pages/index/index.wxml | 4 +- subpages/nohouse/pages/nohouse/nohouse.js | 140 ++++++++++- subpages/nohouse/pages/nohouse/nohouse.wxml | 11 +- .../resnoinformation/resnoinformation.js | 217 +++++++++++------- .../resnoinformation/resnoinformation.wxml | 24 +- 6 files changed, 288 insertions(+), 114 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index b47e3b6..4321f85 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -221,5 +221,11 @@ onresno(){ wx.navigateTo({ url: '../../subpages/resnoinformation/pages/resnoinformation/resnoinformation', }) +}, +toDemandCheck(){ +wx.navigateTo({ + url: '../../subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck', +}) } + }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 1456085..a746ba6 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -32,8 +32,8 @@ - - + + 诉求上报 登记居民诉求 diff --git a/subpages/nohouse/pages/nohouse/nohouse.js b/subpages/nohouse/pages/nohouse/nohouse.js index b77750e..20288ee 100644 --- a/subpages/nohouse/pages/nohouse/nohouse.js +++ b/subpages/nohouse/pages/nohouse/nohouse.js @@ -25,8 +25,39 @@ Page({ children: 'subAgencyList' }, cascaderFwValue: '', + cascaderValue:'', + dictType:[], + showResident:false, + cascaderName:null, + showStreet:false, + searchOrgIdPath:'', + angencyList:[], + fieldName: { + text: 'label', + value: 'id', + children: 'children' + }, + maxLength:10, + fieldNames1:{ + text: 'lable1', + value: 'value', + children: 'children' + }, + params: { + agencyId: '', + orgId: '', + level: 'district', + orgInfo:'' +}, +params1: { + "searchKey": "", + "pageSize": 50, + "pageNo": 1, + "searchOrgIdPath": "7b6f9a9f9f38d5f9fa7ce94a93d6eb28", +}, + }, - }, + /** @@ -35,6 +66,7 @@ Page({ onLoad(options) { this.getAgencygridtree(); + this.getTopTreeData(); }, /** @@ -110,18 +142,104 @@ Page({ console.log,(err); }) }, -onClose() { +onShowPoint(){ this.setData({ - ShowTree: false + showStreet:true }) }, - 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: [] - }) - }, +getTopTreeData() { + getTopTree().then(res => { + console.log("222220",res) + const arr = res.data.children.map(item => { + return { + ...item, + children: [] + } + }) + this.setData({ + angencyList: [{ ...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 +}) +}, +onChange(e) { + const { value, tabIndex, selectedOptions } = e.detail; + console.log("12344",e.detail) + if (tabIndex > 0 && selectedOptions[selectedOptions.length - 1].level != 'building') { + const level = selectedOptions[selectedOptions.length - 1].level + api.getNextTree({ level, id: value }).then(res => { + console.log("123",res) + if (res.data.length > 0) { + const data = res.data.map(item => { + console.log('111126210',item) + if (item.level != 'building') { + return { + ...item, + children: [] + } + } + return { + ...item, + children: null + } + }); + const arr = this.getTreeFun(value, this.data.angencyList, data); + this.setData({ + angencyList: arr, + }) + } else { + const arr = this.getTreeFun(value, this.data.angencyList, null); + this.setData({ + angencyList: arr, + }) + } + }) + } +}, +onClose() { +this.setData({ + showStreet: false, +}); +}, +onFinish(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({ + cascaderName: e.detail.selectedOptions.map(item => item.label).join(' '), + showStreet: false, + cascaderValue: value, + params: { + ...this.data.params, + orgId: value, + level, + }, + params1: { + ...this.data.params1, + searchOrgIdPath: value, + orgId: value, + level, + }, + }); + this.getTableData() +}, }) \ No newline at end of file diff --git a/subpages/nohouse/pages/nohouse/nohouse.wxml b/subpages/nohouse/pages/nohouse/nohouse.wxml index d6e93c3..4a686ff 100644 --- a/subpages/nohouse/pages/nohouse/nohouse.wxml +++ b/subpages/nohouse/pages/nohouse/nohouse.wxml @@ -1,7 +1,7 @@ - - {{cascaderName}} + + {{cascaderName ? cascaderName : '按管辖范围' }} @@ -13,6 +13,7 @@ > - - - \ No newline at end of file + + + diff --git a/subpages/resnoinformation/pages/resnoinformation/resnoinformation.js b/subpages/resnoinformation/pages/resnoinformation/resnoinformation.js index d703056..5e683a6 100644 --- a/subpages/resnoinformation/pages/resnoinformation/resnoinformation.js +++ b/subpages/resnoinformation/pages/resnoinformation/resnoinformation.js @@ -8,7 +8,7 @@ import api, { houseSearch, allOrgHouseInfo, getCommunityHouse, - getAgencygridtree + getAgencygridtree, } from "../../../../utils/api" var http = require('../../../../utils/request.js') var fly = require('../../../../utils/request') @@ -18,20 +18,41 @@ Page({ * 页面的初始数据 */ data: { + level: 'district', + dicts: { + attentioncrowdList: [], // 注意群体列表 + }, + selectedAttentionCrowd: '', // 用户选择的注意群体 + cascaderValue:'', dictType:[], showResident:false, - cascaderName:'海伦路街道', + cascaderName:null, showStreet:false, searchOrgIdPath:'', angencyList:[], fieldName: { - text: 'agencyName', - value: 'agencyId', - children: 'subAgencyList' + text: 'label', + value: 'id', + children: 'children' }, - - - cascaderFwValue: '', + maxLength:10, + fieldNames1:{ + text: 'lable1', + value: 'value', + children: 'children' + }, + params: { + agencyId: '', + orgId: '', + level: 'district', + orgInfo:'' + }, + params1: { + "searchKey": "", + "pageSize": 50, + "pageNo": 1, + "searchOrgIdPath": "7b6f9a9f9f38d5f9fa7ce94a93d6eb28", +}, }, /** @@ -40,6 +61,7 @@ Page({ onLoad(options) { this.getAgencygridtree(); this.getDicts() + this.getTopTreeData() }, @@ -96,33 +118,83 @@ Page({ showStreet:true }) }, - onClose() { - this.setData({ - showStreet: false, - showResident:false - }) - }, - 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: [] + getTopTreeData() { + getTopTree().then(res => { + console.log("222220",res) + const arr = res.data.children.map(item => { + return { + ...item, + children: [] + } + }) + this.setData({ + angencyList: [{ ...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 + }) +}, + onChange(e) { + const { value, tabIndex, selectedOptions } = e.detail; + console.log("12344",e.detail) + if (tabIndex > 0 && selectedOptions[selectedOptions.length - 1].level != 'building') { + const level = selectedOptions[selectedOptions.length - 1].level + api.getNextTree({ level, id: value }).then(res => { + console.log("123",res) + if (res.data.length > 0) { + const data = res.data.map(item => { + console.log('111126210',item) + if (item.level != 'building') { + return { + ...item, + children: [] + } + } + return { + ...item, + children: null + } + }); + const arr = this.getTreeFun(value, this.data.angencyList, data); + this.setData({ + angencyList: arr, + }) + } else { + const arr = this.getTreeFun(value, this.data.angencyList, null); + this.setData({ + angencyList: arr, + }) + } + }) + } + }, + onClose() { + this.setData({ + showStreet: false, + }); +}, getAgencygridtree() { api.getAgencygridtree().then(res => { - console.log([res.data]), + this.setData({ angencyList: [res.data] }); - if (this.data.angencyList && this.data.angencyList.length > 0) { - console.log('angencyList 已经被赋值:', this.data.angencyList); - // 执行 angencyList 被赋值后的操作 - } else { - console.log('angencyList 尚未被赋值'); - // 执行 angencyList 未被赋值时的操作 - } }).catch(err => { console.log,(err); }) @@ -136,74 +208,55 @@ Page({ async getDicts() { try { const requests = [ - http.post("sys/dict/data/dictlist", { - dictType: "nationality", - }), - http.post("sys/dict/data/nation", { - formCode: "resi_base_info", - }), - http.post("sys/dict/data/education", { - formCode: "resi_base_info", - }), - http.post("sys/dict/data/dictlist", { - dictType: "marriage", - }), - http.post("sys/dict/data/dictlist", { - dictType: "household_situation", - }), - http.post("sys/dict/data/relationship", { - formCode: "resi_base_info", - }), - http.post("sys/dict/data/dictlist", { - dictType: "career_status", - }), - http.post("sys/dict/data/dictlist", { - dictType: "spouse_situation", - }), - http.post("sys/dict/data/dictlist", { - dictType: "unemployment_reason", - }), - http.post("sys/dict/data/dictlist", { - dictType: "career_goals", - }), - http.post("sys/dict/data/dictlist", { - dictType: "special_resident_category", - }), http.post("sys/dict/data/dictlist", { dictType: "attention_crowd", }), ]; - const dictKeys = [ + const result = await http.post("sys/dict/data/dictlist", { dictType: "attention_crowd" }); - "nationalityList", - "nationList", - "educationList", - "marriageList", - "householdSituationList", - "houseHolderRelList", - "careerStatusList", - "spouseSituationList", - "unemploymentReasonList", - "employmentWishList", - "specialResidentCategory", - "attentioncrowdList" - ]; // 对应的键名 - - const results = await Promise.all(requests); - results.forEach((result, index) => { if (result.code === 0) { this.setData({ - [`dicts.${dictKeys[index]}`]: [...result.data] + "dicts.attentioncrowdList": result.data }) - console.log(result.data) } else { - console.log(`获取${dictKeys[index]}失败: ${result.data.msg}`); + console.log("获取注意群体失败: ", result.data.msg); } - }); } catch (error) { console.log("获取字典失败: ", error); } + }, + onAttentionCrowdChange(event) { + const index = event.detail.value; // 用户选择的注意群体在字典数据数组中的索引 + const selectedAttentionCrowd = this.data.dicts.attentioncrowdList[index]; // 根据索引获取选择的注意群体 + this.setData({ + selectedAttentionCrowd: selectedAttentionCrowd.label // 更新选择的注意群体 + }); + }, + onFinish(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({ + cascaderName: e.detail.selectedOptions.map(item => item.label).join(' '), + showStreet: false, + cascaderValue: value, + params: { + ...this.data.params, + orgId: value, + level, + }, + params1: { + ...this.data.params1, + searchOrgIdPath: value, + orgId: value, + level, + }, + }); + this.getTableData() + }, }) \ No newline at end of file diff --git a/subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml b/subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml index 0bffd02..58b98c5 100644 --- a/subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml +++ b/subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml @@ -2,20 +2,18 @@ - {{cascaderName}} + {{ cascaderName ? cascaderName : '按管辖范围' }} - - - - 按照居民分类 - - - + + + {{ selectedAttentionCrowd ? selectedAttentionCrowd : '按照居民分类' }} + + 筛选 - + @@ -26,7 +24,6 @@ 杨*冬 - 失眠 @@ -53,8 +50,7 @@ - + - - - \ No newline at end of file +