@jnrs/lingshu-smart 2.2.6 → 2.2.8

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 (174) hide show
  1. package/dist/App.vue.d.ts +2 -1
  2. package/dist/App.vue.js +30 -0
  3. package/dist/assets/data/editor_default.d.ts +8 -1
  4. package/dist/assets/data/editor_default.js +59 -0
  5. package/dist/assets/data/editor_default_setting.d.ts +16 -0
  6. package/dist/assets/data/editor_default_setting.js +58 -0
  7. package/dist/assets/data/editor_preset.d.ts +8 -1
  8. package/dist/assets/data/editor_preset.js +51 -0
  9. package/dist/assets/data/editor_preset_menu.d.ts +9 -0
  10. package/dist/assets/data/editor_preset_menu.js +290 -0
  11. package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +3 -15
  12. package/dist/components/editor/ControlBar/CaseManger.vue.js +465 -0
  13. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +2 -411
  14. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.js +108 -0
  15. package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +3 -2
  16. package/dist/components/editor/ControlBar/ExportImportDialog.vue.js +280 -0
  17. package/dist/components/editor/ControlBar/MainButton.vue.d.ts +3 -2
  18. package/dist/components/editor/ControlBar/MainButton.vue.js +183 -0
  19. package/dist/components/editor/ControlBar/StepButton.vue.d.ts +2 -1
  20. package/dist/components/editor/ControlBar/StepButton.vue.js +147 -0
  21. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +2 -1
  22. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.js +98 -0
  23. package/dist/components/editor/DrawingBoard.vue.d.ts +2 -1
  24. package/dist/components/editor/DrawingBoard.vue.js +31 -0
  25. package/dist/components/editor/MenuCard/Equipments.vue.d.ts +2 -1
  26. package/dist/components/editor/MenuCard/Equipments.vue.js +129 -0
  27. package/dist/components/editor/MenuCard/Layers.vue.d.ts +2 -1
  28. package/dist/components/editor/MenuCard/Layers.vue.js +201 -0
  29. package/dist/components/editor/MenuCard/index.vue.d.ts +2 -1
  30. package/dist/components/editor/MenuCard/index.vue.js +84 -0
  31. package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +2 -1
  32. package/dist/components/editor/OptionCard/Equipment/Base.vue.js +96 -0
  33. package/dist/components/editor/OptionCard/Equipment/Binds.vue.d.ts +3 -0
  34. package/dist/components/editor/OptionCard/Equipment/Binds.vue.js +443 -0
  35. package/dist/components/editor/OptionCard/Equipment/Bot.vue.d.ts +3 -0
  36. package/dist/components/editor/OptionCard/Equipment/Bot.vue.js +81 -0
  37. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.d.ts +2 -1
  38. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.js +304 -0
  39. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.d.ts +3 -0
  40. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.js +597 -0
  41. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.d.ts +2 -1
  42. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.js +287 -0
  43. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.d.ts +3 -0
  44. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.js +440 -0
  45. package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +2 -1
  46. package/dist/components/editor/OptionCard/Equipment/Position.vue.js +436 -0
  47. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.d.ts +2 -1
  48. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.js +1131 -0
  49. package/dist/components/editor/OptionCard/Equipment/Store.vue.d.ts +3 -0
  50. package/dist/components/editor/OptionCard/Equipment/Store.vue.js +453 -0
  51. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.d.ts +3 -0
  52. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.js +1109 -0
  53. package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +2 -1
  54. package/dist/components/editor/OptionCard/Equipment/index.vue.js +100 -0
  55. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.d.ts +3 -0
  56. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.js +99 -0
  57. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.d.ts +3 -0
  58. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.js +225 -0
  59. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.d.ts +3 -0
  60. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.js +99 -0
  61. package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +2 -1
  62. package/dist/components/editor/OptionCard/Scene/Background.vue.js +543 -0
  63. package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +2 -1
  64. package/dist/components/editor/OptionCard/Scene/index.vue.js +200 -0
  65. package/dist/components/editor/OptionCard/index.vue.d.ts +2 -1
  66. package/dist/components/editor/OptionCard/index.vue.js +73 -0
  67. package/dist/components/editor/index.vue.d.ts +4 -13
  68. package/dist/components/editor/index.vue.js +156 -0
  69. package/dist/components/index.d.ts +2 -2
  70. package/dist/components/index.js +4 -25440
  71. package/dist/components/preview/index.vue.d.ts +6 -5
  72. package/dist/components/preview/index.vue.js +104 -0
  73. package/dist/composables/useStepRecord.d.ts +12 -4
  74. package/dist/composables/useStepRecord.js +135 -0
  75. package/dist/constants/options.d.ts +8 -1
  76. package/dist/constants/options.js +55 -0
  77. package/dist/controller/AppController.d.ts +10 -3
  78. package/dist/controller/AppController.js +168 -0
  79. package/dist/controller/EditorController.d.ts +9 -2
  80. package/dist/controller/EditorController.js +173 -0
  81. package/dist/index.js +1 -1
  82. package/dist/locales/en.js +5 -0
  83. package/dist/locales/i18next.d.ts +1 -1
  84. package/dist/locales/i18next.js +6 -0
  85. package/dist/locales/index.d.ts +2 -2
  86. package/dist/locales/index.js +3 -13
  87. package/dist/locales/zhCn.js +5 -0
  88. package/dist/main.d.ts +3 -0
  89. package/dist/main.js +13 -0
  90. package/dist/playground/EditPageDemo.vue.d.ts +2 -1
  91. package/dist/playground/EditPageDemo.vue.js +57 -0
  92. package/dist/playground/ViewPageDemo.vue.d.ts +2 -27
  93. package/dist/playground/ViewPageDemo.vue.js +277 -0
  94. package/dist/stores/index.js +3 -0
  95. package/dist/stores/useAppStore.d.ts +13 -6
  96. package/dist/stores/useAppStore.js +78 -0
  97. package/dist/stores/useDataStore.d.ts +18 -11
  98. package/dist/stores/useDataStore.js +116 -0
  99. package/dist/stores/useEditorStore.d.ts +27 -20
  100. package/dist/stores/useEditorStore.js +263 -0
  101. package/dist/types/app.types.d.ts +1 -1
  102. package/dist/types/app.types.js +2 -0
  103. package/dist/types/base.types.d.ts +4 -2
  104. package/dist/types/base.types.js +1 -0
  105. package/dist/types/components/config.types.d.ts +11 -3
  106. package/dist/types/components/config.types.js +1 -0
  107. package/dist/types/components/operating.types.d.ts +1 -1
  108. package/dist/types/components/operating.types.js +1 -0
  109. package/dist/types/enums.d.ts +5 -2
  110. package/dist/types/enums.js +46 -0
  111. package/dist/types/guards.d.ts +12 -2
  112. package/dist/types/guards.js +28 -0
  113. package/dist/types/index.d.ts +2 -2
  114. package/dist/types/index.js +8 -0
  115. package/dist/types/models/config.types.d.ts +74 -29
  116. package/dist/types/models/config.types.js +1 -0
  117. package/dist/types/models/operating.types.d.ts +83 -17
  118. package/dist/types/models/operating.types.js +1 -0
  119. package/dist/ui/abstract/ComponentAbs.d.ts +9 -2
  120. package/dist/ui/abstract/ComponentAbs.js +64 -0
  121. package/dist/ui/abstract/ModelAbs.d.ts +12 -2
  122. package/dist/ui/abstract/ModelAbs.js +119 -0
  123. package/dist/ui/components/Entrance.d.ts +8 -1
  124. package/dist/ui/components/Entrance.js +83 -0
  125. package/dist/ui/components/Light.d.ts +26 -3
  126. package/dist/ui/components/Light.js +167 -0
  127. package/dist/ui/components/Progress.d.ts +8 -1
  128. package/dist/ui/components/Progress.js +84 -0
  129. package/dist/ui/components/Resource.d.ts +8 -1
  130. package/dist/ui/components/Resource.js +70 -0
  131. package/dist/ui/components/StationSlot.d.ts +24 -2
  132. package/dist/ui/components/StationSlot.js +207 -0
  133. package/dist/ui/components/StationSlotGroup.d.ts +8 -1
  134. package/dist/ui/components/StationSlotGroup.js +110 -0
  135. package/dist/ui/factories/createGlass.d.ts +9 -1
  136. package/dist/ui/factories/createGlass.js +51 -0
  137. package/dist/ui/factories/createModel.d.ts +9 -2
  138. package/dist/ui/factories/createModel.js +35 -0
  139. package/dist/ui/factories/createShadow.d.ts +12 -4
  140. package/dist/ui/factories/createShadow.js +52 -0
  141. package/dist/ui/factories/createText.d.ts +7 -0
  142. package/dist/ui/factories/createText.js +46 -0
  143. package/dist/ui/models/CleaningMachine.d.ts +14 -0
  144. package/dist/ui/models/CleaningMachine.js +141 -0
  145. package/dist/ui/models/DoubleJointRobot.d.ts +23 -0
  146. package/dist/ui/models/DoubleJointRobot.js +545 -0
  147. package/dist/ui/models/LoadingStation.d.ts +16 -0
  148. package/dist/ui/models/LoadingStation.js +167 -0
  149. package/dist/ui/models/MachineTool.d.ts +5 -4
  150. package/dist/ui/models/MachineTool.js +184 -0
  151. package/dist/ui/models/MarkingMachine.d.ts +16 -0
  152. package/dist/ui/models/MarkingMachine.js +148 -0
  153. package/dist/ui/models/Rail.d.ts +15 -0
  154. package/dist/ui/models/Rail.js +117 -0
  155. package/dist/ui/models/ResourceStore.d.ts +12 -0
  156. package/dist/ui/models/ResourceStore.js +101 -0
  157. package/dist/ui/models/SingleBot.d.ts +20 -0
  158. package/dist/ui/models/SingleBot.js +202 -0
  159. package/dist/ui/models/SingleGripperRobot.d.ts +19 -0
  160. package/dist/ui/models/SingleGripperRobot.js +272 -0
  161. package/dist/ui/models/SingleJointRobot.d.ts +22 -0
  162. package/dist/ui/models/SingleJointRobot.js +346 -0
  163. package/dist/ui/shapes/NamePlate.d.ts +10 -1
  164. package/dist/ui/shapes/NamePlate.js +85 -0
  165. package/dist/ui/shapes/ScrewHole.d.ts +8 -1
  166. package/dist/ui/shapes/ScrewHole.js +57 -0
  167. package/dist/ui/shapes/Texture.d.ts +12 -3
  168. package/dist/ui/shapes/Texture.js +51 -0
  169. package/dist/ui/utils/attr.d.ts +10 -3
  170. package/dist/ui/utils/attr.js +50 -0
  171. package/dist/utils/index.js +92 -0
  172. package/dist/utils/type-guards.d.ts +1 -1
  173. package/dist/utils/type-guards.js +105 -0
  174. package/package.json +2 -2
