Skip to content

About

2D HMI 组态复刻(自研 @iotgit/hmi-core 驱动,替代闭源 maotu)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

hmi-studio-v2 —— 2D HMI 组态复刻(自研 hmi-core 驱动)

用自研库 @iotgit/hmi-core 替代闭源 maotu,1:1 复刻 hmi-studio 的 2D 组态 编辑/浏览功能,并已接入 3D 组态与 AI 助手面板(hmi-studio 归档后,本仓接管对外入口)。

  • 代码来源:hmi-studio 的 2D 部分(src/lib / src/symbols / src/screen-assets / 4 页 / 6 组件)原样复制, 唯一改写是 from 'maotu' → from '@iotgit/hmi-core'(29 处 + inline type + CSS)。
  • 后端:复用现有 rs-iot(:20000,gateway :18080),无 mock。
  • 与 hmi-studio 共存:各用独立 dev 端口(v2 5274 / e2e 5294)与独立 e2e 命名空间(e2e-v2-*)。

当前状态:P1–P3 完成

门禁 结果
npm run typecheck ✅ 0 错误
npm test(49 文件) ✅ 823 passed
npm run build ✅
npm run e2e(34 项) ✅ 34 passed

已复刻的功能(与 hmi-studio 2D 一比一): 登录/守卫、画面列表(卡片墙/缩略图/新建/删除/分组)、编辑器(MtEdit 全功能:拖入/选中/组合/撤销/属性面板/绑定面板/ 存为符号/我的符号/版本面板/插件加载)、运行页(MtPreview + SSE 数据桥 + 合成点位 + 告警横幅/抽屉 + 命令桥 $rsiot + 画面互跳 + 自适应缩放 + BI 通道 B)。

e2e 覆盖(34 项,e2e/): smoke 登录守卫+列表 / edit-roundtrip 拖入→保存→刷新保真 / bind-flow 绑定落库+SSE 直写+阈值变色 / editor-shell DOM 锚点+7 图元组+footer+主题+工具栏 / reg-combin 我的符号拖入展开 / hmi-core-batch1 值映射 + 页级事件 / event-types 事件类型 8 种 / actions 动作表端到端(navigate/setProps/emit) / batch-f 图元包(左面板/拖入渲染/重载不降级/属性面板改色/运行页像素断言)/ lifecycle 生命周期(定时器不跨画面存活、列表页缩略图不执行画面脚本)/ panel-layout 属性面板布局(超长标题不压行、输入框不被截断)/ symbol-groups 第三方图元按设备语义分组(10 组,无平铺大组)/ orphan-tag 含未注册 tag 的画面不崩屏(占位代替整屏中断)。


运行

cd hmi-studio-v2
npm install          # 自动拉 github:viccom/hmi-core#v0.10.1(dist 随该仓入库,无需本地构建)
npm run dev          # http://127.0.0.1:5274  → admin/admin
npm run typecheck && npm test && npm run build
npm run e2e          # 需 rs-iot 存活;自动起 5294

依赖获取(重要)

@iotgit/hmi-core 走 git 依赖 github:viccom/hmi-core#v0.10.1(私有仓,需本机 git 对 github 有凭据;本机 gh auth git-credential 已配置)。hmi-core 的 dist/ 故意入库, 所以 clone 后无需先构建依赖库。

npm 12 默认 allow-git=none(供应链保护),本仓 .npmrc 已设 allow-git=root 只对根项目放开。

后端地址(重要)

rs-iot 在 127.0.0.1:20000,不是 8790(8790 是 safebot-agentd)。 vite.config.ts 的 /api 代理默认指向 20000;e2e 的 RSIOT_BASE 同理。


与 hmi-studio 的差异(仅在自研库能力边界内)

项 hmi-studio(maotu 0.6.5) hmi-studio-v2(hmi-core)
组态内核 闭源 maotu npm 自研 hmi-core(LGPL 派生 + 逆向补齐)
事件流(eventFlow 执行器) 有(x6 9 节点) 无(画面 eventFlow: [],不消费)
页级 eventList(mounted/属性监听) 有 无(画面全用图元级事件)
group 子图元事件绑定 有 无(画面无 group 事件)
bind_mapping 值映射 有 无(生成器一律空数组)
model 图元(子画面引用) 有 无(hmi-studio 未使用)
未注册属性 静默丢弃 兜底保留(优于原版)
布尔 trigger 值 字符串化恒真 按描述符归一(优于原版)

以上"无"项均不影响 hmi-studio 现有 16 张工业画面 + 7 个生成器的完整链路。


目录

src/
├── main.ts / router.ts / App.vue     入口(pinia 供 3D + AI store;3D 与 AI 面板已接入)
├── views/         LoginView / ScreenListView / EditView / ViewView
├── components/    BindPanel / ScreenThumb / AlarmBanner / AlarmDrawer / ThemeToggle / VersionPanel
├── lib/           27 个纯逻辑模块(api/screens/binds/sse/alarms/bridge/command/nav/synthetic/bi-*/device-*/…)
├── symbols/       56 图元 TS + 41 Vue 组件 + registry/groups/my-symbols/plugin-*/…
├── screen-assets/ 7 画面生成器 + iot-catalog + protected + 6 个快照基线
└── styles/        screen-list.css / theme-bridge.css
e2e/               helpers(e2e-v2- 隔离)+ 9 个 spec

数据隔离(重要)

v2 的 e2e 不跑 hmi-studio 的 globalSetup(后者会无条件 PUT 覆盖 27 个长期资产)。 v2 只用 e2e-v2-* 前缀播种并在 afterAll 清理;长期资产只 GET 校验存在,绝不写。


依赖

@iotgit/hmi-core(github:viccom/hmi-core#v0.10.1)、vue 3.5、vue-router 4、element-plus 2.8、@vueuse/core 10、echarts 5、vue-echarts 6。 不装 maotu;3D 依赖(three/pinia 等)与 AI 依赖(@incremark/vue、dompurify)已装; 不配 UnoCSS/svg-icons(hmi-core 产物已含)。

About

2D HMI 组态复刻(自研 @iotgit/hmi-core 驱动,替代闭源 maotu)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages