fix: 运营商管理
All checks were successful
构建并部署前端到测试环境 / deploy (push) Successful in 54s

This commit is contained in:
luo
2026-09-29 09:15:05 +08:00
parent 6655638116
commit 5364916b1d
26 changed files with 1095 additions and 40 deletions

View File

@@ -0,0 +1,22 @@
## Context
现有前端没有运营商通道阈值命中记录页面或对应 API 类型。后端已提供只读分页查询接口,页面需忠实呈现不可变的命中时快照和周期恢复状态。
## Goals / Non-Goals
- Goals: 提供受限于平台账号的筛选、分页和证据查询;不丢失空值的历史语义。
- Non-Goals: 修改通道阈值、发起停复机、导出记录、查看卡片详情,或查询上游响应。
## Decisions
- Decision: 在系统管理路径下新增独立隐藏查询页,由运营商管理页提供入口;路由使用 `allowedUserTypes: [1, 2]`,页面自身也在请求前检查平台账号。
- Rationale: 接口只允许超级管理员和平台账号。前端隐藏/保护页面入口,后端仍是最终授权及卡数据范围过滤边界。
- Decision: 精确 ID 筛选使用数值输入,计费周期起点使用日期时间选择器,判定时间使用日期时间范围选择器;时间序列化为带时区 RFC3339 秒级字符串。
- Rationale: 与接口的精确匹配和闭区间语义一致,避免按日期截断或丢失时区。
- Decision: 页面仅展示响应快照,不再查询通道配置或根据当前阈值重算历史值。
- Rationale: 命中值冻结于判定时;历史缺失值必须保留接口规定的空值含义。
## Risks / Trade-offs
- 查询页不依赖后端菜单节点;前端入口仅对平台账号显示,页面路由限制用户类型,API 仍执行最终授权和数据范围过滤。
- 表格包含多列证据字段,采用现有可横向滚动的管理台表格以保持信息完整。

View File

@@ -0,0 +1,24 @@
# Change: 新增运营商通道阈值命中记录查询
## Why
达量停机与周期恢复需要可追溯的数字证据。运营人员需要查询每次停机判定时冻结的累计流量、实际阈值、计费周期、触发来源,以及周期解锁和复机结果;通道阈值后续变更不能影响历史记录。
## What Changes
- 在运营商管理页提供“通道阈值命中记录”入口,打开独立只读查询页并接入 `GET /api/admin/carrier-traffic-threshold-hits`。
- 支持按运营商通道 ID、IoT 卡 ID、计费周期起点精确匹配,并按判定时间闭区间筛选。
- 展示命中时的流量和阈值快照、判定/触发信息、锁状态、解锁时间、复机结果及安全失败原因。
- 仅超级管理员与平台账号可访问;数据范围过滤及越权资源不可区分由后端强制执行,前端不替代后端授权。
- 对接口定义的空历史值使用明确的“无”或“未处理/历史记录”展示,不发起额外的通道阈值或上游接口查询。
## Impact
- Affected specs: `carrier-traffic-threshold-hits`
- Affected code:
- `src/api/modules/carrierTrafficThresholdHit.ts`
- `src/types/api/carrierTrafficThresholdHit.ts`
- `src/views/system/carrier-traffic-threshold-hits/index.vue`
- `src/router/routesAlias.ts`, `src/router/routes/staticRoutes.ts`, `src/views/system/carrier-management/index.vue`
- `src/locales/langs/zh.json`, `src/locales/langs/en.json`
- Breaking changes: 无;仅新增只读查询接口消费与页面入口。

View File

