diff --git a/CLAUDE.md b/CLAUDE.md
index 28629e8..b3c90a1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -248,15 +248,70 @@ PDMS: {
}
```
-## API接入流程
+## API接入流程(实战总结)
-今后新增CAD软件API的标准流程:
+**经验教训**:Store只管理状态,API调用在组件中执行,通知统一处理。
-1. **配置定义**: 在 `src/config/cad.js` 中添加软件配置
-2. **创建API服务**: 在 `src/services/` 中创建对应API文件
-3. **Store集成**: 在 `src/stores/cad.js` 中添加调用逻辑
+### 🔧 标准接入步骤
-所有API请求通过 `apiClient.js` 统一处理,自动获得日志记录和通知功能。
+1. **API服务层**(`src/services/xxxApi.js`)
+```javascript
+// 扩展现有API服务或新建
+async getCurrentModel() {
+ const url = buildApiUrl(this.softwareName, 'status')
+ return await apiClient.get(url, {
+ operationContext: {
+ software: 'Creo', // 软件名
+ operation: '获取当前模型' // 具体操作(用于通知)
+ }
+ })
+}
+```
+
+2. **Store状态管理**(`src/stores/cad.js`)
+```javascript
+// 只管理状态,不执行API调用
+const setCADConnection = (cadName, connected) => {
+ // 一次只能连接一个CAD
+ cadConnections.value.forEach(cad => cad.connected = false)
+ const targetCAD = getCADConnection(cadName)
+ if (targetCAD) targetCAD.connected = connected
+}
+```
+
+3. **组件中调用**(`src/components/xxx.vue`)
+```javascript
+// 组件负责API调用和状态更新
+const handleOperation = async () => {
+ const result = await creoApi.getCurrentModel()
+ // 通知自动显示,无需手动处理
+ // 根据需要更新状态
+ if (result.success) {
+ cadStore.setCADConnection('creo', true)
+ }
+}
+```
+
+### ⚠️ 关键避坑指南
+
+**❌ 常见错误**:
+- Store中执行API调用(职责混乱)
+- 组件中手动处理成功/失败通知(重复工作)
+- Store管理临时查询结果(不是状态)
+- 允许多个CAD同时连接(违反业务逻辑)
+
+**✅ 正确做法**:
+- Store纯状态管理:`cadConnections`、`setCADConnection()`
+- 组件执行业务:API调用、用户交互、状态更新
+- 通知自动化:`apiClient.js`统一处理成功/失败通知
+- 一次一连接:连接新CAD时自动断开其他
+
+### 🎯 核心原则
+
+- **职责分离**:Store管状态,组件调API
+- **通知统一**:`operationContext`自动生成通知
+- **状态约束**:业务规则在状态管理中体现
+- **错误暴露**:不用try-catch,让错误直接暴露
## 日志系统扩展
diff --git a/src/components/layout/CadSidebar.vue b/src/components/layout/CadSidebar.vue
index 8433441..59a05b2 100644
--- a/src/components/layout/CadSidebar.vue
+++ b/src/components/layout/CadSidebar.vue
@@ -50,7 +50,7 @@
-