@jnrs/lingshu-smart 2.2.33 → 2.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/AGENTS.md +60 -4
  2. package/README.md +141 -0
  3. package/dist/components/debug/DataLogPanel.vue.d.ts +44 -0
  4. package/dist/components/debug/DebugPanel.vue.d.ts +61 -0
  5. package/dist/components/debug/PerformanceStats.vue.d.ts +42 -0
  6. package/dist/components/debug/ScriptRunner/ConfigPanel.vue.d.ts +39 -0
  7. package/dist/components/debug/ScriptRunner/StepsPanel.vue.d.ts +50 -0
  8. package/dist/components/debug/ScriptRunner/index.vue.d.ts +16 -0
  9. package/dist/components/debug/ScriptRunner/script.d.ts +100 -0
  10. package/dist/components/debug/WsProxy/ConfigEditor.vue.d.ts +18 -0
  11. package/dist/components/debug/WsProxy/ConnPanel.vue.d.ts +24 -0
  12. package/dist/components/debug/WsProxy/WsProxyPage.vue.d.ts +14 -0
  13. package/dist/components/debug/WsProxy/broadcast.d.ts +31 -0
  14. package/dist/components/debug/WsProxy/index.vue.d.ts +39 -0
  15. package/dist/components/debug/WsProxy/proxy.d.ts +159 -0
  16. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +100 -100
  17. package/dist/components/editor/DrawingBoard.vue.d.ts +3 -1
  18. package/dist/components/editor/OptionCard/Equipment/models/PartConfig.vue.d.ts +2 -0
  19. package/dist/components/editor/index.vue.d.ts +3 -1
  20. package/dist/components/index.d.ts +5 -1
  21. package/dist/components/index.js +31930 -2056
  22. package/dist/components/preview/index.vue.d.ts +1859 -3
  23. package/dist/composables/useDebugEasterEgg.d.ts +2 -0
  24. package/dist/controller/AppController.d.ts +11 -0
  25. package/dist/controller/EditorController.d.ts +1 -1
  26. package/dist/index.js +153 -17
  27. package/dist/lingshu-smart/wsProxyConfig.json +495 -0
  28. package/dist/locales/en.d.ts +45 -0
  29. package/dist/locales/i18next.d.ts +102 -1
  30. package/dist/locales/index.js +94 -4
  31. package/dist/locales/zhCn.d.ts +45 -0
  32. package/dist/playground/ViewPageDemo.vue.d.ts +3802 -6
  33. package/dist/stores/index.d.ts +1 -0
  34. package/dist/stores/useAppStore.d.ts +5565 -3
  35. package/dist/stores/useDataStore.d.ts +5565 -3
  36. package/dist/stores/useDebugStore.d.ts +485 -0
  37. package/dist/stores/useEditorStore.d.ts +5 -2
  38. package/dist/types/app.types.d.ts +3 -0
  39. package/dist/types/components/config.types.d.ts +1 -0
  40. package/dist/types/components/operating.types.d.ts +1 -0
  41. package/dist/types/enums.d.ts +1 -0
  42. package/dist/types/guards.d.ts +1 -0
  43. package/dist/types/models/config.types.d.ts +9 -1
  44. package/dist/types/models/operating.types.d.ts +21 -1
  45. package/dist/ui/abstract/BaseAbs.d.ts +23 -0
  46. package/dist/ui/abstract/ComponentAbs.d.ts +3 -15
  47. package/dist/ui/abstract/ModelAbs.d.ts +17 -17
  48. package/dist/ui/components/Light.d.ts +5 -0
  49. package/dist/ui/components/StationSlot.d.ts +7 -2
  50. package/dist/ui/components/StationSlotGroup.d.ts +5 -0
  51. package/dist/ui/models/CleaningMachine.d.ts +2 -0
  52. package/dist/ui/models/DoubleJointRobot.d.ts +2 -0
  53. package/dist/ui/models/LoadingStation.d.ts +2 -0
  54. package/dist/ui/models/MachineTool.d.ts +2 -0
  55. package/dist/ui/models/MarkingMachine.d.ts +2 -0
  56. package/dist/ui/models/ResourceStore.d.ts +7 -0
  57. package/dist/ui/models/Rgv.d.ts +2 -0
  58. package/dist/ui/models/ShuttleStation.d.ts +21 -0
  59. package/dist/ui/models/SingleJointRobot.d.ts +2 -0
  60. package/dist/utils/debug-flags.d.ts +9 -0
  61. package/dist/utils/formatOperating.d.ts +7 -0
  62. package/dist/utils/index.d.ts +19 -15
  63. package/dist/utils/logger.d.ts +22 -0
  64. package/dist/utils/performance-stats.d.ts +38 -0
  65. package/package.json +5 -3
  66. package/dist/index-g6O0IWAC.js +0 -24879
  67. package/dist/playground/mockWebSocketData.d.ts +0 -23
  68. /package/dist/{json → lingshu-smart}/cases.json +0 -0
