star-horse-lowcode 2.7.62 → 2.7.65

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 (221) hide show
  1. package/.env.development +3 -0
  2. package/.env.production +3 -0
  3. package/.eslintrc-auto-import.json +77 -0
  4. package/.gitignore +27 -0
  5. package/.idea/.gitignore +5 -0
  6. package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
  7. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  8. package/.idea/modules.xml +8 -0
  9. package/.idea/testcode.iml +12 -0
  10. package/.idea/vcs.xml +6 -0
  11. package/.idea/watcherTasks.xml +4 -0
  12. package/.idea/workspace.xml +207 -0
  13. package/.npmignore +21 -0
  14. package/.prettierignore +26 -0
  15. package/README.md +2 -0
  16. package/auto-imports.d.ts +137 -0
  17. package/components.d.ts +189 -0
  18. package/dist/assets/index.css +1 -1
  19. package/dist/index.es.js +941 -720
  20. package/dist/types/index.d.ts +8 -8
  21. package/eslint.config.js +37 -0
  22. package/index.html +14 -0
  23. package/package-lock.json +8276 -0
  24. package/package.json +6 -6
  25. package/prettier.config.js +20 -0
  26. package/public/logo.svg +660 -0
  27. package/src/App.vue +11 -0
  28. package/src/api/date_utils.ts +219 -0
  29. package/src/api/finger_utils.ts +71 -0
  30. package/src/api/form_utils.ts +281 -0
  31. package/src/api/jquery.min.js +2 -0
  32. package/src/api/pcas-code.json +1 -0
  33. package/src/api/settings.ts +81 -0
  34. package/src/api/star_horse_apis.ts +196 -0
  35. package/src/api/star_horse_utils.ts +797 -0
  36. package/src/api/system.ts +351 -0
  37. package/src/api/user_func.ts +147 -0
  38. package/src/api/valid_utils.ts +165 -0
  39. package/src/assets/css/index.scss +908 -0
  40. package/src/assets/icons.css +574 -0
  41. package/src/assets/star-horse-icons.woff +0 -0
  42. package/src/components/comp/ShDynamicForm.vue +160 -0
  43. package/src/components/comp/ShForm.vue +30 -0
  44. package/src/components/comp/ShTableListColumn.vue +61 -0
  45. package/src/components/comp/StarHorseDataSelector.vue +139 -0
  46. package/src/components/comp/StarHorseDataView.vue +110 -0
  47. package/src/components/comp/StarHorseDataViewItems.vue +61 -0
  48. package/src/components/comp/StarHorseDataViewTable.vue +102 -0
  49. package/src/components/comp/StarHorseDialog.vue +383 -0
  50. package/src/components/comp/StarHorseDraggable.vue +401 -0
  51. package/src/components/comp/StarHorseForm.vue +458 -0
  52. package/src/components/comp/StarHorseFormItem.vue +82 -0
  53. package/src/components/comp/StarHorseFormList.vue +516 -0
  54. package/src/components/comp/StarHorseFormTable.vue +56 -0
  55. package/src/components/comp/StarHorseIcon.vue +76 -0
  56. package/src/components/comp/StarHorseItem.vue +302 -0
  57. package/src/components/comp/StarHorseJsonEditor.vue +115 -0
  58. package/src/components/comp/StarHorsePopover.vue +66 -0
  59. package/src/components/comp/StarHorseSearchComp.vue +253 -0
  60. package/src/components/comp/StarHorseStaticTable.vue +395 -0
  61. package/src/components/comp/StarHorseTableColumn.vue +249 -0
  62. package/src/components/comp/StarHorseTableComp.vue +1193 -0
  63. package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
  64. package/src/components/comp/StarHorseTree.vue +494 -0
  65. package/src/components/comp/index.ts +22 -0
  66. package/src/components/comp/items/UTableColumn.vue +65 -0
  67. package/src/components/comp/items/boxItem.vue +98 -0
  68. package/src/components/comp/items/callitem.ts +9 -0
  69. package/src/components/comp/items/cardItem.vue +152 -0
  70. package/src/components/comp/items/collapseItem.vue +134 -0
  71. package/src/components/comp/items/dytableItem.vue +135 -0
  72. package/src/components/comp/items/otherItem.vue +65 -0
  73. package/src/components/comp/items/tabItem.vue +155 -0
  74. package/src/components/comp/items/tabPanelItem.vue +110 -0
  75. package/src/components/comp/items/tableColumn.vue +129 -0
  76. package/src/components/comp/items/tableItem.vue +97 -0
  77. package/src/components/comp/items/tablebtn.vue +158 -0
  78. package/src/components/comp/items/viewBoxItem.vue +55 -0
  79. package/src/components/comp/items/viewCardItem.vue +47 -0
  80. package/src/components/comp/items/viewCollapseItem.vue +71 -0
  81. package/src/components/comp/items/viewDytableItem.vue +77 -0
  82. package/src/components/comp/items/viewOtherItem.vue +55 -0
  83. package/src/components/comp/items/viewTabItem.vue +77 -0
  84. package/src/components/comp/items/viewTabPanelItem.vue +54 -0
  85. package/src/components/comp/items/viewTableItem.vue +74 -0
  86. package/src/components/comp/selfcomp.ts +9 -0
  87. package/src/components/comp/utils/DataPicker.vue +302 -0
  88. package/src/components/comp/utils/DataTag.vue +51 -0
  89. package/src/components/cron/Crontab-Day.vue +230 -0
  90. package/src/components/cron/Crontab-Hour.vue +165 -0
  91. package/src/components/cron/Crontab-Min.vue +166 -0
  92. package/src/components/cron/Crontab-Month.vue +166 -0
  93. package/src/components/cron/Crontab-Result.vue +615 -0
  94. package/src/components/cron/Crontab-Second.vue +185 -0
  95. package/src/components/cron/Crontab-Week.vue +208 -0
  96. package/src/components/cron/Crontab-Year.vue +183 -0
  97. package/src/components/cron/Crontab.vue +474 -0
  98. package/src/components/enums/ModuleEnums.ts +10 -0
  99. package/src/components/enums/ServiceEnums.ts +18 -0
  100. package/src/components/formcomp/container/box-container.vue +162 -0
  101. package/src/components/formcomp/container/callitem.ts +9 -0
  102. package/src/components/formcomp/container/card-container.vue +170 -0
  103. package/src/components/formcomp/container/collapse-container.vue +133 -0
  104. package/src/components/formcomp/container/dytable-col.vue +448 -0
  105. package/src/components/formcomp/container/dytable-container.vue +57 -0
  106. package/src/components/formcomp/container/dytableUtils.ts +358 -0
  107. package/src/components/formcomp/container/group-box-container.vue +331 -0
  108. package/src/components/formcomp/container/index.ts +6 -0
  109. package/src/components/formcomp/container/tab-container.vue +153 -0
  110. package/src/components/formcomp/container/table-container.vue +249 -0
  111. package/src/components/formcomp/items/allitem.ts +9 -0
  112. package/src/components/formcomp/items/area-item.vue +116 -0
  113. package/src/components/formcomp/items/audio-item.vue +163 -0
  114. package/src/components/formcomp/items/autocomplete-item.vue +118 -0
  115. package/src/components/formcomp/items/barcode-item.vue +87 -0
  116. package/src/components/formcomp/items/base-json-item.vue +207 -0
  117. package/src/components/formcomp/items/button-item.vue +228 -0
  118. package/src/components/formcomp/items/cascade-item.vue +113 -0
  119. package/src/components/formcomp/items/checkbox-item.vue +97 -0
  120. package/src/components/formcomp/items/color-item.vue +70 -0
  121. package/src/components/formcomp/items/cron-item.vue +115 -0
  122. package/src/components/formcomp/items/datetime-item.vue +99 -0
  123. package/src/components/formcomp/items/depart-item.vue +51 -0
  124. package/src/components/formcomp/items/dialog-input-item.vue +207 -0
  125. package/src/components/formcomp/items/divider-item.vue +66 -0
  126. package/src/components/formcomp/items/html-item.vue +65 -0
  127. package/src/components/formcomp/items/htmleditor-item.vue +104 -0
  128. package/src/components/formcomp/items/icon-item.vue +195 -0
  129. package/src/components/formcomp/items/image-item.vue +247 -0
  130. package/src/components/formcomp/items/index.ts +44 -0
  131. package/src/components/formcomp/items/input-item.vue +150 -0
  132. package/src/components/formcomp/items/json-array-item.vue +67 -0
  133. package/src/components/formcomp/items/json-item.vue +66 -0
  134. package/src/components/formcomp/items/markdown-item.vue +77 -0
  135. package/src/components/formcomp/items/number-item.vue +94 -0
  136. package/src/components/formcomp/items/number-range-item.vue +278 -0
  137. package/src/components/formcomp/items/page-select-item.vue +407 -0
  138. package/src/components/formcomp/items/password-item.vue +71 -0
  139. package/src/components/formcomp/items/qrcode-item.vue +84 -0
  140. package/src/components/formcomp/items/radio-item.vue +112 -0
  141. package/src/components/formcomp/items/rate-item.vue +68 -0
  142. package/src/components/formcomp/items/select-item.vue +133 -0
  143. package/src/components/formcomp/items/signature-item.vue +216 -0
  144. package/src/components/formcomp/items/slider-item.vue +68 -0
  145. package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
  146. package/src/components/formcomp/items/switch-item.vue +77 -0
  147. package/src/components/formcomp/items/tag-item.vue +77 -0
  148. package/src/components/formcomp/items/text-item.vue +75 -0
  149. package/src/components/formcomp/items/textarea-item.vue +85 -0
  150. package/src/components/formcomp/items/time-item.vue +77 -0
  151. package/src/components/formcomp/items/time-picker-item.vue +74 -0
  152. package/src/components/formcomp/items/transfer-item.vue +93 -0
  153. package/src/components/formcomp/items/tselect-item.vue +121 -0
  154. package/src/components/formcomp/items/unknown-item.vue +51 -0
  155. package/src/components/formcomp/items/upload-item.vue +189 -0
  156. package/src/components/formcomp/items/user-item.vue +177 -0
  157. package/src/components/formcomp/items/usercomp-item.vue +85 -0
  158. package/src/components/formcomp/items/view-markdown-item.vue +77 -0
  159. package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
  160. package/src/components/formcomp/utils/FieldList.vue +125 -0
  161. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
  162. package/src/components/help.vue +31 -0
  163. package/src/components/menu/MenuItem.vue +95 -0
  164. package/src/components/menu/SubMenu.vue +68 -0
  165. package/src/components/menu/SubSystemMenu.vue +142 -0
  166. package/src/components/register.ts +24 -0
  167. package/src/components/system/ContentMenu.vue +260 -0
  168. package/src/components/system/StarHorseButtonList.vue +344 -0
  169. package/src/components/system/StarHorseMenu.vue +97 -0
  170. package/src/components/system/StarHorseSvg.vue +62 -0
  171. package/src/components/system/SystemComp.ts +9 -0
  172. package/src/components/system/index.ts +4 -0
  173. package/src/components/types/ApiUrls.ts +168 -0
  174. package/src/components/types/BtnAction.ts +51 -0
  175. package/src/components/types/BtnAuth.ts +43 -0
  176. package/src/components/types/CompInfo.ts +81 -0
  177. package/src/components/types/DialogProps.ts +55 -0
  178. package/src/components/types/DyCompField.ts +23 -0
  179. package/src/components/types/DynamicNode.ts +42 -0
  180. package/src/components/types/MenusInfo.ts +45 -0
  181. package/src/components/types/PageFieldInfo.ts +530 -0
  182. package/src/components/types/PageProps.ts +25 -0
  183. package/src/components/types/Params.ts +93 -0
  184. package/src/components/types/RuleType.ts +10 -0
  185. package/src/components/types/SearchProps.ts +42 -0
  186. package/src/components/types/ShortKey.ts +30 -0
  187. package/src/components/types/StarHorseType.ts +18 -0
  188. package/src/components/types/index.ts +15 -0
  189. package/src/config/element.ts +15 -0
  190. package/src/config/styles.ts +4 -0
  191. package/src/index.ts +98 -0
  192. package/src/install.ts +33 -0
  193. package/src/lang/en_US.ts +81 -0
  194. package/src/lang/index.ts +35 -0
  195. package/src/lang/zh_CN.ts +84 -0
  196. package/src/main.ts +57 -0
  197. package/src/plugins/AblesPlugin.ts +618 -0
  198. package/src/plugins/registerCompPlugin.ts +15 -0
  199. package/src/sample/test.vue +9 -0
  200. package/src/store/ButtonPermission.ts +101 -0
  201. package/src/store/ConsumerView.ts +52 -0
  202. package/src/store/ContinusConfig.ts +78 -0
  203. package/src/store/CopyerOperation.ts +74 -0
  204. package/src/store/DesignForm.ts +481 -0
  205. package/src/store/DesignPage.ts +59 -0
  206. package/src/store/DynamicForm.ts +241 -0
  207. package/src/store/GlobalConfig.ts +90 -0
  208. package/src/store/SelfOperation.ts +95 -0
  209. package/src/store/UserInfo.ts +88 -0
  210. package/src/store/index.ts +6 -0
  211. package/src/theme/localStorge.ts +16 -0
  212. package/src/theme/theme.ts +27 -0
  213. package/src/utils/FieldOperationUtils.ts +91 -0
  214. package/src/utils/auth.ts +83 -0
  215. package/src/utils/message.ts +69 -0
  216. package/src/utils/preview.ts +125 -0
  217. package/tsconfig.json +39 -0
  218. package/tsconfig.node.json +10 -0
  219. package/vite-env.d.ts +16 -0
  220. package/vite.config.ts +162 -0
  221. package/yarn.lock +4627 -0
