统计bug

This commit is contained in:
花有清香月有阴
2021-12-22 11:40:37 +08:00
parent d36c1add6c
commit 13b4b7342e

View File

@@ -9,22 +9,22 @@
<div class="topcard">
<div class="cards">
<div class="items">
<span class="items1">1</span>
<span>群聊</span>
<span class="items1">{{ groupSum }}</span>
<span>群聊</span>
</div>
<div class="items">
<span class="items2">1</span>
<span class="items2">{{ chartsList.total }}</span>
<span>群成员总数</span>
</div>
<div class="items">
<span class="items3">1</span>
<span class="items3">{{ chartsList.increase }}</span>
<span>今日入群</span>
</div>
<div class="items">
<span class="items4">1</span>
<span class="items4">{{ chartsList.decrease }}</span>
<span>今日退群</span>
</div>
</div>
@@ -39,23 +39,18 @@
<div class="topcard">
<div class="cards">
<div class="items">
<span class="items1">1</span>
<span>群聊人</span>
<span class="items1">{{ nums }}</span>
<span>居民总</span>
</div>
<div class="items">
<span class="items2">1</span>
<span>群成员总数</span>
<span class="items2">{{ chartsList.increase }}</span>
<span>今日新增</span>
</div>
<div class="items">
<span class="items3">1</span>
<span>今日入群</span>
</div>
<div class="items">
<span class="items4">1</span>
<span>今日退群</span>
<span class="items4">{{ chartsList.decrease }}</span>
<span>今日流失</span>
</div>
</div>
</div>
@@ -143,8 +138,8 @@ export default {
return {
lists: [
{
iconPath: 'order',
selectedIconPath: 'order-fill',
iconPath: 'home',
selectedIconPath: 'home-fill',
text: '统计分析',
isDot: true,
customIcon: false,
@@ -192,6 +187,10 @@ export default {
page: { current: 1, size: 10, total: 0 },
search: { name: '' },
list: [],
groupSum: '',
chartsList: [],
datass: [],
nums: '',
}
},
computed: {
@@ -199,7 +198,8 @@ export default {
},
watch: {},
onLoad() {
this.getEchart()
this.getEchart1()
this.getEchart2()
this.areaId = this.user.areaId
},
mounted() {
@@ -233,7 +233,6 @@ export default {
},
toGroupList(item) {
console.log(1, item.id)
uni.navigateTo({
url: `./GroupList?id=${item.id}`,
})
@@ -258,17 +257,79 @@ export default {
})
},
getEchart() {
// 居民群统计
getEchart1() {
console.log(1)
this.$http.post(`/app/wxcp/wxgroup/groupStatistic`).then((res) => {
if (res.code === 0) {
this.initEcharts1(res.data.list)
this.groupSum = res.data.groupSum
this.chartsList = res.data.today
}
})
},
// 居民群统计
getEchart2() {
console.log(2)
this.$http.post(`/app/appresident/queryCustInfoByAreaId?areaId=${this.user.areaId}`).then((res) => {
if (res.code === 0) {
this.initEcharts1(res.data['年龄层次'])
this.initEcharts2(res.data['人口分布'])
this.initEcharts2(res.data['年龄层次'])
this.nums = res.data['总人数']
}
})
},
initEcharts1(data) {
var option = {
xAxis: {
type: 'category',
data: Object.keys(data).map((e) => e.substring(e.length - 5, e.length)),
axisLine: {
lineStyle: { color: '#157EFF' },
},
axisLabel: {
show: true,
interval: 0,
},
axisTick: {
interval: 'auto',
},
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
color: '#666',
},
},
splitLine: {
show: true,
lineStyle: {
color: '#D8DDE6',
},
},
axisLabel: {
show: true,
interval: 0,
},
},
series: [
{
color: '#0072FF',
barWidth: 30,
data: Object.values(data).map((e) => e.total),
type: 'line',
},
],
}
option && this.Echarts1.setOption(option)
},
initEcharts2(data) {
console.log(data)
var options = {
xAxis: {
type: 'category',
data: data.map((v) => v.v1),
@@ -311,53 +372,6 @@ export default {
],
}
option && this.Echarts1.setOption(option)
},
initEcharts2(data) {
var options = {
xAxis: {
type: 'category',
data: data.map((v) => v.name),
axisLine: {
lineStyle: { color: '#157EFF' },
},
axisLabel: {
show: true,
interval: 0,
},
axisTick: {
interval: 'auto',
},
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
color: '#666',
},
},
splitLine: {
show: true,
lineStyle: {
color: '#D8DDE6',
},
},
axisLabel: {
show: true,
interval: 0,
},
},
series: [
{
color: '#0072FF',
barWidth: 30,
data: data.map((v) => v.v1),
type: 'line',
},
],
}
options && this.Echarts2.setOption(options)
},
@@ -366,7 +380,6 @@ export default {
},
areaSelect(e) {
console.log(e)
this.areaId = e.id
this.getList()
},
@@ -390,10 +403,12 @@ export default {
this.$nextTick(() => {
if (this.currentTabs == 0) {
this.Echarts1 = echarts.init(document.getElementById('echarts1'))
} else {
this.Echarts2 = echarts.init(document.getElementById('echarts2'))
this.getEchart1()
}
if (this.currentTabs == 1) {
this.Echarts2 = echarts.init(document.getElementById('echarts2'))
this.getEchart2()
}
this.getEchart()
})
}
if (this.currentTabBar == 1) {
@@ -409,10 +424,11 @@ export default {
this.$nextTick(() => {
if (index == 0) {
this.Echarts1 = echarts.init(document.getElementById('echarts1'))
this.getEchart1()
} else {
this.Echarts2 = echarts.init(document.getElementById('echarts2'))
this.getEchart2()
}
this.getEchart()
})
},