You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
147 lines
3.7 KiB
147 lines
3.7 KiB
import { getUserSituationList } from '../../../../api/userNum'
|
|
import { getAllSituation } from '../../../../api/index'
|
|
|
|
Page({
|
|
data: {
|
|
loadType: 'none',
|
|
loadVisible: false,
|
|
orderType: 'asc',
|
|
conditionList: [
|
|
{ title: '按照注册用户排名', id: '1', select: true },
|
|
{ title: '按照党员总数排名', id: '2', select: false },
|
|
{ title: '按照大于50岁党员排名', id: '3', select: false },
|
|
{ title: '按照小于50岁党员排名', id: '4', select: false }
|
|
],
|
|
choosedCondition: {
|
|
title: '按照注册用户排名',
|
|
id: '1'
|
|
},
|
|
conditionVisible: false,
|
|
preloadVisible: true,
|
|
userAnalysisList: [],
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
allSituation: {
|
|
userTotal: 0,//用户总数
|
|
companyRepresentTotal: 0,//其中企业代表数
|
|
partyNumber: 0,//党员总数
|
|
userNumber: 0,//居民总数
|
|
},//用户
|
|
},
|
|
onReachBottom() {
|
|
this.setData({
|
|
loadVisible: true
|
|
})
|
|
if (this.data.loadType === 'more') {
|
|
this.setData({
|
|
pageNo: this.data.pageNo + 1
|
|
})
|
|
this.initLoad()
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getAllSituation()
|
|
this.initLoad()
|
|
},
|
|
//用户
|
|
getAllSituation: function () {
|
|
let that = this
|
|
let params = {
|
|
// generateDate: utils.formatTimestamp(new Date()),
|
|
deptId: ''//wx.getStorageSync('childrenID')
|
|
}
|
|
getAllSituation(params).then((res: any) => {
|
|
// (res.data.list.unpassedProject / 10000).toFixed(2)
|
|
that.setData({
|
|
allSituation: res.data
|
|
})
|
|
})
|
|
},
|
|
// 街道一级详情
|
|
navigateToDetail(e: AnyObject) {
|
|
wx.navigateTo({
|
|
url: `/subpages/userNum/pages/streetDetail/streetDetail?deptId=${e.detail.deptId}&deptName=${e.detail.deptName}`
|
|
})
|
|
},
|
|
// 正序倒序切换
|
|
changeOrder() {
|
|
let type = 'asc'
|
|
if (this.data.orderType === 'asc') {
|
|
type = 'desc'
|
|
} else if (this.data.orderType === 'desc') {
|
|
type = 'asc'
|
|
}
|
|
this.setData({
|
|
orderType: type,
|
|
userAnalysisList: [],
|
|
preloadVisible: true,
|
|
loadType: 'none',
|
|
loadVisible: false,
|
|
pageNo: 1
|
|
})
|
|
this.initLoad()
|
|
},
|
|
// 改变查询项
|
|
onChnageCondition(e: AnyObject) {
|
|
const list = this.data.conditionList
|
|
list.forEach(item => {
|
|
if (item.id === e.currentTarget.dataset.id) {
|
|
item.select = true
|
|
this.setData({
|
|
'choosedCondition.title': item.title,
|
|
'choosedCondition.id': item.id
|
|
})
|
|
} else {
|
|
item.select = false
|
|
}
|
|
})
|
|
this.setData({
|
|
conditionList: list,
|
|
userAnalysisList: [],
|
|
preloadVisible: true,
|
|
loadType: 'none',
|
|
loadVisible: false,
|
|
pageNo: 1
|
|
})
|
|
this.initLoad()
|
|
},
|
|
// 显示条件下拉框
|
|
showCondition() {
|
|
this.setData({
|
|
conditionVisible: !this.data.conditionVisible
|
|
})
|
|
},
|
|
// 加载列表
|
|
async initLoad() {
|
|
let orderStyle = '2'
|
|
if (this.data.orderType === 'asc') {
|
|
orderStyle = '2'
|
|
} else if (this.data.orderType === 'desc') {
|
|
orderStyle = '1'
|
|
}
|
|
try {
|
|
const para = {
|
|
pageIndex: this.data.pageNo,
|
|
pageSize: this.data.pageSize,
|
|
deptId: '',
|
|
deptType: '1',
|
|
orderType: this.data.choosedCondition.id,
|
|
orderStyle
|
|
}
|
|
const res: any = await getUserSituationList(para)
|
|
console.log('用户分析,一级列表', res)
|
|
this.setData({
|
|
userAnalysisList: this.data.userAnalysisList.concat(res.data.listDTO),
|
|
preloadVisible: false,
|
|
loadType: res.data.listDTO.length === 10 ? 'more' : 'none'
|
|
})
|
|
} catch (err) {
|
|
console.log(err)
|
|
this.setData({
|
|
userAnalysisList: [],
|
|
preloadVisible: false,
|
|
loadType: 'none'
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|