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.
- package/README.md +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +491 -253
- package/package.json +1 -1
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.eslintrc-auto-import.json +0 -77
- package/.gitignore +0 -27
- package/.idea/.gitignore +0 -5
- package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/testcode.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/workspace.xml +0 -207
- package/.npmignore +0 -21
- package/.prettierignore +0 -26
- package/auto-imports.d.ts +0 -137
- package/components.d.ts +0 -189
- package/eslint.config.js +0 -37
- package/index.html +0 -14
- package/package-lock.json +0 -8276
- package/prettier.config.js +0 -20
- package/public/logo.svg +0 -660
- package/src/App.vue +0 -11
- package/src/api/date_utils.ts +0 -219
- package/src/api/finger_utils.ts +0 -71
- package/src/api/form_utils.ts +0 -281
- package/src/api/jquery.min.js +0 -2
- package/src/api/pcas-code.json +0 -1
- package/src/api/settings.ts +0 -81
- package/src/api/star_horse_apis.ts +0 -196
- package/src/api/star_horse_utils.ts +0 -797
- package/src/api/system.ts +0 -351
- package/src/api/user_func.ts +0 -147
- package/src/api/valid_utils.ts +0 -165
- package/src/assets/css/index.scss +0 -908
- package/src/assets/icons.css +0 -574
- package/src/assets/star-horse-icons.woff +0 -0
- package/src/components/comp/ShDynamicForm.vue +0 -160
- package/src/components/comp/ShForm.vue +0 -30
- package/src/components/comp/ShTableListColumn.vue +0 -61
- package/src/components/comp/StarHorseDataSelector.vue +0 -139
- package/src/components/comp/StarHorseDataView.vue +0 -110
- package/src/components/comp/StarHorseDataViewItems.vue +0 -61
- package/src/components/comp/StarHorseDataViewTable.vue +0 -102
- package/src/components/comp/StarHorseDialog.vue +0 -383
- package/src/components/comp/StarHorseDraggable.vue +0 -401
- package/src/components/comp/StarHorseForm.vue +0 -458
- package/src/components/comp/StarHorseFormItem.vue +0 -82
- package/src/components/comp/StarHorseFormList.vue +0 -516
- package/src/components/comp/StarHorseFormTable.vue +0 -56
- package/src/components/comp/StarHorseIcon.vue +0 -76
- package/src/components/comp/StarHorseItem.vue +0 -302
- package/src/components/comp/StarHorseJsonEditor.vue +0 -115
- package/src/components/comp/StarHorsePopover.vue +0 -66
- package/src/components/comp/StarHorseSearchComp.vue +0 -253
- package/src/components/comp/StarHorseStaticTable.vue +0 -395
- package/src/components/comp/StarHorseTableColumn.vue +0 -249
- package/src/components/comp/StarHorseTableComp.vue +0 -1193
- package/src/components/comp/StarHorseTableViewColumn.vue +0 -61
- package/src/components/comp/StarHorseTree.vue +0 -494
- package/src/components/comp/index.ts +0 -22
- package/src/components/comp/items/UTableColumn.vue +0 -65
- package/src/components/comp/items/boxItem.vue +0 -98
- package/src/components/comp/items/callitem.ts +0 -9
- package/src/components/comp/items/cardItem.vue +0 -152
- package/src/components/comp/items/collapseItem.vue +0 -134
- package/src/components/comp/items/dytableItem.vue +0 -135
- package/src/components/comp/items/otherItem.vue +0 -65
- package/src/components/comp/items/tabItem.vue +0 -155
- package/src/components/comp/items/tabPanelItem.vue +0 -110
- package/src/components/comp/items/tableColumn.vue +0 -129
- package/src/components/comp/items/tableItem.vue +0 -97
- package/src/components/comp/items/tablebtn.vue +0 -158
- package/src/components/comp/items/viewBoxItem.vue +0 -55
- package/src/components/comp/items/viewCardItem.vue +0 -47
- package/src/components/comp/items/viewCollapseItem.vue +0 -71
- package/src/components/comp/items/viewDytableItem.vue +0 -77
- package/src/components/comp/items/viewOtherItem.vue +0 -55
- package/src/components/comp/items/viewTabItem.vue +0 -77
- package/src/components/comp/items/viewTabPanelItem.vue +0 -54
- package/src/components/comp/items/viewTableItem.vue +0 -74
- package/src/components/comp/selfcomp.ts +0 -9
- package/src/components/comp/utils/DataPicker.vue +0 -302
- package/src/components/comp/utils/DataTag.vue +0 -51
- package/src/components/cron/Crontab-Day.vue +0 -230
- package/src/components/cron/Crontab-Hour.vue +0 -165
- package/src/components/cron/Crontab-Min.vue +0 -166
- package/src/components/cron/Crontab-Month.vue +0 -166
- package/src/components/cron/Crontab-Result.vue +0 -615
- package/src/components/cron/Crontab-Second.vue +0 -185
- package/src/components/cron/Crontab-Week.vue +0 -208
- package/src/components/cron/Crontab-Year.vue +0 -183
- package/src/components/cron/Crontab.vue +0 -474
- package/src/components/enums/ModuleEnums.ts +0 -10
- package/src/components/enums/ServiceEnums.ts +0 -18
- package/src/components/formcomp/container/box-container.vue +0 -162
- package/src/components/formcomp/container/callitem.ts +0 -9
- package/src/components/formcomp/container/card-container.vue +0 -170
- package/src/components/formcomp/container/collapse-container.vue +0 -133
- package/src/components/formcomp/container/dytable-col.vue +0 -448
- package/src/components/formcomp/container/dytable-container.vue +0 -57
- package/src/components/formcomp/container/dytableUtils.ts +0 -358
- package/src/components/formcomp/container/group-box-container.vue +0 -331
- package/src/components/formcomp/container/index.ts +0 -6
- package/src/components/formcomp/container/tab-container.vue +0 -153
- package/src/components/formcomp/container/table-container.vue +0 -249
- package/src/components/formcomp/items/allitem.ts +0 -9
- package/src/components/formcomp/items/area-item.vue +0 -116
- package/src/components/formcomp/items/audio-item.vue +0 -163
- package/src/components/formcomp/items/autocomplete-item.vue +0 -118
- package/src/components/formcomp/items/barcode-item.vue +0 -87
- package/src/components/formcomp/items/base-json-item.vue +0 -207
- package/src/components/formcomp/items/button-item.vue +0 -228
- package/src/components/formcomp/items/cascade-item.vue +0 -113
- package/src/components/formcomp/items/checkbox-item.vue +0 -97
- package/src/components/formcomp/items/color-item.vue +0 -70
- package/src/components/formcomp/items/cron-item.vue +0 -115
- package/src/components/formcomp/items/datetime-item.vue +0 -99
- package/src/components/formcomp/items/depart-item.vue +0 -51
- package/src/components/formcomp/items/dialog-input-item.vue +0 -207
- package/src/components/formcomp/items/divider-item.vue +0 -66
- package/src/components/formcomp/items/html-item.vue +0 -65
- package/src/components/formcomp/items/htmleditor-item.vue +0 -104
- package/src/components/formcomp/items/icon-item.vue +0 -195
- package/src/components/formcomp/items/image-item.vue +0 -247
- package/src/components/formcomp/items/index.ts +0 -44
- package/src/components/formcomp/items/input-item.vue +0 -150
- package/src/components/formcomp/items/json-array-item.vue +0 -67
- package/src/components/formcomp/items/json-item.vue +0 -66
- package/src/components/formcomp/items/markdown-item.vue +0 -77
- package/src/components/formcomp/items/number-item.vue +0 -94
- package/src/components/formcomp/items/number-range-item.vue +0 -278
- package/src/components/formcomp/items/page-select-item.vue +0 -407
- package/src/components/formcomp/items/password-item.vue +0 -71
- package/src/components/formcomp/items/qrcode-item.vue +0 -84
- package/src/components/formcomp/items/radio-item.vue +0 -112
- package/src/components/formcomp/items/rate-item.vue +0 -68
- package/src/components/formcomp/items/select-item.vue +0 -133
- package/src/components/formcomp/items/signature-item.vue +0 -216
- package/src/components/formcomp/items/slider-item.vue +0 -68
- package/src/components/formcomp/items/starhorse-form-item.vue +0 -334
- package/src/components/formcomp/items/switch-item.vue +0 -77
- package/src/components/formcomp/items/tag-item.vue +0 -77
- package/src/components/formcomp/items/text-item.vue +0 -75
- package/src/components/formcomp/items/textarea-item.vue +0 -85
- package/src/components/formcomp/items/time-item.vue +0 -77
- package/src/components/formcomp/items/time-picker-item.vue +0 -74
- package/src/components/formcomp/items/transfer-item.vue +0 -93
- package/src/components/formcomp/items/tselect-item.vue +0 -121
- package/src/components/formcomp/items/unknown-item.vue +0 -51
- package/src/components/formcomp/items/upload-item.vue +0 -189
- package/src/components/formcomp/items/user-item.vue +0 -177
- package/src/components/formcomp/items/usercomp-item.vue +0 -85
- package/src/components/formcomp/items/view-markdown-item.vue +0 -77
- package/src/components/formcomp/utils/EditDataDialog.vue +0 -67
- package/src/components/formcomp/utils/FieldList.vue +0 -125
- package/src/components/formcomp/utils/ItemRelationEventUtils.ts +0 -284
- package/src/components/help.vue +0 -31
- package/src/components/menu/MenuItem.vue +0 -95
- package/src/components/menu/SubMenu.vue +0 -68
- package/src/components/menu/SubSystemMenu.vue +0 -142
- package/src/components/register.ts +0 -24
- package/src/components/system/ContentMenu.vue +0 -260
- package/src/components/system/StarHorseButtonList.vue +0 -344
- package/src/components/system/StarHorseMenu.vue +0 -97
- package/src/components/system/StarHorseSvg.vue +0 -62
- package/src/components/system/SystemComp.ts +0 -9
- package/src/components/system/index.ts +0 -4
- package/src/components/types/ApiUrls.ts +0 -168
- package/src/components/types/BtnAction.ts +0 -51
- package/src/components/types/BtnAuth.ts +0 -43
- package/src/components/types/CompInfo.ts +0 -81
- package/src/components/types/DialogProps.ts +0 -55
- package/src/components/types/DyCompField.ts +0 -23
- package/src/components/types/DynamicNode.ts +0 -42
- package/src/components/types/MenusInfo.ts +0 -45
- package/src/components/types/PageFieldInfo.ts +0 -530
- package/src/components/types/PageProps.ts +0 -25
- package/src/components/types/Params.ts +0 -93
- package/src/components/types/RuleType.ts +0 -10
- package/src/components/types/SearchProps.ts +0 -42
- package/src/components/types/ShortKey.ts +0 -30
- package/src/components/types/StarHorseType.ts +0 -18
- package/src/components/types/index.ts +0 -15
- package/src/config/element.ts +0 -15
- package/src/config/styles.ts +0 -4
- package/src/index.ts +0 -98
- package/src/install.ts +0 -33
- package/src/lang/en_US.ts +0 -81
- package/src/lang/index.ts +0 -35
- package/src/lang/zh_CN.ts +0 -84
- package/src/main.ts +0 -57
- package/src/plugins/AblesPlugin.ts +0 -618
- package/src/plugins/registerCompPlugin.ts +0 -15
- package/src/sample/test.vue +0 -9
- package/src/store/ButtonPermission.ts +0 -101
- package/src/store/ConsumerView.ts +0 -52
- package/src/store/ContinusConfig.ts +0 -78
- package/src/store/CopyerOperation.ts +0 -74
- package/src/store/DesignForm.ts +0 -481
- package/src/store/DesignPage.ts +0 -59
- package/src/store/DynamicForm.ts +0 -241
- package/src/store/GlobalConfig.ts +0 -90
- package/src/store/SelfOperation.ts +0 -95
- package/src/store/UserInfo.ts +0 -88
- package/src/store/index.ts +0 -6
- package/src/theme/localStorge.ts +0 -16
- package/src/theme/theme.ts +0 -27
- package/src/utils/FieldOperationUtils.ts +0 -91
- package/src/utils/auth.ts +0 -83
- package/src/utils/message.ts +0 -69
- package/src/utils/preview.ts +0 -125
- package/tsconfig.json +0 -39
- package/tsconfig.node.json +0 -10
- package/vite-env.d.ts +0 -16
- package/vite.config.ts +0 -162
- 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>
|