@jnrs/lingshu-smart 2.2.20 → 2.2.22
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/AGENTIC.md +173 -177
- package/package.json +1 -1
package/AGENTIC.md
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
## 📦 模块总览
|
|
8
8
|
|
|
9
|
-
| 模块路径
|
|
10
|
-
|
|
11
|
-
| `@jnrs/lingshu-smart`
|
|
12
|
-
| `@jnrs/lingshu-smart/components`
|
|
13
|
-
| `@jnrs/lingshu-smart/stores`
|
|
14
|
-
| `@jnrs/lingshu-smart/composables` | Vue 组合式 API
|
|
15
|
-
| `@jnrs/lingshu-smart/controller`
|
|
16
|
-
| `@jnrs/lingshu-smart/types`
|
|
17
|
-
| `@jnrs/lingshu-smart/utils`
|
|
18
|
-
| `@jnrs/lingshu-smart/constants`
|
|
19
|
-
| `@jnrs/lingshu-smart/ui`
|
|
20
|
-
| `@jnrs/lingshu-smart/locales`
|
|
9
|
+
| 模块路径 | 说明 |
|
|
10
|
+
| --------------------------------- | ------------------------------ |
|
|
11
|
+
| `@jnrs/lingshu-smart` | 主模块,包含类型定义和工具函数 |
|
|
12
|
+
| `@jnrs/lingshu-smart/components` | Vue 组件库(编辑器、预览器) |
|
|
13
|
+
| `@jnrs/lingshu-smart/stores` | Pinia 状态管理 |
|
|
14
|
+
| `@jnrs/lingshu-smart/composables` | Vue 组合式 API |
|
|
15
|
+
| `@jnrs/lingshu-smart/controller` | 控制器类 |
|
|
16
|
+
| `@jnrs/lingshu-smart/types` | TypeScript 类型定义 |
|
|
17
|
+
| `@jnrs/lingshu-smart/utils` | 工具函数 |
|
|
18
|
+
| `@jnrs/lingshu-smart/constants` | 常量配置 |
|
|
19
|
+
| `@jnrs/lingshu-smart/ui` | UI 模型和工厂 |
|
|
20
|
+
| `@jnrs/lingshu-smart/locales` | 国际化配置 |
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
39
|
enum EnumStepType {
|
|
40
|
-
UNDO = 'Undo',
|
|
41
|
-
REDO = 'Redo'
|
|
40
|
+
UNDO = 'Undo', // 撤销
|
|
41
|
+
REDO = 'Redo' // 重做
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -63,20 +63,20 @@ enum EnumTag {
|
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
65
|
enum EnumModel {
|
|
66
|
-
SINGLE_JOINT_ROBOT = 'SingleJointRobot',
|
|
67
|
-
DOUBLE_JOINT_ROBOT = 'DoubleJointRobot',
|
|
68
|
-
RGV = 'Rgv',
|
|
69
|
-
MACHINE_TOOL = 'MachineTool',
|
|
70
|
-
MARKING_MACHINE = 'MarkingMachine',
|
|
71
|
-
CLEANING_MACHINE = 'CleaningMachine',
|
|
72
|
-
LOADING_STATION = 'LoadingStation',
|
|
73
|
-
PALLET_STORAGE = 'PalletStorage',
|
|
74
|
-
TOOL_STORAGE = 'ToolStorage',
|
|
75
|
-
BUFFER_DOCK = 'BufferDock',
|
|
76
|
-
GROUND_RAIL = 'GroundRail',
|
|
77
|
-
FOLLOWING_TUGGER = 'FollowingTugger',
|
|
78
|
-
RAIL = 'Rail',
|
|
79
|
-
RESOURCE_STORE = 'ResourceStore'
|
|
66
|
+
SINGLE_JOINT_ROBOT = 'SingleJointRobot', // 单关节机器人
|
|
67
|
+
DOUBLE_JOINT_ROBOT = 'DoubleJointRobot', // 双关节机器人
|
|
68
|
+
RGV = 'Rgv', // RGV
|
|
69
|
+
MACHINE_TOOL = 'MachineTool', // 机床
|
|
70
|
+
MARKING_MACHINE = 'MarkingMachine', // 打标机
|
|
71
|
+
CLEANING_MACHINE = 'CleaningMachine', // 清洗机
|
|
72
|
+
LOADING_STATION = 'LoadingStation', // 上料站
|
|
73
|
+
PALLET_STORAGE = 'PalletStorage', // 托盘库
|
|
74
|
+
TOOL_STORAGE = 'ToolStorage', // 刀具库
|
|
75
|
+
BUFFER_DOCK = 'BufferDock', // 缓冲站
|
|
76
|
+
GROUND_RAIL = 'GroundRail', // 地轨
|
|
77
|
+
FOLLOWING_TUGGER = 'FollowingTugger', // 跟随牵引车
|
|
78
|
+
RAIL = 'Rail', // 轨道
|
|
79
|
+
RESOURCE_STORE = 'ResourceStore' // 资源库
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -86,8 +86,8 @@ enum EnumModel {
|
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
88
|
enum EnumComponent {
|
|
89
|
-
STATION_SLOT = 'StationSlot',
|
|
90
|
-
RESOURCE = 'Resource'
|
|
89
|
+
STATION_SLOT = 'StationSlot', // 工位槽
|
|
90
|
+
RESOURCE = 'Resource' // 资源
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
|
@@ -97,8 +97,8 @@ enum EnumComponent {
|
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
enum EnumResourceType {
|
|
100
|
-
PALLET = 'Pallet',
|
|
101
|
-
TOOL = 'Tool'
|
|
100
|
+
PALLET = 'Pallet', // 托盘
|
|
101
|
+
TOOL = 'Tool' // 刀具
|
|
102
102
|
}
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -116,15 +116,15 @@ type EnumInteractiveUi = EnumModel | EnumComponent
|
|
|
116
116
|
|
|
117
117
|
场景配置
|
|
118
118
|
|
|
119
|
-
| 属性名
|
|
120
|
-
|
|
121
|
-
| width
|
|
122
|
-
| height
|
|
123
|
-
| runtime_width
|
|
124
|
-
| runtime_height | `number`
|
|
125
|
-
| zoomType
|
|
126
|
-
| fill
|
|
127
|
-
| texture
|
|
119
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
120
|
+
| -------------- | ----------------- | ---- | -------------------------------- |
|
|
121
|
+
| width | `number` | ✓ | 场景宽度 |
|
|
122
|
+
| height | `number` | ✓ | 场景高度 |
|
|
123
|
+
| runtime_width | `number` | - | 运行时宽度(业务数据) |
|
|
124
|
+
| runtime_height | `number` | - | 运行时高度(业务数据) |
|
|
125
|
+
| zoomType | `'fit' \| number` | ✓ | 缩放类型:'fit' 自适应或具体数值 |
|
|
126
|
+
| fill | `FillConfig` | - | 背景填充配置 |
|
|
127
|
+
| texture | `string` | - | 纹理图片 URL |
|
|
128
128
|
|
|
129
129
|
**FillConfig 类型:**
|
|
130
130
|
|
|
@@ -144,13 +144,13 @@ interface FillConfig {
|
|
|
144
144
|
|
|
145
145
|
方案(案例)
|
|
146
146
|
|
|
147
|
-
| 属性名
|
|
148
|
-
|
|
149
|
-
| uuid
|
|
150
|
-
| isActive | `boolean`
|
|
151
|
-
| title
|
|
152
|
-
| scene
|
|
153
|
-
| layers
|
|
147
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
148
|
+
| -------- | ---------- | ---- | ------------------ |
|
|
149
|
+
| uuid | `string` | ✓ | 唯一标识 |
|
|
150
|
+
| isActive | `boolean` | ✓ | 是否为当前激活方案 |
|
|
151
|
+
| title | `string` | ✓ | 方案标题 |
|
|
152
|
+
| scene | `IScene` | ✓ | 场景配置 |
|
|
153
|
+
| layers | `ILayer[]` | ✓ | 图层列表 |
|
|
154
154
|
|
|
155
155
|
###### ILayer
|
|
156
156
|
|
|
@@ -170,22 +170,22 @@ type InteractiveUi = ILayer | IStationSlotConfig | IResourceConfig
|
|
|
170
170
|
|
|
171
171
|
事件处理器
|
|
172
172
|
|
|
173
|
-
| 属性名
|
|
174
|
-
|
|
175
|
-
| onTap
|
|
173
|
+
| 属性名 | 类型 | 说明 |
|
|
174
|
+
| --------- | ---------------------------------------------- | ------------------------- |
|
|
175
|
+
| onTap | `(layer: ILayer, data: InteractiveUi) => void` | 快速点击事件(左键单击) |
|
|
176
176
|
| onMenuTap | `(layer: ILayer, data: InteractiveUi) => void` | 右键 tap 事件(右键单击) |
|
|
177
|
-
| onDragEnd | `(layer: ILayer, data: InteractiveUi) => void` | 拖动结束事件
|
|
177
|
+
| onDragEnd | `(layer: ILayer, data: InteractiveUi) => void` | 拖动结束事件 |
|
|
178
178
|
|
|
179
179
|
###### IContainer
|
|
180
180
|
|
|
181
181
|
容器配置
|
|
182
182
|
|
|
183
|
-
| 属性名
|
|
184
|
-
|
|
185
|
-
| appDomId
|
|
186
|
-
| autoStart
|
|
187
|
-
| appEditable | `boolean`
|
|
188
|
-
| actions
|
|
183
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
184
|
+
| ----------- | ----------------------- | ------- | ---------------------- |
|
|
185
|
+
| appDomId | `string \| HTMLElement` | — | APP 容器 DOM ID 或元素 |
|
|
186
|
+
| autoStart | `boolean` | `true` | 是否自动启动引擎 |
|
|
187
|
+
| appEditable | `boolean` | `false` | APP 是否可编辑状态 |
|
|
188
|
+
| actions | `IEventHandler` | — | 事件处理配置 |
|
|
189
189
|
|
|
190
190
|
##### 工具函数 (Utils)
|
|
191
191
|
|
|
@@ -195,10 +195,10 @@ type InteractiveUi = ILayer | IStationSlotConfig | IResourceConfig
|
|
|
195
195
|
|
|
196
196
|
**参数:**
|
|
197
197
|
|
|
198
|
-
| 参数名
|
|
199
|
-
|
|
200
|
-
| start
|
|
201
|
-
| end
|
|
198
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
199
|
+
| ---------- | --------- | ------- | ------------ |
|
|
200
|
+
| start | `number` | — | 起始值 |
|
|
201
|
+
| end | `number` | — | 结束值 |
|
|
202
202
|
| shouldLoop | `boolean` | `false` | 是否无限循环 |
|
|
203
203
|
|
|
204
204
|
**返回值:** `Generator<number>` - 数字生成器
|
|
@@ -220,13 +220,13 @@ for (const num of gen) {
|
|
|
220
220
|
|
|
221
221
|
**参数:**
|
|
222
222
|
|
|
223
|
-
| 参数名
|
|
224
|
-
|
|
225
|
-
| x
|
|
226
|
-
| y
|
|
227
|
-
| n
|
|
228
|
-
| rate
|
|
229
|
-
| callback | `(val: number \| string) => void` | —
|
|
223
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
224
|
+
| -------- | --------------------------------- | ------ | -------------- |
|
|
225
|
+
| x | `number` | `0` | 初始值 |
|
|
226
|
+
| y | `number` | `100` | 结束值 |
|
|
227
|
+
| n | `number` | `3` | 递增时长(秒) |
|
|
228
|
+
| rate | `number` | `300` | 帧率(ms) |
|
|
229
|
+
| callback | `(val: number \| string) => void` | — | 回调函数 |
|
|
230
230
|
|
|
231
231
|
**返回值:** `Promise<void>`
|
|
232
232
|
|
|
@@ -246,12 +246,12 @@ await linearIncrease(0, 100, 3, 300, (val) => {
|
|
|
246
246
|
|
|
247
247
|
**参数:**
|
|
248
248
|
|
|
249
|
-
| 参数名
|
|
250
|
-
|
|
251
|
-
| val
|
|
252
|
-
| size
|
|
253
|
-
| precision
|
|
254
|
-
| getPercent | `boolean` | `false` | 是否返回百分比
|
|
249
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
250
|
+
| ---------- | --------- | ------- | --------------------------- |
|
|
251
|
+
| val | `number` | — | 百分比数字(0~1)或像素数字 |
|
|
252
|
+
| size | `number` | — | 尺寸,用于计算百分比 |
|
|
253
|
+
| precision | `number` | `3` | 保留的小数位数 |
|
|
254
|
+
| getPercent | `boolean` | `false` | 是否返回百分比 |
|
|
255
255
|
|
|
256
256
|
**返回值:** `number` - 转换后的值
|
|
257
257
|
|
|
@@ -273,10 +273,10 @@ const percent = transPercentAndPixel(960, 1920, 3, true) // 0.5
|
|
|
273
273
|
|
|
274
274
|
**参数:**
|
|
275
275
|
|
|
276
|
-
| 参数名 | 类型
|
|
277
|
-
|
|
278
|
-
| val
|
|
279
|
-
| size
|
|
276
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
277
|
+
| ------ | -------- | ------ | ---- |
|
|
278
|
+
| val | `number` | — | 值 |
|
|
279
|
+
| size | `number` | — | 尺寸 |
|
|
280
280
|
|
|
281
281
|
**返回值:** `number` - 转换后的小数
|
|
282
282
|
|
|
@@ -286,11 +286,11 @@ const percent = transPercentAndPixel(960, 1920, 3, true) // 0.5
|
|
|
286
286
|
|
|
287
287
|
**参数:**
|
|
288
288
|
|
|
289
|
-
| 参数名
|
|
290
|
-
|
|
291
|
-
| val
|
|
292
|
-
| precision | `number`
|
|
293
|
-
| type
|
|
289
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
290
|
+
| --------- | --------------------- | --------- | ---------- |
|
|
291
|
+
| val | `number` | — | 运行时数值 |
|
|
292
|
+
| precision | `number` | `0` | 精度 |
|
|
293
|
+
| type | `'width' \| 'height'` | `'width'` | 类型 |
|
|
294
294
|
|
|
295
295
|
**返回值:** `number` - 像素数值
|
|
296
296
|
|
|
@@ -306,9 +306,9 @@ const percent = transPercentAndPixel(960, 1920, 3, true) // 0.5
|
|
|
306
306
|
|
|
307
307
|
**Props:**
|
|
308
308
|
|
|
309
|
-
| 属性名
|
|
310
|
-
|
|
311
|
-
| actions | `EditorActions` | `{}`
|
|
309
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
310
|
+
| ------- | --------------- | ------ | ------------ |
|
|
311
|
+
| actions | `EditorActions` | `{}` | 事件处理配置 |
|
|
312
312
|
|
|
313
313
|
**EditorActions 接口:**
|
|
314
314
|
|
|
@@ -388,10 +388,11 @@ const editorActions = {
|
|
|
388
388
|
|
|
389
389
|
**Props:**
|
|
390
390
|
|
|
391
|
-
| 属性名
|
|
392
|
-
|
|
393
|
-
| actions
|
|
394
|
-
| caseUuid | `string`
|
|
391
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
392
|
+
| -------- | ---------------- | ------ | -------------- |
|
|
393
|
+
| actions | `PreviewActions` | `{}` | 事件处理配置 |
|
|
394
|
+
| caseUuid | `string` | — | 案例 UUID |
|
|
395
|
+
| appFill | `string` | — | app 容器填充色 |
|
|
395
396
|
|
|
396
397
|
**PreviewActions 接口:**
|
|
397
398
|
|
|
@@ -431,10 +432,7 @@ interface PreviewActions {
|
|
|
431
432
|
|
|
432
433
|
```vue
|
|
433
434
|
<template>
|
|
434
|
-
<LingshuSmartPreview
|
|
435
|
-
:case-uuid="caseUuid"
|
|
436
|
-
:actions="previewActions"
|
|
437
|
-
/>
|
|
435
|
+
<LingshuSmartPreview :case-uuid="caseUuid" :actions="previewActions" />
|
|
438
436
|
</template>
|
|
439
437
|
|
|
440
438
|
<script setup>
|
|
@@ -476,16 +474,16 @@ const previewActions = {
|
|
|
476
474
|
|
|
477
475
|
**返回值:**
|
|
478
476
|
|
|
479
|
-
| 属性/方法
|
|
480
|
-
|
|
481
|
-
| equipmentsMenu | `Ref<IEquipmentsMenu[]>`
|
|
482
|
-
| cases
|
|
483
|
-
| casesLoading
|
|
484
|
-
| updateCases
|
|
485
|
-
| selectCase
|
|
486
|
-
| addCase
|
|
487
|
-
| removeCase
|
|
488
|
-
| updateCase
|
|
477
|
+
| 属性/方法 | 类型 | 说明 |
|
|
478
|
+
| -------------- | ---------------------------------------------- | ---------------- |
|
|
479
|
+
| equipmentsMenu | `Ref<IEquipmentsMenu[]>` | 设备菜单(预设) |
|
|
480
|
+
| cases | `Ref<ICase[] \| undefined>` | 方案列表 |
|
|
481
|
+
| casesLoading | `Ref<boolean>` | 方案加载状态 |
|
|
482
|
+
| updateCases | `(data?: ICase[]) => void` | 更新方案列表 |
|
|
483
|
+
| selectCase | `(uuid: string) => void` | 切换当前方案 |
|
|
484
|
+
| addCase | `(data?: ICase) => void` | 添加方案 |
|
|
485
|
+
| removeCase | `(uuid: string) => void` | 删除方案 |
|
|
486
|
+
| updateCase | `(uuid: string, data: Partial<ICase>) => void` | 更新方案 |
|
|
489
487
|
|
|
490
488
|
**使用示例:**
|
|
491
489
|
|
|
@@ -500,7 +498,9 @@ dataStore.updateCases([
|
|
|
500
498
|
uuid: 'case-1',
|
|
501
499
|
title: '方案1',
|
|
502
500
|
isActive: true,
|
|
503
|
-
scene: {
|
|
501
|
+
scene: {
|
|
502
|
+
/* ... */
|
|
503
|
+
},
|
|
504
504
|
layers: []
|
|
505
505
|
}
|
|
506
506
|
])
|
|
@@ -513,7 +513,9 @@ dataStore.addCase({
|
|
|
513
513
|
uuid: '',
|
|
514
514
|
title: '新方案',
|
|
515
515
|
isActive: false,
|
|
516
|
-
scene: {
|
|
516
|
+
scene: {
|
|
517
|
+
/* ... */
|
|
518
|
+
},
|
|
517
519
|
layers: []
|
|
518
520
|
})
|
|
519
521
|
|
|
@@ -529,21 +531,21 @@ console.log(dataStore.cases.value)
|
|
|
529
531
|
|
|
530
532
|
**返回值:**
|
|
531
533
|
|
|
532
|
-
| 属性/方法
|
|
533
|
-
|
|
534
|
-
| currentCase
|
|
535
|
-
| scene
|
|
536
|
-
| layers
|
|
537
|
-
| currentLayer
|
|
538
|
-
| initContainer
|
|
539
|
-
| updateScene
|
|
540
|
-
| addLayer
|
|
541
|
-
| removeLayer
|
|
542
|
-
| updateLayer
|
|
543
|
-
| selectLayer
|
|
544
|
-
| resizeContainer
|
|
545
|
-
| destroyContainer | `() => void`
|
|
546
|
-
| operating
|
|
534
|
+
| 属性/方法 | 类型 | 说明 |
|
|
535
|
+
| ---------------- | ----------------------------------------------- | ---------------------- |
|
|
536
|
+
| currentCase | `ComputedRef<ICase \| null>` | 当前选择的方案 |
|
|
537
|
+
| scene | `ComputedRef<IScene \| null>` | 当前方案场景 |
|
|
538
|
+
| layers | `ComputedRef<ILayer[]>` | 当前方案图层列表 |
|
|
539
|
+
| currentLayer | `ComputedRef<ILayer \| null>` | 当前选择的图层 |
|
|
540
|
+
| initContainer | `(options: IContainer) => void` | 初始化容器(引擎实例) |
|
|
541
|
+
| updateScene | `() => void` | 修改场景(防抖) |
|
|
542
|
+
| addLayer | `(layer: ILayer) => void` | 添加图层 |
|
|
543
|
+
| removeLayer | `(uuid: string) => void` | 删除图层 |
|
|
544
|
+
| updateLayer | `(uuid: string, data: Partial<ILayer>) => void` | 更新图层 |
|
|
545
|
+
| selectLayer | `(uuid: string) => void` | 选择图层 |
|
|
546
|
+
| resizeContainer | `() => void` | 重置容器大小 |
|
|
547
|
+
| destroyContainer | `() => void` | 销毁容器 |
|
|
548
|
+
| operating | `Ref<ILayerOperating \| null>` | 当前操作状态 |
|
|
547
549
|
|
|
548
550
|
**使用示例:**
|
|
549
551
|
|
|
@@ -570,7 +572,7 @@ editorStore.addLayer({
|
|
|
570
572
|
x: 100,
|
|
571
573
|
y: 100,
|
|
572
574
|
width: 200,
|
|
573
|
-
height: 200
|
|
575
|
+
height: 200
|
|
574
576
|
// ... 其他属性
|
|
575
577
|
})
|
|
576
578
|
|
|
@@ -590,13 +592,13 @@ console.log(editorStore.scene.value)
|
|
|
590
592
|
|
|
591
593
|
**返回值:**
|
|
592
594
|
|
|
593
|
-
| 属性/方法
|
|
594
|
-
|
|
595
|
-
| currentCase
|
|
596
|
-
| initContainer
|
|
597
|
-
| resizeContainer
|
|
598
|
-
| destroyContainer | `() => void`
|
|
599
|
-
| operating
|
|
595
|
+
| 属性/方法 | 类型 | 说明 |
|
|
596
|
+
| ---------------- | ------------------------------------------------- | ------------------------ |
|
|
597
|
+
| currentCase | `ComputedRef<ICase \| null>` | 当前方案 |
|
|
598
|
+
| initContainer | `(options: IContainer, caseUuid: string) => void` | 初始化容器并加载指定案例 |
|
|
599
|
+
| resizeContainer | `() => void` | 重置容器大小 |
|
|
600
|
+
| destroyContainer | `() => void` | 销毁容器 |
|
|
601
|
+
| operating | `Ref<ILayerOperating \| null>` | 当前操作状态 |
|
|
600
602
|
|
|
601
603
|
**使用示例:**
|
|
602
604
|
|
|
@@ -606,15 +608,18 @@ import { useAppStore } from '@jnrs/lingshu-smart/stores'
|
|
|
606
608
|
const appStore = useAppStore()
|
|
607
609
|
|
|
608
610
|
// 初始化预览容器
|
|
609
|
-
appStore.initContainer(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
611
|
+
appStore.initContainer(
|
|
612
|
+
{
|
|
613
|
+
appDomId: 'preview-app',
|
|
614
|
+
appEditable: false,
|
|
615
|
+
actions: {
|
|
616
|
+
onTap: (layer, data) => {
|
|
617
|
+
console.log('点击设备', data)
|
|
618
|
+
}
|
|
615
619
|
}
|
|
616
|
-
}
|
|
617
|
-
|
|
620
|
+
},
|
|
621
|
+
'case-uuid-123'
|
|
622
|
+
)
|
|
618
623
|
```
|
|
619
624
|
|
|
620
625
|
---
|
|
@@ -627,27 +632,21 @@ appStore.initContainer({
|
|
|
627
632
|
|
|
628
633
|
**返回值:**
|
|
629
634
|
|
|
630
|
-
| 返回值
|
|
631
|
-
|
|
632
|
-
| operationRecordStatus | `ComputedRef<{ canUndo: boolean; canRedo: boolean; totalSteps: number; currentIndex: number }>` | 操作记录状态
|
|
633
|
-
| recordOperation
|
|
634
|
-
| undo
|
|
635
|
-
| redo
|
|
636
|
-
| jumpToStep
|
|
637
|
-
| clearRecord
|
|
635
|
+
| 返回值 | 类型 | 说明 |
|
|
636
|
+
| --------------------- | ----------------------------------------------------------------------------------------------- | ---------------------- |
|
|
637
|
+
| operationRecordStatus | `ComputedRef<{ canUndo: boolean; canRedo: boolean; totalSteps: number; currentIndex: number }>` | 操作记录状态 |
|
|
638
|
+
| recordOperation | `(caseData: ICase[], hash: string) => void` | 记录操作(防抖 300ms) |
|
|
639
|
+
| undo | `() => void` | 撤销操作 |
|
|
640
|
+
| redo | `() => void` | 重做操作 |
|
|
641
|
+
| jumpToStep | `(index: number) => void` | 跳转到任意历史点 |
|
|
642
|
+
| clearRecord | `() => void` | 清空记录 |
|
|
638
643
|
|
|
639
644
|
**使用示例:**
|
|
640
645
|
|
|
641
646
|
```typescript
|
|
642
647
|
import { useStepRecord } from '@jnrs/lingshu-smart/composables'
|
|
643
648
|
|
|
644
|
-
const {
|
|
645
|
-
operationRecordStatus,
|
|
646
|
-
recordOperation,
|
|
647
|
-
undo,
|
|
648
|
-
redo,
|
|
649
|
-
jumpToStep
|
|
650
|
-
} = useStepRecord()
|
|
649
|
+
const { operationRecordStatus, recordOperation, undo, redo, jumpToStep } = useStepRecord()
|
|
651
650
|
|
|
652
651
|
// 检查是否可以撤销/重做
|
|
653
652
|
console.log(operationRecordStatus.value.canUndo)
|
|
@@ -692,9 +691,9 @@ constructor(options: IContainer = {})
|
|
|
692
691
|
|
|
693
692
|
**参数:**
|
|
694
693
|
|
|
695
|
-
| 参数名
|
|
696
|
-
|
|
697
|
-
| options | `IContainer` | `{}`
|
|
694
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
695
|
+
| ------- | ------------ | ------ | -------- |
|
|
696
|
+
| options | `IContainer` | `{}` | 容器配置 |
|
|
698
697
|
|
|
699
698
|
**方法:**
|
|
700
699
|
|
|
@@ -716,10 +715,10 @@ constructor(options: IContainer = {})
|
|
|
716
715
|
|
|
717
716
|
**参数:**
|
|
718
717
|
|
|
719
|
-
| 参数名
|
|
720
|
-
|
|
721
|
-
| zoomType | `'fit' \| number` | `'fit'` | 缩放类型
|
|
722
|
-
| duration | `number`
|
|
718
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
719
|
+
| -------- | ----------------- | ------- | -------------- |
|
|
720
|
+
| zoomType | `'fit' \| number` | `'fit'` | 缩放类型 |
|
|
721
|
+
| duration | `number` | `0.5` | 动画时长(秒) |
|
|
723
722
|
|
|
724
723
|
**返回值:** `void`
|
|
725
724
|
|
|
@@ -729,9 +728,9 @@ constructor(options: IContainer = {})
|
|
|
729
728
|
|
|
730
729
|
**参数:**
|
|
731
730
|
|
|
732
|
-
| 参数名 | 类型
|
|
733
|
-
|
|
734
|
-
| data
|
|
731
|
+
| 参数名 | 类型 | 说明 |
|
|
732
|
+
| ------ | -------- | ------------------------------ |
|
|
733
|
+
| data | `IScene` | 场景配置,不传则重置为默认配置 |
|
|
735
734
|
|
|
736
735
|
**返回值:** `void`
|
|
737
736
|
|
|
@@ -747,9 +746,9 @@ tree 层查找元素
|
|
|
747
746
|
|
|
748
747
|
**参数:**
|
|
749
748
|
|
|
750
|
-
| 参数名 | 类型
|
|
751
|
-
|
|
752
|
-
| layer
|
|
749
|
+
| 参数名 | 类型 | 说明 |
|
|
750
|
+
| ------ | -------- | -------- |
|
|
751
|
+
| layer | `ILayer` | 图层数据 |
|
|
753
752
|
|
|
754
753
|
**返回值:** `ModelAbs` - 模型实例
|
|
755
754
|
|
|
@@ -759,9 +758,9 @@ tree 层查找元素
|
|
|
759
758
|
|
|
760
759
|
**参数:**
|
|
761
760
|
|
|
762
|
-
| 参数名 | 类型
|
|
763
|
-
|
|
764
|
-
| uuid
|
|
761
|
+
| 参数名 | 类型 | 说明 |
|
|
762
|
+
| ------ | -------- | --------- |
|
|
763
|
+
| uuid | `string` | 图层 UUID |
|
|
765
764
|
|
|
766
765
|
**返回值:** `void`
|
|
767
766
|
|
|
@@ -771,10 +770,10 @@ tree 层查找元素
|
|
|
771
770
|
|
|
772
771
|
**参数:**
|
|
773
772
|
|
|
774
|
-
| 参数名 | 类型
|
|
775
|
-
|
|
776
|
-
| uuid
|
|
777
|
-
| data
|
|
773
|
+
| 参数名 | 类型 | 说明 |
|
|
774
|
+
| ------ | ----------------- | ---------- |
|
|
775
|
+
| uuid | `string` | 图层 UUID |
|
|
776
|
+
| data | `Partial<ILayer>` | 更新的属性 |
|
|
778
777
|
|
|
779
778
|
**返回值:** `void`
|
|
780
779
|
|
|
@@ -957,10 +956,7 @@ const editorActions = {
|
|
|
957
956
|
|
|
958
957
|
```vue
|
|
959
958
|
<template>
|
|
960
|
-
<LingshuSmartPreview
|
|
961
|
-
:case-uuid="caseUuid"
|
|
962
|
-
:actions="previewActions"
|
|
963
|
-
/>
|
|
959
|
+
<LingshuSmartPreview :case-uuid="caseUuid" :actions="previewActions" />
|
|
964
960
|
</template>
|
|
965
961
|
|
|
966
962
|
<script setup>
|