@@ -0,0 +1,173 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : EditorController.ts
5
+ * @Date : 2025/02/26
6
+ * @Desc. : 图形编辑类
7
+ */
8
+ import { EditorEvent, EditorRotateEvent, EditorScaleEvent, EditorMoveEvent } from 'leafer';
9
+ import { Ruler } from 'leafer-x-ruler';
10
+ import { DotMatrix } from 'leafer-x-dot-matrix';
11
+ const DEFAULT_ZOOM_MIN = 0.1;
12
+ const DEFAULT_ZOOM_MAX = 10;
13
+ const RULER_THEME_NAME = 'ruler-dark';
14
+ const RULER_SIZE = 20;
15
+ const DOT_MATRIX_COLOR = '#000';
16
+ const DOT_MATRIX_SIZE = 1;
17
+ const TARGET_DOT_MATRIX_PIXEL = 20;
18
+ /**
19
+ * EditorController 类负责管理图形编辑功能,包括设备的选择、旋转和缩放等操作。它通过监听编辑器的事件来更新当前选中的设备,并提供方法来设置缩放范围、标尺和点阵等功能。
20
+ * @param {string} options.container - AppController 对象
21
+ * @param {number} options.zoomMin - 最小缩放比例,默认为 0.1
22
+ * @param {number} options.zoomMax - 最大缩放比例,默认为 10
23
+ * @param {Function} options.onSelected - 设备选中事件的回调函数
24
+ * @param {Function} options.onRotate - 设备旋转事件的回调函数,参数为旋转角度
25
+ * @param {Function} options.onScale - 设备缩放事件的回调函数,参数为缩放比例
26
+ */
27
+ export class EditorController {
28
+ container;
29
+ editor;
30
+ onSelected;
31
+ onRotate;
32
+ onScale;
33
+ onMove;
34
+ constructor(options) {
35
+ const { container, zoomMin = DEFAULT_ZOOM_MIN, zoomMax = DEFAULT_ZOOM_MAX } = options;
36
+ if (zoomMin >= zoomMax) {
37
+ throw new Error('zoomMin must be less than zoomMax');
38
+ }
39
+ const app = container.app;
40
+ app.config.zoom = {
41
+ disabled: false,
42
+ min: zoomMin,
43
+ max: zoomMax
44
+ };
45
+ try {
46
+ addRuler(app);
47
+ addDotMatrix(app);
48
+ }
49
+ catch (error) {
50
+ console.error('Failed to initialize plugins:', error);
51
+ }
52
+ this.container = container;
53
+ this.editor = app.editor;
54
+ this.onSelected = options.onSelected;
55
+ this.onRotate = options.onRotate;
56
+ this.onScale = options.onScale;
57
+ this.onMove = options.onMove;
58
+ const editorConfig = {
59
+ multipleSelect: false, // 多选
60
+ boxSelect: false, // 框选
61
+ lockRatio: true, // 锁定宽高比例
62
+ moveable: true, // 可移动
63
+ resizeable: true, // 编辑大小
64
+ rotateable: true, // 旋转
65
+ skewable: false, // 倾斜
66
+ rotateGap: 15 // 旋转角度间隔
67
+ };
68
+ Object.assign(this.editor.config, editorConfig);
69
+ this.addEvent();
70
+ }
71
+ // 选择设备
72
+ selectEquipment(condition) {
73
+ if (!condition)
74
+ return this.editor.cancel();
75
+ const target = this.container.findAll(condition);
76
+ if (target) {
77
+ this.editor.select(target);
78
+ }
79
+ }
80
+ // 重新渲染设备并进行选中
81
+ rerenderModel(modelConfig) {
82
+ if (!this.container) {
83
+ console.warn('❌ rerenderModel failed: container not initialized');
84
+ return;
85
+ }
86
+ this.container.rerenderModel(modelConfig);
87
+ this.selectEquipment(`#${modelConfig.uuid}`);
88
+ }
89
+ // 设置监听事件
90
+ addEvent() {
91
+ // 选中设备
92
+ this.editor.on(EditorEvent.SELECT, (e) => {
93
+ try {
94
+ const ids = e.editor.list.map((d) => d.id);
95
+ this.onSelected?.(ids);
96
+ }
97
+ catch (error) {
98
+ console.error('Error in SELECT event handler:', error);
99
+ }
100
+ });
101
+ // 旋转设备
102
+ this.editor.on(EditorRotateEvent.ROTATE, (e) => {
103
+ try {
104
+ const { rotation } = e.target;
105
+ if (typeof rotation === 'number') {
106
+ this.onRotate?.(rotation);
107
+ }
108
+ }
109
+ catch (error) {
110
+ console.error('Error in ROTATE event handler:', error);
111
+ }
112
+ });
113
+ // 缩放设备
114
+ this.editor.on(EditorScaleEvent.SCALE, (e) => {
115
+ try {
116
+ const { width, height, scale } = e.target;
117
+ if (typeof width === 'number' &&
118
+ typeof height === 'number' &&
119
+ (typeof scale === 'number' || (typeof scale === 'object' && scale.x !== undefined && scale.y !== undefined))) {
120
+ const scaleX = typeof scale === 'number' ? scale : scale.x;
121
+ const scaleY = typeof scale === 'number' ? scale : scale.y;
122
+ this.onScale?.(width * scaleX, height * scaleY);
123
+ }
124
+ }
125
+ catch (error) {
126
+ console.error('Error in SCALE event handler:', error);
127
+ }
128
+ });
129
+ // 移动设备
130
+ this.editor.on(EditorMoveEvent.MOVE, (e) => {
131
+ try {
132
+ const { x, y } = e.target;
133
+ if (typeof x === 'number' && typeof y === 'number') {
134
+ this.onMove?.(Math.round(x), Math.round(y));
135
+ }
136
+ }
137
+ catch (error) {
138
+ console.error('Error in MOVE event handler:', error);
139
+ }
140
+ });
141
+ }
142
+ // 销毁事件
143
+ destroy() {
144
+ this.editor.off(EditorEvent.SELECT);
145
+ this.editor.off(EditorRotateEvent.ROTATE);
146
+ this.editor.off(EditorScaleEvent.SCALE);
147
+ this.editor.off(EditorMoveEvent.MOVE);
148
+ }
149
+ }
150
+ // 添加标尺插件
151
+ function addRuler(app) {
152
+ const ruler = new Ruler(app, {
153
+ enabled: true,
154
+ ruleSize: RULER_SIZE,
155
+ unit: 'px'
156
+ });
157
+ ruler.addTheme(RULER_THEME_NAME, {
158
+ backgroundColor: '#333',
159
+ textColor: '#ccc',
160
+ borderColor: '#888',
161
+ highlightColor: 'rgba(125,111,239,.8)'
162
+ });
163
+ ruler.changeTheme(RULER_THEME_NAME);
164
+ }
165
+ // 添加点阵插件
166
+ function addDotMatrix(app) {
167
+ const dotMatrix = new DotMatrix(app, {
168
+ dotColor: DOT_MATRIX_COLOR,
169
+ dotSize: DOT_MATRIX_SIZE,
170
+ targetDotMatrixPixel: TARGET_DOT_MATRIX_PIXEL
171
+ });
172
+ dotMatrix.enableDotMatrix(true);
173
+ }
package/dist/index.js CHANGED
@@ -1 +1 @@
1
-
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export default {
2
+ main: {
3
+ title: 'LingShu Smart'
4
+ }
5
+ };
@@ -1,2 +1,2 @@
1
- declare const i18n: import('vue-i18n').I18n<{}, {}, {}, string, false>;
1
+ declare const i18n: import("vue-i18n").I18n<{}, {}, {}, string, false>;
2
2
  export default i18n;
