From cc6719a6778825f7a705fcc887a4248867fb3793 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Fri, 16 Jun 2023 13:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A3=E5=8F=91=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppAnnounceStatistics.vue | 165 +++++++++++++++++- 1 file changed, 164 insertions(+), 1 deletion(-) diff --git a/packages/wxwork/Announce/AppAnnounceStatistics/AppAnnounceStatistics.vue b/packages/wxwork/Announce/AppAnnounceStatistics/AppAnnounceStatistics.vue index 97ce8db3..41d84d54 100644 --- a/packages/wxwork/Announce/AppAnnounceStatistics/AppAnnounceStatistics.vue +++ b/packages/wxwork/Announce/AppAnnounceStatistics/AppAnnounceStatistics.vue @@ -103,6 +103,18 @@ +
+ + + + + + +
@@ -163,6 +175,14 @@ isDepartData: true, departBarData: [], type: '', + date: '', + search: { + current: 1, + size: 10, + type: '0' + }, + chart1: null, + chart2: null } }, computed: { @@ -217,6 +237,14 @@ this.getDepart() this.dict.load('mstSendType') }, + + mounted () { + this.$nextTick(() => { + this.chart1 = echarts.init(document.querySelector('#chart1')) + this.chart2 = echarts.init(document.querySelector('#chart2')) + window.addEventListener('resize', this.onResize) + }) + }, methods: { ...mapActions(['initOpenData', 'transCanvas']), onUserChange (e) { @@ -290,6 +318,8 @@ this.setLineChart(xData, createData, 'createChart', ['#2891FF']) this.setLineChart(xData, executeData, 'executeChart', ['#FFB865']) this.setLineChart(xData, receiveData, 'receiveChart', ['#26D52B']) + this.initChart1(res.data.tagTrend) + this.initChart2(res.data.tagDistribution) } }) }, @@ -456,8 +486,137 @@ // ] // }; this.departBarChart.setOption(option) - } + }, + initChart1 (data) { + const x = Object.keys(data) + const tags = data[x[0]].map(v => v.tag) + let option = { + tooltip: { + trigger: 'axis' + }, + legend: { + type: "plain" + }, + grid: { + left: '10px', + right: '28px', + bottom: '14px', + top: '30px', + containLabel: true + }, + dataZoom: [ + { + type: 'inside', + start: 0, + end: 7, + minValueSpan: 7 + }, + { + start: 0, + end: 7 + } + ], + color: ['#2266FF', '#22AA99', '#F8B425', '#29ABF7', '#49DFCB'], + xAxis: { + type: 'category', + axisLabel: { + align: 'center', + padding: [2, 0, 0, 0], + interval: 0, + fontSize: 14, + color: '#666666' + }, + boundaryGap: false, + axisLine: { + lineStyle: { + color: '#E1E5EF' + } + }, + data: x + }, + yAxis: { + axisTick: { + length: 0, + show: false + }, + splitLine: { + show: true, + lineStyle:{ + color: ['#E1E5EF'], + width: 1, + type: 'solid' + } + }, + nameTextStyle: { + color: '#666666', + align: 'left' + }, + axisLine: { + show: false + }, + axisLabel: { + color: '#666666' + }, + type: 'value' + }, + series: tags.map(v => { + return { + name: v, + type: 'line', + data: x.map(e => data[e]).filter(z => { + return z.filter(y => y.tag === v)[0].c + }) + } + }) + } + this.chart1.setOption(option) + }, + + initChart2 (data) { + let option = { + grid: { + left: '1%', + right: '0%', + bottom: '2%', + top: '0px', + containLabel: true + }, + tooltip: { + trigger: 'item', + axisPointer: { + } + }, + legend: { + left: 'center', + top: '0px', + textStyle: { + } + }, + color: ['#2266FF', '#22AA99', '#F8B425', '#29ABF7', '#49DFCB'], + series: [ + { + type: 'pie', + radius: '50%', + data: data.map(v => { + return { + value: v.c, + name: v.tag + } + }), + label: { + normal: { + textStyle: { + fontSize: '12' + }, + formatter: '{b}: {@2012} ({d}%)' + } + } + } + ] + } + this.chart2.setOption(option) + } } } @@ -469,6 +628,10 @@ display: flex; justify-content: space-between; } + + .bottom { + display: flex; + } .mar-b16{ margin-bottom: 16px; }