2025-08-26 11:34:00 +08:00
|
|
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
|
|
|
import { PieCircleCommenConfig } from './index'
|
|
|
|
import { CreateComponentType } from '@/packages/index.d'
|
|
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
|
|
import dataJson from './data.json'
|
2025-08-28 18:56:34 +08:00
|
|
|
import { chartInitConfig } from '@/settings/designSetting'
|
2025-08-27 19:00:00 +08:00
|
|
|
export const includes = ['legend']
|
|
|
|
export const selectStyleOption = {
|
|
|
|
showAngle: false,
|
|
|
|
color: '#1B9FCC',
|
|
|
|
backgroundColor: '#0F4557',
|
|
|
|
borderTop: '1px solid #1CA4D2',
|
|
|
|
cursor: 'pointer',
|
|
|
|
borderRadius: '2px',
|
|
|
|
}
|
2025-08-26 11:34:00 +08:00
|
|
|
const otherConfig = {
|
2025-09-04 09:45:21 +08:00
|
|
|
sceneCode: 'T01',
|
2025-08-26 11:34:00 +08:00
|
|
|
// 轮播动画
|
|
|
|
isCarousel: false,
|
2025-08-27 10:01:26 +08:00
|
|
|
color: ['#3B72E8', '#45B5E3', '#50D4A8', '#F8B55B'],
|
2025-08-27 15:25:37 +08:00
|
|
|
selectOption: {
|
|
|
|
show: true,
|
2025-08-28 14:12:43 +08:00
|
|
|
selectValue: 'month',
|
2025-08-27 15:25:37 +08:00
|
|
|
dataset: [
|
2025-08-27 19:00:00 +08:00
|
|
|
{
|
|
|
|
label: '当天',
|
|
|
|
value: 'day'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '本周',
|
|
|
|
value: 'week'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '当月',
|
|
|
|
value: 'month'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '本季度',
|
|
|
|
value: 'quarter'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '当年',
|
|
|
|
value: 'year'
|
|
|
|
}
|
2025-08-27 15:25:37 +08:00
|
|
|
]
|
|
|
|
},
|
2025-08-28 10:33:55 +08:00
|
|
|
titleText: '报警统计',
|
2025-08-27 15:25:37 +08:00
|
|
|
titleOption: {
|
|
|
|
},
|
|
|
|
headerOption: {
|
2025-08-28 11:46:21 +08:00
|
|
|
paddingLeft: 0,
|
2025-08-27 19:00:00 +08:00
|
|
|
paddingRight: 0,
|
2025-08-27 15:25:37 +08:00
|
|
|
paddingTop: 0,
|
|
|
|
paddingBottom: 0
|
2025-08-27 19:00:00 +08:00
|
|
|
}, selectStyleOption: {
|
|
|
|
|
2025-08-27 15:25:37 +08:00
|
|
|
}
|
2025-08-26 11:34:00 +08:00
|
|
|
}
|
|
|
|
// ECharts配置
|
2025-08-27 10:01:26 +08:00
|
|
|
export const option = {
|
2025-08-26 11:34:00 +08:00
|
|
|
...otherConfig,
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'item',
|
|
|
|
formatter: '{b}: {c} ({d}%)'
|
|
|
|
},
|
|
|
|
|
|
|
|
title: {
|
|
|
|
// text: total, /
|
|
|
|
subtext: '总数',
|
|
|
|
left: '30%',
|
|
|
|
top: 'center',
|
|
|
|
textAlign: 'center',
|
|
|
|
textStyle: {
|
|
|
|
color: '#fff',
|
|
|
|
fontSize: 35,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
lineHeight: 40
|
|
|
|
},
|
|
|
|
subtextStyle: {
|
|
|
|
color: '#ced4da',
|
|
|
|
fontSize: 15
|
|
|
|
},
|
|
|
|
itemGap: 1
|
|
|
|
},
|
|
|
|
|
|
|
|
legend: {
|
|
|
|
show: true,
|
|
|
|
orient: 'vertical',
|
|
|
|
left: '60%',
|
|
|
|
top: 'center',
|
|
|
|
itemGap: 15,
|
|
|
|
itemWidth: 10,
|
|
|
|
itemHeight: 35,
|
|
|
|
formatter: (name: string) => name,
|
|
|
|
icon: 'roundRect',
|
|
|
|
textStyle: {
|
|
|
|
rich: {
|
|
|
|
title: {
|
|
|
|
fontSize: 14,
|
|
|
|
color: '#ffffff',
|
|
|
|
align: 'left',
|
|
|
|
padding: [0, 0, 10, 10]
|
|
|
|
},
|
|
|
|
detail: {
|
|
|
|
fontSize: 14,
|
|
|
|
color: '#ced4da',
|
|
|
|
align: 'left',
|
|
|
|
padding: [0, 0, 0, 10]
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
series: [
|
|
|
|
{
|
2025-08-27 10:01:26 +08:00
|
|
|
// name: '总数',
|
2025-08-26 11:34:00 +08:00
|
|
|
type: 'pie',
|
|
|
|
radius: ['50%', '70%'],
|
2025-08-28 11:06:02 +08:00
|
|
|
center: ['31.4%', '50%'],
|
2025-08-26 11:34:00 +08:00
|
|
|
avoidLabelOverlap: false,
|
|
|
|
label: {
|
|
|
|
show: false,
|
|
|
|
},
|
|
|
|
emphasis: {
|
|
|
|
label: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
labelLine: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
}
|
2025-08-27 10:01:26 +08:00
|
|
|
], // 使用dataset关联数据
|
|
|
|
dataset: { ...dataJson }
|
2025-08-26 11:34:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
|
|
|
public key: string = PieCircleCommenConfig.key
|
|
|
|
|
|
|
|
public chartConfig = cloneDeep(PieCircleCommenConfig)
|
2025-08-28 18:56:34 +08:00
|
|
|
public attr = { ...chartInitConfig, x: 0, y: 0, w: 430, h: 300, zIndex: 1 }
|
2025-08-26 11:34:00 +08:00
|
|
|
// 图表配置项
|
|
|
|
public option = echartOptionProfixHandle(option, includes)
|
|
|
|
}
|