@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
@@ -11,17 +11,20 @@ export declare enum EnumTag {
11
11
  OTHER = "\u5176\u4ED6"
12
12
  }
13
13
  export declare enum EnumModel {
14
- SINGLE_GRIPPER_ROBOT = "SingleGripperRobot",
14
+ SINGLE_JOINT_ROBOT = "SingleJointRobot",
15
15
  DOUBLE_GRIPPER_ROBOT = "DoubleGripperRobot",
16
16
  RGV = "Rgv",
17
17
  MACHINE_TOOL = "MachineTool",
18
+ MARKING_MACHINE = "MarkingMachine",
18
19
  CLEANING_MACHINE = "CleaningMachine",
19
20
  LOADING_STATION = "LoadingStation",
20
21
  PALLET_STORAGE = "PalletStorage",
21
22
  TOOL_STORAGE = "ToolStorage",
22
23
  BUFFER_DOCK = "BufferDock",
23
24
  GROUND_RAIL = "GroundRail",
24
- FOLLOWING_TUGGER = "FollowingTugger"
25
+ FOLLOWING_TUGGER = "FollowingTugger",
26
+ RAIL = "Rail",
27
+ RESOURCE_STORE = "ResourceStore"
25
28
  }
26
29
  export declare enum EnumComponent {
27
30
  STATION_SLOT = "StationSlot",
@@ -0,0 +1,46 @@
1
+ // 步骤操作类型
2
+ export var EnumStepType;
3
+ (function (EnumStepType) {
4
+ EnumStepType["UNDO"] = "Undo";
5
+ EnumStepType["REDO"] = "Redo";
6
+ })(EnumStepType || (EnumStepType = {}));
7
+ // 设备标签枚举
8
+ export var EnumTag;
9
+ (function (EnumTag) {
10
+ EnumTag["TRANSPORT"] = "\u642C\u8FD0\u8BBE\u5907";
11
+ EnumTag["MACHINE"] = "\u673A\u5E8A";
12
+ EnumTag["CLEANING"] = "\u6E05\u6D17\u673A";
13
+ EnumTag["STATION"] = "\u88C5\u8F7D\u7AD9";
14
+ EnumTag["STORAGE"] = "\u5E93";
15
+ EnumTag["OTHER"] = "\u5176\u4ED6";
16
+ })(EnumTag || (EnumTag = {}));
17
+ // 设备类型枚举
18
+ export var EnumModel;
19
+ (function (EnumModel) {
20
+ EnumModel["SINGLE_JOINT_ROBOT"] = "SingleJointRobot";
21
+ EnumModel["DOUBLE_GRIPPER_ROBOT"] = "DoubleGripperRobot";
22
+ EnumModel["RGV"] = "Rgv";
23
+ EnumModel["MACHINE_TOOL"] = "MachineTool";
24
+ EnumModel["MARKING_MACHINE"] = "MarkingMachine";
25
+ EnumModel["CLEANING_MACHINE"] = "CleaningMachine";
26
+ EnumModel["LOADING_STATION"] = "LoadingStation";
27
+ EnumModel["PALLET_STORAGE"] = "PalletStorage";
28
+ EnumModel["TOOL_STORAGE"] = "ToolStorage";
29
+ EnumModel["BUFFER_DOCK"] = "BufferDock";
30
+ EnumModel["GROUND_RAIL"] = "GroundRail";
31
+ EnumModel["FOLLOWING_TUGGER"] = "FollowingTugger";
32
+ EnumModel["RAIL"] = "Rail";
33
+ EnumModel["RESOURCE_STORE"] = "ResourceStore";
34
+ })(EnumModel || (EnumModel = {}));
35
+ // 组件类型枚举
36
+ export var EnumComponent;
37
+ (function (EnumComponent) {
38
+ EnumComponent["STATION_SLOT"] = "StationSlot";
39
+ EnumComponent["RESOURCE"] = "Resource";
40
+ })(EnumComponent || (EnumComponent = {}));
41
+ // 资源类型枚举
42
+ export var EnumResourceType;
43
+ (function (EnumResourceType) {
44
+ EnumResourceType["PALLET"] = "Pallet";
45
+ EnumResourceType["TOOL"] = "Tool";
46
+ })(EnumResourceType || (EnumResourceType = {}));
@@ -1,2 +1,12 @@
1
- import { ILayer } from './index';
2
- export declare function hasStationSlotGroup(layer: ILayer | null): layer is import('./index').IMachineToolConfig;
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : guards.ts
5
+ * @Date : 2026/04/07
6
+ * @Desc. : 类型守卫函数
7
+ */
8
+ import { type ILayer } from './index';
9
+ export declare function isMachineTool(layer: ILayer | null): layer is import("./index").IMachineToolConfig;
10
+ export declare function hasStationSlotGroup(layer: ILayer | null): layer is import("./index").IMachineToolConfig | import("./index").ILoadingStationConfig | import("./index").IMarkingMachineConfig | import("./index").ICleaningMachineConfig | import("./index").IResourceStoreConfig;
11
+ export declare function hasFixtureChange(layer: ILayer | null): layer is import("./index").ISingleJointRobotConfig;
12
+ export declare function isRail(layer: ILayer | null): layer is import("./index").IRailConfig;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : guards.ts
5
+ * @Date : 2026/04/07
6
+ * @Desc. : 类型守卫函数
7
+ */
8
+ import { EnumModel } from './index';
9
+ // 是否为机床
10
+ export function isMachineTool(layer) {
11
+ return layer?.className === EnumModel.MACHINE_TOOL;
12
+ }
13
+ // 是否拥有工位组配置
14
+ export function hasStationSlotGroup(layer) {
15
+ return (layer?.className === EnumModel.MACHINE_TOOL ||
16
+ layer?.className === EnumModel.MARKING_MACHINE ||
17
+ layer?.className === EnumModel.CLEANING_MACHINE ||
18
+ layer?.className === EnumModel.LOADING_STATION ||
19
+ layer?.className === EnumModel.RESOURCE_STORE);
20
+ }
21
+ // 是否拥有夹具切换配置
22
+ export function hasFixtureChange(layer) {
23
+ return layer?.className === EnumModel.SINGLE_JOINT_ROBOT;
24
+ }
25
+ // 是否为轨道配置
26
+ export function isRail(layer) {
27
+ return layer?.className === EnumModel.RAIL;
28
+ }
@@ -1,5 +1,3 @@
1
- import { ILayer } from './models/config.types';
2
- import { IStationSlotConfig, IResourceConfig } from './components/config.types';
3
1
  export * from './enums';
4
2
  export * from './app.types';
5
3
  export * from './base.types';
@@ -8,6 +6,8 @@ export * from './models/operating.types';
8
6
  export * from './components/config.types';
9
7
  export * from './components/operating.types';
10
8
  export * from './guards';
9
+ import type { ILayer } from './models/config.types';
10
+ import type { IStationSlotConfig, IResourceConfig } from './components/config.types';
11
11
  /**
12
12
  * 可交互设备类型
13
13
  * @description 可交互UI类型:设备模型(ILayer)、工位槽(IStationSlot)、资源(IResource)
@@ -0,0 +1,8 @@
1
+ export * from './enums';
2
+ export * from './app.types';
3
+ export * from './base.types';
4
+ export * from './models/config.types';
5
+ export * from './models/operating.types';
6
+ export * from './components/config.types';
7
+ export * from './components/operating.types';
8
+ export * from './guards';
@@ -1,45 +1,90 @@
1
- import { EnumModel, EnumTag } from '../enums';
2
- import { IRowData, IBaseConfig, IEventState } from '../base.types';
3
- import { IStationSlotGroupConfig } from '../components/config.types';
1
+ import { EnumModel, EnumTag, EnumResourceType } from '../enums'
2
+ import type { IRowData, IBaseConfig, IEventState } from '../base.types'
3
+ import type { IStationSlotGroupConfig } from '../components/config.types'
4
4
  /**
5
5
  * 设备模型基类
6
6
  */
7
7
  export interface IModel extends IBaseConfig, IEventState {
8
- uuid: string;
9
- equipmentName: string;
10
- nameplate?: string;
11
- model?: string;
12
- manufacturer?: string;
13
- group?: string;
14
- tags?: EnumTag[];
15
- x: number;
16
- y: number;
17
- percentX: number;
18
- percentY: number;
19
- zIndex: number;
20
- rotation: number;
21
- scale: number;
22
- rawData: IRowData;
23
- editable: boolean;
24
- selected: boolean;
8
+ uuid: string
9
+ equipmentName: string
10
+ nameplate?: string
11
+ model?: string
12
+ manufacturer?: string
13
+ group?: string
14
+ tags?: EnumTag[]
15
+ x: number
16
+ y: number
17
+ percentX: number
18
+ percentY: number
19
+ zIndex: number
20
+ rotation: number
21
+ scale: number
22
+ rawData: IRowData
23
+ editable: boolean
24
+ selected: boolean
25
25
  }
26
26
  /**
27
27
  * 机床
28
28
  */
29
29
  export interface IMachineToolConfig extends IModel {
30
- className: EnumModel.MACHINE_TOOL;
31
- stationSlotGroup?: IStationSlotGroupConfig;
30
+ className: EnumModel.MACHINE_TOOL
31
+ stationContainerDirection?: 'horizontal' | 'vertical'
32
+ stationSlotGroup?: IStationSlotGroupConfig
32
33
  }
33
34
  /**
34
- * 单手夹爪机器人
35
+ * 装载站
35
36
  */
36
- export interface ISingleGripperRobotConfig extends IModel {
37
- className: EnumModel.SINGLE_GRIPPER_ROBOT;
38
- currentFixture: 'pallet' | 'cutter';
39
- linkRailId?: string;
40
- linkTrailerId?: string;
37
+ export interface ILoadingStationConfig extends IModel {
38
+ className: EnumModel.LOADING_STATION
39
+ stationContainerDirection?: 'horizontal' | 'vertical'
40
+ stationSlotGroup?: IStationSlotGroupConfig
41
+ }
42
+ /**
43
+ * 打标机
44
+ */
45
+ export interface IMarkingMachineConfig extends IModel {
46
+ className: EnumModel.MARKING_MACHINE
47
+ stationSlotGroup?: IStationSlotGroupConfig
48
+ }
49
+ /**
50
+ * 清洗机
51
+ */
52
+ export interface ICleaningMachineConfig extends IModel {
53
+ className: EnumModel.CLEANING_MACHINE
54
+ stationSlotGroup?: IStationSlotGroupConfig
55
+ }
56
+ /**
57
+ * 单关节机器人
58
+ */
59
+ export interface ISingleJointRobotConfig extends IModel {
60
+ className: EnumModel.SINGLE_JOINT_ROBOT
61
+ currentFixture: EnumResourceType
62
+ linkRailId?: string
63
+ linkTrailerId?: string
64
+ }
65
+ /**
66
+ * 轨道
67
+ */
68
+ export interface IRailConfig extends IModel {
69
+ className: EnumModel.RAIL
70
+ chainDirection?: 'left' | 'right'
71
+ linkEquipIdArray?: string[]
72
+ }
73
+ /**
74
+ * 资源库
75
+ */
76
+ export interface IResourceStoreConfig extends IModel {
77
+ className: EnumModel.RESOURCE_STORE
78
+ stationSlotGroup?: IStationSlotGroupConfig
41
79
  }
42
80
  /**
43
81
  * 设备层联合类型
44
82
  */
45
- export type ILayer = IMachineToolConfig | ISingleGripperRobotConfig;
83
+ export type ILayer =
84
+ | IMachineToolConfig
85
+ | ILoadingStationConfig
86
+ | IMarkingMachineConfig
87
+ | ICleaningMachineConfig
88
+ | ISingleJointRobotConfig
89
+ | IRailConfig
90
+ | IResourceStoreConfig
@@ -0,0 +1 @@
1
+ import { EnumModel, EnumTag, EnumResourceType } from '../enums';
@@ -1,34 +1,100 @@
1
- import { EnumModel } from '../enums';
2
- import { IRowData } from '../base.types';
3
- import { ILightOperating, IProgressOperating, IEntranceOperating, IResourceOperating } from '../components/operating.types';
1
+ import { EnumModel, EnumResourceType } from '../enums'
2
+ import type { IRowData } from '../base.types'
3
+ import type {
4
+ ILightOperating,
5
+ IProgressOperating,
6
+ IEntranceOperating,
7
+ IResourceOperating
8
+ } from '../components/operating.types'
4
9
  /**
5
10
  * 设备运转基类
6
11
  */
7
12
  export interface IModelOperating {
8
- id: string;
9
- className: EnumModel;
10
- rawData: IRowData;
11
- resource?: IResourceOperating;
13
+ id: string
14
+ className: EnumModel
15
+ rawData: IRowData
16
+ resource?: IResourceOperating
12
17
  }
13
18
  /**
14
19
  * 机床运转状态
15
20
  */
16
21
  export interface IMachineToolOperating extends IModelOperating {
17
- className: EnumModel.MACHINE_TOOL;
18
- light?: ILightOperating;
19
- progress?: IProgressOperating;
20
- entrance?: IEntranceOperating;
22
+ className: EnumModel.MACHINE_TOOL
23
+ light?: ILightOperating
24
+ progress?: IProgressOperating
25
+ entrance?: IEntranceOperating
26
+ stationRotatable?: boolean
21
27
  }
22
28
  /**
23
- * 单手夹爪机器人运转状态
29
+ * 装载站运转状态
30
+ */
31
+ export interface ILoadingStationOperating extends IModelOperating {
32
+ className: EnumModel.LOADING_STATION
33
+ light?: Omit<ILightOperating, 'rotating'>
34
+ progress?: IProgressOperating
35
+ entrance?: IEntranceOperating
36
+ stationRotatable?: boolean
37
+ }
38
+ /**
39
+ * 打标机站点状态
40
+ */
41
+ export interface ILaserSiteState {
42
+ site: number
43
+ active: boolean
44
+ }
45
+ /**
46
+ * 打标机运转状态
47
+ */
48
+ export interface IMarkingMachineOperating extends IModelOperating {
49
+ className: EnumModel.MARKING_MACHINE
50
+ light?: Omit<ILightOperating, 'rotating'>
51
+ progress?: IProgressOperating
52
+ entrance?: IEntranceOperating
53
+ laserSiteNumberArray?: ILaserSiteState[]
54
+ }
55
+ /**
56
+ * 清洗机运转状态
57
+ */
58
+ export interface ICleaningMachineOperating extends IModelOperating {
59
+ className: EnumModel.CLEANING_MACHINE
60
+ light?: Omit<ILightOperating, 'rotating'>
61
+ progress?: IProgressOperating
62
+ entrance?: IEntranceOperating
63
+ }
64
+ /**
65
+ * 单关节机器人运转状态
24
66
  */
25
67
  export interface ISingleGripperRobotOperating extends IModelOperating {
26
- className: EnumModel.SINGLE_GRIPPER_ROBOT;
27
- light: ILightOperating;
28
- x: number;
29
- y: number;
68
+ className: EnumModel.SINGLE_JOINT_ROBOT
69
+ light?: ILightOperating
70
+ x?: number
71
+ y?: number
72
+ r?: number
73
+ currentFixture?: EnumResourceType
74
+ }
75
+ /**
76
+ * 轨道运转状态
77
+ */
78
+ export interface IRailOperating extends IModelOperating {
79
+ className: EnumModel.RAIL
80
+ x?: number
81
+ botId?: string
82
+ }
83
+ /**
84
+ * 资源库运转状态
85
+ */
86
+ export interface IResourceStoreOperating extends IModelOperating {
87
+ className: EnumModel.RESOURCE_STORE
88
+ light?: ILightOperating
30
89
  }
31
90
  /**
32
91
  * 设备层运转状态的联合类型
33
92
  */
34
- export type ILayerOperating = IMachineToolOperating | ISingleGripperRobotOperating;
93
+ export type ILayerOperating =
94
+ | IMachineToolOperating
95
+ | ILoadingStationOperating
96
+ | IMarkingMachineOperating
97
+ | ICleaningMachineOperating
98
+ | ISingleGripperRobotOperating
99
+ | IRailOperating
100
+ | IResourceStoreOperating
@@ -0,0 +1 @@
1
+ import { EnumModel, EnumResourceType } from '../enums';
@@ -1,11 +1,18 @@
1
- import { IComponent, IComponentOperating } from '../../types';
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : ComponentAbs.ts
5
+ * @Date : 2026/02/13
6
+ * @Desc. : 抽象类:子组件(Model-View 分离)
7
+ */
8
+ import type { IComponent, IComponentOperating } from '@/types';
2
9
  import { UI } from 'leafer';
3
10
  export declare abstract class ComponentAbs<T extends IComponent = IComponent> {
4
11
  _ui: UI | null;
5
12
  private _config;
6
13
  private _initialized;
7
14
  constructor(options: T);
8
- get ui(): UI<import('leafer').IUIInputData>;
15
+ get ui(): UI<import("leafer").IUIInputData>;
9
16
  get config(): T;
10
17
  protected get width_05(): number;
11
18
  protected get height_05(): number;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : ComponentAbs.ts
5
+ * @Date : 2026/02/13
6
+ * @Desc. : 抽象类:子组件(Model-View 分离)
7
+ */
8
+ import { UI } from 'leafer';
9
+ import { cloneDeep } from '@jnrs/shared/lodash';
10
+ export class ComponentAbs {
11
+ _ui = null;
12
+ _config;
13
+ _initialized = false;
14
+ constructor(options) {
15
+ this._config = cloneDeep(options);
16
+ }
17
+ get ui() {
18
+ if (!this._ui) {
19
+ throw new Error('访问 ui 失败:UI 实例未创建,请先调用 init() 方法');
20
+ }
21
+ return this._ui;
22
+ }
23
+ get config() {
24
+ return this._config;
25
+ }
26
+ // 宽度计算 - 50%(中心点)
27
+ get width_05() {
28
+ return this.config.width * 0.5;
29
+ }
30
+ // 高度计算 - 50%(中心点)
31
+ get height_05() {
32
+ return this.config.height * 0.5;
33
+ }
34
+ // 设备操作
35
+ operating(data) { }
36
+ // 初始化 UI(必须在 setEventHandler 之前调用)
37
+ init() {
38
+ if (this._initialized) {
39
+ console.warn('元素已经初始化,重复初始化');
40
+ return this;
41
+ }
42
+ this._ui = this.createUi();
43
+ this._initialized = true;
44
+ return this;
45
+ }
46
+ // 处理设备操作
47
+ handleOperation = (data) => {
48
+ this.operating(data);
49
+ };
50
+ // 销毁 UI 和事件绑定
51
+ destroyUI() {
52
+ if (!this._initialized) {
53
+ console.warn('销毁失败,元素未初始化');
54
+ return;
55
+ }
56
+ this.ui.destroy();
57
+ this._initialized = false;
58
+ }
59
+ // 销毁
60
+ destroy() {
61
+ this.destroyUI();
62
+ this._ui = null;
63
+ }
64
+ }
@@ -1,4 +1,12 @@
1
- import { ILayer, IEventHandler, ILayerOperating } from '../../types';
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : ModelAbs.ts
5
+ * @Date : 2026/02/13
6
+ * @Desc. : 抽象类:设备
7
+ * @Intro. : Model-View 分离架构
8
+ */
9
+ import type { ILayer, IEventHandler, ILayerOperating } from '@/types';
2
10
  import { UI } from 'leafer';
3
11
  export declare abstract class ModelAbs<T extends ILayer = ILayer> {
4
12
  _ui: UI | null;
@@ -6,9 +14,11 @@ export declare abstract class ModelAbs<T extends ILayer = ILayer> {
6
14
  private eventHandler;
7
15
  private _initialized;
8
16
  constructor(options: T);
9
- get ui(): UI<import('leafer').IUIInputData>;
17
+ get ui(): UI<import("leafer").IUIInputData>;
10
18
  get config(): T;
11
19
  protected get width_05(): number;
20
+ protected get width_02(): number;
21
+ protected get width_08(): number;
12
22
  protected get height_05(): number;
13
23
  protected abstract createUi(): UI;
14
24
  protected abstract operating(data: ILayerOperating): void;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : ModelAbs.ts
5
+ * @Date : 2026/02/13
6
+ * @Desc. : 抽象类:设备
7
+ * @Intro. : Model-View 分离架构
8
+ */
9
+ import { UI, PointerEvent, DragEvent } from 'leafer';
10
+ import { cloneDeep, debounce } from '@jnrs/shared/lodash';
11
+ const DEBOUNCE_TIME = 300; // 防抖时间 300ms
12
+ export class ModelAbs {
13
+ _ui = null;
14
+ _config;
15
+ eventHandler = null;
16
+ _initialized = false;
17
+ constructor(options) {
18
+ this._config = cloneDeep(options);
19
+ }
20
+ get ui() {
21
+ if (!this._ui) {
22
+ throw new Error('访问 ui 失败:UI 实例未创建,请先调用 init() 方法');
23
+ }
24
+ return this._ui;
25
+ }
26
+ get config() {
27
+ return this._config;
28
+ }
29
+ // 宽度计算 - 50%(中心点)
30
+ get width_05() {
31
+ return this.config.width * 0.5;
32
+ }
33
+ get width_02() {
34
+ return this.config.width * 0.2;
35
+ }
36
+ get width_08() {
37
+ return this.config.width * 0.8;
38
+ }
39
+ // 高度计算 - 50%(中心点)
40
+ get height_05() {
41
+ return this.config.height * 0.5;
42
+ }
43
+ // 初始化 UI(必须在 setEventHandler 之前调用)
44
+ init() {
45
+ if (this._initialized) {
46
+ console.warn('元素已经初始化,重复初始化');
47
+ return this;
48
+ }
49
+ this._ui = this.createUi();
50
+ this._initialized = true;
51
+ return this;
52
+ }
53
+ // 处理设备操作
54
+ handleOperation = (data) => {
55
+ this.operating(data);
56
+ };
57
+ // 赋值函数,用于判断是否注册交互事件
58
+ shouldHandleInteraction(e, selfEnabled) {
59
+ const isTargetSelf = e.target === this.ui;
60
+ // 情况1禁止注册: hitSelf 为 false,且点击的是自身
61
+ if (!this.config.hitSelf && isTargetSelf)
62
+ return false;
63
+ // 情况2禁止注册: 点击、右击、移动等交互的是自身,但自身不可点击、右击、移动等
64
+ if (isTargetSelf && !selfEnabled)
65
+ return false;
66
+ return true;
67
+ }
68
+ // 点击事件回调
69
+ tapCallback = debounce((e) => {
70
+ if (!this.shouldHandleInteraction(e, this.config.clickable))
71
+ return;
72
+ this.eventHandler?.onTap?.(this.config, e.target.data);
73
+ }, DEBOUNCE_TIME);
74
+ // 右键点击事件回调
75
+ menuTapCallback = debounce((e) => {
76
+ if (!this.shouldHandleInteraction(e, this.config.menuClickable))
77
+ return;
78
+ this.eventHandler?.onMenuTap?.(this.config, e.target.data);
79
+ }, DEBOUNCE_TIME);
80
+ // 拖拽事件回调
81
+ dragCallback = (e) => {
82
+ if (!this.shouldHandleInteraction(e, this.config.draggable))
83
+ return;
84
+ this.eventHandler?.onDragEnd?.(this.config, e.target.data);
85
+ };
86
+ // 注册事件(事件委托模式)
87
+ setEventHandler(handler) {
88
+ // 不可交互时不注册自定义事件(不在 UI 上设置 hittable 属性,防止编辑模式下无法选中设备)
89
+ if (!this.config.hittable)
90
+ return;
91
+ this.eventHandler = handler;
92
+ if (Object.hasOwn(handler, 'onTap')) {
93
+ this.ui.on(PointerEvent.TAP, this.tapCallback);
94
+ }
95
+ if (Object.hasOwn(handler, 'onMenuTap')) {
96
+ this.ui.on(PointerEvent.MENU_TAP, this.menuTapCallback);
97
+ }
98
+ if (Object.hasOwn(handler, 'onDragEnd')) {
99
+ this.ui.on(DragEvent.END, this.dragCallback);
100
+ }
101
+ }
102
+ // 销毁 UI 和事件绑定
103
+ destroyUI() {
104
+ if (!this._initialized) {
105
+ console.warn('销毁失败,元素未初始化');
106
+ return;
107
+ }
108
+ this.ui.off(PointerEvent.TAP, this.tapCallback);
109
+ this.ui.off(PointerEvent.MENU_TAP, this.menuTapCallback);
110
+ this.ui.off(DragEvent.END, this.dragCallback);
111
+ this.ui.destroy();
112
+ this._initialized = false;
113
+ }
114
+ // 销毁
115
+ destroy() {
116
+ this.destroyUI();
117
+ this._ui = null;
118
+ }
119
+ }
@@ -1,5 +1,12 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : Entrance.ts
5
+ * @Date : 2025/01/18
6
+ * @desc. : 设备入口
7
+ */
1
8
  import { Box } from 'leafer';
2
- import { IEntranceConfig, IEntranceOperating } from '../../types';
9
+ import { type IEntranceConfig, type IEntranceOperating } from '@/types';
3
10
  import { ComponentAbs } from '../abstract/ComponentAbs';
4
11
  export declare class Entrance extends ComponentAbs<IEntranceConfig> {
5
12
  constructor(options: IEntranceConfig);