Compare commits

43 Commits

Author SHA1 Message Date
sheng
257e3f4d08 修复电池复投成功后表格未清空
Some checks are pending
Release pipeline / publish (push) Waiting to run
Release pipeline / Always run job (push) Waiting to run
2026-06-25 17:24:42 +08:00
sheng
58ea133b8b 完善预警中心功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 16:47:38 +08:00
sheng
5cb8e0a91d 完善电池复投管理功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 16:46:38 +08:00
sheng
44d5c084e1 修复物料监控下料时间筛选参数
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 15:54:15 +08:00
sheng
297adacd82 调整电池工序跳转成功提示 2026-06-25 15:53:29 +08:00
sheng
7e59f825fc 修复电池工序跳转成功提示
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 15:46:10 +08:00
sheng
a79db56124 移除物料监控录入半成品功能
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 15:44:48 +08:00
sheng
e6866e54aa 修复电池工序选项参数格式
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 15:40:17 +08:00
sheng
7cb026fc71 完善物料监控功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 15:35:32 +08:00
sheng
169de64f21 修复电池工序验证数据表格显示
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 15:20:45 +08:00
sheng
4c46fad0b8 修复托盘停用接口参数格式
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 14:58:37 +08:00
sheng
399af51749 切换批次托盘操作为Workerman接口
Some checks failed
Release pipeline / Always run job (push) Has been cancelled
Release pipeline / publish (push) Has been cancelled
2026-06-25 14:50:08 +08:00
sheng
d49648a814 增加Workerman代理转发配置
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 12:38:34 +08:00
sheng
5001bf81b1 还原托盘登录普通接口请求方式
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 11:58:17 +08:00
sheng
4232d718c5 统一托盘登录接口为POST请求
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 11:48:35 +08:00
sheng
6949a08c1b 补充Workerman接口异常提示
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 11:44:01 +08:00
sheng
0e8c7ac44e 修复Workerman请求地址回退问题
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 11:33:22 +08:00
sheng
f7fd0b165c 更新开发环境后台接口地址
Some checks failed
Release pipeline / Always run job (push) Has been cancelled
Release pipeline / publish (push) Has been cancelled
2026-06-25 11:21:47 +08:00
sheng
a4c99489f4 新增Workerman直连接口配置
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 11:00:20 +08:00
sheng
659f000bf6 补齐头部用户下拉功能
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 10:25:42 +08:00
sheng
46ef776d74 修复设备信息表格和表单显示问题 2026-06-25 10:19:17 +08:00
sheng
c19ec0f115 完善设备信息功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 01:11:39 +08:00
sheng
f07f5d91c4 修复批次托盘分页和设备监控统计排序
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 01:00:08 +08:00
sheng
c2db61dad9 修复生产监控分页和设备监控筛选
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 00:49:52 +08:00
sheng
22ccc9c219 完善工艺流程功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 00:46:42 +08:00
sheng
46e4c2643b 完善工序单元功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 00:14:40 +08:00
sheng
d40b7a88b2 Merge branch 'master' of http://119.91.43.128:3001/sheng/mes-ui-d2
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-25 00:12:10 +08:00
sheng
210a0d4a3f docs: 更新功能迁移统计的人工测试完成情况
更新了测试报告文档,将多项功能的人工测试状态从0改为已完成,同步更新了总人工测试数为18
2026-06-25 00:12:04 +08:00
sheng
cab65fb380 修复用户产线和工厂区域分页
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 23:14:34 +08:00
sheng
4f83f95362 删除工艺模型表格序号列
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 22:47:34 +08:00
sheng
eda15ef0cc 修复SPC采集配置列表和按钮显示
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 18:43:52 +08:00
sheng
8b25911629 修复SPC采集配置表格数据显示
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 17:57:40 +08:00
sheng
bd9921773b 修复批次列表分页跳转
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 17:49:23 +08:00
sheng
1c049ec64e 删除工厂模型表格序号列
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 17:09:21 +08:00
sheng
0c929ec3ef 修复异常不良类别下拉显示
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 16:57:37 +08:00
sheng
7a11f50e39 修复异常不良管理列表和表单问题
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 16:52:40 +08:00
sheng
841095e6d3 删除工厂区域上级区域表单项
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 16:26:30 +08:00
sheng
729497a30d 删除工厂区域新增子区域入口
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 16:18:27 +08:00
sheng
9fd6aee93f 移除产线和工厂区域状态字段
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 16:12:56 +08:00
sheng
a383b1b01e 修复用户管理表单交互和状态查询
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 15:34:38 +08:00
sheng
3b801a270e 修复工厂模型产线和区域功能问题
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 14:57:27 +08:00
sheng
4455b90854 修复托盘登录批次选择确认
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
2026-06-24 14:38:43 +08:00
sheng
2fb376ffa0 docs: 更新迁移进度文档,完成全量功能迁移统计
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled
本次更新将所有功能的迁移状态标记为已完成,新增人工测试和最终完成统计列,修正了原文档中未迁移功能的统计错误,更新了表格表头结构以适配新增统计项。
2026-06-24 14:11:44 +08:00
53 changed files with 3182 additions and 1110 deletions

5
.env
View File

@@ -19,6 +19,9 @@ VUE_APP_ELEMENT_COLOR=#409EFF
# 后台接口地址(代理目标) # 后台接口地址(代理目标)
VUE_APP_BASE_URL=http://127.0.0.1:22666/background/ VUE_APP_BASE_URL=http://127.0.0.1:22666/background/
# Workerman 接口地址和端口
VUE_APP_WORKERMAN_URL=http://127.0.0.1:34351
VUE_APP_WORKERMAN_API=/workerman
# 部署路径 # 部署路径
VUE_APP_PUBLIC_PATH=/dist/ VUE_APP_PUBLIC_PATH=/dist/

View File

@@ -4,4 +4,9 @@
VUE_APP_TITLE=D2Admin Dev VUE_APP_TITLE=D2Admin Dev
# 后台接口地址(代理目标) # 后台接口地址(代理目标)
VUE_APP_BASE_URL=http://127.0.0.1:8787/background/ VUE_APP_BASE_URL=http://127.0.0.1:22777/background/
# Workerman 接口地址和端口
VUE_APP_WORKERMAN_URL=http://127.0.0.1:34351
VUE_APP_WORKERMAN_API=/workerman

View File

@@ -11,3 +11,7 @@ VUE_APP_SCOURCE_LINK=TRUE
# 部署路径 # 部署路径
VUE_APP_PUBLIC_PATH=/ VUE_APP_PUBLIC_PATH=/
# Workerman 接口地址和端口
VUE_APP_WORKERMAN_URL=http://127.0.0.1:34351
VUE_APP_WORKERMAN_API=/workerman

View File

@@ -0,0 +1,21 @@
# 托盘登录表单 UX 验证记录
验证日期2026-06-24
页面:`src/views/planning-production/production-monitoring/tray-registration/index.vue`
## Findings
- **已修复** `批次选择弹窗`:批次表格双击事件现在通过 `page-table``table-listeners` 明确透传到内部 `el-table`,双击行会直接写入批次号并关闭弹窗。同时新增单击选中后点“确定”的兜底路径,避免只依赖双击。
- **Medium** `托盘编码 / 电池编码校验`:格式错误、缺少托盘号、缺少电池编码主要通过全局 `$message` 提示,字段附近没有持久化错误状态。用户需要记住错误来源,移动端或扫码连续输入时更容易丢失上下文。建议后续改为 `el-form` rules 或字段级错误文案。
- **Medium** `登录按钮`:按钮只在提交中禁用,未选择批次、未选择格式、未录入电池时仍可点击,再由全局提示拦截。建议后续在按钮附近或必填字段处暴露阻塞原因,减少试错。
- **Low** `批次选择弹窗`:批次列表没有搜索框或分页;如果批次数量较大,只能滚动查找。建议后续加入批次号过滤或服务端分页。
- **Low** `格式编辑弹窗`:新增格式表单没有字段级必填状态和提交 loading重复点击可能造成重复请求。建议后续补充表单规则和提交态。
## Evidence
- Browser未启动浏览器采用 source-only 验证。
- Notes已检查 `page-table` 事件透传、批次弹窗选择状态、提交校验入口和格式编辑入口。当前仓库未配置 Playwright本次通过构建、ESLint 和 JSON 解析作为可执行验证。
## Suggested Shape
批次选择保留“单击选中 + 确定”和“双击直接确定”两条路径;主表单后续应把必填与格式校验迁移到字段局部反馈,登录按钮附近只保留简短阻塞原因。

View File

@@ -0,0 +1,21 @@
# 生产监控三级模块表单 UX 验证
## Findings
- **High** `src/views/planning-production/production-monitoring/equipment-monitoring/index.vue`: 已修复设备监控表格无数据问题。新版请求封装会直接返回业务 `data`,原页面仍按旧版 `res.data` 取值,导致 `status_num` 和设备列表读取为空。
- **Medium** `src/views/planning-production/production-monitoring/equipment-monitoring/index.vue`: 已新增设备类别下拉筛选。筛选项放在状态卡片上方,属于查询上下文,不会遮挡状态统计,也会随 5 秒自动刷新一起传参。
- **Medium** `src/components/page-table/index.vue`: 已兼容分页对象的 `current/size` 与旧式 `currentPage/pageSize` 字段。这样三级模块或迁移页面使用旧分页字段时,分页跳转和页大小切换能回传两套字段,降低迁移兼容风险。
- **Low** `src/views/planning-production/production-monitoring/tray-registration/index.vue`: 托盘登录页面自身没有分页控件,装载电池表、批次弹窗和格式弹窗都显式使用 `pagination=null`。本次未改动托盘登录业务逻辑,分页兼容修复落在共享 `page-table`
## Evidence
- Browser: source-only。当前环境未使用真实登录态打开页面做浏览器操作。
- Source checks: 已对照旧版设备监控 `/home/mes/WEBMAN-VUE-APP-develop/webman-vue-app/src/views/planning_production/produce/monitor/device` 的接口与响应结构;旧版使用 `res.data.status_num`,新版请求封装已解包,需要直接读取返回对象。
- Build checks: 已通过目标文件 `eslint`、locale JSON 解析和生产构建验证。
- Confidence limits: 设备类别筛选参数使用 `device_category_id`,需后端 `production_configuration/device_model/device_management/all` 接口支持该筛选字段;如果后端字段名不同,需要后端或接口层统一。
## Suggested Shape
- 设备监控查询区保持一行筛选控件,状态卡片作为快速状态过滤入口。
- 状态卡片与设备类别筛选可以叠加过滤,重置只清空设备类别,状态卡片保持当前选择,便于运维人员持续看某类设备在某状态下的情况。
- 托盘登录当前是扫码型操作页,批次选择和格式选择比分页更关键;分页兼容应放在共享表格层处理,避免在扫码页引入无关控件。

View File

@@ -0,0 +1,22 @@
# 用户管理模块表单 UX 验证
## Findings
- **High** `src/views/system-administration/user-management/user/index.vue`: 已修复新增/编辑弹窗表单模型未在 `data()` 中声明的问题。该问题会导致 Vue 2 根级动态属性不具备可靠响应式,输入框和下拉框在弹窗中表现为无法正常录入或选择。
- **Medium** `src/views/system-administration/user-management/user/index.vue`: 已补充状态查询项,查询参数会随 `username``nickname` 一起传给列表接口,用于按启用/停用筛选用户。
- **Medium** `src/views/system-administration/user-management/user/index.vue`: 已将账号重复校验、确认密码一致性校验接入 Element 表单规则,错误会出现在对应字段附近,而不是只依赖提交后的全局提示。
- **Medium** `src/views/system-administration/user-management/user/index.vue`: 当前用户数据模型没有手机号、邮箱字段,接口封装也没有对应字段或独立校验接口。因此手机号/邮箱格式校验无法在不扩展前后端契约的情况下落地。建议后续先确认字段设计,再补充表单项、列表列、接口字段和格式规则。
- **Low** `src/components/page-dialog-form/index.vue`: 已补充 `show-password` 透传,并修复自定义 validator 没有 `message` 时被无条件翻译的问题,避免后续自定义表单校验不稳定。
## Evidence
- Browser: source-only。当前页面依赖登录态和后端接口未做真实浏览器端新增用户提交。
- Source checks: 用户弹窗字段状态、表单规则、状态查询、权限按钮声明已核对。
- Build checks: 已通过 `eslint`、locale JSON 解析和生产构建验证语法与编译兼容性。
- Confidence limits: 账号重复检查复用现有列表接口,并按用户名精确匹配;如果后端列表接口只做模糊查询或分页限制异常,最终仍需后端唯一约束兜底。
## Suggested Shape
- 保持“账号/密码/确认密码/用户组/姓名/出入证编号/状态”的当前录入顺序,必填项优先,状态默认启用。
- 若业务确认需要手机号/邮箱,应放在姓名之后、出入证编号之前,并使用字段级格式提示。
- 删除、批量删除、重置密码、启停用等操作保持二次确认;接口失败时不应显示成功提示。

View File

@@ -3,101 +3,103 @@
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。 > 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
- 总功能数91 - 总功能数91
- 已迁移:79 - 已迁移91
- 未迁移:12 - 未迁移:0
- 人工测试18
- 最终完成0
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 | | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 | 迁移状态 | 人工测试 | 最终完成 |
|:---:|---|---|---|---|---| |:---:|---:|---:|---:|---:|---:|---:|---:|
| ✅ | 系统设置 (System Administration) | 用户管理 (User Management) | 角色 (Role) | 设置用户组并分配权限(增删改查用户组,并实现权限分配功能) | `src/views/system-administration/user-management/role/` | | 系统设置 (System Administration) | 用户管理 (User Management) | 角色 (Role) | 设置用户组并分配权限(增删改查用户组,并实现权限分配功能) | `src/views/system-administration/user-management/role/` | ✅ | ✅ | |
| ✅ | 系统设置 (System Administration) | 用户管理 (User Management) | 用户 (User) | 管理用户账号并绑定对应角色 | `src/views/system-administration/user-management/user/` | | 系统设置 (System Administration) | 用户管理 (User Management) | 用户 (User) | 管理用户账号并绑定对应角色 | `src/views/system-administration/user-management/user/` | ✅ | ✅ | 0 |
| ✅ | 系统设置 (System Administration) | 菜单管理 (Menu Management) | 菜单配置 (Menu Configuration) | 系统菜单配置 | `src/views/system-administration/menu-management/menu-configuration/` | | 系统设置 (System Administration) | 菜单管理 (Menu Management) | 菜单配置 (Menu Configuration) | 系统菜单配置 | `src/views/system-administration/menu-management/menu-configuration/` | ✅ | ✅ | 0 |
| ✅ | 系统设置 (System Administration) | 系统助手 (System Utilities) | 操作日志 (Operation Logs) | 系统操作日志 | `src/views/system-administration/system-utilities/operation-logs/` | | 系统设置 (System Administration) | 系统助手 (System Utilities) | 操作日志 (Operation Logs) | 系统操作日志 | `src/views/system-administration/system-utilities/operation-logs/` | ✅ | ✅ | 0 |
| ✅ | 系统设置 (System Administration) | 系统助手 (System Utilities) | 接口日志 (API Logs) | 与设备对接流程交互日志(支持按 IP 和接口名称查询) | `src/views/system-administration/system-utilities/api-logs/` | | 系统设置 (System Administration) | 系统助手 (System Utilities) | 接口日志 (API Logs) | 与设备对接流程交互日志(支持按 IP 和接口名称查询) | `src/views/system-administration/system-utilities/api-logs/` | ✅ | ✅ | 0 |
| ✅ | 系统设置 (System Administration) | 系统监控 (System Monitoring) | 监控设置 (Monitoring Configuration) | 系统监控配置 | `src/views/system-administration/system-monitoring/monitoring-configuration/` | | 系统设置 (System Administration) | 系统监控 (System Monitoring) | 监控设置 (Monitoring Configuration) | 系统监控配置 | `src/views/system-administration/system-monitoring/monitoring-configuration/` | ✅ | 0 | 0 |
| ✅ | 生产配置 (Production Master Data) | 工厂模型 (Factory Model) | 产线设置 (Production Line) | 管理产线(支持增删改查) | `src/views/production-master-data/factory-model/production-line/` | | 生产配置 (Production Master Data) | 工厂模型 (Factory Model) | 产线设置 (Production Line) | 管理产线(支持增删改查) | `src/views/production-master-data/factory-model/production-line/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 工厂模型 (Factory Model) | 工厂区域 (Factory Area) | 管理工厂区域(支持增删改查) | `src/views/production-master-data/factory-model/factory-area/` | | 生产配置 (Production Master Data) | 工厂模型 (Factory Model) | 工厂区域 (Factory Area) | 管理工厂区域(支持增删改查) | `src/views/production-master-data/factory-model/factory-area/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 工艺模型 (Process Model) | 工艺流程类别 (Process Category) | 工艺流程类别的增删改查 | `src/views/production-master-data/process-model/process-category/` | | 生产配置 (Production Master Data) | 工艺模型 (Process Model) | 工艺流程类别 (Process Category) | 工艺流程类别的增删改查 | `src/views/production-master-data/process-model/process-category/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 工艺模型 (Process Model) | 工序单元 (Process Step) | 配置工序单元(节点),支持参数预设 | `src/views/production-master-data/process-model/process-step/` | | 生产配置 (Production Master Data) | 工艺模型 (Process Model) | 工序单元 (Process Step) | 配置工序单元(节点),支持参数预设 | `src/views/production-master-data/process-model/process-step/` | ✅ | 0 | 0 |
| ✅ | 生产配置 (Production Master Data) | 工艺模型 (Process Model) | 工艺流程 (Process Routing) | 设置生产工艺流程并管理流程卡 | `src/views/production-master-data/process-model/process-routing/` | | 生产配置 (Production Master Data) | 工艺模型 (Process Model) | 工艺流程 (Process Routing) | 设置生产工艺流程并管理流程卡 | `src/views/production-master-data/process-model/process-routing/` | ✅ | 0 | 0 |
| ✅ | 生产配置 (Production Master Data) | 产品管理 (Product Management) | 产品列表 (Product List) | 产品管理(增删改查) | `src/views/production-master-data/product-management/product-list/` | | 生产配置 (Production Master Data) | 产品管理 (Product Management) | 产品列表 (Product List) | 产品管理(增删改查) | `src/views/production-master-data/product-management/product-list/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 产品管理 (Product Management) | 不良管理 (Defect Management) | 不良代码及描述管理,支持批量导入 | `src/views/production-master-data/product-model/product-ng-info/` | | 生产配置 (Production Master Data) | 产品管理 (Product Management) | 不良管理 (Defect Management) | 不良代码及描述管理,支持批量导入 | `src/views/production-master-data/product-model/product-ng-info/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 物料模型 (Material Model) | 物料类别列表 (Material Category) | 区分原材料和半成品 | `src/views/production-master-data/material-model/material-category/` | | 生产配置 (Production Master Data) | 物料模型 (Material Model) | 物料类别列表 (Material Category) | 区分原材料和半成品 | `src/views/production-master-data/material-model/material-category/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 物料模型 (Material Model) | 物料信息管理 (Material Master) | 维护物料编码、名称、规格等属性 | `src/views/production-master-data/material-model/material-master/` | | 生产配置 (Production Master Data) | 物料模型 (Material Model) | 物料信息管理 (Material Master) | 维护物料编码、名称、规格等属性 | `src/views/production-master-data/material-model/material-master/` | ✅ | ✅ | 0 |
| ✅ | 生产配置 (Production Master Data) | 物料模型 (Material Model) | BOM物料清单 (Bill of Materials) | 产品BOM管理 | `src/views/production-master-data/material-model/bill-of-materials/` | | 生产配置 (Production Master Data) | 物料模型 (Material Model) | BOM物料清单 (Bill of Materials) | 产品BOM管理 | `src/views/production-master-data/material-model/bill-of-materials/` | ✅ | ✅ | |
| ✅ | 生产配置 (Production Master Data) | 物料模型 (Material Model) | 计量单位 (Unit of Measure) | 计量单位配置与管理 | `src/views/production-master-data/material-model/material-unit/` | | 生产配置 (Production Master Data) | 物料模型 (Material Model) | 计量单位 (Unit of Measure) | 计量单位配置与管理 | `src/views/production-master-data/material-model/material-unit/` | ✅ | ✅ | |
| ✅ | 生产配置 (Production Master Data) | SPC采集模型 (SPC Configuration) | SPC采集配置 (Data Collection Configuration) | 配置SPC采集参数 | `src/views/production-master-data/spc-configuration/data-collection-configuration/` | | 生产配置 (Production Master Data) | SPC采集模型 (SPC Configuration) | SPC采集配置 (Data Collection Configuration) | 配置SPC采集参数 | `src/views/production-master-data/spc-configuration/data-collection-configuration/` | ✅ | 0 | 0 |
| ✅ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 班组管理 (Team Management) | 管理生产班组 | `src/views/production-master-data/team-model/team-management/` | | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 班组管理 (Team Management) | 管理生产班组 | `src/views/production-master-data/team-model/team-management/` | ✅ | 0 | 0 |
| ✅ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 班次管理 (Shift Management) | 管理生产班次 | `src/views/production-master-data/team-model/shift-management/` | | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 班次管理 (Shift Management) | 管理生产班次 | `src/views/production-master-data/team-model/shift-management/` | ✅ | 0 | 0 |
| ✅ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 排班日历 (Scheduling Calendar) | 查看排班日历 | `src/views/production-master-data/team-model/scheduling-calendar/` | | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 排班日历 (Scheduling Calendar) | 查看排班日历 | `src/views/production-master-data/team-model/scheduling-calendar/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备类别 (Equipment Category) | 设备类别 (Equipment Category) | 管理设备类别 | `src/views/equipment-management/equipment-model/equipment-category/` | | 设备模型 (Equipment Management) | 设备类别 (Equipment Category) | 设备类别 (Equipment Category) | 管理设备类别 | `src/views/equipment-management/equipment-model/equipment-category/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备信息 (Equipment Management) | 设备信息 (Equipment Registry) | 管理设备信息 | `src/views/equipment-management/equipment-model/equipment-registry/` | | 设备模型 (Equipment Management) | 设备信息 (Equipment Management) | 设备信息 (Equipment Registry) | 管理设备信息 | `src/views/equipment-management/equipment-model/equipment-registry/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检项目 (Inspection Items) | 点检项目管理 | `src/views/equipment-management/inspection-management/inspection-items/` | | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检项目 (Inspection Items) | 点检项目管理 | `src/views/equipment-management/inspection-management/inspection-items/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检记录 (Inspection Records) | 点检记录管理 | `src/views/equipment-management/inspection-management/inspection-records/` | | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检记录 (Inspection Records) | 点检记录管理 | `src/views/equipment-management/inspection-management/inspection-records/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检日志 (Inspection Logs) | 点检日志查询 | `src/views/equipment-management/inspection-management/inspection-logs/` | | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检日志 (Inspection Logs) | 点检日志查询 | `src/views/equipment-management/inspection-management/inspection-logs/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养项目 (Maintenance Items) | 保养项目管理 | `src/views/equipment-management/maintenance-management/maintenance-items/` | | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养项目 (Maintenance Items) | 保养项目管理 | `src/views/equipment-management/maintenance-management/maintenance-items/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养详情 (Maintenance Details) | 保养详情管理 | `src/views/equipment-management/maintenance-management/maintenance-details/` | | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养详情 (Maintenance Details) | 保养详情管理 | `src/views/equipment-management/maintenance-management/maintenance-details/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养日志 (Maintenance Logs) | 保养日志查询 | `src/views/equipment-management/maintenance-management/maintenance-logs/` | | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养日志 (Maintenance Logs) | 保养日志查询 | `src/views/equipment-management/maintenance-management/maintenance-logs/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修管理 (Repair Management) | 维修管理 | `src/views/equipment-management/repair-management/repair-management/` | | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修管理 (Repair Management) | 维修管理 | `src/views/equipment-management/repair-management/repair-management/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修日志 (Repair Logs) | 维修日志查询 | `src/views/equipment-management/repair-management/repair-logs/` | | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修日志 (Repair Logs) | 维修日志查询 | `src/views/equipment-management/repair-management/repair-logs/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品类别 (Consumables Category) | 损耗品分类管理 | `src/views/equipment-management/consumables-management/consumables-category/` | | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品类别 (Consumables Category) | 损耗品分类管理 | `src/views/equipment-management/consumables-management/consumables-category/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品项目 (Consumables Items) | 损耗品项目管理 | `src/views/equipment-management/consumables-management/consumables-items/` | | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品项目 (Consumables Items) | 损耗品项目管理 | `src/views/equipment-management/consumables-management/consumables-items/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品寿命管理 (Consumables Lifecycle Management) | 寿命管理 | `src/views/equipment-management/consumables-management/consumables-lifecycle/` | | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品寿命管理 (Consumables Lifecycle Management) | 寿命管理 | `src/views/equipment-management/consumables-management/consumables-lifecycle/` | ✅ | 0 | 0 |
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品更换日志 (Replacement Logs) | 更换记录查询 | `src/views/equipment-management/consumables-management/replacement-logs/` | | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品更换日志 (Replacement Logs) | 更换记录查询 | `src/views/equipment-management/consumables-management/replacement-logs/` | ✅ | 0 | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 批次列表 (Batch List) | 批次管理 | `src/views/planning-production/batch-management/batch-list/` | | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 批次列表 (Batch List) | 批次管理 | `src/views/planning-production/batch-management/batch-list/` | ✅ | ✅ | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 批次托盘 (Tray Tracking) | 托盘跟踪与操作 | `src/views/planning-production/batch-management/tray-tracking/` | | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 批次托盘 (Tray Tracking) | 托盘跟踪与操作 | `src/views/planning-production/batch-management/tray-tracking/` | ✅ | ✅ | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 生产批次不良报表 (Batch Defect Report) | 不良报表 | `src/views/planning-production/batch-management/batch-defect-report/` | | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 生产批次不良报表 (Batch Defect Report) | 不良报表 | `src/views/planning-production/batch-management/batch-defect-report/` | ✅ | 0 | 0 |
| ✅ | 计划与生产 (Planning & Production) | 预警中心 (Alert Center) | 预警中心 (Alert Center) | 预警中心 | `src/views/planning-production/alert-center/` | | 计划与生产 (Planning & Production) | 预警中心 (Alert Center) | 预警中心 (Alert Center) | 预警中心 | `src/views/planning-production/alert-center/` | ✅ | 0 | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 物料监控 (Material Monitoring) | 物料监控 | `src/views/planning-production/production-monitoring/material-monitoring/` | | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 物料监控 (Material Monitoring) | 物料监控 | `src/views/planning-production/production-monitoring/material-monitoring/` | ✅ | 0 | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 电池复投管理 (Rework Management) | 返工管理 | `src/views/planning-production/production-monitoring/rework-management/` | | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 电池复投管理 (Rework Management) | 返工管理 | `src/views/planning-production/production-monitoring/rework-management/` | ✅ | 0 | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 托盘管理 (Tray Management) | 托盘管理 | `src/views/planning-production/production-monitoring/tray-management/` | | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 托盘管理 (Tray Management) | 托盘管理 | `src/views/planning-production/production-monitoring/tray-management/` | ✅ | 0 | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 托盘登录 (Tray Registration) | 托盘登记 | `src/views/planning-production/production-monitoring/tray-registration/` | | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 托盘登录 (Tray Registration) | 托盘登记 | `src/views/planning-production/production-monitoring/tray-registration/` | ✅ | ✅ | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 设备监控 (Equipment Monitoring) | 设备监控 | `src/views/planning-production/production-monitoring/equipment-monitoring/` | | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 设备监控 (Equipment Monitoring) | 设备监控 | `src/views/planning-production/production-monitoring/equipment-monitoring/` | ✅ | ✅ | 0 |
| ✅ | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 电池工序管理 (Process Execution) | 工序管理 | `src/views/planning-production/production-monitoring/process-execution/` | | 计划与生产 (Planning & Production) | 生产监控 (Production Monitoring) | 电池工序管理 (Process Execution) | 工序管理 | `src/views/planning-production/production-monitoring/process-execution/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 过程控制 (Process Control) | 检验类别管理 (Inspection Type Management) | | `src/views/quality-management/process-control/inspection-type-management/` | | 质量管理 (Quality Management) | 过程控制 (Process Control) | 检验类别管理 (Inspection Type Management) | | `src/views/quality-management/process-control/inspection-type-management/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 过程控制 (Process Control) | 首巡检项目配置 (First Article Inspection Configuration) | | `src/views/quality-management/process-control/first-article-inspection-configuration/` | | 质量管理 (Quality Management) | 过程控制 (Process Control) | 首巡检项目配置 (First Article Inspection Configuration) | | `src/views/quality-management/process-control/first-article-inspection-configuration/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 过程控制 (Process Control) | 首巡检录入 (First Article Inspection Records) | | `src/views/quality-management/process-control/first-article-inspection-records/` | | 质量管理 (Quality Management) | 过程控制 (Process Control) | 首巡检录入 (First Article Inspection Records) | | `src/views/quality-management/process-control/first-article-inspection-records/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 过程控制 (Process Control) | 首巡检报表 (First Article Inspection Reports) | | `src/views/quality-management/process-control/first-article-inspection-reports/` | | 质量管理 (Quality Management) | 过程控制 (Process Control) | 首巡检报表 (First Article Inspection Reports) | | `src/views/quality-management/process-control/first-article-inspection-reports/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检验单管理 (Inspection Orders) | | `src/views/quality-management/inspection-management/inspection-orders/` | | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检验单管理 (Inspection Orders) | | `src/views/quality-management/inspection-management/inspection-orders/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检验标准 (Inspection Standards) | | `src/views/quality-management/inspection-management/inspection-standards/` | | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检验标准 (Inspection Standards) | | `src/views/quality-management/inspection-management/inspection-standards/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 接收质量限 (AQL Standards) | | `src/views/quality-management/inspection-management/aql-standards/` | | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 接收质量限 (AQL Standards) | | `src/views/quality-management/inspection-management/aql-standards/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检测方案维护 (Inspection Plans) | | `src/views/quality-management/inspection-management/inspection-plans/` | | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检测方案维护 (Inspection Plans) | | `src/views/quality-management/inspection-management/inspection-plans/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检验项目 (Inspection Items) | | `src/views/quality-management/inspection-management/inspection-items/` | | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 检验项目 (Inspection Items) | | `src/views/quality-management/inspection-management/inspection-items/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 抽样方案配置 (Sampling Plans) | | `src/views/quality-management/inspection-management/sampling-plans/` | | 质量管理 (Quality Management) | 检验控制 (Inspection Management) | 抽样方案配置 (Sampling Plans) | | `src/views/quality-management/inspection-management/sampling-plans/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC统计过程控制 (SPC Control) | SPC渲染条件配置 (SPC Configuration) | | `src/views/quality-management/spc-control/spc-configuration/` | | 质量管理 (Quality Management) | SPC统计过程控制 (SPC Control) | SPC渲染条件配置 (SPC Configuration) | | `src/views/quality-management/spc-control/spc-configuration/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | XBar-R (XBar-R Chart) | | `src/views/quality-management/spc-variable-charts/xbar-r/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | XBar-R (XBar-R Chart) | | `src/views/quality-management/spc-variable-charts/xbar-r/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | XBar-S (XBar-S Chart) | | `src/views/quality-management/spc-variable-charts/xbar-s/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | XBar-S (XBar-S Chart) | | `src/views/quality-management/spc-variable-charts/xbar-s/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | I-MR (I-MR Chart) | | `src/views/quality-management/spc-variable-charts/i-mr/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | I-MR (I-MR Chart) | | `src/views/quality-management/spc-variable-charts/i-mr/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | Levey-Jennings (Levey-Jennings Chart) | | `src/views/quality-management/spc-variable-charts/levey-jennings/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | Levey-Jennings (Levey-Jennings Chart) | | `src/views/quality-management/spc-variable-charts/levey-jennings/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | EWMA (EWMA Chart) | | `src/views/quality-management/spc-variable-charts/ewma/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | EWMA (EWMA Chart) | | `src/views/quality-management/spc-variable-charts/ewma/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | CUSUM (CUSUM Chart) | | `src/views/quality-management/spc-variable-charts/cusum/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | CUSUM (CUSUM Chart) | | `src/views/quality-management/spc-variable-charts/cusum/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | MA (Moving Average Chart) | | `src/views/quality-management/spc-variable-charts/ma/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | MA (Moving Average Chart) | | `src/views/quality-management/spc-variable-charts/ma/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | MAMR (Moving Average MR Chart) | | `src/views/quality-management/spc-variable-charts/mamr/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | MAMR (Moving Average MR Chart) | | `src/views/quality-management/spc-variable-charts/mamr/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | MAMS (Moving Average S Chart) | | `src/views/quality-management/spc-variable-charts/mams/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | MAMS (Moving Average S Chart) | | `src/views/quality-management/spc-variable-charts/mams/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | CPK (Process Capability Index) | | `src/views/quality-management/spc-variable-charts/cpk/` | | 质量管理 (Quality Management) | SPC计量型报表 (SPC Variable Charts) | CPK (Process Capability Index) | | `src/views/quality-management/spc-variable-charts/cpk/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | DPMO (DPMO) | | `src/views/quality-management/spc-attribute-charts/dpmo/` | | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | DPMO (DPMO) | | `src/views/quality-management/spc-attribute-charts/dpmo/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | PChart (P Chart) | | `src/views/quality-management/spc-attribute-charts/pchart/` | | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | PChart (P Chart) | | `src/views/quality-management/spc-attribute-charts/pchart/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | NPChart (NP Chart) | | `src/views/quality-management/spc-attribute-charts/npchart/` | | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | NPChart (NP Chart) | | `src/views/quality-management/spc-attribute-charts/npchart/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | CChart (C Chart) | | `src/views/quality-management/spc-attribute-charts/cchart/` | | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | CChart (C Chart) | | `src/views/quality-management/spc-attribute-charts/cchart/` | ✅ | 0 | 0 |
| ✅ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | UChart (U Chart) | | `src/views/quality-management/spc-attribute-charts/uchart/` | | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | UChart (U Chart) | | `src/views/quality-management/spc-attribute-charts/uchart/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 反向追溯 (Backward Traceability) | 反向追溯 | `src/views/data-platform/traceability/backward/` | | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 反向追溯 (Backward Traceability) | 反向追溯 | `src/views/data-platform/traceability/backward/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 正向追溯 (Forward Traceability) | 正向追溯 | `src/views/data-platform/traceability/forward/` | | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 正向追溯 (Forward Traceability) | 正向追溯 | `src/views/data-platform/traceability/forward/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池曲线 (Battery Curve) | 电池曲线 | `src/views/data-platform/traceability/battery-curve/` | | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池曲线 (Battery Curve) | 电池曲线 | `src/views/data-platform/traceability/battery-curve/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 托盘追溯 (Tray Traceability) | 托盘追溯 | `src/views/data-platform/traceability/tray/` | | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 托盘追溯 (Tray Traceability) | 托盘追溯 | `src/views/data-platform/traceability/tray/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | 电池追溯 | `src/views/data-platform/traceability/battery/` | | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | 电池追溯 | `src/views/data-platform/traceability/battery/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 设备履历报表 (Equipment History Report) | 设备履历报表 | `src/views/data-platform/production-reports/equipment-history/` | | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 设备履历报表 (Equipment History Report) | 设备履历报表 | `src/views/data-platform/production-reports/equipment-history/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 电池详情报表 (Battery Detail Report) | 电池详情报表 | `src/views/data-platform/production-reports/battery-detail/` | | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 电池详情报表 (Battery Detail Report) | 电池详情报表 | `src/views/data-platform/production-reports/battery-detail/` | ✅ | 0 | 0 |
| ✅ | 数据中台 (Data Platform) | 相关性分析 (Correlation Analysis) | 鹰眼 (Hawkeye) | 鹰眼 | `src/views/data-platform/correlation-analysis/hawkeye/` | | 数据中台 (Data Platform) | 相关性分析 (Correlation Analysis) | 鹰眼 (Hawkeye) | 鹰眼 | `src/views/data-platform/correlation-analysis/hawkeye/` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | SCADA管理 (SCADA Management) | SCADA节点配置 (SCADA Node Configuration) | SCADA节点配置功能 | `src/views/scada_manage/basic_configuration/scada_configure` | | SCADA管理 (SCADA Management) | SCADA管理 (SCADA Management) | SCADA节点配置 (SCADA Node Configuration) | SCADA节点配置功能 | `src/views/scada_manage/basic_configuration/scada_configure` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | SCADA管理 (SCADA Management) | SCADA数据查询 (SCADA Data Query) | SCADA数据查询功能 | `src/views/scada_manage/basic_configuration/scada_query` | | SCADA管理 (SCADA Management) | SCADA管理 (SCADA Management) | SCADA数据查询 (SCADA Data Query) | SCADA数据查询功能 | `src/views/scada_manage/basic_configuration/scada_query` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | SCADA管理 (SCADA Management) | 节点设备映射 (Node Device Mapping) | 节点设备映射功能 | `src/views/scada_manage/basic_configuration/node_mapping_device_code` | | SCADA管理 (SCADA Management) | SCADA管理 (SCADA Management) | 节点设备映射 (Node Device Mapping) | 节点设备映射功能 | `src/views/scada_manage/basic_configuration/node_mapping_device_code` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 环控节点配置 (Environmental Control Node Configuration) | 环控节点配置功能 | `src/views/scada_manage/basic_configuration/ems_configure` | | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 环控节点配置 (Environmental Control Node Configuration) | 环控节点配置功能 | `src/views/scada_manage/basic_configuration/ems_configure` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 环控数据查询 (Environmental Control Data Query) | 环控数据查询功能 | `src/views/scada_manage/basic_configuration/ems_query` | | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 环控数据查询 (Environmental Control Data Query) | 环控数据查询功能 | `src/views/scada_manage/basic_configuration/ems_query` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 车间配置 (Workshop Configuration) | 车间配置功能 | `src/views/scada_manage/workshop_manage/workshop_config` | | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 车间配置 (Workshop Configuration) | 车间配置功能 | `src/views/scada_manage/workshop_manage/workshop_config` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 车间点位管理 (Workshop Point Management) | 车间点位管理功能 | `src/views/scada_manage/workshop_manage/workshop_point` | | SCADA管理 (SCADA Management) | 环控管理 (Environmental Control Management) | 车间点位管理 (Workshop Point Management) | 车间点位管理功能 | `src/views/scada_manage/workshop_manage/workshop_point` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 服务配置 (Service Configuration) | 服务配置功能 | `src/views/scada_manage/lecpserver/edgeserverconfigure` | | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 服务配置 (Service Configuration) | 服务配置功能 | `src/views/scada_manage/lecpserver/edgeserverconfigure` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 服务监控 (Service Monitoring) | 服务监控功能 | `src/views/scada_manage/lecpserver/edgeservermonitor` | | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 服务监控 (Service Monitoring) | 服务监控功能 | `src/views/scada_manage/lecpserver/edgeservermonitor` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 前置服务日志 (Pre-service Logs) | 前置服务日志功能 | `src/views/scada_manage/lecpserver/edgeserver_log` | | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 前置服务日志 (Pre-service Logs) | 前置服务日志功能 | `src/views/scada_manage/lecpserver/edgeserver_log` | ✅ | 0 | 0 |
| ⬜ | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 实时采集监控 (Real-time Gathering Monitoring) | 实时采集监控功能 | `src/views/scada_manage/device_gather/battery_device_gather_monitor` | | SCADA管理 (SCADA Management) | 前置采集管理 (Pre-acquisition Management) | 实时采集监控 (Real-time Gathering Monitoring) | 实时采集监控功能 | `src/views/scada_manage/device_gather/battery_device_gather_monitor` | ✅ | 0 | 0 |
## 状态说明 ## 状态说明

