star-horse-lowcode 2.7.65 → 2.7.66

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 (220) hide show
  1. package/README.md +1 -0
  2. package/dist/assets/index.css +1 -1
  3. package/dist/index.es.js +491 -253
  4. package/package.json +1 -1
  5. package/.env.development +0 -3
  6. package/.env.production +0 -3
  7. package/.eslintrc-auto-import.json +0 -77
  8. package/.gitignore +0 -27
  9. package/.idea/.gitignore +0 -5
  10. package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -6
  11. package/.idea/inspectionProfiles/Project_Default.xml +0 -7
  12. package/.idea/modules.xml +0 -8
  13. package/.idea/testcode.iml +0 -12
  14. package/.idea/vcs.xml +0 -6
  15. package/.idea/watcherTasks.xml +0 -4
  16. package/.idea/workspace.xml +0 -207
  17. package/.npmignore +0 -21
  18. package/.prettierignore +0 -26
  19. package/auto-imports.d.ts +0 -137
  20. package/components.d.ts +0 -189
  21. package/eslint.config.js +0 -37
  22. package/index.html +0 -14
  23. package/package-lock.json +0 -8276
  24. package/prettier.config.js +0 -20
  25. package/public/logo.svg +0 -660
  26. package/src/App.vue +0 -11
  27. package/src/api/date_utils.ts +0 -219
  28. package/src/api/finger_utils.ts +0 -71
  29. package/src/api/form_utils.ts +0 -281
  30. package/src/api/jquery.min.js +0 -2
  31. package/src/api/pcas-code.json +0 -1
  32. package/src/api/settings.ts +0 -81
  33. package/src/api/star_horse_apis.ts +0 -196
  34. package/src/api/star_horse_utils.ts +0 -797
  35. package/src/api/system.ts +0 -351
  36. package/src/api/user_func.ts +0 -147
  37. package/src/api/valid_utils.ts +0 -165
  38. package/src/assets/css/index.scss +0 -908
  39. package/src/assets/icons.css +0 -574
  40. package/src/assets/star-horse-icons.woff +0 -0
  41. package/src/components/comp/ShDynamicForm.vue +0 -160
  42. package/src/components/comp/ShForm.vue +0 -30
  43. package/src/components/comp/ShTableListColumn.vue +0 -61
  44. package/src/components/comp/StarHorseDataSelector.vue +0 -139
  45. package/src/components/comp/StarHorseDataView.vue +0 -110
  46. package/src/components/comp/StarHorseDataViewItems.vue +0 -61
  47. package/src/components/comp/StarHorseDataViewTable.vue +0 -102
  48. package/src/components/comp/StarHorseDialog.vue +0 -383
  49. package/src/components/comp/StarHorseDraggable.vue +0 -401
  50. package/src/components/comp/StarHorseForm.vue +0 -458
  51. package/src/components/comp/StarHorseFormItem.vue +0 -82
  52. package/src/components/comp/StarHorseFormList.vue +0 -516
  53. package/src/components/comp/StarHorseFormTable.vue +0 -56
  54. package/src/components/comp/StarHorseIcon.vue +0 -76
  55. package/src/components/comp/StarHorseItem.vue +0 -302
  56. package/src/components/comp/StarHorseJsonEditor.vue +0 -115
  57. package/src/components/comp/StarHorsePopover.vue +0 -66
  58. package/src/components/comp/StarHorseSearchComp.vue +0 -253
  59. package/src/components/comp/StarHorseStaticTable.vue +0 -395
  60. package/src/components/comp/StarHorseTableColumn.vue +0 -249
  61. package/src/components/comp/StarHorseTableComp.vue +0 -1193
  62. package/src/components/comp/StarHorseTableViewColumn.vue +0 -61
  63. package/src/components/comp/StarHorseTree.vue +0 -494
  64. package/src/components/comp/index.ts +0 -22
  65. package/src/components/comp/items/UTableColumn.vue +0 -65
  66. package/src/components/comp/items/boxItem.vue +0 -98
  67. package/src/components/comp/items/callitem.ts +0 -9
  68. package/src/components/comp/items/cardItem.vue +0 -152
  69. package/src/components/comp/items/collapseItem.vue +0 -134
  70. package/src/components/comp/items/dytableItem.vue +0 -135
  71. package/src/components/comp/items/otherItem.vue +0 -65
  72. package/src/components/comp/items/tabItem.vue +0 -155
  73. package/src/components/comp/items/tabPanelItem.vue +0 -110
  74. package/src/components/comp/items/tableColumn.vue +0 -129
  75. package/src/components/comp/items/tableItem.vue +0 -97
  76. package/src/components/comp/items/tablebtn.vue +0 -158
  77. package/src/components/comp/items/viewBoxItem.vue +0 -55
  78. package/src/components/comp/items/viewCardItem.vue +0 -47
  79. package/src/components/comp/items/viewCollapseItem.vue +0 -71
  80. package/src/components/comp/items/viewDytableItem.vue +0 -77
  81. package/src/components/comp/items/viewOtherItem.vue +0 -55
  82. package/src/components/comp/items/viewTabItem.vue +0 -77
  83. package/src/components/comp/items/viewTabPanelItem.vue +0 -54
  84. package/src/components/comp/items/viewTableItem.vue +0 -74
  85. package/src/components/comp/selfcomp.ts +0 -9
  86. package/src/components/comp/utils/DataPicker.vue +0 -302
  87. package/src/components/comp/utils/DataTag.vue +0 -51
  88. package/src/components/cron/Crontab-Day.vue +0 -230
  89. package/src/components/cron/Crontab-Hour.vue +0 -165
  90. package/src/components/cron/Crontab-Min.vue +0 -166
  91. package/src/components/cron/Crontab-Month.vue +0 -166
  92. package/src/components/cron/Crontab-Result.vue +0 -615
  93. package/src/components/cron/Crontab-Second.vue +0 -185
  94. package/src/components/cron/Crontab-Week.vue +0 -208
  95. package/src/components/cron/Crontab-Year.vue +0 -183
  96. package/src/components/cron/Crontab.vue +0 -474
  97. package/src/components/enums/ModuleEnums.ts +0 -10
  98. package/src/components/enums/ServiceEnums.ts +0 -18
  99. package/src/components/formcomp/container/box-container.vue +0 -162
  100. package/src/components/formcomp/container/callitem.ts +0 -9
  101. package/src/components/formcomp/container/card-container.vue +0 -170
  102. package/src/components/formcomp/container/collapse-container.vue +0 -133
  103. package/src/components/formcomp/container/dytable-col.vue +0 -448
  104. package/src/components/formcomp/container/dytable-container.vue +0 -57
  105. package/src/components/formcomp/container/dytableUtils.ts +0 -358
  106. package/src/components/formcomp/container/group-box-container.vue +0 -331
  107. package/src/components/formcomp/container/index.ts +0 -6
  108. package/src/components/formcomp/container/tab-container.vue +0 -153
  109. package/src/components/formcomp/container/table-container.vue +0 -249
  110. package/src/components/formcomp/items/allitem.ts +0 -9
  111. package/src/components/formcomp/items/area-item.vue +0 -116
  112. package/src/components/formcomp/items/audio-item.vue +0 -163
  113. package/src/components/formcomp/items/autocomplete-item.vue +0 -118
  114. package/src/components/formcomp/items/barcode-item.vue +0 -87
  115. package/src/components/formcomp/items/base-json-item.vue +0 -207
  116. package/src/components/formcomp/items/button-item.vue +0 -228
  117. package/src/components/formcomp/items/cascade-item.vue +0 -113
  118. package/src/components/formcomp/items/checkbox-item.vue +0 -97
  119. package/src/components/formcomp/items/color-item.vue +0 -70
  120. package/src/components/formcomp/items/cron-item.vue +0 -115
  121. package/src/components/formcomp/items/datetime-item.vue +0 -99
  122. package/src/components/formcomp/items/depart-item.vue +0 -51
  123. package/src/components/formcomp/items/dialog-input-item.vue +0 -207
  124. package/src/components/formcomp/items/divider-item.vue +0 -66
  125. package/src/components/formcomp/items/html-item.vue +0 -65
  126. package/src/components/formcomp/items/htmleditor-item.vue +0 -104
  127. package/src/components/formcomp/items/icon-item.vue +0 -195
  128. package/src/components/formcomp/items/image-item.vue +0 -247
  129. package/src/components/formcomp/items/index.ts +0 -44
  130. package/src/components/formcomp/items/input-item.vue +0 -150
  131. package/src/components/formcomp/items/json-array-item.vue +0 -67
  132. package/src/components/formcomp/items/json-item.vue +0 -66
  133. package/src/components/formcomp/items/markdown-item.vue +0 -77
  134. package/src/components/formcomp/items/number-item.vue +0 -94
  135. package/src/components/formcomp/items/number-range-item.vue +0 -278
  136. package/src/components/formcomp/items/page-select-item.vue +0 -407
  137. package/src/components/formcomp/items/password-item.vue +0 -71
  138. package/src/components/formcomp/items/qrcode-item.vue +0 -84
  139. package/src/components/formcomp/items/radio-item.vue +0 -112
  140. package/src/components/formcomp/items/rate-item.vue +0 -68
  141. package/src/components/formcomp/items/select-item.vue +0 -133
  142. package/src/components/formcomp/items/signature-item.vue +0 -216
  143. package/src/components/formcomp/items/slider-item.vue +0 -68
  144. package/src/components/formcomp/items/starhorse-form-item.vue +0 -334
  145. package/src/components/formcomp/items/switch-item.vue +0 -77
  146. package/src/components/formcomp/items/tag-item.vue +0 -77
  147. package/src/components/formcomp/items/text-item.vue +0 -75
  148. package/src/components/formcomp/items/textarea-item.vue +0 -85
  149. package/src/components/formcomp/items/time-item.vue +0 -77
  150. package/src/components/formcomp/items/time-picker-item.vue +0 -74
  151. package/src/components/formcomp/items/transfer-item.vue +0 -93
  152. package/src/components/formcomp/items/tselect-item.vue +0 -121
  153. package/src/components/formcomp/items/unknown-item.vue +0 -51
  154. package/src/components/formcomp/items/upload-item.vue +0 -189
  155. package/src/components/formcomp/items/user-item.vue +0 -177
  156. package/src/components/formcomp/items/usercomp-item.vue +0 -85
  157. package/src/components/formcomp/items/view-markdown-item.vue +0 -77
  158. package/src/components/formcomp/utils/EditDataDialog.vue +0 -67
  159. package/src/components/formcomp/utils/FieldList.vue +0 -125
  160. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +0 -284
  161. package/src/components/help.vue +0 -31
  162. package/src/components/menu/MenuItem.vue +0 -95
  163. package/src/components/menu/SubMenu.vue +0 -68
  164. package/src/components/menu/SubSystemMenu.vue +0 -142
  165. package/src/components/register.ts +0 -24
  166. package/src/components/system/ContentMenu.vue +0 -260
  167. package/src/components/system/StarHorseButtonList.vue +0 -344
  168. package/src/components/system/StarHorseMenu.vue +0 -97
  169. package/src/components/system/StarHorseSvg.vue +0 -62
  170. package/src/components/system/SystemComp.ts +0 -9
  171. package/src/components/system/index.ts +0 -4
  172. package/src/components/types/ApiUrls.ts +0 -168
  173. package/src/components/types/BtnAction.ts +0 -51
  174. package/src/components/types/BtnAuth.ts +0 -43
  175. package/src/components/types/CompInfo.ts +0 -81
  176. package/src/components/types/DialogProps.ts +0 -55
  177. package/src/components/types/DyCompField.ts +0 -23
  178. package/src/components/types/DynamicNode.ts +0 -42
  179. package/src/components/types/MenusInfo.ts +0 -45
  180. package/src/components/types/PageFieldInfo.ts +0 -530
  181. package/src/components/types/PageProps.ts +0 -25
  182. package/src/components/types/Params.ts +0 -93
  183. package/src/components/types/RuleType.ts +0 -10
  184. package/src/components/types/SearchProps.ts +0 -42
  185. package/src/components/types/ShortKey.ts +0 -30
  186. package/src/components/types/StarHorseType.ts +0 -18
  187. package/src/components/types/index.ts +0 -15
  188. package/src/config/element.ts +0 -15
  189. package/src/config/styles.ts +0 -4
  190. package/src/index.ts +0 -98
  191. package/src/install.ts +0 -33
  192. package/src/lang/en_US.ts +0 -81
  193. package/src/lang/index.ts +0 -35
  194. package/src/lang/zh_CN.ts +0 -84
  195. package/src/main.ts +0 -57
  196. package/src/plugins/AblesPlugin.ts +0 -618
  197. package/src/plugins/registerCompPlugin.ts +0 -15
  198. package/src/sample/test.vue +0 -9
  199. package/src/store/ButtonPermission.ts +0 -101
  200. package/src/store/ConsumerView.ts +0 -52
  201. package/src/store/ContinusConfig.ts +0 -78
  202. package/src/store/CopyerOperation.ts +0 -74
  203. package/src/store/DesignForm.ts +0 -481
  204. package/src/store/DesignPage.ts +0 -59
  205. package/src/store/DynamicForm.ts +0 -241
  206. package/src/store/GlobalConfig.ts +0 -90
  207. package/src/store/SelfOperation.ts +0 -95
  208. package/src/store/UserInfo.ts +0 -88
  209. package/src/store/index.ts +0 -6
  210. package/src/theme/localStorge.ts +0 -16
  211. package/src/theme/theme.ts +0 -27
  212. package/src/utils/FieldOperationUtils.ts +0 -91
  213. package/src/utils/auth.ts +0 -83
  214. package/src/utils/message.ts +0 -69
  215. package/src/utils/preview.ts +0 -125
  216. package/tsconfig.json +0 -39
  217. package/tsconfig.node.json +0 -10
  218. package/vite-env.d.ts +0 -16
  219. package/vite.config.ts +0 -162
  220. package/yarn.lock +0 -4627
