@jnrs/lingshu-smart 2.2.28 → 2.2.29
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 +29 -16
- package/README.md +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{index-tpebqVjC.js → index-xyCXB0RY.js} +1569 -1543
- package/dist/index.js +4 -3
- package/dist/ui/models/Rgv.d.ts +2 -2
- package/dist/utils/index.d.ts +8 -0
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -74,7 +74,7 @@ const handleExit = () => {
|
|
|
74
74
|
import { ref, computed, onMounted } from 'vue'
|
|
75
75
|
import type { ICase, ILayer, ILayerOperating, InteractiveUi } from '@/types'
|
|
76
76
|
import { EnumModel } from '@/types'
|
|
77
|
-
import { transRuntimeToPixel } from '@/utils'
|
|
77
|
+
import { transRuntimeToPixel, transPercentToPixel } from '@/utils'
|
|
78
78
|
import LingshuSmartPreview from '@/components/preview/index.vue'
|
|
79
79
|
|
|
80
80
|
const lingshuSmartPreviewRef = ref()
|
|
@@ -305,7 +305,7 @@ operating({
|
|
|
305
305
|
color: payload.status === 2 ? 'green' : '#424242',
|
|
306
306
|
blinking: payload.status === 2
|
|
307
307
|
},
|
|
308
|
-
x:
|
|
308
|
+
x: transPercentToPixel(payload.x, 2, 'width') // 沿轨道移动时需转换
|
|
309
309
|
})
|
|
310
310
|
```
|
|
311
311
|
|
|
@@ -320,7 +320,7 @@ operating({
|
|
|
320
320
|
color: payload.status === 2 ? 'green' : '#424242',
|
|
321
321
|
blinking: payload.status === 2
|
|
322
322
|
},
|
|
323
|
-
x:
|
|
323
|
+
x: transPercentToPixel(payload.x, 2, 'width'),
|
|
324
324
|
j1: payload.j1, // 一级关节角度(度)
|
|
325
325
|
currentFixture: payload.currentFixture // EnumResourceType.PALLET | TOOL
|
|
326
326
|
})
|
|
@@ -337,7 +337,7 @@ operating({
|
|
|
337
337
|
color: payload.status === 0 ? '#f30' : '#424242'
|
|
338
338
|
},
|
|
339
339
|
currentFixture: payload.currentFixture,
|
|
340
|
-
x:
|
|
340
|
+
x: transPercentToPixel(payload.x, 2, 'width'),
|
|
341
341
|
j1: payload.j1,
|
|
342
342
|
j2: payload.j2
|
|
343
343
|
})
|
|
@@ -392,10 +392,10 @@ operating({
|
|
|
392
392
|
id: payload.id,
|
|
393
393
|
rawData: payload,
|
|
394
394
|
light: { color: payload.lightColor, blinking: payload.blinking },
|
|
395
|
-
x:
|
|
395
|
+
x: transPercentToPixel(payload.x, 2, 'width'),
|
|
396
396
|
j1: payload.j1, // 旋转角度
|
|
397
|
-
forkXY: payload.forkXY, //
|
|
398
|
-
forkZ: payload.forkZ // 货叉升降比例 0
|
|
397
|
+
forkXY: payload.forkXY, // 货叉进出移动比例 [−1,1]
|
|
398
|
+
forkZ: payload.forkZ // 货叉升降比例 [0,1]
|
|
399
399
|
})
|
|
400
400
|
```
|
|
401
401
|
|
|
@@ -423,6 +423,18 @@ const pixelX = transRuntimeToPixel(payload.x, 1, 'width')
|
|
|
423
423
|
const pixelY = transRuntimeToPixel(payload.y, 1, 'height')
|
|
424
424
|
```
|
|
425
425
|
|
|
426
|
+
### 百分比转换为像素数值
|
|
427
|
+
|
|
428
|
+
后端推送的 `x` / `y` 通常为**百分比数值**(范围通常为[-1,1]),画布使用**像素坐标**。转换公式:
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
import { transPercentToPixel } from '@jnrs/lingshu-smart'
|
|
432
|
+
|
|
433
|
+
// 宽方向:pixel = percentVal * scene.width
|
|
434
|
+
const pixelX = transPercentToPixel(payload.x, 2, 'width')
|
|
435
|
+
const pixelY = transPercentToPixel(payload.y, 1, 'height')
|
|
436
|
+
```
|
|
437
|
+
|
|
426
438
|
**前提:** 方案 `IScene` 中需配置 `runtime_width` / `runtime_height`。该函数读取 `useEditorStore().scene`,预览页需确保场景数据已加载。
|
|
427
439
|
|
|
428
440
|
### WebSocket 接入示例
|
|
@@ -559,14 +571,14 @@ type ILayerOperating =
|
|
|
559
571
|
|
|
560
572
|
#### IRGVOperating
|
|
561
573
|
|
|
562
|
-
| 属性 | 类型 | 说明
|
|
563
|
-
| ---------- | -------------------- |
|
|
564
|
-
| `light` | `ILightOperating` | 双灯同步更新
|
|
565
|
-
| `x` | `number` | 沿轨道位移(像素) |
|
|
566
|
-
| `j1` | `number` | 车体旋转角度(度)
|
|
567
|
-
| `forkXY` | `number` |
|
|
568
|
-
| `forkZ` | `number` | 货叉升降比例 0
|
|
569
|
-
| `resource` | `IResourceOperating` | 托盘/刀具工位槽
|
|
574
|
+
| 属性 | 类型 | 说明 |
|
|
575
|
+
| ---------- | -------------------- | ------------------------- |
|
|
576
|
+
| `light` | `ILightOperating` | 双灯同步更新 |
|
|
577
|
+
| `x` | `number` | 沿轨道位移(像素)[0,1] |
|
|
578
|
+
| `j1` | `number` | 车体旋转角度(度)[0,360] |
|
|
579
|
+
| `forkXY` | `number` | 货叉进出移动比例 [−1,1] |
|
|
580
|
+
| `forkZ` | `number` | 货叉升降比例 [0,1] |
|
|
581
|
+
| `resource` | `IResourceOperating` | 托盘/刀具工位槽 |
|
|
570
582
|
|
|
571
583
|
#### IRailOperating
|
|
572
584
|
|
|
@@ -666,6 +678,7 @@ type ILayerOperating =
|
|
|
666
678
|
| `transPercentAndPixel(val, size, precision?, getPercent?)` | 百分比 ↔ 像素 |
|
|
667
679
|
| `transFraction(val, size)` | 百分比转小数 |
|
|
668
680
|
| `transRuntimeToPixel(val, precision?, type?)` | 运行时坐标 → 像素(依赖 scene.runtime_width/height) |
|
|
681
|
+
| `transPercentToPixel(val, precision?, type?)` | 百分比数值 → 像素(依赖 scene.width/height) |
|
|
669
682
|
|
|
670
683
|
---
|
|
671
684
|
|
|
@@ -673,7 +686,7 @@ type ILayerOperating =
|
|
|
673
686
|
|
|
674
687
|
1. **编辑器 vs 预览:** 编辑模式配置 `EditorActions`;预览模式配置 `PreviewActions` + `onMessage` → `operating`
|
|
675
688
|
2. **ID 匹配:** `operating` 的 `id` 必须与方案图层 `rawData.id` 一致,否则静默失败(在前端层面该值即为编辑器组件中业务数据配置中必填项 id 的值,需根据后端预先提供的设备 id 在编辑器中进行配置)
|
|
676
|
-
3. **坐标系:** 轨道类设备的 `x` 通常需 `
|
|
689
|
+
3. **坐标系:** 轨道类设备的 `x` 通常需 `transPercentToPixel` 转换;`IRailOperating.x` 直接使用像素
|
|
677
690
|
4. **资源消息:** `Resource` 类型不对应独立图层,通过目标设备的 `resource` 字段操作工位槽
|
|
678
691
|
5. **引擎生命周期:** 组件卸载时自动 `destroyContainer`;手动集成需自行销毁
|
|
679
692
|
6. **类型安全:** 所有 API 均导出 TypeScript 类型,推荐 `import type { ILayerOperating, EnumModel } from '@jnrs/lingshu-smart'`
|
package/README.md
CHANGED
package/dist/components/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineComponent as W, ref as oe, createElementBlock as z, openBlock as R, createElementVNode as n, createVNode as r, withDirectives as pe, unref as e, withCtx as k, vModelText as _t, Fragment as re, renderList as ke, toDisplayString as de, vShow as _e, normalizeClass as we, withModifiers as De, watch as Me, createCommentVNode as ye, createTextVNode as J, createBlock as Se, normalizeStyle as it, computed as be, onMounted as Qe, onUnmounted as vt, nextTick as ut, createStaticVNode as wt } from "vue";
|
|
3
3
|
import { ElIcon as le, ElMessage as Ue, ElSelect as ge, ElOption as H, ElColorPicker as dt, ElInputNumber as ce, ElButton as $e, ElInput as Z, ElPopover as bt, ElInputTag as Vt, ElDialog as Ze, ElSwitch as Ce, ElForm as xt, ElFormItem as Ae, ElTable as kt, ElTableColumn as he, ElTag as $t, ElRadioGroup as St, ElRadioButton as ft, ElDropdown as et, ElDropdownMenu as tt, ElDropdownItem as Be, ElMessageBox as je, vLoading as mt } from "element-plus";
|
|
4
4
|
import { storeToRefs as ee } from "pinia";
|
|
5
|
-
import { u as Re,
|
|
5
|
+
import { u as Re, o as ae, L as Et, D as Ct, M as It, p as Ut, q as Bt, W as Lt, t as Fe, r as Ie, d as xe, h as qe, e as He, i as We, f as Xe, a as Dt, g as Le, s as nt, E as Oe, v as Tt } from "../index-xyCXB0RY.js";
|
|
6
6
|
import { Search as At, WarnTriangleFilled as Ye, View as gt, Hide as Ot, Delete as Pe, QuestionFilled as Mt, Select as Rt, ArrowDown as ot, Plus as Nt, Connection as zt, Refresh as jt, Finished as Ft, Back as Pt, Right as Yt, SwitchButton as Gt } from "@element-plus/icons-vue";
|
|
7
7
|
import { clipboard as yt, formatDateTime as Jt } from "@jnrs/shared";
|
|
8
8
|
const qt = { class: "menu" }, Ht = { class: "menu_input" }, Wt = { class: "menu_container tinyScrollbar" }, Xt = { class: "menu_group_title" }, Kt = ["onClick"], Qt = { class: "menu_group_noItem" }, Zt = { class: "noData" }, en = /* @__PURE__ */ W({
|