package/AGENTS.md CHANGED
@@ -29,7 +29,7 @@ import type { ICase } from '@/types'
29
29
  import LingshuSmartEditor from '@/components/editor/index.vue'
30
30
 
31
31
  const loadCases = async (requestId?: string): Promise<ICase[]> => {
32
- const res = await fetch(`/json/cases.json?requestId=${requestId}`)
32
+ const res = await fetch(`/lingshu-smart/cases.json?requestId=${requestId}`)
33
33
  const data = await res.json()
34
34
  return data.data
35
35
  }
@@ -164,7 +164,7 @@ WebSocket 原始消息
164
164
  → onMessage 校验 & 解析
165
165
  → 按 payload.type 分支映射
166
166
  → operating(ILayerOperating)
167
- → AppController.businessMap 匹配 `${className}_${id}`
167
+ → AppController.businessMap 三级匹配 `${className}_${id}` → 工位号
168
168
  → 对应 ModelAbs.handleOperation → 子组件动画
169
169
  ```
170
170
 
@@ -220,12 +220,13 @@ const onMessage = (rawMessage: any) => {
220
220
 
221
221
  ### 匹配规则(重要)
222
222
 
223
- `operating()` 通过 `className + id` 定位画布上的设备:
223
+ `operating()` 通过三级匹配定位画布上的设备:`className id → 工位号`:
224
224
 
225
225
  - `id` 作为前后端对于设备的唯一识别字段
226
- - `rawData` 为后端接口返回的原始数据 payload,其中包含 id 属性,如果设备注册了交互事件,则该对象会存在于回调函数的返回值中,供“点击设备后弹窗展示设备详情”等业务需求使用
226
+ - `rawData` 为后端接口返回的原始数据 payload,其中包含 id 属性,如果设备注册了交互事件,则该对象会存在于回调函数的返回值中,供"点击设备后弹窗展示设备详情"等业务需求使用
227
227
  - `className` 使用 `EnumModel` 枚举值,例如 `EnumModel.MACHINE_TOOL`
228
228
  - 资源增删时,`addType` / `removeType` 为目标设备的 `className`,`addId` / `removeId` 为目标设备 `id`
229
+ - **工位号匹配(三级)**:当同一 `id` 的设备(如 `ResourceStore`)在画布上被拆分为多个 UI(不同工位号范围)时,`businessMap` 以数组存储同 `className + id` 的多个模型,再通过 `resource.index`(工位号)匹配到具体 UI。模型通过 `containsStationIndex` 方法判断是否包含该工位号。仅有一个模型时直接使用,无需工位号匹配
229
230
 
230
231
  匹配失败时控制台输出:`模型操作失败: 模型未匹配到`。
231
232
 
@@ -690,6 +691,61 @@ type ILayerOperating =
690
691
  4. **资源消息:** `Resource` 类型不对应独立图层,通过目标设备的 `resource` 字段操作工位槽
691
692
  5. **引擎生命周期:** 组件卸载时自动 `destroyContainer`;手动集成需自行销毁
692
693
  6. **类型安全:** 所有 API 均导出 TypeScript 类型,推荐 `import type { ILayerOperating, EnumModel } from '@jnrs/lingshu-smart'`
694
+ 7. **调试模式:** 500ms 内点击主容器(`#lingshu-smart`)10 次可打开调试配置面板,支持运行时配置日志等级、阴影/动画开关、FPS 限制、交互禁用、性能统计。配置通过 `localStorage` 持久化,详见 README「调试功能」章节。
695
+
696
+ ---
697
+
698
+ ## 🐛 调试系统
699
+
700
+ ### 架构
701
+
702
+ | 模块 | 职责 |
703
+ | ---------------------------------- | ---------------------------------------------------------------- |
704
+ | `utils/logger.ts` | 统一日志工具,支持 tag 着色、LogLevel 过滤、`operating` 追踪级别 |
705
+ | `utils/debug-flags.ts` | 模块级动画标志位,供 UI 组件直接导入控制循环动画 |
706
+ | `utils/performance-stats.ts` | 性能统计工具,记录运行时长和 WebSocket 数据接收量 |
707
+ | `stores/useDebugStore.ts` | 全局调试配置 Pinia store,localStorage 持久化 |
708
+ | `composables/useDebugEasterEgg.ts` | 调试触发检测:500ms 内 10 次点击打开面板 |
709
+ | `components/debug/DebugPanel.vue` | 调试配置对话框 UI |
710
+ | `components/debug/ScriptRunner/` | Socket 脚本模拟器:脚本步骤编排、断点调试、消息结构配置(code/msg、payload 字段名、type)、日志查看 |
711
+ | `components/debug/WsProxy/` | WebSocket 代理器:声明式字段映射将后端 socket 结构桥接为 operating,支持连接/断开/重连、日志、配置导出/导入、场景像素换算(percentToPixel 百分比/ runtimeToPixel 运行时坐标)、standalone 独立标签页模式 / remote 远程接收模式(BroadcastChannel 跨标签页流转数据) |
712
+ | `components/debug/WsProxy/WsProxyPage.vue` | `WsProxy` 独立路由页面组件:以独立 URL/标签页运行代理器配置,将 operating/raw/状态广播给预览页驱动图形运转 |
713
+ | `controller/AppController.ts` | 提供 `toggleShadows` / `toggleAnimations` / `setFps` 方法 |
714
+
715
+ ### 日志系统
716
+
717
+ ```typescript
718
+ import { createLogger, setLogLevel } from '@/utils/logger'
719
+
720
+ const logger = createLogger('MyModule')
721
+ logger.log('消息') // LOG:MyModule 消息(彩色单徽章)
722
+ logger.operating('操作, data=%o', data) // OPERATING:MyModule 操作, data={...}(紫色徽章)
723
+ logger.warn('警告') // [WARN:MyModule] 警告(浏览器默认样式)
724
+ ```
725
+
726
+ - `log`/`info`/`operating` 级别:使用彩色单徽章(`LEVEL:Tag` 合并显示)
727
+ - `warn`/`error` 级别:纯文本前缀 `[LEVEL:Tag]`
728
+ - `operating` 级别:用于追踪 UI 模型操作指令,在 `ModelAbs.handleOperation` 和 `ComponentAbs.handleOperation` 中自动埋点
729
+ - 日志等级优先级:`none` < `error` < `warn` < `info` < `log` < `operating`
730
+ - 默认:开发环境 `log`(全开),生产环境 `warn`
731
+
732
+ ### 调试配置项
733
+
734
+ | 配置项 | store 字段 | AppController 方法 |
735
+ | ------------ | ---------------------- | ------------------------- |
736
+ | 日志显示等级 | `logLevel` | `setLogLevel()` |
737
+ | 显示内外阴影 | `shadowsEnabled` | `toggleShadows()` |
738
+ | 启用全局动画 | `animationsEnabled` | `toggleAnimations()` |
739
+ | 全局 FPS | `fpsMode` | `setFps()` |
740
+ | 禁止所有交互 | `interactionsDisabled` | CSS `pointer-events` |
741
+ | 性能统计 | — | `trackWebSocketMessage()` |
742
+
743
+ - **动画开关**:通过标志位控制循环动画(灯闪烁、入口通道动画等),关闭后保留静态状态(如灯颜色保持不变),不影响一次性动画(如机器人摆臂、进度条动画)
744
+ - **阴影开关**:递归遍历所有元素切换 `shadow`/`innerShadow` 的 `visible` 属性,同时处理 `ShadowCanvas` 元素(`createShadow` 工厂创建的 Canvas 阴影)的 `visible` 属性
745
+
746
+ ### localStorage 存储
747
+
748
+ 统一 key 为 `lingshu-smart`,debug 配置存储在 `debug` 子对象中,与 `useDataStore` 的持久化数据共享同一 key。
693
749
 
