@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,395 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<main class="form-page" aria-labelledby="form-title">
|
|
3
|
+
<header class="form-header art-card">
|
|
4
|
+
<span>PAGE PATTERN / MULTI-STEP FORM</span>
|
|
5
|
+
<h1 id="form-title">创建资源配置</h1>
|
|
6
|
+
<p>演示分步填写、字段联动、就近校验、草稿状态和提交反馈。</p>
|
|
7
|
+
</header>
|
|
8
|
+
|
|
9
|
+
<section class="form-shell art-card">
|
|
10
|
+
<ElSteps :active="step" finish-status="success" align-center aria-label="创建进度">
|
|
11
|
+
<ElStep title="基础信息" description="名称与类型" />
|
|
12
|
+
<ElStep title="运行配置" description="策略与通知" />
|
|
13
|
+
<ElStep title="确认提交" description="检查配置" />
|
|
14
|
+
</ElSteps>
|
|
15
|
+
|
|
16
|
+
<ElForm ref="formRef" :model="form" :rules="rules" label-position="top" class="step-form">
|
|
17
|
+
<section v-show="step === 0" aria-labelledby="basic-title">
|
|
18
|
+
<div class="step-heading"
|
|
19
|
+
><h2 id="basic-title">基础信息</h2><p>带星号的字段为必填项。</p></div
|
|
20
|
+
>
|
|
21
|
+
<div class="field-grid">
|
|
22
|
+
<ElFormItem label="配置名称" prop="name"
|
|
23
|
+
><ElInput
|
|
24
|
+
v-model.trim="form.name"
|
|
25
|
+
maxlength="40"
|
|
26
|
+
show-word-limit
|
|
27
|
+
placeholder="例如:生产环境监控"
|
|
28
|
+
/></ElFormItem>
|
|
29
|
+
<ElFormItem label="资源类型" prop="type"
|
|
30
|
+
><ElSelect v-model="form.type" placeholder="请选择资源类型" style="width: 100%"
|
|
31
|
+
><ElOption label="API 服务" value="api" /><ElOption
|
|
32
|
+
label="定时任务"
|
|
33
|
+
value="job" /><ElOption label="消息通道" value="message" /></ElSelect
|
|
34
|
+
></ElFormItem>
|
|
35
|
+
<ElFormItem label="负责人" prop="owner"
|
|
36
|
+
><ElInput v-model.trim="form.owner" placeholder="请输入负责人或团队"
|
|
37
|
+
/></ElFormItem>
|
|
38
|
+
<ElFormItem label="所属环境" prop="environment"
|
|
39
|
+
><ElRadioGroup v-model="form.environment"
|
|
40
|
+
><ElRadioButton value="development">开发</ElRadioButton
|
|
41
|
+
><ElRadioButton value="staging">预发</ElRadioButton
|
|
42
|
+
><ElRadioButton value="production">生产</ElRadioButton></ElRadioGroup
|
|
43
|
+
></ElFormItem
|
|
44
|
+
>
|
|
45
|
+
<ElFormItem class="full-field" label="说明" prop="description"
|
|
46
|
+
><ElInput
|
|
47
|
+
v-model="form.description"
|
|
48
|
+
type="textarea"
|
|
49
|
+
:rows="4"
|
|
50
|
+
maxlength="200"
|
|
51
|
+
show-word-limit
|
|
52
|
+
placeholder="说明这项配置解决的问题"
|
|
53
|
+
/></ElFormItem>
|
|
54
|
+
</div>
|
|
55
|
+
</section>
|
|
56
|
+
|
|
57
|
+
<section v-show="step === 1" aria-labelledby="runtime-title">
|
|
58
|
+
<div class="step-heading"
|
|
59
|
+
><h2 id="runtime-title">运行配置</h2><p>高级字段会根据开关逐步显示。</p></div
|
|
60
|
+
>
|
|
61
|
+
<div class="field-grid">
|
|
62
|
+
<ElFormItem label="运行策略" prop="strategy"
|
|
63
|
+
><ElSelect v-model="form.strategy" style="width: 100%"
|
|
64
|
+
><ElOption label="稳定优先" value="stable" /><ElOption
|
|
65
|
+
label="性能优先"
|
|
66
|
+
value="performance" /><ElOption label="成本优先" value="economy" /></ElSelect
|
|
67
|
+
></ElFormItem>
|
|
68
|
+
<ElFormItem label="并发上限" prop="concurrency"
|
|
69
|
+
><ElInputNumber
|
|
70
|
+
v-model="form.concurrency"
|
|
71
|
+
:min="1"
|
|
72
|
+
:max="100"
|
|
73
|
+
controls-position="right"
|
|
74
|
+
style="width: 100%"
|
|
75
|
+
/></ElFormItem>
|
|
76
|
+
<ElFormItem class="full-field setting-switch"
|
|
77
|
+
><div><label>失败通知</label><p>运行失败后向负责人发送通知。</p></div
|
|
78
|
+
><ElSwitch v-model="form.notificationEnabled"
|
|
79
|
+
/></ElFormItem>
|
|
80
|
+
<ElFormItem
|
|
81
|
+
v-if="form.notificationEnabled"
|
|
82
|
+
class="full-field"
|
|
83
|
+
label="通知邮箱"
|
|
84
|
+
prop="email"
|
|
85
|
+
><ElInput
|
|
86
|
+
v-model.trim="form.email"
|
|
87
|
+
type="email"
|
|
88
|
+
autocomplete="email"
|
|
89
|
+
placeholder="name@example.com"
|
|
90
|
+
/></ElFormItem>
|
|
91
|
+
<ElFormItem class="full-field setting-switch"
|
|
92
|
+
><div><label>自动重试</label><p>发生临时错误时按间隔重新执行。</p></div
|
|
93
|
+
><ElSwitch v-model="form.retryEnabled"
|
|
94
|
+
/></ElFormItem>
|
|
95
|
+
<template v-if="form.retryEnabled"
|
|
96
|
+
><ElFormItem label="重试次数" prop="retryCount"
|
|
97
|
+
><ElInputNumber
|
|
98
|
+
v-model="form.retryCount"
|
|
99
|
+
:min="1"
|
|
100
|
+
:max="10"
|
|
101
|
+
style="width: 100%" /></ElFormItem
|
|
102
|
+
><ElFormItem label="重试间隔"
|
|
103
|
+
><ElSelect v-model="form.retryInterval" style="width: 100%"
|
|
104
|
+
><ElOption label="1 分钟" :value="1" /><ElOption
|
|
105
|
+
label="5 分钟"
|
|
106
|
+
:value="5" /><ElOption label="15 分钟" :value="15" /></ElSelect></ElFormItem
|
|
107
|
+
></template>
|
|
108
|
+
</div>
|
|
109
|
+
</section>
|
|
110
|
+
|
|
111
|
+
<section v-show="step === 2" aria-labelledby="review-title">
|
|
112
|
+
<div class="step-heading"
|
|
113
|
+
><h2 id="review-title">确认配置</h2><p>提交前请检查以下信息,仍可返回修改。</p></div
|
|
114
|
+
>
|
|
115
|
+
<ElDescriptions :column="2" border class="review-list">
|
|
116
|
+
<ElDescriptionsItem label="配置名称">{{ form.name }}</ElDescriptionsItem
|
|
117
|
+
><ElDescriptionsItem label="资源类型">{{ typeLabels[form.type] }}</ElDescriptionsItem
|
|
118
|
+
><ElDescriptionsItem label="负责人">{{ form.owner }}</ElDescriptionsItem
|
|
119
|
+
><ElDescriptionsItem label="所属环境">{{
|
|
120
|
+
environmentLabels[form.environment]
|
|
121
|
+
}}</ElDescriptionsItem
|
|
122
|
+
><ElDescriptionsItem label="运行策略">{{
|
|
123
|
+
strategyLabels[form.strategy]
|
|
124
|
+
}}</ElDescriptionsItem
|
|
125
|
+
><ElDescriptionsItem label="并发上限">{{ form.concurrency }}</ElDescriptionsItem
|
|
126
|
+
><ElDescriptionsItem label="失败通知">{{
|
|
127
|
+
form.notificationEnabled ? form.email : '未开启'
|
|
128
|
+
}}</ElDescriptionsItem
|
|
129
|
+
><ElDescriptionsItem label="自动重试">{{
|
|
130
|
+
form.retryEnabled ? `${form.retryCount} 次 / ${form.retryInterval} 分钟` : '未开启'
|
|
131
|
+
}}</ElDescriptionsItem>
|
|
132
|
+
</ElDescriptions>
|
|
133
|
+
<ElAlert
|
|
134
|
+
class="review-alert"
|
|
135
|
+
title="演示不会请求真实接口"
|
|
136
|
+
type="info"
|
|
137
|
+
:closable="false"
|
|
138
|
+
show-icon
|
|
139
|
+
/>
|
|
140
|
+
</section>
|
|
141
|
+
</ElForm>
|
|
142
|
+
|
|
143
|
+
<footer class="form-actions">
|
|
144
|
+
<div class="draft-status" role="status"
|
|
145
|
+
><ArtSvgIcon icon="ri:save-3-line" aria-hidden="true" /><span>{{
|
|
146
|
+
draftStatus
|
|
147
|
+
}}</span></div
|
|
148
|
+
>
|
|
149
|
+
<div
|
|
150
|
+
><ElButton v-if="step > 0" size="large" @click="step--">上一步</ElButton
|
|
151
|
+
><ElButton v-if="step < 2" type="primary" size="large" @click="nextStep">下一步</ElButton
|
|
152
|
+
><ElButton v-else type="primary" size="large" :loading="submitting" @click="submit"
|
|
153
|
+
>确认提交</ElButton
|
|
154
|
+
></div
|
|
155
|
+
>
|
|
156
|
+
</footer>
|
|
157
|
+
</section>
|
|
158
|
+
</main>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<script setup lang="ts">
|
|
162
|
+
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
|
163
|
+
defineOptions({ name: 'ComplexFormExample' })
|
|
164
|
+
const formRef = ref<FormInstance>()
|
|
165
|
+
const step = ref(0)
|
|
166
|
+
const submitting = ref(false)
|
|
167
|
+
const draftStatus = ref('草稿已保存')
|
|
168
|
+
const form = reactive({
|
|
169
|
+
name: '',
|
|
170
|
+
type: '',
|
|
171
|
+
owner: '',
|
|
172
|
+
environment: 'development',
|
|
173
|
+
description: '',
|
|
174
|
+
strategy: 'stable',
|
|
175
|
+
concurrency: 10,
|
|
176
|
+
notificationEnabled: true,
|
|
177
|
+
email: '',
|
|
178
|
+
retryEnabled: false,
|
|
179
|
+
retryCount: 3,
|
|
180
|
+
retryInterval: 5
|
|
181
|
+
})
|
|
182
|
+
const typeLabels: Record<string, string> = {
|
|
183
|
+
api: 'API 服务',
|
|
184
|
+
job: '定时任务',
|
|
185
|
+
message: '消息通道'
|
|
186
|
+
}
|
|
187
|
+
const environmentLabels: Record<string, string> = {
|
|
188
|
+
development: '开发',
|
|
189
|
+
staging: '预发',
|
|
190
|
+
production: '生产'
|
|
191
|
+
}
|
|
192
|
+
const strategyLabels: Record<string, string> = {
|
|
193
|
+
stable: '稳定优先',
|
|
194
|
+
performance: '性能优先',
|
|
195
|
+
economy: '成本优先'
|
|
196
|
+
}
|
|
197
|
+
const rules: FormRules = {
|
|
198
|
+
name: [{ required: true, message: '请输入配置名称', trigger: 'blur' }],
|
|
199
|
+
type: [{ required: true, message: '请选择资源类型', trigger: 'change' }],
|
|
200
|
+
owner: [{ required: true, message: '请输入负责人', trigger: 'blur' }],
|
|
201
|
+
email: [
|
|
202
|
+
{ required: true, message: '请输入通知邮箱', trigger: 'blur' },
|
|
203
|
+
{ type: 'email', message: '请输入有效的邮箱地址', trigger: 'blur' }
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
const firstStepFields = ['name', 'type', 'owner']
|
|
207
|
+
const validateFields = async (fields: string[]) =>
|
|
208
|
+
formRef.value
|
|
209
|
+
?.validateField(fields)
|
|
210
|
+
.then(() => true)
|
|
211
|
+
.catch(() => false)
|
|
212
|
+
const nextStep = async () => {
|
|
213
|
+
const valid =
|
|
214
|
+
step.value === 0
|
|
215
|
+
? await validateFields(firstStepFields)
|
|
216
|
+
: form.notificationEnabled
|
|
217
|
+
? await validateFields(['email'])
|
|
218
|
+
: true
|
|
219
|
+
if (valid) step.value++
|
|
220
|
+
}
|
|
221
|
+
const submit = async () => {
|
|
222
|
+
submitting.value = true
|
|
223
|
+
await new Promise((resolve) => window.setTimeout(resolve, 700))
|
|
224
|
+
submitting.value = false
|
|
225
|
+
ElMessage.success('配置创建成功(演示)')
|
|
226
|
+
step.value = 0
|
|
227
|
+
}
|
|
228
|
+
let saveTimer: number | undefined
|
|
229
|
+
watch(
|
|
230
|
+
form,
|
|
231
|
+
() => {
|
|
232
|
+
draftStatus.value = '正在保存草稿…'
|
|
233
|
+
window.clearTimeout(saveTimer)
|
|
234
|
+
saveTimer = window.setTimeout(() => {
|
|
235
|
+
draftStatus.value = '草稿已保存'
|
|
236
|
+
}, 500)
|
|
237
|
+
},
|
|
238
|
+
{ deep: true }
|
|
239
|
+
)
|
|
240
|
+
onBeforeUnmount(() => window.clearTimeout(saveTimer))
|
|
241
|
+
</script>
|
|
242
|
+
|
|
243
|
+
<style scoped lang="scss">
|
|
244
|
+
.form-page {
|
|
245
|
+
display: grid;
|
|
246
|
+
gap: 16px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.form-header {
|
|
250
|
+
padding: 26px 28px;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.form-header > span {
|
|
254
|
+
font-size: 12px;
|
|
255
|
+
font-weight: 700;
|
|
256
|
+
color: var(--el-color-primary);
|
|
257
|
+
letter-spacing: 0.12em;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.form-header h1 {
|
|
261
|
+
margin-top: 8px;
|
|
262
|
+
font-size: clamp(25px, 3vw, 34px);
|
|
263
|
+
font-weight: 650;
|
|
264
|
+
color: var(--art-gray-900);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.form-header p {
|
|
268
|
+
margin-top: 6px;
|
|
269
|
+
color: var(--art-gray-600);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.form-shell {
|
|
273
|
+
padding: 28px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.step-form {
|
|
277
|
+
width: min(100%, 860px);
|
|
278
|
+
min-height: 390px;
|
|
279
|
+
margin: 36px auto 0;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.step-heading {
|
|
283
|
+
padding-bottom: 18px;
|
|
284
|
+
margin-bottom: 20px;
|
|
285
|
+
border-bottom: 1px solid var(--art-gray-200);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.step-heading h2 {
|
|
289
|
+
font-size: 20px;
|
|
290
|
+
font-weight: 600;
|
|
291
|
+
color: var(--art-gray-900);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.step-heading p {
|
|
295
|
+
margin-top: 5px;
|
|
296
|
+
color: var(--art-gray-500);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.field-grid {
|
|
300
|
+
display: grid;
|
|
301
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
302
|
+
gap: 0 20px;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.full-field {
|
|
306
|
+
grid-column: 1 / -1;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.setting-switch :deep(.el-form-item__content) {
|
|
310
|
+
display: flex;
|
|
311
|
+
justify-content: space-between;
|
|
312
|
+
min-height: 64px;
|
|
313
|
+
padding: 12px 16px;
|
|
314
|
+
background: var(--art-gray-100);
|
|
315
|
+
border-radius: 10px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.setting-switch label {
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
color: var(--art-gray-800);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.setting-switch p {
|
|
324
|
+
margin-top: 3px;
|
|
325
|
+
color: var(--art-gray-500);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.review-list {
|
|
329
|
+
margin-top: 8px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.review-alert {
|
|
333
|
+
margin-top: 18px;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.form-actions {
|
|
337
|
+
display: flex;
|
|
338
|
+
align-items: center;
|
|
339
|
+
justify-content: space-between;
|
|
340
|
+
padding-top: 20px;
|
|
341
|
+
border-top: 1px solid var(--art-gray-200);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.form-actions :deep(.el-button) {
|
|
345
|
+
min-height: 44px;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.draft-status {
|
|
349
|
+
display: flex;
|
|
350
|
+
gap: 7px;
|
|
351
|
+
align-items: center;
|
|
352
|
+
color: var(--art-gray-500);
|
|
353
|
+
}
|
|
354
|
+
@media (width <= 680px) {
|
|
355
|
+
.form-header,
|
|
356
|
+
.form-shell {
|
|
357
|
+
padding: 20px;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.form-shell :deep(.el-steps) {
|
|
361
|
+
overflow-x: auto;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.field-grid {
|
|
365
|
+
grid-template-columns: 1fr;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.step-form {
|
|
369
|
+
min-height: 440px;
|
|
370
|
+
margin-top: 28px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.review-list :deep(.el-descriptions__body .el-descriptions__table) {
|
|
374
|
+
display: block;
|
|
375
|
+
overflow-x: auto;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.form-actions {
|
|
379
|
+
flex-direction: column;
|
|
380
|
+
gap: 16px;
|
|
381
|
+
align-items: stretch;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.form-actions > div:last-child {
|
|
385
|
+
display: grid;
|
|
386
|
+
grid-template-columns: repeat(2, 1fr);
|
|
387
|
+
gap: 8px;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.form-actions :deep(.el-button) {
|
|
391
|
+
width: 100%;
|
|
392
|
+
margin: 0;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
</style>
|