@@ -0,0 +1,284 @@
1
+ import { error } from "@/utils/message";
2
+ import { userFunction } from "@/api/user_func";
3
+ import { compDynamicData } from "@/api/star_horse_utils";
4
+ import piniaInstance from "@/store";
5
+ import { useSelfOperationStore } from "@/store/SelfOperation";
6
+ import { useDesignFormStore } from "@/store/DesignForm";
7
+ import { computed, isRef, unref, watch } from "vue";
8
+
9
+ const designForm = useDesignFormStore(piniaInstance);
10
+ const userOperation = useSelfOperationStore(piniaInstance);
11
+
12
+ const isDesign = computed(() => designForm.isEdit);
13
+ /**
14
+ * Change 事件
15
+ * @param context
16
+ * @param formData
17
+ */
18
+ const change = (context: any, formData: any) => {
19
+ const field = context.field as any;
20
+ const relation = field.preps?.dataRelation;
21
+ operationRelation(relation, "change", formData, field.fieldName);
22
+ };
23
+ /**
24
+ * Input 事件
25
+ * @param context
26
+ * @param formData
27
+ */
28
+ const input = (context: any, formData: any) => {
29
+ const field = context.field as any;
30
+ const relation = field.preps?.dataRelation;
31
+ operationRelation(relation, "input", formData, field.fieldName);
32
+ };
33
+ /**
34
+ * Focus 事件
35
+ * @param context
36
+ * @param formData
37
+ */
38
+ const focus = (context: any, formData: any) => {
39
+ const field = context.field as any;
40
+ const relation = field.preps?.dataRelation;
41
+ operationRelation(relation, "focus", formData, field.fieldName);
42
+ };
43
+ /**
44
+ * Blur 事件
45
+ * @param context
46
+ * @param formData
47
+ */
48
+ const blur = (context: any, formData: any) => {
49
+ const field = context.field as any;
50
+ const relation = field.preps?.dataRelation;
51
+ operationRelation(relation, "blur", formData, field.fieldName);
52
+ };
53
+ /**
54
+ * Enter 事件
55
+ * @param context
56
+ * @param formData
57
+ */
58
+ const mouseEnter = (context: any, formData: any) => {
59
+ const field = context.field as any;
60
+ const relation = field.preps?.dataRelation;
61
+ operationRelation(relation, "enter", formData, field.fieldName);
62
+ };
63
+
64
+ /**
65
+ * 操作关联关系
66
+ * @param relation
67
+ * @param actionName
68
+ * @param formData
69
+ * @param currentName
70
+ */
71
+ const operationRelation = async (
72
+ relation: any,
73
+ actionName: string,
74
+ formData: any,
75
+ currentName: string,
76
+ ) => {
77
+ if (!relation || actionName != relation.actionName) {
78
+ return;
79
+ }
80
+ const relations: Array<any> = relation?.relationDetails;
81
+ const currentVal = formData[currentName];
82
+ if (!relations || relations.length == 0) {
83
+ return;
84
+ }
85
+ for (const index in relations) {
86
+ const temp = relations[index];
87
+ const conditon: string = temp.controlCondition;
88
+ const fieldName: string = temp.relationFields;
89
+ if (!conditon || !fieldName) {
90
+ continue;
91
+ }
92
+ const field = userOperation.getFormItem(fieldName);
93
+ const params: any = temp.params;
94
+ //数据联动
95
+ if (conditon == "dataLinkage") {
96
+ formData[fieldName + "OptionList"] = await compDynamicData({
97
+ preps: temp,
98
+ });
99
+ } else if (conditon == "eqDisable" || conditon == "eqDisableOrEditable") {
100
+ //输入的值等于指定值隐藏否则显示
101
+ formData["_" + fieldName + "Editable"] = !(currentVal == params);
102
+ } else if (conditon == "eqEditable" || conditon == "eqEditableOrDisable") {
103
+ //输入的值等于指定值显示否则隐藏
104
+ formData["_" + fieldName + "Editable"] = currentVal == params;
105
+ } else if (conditon == "assignValue") {
106
+ //输入的值等于指定值时赋予新值
107
+ if (
108
+ field.itemType == "select" ||
109
+ field.itemType == "tselect" ||
110
+ field.itemType == "autocomplete" ||
111
+ field.itemType == "cascade"
112
+ ) {
113
+ field.preps.values = JSON.parse(params);
114
+ } else {
115
+ formData[field.fieldName] = params;
116
+ }
117
+ } else if (conditon == "changeType") {
118
+ //输入的值等于指定值时改变字段类型
119
+ field.itemType = params;
120
+ }
121
+ }
122
+ };
123
+ /**
124
+ * 所有触发的事件
125
+ * @param context
126
+ * @param emits
127
+ * @param formData
128
+ * @param actionName
129
+ * @param isInit
130
+ */
131
+ const allAction = (
132
+ context: any,
133
+ emits: any,
134
+ formData: any,
135
+ actionName: string,
136
+ isInit: boolean = false,
137
+ ) => {
138
+ const currentData = unref(formData);
139
+ //设计时的初始化不作处理
140
+ // const field = context.field as any;
141
+ try {
142
+ emits("selfFunc", actionName, currentData);
143
+ } catch (e) {
144
+ error("事件触发异常:" + e);
145
+ }
146
+ if (isDesign.value && isInit) {
147
+ return;
148
+ }
149
+
150
+ //处理连动
151
+ switch (actionName) {
152
+ case "change":
153
+ change(context, currentData);
154
+ break;
155
+ case "input":
156
+ input(context, currentData);
157
+ break;
158
+ case "focus":
159
+ focus(context, currentData);
160
+ break;
161
+ case "blur":
162
+ blur(context, currentData);
163
+ break;
164
+ case "enter":
165
+ case "keydown.enter":
166
+ mouseEnter(context, currentData);
167
+ break;
168
+ default:
169
+ console.log("不支持的事件:" + actionName);
170
+ return;
171
+ }
172
+ };
173
+ /**
174
+ * Button 组件的点击事件
175
+ * @param context
176
+ * @param emits
177
+ * @param formData
178
+ * @param code
179
+ * @param evtName 时间名称
180
+ */
181
+ const buttonAction = (
182
+ context: any,
183
+ emits: any,
184
+ formData: any,
185
+ code: string,
186
+ evtName: string = "click",
187
+ ) => {
188
+ const currentData = isRef(formData) ? formData.value : formData;
189
+ if (code) {
190
+ userFunction(code, context, currentData);
191
+ } else {
192
+ const field = context.field as any;
193
+ currentData["starHorseBtnName"] = field.fieldName;
194
+ const actions = field.actions;
195
+ if (actions) {
196
+ if (typeof actions === "function") {
197
+ actions(formData);
198
+ } else {
199
+ actions[evtName]?.(formData);
200
+ }
201
+ } else {
202
+ emits("selfFunc", currentData);
203
+ }
204
+ }
205
+ };
206
+ /**
207
+ * 检查是否禁用
208
+ * @param attrs
209
+ */
210
+ const checkIsDisabled = (attrs: any) => {
211
+ // const {attrs} = context;
212
+ const { field } = attrs;
213
+ const fieldName = field.fieldName;
214
+ const isExplicitlyDisabled =
215
+ attrs?.disabled || field.disabled || field.preps?.disabled;
216
+ const eidtDidsabled =
217
+ (attrs.editDisabled || field.editDisabled || field.preps?.editDisabled) &&
218
+ field.preps?.starHorseFieldSource != 1;
219
+ const isImplicitlyDisabled =
220
+ !attrs?.formData?.[`_${fieldName}Editable`] && field?.preps?.disabled;
221
+ return (
222
+ eidtDidsabled === true ||
223
+ isExplicitlyDisabled === true ||
224
+ isImplicitlyDisabled === true
225
+ );
226
+ };
227
+ const useFormField = (context: any, field: any) => {
228
+ const fieldName = computed(() => field.fieldName);
229
+ const updateFormData = (value: any) => {
230
+ const newData = context.attrs.formData;
231
+ newData[fieldName.value] = value;
232
+ // context.emit('form-data-update', newData);
233
+ };
234
+
235
+ return {
236
+ fieldValue: computed({
237
+ get: () => context.attrs.formData[fieldName.value],
238
+ set: updateFormData,
239
+ }),
240
+ };
241
+ };
242
+ const initCompCallEvent = (props: any, emits: any, formData: any) => {
243
+ const events: string[] = Object.keys(props.field.actions || {});
244
+ // 新增数据检查
245
+ if (
246
+ !props.isSearch &&
247
+ !props.field.preps?.["stopInitCallAction"] &&
248
+ events?.length > 0
249
+ ) {
250
+ if (
251
+ Object.keys(formData.value || {}).length == 0 ||
252
+ !formData.value[props.field.fieldName]
253
+ ) {
254
+ const stop = watch(
255
+ () => formData.value[props.field.fieldName],
256
+ (val) => {
257
+ if (val) {
258
+ doInitCallEvent(props, emits, formData);
259
+ stop();
260
+ }
261
+ },
262
+ { immediate: true },
263
+ );
264
+ return;
265
+ }
266
+ doInitCallEvent(props, emits, formData);
267
+ }
268
+ };
269
+ const doInitCallEvent = (props: any, emits: any, formData: any) => {
270
+ const events: string[] = Object.keys(props.field.actions || {});
271
+ if (props.field.preps?.["starHorseFieldSource"] == 5) {
272
+ return;
273
+ }
274
+ events?.forEach((event) => {
275
+ allAction(props, emits, formData, event, true);
276
+ });
277
+ };
278
+ export {
279
+ allAction,
280
+ buttonAction,
281
+ checkIsDisabled,
282
+ useFormField,
283
+ initCompCallEvent,
284
+ };
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts" name="help">
2
+ import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
3
+
4
+ defineProps({
5
+ width: { type: Number, default: 340 },
6
+ message: { type: String, required: true, default: "帮助" },
7
+ });
8
+ </script>
9
+ <template>
10
+ <el-popover
11
+ trigger="hover"
12
+ :popper-style="{ width: 'unset !important' }"
13
+ placement="bottom-start"
14
+ >
15
+ <template #reference>
16
+ <star-horse-icon
17
+ icon-class="help"
18
+ color="var(--star-horse-style)"
19
+ size="12px"
20
+ style="cursor: pointer"
21
+ />
22
+ </template>
23
+ <div style="font-size: 12px">
24
+ <pre
25
+ >{{ message }}
26
+ </pre
27
+ >
28
+ </div>
29
+ </el-popover>
30
+ </template>
31
+ <style scoped lang="scss"></style>
@@ -0,0 +1,95 @@
1
+ <script setup lang="ts">
2
+ import { computed, PropType } from "vue";
3
+ import { compKey } from "@/api/system";
4
+ defineOptions({
5
+ name: "MenuItem",
6
+ });
7
+ const props = defineProps({
8
+ item: { type: Object as PropType<any>, required: true },
9
+ preps: {
10
+ type: Object as PropType<any>,
11
+ default: () => {
12
+ return {
13
+ id: "id",
14
+ icon: "icon",
15
+ value: "value",
16
+ label: "name",
17
+ children: "children",
18
+ };
19
+ },
20
+ },
21
+ level: { type: Number, default: 1 },
22
+ });
23
+ const emits = defineEmits(["selectItem"]);
24
+ const selectItem = (item: any) => {
25
+ emits("selectItem", item);
26
+ };
27
+ let menuColor = computed(() =>
28
+ props.level > 1 ? "var(--star-horse-shadow)" : "var(--star-horse-background)",
29
+ );
30
+ </script>
31
+ <template>
32
+ <el-sub-menu
33
+ popper-class="popper-class"
34
+ v-if="item[preps.children ?? 'children']?.length > 0"
35
+ :index="item[preps.id]"
36
+ @click="selectItem(item)"
37
+ >
38
+ <template #title>
39
+ <el-icon class="star-icon">
40
+ <component :is="item[preps.icon] || 'document'" />
41
+ </el-icon>
42
+ <span>{{ item[preps.label] }} </span>
43
+ </template>
44
+ <MenuItem
45
+ :item="sitem"
46
+ :level="level + 1"
47
+ :preps="preps"
48
+ @selectItem="selectItem"
49
+ v-for="(sitem, key) in item[preps.children ?? 'children']"
50
+ :key="compKey(sitem, key)"
51
+ />
52
+ </el-sub-menu>
53
+ <el-menu-item
54
+ popper-class="popper-class"
55
+ v-else
56
+ :index="item[preps.id]"
57
+ @click="selectItem(item)"
58
+ >
59
+ <el-icon class="star-icon">
60
+ <component :is="item[preps.icon] || 'document'" />
61
+ </el-icon>
62
+ <template #title>
63
+ <span>{{ item[preps.label] }} </span>
64
+ </template>
65
+ </el-menu-item>
66
+ </template>
67
+ <style lang="scss" scoped>
68
+ .star-icon {
69
+ font-size: 22px;
70
+ }
71
+
72
+ .popper-class {
73
+ background: var(--star-horse-white) !important;
74
+ }
75
+
76
+ .el-sub-menu {
77
+ background: v-bind(menuColor);
78
+ margin-top: 1px;
79
+ }
80
+
81
+ :deep(.el-sub-menu__title) {
82
+ height: 40px;
83
+ line-height: 40px;
84
+ }
85
+
86
+ :deep(.el-scrollbar__view) {
87
+ height: 100%;
88
+ }
89
+
90
+ .popers {
91
+ overflow: auto;
92
+ height: 100% !important;
93
+ z-index: 999999;
94
+ }
95
+ </style>
@@ -0,0 +1,68 @@
1
+ <script setup lang="ts">
2
+ import { computed, ModelRef } from "vue";
3
+ import { compKey } from "@/api/system";
4
+
5
+ const props = defineProps({
6
+ level: { type: Number, default: 1 },
7
+ });
8
+ const dataList: ModelRef<any> = defineModel("dataList");
9
+ let menuColor = computed(() =>
10
+ props.level > 1 ? "var(--star-horse-shadow)" : "var(--star-horse-background)",
11
+ );
12
+ </script>
13
+ <template>
14
+ <div
15
+ v-if="level > 1"
16
+ style="height: 2px; background: var(--star-horse-white)"
17
+ ></div>
18
+ <template v-for="(item, key) in dataList" :key="compKey(item, key)">
19
+ <el-sub-menu v-if="item.children?.length > 0" :index="item.meta.menuId">
20
+ <template #title>
21
+ <el-icon class="star-icon">
22
+ <component :is="item.meta.menuIcon || 'document'" />
23
+ </el-icon>
24
+ <span>{{ item.meta.title }} </span>
25
+ </template>
26
+ <SubMenu v-model:dataList="item.children" :level="level + 1"></SubMenu>
27
+ </el-sub-menu>
28
+ <el-menu-item popper-class="popper-class" v-else :index="item.meta.menuId">
29
+ <el-icon class="star-icon">
30
+ <component :is="item.meta.menuIcon || 'document'" />
31
+ </el-icon>
32
+ <template #title>
33
+ <router-link :to="{ path: item.path }">{{
34
+ item.meta.title
35
+ }}</router-link>
36
+ </template>
37
+ </el-menu-item>
38
+ </template>
39
+ </template>
40
+ <style lang="scss" scoped>
41
+ .star-icon {
42
+ font-size: 22px;
43
+ }
44
+
45
+ .popper-class {
46
+ background: var(--star-horse-style);
47
+ }
48
+
49
+ .el-sub-menu {
50
+ background: v-bind(menuColor);
51
+ margin-top: 1px;
52
+ }
53
+
54
+ :deep(.el-sub-menu__title) {
55
+ height: 40px;
56
+ line-height: 40px;
57
+ }
58
+
59
+ :deep(.el-scrollbar__view) {
60
+ height: 100%;
61
+ }
62
+
63
+ .popers {
64
+ overflow: auto;
65
+ height: 100% !important;
66
+ z-index: 999999;
67
+ }
68
+ </style>
@@ -0,0 +1,142 @@
1
+ <script setup lang="ts">
2
+ import { PropType, ref } from "vue";
3
+ import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
4
+ import { compKey } from "@/api/system";
5
+
6
+ defineProps({
7
+ dataList: { type: Array<any>, required: true },
8
+ preps: {
9
+ type: Object as PropType<any>,
10
+ default: () => {
11
+ return {
12
+ value: "value",
13
+ label: "name",
14
+ children: "children",
15
+ };
16
+ },
17
+ },
18
+ btnTitle: { type: String, default: "添加数据" },
19
+ rmvTitle: { type: String, default: "删除数据" },
20
+ btnVisible: { type: Boolean, default: false },
21
+ rmvVisible: { type: Boolean, default: false },
22
+ });
23
+ const emits = defineEmits(["selectData", "addData", "removeData"]);
24
+ let currentItem = ref<any>({});
25
+ const selectData = (item: any, event: MouseEvent) => {
26
+ currentItem.value = item;
27
+ if (event) {
28
+ event.stopPropagation();
29
+ event.preventDefault();
30
+ }
31
+ emits("selectData", item);
32
+ };
33
+ /**
34
+ * 添加数据
35
+ * @param item
36
+ */
37
+ const addData = (item: any) => {
38
+ emits("addData", item);
39
+ };
40
+ const removeData = (item: any) => {
41
+ emits("removeData", item);
42
+ };
43
+ </script>
44
+ <template>
45
+ <template v-for="(item, key) in dataList" :key="compKey(item, key)">
46
+ <el-sub-menu
47
+ v-if="item?.children?.length > 0"
48
+ :class="{ 'is-active': item[preps.value] == currentItem[preps.value] }"
49
+ :index="item[preps.value]"
50
+ >
51
+ <template #title>
52
+ <el-icon class="star-icon">
53
+ <component is="folder" />
54
+ </el-icon>
55
+ <div class="menu-title" @click="selectData(item, $event)">
56
+ <div class="name">{{ item[preps.label] }}</div>
57
+ <div v-if="btnVisible || rmvVisible" class="btn">
58
+ <el-tooltip :content="btnTitle">
59
+ <star-horse-icon
60
+ cursor="pointer"
61
+ v-if="btnVisible"
62
+ @click.stop="addData(item)"
63
+ icon-class="plus"
64
+ />
65
+ </el-tooltip>
66
+ <el-tooltip :content="rmvTitle">
67
+ <star-horse-icon
68
+ cursor="pointer"
69
+ v-if="rmvVisible"
70
+ @click.stop="removeData(item)"
71
+ color="var(--el-color-danger)"
72
+ icon-class="minus"
73
+ />
74
+ </el-tooltip>
75
+ </div>
76
+ </div>
77
+ </template>
78
+ <SubSystemMenu
79
+ :dataList="item.children"
80
+ :preps="preps"
81
+ @selectData="selectData"
82
+ @removeData="removeData"
83
+ :btnVisible="btnVisible"
84
+ :btnTitle="btnTitle"
85
+ :rmvVisible="rmvVisible"
86
+ :rmvTitle="rmvTitle"
87
+ />
88
+ </el-sub-menu>
89
+ <el-menu-item
90
+ v-else
91
+ :index="item[preps.value]"
92
+ :class="{ 'is-active': item[preps.value] == currentItem[preps.value] }"
93
+ >
94
+ <el-icon class="star-icon">
95
+ <component is="document" />
96
+ </el-icon>
97
+ <template #title>
98
+ <div class="menu-title" @click="selectData(item, $event)">
99
+ <div class="name">{{ item[preps.label] }}</div>
100
+ <div v-if="btnVisible || rmvVisible" class="btn">
101
+ <el-tooltip :content="btnTitle">
102
+ <star-horse-icon
103
+ cursor="pointer"
104
+ v-if="btnVisible"
105
+ @click.stop="addData(item)"
106
+ icon-class="plus"
107
+ />
108
+ </el-tooltip>
109
+ <el-tooltip :content="rmvTitle">
110
+ <star-horse-icon
111
+ cursor="pointer"
112
+ v-if="rmvVisible"
113
+ @click.stop="removeData(item)"
114
+ color="var(--el-color-danger)"
115
+ icon-class="minus"
116
+ />
117
+ </el-tooltip>
118
+ </div>
119
+ </div>
120
+ </template>
121
+ </el-menu-item>
122
+ </template>
123
+ </template>
124
+ <style scoped lang="scss">
125
+ .star-icon {
126
+ font-size: 22px;
127
+ }
128
+
129
+ .el-sub-menu {
130
+ justify-content: space-between;
131
+ }
132
+
133
+ :deep(.el-sub-menu__title) {
134
+ height: 35px !important;
135
+ line-height: 35px !important;
136
+ width: 100%;
137
+ }
138
+
139
+ :deep(.el-scrollbar__view) {
140
+ height: 100%;
141
+ }
142
+ </style>
@@ -0,0 +1,24 @@
1
+ import { App, defineAsyncComponent } from "vue";
2
+
3
+ // 动态导入组件路径(保持原有逻辑)
4
+ const items = import.meta.glob([
5
+ "@/components/comp/*.vue",
6
+ "@/components/comp/items/*.vue",
7
+ "@/components/system/*.vue",
8
+ "@/components/formcomp/items/*.vue",
9
+ "@/components/formcomp/container/*.vue",
10
+ ]);
11
+
12
+ // 全局组件注册函数
13
+ export const registerGlobalComponents = (app: App<Element>) => {
14
+ Object.entries(items).forEach(([path, component]) => {
15
+ const name = path
16
+ .split("/")
17
+ .pop() // 获取文件名
18
+ ?.replace(/\.vue$/, ""); // 移除扩展名
19
+
20
+ if (name) {
21
+ app.component(name, defineAsyncComponent(component as any));
22
+ }
23
+ });
24
+ };