@befly-addon/admin 1.1.34 → 1.2.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.
Files changed (46) hide show
  1. package/apis/admin/cacheRefresh.ts +2 -2
  2. package/apis/menu/all.ts +8 -9
  3. package/apis/menu/list.ts +1 -2
  4. package/apis/role/apiSave.ts +3 -3
  5. package/apis/role/apis.ts +3 -3
  6. package/apis/role/menuSave.ts +2 -2
  7. package/apis/role/menus.ts +3 -3
  8. package/package.json +21 -21
  9. package/plugins/email.ts +3 -8
  10. package/tables/api.json +1 -20
  11. package/tables/menu.json +6 -11
  12. package/tables/role.json +4 -4
  13. package/views/403_1/index.vue +0 -75
  14. package/views/config/dict/components/edit.vue +0 -109
  15. package/views/config/dict/index.vue +0 -266
  16. package/views/config/dictType/components/edit.vue +0 -100
  17. package/views/config/dictType/index.vue +0 -244
  18. package/views/config/index.vue +0 -12
  19. package/views/config/system/components/edit.vue +0 -171
  20. package/views/config/system/index.vue +0 -286
  21. package/views/index/components/addonList.vue +0 -132
  22. package/views/index/components/environmentInfo.vue +0 -100
  23. package/views/index/components/operationLogs.vue +0 -112
  24. package/views/index/components/performanceMetrics.vue +0 -145
  25. package/views/index/components/quickActions.vue +0 -30
  26. package/views/index/components/serviceStatus.vue +0 -192
  27. package/views/index/components/systemNotifications.vue +0 -137
  28. package/views/index/components/systemOverview.vue +0 -190
  29. package/views/index/components/systemResources.vue +0 -111
  30. package/views/index/components/userInfo.vue +0 -204
  31. package/views/index/index.vue +0 -74
  32. package/views/log/email/index.vue +0 -292
  33. package/views/log/index.vue +0 -12
  34. package/views/log/login/index.vue +0 -187
  35. package/views/log/operate/index.vue +0 -249
  36. package/views/login_1/index.vue +0 -415
  37. package/views/people/admin/components/edit.vue +0 -168
  38. package/views/people/admin/index.vue +0 -240
  39. package/views/people/index.vue +0 -12
  40. package/views/permission/api/index.vue +0 -149
  41. package/views/permission/index.vue +0 -12
  42. package/views/permission/menu/index.vue +0 -128
  43. package/views/permission/role/components/api.vue +0 -261
  44. package/views/permission/role/components/edit.vue +0 -142
  45. package/views/permission/role/components/menu.vue +0 -116
  46. package/views/permission/role/index.vue +0 -263