@@ -0,0 +1,6 @@
1
+ import { createI18n } from 'vue-i18n';
2
+ const i18n = createI18n({
3
+ legacy: false, // legacy 为 false 则启用 Composition API 模式
4
+ globalInjection: true // 允许在模板中使用 $t
5
+ });
6
+ export default i18n;
@@ -1,3 +1,3 @@
1
- import { default as zhCn } from './zhCn';
2
- import { default as en } from './en';
1
+ import zhCn from './zhCn';
2
+ import en from './en';
3
3
  export { zhCn, en };
@@ -1,13 +1,3 @@
1
- const t = {
2
- main: {
3
- title: "灵枢智造"
4
- }
5
- }, n = {
6
- main: {
7
- title: "LingShu Smart"
8
- }
9
- };
10
- export {
11
- n as en,
12
- t as zhCn
13
- };
1
+ import zhCn from './zhCn';
2
+ import en from './en';
3
+ export { zhCn, en };
@@ -0,0 +1,5 @@
1
+ export default {
2
+ main: {
3
+ title: '灵枢智造'
4
+ }
5
+ };
package/dist/main.d.ts CHANGED
@@ -0,0 +1,3 @@
1
+ import 'element-plus/dist/index.css';
2
+ import 'element-plus/theme-chalk/dark/css-vars.css';
3
+ import '@/assets/styles/init.scss';
package/dist/main.js ADDED
@@ -0,0 +1,13 @@
1
+ import 'element-plus/dist/index.css';
2
+ import 'element-plus/theme-chalk/dark/css-vars.css';
3
+ import '@/assets/styles/init.scss';
4
+ import { createApp } from 'vue';
5
+ import { createPinia } from 'pinia';
6
+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
7
+ import App from './App.vue';
8
+ const app = createApp(App);
9
+ // pinia 相关
10
+ const pinia = createPinia();
11
+ pinia.use(piniaPluginPersistedstate);
12
+ app.use(pinia);
13
+ app.mount('#app');
@@ -1,2 +1,3 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
2
3
  export default _default;
