From 8ef6c262afb282773fb592e6d257a75c1bb0801d Mon Sep 17 00:00:00 2001 From: jiangyy Date: Wed, 8 Dec 2021 17:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visual/communityGovern/processAnalyze.vue | 29 +- .../communityGovern/processLineOption.js | 69 ++- .../communityGovern/processPieOption.js | 57 +- .../visual/communityGovern/resibuzz.vue | 12 - .../components/screen-map/basicInfoMain.vue | 523 ++++++++++++++++++ 5 files changed, 648 insertions(+), 42 deletions(-) create mode 100644 src/views/modules/visual/components/screen-map/basicInfoMain.vue diff --git a/src/views/modules/visual/communityGovern/processAnalyze.vue b/src/views/modules/visual/communityGovern/processAnalyze.vue index 86b0d733..1517c453 100644 --- a/src/views/modules/visual/communityGovern/processAnalyze.vue +++ b/src/views/modules/visual/communityGovern/processAnalyze.vue @@ -95,6 +95,7 @@ export default { lineColorArray: [], lineData: [820, 932, 901, 934, 1290, 1330, 1320], + pieChartS: null, pieChart: '', pieOption: {}, pieInitState: false, @@ -227,8 +228,9 @@ export default { } }, - pieInitOk () { + pieInitOk (dom) { console.log('pie准备好了') + this.pieChartS = dom this.pieInitState = true }, @@ -252,10 +254,11 @@ export default { const _that = this // this.$refs.pieChart.showLoading() - // const url ="/gov/issue/issue/resibuzz-leftpiechart"; - const url = "http://yapi.elinkservice.cn/mock/245/gov/issue/issue/resibuzz-leftpiechart"; + // const url ="/data/aggregator/project/projectmonthincr"; + const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/project/projectmonthincr"; let params = { agencyId: this.agencyId, + dateId: this.dateId, }; const { data, code, msg } = await requestPost(url, params); @@ -263,14 +266,28 @@ export default { if (code === 0) { // 获取pieChart配置 this.lineOption = lineOption() + let xaxis = [] + let totalIndexData = [] if (data && data.length > 0) { + data.forEach(item => { + xaxis.push(item.type) + totalIndexData.push(item.value) + }); // this.lineData = data } else { - this.lineData = [0] + } + this.$refs.lineChart.setOption(this.lineOption, true) + this.$refs.lineChart.setOption({ + xAxis: { data: xaxis }, + series: [ + { data: totalIndexData }, + + ] + }, true) + - this.$refs.lineChart.setOption(this.lineOption) } else { this.$message.error(msg); } @@ -295,7 +312,7 @@ export default { // this.$refs.pieChart.showLoading() // 获取pieChart配置 - this.pieOption = pieOption() + this.pieOption = pieOption(this.pieChartS) this.pieData.forEach(item => { this.pieTotal = this.pieTotal + item.value diff --git a/src/views/modules/visual/communityGovern/processLineOption.js b/src/views/modules/visual/communityGovern/processLineOption.js index 0d094b5c..ef7dec01 100644 --- a/src/views/modules/visual/communityGovern/processLineOption.js +++ b/src/views/modules/visual/communityGovern/processLineOption.js @@ -1,21 +1,76 @@ - +import * as echarts from 'echarts' export function lineOption () { return { + xAxis: { type: 'category', - boundaryGap: false, - data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] + // boundaryGap: false, + axisLabel: { + color: '#8ec7dc', + fontSize: 16 + }, + axisTick: { + show: false + }, + axisLine: { + lineStyle: { + color: '#0c4b59' + } + } }, yAxis: { - type: 'value' + nameTextStyle: { + color: '#8ec7dc', + fontSize: 18 + }, + splitNumber: 4, + minInterval: 1, + show: true, + type: 'value', + axisLabel: { + color: '#8ec7dc', + fontSize: 18 + }, + axisTick: { + show: false + }, + splitLine: { + lineStyle: { + color: ['#145968'], + type: 'dotted' + } + }, + axisLine: { + show: true, + symbol: ['none', 'arrow'], + symbolOffset: [0, 15], + lineStyle: { + color: '#0c4b59' + } + } }, series: [ { - data: [820, 932, 901, 934, 1290, 1330, 1320], + name: '项目数', type: 'line', - areaStyle: {} - } + barWidth: 15, + areaStyle: {}, + itemStyle: { + color: new echarts.graphic.LinearGradient( + 0, 1, 0, 0, + [ + { offset: 0, color: 'rgba(121, 55, 255, 0)' }, + { offset: 1, color: '#6339FF' } + ] + ) + } + }, + // { + // data: [820, 932, 901, 934, 1290, 1330, 1320], + // type: 'line', + // areaStyle: {} + // } ] } diff --git a/src/views/modules/visual/communityGovern/processPieOption.js b/src/views/modules/visual/communityGovern/processPieOption.js index a58528b7..0ab2bfd2 100644 --- a/src/views/modules/visual/communityGovern/processPieOption.js +++ b/src/views/modules/visual/communityGovern/processPieOption.js @@ -1,5 +1,5 @@ -export function pieOption () { +export function pieOption (_charts) { const center= ['50%', '200px'] return { title: { @@ -85,33 +85,56 @@ const center= ['50%', '200px'] left: 'center', width: 400, label: { - position: 'outer', - // alignTo: 'edge', - formatter: '{a|{c}}\n\n{name|{b}}', - // minMargin: 100, - // edgeDistance: 0, - // lineHeight: 20, + // show: false, + position: 'outside', + alignTo: 'edge', + // formatter: '{a|{c}}\n\n{name|{b}}', + formatter: '{a|{c}}\n{r|}\n{name|{b}}', + minMargin: 5, + edgeDistance: 1, + lineHeight: 15, color: '#fff', fontSize: 12, - distanceToLabelLine: -60, + // distanceToLabelLine: -60, rich: { + name: { + padding: [0, 6, 0, 6] + }, a: { - fontSize: '30px', - color: ' #00F5FE', - + fontSize: 30, + color: '#fff', + padding: [0, 6, 6, 6] }, - b: { - lineHeight: 0, - fontSize: '20px', - color: ' #FFFFFF' - + r: { + backgroundColor: 'auto', + borderRadius: 6, + width: 6, + height: 6, + // padding: [3, 3, 0, -12] } } }, labelLine: { + show: false, smooth: 0.2, length: 30, - length2: 90 + length2: 0, + maxSurfaceAngle: 80 + }, + labelLayout: function (params) { + + const isLeft = params.labelRect.x < _charts.getWidth() / 2; + const points = params.labelLinePoints; + // Update the end point. + if (points) { + points[2][0] = isLeft + ? params.labelRect.x + : params.labelRect.x + params.labelRect.width; + } + + return { + labelLinePoints: points + }; }, itemStyle: { color:function(params) { diff --git a/src/views/modules/visual/communityGovern/resibuzz.vue b/src/views/modules/visual/communityGovern/resibuzz.vue index 9032eed2..8b7406b6 100644 --- a/src/views/modules/visual/communityGovern/resibuzz.vue +++ b/src/views/modules/visual/communityGovern/resibuzz.vue @@ -318,18 +318,6 @@ export default { }; console.log('zhilma') - // element.labelLayout = (params) => { - // const isLeft = params.labelRect.x < this.pieChartS.getWidth() / 2; - // const points = params.labelLinePoints; - // console.log('isLeft', isLeft, points) - // // Update the end point. - // points[2][0] = isLeft - // ? params.labelRect.x - // : params.labelRect.x + params.labelRect.width; - // return { - // labelLinePoints: points - // }; - // } } else { element.label = { diff --git a/src/views/modules/visual/components/screen-map/basicInfoMain.vue b/src/views/modules/visual/components/screen-map/basicInfoMain.vue new file mode 100644 index 00000000..6f48ebd4 --- /dev/null +++ b/src/views/modules/visual/components/screen-map/basicInfoMain.vue @@ -0,0 +1,523 @@ + + + + + + + \ No newline at end of file