From 60f0336a9dead3bfcdf270a6a9d7968697e57327 Mon Sep 17 00:00:00 2001 From: chenjingyu Date: Wed, 2 Sep 2020 17:07:00 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=88=A0=E9=99=A4]=E7=AC=AC=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../delete-one/delete-one.component.ts | 132 ++++++++++++++++-- .../state/page-one/page-one.component.ts | 3 +- 2 files changed, 123 insertions(+), 12 deletions(-) diff --git a/src/app/statistic-analysis/deleteUnit/delete-one/delete-one.component.ts b/src/app/statistic-analysis/deleteUnit/delete-one/delete-one.component.ts index 3169f9b..afd66fa 100644 --- a/src/app/statistic-analysis/deleteUnit/delete-one/delete-one.component.ts +++ b/src/app/statistic-analysis/deleteUnit/delete-one/delete-one.component.ts @@ -1,12 +1,6 @@ -/* - * @Descripttion: - * @version: - * @Author: sueRimn - * @Date: 2020-09-02 16:15:53 - * @LastEditors: sueRimn - * @LastEditTime: 2020-09-02 16:44:32 - */ import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +declare var echarts: any; @Component({ selector: 'app-delete-one', @@ -14,10 +8,128 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./delete-one.component.scss'] }) export class DeleteOneComponent implements OnInit { + options:any; - constructor() { } + constructor(private router: Router) { } - ngOnInit(): void { + ngOnInit() { + window.setTimeout(()=>{ + this.initCharts() + },0) + } + + /* 首页饼状图 */ + initCharts(){ + //console.log(document.getElementById('indexBzt')) + + var ec = echarts as any; + var indexBzt = ec.init(document.getElementById('indexBzt')); + var options={ + title: { + text: '预案状态统计(7005家)', + //subtext: '纯属虚构', + padding:[80,100], + left: 'center', + textStyle:{ + fontSize:38 + } + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.biaogeTishi(params.name) + } , + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + + + }, + legend: { + orient: 'vertical', + right: 150, + top:80, + //padding:20, + itemWidth:60, + itemHeight:25, + textStyle:{ + fontSize:28 + }, + data: ['预案新增', '预案审核通过', '预案编制', '预案审核退回', '预案审核中'] + }, + series: [ + { + name: '访问来源', + type: 'pie', + radius: '65%', + center: ['50%', '60%'], + label:{ + normal:{ + show:true, + position: 'inner', + fontSize:18, + formatter:'{c} ({d}%)' + } + + }, + data: [ + {value: 1585, name: '预案新增'}, + {value: 2000, name: '预案审核通过',itemStyle:{color:'#02A7F0'}}, + {value: 2600, name: '预案编制'}, + {value: 1500, name: '预案审核退回'}, + {value: 1800, name: '预案审核中'} + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + indexBzt.on('click', (params) => { + this.router.navigateByUrl('/statisticanalysis/statePageTwo_time'); + }); + indexBzt.setOption(options); + } + /** + * @name: 表格提示框封装 + * @test: test font + * @msg: + * @param {string(表头)} + * @return {type} + */ + biaogeTishi(biaotou:string){ + var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄埔支队","number":"144","zhanbi":"2.8%"},' + shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' + shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},' + shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},' + shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},' + shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' + shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},' + shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]' + var jsonObj = JSON.parse(shuju); + var res = '
'+biaotou+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+jsonObj[i].number+''+jsonObj[i].zhanbi+'
总计135619%
' + return res } } diff --git a/src/app/statistic-analysis/state/page-one/page-one.component.ts b/src/app/statistic-analysis/state/page-one/page-one.component.ts index 1563f44..83df434 100644 --- a/src/app/statistic-analysis/state/page-one/page-one.component.ts +++ b/src/app/statistic-analysis/state/page-one/page-one.component.ts @@ -4,11 +4,10 @@ * @Author: sueRimn * @Date: 2020-09-01 15:24:39 * @LastEditors: sueRimn - * @LastEditTime: 2020-09-02 15:11:35 + * @LastEditTime: 2020-09-02 16:52:44 */ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; -//import * as echarts from ''; declare var echarts: any; @Component({