Files
Excelbuilder/Agents/修复设备模块弹窗加号不新增配置行.md
2026-06-01 17:55:16 +08:00

28 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 修复设备模块弹窗加号不新增配置行
## Summary
- 当前问题原因基本明确:`+` 按钮使用 `@click="addStationToDeviceForm"`Vue 会把点击事件 `MouseEvent` 作为第一个参数传入。
- 现有方法 `addStationToDeviceForm(targetForm)` 会把这个事件对象误当成表单对象,导致新增行没有正确写入 `deviceForm.stations`
- 修复目标:新增和编辑设备模块时,点击 `+` 都能立即在弹窗表格中新增一条完整配置行。
## Key Changes
- 修改弹窗 `+` 按钮点击事件:
-`@click="addStationToDeviceForm"` 改为明确调用当前表单。
- 加固 `addStationToDeviceForm` 方法:
- 默认只操作 `this.deviceForm`
- 如果传入参数不是有效表单对象,自动回退到 `this.deviceForm`
- 使用响应式方式确保 `stations` 数组存在。
- 保持现有保存逻辑:
- 保存后第一行同步为设备模块左侧列表展示信息。
- 所有配置行写入 `stations[]`,用于导出 `设备类型对应表` 多行。
## Test Plan
- 打开新增弹窗,默认已有一行。
- 点击 `+`,表格立即增加第二行。
- 连续点击 `+`,每次都增加一行。
- 打开编辑弹窗后点击 `+`,在原有配置后追加一行。
## Assumptions
- 这次只修复 `+` 不新增配置行的问题,不调整整体 UI 布局。
- 仍保持 v8 的“弹窗整表编辑模式”。