装备台账

This commit is contained in:
bb_pan 2026-02-02 16:11:56 +08:00
parent b3323de0d0
commit 752e11fa0c
1 changed files with 30 additions and 13 deletions

View File

@ -175,6 +175,7 @@ export default {
if (res4.data && res4.data.length > 0) {
this.dataMap.major = res4.data.map((item) => ({
...item,
name: item.type,
value: item.total,
}))
@ -184,6 +185,7 @@ export default {
const res5 = await getTenMajorApi(this.queryParams)
if (res5.data && res5.data.length > 0) {
this.dataMap.process = res5.data.map((item) => ({
...item,
name: item.type,
value: item.total,
}))
@ -216,10 +218,17 @@ export default {
},
legend: {
orient: 'vertical',
right: '5%',
right: '-1%',
top: 'center',
itemWidth: 10,
itemHeight: 10,
itemGap: 15,
textStyle: {
// 👈
fontSize: 16, //
color: '#3F3F3F',
lineHeight: 20, //
},
formatter: (name) => {
const item = this.chartData.find((i) => i.name === name)
const percent = item.value > 0 && this.total > 0 ? ((item.value / this.total) * 100).toFixed(2) : '0.00'
@ -230,7 +239,7 @@ export default {
{
type: 'pie',
radius: ['60%', '80%'],
center: ['35%', '50%'],
center: ['25%', '50%'],
avoidLabelOverlap: false,
label: { show: false },
labelLine: { show: false },
@ -240,7 +249,7 @@ export default {
graphic: [
{
type: 'group',
left: '35%', // center[0]
left: '25%', // center[0]
top: '42%',
bounding: 'raw',
children: [
@ -283,7 +292,11 @@ export default {
renderBarChart() {
const list = this.dataMap[this.activeTab2]
const xData = list.map((i) => i.name)
const yData = list.map((i) => i.value)
const yData = list.map((item) => ({
value: item.value,
proType: item.proType,
}))
console.log('🚀 ~ yData:', yData)
const option = {
tooltip: {
@ -296,7 +309,7 @@ export default {
return `
<div>
<div>${item.name}</div>
<div>${item.value}</div>
<div>${item.value}</div>
</div>
`
},
@ -332,18 +345,22 @@ export default {
{
type: 'bar',
data: yData,
barWidth: 24,
barWidth: 20,
itemStyle: {
borderRadius: [12, 12, 0, 0],
color: (params) => {
const colors = [
['#5DA9FF', '#8EC5FF'],
['#4ED6C8', '#7BE7D7'],
['#FDBA4F', '#FFD78A'],
]
const colorMap = {
1: ['#5DA9FF', '#8EC5FF'], // 1
2: ['#4ED6C8', '#7BE7D7'], // 2
3: ['#FDBA4F', '#FFD78A'], // 3
}
const type = params.data.proType
const colors = colorMap[type] || ['#5DA9FF', '#8EC5FF'] //
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: colors[params.dataIndex % 3][0] },
{ offset: 1, color: colors[params.dataIndex % 3][1] },
{ offset: 0, color: colors[0] },
{ offset: 1, color: colors[1] },
])
},
},