duanshenglang 1 周之前
父節點
當前提交
cf53aef65b
共有 1 個文件被更改,包括 25 次插入7 次删除
  1. 25 7
      lottery/jxs.html

+ 25 - 7
lottery/jxs.html

@@ -1468,16 +1468,32 @@
                 formatter: function (param) {
                 formatter: function (param) {
                   let label = ''
                   let label = ''
                   let percent = ''
                   let percent = ''
+                  let showPercent = true; // 默认显示占比
                   clientIndicators.forEach(item => {
                   clientIndicators.forEach(item => {
                     if (item.name === param.data.name) {
                     if (item.name === param.data.name) {
                       label = item.value
                       label = item.value
                       percent = item.percent
                       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 样式定义
                 rich: {
                 rich: {
@@ -1487,10 +1503,12 @@
                     lineHeight: 20     // 保持与外层 lineHeight 一致
                     lineHeight: 20     // 保持与外层 lineHeight 一致
                   },
                   },
                   secondLine: {
                   secondLine: {
-                    color: '#1677FF',  // 第二行颜色(示例用红色)
+                    color: '#1677FF',
                     fontWeight: 'bold',
                     fontWeight: 'bold',
-                    fontSize: 14,      // 第二行字号
-                    lineHeight: 20     // 保持与外层 lineHeight 一致
+                    fontSize: 14,
+                    lineHeight: 20,
+                    width: 150,  // 关键:限制宽度触发自动换行
+                    overflow: 'break', // 允许文本换行
                   },
                   },
                   thirdLine: {
                   thirdLine: {
                     color: '#1677FF',  // 第二行颜色(示例用红色)
                     color: '#1677FF',  // 第二行颜色(示例用红色)