Files
one-pipe-system/openspec/changes/add-iot-card-recall-line-input/specs/iot-card-management/spec.md
luo f5730089a1
All checks were successful
构建并部署前端到测试环境 / deploy (push) Successful in 54s
fix: 一行一个ICCID批量回收
2026-10-29 16:18:45 +08:00

56 lines
3.2 KiB
Markdown
Raw 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.
## ADDED Requirements
### Requirement: IoT Card Batch Recall Line Input
The IoT card batch recall dialog SHALL offer “一行一个ICCID” as an additional frontend-only selection mode alongside the existing ICCID list, range and filter modes.
The new mode MUST show a labeled multiline input with a hint to enter one ICCID per line. It MUST split LF and CRLF line endings, trim each line, ignore empty lines and preserve each ICCID as a string without numeric conversion or additional length or format restrictions.
Submitting this mode MUST call the existing `POST /api/admin/iot-cards/standalone/recall` endpoint with `selection_type: "list"`, the entered values in `iccids`, and the existing optional remark. It MUST NOT include selected table rows, range fields, filter fields or frontend-only fields in that request.
#### Scenario: Submit a pasted ICCID list
- **GIVEN** 用户选择“一行一个ICCID”并输入多个 ICCID,行首尾存在空白且内容中包含空行
- **WHEN** 用户点击“确认回收”
- **THEN** 系统 MUST 去除首尾空白和空行,将剩余各行作为字符串放入 `iccids`
- **AND** 系统 MUST 使用原有列表模式的接口和 `selection_type: "list"` 提交
- **AND** 系统 MUST 沿用现有成功数、失败项及列表刷新流程
#### Scenario: Reject empty manual input
- **GIVEN** 用户选择“一行一个ICCID”
- **WHEN** 输入为空或仅包含空白和空行并尝试提交
- **THEN** 系统 MUST 显示请输入 ICCID 的校验提示
- **AND** 系统 MUST NOT 发送回收请求
#### Scenario: Keep each selection mode isolated
- **GIVEN** 用户在逐行输入与现有列表、号段或筛选方式之间切换
- **WHEN** 用户提交当前选择方式
- **THEN** 系统 MUST 仅根据当前方式构建请求参数
- **AND** 原有列表、号段和筛选方式 MUST 保持既有行为及号段数量提示
### Requirement: IoT Card Batch Recall Manual Input Entry
The batch recall action SHALL remain permission-controlled and be available without selected table rows so users can enter ICCIDs directly. When opening the dialog, it MUST default to the existing list mode if rows are selected and to line input mode otherwise. The existing list mode MUST still reject submission without selected cards. Manual input MUST be cleared when the dialog is reopened.
#### Scenario: Open batch recall without selected rows
- **GIVEN** 用户拥有 `iot_card:batch_recycle` 权限且未勾选表格行
- **WHEN** 用户点击“批量回收”
- **THEN** 系统 MUST 打开弹窗并默认选择“一行一个ICCID”
- **AND** 用户 MUST 能直接粘贴卡号,而无需先勾选无关卡片
#### Scenario: Preserve the selected-row workflow
- **GIVEN** 用户已在表格勾选卡片
- **WHEN** 用户打开“批量回收”弹窗
- **THEN** 系统 MUST 默认选择现有“ICCID列表”方式
- **AND** 用户按列表方式提交时 MUST 继续使用已勾选卡片的 ICCID
#### Scenario: Clear manual input when reopening
- **GIVEN** 用户在“一行一个ICCID”方式下输入过卡号并关闭弹窗
- **WHEN** 用户再次打开“批量回收”弹窗
- **THEN** 手工输入框 MUST 为空,不得沿用上一次回收的输入