@jnrs/lingshu-smart 2.2.32 → 2.2.34
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.
- package/AGENTS.md +56 -3
- package/README.md +140 -0
- package/dist/components/debug/DebugPanel.vue.d.ts +2 -0
- package/dist/components/debug/PerformanceStats.vue.d.ts +42 -0
- package/dist/components/debug/ScriptRunner/ConfigPanel.vue.d.ts +36 -0
- package/dist/components/debug/ScriptRunner/LogPanel.vue.d.ts +19 -0
- package/dist/components/debug/ScriptRunner/StepsPanel.vue.d.ts +42 -0
- package/dist/components/debug/ScriptRunner/index.vue.d.ts +16 -0
- package/dist/components/debug/ScriptRunner/script.d.ts +72 -0
- package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +40 -40
- package/dist/components/editor/DrawingBoard.vue.d.ts +3 -1
- package/dist/components/editor/OptionCard/Equipment/models/PartConfig.vue.d.ts +2 -0
- package/dist/components/editor/index.vue.d.ts +3 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +29307 -2053
- package/dist/components/preview/index.vue.d.ts +1859 -3
- package/dist/composables/useDebugEasterEgg.d.ts +2 -0
- package/dist/controller/AppController.d.ts +9 -0
- package/dist/controller/EditorController.d.ts +1 -1
- package/dist/index.js +153 -17
- package/dist/locales/en.d.ts +45 -0
- package/dist/locales/i18next.d.ts +102 -1
- package/dist/locales/index.js +94 -4
- package/dist/locales/zhCn.d.ts +45 -0
- package/dist/playground/ViewPageDemo.vue.d.ts +3744 -6
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/useAppStore.d.ts +5565 -3
- package/dist/stores/useDataStore.d.ts +5565 -3
- package/dist/stores/useDebugStore.d.ts +112 -0
- package/dist/stores/useEditorStore.d.ts +5 -2
- package/dist/types/app.types.d.ts +3 -0
- package/dist/types/enums.d.ts +1 -0
- package/dist/types/guards.d.ts +1 -0
- package/dist/types/models/config.types.d.ts +9 -1
- package/dist/types/models/operating.types.d.ts +8 -1
- package/dist/ui/abstract/BaseAbs.d.ts +23 -0
- package/dist/ui/abstract/ComponentAbs.d.ts +3 -15
- package/dist/ui/abstract/ModelAbs.d.ts +7 -17
- package/dist/ui/components/Light.d.ts +5 -0
- package/dist/ui/components/StationSlot.d.ts +2 -1
- package/dist/ui/models/ResourceStore.d.ts +5 -0
- package/dist/ui/models/ShuttleStation.d.ts +21 -0
- package/dist/utils/debug-flags.d.ts +9 -0
- package/dist/utils/formatOperating.d.ts +7 -0
- package/dist/utils/index.d.ts +19 -15
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/performance-stats.d.ts +38 -0
- package/package.json +5 -3
- package/dist/index-g6O0IWAC.js +0 -24879
- package/dist/playground/mockWebSocketData.d.ts +0 -23
package/AGENTS.md
CHANGED
|
@@ -164,7 +164,7 @@ WebSocket 原始消息
|
|
|
164
164
|
→ onMessage 校验 & 解析
|
|
165
165
|
→ 按 payload.type 分支映射
|
|
166
166
|
→ operating(ILayerOperating)
|
|
167
|
-
→ AppController.businessMap
|
|
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()`
|
|
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,58 @@ 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
|
+
| `controller/AppController.ts` | 提供 `toggleShadows` / `toggleAnimations` / `setFps` 方法 |
|
|
711
|
+
|
|
712
|
+
### 日志系统
|
|
713
|
+
|
|
714
|
+
```typescript
|
|
715
|
+
import { createLogger, setLogLevel } from '@/utils/logger'
|
|
716
|
+
|
|
717
|
+
const logger = createLogger('MyModule')
|
|
718
|
+
logger.log('消息') // LOG:MyModule 消息(彩色单徽章)
|
|
719
|
+
logger.operating('操作, data=%o', data) // OPERATING:MyModule 操作, data={...}(紫色徽章)
|
|
720
|
+
logger.warn('警告') // [WARN:MyModule] 警告(浏览器默认样式)
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
- `log`/`info`/`operating` 级别:使用彩色单徽章(`LEVEL:Tag` 合并显示)
|
|
724
|
+
- `warn`/`error` 级别:纯文本前缀 `[LEVEL:Tag]`
|
|
725
|
+
- `operating` 级别:用于追踪 UI 模型操作指令,在 `ModelAbs.handleOperation` 和 `ComponentAbs.handleOperation` 中自动埋点
|
|
726
|
+
- 日志等级优先级:`none` < `error` < `warn` < `info` < `log` < `operating`
|
|
727
|
+
- 默认:开发环境 `log`(全开),生产环境 `warn`
|
|
728
|
+
|
|
729
|
+
### 调试配置项
|
|
730
|
+
|
|
731
|
+
| 配置项 | store 字段 | AppController 方法 |
|
|
732
|
+
| ------------ | ---------------------- | ------------------------- |
|
|
733
|
+
| 日志显示等级 | `logLevel` | `setLogLevel()` |
|
|
734
|
+
| 显示内外阴影 | `shadowsEnabled` | `toggleShadows()` |
|
|
735
|
+
| 启用全局动画 | `animationsEnabled` | `toggleAnimations()` |
|
|
736
|
+
| 全局 FPS | `fpsMode` | `setFps()` |
|
|
737
|
+
| 禁止所有交互 | `interactionsDisabled` | CSS `pointer-events` |
|
|
738
|
+
| 性能统计 | — | `trackWebSocketMessage()` |
|
|
739
|
+
|
|
740
|
+
- **动画开关**:通过标志位控制循环动画(灯闪烁、入口通道动画等),关闭后保留静态状态(如灯颜色保持不变),不影响一次性动画(如机器人摆臂、进度条动画)
|
|
741
|
+
- **阴影开关**:递归遍历所有元素切换 `shadow`/`innerShadow` 的 `visible` 属性,同时处理 `ShadowCanvas` 元素(`createShadow` 工厂创建的 Canvas 阴影)的 `visible` 属性
|
|
742
|
+
|
|
743
|
+
### localStorage 存储
|
|
744
|
+
|
|
745
|
+
统一 key 为 `lingshu-smart`,debug 配置存储在 `debug` 子对象中,与 `useDataStore` 的持久化数据共享同一 key。
|
|
693
746
|
|
|
694
747
|
---
|
|
695
748
|
|
package/README.md
CHANGED
|
@@ -49,3 +49,143 @@ import { transRuntimeToPixel, transPercentToPixel } from '@jnrs/lingshu-smart'
|
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
详细文档请查看 [AGENTS.md](./AGENTS.md)
|
|
52
|
+
|
|
53
|
+
## 🐛 调试功能
|
|
54
|
+
|
|
55
|
+
本库内置了全局调试系统,支持运行时动态配置日志等级、渲染效果和交互状态,适用于开发环境排查问题或生产环境现场调试。
|
|
56
|
+
|
|
57
|
+
### 调试模式触发
|
|
58
|
+
|
|
59
|
+
在编辑器或预览页面中,500ms 内快速点击主容器(`#lingshu-smart`)10 次即可触发调试模式确认对话框,确认后打开调试配置面板。此操作类似 Android 系统的"开发者模式"快捷入口。
|
|
60
|
+
|
|
61
|
+
> 该触发方式基于 DOM 原生 `click` 事件绑定,不受"禁止所有交互"配置的影响。
|
|
62
|
+
|
|
63
|
+
### 调试配置面板
|
|
64
|
+
|
|
65
|
+
| 配置项 | 说明 |
|
|
66
|
+
| ------------- | -------------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| 日志显示等级 | `none`(静默)/ `error` / `warn` / `info` / `log`(全部显示)/ `operating`(全部显示 + UI 模型操作追踪) |
|
|
68
|
+
| 显示内外阴影 | 全局开关所有 Leafer 图形的 `shadow` / `innerShadow` 效果(含 ShadowCanvas 绘制阴影) |
|
|
69
|
+
| 启用全局动画 | 全局开关循环动画(如灯闪烁、入口通道动画),关闭后保留静态状态(如灯颜色保持不变),不影响一次性动画 |
|
|
70
|
+
| 全局 FPS | 限制 Leafer 渲染帧率:`auto`(不限制)/ `30` / `60` / `120` FPS |
|
|
71
|
+
| 禁止所有交互 | 通过 CSS `pointer-events: none` 禁用主容器内所有子元素交互,调试模式开关不受此限制 |
|
|
72
|
+
| 语言/Language | 切换调试面板和性能统计的显示语言:`中文` / `English` |
|
|
73
|
+
| 性能统计 | 显示页面运行开始时间、持续运行时长、WebSocket 消息接收次数和数据量 |
|
|
74
|
+
|
|
75
|
+
### 日志系统
|
|
76
|
+
|
|
77
|
+
日志工具 `createLogger(tag)` 创建带标签的 Logger 实例,输出格式为 `[等级:Tag] 消息内容`:
|
|
78
|
+
|
|
79
|
+
- `log` / `info` / `operating` 级别:使用彩色单徽章样式(`LEVEL:Tag` 合并显示)
|
|
80
|
+
- `warn` / `error` 级别:保留浏览器默认样式,以纯文本前缀显示
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { createLogger, setLogLevel, type LogLevel } from '@jnrs/lingshu-smart/utils/logger'
|
|
84
|
+
|
|
85
|
+
const logger = createLogger('MyModule')
|
|
86
|
+
logger.log('模型已加载, uuid=%s', uuid) // LOG:MyModule 模型已加载, uuid=xxx
|
|
87
|
+
logger.warn('配置缺失: %s', key) // [WARN:MyModule] 配置缺失: xxx
|
|
88
|
+
logger.operating('执行操作, data=%o', data) // OPERATING:MyModule 执行操作, data={...}
|
|
89
|
+
|
|
90
|
+
// 代码层面设置日志等级(优先级低于调试面板的运行时配置)
|
|
91
|
+
setLogLevel('warn' as LogLevel) // 仅显示 warn + error
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### operating 日志级别
|
|
95
|
+
|
|
96
|
+
`operating` 是最详细的日志级别,用于追踪 UI 模型的操作指令。在 `ModelAbs.handleOperation` 和 `ComponentAbs.handleOperation` 中自动埋点,记录模型的 `className`、`uuid`、`businessId` 和接收到的 `operating` 数据,便于追溯 WebSocket 数据与前端 UI 动作的对应关系,定位问题是后端数据返回有误还是前端 UI 显示有误。
|
|
97
|
+
|
|
98
|
+
### 性能统计
|
|
99
|
+
|
|
100
|
+
通过 `trackWebSocketMessage(data)` 记录 WebSocket 消息接收,在调试面板中实时显示运行时长和数据接收量:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { trackWebSocketMessage } from '@jnrs/lingshu-smart/utils/performance-stats'
|
|
104
|
+
|
|
105
|
+
// 在 WebSocket onmessage 回调中调用
|
|
106
|
+
ws.onmessage = (event) => {
|
|
107
|
+
trackWebSocketMessage(event.data)
|
|
108
|
+
// ... 业务处理
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 配置持久化
|
|
113
|
+
|
|
114
|
+
所有调试配置通过 `localStorage` 持久化存储,key 为 `@jnrs/lingshu-smart/debug`:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"logLevel": "log",
|
|
119
|
+
"shadowsEnabled": true,
|
|
120
|
+
"animationsEnabled": true,
|
|
121
|
+
"fpsMode": "auto",
|
|
122
|
+
"interactionsDisabled": false,
|
|
123
|
+
"locale": "zhCn"
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
页面刷新后自动恢复上次配置。如需重置,点击调试面板中的"恢复默认"按钮。
|
|
128
|
+
|
|
129
|
+
## 🌐 国际化
|
|
130
|
+
|
|
131
|
+
本库内置 vue-i18n 国际化支持,默认提供中文(`zhCn`)和英文(`en`)两种语言,涵盖调试面板、性能统计等模块。
|
|
132
|
+
|
|
133
|
+
### 在宿主项目中切换语言
|
|
134
|
+
|
|
135
|
+
通过 `useDebugStore` 的 `setLocale` 方法切换语言,切换后库内所有组件文本实时更新:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { useDebugStore } from '@jnrs/lingshu-smart/stores/useDebugStore'
|
|
139
|
+
|
|
140
|
+
const debugStore = useDebugStore()
|
|
141
|
+
|
|
142
|
+
// 切换为英文
|
|
143
|
+
debugStore.setLocale('en')
|
|
144
|
+
|
|
145
|
+
// 切换为中文
|
|
146
|
+
debugStore.setLocale('zhCn')
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 自定义或扩展翻译
|
|
150
|
+
|
|
151
|
+
如需覆盖现有翻译或添加新的语言,通过 vue-i18n 的 `mergeLocaleMessage` 合并:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import i18n from '@jnrs/lingshu-smart/locales/i18next'
|
|
155
|
+
|
|
156
|
+
// 覆盖中文翻译
|
|
157
|
+
i18n.global.mergeLocaleMessage('zhCn', {
|
|
158
|
+
perf: {
|
|
159
|
+
panelButton: '监控面板'
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
// 添加新语言
|
|
164
|
+
i18n.global.mergeLocaleMessage('ja', {
|
|
165
|
+
perf: {
|
|
166
|
+
title: 'ライブモニター',
|
|
167
|
+
status: '実行中'
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 与宿主项目 i18n 集成
|
|
173
|
+
|
|
174
|
+
如果宿主项目已使用 vue-i18n,可选择以下方案:
|
|
175
|
+
|
|
176
|
+
1. **独立模式**(推荐):库内部 i18n 实例独立运行,通过 `setLocale` 同步语言,互不干扰。
|
|
177
|
+
2. **共享模式**:将库的 messages 合并到宿主项目的 i18n 实例中,统一管理。
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// 方案1:监听宿主语言变化,同步到库
|
|
181
|
+
import { watch } from 'vue'
|
|
182
|
+
import { useDebugStore } from '@jnrs/lingshu-smart/stores/useDebugStore'
|
|
183
|
+
|
|
184
|
+
const debugStore = useDebugStore()
|
|
185
|
+
watch(
|
|
186
|
+
() => hostI18n.global.locale.value,
|
|
187
|
+
(lang) => {
|
|
188
|
+
debugStore.setLocale(lang === 'zh-CN' ? 'zhCn' : 'en')
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
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,36 @@
|
|
|
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: string;
|
|
16
|
+
addDeviceValue: string;
|
|
17
|
+
removeDeviceValue: string;
|
|
18
|
+
};
|
|
19
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
20
|
+
copy: (uid: string) => any;
|
|
21
|
+
delete: (uid: string) => any;
|
|
22
|
+
"update:selectedDeviceValue": (value: string) => any;
|
|
23
|
+
"update:addDeviceValue": (value: string) => any;
|
|
24
|
+
"update:removeDeviceValue": (value: string) => any;
|
|
25
|
+
"move-up": (uid: string) => any;
|
|
26
|
+
"move-down": (uid: string) => any;
|
|
27
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
+
onCopy?: ((uid: string) => any) | undefined;
|
|
29
|
+
onDelete?: ((uid: string) => any) | undefined;
|
|
30
|
+
"onUpdate:selectedDeviceValue"?: ((value: string) => any) | undefined;
|
|
31
|
+
"onUpdate:addDeviceValue"?: ((value: string) => any) | undefined;
|
|
32
|
+
"onUpdate:removeDeviceValue"?: ((value: string) => any) | undefined;
|
|
33
|
+
"onMove-up"?: ((uid: string) => any) | undefined;
|
|
34
|
+
"onMove-down"?: ((uid: string) => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** 日志条目(对应 WebSocket 消息结构) */
|
|
2
|
+
export interface LogEntry {
|
|
3
|
+
datetime: string;
|
|
4
|
+
type: string;
|
|
5
|
+
traceId: string;
|
|
6
|
+
payload: any;
|
|
7
|
+
}
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
logs: LogEntry[];
|
|
10
|
+
maxLogCount: number;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
copy: () => any;
|
|
14
|
+
clear: () => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
onCopy?: (() => any) | undefined;
|
|
17
|
+
onClear?: (() => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ScriptStep, ScriptTemplate } from './script';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
scriptSteps: ScriptStep[];
|
|
4
|
+
selectedStepUid: string;
|
|
5
|
+
isRunning: boolean;
|
|
6
|
+
isLooping: boolean;
|
|
7
|
+
currentStepIndex: number;
|
|
8
|
+
breakpointUids: Record<string, boolean>;
|
|
9
|
+
isPaused: boolean;
|
|
10
|
+
pausedUid: string;
|
|
11
|
+
runSeq: number;
|
|
12
|
+
statusText: string;
|
|
13
|
+
allChecked: boolean;
|
|
14
|
+
isIndeterminate: boolean;
|
|
15
|
+
scriptTemplates: ScriptTemplate[];
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
18
|
+
add: () => any;
|
|
19
|
+
select: (uid: string) => any;
|
|
20
|
+
stop: () => any;
|
|
21
|
+
"update:allChecked": (value: boolean) => any;
|
|
22
|
+
"update:isLooping": (value: boolean) => any;
|
|
23
|
+
"toggle-breakpoint": (uid: string) => any;
|
|
24
|
+
"clear-all": () => any;
|
|
25
|
+
run: () => any;
|
|
26
|
+
"continue-run": () => any;
|
|
27
|
+
"step-next": () => any;
|
|
28
|
+
"load-template": (name: string) => any;
|
|
29
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
|
+
onAdd?: (() => any) | undefined;
|
|
31
|
+
onSelect?: ((uid: string) => any) | undefined;
|
|
32
|
+
onStop?: (() => any) | undefined;
|
|
33
|
+
"onUpdate:allChecked"?: ((value: boolean) => any) | undefined;
|
|
34
|
+
"onUpdate:isLooping"?: ((value: boolean) => any) | undefined;
|
|
35
|
+
"onToggle-breakpoint"?: ((uid: string) => any) | undefined;
|
|
36
|
+
"onClear-all"?: (() => any) | undefined;
|
|
37
|
+
onRun?: (() => any) | undefined;
|
|
38
|
+
"onContinue-run"?: (() => any) | undefined;
|
|
39
|
+
"onStep-next"?: (() => any) | undefined;
|
|
40
|
+
"onLoad-template"?: ((name: string) => any) | undefined;
|
|
41
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
42
|
+
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,72 @@
|
|
|
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
|
+
}
|
|
28
|
+
/** 脚本模板 */
|
|
29
|
+
export interface ScriptTemplate {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
steps: Omit<ScriptStep, 'uid'>[];
|
|
33
|
+
}
|
|
34
|
+
/** 设备类型选项 */
|
|
35
|
+
export declare const deviceTypeOptions: {
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}[];
|
|
39
|
+
/** 资源类型选项 */
|
|
40
|
+
export declare const resourceTypeOptions: {
|
|
41
|
+
label: string;
|
|
42
|
+
value: string;
|
|
43
|
+
}[];
|
|
44
|
+
/** 通用状态字典:状态值/文本/颜色三要素,供「状态」下拉选择与状态灯颜色展示使用 */
|
|
45
|
+
export interface CommonStatusOption {
|
|
46
|
+
label: string;
|
|
47
|
+
value: number;
|
|
48
|
+
displayColor: string;
|
|
49
|
+
}
|
|
50
|
+
export declare const commonDict: CommonStatusOption[];
|
|
51
|
+
/** 资源状态字典:资源增删专用,状态值/文本/颜色三要素 */
|
|
52
|
+
export declare const resourceDict: CommonStatusOption[];
|
|
53
|
+
/** 可作为资源容器的设备类型 */
|
|
54
|
+
export declare const containerDeviceOptions: {
|
|
55
|
+
label: string;
|
|
56
|
+
value: string;
|
|
57
|
+
}[];
|
|
58
|
+
/** 各设备类型的字段配置 */
|
|
59
|
+
export declare const deviceFieldConfigs: Record<string, ScriptFieldConfig[]>;
|
|
60
|
+
/**
|
|
61
|
+
* 模板说明:
|
|
62
|
+
* - 每个步骤的 deviceId 留空,由 loadTemplate 根据当前方案自动回填
|
|
63
|
+
* - 单设备模板总时长 ≤ 3 秒
|
|
64
|
+
* - 完整生产流程展示资源跨设备搬运全流程
|
|
65
|
+
* - 状态值:0=待机,1=运行,2=报警(见 commonDict)
|
|
66
|
+
* - x 值每步增量 ≤ 0.03,整体移动幅度小(轻微移动)
|
|
67
|
+
*/
|
|
68
|
+
export declare const scriptTemplates: ScriptTemplate[];
|
|
69
|
+
/** 获取设备类型中文标签 */
|
|
70
|
+
export declare function getDeviceLabel(deviceType: string): string;
|
|
71
|
+
/** 为指定设备类型创建默认参数 */
|
|
72
|
+
export declare function createDefaultParams(deviceType: string): Record<string, any>;
|