View File

@@ -31,3 +31,38 @@ export function logoutAdminUser () {
} }
}) })
} }
export function getAuthTime (data) {
return request({
url: 'auth/get/time',
method: 'post',
data: {
method: 'get.auth.time',
platform: 'admin',
...data
}
})
}
export function getAuthNearTime (data) {
return request({
url: 'auth/get/nearTime',
method: 'post',
data: {
method: 'get.auth.nearTime',
platform: 'admin',
...data
}
})
}
export function getAuthTimeByUpload (data) {
return request({
url: 'auth/get/timeByUpload',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
data
})
}

View File

@@ -4,7 +4,7 @@ const BASE = 'production_configuration/device_model/device_category/'
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `equipment_management_equipment_model_equipment_category_${method}`, method: `production_configuration_device_model_device_category_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }

View File

@@ -28,6 +28,23 @@ export function batchDeleteItems (data) {
return request({ url: BASE + 'batch_delete', method: 'delete', data: params('production_configuration_device_model_device_management_batch_delete', data) }) return request({ url: BASE + 'batch_delete', method: 'delete', data: params('production_configuration_device_model_device_management_batch_delete', data) })
} }
export function getImportTemplate (data) {
return request({
url: BASE + 'get_import_template',
method: 'post',
responseType: 'blob',
data: params('production_configuration_device_model_device_management_get_import_template', data)
})
}
export function importData (data) {
return request({
url: BASE + 'device_data_import',
method: 'post',
data: params('production_configuration_device_model_device_management_device_data_import', data)
})
}
export function createExportTask (data) { export function createExportTask (data) {
return request({ url: BASE + 'device_data_export_task', method: 'post', data: params('production_configuration_device_model_device_management_device_export_task', data) }) return request({ url: BASE + 'device_data_export_task', method: 'post', data: params('production_configuration_device_model_device_management_device_export_task', data) })
} }

View File

@@ -57,3 +57,11 @@ export function getWorkstationSearch (data) {
params: apiParams('planning_production_produce_pincheck_search', data) params: apiParams('planning_production_produce_pincheck_search', data)
}) })
} }
export function devicePinCheckExport (data) {
return request({
url: BASE + 'check',
method: 'get',
params: apiParams('planning_production_produce_pincheck_check', data)
})
}

View File

@@ -1,4 +1,5 @@
import { request } from '@/api/_service' import { request } from '@/api/_service'
import qs from 'qs'
const BASE = 'planning_production/wip/wip_management/' const BASE = 'planning_production/wip/wip_management/'
@@ -10,11 +11,19 @@ function apiParams (method, data = {}) {
} }
} }
function stringifyListParams (data = {}) {
return qs.stringify(apiParams('planning_production_wip_wip_management_list', data), {
arrayFormat: 'brackets',
allowDots: true,
encode: false
})
}
export function getWipDataList (data) { export function getWipDataList (data) {
return request({ return request({
url: BASE + 'list', url: BASE + 'list?' + stringifyListParams(data),
method: 'get', method: 'get',
params: apiParams('planning_production_wip_wip_management_list', data) params: {}
}) })
} }

View File

@@ -1,4 +1,5 @@
import { request } from '@/api/_service' import { request } from '@/api/_service'
import qs from 'qs'
const BASE = 'planning_production/produce/change_battery_process/' const BASE = 'planning_production/produce/change_battery_process/'
@@ -10,6 +11,16 @@ function apiParams (method, data = {}) {
} }
} }
function stringifyLegacyProcessOptions (data = {}) {
const params = apiParams('planning_production_produce_change_battery_process_change', data)
if (Array.isArray(params.processOptions)) {
params.processOptions = params.processOptions.map(item => {
return typeof item === 'string' ? item : JSON.stringify(item)
})
}
return qs.stringify(params, { arrayFormat: 'brackets', allowDots: true, encode: false })
}
export function verifyBatteryProcessInfo (data) { export function verifyBatteryProcessInfo (data) {
return request({ return request({
url: BASE + 'verify', url: BASE + 'verify',
@@ -20,8 +31,8 @@ export function verifyBatteryProcessInfo (data) {
export function changeBatteryProcess (data) { export function changeBatteryProcess (data) {
return request({ return request({
url: BASE + 'change', url: BASE + 'change?' + stringifyLegacyProcessOptions(data),
method: 'get', method: 'get',
params: apiParams('planning_production_produce_change_battery_process_change', data) params: {}
}) })
} }

View File

@@ -4,7 +4,7 @@ const BASE = 'production_configuration/spc_configuration/binding_scada_node/'
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `production_master_data_spc_configuration_data_collection_configuration_${method}`, method: `production_configuration_spc_configuration_binding_scada_node_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }

View File

@@ -4,7 +4,7 @@ const BASE = 'production_configuration/factory_model/factory_area/'
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `production_master_data_factory_model_factory_area_${method}`, method: `production_configuration_factory_model_factory_area_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }
@@ -49,3 +49,11 @@ export function deleteFactoryArea (data) {
data: apiParams('delete', data) data: apiParams('delete', data)
}) })
} }
export function exportFactoryAreaTask (data) {
return request({
url: BASE + 'export',
method: 'post',
data: apiParams('export', data)
})
}

View File

@@ -4,12 +4,20 @@ const BASE = 'production_configuration/technology_model/optional_params/'
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `production_master_data_process_model_optional_params_${method}`, method: `production_configuration_technology_model_optional_params_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }
} }
export function getOptionalParamsALL (data) {
return request({
url: BASE + 'all',
method: 'get',
params: apiParams('all', data)
})
}
export function getOptionalParamsList (data) { export function getOptionalParamsList (data) {
return request({ return request({
url: BASE + 'list', url: BASE + 'list',
@@ -47,11 +55,7 @@ export function getImportTemplate (data) {
url: BASE + 'get_import_template', url: BASE + 'get_import_template',
method: 'post', method: 'post',
responseType: 'blob', responseType: 'blob',
data: { data: apiParams('get_import_template', data)
method: 'production_master_data_process_model_optional_params_get_import_template',
platform: 'background',
...data
}
}) })
} }
@@ -59,6 +63,10 @@ export function importDataCreate (data) {
return request({ return request({
url: BASE + 'import_data_create', url: BASE + 'import_data_create',
method: 'post', method: 'post',
data: apiParams('import_data_create', data) data: {
method: 'production_configuration_technology_model_optional_params_import_data_create',
platform: 'background',
...data
}
}) })
} }

View File

@@ -4,7 +4,7 @@ const BASE = 'production_configuration/technology_model/technology_flow/'
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `production_master_data_process_model_process_routing_${method}`, method: `production_configuration_technology_model_technology_flow_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }

View File

@@ -4,7 +4,7 @@ const BASE = 'production_configuration/technology_model/technology_flow_workings
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `production_master_data_process_model_process_step_${method}`, method: `production_configuration_technology_model_technology_flow_workingsubclass_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }
@@ -30,6 +30,14 @@ export function getWorkingsubclassAll (data) {
}) })
} }
export function getWorkSubClassByDeviceCode (data) {
return request({
url: BASE + 'get_worksubclass_by_device_code',
method: 'get',
params: apiParams('get_worksubclass_by_device_code', data)
})
}
export function createProcessStep (data) { export function createProcessStep (data) {
return request({ return request({
url: BASE + 'create', url: BASE + 'create',
@@ -58,10 +66,6 @@ export function settingSubmit (data) {
return request({ return request({
url: BASE + 'setting_submit', url: BASE + 'setting_submit',
method: 'post', method: 'post',
data: { data: apiParams('setting_submit', data)
method: 'production_master_data_process_model_process_step_setting_submit',
platform: 'background',
...data
}
}) })
} }

View File

@@ -4,12 +4,20 @@ const BASE = 'production_configuration/factory_model/factory_line/'
function apiParams (method, data = {}) { function apiParams (method, data = {}) {
return { return {
method: `production_master_data_factory_model_factory_line_${method}`, method: `production_configuration_factory_model_factory_line_${method}`,
platform: 'background', platform: 'background',
...data ...data
} }
} }
export function getProductionLineALL (data) {
return request({
url: BASE + 'all',
method: 'get',
params: apiParams('all', data)
})
}
export function getProductionLineList (data) { export function getProductionLineList (data) {
return request({ return request({
url: BASE + 'list', url: BASE + 'list',
@@ -41,3 +49,11 @@ export function deleteProductionLine (data) {
data: apiParams('delete', data) data: apiParams('delete', data)
}) })
} }
export function exportProductionLineTask (data) {
return request({
url: BASE + 'export',
method: 'post',
data: apiParams('export', data)
})
}

View File

@@ -1,15 +1 @@
import { request } from '@/api/_service' export * from '@/api/workerman'
const BASE = 'production_configuration/workerman/'
export function sendWorkerman (data) {
return request({
url: BASE + 'send',
method: 'get',
params: {
method: 'planning_production_produce_traymanage_send_workerman',
module: 'api',
...data
}
})
}

View File

@@ -97,3 +97,15 @@ export function resetUserPwd (data) {
} }
}) })
} }
export function updateUserPwd (data) {
return request({
url: BASE + 'update_pwd',
method: 'put',
data: {
method: 'system_settings_user_management_user_update_pwd',
platform: 'background',
...data
}
})
}

View File

@@ -0,0 +1,90 @@
import axios from 'axios'
import { Message } from 'element-ui'
const WORKERMAN_URL = process.env.VUE_APP_WORKERMAN_URL || 'http://127.0.0.1:34351'
const WORKERMAN_API = process.env.VUE_APP_WORKERMAN_API || WORKERMAN_URL
const workerman = axios.create({
timeout: 10000,
headers: {
'Content-Type': 'application/json'
}
})
function normalizePayload (data = {}) {
return data.sendData || data
}
function readBusinessError (data) {
if (!data || typeof data !== 'object') return ''
const code = data.code ?? data.errcode
if (code === undefined || Number(code) === 0) return ''
return data.errmsg || data.msg || data.message || 'Workerman 接口返回失败'
}
function buildRequestErrorMessage (error) {
if (error.response) {
return `Workerman 接口请求失败HTTP ${error.response.status}`
}
if (error.code === 'ECONNABORTED') {
return `Workerman 接口请求超时,请确认 ${WORKERMAN_URL} 是否可访问`
}
if (error.request) {
return `Workerman 接口无响应,请确认浏览器可以访问 ${WORKERMAN_URL}`
}
return error.message || 'Workerman 接口请求失败'
}
export function sendWorkerman (data) {
return workerman.post(WORKERMAN_API, normalizePayload(data)).then(response => {
const result = response.data
const businessError = readBusinessError(result)
if (businessError) {
Message.error(businessError)
const error = new Error(businessError)
error.__workermanHandled = true
throw error
}
if (result === undefined || result === null || result === '') {
const message = 'Workerman 接口未返回有效数据'
Message.error(message)
const error = new Error(message)
error.__workermanHandled = true
throw error
}
return result
}).catch(error => {
if (error.__workermanHandled) throw error
const message = buildRequestErrorMessage(error)
Message.error(message)
throw error
})
}
export function trayLogin (param) {
return sendWorkerman({
action: 'set_tray_login',
param
})
}
export function trayUnbinding (tray) {
return sendWorkerman({
action: 'set_tray_unbinding',
param: { tray }
})
}
export function trayInactivity (tray) {
return sendWorkerman({
action: 'set_tray_inactivity',
param: { tray }
})
}
export function batteryInactivity (data) {
return sendWorkerman({
action: 'set_battery_inactivity',
param: { data }
})
}

View File

@@ -66,6 +66,7 @@
v-model="formData[col.prop]" v-model="formData[col.prop]"
:placeholder="$t(col.placeholder)" :placeholder="$t(col.placeholder)"
:type="col.inputType || 'text'" :type="col.inputType || 'text'"
:show-password="!!col.showPassword"
:autosize="col.autosize" :autosize="col.autosize"
:clearable="col.clearable !== false" :clearable="col.clearable !== false"
:disabled="!!col.disabled" :disabled="!!col.disabled"
@@ -255,7 +256,13 @@ export default {
const rules = this.rules || {} const rules = this.rules || {}
const translated = {} const translated = {}
for (const [field, validators] of Object.entries(rules)) { for (const [field, validators] of Object.entries(rules)) {
translated[field] = validators.map(v => ({ ...v, message: this.$t(v.message) })) translated[field] = validators.map(v => {
const rule = { ...v }
if (rule.message) {
rule.message = this.$t(rule.message)
}
return rule
})
} }
return translated return translated
} }

View File

