import { getStreetList, getAllDynamicStatistics } from '../../../../api/partyInteract' Page({ data: { currentTab: 0, //按了哪个tab键 status: 1,//状态,接口需要的参数 conditionList: [ { title:'全部', id:'', select: true } ], choosedCondition: {}, conditionVisible: false, visible: false, deptid: '', partyTotal:'',//党员总数 deadline:'',//时间 partyPercent:'',//占平台总用户数 pepopleList:[], peopleLeft:[], peopleright:[], peopleColorData:["#29B9A5","#FFC600"],//#FFC600党员 #29B9A5居民 peopleColorData2:['#FFA270','#AD6DFE'] //#FFA270不参与 }, async onLoad() { await this.getStreetList() await this.getAllDynamicStatistics() }, // 显示条件下拉框 showCondition() { this.setData({ conditionVisible: !this.data.conditionVisible }) }, // 改变查询项 onChnageCondition(e: AnyObject) { if (this.data.conditionList.length !== 0) { const list = this.data.conditionList list.forEach(item => { // @ts-ignore if (item.id === e.currentTarget.dataset.id) { // @ts-ignore item.select = true this.setData({ // @ts-ignore 'choosedCondition.title': item.title, // @ts-ignore 'choosedCondition.id': item.id, // @ts-ignore deptid: item.id }) } else { // @ts-ignore item.select = false } }) this.setData({ conditionList: list }) this.getAllDynamicStatistics() } }, trigger(e: any) { let { currentTarget } = e if (currentTarget.dataset.index == '党员平台参与') { this.setData({ currentTab: 0 }) wx.pageScrollTo({ duration: 300, scrollTop: 0 }) } else if (currentTarget.dataset.index == '党员声音参与') { this.setData({ currentTab: 1 }) wx.pageScrollTo({ duration: 300, selector: '.participationVoice' }) } else if (currentTarget.dataset.index == '党员议事参与') { this.setData({ currentTab: 2 }) wx.pageScrollTo({ duration: 300, selector: '.participationStatus' }) } else if (currentTarget.dataset.index == '党员群团带动') { this.setData({ currentTab: 3 }) wx.pageScrollTo({ duration: 300, selector: '.participationActivety' }) } }, hide() { this.setData({ visible: false, }) }, onChange(e: any) { console.log('onChange', e) this.setData({ visible: e.detail.visible, }) }, /******下拉框 ***********/ async getStreetList() { let res: any = await getStreetList() let arr: any = [] res.data.forEach((element: any, index: number) => { if (index == 0) { arr.push( { title: element.deptName, id: element.deptId, select: false } ) } else { arr.push( { title: element.deptName, id: element.deptId, select: false } ) } }) this.setData({ conditionList: this.data.conditionList.concat(arr), 'choosedCondition.title': this.data.conditionList[0].title, 'choosedCondition.id': this.data.conditionList[0].id, deptid: this.data.conditionList[0].id }) }, /******************getAllDynamicStatistics获得党员平台参与情况 ***********/ async getAllDynamicStatistics() { let obj = { deptId:this.data.deptid } // @ts-ignore let res: any = await getAllDynamicStatistics(obj) let arr1 = [ { name:res.data.list.residentTotal, // name:'居民人数', value:res.data.list.residentTotal }, { name:res.data.list.partyTotal, // name:'党员人数', value:res.data.list.partyTotal } ] let arr2 = [ { name:res.data.list.noDynamicPartyTotal, // name:'党员不参与人数', value:res.data.list.noDynamicPartyTotal }, { name:res.data.list.partyDynamicTotal, // name:'党员参与人数', value:res.data.list.partyDynamicTotal } ] this.setData({ partyTotal:res.data.list.partyTotal, deadline:res.data.deadline, // @ts-ignore partyPercent:(res.data.list.partyPercent)*100, pepopleList:res.data.list, // @ts-ignore peopleLeft:arr1, // @ts-ignore peopleright:arr2 }) console.log(res,'参与人数') } })