@@ -1,260 +0,0 @@
1
- <script lang="ts" setup>
2
- import {
3
- computed,
4
- nextTick,
5
- onBeforeUnmount,
6
- onMounted,
7
- PropType,
8
- ref,
9
- } from "vue";
10
- import { compKey, useZIndex } from "@/api/system";
11
- import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
12
-
13
- defineOptions({
14
- name: "PageEditorContentMenu",
15
- });
16
-
17
- const props = defineProps({
18
- menuData: { type: Array as PropType<any>, default: () => [] },
19
- isSubMenu: { type: Boolean, default: false },
20
- autoHide: { type: Boolean, default: true },
21
- active: { type: [String, Number], default: "" },
22
- });
23
- const emit = defineEmits<{
24
- hide: [];
25
- show: [];
26
- mouseenter: [];
27
- }>();
28
-
29
- const menu = ref<HTMLDivElement>();
30
- const buttons = ref<Array<any>>();
31
- const subMenu = ref<any>();
32
- const visible = ref(false);
33
- const subMenuData = ref<Array<any>>([]);
34
- const zIndex = useZIndex();
35
- const curZIndex = ref<number>(0);
36
-
37
- const menuPosition = ref({
38
- left: 0,
39
- top: 0,
40
- });
41
-
42
- const menuStyle = computed(() => ({
43
- top: `${menuPosition.value.top}px`,
44
- left: `${menuPosition.value.left}px`,
45
- zIndex: curZIndex.value,
46
- }));
47
-
48
- const contains = (el: HTMLElement) =>
49
- menu.value?.contains(el) || subMenu.value?.contains(el);
50
-
51
- const hide = () => {
52
- if (!visible.value) return;
53
- visible.value = false;
54
- subMenu.value?.hide();
55
- emit("hide");
56
- };
57
-
58
- const clickHandler = (item: any) => {
59
- if (!props.autoHide) return;
60
- item.handler();
61
- hide();
62
- };
63
-
64
- const outsideClickHideHandler = (e: MouseEvent) => {
65
- if (!props.autoHide) return;
66
- const target = e.target as HTMLElement | undefined;
67
- if (!visible.value || !target) {
68
- return;
69
- }
70
- if (contains(target)) {
71
- return;
72
- }
73
- hide();
74
- };
75
-
76
- const setPosition = (e: MouseEvent) => {
77
- const menuHeight = menu.value?.clientHeight || 0;
78
- let top = e.clientY;
79
- if (menuHeight + e.clientY > document.body.clientHeight) {
80
- top = document.body.clientHeight - menuHeight;
81
- }
82
- let left = e.clientX;
83
- menuPosition.value = {
84
- top,
85
- left,
86
- };
87
- };
88
-
89
- const show = (e?: MouseEvent) => {
90
- // 加setTimeout是以为,如果菜单中的按钮监听的是mouseup,那么菜单显示出来时鼠标如果正好在菜单上就会马上触发按钮的mouseup
91
- setTimeout(() => {
92
- visible.value = true;
93
- nextTick(() => {
94
- e && setPosition(e);
95
- curZIndex.value = zIndex.nextZIndex();
96
- emit("show");
97
- });
98
- }, 300);
99
- };
100
- const showSubMenu = (item: any, index: number) => {
101
- const menuItem = item;
102
- if (typeof item !== "object") {
103
- return;
104
- }
105
- subMenuData.value = menuItem.items || [];
106
- setTimeout(() => {
107
- if (!visible.value) {
108
- return;
109
- }
110
-
111
- if (menu.value) {
112
- // 将子菜单放置在按钮右侧,与按钮齐平
113
- let y = menu.value.offsetTop;
114
- if (buttons.value?.[index]?.$el) {
115
- const rect = buttons.value?.[index].$el.getBoundingClientRect();
116
- y = rect.top;
117
- }
118
- subMenu.value?.show({
119
- clientX: menu.value.offsetLeft + menu.value.clientWidth,
120
- clientY: y,
121
- });
122
- }
123
- }, 0);
124
- };
125
-
126
- const mouseenterHandler = () => {
127
- emit("mouseenter");
128
- };
129
-
130
- onMounted(() => {
131
- if (props.isSubMenu) return;
132
- globalThis.addEventListener("mousedown", outsideClickHideHandler, true);
133
- });
134
-
135
- onBeforeUnmount(() => {
136
- if (props.isSubMenu) return;
137
- globalThis.removeEventListener("mousedown", outsideClickHideHandler, true);
138
- });
139
-
140
- defineExpose({
141
- menu,
142
- menuPosition,
143
- hide,
144
- show,
145
- contains,
146
- setPosition,
147
- });
148
- </script>
149
- <template>
150
- <transition name="fade">
151
- <div
152
- v-show="visible"
153
- class="content-menu"
154
- ref="menu"
155
- :style="menuStyle"
156
- @mouseenter="mouseenterHandler()"
157
- >
158
- <slot name="title"></slot>
159
-
160
- <template v-for="(item, index) in menuData" :key="compKey(item, index)">
161
- <el-divider v-if="item.type == 'divider'" :direction="item.direction" />
162
- <div
163
- v-if="item.type == 'button' && item.display"
164
- ref="buttons"
165
- class="menu-item button"
166
- :class="{ active: active && item.id === active }"
167
- :data="item"
168
- :key="index"
169
- @mouseup="clickHandler(item)"
170
- @mouseenter="showSubMenu(item, index)"
171
- >
172
- <star-horse-icon :icon-class="item.icon" />
173
- {{ item.text }}
174
- </div>
175
- </template>
176
- <teleport to="body">
177
- <content-menu
178
- v-if="subMenuData.length"
179
- class="sub-menu"
180
- ref="subMenu"
181
- :active="active"
182
- :menu-data="subMenuData"
183
- :is-sub-menu="true"
184
- @hide="hide"
185
- ></content-menu>
186
- </teleport>
187
- </div>
188
- </transition>
189
- </template>
190
- <style lang="scss" scoped>
191
- :deep(.el-divider) {
192
- margin: 5px auto;
193
- }
194
-
195
- .content-menu {
196
- position: fixed;
197
- font-size: 12px;
198
- background: #fff;
199
- box-shadow: 0 2px 8px 2px rgba(68, 73, 77, 0.16);
200
- z-index: 999999;
201
- transform-origin: 0 0;
202
- font-weight: 600;
203
- padding: 4px 0;
204
- overflow: auto;
205
- max-height: 80%;
206
- min-width: 180px;
207
-
208
- .menu-item {
209
- color: #333;
210
- display: flex;
211
- -webkit-box-align: center;
212
- align-items: center;
213
- flex-direction: row;
214
- vertical-align: middle;
215
- cursor: pointer;
216
- line-height: 35px;
217
- min-width: 140px;
218
- transition: all 0.2s ease 0s;
219
- padding: 5px 14px;
220
- border-left: 2px solid transparent;
221
-
222
- .button {
223
- width: 100%;
224
- justify-content: flex-start;
225
- }
226
-
227
- .el-button--text,
228
- i {
229
- color: var(--star-horse-style);
230
- }
231
-
232
- svg {
233
- margin-right: 5px;
234
- }
235
-
236
- &.divider {
237
- padding: 0 14px;
238
-
239
- .el-divider {
240
- margin: 0;
241
- }
242
- }
243
- &.button {
244
- &:hover {
245
- background-color: #6b778c;
246
-
247
- &.menu-item i {
248
- color: var(--star-horse-style);
249
- }
250
- }
251
- &.active {
252
- background-color: #6b778c;
253
- &.menu-item i {
254
- color: #fff;
255
- }
256
- }
257
- }
258
- }
259
- }
260
- </style>
@@ -1,344 +0,0 @@
1
- <script setup lang="ts" name="StarHorseButtonList">
2
- import {Config} from "@/api/settings";
3
- import {download} from "@/api/star_horse_apis";
4
- import {compKey} from "@/api/system";
5
- import Help from "@/components/help.vue";
6
- import {ApiUrls} from "@/components/types/ApiUrls";
7
- import {PreValid} from "@/components/types/BtnAuth";
8
- import {DialogProps} from "@/components/types/DialogProps";
9
- import {UserFuncInfo} from "@/components/types/PageFieldInfo";
10
- import piniaInstance from "@/store";
11
- import {useGlobalConfigStore} from "@/store/GlobalConfig";
12
- import {getToken} from "@/utils/auth";
13
- import {error, warning} from "@/utils/message";
14
- import {computed, onMounted, PropType, ref} from "vue";
15
-
16
- const props = defineProps({
17
- dialogProps: {type: Object as PropType<DialogProps>, required: true},
18
- compUrl: {type: Object as PropType<ApiUrls>, required: true},
19
- viewFlag: {type: Boolean, default: false},
20
- //自定义按钮
21
- extendBtns: {type: Array as PropType<UserFuncInfo[]>},
22
- //预检查方法,如果设置了预检查方法,必须要检查通过后,按钮事件才能继续往下执行
23
- preValidFunc: {type: Object as PropType<Array<PreValid>>},
24
- btnPermissions: {type: Object as PropType<any>, required: false},
25
- });
26
- const emits = defineEmits([
27
- "upload",
28
- "uploadProcess",
29
- "uploadError",
30
- "uploadSuccess",
31
- "btnOperation",
32
- "tableCompFunc",
33
- ]);
34
- let configStore = useGlobalConfigStore(piniaInstance);
35
- let compSize = computed(
36
- () => configStore.configFormInfo?.buttonSize || Config.compSize,
37
- );
38
- let showType = computed(
39
- () => configStore.configFormInfo?.buttonShowType || "dropdown",
40
- );
41
- let permissions = computed(() => props.btnPermissions);
42
- const dataForm = ref<any>({});
43
- /**
44
- * 向往抛出事件
45
- * @param funcName
46
- */
47
- const tableCompFunc = (funcName: string) => {
48
- emits("tableCompFunc", funcName);
49
- };
50
- const btnOperation = (funcName: string) => {
51
- //检查前置条件
52
- if (props.preValidFunc?.length > 0 && Array.isArray(props.preValidFunc)) {
53
- const preFunc = props.preValidFunc.find(
54
- (item: PreValid) => item.authority == funcName,
55
- );
56
- if (preFunc) {
57
- const result = preFunc.valid?.();
58
- if (!result) {
59
- if (preFunc.msg?.length > 1) {
60
- warning(preFunc.msg);
61
- }
62
- return;
63
- }
64
- }
65
- }
66
- //?表示判断是否为空 !表示断言not null
67
- if (funcName == "add") {
68
- // dataForm.value = {};
69
- props.dialogProps!.ids = -1;
70
- props.dialogProps!.editVisible = true;
71
- props.dialogProps!.dialogTitle = "新增数据";
72
- } else if (funcName == "batchAdd") {
73
- props.dialogProps!.batchEditVisible = true;
74
- props.dialogProps!.batchDialogTitle = "批量新增数据";
75
- } else if (funcName == "download") {
76
- downloadTemplate();
77
- } else {
78
- tableCompFunc(funcName);
79
- }
80
- };
81
- /**
82
- * 刷新数据
83
- * @param file
84
- * @param fileList
85
- */
86
- const downloadTemplate = () => {
87
- download(props.compUrl?.downloadTemplateUrl!, {}).catch((err) => {
88
- error("接口不存在或网络异常:" + err);
89
- });
90
- };
91
- const upload = (file: any, fileList: any) => {
92
- emits("upload", file, fileList);
93
- };
94
- const beforeUpload = (_file: any, _fileList: any) => {
95
- //load("数据导入中");
96
- };
97
- /**
98
- * 上传过程
99
- */
100
- const uploadProcess = (_event: any, _file: any, _fileList: any) => {
101
- };
102
- /**
103
- * 上传失败
104
- */
105
- const uploadError = (_err: any, _file: any, _fileList: any) => {
106
- // closeLoad();
107
- tableCompFunc("refresh");
108
- };
109
- /**
110
- * 上传成功
111
- */
112
- const uploadSuccess = (_response: any, _file: any, _fileList: any) => {
113
- //closeLoad();
114
- tableCompFunc("refresh");
115
- };
116
- const buttonList = computed(() => {
117
- return extendBtnFunction();
118
- });
119
- /**
120
- * 扩展按钮
121
- */
122
- const extendBtnFunction = (): Array<UserFuncInfo> | any => {
123
- let arr: Array<UserFuncInfo | any> = [];
124
- if (props.viewFlag) {
125
- return arr;
126
- }
127
- arr.push({
128
- btnName: "新增",
129
- icon: "add",
130
- authority: "add",
131
- priority: 100,
132
- funcName: (actionName: string) => btnOperation(actionName),
133
- });
134
- arr.push({
135
- btnName: "批量新增",
136
- icon: "batch-add",
137
- authority: "batchAdd",
138
- priority: 110,
139
- funcName: (actionName: string) => btnOperation(actionName),
140
- });
141
- arr.push({
142
- btnName: "下载模板",
143
- icon: "download",
144
- authority: "download",
145
- priority: 120,
146
- funcName: (actionName: string) => btnOperation(actionName),
147
- });
148
- arr.push({
149
- btnName: "执行",
150
- icon: "run",
151
- authority: "execution",
152
- priority: 130,
153
- funcName: (actionName: string) => btnOperation(actionName),
154
- });
155
- arr.push({
156
- btnName: "导入数据",
157
- icon: "excel-upload",
158
- authority: "upload",
159
- priority: 140,
160
- funcName: (actionName: string) => btnOperation(actionName),
161
- });
162
- arr.push({
163
- btnName: "导出数据",
164
- icon: "excel-export",
165
- authority: "export",
166
- helpMsg:
167
- "如果选择了数据,则按选择数据导出;\n没有选择数据,则根据查询条件导出",
168
- priority: 150,
169
- funcName: (actionName: string) => btnOperation(actionName),
170
- });
171
- arr.push({
172
- btnName: "批量删除",
173
- icon: "batch_delete1",
174
- authority: "batchDelete",
175
- priority: 160,
176
- funcName: (actionName: string) => btnOperation(actionName),
177
- });
178
- //自定义按钮,如果时自定义按钮,则覆盖原有的按钮
179
- if (props.extendBtns?.length > 0) {
180
- let extBtns: UserFuncInfo[] =
181
- props.extendBtns.filter((item) => item.position == "toolbar") || [];
182
- if (extBtns?.length > 0) {
183
- for (let i = 0; i < arr.length; i++) {
184
- let temp: UserFuncInfo = arr[i];
185
- if (
186
- extBtns.find(
187
- (item: UserFuncInfo) =>
188
- item.btnName == temp.btnName && item.authority == temp.authority,
189
- )
190
- ) {
191
- arr.splice(i, 1);
192
- }
193
- }
194
- arr.push(...extBtns);
195
- }
196
- }
197
- arr.sort(
198
- (a: UserFuncInfo, b: UserFuncInfo) =>
199
- (a.priority || 100) - (b.priority || 100),
200
- );
201
- return arr;
202
- };
203
- const setFormData = (val: any) => {
204
- dataForm.value = {...val};
205
- };
206
- /**
207
- * 获取授权按钮长度
208
- */
209
- const authBtnLength = () => {
210
- const result = buttonList.value.filter((item) => permissions.value[item.authority]) || [];
211
- return result.length;
212
- };
213
- const init = async () => {
214
- };
215
- onMounted(() => {
216
- init();
217
- });
218
- defineExpose({
219
- setFormData,
220
- });
221
- </script>
222
- <template>
223
- <template v-if="showType == 'dropdown' && Object.keys(permissions || {}).length > 0&&authBtnLength()>3">
224
- <el-menu mode="horizontal" :ellipsis="false">
225
- <el-sub-menu index="1">
226
- <template #title>
227
- <el-tooltip content="操作" placement="top">
228
- <star-horse-icon icon-class="operation" size="16px" cursor="pointer"/>
229
- </el-tooltip>
230
- </template>
231
- <template v-for="(item, index) in buttonList" :key="compKey(item, index)">
232
- <template v-if="item.children?.length > 0">
233
- <el-sub-menu :index="'2-' + index" v-if="permissions[item.authority]">
234
- <template #title>
235
- {{ item.btnName }}
236
- </template>
237
- <template v-for="(sitem, sindex) in item.children" :key="compKey(sitem, sindex)">
238
- <el-menu-item :index="'3-' + index + '-' + sindex" @click="sitem.funcName(sitem.authority)"
239
- v-if="permissions[sitem.authority]">
240
- <star-horse-icon :icon-class="item.icon || 'edit'" :color="item.authority == 'delete' ||
241
- item.authority == 'batchDelete'
242
- ? 'var(--el-style-danger)'
243
- : 'var(--star-horse-style)'
244
- " size="14px"/>
245
- {{ sitem.btnName }}
246
- <help :message="sitem.helpMsg" v-if="sitem.helpMsg"/>
247
- </el-menu-item>
248
- </template>
249
- </el-sub-menu>
250
- </template>
251
- <template v-else>
252
- <el-menu-item :index="'1-' + index" v-if="permissions[item.authority]">
253
- <el-upload :auto-upload="true" :on-change="upload" :on-error="uploadError" :on-progress="uploadProcess"
254
- :on-success="uploadSuccess" :show-file-list="false" accept=".xls,.xlsx"
255
- :before-upload="beforeUpload"
256
- :action="compUrl?.importUrl" :headers="{ token: getToken() }"
257
- class="upload flex items-center w-[100%]"
258
- name="file" v-if="item.authority == 'upload'">
259
- <div class="flex items-center w-[100%]">
260
- <star-horse-icon icon-class="excel-upload" size="14px"/>
261
- {{ item.btnName }}
262
- </div>
263
- </el-upload>
264
- <div class="flex items-center w-[100%]" @click="item.funcName(item.authority)" v-else>
265
- <star-horse-icon :icon-class="item.icon || 'edit'" :color="item.authority == 'delete' || item.authority == 'batchDelete'
266
- ? 'var(--el-color-danger)'
267
- : 'var(--star-horse-style)'
268
- " size="14px"/>
269
- {{ item.btnName }}
270
- <help :message="item.helpMsg" v-if="item.helpMsg"/>
271
- </div>
272
- </el-menu-item>
273
- </template>
274
- </template>
275
- </el-sub-menu>
276
- </el-menu>
277
- </template>
278
- <template v-else-if="Object.keys(permissions || {}).length > 0">
279
- <ul class="inner_button">
280
- <template v-for="(item, key) in buttonList" :key="compKey(item, key)">
281
- <template v-if="item.children?.length > 0">
282
- <el-dropdown :size="compSize" split-button style="
283
- background: var(--star-horse-style);
284
- color: var(--star-horse-white);
285
- " placement="top-start" v-if="permissions[item.authority]">
286
- <star-horse-icon :icon-class="item.icon" size="18px"/>
287
- {{ item.btnName }}
288
- <template #dropdown>
289
- <el-dropdown-menu>
290
- <template v-for="(sitem, skey) in item.children" :key="compKey(sitem, skey)">
291
- <el-dropdown-item v-if="permissions[sitem.authority]" @click="sitem.funcName(sitem.btnName)">
292
- <star-horse-icon :icon-class="item.icon || 'edit'" size="18px" :color="item.authority == 'delete' ||
293
- item.authority == 'batchDelete'
294
- ? '#f56c6c'
295
- : 'var(--star-horse-style)'
296
- "/>
297
- {{ sitem.btnName }}
298
- <help :message="sitem.helpMsg" v-if="sitem.helpMsg"/>
299
- </el-dropdown-item>
300
- </template>
301
- </el-dropdown-menu>
302
- </template>
303
- </el-dropdown>
304
- </template>
305
- <template v-else>
306
- <li v-if="permissions[item.authority] && item.authority == 'upload'">
307
- <el-upload :auto-upload="true" :on-change="upload" :on-error="uploadError" :on-progress="uploadProcess"
308
- :on-success="uploadSuccess" :show-file-list="false" accept=".xls,.xlsx"
309
- :before-upload="beforeUpload"
310
- :action="compUrl?.importUrl" :headers="{ token: getToken() }" class="upload" name="file"
311
- title="导入">
312
- <star-horse-icon title="导入" width="27px" size="18px" icon-class="excel-upload"/>
313
- </el-upload>
314
- </li>
315
- <li v-else-if="permissions[item.authority]" @click="item.funcName(item.authority)" :title="item.btnName">
316
- <star-horse-icon :icon-class="item.icon || 'edit'" :title="item.btnName" size="18px" width="27px" :color="item.authority == 'delete' || item.authority == 'batchDelete'
317
- ? '#f56c6c'
318
- : 'var(--star-horse-style)'
319
- "/>
320
- <help :message="item.helpMsg" v-if="item.helpMsg"/>
321
- </li>
322
- </template>
323
- </template>
324
- </ul>
325
- </template>
326
- </template>
327
- <style lang="scss" scoped>
328
- :deep(.el-tooltip__trigger:focus-visible) {
329
- outline: unset;
330
- }
331
-
332
- .el-menu {
333
- background: none;
334
- border-bottom: none;
335
- }
336
-
337
- :deep(.el-sub-menu) {
338
- background: none;
339
- }
340
-
341
- .el-menu--horizontal {
342
- height: 30px;
343
- }
344
- </style>
@@ -1,97 +0,0 @@
1
- <script setup lang="ts" name="StarHorseHmenu">
2
- import { ModelRef, onMounted, PropType } from "vue";
3
- import MenuItem from "@/components/menu/MenuItem.vue";
4
- import { compKey } from "@/api/system";
5
- defineProps({
6
- preps: {
7
- type: Object as PropType<any>,
8
- default: () => {
9
- return {
10
- id: "id",
11
- value: "value",
12
- icon: "icon",
13
- label: "name",
14
- children: "children",
15
- };
16
- },
17
- },
18
- });
19
- const emits = defineEmits(["selectItem"]);
20
- let dataList: ModelRef<any> = defineModel("dataList");
21
- const initData = async () => {};
22
- const selectItem = (item: any) => {
23
- emits("selectItem", item);
24
- };
25
- onMounted(() => {
26
- initData();
27
- });
28
- </script>
29
- <template>
30
- <el-menu class="system-menu" v-bind="$attrs">
31
- <MenuItem
32
- v-for="(sitem, key) in dataList"
33
- :key="compKey(sitem, key)"
34
- :item="sitem"
35
- @selectItem="selectItem"
36
- :preps="preps"
37
- />
38
- </el-menu>
39
- </template>
40
- <style lang="scss" scoped>
41
- .el-menu--horizontal {
42
- .el-menu-item {
43
- height: inherit;
44
- }
45
-
46
- .el-menu-item.is-active,
47
- .el-menu-item:hover,
48
- .el-submenu__title:hover,
49
- .el-submenu__title.is-opened {
50
- background-color: unset !important;
51
- }
52
- }
53
-
54
- :deep(.el-submenu__title:hover),
55
- :deep(.el-sub-menu:hover),
56
- .el-tooltip__trigger:hover,
57
- .el-submenu__title.is-opened {
58
- background-color: unset !important;
59
- }
60
-
61
- .sub-class:hover {
62
- background-color: unset !important;
63
- }
64
-
65
- .system-menu {
66
- --el-menu-bg-color: #fff;
67
- --el-menu-text-color: #eee;
68
- --el-menu-active-color: #ffd04b;
69
- --el-menu-hover-bg-color: rgb(245, 235, 255, 0.5);
70
- max-height: 50px;
71
- background-color: unset !important;
72
- width: 100% !important;
73
- border-bottom: unset !important;
74
- color: var(--star-horse-white);
75
- font-weight: bold;
76
- font-size: 16px;
77
- align-items: center;
78
- }
79
-
80
- :deep(.el-sub-menu) {
81
- box-sizing: border-box;
82
- background-color: unset !important;
83
- }
84
-
85
- .star-icon {
86
- font-size: 26px;
87
- color: var(--star-horse-white);
88
- }
89
-
90
- :deep(.el-icon) {
91
- svg {
92
- height: 1.5em;
93
- width: 1.5em;
94
- color: var(--star-horse-white) !important;
95
- }
96
- }
97
- </style>