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.
241 lines
6.8 KiB
241 lines
6.8 KiB
// @ts-ignore
|
|
import * as echarts from '../../../../../../components/ec-canvas/echarts.js'
|
|
import { getPeopleChart2 } from '../../../../utils/echarts'
|
|
import { getEventDynamicCondition } from '../../../../../../api/partyInteract'
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
deptid: {
|
|
type: String
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
ecVoiceA: {
|
|
lazyLoad: true
|
|
},
|
|
ecVoiceB: {
|
|
lazyLoad: true
|
|
},
|
|
colorData1: ['#AD6DFE', '#FFA270'],
|
|
colorData2: [],//#AD6DFE居民 //#FFA270党员
|
|
chartsData1: [],
|
|
chartsData2: [],
|
|
deadline: '',
|
|
partyDynamicTotal: '',
|
|
resident1: '',//居民
|
|
resident2: ''
|
|
},
|
|
lifetimes: {
|
|
async attached() {
|
|
await this.getEventDynamicCondition()
|
|
// @ts-ignore
|
|
this.ecComponentA = this.selectComponent('#mychart-voiceA')
|
|
await this.initA()
|
|
// @ts-ignore
|
|
this.ecComponentB = this.selectComponent('#mychart-voiceB')
|
|
await this.initB()
|
|
|
|
}
|
|
},
|
|
observers: {
|
|
async deptid(newValue) {
|
|
if (newValue.length !== 0) {
|
|
await this.getEventDynamicCondition()
|
|
await this.initA()
|
|
}
|
|
},
|
|
|
|
},
|
|
methods: {
|
|
initA() {
|
|
// @ts-ignore
|
|
this.ecComponentA.init((canvas: any, width: any, height: any) => {
|
|
const chart = echarts.init(canvas, null, {
|
|
width: width,
|
|
height: height
|
|
})
|
|
getPeopleChart2(chart, this.data.colorData1, this.data.chartsData1)
|
|
return chart
|
|
})
|
|
},
|
|
initB() {
|
|
// @ts-ignore
|
|
this.ecComponentB.init((canvas: any, width: any, height: any) => {
|
|
const chart = echarts.init(canvas, null, {
|
|
width: width,
|
|
height: height
|
|
})
|
|
getPeopleChart2(chart, this.data.colorData1, this.data.chartsData2)
|
|
return chart
|
|
})
|
|
},
|
|
async getEventDynamicCondition() {
|
|
let obj = {
|
|
DeptId: this.properties.deptid,
|
|
someMonthsType: '1'
|
|
}
|
|
let res: any = await getEventDynamicCondition(obj)
|
|
this.setData({
|
|
// @ts-ignore
|
|
resident2: parseInt(res.data.dataList.partyPublishTimes / res.data.dataList.partyPublishTimesPercent - res.data.dataList.partyPublishTimes),
|
|
// @ts-ignore
|
|
resident1: parseInt(res.data.dataList.partyPublishTotal / res.data.dataList.partyPublishPercent - res.data.dataList.partyPublishTotal)
|
|
})
|
|
/****议事数 ****/
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTotal == 0 && this.data.resident1 == 0) {
|
|
// @ts-ignore
|
|
let arr1 = [
|
|
{
|
|
name: '党员发起议事数',
|
|
value: res.data.dataList.partyPublishTotal
|
|
},
|
|
{
|
|
name: '居民发起议事数',
|
|
// @ts-ignore
|
|
value: this.data.resident1
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData1: ['#AD6DFE', '#FFA270'],
|
|
})
|
|
}
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTotal == 0 && this.data.resident1 !== 0) {
|
|
debugger
|
|
// @ts-ignore
|
|
let arr1 = [
|
|
{
|
|
name: '居民发起议事数',
|
|
// @ts-ignore
|
|
value: this.data.resident1
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData1: ['#FFA270'],
|
|
})
|
|
}
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTotal !== 0 && this.data.resident1 == 0) {
|
|
// @ts-ignore
|
|
let arr1 = [
|
|
{
|
|
name: '党员发起议事数',
|
|
value: res.data.dataList.partyPublishTotal
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData1: ["#AD6DFE"]
|
|
})
|
|
}
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTotal !== 0 && this.data.resident1 !== 0) {
|
|
let arr1 = [
|
|
{
|
|
name: '党员发起议事数',
|
|
value: res.data.dataList.partyPublishTotal
|
|
},
|
|
{
|
|
name: '居民发起议事数',
|
|
// @ts-ignore
|
|
value: this.data.resident1
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData1: ['#AD6DFE', '#FFA270'],
|
|
})
|
|
}
|
|
/****议事人次 ****/
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTimes == 0 && this.data.resident2 == 0) {
|
|
// @ts-ignore
|
|
let arr2 = [
|
|
{
|
|
name: '党员发起议事人次',
|
|
value: res.data.dataList.partyPublishTimes
|
|
},
|
|
{
|
|
name: '居民发起议事人次',
|
|
// @ts-ignore
|
|
value: this.data.resident2
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData2: ['#AD6DFE', '#FFA270'],
|
|
})
|
|
}
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTimes == 0 && this.data.resident2 !== 0) {
|
|
// @ts-ignore
|
|
let arr2 = [
|
|
{
|
|
name: '居民发起议事人次',
|
|
// @ts-ignore
|
|
value: this.data.resident2
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData2: ['#FFA270'],
|
|
})
|
|
}
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTimes !== 0 && this.data.resident2 == 0) {
|
|
// @ts-ignore
|
|
let arr2 = [
|
|
{
|
|
name: '党员发起议事人次',
|
|
value: res.data.dataList.partyPublishTimes
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData2: ["#AD6DFE"]
|
|
})
|
|
}
|
|
// @ts-ignore
|
|
if (res.data.dataList.partyPublishTimes !== 0 && this.data.resident2 !== 0) {
|
|
let arr2 = [
|
|
{
|
|
name: '党员发起议事人次',
|
|
value: res.data.dataList.partyPublishTimes
|
|
},
|
|
{
|
|
name: '居民发起议事人次',
|
|
// @ts-ignore
|
|
value: this.data.resident2
|
|
}
|
|
]
|
|
this.setData({
|
|
// @ts-ignore
|
|
colorData2: ['#AD6DFE', '#FFA270'],
|
|
})
|
|
}
|
|
this.setData({
|
|
deadline: res.data.deadline,
|
|
partyDynamicTotal: res.data.dataList.partyDynamicTotal,//参与议题总数
|
|
partyDynamicPercent: res.data.dataList.partyDynamicPercent * 100,//占总用户的
|
|
partyDynamicPartyPercent: res.data.dataList.partyDynamicPartyPercent * 100,//占党员
|
|
partyPublishTotal: res.data.dataList.partyPublishTotal,//党员发起议事数
|
|
partyPublishPercent: res.data.dataList.partyPublishPercent * 100,//占平台总议题数
|
|
partyDynamicTimes: res.data.dataList.partyPublishTimes,//党员参与议事人次
|
|
partyDynamicTimesPercent: res.data.dataList.partyPublishTimesPercent * 100,//占平台总参与人次
|
|
// @ts-ignore
|
|
chartsData1: arr1,
|
|
// @ts-ignore
|
|
chartsData2: arr2
|
|
})
|
|
}
|
|
}
|
|
})
|