befly-admin-ui 1.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +188 -0
  3. package/jsconfig.json +14 -0
  4. package/package.json +51 -0
  5. package/styles/variables.scss +148 -0
  6. package/utils/arrayToTree.js +115 -0
  7. package/utils/cleanParams.js +29 -0
  8. package/utils/fieldClear.js +62 -0
  9. package/utils/genShortId.js +12 -0
  10. package/utils/hashPassword.js +9 -0
  11. package/utils/scanViewsDir.js +120 -0
  12. package/utils/withDefaultColumns.js +46 -0
  13. package/views/config/dict/components/edit.vue +120 -0
  14. package/views/config/dict/index.vue +188 -0
  15. package/views/config/dictType/components/edit.vue +110 -0
  16. package/views/config/dictType/index.vue +153 -0
  17. package/views/config/index.vue +3 -0
  18. package/views/config/system/components/edit.vue +184 -0
  19. package/views/config/system/index.vue +188 -0
  20. package/views/index/components/addonList.vue +148 -0
  21. package/views/index/components/environmentInfo.vue +116 -0
  22. package/views/index/components/operationLogs.vue +127 -0
  23. package/views/index/components/performanceMetrics.vue +153 -0
  24. package/views/index/components/quickActions.vue +30 -0
  25. package/views/index/components/serviceStatus.vue +197 -0
  26. package/views/index/components/systemNotifications.vue +144 -0
  27. package/views/index/components/systemOverview.vue +194 -0
  28. package/views/index/components/systemResources.vue +121 -0
  29. package/views/index/components/userInfo.vue +210 -0
  30. package/views/index/index.vue +67 -0
  31. package/views/jsconfig.json +15 -0
  32. package/views/log/email/index.vue +221 -0
  33. package/views/log/index.vue +3 -0
  34. package/views/log/login/index.vue +95 -0
  35. package/views/log/operate/index.vue +169 -0
  36. package/views/login_1/index.vue +400 -0
  37. package/views/people/admin/components/edit.vue +173 -0
  38. package/views/people/admin/index.vue +121 -0
  39. package/views/people/index.vue +3 -0
  40. package/views/permission/api/index.vue +146 -0
  41. package/views/permission/index.vue +3 -0
  42. package/views/permission/menu/index.vue +109 -0
  43. package/views/permission/role/components/api.vue +371 -0
  44. package/views/permission/role/components/edit.vue +143 -0
  45. package/views/permission/role/components/menu.vue +310 -0
  46. package/views/permission/role/index.vue +175 -0
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <div class="section-block">
3
+ <div class="section-header flex items-center gap-2">
4
+ <ChartIcon />
5
+ <h2>性能指标</h2>
6
+ </div>
7
+ <div class="section-content">
8
+ <div class="performance-grid">
9
+ <div class="perf-metric">
10
+ <div class="perf-icon">
11
+ <TimeIcon />
12
+ </div>
13
+ <div class="perf-info">
14
+ <div class="perf-label">平均响应</div>
15
+ <div class="perf-value">{{ performanceMetrics.avgResponseTime }}ms</div>
16
+ </div>
17
+ </div>
18
+ <div class="perf-metric">
19
+ <div class="perf-icon">
20
+ <TrendingUpIcon />
21
+ </div>
22
+ <div class="perf-info">
23
+ <div class="perf-label">QPS</div>
24
+ <div class="perf-value">{{ performanceMetrics.qps }}/s</div>
25
+ </div>
26
+ </div>
27
+ <div class="perf-metric">
28
+ <div class="perf-icon">
29
+ <ErrorCircleIcon />
30
+ </div>
31
+ <div class="perf-info">
32
+ <div class="perf-label">错误率</div>
33
+ <div class="perf-value">{{ performanceMetrics.errorRate }}%</div>
34
+ </div>
35
+ </div>
36
+ <div class="perf-metric">
37
+ <div class="perf-icon">
38
+ <ChartIcon />
39
+ </div>
40
+ <div class="perf-info">
41
+ <div class="perf-label">活跃连接</div>
42
+ <div class="perf-value">{{ performanceMetrics.activeConnections }}</div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ <!-- 最慢接口提示 -->
47
+ <div v-if="performanceMetrics.slowestApi" class="perf-slowest">
48
+ <ErrorTriangleIcon />
49
+ <span>最慢接口: {{ performanceMetrics.slowestApi.path }} ({{ performanceMetrics.slowestApi.time }}ms)</span>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </template>
54
+
55
+ <script setup lang="ts">
56
+ import { reactive } from "vue";
57
+ import { ChartIcon, ErrorCircleIcon, ErrorTriangleIcon, TimeIcon, TrendingUpIcon } from "tdesign-icons-vue-next";
58
+ import { $Http } from "@/plugins/http";
59
+
60
+ type SlowestApiInfo = {
61
+ path: string;
62
+ time: number;
63
+ };
64
+
65
+ // 组件内部数据
66
+ const performanceMetrics = reactive({
67
+ avgResponseTime: 0,
68
+ qps: 0,
69
+ errorRate: 0,
70
+ activeConnections: 0,
71
+ slowestApi: null as SlowestApiInfo | null
72
+ });
73
+
74
+ // 获取数据
75
+ const fetchData = async () => {
76
+ try {
77
+ const { data } = await $Http.post(
78
+ "/core/dashboard/performanceMetrics",
79
+ {},
80
+ {
81
+ dropValues: [""]
82
+ }
83
+ );
84
+ Object.assign(performanceMetrics, data);
85
+ } catch (_error) {
86
+ // 静默失败:不阻断页面展示
87
+ }
88
+ };
89
+
90
+ fetchData();
91
+ </script>
92
+
93
+ <style scoped lang="scss">
94
+ .performance-grid {
95
+ display: grid;
96
+ grid-template-columns: repeat(4, 1fr);
97
+ gap: var(--spacing-sm);
98
+ margin-bottom: var(--spacing-sm);
99
+
100
+ .perf-metric {
101
+ display: flex;
102
+ align-items: center;
103
+ gap: var(--spacing-sm);
104
+ padding: var(--spacing-sm) var(--spacing-md);
105
+ background: rgba(var(--primary-color-rgb), 0.02);
106
+ border-radius: var(--border-radius);
107
+ border: 1px solid var(--border-color);
108
+ transition: all 0.2s;
109
+
110
+ &:hover {
111
+ background: rgba(var(--primary-color-rgb), 0.05);
112
+ border-color: var(--primary-color);
113
+ }
114
+
115
+ .perf-icon {
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: center;
119
+ width: 36px;
120
+ height: 36px;
121
+ border-radius: var(--border-radius-small);
122
+ background: linear-gradient(135deg, rgba(0, 168, 112, 0.1) 0%, rgba(0, 168, 112, 0.05) 100%);
123
+ color: var(--success-color);
124
+ flex-shrink: 0;
125
+ }
126
+
127
+ .perf-info {
128
+ flex: 1;
129
+
130
+ .perf-label {
131
+ font-size: 14px;
132
+ color: var(--text-secondary);
133
+ margin-bottom: 2px;
134
+ }
135
+
136
+ .perf-value {
137
+ font-size: 16px;
138
+ font-weight: 700;
139
+ color: var(--primary-color);
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ .warning-tip {
146
+ padding: var(--spacing-sm) var(--spacing-md);
147
+ background: rgba(var(--warning-color-rgb), 0.05);
148
+ border-radius: var(--border-radius-small);
149
+ border: 1px solid rgba(var(--warning-color-rgb), 0.2);
150
+ font-size: 13px;
151
+ color: var(--warning-color);
152
+ }
153
+ </style>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="section-block">
3
+ <div class="section-content">
4
+ <TButton theme="primary" size="large" @click="handleClearCache">
5
+ <template #prefix>
6
+ <RefreshIcon />
7
+ </template>
8
+ 刷新缓存
9
+ </TButton>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { Button as TButton } from "tdesign-vue-next";
16
+ import { RefreshIcon } from "tdesign-icons-vue-next";
17
+
18
+ const handleClearCache = () => {
19
+ // TODO: 接入刷新缓存接口
20
+ };
21
+ </script>
22
+
23
+ <style scoped lang="scss">
24
+ .section-block {
25
+ .section-content {
26
+ display: flex;
27
+ justify-content: center;
28
+ }
29
+ }
30
+ </style>
@@ -0,0 +1,197 @@
1
+ <template>
2
+ <div class="section-block">
3
+ <div class="section-header flex items-center gap-2">
4
+ <CheckCircleIcon />
5
+ <h2>服务状态</h2>
6
+ </div>
7
+ <div class="section-content">
8
+ <div class="config-grid">
9
+ <div v-for="service in services" :key="service.name" class="config-card" :class="`config-${service.status}`">
10
+ <div class="config-icon">
11
+ <DataBaseIcon v-if="service.name === '数据库'" style="width: 20px; height: 20px" />
12
+ <LightingCircleIcon v-else-if="service.name === 'Redis'" style="width: 20px; height: 20px" />
13
+ <HardDiskStorageIcon v-else-if="service.name === '文件系统'" style="width: 20px; height: 20px" />
14
+ <MailIcon v-else-if="service.name === '邮件服务'" style="width: 20px; height: 20px" />
15
+ <CloudIcon v-else-if="service.name === 'OSS存储'" style="width: 20px; height: 20px" />
16
+ <CircleIcon v-else style="width: 20px; height: 20px" />
17
+ </div>
18
+ <div class="config-info">
19
+ <div class="config-name">{{ service.name }}</div>
20
+ <div class="config-status">
21
+ {{ getStatusText(service.status) }}
22
+ <span v-if="service.responseTime && service.responseTime !== '-'" class="latency">{{ service.responseTime }}</span>
23
+ </div>
24
+ </div>
25
+ <div class="config-badge">
26
+ <CheckCircleIcon v-if="service.status === 'running'" style="width: 32px; height: 32px" />
27
+ <CloseCircleIcon v-else-if="service.status === 'stopped'" style="width: 32px; height: 32px" />
28
+ <ErrorCircleIcon v-else-if="service.status === 'unconfigured'" style="width: 32px; height: 32px" />
29
+ <CircleIcon v-else style="width: 32px; height: 32px" />
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script setup lang="ts">
38
+ import { reactive } from "vue";
39
+ import { CheckCircleIcon, CircleIcon, CloudIcon, CloseCircleIcon, DataBaseIcon, ErrorCircleIcon, HardDiskStorageIcon, LightingCircleIcon, MailIcon } from "tdesign-icons-vue-next";
40
+ import { $Http } from "@/plugins/http";
41
+
42
+ type ServiceStatusItem = {
43
+ name: string;
44
+ status: string;
45
+ responseTime?: string;
46
+ };
47
+
48
+ // 组件内部数据
49
+ const services = reactive<ServiceStatusItem[]>([]);
50
+
51
+ // 获取数据
52
+ const fetchData = async () => {
53
+ try {
54
+ const { data } = await $Http.post(
55
+ "/core/dashboard/serviceStatus",
56
+ {},
57
+ {
58
+ dropValues: [""]
59
+ }
60
+ );
61
+ services.splice(0, services.length, ...data.services);
62
+ } catch (_error) {
63
+ // 静默失败:不阻断页面展示
64
+ }
65
+ };
66
+
67
+ fetchData();
68
+
69
+ // 工具函数
70
+ const getStatusColor = (status: string): string => {
71
+ const colors = {
72
+ running: "success",
73
+ stopped: "error",
74
+ unconfigured: "warning"
75
+ };
76
+ return colors[status] || "default";
77
+ };
78
+
79
+ const getStatusText = (status: string): string => {
80
+ const texts = {
81
+ running: "正常",
82
+ stopped: "停止",
83
+ unconfigured: "未配置"
84
+ };
85
+ return texts[status] || status;
86
+ };
87
+ </script>
88
+
89
+ <style scoped lang="scss">
90
+ .config-grid {
91
+ display: grid;
92
+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
93
+ gap: 10px;
94
+
95
+ .config-card {
96
+ background: rgba(var(--primary-color-rgb), 0.02);
97
+ border: 1px solid var(--border-color);
98
+ border-radius: 6px;
99
+ padding: 12px;
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 10px;
103
+ position: relative;
104
+ overflow: hidden;
105
+ transition: all 0.3s;
106
+
107
+ &:hover {
108
+ background: rgba(var(--primary-color-rgb), 0.05);
109
+ border-color: var(--primary-color);
110
+ transform: translateY(-2px);
111
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
112
+ }
113
+
114
+ .config-icon {
115
+ width: 40px;
116
+ height: 40px;
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: center;
120
+ border-radius: 6px;
121
+ flex-shrink: 0;
122
+ }
123
+
124
+ .config-info {
125
+ flex: 1;
126
+ min-width: 0;
127
+
128
+ .config-name {
129
+ font-size: 14px;
130
+ font-weight: 600;
131
+ margin-bottom: 2px;
132
+ }
133
+
134
+ .config-status {
135
+ font-size: 14px;
136
+ display: flex;
137
+ align-items: center;
138
+ gap: 4px;
139
+
140
+ .latency {
141
+ margin-left: 4px;
142
+ color: var(--text-placeholder);
143
+ }
144
+ }
145
+ }
146
+
147
+ .config-badge {
148
+ position: absolute;
149
+ top: 6px;
150
+ right: 6px;
151
+ opacity: 0.2;
152
+ }
153
+
154
+ &.config-running {
155
+ border-color: var(--success-color);
156
+ background: linear-gradient(135deg, rgba(82, 196, 26, 0.05), white);
157
+
158
+ .config-icon {
159
+ background: rgba(82, 196, 26, 0.1);
160
+ color: var(--success-color);
161
+ }
162
+
163
+ .config-name {
164
+ color: var(--success-color);
165
+ }
166
+ }
167
+
168
+ &.config-unconfigured {
169
+ border-color: var(--warning-color);
170
+ background: linear-gradient(135deg, rgba(250, 173, 20, 0.05), white);
171
+
172
+ .config-icon {
173
+ background: rgba(250, 173, 20, 0.1);
174
+ color: var(--warning-color);
175
+ }
176
+
177
+ .config-name {
178
+ color: var(--warning-color);
179
+ }
180
+ }
181
+
182
+ &.config-stopped {
183
+ border-color: var(--error-color);
184
+ background: linear-gradient(135deg, rgba(255, 77, 79, 0.05), white);
185
+
186
+ .config-icon {
187
+ background: rgba(255, 77, 79, 0.1);
188
+ color: var(--error-color);
189
+ }
190
+
191
+ .config-name {
192
+ color: var(--error-color);
193
+ }
194
+ }
195
+ }
196
+ }
197
+ </style>
@@ -0,0 +1,144 @@
1
+ <template>
2
+ <div class="section-block">
3
+ <div class="section-header flex items-center gap-2">
4
+ <NotificationIcon />
5
+ <h2>系统通知</h2>
6
+ </div>
7
+ <div class="section-content">
8
+ <div class="notification-compact-list">
9
+ <div v-for="notification in notifications" :key="notification.id" class="notification-compact-item">
10
+ <div class="notification-icon" :class="`type-${notification.type}`">
11
+ <InfoCircleIcon v-if="notification.type === 'info'" />
12
+ <CheckCircleIcon v-else-if="notification.type === 'success'" />
13
+ <ErrorTriangleIcon v-else-if="notification.type === 'warning'" />
14
+ <CloseCircleIcon v-else-if="notification.type === 'error'" />
15
+ <NotificationIcon v-else />
16
+ </div>
17
+ <div class="notification-content">
18
+ <span class="notification-title">{{ notification.title }}</span>
19
+ <span class="notification-time">{{ formatTime(notification.createdAt) }}</span>
20
+ </div>
21
+ <TTag v-if="!notification.isRead" type="primary" size="small">新</TTag>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script setup lang="ts">
29
+ import { reactive } from "vue";
30
+ import { Tag as TTag } from "tdesign-vue-next";
31
+ import { CheckCircleIcon, CloseCircleIcon, ErrorTriangleIcon, InfoCircleIcon, NotificationIcon } from "tdesign-icons-vue-next";
32
+
33
+ type NotificationType = "info" | "success" | "warning" | "error" | "other";
34
+
35
+ type NotificationItem = {
36
+ id: number;
37
+ type: NotificationType;
38
+ title: string;
39
+ isRead: boolean;
40
+ createdAt: number;
41
+ };
42
+
43
+ // 组件内部数据
44
+ const notifications = reactive<NotificationItem[]>([
45
+ { id: 1, type: "warning", title: "系统更新提醒 - v1.1.0 版本已发布", isRead: false, createdAt: Date.now() - 3600000 },
46
+ { id: 2, type: "info", title: "数据备份完成 - 今日凌晨自动备份成功", isRead: true, createdAt: Date.now() - 21600000 },
47
+ { id: 3, type: "error", title: "SSL证书即将过期 - 请及时更新证书", isRead: false, createdAt: Date.now() - 86400000 },
48
+ { id: 4, type: "success", title: "性能优化完成 - 响应速度提升30%", isRead: true, createdAt: Date.now() - 172800000 }
49
+ ]);
50
+
51
+ const formatTime = (timestamp: number): string => {
52
+ const date = new Date(timestamp);
53
+ const now = Date.now();
54
+ const diff = now - timestamp;
55
+
56
+ if (diff < 3600000) {
57
+ return `${Math.floor(diff / 60000)}分钟前`;
58
+ } else if (diff < 86400000) {
59
+ return `${Math.floor(diff / 3600000)}小时前`;
60
+ } else {
61
+ const month = String(date.getMonth() + 1).padStart(2, "0");
62
+ const day = String(date.getDate()).padStart(2, "0");
63
+ return `${month}-${day}`;
64
+ }
65
+ };
66
+ </script>
67
+
68
+ <style scoped lang="scss">
69
+ .notification-compact-list {
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: var(--spacing-xs);
73
+
74
+ .notification-compact-item {
75
+ display: flex;
76
+ align-items: center;
77
+ gap: var(--spacing-sm);
78
+ padding: var(--spacing-sm) var(--spacing-md);
79
+ background: rgba(var(--primary-color-rgb), 0.02);
80
+ border-radius: var(--border-radius-small);
81
+ border: 1px solid var(--border-color);
82
+ transition: all 0.2s;
83
+
84
+ &:hover {
85
+ background: rgba(var(--primary-color-rgb), 0.05);
86
+ border-color: var(--primary-color);
87
+ }
88
+
89
+ .notification-icon {
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ width: 32px;
94
+ height: 32px;
95
+ border-radius: var(--border-radius-small);
96
+ flex-shrink: 0;
97
+
98
+ &.type-info {
99
+ background: rgba(var(--primary-color-rgb), 0.1);
100
+ color: var(--primary-color);
101
+ }
102
+
103
+ &.type-success {
104
+ background: rgba(var(--success-color-rgb), 0.1);
105
+ color: var(--success-color);
106
+ }
107
+
108
+ &.type-warning {
109
+ background: rgba(var(--warning-color-rgb), 0.1);
110
+ color: var(--warning-color);
111
+ }
112
+
113
+ &.type-error {
114
+ background: rgba(var(--error-color-rgb), 0.1);
115
+ color: var(--error-color);
116
+ }
117
+ }
118
+
119
+ .notification-content {
120
+ display: flex;
121
+ align-items: center;
122
+ gap: var(--spacing-sm);
123
+ flex: 1;
124
+ min-width: 0;
125
+
126
+ .notification-title {
127
+ font-size: 14px;
128
+ color: var(--text-primary);
129
+ font-weight: 500;
130
+ overflow: hidden;
131
+ text-overflow: ellipsis;
132
+ white-space: nowrap;
133
+ flex: 1;
134
+ }
135
+
136
+ .notification-time {
137
+ font-size: 14px;
138
+ color: var(--text-placeholder);
139
+ flex-shrink: 0;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ </style>