Browse Source

居民搜索逻辑调整

work_tab_bar
mk 1 year ago
parent
commit
603a38b966
  1. 522
      pages/resiAndHouse/resiAndHouse.js
  2. 2
      pages/resiAndHouse/resiAndHouse.json
  3. 112
      pages/resiAndHouse/resiAndHouse.wxml
  4. 13
      pages/resiAndHouse/resiAndHouse.wxss
  5. 6
      pages/work2/work2.js
  6. 2
      pages/work2/work2.wxml
  7. 1
      pages/work2/work2.wxss
  8. 5
      subpages/searchResult/pages/punchCard/punchCard.js
  9. 4
      subpages/searchResult/pages/punchCard/punchCard.wxml
  10. 4
      subpages/searchResult/pages/punchCard/punchCard.wxss

522
pages/resiAndHouse/resiAndHouse.js

@ -1,322 +1,268 @@
// pages/resiAndHouse/resiAndHouse.js
import api, {getAllOrgCategoryCount,getResidentBaseInfo,getCommunityHouse} from "../../utils/api"
import api, {
getAllOrgCategoryCount,
getResidentBaseInfo,
getCommunityHouse
} from "../../utils/api"
const App = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
selectValue:0,
activeType:0,
tabList:[],
tableData:[],
resiList:[
{
name:'',
resiTags:[''],
nationalityName:'',
nationName:'',
mobile:'',
idNum:'',
agencyName:'',
homeName:'',
updatedTime:''
}
],
selectedText:[],
pageNo:1,
pageSize:10,
lowerThreshold:'10',
cascaderValue:'同德路社区居委会',
loadMoreVisible:false,
loadMoreType: "none",
selectVale:'resi',
keyWord:'',
angencyId:null,
category:'',
searchOrgIdPath:'',
angencyList:[],//组织树
showAngenCascader:false,
fieldName:{text: 'agencyName', value: 'agencyId', children: 'subAgencyList' }
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
angencyId:App.globalData.user.agencyId,
angencyName:App.globalData.user.angencyName,
})
this.getAgencygridtree()
this.getAllOrgCategoryCount()
this.onSearchMessage()
},
//
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
/**
* 页面的初始数据
*/
data: {
activeType: 0,
tabList: [],
tableData: [],
resiList: [{
name: '',
resiTags: [''],
nationalityName: '',
nationName: '',
mobile: '',
idNum: '',
agencyName: '',
homeName: '',
updatedTime: ''
}
},
],
pageNo: 1,
pageSize: 10,
lowerThreshold: '10',
loadMoreVisible: false,
loadMoreType: "none",
nodata:false,
selectVale: 'resi',
keyWord: null,
angencyId: null,
category: null,
searchOrgIdPath: '',
angencyList: [], //组织树
showAngenCascader: false,
agencyName:'',
fieldName: {
text: 'agencyName',
value: 'agencyId',
children: 'subAgencyList'
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
searchOrgIdPath: App.globalData.user.agencyId,
cascaderName: App.globalData.user.agencyName,
agencyName: App.globalData.user.agencyName
})
this.getAgencygridtree()
this.getAllOrgCategoryCount()
this.getTableData()
},
//
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.onAllSearchMessage()
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.getIntelligentMessage()
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.getIntelligentMessage()
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
},
toOCRCard(){
wx.navigateTo({
url: '/subpages/OCRCard/pages/index/index',
})
},
handelClickTab(e){
this.setData({
activeType: e.currentTarget.dataset.index
})
},
handelBlurKeyWord(e){
this.setData({
keyWord:e.detail.value
})
},
handelClickSearchType(e){
this.setData({
selectVale:e.currentTarget.dataset.type
})
},
handelClickShowTree(){
this.setData({
showAngenCascader:true
})
},
// 组织树
getAgencygridtree() {
// let parm ={
// agencyId:this.data.angencyId,
// purpose:'query'
// }
api.getAgencygridtree().then(res => {
this.setData({
angencyList: [res.data],
})
console.log('zuzhishu',angencyList)
}).catch(err => {
console.log(err);
})
},
async handelClickSearch(){
this.setData({
loadMoreVisible: true,
nodata: false,
loadMoreType: "more",
})
let parm ={
searchKey:this.data.keyWord,
pageSize:this.data.pageSize,
pageNo:this.data.pageNo
}
let {data,code,msg} = await getResidentBaseInfo(parm)
if(code == 0){
console.log(this.data.tableData),
this.setData({
loadMoreType:data.list.length === this.data.pageSize ? 'more' : 'none',
tableData: this.data.tableData.concat(data.list),
})
if (this.data.tableData.length == 0) {
this.setData({
loadMoreVisible: false,
nodata: true
})
}
}else{
this.setData({
loadMoreVisible: false,
nodata: true,
})
}
},
handelClickToOcr(){
wx.navigateTo({
url: '/subpages/OCRCard/pages/index/index',
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
getAllOrgCategoryCount(){
let parm ={
residentInfo:this.data.keyWord,
agencyId: this.data.searchOrgIdPath,
orgId:'e723c89ee5ed0cc382576833e7c6a220',
level:'community'
}
api.getAllOrgCategoryCount(parm).then(res=>{
if(res.code == 0){
this.setData({
tabList:res.data.filter(item=>item.categoryName =='党员'||item.categoryName =='关注人群' || item.categoryName =='特殊人群'||item.categoryName =='非健康人群'||item.categoryName =='居民')
})
}
}).catch(err=>{
console.log(err);
})
},
toResiDetail(e){
// '1765976717767618562'
console.log(e);
wx.navigateTo({
url: `/subpages/searchResult/pages/punchCard/punchCard?resiId=${e.currentTarget.dataset.resiid}`,
})
},
onFinish(e){
const selectedValues = e.detail.type
console.log("123",selectedValues)
},
toOCRCard() {
wx.navigateTo({
url: '/subpages/OCRCard/pages/index/index',
})
},
handelClickTab(e) {
this.setData({
activeType: e.currentTarget.dataset.index,
category: e.currentTarget.dataset.category
})
this.getTableData()
},
handelBlurKeyWord(e) {
this.setData({
keyWord: e.detail.value
})
},
handelClickSearchType(e) {
this.setData({
selectVale: e.currentTarget.dataset.type
})
},
handelClickShowTree() {
this.setData({
showAngenCascader: true
})
},
// 组织树
getAgencygridtree() {
api.getAgencygridtree().then(res => {
this.setData({
cascaderValue:selectedValues,
showAngenCascader: false
});
let parm={
searchOrgIdPath:e.detail.value,
searchKey:this.data.keyWord,
pageSize:this.data.pageSize,
pageNo:this.data.pageNo
}
getResidentBaseInfo(parm).then(res=>{
this.setData({
'resiList':res.data.list
})
angencyList: [res.data],
})
},
onClose(){
}).catch(err => {
console.log(err);
})
},
async handelClickSearch() {
this.setData({
pageNo:1,
tableData:[]
})
this.getTableData()
},
handelClickToOcr() {
wx.navigateTo({
url: '/subpages/OCRCard/pages/index/index',
})
},
// 获取居民概览
getAllOrgCategoryCount() {
let parm = {
residentInfo: this.data.keyWord,
agencyId: this.data.searchOrgIdPath,
orgId: 'e723c89ee5ed0cc382576833e7c6a220',
level: 'community'
}
api.getAllOrgCategoryCount(parm).then(res => {
if (res.code == 0) {
res.data.forEach(item => {
if (item.categoryName === '党员') {
item.category = 'party'
} else if (item.categoryName === '关注人群') {
item.category = 'attention'
} else if (item.categoryName === '特殊人群') {
item.category = 'special'
} else if (item.categoryName === '非健康人群') {
item.category = 'health'
}
})
this.setData({
showAngenCascader:false
tabList: res.data.filter(item => item.categoryName == '党员' || item.categoryName == '关注人群' || item.categoryName == '特殊人群' || item.categoryName == '非健康人群' || item.categoryName == '居民')
})
},
onSearchMessage(){
let parm ={
searchKey:this.data.keyWord,
pageSize:this.data.pageSize,
pageNo:this.data.pageNo
}
getResidentBaseInfo(parm).then(res=>{
console.log("11111",res);
this.setData({
'resiList':res.data.list
})
console.log("123",this.resiList);
}).catch(err=>{
console.log(err);
})
},
onAllSearchMessage(){
let parm ={
searchKey:this.data.keyWord,
pageSize:this.data.pageSize,
pageNo:this.data.pageNo,
category:this.data.category,
searchOrgIdPath:this.data.searchOrgIdPath
}
getResidentBaseInfo(parm).then(res=>{
this.setData({
'resiList':res.data.list
})
}).catch(err=>{
console.log(err);
})
},
onScrollToLower(e){
console.log("111"+e)
if (this.data.loadMoreType === 'more') {
this.setData({
loadMoreVisible: true,
})
this.data.pageNo += 1
this.onAllSearchMessage()
}).catch(err => {
console.log(err);
})
},
toResiDetail(e) {
// '1765976717767618562'
console.log(e);
wx.navigateTo({
url: `/subpages/searchResult/pages/punchCard/punchCard?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(',')
})
this.getTableData()
},
onClose() {
this.setData({
showAngenCascader: false
})
},
onScrollToLower(e) {
}
if (this.data.loadMoreType === 'more') {
this.setData({
loadMoreVisible: true,
})
this.data.pageNo += 1
this.getTableData()
}
},
onAllSearchMessage(){
getTableData: async function() {
try{
this.setData({
// 加载更多为true
loadMoreVisible: true,
nodata: false,
loadMoreType: "more",
})
const parm={
searchKey:this.data.keyWord,
pageSize:this.data.pageSize,
pageNo:this.data.pageNo,
let parm = {
searchKey: this.data.keyWord,
pageSize: this.data.pageSize,
pageNo: this.data.pageNo,
category:this.data.category,
searchOrgIdPath:this.data.searchOrgIdPat
searchOrgIdPath:this.data.searchOrgIdPath
}
getResidentBaseInfo(parm).then(res=>{
res.data.resiList = res.data.resiList.map(item => {
if (item.createdByName && item.createdByName.length >= 3) {
item.createdByName = item.createdByName.slice(1,3);
}
return item;
});
let {
data,
code,
msg
} = await getResidentBaseInfo(parm)
if (code == 0) {
this.setData({
loadMoreType: res.data.resiList.length === this.data.pageSize ? 'more' : 'none',
resiList: this.data.resiList.concat(res.data.list),
loadMoreType: data.list.length === this.data.pageSize ? 'more' : 'none',
tableData: this.data.tableData.concat(data.list),
})
if(TouchList)
console.log(resiList)
if (this.data.resiList.length == 0) {
this.setData({
loadMoreVisible: false,
nodata: true
})
}
}).catch(err=>{
console.log(err);
if (this.data.tableData.length == 0) {
this.setData({
loadMoreVisible: false,
nodata: true,
})
loadMoreVisible: false,
nodata: true
})
}
} else {
this.setData({
loadMoreVisible: false,
nodata: true,
loadMoreType:'none'
})
}
} catch(err) {
console.log(err);
this.setData({
loadMoreVisible: false,
nodata: true,
loadMoreType:'none'
})
},
})
}
},
})

2
pages/resiAndHouse/resiAndHouse.json

@ -1,6 +1,8 @@
{
"usingComponents": {
"custom-tab-bar":"../../components/custom-tab-bar",
"load-more": "../../components/loadMore/loadMore",
"no-data": "../../components/noData/nodata",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-cascader": "@vant/weapp/cascader/index",

112
pages/resiAndHouse/resiAndHouse.wxml

@ -2,7 +2,7 @@
<view class="group_1">
<view class="block_1">
<view class="box_15">
<text lines="1" class="text_1">海伦路街道</text>
<text lines="1" class="text_1">{{agencyName}}</text>
</view>
<view class="text-wrapper_30">
<view bind:tap="handelClickSearchType" data-type="resi">
@ -19,8 +19,8 @@
<image src="../../images/work/search.png" mode="" class="search_img" />
<input type="text" placeholder="姓名/手机/身份证" bindinput="handelBlurKeyWord" bindblur="handelBlurKeyWord" value="{{keyWord}}" />
<view class="btn_box" bind:tap="handelClickSearch">
<image src="../../images/cardIcon.png" mode="" class="OCR_img" bind:tap="handelClickToOcr"/>
<text bindtap="onSearchMessage">搜索</text>
<image src="../../images/cardIcon.png" mode="" class="OCR_img" bind:tap="handelClickToOcr" />
<text>搜索</text>
</view>
</view>
@ -28,10 +28,10 @@
</view>
<view class="group_2" wx:if="{{selectVale === 'resi'}}">
<view class="section_2">
<view class="box_16">
<text lines="1" class="text_4">{{cascaderValue}}</text>
<text lines="1" class="text_4">{{cascaderName}}</text>
<view class="image-text_9">
<text lines="1" class="text_5" bind:tap="handelClickShowTree">切换</text>
<image src="../../images/swapHorizontal.png" class="image_8"></image>
@ -39,74 +39,62 @@
</view>
<view class="box_17">
<view class="tabs">
<view class="tab_item {{activeType === index ? 'border_bto' : ''}}" wx:for="{{tabList}}" bind:tap="handelClickTab" data-index="{{index}}">
<view class="tab_item {{activeType === index ? 'border_bto' : ''}}" wx:for="{{tabList}}" bind:tap="handelClickTab" data-index="{{index}}" data-category="{{item.category}}">
<view class="num">{{item.categoryCount}}</view>
<view class="name" style="color:{{activeType === index?'#3974f6':'#666666'}}">{{item.categoryName}}</view>
</view>
</view>
</view>
<view class="content">
<scroll-view class="scroll" scroll-y="{{true}}" lower-threshold="{{ lowerThreshold }}" bindscrolltolower="onScrollToLower">
<view class="form_item" wx:for="{{resiList}}" :wx:key="{{index}}" bind:tap="toResiDetail" data-resiId="{{item.resiId}}">
<view class="box_18">
<text lines="1" class="text_16">{{item.name}}</text>
<view class="resi_tag">
<view class="text-wrapper_8" wx:for="{{item.categoryInfo.categoryNames}}" wx:for-item="itemC">
{{itemC}}
<scroll-view class="scroll" scroll-y="{{true}}" lower-threshold="{{ lowerThreshold }}" bindscrolltolower="onScrollToLower">
<view class="form_item" wx:for="{{tableData}}" :wx:key="{{index}}" bind:tap="toResiDetail" data-resiId="{{item.resiId}}">
<view class="box_18">
<text lines="1" class="text_16">{{item.name}}</text>
<view class="resi_tag" wx:if="{{item.categoryInfo.categoryNames}}">
<view class="text-wrapper_8" wx:for="{{item.categoryInfo.categoryNames.split(',')}}" wx:for-item="itemC">
{{itemC}}
</view>
</view>
</view>
<view class="text-wrapper_9">
<text lines="1" class="text_19">信息完整度:</text>
<text lines="1" class="text_20">40%</text>
<view class="text-wrapper_9">
<text lines="1" class="text_19">信息完整度:</text>
<text lines="1" class="text_20">40%</text>
</view>
</view>
</view>
<view class="box_19">
<view class="text-wrapper_10" >
<text lines="1" class="text_21">国籍:</text>
<text lines="1" class="text_22">{{item.nationalityName || "--"}}</text>
<view class="box_19">
<view class="text-wrapper_10">
<text lines="1" class="text_21">国籍:</text>
<text lines="1" class="text_22">{{item.nationalityName || "--"}}</text>
</view>
<view class="text-wrapper_11">
<text lines="1" class="text_23">民族:</text>
<text lines="1" class="text_24">{{item.nationName || '--'}}</text>
</view>
</view>
<view class="text-wrapper_11" >
<text lines="1" class="text_23">民族:</text>
<text lines="1" class="text_24">{{item.nationName || '--'}}</text>
<view class="text-wrapper_12">
<text lines="1" class="text_25">电话:</text>
<text lines="1" class="text_26">{{item.mobile}}</text>
</view>
<view class="text-wrapper_13">
<text lines="1" class="text_27">证件号</text>
<text lines="1" class="text_28">:</text>
<text lines="1" class="text_29">{{item.idNum}}</text>
</view>
<view class="text-wrapper_14">
<text lines="1" class="text_30">地址:</text>
<text lines="1" class="text_31">{{item.agencyName || ''}} {{item.homeName || ''}}</text>
</view>
<view class="text-wrapper_15">
<text lines="1" class="text_32">最新更新时间:</text>
<text lines="1" decode="true" class="text_33">{{item.updatedTime|| '--'}}</text>
</view>
</view>
<view class="text-wrapper_12">
<text lines="1" class="text_25">电话:</text>
<text lines="1" class="text_26">{{item.mobile}}</text>
</view>
<view class="text-wrapper_13">
<text lines="1" class="text_27">证件号</text>
<text lines="1" class="text_28">:</text>
<text lines="1" class="text_29">{{item.idNum}}</text>
</view>
<view class="text-wrapper_14">
<text lines="1" class="text_30">地址:</text>
<text lines="1" class="text_31">{{item.agencyName || ''}} {{item.homeName || ''}}</text>
</view>
<view class="text-wrapper_15" >
<text lines="1" class="text_32">最新更新时间:</text>
<text lines="1" decode="true" class="text_33">{{item.updatedTime|| '--'}}</text>
</view>
</view>
</scroll-view>
</view>
<load-more loadVisible="{{loadMoreVisible}}" loadType="{{loadMoreType}}"></load-more>
<no-data isShow="{{nodata}}" wx:if="{{nodata}}"></no-data>
</scroll-view>
</view>
</view>
</view>
<custom-tab-bar></custom-tab-bar>
<van-popup show="{{ showAngenCascader }}" round position="bottom">
<van-cascader
field-names="{{fieldName}}"
wx:if="{{ showAngenCascader }}"
value="{{ cascaderValue }}"
title="请选择"
options="{{ angencyList }}"
bind:close="onClose"
bind:finish="onFinish"
/>
</van-popup>
<van-cascader field-names="{{fieldName}}" wx:if="{{showAngenCascader}}" value="{{ searchOrgIdPath }}" title="请选择" options="{{ angencyList }}" bind:close="onClose" bind:finish="onFinish" />
</van-popup>

13
pages/resiAndHouse/resiAndHouse.wxss

@ -152,7 +152,6 @@ page{
margin-top: 20rpx;
}
.text_4 {
width: 401rpx;
overflow-wrap: break-word;
color: rgba(51,51,51,1);
font-size: 36rpx;
@ -161,6 +160,7 @@ page{
text-align: left;
white-space: nowrap;
line-height: 52rpx;
text-align: center;
margin-right:20rpx ;
}
@ -1088,14 +1088,9 @@ page{
line-height: 40rpx;
margin: 20rpx 0 0 31rpx;
}
.content{
width: 100%;
padding:0 20rpx ;
margin-top: 20rpx;
box-sizing: border-box;
}
.content .scroll {
height: calc(100vh - 130rpx);
.scroll {
height: calc(100vh - 750rpx);
}
.text_61 {
width: 639rpx;

6
pages/work2/work2.js

@ -1,4 +1,6 @@
// pages/work2/work2.js
const App = getApp()
Page({
/**
@ -12,7 +14,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
agencyName:App.globalData.user.agencyName,
})
},
/**

2
pages/work2/work2.wxml

@ -3,7 +3,7 @@
<view class="header">
<view>
<image src="/images/work2/Header.png "class="image_1" ></image>
<text lines="1" class="text_1">海伦路街道</text>
<text lines="1" class="text_1">{{agencyName}}</text>
</view>
</view>
<view class="box_2">

1
pages/work2/work2.wxss

@ -24,6 +24,7 @@
display:flex;
flex-direction: row;
justify-items:self-end;
align-items: center;
margin: 130rpx 0 0 29rpx;
width: 100%;
}

5
subpages/searchResult/pages/punchCard/punchCard.js

@ -599,9 +599,8 @@ Page({
try {
let res = await api.getResiInfo(this.data.resiId);
let marriageName = '--'
if (res.data.baseInfoDto.categoryInfo.categoryNames) {
res.data.baseInfoDto.categoryInfo.categoryNames = res.data.baseInfoDto.categoryInfo.categoryNames.join(',')
if (res.data.residentCategoryStr) {
res.data.baseInfoDto.categoryInfo.categoryNames = res.data.residentCategoryStr.split(',')
}
if(res.data.familyInfoDto.marriage){
marriageName = this.data.marriageList.filter(item=>item.value == res.data.familyInfoDto.marriage)[0].label

4
subpages/searchResult/pages/punchCard/punchCard.wxml

@ -18,8 +18,8 @@
</view>
<view class="form">
<view class="form_label">地址:</view>
<view class="form_value">{{form
.resideInfoDtos[0].agencyName + form.resideInfoDtos[0].homeName}}</view>
<view class="form_value"><text >{{form
.resideInfoDtos[0].agencyName}}</text>{{form.resideInfoDtos[0].homeName}}</view>
</view>
<view class="form">
<view class="form_label">创建时间:</view>

4
subpages/searchResult/pages/punchCard/punchCard.wxss

@ -201,7 +201,9 @@ page {
margin-top: 20rpx;
box-sizing: border-box;
}
.top .left .tags::-webkit-scrollbar {
display: none;
}
.top .left .tags .tag {
background-color: rgba(236, 236, 236, 0.500000);
border-radius: 4rpx;

Loading…
Cancel
Save