@kevairy/template 0.1.0
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/LICENSE +21 -0
- package/README.md +14 -0
- package/package.json +37 -0
- package/template/.env +22 -0
- package/template/.env.development +13 -0
- package/template/.env.production +10 -0
- package/template/.prettierignore +3 -0
- package/template/.prettierrc +20 -0
- package/template/.stylelintignore +9 -0
- package/template/.stylelintrc.cjs +84 -0
- package/template/LICENSE +21 -0
- package/template/README.md +22 -0
- package/template/_gitignore +19 -0
- package/template/eslint-auto-import.json +324 -0
- package/template/eslint.config.mjs +83 -0
- package/template/index.html +25 -0
- package/template/package.json +79 -0
- package/template/playwright.config.ts +25 -0
- package/template/public/favicon.ico +0 -0
- package/template/src/App.vue +39 -0
- package/template/src/adapters/auth/index.ts +9 -0
- package/template/src/adapters/auth/mock.ts +10 -0
- package/template/src/adapters/auth/types.ts +11 -0
- package/template/src/adapters/navigation/index.ts +13 -0
- package/template/src/adapters/navigation/types.ts +6 -0
- package/template/src/api/auth.ts +23 -0
- package/template/src/assets/images/avatar/avatar.webp +0 -0
- package/template/src/assets/images/avatar/avatar1.webp +0 -0
- package/template/src/assets/images/avatar/avatar10.webp +0 -0
- package/template/src/assets/images/avatar/avatar2.webp +0 -0
- package/template/src/assets/images/avatar/avatar3.webp +0 -0
- package/template/src/assets/images/avatar/avatar4.webp +0 -0
- package/template/src/assets/images/avatar/avatar5.webp +0 -0
- package/template/src/assets/images/avatar/avatar6.webp +0 -0
- package/template/src/assets/images/avatar/avatar7.webp +0 -0
- package/template/src/assets/images/avatar/avatar8.webp +0 -0
- package/template/src/assets/images/avatar/avatar9.webp +0 -0
- package/template/src/assets/images/ceremony/hb.png +0 -0
- package/template/src/assets/images/ceremony/sd.png +0 -0
- package/template/src/assets/images/ceremony/xc.png +0 -0
- package/template/src/assets/images/ceremony/yd.png +0 -0
- package/template/src/assets/images/common/logo.webp +0 -0
- package/template/src/assets/images/draw/draw1.png +0 -0
- package/template/src/assets/images/favicon.ico +0 -0
- package/template/src/assets/images/lock/bg_dark.webp +0 -0
- package/template/src/assets/images/lock/bg_light.webp +0 -0
- package/template/src/assets/images/login/kylin-hero-source.png +0 -0
- package/template/src/assets/images/login/lf_icon2.webp +0 -0
- package/template/src/assets/images/settings/menu_layouts/dual_column.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/horizontal.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/mixed.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/vertical.png +0 -0
- package/template/src/assets/images/settings/menu_styles/dark.png +0 -0
- package/template/src/assets/images/settings/menu_styles/design.png +0 -0
- package/template/src/assets/images/settings/menu_styles/light.png +0 -0
- package/template/src/assets/images/settings/theme_styles/dark.png +0 -0
- package/template/src/assets/images/settings/theme_styles/light.png +0 -0
- package/template/src/assets/images/settings/theme_styles/system.png +0 -0
- package/template/src/assets/images/svg/403.svg +1 -0
- package/template/src/assets/images/svg/404.svg +1 -0
- package/template/src/assets/images/svg/500.svg +5 -0
- package/template/src/assets/images/svg/login_icon.svg +1 -0
- package/template/src/assets/images/user/avatar.webp +0 -0
- package/template/src/assets/images/user/bg.webp +0 -0
- package/template/src/assets/styles/core/app.scss +227 -0
- package/template/src/assets/styles/core/dark.scss +93 -0
- package/template/src/assets/styles/core/el-dark.scss +2 -0
- package/template/src/assets/styles/core/el-light.scss +34 -0
- package/template/src/assets/styles/core/el-ui.scss +519 -0
- package/template/src/assets/styles/core/md.scss +1036 -0
- package/template/src/assets/styles/core/mixin.scss +157 -0
- package/template/src/assets/styles/core/reset.scss +41 -0
- package/template/src/assets/styles/core/router-transition.scss +104 -0
- package/template/src/assets/styles/core/tailwind.css +219 -0
- package/template/src/assets/styles/core/theme-animation.scss +63 -0
- package/template/src/assets/styles/core/theme-change.scss +11 -0
- package/template/src/assets/styles/custom/one-dark-pro.scss +98 -0
- package/template/src/assets/styles/index.scss +23 -0
- package/template/src/assets/svg/loading.ts +32 -0
- package/template/src/bootstrap/initializeApp.ts +30 -0
- package/template/src/components/core/banners/art-basic-banner/index.vue +343 -0
- package/template/src/components/core/banners/art-card-banner/index.vue +114 -0
- package/template/src/components/core/base/art-back-to-top/index.vue +40 -0
- package/template/src/components/core/base/art-logo/index.vue +34 -0
- package/template/src/components/core/base/art-svg-icon/index.vue +24 -0
- package/template/src/components/core/cards/art-bar-chart-card/index.vue +103 -0
- package/template/src/components/core/cards/art-data-list-card/index.vue +74 -0
- package/template/src/components/core/cards/art-donut-chart-card/index.vue +124 -0
- package/template/src/components/core/cards/art-image-card/index.vue +89 -0
- package/template/src/components/core/cards/art-line-chart-card/index.vue +126 -0
- package/template/src/components/core/cards/art-progress-card/index.vue +86 -0
- package/template/src/components/core/cards/art-stats-card/index.vue +67 -0
- package/template/src/components/core/cards/art-timeline-list-card/index.vue +69 -0
- package/template/src/components/core/charts/art-bar-chart/index.vue +203 -0
- package/template/src/components/core/charts/art-dual-bar-compare-chart/index.vue +195 -0
- package/template/src/components/core/charts/art-h-bar-chart/index.vue +208 -0
- package/template/src/components/core/charts/art-k-line-chart/index.vue +152 -0
- package/template/src/components/core/charts/art-line-chart/index.vue +371 -0
- package/template/src/components/core/charts/art-radar-chart/index.vue +105 -0
- package/template/src/components/core/charts/art-ring-chart/index.vue +133 -0
- package/template/src/components/core/charts/art-scatter-chart/index.vue +115 -0
- package/template/src/components/core/feedback/art-page-loading/index.vue +281 -0
- package/template/src/components/core/forms/art-button-more/index.vue +71 -0
- package/template/src/components/core/forms/art-button-table/index.vue +59 -0
- package/template/src/components/core/forms/art-drag-verify/index.vue +430 -0
- package/template/src/components/core/forms/art-excel-export/index.vue +390 -0
- package/template/src/components/core/forms/art-excel-import/index.vue +62 -0
- package/template/src/components/core/forms/art-form/index.vue +507 -0
- package/template/src/components/core/forms/art-wang-editor/index.vue +261 -0
- package/template/src/components/core/forms/art-wang-editor/style.scss +273 -0
- package/template/src/components/core/layouts/art-breadcrumb/index.vue +142 -0
- package/template/src/components/core/layouts/art-chat-window/index.vue +262 -0
- package/template/src/components/core/layouts/art-fast-enter/index.vue +113 -0
- package/template/src/components/core/layouts/art-fireworks-effect/index.vue +633 -0
- package/template/src/components/core/layouts/art-global-component/index.vue +14 -0
- package/template/src/components/core/layouts/art-global-search/index.vue +431 -0
- package/template/src/components/core/layouts/art-header-bar/index.vue +485 -0
- package/template/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +118 -0
- package/template/src/components/core/layouts/art-menus/art-horizontal-menu/index.vue +110 -0
- package/template/src/components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.vue +106 -0
- package/template/src/components/core/layouts/art-menus/art-mixed-menu/index.vue +279 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/index.vue +354 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/style.scss +251 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/theme.scss +258 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue +190 -0
- package/template/src/components/core/layouts/art-notification/index.vue +456 -0
- package/template/src/components/core/layouts/art-page-content/index.vue +137 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsConfig.ts +248 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsHandlers.ts +167 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsPanel.ts +233 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsState.ts +37 -0
- package/template/src/components/core/layouts/art-settings-panel/index.vue +72 -0
- package/template/src/components/core/layouts/art-settings-panel/style.scss +92 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/BasicSettings.vue +77 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/BoxStyleSettings.vue +38 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ColorSettings.vue +35 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ContainerSettings.vue +33 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/MenuLayoutSettings.vue +31 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/MenuStyleSettings.vue +44 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SectionTitle.vue +17 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +236 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingDrawer.vue +51 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingHeader.vue +18 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingItem.vue +101 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ThemeSettings.vue +28 -0
- package/template/src/components/core/layouts/art-work-tab/index.vue +584 -0
- package/template/src/components/core/media/art-cutter-img/index.vue +350 -0
- package/template/src/components/core/media/art-video-player/index.vue +111 -0
- package/template/src/components/core/others/art-menu-right/index.vue +415 -0
- package/template/src/components/core/others/art-watermark/index.vue +64 -0
- package/template/src/components/core/text-effect/art-count-to/index.vue +310 -0
- package/template/src/components/core/text-effect/art-festival-text-scroll/index.vue +32 -0
- package/template/src/components/core/text-effect/art-text-scroll/index.vue +285 -0
- package/template/src/components/core/theme/theme-svg/index.vue +100 -0
- package/template/src/components/core/views/exception/ArtException.vue +55 -0
- package/template/src/components/core/views/login/AuthTopBar.vue +149 -0
- package/template/src/components/core/views/login/LoginLeftView.vue +602 -0
- package/template/src/components/core/views/result/ArtResultPage.vue +43 -0
- package/template/src/components/core/widget/art-icon-button/index.vue +23 -0
- package/template/src/config/assets/images.ts +61 -0
- package/template/src/config/index.ts +170 -0
- package/template/src/config/modules/component.ts +98 -0
- package/template/src/config/modules/fastEnter.ts +16 -0
- package/template/src/config/modules/festival.ts +51 -0
- package/template/src/config/modules/headerBar.ts +64 -0
- package/template/src/config/setting.ts +109 -0
- package/template/src/directives/core/auth.ts +66 -0
- package/template/src/directives/core/highlight-loader.ts +37 -0
- package/template/src/directives/core/highlight.ts +253 -0
- package/template/src/directives/core/ripple.ts +116 -0
- package/template/src/directives/core/roles.ts +87 -0
- package/template/src/directives/index.ts +14 -0
- package/template/src/enums/appEnum.ts +81 -0
- package/template/src/enums/formEnum.ts +17 -0
- package/template/src/env.d.ts +32 -0
- package/template/src/hooks/core/useAppMode.ts +45 -0
- package/template/src/hooks/core/useAuth.ts +74 -0
- package/template/src/hooks/core/useCeremony.ts +184 -0
- package/template/src/hooks/core/useChart.ts +745 -0
- package/template/src/hooks/core/useCommon.ts +87 -0
- package/template/src/hooks/core/useFastEnter.ts +55 -0
- package/template/src/hooks/core/useHeaderBar.ts +201 -0
- package/template/src/hooks/core/useLayoutHeight.ts +148 -0
- package/template/src/hooks/core/useTableColumns.ts +313 -0
- package/template/src/hooks/core/useTheme.ts +174 -0
- package/template/src/hooks/index.ts +29 -0
- package/template/src/locales/index.ts +123 -0
- package/template/src/locales/langs/en.json +283 -0
- package/template/src/locales/langs/zh.json +283 -0
- package/template/src/main.ts +29 -0
- package/template/src/mock/auth.ts +46 -0
- package/template/src/plugins/echarts.ts +76 -0
- package/template/src/plugins/index.ts +6 -0
- package/template/src/router/core/ComponentLoader.ts +82 -0
- package/template/src/router/core/IframeRouteManager.ts +78 -0
- package/template/src/router/core/MenuProcessor.ts +280 -0
- package/template/src/router/core/RoutePermissionValidator.ts +161 -0
- package/template/src/router/core/RouteRegistry.ts +90 -0
- package/template/src/router/core/RouteTransformer.ts +132 -0
- package/template/src/router/core/RouteValidator.ts +187 -0
- package/template/src/router/core/index.ts +14 -0
- package/template/src/router/guards/afterEach.ts +34 -0
- package/template/src/router/guards/beforeEach.ts +442 -0
- package/template/src/router/index.ts +24 -0
- package/template/src/router/modules/dashboard.ts +23 -0
- package/template/src/router/modules/examples.ts +109 -0
- package/template/src/router/modules/exception.ts +46 -0
- package/template/src/router/modules/index.ts +12 -0
- package/template/src/router/modules/result.ts +32 -0
- package/template/src/router/routes/asyncRoutes.ts +9 -0
- package/template/src/router/routes/staticRoutes.ts +60 -0
- package/template/src/router/routesAlias.ts +8 -0
- package/template/src/services/auth.ts +15 -0
- package/template/src/store/index.ts +52 -0
- package/template/src/store/modules/menu.ts +109 -0
- package/template/src/store/modules/setting.ts +450 -0
- package/template/src/store/modules/user.ts +218 -0
- package/template/src/store/modules/worktab.ts +568 -0
- package/template/src/types/api/api.d.ts +86 -0
- package/template/src/types/common/index.ts +95 -0
- package/template/src/types/common/response.ts +32 -0
- package/template/src/types/component/chart.ts +324 -0
- package/template/src/types/component/index.ts +86 -0
- package/template/src/types/config/index.ts +253 -0
- package/template/src/types/directive/directive.d.ts +15 -0
- package/template/src/types/import/auto-imports.d.ts +319 -0
- package/template/src/types/import/components.d.ts +126 -0
- package/template/src/types/index.ts +22 -0
- package/template/src/types/router/index.ts +80 -0
- package/template/src/types/store/index.ts +157 -0
- package/template/src/utils/form/index.ts +9 -0
- package/template/src/utils/form/validator.ts +316 -0
- package/template/src/utils/http/contract.ts +39 -0
- package/template/src/utils/http/error.ts +182 -0
- package/template/src/utils/http/index.ts +226 -0
- package/template/src/utils/http/status.ts +18 -0
- package/template/src/utils/index.ts +31 -0
- package/template/src/utils/navigation/index.ts +10 -0
- package/template/src/utils/navigation/jump.ts +68 -0
- package/template/src/utils/navigation/route.ts +85 -0
- package/template/src/utils/navigation/worktab.ts +67 -0
- package/template/src/utils/router.ts +63 -0
- package/template/src/utils/socket/index.ts +423 -0
- package/template/src/utils/storage/index.ts +7 -0
- package/template/src/utils/storage/storage-config.ts +127 -0
- package/template/src/utils/storage/storage-key-manager.ts +97 -0
- package/template/src/utils/storage/storage.ts +250 -0
- package/template/src/utils/sys/console.ts +9 -0
- package/template/src/utils/sys/error-handle.ts +143 -0
- package/template/src/utils/sys/index.ts +2 -0
- package/template/src/utils/sys/mittBus.ts +61 -0
- package/template/src/utils/ui/animation.ts +80 -0
- package/template/src/utils/ui/colors.ts +273 -0
- package/template/src/utils/ui/emojo.ts +24 -0
- package/template/src/utils/ui/iconify-loader.ts +31 -0
- package/template/src/utils/ui/index.ts +11 -0
- package/template/src/utils/ui/loading.ts +158 -0
- package/template/src/utils/ui/tabs.ts +60 -0
- package/template/src/views/auth/forget-password/index.vue +62 -0
- package/template/src/views/auth/login/index.vue +166 -0
- package/template/src/views/auth/login/style.css +38 -0
- package/template/src/views/auth/register/index.vue +240 -0
- package/template/src/views/dashboard/console/index.vue +173 -0
- package/template/src/views/examples/analytics/index.vue +389 -0
- package/template/src/views/examples/complex-form/index.vue +395 -0
- package/template/src/views/examples/crud-workspace/index.vue +412 -0
- package/template/src/views/examples/navigation/detail/index.vue +151 -0
- package/template/src/views/examples/navigation/state/index.vue +226 -0
- package/template/src/views/examples/overview/index.vue +309 -0
- package/template/src/views/examples/permissions/index.vue +303 -0
- package/template/src/views/examples/search-table/index.vue +182 -0
- package/template/src/views/examples/search-table/search.config.ts +81 -0
- package/template/src/views/examples/search-table/service.ts +116 -0
- package/template/src/views/examples/search-table/table.config.ts +37 -0
- package/template/src/views/exception/403/index.vue +16 -0
- package/template/src/views/exception/404/index.vue +16 -0
- package/template/src/views/exception/500/index.vue +16 -0
- package/template/src/views/index/index.vue +29 -0
- package/template/src/views/index/style.scss +93 -0
- package/template/src/views/outside/Iframe.vue +42 -0
- package/template/src/views/result/fail/index.vue +28 -0
- package/template/src/views/result/success/index.vue +21 -0
- package/template/tests/e2e/auth.spec.ts +14 -0
- package/template/tests/e2e/search-table.spec.ts +154 -0
- package/template/tests/unit/adapters/auth.spec.ts +38 -0
- package/template/tests/unit/config/app-config.spec.ts +17 -0
- package/template/tests/unit/directives/highlight.spec.ts +20 -0
- package/template/tests/unit/http/contract.spec.ts +47 -0
- package/template/tests/unit/mock/search-table.spec.ts +62 -0
- package/template/tests/unit/router/examples.spec.ts +52 -0
- package/template/tsconfig.json +28 -0
- package/template/vite.config.ts +181 -0
- package/template/vitest.config.ts +27 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<!-- 环形图 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
ref="chartRef"
|
|
5
|
+
class="relative w-full"
|
|
6
|
+
:style="{ height: props.height }"
|
|
7
|
+
v-loading="props.loading"
|
|
8
|
+
>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import type { EChartsOption } from '@/plugins/echarts'
|
|
14
|
+
import { useChartOps, useChartComponent } from '@/hooks/core/useChart'
|
|
15
|
+
import type { RingChartProps } from '@/types/component/chart'
|
|
16
|
+
|
|
17
|
+
defineOptions({ name: 'ArtRingChart' })
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<RingChartProps>(), {
|
|
20
|
+
// 基础配置
|
|
21
|
+
height: useChartOps().chartHeight,
|
|
22
|
+
loading: false,
|
|
23
|
+
isEmpty: false,
|
|
24
|
+
colors: () => useChartOps().colors,
|
|
25
|
+
|
|
26
|
+
// 数据配置
|
|
27
|
+
data: () => [],
|
|
28
|
+
radius: () => ['50%', '80%'],
|
|
29
|
+
borderRadius: 10,
|
|
30
|
+
centerText: '',
|
|
31
|
+
showLabel: false,
|
|
32
|
+
|
|
33
|
+
// 交互配置
|
|
34
|
+
showTooltip: true,
|
|
35
|
+
showLegend: false,
|
|
36
|
+
legendPosition: 'right'
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// 使用新的图表组件抽象
|
|
40
|
+
const { chartRef, isDark, getAnimationConfig, getTooltipStyle, getLegendStyle } =
|
|
41
|
+
useChartComponent({
|
|
42
|
+
props,
|
|
43
|
+
checkEmpty: () => {
|
|
44
|
+
return !props.data?.length || props.data.every((item) => item.value === 0)
|
|
45
|
+
},
|
|
46
|
+
watchSources: [() => props.data, () => props.centerText],
|
|
47
|
+
generateOptions: (): EChartsOption => {
|
|
48
|
+
// 根据图例位置计算环形图中心位置
|
|
49
|
+
const getCenterPosition = (): [string, string] => {
|
|
50
|
+
if (!props.showLegend) return ['50%', '50%']
|
|
51
|
+
|
|
52
|
+
switch (props.legendPosition) {
|
|
53
|
+
case 'left':
|
|
54
|
+
return ['60%', '50%']
|
|
55
|
+
case 'right':
|
|
56
|
+
return ['40%', '50%']
|
|
57
|
+
case 'top':
|
|
58
|
+
return ['50%', '60%']
|
|
59
|
+
case 'bottom':
|
|
60
|
+
return ['50%', '40%']
|
|
61
|
+
default:
|
|
62
|
+
return ['50%', '50%']
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const option: EChartsOption = {
|
|
67
|
+
tooltip: props.showTooltip
|
|
68
|
+
? getTooltipStyle('item', {
|
|
69
|
+
formatter: '{b}: {c} ({d}%)'
|
|
70
|
+
})
|
|
71
|
+
: undefined,
|
|
72
|
+
legend: props.showLegend ? getLegendStyle(props.legendPosition) : undefined,
|
|
73
|
+
series: [
|
|
74
|
+
{
|
|
75
|
+
name: '数据占比',
|
|
76
|
+
type: 'pie',
|
|
77
|
+
radius: props.radius,
|
|
78
|
+
center: getCenterPosition(),
|
|
79
|
+
avoidLabelOverlap: false,
|
|
80
|
+
itemStyle: {
|
|
81
|
+
borderRadius: props.borderRadius,
|
|
82
|
+
borderColor: isDark.value ? '#2c2c2c' : '#fff',
|
|
83
|
+
borderWidth: 0
|
|
84
|
+
},
|
|
85
|
+
label: {
|
|
86
|
+
show: props.showLabel,
|
|
87
|
+
formatter: '{b}\n{d}%',
|
|
88
|
+
position: 'outside',
|
|
89
|
+
color: isDark.value ? '#ccc' : '#999',
|
|
90
|
+
fontSize: 12
|
|
91
|
+
},
|
|
92
|
+
emphasis: {
|
|
93
|
+
label: {
|
|
94
|
+
show: false,
|
|
95
|
+
fontSize: 14,
|
|
96
|
+
fontWeight: 'bold'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
labelLine: {
|
|
100
|
+
show: props.showLabel,
|
|
101
|
+
length: 15,
|
|
102
|
+
length2: 25,
|
|
103
|
+
smooth: true
|
|
104
|
+
},
|
|
105
|
+
data: props.data,
|
|
106
|
+
color: props.colors,
|
|
107
|
+
...getAnimationConfig(),
|
|
108
|
+
animationType: 'expansion'
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 添加中心文字
|
|
114
|
+
if (props.centerText) {
|
|
115
|
+
const centerPos = getCenterPosition()
|
|
116
|
+
option.title = {
|
|
117
|
+
text: props.centerText,
|
|
118
|
+
left: centerPos[0],
|
|
119
|
+
top: centerPos[1],
|
|
120
|
+
textAlign: 'center',
|
|
121
|
+
textVerticalAlign: 'middle',
|
|
122
|
+
textStyle: {
|
|
123
|
+
fontSize: 18,
|
|
124
|
+
fontWeight: 500,
|
|
125
|
+
color: isDark.value ? '#999' : '#ADB0BC'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return option
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
</script>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<!-- 散点图 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
ref="chartRef"
|
|
5
|
+
class="relative w-full"
|
|
6
|
+
:style="{ height: props.height }"
|
|
7
|
+
v-loading="props.loading"
|
|
8
|
+
>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import type { EChartsOption } from '@/plugins/echarts'
|
|
14
|
+
import { getCssVar } from '@/utils/ui'
|
|
15
|
+
import { useChartOps, useChartComponent } from '@/hooks/core/useChart'
|
|
16
|
+
import type { ScatterChartProps } from '@/types/component/chart'
|
|
17
|
+
|
|
18
|
+
defineOptions({ name: 'ArtScatterChart' })
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<ScatterChartProps>(), {
|
|
21
|
+
// 基础配置
|
|
22
|
+
height: useChartOps().chartHeight,
|
|
23
|
+
loading: false,
|
|
24
|
+
isEmpty: false,
|
|
25
|
+
colors: () => useChartOps().colors,
|
|
26
|
+
|
|
27
|
+
// 数据配置
|
|
28
|
+
data: () => [{ value: [0, 0] }, { value: [0, 0] }],
|
|
29
|
+
symbolSize: 14,
|
|
30
|
+
|
|
31
|
+
// 轴线显示配置
|
|
32
|
+
showAxisLabel: true,
|
|
33
|
+
showAxisLine: true,
|
|
34
|
+
showSplitLine: true,
|
|
35
|
+
|
|
36
|
+
// 交互配置
|
|
37
|
+
showTooltip: true,
|
|
38
|
+
showLegend: false,
|
|
39
|
+
legendPosition: 'bottom'
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// 使用新的图表组件抽象
|
|
43
|
+
const {
|
|
44
|
+
chartRef,
|
|
45
|
+
isDark,
|
|
46
|
+
getAxisLineStyle,
|
|
47
|
+
getAxisLabelStyle,
|
|
48
|
+
getAxisTickStyle,
|
|
49
|
+
getSplitLineStyle,
|
|
50
|
+
getAnimationConfig,
|
|
51
|
+
getTooltipStyle
|
|
52
|
+
} = useChartComponent({
|
|
53
|
+
props,
|
|
54
|
+
checkEmpty: () => {
|
|
55
|
+
return !props.data?.length || props.data.every((item) => item.value.every((val) => val === 0))
|
|
56
|
+
},
|
|
57
|
+
watchSources: [() => props.data, () => props.colors, () => props.symbolSize],
|
|
58
|
+
generateOptions: (): EChartsOption => {
|
|
59
|
+
const computedColor = props.colors[0] || getCssVar('--el-color-primary')
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
grid: {
|
|
63
|
+
top: 20,
|
|
64
|
+
right: 20,
|
|
65
|
+
bottom: 20,
|
|
66
|
+
left: 20,
|
|
67
|
+
containLabel: true
|
|
68
|
+
},
|
|
69
|
+
tooltip: props.showTooltip
|
|
70
|
+
? getTooltipStyle('item', {
|
|
71
|
+
formatter: (params: { value: [number, number] }) => {
|
|
72
|
+
const [x, y] = params.value
|
|
73
|
+
return `X: ${x}<br/>Y: ${y}`
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
: undefined,
|
|
77
|
+
xAxis: {
|
|
78
|
+
type: 'value',
|
|
79
|
+
axisLabel: getAxisLabelStyle(props.showAxisLabel),
|
|
80
|
+
axisLine: getAxisLineStyle(props.showAxisLine),
|
|
81
|
+
axisTick: getAxisTickStyle(),
|
|
82
|
+
splitLine: getSplitLineStyle(props.showSplitLine)
|
|
83
|
+
},
|
|
84
|
+
yAxis: {
|
|
85
|
+
type: 'value',
|
|
86
|
+
axisLabel: getAxisLabelStyle(props.showAxisLabel),
|
|
87
|
+
axisLine: getAxisLineStyle(props.showAxisLine),
|
|
88
|
+
axisTick: getAxisTickStyle(),
|
|
89
|
+
splitLine: getSplitLineStyle(props.showSplitLine)
|
|
90
|
+
},
|
|
91
|
+
series: [
|
|
92
|
+
{
|
|
93
|
+
type: 'scatter',
|
|
94
|
+
data: props.data,
|
|
95
|
+
symbolSize: props.symbolSize,
|
|
96
|
+
itemStyle: {
|
|
97
|
+
color: computedColor,
|
|
98
|
+
shadowBlur: 6,
|
|
99
|
+
shadowColor: isDark.value ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)',
|
|
100
|
+
shadowOffsetY: 2
|
|
101
|
+
},
|
|
102
|
+
emphasis: {
|
|
103
|
+
itemStyle: {
|
|
104
|
+
shadowBlur: 12,
|
|
105
|
+
shadowColor: isDark.value ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)'
|
|
106
|
+
},
|
|
107
|
+
scale: true
|
|
108
|
+
},
|
|
109
|
+
...getAnimationConfig()
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
</script>
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
'art-page-loading',
|
|
5
|
+
{
|
|
6
|
+
'art-page-loading--fullscreen': fullscreen,
|
|
7
|
+
'art-page-loading--leaving': leaving
|
|
8
|
+
},
|
|
9
|
+
className
|
|
10
|
+
]"
|
|
11
|
+
:style="loadingStyle"
|
|
12
|
+
role="status"
|
|
13
|
+
aria-live="polite"
|
|
14
|
+
:aria-label="text"
|
|
15
|
+
>
|
|
16
|
+
<div class="art-page-loading__content">
|
|
17
|
+
<div class="art-page-loading__logo" aria-hidden="true">
|
|
18
|
+
<slot name="logo">
|
|
19
|
+
<span class="art-page-loading__logo-svg" v-html="logo"></span>
|
|
20
|
+
</slot>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="art-page-loading__text" aria-hidden="true">
|
|
24
|
+
<span
|
|
25
|
+
v-for="(char, index) in textChars"
|
|
26
|
+
:key="`${char}-${index}`"
|
|
27
|
+
:class="['art-page-loading__char', `art-page-loading__char--${index % 6}`]"
|
|
28
|
+
:style="getCharStyle(index)"
|
|
29
|
+
>
|
|
30
|
+
{{ char === ' ' ? '\u00A0' : char }}
|
|
31
|
+
</span>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import type { CSSProperties } from 'vue'
|
|
39
|
+
import { computed } from 'vue'
|
|
40
|
+
import { fourDotsSpinnerSvg } from '@/assets/svg/loading'
|
|
41
|
+
|
|
42
|
+
interface PageLoadingProps {
|
|
43
|
+
text?: string
|
|
44
|
+
logo?: string
|
|
45
|
+
fullscreen?: boolean
|
|
46
|
+
className?: string
|
|
47
|
+
duration?: number
|
|
48
|
+
leaving?: boolean
|
|
49
|
+
exitDuration?: number
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const props = withDefaults(defineProps<PageLoadingProps>(), {
|
|
53
|
+
text: 'One Design Language',
|
|
54
|
+
logo: fourDotsSpinnerSvg,
|
|
55
|
+
fullscreen: true,
|
|
56
|
+
className: '',
|
|
57
|
+
duration: 2000,
|
|
58
|
+
leaving: false,
|
|
59
|
+
exitDuration: 220
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const textChars = computed(() => Array.from(props.text))
|
|
63
|
+
const safeDuration = computed(() => Math.max(props.duration, 1))
|
|
64
|
+
const charDelayStep = computed(() => {
|
|
65
|
+
const intervalCount = Math.max(textChars.value.length - 1, 1)
|
|
66
|
+
return (safeDuration.value * 0.2) / intervalCount
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const loadingStyle = computed(
|
|
70
|
+
() =>
|
|
71
|
+
({
|
|
72
|
+
'--art-page-loading-duration': `${safeDuration.value}ms`,
|
|
73
|
+
'--art-page-loading-exit-duration': `${Math.max(props.exitDuration, 0)}ms`
|
|
74
|
+
}) as CSSProperties
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
const getCharStyle = (index: number): CSSProperties =>
|
|
78
|
+
({
|
|
79
|
+
'--art-page-loading-delay': `${index * charDelayStep.value}ms`
|
|
80
|
+
}) as CSSProperties
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<style scoped lang="scss">
|
|
84
|
+
.art-page-loading {
|
|
85
|
+
--art-page-loading-duration: 2000ms;
|
|
86
|
+
--art-page-loading-exit-duration: 220ms;
|
|
87
|
+
--art-page-loading-background: #fff;
|
|
88
|
+
--art-page-loading-text-color: #666;
|
|
89
|
+
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
min-height: 180px;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
background: var(--art-page-loading-background);
|
|
96
|
+
opacity: 1;
|
|
97
|
+
transition: opacity var(--art-page-loading-exit-duration) cubic-bezier(0.4, 0, 1, 1);
|
|
98
|
+
will-change: opacity;
|
|
99
|
+
|
|
100
|
+
&--leaving {
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
opacity: 0;
|
|
103
|
+
|
|
104
|
+
.art-page-loading__content {
|
|
105
|
+
opacity: 0.92;
|
|
106
|
+
transform: translate3d(0, -3px, 0) scale(0.985);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&--fullscreen {
|
|
111
|
+
position: fixed;
|
|
112
|
+
inset: 0;
|
|
113
|
+
z-index: 9999;
|
|
114
|
+
width: 100%;
|
|
115
|
+
min-height: 100vh;
|
|
116
|
+
min-height: 100dvh;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&__content {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
max-width: calc(100vw - 32px);
|
|
125
|
+
opacity: 1;
|
|
126
|
+
transform: translate3d(0, 0, 0) scale(1);
|
|
127
|
+
transform-origin: center;
|
|
128
|
+
perspective: 500px;
|
|
129
|
+
transition:
|
|
130
|
+
opacity var(--art-page-loading-exit-duration) cubic-bezier(0.4, 0, 1, 1),
|
|
131
|
+
transform var(--art-page-loading-exit-duration) cubic-bezier(0.4, 0, 1, 1);
|
|
132
|
+
will-change: transform, opacity;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&__logo {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
width: 64px;
|
|
140
|
+
height: 64px;
|
|
141
|
+
margin-bottom: 10px;
|
|
142
|
+
transform-origin: center;
|
|
143
|
+
transform-style: preserve-3d;
|
|
144
|
+
animation: art-logo-loading var(--art-page-loading-duration)
|
|
145
|
+
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__logo-svg {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
width: 64px;
|
|
153
|
+
height: 64px;
|
|
154
|
+
|
|
155
|
+
:deep(svg) {
|
|
156
|
+
display: block;
|
|
157
|
+
width: 64px;
|
|
158
|
+
height: 64px;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&__text {
|
|
163
|
+
max-width: 100%;
|
|
164
|
+
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
165
|
+
font-size: clamp(14px, 4vw, 16px);
|
|
166
|
+
font-weight: 400;
|
|
167
|
+
line-height: 1.5;
|
|
168
|
+
color: var(--art-page-loading-text-color);
|
|
169
|
+
text-align: center;
|
|
170
|
+
letter-spacing: 2px;
|
|
171
|
+
white-space: nowrap;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&__char {
|
|
175
|
+
--art-page-loading-x: 36px;
|
|
176
|
+
--art-page-loading-y: -34px;
|
|
177
|
+
--art-page-loading-rotate: -30deg;
|
|
178
|
+
--art-page-loading-scale: 1.45;
|
|
179
|
+
--art-page-loading-delay: 0ms;
|
|
180
|
+
|
|
181
|
+
display: inline-block;
|
|
182
|
+
opacity: 0;
|
|
183
|
+
transform: translate3d(var(--art-page-loading-x), var(--art-page-loading-y), 0)
|
|
184
|
+
rotate(var(--art-page-loading-rotate)) scale(var(--art-page-loading-scale));
|
|
185
|
+
transform-origin: center;
|
|
186
|
+
animation: art-char-gather var(--art-page-loading-duration)
|
|
187
|
+
cubic-bezier(0.645, 0.045, 0.355, 1) var(--art-page-loading-delay) 1 both;
|
|
188
|
+
will-change: transform, opacity;
|
|
189
|
+
|
|
190
|
+
&--1 {
|
|
191
|
+
--art-page-loading-x: 32px;
|
|
192
|
+
--art-page-loading-y: 40px;
|
|
193
|
+
--art-page-loading-rotate: 28deg;
|
|
194
|
+
--art-page-loading-scale: 0.65;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&--2 {
|
|
198
|
+
--art-page-loading-x: -42px;
|
|
199
|
+
--art-page-loading-y: 34px;
|
|
200
|
+
--art-page-loading-rotate: -24deg;
|
|
201
|
+
--art-page-loading-scale: 1.35;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&--3 {
|
|
205
|
+
--art-page-loading-x: -34px;
|
|
206
|
+
--art-page-loading-y: -40px;
|
|
207
|
+
--art-page-loading-rotate: 34deg;
|
|
208
|
+
--art-page-loading-scale: 0.75;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&--4 {
|
|
212
|
+
--art-page-loading-x: 46px;
|
|
213
|
+
--art-page-loading-y: -30px;
|
|
214
|
+
--art-page-loading-rotate: 22deg;
|
|
215
|
+
--art-page-loading-scale: 1.25;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&--5 {
|
|
219
|
+
--art-page-loading-x: -38px;
|
|
220
|
+
--art-page-loading-y: 44px;
|
|
221
|
+
--art-page-loading-rotate: -36deg;
|
|
222
|
+
--art-page-loading-scale: 0.7;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
html.dark .art-page-loading {
|
|
228
|
+
--art-page-loading-background: var(--default-bg-color, #0b1120);
|
|
229
|
+
--art-page-loading-text-color: var(--art-gray-700, #ababba);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@keyframes art-char-gather {
|
|
233
|
+
0% {
|
|
234
|
+
opacity: 0;
|
|
235
|
+
transform: translate3d(var(--art-page-loading-x), var(--art-page-loading-y), 0)
|
|
236
|
+
rotate(var(--art-page-loading-rotate)) scale(var(--art-page-loading-scale));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
70%,
|
|
240
|
+
100% {
|
|
241
|
+
opacity: 1;
|
|
242
|
+
transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@keyframes art-logo-loading {
|
|
247
|
+
0% {
|
|
248
|
+
transform: rotateY(0deg);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
50% {
|
|
252
|
+
transform: rotateY(180deg);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
100% {
|
|
256
|
+
transform: rotateX(-180deg);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@media (prefers-reduced-motion: reduce) {
|
|
261
|
+
.art-page-loading {
|
|
262
|
+
transition: none;
|
|
263
|
+
|
|
264
|
+
&--leaving .art-page-loading__content {
|
|
265
|
+
transform: none;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&__logo,
|
|
269
|
+
&__char,
|
|
270
|
+
&__logo-svg :deep(.spinner),
|
|
271
|
+
&__logo-svg :deep(.dot) {
|
|
272
|
+
animation: none !important;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&__char {
|
|
276
|
+
opacity: 1;
|
|
277
|
+
transform: none;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!-- 更多按钮 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<ElDropdown v-if="hasAnyAuthItem">
|
|
5
|
+
<ArtIconButton icon="ri:more-2-fill" class="!size-8 bg-g-200 dark:bg-g-300/45 text-sm" />
|
|
6
|
+
<template #dropdown>
|
|
7
|
+
<ElDropdownMenu>
|
|
8
|
+
<template v-for="item in list" :key="item.key">
|
|
9
|
+
<ElDropdownItem
|
|
10
|
+
v-if="!item.auth || hasAuth(item.auth)"
|
|
11
|
+
:disabled="item.disabled"
|
|
12
|
+
@click="handleClick(item)"
|
|
13
|
+
>
|
|
14
|
+
<div class="flex-c gap-2" :style="{ color: item.color }">
|
|
15
|
+
<ArtSvgIcon v-if="item.icon" :icon="item.icon" />
|
|
16
|
+
<span>{{ item.label }}</span>
|
|
17
|
+
</div>
|
|
18
|
+
</ElDropdownItem>
|
|
19
|
+
</template>
|
|
20
|
+
</ElDropdownMenu>
|
|
21
|
+
</template>
|
|
22
|
+
</ElDropdown>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { useAuth } from '@/hooks/core/useAuth'
|
|
28
|
+
|
|
29
|
+
defineOptions({ name: 'ArtButtonMore' })
|
|
30
|
+
|
|
31
|
+
const { hasAuth } = useAuth()
|
|
32
|
+
|
|
33
|
+
export interface ButtonMoreItem {
|
|
34
|
+
/** 按钮标识,可用于点击事件 */
|
|
35
|
+
key: string | number
|
|
36
|
+
/** 按钮文本 */
|
|
37
|
+
label: string
|
|
38
|
+
/** 是否禁用 */
|
|
39
|
+
disabled?: boolean
|
|
40
|
+
/** 权限标识 */
|
|
41
|
+
auth?: string
|
|
42
|
+
/** 图标组件 */
|
|
43
|
+
icon?: string
|
|
44
|
+
/** 文本颜色 */
|
|
45
|
+
color?: string
|
|
46
|
+
/** 图标颜色(优先级高于 color) */
|
|
47
|
+
iconColor?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface Props {
|
|
51
|
+
/** 下拉项列表 */
|
|
52
|
+
list: ButtonMoreItem[]
|
|
53
|
+
/** 整体权限控制 */
|
|
54
|
+
auth?: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const props = withDefaults(defineProps<Props>(), {})
|
|
58
|
+
|
|
59
|
+
// 检查是否有任何有权限的 item
|
|
60
|
+
const hasAnyAuthItem = computed(() => {
|
|
61
|
+
return props.list.some((item) => !item.auth || hasAuth(item.auth))
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const emit = defineEmits<{
|
|
65
|
+
(e: 'click', item: ButtonMoreItem): void
|
|
66
|
+
}>()
|
|
67
|
+
|
|
68
|
+
const handleClick = (item: ButtonMoreItem) => {
|
|
69
|
+
emit('click', item)
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- 表格按钮 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
:class="[
|
|
5
|
+
'inline-flex items-center justify-center min-w-8 h-8 px-2.5 mr-2.5 text-sm c-p rounded-md align-middle',
|
|
6
|
+
buttonClass
|
|
7
|
+
]"
|
|
8
|
+
:style="{ backgroundColor: buttonBgColor, color: iconColor }"
|
|
9
|
+
@click="handleClick"
|
|
10
|
+
>
|
|
11
|
+
<ArtSvgIcon :icon="iconContent" />
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
defineOptions({ name: 'ArtButtonTable' })
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
/** 按钮类型 */
|
|
20
|
+
type?: 'add' | 'edit' | 'delete' | 'more' | 'view'
|
|
21
|
+
/** 按钮图标 */
|
|
22
|
+
icon?: string
|
|
23
|
+
/** 按钮样式类 */
|
|
24
|
+
iconClass?: string
|
|
25
|
+
/** icon 颜色 */
|
|
26
|
+
iconColor?: string
|
|
27
|
+
/** 按钮背景色 */
|
|
28
|
+
buttonBgColor?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(defineProps<Props>(), {})
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits<{
|
|
34
|
+
(e: 'click'): void
|
|
35
|
+
}>()
|
|
36
|
+
|
|
37
|
+
// 默认按钮配置
|
|
38
|
+
const defaultButtons = {
|
|
39
|
+
add: { icon: 'ri:add-fill', class: 'bg-theme/12 text-theme' },
|
|
40
|
+
edit: { icon: 'ri:pencil-line', class: 'bg-secondary/12 text-secondary' },
|
|
41
|
+
delete: { icon: 'ri:delete-bin-5-line', class: 'bg-error/12 text-error' },
|
|
42
|
+
view: { icon: 'ri:eye-line', class: 'bg-info/12 text-info' },
|
|
43
|
+
more: { icon: 'ri:more-2-fill', class: '' }
|
|
44
|
+
} as const
|
|
45
|
+
|
|
46
|
+
// 获取图标内容
|
|
47
|
+
const iconContent = computed(() => {
|
|
48
|
+
return props.icon || (props.type ? defaultButtons[props.type]?.icon : '') || ''
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// 获取按钮样式类
|
|
52
|
+
const buttonClass = computed(() => {
|
|
53
|
+
return props.iconClass || (props.type ? defaultButtons[props.type]?.class : '') || ''
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const handleClick = () => {
|
|
57
|
+
emit('click')
|
|
58
|
+
}
|
|
59
|
+
</script>
|