@@ -1,190 +0,0 @@
1
- <template>
2
- <div class="section-block">
3
- <div class="section-header flex items-center gap-2">
4
- <ILucideInfo />
5
- <h2>系统概览</h2>
6
- </div>
7
- <div class="section-content">
8
- <div class="info-block">
9
- <div class="stats-grid">
10
- <div class="stat-box stat-primary">
11
- <ILucideMenu />
12
- <div class="stat-content">
13
- <div class="stat-value">{{ permissionStats.menuCount }}</div>
14
- <div class="stat-label">菜单总数</div>
15
- </div>
16
- </div>
17
- <div class="stat-box stat-success">
18
- <ILucideWebhook />
19
- <div class="stat-content">
20
- <div class="stat-value">{{ permissionStats.apiCount }}</div>
21
- <div class="stat-label">接口总数</div>
22
- </div>
23
- </div>
24
- <div class="stat-box stat-warning">
25
- <ILucideUsers />
26
- <div class="stat-content">
27
- <div class="stat-value">{{ permissionStats.roleCount }}</div>
28
- <div class="stat-label">角色总数</div>
29
- </div>
30
- </div>
31
- </div>
32
- </div>
33
- </div>
34
- </div>
35
- </template>
36
-
37
- <script setup>
38
- import ILucideInfo from "~icons/lucide/info";
39
- import ILucideMenu from "~icons/lucide/menu";
40
- import ILucideWebhook from "~icons/lucide/webhook";
41
- import ILucideUsers from "~icons/lucide/users";
42
- import { $Http } from "@/plugins/http";
43
-
44
- // 组件内部数据
45
- const permissionStats = $ref({
46
- menuCount: 0,
47
- apiCount: 0,
48
- roleCount: 0
49
- });
50
-
51
- // 获取数据
52
- const fetchData = async () => {
53
- try {
54
- const { data } = await $Http("/addon/admin/dashboard/systemOverview");
55
- Object.assign(permissionStats, data);
56
- } catch (error) {
57
- // 静默失败:不阻断页面展示
58
- }
59
- };
60
-
61
- fetchData();
62
- </script>
63
-
64
- <style scoped lang="scss">
65
- .info-block {
66
- background: transparent;
67
- border: none;
68
- padding: 0;
69
- height: 100%;
70
-
71
- .info-header {
72
- display: flex;
73
- align-items: center;
74
- gap: 6px;
75
- padding-bottom: 8px;
76
- margin-bottom: 12px;
77
- border-bottom: 2px solid var(--primary-color);
78
-
79
- .info-title {
80
- font-size: 14px;
81
- font-weight: 600;
82
- color: var(--text-primary);
83
- }
84
- }
85
-
86
- .info-grid-compact {
87
- display: grid;
88
- grid-template-columns: repeat(3, 1fr);
89
- gap: 10px;
90
-
91
- .info-grid-item {
92
- display: flex;
93
- justify-content: space-between;
94
- align-items: center;
95
- padding: 10px 12px;
96
- background: rgba(var(--primary-color-rgb), 0.02);
97
- border-radius: var(--border-radius-small);
98
- border: 1px solid var(--border-color);
99
- transition: all 0.2s ease;
100
-
101
- &:hover {
102
- background: rgba(var(--primary-color-rgb), 0.05);
103
- border-color: var(--primary-color);
104
- }
105
-
106
- .label {
107
- font-size: 14px;
108
- color: var(--text-secondary);
109
- font-weight: 500;
110
- }
111
-
112
- .value {
113
- font-size: 14px;
114
- color: var(--text-primary);
115
- font-weight: 600;
116
-
117
- &.highlight {
118
- color: var(--primary-color);
119
- }
120
- }
121
- }
122
- }
123
- }
124
-
125
- .stats-grid {
126
- display: grid;
127
- grid-template-columns: repeat(3, 1fr);
128
- gap: 10px;
129
-
130
- .stat-box {
131
- background: rgba(var(--primary-color-rgb), 0.02);
132
- border: 1px solid var(--border-color);
133
- border-radius: 6px;
134
- padding: 12px;
135
- display: flex;
136
- align-items: center;
137
- gap: 10px;
138
- transition: all 0.3s;
139
-
140
- &:hover {
141
- background: rgba(var(--primary-color-rgb), 0.05);
142
- border-color: var(--primary-color);
143
- transform: translateY(-2px);
144
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
145
- }
146
-
147
- .stat-content {
148
- flex: 1;
149
-
150
- .stat-value {
151
- font-size: 20px;
152
- font-weight: 700;
153
- margin-bottom: 2px;
154
- }
155
-
156
- .stat-label {
157
- font-size: 14px;
158
- color: var(--text-secondary);
159
- }
160
- }
161
-
162
- &.stat-primary {
163
- border-color: var(--primary-color);
164
- background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.05), white);
165
-
166
- .stat-value {
167
- color: var(--primary-color);
168
- }
169
- }
170
-
171
- &.stat-success {
172
- border-color: var(--success-color);
173
- background: linear-gradient(135deg, rgba(var(--success-color-rgb), 0.05), white);
174
-
175
- .stat-value {
176
- color: var(--success-color);
177
- }
178
- }
179
-
180
- &.stat-warning {
181
- border-color: var(--warning-color);
182
- background: linear-gradient(135deg, rgba(var(--warning-color-rgb), 0.05), white);
183
-
184
- .stat-value {
185
- color: var(--warning-color);
186
- }
187
- }
188
- }
189
- }
190
- </style>
@@ -1,111 +0,0 @@
1
- <template>
2
- <div class="section-block">
3
- <div class="section-header flex items-center gap-2">
4
- <ILucideActivity />
5
- <h2>系统资源</h2>
6
- </div>
7
- <div class="section-content">
8
- <div class="resource-compact-list">
9
- <div class="resource-compact-item">
10
- <div class="resource-compact-header">
11
- <ILucideCpu />
12
- <span class="resource-label">CPU</span>
13
- <span class="resource-value">{{ systemResources.cpu.usage }}%</span>
14
- <span class="resource-desc">{{ systemResources.cpu.cores }}核心</span>
15
- </div>
16
- <TProgress :percentage="systemResources.cpu.usage" :status="getProgressColor(systemResources.cpu.usage)" />
17
- </div>
18
- <div class="resource-compact-item">
19
- <div class="resource-compact-header">
20
- <ILucideHardDrive />
21
- <span class="resource-label">内存</span>
22
- <span class="resource-value">{{ systemResources.memory.percentage }}%</span>
23
- <span class="resource-desc">{{ systemResources.memory.used }}GB / {{ systemResources.memory.total }}GB</span>
24
- </div>
25
- <TProgress :percentage="systemResources.memory.percentage" :status="getProgressColor(systemResources.memory.percentage)" />
26
- </div>
27
- <div class="resource-compact-item">
28
- <div class="resource-compact-header">
29
- <ILucideDisc />
30
- <span class="resource-label">磁盘</span>
31
- <span class="resource-value">{{ systemResources.disk.percentage }}%</span>
32
- <span class="resource-desc">{{ systemResources.disk.used }}GB / {{ systemResources.disk.total }}GB</span>
33
- </div>
34
- <TProgress :percentage="systemResources.disk.percentage" :status="getProgressColor(systemResources.disk.percentage)" />
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
- </template>
40
-
41
- <script setup>
42
- import { Progress as TProgress } from "tdesign-vue-next";
43
- import ILucideActivity from "~icons/lucide/activity";
44
- import ILucideCpu from "~icons/lucide/cpu";
45
- import ILucideHardDrive from "~icons/lucide/hard-drive";
46
- import ILucideDisc from "~icons/lucide/disc";
47
- import { $Http } from "@/plugins/http";
48
-
49
- // 组件内部数据
50
- const systemResources = $ref({
51
- cpu: { usage: 0, cores: 0 },
52
- memory: { used: 0, total: 0, percentage: 0 },
53
- disk: { used: 0, total: 0, percentage: 0 }
54
- });
55
-
56
- // 获取数据
57
- const fetchData = async () => {
58
- try {
59
- const { data } = await $Http("/addon/admin/dashboard/systemResources");
60
- Object.assign(systemResources, data);
61
- } catch (error) {
62
- // 静默失败:不阻断页面展示
63
- }
64
- };
65
-
66
- fetchData();
67
-
68
- // 工具函数
69
- const getProgressColor = (percentage) => {
70
- if (percentage < 50) return "success";
71
- if (percentage < 80) return "warning";
72
- return "danger";
73
- };
74
- </script>
75
-
76
- <style scoped lang="scss">
77
- .resource-compact-list {
78
- display: grid;
79
- grid-template-columns: repeat(3, 1fr);
80
- gap: var(--spacing-md);
81
-
82
- .resource-compact-item {
83
- .resource-compact-header {
84
- display: flex;
85
- align-items: center;
86
- gap: 10px;
87
- margin-bottom: 8px;
88
-
89
- .resource-label {
90
- font-size: 14px;
91
- font-weight: 600;
92
- color: var(--text-secondary);
93
- min-width: 50px;
94
- }
95
-
96
- .resource-value {
97
- font-size: 16px;
98
- font-weight: 700;
99
- color: var(--primary-color);
100
- min-width: 60px;
101
- }
102
-
103
- .resource-desc {
104
- font-size: 14px;
105
- color: var(--text-placeholder);
106
- flex: 1;
107
- }
108
- }
109
- }
110
- }
111
- </style>
@@ -1,204 +0,0 @@
1
- <template>
2
- <div class="section-block user-info-card">
3
- <div class="user-header">
4
- <div class="user-avatar">
5
- <ILucideUser />
6
- </div>
7
- <div class="user-basic">
8
- <div class="user-name">
9
- {{ $Data.userInfo.nickname || $Data.userInfo.name || $Data.userInfo.username || "未设置" }}
10
- </div>
11
- <div class="user-role">{{ $Data.userInfo.role?.name || "普通用户" }}</div>
12
- </div>
13
- </div>
14
- <div class="user-details">
15
- <div class="detail-item">
16
- <ILucideMail />
17
- <span>{{ $Data.userInfo.email || "未设置" }}</span>
18
- </div>
19
- <div v-if="$Data.userInfo.phone" class="detail-item">
20
- <ILucidePhone />
21
- <span>{{ $Data.userInfo.phone }}</span>
22
- </div>
23
- <div v-if="$Data.userInfo.lastLoginTime" class="detail-item">
24
- <ILucideClock />
25
- <span>{{ $Method.formatTime($Data.userInfo.lastLoginTime) }}</span>
26
- </div>
27
- </div>
28
-
29
- <!-- 仅 dev 角色显示刷新缓存按钮 -->
30
- <div v-if="$Data.userInfo.roleCode === 'dev'" class="user-actions">
31
- <TButton theme="primary" size="mini" :loading="$Data.refreshing" @click="$Method.handleRefreshCache">
32
- <template #icon>
33
- <ILucideRotateCw />
34
- </template>
35
- 刷新缓存
36
- </TButton>
37
- </div>
38
- </div>
39
- </template>
40
-
41
- <script setup>
42
- import { Button as TButton, MessagePlugin } from "tdesign-vue-next";
43
- import ILucideUser from "~icons/lucide/user";
44
- import ILucideMail from "~icons/lucide/mail";
45
- import ILucidePhone from "~icons/lucide/phone";
46
- import ILucideClock from "~icons/lucide/clock";
47
- import ILucideRotateCw from "~icons/lucide/rotate-cw";
48
- import { $Http } from "@/plugins/http";
49
-
50
- // 响应式数据
51
- const $Data = $ref({
52
- userInfo: {},
53
- refreshing: false
54
- });
55
-
56
- // 方法集合
57
- const $Method = {
58
- // 获取数据
59
- async fetchData() {
60
- try {
61
- const { data } = await $Http("/addon/admin/admin/detail");
62
- Object.assign($Data.userInfo, data);
63
- } catch (error) {
64
- MessagePlugin.error("获取用户信息失败");
65
- }
66
- },
67
-
68
- // 刷新缓存
69
- async handleRefreshCache() {
70
- try {
71
- $Data.refreshing = true;
72
- const result = await $Http("/addon/admin/admin/cacheRefresh");
73
-
74
- if (result.code === 0) {
75
- const { apis, menus, roles } = result.data;
76
- const messages = [];
77
-
78
- if (apis.success) {
79
- messages.push(`接口缓存: ${apis.count} 个`);
80
- }
81
- if (menus.success) {
82
- messages.push(`菜单缓存: ${menus.count} 个`);
83
- }
84
- if (roles.success) {
85
- messages.push(`角色缓存: ${roles.count} 个`);
86
- }
87
-
88
- MessagePlugin.success(`缓存刷新成功!${messages.join(",")}`);
89
- } else {
90
- MessagePlugin.warning(result.msg || "部分缓存刷新失败");
91
- }
92
- } catch (error) {
93
- MessagePlugin.error("刷新缓存失败,请稍后重试");
94
- } finally {
95
- $Data.refreshing = false;
96
- }
97
- },
98
-
99
- // 格式化时间
100
- formatTime(timestamp) {
101
- if (!timestamp) return "";
102
- const date = new Date(Number(timestamp));
103
- const now = new Date();
104
- const diff = now - date;
105
-
106
- // 小于1分钟
107
- if (diff < 60000) {
108
- return "刚刚";
109
- }
110
- // 小于1小时
111
- if (diff < 3600000) {
112
- return `${Math.floor(diff / 60000)}分钟前`;
113
- }
114
- // 小于24小时
115
- if (diff < 86400000) {
116
- return `${Math.floor(diff / 3600000)}小时前`;
117
- }
118
- // 小于7天
119
- if (diff < 604800000) {
120
- return `${Math.floor(diff / 86400000)}天前`;
121
- }
122
- // 超过7天显示具体日期
123
- return `${date.getMonth() + 1}月${date.getDate()}日`;
124
- }
125
- };
126
-
127
- // 初始化
128
- $Method.fetchData();
129
- </script>
130
-
131
- <style scoped lang="scss">
132
- .user-info-card {
133
- background-color: #fff;
134
- padding: 15px;
135
- .user-header {
136
- display: flex;
137
- align-items: center;
138
- gap: 12px;
139
- padding-bottom: 12px;
140
- border-bottom: 1px solid var(--border-color);
141
-
142
- .user-avatar {
143
- width: 48px;
144
- height: 48px;
145
- background: linear-gradient(135deg, var(--primary-color), #764ba2);
146
- border-radius: 50%;
147
- display: flex;
148
- align-items: center;
149
- justify-content: center;
150
- color: white;
151
- flex-shrink: 0;
152
- }
153
-
154
- .user-basic {
155
- flex: 1;
156
- min-width: 0;
157
-
158
- .user-name {
159
- font-size: 16px;
160
- font-weight: 600;
161
- color: var(--text-primary);
162
- margin-bottom: 4px;
163
- overflow: hidden;
164
- text-overflow: ellipsis;
165
- white-space: nowrap;
166
- }
167
-
168
- .user-role {
169
- font-size: 12px;
170
- color: var(--text-secondary);
171
- }
172
- }
173
- }
174
-
175
- .user-details {
176
- display: flex;
177
- flex-direction: column;
178
- gap: 8px;
179
- margin-top: 12px;
180
-
181
- .detail-item {
182
- display: flex;
183
- align-items: center;
184
- gap: 8px;
185
- font-size: 12px;
186
- color: var(--text-secondary);
187
-
188
- span {
189
- overflow: hidden;
190
- text-overflow: ellipsis;
191
- white-space: nowrap;
192
- }
193
- }
194
- }
195
-
196
- .user-actions {
197
- margin-top: 16px;
198
- padding-top: 12px;
199
- border-top: 1px solid var(--border-color);
200
- display: flex;
201
- justify-content: center;
202
- }
203
- }
204
- </style>
@@ -1,74 +0,0 @@
1
- <template>
2
- <div class="dashboard-container">
3
- <!-- 第一行:系统概览(全宽) -->
4
- <div class="dashboard-row full-width">
5
- <SystemOverview />
6
- </div>
7
-
8
- <!-- 第二行:服务状态 + 系统资源 -->
9
- <div class="dashboard-row two-columns">
10
- <ServiceStatus />
11
- <SystemResources />
12
- </div>
13
-
14
- <!-- 第三行:性能指标 + 环境信息 -->
15
- <div class="dashboard-row two-columns">
16
- <PerformanceMetrics />
17
- <EnvironmentInfo />
18
- </div>
19
- </div>
20
- </template>
21
-
22
- <script setup>
23
- import SystemOverview from "./components/systemOverview.vue";
24
- import ServiceStatus from "./components/serviceStatus.vue";
25
- import SystemResources from "./components/systemResources.vue";
26
- import PerformanceMetrics from "./components/performanceMetrics.vue";
27
- import EnvironmentInfo from "./components/environmentInfo.vue";
28
-
29
- definePage({
30
- meta: {
31
- title: "首页",
32
- order: 0
33
- }
34
- });
35
- </script>
36
-
37
- <style scoped lang="scss">
38
- .dashboard-container {
39
- display: flex;
40
- flex-direction: column;
41
- gap: var(--layout-gap);
42
- overflow-y: auto;
43
- height: 100%;
44
- padding: 0;
45
-
46
- .dashboard-row {
47
- display: flex;
48
- gap: var(--layout-gap);
49
-
50
- &.full-width {
51
- > * {
52
- flex: 1;
53
- }
54
- }
55
-
56
- &.two-columns {
57
- > * {
58
- flex: 1;
59
- min-width: 0;
60
- }
61
- }
62
- }
63
-
64
- // 每个组件都是独立的卡片
65
- :deep(.section-block) {
66
- background: var(--bg-color-container);
67
- border-radius: var(--card-radius);
68
- box-shadow: var(--shadow-1);
69
- padding: var(--spacing-md);
70
- border: none;
71
- height: 100%;
72
- }
73
- }
74
- </style>