befly-admin-ui 1.45.0 → 1.47.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/package.json
CHANGED
package/views/index/index.vue
CHANGED
|
@@ -15,16 +15,11 @@
|
|
|
15
15
|
<div class="dashboard-row full-width">
|
|
16
16
|
<EnvironmentInfo />
|
|
17
17
|
</div>
|
|
18
|
-
|
|
19
|
-
<div class="dashboard-row full-width">
|
|
20
|
-
<ProjectStats />
|
|
21
|
-
</div>
|
|
22
18
|
</div>
|
|
23
19
|
</template>
|
|
24
20
|
|
|
25
21
|
<script setup>
|
|
26
22
|
import EnvironmentInfo from "./components/environmentInfo.vue";
|
|
27
|
-
import ProjectStats from "./components/projectStats.vue";
|
|
28
23
|
import ServiceStatus from "./components/serviceStatus.vue";
|
|
29
24
|
import SystemOverview from "./components/systemOverview.vue";
|
|
30
25
|
import SystemResources from "./components/systemResources.vue";
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-project-stats">
|
|
3
|
+
<div class="section-block">
|
|
4
|
+
<div class="section-header">
|
|
5
|
+
<ChartIcon />
|
|
6
|
+
<h2>项目统计</h2>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="section-content">
|
|
10
|
+
<div class="project-row-list">
|
|
11
|
+
<div v-for="item in $Computed.productRows" :key="item.key" class="product-row">
|
|
12
|
+
<div class="product-title">{{ $Method.formatProductTitle(item) }}</div>
|
|
13
|
+
|
|
14
|
+
<t-row :gutter="[16, 16]">
|
|
15
|
+
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
16
|
+
<div class="metric-card">
|
|
17
|
+
<span class="metric-label">在线人数</span>
|
|
18
|
+
<strong class="metric-value-online">{{ item.onlineCount }}</strong>
|
|
19
|
+
</div>
|
|
20
|
+
</t-col>
|
|
21
|
+
|
|
22
|
+
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
23
|
+
<div class="metric-card">
|
|
24
|
+
<span class="metric-label">今日访客</span>
|
|
25
|
+
<strong class="metric-value-visitor">{{ item.today }}</strong>
|
|
26
|
+
</div>
|
|
27
|
+
</t-col>
|
|
28
|
+
|
|
29
|
+
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
30
|
+
<div class="metric-card">
|
|
31
|
+
<span class="metric-label">昨日访客</span>
|
|
32
|
+
<strong class="metric-value-visitor">{{ item.yesterday }}</strong>
|
|
33
|
+
</div>
|
|
34
|
+
</t-col>
|
|
35
|
+
|
|
36
|
+
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
37
|
+
<div class="metric-card">
|
|
38
|
+
<span class="metric-label">前天访客</span>
|
|
39
|
+
<strong class="metric-value-visitor">{{ item.dayBeforeYesterday }}</strong>
|
|
40
|
+
</div>
|
|
41
|
+
</t-col>
|
|
42
|
+
|
|
43
|
+
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
44
|
+
<div class="metric-card">
|
|
45
|
+
<span class="metric-label">近30天访客</span>
|
|
46
|
+
<strong class="metric-value-visitor">{{ item.recent30 }}</strong>
|
|
47
|
+
</div>
|
|
48
|
+
</t-col>
|
|
49
|
+
|
|
50
|
+
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
51
|
+
<div class="metric-card">
|
|
52
|
+
<span class="metric-label">本月访客</span>
|
|
53
|
+
<strong class="metric-value-visitor">{{ item.month }}</strong>
|
|
54
|
+
</div>
|
|
55
|
+
</t-col>
|
|
56
|
+
</t-row>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup>
|
|
65
|
+
import { ChartIcon } from "tdesign-icons-vue-next";
|
|
66
|
+
import { Col as TCol, Row as TRow } from "tdesign-vue-next";
|
|
67
|
+
import { computed, reactive } from "vue";
|
|
68
|
+
|
|
69
|
+
import { $Http } from "@/plugins/http.js";
|
|
70
|
+
|
|
71
|
+
const $Data = reactive({
|
|
72
|
+
productState: {
|
|
73
|
+
options: []
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const $Method = {
|
|
78
|
+
buildProjectRow: function (visitItem, onlineItem) {
|
|
79
|
+
return {
|
|
80
|
+
key: String(visitItem?.key || onlineItem?.key || visitItem?.productCode || onlineItem?.productCode || ""),
|
|
81
|
+
productName: String(visitItem?.productName || onlineItem?.productName || "-"),
|
|
82
|
+
productCode: String(visitItem?.productCode || onlineItem?.productCode || ""),
|
|
83
|
+
|
|
84
|
+
onlineCount: Number(onlineItem?.onlineCount || 0),
|
|
85
|
+
today: Number(visitItem?.today || 0),
|
|
86
|
+
yesterday: Number(visitItem?.yesterday || 0),
|
|
87
|
+
dayBeforeYesterday: Number(visitItem?.dayBeforeYesterday || 0),
|
|
88
|
+
recent30: Number(visitItem?.recent30 || 0),
|
|
89
|
+
month: Number(visitItem?.month || 0)
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
formatProductTitle: function (row) {
|
|
93
|
+
const productName = row?.productName;
|
|
94
|
+
const productCode = row?.productCode;
|
|
95
|
+
|
|
96
|
+
if (productName && productCode) {
|
|
97
|
+
return `${productName}(${productCode})`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return productName || productCode || "-";
|
|
101
|
+
},
|
|
102
|
+
mapProjectRows: function (infoStatsData, onlineStatsData) {
|
|
103
|
+
const onlineMap = new Map();
|
|
104
|
+
|
|
105
|
+
for (const item of onlineStatsData?.products || []) {
|
|
106
|
+
onlineMap.set(String(item?.productCode || item?.key || ""), item);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const rows = [];
|
|
110
|
+
|
|
111
|
+
for (const item of infoStatsData?.products || []) {
|
|
112
|
+
const productCode = String(item?.productCode || item?.key || "");
|
|
113
|
+
rows.push($Method.buildProjectRow(item, onlineMap.get(productCode)));
|
|
114
|
+
onlineMap.delete(productCode);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (const item of onlineMap.values()) {
|
|
118
|
+
rows.push($Method.buildProjectRow(null, item));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return rows.filter((item) => {
|
|
122
|
+
return Boolean(item.key);
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
fetchData: async function () {
|
|
126
|
+
try {
|
|
127
|
+
const [infoStatsRes, onlineStatsRes] = await Promise.all([$Http("/core/tongJi/infoStats", {}, [""]), $Http("/core/tongJi/onlineStats", {}, [""])]);
|
|
128
|
+
$Data.productState.options = $Method.mapProjectRows(infoStatsRes.data, onlineStatsRes.data);
|
|
129
|
+
} catch (_error) {
|
|
130
|
+
// 静默失败:不阻断页面展示
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const $Computed = reactive({
|
|
136
|
+
productRows: computed(() => {
|
|
137
|
+
return Array.isArray($Data.productState.options) ? $Data.productState.options.slice() : [];
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
$Method.fetchData();
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<style scoped lang="scss">
|
|
145
|
+
@use "../../styles/dashboardCard.scss" as dashboardCard;
|
|
146
|
+
|
|
147
|
+
.page-project-stats {
|
|
148
|
+
height: 100%;
|
|
149
|
+
min-width: 0;
|
|
150
|
+
overflow-y: auto;
|
|
151
|
+
overflow-x: hidden;
|
|
152
|
+
padding: 4px 0 12px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.section-content {
|
|
156
|
+
min-width: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.project-row-list {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
gap: 20px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.product-row {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
gap: 12px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.product-title {
|
|
172
|
+
font-size: 16px;
|
|
173
|
+
font-weight: 700;
|
|
174
|
+
color: var(--text-primary);
|
|
175
|
+
line-height: 1.2;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.metric-col {
|
|
179
|
+
min-width: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.metric-label {
|
|
183
|
+
@include dashboardCard.dashboardCardLabel();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.metric-value-online {
|
|
187
|
+
@include dashboardCard.dashboardCardNumericValue(var(--error-color));
|
|
188
|
+
|
|
189
|
+
color: var(--error-color);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.metric-card {
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
align-items: flex-start;
|
|
196
|
+
text-align: left;
|
|
197
|
+
|
|
198
|
+
@include dashboardCard.dashboardCardShell();
|
|
199
|
+
|
|
200
|
+
gap: 8px;
|
|
201
|
+
justify-content: flex-start;
|
|
202
|
+
padding: 12px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.metric-value-visitor {
|
|
206
|
+
@include dashboardCard.dashboardCardNumericValue(var(--success-color));
|
|
207
|
+
|
|
208
|
+
color: var(--success-color);
|
|
209
|
+
text-align: left;
|
|
210
|
+
white-space: nowrap;
|
|
211
|
+
}
|
|
212
|
+
</style>
|
|
@@ -1,184 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
<div class="section-content">
|
|
9
|
-
<div class="project-row-list">
|
|
10
|
-
<div v-for="item in $Computed.productRows" :key="item.key" class="product-row">
|
|
11
|
-
<div class="metric-card">
|
|
12
|
-
<span class="metric-label">产品名称</span>
|
|
13
|
-
<strong class="metric-value-name">{{ item.productCode || item.productName }}</strong>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div class="metric-card">
|
|
17
|
-
<span class="metric-label">在线人数</span>
|
|
18
|
-
<strong class="metric-value-online">{{ item.onlineCount }}</strong>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div class="metric-card">
|
|
22
|
-
<span class="metric-label">今日访客</span>
|
|
23
|
-
<strong class="metric-value-visitor">{{ item.today }}</strong>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="metric-card">
|
|
27
|
-
<span class="metric-label">昨日访客</span>
|
|
28
|
-
<strong class="metric-value-visitor">{{ item.yesterday }}</strong>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div class="metric-card">
|
|
32
|
-
<span class="metric-label">前天访客</span>
|
|
33
|
-
<strong class="metric-value-visitor">{{ item.dayBeforeYesterday }}</strong>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="metric-card">
|
|
37
|
-
<span class="metric-label">近30天访客</span>
|
|
38
|
-
<strong class="metric-value-visitor">{{ item.recent30 }}</strong>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div class="metric-card">
|
|
42
|
-
<span class="metric-label">本月访客</span>
|
|
43
|
-
<strong class="metric-value-visitor">{{ item.month }}</strong>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script setup>
|
|
52
|
-
import { computed, reactive } from "vue";
|
|
53
|
-
|
|
54
|
-
import { $Http } from "@/plugins/http.js";
|
|
55
|
-
|
|
56
|
-
const $Data = reactive({
|
|
57
|
-
productState: {
|
|
58
|
-
options: []
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const $Method = {
|
|
63
|
-
buildProjectRow: function (visitItem, onlineItem) {
|
|
64
|
-
return {
|
|
65
|
-
key: String(visitItem?.key || onlineItem?.key || visitItem?.productCode || onlineItem?.productCode || ""),
|
|
66
|
-
productName: String(visitItem?.productName || onlineItem?.productName || "-"),
|
|
67
|
-
productCode: String(visitItem?.productCode || onlineItem?.productCode || ""),
|
|
68
|
-
|
|
69
|
-
onlineCount: Number(onlineItem?.onlineCount || 0),
|
|
70
|
-
today: Number(visitItem?.today || 0),
|
|
71
|
-
yesterday: Number(visitItem?.yesterday || 0),
|
|
72
|
-
dayBeforeYesterday: Number(visitItem?.dayBeforeYesterday || 0),
|
|
73
|
-
recent30: Number(visitItem?.recent30 || 0),
|
|
74
|
-
month: Number(visitItem?.month || 0)
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
mapProjectRows: function (infoStatsData, onlineStatsData) {
|
|
78
|
-
const onlineMap = new Map();
|
|
79
|
-
|
|
80
|
-
for (const item of onlineStatsData?.products || []) {
|
|
81
|
-
onlineMap.set(String(item?.productCode || item?.key || ""), item);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const rows = [];
|
|
85
|
-
|
|
86
|
-
for (const item of infoStatsData?.products || []) {
|
|
87
|
-
const productCode = String(item?.productCode || item?.key || "");
|
|
88
|
-
rows.push($Method.buildProjectRow(item, onlineMap.get(productCode)));
|
|
89
|
-
onlineMap.delete(productCode);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
for (const item of onlineMap.values()) {
|
|
93
|
-
rows.push($Method.buildProjectRow(null, item));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return rows.filter((item) => {
|
|
97
|
-
return Boolean(item.key);
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
fetchData: async function () {
|
|
101
|
-
try {
|
|
102
|
-
const [infoStatsRes, onlineStatsRes] = await Promise.all([$Http("/core/tongJi/infoStats", {}, [""]), $Http("/core/tongJi/onlineStats", {}, [""])]);
|
|
103
|
-
$Data.productState.options = $Method.mapProjectRows(infoStatsRes.data, onlineStatsRes.data);
|
|
104
|
-
} catch (_error) {
|
|
105
|
-
// 静默失败:不阻断页面展示
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const $Computed = reactive({
|
|
111
|
-
productRows: computed(() => {
|
|
112
|
-
return Array.isArray($Data.productState.options) ? $Data.productState.options.slice() : [];
|
|
113
|
-
})
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
$Method.fetchData();
|
|
117
|
-
</script>
|
|
118
|
-
|
|
119
|
-
<style scoped lang="scss">
|
|
120
|
-
@use "../../../styles/dashboardCard.scss" as dashboardCard;
|
|
121
|
-
|
|
122
|
-
.project-row-list {
|
|
123
|
-
display: flex;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
gap: 16px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.product-row {
|
|
129
|
-
display: grid;
|
|
130
|
-
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
131
|
-
gap: 16px;
|
|
132
|
-
align-items: stretch;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.metric-label {
|
|
136
|
-
@include dashboardCard.dashboardCardLabel();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.metric-value-online {
|
|
140
|
-
@include dashboardCard.dashboardCardNumericValue(var(--error-color));
|
|
141
|
-
|
|
142
|
-
color: var(--error-color);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.metric-value-name {
|
|
146
|
-
@include dashboardCard.dashboardCardMainValue();
|
|
147
|
-
|
|
148
|
-
text-align: left;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.metric-card {
|
|
152
|
-
display: flex;
|
|
153
|
-
flex-direction: column;
|
|
154
|
-
align-items: flex-start;
|
|
155
|
-
text-align: left;
|
|
156
|
-
|
|
157
|
-
@include dashboardCard.dashboardCardShell();
|
|
158
|
-
|
|
159
|
-
gap: 8px;
|
|
160
|
-
justify-content: flex-start;
|
|
161
|
-
min-height: 100%;
|
|
162
|
-
padding: 12px;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.metric-value-visitor {
|
|
166
|
-
@include dashboardCard.dashboardCardNumericValue(var(--success-color));
|
|
167
|
-
|
|
168
|
-
color: var(--success-color);
|
|
169
|
-
text-align: left;
|
|
170
|
-
white-space: nowrap;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@media (max-width: 1280px) {
|
|
174
|
-
.product-row {
|
|
175
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@media (max-width: 720px) {
|
|
180
|
-
.product-row {
|
|
181
|
-
grid-template-columns: 1fr;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
</style>
|