@@ -66,7 +66,7 @@
:row-key="rowKey" :row-key="rowKey"
:header-cell-style="headerCellStyle" :header-cell-style="headerCellStyle"
v-bind="tableAttrs" v-bind="tableAttrs"
v-on="tableListeners" v-on="elTableListeners"
@selection-change="onSelectionChange" @selection-change="onSelectionChange"
> >
<!-- <!--
@@ -169,9 +169,9 @@
--> -->
<div ref="footer" class="page-table__footer" v-if="pagination"> <div ref="footer" class="page-table__footer" v-if="pagination">
<el-pagination <el-pagination
:current-page="pagination.current" :current-page="paginationCurrent"
:page-size="pagination.size || 10" :page-size="paginationSize"
:total="pagination.total" :total="paginationTotal"
:page-sizes="[10, 25, 50, 100, 250, 500]" :page-sizes="[10, 25, 50, 100, 250, 500]"
:disabled="loading" :disabled="loading"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@@ -361,11 +361,40 @@ export default {
return this.tableSelected.length return this.tableSelected.length
}, },
paginationCurrent () {
if (!this.pagination) return 1
return Number(this.pagination.current || this.pagination.currentPage || 1)
},
paginationSize () {
if (!this.pagination) return 10
return Number(this.pagination.size || this.pagination.pageSize || 10)
},
paginationTotal () {
if (!this.pagination) return 0
return Number(this.pagination.total || 0)
},
/** /**
* 表头样式:浅灰背景 + 黑色加粗文字 * 表头样式:浅灰背景 + 黑色加粗文字
*/ */
headerCellStyle () { headerCellStyle () {
return () => 'background-color: #F8F8F8; color: #000000; font-weight: 500;' return () => 'background-color: #F8F8F8; color: #000000; font-weight: 500;'
},
/**
* 将父组件直接绑定在 page-table 上的 el-table 原生事件透传下去。
* selection-change 由当前组件统一维护选中行状态,避免父级监听被触发两次。
*/
elTableListeners () {
const listeners = {
...this.$listeners,
...this.tableListeners
}
delete listeners['selection-change']
delete listeners['page-change']
return listeners
} }
}, },
mounted () { mounted () {
@@ -410,16 +439,20 @@ export default {
onSizeChange (size) { onSizeChange (size) {
this.$emit('page-change', { this.$emit('page-change', {
current: 1, current: 1,
currentPage: 1,
size, size,
total: this.pagination.total pageSize: size,
total: this.paginationTotal
}) })
}, },
onCurrentChange (current) { onCurrentChange (current) {
this.$emit('page-change', { this.$emit('page-change', {
current, current,
size: this.pagination.size, currentPage: current,
total: this.pagination.total size: this.paginationSize,
pageSize: this.paginationSize,
total: this.paginationTotal
}) })
}, },

View File

@@ -1,31 +1,295 @@
<template> <template>
<el-dropdown size="small" class="d2-mr"> <el-dropdown size="small" class="d2-mr">
<span class="btn-text">{{info.name ? $t('page.layout.user.greeting', { name: info.name }) : $t('page.layout.user.not_logged_in')}}</span> <span class="btn-text">
{{ info.name ? $t('page.layout.user.greeting', { name: info.name }) : $t('page.layout.user.not_logged_in') }}
</span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="logOff"> <el-dropdown-item v-if="isAdmin" icon="el-icon-setting" @click.native="openApiDebug">
{{ $t('page.layout.user.api_debug') }}
</el-dropdown-item>
<el-dropdown-item icon="el-icon-key" @click.native="openPasswordDialog">
{{ $t('page.layout.user.change_password') }}
</el-dropdown-item>
<el-dropdown-item icon="el-icon-refresh" @click.native="reloadMenu">
{{ $t('page.layout.user.reload_menu') }}
</el-dropdown-item>
<el-dropdown-item icon="el-icon-document-checked" @click.native="openAuthDialog">
{{ $t('page.layout.user.product_authorization') }}
</el-dropdown-item>
<el-dropdown-item divided @click.native="logOff">
<d2-icon name="power-off" class="d2-mr-5" /> <d2-icon name="power-off" class="d2-mr-5" />
{{ $t('page.layout.user.logout') }} {{ $t('page.layout.user.logout') }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
<el-dialog
:title="$t('page.layout.user.change_password')"
width="600px"
:visible.sync="passwordDialogVisible"
:append-to-body="true"
:close-on-click-modal="false"
@close="resetPasswordForm"
>
<el-form ref="passwordForm" :model="passwordForm" :rules="passwordRules" label-width="110px" size="small">
<el-form-item :label="$t('page.layout.user.original_password')" prop="password_old">
<el-input v-model.trim="passwordForm.password_old" type="password" :placeholder="$t('page.layout.user.placeholder_original_password')" clearable show-password />
</el-form-item>
<el-form-item :label="$t('page.layout.user.new_password')" prop="password">
<el-input v-model.trim="passwordForm.password" type="password" :placeholder="$t('page.layout.user.placeholder_new_password')" clearable show-password />
</el-form-item>
<el-form-item :label="$t('page.layout.user.confirm_password')" prop="password_confirm">
<el-input v-model.trim="passwordForm.password_confirm" type="password" :placeholder="$t('page.layout.user.placeholder_confirm_password')" clearable show-password />
</el-form-item>
</el-form>
<div slot="footer">
<el-button size="small" @click="passwordDialogVisible = false">{{ $t('page.layout.user.cancel') }}</el-button>
<el-button size="small" type="primary" :loading="passwordSubmitting" @click="submitPassword">
{{ $t('page.layout.user.confirm') }}
</el-button>
</div>
</el-dialog>
<el-dialog
:title="$t('page.layout.user.product_authorization')"
width="600px"
:visible.sync="authDialogVisible"
:append-to-body="true"
:close-on-click-modal="false"
@opened="clearAuthFiles"
>
<el-descriptions :column="1" border>
<el-descriptions-item :label="$t('page.layout.user.authorization_validity_period')">
{{ authTime || '-' }}
</el-descriptions-item>
</el-descriptions>
<el-upload
ref="authUpload"
class="auth-upload"
drag
action=""
:limit="1"
:show-file-list="true"
:before-upload="beforeAuthUpload"
:http-request="uploadAuthFile"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
{{ $t('page.layout.user.drag_upload_hint') }}<em>{{ $t('page.layout.user.click_upload') }}</em>
</div>
<div slot="tip" class="el-upload__tip">{{ $t('page.layout.user.upload_file_tip') }}</div>
</el-upload>
</el-dialog>
</el-dropdown> </el-dropdown>
</template> </template>
<script> <script>
import { mapState, mapActions } from 'vuex' import util from '@/libs/util'
import { mapActions, mapState } from 'vuex'
import { updateUserPwd } from '@/api/system-administration/user'
import { getAuthNearTime, getAuthTime, getAuthTimeByUpload } from '@/api/auth'
export default { export default {
data () {
return {
passwordDialogVisible: false,
passwordSubmitting: false,
authDialogVisible: false,
authTime: '',
authNoticeTimer: null,
passwordForm: this.emptyPasswordForm(),
passwordRules: {
password_old: [
{ required: true, message: this.$t('page.layout.user.old_password_required'), trigger: 'blur' },
{ min: 6, max: 64, message: this.$t('page.layout.user.length_6_to_64'), trigger: 'blur' }
],
password: [
{ required: true, message: this.$t('page.layout.user.new_password_required'), trigger: 'blur' },
{ min: 6, max: 64, message: this.$t('page.layout.user.length_6_to_64'), trigger: 'blur' }
],
password_confirm: [
{ required: true, message: this.$t('page.layout.user.confirm_password_required'), trigger: 'blur' },
{ min: 6, max: 64, message: this.$t('page.layout.user.length_6_to_64'), trigger: 'blur' }
]
}
}
},
computed: { computed: {
...mapState('d2admin/user', [ ...mapState('d2admin/user', [
'info' 'info'
]) ]),
isAdmin () {
return String(this.info && this.info.admin && this.info.admin.role_id) === '1'
}
},
mounted () {
this.loadAuthTime()
},
beforeDestroy () {
this.clearAuthNoticeTimer()
}, },
methods: { methods: {
...mapActions('d2admin/account', [ ...mapActions('d2admin/account', [
'logout' 'logout'
]), ]),
/** emptyPasswordForm () {
* @description 登出 return {
*/ password_old: '',
password: '',
password_confirm: ''
}
},
normalizeAuthResponse (res) {
const source = res && res.data ? res.data : res
return {
status: Number(source && source.status),
msg: source && source.msg ? source.msg : ''
}
},
openApiDebug () {
const routeData = this.$router.resolve({
path: '/api',
query: { token: this.info && this.info.token }
})
window.open(routeData.href, '_blank')
},
openPasswordDialog () {
this.passwordForm = this.emptyPasswordForm()
this.passwordDialogVisible = true
this.$nextTick(() => {
this.$refs.passwordForm && this.$refs.passwordForm.clearValidate()
})
},
resetPasswordForm () {
this.passwordForm = this.emptyPasswordForm()
this.$nextTick(() => {
this.$refs.passwordForm && this.$refs.passwordForm.clearValidate()
})
},
submitPassword () {
this.$refs.passwordForm.validate(async valid => {
if (!valid) return
if (this.passwordForm.password_old === this.passwordForm.password) {
this.$message.error(this.$t('page.layout.user.password_same_error'))
return
}
if (this.passwordForm.password !== this.passwordForm.password_confirm) {
this.$message.error(this.$t('page.layout.user.password_not_match'))
return
}
this.passwordSubmitting = true
try {
await updateUserPwd({
user_id: this.info && this.info.admin && this.info.admin.user_id,
...this.passwordForm
})
this.passwordDialogVisible = false
this.$message.success(this.$t('page.layout.user.password_change_success'))
util.cookies.remove('token')
util.cookies.remove('uuid')
util.cookies.remove('block')
localStorage.removeItem('user_id')
this.logout({ confirm: false })
} finally {
this.passwordSubmitting = false
}
})
},
async reloadMenu () {
await this.$store.dispatch('d2admin/menu/menuReload')
this.$store.commit('d2admin/page/keepAliveClean')
await this.$router.replace('/refresh')
this.$message.success(this.$t('page.layout.user.menu_permission_reloaded'))
},
openAuthDialog () {
this.authDialogVisible = true
this.loadAuthTime()
},
clearAuthFiles () {
this.$nextTick(() => {
this.$refs.authUpload && this.$refs.authUpload.clearFiles()
})
},
beforeAuthUpload (file) {
const ext = String(file.name || '').replace(/.+\./, '').toLowerCase()
if (ext !== 'license') {
this.$message.error(this.$t('page.layout.user.please_upload_license'))
return false
}
return true
},
async uploadAuthFile ({ file }) {
const formData = new FormData()
formData.append('method', 'get.auth.timeByUpload')
formData.append('platform', 'admin')
formData.append('file', file)
try {
const res = this.normalizeAuthResponse(await getAuthTimeByUpload(formData))
if (res.status !== 0) {
this.$message.error(res.msg)
return
}
this.authTime = res.msg
this.$message.success(this.$t('page.layout.user.authorization_update_success', { time: res.msg }))
} finally {
this.clearAuthFiles()
}
},
notifyAuthExpired (message) {
if (process.env.NODE_ENV === 'development') return
this.$notify.error({
title: this.$t('page.layout.user.prompt'),
message,
duration: 4500,
position: 'bottom-right',
showClose: false
})
},
notifyAuthNearTime (message) {
if (process.env.NODE_ENV === 'development') return
this.$notify.warning({
title: this.$t('page.layout.user.prompt'),
message,
duration: 4500,
position: 'top-right',
showClose: false
})
},
clearAuthNoticeTimer () {
if (this.authNoticeTimer) {
clearInterval(this.authNoticeTimer)
this.authNoticeTimer = null
}
},
startAuthNoticeTimer (type, message) {
if (process.env.NODE_ENV === 'development') return
this.clearAuthNoticeTimer()
const notify = type === 'expired' ? this.notifyAuthExpired : this.notifyAuthNearTime
const interval = type === 'expired' ? 5000 : 30000
this.authNoticeTimer = setInterval(() => notify(message), interval)
},
async loadAuthTime () {
try {
const auth = this.normalizeAuthResponse(await getAuthTime())
if (auth.msg) this.authTime = auth.msg
if (auth.status === 1) {
const message = this.$t('page.layout.user.authorization_expired_message', { time: auth.msg })
this.notifyAuthExpired(message)
this.startAuthNoticeTimer('expired', message)
}
const near = this.normalizeAuthResponse(await getAuthNearTime())
if (near.status === 1) {
const message = this.$t('page.layout.user.authorization_near_message', { message: near.msg })
this.notifyAuthNearTime(message)
this.startAuthNoticeTimer('near', message)
}
} catch (error) {
this.clearAuthNoticeTimer()
}
},
logOff () { logOff () {
localStorage.removeItem('user_id')
this.logout({ this.logout({
confirm: true confirm: true
}) })
@@ -33,3 +297,9 @@ export default {
} }
} }
</script> </script>
<style scoped>
.auth-upload {
margin-top: 16px;
}
</style>

View File

@@ -27,7 +27,6 @@
"create_success": "Created successfully", "create_success": "Created successfully",
"edit_success": "Updated successfully", "edit_success": "Updated successfully",
"delete_success": "Deleted successfully", "delete_success": "Deleted successfully",
"sort": "No.",
"code": "Area Code", "code": "Area Code",
"name": "Area Name", "name": "Area Name",
"remark": "Remark", "remark": "Remark",
@@ -44,7 +43,11 @@
"tip": "Tip", "tip": "Tip",
"confirm_delete": "Are you sure to delete?", "confirm_delete": "Are you sure to delete?",
"validation_fail": "Validation failed", "validation_fail": "Validation failed",
"please_enter": "Please enter {name}" "please_enter": "Please enter {name}",
"export": "Export",
"confirm_export": "Create export task?",
"length_1_100": "Length should be 1 to 100 characters",
"remark_max_500": "Remark cannot exceed 500 characters"
}, },
"production_line": { "production_line": {
"search": "Search", "search": "Search",
@@ -53,7 +56,6 @@
"enter_name": "Please enter production line name", "enter_name": "Please enter production line name",
"enter_remark": "Please enter remark", "enter_remark": "Please enter remark",
"operation_success": "Operation succeeded", "operation_success": "Operation succeeded",
"sort": "No.",
"code": "Production Line Code", "code": "Production Line Code",
"name": "Production Line Name", "name": "Production Line Name",
"area": "Plant Area", "area": "Plant Area",
@@ -71,7 +73,11 @@
"confirm": "Confirm", "confirm": "Confirm",
"tip": "Tip", "tip": "Tip",
"confirm_delete": "Are you sure to delete?", "confirm_delete": "Are you sure to delete?",
"validation_fail": "Validation failed" "validation_fail": "Validation failed",
"export": "Export",
"confirm_export": "Create export task?",
"length_1_100": "Length should be 1 to 100 characters",
"remark_max_500": "Remark cannot exceed 500 characters"
} }
}, },
"process_model": { "process_model": {
@@ -120,6 +126,8 @@
"enter_process_unit_code": "Enter process unit code", "enter_process_unit_code": "Enter process unit code",
"enter_process_unit_name": "Enter process unit name", "enter_process_unit_name": "Enter process unit name",
"select_device_category": "Please select device category", "select_device_category": "Please select device category",
"login_process": "Login Process",
"select_login_process": "Please select whether this is a login process",
"remark_required": "Please enter remark", "remark_required": "Please enter remark",
"preset_setting": "Preset Settings", "preset_setting": "Preset Settings",
"add_process_unit": "Add Process Unit", "add_process_unit": "Add Process Unit",
@@ -139,6 +147,7 @@
"no": "No", "no": "No",
"is_upload": "Is Upload Required", "is_upload": "Is Upload Required",
"need_device_upload": "Requires Device Upload", "need_device_upload": "Requires Device Upload",
"multi_step_not_unique": "Set to No when parameters with the same name exist across steps",
"add_row": "Add Row", "add_row": "Add Row",
"import": "Import", "import": "Import",
"close": "Close", "close": "Close",
@@ -152,7 +161,18 @@
"delete_success": "Deleted successfully", "delete_success": "Deleted successfully",
"setting_placeholder": "Preset setting configuration area", "setting_placeholder": "Preset setting configuration area",
"setting_tip": "Configure preset settings for this process unit here", "setting_tip": "Configure preset settings for this process unit here",
"import_tip": "Import function is under development" "preset_result_param_import": "Preset Result Parameter Import",
"file_suffix_rule": "Only xlsx or xls files following the template can be uploaded",
"import_table": "Import Table",
"select_file": "Select File",
"download_template": "Download Template",
"preview": "Preview",
"upload_format_error": "Please upload xls or xlsx file",
"please_import_data": "Please import data first",
"optional_param_import_template": "Optional Parameter Import Template",
"import_missing_column": "Column [{name}] does not exist in the file. Please check.",
"import_duplicate_name": "Name [{name}] is duplicated. Remove duplicates and upload again.",
"import_duplicate_param": "Parameter [{param}] is duplicated. Remove duplicates and upload again."
}, },
"process_routing": { "process_routing": {
"search": "Search", "search": "Search",
@@ -222,9 +242,19 @@
"tip": "Tip", "tip": "Tip",
"confirm_delete": "Are you sure to delete this step?", "confirm_delete": "Are you sure to delete this step?",
"operation_success": "Operation succeeded", "operation_success": "Operation succeeded",
"validation_fail": "Validation failed",
"length_1_100": "Length must be 1-100 characters", "length_1_100": "Length must be 1-100 characters",
"batch_bound_no_move": "Batch bound, cannot move", "batch_bound_no_move": "Batch bound, cannot move",
"select_category": "Please select a category", "select_category": "Please select a category",
"rest_time": "Rest Time",
"enter_rest_time": "Please enter rest time",
"precision_range": "Precision Range",
"enter_precision_range": "Please enter precision range",
"minute": "Minute",
"integer_ge_0": "Please enter an integer greater than or equal to 0",
"input_empty": "Input cannot be empty",
"json_format_error": "Invalid JSON format",
"enter_setting_json": "Please enter setting JSON",
"log_operation_step": "Operation step: ", "log_operation_step": "Operation step: ",
"search": "Search", "search": "Search",
"query": "Query", "query": "Query",
@@ -675,6 +705,28 @@
"confirm_delete": "Are you sure to delete this SPC collection configuration?", "confirm_delete": "Are you sure to delete this SPC collection configuration?",
"validation_fail": "Validation failed", "validation_fail": "Validation failed",
"please_enter": "Please enter {name}", "please_enter": "Please enter {name}",
"result_param": "Result Parameter",
"result_param_code": "Result Parameter Code",
"result_param_name": "Result Parameter Name",
"enter_result_param_code": "Please enter result parameter code",
"enter_result_param_name": "Please enter result parameter name",
"scada_node_code": "SCADA Node Code",
"scada_node_name": "SCADA Node Name",
"enter_scada_node_code": "Please enter SCADA node code",
"enter_scada_node_name": "Please enter SCADA node name",
"working_subclass": "Process Step",
"select_working_subclass": "Please select process step",
"category": "Category",
"select_data_type": "Please select data type",
"select_result_param": "Please select result parameter",
"select_scada_node": "Please select SCADA node",
"result_param_type": "Result Parameter Type",
"process_inspection": "Process Inspection",
"result_data": "Result Data",
"measurement_type": "Measurement Type",
"count_type": "Count Type",
"create_time": "Created Time",
"update_data": "Updated Time",
"help": "Configure SPC data collection parameters and bind SCADA nodes" "help": "Configure SPC data collection parameters and bind SCADA nodes"
} }
}, },
@@ -810,16 +862,21 @@
"add": "Add", "add": "Add",
"edit": "Edit", "edit": "Edit",
"delete": "Delete", "delete": "Delete",
"batch_delete": "Batch Delete",
"import": "Import",
"export": "Export", "export": "Export",
"operation": "Operation", "operation": "Operation",
"add_title": "Add", "add_title": "Add Equipment",
"edit_title": "Edit", "edit_title": "Edit Equipment",
"confirm": "Confirm", "confirm": "Confirm",
"cancel": "Cancel", "cancel": "Cancel",
"tip": "Prompt", "tip": "Prompt",
"confirm_delete": "Delete this record?", "confirm_delete": "Delete this record?",
"confirm_batch_delete": "Batch delete selected equipment?",
"confirm_export": "Create export task?", "confirm_export": "Create export task?",
"operation_success": "Operation succeeded", "operation_success": "Operation succeeded",
"create_download_task_success": "Download task created",
"please_select_data": "Please select data",
"keyword": "Keyword", "keyword": "Keyword",
"enter_keyword": "Enter keyword", "enter_keyword": "Enter keyword",
"remark": "Remark", "remark": "Remark",
@@ -831,14 +888,41 @@
"enter_device_code": "Enter device code", "enter_device_code": "Enter device code",
"device_name": "Device Name", "device_name": "Device Name",
"enter_device_name": "Enter device name", "enter_device_name": "Enter device name",
"device_category": "Device Category",
"select_device_category": "Please select device category",
"design_ppm": "Design PPM",
"enter_design_ppm": "Please enter design PPM",
"ip": "IP",
"enter_ip": "Please enter IP",
"manufacturer": "Manufacturer",
"enter_manufacturer": "Please enter manufacturer",
"fixed_asset_code": "Fixed Asset Code",
"enter_fixed_asset_code": "Please enter fixed asset code",
"entry_time": "Entry Time",
"select_entry_time": "Please select entry time",
"device_id": "Device ID", "device_id": "Device ID",
"enter_device_id": "Enter device ID", "enter_device_id": "Enter device ID",
"device_type": "Device Type", "device_type": "Device Type",
"enter_device_type": "Enter device type", "enter_device_type": "Enter device type",
"area": "Area", "area": "Area",
"enter_area": "Enter area", "enter_area": "Enter area",
"select_area": "Please select area",
"line": "Line", "line": "Line",
"enter_line": "Enter line", "enter_line": "Enter line",
"production_line": "Production Line",
"select_production_line": "Please select production line",
"select_factory_first": "Please select area first",
"length_1_100": "Length must be 1 to 100 characters",
"device_data_import": "Equipment Import",
"import_warning": "Only xlsx or xls files following the template can be uploaded",
"import_table": "Import Table",
"select_file": "Select File",
"download_template": "Download Template",
"preview": "Preview",
"import_template_name": "Equipment Import Template",
"import_file_format_error": "Please upload xls or xlsx file",
"import_missing_column": "Column [{name}] does not exist in the file. Please check.",
"import_no_data": "Please import data first",
"standard": "Standard", "standard": "Standard",
"enter_standard": "Enter standard", "enter_standard": "Enter standard",
"inspection_item_code": "Inspection Item Code", "inspection_item_code": "Inspection Item Code",
@@ -2323,6 +2407,7 @@
"status": "Status", "status": "Status",
"enable": "Enabled", "enable": "Enabled",
"disable": "Disabled", "disable": "Disabled",
"select_status": "Please select status",
"user_group": "User Group", "user_group": "User Group",
"login_ip": "Last Login IP", "login_ip": "Last Login IP",
"last_login_time": "Last Login Time", "last_login_time": "Last Login Time",
@@ -2349,6 +2434,7 @@
"password_not_match": "Passwords do not match", "password_not_match": "Passwords do not match",
"password_length": "Length should be 6 to 64 characters", "password_length": "Length should be 6 to 64 characters",
"username_length": "Length should be 3 to 20 characters", "username_length": "Length should be 3 to 20 characters",
"username_exists": "Username already exists. Please use another username",
"cannot_delete_self": "Cannot delete own account", "cannot_delete_self": "Cannot delete own account",
"cannot_operate_self": "Cannot operate own account", "cannot_operate_self": "Cannot operate own account",
"batch_delete": "Batch Delete", "batch_delete": "Batch Delete",
@@ -2599,7 +2685,36 @@
"user": { "user": {
"greeting": "Hello {name}", "greeting": "Hello {name}",
"not_logged_in": "Not logged in", "not_logged_in": "Not logged in",
"logout": "Logout" "logout": "Logout",
"api_debug": "API Debug",
"change_password": "Change Password",
"reload_menu": "Reload Menu",
"product_authorization": "Product Authorization",
"original_password": "Old Password",
"new_password": "New Password",
"confirm_password": "Confirm Password",
"placeholder_original_password": "Please enter old password",
"placeholder_new_password": "Please enter new password",
"placeholder_confirm_password": "Please confirm new password",
"old_password_required": "Please enter old password",
"new_password_required": "Please enter new password",
"confirm_password_required": "Please confirm new password",
"length_6_to_64": "Length should be 6 to 64 characters",
"password_same_error": "Old password cannot be the same as new password",
"password_not_match": "The two new passwords do not match",
"password_change_success": "Password changed successfully. Please log in again",
"menu_permission_reloaded": "Menu permissions reloaded",
"authorization_validity_period": "Authorization Validity",
"drag_upload_hint": "Drop the license file here, or ",
"click_upload": "click to upload",
"upload_file_tip": "Only .license authorization files are allowed",
"please_upload_license": "Please upload a license file",
"authorization_update_success": "Authorization validity updated: {time}",
"authorization_expired_message": "Product authorization time: {time}. Authorization has expired and APIs will be unavailable. Please verify the license again.",
"authorization_near_message": "Product authorization is about to expire. APIs will be unavailable after expiration. {message}",
"prompt": "Prompt",
"cancel": "Cancel",
"confirm": "Confirm"
}, },
"fullscreen": { "fullscreen": {
"enter": "Fullscreen", "enter": "Fullscreen",
@@ -2829,6 +2944,7 @@
"no": "No", "no": "No",
"verify_data": "Verify Data", "verify_data": "Verify Data",
"change_process": "Change Process", "change_process": "Change Process",
"change_process_success": "Process changed successfully",
"multi_battery_input": "Multi-Battery Input", "multi_battery_input": "Multi-Battery Input",
"input_rule": "Rule: One barcode per line", "input_rule": "Rule: One barcode per line",
"please_enter_battery_id_data": "Enter battery barcode data", "please_enter_battery_id_data": "Enter battery barcode data",
@@ -2842,7 +2958,11 @@
"current_process": "Current Process" "current_process": "Current Process"
}, },
"equipment_monitoring": { "equipment_monitoring": {
"query": "Search",
"reset": "Reset",
"device_total": "Total Devices", "device_total": "Total Devices",
"device_category": "Device Category",
"select_device_category": "Please select device category",
"device_code": "Device Code", "device_code": "Device Code",
"device_name": "Device Name", "device_name": "Device Name",
"area": "Plant Area", "area": "Plant Area",

View File

@@ -27,7 +27,6 @@
"create_success": "新增成功", "create_success": "新增成功",
"edit_success": "编辑成功", "edit_success": "编辑成功",
"delete_success": "删除成功", "delete_success": "删除成功",
"sort": "序号",
"code": "所区编码", "code": "所区编码",
"name": "所区名称", "name": "所区名称",
"remark": "备注", "remark": "备注",
@@ -44,7 +43,11 @@
"tip": "提示", "tip": "提示",
"confirm_delete": "确定要执行该操作吗?", "confirm_delete": "确定要执行该操作吗?",
"validation_fail": "校验失败", "validation_fail": "校验失败",
"please_enter": "请输入{name}" "please_enter": "请输入{name}",
"export": "导出",
"confirm_export": "确认创建导出任务?",
"length_1_100": "长度在 1 到 100 个字符",
"remark_max_500": "备注不能超过 500 个字符"
}, },
"production_line": { "production_line": {
"search": "查询", "search": "查询",
@@ -53,7 +56,6 @@
"enter_name": "请输入产线名称", "enter_name": "请输入产线名称",
"enter_remark": "请输入备注", "enter_remark": "请输入备注",
"operation_success": "操作成功", "operation_success": "操作成功",
"sort": "序号",
"code": "产线编码", "code": "产线编码",
"name": "产线名称", "name": "产线名称",
"area": "所区", "area": "所区",
@@ -71,7 +73,11 @@
"confirm": "确定", "confirm": "确定",
"tip": "提示", "tip": "提示",
"confirm_delete": "确定要执行该操作吗?", "confirm_delete": "确定要执行该操作吗?",
"validation_fail": "校验失败" "validation_fail": "校验失败",
"export": "导出",
"confirm_export": "确认创建导出任务?",
"length_1_100": "长度在 1 到 100 个字符",
"remark_max_500": "备注不能超过 500 个字符"
} }
}, },
"process_model": { "process_model": {
@@ -120,6 +126,8 @@
"enter_process_unit_code": "请输入工序单元编码", "enter_process_unit_code": "请输入工序单元编码",
"enter_process_unit_name": "请输入工序单元名称", "enter_process_unit_name": "请输入工序单元名称",
"select_device_category": "请选择设备类别", "select_device_category": "请选择设备类别",
"login_process": "是否登录工序",
"select_login_process": "请选择是否登录工序",
"remark_required": "请输入备注", "remark_required": "请输入备注",
"preset_setting": "预设设定值", "preset_setting": "预设设定值",
"add_process_unit": "新增工序单元", "add_process_unit": "新增工序单元",
@@ -139,6 +147,7 @@
"no": "否", "no": "否",
"is_upload": "是否上传", "is_upload": "是否上传",
"need_device_upload": "是否需要设备上传", "need_device_upload": "是否需要设备上传",
"multi_step_not_unique": "多工步同名称参数时设置为否",
"add_row": "新增一行", "add_row": "新增一行",
"import": "导入", "import": "导入",
"close": "关闭", "close": "关闭",
@@ -152,7 +161,18 @@
"delete_success": "删除成功", "delete_success": "删除成功",
"setting_placeholder": "预设设定值配置区域", "setting_placeholder": "预设设定值配置区域",
"setting_tip": "在此配置工序单元的预设设定值", "setting_tip": "在此配置工序单元的预设设定值",
"import_tip": "导入功能开发中" "preset_result_param_import": "预设结果参数导入",
"file_suffix_rule": "上传的文件后缀必须是 xlsx 或 xls且根据模板上传否则不能上传成功",
"import_table": "导入表格",
"select_file": "选择文件",
"download_template": "下载模板",
"preview": "预览",
"upload_format_error": "请上传 xls 或 xlsx 文件",
"please_import_data": "请先导入数据",
"optional_param_import_template": "可选参数导入模板",
"import_missing_column": "文件不存在【{name}】数据列,请检查",
"import_duplicate_name": "【{name}】名称存在重复值,请去掉重复值并重新上传",
"import_duplicate_param": "【{param}】参数存在重复值,请去掉重复值并重新上传"
}, },
"process_routing": { "process_routing": {
"search": "查询", "search": "查询",
@@ -222,9 +242,19 @@
"tip": "提示", "tip": "提示",
"confirm_delete": "确定要删除该工序吗?", "confirm_delete": "确定要删除该工序吗?",
"operation_success": "操作成功", "operation_success": "操作成功",
"validation_fail": "校验失败",
"length_1_100": "长度在 1 到 100 个字符", "length_1_100": "长度在 1 到 100 个字符",
"batch_bound_no_move": "已绑定批次,不可移动", "batch_bound_no_move": "已绑定批次,不可移动",
"select_category": "请选择流程类别", "select_category": "请选择流程类别",
"rest_time": "静置时间",
"enter_rest_time": "请输入静置时间",
"precision_range": "精度范围",
"enter_precision_range": "请输入精度范围",
"minute": "分钟",
"integer_ge_0": "请输入大于等于 0 的整数",
"input_empty": "输入内容不能为空",
"json_format_error": "JSON 格式不正确",
"enter_setting_json": "请输入设定值 JSON",
"log_operation_step": "操作工序:", "log_operation_step": "操作工序:",
"search": "搜索", "search": "搜索",
"query": "查询", "query": "查询",
@@ -675,6 +705,28 @@
"confirm_delete": "确定要删除该SPC采集配置吗?", "confirm_delete": "确定要删除该SPC采集配置吗?",
"validation_fail": "校验失败", "validation_fail": "校验失败",
"please_enter": "请输入{name}", "please_enter": "请输入{name}",
"result_param": "结果参数",
"result_param_code": "结果参数编码",
"result_param_name": "结果参数名称",
"enter_result_param_code": "请输入结果参数编码",
"enter_result_param_name": "请输入结果参数名称",
"scada_node_code": "SCADA节点编码",
"scada_node_name": "SCADA节点名称",
"enter_scada_node_code": "请输入SCADA节点编码",
"enter_scada_node_name": "请输入SCADA节点名称",
"working_subclass": "工序",
"select_working_subclass": "请选择工序",
"category": "类别",
"select_data_type": "请选择数据类型",
"select_result_param": "请选择结果参数",
"select_scada_node": "请选择SCADA节点",
"result_param_type": "结果参数类型",
"process_inspection": "过程检验",
"result_data": "结果数据",
"measurement_type": "计量型",
"count_type": "计数型",
"create_time": "创建时间",
"update_data": "更新时间",
"help": "配置SPC数据采集参数绑定SCADA节点" "help": "配置SPC数据采集参数绑定SCADA节点"
} }
}, },
@@ -810,16 +862,21 @@
"add": "新增", "add": "新增",
"edit": "编辑", "edit": "编辑",
"delete": "删除", "delete": "删除",
"batch_delete": "批量删除",
"import": "导入",
"export": "导出", "export": "导出",
"operation": "操作", "operation": "操作",
"add_title": "新增", "add_title": "新增设备信息",
"edit_title": "编辑", "edit_title": "编辑设备信息",
"confirm": "确定", "confirm": "确定",
"cancel": "取消", "cancel": "取消",
"tip": "提示", "tip": "提示",
"confirm_delete": "确认删除该记录?", "confirm_delete": "确认删除该记录?",
"confirm_batch_delete": "确认批量删除选中的设备信息?",
"confirm_export": "确认创建导出任务?", "confirm_export": "确认创建导出任务?",
"operation_success": "操作成功", "operation_success": "操作成功",
"create_download_task_success": "创建下载任务成功",
"please_select_data": "请选择数据",
"keyword": "关键字", "keyword": "关键字",
"enter_keyword": "请输入关键字", "enter_keyword": "请输入关键字",
"remark": "备注", "remark": "备注",
@@ -831,14 +888,41 @@
"enter_device_code": "请输入设备编码", "enter_device_code": "请输入设备编码",
"device_name": "设备名称", "device_name": "设备名称",
"enter_device_name": "请输入设备名称", "enter_device_name": "请输入设备名称",
"device_category": "设备类别",
"select_device_category": "请选择设备类别",
"design_ppm": "设计PPM",
"enter_design_ppm": "请输入设计PPM",
"ip": "IP",
"enter_ip": "请输入IP",
"manufacturer": "厂商",
"enter_manufacturer": "请输入厂商",
"fixed_asset_code": "设备固定资产编码",
"enter_fixed_asset_code": "请输入设备固定资产编码",
"entry_time": "进场时间",
"select_entry_time": "请选择进场时间",
"device_id": "设备ID", "device_id": "设备ID",
"enter_device_id": "请输入设备ID", "enter_device_id": "请输入设备ID",
"device_type": "设备类别", "device_type": "设备类别",
"enter_device_type": "请输入设备类别", "enter_device_type": "请输入设备类别",
"area": "所属区域", "area": "所属区域",
"enter_area": "请输入所属区域", "enter_area": "请输入所属区域",
"select_area": "请选择所区",
"line": "所属产线", "line": "所属产线",
"enter_line": "请输入所属产线", "enter_line": "请输入所属产线",
"production_line": "产线",
"select_production_line": "请选择产线",
"select_factory_first": "请先选择所区",
"length_1_100": "长度在 1 到 100 个字符",
"device_data_import": "设备信息导入",
"import_warning": "上传的文件后缀必须是 xlsx 或 xls且根据模板上传否则不能上传成功",
"import_table": "导入表格",
"select_file": "选择文件",
"download_template": "下载模板",
"preview": "预览",
"import_template_name": "设备数据导入模板",
"import_file_format_error": "请上传 xls 或 xlsx 文件",
"import_missing_column": "文件不存在【{name}】数据列,请检查",
"import_no_data": "请先导入数据",
"standard": "标准", "standard": "标准",
"enter_standard": "请输入标准", "enter_standard": "请输入标准",
"inspection_item_code": "点检项目编码", "inspection_item_code": "点检项目编码",
@@ -2323,6 +2407,7 @@
"status": "状态", "status": "状态",
"enable": "启用", "enable": "启用",
"disable": "禁用", "disable": "禁用",
"select_status": "请选择状态",
"user_group": "用户组", "user_group": "用户组",
"login_ip": "上次登录IP", "login_ip": "上次登录IP",
"last_login_time": "上次登录时间", "last_login_time": "上次登录时间",
@@ -2349,6 +2434,7 @@
"password_not_match": "两次输入的密码不一致", "password_not_match": "两次输入的密码不一致",
"password_length": "长度在 6 到 64 个字符", "password_length": "长度在 6 到 64 个字符",
"username_length": "长度在 3 到 20 个字符", "username_length": "长度在 3 到 20 个字符",
"username_exists": "账号已存在,请更换账号",
"cannot_delete_self": "不能删除自己的账号", "cannot_delete_self": "不能删除自己的账号",
"cannot_operate_self": "不能操作自己的账号", "cannot_operate_self": "不能操作自己的账号",
"batch_delete": "批量删除", "batch_delete": "批量删除",
@@ -2599,7 +2685,36 @@
"user": { "user": {
"greeting": "你好 {name}", "greeting": "你好 {name}",
"not_logged_in": "未登录", "not_logged_in": "未登录",
"logout": "注销" "logout": "注销",
"api_debug": "API调试",
"change_password": "修改密码",
"reload_menu": "重新加载菜单",
"product_authorization": "产品授权",
"original_password": "原密码",
"new_password": "新密码",
"confirm_password": "确认密码",
"placeholder_original_password": "请输入原密码",
"placeholder_new_password": "请输入新密码",
"placeholder_confirm_password": "请输入确认密码",
"old_password_required": "请输入原密码",
"new_password_required": "请输入新密码",
"confirm_password_required": "请输入确认密码",
"length_6_to_64": "长度在 6 到 64 个字符",
"password_same_error": "原密码不能与新密码相同",
"password_not_match": "两次输入的新密码不一致",
"password_change_success": "密码修改成功,请重新登录",
"menu_permission_reloaded": "菜单权限已重新载入",
"authorization_validity_period": "授权有效期",
"drag_upload_hint": "将 license 文件拖到此处,或",
"click_upload": "点击上传",
"upload_file_tip": "只能上传 .license 授权文件",
"please_upload_license": "请上传 license 文件",
"authorization_update_success": "授权有效期更新成功:{time}",
"authorization_expired_message": "产品授权时间:{time},授权已过期,接口将无法使用。请重新验证授权序列号!",
"authorization_near_message": "产品授权即将到期,授权过期时,数据接口将无法使用。{message}",
"prompt": "提示",
"cancel": "取消",
"confirm": "确定"
}, },
"fullscreen": { "fullscreen": {
"enter": "全屏", "enter": "全屏",
@@ -2829,6 +2944,7 @@
"no": "否", "no": "否",
"verify_data": "验证数据", "verify_data": "验证数据",
"change_process": "更改工序", "change_process": "更改工序",
"change_process_success": "工序跳转成功",
"multi_battery_input": "多电池条码输入", "multi_battery_input": "多电池条码输入",
"input_rule": "输入规则:每个电池条码占一行输入", "input_rule": "输入规则:每个电池条码占一行输入",
"please_enter_battery_id_data": "请输入电池条码数据", "please_enter_battery_id_data": "请输入电池条码数据",
@@ -2842,7 +2958,11 @@
"current_process": "当前工序" "current_process": "当前工序"
}, },
"equipment_monitoring": { "equipment_monitoring": {
"query": "查询",
"reset": "重置",
"device_total": "设备总数", "device_total": "设备总数",
"device_category": "设备类别",
"select_device_category": "请选择设备类别",
"device_code": "设备编码", "device_code": "设备编码",
"device_name": "设备名称", "device_name": "设备名称",
"area": "厂区", "area": "厂区",
@@ -2960,7 +3080,7 @@
"end_time": "结束时间" "end_time": "结束时间"
}, },
"rework_management": { "rework_management": {
"active": "激活", "active": "激活",
"not_activated": "未激活", "not_activated": "未激活",
"reset": "重置", "reset": "重置",
"battery_id": "电池条码", "battery_id": "电池条码",

View File

@@ -4,22 +4,25 @@
<div class="search-bar"> <div class="search-bar">
<el-form :inline="true" size="mini"> <el-form :inline="true" size="mini">
<el-form-item :label="$t(key('device_code'))"> <el-form-item :label="$t(key('device_code'))">
<el-input <el-input v-model="search.code" :placeholder="$t(key('enter_device_code'))" clearable style="width:180px" @keyup.enter.native="onSearch" />
v-model="search.device_code"
:placeholder="$t(key('enter_device_code'))"
clearable
style="width:200px"
@keyup.enter.native="onSearch"
/>
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('device_name'))"> <el-form-item :label="$t(key('device_name'))">
<el-input <el-input v-model="search.name" :placeholder="$t(key('enter_device_name'))" clearable style="width:180px" @keyup.enter.native="onSearch" />
v-model="search.device_name" </el-form-item>
:placeholder="$t(key('enter_device_name'))" <el-form-item :label="$t(key('device_category'))">
clearable <el-select v-model="search.device_category_id" :placeholder="$t(key('select_device_category'))" clearable filterable style="width:180px" @focus="loadDeviceCategories">
style="width:200px" <el-option v-for="item in deviceCategoryOptions" :key="item.value" :label="item.label" :value="item.value" />
@keyup.enter.native="onSearch" </el-select>
/> </el-form-item>
<el-form-item :label="$t(key('area'))">
<el-select v-model="search.area_id" :placeholder="$t(key('select_area'))" clearable filterable style="width:180px" @focus="loadAreas" @change="onSearchAreaChange">
<el-option v-for="item in areaOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t(key('production_line'))">
<el-select v-model="search.line_id" :placeholder="$t(key('select_production_line'))" clearable filterable style="width:180px" @focus="loadSearchLines">
<el-option v-for="item in searchLineOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onSearch">{{ $t(key('search')) }}</el-button> <el-button type="primary" icon="el-icon-search" @click="onSearch">{{ $t(key('search')) }}</el-button>
@@ -42,21 +45,131 @@
@selection-change="onSelect" @selection-change="onSelect"
/> />
<page-dialog-form <el-dialog
ref="dialogForm" :title="$t(dialogTitle)"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="dialogTitle" width="60%"
width="40%" :close-on-click-modal="false"
:form-cols="formCols" destroy-on-close
:form-data="formData"
:rules="rules"
label-width="130px"
:submitting="submitting"
:confirm-text="key('confirm')"
:cancel-text="key('cancel')"
@submit="onDialogSubmit"
@close="onDialogClose" @close="onDialogClose"
/> >
<el-form ref="form" class="equipment-form" :model="formData" :rules="rules" label-width="130px" size="mini">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item :label="$t(key('device_code'))" prop="code">
<el-input v-model="formData.code" :placeholder="$t(key('enter_device_code'))" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('ip'))" prop="ip">
<el-input v-model="formData.ip" :placeholder="$t(key('enter_ip'))" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('device_name'))" prop="name">
<el-input v-model="formData.name" :placeholder="$t(key('enter_device_name'))" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('manufacturer'))" prop="manufacturer">
<el-input v-model="formData.manufacturer" :placeholder="$t(key('enter_manufacturer'))" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('device_category'))" prop="device_category_id">
<el-select v-model="formData.device_category_id" :placeholder="$t(key('select_device_category'))" clearable filterable style="width:100%" @focus="loadDeviceCategories">
<el-option v-for="item in deviceCategoryOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('fixed_asset_code'))" prop="fixed_asset_code">
<el-input v-model="formData.fixed_asset_code" :placeholder="$t(key('enter_fixed_asset_code'))" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('design_ppm'))" prop="design_ppm">
<el-input v-model="formData.design_ppm" :placeholder="$t(key('enter_design_ppm'))" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('entry_time'))" prop="entry_time">
<el-date-picker v-model="formData.entry_time" type="date" value-format="yyyy-MM-dd" :placeholder="$t(key('select_entry_time'))" clearable style="width:100%" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('area'))" prop="area_id">
<el-select v-model="formData.area_id" :placeholder="$t(key('select_area'))" clearable filterable style="width:100%" @focus="loadAreas" @change="onFormAreaChange">
<el-option v-for="item in areaOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t(key('production_line'))" prop="line_id">
<el-select v-model="formData.line_id" :placeholder="$t(key('select_production_line'))" clearable filterable style="width:100%" @focus="loadFormLines">
<el-option v-for="item in formLineOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="$t(key('remark'))" prop="remark">
<el-input v-model="formData.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 6 }" :placeholder="$t(key('enter_remark'))" clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer">
<el-button @click="dialogVisible = false">{{ $t(key('cancel')) }}</el-button>
<el-button type="primary" :loading="submitting" @click="onDialogSubmit">{{ $t(key('confirm')) }}</el-button>
</div>
</el-dialog>
<el-dialog
:title="$t(key('device_data_import'))"
:visible.sync="importVisible"
width="70%"
append-to-body
:close-on-click-modal="false"
@close="resetImport"
>
<el-alert :title="$t(key('import_warning'))" :closable="false" type="warning" show-icon />
<el-form label-width="130px" class="import-form">
<el-form-item :label="$t(key('import_table'))">
<el-upload
action=""
:multiple="false"
:auto-upload="false"
:show-file-list="true"
:file-list="importFileList"
accept=".xls,.xlsx"
:on-change="onImportFileChange"
>
<el-button slot="trigger" size="mini" type="success">{{ $t(key('select_file')) }}</el-button>
<el-button style="margin-left:10px" size="mini" type="primary" :loading="importTemplateLoading" @click.stop="downloadTemplate">
{{ $t(key('download_template')) }}
</el-button>
</el-upload>
</el-form-item>
<el-form-item :label="$t(key('preview'))">
<el-table v-loading="importTableLoading" :data="importRows" border height="360">
<el-table-column prop="code" :label="$t(key('device_code'))" min-width="120" />
<el-table-column prop="name" :label="$t(key('device_name'))" min-width="120" />
<el-table-column prop="device_category_name" :label="$t(key('device_category'))" min-width="120" />
<el-table-column prop="line_name" :label="$t(key('production_line'))" min-width="120" />
<el-table-column prop="ip" :label="$t(key('ip'))" min-width="120" />
<el-table-column prop="design_ppm" :label="$t(key('design_ppm'))" min-width="100" />
<el-table-column prop="manufacturer" :label="$t(key('manufacturer'))" min-width="120" />
<el-table-column prop="fixed_asset_code" :label="$t(key('fixed_asset_code'))" min-width="140" />
<el-table-column prop="entry_time" :label="$t(key('entry_time'))" min-width="120" />
<el-table-column prop="remark" :label="$t(key('remark'))" min-width="160" show-overflow-tooltip />
</el-table>
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="importVisible = false">{{ $t(key('cancel')) }}</el-button>
<el-button type="primary" :loading="importSubmitting" @click="submitImport">{{ $t(key('confirm')) }}</el-button>
</div>
</el-dialog>
</d2-container> </d2-container>
</template> </template>
@@ -66,12 +179,24 @@ import { useTableButtons } from '@/composables/useTableButtons'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import { confirmMixin } from '@/composables/useConfirmHandle' import { confirmMixin } from '@/composables/useConfirmHandle'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import PageDialogForm from '@/components/page-dialog-form' import {
import { getList, createItem, editItem, deleteItem, createExportTask } from '@/api/equipment-management/equipment-registry' getList,
createItem,
editItem,
deleteItem,
batchDeleteItems,
getImportTemplate,
importData,
createExportTask
} from '@/api/equipment-management/equipment-registry'
import { getEquipmentCategoryALL } from '@/api/equipment-management/equipment-category'
import { getFactoryAreaALL } from '@/api/production-master-data/factory-area'
import { getProductionLineALL } from '@/api/production-master-data/production-line'
import { downloadRename, readExcel } from '@/utils/file'
export default { export default {
name: 'equipment-management-equipment-registry', name: 'equipment-management-equipment-registry',
components: { PageTable, PageDialogForm }, components: { PageTable },
mixins: [i18nMixin('page.equipment_management.equipment_model.equipment_registry'), confirmMixin], mixins: [i18nMixin('page.equipment_management.equipment_model.equipment_registry'), confirmMixin],
data () { data () {
return { return {
@@ -83,122 +208,64 @@ export default {
dialogTitle: '', dialogTitle: '',
editId: '', editId: '',
handleType: 'create', handleType: 'create',
search: { search: { code: '', name: '', device_category_id: '', area_id: '', line_id: '' },
device_code: '',
device_name: ''
},
pagination: { current: 1, size: 10, total: 0 }, pagination: { current: 1, size: 10, total: 0 },
formData: { formData: this.emptyForm(),
device_code: '', deviceCategoryOptions: [],
device_name: '', areaOptions: [],
device_type_id: '', searchLineOptions: [],
device_status: '', formLineOptions: [],
area_id: '', importVisible: false,
line_id: '', importFileList: [],
remark: '' importRows: [],
}, importTableLoading: false,
importTemplateLoading: false,
importSubmitting: false,
rules: { rules: {
device_code: [{ required: true, message: this.key('enter_device_code'), trigger: 'blur' }], code: [
device_name: [{ required: true, message: this.key('enter_device_name'), trigger: 'blur' }] { required: true, message: this.key('enter_device_code'), trigger: 'blur' },
{ min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
],
name: [
{ required: true, message: this.key('enter_device_name'), trigger: 'blur' },
{ min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
],
device_category_id: [{ required: true, message: this.key('select_device_category'), trigger: 'change' }],
area_id: [{ required: true, message: this.key('select_area'), trigger: 'change' }],
line_id: [{ required: true, message: this.key('select_production_line'), trigger: 'change' }],
design_ppm: [{ required: true, message: this.key('enter_design_ppm'), trigger: 'blur' }]
}, },
columns: [], columns: [],
toolbarButtons: [], toolbarButtons: [],
rowButtons: [], rowButtons: []
formCols: [
[
{
type: 'input',
prop: 'device_code',
label: this.key('device_code'),
placeholder: this.key('enter_device_code'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'device_name',
label: this.key('device_name'),
placeholder: this.key('enter_device_name'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'device_type_id',
label: this.key('device_type'),
placeholder: this.key('enter_device_type'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'device_status',
label: this.key('status'),
placeholder: this.key('enter_status'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'area_id',
label: this.key('area'),
placeholder: this.key('enter_area'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'line_id',
label: this.key('line'),
placeholder: this.key('enter_line'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'remark',
label: this.key('remark'),
placeholder: this.key('enter_remark'),
inputType: 'textarea',
autosize: { minRows: 2, maxRows: 6 },
clearable: true,
style: { width: '90%' }
}
]
]
} }
}, },
created () { created () {
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'device_code', label: this.key('device_code'), minWidth: 140 }, { prop: 'code', label: this.key('device_code'), minWidth: 130 },
{ prop: 'device_name', label: this.key('device_name'), minWidth: 140 }, { prop: 'name', label: this.key('device_name'), minWidth: 130 },
{ prop: 'device_type_name', label: this.key('device_type'), minWidth: 140 }, { prop: 'device_category_name', label: this.key('device_category'), minWidth: 130 },
{ prop: 'device_status', label: this.key('status'), minWidth: 140 }, { prop: 'design_ppm', label: this.key('design_ppm'), minWidth: 110 },
{ prop: 'area_name', label: this.key('area'), minWidth: 140 }, { prop: 'area_name', label: this.key('area'), minWidth: 120 },
{ prop: 'line_name', label: this.key('line'), minWidth: 140 }, { prop: 'line_name', label: this.key('production_line'), minWidth: 120 },
{ prop: 'remark', label: this.key('remark'), minWidth: 140 }, { prop: 'ip', label: this.key('ip'), minWidth: 120 },
{ prop: 'manufacturer', label: this.key('manufacturer'), minWidth: 130 },
{ prop: 'fixed_asset_code', label: this.key('fixed_asset_code'), minWidth: 150 },
{ prop: 'entry_time', label: this.key('entry_time'), minWidth: 120 },
{ prop: 'remark', label: this.key('remark'), minWidth: 160 },
{ prop: 'create_time', label: this.key('create_time'), minWidth: 160 },
{ prop: '_actions', label: this.key('operation'), width: 170, fixed: 'right' } { prop: '_actions', label: this.key('operation'), width: 170, fixed: 'right' }
]) ])
const btns = useTableButtons({ const btns = useTableButtons({
toolbar: [ toolbar: [
{ key: 'add', label: this.key('add'), icon: 'el-icon-plus', type: 'primary', auth: '/device_management/device_model/device_management/create', onClick: this.openAdd }, { key: 'add', label: this.key('add'), icon: 'el-icon-plus', type: 'primary', auth: '/production_configuration/device_model/device_management/create', onClick: this.openAdd },
{ key: 'export', label: this.key('export'), icon: 'el-icon-download', auth: '/device_management/device_model/device_management/export', onClick: this.handleExport } { key: 'batchDelete', label: this.key('batch_delete'), icon: 'el-icon-delete', type: 'danger', auth: '/production_configuration/device_model/device_management/batch-delete', needSelection: true, onClick: this.handleBatchDelete },
{ key: 'import', label: this.key('import'), icon: 'el-icon-upload2', type: 'success', auth: '/production_configuration/device_model/device_management/import', onClick: this.openImport },
{ key: 'export', label: this.key('export'), icon: 'el-icon-download', auth: '/production_configuration/device_model/device_management/export', onClick: this.handleExport }
], ],
row: [ row: [
{ key: 'edit', label: this.key('edit'), icon: 'el-icon-edit', auth: '/device_management/device_model/device_management/edit', onClick: this.openEdit }, { key: 'edit', label: this.key('edit'), icon: 'el-icon-edit', auth: '/production_configuration/device_model/device_management/edit', onClick: this.openEdit },
{ key: 'delete', label: this.key('delete'), icon: 'el-icon-delete', color: 'danger', auth: '/device_management/device_model/device_management/delete', onClick: this.handleDelete } { key: 'delete', label: this.key('delete'), icon: 'el-icon-delete', color: 'danger', auth: '/production_configuration/device_model/device_management/delete', onClick: this.handleDelete }
] ]
}, this.$permission) }, this.$permission)
this.toolbarButtons = btns.toolbarButtons this.toolbarButtons = btns.toolbarButtons
@@ -206,11 +273,34 @@ export default {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
emptyForm () {
return {
code: '',
name: '',
ip: '',
manufacturer: '',
device_category_id: '',
fixed_asset_code: '',
design_ppm: '',
area_id: '',
line_id: '',
entry_time: '',
remark: ''
}
},
normalizeResponse (res) { normalizeResponse (res) {
const data = res && res.data !== undefined ? res.data : res const getTotal = (source, fallback) => {
if (Array.isArray(data)) return { list: data, total: data.length } if (!source) return fallback
if (data && Array.isArray(data.data)) return { list: data.data, total: Number(data.count || data.total || data.data.length) } const total = source.count ?? source.total ?? source.total_count ?? source.record_count
if (data && data.data && Array.isArray(data.data.data)) return { list: data.data.data, total: Number(data.data.count || data.data.total || data.data.data.length) } const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) return { list: item, total: getTotal(res, item.length) }
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) return { list, total: getTotal(item, getTotal(res, list.length)) }
}
return { list: [], total: 0 } return { list: [], total: 0 }
}, },
async fetchData () { async fetchData () {
@@ -229,12 +319,9 @@ export default {
this.fetchData() this.fetchData()
}, },
onReset () { onReset () {
this.search = { this.search = { code: '', name: '', device_category_id: '', area_id: '', line_id: '' }
device_code: '', this.searchLineOptions = []
device_name: '' this.onSearch()
}
this.pagination.current = 1
this.fetchData()
}, },
onPageChange (page) { onPageChange (page) {
this.pagination.current = page.current this.pagination.current = page.current
@@ -244,43 +331,64 @@ export default {
onSelect (rows) { onSelect (rows) {
this.selectedRows = rows this.selectedRows = rows
}, },
resetForm () { async loadDeviceCategories () {
this.formData = { if (this.deviceCategoryOptions.length) return
device_code: '', const res = await getEquipmentCategoryALL()
device_name: '', this.deviceCategoryOptions = this.normalizeResponse(res).list.map(item => ({ label: item.name, value: item.id, code: item.code }))
device_type_id: '', },
device_status: '', async loadAreas () {
area_id: '', if (this.areaOptions.length) return
line_id: '', const res = await getFactoryAreaALL()
remark: '' this.areaOptions = this.normalizeResponse(res).list.map(item => ({ label: item.name, value: item.area_id || item.id }))
},
async loadLines (areaId) {
if (!areaId) {
this.$message.warning(this.$t(this.key('select_factory_first')))
return []
} }
const res = await getProductionLineALL({ area_id: areaId })
return this.normalizeResponse(res).list.map(item => ({ label: item.name, value: item.id }))
},
async loadSearchLines () {
this.searchLineOptions = await this.loadLines(this.search.area_id)
},
async loadFormLines () {
this.formLineOptions = await this.loadLines(this.formData.area_id)
},
onSearchAreaChange () {
this.search.line_id = ''
this.searchLineOptions = []
},
onFormAreaChange () {
this.formData.line_id = ''
this.formLineOptions = []
},
resetForm () {
this.formData = this.emptyForm()
this.editId = '' this.editId = ''
this.formLineOptions = []
this.$nextTick(() => this.$refs.form && this.$refs.form.clearValidate())
}, },
openAdd () { openAdd () {
this.handleType = 'create' this.handleType = 'create'
this.dialogTitle = this.key('add_title') this.dialogTitle = this.key('add_title')
this.$nextTick(() => {
this.$refs.dialogForm && this.$refs.dialogForm.reset()
this.resetForm() this.resetForm()
this.loadDeviceCategories()
this.loadAreas()
this.dialogVisible = true this.dialogVisible = true
})
}, },
openEdit (row) { async openEdit (row) {
this.handleType = 'edit' this.handleType = 'edit'
this.dialogTitle = this.key('edit_title') this.dialogTitle = this.key('edit_title')
this.editId = row.id this.editId = row.id
this.formData = { this.formData = { ...this.emptyForm(), ...row }
device_code: row.device_code || '', await Promise.all([this.loadDeviceCategories(), this.loadAreas()])
device_name: row.device_name || '', if (this.formData.area_id) this.formLineOptions = await this.loadLines(this.formData.area_id)
device_type_id: row.device_type_id || '',
device_status: row.device_status || '',
area_id: row.area_id || '',
line_id: row.line_id || '',
remark: row.remark || ''
}
this.dialogVisible = true this.dialogVisible = true
}, },
async onDialogSubmit () { onDialogSubmit () {
this.$refs.form.validate(async valid => {
if (!valid) return
this.submitting = true this.submitting = true
try { try {
if (this.handleType === 'create') await createItem(this.formData) if (this.handleType === 'create') await createItem(this.formData)
@@ -291,33 +399,121 @@ export default {
} finally { } finally {
this.submitting = false this.submitting = false
} }
})
}, },
onDialogClose () { onDialogClose () {
this.resetForm() this.resetForm()
}, },
async handleDelete (row) { async handleDelete (row) {
const cancelled = await this.$confirmAction( const cancelled = await this.$confirmAction({ message: this.key('confirm_delete'), title: this.key('tip') }, () => deleteItem({ id: [row.id] }))
{ message: this.key('confirm_delete'), title: this.key('tip') },
() => deleteItem({ id: [row.id] })
)
if (cancelled) return if (cancelled) return
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.pagination.current = Math.min(this.pagination.current, Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1) this.pagination.current = Math.min(this.pagination.current, Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1)
this.fetchData() this.fetchData()
}, },
async handleExport () { async handleBatchDelete () {
const cancelled = await this.$confirmAction( if (!this.selectedRows.length) {
{ message: this.key('confirm_export'), title: this.key('tip') }, this.$message.error(this.$t(this.key('please_select_data')))
() => createExportTask({ ...this.search }) return
) }
const ids = this.selectedRows.map(item => item.id)
const cancelled = await this.$confirmAction({ message: this.key('confirm_batch_delete'), title: this.key('tip') }, () => batchDeleteItems({ id: ids }))
if (cancelled) return if (cancelled) return
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.fetchData()
},
openImport () {
this.resetImport()
this.importVisible = true
},
resetImport () {
this.importFileList = []
this.importRows = []
},
async downloadTemplate () {
this.importTemplateLoading = true
try {
const res = await getImportTemplate({})
downloadRename(res, 'xlsx', this.$t(this.key('import_template_name')))
} finally {
this.importTemplateLoading = false
}
},
getImportValue (row, names) {
for (const name of names) {
if (row[name] !== undefined && row[name] !== null) return row[name]
}
return ''
},
async onImportFileChange (file) {
if (!file || !/\.(xls|xlsx)$/i.test(file.name)) {
this.$message.error(this.$t(this.key('import_file_format_error')))
this.importFileList = []
return
}
this.importFileList = [file]
this.importTableLoading = true
try {
const rows = await readExcel(file.raw)
const required = ['设备编码', '设备名称', 'IP', '设备类别', '产线', '设计PPM', '厂商', '设备固定资产编码', '进场时间', '备注']
const first = rows[0] || {}
const missing = required.find(name => !Object.prototype.hasOwnProperty.call(first, name))
if (missing) {
this.$message.error(this.$t(this.key('import_missing_column'), { name: missing }))
this.importRows = []
return
}
this.importRows = rows.map(row => ({
code: this.getImportValue(row, ['设备编码']),
name: this.getImportValue(row, ['设备名称']),
ip: this.getImportValue(row, ['IP']),
device_category_name: this.getImportValue(row, ['设备类别']),
line_name: this.getImportValue(row, ['产线']),
design_ppm: this.getImportValue(row, ['设计PPM']),
manufacturer: this.getImportValue(row, ['厂商']),
fixed_asset_code: this.getImportValue(row, ['设备固定资产编码']),
entry_time: this.getImportValue(row, ['进场时间']),
remark: this.getImportValue(row, ['备注'])
}))
} finally {
this.importTableLoading = false
}
},
async submitImport () {
if (!this.importRows.length) {
this.$message.error(this.$t(this.key('import_no_data')))
return
}
this.importSubmitting = true
try {
await importData({ import_data: JSON.stringify(this.importRows) })
this.$message.success(this.$t(this.key('operation_success')))
this.importVisible = false
this.fetchData()
} finally {
this.importSubmitting = false
}
},
async handleExport () {
const cancelled = await this.$confirmAction({ message: this.key('confirm_export'), title: this.key('tip') }, () => createExportTask({ ...this.search, action: 'download' }))
if (cancelled) return
this.$message.success(this.$t(this.key('create_download_task_success')))
if (this.$router && this.$router.push) {
this.$router.push({ name: 'task' }).catch(() => {})
}
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.search-bar { padding: 10px 0; } .search-bar {
/deep/ .el-form-item--mini.el-form-item { margin-bottom: 4px; } padding: 10px 0;
}
.import-form {
margin-top: 16px;
}
/deep/ .equipment-form .el-form-item--mini.el-form-item {
margin-bottom: 22px;
}
</style> </style>

View File

@@ -1,10 +1,66 @@
<template> <template>
<d2-container> <d2-container>
<template #header> <template #header>
<div class="toolbar"> <div class="search-bar">
<el-button size="mini" type="primary" icon="el-icon-refresh" :disabled="loading" @click="fetchData"> <el-form ref="form" :inline="true" :model="form" size="mini">
{{ $t(key('refresh')) }} <el-form-item :label="$t(key('select_time'))" prop="time">
<el-date-picker
v-model="form.time"
:default-time="['00:00:00', '23:59:59']"
type="datetimerange"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
range-separator="~"
:start-placeholder="$t(key('start_date'))"
:end-placeholder="$t(key('end_date'))"
style="width:360px"
/>
</el-form-item>
<el-form-item :label="$t(key('workstation'))" prop="workstation_id">
<el-select
v-model="form.workstation_id"
filterable
clearable
:placeholder="$t(key('select_workstation'))"
style="width:180px"
@change="changeWorkstation"
>
<el-option
v-for="item in workstationOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item prop="device_code">
<el-select
v-model="form.device_code"
filterable
clearable
:placeholder="$t(key('select_device'))"
style="width:180px"
>
<el-option
v-for="item in deviceOptions"
:key="item.id || item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" icon="el-icon-search" :disabled="loading" @click="onSearch">
{{ $t(key('query')) }}
</el-button> </el-button>
<el-button size="mini" icon="el-icon-refresh" :disabled="loading" @click="onReset">
{{ $t(key('reset')) }}
</el-button>
<el-button size="mini" type="primary" icon="el-icon-download" :disabled="exportLoading" :loading="exportLoading" @click="handleExport">
{{ $t(key('export')) }}
</el-button>
</el-form-item>
</el-form>
</div> </div>
</template> </template>
@@ -143,7 +199,9 @@ import {
getDevicePinCheckList, getDevicePinCheckList,
getPinCheckDetail, getPinCheckDetail,
setPinCheckClean, setPinCheckClean,
setPinCheckCleanSingle setPinCheckCleanSingle,
getWorkstationSearch,
devicePinCheckExport
} from '@/api/planning-production/alert-center' } from '@/api/planning-production/alert-center'
export default { export default {
@@ -154,6 +212,14 @@ export default {
loading: false, loading: false,
detailLoading: false, detailLoading: false,
detailTableLoading: false, detailTableLoading: false,
exportLoading: false,
form: {
time: '',
workstation_id: '',
device_code: ''
},
workstationOptions: [],
deviceOptions: [],
workstations: [], workstations: [],
currentWorkstation: null, currentWorkstation: null,
workstationDialogVisible: false, workstationDialogVisible: false,
@@ -166,6 +232,7 @@ export default {
} }
}, },
mounted () { mounted () {
this.loadWorkstationOptions()
this.fetchData() this.fetchData()
}, },
methods: { methods: {
@@ -173,16 +240,88 @@ export default {
const data = res && res.data !== undefined ? res.data : res const data = res && res.data !== undefined ? res.data : res
return data || [] return data || []
}, },
normalizeList (res) {
const data = this.normalizeData(res)
if (Array.isArray(data)) return data
if (Array.isArray(data.data)) return data.data
if (Array.isArray(data.list)) return data.list
if (Array.isArray(data.rows)) return data.rows
return []
},
buildQueryParams () {
return {
...this.form,
page_no: 1,
page_size: 1000
}
},
loadWorkstationOptions () {
getWorkstationSearch({ pin_check: 'pin_check' })
.then(res => {
this.workstationOptions = this.normalizeList(res)
})
.catch(() => {
this.workstationOptions = []
})
},
fetchData () { fetchData () {
this.loading = true this.loading = true
getPincheckWorkstation({}) getPincheckWorkstation(this.buildQueryParams())
.then(res => { .then(res => {
this.workstations = this.normalizeData(res) this.workstations = this.normalizeList(res)
}) })
.finally(() => { .finally(() => {
this.loading = false this.loading = false
}) })
}, },
onSearch () {
this.fetchData()
},
onReset () {
this.$refs.form.resetFields()
this.deviceOptions = []
this.fetchData()
},
changeWorkstation (workstationId) {
this.form.device_code = ''
const workstation = this.workstationOptions.find(item => String(item.id) === String(workstationId))
this.deviceOptions = workstation && Array.isArray(workstation.devices) ? workstation.devices : []
},
isEmptyTime () {
return !this.form.time || (Array.isArray(this.form.time) && !this.form.time.length)
},
async handleExport () {
if (this.isEmptyTime()) {
this.$message.error(this.$t(this.key('please_select_time')))
return
}
if (!this.form.workstation_id) {
this.$message.error(this.$t(this.key('please_select_workstation')))
return
}
const confirmed = await this.$confirm(this.$t(this.key('export_confirm_message')), this.$t(this.key('prompt')), {
confirmButtonText: this.$t(this.key('confirm')),
cancelButtonText: this.$t(this.key('cancel')),
type: 'warning',
center: true
}).catch(() => {
this.$message.info(this.$t(this.key('clear_cancel')))
return false
})
if (confirmed === false) return
this.exportLoading = true
try {
await devicePinCheckExport({
...this.form,
action: 'download'
})
this.$message.success(this.$t(this.key('create_download_task_success')))
this.$router.push({ name: 'task' }).catch(() => {})
} finally {
this.exportLoading = false
}
},
openWorkstation (item) { openWorkstation (item) {
this.currentWorkstation = item this.currentWorkstation = item
this.workstationDialogTitle = this.$t(this.key('workstation_detail'), { device_name: item.name }) this.workstationDialogTitle = this.$t(this.key('workstation_detail'), { device_name: item.name })
@@ -191,7 +330,7 @@ export default {
}, },
fetchDeviceDetails (item) { fetchDeviceDetails (item) {
this.detailLoading = true this.detailLoading = true
getDevicePinCheckList({ device_category_id: item.workstation_id }) getDevicePinCheckList({ device_category_id: item.workstation_id || item.id })
.then(res => { .then(res => {
const data = this.normalizeData(res) const data = this.normalizeData(res)
this.consecutiveData = data.consecutive_data || [] this.consecutiveData = data.consecutive_data || []
@@ -212,7 +351,7 @@ export default {
device_code: row.device_code device_code: row.device_code
}) })
getPinCheckDetail({ getPinCheckDetail({
device_category_id: row.workstation_id, device_category_id: row.workstation_id || (this.currentWorkstation && this.currentWorkstation.workstation_id) || (this.currentWorkstation && this.currentWorkstation.id),
device_code: row.device_code, device_code: row.device_code,
type type
}) })
@@ -260,7 +399,7 @@ export default {
this.$message.success(this.$t(this.key('clear_success'))) this.$message.success(this.$t(this.key('clear_success')))
this.fetchData() this.fetchData()
this.fetchDeviceDetails({ this.fetchDeviceDetails({
workstation_id: row.workstation_id, workstation_id: row.workstation_id || (this.currentWorkstation && this.currentWorkstation.workstation_id) || (this.currentWorkstation && this.currentWorkstation.id),
name: row.device_name name: row.device_name
}) })
} }
@@ -269,7 +408,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.toolbar { .search-bar {
margin-bottom: -18px; margin-bottom: -18px;
} }
.alert-center { .alert-center {

View File

@@ -467,12 +467,30 @@ export default {
} }
}, },
normalizeListResponse (res) { normalizeListResponse (res) {
const data = Array.isArray(res) ? res : (res && res.data) || [] const root = res || {}
if (Array.isArray(data)) return { list: data, total: data.length } const data = res && res.data !== undefined ? res.data : res
return { if (Array.isArray(data)) {
list: data.data || [], return { list: data, total: Number(root.count || root.total || data.length) }
total: data.count || 0
} }
if (data && Array.isArray(data.list)) {
return { list: data.list, total: Number(root.count || root.total || data.count || data.total || data.list.length) }
}
if (data && Array.isArray(data.rows)) {
return { list: data.rows, total: Number(root.count || root.total || data.count || data.total || data.rows.length) }
}
if (data && Array.isArray(data.records)) {
return { list: data.records, total: Number(root.count || root.total || data.count || data.total || data.records.length) }
}
if (data && Array.isArray(data.data)) {
return { list: data.data, total: Number(root.count || root.total || data.count || data.total || data.data.length) }
}
if (data && data.data && Array.isArray(data.data.data)) {
return { list: data.data.data, total: Number(root.count || root.total || data.count || data.total || data.data.count || data.data.total || data.data.data.length) }
}
if (data && data.data && Array.isArray(data.data.list)) {
return { list: data.data.list, total: Number(root.count || root.total || data.count || data.total || data.data.count || data.data.total || data.data.list.length) }
}
return { list: [], total: 0 }
}, },
async fetchData () { async fetchData () {
this.loading = true this.loading = true

View File

@@ -203,7 +203,6 @@ import { i18nMixin } from '@/composables/useI18n'
import { confirmMixin } from '@/composables/useConfirmHandle' import { confirmMixin } from '@/composables/useConfirmHandle'
import { import {
getBatchTrayList, getBatchTrayList,
trayUnbinding,
getBatteryParam getBatteryParam
} from '@/api/planning-production/batch-tray' } from '@/api/planning-production/batch-tray'
import { sendWorkerman } from '@/api/production-master-data/workerman' import { sendWorkerman } from '@/api/production-master-data/workerman'
@@ -297,12 +296,30 @@ export default {
}, },
methods: { methods: {
normalizeListResponse (res) { normalizeListResponse (res) {
const data = Array.isArray(res) ? res : (res && res.data) || [] const root = res || {}
if (Array.isArray(data)) return { list: data, total: data.length } const data = root.data !== undefined ? root.data : root
return { if (Array.isArray(data)) {
list: data.data || [], return { list: data, total: Number(root.count || root.total || data.length) }
total: data.count || 0
} }
if (data && Array.isArray(data.list)) {
return { list: data.list, total: Number(root.count || root.total || data.count || data.total || data.list.length) }
}
if (data && Array.isArray(data.rows)) {
return { list: data.rows, total: Number(root.count || root.total || data.count || data.total || data.rows.length) }
}
if (data && Array.isArray(data.records)) {
return { list: data.records, total: Number(root.count || root.total || data.count || data.total || data.records.length) }
}
if (data && Array.isArray(data.data)) {
return { list: data.data, total: Number(root.count || root.total || data.count || data.total || data.data.length) }
}
if (data && data.data && Array.isArray(data.data.data)) {
return { list: data.data.data, total: Number(root.count || root.total || data.count || data.total || data.data.count || data.data.total || data.data.data.length) }
}
if (data && data.data && Array.isArray(data.data.list)) {
return { list: data.data.list, total: Number(root.count || root.total || data.count || data.total || data.data.count || data.data.total || data.data.list.length) }
}
return { list: [], total: Number(root.count || root.total || data.count || data.total || 0) }
}, },
async fetchData () { async fetchData () {
this.loading = true this.loading = true
@@ -329,8 +346,8 @@ export default {
this.fetchData() this.fetchData()
}, },
onPageChange (page) { onPageChange (page) {
this.pagination.current = page.current this.pagination.current = Number(page.current || page.currentPage || 1)
this.pagination.size = page.size this.pagination.size = Number(page.size || page.pageSize || this.pagination.size)
this.fetchData() this.fetchData()
}, },
openTrayDetails (row) { openTrayDetails (row) {
@@ -378,7 +395,14 @@ export default {
message: this.key('tray_unbind_confirm'), message: this.key('tray_unbind_confirm'),
title: this.key('prompt') title: this.key('prompt')
}, },
() => trayUnbinding({ batch: row.batch, tray: row.tray }) () => sendWorkerman({
sendData: {
action: 'set_tray_unbinding',
param: {
tray: row.tray
}
}
})
) )
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.pagination.current = Math.min( this.pagination.current = Math.min(
@@ -397,7 +421,6 @@ export default {
sendData: { sendData: {
action: 'set_tray_inactivity', action: 'set_tray_inactivity',
param: { param: {
batch: row.batch,
tray: row.tray tray: row.tray
} }
} }

View File

@@ -1,6 +1,32 @@
<template> <template>
<d2-container> <d2-container>
<template #header> <template #header>
<div class="search-bar">
<el-form :inline="true" size="mini">
<el-form-item :label="$t(key('device_category'))">
<el-select
v-model="search.device_category_id"
:placeholder="$t(key('select_device_category'))"
clearable
filterable
style="width:220px"
@change="onSearch"
>
<el-option
v-for="item in deviceCategoryOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" :disabled="loading" @click="onReset">
{{ $t(key('reset')) }}
</el-button>
</el-form-item>
</el-form>
</div>
<div class="status-board"> <div class="status-board">
<el-card <el-card
:class="['status-card', 'status-card--all', { 'is-active': activeStatus === '' }]" :class="['status-card', 'status-card--all', { 'is-active': activeStatus === '' }]"
@@ -25,12 +51,13 @@
<page-table <page-table
:columns="columns" :columns="columns"
:data="tableData" :data="sortedTableData"
:loading="loading" :loading="loading"
:toolbar-buttons="[]" :toolbar-buttons="[]"
:row-buttons="[]" :row-buttons="[]"
:pagination="null" :pagination="null"
:table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }" :table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }"
:table-listeners="tableListeners"
auto-height auto-height
> >
<template #col-status="{ row }"> <template #col-status="{ row }">
@@ -53,6 +80,7 @@ import { useTableColumns } from '@/composables/useTableColumns'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import { getDeviceAll } from '@/api/planning-production/equipment-monitoring' import { getDeviceAll } from '@/api/planning-production/equipment-monitoring'
import { getDeviceCategoryAll } from '@/api/production-master-data/device-category'
const STATUS_META = { const STATUS_META = {
FINISH: { label: 'finished', color: '#409EFF', className: 'finish' }, FINISH: { label: 'finished', color: '#409EFF', className: 'finish' },
@@ -73,35 +101,53 @@ export default {
activeStatus: '', activeStatus: '',
tableData: [], tableData: [],
statusNum: [], statusNum: [],
totalCount: 0,
deviceCategoryOptions: [],
search: {
device_category_id: ''
},
sortState: {
prop: '',
order: ''
},
refreshTimer: null refreshTimer: null
} }
}, },
computed: { computed: {
columns () { columns () {
return useTableColumns([ return useTableColumns([
{ prop: 'code', label: this.key('device_code'), minWidth: 140, showOverflowTooltip: true }, { prop: 'code', label: this.key('device_code'), minWidth: 140, sortable: 'custom', showOverflowTooltip: true },
{ prop: 'name', label: this.key('device_name'), minWidth: 160, showOverflowTooltip: true }, { prop: 'name', label: this.key('device_name'), minWidth: 160, sortable: 'custom', showOverflowTooltip: true },
{ prop: 'area_name', label: this.key('area'), minWidth: 120, showOverflowTooltip: true }, { prop: 'area_name', label: this.key('area'), minWidth: 120, sortable: 'custom', showOverflowTooltip: true },
{ prop: 'line_name', label: this.key('production_line'), minWidth: 140, showOverflowTooltip: true }, { prop: 'line_name', label: this.key('production_line'), minWidth: 140, sortable: 'custom', showOverflowTooltip: true },
{ prop: 'workstation_name', label: this.key('workstation'), minWidth: 140, showOverflowTooltip: true }, { prop: 'workstation_name', label: this.key('workstation'), minWidth: 140, sortable: 'custom', showOverflowTooltip: true },
{ prop: 'heartbeat', label: this.key('last_response'), minWidth: 170, showOverflowTooltip: true }, { prop: 'heartbeat', label: this.key('last_response'), minWidth: 170, sortable: 'custom', showOverflowTooltip: true },
{ prop: 'status', label: this.key('work_status'), minWidth: 110, slot: 'status' }, { prop: 'status', label: this.key('work_status'), minWidth: 110, sortable: 'custom', slot: 'status' },
{ prop: 'msg', label: this.key('msg'), minWidth: 180, slot: 'msg', showOverflowTooltip: true } { prop: 'msg', label: this.key('msg'), minWidth: 180, sortable: 'custom', slot: 'msg', showOverflowTooltip: true }
], { ], {
selectionWidth: 0, selectionWidth: 0,
indexWidth: 55 indexWidth: 55
}) })
}, },
tableListeners () {
return {
'sort-change': this.onSortChange
}
},
statusCountMap () { statusCountMap () {
return this.statusNum.reduce((result, item) => { return this.statusNum.reduce((result, item) => {
result[item.status] = Number(item.num || 0) const status = this.normalizeStatus(item.status || item.key || item.name || item.type)
if (status) {
result[status] = Number(item.num || item.count || item.value || item.total || 0)
}
return result return result
}, {}) }, {})
}, },
totalDeviceCount () { totalDeviceCount () {
return Object.keys(this.statusCountMap).reduce((total, status) => { const statusTotal = Object.keys(this.statusCountMap).reduce((total, status) => {
return total + this.statusCountMap[status] return total + this.statusCountMap[status]
}, 0) }, 0)
return statusTotal || this.totalCount || this.tableData.length
}, },
statusCards () { statusCards () {
return Object.keys(STATUS_META).map(status => ({ return Object.keys(STATUS_META).map(status => ({
@@ -109,9 +155,17 @@ export default {
count: this.statusCountMap[status] || 0, count: this.statusCountMap[status] || 0,
...STATUS_META[status] ...STATUS_META[status]
})) }))
},
sortedTableData () {
if (!this.sortState.prop || !this.sortState.order) return this.tableData
const direction = this.sortState.order === 'ascending' ? 1 : -1
return [...this.tableData].sort((a, b) => {
return this.compareValue(a[this.sortState.prop], b[this.sortState.prop]) * direction
})
} }
}, },
mounted () { mounted () {
this.loadDeviceCategoryOptions()
this.fetchData() this.fetchData()
this.refreshTimer = setInterval(() => { this.refreshTimer = setInterval(() => {
this.fetchData(false) this.fetchData(false)
@@ -128,13 +182,104 @@ export default {
this.activeStatus = status === 'all' ? '' : status this.activeStatus = status === 'all' ? '' : status
this.fetchData() this.fetchData()
}, },
normalizePayload (res) {
if (!res) return {}
if (Array.isArray(res)) return { data: res, status_num: [] }
if (res.data && !Array.isArray(res.data) && (res.data.data || res.data.status_num || res.data.statusNum || res.data.status_count || res.data.statusCount)) {
return res.data
}
const payload = res || {}
if (Array.isArray(payload)) {
return { data: payload, status_num: [] }
}
return payload || {}
},
normalizeList (res) {
const payload = this.normalizePayload(res)
if (Array.isArray(payload)) return payload
if (Array.isArray(payload.data)) return payload.data
if (Array.isArray(payload.list)) return payload.list
if (Array.isArray(payload.rows)) return payload.rows
if (Array.isArray(payload.records)) return payload.records
return []
},
normalizeStatus (status) {
return String(status || '').toUpperCase()
},
normalizeStatusNum (payload, list) {
const statusNum = payload.status_num || payload.statusNum || payload.status_count || payload.statusCount || payload.status_counts || payload.statusCounts
if (Array.isArray(statusNum)) return statusNum
if (statusNum && typeof statusNum === 'object') {
return Object.keys(statusNum).map(status => ({
status,
num: statusNum[status]
}))
}
const counts = list.reduce((result, row) => {
const status = this.normalizeStatus(row.status)
if (status) {
result[status] = (result[status] || 0) + 1
}
return result
}, {})
return Object.keys(counts).map(status => ({
status,
num: counts[status]
}))
},
normalizeTotal (payload, list) {
return Number(payload.count || payload.total || payload.total_count || payload.totalCount || list.length || 0)
},
async loadDeviceCategoryOptions () {
try {
const res = await getDeviceCategoryAll()
this.deviceCategoryOptions = this.normalizeList(res).map(item => ({
value: item.id || item.device_category_id,
label: item.name || item.device_category_name || item.code
})).filter(item => item.value !== undefined && item.label)
} catch { /* 类别加载失败不影响监控列表 */ }
},
onReset () {
this.search.device_category_id = ''
this.fetchData()
},
onSearch () {
this.fetchData()
},
onSortChange ({ prop, order }) {
this.sortState = {
prop: prop || '',
order: order || ''
}
},
compareValue (left, right) {
if (left === right) return 0
if (left === undefined || left === null || left === '') return -1
if (right === undefined || right === null || right === '') return 1
const leftNumber = Number(left)
const rightNumber = Number(right)
if (!Number.isNaN(leftNumber) && !Number.isNaN(rightNumber)) {
return leftNumber - rightNumber
}
const leftDate = Date.parse(left)
const rightDate = Date.parse(right)
if (!Number.isNaN(leftDate) && !Number.isNaN(rightDate)) {
return leftDate - rightDate
}
return String(left).localeCompare(String(right), 'zh-Hans-CN')
},
async fetchData (showLoading = true) { async fetchData (showLoading = true) {
if (showLoading) this.loading = true if (showLoading) this.loading = true
try { try {
const res = await getDeviceAll({ status: this.activeStatus }) const res = await getDeviceAll({
const payload = res && res.data ? res.data : (res || {}) status: this.activeStatus,
this.statusNum = Array.isArray(payload.status_num) ? payload.status_num : [] device_category_id: this.search.device_category_id
this.tableData = Array.isArray(payload.data) ? payload.data : [] })
const payload = this.normalizePayload(res)
const list = this.normalizeList(payload)
this.statusNum = this.normalizeStatusNum(payload, list)
this.totalCount = this.normalizeTotal(payload, list)
this.tableData = list
} finally { } finally {
if (showLoading) this.loading = false if (showLoading) this.loading = false
} }
@@ -152,6 +297,10 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.search-bar {
padding: 0 0 10px;
}
.status-board { .status-board {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));

View File

@@ -28,7 +28,7 @@
clearable clearable
filterable filterable
style="width:200px" style="width:200px"
@focus="loadBatchOptions" @focus="loadProcessOptions"
> >
<el-option <el-option
v-for="item in processOptions" v-for="item in processOptions"
@@ -41,11 +41,11 @@
<el-form-item :label="$t(key('finish_time'))" prop="start_time"> <el-form-item :label="$t(key('finish_time'))" prop="start_time">
<el-date-picker <el-date-picker
v-model="search.start_time" v-model="search.start_time"
type="datetimerange" type="daterange"
range-separator="-" range-separator="-"
:start-placeholder="$t(key('start_time'))" :start-placeholder="$t(key('start_time'))"
:end-placeholder="$t(key('end_time'))" :end-placeholder="$t(key('end_time'))"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd"
style="width:330px" style="width:330px"
/> />
</el-form-item> </el-form-item>
@@ -65,7 +65,7 @@
:columns="columns" :columns="columns"
:data="tableData" :data="tableData"
:loading="loading" :loading="loading"
:toolbar-buttons="toolbarButtons" :toolbar-buttons="[]"
:row-buttons="[]" :row-buttons="[]"
:pagination="pagination" :pagination="pagination"
:table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }" :table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }"
@@ -81,81 +81,6 @@
<el-empty :description="$t('暂无数据')" :image-size="80" /> <el-empty :description="$t('暂无数据')" :image-size="80" />
</template> </template>
</page-table> </page-table>
<el-dialog :title="$t(key('input_semi_product_data'))" :visible.sync="dialogVisible" width="520px">
<el-form ref="form" :model="form" :rules="rules" label-width="130px" size="mini">
<el-form-item :label="$t(key('batch_id'))" prop="batch_id">
<el-select
v-model="form.batch_id"
:placeholder="$t(key('select_batch_id'))"
clearable
filterable
style="width:100%"
@focus="loadBatchOptions"
@change="onBatchChange"
>
<el-option
v-for="item in batchOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t(key('workingsubclass'))" prop="process_code">
<el-select
v-model="form.process_code"
:placeholder="$t(key('select_workingsubclass'))"
clearable
filterable
style="width:100%"
:disabled="!form.batch_id"
>
<el-option
v-for="item in selectedBatchProcesses"
:key="item.code || item.name"
:label="item.name || item.code"
:value="item.code || item.name"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t(key('device_code'))" prop="device_code">
<el-select
v-model="form.device_code"
:placeholder="$t(key('select_device_code'))"
clearable
filterable
style="width:100%"
@focus="loadDeviceOptions"
>
<el-option
v-for="item in deviceOptions"
:key="item.code || item.device_code"
:label="item.name || item.device_name || item.code || item.device_code"
:value="item.code || item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t(key('output_quantity'))" prop="item_quantity">
<el-input-number v-model="form.item_quantity" :min="1" style="width:100%" />
</el-form-item>
<el-form-item :label="$t(key('output_date'))" prop="start_time">
<el-date-picker
v-model="form.start_time"
type="date"
value-format="yyyy-MM-dd"
style="width:100%"
:placeholder="$t(key('output_date'))"
/>
</el-form-item>
</el-form>
<span slot="footer">
<el-button size="mini" @click="dialogVisible = false">{{ $t(key('cancel')) }}</el-button>
<el-button size="mini" type="primary" :loading="submitting" @click="submitForm">
{{ $t(key('confirm')) }}
</el-button>
</span>
</el-dialog>
</d2-container> </d2-container>
</template> </template>
@@ -163,9 +88,8 @@
import { useTableColumns } from '@/composables/useTableColumns' import { useTableColumns } from '@/composables/useTableColumns'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import { getBatchAll } from '@/api/planning-production/batch-list' import { getWipDataList } from '@/api/planning-production/material-monitoring'
import { getDeviceAll } from '@/api/planning-production/equipment-monitoring' import { getWorkingsubclassAll } from '@/api/production-master-data/process-step'
import { createWipData, getWipDataList } from '@/api/planning-production/material-monitoring'
export default { export default {
name: 'planning-production-material-monitoring', name: 'planning-production-material-monitoring',
@@ -174,8 +98,6 @@ export default {
data () { data () {
return { return {
loading: false, loading: false,
submitting: false,
dialogVisible: false,
search: { search: {
batch: '', batch: '',
item_id: '', item_id: '',
@@ -188,15 +110,7 @@ export default {
size: 10, size: 10,
total: 0 total: 0
}, },
form: { processOptions: []
batch_id: '',
process_code: '',
device_code: '',
item_quantity: undefined,
start_time: ''
},
batchOptions: [],
deviceOptions: []
} }
}, },
computed: { computed: {
@@ -214,51 +128,36 @@ export default {
selectionWidth: 0, selectionWidth: 0,
indexWidth: 55 indexWidth: 55
}) })
},
toolbarButtons () {
return [
{
key: 'create',
label: this.key('input_semi_product_data'),
type: 'primary',
icon: 'el-icon-plus',
size: 'mini',
onClick: this.openDialog
}
]
},
rules () {
return {
batch_id: [{ required: true, message: this.$t(this.key('select_batch_id')), trigger: 'change' }],
process_code: [{ required: true, message: this.$t(this.key('select_workingsubclass')), trigger: 'change' }],
device_code: [{ required: true, message: this.$t(this.key('select_device_code')), trigger: 'change' }],
item_quantity: [{ required: true, message: this.$t(this.key('enter_output_quantity')), trigger: 'blur' }]
}
},
selectedBatch () {
return this.batchOptions.find(item => String(item.id) === String(this.form.batch_id)) || {}
},
selectedBatchProcesses () {
return Array.isArray(this.selectedBatch.process) ? this.selectedBatch.process : []
},
processOptions () {
const map = new Map()
this.batchOptions.forEach(batch => {
const processes = Array.isArray(batch.process) ? batch.process : []
processes.forEach(item => {
const value = item.code || item.name
if (value && !map.has(value)) map.set(value, item)
})
})
return Array.from(map.values())
} }
}, },
created () { created () {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
responseData (res) { normalizePayload (res) {
return res && res.data ? res.data : (res || {}) if (res && res.code !== undefined && res.data !== undefined) return res.data
return res || {}
},
normalizeList (res) {
const payload = this.normalizePayload(res)
if (Array.isArray(payload)) return payload
if (Array.isArray(payload.data)) return payload.data
if (payload.data && Array.isArray(payload.data.data)) return payload.data.data
return []
},
normalizePage (res) {
const payload = this.normalizePayload(res)
if (Array.isArray(payload)) return { data: payload, count: payload.length }
if (payload.data && !Array.isArray(payload.data)) {
return {
data: Array.isArray(payload.data.data) ? payload.data.data : [],
count: Number(payload.data.count || 0)
}
}
return {
data: Array.isArray(payload.data) ? payload.data : [],
count: Number(payload.count || 0)
}
}, },
searchParams () { searchParams () {
const params = { const params = {
@@ -267,8 +166,10 @@ export default {
workingsubclass: this.search.workingsubclass || undefined workingsubclass: this.search.workingsubclass || undefined
} }
if (Array.isArray(this.search.start_time) && this.search.start_time.length === 2) { if (Array.isArray(this.search.start_time) && this.search.start_time.length === 2) {
params.start_time = this.search.start_time[0] params.start_time = [
params.end_time = this.search.start_time[1] `${this.search.start_time[0]} 00:00:00`,
`${this.search.start_time[1]} 23:59:59`
]
} }
return params return params
}, },
@@ -280,9 +181,9 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const payload = this.responseData(res) const payload = this.normalizePage(res)
this.tableData = Array.isArray(payload.data) ? payload.data : [] this.tableData = payload.data
this.pagination.total = Number(payload.count || 0) this.pagination.total = payload.count
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -304,49 +205,10 @@ export default {
this.pagination = pagination this.pagination = pagination
this.fetchData() this.fetchData()
}, },
openDialog () { async loadProcessOptions () {
this.dialogVisible = true if (this.processOptions.length) return
this.form = { const res = await getWorkingsubclassAll({})
batch_id: '', this.processOptions = this.normalizeList(res)
process_code: '',
device_code: '',
item_quantity: undefined,
start_time: ''
}
this.$nextTick(() => {
if (this.$refs.form) this.$refs.form.clearValidate()
})
this.loadBatchOptions()
this.loadDeviceOptions()
},
async loadBatchOptions () {
if (this.batchOptions.length) return
const res = await getBatchAll({})
const data = Array.isArray(res) ? res : (res && res.data) || []
this.batchOptions = Array.isArray(data) ? data : []
},
async loadDeviceOptions () {
if (this.deviceOptions.length) return
const res = await getDeviceAll({})
const payload = this.responseData(res)
this.deviceOptions = Array.isArray(payload.data) ? payload.data : []
},
onBatchChange () {
this.form.process_code = ''
},
submitForm () {
this.$refs.form.validate(async valid => {
if (!valid) return
this.submitting = true
try {
await createWipData({ ...this.form })
this.$message.success(this.$t(this.key('operation_success')))
this.dialogVisible = false
this.fetchData()
} finally {
this.submitting = false
}
})
} }
} }
} }

View File

@@ -168,15 +168,31 @@ export default {
syncProcessOptions () { syncProcessOptions () {
this.form.processOptions = this.processOptions this.form.processOptions = this.processOptions
}, },
normalizeProcessPayload (res) {
const payload = res && res.code !== undefined && res.data !== undefined ? res.data : res
if (
payload &&
!Array.isArray(payload) &&
payload.data &&
!Array.isArray(payload.data) &&
(payload.data.flow_process || payload.data.data)
) {
return payload.data
}
return payload || {}
},
normalizeProcessRows (payload) {
if (Array.isArray(payload)) return payload
return Array.isArray(payload.data) ? payload.data : []
},
verifyData () { verifyData () {
if (!this.ensureBatteryInput()) return if (!this.ensureBatteryInput()) return
this.loading = true this.loading = true
verifyBatteryProcessInfo(this.form) verifyBatteryProcessInfo(this.form)
.then(res => { .then(res => {
const data = res && res.data ? res.data : res const data = this.normalizeProcessPayload(res)
this.processOptions = data.flow_process || [] this.processOptions = data.flow_process || []
this.form.processOptions = this.processOptions this.tableData = this.normalizeProcessRows(data)
this.tableData = data.data || []
this.showProcess = true this.showProcess = true
}) })
.finally(() => { .finally(() => {
@@ -192,8 +208,9 @@ export default {
this.loading = true this.loading = true
changeBatteryProcess(this.form) changeBatteryProcess(this.form)
.then(res => { .then(res => {
const data = res && res.data ? res.data : res const data = this.normalizeProcessPayload(res)
this.tableData = Array.isArray(data) ? data : (data.data || []) this.tableData = this.normalizeProcessRows(data)
this.$message.success(this.$t(this.key('change_process_success')))
}) })
.finally(() => { .finally(() => {
this.loading = false this.loading = false

View File

@@ -0,0 +1,52 @@
<template>
<el-dialog
:title="$t(key('multi_battery_input'))"
:visible.sync="visibleProxy"
width="520px"
:close-on-click-modal="false"
@open="onOpen"
>
<el-form>
<el-form-item :label="$t(key('input_rule'))">
<el-input v-model="inputValue" type="textarea" :rows="8" />
</el-form-item>
</el-form>
<span slot="footer">
<el-button size="mini" @click="visibleProxy = false">{{ $t(key('cancel')) }}</el-button>
<el-button size="mini" type="primary" @click="onConfirm">{{ $t(key('confirm')) }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { i18nMixin } from '@/composables/useI18n'
export default {
name: 'BatteryInputDialog',
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
props: {
visible: { type: Boolean, default: false },
value: { type: String, default: '' }
},
data () {
return {
inputValue: ''
}
},
computed: {
visibleProxy: {
get () { return this.visible },
set (value) { this.$emit('update:visible', value) }
}
},
methods: {
onOpen () {
this.inputValue = this.value
},
onConfirm () {
this.$emit('confirm', this.inputValue)
this.visibleProxy = false
}
}
}
</script>

View File

@@ -44,7 +44,6 @@
:pagination="null" :pagination="null"
:table-attrs="{ size: 'mini', rowKey: 'battery_id', highlightCurrentRow: true }" :table-attrs="{ size: 'mini', rowKey: 'battery_id', highlightCurrentRow: true }"
auto-height auto-height
@selection-change="onSelectionChange"
> >
<template #col-active="{ row }"> <template #col-active="{ row }">
<el-tag :type="Number(row.active) === 0 ? 'info' : 'success'" size="mini"> <el-tag :type="Number(row.active) === 0 ? 'info' : 'success'" size="mini">
@@ -56,17 +55,11 @@
</template> </template>
</page-table> </page-table>
<el-dialog :title="$t(key('multi_battery_input'))" :visible.sync="dialogVisible" width="520px"> <battery-input-dialog
<el-form> :visible.sync="dialogVisible"
<el-form-item :label="$t(key('input_rule'))"> :value="dialogBatteryIds"
<el-input v-model="dialogBatteryIds" type="textarea" :rows="8" /> @confirm="confirmBatchInput"
</el-form-item> />
</el-form>
<span slot="footer">
<el-button size="mini" @click="dialogVisible = false">{{ $t(key('cancel')) }}</el-button>
<el-button size="mini" type="primary" @click="confirmBatchInput">{{ $t(key('confirm')) }}</el-button>
</span>
</el-dialog>
</d2-container> </d2-container>
</template> </template>
@@ -74,12 +67,13 @@
import { useTableColumns } from '@/composables/useTableColumns' import { useTableColumns } from '@/composables/useTableColumns'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import BatteryInputDialog from './components/BatteryInputDialog'
import { sendWorkerman } from '@/api/production-master-data/workerman' import { sendWorkerman } from '@/api/production-master-data/workerman'
import { verifyBatteryRebatchInfo } from '@/api/planning-production/rework-management' import { verifyBatteryRebatchInfo } from '@/api/planning-production/rework-management'
export default { export default {
name: 'planning-production-rework-management', name: 'planning-production-rework-management',
components: { PageTable }, components: { PageTable, BatteryInputDialog },
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')], mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
data () { data () {
return { return {
@@ -88,7 +82,6 @@ export default {
battery_ids: '' battery_ids: ''
}, },
tableData: [], tableData: [],
selectedRows: [],
dialogVisible: false, dialogVisible: false,
dialogBatteryIds: '' dialogBatteryIds: ''
} }
@@ -133,17 +126,34 @@ export default {
this.dialogBatteryIds = '' this.dialogBatteryIds = ''
this.dialogVisible = true this.dialogVisible = true
}, },
confirmBatchInput () { confirmBatchInput (value) {
this.form.battery_ids = this.normalizeBatteryIds(this.dialogBatteryIds) this.dialogBatteryIds = value
this.dialogVisible = false this.form.battery_ids = this.normalizeBatteryIds(value)
},
normalizeVerifyPayload (res) {
const payload = res && res.code !== undefined && res.data !== undefined ? res.data : res
if (
payload &&
!Array.isArray(payload) &&
payload.data &&
!Array.isArray(payload.data) &&
payload.data.data
) {
return payload.data
}
return payload || {}
},
normalizeVerifyRows (payload) {
if (Array.isArray(payload)) return payload
return Array.isArray(payload.data) ? payload.data : []
}, },
verifyData () { verifyData () {
if (!this.ensureBatteryInput()) return if (!this.ensureBatteryInput()) return
this.loading = true this.loading = true
verifyBatteryRebatchInfo(this.form) verifyBatteryRebatchInfo(this.form)
.then(res => { .then(res => {
const data = res && res.data ? res.data : res const data = this.normalizeVerifyPayload(res)
this.tableData = data.data || [] this.tableData = this.normalizeVerifyRows(data)
}) })
.finally(() => { .finally(() => {
this.loading = false this.loading = false
@@ -151,8 +161,7 @@ export default {
}, },
setBatteryRebatch () { setBatteryRebatch () {
if (!this.ensureBatteryInput()) return if (!this.ensureBatteryInput()) return
const sourceRows = this.selectedRows.length ? this.selectedRows : this.tableData const batteryIds = this.tableData.map(item => item.battery_id).filter(Boolean)
const batteryIds = sourceRows.map(item => item.battery_id).filter(Boolean)
if (!batteryIds.length) { if (!batteryIds.length) {
this.$message.warning(this.$t(this.key('verify_data_before_action'))) this.$message.warning(this.$t(this.key('verify_data_before_action')))
return return
@@ -179,6 +188,7 @@ export default {
return return
} }
this.$message.success(this.$t(this.key('re_activate_success'))) this.$message.success(this.$t(this.key('re_activate_success')))
this.tableData = []
}).catch(error => { }).catch(error => {
this.$message.warning(`${this.$t(this.key('rethrow_activation_failed'))}: ${error}`) this.$message.warning(`${this.$t(this.key('rethrow_activation_failed'))}: ${error}`)
}).finally(() => { }).finally(() => {
@@ -189,11 +199,7 @@ export default {
resetForm () { resetForm () {
if (this.$refs.form) this.$refs.form.resetFields() if (this.$refs.form) this.$refs.form.resetFields()
this.tableData = [] this.tableData = []
this.selectedRows = []
this.dialogBatteryIds = '' this.dialogBatteryIds = ''
},
onSelectionChange (rows) {
this.selectedRows = rows
} }
} }
} }

View File

@@ -136,9 +136,15 @@
:row-buttons="[]" :row-buttons="[]"
:pagination="null" :pagination="null"
:table-attrs="{ size: 'mini', rowKey: 'batch', highlightCurrentRow: true }" :table-attrs="{ size: 'mini', rowKey: 'batch', highlightCurrentRow: true }"
:table-listeners="batchTableListeners"
height="420px" height="420px"
@row-dblclick="selectBatch"
/> />
<span slot="footer">
<el-button size="mini" @click="batchDialogVisible = false">{{ $t(key('cancel')) }}</el-button>
<el-button size="mini" type="primary" :disabled="!currentBatch" @click="confirmBatch">
{{ $t(key('confirm')) }}
</el-button>
</span>
</el-dialog> </el-dialog>
<el-dialog :title="$t(key('format_dialog_title'))" :visible.sync="formatDialogVisible" width="820px"> <el-dialog :title="$t(key('format_dialog_title'))" :visible.sync="formatDialogVisible" width="820px">
@@ -154,8 +160,8 @@
:row-buttons="[]" :row-buttons="[]"
:pagination="null" :pagination="null"
:table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }" :table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }"
:table-listeners="formatTableListeners"
height="360px" height="360px"
@row-dblclick="selectFormatRow"
> >
<template #col-actions="{ row }"> <template #col-actions="{ row }">
<el-button type="text" class="danger-action" @click="deleteFormat(row)"> <el-button type="text" class="danger-action" @click="deleteFormat(row)">
@@ -213,7 +219,7 @@
import { useTableColumns } from '@/composables/useTableColumns' import { useTableColumns } from '@/composables/useTableColumns'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import { sendWorkerman } from '@/api/production-master-data/workerman' import { sendWorkerman } from '@/api/workerman'
import { import {
getBatchAll, getBatchAll,
getBatchTrayFormatAll, getBatchTrayFormatAll,
@@ -239,6 +245,7 @@ export default {
batchList: [], batchList: [],
formatList: [], formatList: [],
selectedRows: [], selectedRows: [],
currentBatch: null,
batchDialogVisible: false, batchDialogVisible: false,
formatDialogVisible: false, formatDialogVisible: false,
formatFormVisible: false, formatFormVisible: false,
@@ -312,6 +319,18 @@ export default {
selectionWidth: 0, selectionWidth: 0,
indexWidth: 0 indexWidth: 0
}) })
},
batchTableListeners () {
return {
'current-change': this.onBatchCurrentChange,
'row-click': this.onBatchCurrentChange,
'row-dblclick': this.selectBatch
}
},
formatTableListeners () {
return {
'row-dblclick': this.selectFormatRow
}
} }
}, },
created () { created () {
@@ -335,11 +354,21 @@ export default {
return new RegExp(`^${escaped}$`) return new RegExp(`^${escaped}$`)
}, },
openBatchDialog () { openBatchDialog () {
this.currentBatch = this.batchList.find(item => item.batch === this.form.batch) || null
this.batchDialogVisible = true this.batchDialogVisible = true
if (!this.batchList.length) this.fetchBatchList() if (!this.batchList.length) this.fetchBatchList()
}, },
onBatchCurrentChange (row) {
this.currentBatch = row || null
},
confirmBatch () {
if (!this.currentBatch) return
this.selectBatch(this.currentBatch)
},
selectBatch (row) { selectBatch (row) {
if (!row || !row.batch) return
this.form.batch = row.batch this.form.batch = row.batch
this.currentBatch = row
this.batchDialogVisible = false this.batchDialogVisible = false
}, },
async fetchBatchList () { async fetchBatchList () {
@@ -586,9 +615,7 @@ export default {
return true return true
} }
}).then(async ({ value }) => { }).then(async ({ value }) => {
const param = action === 'set_tray_inactivity' const param = { tray: value }
? { data: [{ tray: value }] }
: { tray: value }
await sendWorkerman({ await sendWorkerman({
sendData: { sendData: {
action, action,

View File

@@ -4,30 +4,14 @@
<div class="search-bar"> <div class="search-bar">
<el-form :inline="true" size="mini"> <el-form :inline="true" size="mini">
<el-form-item :label="$t(key('code'))"> <el-form-item :label="$t(key('code'))">
<el-input <el-input v-model="search.code" :placeholder="$t(key('enter_code'))" clearable style="width:200px" @keyup.enter.native="onSearch" />
v-model="search.code"
:placeholder="$t(key('enter_code'))"
clearable
style="width:200px"
@keyup.enter.native="onSearch"
/>
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('name'))"> <el-form-item :label="$t(key('name'))">
<el-input <el-input v-model="search.name" :placeholder="$t(key('enter_name'))" clearable style="width:200px" @keyup.enter.native="onSearch" />
v-model="search.name"
:placeholder="$t(key('enter_name'))"
clearable
style="width:200px"
@keyup.enter.native="onSearch"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onSearch"> <el-button type="primary" icon="el-icon-search" @click="onSearch">{{ $t(key('search')) }}</el-button>
{{ $t(key('search')) }} <el-button icon="el-icon-refresh" @click="onReset">{{ $t(key('reset')) }}</el-button>
</el-button>
<el-button icon="el-icon-refresh" @click="onReset">
{{ $t(key('reset')) }}
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -35,25 +19,28 @@
<page-table <page-table
ref="pageTable" ref="pageTable"
row-key="id"
:columns="columns" :columns="columns"
:data="tableData" :data="tableData"
:loading="loading" :loading="loading"
:toolbar-buttons="toolbarButtons" :toolbar-buttons="toolbarButtons"
:row-buttons="rowButtons" :row-buttons="rowButtons"
:pagination="pagination" :pagination="pagination"
:table-attrs="tableAttrs"
help-url="/help/factory-area" help-url="/help/factory-area"
:help-text="$t(ckey('help'))" :help-text="$t(ckey('help'))"
auto-height auto-height
@page-change="onPageChange" @page-change="onPageChange"
@selection-change="onSelect" @selection-change="onSelect"
/> >
</page-table>
<page-dialog-form <page-dialog-form
ref="dialogForm" ref="dialogForm"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="dialogTitle" :title="dialogTitle"
:width="'35%'" :width="'35%'"
:form-cols="formCols" :form-cols="baseFormCols"
:form-data="formData" :form-data="formData"
:rules="rules" :rules="rules"
:label-width="'100px'" :label-width="'100px'"
@@ -70,12 +57,12 @@
import { useTableColumns } from '@/composables/useTableColumns' import { useTableColumns } from '@/composables/useTableColumns'
import { useTableButtons } from '@/composables/useTableButtons' import { useTableButtons } from '@/composables/useTableButtons'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import { confirmMixin } from '@/composables/useConfirmHandle'
import { import {
getFactoryAreaList, getFactoryAreaList,
createFactoryArea, createFactoryArea,
editFactoryArea, editFactoryArea,
deleteFactoryArea deleteFactoryArea,
exportFactoryAreaTask
} from '@/api/production-master-data/factory-area' } from '@/api/production-master-data/factory-area'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import PageDialogForm from '@/components/page-dialog-form' import PageDialogForm from '@/components/page-dialog-form'
@@ -83,12 +70,13 @@ import PageDialogForm from '@/components/page-dialog-form'
export default { export default {
name: 'production-master-data-factory-area', name: 'production-master-data-factory-area',
components: { PageTable, PageDialogForm }, components: { PageTable, PageDialogForm },
mixins: [i18nMixin('page.production_master_data.factory_model.factory_area'), confirmMixin], mixins: [i18nMixin('page.production_master_data.factory_model.factory_area')],
data () { data () {
return { return {
loading: false, loading: false,
submitting: false, submitting: false,
tableData: [], tableData: [],
rawAreaData: [],
selectedRows: [], selectedRows: [],
dialogVisible: false, dialogVisible: false,
dialogTitle: '', dialogTitle: '',
@@ -96,91 +84,44 @@ export default {
handleType: 'create', handleType: 'create',
search: { code: '', name: '' }, search: { code: '', name: '' },
pagination: { current: 1, size: 10, total: 0 }, pagination: { current: 1, size: 10, total: 0 },
formData: { code: '', name: '', remark: '' }, tableAttrs: { defaultExpandAll: true, treeProps: { children: 'children', hasChildren: 'hasChildren' } },
formData: { code: '', name: '', parent_id: '', remark: '' },
rules: { rules: {
code: [ code: [
{ required: true, message: this.key('enter_code'), trigger: 'blur' }, { required: true, message: this.key('enter_code'), trigger: 'blur' },
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' } { min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
], ],
name: [ name: [
{ required: true, message: this.key('enter_name'), trigger: 'blur' }, { required: true, message: this.key('enter_name'), trigger: 'blur' },
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' } { min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
] ],
remark: [{ max: 500, message: this.key('remark_max_500'), trigger: 'blur' }]
}, },
columns: [], columns: [],
toolbarButtons: [], toolbarButtons: [],
rowButtons: [], rowButtons: [],
formCols: [ baseFormCols: [
[ [{ type: 'input', prop: 'code', label: this.key('code'), placeholder: this.key('enter_code'), clearable: true, style: { width: '90%' } }],
{ [{ type: 'input', prop: 'name', label: this.key('name'), placeholder: this.key('enter_name'), clearable: true, style: { width: '90%' } }],
type: 'input', [{ type: 'input', prop: 'remark', inputType: 'textarea', autosize: { minRows: 2, maxRows: 6 }, label: this.key('remark'), placeholder: this.key('remark_required'), clearable: true, style: { width: '90%' } }]
prop: 'code',
label: this.key('code'),
placeholder: this.key('enter_code'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'name',
label: this.key('name'),
placeholder: this.key('enter_name'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'remark',
inputType: 'textarea',
autosize: { minRows: 2, maxRows: 6 },
label: this.key('remark'),
placeholder: this.key('remark_required'),
clearable: true,
style: { width: '90%' }
}
]
] ]
} }
}, },
created () { created () {
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'sort', label: this.key('sort'), width: 80 }, { prop: 'code', label: this.key('code'), minWidth: 140 },
{ prop: 'code', label: this.key('code'), minWidth: 120 }, { prop: 'name', label: this.key('name'), minWidth: 160 },
{ prop: 'name', label: this.key('name'), minWidth: 120 },
{ prop: 'remark', label: this.key('remark') }, { prop: 'remark', label: this.key('remark') },
{ prop: '_actions', label: this.key('operation'), width: 160, fixed: 'right' } { prop: '_actions', label: this.key('operation'), width: 160, fixed: 'right' }
]) ])
const btns = useTableButtons({ const btns = useTableButtons({
toolbar: [ toolbar: [
{ { key: 'add', label: this.key('add'), icon: 'el-icon-plus', type: 'primary', auth: '/production_configuration/factory_model/factory_area/create', onClick: this.openAdd },
key: 'add', { key: 'export', label: this.key('export'), icon: 'el-icon-download', auth: '/production_configuration/factory_model/factory_area/export', onClick: this.handleExport }
label: this.key('add'),
icon: 'el-icon-plus',
type: 'primary',
auth: '/production_configuration/factory_model/factory_area/create',
onClick: this.openAdd
}
], ],
row: [ row: [
{ { key: 'edit', label: this.key('edit'), icon: 'el-icon-edit', auth: '/production_configuration/factory_model/factory_area/edit', onClick: this.openEdit },
key: 'edit', { key: 'delete', label: this.key('delete'), icon: 'el-icon-delete', color: 'danger', auth: '/production_configuration/factory_model/factory_area/delete', onClick: this.handleDelete }
label: this.key('edit'),
icon: 'el-icon-edit',
auth: '/production_configuration/factory_model/factory_area/edit',
onClick: this.openEdit
},
{
key: 'delete',
label: this.key('delete'),
icon: 'el-icon-delete',
color: 'danger',
auth: '/production_configuration/factory_model/factory_area/delete',
onClick: this.handleDelete
}
] ]
}, this.$permission) }, this.$permission)
this.toolbarButtons = btns.toolbarButtons this.toolbarButtons = btns.toolbarButtons
@@ -188,6 +129,72 @@ export default {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
getId (row) {
return row && (row.id !== undefined ? row.id : row.area_id)
},
getParentId (row) {
if (!row) return ''
if (row.parent_id !== undefined) return row.parent_id || ''
if (row.pid !== undefined) return row.pid || ''
if (row.parentId !== undefined) return row.parentId || ''
return ''
},
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
normalizeNode (row, level = 0) {
const children = Array.isArray(row.children) ? row.children.map(item => this.normalizeNode(item, level + 1)) : []
const node = { ...row, id: this.getId(row), parent_id: this.getParentId(row), children }
node._treeLabel = `${' '.repeat(level)}${node.name || ''}`
if (!node.children.length) delete node.children
return node
},
buildTree (list) {
if (list.some(item => Array.isArray(item.children))) return list.map(item => this.normalizeNode(item))
const map = new Map()
const roots = []
list.forEach(item => {
const node = this.normalizeNode(item)
node.children = []
map.set(String(node.id), node)
})
map.forEach(node => {
const parentId = this.getParentId(node)
const parent = parentId !== '' ? map.get(String(parentId)) : null
if (parent && String(parent.id) !== String(node.id)) parent.children.push(node)
else roots.push(node)
})
const mark = (nodes, level = 0) => nodes.map(node => {
node._treeLabel = `${' '.repeat(level)}${node.name || ''}`
if (node.children.length) node.children = mark(node.children, level + 1)
else delete node.children
return node
})
return mark(roots)
},
flattenTree (tree, result = []) {
tree.forEach(item => {
result.push(item)
if (Array.isArray(item.children)) this.flattenTree(item.children, result)
})
return result
},
async fetchData () { async fetchData () {
this.loading = true this.loading = true
try { try {
@@ -196,10 +203,10 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const list = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res)
const total = Array.isArray(res) ? res.length : (res.count || 0) this.rawAreaData = data.list
this.tableData = list this.tableData = this.buildTree(data.list)
this.pagination.total = total this.pagination.total = data.total
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -222,7 +229,7 @@ export default {
this.selectedRows = rows this.selectedRows = rows
}, },
resetForm () { resetForm () {
this.formData = { code: '', name: '', remark: '' } this.formData = { code: '', name: '', parent_id: '', remark: '' }
this.editId = '' this.editId = ''
}, },
openAdd () { openAdd () {
@@ -237,22 +244,15 @@ export default {
openEdit (row) { openEdit (row) {
this.handleType = 'edit' this.handleType = 'edit'
this.dialogTitle = this.key('edit_title') this.dialogTitle = this.key('edit_title')
this.editId = row.id this.editId = this.getId(row)
this.formData = { this.formData = { code: row.code, name: row.name, parent_id: this.getParentId(row), remark: row.remark || '' }
code: row.code,
name: row.name,
remark: row.remark || ''
}
this.dialogVisible = true this.dialogVisible = true
}, },
async onDialogSubmit () { async onDialogSubmit () {
this.submitting = true this.submitting = true
try { try {
if (this.handleType === 'create') { if (this.handleType === 'create') await createFactoryArea(this.formData)
await createFactoryArea(this.formData) else await editFactoryArea({ ...this.formData, id: this.editId })
} else {
await editFactoryArea({ ...this.formData, id: this.editId })
}
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.dialogVisible = false this.dialogVisible = false
this.fetchData() this.fetchData()
@@ -263,31 +263,31 @@ export default {
onDialogClose () { onDialogClose () {
this.resetForm() this.resetForm()
}, },
async handleDelete (row) { async confirmAction (message, action) {
const cancelled = await this.$confirmAction( try {
{ await this.$confirm(this.$t(message), this.$t(this.key('tip')), { type: 'warning' })
message: this.key('confirm_delete'), } catch {
title: this.key('tip') return false
}
await action()
return true
}, },
() => deleteFactoryArea({ id: [row.id] }) async handleDelete (row) {
) const ok = await this.confirmAction(this.key('confirm_delete'), () => deleteFactoryArea({ id: [this.getId(row)] }))
if (cancelled) return if (!ok) return
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.pagination.current = Math.min( this.pagination.current = Math.min(this.pagination.current, Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1)
this.pagination.current,
Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1
)
this.fetchData() this.fetchData()
},
async handleExport () {
const ok = await this.confirmAction(this.key('confirm_export'), () => exportFactoryAreaTask({ ...this.search }))
if (ok) this.$message.success(this.$t(this.key('operation_success')))
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.search-bar { .search-bar { padding: 10px 0; }
padding: 10px 0; /deep/ .el-form-item--mini.el-form-item { margin-bottom: 4px; }
}
/deep/ .el-form-item--mini.el-form-item {
margin-bottom: 4px;
}
</style> </style>

View File

@@ -28,6 +28,7 @@
clearable clearable
filterable filterable
style="width:200px" style="width:200px"
@change="onSearch"
> >
<el-option <el-option
v-for="item in areaOptions" v-for="item in areaOptions"
@@ -62,7 +63,8 @@
auto-height auto-height
@page-change="onPageChange" @page-change="onPageChange"
@selection-change="onSelect" @selection-change="onSelect"
/> >
</page-table>
<page-dialog-form <page-dialog-form
ref="dialogForm" ref="dialogForm"
@@ -86,12 +88,12 @@
import { useTableColumns } from '@/composables/useTableColumns' import { useTableColumns } from '@/composables/useTableColumns'
import { useTableButtons } from '@/composables/useTableButtons' import { useTableButtons } from '@/composables/useTableButtons'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import { confirmMixin } from '@/composables/useConfirmHandle'
import { import {
getProductionLineList, getProductionLineList,
createProductionLine, createProductionLine,
editProductionLine, editProductionLine,
deleteProductionLine deleteProductionLine,
exportProductionLineTask
} from '@/api/production-master-data/production-line' } from '@/api/production-master-data/production-line'
import { getFactoryAreaALL } from '@/api/production-master-data/factory-area' import { getFactoryAreaALL } from '@/api/production-master-data/factory-area'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
@@ -100,7 +102,7 @@ import PageDialogForm from '@/components/page-dialog-form'
export default { export default {
name: 'production-master-data-production-line', name: 'production-master-data-production-line',
components: { PageTable, PageDialogForm }, components: { PageTable, PageDialogForm },
mixins: [i18nMixin('page.production_master_data.factory_model.production_line'), confirmMixin], mixins: [i18nMixin('page.production_master_data.factory_model.production_line')],
data () { data () {
return { return {
loading: false, loading: false,
@@ -118,81 +120,40 @@ export default {
rules: { rules: {
code: [ code: [
{ required: true, message: this.key('enter_code'), trigger: 'blur' }, { required: true, message: this.key('enter_code'), trigger: 'blur' },
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' } { min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
], ],
name: [ name: [
{ required: true, message: this.key('enter_name'), trigger: 'blur' }, { required: true, message: this.key('enter_name'), trigger: 'blur' },
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' } { min: 1, max: 100, message: this.key('length_1_100'), trigger: 'blur' }
], ],
area_id: [ area_id: [
{ required: true, message: this.key('select_area'), trigger: 'change' } { required: true, message: this.key('select_area'), trigger: 'change' }
],
remark: [
{ max: 500, message: this.key('remark_max_500'), trigger: 'blur' }
] ]
}, },
columns: [], columns: [],
toolbarButtons: [], toolbarButtons: [],
rowButtons: [], rowButtons: [],
baseFormCols: [ baseFormCols: [
[ [{ type: 'input', prop: 'code', label: this.key('code'), placeholder: this.key('enter_code'), clearable: true, style: { width: '90%' } }],
{ [{ type: 'input', prop: 'name', label: this.key('name'), placeholder: this.key('enter_name'), clearable: true, style: { width: '90%' } }],
type: 'input', [{ type: 'select', prop: 'area_id', label: this.key('area'), placeholder: this.key('select_area'), clearable: true, filterable: true, style: { width: '90%' }, options: [] }],
prop: 'code', [{ type: 'input', prop: 'remark', inputType: 'textarea', autosize: { minRows: 2, maxRows: 6 }, label: this.key('remark'), placeholder: this.key('enter_remark'), clearable: true, style: { width: '90%' } }]
label: this.key('code'),
placeholder: this.key('enter_code'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'name',
label: this.key('name'),
placeholder: this.key('enter_name'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'select',
prop: 'area_id',
label: this.key('area'),
placeholder: this.key('select_area'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: []
}
],
[
{
type: 'input',
prop: 'remark',
inputType: 'textarea',
autosize: { minRows: 2, maxRows: 6 },
label: this.key('remark'),
placeholder: this.key('enter_remark'),
clearable: true,
style: { width: '90%' }
}
]
] ]
} }
}, },
computed: { computed: {
dialogFormCols () { dialogFormCols () {
const idx = 2
const cols = JSON.parse(JSON.stringify(this.baseFormCols)) const cols = JSON.parse(JSON.stringify(this.baseFormCols))
if (cols[idx] && cols[idx][0]) { cols[2][0].options = this.areaOptions
cols[idx][0].options = this.areaOptions
}
return cols return cols
} }
}, },
created () { created () {
this.initAreaOptions() this.initAreaOptions()
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'sort', label: this.key('sort'), width: 80 },
{ prop: 'code', label: this.key('code'), minWidth: 120 }, { prop: 'code', label: this.key('code'), minWidth: 120 },
{ prop: 'name', label: this.key('name'), minWidth: 120 }, { prop: 'name', label: this.key('name'), minWidth: 120 },
{ prop: 'area_name', label: this.key('area_name'), minWidth: 120 }, { prop: 'area_name', label: this.key('area_name'), minWidth: 120 },
@@ -201,31 +162,12 @@ export default {
]) ])
const btns = useTableButtons({ const btns = useTableButtons({
toolbar: [ toolbar: [
{ { key: 'add', label: this.key('add'), icon: 'el-icon-plus', type: 'primary', auth: '/production_configuration/factory_model/factory_line/create', onClick: this.openAdd },
key: 'add', { key: 'export', label: this.key('export'), icon: 'el-icon-download', auth: '/production_configuration/factory_model/factory_line/export', onClick: this.handleExport }
label: this.key('add'),
icon: 'el-icon-plus',
type: 'primary',
auth: '/production_configuration/factory_model/factory_line/create',
onClick: this.openAdd
}
], ],
row: [ row: [
{ { key: 'edit', label: this.key('edit'), icon: 'el-icon-edit', auth: '/production_configuration/factory_model/factory_line/edit', onClick: this.openEdit },
key: 'edit', { key: 'delete', label: this.key('delete'), icon: 'el-icon-delete', color: 'danger', auth: '/production_configuration/factory_model/factory_line/delete', onClick: this.handleDelete }
label: this.key('edit'),
icon: 'el-icon-edit',
auth: '/production_configuration/factory_model/factory_line/edit',
onClick: this.openEdit
},
{
key: 'delete',
label: this.key('delete'),
icon: 'el-icon-delete',
color: 'danger',
auth: '/production_configuration/factory_model/factory_line/delete',
onClick: this.handleDelete
}
] ]
}, this.$permission) }, this.$permission)
this.toolbarButtons = btns.toolbarButtons this.toolbarButtons = btns.toolbarButtons
@@ -233,25 +175,39 @@ export default {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
async initAreaOptions () { async initAreaOptions () {
try { try {
const res = await getFactoryAreaALL() const res = await getFactoryAreaALL()
const data = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res).list
this.areaOptions = data.map(item => ({ value: item.area_id || item.id, label: item.name })) this.areaOptions = data.map(item => ({ value: item.area_id || item.id, label: item.name }))
} catch { /* 忽略加载失败 */ } } catch { /* 忽略加载失败 */ }
}, },
async fetchData () { async fetchData () {
this.loading = true this.loading = true
try { try {
const res = await getProductionLineList({ const res = await getProductionLineList({ ...this.search, page_no: this.pagination.current, page_size: this.pagination.size })
...this.search, const data = this.normalizeResponse(res)
page_no: this.pagination.current, this.tableData = data.list
page_size: this.pagination.size this.pagination.total = data.total
})
const list = Array.isArray(res) ? res : (res.data || [])
const total = Array.isArray(res) ? res.length : (res.count || 0)
this.tableData = list
this.pagination.total = total
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -290,22 +246,14 @@ export default {
this.handleType = 'edit' this.handleType = 'edit'
this.dialogTitle = this.key('edit_title') this.dialogTitle = this.key('edit_title')
this.editId = row.id this.editId = row.id
this.formData = { this.formData = { code: row.code, name: row.name, area_id: row.area_id, remark: row.remark || '' }
code: row.code,
name: row.name,
area_id: row.area_id,
remark: row.remark || ''
}
this.dialogVisible = true this.dialogVisible = true
}, },
async onDialogSubmit () { async onDialogSubmit () {
this.submitting = true this.submitting = true
try { try {
if (this.handleType === 'create') { if (this.handleType === 'create') await createProductionLine(this.formData)
await createProductionLine(this.formData) else await editProductionLine({ ...this.formData, id: this.editId })
} else {
await editProductionLine({ ...this.formData, id: this.editId })
}
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.dialogVisible = false this.dialogVisible = false
this.fetchData() this.fetchData()
@@ -316,31 +264,31 @@ export default {
onDialogClose () { onDialogClose () {
this.resetForm() this.resetForm()
}, },
async handleDelete (row) { async confirmAction (message, action) {
const cancelled = await this.$confirmAction( try {
{ await this.$confirm(this.$t(message), this.$t(this.key('tip')), { type: 'warning' })
message: this.key('confirm_delete'), } catch {
title: this.key('tip') return false
}
await action()
return true
}, },
() => deleteProductionLine({ id: [row.id] }) async handleDelete (row) {
) const ok = await this.confirmAction(this.key('confirm_delete'), () => deleteProductionLine({ id: [row.id] }))
if (cancelled) return if (!ok) return
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.pagination.current = Math.min( this.pagination.current = Math.min(this.pagination.current, Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1)
this.pagination.current,
Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1
)
this.fetchData() this.fetchData()
},
async handleExport () {
const ok = await this.confirmAction(this.key('confirm_export'), () => exportProductionLineTask({ ...this.search }))
if (ok) this.$message.success(this.$t(this.key('operation_success')))
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.search-bar { .search-bar { padding: 10px 0; }
padding: 10px 0; /deep/ .el-form-item--mini.el-form-item { margin-bottom: 4px; }
}
/deep/ .el-form-item--mini.el-form-item {
margin-bottom: 4px;
}
</style> </style>

View File

@@ -148,7 +148,6 @@ export default {
}, },
created () { created () {
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'sort', label: this.key('sort'), width: 80 },
{ prop: 'code', label: this.key('code'), minWidth: 120 }, { prop: 'code', label: this.key('code'), minWidth: 120 },
{ prop: 'name', label: this.key('name'), minWidth: 120 }, { prop: 'name', label: this.key('name'), minWidth: 120 },
{ prop: 'remark', label: this.key('remark') }, { prop: 'remark', label: this.key('remark') },

View File

@@ -1,5 +1,5 @@
<template> <template>
<el-dialog :title="$t(title)" :visible.sync="visible" append-to-body :close-on-click-modal="false" width="70%" :before-close="handleClose"> <el-dialog :title="title" :visible.sync="visible" append-to-body :close-on-click-modal="false" width="70%" :before-close="handleClose">
<div class="toolbar"> <div class="toolbar">
<el-button type="primary" size="mini" icon="el-icon-plus" @click="openAdd"> <el-button type="primary" size="mini" icon="el-icon-plus" @click="openAdd">
{{ $t(key('add_calculation_script')) }} {{ $t(key('add_calculation_script')) }}

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="$t(title)" :title="title"
:visible.sync="visible" :visible.sync="visible"
append-to-body append-to-body
:close-on-click-modal="false" :close-on-click-modal="false"

View File

@@ -0,0 +1,197 @@
<template>
<el-dialog
:title="title"
:visible.sync="visible"
:width="width"
append-to-body
:close-on-click-modal="false"
:before-close="handleClose"
>
<wait-plugin
v-if="type === 'WaitPlugin'"
ref="plugin"
:setting-json="pluginData"
@submit="handleChildSubmit"
/>
<json-plugin
v-else
ref="plugin"
:setting-json="pluginData"
:plugin-type="type"
:workingsubclass-code="code"
@submit="handleChildSubmit"
/>
<div slot="footer">
<el-button size="small" @click="handleClose">{{ $t(key('cancel')) }}</el-button>
<el-button type="primary" size="small" @click="handleFormSubmit">{{ $t(key('confirm')) }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { i18nMixin } from '@/composables/useI18n'
function parseSettingJson (value) {
if (value === undefined || value === null || value === '') return { process: {} }
if (typeof value === 'object') return value
try {
return JSON.parse(value)
} catch (e) {
return { process: {} }
}
}
const WaitPlugin = {
name: 'ProcessRoutingWaitPlugin',
mixins: [i18nMixin('page.production_master_data.process_model.process_routing.card')],
props: {
settingJson: { default: '' }
},
data () {
return {
form: { time: undefined, time_range: undefined, alert: '0' },
rules: {
time: [{ pattern: /^[0-9]\d*$/, message: this.key('integer_ge_0'), trigger: 'change' }],
time_range: [{ pattern: /^[0-9]\d*$/, message: this.key('integer_ge_0'), trigger: 'change' }]
}
}
},
watch: {
settingJson: {
handler (val) {
const json = parseSettingJson(val)
this.form = {
time: json.process && json.process.time !== undefined ? json.process.time : undefined,
time_range: json.process && json.process.time_range !== undefined ? json.process.time_range : undefined,
alert: json.process && json.process.alert !== undefined ? json.process.alert : '0'
}
},
immediate: true
}
},
methods: {
handleFormSubmit () {
this.$refs.form.validate(valid => {
if (!valid) {
this.$message.error(this.$t(this.key('validation_fail')))
return
}
this.$emit('submit', { process: { ...this.form } })
})
}
},
template: `
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini">
<el-form-item :label="$t(key('rest_time'))" prop="time">
<el-input v-model="form.time" :placeholder="$t(key('enter_rest_time'))" clearable>
<template slot="append">{{ $t(key('minute')) }}</template>
</el-input>
</el-form-item>
<el-form-item :label="$t(key('precision_range'))" prop="time_range">
<el-input v-model="form.time_range" :placeholder="$t(key('enter_precision_range'))" clearable>
<template slot="append">{{ $t(key('minute')) }}</template>
</el-input>
</el-form-item>
</el-form>
`
}
const JsonPlugin = {
name: 'ProcessRoutingJsonPlugin',
mixins: [i18nMixin('page.production_master_data.process_model.process_routing.card')],
props: {
settingJson: { default: '' },
pluginType: { type: String, default: '' },
workingsubclassCode: { type: String, default: '' }
},
data () {
return {
activeTab: 'process',
jsonText: '{}',
parsedJson: { process: {} }
}
},
watch: {
settingJson: {
handler (val) {
this.parsedJson = parseSettingJson(val)
this.jsonText = JSON.stringify(this.parsedJson.process || {}, null, 2)
},
immediate: true
}
},
methods: {
handleFormSubmit () {
if (!this.jsonText) {
this.$message.error(this.$t(this.key('input_empty')))
return
}
try {
this.$emit('submit', { ...this.parsedJson, process: JSON.parse(this.jsonText) })
} catch (e) {
this.$message.error(this.$t(this.key('json_format_error')))
}
}
},
template: `
<el-tabs v-model="activeTab" type="card">
<el-tab-pane :label="$t(key('setting'))" name="process">
<el-alert
v-if="pluginType"
:title="pluginType + (workingsubclassCode ? ' / ' + workingsubclassCode : '')"
type="info"
:closable="false"
show-icon
style="margin-bottom:12px"
/>
<el-input
v-model="jsonText"
type="textarea"
:rows="15"
:placeholder="$t(key('enter_setting_json'))"
/>
</el-tab-pane>
<el-tab-pane label="JSON" name="json">
<pre class="json-preview">{{ JSON.stringify(parsedJson, null, 2) }}</pre>
</el-tab-pane>
</el-tabs>
`
}
export default {
name: 'ProcessRoutingTechnologyFlowModel',
components: { WaitPlugin, JsonPlugin },
mixins: [i18nMixin('page.production_master_data.process_model.process_routing.card')],
props: {
type: { type: String, default: '' },
code: { type: String, default: '' },
title: { type: String, default: '' },
width: { type: String, default: '35%' },
visible: { type: Boolean, default: false },
pluginData: { default: '' }
},
methods: {
handleClose () {
this.$emit('close')
},
handleFormSubmit () {
this.$refs.plugin && this.$refs.plugin.handleFormSubmit()
},
handleChildSubmit (data) {
this.$emit('submit', data)
}
}
}
</script>
<style scoped>
.json-preview {
max-height: 360px;
overflow: auto;
padding: 12px;
background: #f5f7fa;
border: 1px solid #dcdfe6;
border-radius: 4px;
}
</style>

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-drawer :visible.sync="visible" :wrapper-closable="false" :with-header="false" size="50%"> <el-drawer :visible.sync="visible" :wrapper-closable="false" :with-header="false" size="50%">
<div class="drawer-title"> <div class="drawer-title">
<el-page-header @back="handleClose" :content="$t(title)" /> <el-page-header @back="handleClose" :content="title" />
</div> </div>
<div class="section"> <div class="section">

View File

@@ -191,7 +191,7 @@ import {
import { getWorkingsubclassAll } from '@/api/production-master-data/process-step' import { getWorkingsubclassAll } from '@/api/production-master-data/process-step'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import PageDialogForm from '@/components/page-dialog-form' import PageDialogForm from '@/components/page-dialog-form'
import TechnologyFlowModel from '../process-step/components/technology-flow-model.vue' import TechnologyFlowModel from './components/technology-flow-model.vue'
import ResultParam from './components/result-param.vue' import ResultParam from './components/result-param.vue'
import TemperatureCompensation from './components/temperature-compensation.vue' import TemperatureCompensation from './components/temperature-compensation.vue'
import CalculationScript from './components/calculation-script.vue' import CalculationScript from './components/calculation-script.vue'
@@ -295,8 +295,8 @@ export default {
{ {
type: 'select', type: 'select',
prop: 'pin_check', prop: 'pin_check',
label: this.$t(this.key('pin_check')), label: this.key('pin_check'),
placeholder: this.$t(this.key('select_pin_check')), placeholder: this.key('select_pin_check'),
clearable: false, clearable: false,
style: { width: '90%' }, style: { width: '90%' },
options: [ options: [
@@ -399,6 +399,25 @@ export default {
} }
}, },
methods: { methods: {
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
async fetchData () { async fetchData () {
this.loading = true this.loading = true
try { try {
@@ -466,7 +485,7 @@ export default {
loadWorkingsubclassOptions () { loadWorkingsubclassOptions () {
if (this.workingsubclassOptions.length > 0) return Promise.resolve() if (this.workingsubclassOptions.length > 0) return Promise.resolve()
return getWorkingsubclassAll().then(res => { return getWorkingsubclassAll().then(res => {
const list = res.data || res || [] const list = this.normalizeResponse(res).list
this.workingsubclassRawData = list this.workingsubclassRawData = list
this.workingsubclassOptions = list.map(item => ({ this.workingsubclassOptions = list.map(item => ({
label: item.name, label: item.name,
@@ -574,25 +593,26 @@ export default {
}, },
openSettingDrawer (row) { openSettingDrawer (row) {
this.settingRowId = row.id this.settingRowId = row.id
this.settingTitle = this.key('setting') this.settingTitle = `${row.name}${this.$t(this.key('setting'))}`
this.settingType = row.setting_plugin || row.device_category_code || '' this.settingType = row.setting_plugin || ''
this.settingCode = row.workingsubclass_code || row.code || '' this.settingCode = row.workingsubclass_code || row.code || ''
this.settingWidth = row.setting_plugin_width ? `${row.setting_plugin_width}%` : '35%'
this.settingPluginData = row.setting || {} this.settingPluginData = row.setting || {}
this.settingVisible = true this.settingVisible = true
}, },
openResultParamDrawer (row) { openResultParamDrawer (row) {
this.resultTitle = this.key('result_param') this.resultTitle = `${row.name}${this.$t(this.key('result_param'))}`
this.resultWorkingsubclassId = row.workingsubclass_id || '' this.resultWorkingsubclassId = row.workingsubclass_id || ''
this.resultFlowProcessId = row.id || '' this.resultFlowProcessId = row.id || ''
this.resultVisible = true this.resultVisible = true
}, },
openTemperatureDrawer (row) { openTemperatureDrawer (row) {
this.temperatureTitle = this.key('temperature') this.temperatureTitle = `${row.name}${this.$t(this.key('temperature'))}`
this.temperatureFlowProcessId = row.id || '' this.temperatureFlowProcessId = row.id || ''
this.temperatureVisible = true this.temperatureVisible = true
}, },
openCalculationScriptDrawer (row) { openCalculationScriptDrawer (row) {
this.calculationTitle = this.key('calculation_script') this.calculationTitle = `${row.name}${this.$t(this.key('calculation_script'))}`
this.calculationFlowProcessId = row.id || '' this.calculationFlowProcessId = row.id || ''
this.calculationVisible = true this.calculationVisible = true
}, },

View File

@@ -228,7 +228,6 @@ export default {
}, },
created () { created () {
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'sort', label: this.key('sort'), width: 80 },
{ prop: 'code', label: this.key('code'), minWidth: 120 }, { prop: 'code', label: this.key('code'), minWidth: 120 },
{ prop: 'name', label: this.key('name'), minWidth: 140 }, { prop: 'name', label: this.key('name'), minWidth: 140 },
{ prop: 'flow_category_name', label: this.key('category'), minWidth: 120 }, { prop: 'flow_category_name', label: this.key('category'), minWidth: 120 },
@@ -288,6 +287,25 @@ export default {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
async fetchData () { async fetchData () {
this.loading = true this.loading = true
try { try {
@@ -296,10 +314,9 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const list = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res)
const total = Array.isArray(res) ? res.length : (res.count || 0) this.tableData = data.list
this.tableData = list this.pagination.total = data.total
this.pagination.total = total
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -337,7 +354,7 @@ export default {
loadDialogCategories () { loadDialogCategories () {
if (this.categoryOptions.length > 0) return if (this.categoryOptions.length > 0) return
getProcessCategoryAll().then(res => { getProcessCategoryAll().then(res => {
this.categoryOptions = (res.data || res || []).map(item => ({ this.categoryOptions = this.normalizeResponse(res).list.map(item => ({
label: item.name, label: item.name,
value: item.id value: item.id
})) }))
@@ -347,7 +364,7 @@ export default {
loadDialogProducts () { loadDialogProducts () {
if (this.productOptions.length > 0) return if (this.productOptions.length > 0) return
getProductBatteryAll().then(res => { getProductBatteryAll().then(res => {
this.productOptions = (res.data || res || []).map(item => ({ this.productOptions = this.normalizeResponse(res).list.map(item => ({
label: item.name, label: item.name,
value: item.product_model_id value: item.product_model_id
})) }))
@@ -357,13 +374,13 @@ export default {
loadSearchCategories () { loadSearchCategories () {
if (this.searchCategoryOptions.length > 0) return if (this.searchCategoryOptions.length > 0) return
getProcessCategoryAll().then(res => { getProcessCategoryAll().then(res => {
this.searchCategoryOptions = res.data || res || [] this.searchCategoryOptions = this.normalizeResponse(res).list
}) })
}, },
loadSearchProducts () { loadSearchProducts () {
if (this.searchProductOptions.length > 0) return if (this.searchProductOptions.length > 0) return
getProductBatteryAll().then(res => { getProductBatteryAll().then(res => {
this.searchProductOptions = res.data || res || [] this.searchProductOptions = this.normalizeResponse(res).list
}) })
}, },
openAdd () { openAdd () {

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="$t(title)" :title="title"
:visible.sync="visible" :visible.sync="visible"
:append-to-body="true" :append-to-body="true"
:close-on-click-modal="false" :close-on-click-modal="false"
@@ -129,6 +129,66 @@
<el-button type="primary" @click="handleSubmit">{{ $t(key('confirm')) }}</el-button> <el-button type="primary" @click="handleSubmit">{{ $t(key('confirm')) }}</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
:title="$t(key('preset_result_param_import'))"
:visible.sync="importVisible"
append-to-body
width="75%"
:close-on-click-modal="false"
:before-close="handleImportClose"
>
<el-alert
:title="$t(key('file_suffix_rule'))"
:closable="false"
type="warning"
show-icon
/>
<el-form label-width="90px" class="import-form">
<el-form-item :label="$t(key('import_table'))">
<el-upload
action=""
:multiple="false"
:auto-upload="false"
:show-file-list="true"
:file-list="importFileList"
accept=".xls,.xlsx"
:on-change="onImportFileChange"
>
<el-button slot="trigger" size="mini" type="success">{{ $t(key('select_file')) }}</el-button>
<el-button
style="margin-left:10px"
size="mini"
type="primary"
:loading="downloadImportLoading"
@click.stop="downloadTemplate"
>
{{ $t(key('download_template')) }}
</el-button>
</el-upload>
</el-form-item>
<el-form-item :label="$t(key('preview'))">
<el-table
v-loading="importTableLoading"
:data="importRows"
border
height="360"
style="width:100%"
>
<el-table-column prop="name" :label="$t(key('name'))" min-width="140" show-overflow-tooltip />
<el-table-column prop="code" :label="$t(key('param'))" min-width="140" show-overflow-tooltip />
<el-table-column prop="field_type" :label="$t(key('category'))" min-width="120" />
<el-table-column prop="remark" :label="$t(key('remark'))" min-width="160" show-overflow-tooltip />
<el-table-column prop="is_only" :label="$t(key('is_unique'))" width="110" />
<el-table-column prop="is_upload" :label="$t(key('is_upload'))" width="110" />
</el-table>
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="handleImportClose">{{ $t(key('cancel')) }}</el-button>
<el-button type="primary" :loading="importSubmitting" @click="submitImport">{{ $t(key('confirm')) }}</el-button>
</div>
</el-dialog>
</el-dialog> </el-dialog>
</template> </template>
@@ -138,8 +198,11 @@ import {
getOptionalParamsList, getOptionalParamsList,
createOptionalParams, createOptionalParams,
editOptionalParams, editOptionalParams,
deleteOptionalParams deleteOptionalParams,
getImportTemplate,
importDataCreate
} from '@/api/production-master-data/optional-params' } from '@/api/production-master-data/optional-params'
import { downloadRename, readExcel } from '@/utils/file'
export default { export default {
name: 'ProcessStepResultParam', name: 'ProcessStepResultParam',
@@ -167,6 +230,12 @@ export default {
pagination: { current: 1, size: 10, total: 0 }, pagination: { current: 1, size: 10, total: 0 },
innerVisible: false, innerVisible: false,
dialogTitle: '', dialogTitle: '',
importVisible: false,
downloadImportLoading: false,
importFileList: [],
importTableLoading: false,
importSubmitting: false,
importRows: [],
formData: { formData: {
id: '', id: '',
code: '', code: '',
@@ -201,6 +270,25 @@ export default {
this.innerVisible = false this.innerVisible = false
this.$refs.form && this.$refs.form.resetFields() this.$refs.form && this.$refs.form.resetFields()
}, },
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
onSearch () { onSearch () {
this.pagination.current = 1 this.pagination.current = 1
this.fetchData() this.fetchData()
@@ -214,10 +302,9 @@ export default {
page_size: this.pagination.size, page_size: this.pagination.size,
...this.searchForm ...this.searchForm
}).then(res => { }).then(res => {
const list = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res)
const total = Array.isArray(res) ? res.length : (res.count || 0) this.tableData = data.list
this.tableData = list this.pagination.total = data.total
this.pagination.total = total
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
}) })
@@ -265,6 +352,7 @@ export default {
}).then(() => { }).then(() => {
deleteOptionalParams({ workingsubclass_id: this.workingsubclass_id, id: row.id }).then(() => { deleteOptionalParams({ workingsubclass_id: this.workingsubclass_id, id: row.id }).then(() => {
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.pagination.current = Math.min(this.pagination.current, Math.ceil((this.pagination.total - 1) / this.pagination.size) || 1)
this.fetchData() this.fetchData()
}) })
}).catch(() => {}) }).catch(() => {})
@@ -283,7 +371,109 @@ export default {
}) })
}, },
handleImport () { handleImport () {
this.$message.info(this.$t(this.key('import_tip'))) this.importFileList = []
this.importRows = []
this.importVisible = true
},
handleImportClose () {
this.importVisible = false
this.importFileList = []
this.importRows = []
},
async downloadTemplate () {
this.downloadImportLoading = true
try {
const res = await getImportTemplate({})
downloadRename(res, 'xlsx', this.$t(this.key('optional_param_import_template')))
} finally {
this.downloadImportLoading = false
}
},
getImportValue (row, keys) {
for (const key of keys) {
if (row[key] !== undefined && row[key] !== null) return row[key]
}
return ''
},
normalizeFlag (value) {
if (value === 1 || value === '1') return 1
if (value === 0 || value === '0') return 0
const text = String(value || '').trim().toLowerCase()
if ([this.$t(this.key('yes')).toLowerCase(), '是', 'yes', 'true'].includes(text)) return 1
if ([this.$t(this.key('no')).toLowerCase(), '否', 'no', 'false'].includes(text)) return 0
return value
},
async onImportFileChange (file) {
if (!file || !/\.(xls|xlsx)$/i.test(file.name)) {
this.$message.error(this.$t(this.key('upload_format_error')))
this.importFileList = []
return
}
this.importFileList = [file]
this.importTableLoading = true
try {
const rows = await readExcel(file.raw)
const required = [
{ label: this.key('name'), aliases: [this.$t(this.key('name')), '名称', 'Name'] },
{ label: this.key('param'), aliases: [this.$t(this.key('param')), '参数', 'Parameter'] },
{ label: this.key('category'), aliases: [this.$t(this.key('category')), '类别', 'Category'] }
]
const first = rows[0] || {}
const missing = required.find(field => !field.aliases.some(alias => Object.prototype.hasOwnProperty.call(first, alias)))
if (missing) {
this.$message.error(this.$t(this.key('import_missing_column'), { name: this.$t(missing.label) }))
this.importRows = []
return
}
const nameSet = new Set()
const codeSet = new Set()
const result = []
for (const row of rows) {
const name = this.getImportValue(row, [this.$t(this.key('name')), '名称', 'Name'])
const code = this.getImportValue(row, [this.$t(this.key('param')), '参数', 'Parameter'])
if (nameSet.has(name)) {
this.$message.error(this.$t(this.key('import_duplicate_name'), { name }))
this.importRows = []
return
}
if (codeSet.has(code)) {
this.$message.error(this.$t(this.key('import_duplicate_param'), { param: code }))
this.importRows = []
return
}
nameSet.add(name)
codeSet.add(code)
result.push({
name,
code,
field_type: this.getImportValue(row, [this.$t(this.key('category')), '类别', 'Category']),
remark: this.getImportValue(row, [this.$t(this.key('remark')), '备注', 'Remark']),
is_only: this.normalizeFlag(this.getImportValue(row, [this.$t(this.key('is_unique')), '是否唯一', 'Is Unique'])),
is_upload: this.normalizeFlag(this.getImportValue(row, [this.$t(this.key('is_upload')), '是否上传', 'Is Upload Required']))
})
}
this.importRows = result
} finally {
this.importTableLoading = false
}
},
async submitImport () {
if (!this.importRows.length) {
this.$message.error(this.$t(this.key('please_import_data')))
return
}
this.importSubmitting = true
try {
await importDataCreate({
workingsubclass_id: this.workingsubclass_id,
import_data: JSON.stringify(this.importRows)
})
this.$message.success(this.$t(this.key('operation_success')))
this.handleImportClose()
this.fetchData()
} finally {
this.importSubmitting = false
}
} }
} }
} }
@@ -296,4 +486,7 @@ export default {
.box-card { .box-card {
width: 100%; width: 100%;
} }
.import-form {
margin-top: 16px;
}
</style> </style>

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="$t(title)" :title="title"
:visible.sync="visible" :visible.sync="visible"
:append-to-body="true" :append-to-body="true"
:close-on-click-modal="false" :close-on-click-modal="false"

View File

@@ -21,6 +21,24 @@
@keyup.enter.native="onSearch" @keyup.enter.native="onSearch"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('device_category'))">
<el-select
v-model="search.device_category_id"
:placeholder="$t(key('select_device_category'))"
clearable
filterable
style="width:200px"
@focus="loadDeviceCategoryOptions"
@change="onSearch"
>
<el-option
v-for="item in deviceCategoryOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onSearch"> <el-button type="primary" icon="el-icon-search" @click="onSearch">
{{ $t(key('search')) }} {{ $t(key('search')) }}
@@ -46,7 +64,12 @@
auto-height auto-height
@page-change="onPageChange" @page-change="onPageChange"
@selection-change="onSelect" @selection-change="onSelect"
/> >
<template #col-is_denglu_process="{ row }">
<el-tag v-if="String(row.is_denglu_process) === '1'" size="mini">{{ $t(key('yes')) }}</el-tag>
<el-tag v-else type="warning" size="mini">{{ $t(key('no')) }}</el-tag>
</template>
</page-table>
<page-dialog-form <page-dialog-form
ref="dialogForm" ref="dialogForm"
@@ -116,9 +139,10 @@ export default {
dialogTitle: '', dialogTitle: '',
editId: '', editId: '',
handleType: 'create', handleType: 'create',
search: { code: '', name: '' }, search: { code: '', name: '', device_category_id: '' },
pagination: { current: 1, size: 10, total: 0 }, pagination: { current: 1, size: 10, total: 0 },
formData: { code: '', name: '', device_category_id: '', remark: '' }, deviceCategoryOptions: [],
formData: { code: '', name: '', device_category_id: '', is_denglu_process: '0', remark: '' },
settingVisible: false, settingVisible: false,
settingTitle: '', settingTitle: '',
settingType: '', settingType: '',
@@ -139,6 +163,9 @@ export default {
], ],
device_category_id: [ device_category_id: [
{ required: true, message: this.key('select_device_category'), trigger: 'change' } { required: true, message: this.key('select_device_category'), trigger: 'change' }
],
is_denglu_process: [
{ required: true, message: this.key('select_login_process'), trigger: 'change' }
] ]
}, },
columns: [], columns: [],
@@ -175,7 +202,23 @@ export default {
clearable: true, clearable: true,
filterable: true, filterable: true,
style: { width: '90%' }, style: { width: '90%' },
options: [] options: [],
onFocus: this.loadDeviceCategoryOptions
}
],
[
{
type: 'select',
prop: 'is_denglu_process',
label: this.key('login_process'),
placeholder: this.key('select_login_process'),
clearable: false,
filterable: true,
style: { width: '90%' },
options: [
{ label: this.$t(this.key('yes')), value: '1' },
{ label: this.$t(this.key('no')), value: '0' }
]
} }
], ],
[ [
@@ -195,12 +238,12 @@ export default {
}, },
created () { created () {
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'sort ', label: this.key('sort'), width: 80 },
{ prop: 'code', label: this.key('process_unit_code'), minWidth: 120 }, { prop: 'code', label: this.key('process_unit_code'), minWidth: 120 },
{ prop: 'name', label: this.key('process_unit_name'), minWidth: 120 }, { prop: 'name', label: this.key('process_unit_name'), minWidth: 120 },
{ prop: 'device_category_name', label: this.key('device_category'), minWidth: 120 }, { prop: 'device_category_name', label: this.key('device_category'), minWidth: 120 },
{ prop: 'is_denglu_process', label: this.key('login_process'), width: 120, slot: 'is_denglu_process' },
{ prop: 'remark', label: this.key('remark') }, { prop: 'remark', label: this.key('remark') },
{ prop: '_actions', label: this.key('operation'), width: 160, fixed: 'right' } { prop: '_actions', label: this.key('operation'), width: 350, fixed: 'right' }
]) ])
const btns = useTableButtons({ const btns = useTableButtons({
toolbar: [ toolbar: [
@@ -218,7 +261,7 @@ export default {
key: 'edit', key: 'edit',
label: this.key('edit'), label: this.key('edit'),
icon: 'el-icon-edit', icon: 'el-icon-edit',
auth: '/production_configuration/technology_model/technology_flow_process/edit', auth: '/production_configuration/technology_model/technology_flow_workingsubclass/edit',
onClick: this.openEdit onClick: this.openEdit
}, },
{ {
@@ -227,7 +270,8 @@ export default {
icon: 'el-icon-setting', icon: 'el-icon-setting',
color: 'warning', color: 'warning',
auth: '/production_configuration/technology_model/technology_flow_workingsubclass/setting', auth: '/production_configuration/technology_model/technology_flow_workingsubclass/setting',
onClick: this.openSetting onClick: this.openSetting,
visible: row => !!row.setting_plugin
}, },
{ {
key: 'result', key: 'result',
@@ -249,17 +293,38 @@ export default {
}, this.$permission) }, this.$permission)
this.toolbarButtons = btns.toolbarButtons this.toolbarButtons = btns.toolbarButtons
this.rowButtons = btns.rowButtons this.rowButtons = btns.rowButtons
this.loadDeviceCategoryOptions()
this.fetchData() this.fetchData()
}, },
methods: { methods: {
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
loadDeviceCategoryOptions () { loadDeviceCategoryOptions () {
if (this.formCols[2][0].options.length > 0) return Promise.resolve() if (this.deviceCategoryOptions.length > 0) return Promise.resolve()
return getDeviceCategoryAll().then(res => { return getDeviceCategoryAll().then(res => {
const list = res.data || res || [] const list = this.normalizeResponse(res).list
this.formCols[2][0].options = list.map(item => ({ this.deviceCategoryOptions = list.map(item => ({
label: item.name, label: item.name,
value: item.id value: item.id
})) }))
this.formCols[2][0].options = this.deviceCategoryOptions
}) })
}, },
async fetchData () { async fetchData () {
@@ -270,10 +335,9 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const list = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res)
const total = Array.isArray(res) ? res.length : (res.count || 0) this.tableData = data.list
this.tableData = list this.pagination.total = data.total
this.pagination.total = total
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -283,7 +347,7 @@ export default {
this.fetchData() this.fetchData()
}, },
onReset () { onReset () {
this.search = { code: '', name: '' } this.search = { code: '', name: '', device_category_id: '' }
this.pagination.current = 1 this.pagination.current = 1
this.fetchData() this.fetchData()
}, },
@@ -296,7 +360,7 @@ export default {
this.selectedRows = rows this.selectedRows = rows
}, },
resetForm () { resetForm () {
this.formData = { code: '', name: '', device_category_id: '', remark: '' } this.formData = { code: '', name: '', device_category_id: '', is_denglu_process: '0', remark: '' }
this.editId = '' this.editId = ''
this.$nextTick(() => { this.$nextTick(() => {
this.formCols[0][0].disabled = false this.formCols[0][0].disabled = false
@@ -321,6 +385,7 @@ export default {
code: row.code, code: row.code,
name: row.name, name: row.name,
device_category_id: row.device_category_id || '', device_category_id: row.device_category_id || '',
is_denglu_process: String(row.is_denglu_process || '0'),
remark: row.remark || '' remark: row.remark || ''
} }
this.$nextTick(() => { this.$nextTick(() => {
@@ -366,17 +431,17 @@ export default {
}, },
openSetting (row) { openSetting (row) {
this.currentRowId = row.id this.currentRowId = row.id
this.settingTitle = this.key('preset_setting') this.settingTitle = `${row.name}${this.$t(this.key('preset_setting'))}`
this.settingType = row.device_category_code || row.device_category_name || '' this.settingType = row.setting_plugin || ''
this.settingCode = row.code this.settingCode = row.code
this.settingWidth = '60%' this.settingWidth = row.setting_plugin_width ? `${row.setting_plugin_width}%` : '35%'
this.settingPluginData = row.setting || {} this.settingPluginData = row.default_setting || {}
this.settingVisible = true this.settingVisible = true
}, },
async handleSettingSubmit (data) { async handleSettingSubmit (data) {
await settingSubmit({ await settingSubmit({
id: this.currentRowId, id: this.currentRowId,
setting: JSON.stringify(data) default_setting: JSON.stringify(data)
}) })
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.settingVisible = false this.settingVisible = false
@@ -384,7 +449,7 @@ export default {
}, },
openResult (row) { openResult (row) {
this.currentRowId = row.id this.currentRowId = row.id
this.resultTitle = this.key('preset_result_param') this.resultTitle = `${row.name}${this.$t(this.key('preset_result_param'))}`
this.resultVisible = true this.resultVisible = true
} }
} }

View File

@@ -14,9 +14,9 @@
> >
<el-option <el-option
v-for="item in deviceCategoryOptions" v-for="item in deviceCategoryOptions"
:key="item.id" :key="item.value"
:label="item.name" :label="item.label"
:value="item.id" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -74,7 +74,11 @@
auto-height auto-height
@page-change="onPageChange" @page-change="onPageChange"
@selection-change="onSelect" @selection-change="onSelect"
/> >
<template #col-type="{ row }">
<span>{{ typeText(row.type) }}</span>
</template>
</page-table>
<page-dialog-form <page-dialog-form
ref="dialogForm" ref="dialogForm"
@@ -168,7 +172,6 @@ export default {
clearable: true, clearable: true,
style: { width: '90%' }, style: { width: '90%' },
options: [], options: [],
keys: { label: 'name', value: 'id' },
onFocus: this.onFormDeviceCategoryFocus onFocus: this.onFormDeviceCategoryFocus
} }
], ],
@@ -181,10 +184,9 @@ export default {
clearable: true, clearable: true,
style: { width: '90%' }, style: { width: '90%' },
options: [ options: [
{ name: this.key('type_error'), code: 'ERR' }, { label: 'ERR', value: 'ERR' },
{ name: this.key('type_ng'), code: 'NG' } { label: 'NG', value: 'NG' }
], ]
keys: { label: 'name', value: 'code' }
} }
], ],
[ [
@@ -222,9 +224,8 @@ export default {
] ]
this.columns = useTableColumns([ this.columns = useTableColumns([
{ type: 'selection', width: 55 },
{ prop: 'device_category_name', label: this.key('device_category'), minWidth: 140 }, { prop: 'device_category_name', label: this.key('device_category'), minWidth: 140 },
{ prop: 'type', label: this.key('exception_ng_category'), minWidth: 120 }, { prop: 'type', label: this.key('exception_ng_category'), minWidth: 120, slot: 'type' },
{ prop: 'number', label: this.key('ng_code'), minWidth: 140 }, { prop: 'number', label: this.key('ng_code'), minWidth: 140 },
{ prop: 'explain', label: this.key('ng_name'), minWidth: 140 }, { prop: 'explain', label: this.key('ng_name'), minWidth: 140 },
{ prop: 'note', label: this.key('remark'), minWidth: 200 }, { prop: 'note', label: this.key('remark'), minWidth: 200 },
@@ -286,9 +287,45 @@ export default {
}, this.$permission) }, this.$permission)
this.toolbarButtons = btns.toolbarButtons this.toolbarButtons = btns.toolbarButtons
this.rowButtons = btns.rowButtons this.rowButtons = btns.rowButtons
this.loadDeviceCategories().then(() => {
this.fetchData() this.fetchData()
})
}, },
methods: { methods: {
normalizeResponse (res) {
const root = res || {}
const data = res && res.data !== undefined ? res.data : res
if (Array.isArray(data)) return { list: data, total: Number(root.count || root.total || data.length) }
if (data && Array.isArray(data.list)) return { list: data.list, total: Number(root.count || root.total || data.count || data.total || data.list.length) }
if (data && Array.isArray(data.rows)) return { list: data.rows, total: Number(root.count || root.total || data.count || data.total || data.rows.length) }
if (data && Array.isArray(data.records)) return { list: data.records, total: Number(root.count || root.total || data.count || data.total || data.records.length) }
if (data && Array.isArray(data.data)) return { list: data.data, total: Number(root.count || root.total || data.count || data.total || data.data.length) }
if (data && data.data && Array.isArray(data.data.data)) return { list: data.data.data, total: Number(root.count || root.total || data.count || data.total || data.data.count || data.data.total || data.data.data.length) }
if (data && data.data && Array.isArray(data.data.list)) return { list: data.data.list, total: Number(root.count || root.total || data.count || data.total || data.data.count || data.data.total || data.data.list.length) }
return { list: [], total: 0 }
},
normalizeRow (row) {
const deviceCategory = typeof row.device_category === 'object'
? row.device_category
: (typeof row.category === 'object' ? row.category : {})
const option = this.deviceCategoryOptions.find(item => String(item.value) === String(row.device_category_id || deviceCategory.id || ''))
return {
...row,
device_category_id: row.device_category_id || deviceCategory.id || '',
device_category_name: row.device_category_name || deviceCategory.name || row.category_name || (option && option.label) || (typeof row.device_category === 'string' ? row.device_category : '')
}
},
normalizeOptions (res) {
return this.normalizeResponse(res).list.map(item => ({
label: item.name || item.label || item.code || item.id,
value: item.id !== undefined ? item.id : item.value
})).filter(item => item.value !== undefined && item.value !== null && item.value !== '')
},
typeText (type) {
if (type === 'ERR') return this.$t(this.key('type_error'))
if (type === 'NG') return this.$t(this.key('type_ng'))
return type
},
async fetchData () { async fetchData () {
this.loading = true this.loading = true
try { try {
@@ -297,11 +334,9 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const data = Array.isArray(res) ? res : (res.data || {}) const data = this.normalizeResponse(res)
const list = Array.isArray(data) ? data : (data.data || []) this.tableData = data.list.map(this.normalizeRow)
const total = Array.isArray(data) ? data.length : (data.count || 0) this.pagination.total = data.total
this.tableData = list
this.pagination.total = total
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -327,8 +362,7 @@ export default {
if (this.deviceCategoryOptions.length) return if (this.deviceCategoryOptions.length) return
try { try {
const res = await getDeviceCategoryAll({}) const res = await getDeviceCategoryAll({})
const list = Array.isArray(res) ? res : (res.data || []) this.deviceCategoryOptions = this.normalizeOptions(res)
this.deviceCategoryOptions = Array.isArray(list) ? list : []
this.searchFormDeviceCategoryUpdate() this.searchFormDeviceCategoryUpdate()
} catch { /* ignore */ } } catch { /* ignore */ }
}, },
@@ -349,18 +383,18 @@ export default {
openAdd () { openAdd () {
this.handleType = 'create' this.handleType = 'create'
this.dialogTitle = this.key('add_exception_ng_category') this.dialogTitle = this.key('add_exception_ng_category')
this.loadDeviceCategories() this.loadDeviceCategories().then(() => {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dialogForm && this.$refs.dialogForm.reset() this.$refs.dialogForm && this.$refs.dialogForm.reset()
this.resetForm() this.resetForm()
this.dialogVisible = true this.dialogVisible = true
}) })
})
}, },
openEdit (row) { openEdit (row) {
this.handleType = 'edit' this.handleType = 'edit'
this.dialogTitle = this.key('edit_exception_ng_category') this.dialogTitle = this.key('edit_exception_ng_category')
this.editId = row.id this.editId = row.id
this.loadDeviceCategories()
this.formData = { this.formData = {
device_category_id: row.device_category_id || '', device_category_id: row.device_category_id || '',
type: row.type || '', type: row.type || '',
@@ -368,7 +402,9 @@ export default {
explain: row.explain || '', explain: row.explain || '',
note: row.note || '' note: row.note || ''
} }
this.loadDeviceCategories().then(() => {
this.dialogVisible = true this.dialogVisible = true
})
}, },
async onDialogSubmit () { async onDialogSubmit () {
this.submitting = true this.submitting = true

View File

@@ -3,43 +3,41 @@
<template #header> <template #header>
<div class="search-bar"> <div class="search-bar">
<el-form :inline="true" size="mini"> <el-form :inline="true" size="mini">
<el-form-item :label="$t(key('code'))"> <el-form-item :label="$t(key('result_param_code'))">
<el-input <el-input
v-model="search.code" v-model="search.result_param_code"
:placeholder="$t(key('enter_code'))" :placeholder="$t(key('enter_result_param_code'))"
clearable clearable
style="width:200px" style="width:200px"
@keyup.enter.native="onSearch" @keyup.enter.native="onSearch"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('name'))"> <el-form-item :label="$t(key('result_param_name'))">
<el-input <el-input
v-model="search.name" v-model="search.result_param_name"
:placeholder="$t(key('enter_name'))" :placeholder="$t(key('enter_result_param_name'))"
clearable clearable
style="width:200px" style="width:200px"
@keyup.enter.native="onSearch" @keyup.enter.native="onSearch"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('scada_node'))"> <el-form-item :label="$t(key('scada_node_code'))">
<el-input <el-input
v-model="search.scada_node" v-model="search.scada_node_code"
:placeholder="$t(key('enter_scada_node'))" :placeholder="$t(key('enter_scada_node_code'))"
clearable clearable
style="width:200px" style="width:200px"
@keyup.enter.native="onSearch" @keyup.enter.native="onSearch"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('status'))"> <el-form-item :label="$t(key('scada_node_name'))">
<el-select <el-input
v-model="search.status" v-model="search.scada_node_name"
:placeholder="$t(key('select_status'))" :placeholder="$t(key('enter_scada_node_name'))"
clearable clearable
style="width:140px" style="width:200px"
> @keyup.enter.native="onSearch"
<el-option :value="1" :label="$t(key('enable'))" /> />
<el-option :value="0" :label="$t(key('disable'))" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onSearch"> <el-button type="primary" icon="el-icon-search" @click="onSearch">
@@ -66,7 +64,11 @@
auto-height auto-height
@page-change="onPageChange" @page-change="onPageChange"
@selection-change="onSelect" @selection-change="onSelect"
/> >
<template #col-category="{ row }">
<span>{{ categoryText(row.category) }}</span>
</template>
</page-table>
<page-dialog-form <page-dialog-form
ref="dialogForm" ref="dialogForm"
@@ -97,6 +99,9 @@ import {
editDataCollectionConfig, editDataCollectionConfig,
deleteDataCollectionConfig deleteDataCollectionConfig
} from '@/api/production-master-data/data-collection-configuration' } from '@/api/production-master-data/data-collection-configuration'
import { getOptionalParamsList } from '@/api/production-master-data/optional-params'
import { getWorkingsubclassAll } from '@/api/production-master-data/process-step'
import { getQueryCodes } from '@/api/scada-manage/edge-manager'
import PageTable from '@/components/page-table' import PageTable from '@/components/page-table'
import PageDialogForm from '@/components/page-dialog-form' import PageDialogForm from '@/components/page-dialog-form'
@@ -117,140 +122,57 @@ export default {
dialogTitle: '', dialogTitle: '',
editId: '', editId: '',
handleType: 'create', handleType: 'create',
search: { code: '', name: '', scada_node: '', status: '' }, search: {
result_param_code: undefined,
result_param_name: undefined,
scada_node_code: undefined,
scada_node_name: undefined
},
pagination: { current: 1, size: 10, total: 0 }, pagination: { current: 1, size: 10, total: 0 },
workingSubclassOptions: [],
workingSubclassRawData: [],
resultParamOptions: [],
scadaNodeOptions: [],
formData: { formData: {
code: '', working_subclass_id: undefined,
name: '', category: undefined,
scada_node: '', result_param_code: undefined,
collect_type: '', scada_node_code: undefined,
interval: 1, result_param_type: 1
status: 1,
remark: ''
}, },
rules: { rules: {
code: [ working_subclass_id: [
{ required: true, message: this.key('enter_code'), trigger: 'blur' }, { required: true, message: this.key('select_working_subclass'), trigger: 'change' }
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' }
], ],
name: [ category: [
{ required: true, message: this.key('enter_name'), trigger: 'blur' }, { required: true, message: this.key('select_data_type'), trigger: 'change' }
{ min: 1, max: 100, message: this.key('remark_length'), trigger: 'blur' }
], ],
scada_node: [ result_param_code: [
{ required: true, message: this.key('enter_scada_node'), trigger: 'blur' } { required: true, message: this.key('select_result_param'), trigger: 'change' }
], ],
collect_type: [ scada_node_code: [
{ required: true, message: this.key('select_collect_type'), trigger: 'change' } { required: true, message: this.key('select_scada_node'), trigger: 'change' }
], ],
interval: [ result_param_type: [
{ required: true, message: this.key('enter_interval'), trigger: 'blur' } { required: true, message: this.key('select_data_type'), trigger: 'change' }
],
status: [
{ required: true, message: this.key('select_status'), trigger: 'change' }
] ]
}, },
columns: [], columns: [],
toolbarButtons: [], toolbarButtons: [],
rowButtons: [], rowButtons: [],
formCols: [ formCols: []
[
{
type: 'input',
prop: 'code',
label: this.key('code'),
placeholder: this.key('enter_code'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'name',
label: this.key('name'),
placeholder: this.key('enter_name'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'input',
prop: 'scada_node',
label: this.key('scada_node'),
placeholder: this.key('enter_scada_node'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'select',
prop: 'collect_type',
label: this.key('collect_type'),
placeholder: this.key('select_collect_type'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: [
{ label: this.key('real_time'), value: 'real_time' },
{ label: this.key('periodic'), value: 'periodic' },
{ label: this.key('trigger'), value: 'trigger' }
]
}
],
[
{
type: 'input',
prop: 'interval',
inputType: 'number',
label: this.key('interval'),
placeholder: this.key('enter_interval'),
clearable: true,
style: { width: '90%' }
}
],
[
{
type: 'select',
prop: 'status',
label: this.key('status'),
placeholder: this.key('select_status'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: [
{ label: this.key('enable'), value: 1 },
{ label: this.key('disable'), value: 0 }
]
}
],
[
{
type: 'input',
prop: 'remark',
inputType: 'textarea',
autosize: { minRows: 2, maxRows: 6 },
label: this.key('remark'),
placeholder: this.key('enter_remark'),
clearable: true,
style: { width: '90%' }
}
]
]
} }
}, },
created () { created () {
this.columns = useTableColumns([ this.columns = useTableColumns([
{ prop: 'sort', label: this.key('sort'), width: 80 }, { prop: 'working_subclass', label: this.key('working_subclass'), minWidth: 140 },
{ prop: 'code', label: this.key('code'), minWidth: 120 }, { prop: 'result_param_name', label: this.key('result_param_name'), minWidth: 160 },
{ prop: 'name', label: this.key('name'), minWidth: 140 }, { prop: 'result_param_code', label: this.key('result_param_code'), minWidth: 160 },
{ prop: 'scada_node', label: this.key('scada_node'), minWidth: 140 }, { prop: 'scada_node_name', label: this.key('scada_node_name'), minWidth: 160 },
{ prop: 'collect_type_name', label: this.key('collect_type'), minWidth: 120 }, { prop: 'scada_node_code', label: this.key('scada_node_code'), minWidth: 160 },
{ prop: 'interval', label: this.key('interval'), width: 100 }, { prop: 'category', label: this.key('category'), minWidth: 140, slot: 'category' },
{ prop: 'status_name', label: this.key('status'), width: 100, slot: true }, { prop: 'create_time', label: this.key('create_time'), minWidth: 160 },
{ prop: 'remark', label: this.key('remark'), minWidth: 120 }, { prop: 'update_data', label: this.key('update_data'), minWidth: 160 },
{ prop: '_actions', label: this.key('operation'), width: 160, fixed: 'right' } { prop: '_actions', label: this.key('operation'), width: 160, fixed: 'right' }
]) ])
const btns = useTableButtons({ const btns = useTableButtons({
@@ -260,7 +182,7 @@ export default {
label: this.key('add'), label: this.key('add'),
icon: 'el-icon-plus', icon: 'el-icon-plus',
type: 'primary', type: 'primary',
auth: '/production_configuration/spc_configuration/binding_scada_node/create', auth: '/production_configuration/matetial_model/bom/create',
onClick: this.openAdd onClick: this.openAdd
} }
], ],
@@ -269,7 +191,7 @@ export default {
key: 'edit', key: 'edit',
label: this.key('edit'), label: this.key('edit'),
icon: 'el-icon-edit', icon: 'el-icon-edit',
auth: '/production_configuration/spc_configuration/binding_scada_node/edit', auth: '/production_configuration/matetial_model/bom/edit',
onClick: this.openEdit onClick: this.openEdit
}, },
{ {
@@ -277,13 +199,15 @@ export default {
label: this.key('delete'), label: this.key('delete'),
icon: 'el-icon-delete', icon: 'el-icon-delete',
color: 'danger', color: 'danger',
auth: '/production_configuration/spc_configuration/binding_scada_node/delete', auth: '/production_configuration/matetial_model/bom/delete',
onClick: this.handleDelete onClick: this.handleDelete
} }
] ]
}, this.$permission) }, this.$permission)
this.toolbarButtons = btns.toolbarButtons this.toolbarButtons = btns.toolbarButtons
this.rowButtons = btns.rowButtons this.rowButtons = btns.rowButtons
this.formCols = this.makeFormCols()
this.loadWorkingSubclassOptions()
this.fetchData() this.fetchData()
}, },
methods: { methods: {
@@ -295,20 +219,233 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const list = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res)
const total = Array.isArray(res) ? res.length : (res.count || 0) this.tableData = data.list.map((row, index) => this.normalizeRow(row, index))
this.tableData = list this.pagination.total = data.total
this.pagination.total = total
} finally { } finally {
this.loading = false this.loading = false
} }
}, },
normalizeResponse (res) {
if (Array.isArray(res)) {
return { list: res, total: res.length }
}
const containers = [
res,
res && res.data,
res && res.data && res.data.data
].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return {
list: item,
total: this.getTotal(res, item.length)
}
}
const list = item.data || item.list || item.rows || item.records || item.results || item.items
if (Array.isArray(list)) {
return {
list,
total: this.getTotal(item, this.getTotal(res, list.length))
}
}
}
return { list: [], total: 0 }
},
getTotal (source, fallback) {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
},
firstValue (row, keys, defaultValue = '') {
if (!row) return defaultValue
for (const key of keys) {
const value = row[key]
if (value !== undefined && value !== null && value !== '') {
return value
}
}
return defaultValue
},
makeFormCols () {
return [
[
{
type: 'select',
prop: 'working_subclass_id',
label: this.key('working_subclass'),
placeholder: this.key('select_working_subclass'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: this.workingSubclassOptions,
onChange: this.onWorkingSubclassChange
}
],
[
{
type: 'select',
prop: 'category',
label: this.key('category'),
placeholder: this.key('select_data_type'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: [
{ label: this.$t(this.key('process_inspection')), value: 'PROCESS_INSPECTION' },
{ label: this.$t(this.key('result_data')), value: 'RESULT_DATA' }
]
}
],
[
{
type: 'select',
prop: 'result_param_code',
label: this.key('result_param'),
placeholder: this.key('select_result_param'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: this.resultParamOptions
}
],
[
{
type: 'select',
prop: 'scada_node_code',
label: this.key('scada_node'),
placeholder: this.key('select_scada_node'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: this.scadaNodeOptions
}
],
[
{
type: 'select',
prop: 'result_param_type',
label: this.key('result_param_type'),
placeholder: this.key('select_data_type'),
clearable: true,
filterable: true,
style: { width: '90%' },
options: [
{ label: this.$t(this.key('measurement_type')), value: 1 },
{ label: this.$t(this.key('count_type')), value: 2 }
]
}
]
]
},
normalizeList (res) {
return this.normalizeResponse(res).list
},
categoryText (value) {
const map = {
PROCESS_INSPECTION: this.key('process_inspection'),
RESULT_DATA: this.key('result_data')
}
return map[value] ? this.$t(map[value]) : (value || '')
},
async loadWorkingSubclassOptions () {
try {
const res = await getWorkingsubclassAll()
const list = this.normalizeList(res)
this.workingSubclassRawData = list
this.workingSubclassOptions = list.map(item => ({
label: item.name || item.working_subclass_name || item.code,
value: item.id
}))
this.formCols = this.makeFormCols()
} catch (e) {
this.formCols = this.makeFormCols()
}
},
findWorkingSubclassById (id) {
return this.workingSubclassRawData.find(item => item.id === id)
},
async onWorkingSubclassChange (value) {
this.formData.result_param_code = undefined
this.formData.scada_node_code = undefined
this.resultParamOptions = []
this.scadaNodeOptions = []
const workingSubclass = this.findWorkingSubclassById(value)
if (!workingSubclass) {
this.formCols = this.makeFormCols()
return
}
const code = workingSubclass.code || workingSubclass.working_subclass
await Promise.all([
this.loadResultParamOptions(value),
this.loadScadaNodeOptions(code)
])
this.formCols = this.makeFormCols()
},
async loadResultParamOptions (workingsubclassId) {
try {
const res = await getOptionalParamsList({
workingsubclass_id: workingsubclassId,
page_no: 1,
page_size: 10000
})
this.resultParamOptions = this.normalizeList(res).map(item => ({
label: item.name || item.result_param_name || item.code,
value: item.code || item.result_param_code
}))
} catch (e) {
this.resultParamOptions = []
}
},
normalizeScadaNodeList (res, workingSubclassCode) {
const data = res && res.data ? res.data : res
if (Array.isArray(data)) return data
if (data && Array.isArray(data[workingSubclassCode])) return data[workingSubclassCode]
if (data && Array.isArray(data.data)) return data.data
return []
},
async loadScadaNodeOptions (workingSubclassCode) {
try {
const res = await getQueryCodes(workingSubclassCode)
const list = this.normalizeScadaNodeList(res, workingSubclassCode)
this.scadaNodeOptions = list.map(item => ({
label: item.name || item.scada_node_name || item.code,
value: item.code || item.scada_node_code
}))
} catch (e) {
this.scadaNodeOptions = []
}
},
normalizeRow (row) {
return {
...row,
id: this.firstValue(row, ['id', 'binding_scada_node_id', 'config_id']),
working_subclass: this.firstValue(row, ['working_subclass', 'working_subclass_code', 'workingsubclass_code']),
working_subclass_id: this.firstValue(row, ['working_subclass_id', 'workingsubclass_id']),
result_param_name: this.firstValue(row, ['result_param_name', 'param_name', 'name']),
result_param_code: this.firstValue(row, ['result_param_code', 'param_code', 'code']),
scada_node_name: this.firstValue(row, ['scada_node_name', 'node_name']),
scada_node_code: this.firstValue(row, ['scada_node_code', 'node_code']),
category: this.firstValue(row, ['category', 'data_category']),
create_time: this.firstValue(row, ['create_time', 'created_at']),
update_data: this.firstValue(row, ['update_data', 'update_time', 'updated_at'])
}
},
onSearch () { onSearch () {
this.pagination.current = 1 this.pagination.current = 1
this.fetchData() this.fetchData()
}, },
onReset () { onReset () {
this.search = { code: '', name: '', scada_node: '', status: '' } this.search = {
result_param_code: undefined,
result_param_name: undefined,
scada_node_code: undefined,
scada_node_name: undefined
}
this.pagination.current = 1 this.pagination.current = 1
this.fetchData() this.fetchData()
}, },
@@ -322,14 +459,15 @@ export default {
}, },
resetForm () { resetForm () {
this.formData = { this.formData = {
code: '', working_subclass_id: undefined,
name: '', category: undefined,
scada_node: '', result_param_code: undefined,
collect_type: '', scada_node_code: undefined,
interval: 1, result_param_type: 1
status: 1,
remark: ''
} }
this.resultParamOptions = []
this.scadaNodeOptions = []
this.formCols = this.makeFormCols()
this.editId = '' this.editId = ''
}, },
openAdd () { openAdd () {
@@ -341,28 +479,64 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}) })
}, },
openEdit (row) { async openEdit (row) {
if (!this.workingSubclassRawData.length) {
await this.loadWorkingSubclassOptions()
}
const record = this.normalizeRow(row)
this.handleType = 'edit' this.handleType = 'edit'
this.dialogTitle = this.key('edit_title') this.dialogTitle = this.key('edit_title')
this.editId = row.id this.editId = record.id
const workingSubclassId = record.working_subclass_id || this.getWorkingSubclassIdByCode(record.working_subclass)
this.formData = { this.formData = {
code: row.code, working_subclass_id: workingSubclassId,
name: row.name, category: record.category,
scada_node: row.scada_node || '', result_param_code: record.result_param_code,
collect_type: row.collect_type || '', scada_node_code: record.scada_node_code,
interval: row.interval || 1, result_param_type: record.result_param_type || 1
status: typeof row.status === 'number' ? row.status : 1,
remark: row.remark || ''
} }
this.prepareEditOptions(workingSubclassId, record).finally(() => {
this.dialogVisible = true this.dialogVisible = true
})
},
getWorkingSubclassIdByCode (code) {
const target = this.workingSubclassRawData.find(item => item.code === code || item.working_subclass === code)
return target && target.id
},
async prepareEditOptions (workingSubclassId, record) {
const workingSubclass = this.findWorkingSubclassById(workingSubclassId)
if (workingSubclass) {
await Promise.all([
this.loadResultParamOptions(workingSubclassId),
this.loadScadaNodeOptions(workingSubclass.code || workingSubclass.working_subclass)
])
}
if (record.result_param_code && !this.resultParamOptions.some(item => item.value === record.result_param_code)) {
this.resultParamOptions.push({ label: record.result_param_name || record.result_param_code, value: record.result_param_code })
}
if (record.scada_node_code && !this.scadaNodeOptions.some(item => item.value === record.scada_node_code)) {
this.scadaNodeOptions.push({ label: record.scada_node_name || record.scada_node_code, value: record.scada_node_code })
}
this.formCols = this.makeFormCols()
},
buildSubmitData () {
const workingSubclass = this.findWorkingSubclassById(this.formData.working_subclass_id)
const workingSubclassCode = workingSubclass && (workingSubclass.code || workingSubclass.working_subclass)
const scadaNode = this.scadaNodeOptions.find(item => item.value === this.formData.scada_node_code)
return {
...this.formData,
working_subclass: workingSubclassCode,
scada_node_name: scadaNode ? scadaNode.label : undefined
}
}, },
async onDialogSubmit () { async onDialogSubmit () {
this.submitting = true this.submitting = true
try { try {
const submitData = this.buildSubmitData()
if (this.handleType === 'create') { if (this.handleType === 'create') {
await createDataCollectionConfig(this.formData) await createDataCollectionConfig(submitData)
} else { } else {
await editDataCollectionConfig({ ...this.formData, id: this.editId }) await editDataCollectionConfig({ ...submitData, id: this.editId })
} }
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.dialogVisible = false this.dialogVisible = false

View File

@@ -21,6 +21,18 @@
@keyup.enter.native="onSearch" @keyup.enter.native="onSearch"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t(key('status'))">
<el-select
v-model="search.status"
:placeholder="$t(key('select_status'))"
clearable
style="width:140px"
@change="onSearch"
>
<el-option value="1" :label="$t(key('enable'))" />
<el-option value="0" :label="$t(key('disable'))" />
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onSearch"> <el-button type="primary" icon="el-icon-search" @click="onSearch">
{{ $t(key('search')) }} {{ $t(key('search')) }}
@@ -46,7 +58,7 @@
@selection-change="onSelect" @selection-change="onSelect"
> >
<template #col-status="{ row }"> <template #col-status="{ row }">
<span v-if="row.status === 1" style="color: #67c23a;"> <span v-if="String(row.status) === '1'" style="color: #67c23a;">
<i class="el-icon-circle-check" /> <i class="el-icon-circle-check" />
{{ $t(key('enable')) }} {{ $t(key('enable')) }}
</span> </span>
@@ -79,7 +91,6 @@
import { useTableColumns } from '@/composables/useTableColumns' import { useTableColumns } from '@/composables/useTableColumns'
import { useTableButtons } from '@/composables/useTableButtons' import { useTableButtons } from '@/composables/useTableButtons'
import { i18nMixin } from '@/composables/useI18n' import { i18nMixin } from '@/composables/useI18n'
import { confirmMixin } from '@/composables/useConfirmHandle'
import { getRoleAll } from '@/api/system-administration/role' import { getRoleAll } from '@/api/system-administration/role'
import { import {
getUserList, getUserList,
@@ -99,10 +110,43 @@ const ownUserId = () => localStorage.getItem('user_id')
export default { export default {
name: 'system-administration-user', name: 'system-administration-user',
components: { PageTable, PageDialogForm }, components: { PageTable, PageDialogForm },
mixins: [i18nMixin('page.system_administration.user_management.user'), confirmMixin], mixins: [i18nMixin('page.system_administration.user_management.user')],
data () { data () {
const key = this.key.bind(this) const key = this.key.bind(this)
const $t = this.$t.bind(this) const $t = this.$t.bind(this)
const normalizeList = res => {
const data = res && res.data !== undefined ? res.data : res
if (Array.isArray(data)) return data
if (data && Array.isArray(data.list)) return data.list
if (data && Array.isArray(data.data)) return data.data
if (data && data.data && Array.isArray(data.data.data)) return data.data.data
return []
}
const validateUsernameUnique = async (rule, value, callback) => {
const username = String(value || '').trim()
if (!username || username.length < 3) {
callback()
return
}
try {
const res = await getUserList({ username, page_no: 1, page_size: 10000 })
const exists = normalizeList(res).some(item => {
const sameName = String(item.username || '') === username
const sameUser = this.handleType === 'edit' && String(item.user_id) === String(this.editId)
return sameName && !sameUser
})
callback(exists ? new Error($t(key('username_exists'))) : undefined)
} catch {
callback()
}
}
const validatePasswordConfirm = (rule, value, callback) => {
if (this.handleType === 'create' && value && value !== this.formData.password) {
callback(new Error($t(key('password_not_match'))))
return
}
callback()
}
return { return {
loading: false, loading: false,
submitting: false, submitting: false,
@@ -112,12 +156,21 @@ export default {
dialogTitle: '', dialogTitle: '',
editId: '', editId: '',
handleType: 'create', handleType: 'create',
search: { username: '', nickname: '' }, search: { username: '', nickname: '', status: '' },
pagination: { current: 1, size: 10, total: 0 }, pagination: { current: 1, size: 10, total: 0 },
roleOptions: [], roleOptions: [],
columns: [], columns: [],
toolbarButtons: [], toolbarButtons: [],
rowButtons: [], rowButtons: [],
formData: {
username: '',
password: '',
password_confirm: '',
role_id: '',
nickname: '',
pass_number: '',
status: '1'
},
baseFormCols: { baseFormCols: {
create: [ create: [
[{ type: 'input', prop: 'username', label: key('username'), placeholder: key('enter_username'), clearable: true, style: { width: '90%' } }], [{ type: 'input', prop: 'username', label: key('username'), placeholder: key('enter_username'), clearable: true, style: { width: '90%' } }],
@@ -139,7 +192,8 @@ export default {
baseRules: { baseRules: {
username: [ username: [
{ required: true, message: key('enter_username'), trigger: 'blur' }, { required: true, message: key('enter_username'), trigger: 'blur' },
{ min: 3, max: 20, message: key('username_length'), trigger: 'blur' } { min: 3, max: 20, message: key('username_length'), trigger: 'blur' },
{ validator: validateUsernameUnique, trigger: 'blur' }
], ],
password: [ password: [
{ required: true, message: key('enter_password'), trigger: 'blur' }, { required: true, message: key('enter_password'), trigger: 'blur' },
@@ -147,10 +201,14 @@ export default {
], ],
password_confirm: [ password_confirm: [
{ required: true, message: key('enter_confirm_password'), trigger: 'blur' }, { required: true, message: key('enter_confirm_password'), trigger: 'blur' },
{ min: 6, max: 64, message: key('password_length'), trigger: 'blur' } { min: 6, max: 64, message: key('password_length'), trigger: 'blur' },
{ validator: validatePasswordConfirm, trigger: ['blur', 'change'] }
], ],
role_id: [ role_id: [
{ required: true, message: key('select_user_group'), trigger: 'change' } { required: true, message: key('select_user_group'), trigger: 'change' }
],
status: [
{ required: true, message: key('select_status'), trigger: 'change' }
] ]
} }
} }
@@ -168,7 +226,8 @@ export default {
if (this.handleType === 'edit') { if (this.handleType === 'edit') {
return { return {
username: this.baseRules.username, username: this.baseRules.username,
role_id: this.baseRules.role_id role_id: this.baseRules.role_id,
status: this.baseRules.status
} }
} }
return this.baseRules return this.baseRules
@@ -255,10 +314,29 @@ export default {
async initRoleOptions () { async initRoleOptions () {
try { try {
const res = await getRoleAll() const res = await getRoleAll()
const data = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res).list
this.roleOptions = data.map(item => ({ value: item.id, label: item.name })) this.roleOptions = data.map(item => ({ value: item.id, label: item.name }))
} catch { /* 忽略 */ } } catch { /* 忽略 */ }
}, },
normalizeResponse (res) {
const getTotal = (source, fallback) => {
if (!source) return fallback
const total = source.count ?? source.total ?? source.total_count ?? source.record_count
const value = Number(total)
return Number.isNaN(value) ? fallback : value
}
const containers = [res, res && res.data, res && res.data && res.data.data].filter(Boolean)
for (const item of containers) {
if (Array.isArray(item)) {
return { list: item, total: getTotal(res, item.length) }
}
const list = item.data || item.list || item.rows || item.records || item.items
if (Array.isArray(list)) {
return { list, total: getTotal(item, getTotal(res, list.length)) }
}
}
return { list: [], total: 0 }
},
async fetchData () { async fetchData () {
this.loading = true this.loading = true
try { try {
@@ -267,10 +345,9 @@ export default {
page_no: this.pagination.current, page_no: this.pagination.current,
page_size: this.pagination.size page_size: this.pagination.size
}) })
const list = Array.isArray(res) ? res : (res.data || []) const data = this.normalizeResponse(res)
const total = Array.isArray(res) ? res.length : (res.count || 0) this.tableData = data.list
this.tableData = list this.pagination.total = data.total
this.pagination.total = total
} finally { } finally {
this.loading = false this.loading = false
} }
@@ -280,7 +357,7 @@ export default {
this.fetchData() this.fetchData()
}, },
onReset () { onReset () {
this.search = { username: '', nickname: '' } this.search = { username: '', nickname: '', status: '' }
this.pagination.current = 1 this.pagination.current = 1
this.fetchData() this.fetchData()
}, },
@@ -377,16 +454,34 @@ export default {
} catch { /* 拦截器已处理 */ } } catch { /* 拦截器已处理 */ }
}).catch(() => {}) }).catch(() => {})
}, },
async confirmAction (message, action) {
try {
await this.$confirm(
this.$t(message),
this.$t(this.key('prompt')),
{
confirmButtonText: this.$t(this.key('confirm')),
cancelButtonText: this.$t(this.key('cancel')),
type: 'warning',
closeOnClickModal: false
}
)
} catch {
return false
}
await action()
return true
},
async handleDelete (row) { async handleDelete (row) {
if (String(row.user_id) === ownUserId()) { if (String(row.user_id) === ownUserId()) {
this.$message.warning(this.$t(this.key('cannot_delete_self'))) this.$message.warning(this.$t(this.key('cannot_delete_self')))
return return
} }
const cancelled = await this.$confirmAction( const ok = await this.confirmAction(
{ message: this.key('confirm_delete'), title: this.key('prompt') }, this.key('confirm_delete'),
() => deleteUser({ id: [row.user_id] }) () => deleteUser({ id: [row.user_id] })
) )
if (cancelled) return if (!ok) return
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.pagination.current = Math.min( this.pagination.current = Math.min(
this.pagination.current, this.pagination.current,
@@ -405,11 +500,11 @@ export default {
this.$message.warning(this.$t(this.key('select_rows_first'))) this.$message.warning(this.$t(this.key('select_rows_first')))
return return
} }
const cancelled = await this.$confirmAction( const ok = await this.confirmAction(
{ message: this.key('confirm_batch_delete'), title: this.key('prompt') }, this.key('confirm_batch_delete'),
() => batchDeleteUser({ id: rows.map(row => row.user_id) }) () => batchDeleteUser({ id: rows.map(row => row.user_id) })
) )
if (cancelled) return if (!ok) return
this.$message.success(this.$t(this.key('operation_success'))) this.$message.success(this.$t(this.key('operation_success')))
this.fetchData() this.fetchData()
}, },

View File

@@ -87,6 +87,13 @@ module.exports = {
pathRewrite: { pathRewrite: {
'^/background': '' '^/background': ''
} }
},
'/workerman': {
target: process.env.VUE_APP_WORKERMAN_URL,
changeOrigin: true,
pathRewrite: {
'^/workerman': ''
}
} }
}, },
disableHostCheck: process.env.NODE_ENV === 'development' disableHostCheck: process.env.NODE_ENV === 'development'