|
|
@@ -1468,16 +1468,32 @@
|
|
|
formatter: function (param) {
|
|
|
let label = ''
|
|
|
let percent = ''
|
|
|
+ let showPercent = true; // 默认显示占比
|
|
|
clientIndicators.forEach(item => {
|
|
|
if (item.name === param.data.name) {
|
|
|
label = item.value
|
|
|
percent = item.percent
|
|
|
}
|
|
|
});
|
|
|
- return [
|
|
|
- `{firstLine|${param.data.name}:}{secondLine|${label}人}`,
|
|
|
- `{thirdLine|占比:${percent ? percent + '%' : ''}}`
|
|
|
- ].join('\n');
|
|
|
+ // 特殊处理长文本换行
|
|
|
+ const secondLineText = label
|
|
|
+ ? `${label}人`
|
|
|
+ : (['到店客户', '成交客户'].includes(param.data.name)
|
|
|
+ ? '待ONE-ID\n数据打通' // 手动插入换行符
|
|
|
+ : '');
|
|
|
+ // 关键修改:当显示特殊文本时隐藏占比行
|
|
|
+ if (['到店客户', '成交客户'].includes(param.data.name) && !label) {
|
|
|
+ showPercent = false;
|
|
|
+ }
|
|
|
+ const lines = [];
|
|
|
+ lines.push(`{firstLine|${param.data.name}:}{secondLine|${secondLineText}}`);
|
|
|
+
|
|
|
+ // 只有需要显示占比时才添加第三行
|
|
|
+ if (showPercent) {
|
|
|
+ lines.push(`{thirdLine|占比:${percent ? percent + '%' : ''}}`);
|
|
|
+ }
|
|
|
+
|
|
|
+ return lines.join('\n');
|
|
|
},
|
|
|
// 新增 rich 样式定义
|
|
|
rich: {
|
|
|
@@ -1487,10 +1503,12 @@
|
|
|
lineHeight: 20 // 保持与外层 lineHeight 一致
|
|
|
},
|
|
|
secondLine: {
|
|
|
- color: '#1677FF', // 第二行颜色(示例用红色)
|
|
|
+ color: '#1677FF',
|
|
|
fontWeight: 'bold',
|
|
|
- fontSize: 14, // 第二行字号
|
|
|
- lineHeight: 20 // 保持与外层 lineHeight 一致
|
|
|
+ fontSize: 14,
|
|
|
+ lineHeight: 20,
|
|
|
+ width: 150, // 关键:限制宽度触发自动换行
|
|
|
+ overflow: 'break', // 允许文本换行
|
|
|
},
|
|
|
thirdLine: {
|
|
|
color: '#1677FF', // 第二行颜色(示例用红色)
|