更新 wiki

This commit is contained in:
eafonyang
2026-07-30 11:15:28 +08:00
parent 22a24056d6
commit 6a747b514f
8 changed files with 386 additions and 345 deletions
@@ -9,6 +9,7 @@
- [frontend/src/views/headphone/model/components/EqCacheDialog.vue](file://frontend/src/views/headphone/model/components/EqCacheDialog.vue)
- [frontend/src/views/headphone/model/components/PushProgressDialog.vue](file://frontend/src/views/headphone/model/components/PushProgressDialog.vue)
- [frontend/src/views/headphone/model/components/PushViewDialog.vue](file://frontend/src/views/headphone/model/components/PushViewDialog.vue)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue)
- [frontend/src/service/api/model.ts](file://frontend/src/service/api/model.ts)
- [backend/src/routes/models.js](file://backend/src/routes/models.js)
- [backend/src/models/Model.js](file://backend/src/models/Model.js)
@@ -25,12 +26,10 @@
## 更新摘要
**变更内容**
- **重大重构**:型号管理系统完全迁移到 `src/views/headphone/model/` 目录结构下
- **新增组合式函数**useModelList.ts提供TypeScript类型安全的状态管理和数据操作
- **增强对话框组件**:5个专用对话框组件支持CSV导入导出、EQ缓存管理、推送进度跟踪等高级功能
- **API模块现代化**:从JavaScript迁移到TypeScript,提供更好的类型支持
- **路由配置更新**:前端路由配置适配新的目录结构
- **服务层优化**:后端squig.link集成、频响文件处理、EQ缓存管理等核心功能保持不变
- **新增批量编辑功能**:添加208行的BatchEditDialog组件,支持对多个耳机型号进行批量操作
- **主界面集成**:在型号管理主界面中集成批量编辑对话框,提供统一的批量操作入口
- **批量操作扩展**:在现有复制、推送搜索功能基础上,增加批量编辑能力
- **用户体验优化**:通过批量编辑提升大规模型号管理的效率
## 目录
1. [简介](#简介)
@@ -51,10 +50,10 @@
- 型号表单的数据结构、字段验证与复杂表单处理(含频响文件上传)
- 型号与品牌的关联关系、级联数据管理与外键约束处理
- 型号参数的动态配置、数据格式验证与存储优化
- 批量操作(复制、推送搜索)的实现方案
- 批量操作(复制、推送搜索、**新增批量编辑**)的实现方案
- **新增**squig.link外部数据导入功能
- **新增**:组合式函数useModelList的状态管理
- **新增**5个专用对话框组件的完整功能
- **新增**6个专用对话框组件的完整功能(包含新增的批量编辑对话框)
- **重大改进**:核心组件协调更新,提升模型管理工作流体验
- **更新**:标准化的圆形图标搜索和重置按钮设计
@@ -76,6 +75,7 @@ FE_CsvViewerDialog["CsvViewerDialog.vue"]
FE_EqCacheDialog["EqCacheDialog.vue"]
FE_PushProgressDialog["PushProgressDialog.vue"]
FE_PushViewDialog["PushViewDialog.vue"]
FE_BatchEditDialog["BatchEditDialog.vue<br/>新增组件"]
end
subgraph "后端服务"
BE_Routes_Models["型号路由<br/>routes/models.js"]
@@ -90,6 +90,7 @@ end
FE_Model --> FE_useModelList
FE_Model --> FE_API_Model
FE_Model --> FE_API_Brand
FE_Model --> FE_BatchEditDialog
FE_useModelList --> FE_API_Model
FE_useModelList --> FE_API_Brand
FE_API_Model --> FE_Request
@@ -101,6 +102,7 @@ FE_Components --> FE_CsvViewerDialog
FE_Components --> FE_EqCacheDialog
FE_Components --> FE_PushProgressDialog
FE_Components --> FE_PushViewDialog
FE_Components --> FE_BatchEditDialog
FE_API_Model --> BE_Routes_Models
FE_API_Brand --> BE_Routes_Brands
BE_Routes_Models --> BE_Models_Model
@@ -119,6 +121,7 @@ BE_Routes_Brands --> BE_Models_Brand
- [frontend/src/views/headphone/model/components/EqCacheDialog.vue:1-306](file://frontend/src/views/headphone/model/components/EqCacheDialog.vue#L1-L306)
- [frontend/src/views/headphone/model/components/PushProgressDialog.vue:1-303](file://frontend/src/views/headphone/model/components/PushProgressDialog.vue#L1-L303)
- [frontend/src/views/headphone/model/components/PushViewDialog.vue:1-60](file://frontend/src/views/headphone/model/components/PushViewDialog.vue#L1-L60)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
**章节来源**
- [frontend/src/views/headphone/model/index.vue:1-524](file://frontend/src/views/headphone/model/index.vue#L1-L524)
@@ -134,6 +137,7 @@ BE_Routes_Brands --> BE_Models_Brand
- EqCacheDialogEQ缓存查看对话框,支持JSON树形展示
- PushProgressDialog:推送进度跟踪对话框
- PushViewDialog:推送状态查看对话框
- **BatchEditDialog:批量编辑对话框,支持对多个型号进行统一修改**
- **API模块**TypeScript封装的所有型号相关HTTP请求,包括新增的squig.link导入功能
- **后端路由**:提供完整的REST接口,包括squig.link数据抓取功能
- **服务层**:频响文件上传、EQ缓存读取、squig.link数据抓取等服务
@@ -146,6 +150,7 @@ BE_Routes_Brands --> BE_Models_Brand
- [frontend/src/views/headphone/model/components/EqCacheDialog.vue:1-306](file://frontend/src/views/headphone/model/components/EqCacheDialog.vue#L1-L306)
- [frontend/src/views/headphone/model/components/PushProgressDialog.vue:1-303](file://frontend/src/views/headphone/model/components/PushProgressDialog.vue#L1-L303)
- [frontend/src/views/headphone/model/components/PushViewDialog.vue:1-60](file://frontend/src/views/headphone/model/components/PushViewDialog.vue#L1-L60)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
- [frontend/src/service/api/model.ts:1-165](file://frontend/src/service/api/model.ts#L1-L165)
## 架构总览
@@ -157,6 +162,7 @@ participant U as "用户"
participant V as "型号视图<br/>index.vue"
participant CM as "组合式函数<br/>useModelList.ts"
participant MD as "ModelFormDialog"
participant BED as "BatchEditDialog<br/>新增"
participant API as "API 模块<br/>model.ts"
participant R as "后端路由<br/>models.js"
participant S as "服务层<br/>squiglink.js"
@@ -169,6 +175,12 @@ S-->>R : 返回数据
R-->>API : 品牌数据
API-->>CM : 品牌选项
CM-->>V : 渲染界面
U->>BED : 选择多个型号并点击"批量编辑"
BED->>API : 批量更新选中的型号
API->>R : PUT /api/models/batch-update
R-->>API : 批量更新结果
API-->>BED : 成功响应
BED-->>V : 关闭对话框并刷新
U->>MD : 点击"新型号"
MD->>API : 上传文件或导入squig.link
API->>R : POST /api/models/squiglink-fetch
@@ -183,6 +195,7 @@ MD-->>V : 关闭对话框并刷新
- [frontend/src/views/headphone/model/index.vue:218-424](file://frontend/src/views/headphone/model/index.vue#L218-L424)
- [frontend/src/views/headphone/model/composables/useModelList.ts:31-191](file://frontend/src/views/headphone/model/composables/useModelList.ts#L31-L191)
- [frontend/src/views/headphone/model/components/ModelFormDialog.vue:158-464](file://frontend/src/views/headphone/model/components/ModelFormDialog.vue#L158-L464)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
- [frontend/src/service/api/model.ts:157-165](file://frontend/src/service/api/model.ts#L157-L165)
- [backend/src/routes/models.js:307-369](file://backend/src/routes/models.js#L307-L369)
- [backend/src/services/squiglink.js:261-310](file://backend/src/services/squiglink.js#L261-L310)
@@ -254,7 +267,36 @@ useModelList是型号管理页面的核心状态管理函数,提供TypeScript
**章节来源**
- [frontend/src/views/headphone/model/index.vue:29-31](file://frontend/src/views/headphone/model/index.vue#L29-L31)
- [frontend/src/views/headphone/model/index.vue:221-228](file://frontend/src/views/headphone/model/index.vue#L221-228)
- [frontend/src/views/headphone/model/index.vue:221-228](file://frontend/src/views/headphone/model/index.vue#L221-L228)
### BatchEditDialog批量编辑对话框
**新增功能**BatchEditDialog组件提供对多个耳机型号的批量编辑能力,显著提升大规模型号管理的效率。
**核心特性**
- **批量选择支持**:基于表格选中行进行批量操作
- **统一字段编辑**:支持对选中型号的共同字段进行统一修改
- **实时预览**:显示将要被修改的型号数量和基本信息
- **确认机制**:提供详细的修改预览和确认流程
- **错误处理**:完善的错误处理和用户反馈机制
- **状态管理**:独立的对话框状态管理和生命周期控制
**支持的批量操作**
- **批量更新品牌**:将选中型号的品牌统一修改为指定品牌
- **批量更新形式**:统一设置佩戴方式(入耳式/头戴式/耳塞式)
- **批量更新阻抗**:统一设置阻抗参数
- **批量更新来源**:统一设置数据来源信息
**用户交互流程**
1. 用户在表格中选择多个型号
2. 点击"批量编辑"按钮打开对话框
3. 对话框显示选中型号的基本信息和数量
4. 用户填写要更新的字段值
5. 系统预览修改结果
6. 用户确认后执行批量更新操作
7. 显示操作结果并刷新列表
**章节来源**
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
### ModelFormDialog型号表单对话框
**重大改进**ModelFormDialog组件经过协调更新,优化了用户交互流程和数据验证机制。
@@ -286,7 +328,7 @@ useModelList是型号管理页面的核心状态管理函数,提供TypeScript
- [backend/src/services/squiglink.js:261-310](file://backend/src/services/squiglink.js#L261-L310)
### 对话框组件体系
**重大改进**:系统包含5个专用对话框组件,每个组件都经过协调更新,具有明确的功能边界和使用场景。
**重大改进**:系统包含6个专用对话框组件,每个组件都经过协调更新,具有明确的功能边界和使用场景。
**CsvViewerDialog**
- 功能:查看CSV频响数据内容
@@ -308,11 +350,17 @@ useModelList是型号管理页面的核心状态管理函数,提供TypeScript
- 特点:简洁的信息展示,支持加载状态
- 适用:查看单个型号的推送结果
**BatchEditDialog(新增)**
- 功能:对多个型号进行批量编辑
- 特点:支持统一字段修改,提供修改预览和确认机制
- 适用:大规模型号数据的批量维护操作
**章节来源**
- [frontend/src/views/headphone/model/components/CsvViewerDialog.vue:1-50](file://frontend/src/views/headphone/model/components/CsvViewerDialog.vue#L1-L50)
- [frontend/src/views/headphone/model/components/EqCacheDialog.vue:1-306](file://frontend/src/views/headphone/model/components/EqCacheDialog.vue#L1-L306)
- [frontend/src/views/headphone/model/components/PushProgressDialog.vue:1-303](file://frontend/src/views/headphone/model/components/PushProgressDialog.vue#L1-L303)
- [frontend/src/views/headphone/model/components/PushViewDialog.vue:1-60](file://frontend/src/views/headphone/model/components/PushViewDialog.vue#L1-L60)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
### 型号数据模型与表单结构
- **数据模型字段**
@@ -379,6 +427,10 @@ useModelList是型号管理页面的核心状态管理函数,提供TypeScript
- **批量复制**
- 支持复制所选项的"品牌+型号"文本
- **批量编辑(新增)**
- 支持对选中型号的统一字段进行修改
- 提供修改预览和确认机制
- 支持批量更新品牌、形式、阻抗、来源等字段
- **推送搜索**
- 校验:对选中型号调用曲线校验服务,返回校验失败项
- 推送:将型号数据批量写入 Meilisearch 索引
@@ -391,11 +443,19 @@ useModelList是型号管理页面的核心状态管理函数,提供TypeScript
sequenceDiagram
participant U as "用户"
participant V as "型号视图"
participant BED as "BatchEditDialog"
participant PP as "PushProgressDialog"
participant API as "API 模块"
participant R as "后端路由"
participant C as "曲线校验服务"
participant MS as "Meilisearch"
U->>V : 选择多个型号并点击"批量编辑"
V->>BED : 打开批量编辑对话框
BED->>API : 批量更新选中的型号
API->>R : PUT /api/models/batch-update
R-->>API : 批量更新结果
API-->>BED : 更新完成
BED-->>V : 刷新列表
U->>V : 选择多个型号并点击"推送搜索"
V->>PP : 打开进度对话框
PP->>API : validatePushToMeilisearch(ids)
@@ -415,12 +475,14 @@ API-->>PP : 关闭进度弹窗并刷新
**图表来源**
- [frontend/src/views/headphone/model/index.vue:395-419](file://frontend/src/views/headphone/model/index.vue#L395-L419)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
- [frontend/src/views/headphone/model/components/PushProgressDialog.vue:117-195](file://frontend/src/views/headphone/model/components/PushProgressDialog.vue#L117-L195)
- [frontend/src/service/api/model.ts:128-150](file://frontend/src/service/api/model.ts#L128-L150)
- [backend/src/routes/models.js:466-566](file://backend/src/routes/models.js#L466-L566)
**章节来源**
- [frontend/src/views/headphone/model/index.vue:395-419](file://frontend/src/views/headphone/model/index.vue#L395-L419)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
- [frontend/src/views/headphone/model/components/PushProgressDialog.vue:117-195](file://frontend/src/views/headphone/model/components/PushProgressDialog.vue#L117-L195)
- [frontend/src/service/api/model.ts:128-150](file://frontend/src/service/api/model.ts#L128-L150)
@@ -504,7 +566,9 @@ API-->>PP : 关闭进度弹窗并刷新
```mermaid
graph LR
FE_View["前端视图<br/>index.vue"] --> FE_useModelList["组合式函数<br/>useModelList.ts"]
FE_View --> FE_BatchEditDialog["批量编辑对话框<br/>BatchEditDialog.vue"]
FE_useModelList --> FE_API["前端 API<br/>model.ts/brand.ts"]
FE_BatchEditDialog --> FE_API
FE_API --> FE_Request["请求封装<br/>request/index.ts"]
FE_API --> BE_Routes["后端路由<br/>models.js/brands.js"]
BE_Routes --> BE_Models["数据模型<br/>Model.js/Brand.js"]
@@ -517,6 +581,7 @@ BE_Routes --> MS["Meilisearch"]
**图表来源**
- [frontend/src/views/headphone/model/index.vue:218-424](file://frontend/src/views/headphone/model/index.vue#L218-L424)
- [frontend/src/views/headphone/model/composables/useModelList.ts:1-191](file://frontend/src/views/headphone/model/composables/useModelList.ts#L1-L191)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
- [frontend/src/service/api/model.ts:1-165](file://frontend/src/service/api/model.ts#L1-L165)
- [backend/src/routes/models.js:1-659](file://backend/src/routes/models.js#L1-L659)
@@ -534,12 +599,17 @@ BE_Routes --> MS["Meilisearch"]
- **缓存与索引**
- EQ 缓存仅列出 Hash Key,避免一次性返回大体积 JSON
- 推送搜索采用异步任务与进度弹窗,提升用户体验
- **批量操作优化**
- 批量编辑操作采用事务处理,确保数据一致性
- 批量更新时进行增量比较,只更新实际变化的字段
- 批量操作提供进度反馈,避免长时间无响应
- **squig.link抓取**
- 使用内存缓存squigsites.json,减少外部请求频率
- 并行处理多项操作,提高响应速度
- **UI性能优化**
- 圆形图标按钮减少DOM复杂度,提升渲染性能
- 工具提示按需显示,避免不必要的重绘
- 批量编辑对话框采用懒加载,减少初始加载时间
- **TypeScript编译优化**
- 类型检查在开发时进行,生产环境无额外开销
- 组合式函数提供更好的代码分割和懒加载支持
@@ -567,15 +637,22 @@ BE_Routes --> MS["Meilisearch"]
- URL格式错误:确认使用标准的squig.link分享链接
- 数据抓取失败:检查网络连接和目标网站可用性
- 文件匹配失败:确认分享参数与目标文件名匹配
- **批量编辑问题**
- 批量更新失败:检查选中型号的数量和字段有效性
- 数据不一致:确认批量操作的事务完整性
- 性能问题:大批量操作时注意服务器负载和网络延迟
- **UI组件问题**
- 图标不显示:检查@element-plus/icons-vue包是否正确安装
- 工具提示异常:确认title属性设置正确
- 对话框状态不同步:检查组件间的事件传递和状态同步
- **组件协调问题**
- 对话框状态不同步:检查组件间的事件传递和状态同步
- 进度显示异常:确认PushProgressDialog的进度回调机制
- 批量编辑对话框无法打开:检查选中行的状态管理
- **TypeScript类型错误**
- 类型不匹配:检查useModelList.ts中的类型定义
- API接口类型:确认model.ts中的接口定义与后端一致
- 批量编辑数据类型:确认BatchEditDialog中的类型定义
- **路由配置问题**
- 页面无法访问:检查router/elegant/routes.ts中的路由配置
- 导航异常:确认路由路径与组件路径对应关系
@@ -587,17 +664,19 @@ BE_Routes --> MS["Meilisearch"]
- [backend/src/services/measurementStorage.js:87-108](file://backend/src/services/measurementStorage.js#L87-L108)
- [backend/src/services/eqCacheStorage.js:47-66](file://backend/src/services/eqCacheStorage.js#L47-L66)
- [backend/src/services/squiglink.js:261-310](file://backend/src/services/squiglink.js#L261-L310)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)
## 结论
型号管理页面经过重大重构后,现已迁移到 `frontend/src/views/headphone/model/` 目录下,成为一个功能完整、架构清晰的现代化管理系统。通过useModelList组合式函数实现了TypeScript类型安全的状态管理,通过5个专用对话框组件提供了丰富的用户交互体验,通过squig.link导入功能扩展了数据来源的多样性,并通过标准化的圆形图标按钮设计提升了整体界面的一致性和用户体验。
型号管理页面经过重大重构后,现已迁移到 `frontend/src/views/headphone/model/` 目录下,成为一个功能完整、架构清晰的现代化管理系统。通过useModelList组合式函数实现了TypeScript类型安全的状态管理,通过6个专用对话框组件提供了丰富的用户交互体验,通过squig.link导入功能扩展了数据来源的多样性,并通过标准化的圆形图标按钮设计提升了整体界面的一致性和用户体验。**新增的批量编辑功能进一步提升了大规模型号管理的效率**。
**重大重构带来的优势**
- **模块化架构**:完整的headphone模块组织提高了代码的可维护性和可扩展性
- **TypeScript支持**:类型安全的前端开发体验,更好的错误检测和代码提示
- **组件协调优化**ModelFormDialog、PushProgressDialog、EqCacheDialog等核心组件的协调更新,显著提升了工作流体验
- **组件协调优化**ModelFormDialog、PushProgressDialog、EqCacheDialog、**BatchEditDialog**等核心组件的协调更新,显著提升了工作流体验
- **用户体验优化**:完整的进度跟踪和错误处理提升了用户满意度
- **数据来源多样化**:支持本地文件上传和外部网站数据导入
- **UI设计标准化**:统一的圆形图标按钮设计增强了界面一致性
- **批量操作增强**:**新增的批量编辑功能大幅提升了大规模数据管理效率**
- **扩展性强**:基于Vue 3 Composition API的设计便于功能扩展
建议在后续版本中继续完善:
@@ -606,6 +685,7 @@ BE_Routes --> MS["Meilisearch"]
- 优化大数据量场景下的性能表现
- 进一步丰富图标库的使用,提升界面美观度
- 持续优化组件间的协调机制,提升整体稳定性
- **扩展批量操作功能,支持更多字段的批量编辑**
- 考虑引入更完善的单元测试和集成测试
## 附录
@@ -615,6 +695,7 @@ BE_Routes --> MS["Meilisearch"]
- 创建型号:POST /api/models/
- 更新型号:PUT /api/models/:id
- 删除型号:DELETE /api/models/:id
- **批量更新型号:PUT /api/models/batch-update(新增)**
- 推送搜索校验:POST /api/models/push-to-search/validate
- 推送搜索:POST /api/models/push-to-search
- 查看 Meilisearch 推送:GET /api/models/:id/meilisearch
@@ -632,4 +713,5 @@ BE_Routes --> MS["Meilisearch"]
- [frontend/src/service/api/model.ts:1-165](file://frontend/src/service/api/model.ts#L1-L165)
- [frontend/src/service/api/brand.ts:1-66](file://frontend/src/service/api/brand.ts#L1-L66)
- [backend/src/routes/models.js:133-659](file://backend/src/routes/models.js#L133-L659)
- [backend/src/routes/brands.js:14-147](file://backend/src/routes/brands.js#L14-L147)
- [backend/src/routes/brands.js:14-147](file://backend/src/routes/brands.js#L14-L147)
- [frontend/src/views/headphone/model/components/BatchEditDialog.vue:1-208](file://frontend/src/views/headphone/model/components/BatchEditDialog.vue#L1-L208)