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. 11
      subpages/nohouse/pages/nohouse/nohouse.wxml
  5. 217
      subpages/resnoinformation/pages/resnoinformation/resnoinformation.js
  6. 24
      subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml

6
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',
})
}
})

4
pages/index/index.wxml

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

140
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()
},
})

11
subpages/nohouse/pages/nohouse/nohouse.wxml

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

217
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()
},
})

24
subpages/resnoinformation/pages/resnoinformation/resnoinformation.wxml

@ -2,20 +2,18 @@
<view class="header">
<view class="card_one" bind:tap="onShowPoint">
<view class="items" >
<view class="text1" >{{cascaderName}}</view>
<view class="text1" > {{ cascaderName ? cascaderName : '按管辖范围' }}</view>
</view>
</view>
<view>
<view class="card_two" bind:tap="onclickResident">
<view class="items">
<view class="text2">按照居民分类</view>
</view>
</view>
</view>
<picker mode="selector" range="{{ dicts.attentioncrowdList }}" range-key="label" bindchange="onAttentionCrowdChange" >
<view class="card_two">
<view class="text2">{{ selectedAttentionCrowd ? selectedAttentionCrowd : '按照居民分类' }} </view>
</view>
</picker>
<view class="card_three">
<text class="test3">筛选</text>
</view>
</view>
<view class="context">
@ -26,7 +24,6 @@
<view class="name">
<text lines="1" class="text_1">杨*冬</text>
</view>
<view class="lable">
<text class="text_2">失眠</text>
</view>
@ -53,8 +50,7 @@
</scroll-view>
</view>
<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"
bind:change="onChange" bind:finish="onFinish" />
</van-popup>
<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>

Loading…
Cancel
Save