Browse Source

小程序除了需要调取接口意外,其余都已经完成

work_tab_bar
是小王呀\24601 2 years ago
parent
commit
ddcf6a763a
  1. 6
      pages/index/index.js
  2. 4
      pages/index/index.wxml
  3. 140
      subpages/nohouse/pages/nohouse/nohouse.js
  4. 9
      subpages/nohouse/pages/nohouse/nohouse.wxml
  5. 219
      subpages/resnoinformation/pages/resnoinformation/resnoinformation.js
  6. 22
      subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml

6
pages/index/index.js

@ -221,5 +221,11 @@ onresno(){
wx.navigateTo({ wx.navigateTo({
url: '../../subpages/resnoinformation/pages/resnoinformation/resnoinformation', url: '../../subpages/resnoinformation/pages/resnoinformation/resnoinformation',
}) })
},
toDemandCheck(){
wx.navigateTo({
url: '../../subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck',
})
} }
}) })

4
pages/index/index.wxml

@ -32,8 +32,8 @@
</view> </view>
</view> </view>
<view class="section_3"> <view class="section_3">
<view class="image-text_3"> <view class="image-text_3" bind:tap="toDemandCheck">
<view class="text-group_3" bind:tap="toDemandCheck"> <view class="text-group_3">
<text lines="1" class="text_5">诉求上报</text> <text lines="1" class="text_5">诉求上报</text>
<text lines="1" class="text_6">登记居民诉求</text> <text lines="1" class="text_6">登记居民诉求</text>
</view> </view>

140
subpages/nohouse/pages/nohouse/nohouse.js

