spring
7 小时以前 0b8b77e3320c45260f28f92dadf9c66515d75328
src/views/reportAnalysis/dataDashboard/components/basic/left-top.vue
@@ -31,6 +31,18 @@
// 颜色列表
const landColors = ['#26FFCB', '#24CBFF', '#35FBF4', '#2651FF', '#D1E4F5', '#5782F7', '#2F67EF', '#82BAFF']
// label 富文本:为每个颜色生成一个小圆点样式(确保在 label 中可见)
const dotRich = landColors.reduce((acc, color, idx) => {
  acc[`dot${idx}`] = {
    width: 8,
    height: 8,
    borderRadius: 8,
    backgroundColor: color,
    align: 'center',
  }
  return acc
}, {})
// 图例配置(右侧竖排)
const landLegend = {
  show: false,
@@ -86,20 +98,33 @@
    center: ['50%', '50%'],
    label: {
      show: true,
      position: 'outside',
      color: '#fff',
      fontSize: 12,
      lineHeight: 18,
      rich: {
        ...dotRich,
        parent: { fontSize: 14, fontWeight: 600, color: '#fff', lineHeight: 20 },
        child: { fontSize: 12, color: '#fff', lineHeight: 18 },
      },
      formatter: function (params) {
        const children = params?.data?.children || []
        if (!children.length) return ''
        // label 展示 children 的 name + value
        return children.map((c) => `${c.name} ${c.value}`).join('\n')
        const parentName = params?.data?.name || ''
        const parentValue = params?.data?.value ?? 0
        const dotKey = `dot${(params?.dataIndex || 0) % landColors.length}`
        const dot = `{${dotKey}|} `
        if (!children.length) return `${dot}{parent|${parentName} ${parentValue}}`
        // 小圆点 + 父级 name + 父级 value,换行展示 children 的 name + value
        return [
          `${dot}{parent|${parentName} ${parentValue}}`,
          ...children.map((c) => `{child|${c.name}}`),
        ].join('\n')
      },
    },
    labelLine: {
      show: true,
      length: 40,
      length2: 40,
      length: 20,
      length2: 20,
      lineStyle: {
        color: '#B8C8E0',
      },
@@ -109,7 +134,6 @@
        return landColors[params.dataIndex % landColors.length]
      },
    },
    // 初始绑定为响应式数据源,后续通过接口填充
    data: dataList.value,
  },
  {
@@ -167,47 +191,5 @@
  padding: 18px;
  width: 100%;
  height: 420px;
}
.quality-cards {
  display: flex;
  gap: 12px;
  width: 100%;
  height: 54px;
  justify-content: space-between;
  align-items: center;
}
.quality-cardSec {
  display: flex;
}
.quality-cardTitle {
  font-weight: 400;
  font-size: 14px;
  color: #ffffff;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}
.quality-card {
  width: 80px;
  height: 60px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.quality-card.one {
  background-image: url('@/assets/BI/yuancailiaoyijianicon@2x.png');
}
.quality-card.two {
  background-image: url('@/assets/BI/guochengyijianicon@2x.png');
}
.quality-card.three {
  background-image: url('@/assets/BI/chuchangyijianicon@2x.png');
}
</style>