# 客户 360 弹窗 + 决策链集成（2026-07-29）

## 客户 360 内嵌工作台

客户 360 已从独立页面改为 workbench 内嵌弹窗 overlay：

### 触发方式
客户 Tab → 点击「360°」按钮 → `showCust360(customerName)` → 全屏 overlay

### 数据源合并
`loadData()` 中用 `Promise.all` 并行加载 `workbench_data.json` + `customer_360.json`，合并 detail 字段：
```javascript
var c360Map = {};
c360.customers.forEach(function(c) { c360Map[c.name] = c; });
data.customers.forEach(function(c) {
  var detail = c360Map[c.name];
  if (detail) {
    if (detail.top_products) c.top_products = detail.top_products;
    if (detail.recent_orders) c.recent_orders = detail.recent_orders;
    if (detail.decision_url) c.decision_url = detail.decision_url;
    if (detail.opps && detail.opps.length) c.opps = detail.opps;
  }
});
```

### 弹窗内容
- 三年采购 KPI 卡片（sales_2024/2025/2026）
- 主销产品表（top_products）
- 决策链 iframe（可编辑，需飞书登录）
- 商机 / 客诉 / 近期订单
- 权限自动隔离（非 admin 只看自己客户）

## 决策链批量导入

从飞书导出的 Excel 批量解析决策链 URL：

### 数据源
飞书项目「客户」工作项 → 导出 → 含「决策链URL链接」字段的 Excel

### 解析（从 read_file 提取的 tab-separated 文本）
```python
for line in content.split('\n'):
    parts = line.split('\t')
    if len(parts) >= 3 and 'i16l6v9noru.feishu.cn' in parts[2]:
        name = parts[0].strip()
        url = parts[2].strip()
        if name and url: mapping[name] = url
```

### 目标文件
- `_key_customers.json` → 工作台客户 Tab
- `customer_360.json` → 360 弹窗详情

### 效果
62 家客户有决策链 iframe（从飞书 Excel 102 条 URL 匹配到 62 家）

## 柱状图标注位置

客户透视水平柱状图的数值标注放在柱子右侧两行，避免窄柱截断数字：
- 名称：`x=w+6, y=barH/2`（名称，字号 12）
- 数值：`x=w+6, y=barH-4`（数值，蓝色，字号 11）

## 相关技能
- `baoyu-sales-data-isolation` → 数据源对照、部署命令
- `baoyu-password-management` → CloudBase user_roles、超管页面
