New file |
| | |
| | | <template> |
| | | <div class="hola-container"> |
| | | <div class="chart" id="dataChart" ref="chartRef"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | let myChart = null; |
| | | export default { |
| | | name: 'DataHola', |
| | | props: { |
| | | centerValue: { |
| | | type: [Number, String], |
| | | default: 0 |
| | | }, |
| | | holaColor: { |
| | | type: String, |
| | | default: '#4ea8ff' |
| | | }, |
| | | holaTitle: { |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | methods: { |
| | | initChart() { |
| | | const series= [ |
| | | { |
| | | type: 'gauge', // 仪表盘类型 |
| | | name: '系列名称', // 用于tooltip的显示 |
| | | startAngle: 90, // 仪表盘开始角度(设置背景圆的角度) |
| | | endAngle: -270, // 仪表盘结束角度 |
| | | center: ['50%', '50%'], // 中心点(圆心坐标) |
| | | radius: '100%', // 圆大小(仪表盘半径) |
| | | clockwise: true, // 仪表盘刻度是否是顺时针增长 |
| | | // 仪表盘轴线相关配置 |
| | | axisLine: { |
| | | show: true, |
| | | roundCap: false, // 两端显示成圆形(背景环) |
| | | clip: false, // 是否裁剪超出部分 |
| | | // 设置背景圆环样式 |
| | | lineStyle: { |
| | | width: 6, // 圆环宽度 |
| | | color: [[1, '#002865']] // 圆环背景色 |
| | | } |
| | | }, |
| | | max: 5000, |
| | | // 仪表盘指针 |
| | | pointer: { |
| | | show: false |
| | | }, |
| | | // 进度设置 |
| | | progress: { |
| | | show: true, |
| | | overlap: false, // 多组数据时进度条是否重叠 |
| | | roundCap: true, // 是否在两端显示成圆形 |
| | | clip: false, // 是否裁掉超出部分 |
| | | // 进度条样式 |
| | | itemStyle: { |
| | | borderWidth: 0, |
| | | shadowColor: '', |
| | | color: this.holaColor |
| | | } |
| | | }, |
| | | // 仪表盘分割线 |
| | | splitLine: { |
| | | show: false |
| | | }, |
| | | // 刻度样式 |
| | | axisTick: { |
| | | show: false |
| | | }, |
| | | // 刻度标签 |
| | | axisLabel: { |
| | | show: false |
| | | }, |
| | | title: { |
| | | show: false, |
| | | fontSize: 20 |
| | | }, |
| | | detail: { |
| | | // width: 50, |
| | | // height: 14, |
| | | fontSize: 20, |
| | | color: 'auto' |
| | | }, |
| | | data: [ |
| | | { |
| | | value: this.centerValue, |
| | | name: this.holaTitle, |
| | | title: { |
| | | show: true, |
| | | fontSize: 14, |
| | | color: '#fff', |
| | | offsetCenter: ['0%', '30%'], |
| | | }, |
| | | detail: { |
| | | fontSize: 18, |
| | | // 中心title设置 |
| | | offsetCenter: ['0%', '-10%'], |
| | | color: '#fff', |
| | | formatter: '{value}' |
| | | |
| | | } |
| | | } |
| | | ], |
| | | } |
| | | ]; |
| | | myChart.setOption({ |
| | | series: series |
| | | }) |
| | | } |
| | | }, |
| | | mounted() { |
| | | myChart = echarts.init(this.$refs['chartRef']); |
| | | this.initChart(); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .hola-container { |
| | | width: 100%; |
| | | height: 100%; |
| | | |
| | | .chart { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | |
| | | <div class="data-content"> |
| | | <div class="data-panel"> |
| | | |
| | | <div class="panel-title"> |
| | | <div class="icon"> |
| | | <img src="@/assets/icons/arrow.png" alt=""> |
| | | </div> |
| | | <div class="title"> |
| | | 整体工单数 |
| | | </div> |
| | | </div> |
| | | <div class="panel-container"> |
| | | <div class="panel-item"> |
| | | <data-hola :holaTitle="`工单总数`" :centerValue="1111" :holaColor="`#4ea8ff`"></data-hola> |
| | | </div> |
| | | <div class="panel-item"> |
| | | <data-hola :holaTitle="`已处理工单数`" :centerValue="1111" :holaColor="`#4ea8ff`"></data-hola> |
| | | </div> |
| | | <div class="panel-item"> |
| | | <data-hola :holaTitle="`未处理工单数`" :centerValue="1111" :holaColor="`#4ea8ff`"></data-hola> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="data-panel"> |
| | | <div class="panel-title"> |
| | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | import WrapperTitle from '../wrapper-title/index'; |
| | | import DataHola from './components/data-hola'; |
| | | let chart = null; |
| | | export default { |
| | | name: 'ScreenData', |
| | | components: { |
| | | WrapperTitle |
| | | WrapperTitle, |
| | | DataHola |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | initEchart() { |
| | | const option = { |
| | | grid: { |
| | | top: '10%', |
| | | right: 0, |
| | | bottom: '15%', |
| | | }, |
| | | legend: { |
| | | right: 0, |
| | |
| | | <style lang="scss" scoped> |
| | | .data-container { |
| | | width: 100%; |
| | | height: 450px; |
| | | height: 470px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | |
| | | flex: 1; |
| | | background: rgba(67, 102, 155, 0.3); |
| | | border: 1px solid rgba(47, 91, 157, 0.8); |
| | | padding: 20px; |
| | | padding: 10px; |
| | | box-sizing: border-box; |
| | | } |
| | | } |
| | | |
| | | .echart-container { |
| | | width: 100%; |
| | | height: 300px; |
| | | height: 260px; |
| | | |
| | | #barChart { |
| | | width: 100%; |
| | |
| | | color: #b9b9b9; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .icon { |
| | | width: 20px; |
| | | margin-right: 5px; |
| | | |
| | | img { |
| | | width: 100%; |
| | | display: block; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .panel-container { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: space-around; |
| | | |
| | | .panel-item { |
| | | width: 100px; |
| | | height: 100px; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | |
| | | .hola-item { |
| | | flex-shrink: 0; |
| | | width: 140px; |
| | | height: 140px; |
| | | width: 120px; |
| | | height: 120px; |
| | | } |
| | | } |
| | | } |
| | |
| | | clip: false, // 是否裁剪超出部分 |
| | | // 设置背景圆环样式 |
| | | lineStyle: { |
| | | width: 10, // 圆环宽度 |
| | | width: 6, // 圆环宽度 |
| | | color: [[1, '#002865']] // 圆环背景色 |
| | | } |
| | | }, |