@@ -0,0 +1,57 @@
1
+ import LingshuSmartEditor from '@/components/editor/index.vue';
2
+ // import casesJson from '@/assets/json/cases.json' // TODO 预设方案
3
+ /**
4
+ * 加载方案列表数据
5
+ * @param requestId 请求数据ID,即输入框输入的值(按需)
6
+ */
7
+ const loadCases = async (requestId) => {
8
+ // 此处模拟异步请求,生产环境请按需替换为后端 API
9
+ const res = await fetch(`/json/cases.json?requestId=${requestId}`);
10
+ await new Promise((resolve) => setTimeout(resolve, 500));
11
+ const data = await res.json();
12
+ return data.data;
13
+ };
14
+ // 保存方案列表按钮回调
15
+ const saveCases = (data) => {
16
+ console.log('保存方案列表数据', data);
17
+ };
18
+ // 预览按钮回调
19
+ const handlePreview = (currentCase) => {
20
+ console.log('跳转预览页面', currentCase);
21
+ window.open(`/preview/${currentCase?.uuid}`);
22
+ };
23
+ // 退出按钮回调
24
+ const handleExit = () => {
25
+ console.log('退出');
26
+ };
27
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
28
+ const __VLS_ctx = {
29
+ ...{},
30
+ ...{},
31
+ };
32
+ let __VLS_components;
33
+ let __VLS_directives;
34
+ /** @type {[typeof LingshuSmartEditor, typeof LingshuSmartEditor, ]} */ ;
35
+ // @ts-ignore
36
+ const __VLS_0 = __VLS_asFunctionalComponent(LingshuSmartEditor, new LingshuSmartEditor({
37
+ actions: ({
38
+ loadCases: __VLS_ctx.loadCases,
39
+ saveCases: __VLS_ctx.saveCases,
40
+ handlePreview: __VLS_ctx.handlePreview,
41
+ handleExit: __VLS_ctx.handleExit
42
+ }),
43
+ }));
44
+ const __VLS_1 = __VLS_0({
45
+ actions: ({
46
+ loadCases: __VLS_ctx.loadCases,
47
+ saveCases: __VLS_ctx.saveCases,
48
+ handlePreview: __VLS_ctx.handlePreview,
49
+ handleExit: __VLS_ctx.handleExit
50
+ }),
51
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
52
+ var __VLS_4 = {};
53
+ // @ts-ignore
54
+ [loadCases, saveCases, handlePreview, handleExit,];
55
+ var __VLS_2;
56
+ const __VLS_export = (await import('vue')).defineComponent({});
57
+ export default {};
@@ -1,28 +1,3 @@
1
- import { ICase, ILayerOperating } from '../types';
2
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
3
- lingshuSmartPreviewRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
4
- actions?: import('../components/preview/index.vue').PreviewActions;
5
- caseUuid?: string;
6
- }> & Readonly<{}>, {
7
- currentCase: import('vue').Ref<ICase | null | undefined, ICase | null | undefined>;
8
- operating: (data: ILayerOperating) => void;
9
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
10
- actions: import('../components/preview/index.vue').PreviewActions;
11
- }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
12
- P: {};
13
- B: {};
14
- D: {};
15
- C: {};
16
- M: {};
17
- Defaults: {};
18
- }, Readonly<{
19
- actions?: import('../components/preview/index.vue').PreviewActions;
20
- caseUuid?: string;
21
- }> & Readonly<{}>, {
22
- currentCase: import('vue').Ref<ICase | null | undefined, ICase | null | undefined>;
23
- operating: (data: ILayerOperating) => void;
24
- }, {}, {}, {}, {
25
- actions: import('../components/preview/index.vue').PreviewActions;
26
- }> | null;
27
- }, HTMLDivElement>;
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
28
3
  export default _default;