@ -25,8 +25,39 @@ Page({
children: 'subAgencyList' children: 'subAgencyList'
}, },
cascaderFwValue: '', 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) { onLoad(options) {
this.getAgencygridtree(); this.getAgencygridtree();
this.getTopTreeData();
}, },
/** /**
@ -110,18 +142,104 @@ Page({
console.log,(err); console.log,(err);
}) })
}, },
onClose() { onShowPoint(){
this.setData({ this.setData({
ShowTree: false showStreet:true
}) })
}, },
onFinish(e) { getTopTreeData() {
this.setData({ getTopTree().then(res => {
pageNo: 1, console.log("222220",res)
searchOrgIdPath: e.detail.selectedOptions[e.detail.selectedOptions.length - 1].agencyId, const arr = res.data.children.map(item => {
cascaderName: e.detail.selectedOptions.map(item => item.agencyName).join(','), return {
tableData: [] ...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()
},
}) })

9
subpages/nohouse/pages/nohouse/nohouse.wxml

@ -1,7 +1,7 @@
<!--subpages/nohouse/pages/nohouse/nohouse.wxml--> <!--subpages/nohouse/pages/nohouse/nohouse.wxml-->
<view class="header"> <view class="header">
<view class="header_left" bind:tap="handelClickShowTree"> <view class="header_left" bind:tap="onShowPoint">
<test class="left_test">{{cascaderName}}</test> <test class="left_test">{{cascaderName ? cascaderName : '按管辖范围' }}</test>
<image class="left_image" src="/images/Dropdownbutton.png"></image> <image class="left_image" src="/images/Dropdownbutton.png"></image>
</view> </view>
<view class="button"> <view class="button">
@ -13,6 +13,7 @@
<test class="from_test2">></test> <test class="from_test2">></test>
</view> </view>
</view> </view>
<van-popup show="{{ ShowTree }}" round position="bottom"> <van-popup show="{{ showStreet }}" round position="bottom">
<van-cascader field-names="{{fieldName}}" wx:if="{{ShowTree}}" value="{{ searchOrgIdPath }}" title="请选择" options="{{ angencyList }}" bind:close="onClose" bind:finish="onFinish" /> <van-cascader field-names="{{fieldName}}" wx:if="{{showStreet}}" value="{{ cascaderValue }}" title="请选择" options="{{ angencyList}}" bind:close="onClose"
bind:change="onChange" bind:finish="onFinish" />
</van-popup> </van-popup>

219
subpages/resnoinformation/pages/resnoinformation/resnoinformation.js

@ -8,7 +8,7 @@ import api, {
houseSearch, houseSearch,
allOrgHouseInfo, allOrgHouseInfo,
getCommunityHouse, getCommunityHouse,
getAgencygridtree getAgencygridtree,
} from "../../../../utils/api" } from "../../../../utils/api"
var http = require('../../../../utils/request.js') var http = require('../../../../utils/request.js')
var fly = require('../../../../utils/request') var fly = require('../../../../utils/request')
@ -18,20 +18,41 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
level: 'district',
dicts: {
attentioncrowdList: [], // 注意群体列表
},
selectedAttentionCrowd: '', // 用户选择的注意群体
cascaderValue:'',
dictType:[], dictType:[],
showResident:false, showResident:false,
cascaderName:'海伦路街道', cascaderName:null,
showStreet:false, showStreet:false,
searchOrgIdPath:'', searchOrgIdPath:'',
angencyList:[], angencyList:[],
fieldName: { fieldName: {
text: 'agencyName', text: 'label',
value: 'agencyId', value: 'id',
children: 'subAgencyList' children: 'children'
}, },
maxLength:10,
fieldNames1:{
cascaderFwValue: '', 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) { onLoad(options) {
this.getAgencygridtree(); this.getAgencygridtree();
this.getDicts() this.getDicts()
this.getTopTreeData()
}, },
@ -96,33 +118,83 @@ Page({
showStreet:true showStreet:true
}) })
}, },
onClose() { getTopTreeData() {
this.setData({ getTopTree().then(res => {
showStreet: false, console.log("222220",res)
showResident:false const arr = res.data.children.map(item => {
}) return {
}, ...item,
onFinish(e) { children: []
this.setData({ }
pageNo: 1, })
searchOrgIdPath: e.detail.selectedOptions[e.detail.selectedOptions.length - 1].agencyId, this.setData({
cascaderName: e.detail.selectedOptions.map(item => item.agencyName).join(','), angencyList: [{ ...res.data, children: arr }],
tableData: [] })
}) })
}, },
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() { getAgencygridtree() {
api.getAgencygridtree().then(res => { api.getAgencygridtree().then(res => {
console.log([res.data]),
this.setData({ this.setData({
angencyList: [res.data] 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 => { }).catch(err => {
console.log,(err); console.log,(err);
}) })
@ -136,74 +208,55 @@ Page({
async getDicts() { async getDicts() {
try { try {
const requests = [ 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", { http.post("sys/dict/data/dictlist", {
dictType: "attention_crowd", 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) { if (result.code === 0) {
this.setData({ this.setData({
[`dicts.${dictKeys[index]}`]: [...result.data] "dicts.attentioncrowdList": result.data
}) })
console.log(result.data)
} else { } else {
console.log(`获取${dictKeys[index]}失败: ${result.data.msg}`); console.log("获取注意群体失败: ", result.data.msg);
} }
});
} catch (error) { } catch (error) {
console.log("获取字典失败: ", 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()
},
}) })

22
subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml

@ -2,16 +2,14 @@
<view class="header"> <view class="header">
<view class="card_one" bind:tap="onShowPoint"> <view class="card_one" bind:tap="onShowPoint">
<view class="items" > <view class="items" >
<view class="text1" >{{cascaderName}}</view> <view class="text1" > {{ cascaderName ? cascaderName : '按管辖范围' }}</view>
</view> </view>
</view> </view>
<view> <picker mode="selector" range="{{ dicts.attentioncrowdList }}" range-key="label" bindchange="onAttentionCrowdChange" >
<view class="card_two" bind:tap="onclickResident"> <view class="card_two">
<view class="items"> <view class="text2">{{ selectedAttentionCrowd ? selectedAttentionCrowd : '按照居民分类' }} </view>
<view class="text2">按照居民分类</view> </view>
</view> </picker>
</view>
</view>
<view class="card_three"> <view class="card_three">
<text class="test3">筛选</text> <text class="test3">筛选</text>
</view> </view>
@ -26,7 +24,6 @@
<view class="name"> <view class="name">
<text lines="1" class="text_1">杨*冬</text> <text lines="1" class="text_1">杨*冬</text>
</view> </view>
<view class="lable"> <view class="lable">
<text class="text_2">失眠</text> <text class="text_2">失眠</text>
</view> </view>
@ -53,8 +50,7 @@
</scroll-view> </scroll-view>
</view> </view>
<van-popup show="{{ showStreet }}" round position="bottom"> <van-popup show="{{ showStreet }}" round position="bottom">
<van-cascader field-names="{{fieldName}}" wx:if="{{showStreet}}" value="{{ searchOrgIdPath }}" title="请选择" options="{{ angencyList }}" bind:close="onClose" bind:finish="onFinish" /> <van-cascader field-names="{{fieldName}}" wx:if="{{showStreet}}" value="{{ cascaderValue }}" title="请选择" options="{{ angencyList}}" bind:close="onClose"
</van-popup> bind:change="onChange" bind:finish="onFinish" />
<van-popup show="{{ showResident }}" round position="bottom">
<van-cascader field-names="{{fieldNames}}" wx:if="{{showResident}}" value="{{ searchOrgIdPath }}" title="请选择" options="{{ dicts.nationalityList }}" bind:close="onClose" bind:finish="onFinish" />
</van-popup> </van-popup>

Loading…
Cancel
Save