@@ -0,0 +1,35 @@
## ADDED Requirements
### Requirement: Carrier Traffic Threshold Hit Record Query
The admin frontend SHALL provide a read-only paginated view of carrier traffic threshold hit records using `GET /api/admin/carrier-traffic-threshold-hits`.
#### Scenario: Restrict page access to platform accounts
- **GIVEN** a user is not a super administrator or platform account
- **WHEN** the user navigates to the carrier traffic threshold hit page
- **THEN** the frontend MUST deny access and MUST NOT issue the hit-record query
- **AND** backend authorization and card data-scope filtering MUST remain authoritative
#### Scenario: Filter hit records
- **GIVEN** an authorized platform user opens the hit-record page
- **WHEN** the user searches by optional carrier ID, card ID, billing period start, or judged-at time range
- **THEN** the frontend MUST send `carrier_id`, `card_id`, `period_start`, `start_time`, and `end_time` only when provided
- **AND** period and judged-at timestamps MUST be timezone-qualified RFC3339 values with second precision
- **AND** `start_time` and `end_time` MUST represent the API's inclusive time interval
#### Scenario: Display immutable hit evidence and recovery result
- **GIVEN** the query returns threshold-hit records
- **WHEN** the frontend renders the table
- **THEN** it MUST display record/card/carrier IDs, hit traffic, frozen threshold value and unit, billing period start, judged time, trigger source, lock status, unlock time, resume result, failure reason, and creation time
- **AND** it MUST NOT recompute hit traffic or threshold from current channel configuration
- **AND** it MUST display nullable historical traffic/threshold values as “无”, blank resume results as “未处理或历史记录”, and missing unlock/failure details as “无”
#### Scenario: Preserve server ordering and pagination
- **GIVEN** the user queries hit records
- **WHEN** the frontend loads or changes the page
- **THEN** it MUST send `page` and `page_size` (never exceeding 100)
- **AND** it MUST render the server-provided page, size, total, and item order without client-side re-sorting

View File

@@ -0,0 +1,10 @@
## 1. API Contract
- [x] 1.1 增加命中记录查询参数、记录项及分页响应类型。
- [x] 1.2 增加 `GET /api/admin/carrier-traffic-threshold-hits` 服务方法并统一导出。
## 2. Admin UI
- [x] 2.1 新增超级管理员/平台账号可访问的隐藏路由、运营商管理页入口及中英文标题。
- [x] 2.2 实现筛选、分页和命中/周期恢复快照表格,按接口约定展示空值。
- [x] 2.3 运行 OpenSpec 校验、ESLint 与生产构建。

View File

@@ -0,0 +1,18 @@
# Change: 新建订单套餐作废任务支持下载 CSV 模板
## Why
运营创建订单套餐批量作废任务时,需要按系统要求准备订单号 CSV。当前创建抽屉只有文件上传入口,无法直接取得格式样例,容易因文件列格式不符而返工。
## What Changes
- 在新建订单套餐作废任务抽屉的 CSV 上传项旁提供“下载模板”入口。
- 下载仓库中已有的静态模板 `src/template/订单批量作废模板.csv`,保留其 `order_no` 表头,不增加模板生成接口。
- 不改变现有 CSV 上传校验、任务创建、权限或后端接口。
## Impact
- Affected specs: `order-package-invalidate-task`
- Affected code: `src/views/asset-management/task-management/order-package-invalidate-task/index.vue`
- Existing user-provided asset: `src/template/订单批量作废模板.csv`(只读取,不修改)
- Breaking changes: 无。

View File

@@ -0,0 +1,13 @@
## ADDED Requirements
### Requirement: Order Package Invalidation CSV Template Download
The admin frontend SHALL let users creating an order package invalidation task download the CSV template used by the task's CSV upload field.
#### Scenario: Download the static CSV template
- **GIVEN** 用户已打开新建订单套餐作废任务抽屉
- **WHEN** 用户点击 CSV 上传项旁的模板下载入口
- **THEN** 页面 MUST 下载静态文件 `订单批量作废模板.csv`
- **AND** 下载内容 MUST match `src/template/订单批量作废模板.csv`, including the `order_no` header
- **AND** 页面 MUST NOT make a template-generation API request

View File

@@ -0,0 +1,4 @@
## 1. Implementation
- [x] 1.1 在订单套餐作废任务创建抽屉中添加静态 CSV 模板下载入口。
- [x] 1.2 验证下载内容、文件名与现有模板一致,并运行相关前端检查。