@@ -0,0 +1,277 @@
1
+ import { EnumModel } from '@/types';
2
+ import { ref, computed, onMounted } from 'vue';
3
+ import { uuidv4 } from '@jnrs/shared/uuid';
4
+ import LingshuSmartPreview from '@/components/preview/index.vue';
5
+ // 预览组件实例
6
+ const lingshuSmartPreviewRef = ref();
7
+ // 当前方案 ID
8
+ const currentCaseId = ref();
9
+ // 当前方案数据
10
+ const currentCase = computed(() => {
11
+ return lingshuSmartPreviewRef.value?.currentCase;
12
+ });
13
+ /**
14
+ * 加载方案列表数据
15
+ * @param requestId 请求数据ID,即输入框输入的值(按需)
16
+ */
17
+ const loadCases = async (requestId) => {
18
+ // 此处模拟异步请求,生产环境请按需替换为后端 API
19
+ const res = await fetch(`/json/cases.json?requestId=${requestId}`);
20
+ await new Promise((resolve) => setTimeout(resolve, 500));
21
+ const data = await res.json();
22
+ return data.data;
23
+ };
24
+ // 点击事件
25
+ const onTap = (layer, data) => {
26
+ console.log('点击 parent', layer, '点击 target', data);
27
+ };
28
+ // 右键点击事件
29
+ const onMenuTap = (layer, data) => {
30
+ console.log('右键点击 parent', layer, '右键点击 target', data);
31
+ };
32
+ // 拖拽结束事件
33
+ const onDragEnd = (layer, data) => {
34
+ console.log('拖拽结束 parent', layer, '拖拽结束 target', data);
35
+ };
36
+ // 设备运行
37
+ const operating = (data) => {
38
+ lingshuSmartPreviewRef.value?.operating(data);
39
+ };
40
+ // websocket 消息处理
41
+ const onMessage = (rawMessage) => {
42
+ console.log('接收ws数据:', rawMessage);
43
+ // 校验必要字段
44
+ if (!rawMessage?.type || !rawMessage?.payload) {
45
+ console.warn('无效的 WebSocket 消息格式', rawMessage);
46
+ return;
47
+ }
48
+ const type = rawMessage.type;
49
+ const payload = rawMessage.payload;
50
+ if (type === 'update') {
51
+ // 根据原始数据处理设备运行数据
52
+ switch (payload.type) {
53
+ case 'Pallet':
54
+ if (payload.addType && payload.addId) {
55
+ // 新增资源
56
+ operating({
57
+ className: payload.addType,
58
+ id: payload.addId,
59
+ rawData: payload,
60
+ resource: {
61
+ resourceType: payload.type,
62
+ name: payload.name,
63
+ color: payload.status === 3 ? 'green' : '#424242',
64
+ index: payload.addSiteNumber,
65
+ handleType: 'add',
66
+ rawData: payload
67
+ }
68
+ });
69
+ }
70
+ if (payload.removeType && payload.removeId) {
71
+ // 删除资源
72
+ operating({
73
+ className: payload.removeType,
74
+ id: payload.removeId,
75
+ rawData: payload,
76
+ resource: {
77
+ resourceType: payload.type,
78
+ index: payload.removeSiteNumber,
79
+ handleType: 'remove',
80
+ rawData: payload
81
+ }
82
+ });
83
+ }
84
+ break;
85
+ case 'MachineTool':
86
+ operating({
87
+ className: EnumModel.MACHINE_TOOL,
88
+ id: payload.id,
89
+ rawData: payload,
90
+ light: {
91
+ color: payload.status === 2 ? 'green' : '#424242',
92
+ blinking: payload.status !== 2,
93
+ rotating: payload.status === 2
94
+ },
95
+ progress: {
96
+ percent: payload.percent,
97
+ textContent: payload.status === 2 ? '运行中' : '待机中'
98
+ },
99
+ entrance: {
100
+ isIn: payload.isIn,
101
+ isOut: payload.isOut
102
+ },
103
+ stationRotatable: payload.stationRotatable
104
+ });
105
+ break;
106
+ case 'ResourceStore':
107
+ operating({
108
+ className: EnumModel.RESOURCE_STORE,
109
+ id: payload.id,
110
+ rawData: payload,
111
+ light: {
112
+ color: payload.status === 2 ? 'green' : '#424242',
113
+ blinking: payload.status === 2
114
+ }
115
+ });
116
+ break;
117
+ case 'SingleJointRobot':
118
+ operating({
119
+ className: EnumModel.SINGLE_JOINT_ROBOT,
120
+ id: payload.id,
121
+ rawData: payload,
122
+ light: {
123
+ color: payload.status === 2 ? 'green' : '#424242',
124
+ blinking: payload.status === 2
125
+ },
126
+ x: payload.x,
127
+ r: payload.r
128
+ });
129
+ break;
130
+ }
131
+ }
132
+ };
133
+ onMounted(() => {
134
+ const VIEW_PATH = '/preview/';
135
+ if (location.pathname.includes(VIEW_PATH)) {
136
+ currentCaseId.value = location.pathname.split(VIEW_PATH)[1];
137
+ }
138
+ // MOCK 服务器发送的 websocket 数据,实际需和后端确认数据格式
139
+ setTimeout(() => {
140
+ onMessage({
141
+ traceId: uuidv4(),
142
+ type: 'update',
143
+ payload: {
144
+ id: '75fb136f-bb81-4348-b53f-b9ba56f1816b',
145
+ type: 'MachineTool',
146
+ status: 2,
147
+ percent: 0.8,
148
+ isIn: true,
149
+ isOut: false,
150
+ stationRotatable: true
151
+ }
152
+ });
153
+ onMessage({
154
+ traceId: uuidv4(),
155
+ type: 'update',
156
+ payload: {
157
+ id: 'b37075e3-25a3-4adf-937d-f9e94d27d917',
158
+ type: 'SingleJointRobot',
159
+ status: 2,
160
+ x: 800,
161
+ r: 45
162
+ }
163
+ });
164
+ onMessage({
165
+ traceId: uuidv4(),
166
+ type: 'update',
167
+ payload: {
168
+ id: '35cd0433-2587-4dce-8e08-13e397b5eb3d',
169
+ type: 'ResourceStore',
170
+ status: 2
171
+ }
172
+ });
173
+ onMessage({
174
+ traceId: uuidv4(),
175
+ type: 'update',
176
+ payload: {
177
+ type: 'Pallet',
178
+ name: 'P111',
179
+ status: 3,
180
+ addType: 'MachineTool',
181
+ addId: '75fb136f-bb81-4348-b53f-b9ba56f1816b',
182
+ addSiteNumber: 2,
183
+ removeId: null,
184
+ removeType: null,
185
+ removeSiteNumber: null
186
+ }
187
+ });
188
+ setTimeout(() => {
189
+ onMessage({
190
+ traceId: uuidv4(),
191
+ type: 'update',
192
+ payload: {
193
+ id: '75fb136f-bb81-4348-b53f-b9ba56f1816b',
194
+ type: 'MachineTool',
195
+ percent: 1,
196
+ isIn: true,
197
+ isOut: true,
198
+ stationRotatable: false
199
+ }
200
+ });
201
+ onMessage({
202
+ traceId: uuidv4(),
203
+ type: 'update',
204
+ payload: {
205
+ type: 'Pallet',
206
+ name: 'P111',
207
+ status: 2,
208
+ addType: 'ResourceStore',
209
+ addId: '35cd0433-2587-4dce-8e08-13e397b5eb3d',
210
+ addSiteNumber: 3,
211
+ removeId: '75fb136f-bb81-4348-b53f-b9ba56f1816b',
212
+ removeType: 'MachineTool',
213
+ removeSiteNumber: 2
214
+ }
215
+ });
216
+ onMessage({
217
+ traceId: uuidv4(),
218
+ type: 'update',
219
+ payload: {
220
+ id: 'b37075e3-25a3-4adf-937d-f9e94d27d917',
221
+ type: 'SingleJointRobot',
222
+ x: 800,
223
+ r: 145
224
+ }
225
+ });
226
+ }, 1500);
227
+ }, 1500);
228
+ });
229
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
230
+ const __VLS_ctx = {
231
+ ...{},
232
+ ...{},
233
+ };
234
+ let __VLS_components;
235
+ let __VLS_directives;
236
+ __VLS_asFunctionalElement(__VLS_intrinsics.div, __VLS_intrinsics.div)({
237
+ ...{ class: "main" },
238
+ });
239
+ __VLS_asFunctionalElement(__VLS_intrinsics.div, __VLS_intrinsics.div)({
240
+ ...{ class: "head" },
241
+ });
242
+ (__VLS_ctx.currentCase?.title);
243
+ // @ts-ignore
244
+ [currentCase,];
245
+ /** @type {[typeof LingshuSmartPreview, typeof LingshuSmartPreview, ]} */ ;
246
+ // @ts-ignore
247
+ const __VLS_0 = __VLS_asFunctionalComponent(LingshuSmartPreview, new LingshuSmartPreview({
248
+ ref: "lingshuSmartPreviewRef",
249
+ actions: ({
250
+ loadCases: __VLS_ctx.loadCases,
251
+ onTap: __VLS_ctx.onTap,
252
+ onMenuTap: __VLS_ctx.onMenuTap,
253
+ onDragEnd: __VLS_ctx.onDragEnd
254
+ }),
255
+ caseUuid: (__VLS_ctx.currentCaseId),
256
+ }));
257
+ const __VLS_1 = __VLS_0({
258
+ ref: "lingshuSmartPreviewRef",
259
+ actions: ({
260
+ loadCases: __VLS_ctx.loadCases,
261
+ onTap: __VLS_ctx.onTap,
262
+ onMenuTap: __VLS_ctx.onMenuTap,
263
+ onDragEnd: __VLS_ctx.onDragEnd
264
+ }),
265
+ caseUuid: (__VLS_ctx.currentCaseId),
266
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
267
+ /** @type {typeof __VLS_ctx.lingshuSmartPreviewRef} */ ;
268
+ var __VLS_4 = {};
269
+ // @ts-ignore
270
+ [loadCases, onTap, onMenuTap, onDragEnd, currentCaseId, lingshuSmartPreviewRef,];
271
+ var __VLS_2;
272
+ /** @type {__VLS_StyleScopedClasses['main']} */ ;
273
+ /** @type {__VLS_StyleScopedClasses['head']} */ ;
274
+ // @ts-ignore
275
+ var __VLS_5 = __VLS_4;
276
+ const __VLS_export = (await import('vue')).defineComponent({});
277
+ export default {};
@@ -0,0 +1,3 @@
1
+ export { useDataStore } from './useDataStore';
2
+ export { useEditorStore } from './useEditorStore';
3
+ export { useAppStore } from './useAppStore';
@@ -1,20 +1,27 @@
1
- import { ICase, IContainer, ILayerOperating } from '../types';
2
- export declare const useAppStore: import('pinia').StoreDefinition<"@jnrs/lingshu-smart/app", Pick<{
3
- currentCase: import('vue').Ref<ICase | null | undefined, ICase | null | undefined>;
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : useAppStore.ts
5
+ * @Date : 2026/03/20
6
+ * @Desc. : 用于预览页面:当前方案状态
7
+ */
8
+ import type { ICase, IContainer, ILayerOperating } from '@/types';
9
+ export declare const useAppStore: import("pinia").StoreDefinition<"@jnrs/lingshu-smart/app", Pick<{
10
+ currentCase: import("vue").Ref<ICase | null | undefined, ICase | null | undefined>;
4
11
  initContainer: (options: IContainer, caseUuid: string) => void;
5
12
  resizeContainer: () => void;
6
13
  destroyContainer: () => void;
7
14
  operating: (data: ILayerOperating) => void;
8
15
  }, "currentCase">, Pick<{
9
- currentCase: import('vue').Ref<ICase | null | undefined, ICase | null | undefined>;
16
+ currentCase: import("vue").Ref<ICase | null | undefined, ICase | null | undefined>;
10
17
  initContainer: (options: IContainer, caseUuid: string) => void;
11
18
  resizeContainer: () => void;
12
19
  destroyContainer: () => void;
13
20
  operating: (data: ILayerOperating) => void;
14
21
  }, never>, Pick<{
15
- currentCase: import('vue').Ref<ICase | null | undefined, ICase | null | undefined>;
22
+ currentCase: import("vue").Ref<ICase | null | undefined, ICase | null | undefined>;
16
23
  initContainer: (options: IContainer, caseUuid: string) => void;
17
24
  resizeContainer: () => void;
18
25
  destroyContainer: () => void;
19
26
  operating: (data: ILayerOperating) => void;
20
- }, "initContainer" | "resizeContainer" | "destroyContainer" | "operating">>;
27
+ }, "operating" | "initContainer" | "resizeContainer" | "destroyContainer">>;