694
750
  ---
695
751
 
package/README.md CHANGED
@@ -13,6 +13,7 @@
13
13
  | 设备模型 | 机床、机器人(单关节/双关节)、RGV、装载站、打标机、清洗机、轨道拖链、资源库等 |
14
14
  | 设备运转 | 灯光、进度条、入口动画、工位槽资源增删、坐标/角度/货叉控制 |
15
15
  | 坐标转换 | `transRuntimeToPixel` / `transPercentToPixel` — 物理坐标与像素坐标互转 |
16
+ | WebSocket 代理器 | `WsProxy` — 声明式字段映射将后端 socket 数据桥接为 operating 驱动设备动画;`WsProxyPage` 独立路由页面支持单独标签页配置并通过 BroadcastChannel 广播给预览页 |
16
17
 
17
18
  ## 💻 技术栈
18
19
 
@@ -49,3 +50,143 @@ import { transRuntimeToPixel, transPercentToPixel } from '@jnrs/lingshu-smart'
49
50
  ```
50
51
 
51
52
  详细文档请查看 [AGENTS.md](./AGENTS.md)
53
+
54
+ ## 🐛 调试功能
55
+
56
+ 本库内置了全局调试系统,支持运行时动态配置日志等级、渲染效果和交互状态,适用于开发环境排查问题或生产环境现场调试。
57
+
58
+ ### 调试模式触发
59
+
60
+ 在编辑器或预览页面中,500ms 内快速点击主容器(`#lingshu-smart`)10 次即可触发调试模式确认对话框,确认后打开调试配置面板。此操作类似 Android 系统的"开发者模式"快捷入口。
61
+
62
+ > 该触发方式基于 DOM 原生 `click` 事件绑定,不受"禁止所有交互"配置的影响。
63
+
64
+ ### 调试配置面板
65
+
66
+ | 配置项 | 说明 |
67
+ | ------------- | -------------------------------------------------------------------------------------------------------- |
68
+ | 日志显示等级 | `none`(静默)/ `error` / `warn` / `info` / `log`(全部显示)/ `operating`(全部显示 + UI 模型操作追踪) |
69
+ | 显示内外阴影 | 全局开关所有 Leafer 图形的 `shadow` / `innerShadow` 效果(含 ShadowCanvas 绘制阴影) |
70
+ | 启用全局动画 | 全局开关循环动画(如灯闪烁、入口通道动画),关闭后保留静态状态(如灯颜色保持不变),不影响一次性动画 |
71
+ | 全局 FPS | 限制 Leafer 渲染帧率:`auto`(不限制)/ `30` / `60` / `120` FPS |
72
+ | 禁止所有交互 | 通过 CSS `pointer-events: none` 禁用主容器内所有子元素交互,调试模式开关不受此限制 |
73
+ | 语言/Language | 切换调试面板和性能统计的显示语言:`中文` / `English` |
74
+ | 性能统计 | 显示页面运行开始时间、持续运行时长、WebSocket 消息接收次数和数据量 |
75
+
76
+ ### 日志系统
77
+
78
+ 日志工具 `createLogger(tag)` 创建带标签的 Logger 实例,输出格式为 `[等级:Tag] 消息内容`:
79
+
80
+ - `log` / `info` / `operating` 级别:使用彩色单徽章样式(`LEVEL:Tag` 合并显示)
81
+ - `warn` / `error` 级别:保留浏览器默认样式,以纯文本前缀显示
82
+
83
+ ```typescript
84
+ import { createLogger, setLogLevel, type LogLevel } from '@jnrs/lingshu-smart/utils/logger'
85
+
86
+ const logger = createLogger('MyModule')
87
+ logger.log('模型已加载, uuid=%s', uuid) // LOG:MyModule 模型已加载, uuid=xxx
88
+ logger.warn('配置缺失: %s', key) // [WARN:MyModule] 配置缺失: xxx
89
+ logger.operating('执行操作, data=%o', data) // OPERATING:MyModule 执行操作, data={...}
90
+
91
+ // 代码层面设置日志等级(优先级低于调试面板的运行时配置)
92
+ setLogLevel('warn' as LogLevel) // 仅显示 warn + error
93
+ ```
94
+
95
+ #### operating 日志级别
96
+
97
+ `operating` 是最详细的日志级别,用于追踪 UI 模型的操作指令。在 `ModelAbs.handleOperation` 和 `ComponentAbs.handleOperation` 中自动埋点,记录模型的 `className`、`uuid`、`businessId` 和接收到的 `operating` 数据,便于追溯 WebSocket 数据与前端 UI 动作的对应关系,定位问题是后端数据返回有误还是前端 UI 显示有误。
98
+
99
+ ### 性能统计
100
+
101
+ 通过 `trackWebSocketMessage(data)` 记录 WebSocket 消息接收,在调试面板中实时显示运行时长和数据接收量:
102
+
103
+ ```typescript
104
+ import { trackWebSocketMessage } from '@jnrs/lingshu-smart/utils/performance-stats'
105
+
106
+ // 在 WebSocket onmessage 回调中调用
107
+ ws.onmessage = (event) => {
108
+ trackWebSocketMessage(event.data)
109
+ // ... 业务处理
110
+ }
111
+ ```
112
+
113
+ ### 配置持久化
114
+
115
+ 所有调试配置通过 `localStorage` 持久化存储,key 为 `@jnrs/lingshu-smart/debug`:
116
+
117
+ ```json
118
+ {
119
+ "logLevel": "log",
120
+ "shadowsEnabled": true,
121
+ "animationsEnabled": true,
122
+ "fpsMode": "auto",
123
+ "interactionsDisabled": false,
124
+ "locale": "zhCn"
125
+ }
126
+ ```
127
+
128
+ 页面刷新后自动恢复上次配置。如需重置,点击调试面板中的"恢复默认"按钮。
129
+
130
+ ## 🌐 国际化
131
+
132
+ 本库内置 vue-i18n 国际化支持,默认提供中文(`zhCn`)和英文(`en`)两种语言,涵盖调试面板、性能统计等模块。
133
+
134
+ ### 在宿主项目中切换语言
135
+
136
+ 通过 `useDebugStore` 的 `setLocale` 方法切换语言,切换后库内所有组件文本实时更新:
137
+
138
+ ```typescript
139
+ import { useDebugStore } from '@jnrs/lingshu-smart/stores/useDebugStore'
140
+
141
+ const debugStore = useDebugStore()
142
+
143
+ // 切换为英文
144
+ debugStore.setLocale('en')
145
+
146
+ // 切换为中文
147
+ debugStore.setLocale('zhCn')
148
+ ```
149
+
150
+ ### 自定义或扩展翻译
151
+
152
+ 如需覆盖现有翻译或添加新的语言,通过 vue-i18n 的 `mergeLocaleMessage` 合并:
153
+
154
+ ```typescript
155
+ import i18n from '@jnrs/lingshu-smart/locales/i18next'
156
+
157
+ // 覆盖中文翻译
158
+ i18n.global.mergeLocaleMessage('zhCn', {
159
+ perf: {
160
+ panelButton: '监控面板'
161
+ }
162
+ })
163
+
164
+ // 添加新语言
165
+ i18n.global.mergeLocaleMessage('ja', {
166
+ perf: {
167
+ title: 'ライブモニター',
168
+ status: '実行中'
169
+ }
170
+ })
171
+ ```
172
+
173
+ ### 与宿主项目 i18n 集成
174
+
175
+ 如果宿主项目已使用 vue-i18n,可选择以下方案:
176
+
177
+ 1. **独立模式**(推荐):库内部 i18n 实例独立运行,通过 `setLocale` 同步语言,互不干扰。
178
+ 2. **共享模式**:将库的 messages 合并到宿主项目的 i18n 实例中,统一管理。
179
+
180
+ ```typescript
181
+ // 方案1:监听宿主语言变化,同步到库
182
+ import { watch } from 'vue'
183
+ import { useDebugStore } from '@jnrs/lingshu-smart/stores/useDebugStore'
184
+
185
+ const debugStore = useDebugStore()
186
+ watch(
187
+ () => hostI18n.global.locale.value,
188
+ (lang) => {
189
+ debugStore.setLocale(lang === 'zh-CN' ? 'zhCn' : 'en')
190
+ }
191
+ )
192
+ ```
@@ -0,0 +1,44 @@
1
+ import { ILayerOperating } from '../../types';
2
+ export interface LogEntry {
3
+ datetime: string;
4
+ type: string;
5
+ traceId: string;
6
+ payload: any;
7
+ }
8
+ export type LogDirection = 'send' | 'receive';
9
+ export interface WsProxyLogEntry {
10
+ datetime: string;
11
+ direction: LogDirection;
12
+ data: any;
13
+ }
14
+ export type RunLogEntry = ILayerOperating;
15
+ type __VLS_Props = {
16
+ logs: any[];
17
+ maxLogCount: number;
18
+ snapshot: boolean;
19
+ /** 边框左上角区域名称(如 模拟消息日志 / 消息日志 / 运行日志) */
20
+ title?: string;
21
+ /** 数据列表头名称 */
22
+ dataLabel?: string;
23
+ /** 数据单元格渲染函数 */
24
+ textFn?: (row: any) => string;
25
+ /** 是否展示方向/类型列(WsProxy 消息日志专用) */
26
+ showDirectionType?: boolean;
27
+ };
28
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
29
+ copy: () => any;
30
+ clear: () => any;
31
+ "update:maxLogCount": (value: number) => any;
32
+ "toggle-snapshot": () => any;
33
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
34
+ onCopy?: (() => any) | undefined;
35
+ onClear?: (() => any) | undefined;
36
+ "onUpdate:maxLogCount"?: ((value: number) => any) | undefined;
37
+ "onToggle-snapshot"?: (() => any) | undefined;
38
+ }>, {
39
+ title: string;
40
+ dataLabel: string;
41
+ textFn: (row: any) => string;
42
+ showDirectionType: boolean;
43
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
44
+ export default _default;
@@ -0,0 +1,61 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
2
+ wsProxyRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
3
+ autoApply?: boolean;
4
+ config?: import('./WsProxy/proxy').WsProxyConfig;
5
+ scene?: import('../..').IScene | null;
6
+ dictFn?: import('./WsProxy/proxy').DictFn;
7
+ standalone?: boolean;
8
+ remote?: boolean;
9
+ }> & Readonly<{
10
+ onOperating?: ((data: import('../..').ILayerOperating) => any) | undefined;
11
+ onRaw?: ((data: unknown) => any) | undefined;
12
+ "onStatus-change"?: ((connected: boolean) => any) | undefined;
13
+ }>, {
14
+ open: () => void;
15
+ feedMessage: (rawMessage: any) => void;
16
+ setConfig: (cfg: import('./WsProxy/proxy').WsProxyConfig) => void;
17
+ isConnected: import('vue').Ref<boolean, boolean>;
18
+ rules: import('vue').ComputedRef<import('./WsProxy/proxy').ProxyRule[]>;
19
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
+ operating: (data: import('../..').ILayerOperating) => any;
21
+ raw: (data: unknown) => any;
22
+ "status-change": (connected: boolean) => any;
23
+ }, import('vue').PublicProps, {
24
+ scene: import('../..').IScene | null;
25
+ config: import('./WsProxy/proxy').WsProxyConfig;
26
+ remote: boolean;
27
+ autoApply: boolean;
28
+ standalone: boolean;
29
+ }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
30
+ P: {};
31
+ B: {};
32
+ D: {};
33
+ C: {};
34
+ M: {};
35
+ Defaults: {};
36
+ }, Readonly<{
37
+ autoApply?: boolean;
38
+ config?: import('./WsProxy/proxy').WsProxyConfig;
39
+ scene?: import('../..').IScene | null;
40
+ dictFn?: import('./WsProxy/proxy').DictFn;
41
+ standalone?: boolean;
42
+ remote?: boolean;
43
+ }> & Readonly<{
44
+ onOperating?: ((data: import('../..').ILayerOperating) => any) | undefined;
45
+ onRaw?: ((data: unknown) => any) | undefined;
46
+ "onStatus-change"?: ((connected: boolean) => any) | undefined;
47
+ }>, {
48
+ open: () => void;
49
+ feedMessage: (rawMessage: any) => void;
50
+ setConfig: (cfg: import('./WsProxy/proxy').WsProxyConfig) => void;
51
+ isConnected: import('vue').Ref<boolean, boolean>;
52
+ rules: import('vue').ComputedRef<import('./WsProxy/proxy').ProxyRule[]>;
53
+ }, {}, {}, {}, {
54
+ scene: import('../..').IScene | null;
55
+ config: import('./WsProxy/proxy').WsProxyConfig;
56
+ remote: boolean;
57
+ autoApply: boolean;
58
+ standalone: boolean;
59
+ }> | null;
60
+ }, any>;
61
+ export default _default;
@@ -0,0 +1,42 @@
1
+ type Layout = 'stacked' | 'inline';
2
+ type __VLS_Props = {
3
+ /** 统计面板布局,'stacked' 表示堆叠布局,'inline' 表示行内布局 */
4
+ layout?: Layout;
5
+ /** 是否可收起/展开 */
6
+ collapsible?: boolean;
7
+ /** 是否显示 header(脉冲+标题+状态),默认 true */
8
+ showHeader?: boolean;
9
+ /** 整体高度,如 '40px',仅 inline 布局下生效 */
10
+ height?: string;
11
+ /** 定位模式,'static' 时不启用定位 */
12
+ position?: 'static' | 'fixed' | 'absolute';
13
+ /** 定位 top,仅 position 非 static 时生效 */
14
+ top?: string;
15
+ /** 定位 bottom,仅 position 非 static 时生效 */
16
+ bottom?: string;
17
+ /** 定位 left,仅 position 非 static 时生效 */
18
+ left?: string;
19
+ /** 定位 right,仅 position 非 static 时生效 */
20
+ right?: string;
21
+ /** 整体宽度,如 '100%' 或 '360px' */
22
+ width?: string;
23
+ /** WebSocket 新消息,传入后自动累加统计(用 watch 监听变化) */
24
+ message?: unknown;
25
+ /** WebSocket 连接状态,传入后自动同步 */
26
+ connected?: boolean;
27
+ };
28
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
29
+ toggleCollapse: () => void;
30
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
31
+ width: string;
32
+ height: string;
33
+ left: string;
34
+ right: string;
35
+ top: string;
36
+ bottom: string;
37
+ layout: Layout;
38
+ collapsible: boolean;
39
+ showHeader: boolean;
40
+ position: "static" | "fixed" | "absolute";
41
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
42
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import { ScriptStep, ScriptFieldConfig } from './script';
2
+ /** 设备/资源下拉选项 */
3
+ interface DeviceOption {
4
+ label: string;
5
+ value: string;
6
+ className: string;
7
+ nameplate: string;
8
+ }
9
+ type __VLS_Props = {
10
+ selectedStep: ScriptStep | null | undefined;
11
+ selectedFieldConfigs: ScriptFieldConfig[];
12
+ deviceOptions: DeviceOption[];
13
+ resourceDeviceOptions: DeviceOption[];
14
+ statusDisplayColor: string;
15
+ selectedDeviceValue: DeviceOption | null;
16
+ addDeviceValue: DeviceOption | null;
17
+ removeDeviceValue: DeviceOption | null;
18
+ customData: string;
19
+ };
20
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
+ delete: (uid: string) => any;
22
+ copy: (uid: string) => any;
23
+ "update:selectedDeviceValue": (value: DeviceOption | null) => any;
24
+ "update:addDeviceValue": (value: "" | DeviceOption) => any;
25
+ "update:removeDeviceValue": (value: "" | DeviceOption) => any;
26
+ "update:customData": (value: string) => any;
27
+ "move-up": (uid: string) => any;
28
+ "move-down": (uid: string) => any;
29
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
30
+ onDelete?: ((uid: string) => any) | undefined;
31
+ onCopy?: ((uid: string) => any) | undefined;
32
+ "onUpdate:selectedDeviceValue"?: ((value: DeviceOption | null) => any) | undefined;
33
+ "onUpdate:addDeviceValue"?: ((value: "" | DeviceOption) => any) | undefined;
34
+ "onUpdate:removeDeviceValue"?: ((value: "" | DeviceOption) => any) | undefined;
35
+ "onUpdate:customData"?: ((value: string) => any) | undefined;
36
+ "onMove-up"?: ((uid: string) => any) | undefined;
37
+ "onMove-down"?: ((uid: string) => any) | undefined;
38
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
39
+ export default _default;
@@ -0,0 +1,50 @@
1
+ import { ScriptStep, ScriptTemplate } from './script';
2
+ /** 设备/资源下拉选项 */
3
+ interface DeviceOption {
4
+ label: string;
5
+ value: string;
6
+ className: string;
7
+ nameplate: string;
8
+ }
9
+ type __VLS_Props = {
10
+ scriptSteps: ScriptStep[];
11
+ selectedStepUid: string;
12
+ isRunning: boolean;
13
+ isLooping: boolean;
14
+ currentStepIndex: number;
15
+ breakpointUids: Record<string, boolean>;
16
+ isPaused: boolean;
17
+ pausedUid: string;
18
+ runSeq: number;
19
+ statusText: string;
20
+ allChecked: boolean;
21
+ isIndeterminate: boolean;
22
+ scriptTemplates: ScriptTemplate[];
23
+ deviceOptions: DeviceOption[];
24
+ };
25
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
26
+ add: () => any;
27
+ select: (uid: string) => any;
28
+ stop: () => any;
29
+ "update:allChecked": (value: boolean) => any;
30
+ "update:isLooping": (value: boolean) => any;
31
+ "toggle-breakpoint": (uid: string) => any;
32
+ "clear-all": () => any;
33
+ run: () => any;
34
+ "continue-run": () => any;
35
+ "step-next": () => any;
36
+ "load-template": (name: string) => any;
37
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
38
+ onAdd?: (() => any) | undefined;
39
+ onSelect?: ((uid: string) => any) | undefined;
40
+ onStop?: (() => any) | undefined;
41
+ "onUpdate:allChecked"?: ((value: boolean) => any) | undefined;
42
+ "onUpdate:isLooping"?: ((value: boolean) => any) | undefined;
43
+ "onToggle-breakpoint"?: ((uid: string) => any) | undefined;
44
+ "onClear-all"?: (() => any) | undefined;
45
+ onRun?: (() => any) | undefined;
46
+ "onContinue-run"?: (() => any) | undefined;
47
+ "onStep-next"?: (() => any) | undefined;
48
+ "onLoad-template"?: ((name: string) => any) | undefined;
49
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
50
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { ILayer } from '../../../types';
2
+ type __VLS_Props = {
3
+ /** 当前方案的设备图层列表 */
4
+ layers?: ILayer[];
5
+ };
6
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
7
+ open: () => void;
8
+ isRunning: import('vue').Ref<boolean, boolean>;
9
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
+ message: (message: any) => any;
11
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onMessage?: ((message: any) => any) | undefined;
13
+ }>, {
14
+ layers: ILayer[];
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
+ export default _default;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @File : script.ts
3
+ * @Desc. : 脚本模拟器的设备字段配置与预设模板
4
+ */
5
+ /** 字段配置 */
6
+ export interface ScriptFieldConfig {
7
+ key: string;
8
+ label: string;
9
+ type: 'input' | 'select' | 'switch' | 'number' | 'color';
10
+ options?: {
11
+ label: string;
12
+ value: string | number;
13
+ }[];
14
+ default?: any;
15
+ step?: number;
16
+ min?: number;
17
+ max?: number;
18
+ }
19
+ /** 脚本步骤 */
20
+ export interface ScriptStep {
21
+ uid: string;
22
+ deviceType: string;
23
+ deviceId: string;
24
+ delay: number;
25
+ enabled: boolean;
26
+ params: Record<string, any>;
27
+ /** 返回码(0 操作成功 / 400 客户端参数错误 / 500 服务端处理异常) */
28
+ code: number;
29
+ /** 返回消息说明(可选 code 自动带入后可修改) */
30
+ msg: string;
31
+ /** 消息体字段名:'data' 或 'payload' */
32
+ payloadKey: 'data' | 'payload';
33
+ /** 顶层 type 值(可自由配置,默认 'update') */
34
+ msgType: string;
35
+ /** 自定义业务数据 JSON 文本(设备/资源选择「自定义」时启用,作为业务数据) */
36
+ customData?: string;
37
+ /** type 字段覆盖值:设置后业务数据中的 type 使用此值而非 deviceType */
38
+ typeOverride?: string;
39
+ }
40
+ /** 脚本模板 */
41
+ export interface ScriptTemplate {
42
+ name: string;
43
+ description: string;
44
+ steps: Omit<ScriptStep, 'uid'>[];
45
+ }
46
+ /** 设备类型选项 */
47
+ export declare const deviceTypeOptions: {
48
+ label: string;
49
+ value: string;
50
+ }[];
51
+ /** 设备/资源下拉「自定义」选项的标识值(选中后编辑自定义业务数据 JSON) */
52
+ export declare const CUSTOM_DEVICE_TYPE = "__custom__";
53
+ /** 资源类型选项 */
54
+ export declare const resourceTypeOptions: {
55
+ label: string;
56
+ value: string;
57
+ }[];
58
+ /** 通用状态字典:状态值/文本/颜色三要素,供「状态」下拉选择与状态灯颜色展示使用 */
59
+ export interface CommonStatusOption {
60
+ label: string;
61
+ value: number;
62
+ displayColor: string;
63
+ }
64
+ export declare const commonDict: CommonStatusOption[];
65
+ /** 资源状态字典:资源增删专用,状态值/文本/颜色三要素 */
66
+ export declare const resourceDict: CommonStatusOption[];
67
+ /** 返回码字典:code / 说明,供「返回码」下拉与 msg 自动带入使用 */
68
+ export interface CodeOption {
69
+ label: string;
70
+ value: number;
71
+ }
72
+ export declare const codeDict: CodeOption[];
73
+ /** 默认消息体字段名 */
74
+ export declare const defaultPayloadKey: 'data' | 'payload';
75
+ /** 默认顶层 type 值 */
76
+ export declare const defaultMsgType = "update";
77
+ /** 默认返回码 */
78
+ export declare const defaultCode = 0;
79
+ /** 默认返回说明 */
80
+ export declare const defaultMsg = "\u64CD\u4F5C\u6210\u529F";
81
+ /** 可作为资源容器的设备类型 */
82
+ export declare const containerDeviceOptions: {
83
+ label: string;
84
+ value: string;
85
+ }[];
86
+ /** 各设备类型的字段配置 */
87
+ export declare const deviceFieldConfigs: Record<string, ScriptFieldConfig[]>;
88
+ /**
89
+ * 模板说明:
90
+ * - 每个步骤的 deviceId 留空,由 loadTemplate 根据当前方案自动回填
91
+ * - 单设备模板总时长 ≤ 3 秒
92
+ * - 完整生产流程展示资源跨设备搬运全流程
93
+ * - 状态值:0=待机,1=运行,2=报警(见 commonDict)
94
+ * - x 值每步增量 ≤ 0.03,整体移动幅度小(轻微移动)
95
+ */
96
+ export declare const scriptTemplates: ScriptTemplate[];
97
+ /** 获取设备类型中文标签 */
98
+ export declare function getDeviceLabel(deviceType: string): string;
99
+ /** 为指定设备类型创建默认参数 */
100
+ export declare function createDefaultParams(deviceType: string): Record<string, any>;
@@ -0,0 +1,18 @@
1
+ import { WsProxyConfig } from './proxy';
2
+ type __VLS_Props = {
3
+ config: WsProxyConfig;
4
+ /** 配置来源:localFile 本地文件 / store 持久化配置(含用户手动修改场景) */
5
+ configSource: 'localFile' | 'store';
6
+ /** 用户是否已手动修改配置(configSource 为 store 时区分「本地文件异常」与「已手动修改配置」) */
7
+ manualModified?: boolean;
8
+ /** 是否已配置 dictFn(用于「字典 Label / 字典 Color」选项右侧 tag 显示) */
9
+ hasDictFn?: boolean;
10
+ };
11
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
+ reset: (value: WsProxyConfig) => any;
13
+ "update:config": (value: WsProxyConfig) => any;
14
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onReset?: ((value: WsProxyConfig) => any) | undefined;
16
+ "onUpdate:config"?: ((value: WsProxyConfig) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
18
+ export default _default;
@@ -0,0 +1,24 @@
1
+ type __VLS_Props = {
2
+ url: string;
3
+ isConnected: boolean;
4
+ isConnecting: boolean;
5
+ stateInfo: string;
6
+ /** 心跳检测间隔(秒):0=关闭 */
7
+ heartbeatInterval: number;
8
+ };
9
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
+ "update:url": (value: string) => any;
11
+ "update:heartbeatInterval": (value: number) => any;
12
+ connect: () => any;
13
+ disconnect: () => any;
14
+ reconnect: () => any;
15
+ send: (data: string) => any;
16
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ "onUpdate:url"?: ((value: string) => any) | undefined;
18
+ "onUpdate:heartbeatInterval"?: ((value: number) => any) | undefined;
19
+ onConnect?: (() => any) | undefined;
20
+ onDisconnect?: (() => any) | undefined;
21
+ onReconnect?: (() => any) | undefined;
22
+ onSend?: ((data: string) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
24
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { IScene } from '../../../types';
2
+ import { DictFn } from './proxy';
3
+ type __VLS_Props = {
4
+ /** 场景信息:用于字段映射中像素换算(如 currentCase.scene) */
5
+ scene?: IScene | null;
6
+ /** 字典转换函数:用于「字典 Label / 字典 Color」特殊处理
7
+ * 入参 (name, value, type),返回 string 赋给画布字段 */
8
+ dictFn?: DictFn;
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ scene: IScene | null;
12
+ dictFn: DictFn;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
14
+ export default _default;