You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9.2 KiB
9.2 KiB
产量报表页面
最后更新:2026-04-26 状态:已设计
1. 基本信息
| 项 | 值 |
|---|---|
| 路由 | /production |
| 权限 | admin |
| 入口 | 侧边栏产量报表 |
| 面包屑 | 首页 / 产量报表 |
2. 界面布局
┌──────────────────────────────────────────────────────────┐
│ [面包屑] 首页 / 产量报表 │
├──────────────────────────────────────────────────────────┤
│ [查询条件区] │
│ 日期范围[2026-04-19 ~ 2026-04-25] 车间[▼全部] │
│ 机床[▼全部] 工人[▼全部] 程序名[_______] │
│ [查询] [重置] [导出] │
├──────────────────────────────────────────────────────────┤
│ [汇总统计区] │
│ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ │
│ │总产量 │ │运行机床│ │切削总时│ │平均产量│ │
│ │8,520 │ │ 142 │ │580h │ │ 60 │ │
│ └──────┘ └──────┘ └──────┘ └──────┘ │
├──────────────────────────────────────────────────────────┤
│ [列表区] │
│ 日期 | 机床 | 程序名 | 产量 | 运行时间 | 切削时间 | 日状态 | 修正 | 操作 │
│ 2026-04-25| 西-1.8 | 1566.NC | 580 | 4h20m | 3h50m | 正常 | - | [修正产量] │
│ 2026-04-25| 东-2.5 | A456.NC | - | - | - | 缺失 | - | [修正产量] │
│ 2026-04-25| 北-4.1 | B789.NC | 310 | 2h10m | 1h50m | 正常 | ✓ | [修正记录] │
├──────────────────────────────────────────────────────────┤
│ [分页] 共1200条 每页[20▼] < 1 2 3 ... 60 > │
└──────────────────────────────────────────────────────────┘
3. 查询条件
| 字段 | 控件 | 必填 | 默认值 | 校验 | 联动 |
|---|---|---|---|---|---|
| 日期范围 | el-date-picker type=daterange | 是 | 近7天(含今日) | 必填+结束日期≥开始日期 | 无 |
| 车间 | el-select | 否 | 全部 | - | 联动机床下拉(按车间筛选) |
| 机床 | el-select filterable | 否 | 全部 | - | 受车间联动 |
| 工人 | el-select filterable | 否 | 全部 | - | 无 |
| 程序名 | el-input | 否 | 空 | - | 无 |
4. 列表字段
| 字段名 | 列宽 | 排序 | 筛选 | 固定 | 超长处理 | 对齐 |
|---|---|---|---|---|---|---|
| 日期 | - | y | - | left | - | center |
| 机床名称 | - | y | - | - | tooltip | center |
| 程序名 | - | y | - | - | tooltip | center |
| 产量 | - | y | - | - | - | center |
| 运行时间 | - | - | - | - | - | center |
| 切削时间 | - | - | - | - | - | center |
| 日状态 | - | - | 下拉 | - | - | center |
| 修正标记 | - | - | - | - | - | center |
| 操作 | 120 | - | - | right | - | center |
列宽规则见
02-前端全局规范.mdel-table列宽均分规则:数据列不设width自动均分,操作列固定120。
5. 操作按钮
| 名称 | 权限编码 | 位置 | 显示条件 | 点击行为 |
|---|---|---|---|---|
| 查询 | - | 查询区 | 始终 | 重置page=1->请求列表 |
| 重置 | - | 查询区 | 始终 | 清空条件->请求列表 |
| 导出 | production:export | 查询区 | 始终 | 按当前查询条件导出Excel |
| 修正产量 | production:adjust | 行操作 | 始终 | 打开修正弹窗 |
| 修正记录 | - | 行操作 | is_adjusted=1 | 打开修正历史弹窗(只读) |
6. 弹窗规格
产量修正弹窗:
- 宽度500px,遮罩有,ESC关闭是(脏数据检测),标题=修正产量
| 字段 | 控件 | 必填 | 默认值 | 校验 | 联动 |
|---|---|---|---|---|---|
| 当前产量 | el-input disabled | - | 原始产量 | - | - |
| 修正后产量 | el-input-number min=0 | 是 | 原始产量 | 必填+非负整数 | - |
| 修正原因 | el-input type=textarea maxlength=500 | 是 | - | 必填 | - |
修正历史弹窗(只读):
- 宽度600px,标题=修正记录
| 展示字段 | 说明 |
|---|---|
| 修正时间 | created_at |
| 修正前 | old_value |
| 修正后 | new_value |
| 修正原因 | reason |
7. 状态机
日状态(data_status):
- normal(正常): 文本"正常" 灰色 -> 产量正常显示
- offline(离线): 文本"离线" el-tag danger -> 产量显示0
- data_missing(数据缺失): 文本"缺失" el-tag warning -> 产量显示"-"(非0)
修正标记:
- is_adjusted=0: 显示"-"
- is_adjusted=1: 显示"✓" el-tag primary
8. 交互流程
- 加载:默认近7天->请求列表API+汇总统计API->渲染
- 查询:选条件->查询->重置page=1->请求列表+汇总
- 重置:清空条件(恢复默认近7天)->请求
- 导出:调API下载Excel(按当前查询条件导出)
- 修正产量:弹窗->输入修正后产量+原因->确认"确定修正产量?修正后将记录审计日志。 "->调API->关闭->刷新列表
- 修正记录:弹窗(只读)->展示修正历史->关闭
9. 空状态
列表无数据:el-empty 未找到匹配的产量数据,请调整查询条件 汇总统计:无数据时各卡片显示"-"
10. 接口引用与数据结构
Mock/正式API的URL、HTTP方法均定义在
03-API接口设计.md§3.7 端点清单,本节仅引用编号并定义返回数据结构。
接口引用
| 接口名称 | 端点编号 | 界面用途 |
|---|---|---|
| 日汇总统计 | §3.7 #1 | 顶部统计卡片 |
| 日产量列表 | §3.7 #2 | 表格数据,分页渲染 |
| 修正产量 | §3.7 #3 | 修正弹窗保存 |
| 修正历史 | §3.7 #4 | 修正历史弹窗 |
| 导出报表 | §3.7 #5 | 导出Excel按钮 |
| 车间下拉 | §3.13 #1 | 查询条件下拉 |
| 机床下拉 | §3.13 #3 | 查询条件下拉 |
| 工人下拉 | §3.13 #4 | 查询条件下拉 |
数据结构
日汇总统计(§3.7 #1):
Response:
{ "code": 0, "data": { "totalQuantity": 8520, "activeMachineCount": 142, "totalCuttingTime": "580h", "avgQuantityPerMachine": 60 }}
日产量列表(§3.7 #2):
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "date": "2026-04-25", "machineName": "西-1.8", "programName": "1566.NC", "quantity": 580, "runTime": "4h20m", "cuttingTime": "3h50m", "dataStatus": "normal", "isAdjusted": 0, "adjustedQuantity": null },
{ "id": 2, "date": "2026-04-25", "machineName": "东-2.5", "programName": "A456.NC", "quantity": null, "runTime": null, "cuttingTime": null, "dataStatus": "data_missing", "isAdjusted": 0, "adjustedQuantity": null },
{ "id": 3, "date": "2026-04-25", "machineName": "北-4.1", "programName": "B789.NC", "quantity": 310, "runTime": "2h10m", "cuttingTime": "1h50m", "dataStatus": "normal", "isAdjusted": 1, "adjustedQuantity": 320 }
], "total": 1200, "page": 1, "pageSize": 20 }}
修正产量(§3.7 #3):
Request body:
{ "targetTable": "daily_production", "targetId": 3, "fieldName": "total_quantity", "newValue": 320, "reason": "传感器计数偏差,手工校准" }
Response:
{ "code": 0, "message": "success", "data": null }
修正历史(§3.7 #4):
Response:
{ "code": 0, "data": { "items": [
{ "createdAt": "2026-04-25 15:30:00", "oldValue": 310, "newValue": 320, "reason": "传感器计数偏差,手工校准" }
]}}
导出报表(§3.7 #5):
二进制Excel文件,Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
11. 数据需求
以下为本页面需要的数据,数据库设计定稿时需覆盖。参考
01-数据库设计.md草案。
| 数据需求 | 草案对应 | 说明 |
|---|---|---|
| 日产量列表(含分页) | cnc_daily_production + cnc_machine | 主表,需JOIN机床名+车间名 |
| 日状态 | cnc_machine_daily_status | 按machine_id+date关联 |
| 汇总统计 | cnc_daily_production | 按日期范围聚合SUM/COUNT/AVG |
| 车间下拉 | cnc_workshop | 查询条件 |
| 机床下拉 | cnc_machine | 查询条件,受车间联动 |
| 工人下拉 | cnc_worker | 查询条件 |
| 产量修正写入 | cnc_daily_production.adjusted_quantity | 更新修正后产量+is_adjusted=1 |
| 修正审计记录 | cnc_production_adjustment | 写入修正前/后值+原因 |
| 修正历史查询 | cnc_production_adjustment | 按target_table+target_id查询 |