榆山数据端小程序
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.
 
 

245 lines
7.5 KiB

import { analysisOfBranch, getResourceAmount, deptAnalysisOfBranch, rankingOfDevelopment } from '../../../../../../api/basicReality'
Component({
data: {
streetContentList: [],
upOrDownStatus: 'down',
selectCondition: {
label: '组织活动总次数',
value: '0'
},
conditionOrder: 'asc',
conditionListVisible: false,
conditionList: [
{ value: '0', label: '组织活动总次数' },
{ value: '1', label: '参加活动总人数' },
{ value: '2', label: '省市级和区直机关-组织次数' },
{ value: '3', label: '省市级和区直机关-参与人数' },
{ value: '4', label: '驻区企事业单位-组织次数' },
{ value: '5', label: '驻区企事业单位-参加人数' },
{ value: '6', label: '驻区两新组织-组织次数' },
{ value: '7', label: '驻区两新组织-参加次数' }
],
developSituation: {}, // 联建共建开展情况图表数据
unionAmount: {
resourceAmountTotal: 0,
resourceTimes: 0,
averageAmount: 0
},
categoryList: [
{ value: '21', label: '省级、市级和区直机关'},
{ value: '23', label: '驻区企事业单位'},
{ value: '24', label: '驻区两新组织'}],
selectUnionCondition: {
value: '21',
label: '省级、市级和区直机关'
},
unionConditionVisible: false,
developSituationLineChart: {},
streetPreloadContentList: [
{detailList: [1,2], contentList: [1,2,3]},
{detailList: [1,2], contentList: [1,2,3]},
{detailList: [1,2], contentList: [1,2,3]}
],
preloadVisible: true,
streetId: '',
timeId: '',
deptNum: ''
},
lifetimes: {
attached () {
this.analysisOfBranch()
this.getResourceAmount()
this.deptAnalysisOfBranch()
this.rankingOfDevelopment()
}
},
methods: {
// 党员参与发挥情况排名 收起/展开
onUpOrDown () {
this.setData({
upOrDownStatus: this.data.upOrDownStatus === 'up' ? 'down' : 'up'
})
},
// 显示筛选条件列表
onShowConditionList () {
this.setData({
conditionListVisible: !this.data.conditionListVisible
})
},
// 切换排名条件
onChangeCondition (e) {
this.setData({
conditionListVisible: false,
preloadVisible: true,
streetContentList: []
})
const { condition } = e.currentTarget.dataset
this.data.conditionList.forEach(item => {
if (item.value === condition) {
this.setData({
selectCondition: {
label: item.label,
value: item.value
}
})
}
})
this.rankingOfDevelopment()
},
// 正反序切换
onChangeConditionOrder () {
this.setData({
conditionOrder: this.data.conditionOrder === 'asc' ? 'desc' : 'asc',
preloadVisible: true,
streetContentList: []
})
this.rankingOfDevelopment()
},
// 获取联建共建开展情况图表数据
async analysisOfBranch () {
const para = {
streetId: this.data.streetId,
someMonthsType: this.data.timeId,
categoryType: '1'
}
try {
const res: any = await analysisOfBranch(para)
console.log('联建共建开展情况图表数据', res)
Object.assign(this.data.developSituation, res.data)
this.setData({
developSituation: this.data.developSituation
})
} catch (err) {
console.error(err)
}
},
// 获取资源整合金额
async getResourceAmount () {
const para = {
streetId: this.data.streetId,
someMonthsType: this.data.timeId
}
try {
const res: any = await getResourceAmount(para)
console.log('联建共建资源整合金额', res)
Object.assign(this.data.unionAmount, res.data)
this.setData({
unionAmount: this.data.unionAmount
})
} catch (err) {
console.error(err)
}
},
// 联建共建开展情况筛选列表
onShowUnionConditionList () {
this.setData({
unionConditionVisible: !this.data.unionConditionVisible
})
},
// 切换联建共建开展情况筛选条件
onChnageUnionCondition (e) {
const { condition } = e.currentTarget.dataset
this.data.categoryList.forEach(item => {
if (item.value === condition) {
this.setData({
selectUnionCondition: {
label: item.label,
value: item.value
},
unionConditionVisible: false
})
}
})
this.deptAnalysisOfBranch()
},
// 获取联建共建折线图
async deptAnalysisOfBranch () {
const para = {
streetId: this.data.streetId,
someMonthsType: this.data.timeId,
categoryCode: this.data.selectUnionCondition.value
}
try {
const res: any = await deptAnalysisOfBranch(para)
console.log('联建共建折线图', res)
const { categoryList, joinNumList, organizationsCountList, averageNum } = res.data
Object.assign(this.data.developSituationLineChart, { categoryList, joinNumList, organizationsCountList, averageNum })
this.setData({
developSituationLineChart: this.data.developSituationLineChart,
deptNum: res.data.deptNum
})
} catch (err) {
console.error(err)
}
},
// 联建共建开展情况排名
async rankingOfDevelopment () {
const para = {
streetId: this.data.streetId,
someMonthsType: this.data.timeId,
order: this.data.conditionOrder === 'asc' ? '0' : '1',
type: this.data.selectCondition.value
}
try {
const res: any = await rankingOfDevelopment(para)
console.log('联建共建开展情况排名', res)
const list: any[] = []
if (res.data.streetList && res.data.streetList.length > 0) {
res.data.streetList.forEach((street: any) => {
let contentList: AnyArray = []
street.categoryInfoList.forEach( (category: any) => {
contentList.push({
name: category.categoryName,
organizationNum: category.organizationsCount,
enterNum: category.joinNum
})
})
const detailList = [
{ name: '组织总次数', num: street.allOrganizationsCount },
{ name: '参加总次数', num: street.allJoinNumCount}
]
list.push({
contentList,
detailList,
streetName: street.deptname
})
})
}
this.setData({
// @ts-ignore
streetContentList: list,
preloadVisible: false
})
} catch (err) {
this.setData({
streetContentList: [],
preloadVisible: false
})
console.error(err)
}
},
chooseStreetId (e: any) {
this.setData({
streetId: e.detail,
streetContentList: [],
preloadVisible: true
})
this.rankingOfDevelopment()
this.deptAnalysisOfBranch()
this.getResourceAmount()
this.analysisOfBranch()
},
chooseTimeId (e: any) {
this.setData({
timeId: e.detail,
streetContentList: [],
preloadVisible: true
})
this.rankingOfDevelopment()
this.deptAnalysisOfBranch()
this.getResourceAmount()
this.analysisOfBranch()
}
}
})