befly-admin 3.0.1
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/.env.development +4 -0
- package/.env.production +4 -0
- package/LICENSE +201 -0
- package/README.md +143 -0
- package/index.html +13 -0
- package/libs/auto-routes-template.js +104 -0
- package/libs/autoRouter.ts +67 -0
- package/libs/icons.ts +543 -0
- package/package.json +42 -0
- package/public/logo.svg +106 -0
- package/src/App.vue +17 -0
- package/src/api/auth.ts +60 -0
- package/src/components/Icon.vue +41 -0
- package/src/env.d.ts +9 -0
- package/src/layouts/0.vue +207 -0
- package/src/layouts/1.vue +22 -0
- package/src/layouts/2.vue +166 -0
- package/src/main.ts +19 -0
- package/src/plugins/http.ts +94 -0
- package/src/plugins/router.ts +47 -0
- package/src/plugins/store.ts +19 -0
- package/src/styles/index.scss +198 -0
- package/src/styles/mixins.scss +98 -0
- package/src/styles/variables.scss +75 -0
- package/src/types/env.d.ts +23 -0
- package/src/util.ts +28 -0
- package/src/views/403/403.vue +33 -0
- package/src/views/admin/components/edit.vue +147 -0
- package/src/views/admin/components/role.vue +135 -0
- package/src/views/admin/index.vue +169 -0
- package/src/views/dict/components/edit.vue +156 -0
- package/src/views/dict/index.vue +159 -0
- package/src/views/index/components/AddonList.vue +125 -0
- package/src/views/index/components/EnvironmentInfo.vue +97 -0
- package/src/views/index/components/OperationLogs.vue +112 -0
- package/src/views/index/components/PerformanceMetrics.vue +148 -0
- package/src/views/index/components/QuickActions.vue +27 -0
- package/src/views/index/components/ServiceStatus.vue +193 -0
- package/src/views/index/components/SystemNotifications.vue +136 -0
- package/src/views/index/components/SystemOverview.vue +188 -0
- package/src/views/index/components/SystemResources.vue +104 -0
- package/src/views/index/components/UserInfo.vue +136 -0
- package/src/views/index/index.vue +62 -0
- package/src/views/login/index_1.vue +694 -0
- package/src/views/menu/components/edit.vue +150 -0
- package/src/views/menu/index.vue +168 -0
- package/src/views/news/detail/detail_2.vue +26 -0
- package/src/views/news/detail/index.vue +26 -0
- package/src/views/news/news.vue +26 -0
- package/src/views/role/components/api.vue +280 -0
- package/src/views/role/components/edit.vue +129 -0
- package/src/views/role/components/menu.vue +143 -0
- package/src/views/role/index.vue +179 -0
- package/src/views/user/user.vue +320 -0
- package/temp/router.js +71 -0
- package/tsconfig.json +34 -0
- package/vite.config.ts +100 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="section-block">
|
|
3
|
+
<div class="section-header">
|
|
4
|
+
<Icon name="Package" :size="20" />
|
|
5
|
+
<h2>已安装插件</h2>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="section-content">
|
|
8
|
+
<div class="addon-list">
|
|
9
|
+
<div v-for="addon in addonList" :key="addon.name" class="addon-item">
|
|
10
|
+
<div class="addon-status-badge" :class="{ active: addon.enabled }"></div>
|
|
11
|
+
<div class="addon-icon">
|
|
12
|
+
<Icon name="Box" :size="20" />
|
|
13
|
+
</div>
|
|
14
|
+
<div class="addon-info">
|
|
15
|
+
<div class="addon-title">
|
|
16
|
+
<span class="addon-name">{{ addon.title }}</span>
|
|
17
|
+
<t-tag theme="success" variant="outline" size="small">{{ addon.version }}</t-tag>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="addon-desc">{{ addon.description }}</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
28
|
+
// 组件内部数据
|
|
29
|
+
const addonList = $ref([]);
|
|
30
|
+
|
|
31
|
+
// 获取数据
|
|
32
|
+
const fetchData = async () => {
|
|
33
|
+
try {
|
|
34
|
+
const { data } = await $Http('/addon/admin/dashboardAddonList');
|
|
35
|
+
addonList.splice(0, addonList.length, ...data);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('获取插件列表失败:', error);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
fetchData();
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style scoped lang="scss">
|
|
45
|
+
.addon-list {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
|
|
50
|
+
.addon-item {
|
|
51
|
+
position: relative;
|
|
52
|
+
background: $bg-color-container;
|
|
53
|
+
border: 1px solid $border-color;
|
|
54
|
+
border-left: 3px solid $primary-color;
|
|
55
|
+
border-radius: $border-radius-small;
|
|
56
|
+
padding: 10px 12px;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 10px;
|
|
60
|
+
transition: all 0.3s;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
border-left-color: $success-color;
|
|
64
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
|
|
65
|
+
transform: translateY(-2px);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.addon-status-badge {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 8px;
|
|
71
|
+
right: 8px;
|
|
72
|
+
width: 8px;
|
|
73
|
+
height: 8px;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
background: $text-disabled;
|
|
76
|
+
transition: all 0.3s;
|
|
77
|
+
|
|
78
|
+
&.active {
|
|
79
|
+
background: $success-color;
|
|
80
|
+
box-shadow: 0 0 0 2px rgba($success-color, 0.2);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.addon-icon {
|
|
85
|
+
width: 32px;
|
|
86
|
+
height: 32px;
|
|
87
|
+
background: linear-gradient(135deg, $primary-color, #764ba2);
|
|
88
|
+
border-radius: $border-radius-small;
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
color: white;
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.addon-info {
|
|
97
|
+
flex: 1;
|
|
98
|
+
min-width: 0;
|
|
99
|
+
padding-right: 16px;
|
|
100
|
+
|
|
101
|
+
.addon-title {
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 6px;
|
|
105
|
+
margin-bottom: 2px;
|
|
106
|
+
|
|
107
|
+
.addon-name {
|
|
108
|
+
font-size: 14px;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
color: $text-primary;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.addon-desc {
|
|
115
|
+
font-size: 14px;
|
|
116
|
+
color: $text-secondary;
|
|
117
|
+
line-height: 1.3;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
text-overflow: ellipsis;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="section-block">
|
|
3
|
+
<div class="section-header">
|
|
4
|
+
<Icon name="Server" :size="20" />
|
|
5
|
+
<h2>运行环境</h2>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="section-content">
|
|
8
|
+
<div class="env-grid-compact">
|
|
9
|
+
<div class="env-compact-item">
|
|
10
|
+
<span class="env-label">操作系统</span>
|
|
11
|
+
<span class="env-value">{{ environmentInfo.os }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="env-compact-item">
|
|
14
|
+
<span class="env-label">服务器</span>
|
|
15
|
+
<span class="env-value">{{ environmentInfo.server }}</span>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="env-compact-item">
|
|
18
|
+
<span class="env-label">Node版本</span>
|
|
19
|
+
<span class="env-value">{{ environmentInfo.nodeVersion }}</span>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="env-compact-item">
|
|
22
|
+
<span class="env-label">数据库</span>
|
|
23
|
+
<span class="env-value">{{ environmentInfo.database }}</span>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="env-compact-item">
|
|
26
|
+
<span class="env-label">缓存</span>
|
|
27
|
+
<span class="env-value">{{ environmentInfo.cache }}</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="env-compact-item">
|
|
30
|
+
<span class="env-label">时区</span>
|
|
31
|
+
<span class="env-value">{{ environmentInfo.timezone }}</span>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup>
|
|
39
|
+
// 组件内部数据
|
|
40
|
+
const environmentInfo = $ref({
|
|
41
|
+
os: '',
|
|
42
|
+
server: '',
|
|
43
|
+
nodeVersion: '',
|
|
44
|
+
database: '',
|
|
45
|
+
cache: '',
|
|
46
|
+
timezone: ''
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 获取数据
|
|
50
|
+
const fetchData = async () => {
|
|
51
|
+
try {
|
|
52
|
+
const { data } = await $Http('/addon/admin/dashboardEnvironmentInfo');
|
|
53
|
+
Object.assign(environmentInfo, data);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('获取运行环境信息失败:', error);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
fetchData();
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style scoped lang="scss">
|
|
63
|
+
.env-grid-compact {
|
|
64
|
+
display: grid;
|
|
65
|
+
grid-template-columns: repeat(4, 1fr);
|
|
66
|
+
gap: 10px;
|
|
67
|
+
|
|
68
|
+
.env-compact-item {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
align-items: center;
|
|
72
|
+
padding: 10px 12px;
|
|
73
|
+
background: $bg-color-container;
|
|
74
|
+
border-radius: 6px;
|
|
75
|
+
border: 1px solid $border-color;
|
|
76
|
+
transition: all 0.2s ease;
|
|
77
|
+
|
|
78
|
+
&:hover {
|
|
79
|
+
background: rgba($primary-color, 0.03);
|
|
80
|
+
border-color: rgba($primary-color, 0.2);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.env-label {
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
color: $text-secondary;
|
|
86
|
+
font-weight: 500;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.env-value {
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
color: $text-primary;
|
|
92
|
+
font-weight: 600;
|
|
93
|
+
text-align: right;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="section-block">
|
|
3
|
+
<div class="section-header">
|
|
4
|
+
<Icon name="List" :size="20" />
|
|
5
|
+
<h2>操作日志</h2>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="section-content">
|
|
8
|
+
<div class="operation-table">
|
|
9
|
+
<div class="operation-header">
|
|
10
|
+
<span class="col-time">时间</span>
|
|
11
|
+
<span class="col-user">操作人</span>
|
|
12
|
+
<span class="col-action">操作</span>
|
|
13
|
+
<span class="col-module">模块</span>
|
|
14
|
+
<span class="col-ip">IP地址</span>
|
|
15
|
+
<span class="col-status">状态</span>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="operation-body">
|
|
18
|
+
<div v-for="log in operationLogs" :key="log.id" class="operation-row">
|
|
19
|
+
<span class="col-time">{{ formatTime(log.createdAt) }}</span>
|
|
20
|
+
<span class="col-user">{{ log.userName }}</span>
|
|
21
|
+
<span class="col-action">{{ log.action }}</span>
|
|
22
|
+
<span class="col-module">{{ log.module }}</span>
|
|
23
|
+
<span class="col-ip">{{ log.ip }}</span>
|
|
24
|
+
<span class="col-status">
|
|
25
|
+
<t-tag :theme="log.status === 'success' ? 'success' : 'danger'" size="small" variant="light">
|
|
26
|
+
{{ log.status === 'success' ? '成功' : '失败' }}
|
|
27
|
+
</t-tag>
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
// 组件内部数据
|
|
38
|
+
const operationLogs = $ref([
|
|
39
|
+
{ id: 1, userName: '管理员', action: '创建角色', module: '权限管理', ip: '192.168.1.100', status: 'success', createdAt: Date.now() - 120000 },
|
|
40
|
+
{ id: 2, userName: '张三', action: '修改菜单', module: '系统设置', ip: '192.168.1.101', status: 'success', createdAt: Date.now() - 900000 },
|
|
41
|
+
{ id: 3, userName: '李四', action: '删除接口', module: '接口管理', ip: '192.168.1.102', status: 'failed', createdAt: Date.now() - 3600000 },
|
|
42
|
+
{ id: 4, userName: '管理员', action: '同步数据库', module: '数据库', ip: '192.168.1.100', status: 'success', createdAt: Date.now() - 7200000 },
|
|
43
|
+
{ id: 5, userName: '王五', action: '登录系统', module: '系统', ip: '192.168.1.103', status: 'success', createdAt: Date.now() - 10800000 }
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const formatTime = (timestamp) => {
|
|
47
|
+
const date = new Date(timestamp);
|
|
48
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
49
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
50
|
+
const hours = String(date.getHours()).padStart(2, '0');
|
|
51
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
52
|
+
return `${month}-${day} ${hours}:${minutes}`;
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style scoped lang="scss">
|
|
57
|
+
.operation-table {
|
|
58
|
+
.operation-header,
|
|
59
|
+
.operation-row {
|
|
60
|
+
display: grid;
|
|
61
|
+
grid-template-columns: 100px 100px 1fr 120px 120px 80px;
|
|
62
|
+
gap: 12px;
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.operation-header {
|
|
67
|
+
padding: 10px 12px;
|
|
68
|
+
background: linear-gradient(135deg, rgba($primary-color, 0.05) 0%, rgba($primary-color, 0.02) 100%);
|
|
69
|
+
border-radius: 6px;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
color: $text-secondary;
|
|
73
|
+
margin-bottom: 6px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.operation-body {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 4px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.operation-row {
|
|
83
|
+
padding: 10px 12px;
|
|
84
|
+
background: $bg-color-container;
|
|
85
|
+
border-radius: 6px;
|
|
86
|
+
border: 1px solid $border-color;
|
|
87
|
+
font-size: 14px;
|
|
88
|
+
transition: all 0.2s ease;
|
|
89
|
+
|
|
90
|
+
&:hover {
|
|
91
|
+
background: rgba($primary-color, 0.02);
|
|
92
|
+
border-color: rgba($primary-color, 0.2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.col-time {
|
|
96
|
+
color: $text-secondary;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.col-user,
|
|
101
|
+
.col-action,
|
|
102
|
+
.col-module,
|
|
103
|
+
.col-ip {
|
|
104
|
+
color: $text-primary;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.col-action {
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="section-block">
|
|
3
|
+
<div class="section-header">
|
|
4
|
+
<Icon name="Zap" :size="20" />
|
|
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
|
+
<Icon name="Clock" :size="18" />
|
|
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
|
+
<Icon name="TrendingUp" :size="18" />
|
|
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
|
+
<Icon name="AlertCircle" :size="18" />
|
|
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
|
+
<Icon name="Activity" :size="18" />
|
|
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
|
+
<Icon name="AlertTriangle" :size="14" />
|
|
49
|
+
<span>最慢接口: {{ performanceMetrics.slowestApi.path }} ({{ performanceMetrics.slowestApi.time }}ms)</span>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup>
|
|
56
|
+
// 组件内部数据
|
|
57
|
+
const performanceMetrics = $ref({
|
|
58
|
+
avgResponseTime: 0,
|
|
59
|
+
qps: 0,
|
|
60
|
+
errorRate: 0,
|
|
61
|
+
activeConnections: 0,
|
|
62
|
+
slowestApi: null
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// 获取数据
|
|
66
|
+
const fetchData = async () => {
|
|
67
|
+
try {
|
|
68
|
+
const { data } = await $Http('/addon/admin/dashboardPerformanceMetrics');
|
|
69
|
+
Object.assign(performanceMetrics, data);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error('获取性能指标失败:', error);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
fetchData();
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style scoped lang="scss">
|
|
79
|
+
.performance-grid {
|
|
80
|
+
display: grid;
|
|
81
|
+
grid-template-columns: repeat(4, 1fr);
|
|
82
|
+
gap: $spacing-sm;
|
|
83
|
+
margin-bottom: $spacing-sm;
|
|
84
|
+
|
|
85
|
+
.perf-metric {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: $spacing-sm;
|
|
89
|
+
padding: $spacing-sm $spacing-md;
|
|
90
|
+
background: rgba($primary-color, 0.02);
|
|
91
|
+
border-radius: $border-radius;
|
|
92
|
+
border: 1px solid $border-color;
|
|
93
|
+
transition: all 0.2s ease;
|
|
94
|
+
|
|
95
|
+
&:hover {
|
|
96
|
+
background: rgba($primary-color, 0.05);
|
|
97
|
+
border-color: $primary-color;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.perf-icon {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
width: 36px;
|
|
105
|
+
height: 36px;
|
|
106
|
+
border-radius: $border-radius-small;
|
|
107
|
+
background: linear-gradient(135deg, rgba($success-color, 0.1) 0%, rgba($success-color, 0.05) 100%);
|
|
108
|
+
color: $success-color;
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.perf-info {
|
|
113
|
+
flex: 1;
|
|
114
|
+
|
|
115
|
+
.perf-label {
|
|
116
|
+
font-size: 14px;
|
|
117
|
+
color: $text-secondary;
|
|
118
|
+
margin-bottom: 2px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.perf-value {
|
|
122
|
+
font-size: 16px;
|
|
123
|
+
font-weight: 700;
|
|
124
|
+
color: $primary-color;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.perf-slowest {
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 6px;
|
|
134
|
+
padding: $spacing-sm $spacing-md;
|
|
135
|
+
background: rgba($warning-color, 0.05);
|
|
136
|
+
border-radius: $border-radius-small;
|
|
137
|
+
border: 1px solid rgba($warning-color, 0.2);
|
|
138
|
+
font-size: 14px;
|
|
139
|
+
color: $warning-color;
|
|
140
|
+
|
|
141
|
+
span {
|
|
142
|
+
flex: 1;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="section-block">
|
|
3
|
+
<div class="section-content">
|
|
4
|
+
<t-button theme="primary" size="large" @click="handleClearCache">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<Icon name="RotateCw" :size="18" />
|
|
7
|
+
</template>
|
|
8
|
+
刷新缓存
|
|
9
|
+
</t-button>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
const handleClearCache = () => {
|
|
16
|
+
console.log('刷新缓存');
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<style scoped lang="scss">
|
|
21
|
+
.section-block {
|
|
22
|
+
.section-content {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="section-block">
|
|
3
|
+
<div class="section-header">
|
|
4
|
+
<Icon name="Settings" :size="20" />
|
|
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
|
+
<Icon :name="getServiceIcon(service.name)" :size="20" />
|
|
12
|
+
</div>
|
|
13
|
+
<div class="config-info">
|
|
14
|
+
<div class="config-name">{{ service.name }}</div>
|
|
15
|
+
<div class="config-status">
|
|
16
|
+
{{ getStatusText(service.status) }}
|
|
17
|
+
<span v-if="service.responseTime && service.responseTime !== '-'" class="latency">{{ service.responseTime }}</span>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="config-badge">
|
|
21
|
+
<Icon :name="getStatusIcon(service.status)" :size="32" />
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup>
|
|
30
|
+
// 组件内部数据
|
|
31
|
+
const services = $ref([]);
|
|
32
|
+
|
|
33
|
+
// 获取数据
|
|
34
|
+
const fetchData = async () => {
|
|
35
|
+
try {
|
|
36
|
+
const { data } = await $Http('/addon/admin/dashboardServiceStatus');
|
|
37
|
+
services.splice(0, services.length, ...data.services);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('获取服务状态失败:', error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
fetchData();
|
|
44
|
+
|
|
45
|
+
// 工具函数
|
|
46
|
+
const getStatusColor = (status) => {
|
|
47
|
+
const colors = {
|
|
48
|
+
running: 'success',
|
|
49
|
+
stopped: 'error',
|
|
50
|
+
unconfigured: 'warning'
|
|
51
|
+
};
|
|
52
|
+
return colors[status] || 'default';
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const getStatusText = (status) => {
|
|
56
|
+
const texts = {
|
|
57
|
+
running: '正常',
|
|
58
|
+
stopped: '停止',
|
|
59
|
+
unconfigured: '未配置'
|
|
60
|
+
};
|
|
61
|
+
return texts[status] || status;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getServiceIcon = (name) => {
|
|
65
|
+
const icons = {
|
|
66
|
+
数据库: 'Database',
|
|
67
|
+
Redis: 'Zap',
|
|
68
|
+
文件系统: 'HardDrive',
|
|
69
|
+
邮件服务: 'Mail',
|
|
70
|
+
OSS存储: 'Cloud'
|
|
71
|
+
};
|
|
72
|
+
return icons[name] || 'Circle';
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const getStatusIcon = (status) => {
|
|
76
|
+
const icons = {
|
|
77
|
+
running: 'CheckCircle',
|
|
78
|
+
stopped: 'XCircle',
|
|
79
|
+
unconfigured: 'AlertCircle'
|
|
80
|
+
};
|
|
81
|
+
return icons[status] || 'Circle';
|
|
82
|
+
};
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped lang="scss">
|
|
86
|
+
.config-grid {
|
|
87
|
+
display: grid;
|
|
88
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
89
|
+
gap: 10px;
|
|
90
|
+
|
|
91
|
+
.config-card {
|
|
92
|
+
background: rgba($primary-color, 0.02);
|
|
93
|
+
border: 1px solid $border-color;
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
padding: 12px;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 10px;
|
|
99
|
+
position: relative;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
transition: all 0.3s;
|
|
102
|
+
|
|
103
|
+
&:hover {
|
|
104
|
+
background: rgba($primary-color, 0.05);
|
|
105
|
+
border-color: $primary-color;
|
|
106
|
+
transform: translateY(-2px);
|
|
107
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.config-icon {
|
|
111
|
+
width: 40px;
|
|
112
|
+
height: 40px;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
border-radius: 6px;
|
|
117
|
+
flex-shrink: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.config-info {
|
|
121
|
+
flex: 1;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
|
|
124
|
+
.config-name {
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
font-weight: 600;
|
|
127
|
+
margin-bottom: 2px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.config-status {
|
|
131
|
+
font-size: 14px;
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
gap: 4px;
|
|
135
|
+
|
|
136
|
+
.latency {
|
|
137
|
+
margin-left: 4px;
|
|
138
|
+
color: $text-placeholder;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.config-badge {
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: 6px;
|
|
146
|
+
right: 6px;
|
|
147
|
+
opacity: 0.2;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&.config-running {
|
|
151
|
+
border-color: $success-color;
|
|
152
|
+
background: linear-gradient(135deg, rgba(82, 196, 26, 0.05), white);
|
|
153
|
+
|
|
154
|
+
.config-icon {
|
|
155
|
+
background: rgba(82, 196, 26, 0.1);
|
|
156
|
+
color: $success-color;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.config-name {
|
|
160
|
+
color: $success-color;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&.config-unconfigured {
|
|
165
|
+
border-color: $warning-color;
|
|
166
|
+
background: linear-gradient(135deg, rgba(250, 173, 20, 0.05), white);
|
|
167
|
+
|
|
168
|
+
.config-icon {
|
|
169
|
+
background: rgba(250, 173, 20, 0.1);
|
|
170
|
+
color: $warning-color;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.config-name {
|
|
174
|
+
color: $warning-color;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&.config-stopped {
|
|
179
|
+
border-color: $error-color;
|
|
180
|
+
background: linear-gradient(135deg, rgba(255, 77, 79, 0.05), white);
|
|
181
|
+
|
|
182
|
+
.config-icon {
|
|
183
|
+
background: rgba(255, 77, 79, 0.1);
|
|
184
|
+
color: $error-color;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.config-name {
|
|
188
|
+
color: $error-color;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
</style>
|