befly-admin-ui 1.47.0 → 1.49.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.
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<div v-if="$Prop.isPagination" class="main-page">
|
|
36
|
-
<TPagination :current
|
|
36
|
+
<TPagination :current="$Data.pager.current" :page-size="$Const.pageLimit" :total="$Data.pager.total" :showPageSize="false" align="right" layout="total, prev, pager, next" @current-change="$Method.onPageChange" />
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
39
|
<slot name="dialogs" :reload="$Method.reload" :current-row="$Data.currentRow"></slot>
|
|
@@ -66,18 +66,10 @@ const $Prop = defineProps({
|
|
|
66
66
|
type: Boolean,
|
|
67
67
|
default: true
|
|
68
68
|
},
|
|
69
|
-
pageSize: {
|
|
70
|
-
type: Number,
|
|
71
|
-
default: 30
|
|
72
|
-
},
|
|
73
69
|
endpoints: {
|
|
74
70
|
type: Object,
|
|
75
71
|
default: undefined
|
|
76
72
|
},
|
|
77
|
-
paginationLayout: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: "total, prev, pager, next, jumper"
|
|
80
|
-
},
|
|
81
73
|
autoLoad: {
|
|
82
74
|
type: Boolean,
|
|
83
75
|
default: true
|
|
@@ -96,6 +88,7 @@ const $From = {
|
|
|
96
88
|
};
|
|
97
89
|
|
|
98
90
|
const $Const = {
|
|
91
|
+
pageLimit: 30,
|
|
99
92
|
reservedSlotNames: ["toolLeft", "toolRight", "detail", "dialogs", "operation", "default"]
|
|
100
93
|
};
|
|
101
94
|
|
|
@@ -103,8 +96,7 @@ const $Data = reactive({
|
|
|
103
96
|
rows: [],
|
|
104
97
|
loading: false,
|
|
105
98
|
pager: {
|
|
106
|
-
|
|
107
|
-
limit: $Prop.pageSize,
|
|
99
|
+
current: 1,
|
|
108
100
|
total: 0
|
|
109
101
|
},
|
|
110
102
|
currentRow: null,
|
|
@@ -237,13 +229,13 @@ const $Method = {
|
|
|
237
229
|
const limitKey = listEndpoint.limitKey || "limit";
|
|
238
230
|
|
|
239
231
|
const data = {};
|
|
240
|
-
data[pageKey] = $Data.pager.
|
|
241
|
-
data[limitKey] = $
|
|
232
|
+
data[pageKey] = $Data.pager.current;
|
|
233
|
+
data[limitKey] = $Const.pageLimit;
|
|
242
234
|
|
|
243
235
|
if (listEndpoint.buildData) {
|
|
244
236
|
const extra = listEndpoint.buildData({
|
|
245
|
-
currentPage: $Data.pager.
|
|
246
|
-
limit: $
|
|
237
|
+
currentPage: $Data.pager.current,
|
|
238
|
+
limit: $Const.pageLimit
|
|
247
239
|
});
|
|
248
240
|
if (extra && typeof extra === "object") {
|
|
249
241
|
for (const key of Object.keys(extra)) {
|
|
@@ -263,9 +255,9 @@ const $Method = {
|
|
|
263
255
|
|
|
264
256
|
const allowPageFallback = options?.allowPageFallback !== false;
|
|
265
257
|
if (allowPageFallback && lists.length === 0 && total > 0) {
|
|
266
|
-
const lastPage = $Method.getLastPage(total, $
|
|
267
|
-
if ($Data.pager.
|
|
268
|
-
$Data.pager.
|
|
258
|
+
const lastPage = $Method.getLastPage(total, $Const.pageLimit);
|
|
259
|
+
if ($Data.pager.current > lastPage) {
|
|
260
|
+
$Data.pager.current = lastPage;
|
|
269
261
|
await $Method.loadList({
|
|
270
262
|
keepSelection: false,
|
|
271
263
|
allowPageFallback: false
|
|
@@ -292,22 +284,17 @@ const $Method = {
|
|
|
292
284
|
},
|
|
293
285
|
reload: async function (options) {
|
|
294
286
|
if (options?.resetPage) {
|
|
295
|
-
$Data.pager.
|
|
287
|
+
$Data.pager.current = 1;
|
|
296
288
|
}
|
|
297
289
|
await $Method.loadList({
|
|
298
290
|
keepSelection: options?.keepSelection,
|
|
299
291
|
allowPageFallback: true
|
|
300
292
|
});
|
|
301
293
|
},
|
|
302
|
-
onPageChange: function (
|
|
303
|
-
$Data.pager.
|
|
294
|
+
onPageChange: function (current) {
|
|
295
|
+
$Data.pager.current = current;
|
|
304
296
|
$Method.reload({ keepSelection: true });
|
|
305
297
|
},
|
|
306
|
-
onPageSizeChange: function (info) {
|
|
307
|
-
$Data.pager.limit = info.pageSize;
|
|
308
|
-
$Data.pager.currentPage = 1;
|
|
309
|
-
$Method.reload({ keepSelection: false });
|
|
310
|
-
},
|
|
311
298
|
onActiveChange: function (value, context) {
|
|
312
299
|
if (value.length === 0) {
|
|
313
300
|
if ($Data.activeRowKeys.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly-admin-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.49.0",
|
|
4
4
|
"gitHead": "071d17be177355cdd61f30659c6e4c5873f87d39",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly - 管理后台功能组件",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dependencies": {},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"tdesign-icons-vue-next": ">=0.4.0",
|
|
53
|
-
"tdesign-vue-next": ">=1.
|
|
53
|
+
"tdesign-vue-next": ">=1.20.2",
|
|
54
54
|
"vue": ">=3.0.0",
|
|
55
55
|
"vue-router": ">=5.0.0"
|
|
56
56
|
}
|
|
@@ -43,20 +43,9 @@
|
|
|
43
43
|
<t-col :span="2" class="dashboard-card-col">
|
|
44
44
|
<div class="dashboard-card">
|
|
45
45
|
<div class="dashboard-card-content">
|
|
46
|
-
<div class="dashboard-card-label"
|
|
46
|
+
<div class="dashboard-card-label">今日在线</div>
|
|
47
47
|
<div class="dashboard-card-value-row">
|
|
48
|
-
<div class="dashboard-card-main dashboard-card-main--metric dashboard-card-main--success">{{ $Computed.
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</t-col>
|
|
53
|
-
|
|
54
|
-
<t-col :span="2" class="dashboard-card-col">
|
|
55
|
-
<div class="dashboard-card">
|
|
56
|
-
<div class="dashboard-card-content">
|
|
57
|
-
<div class="dashboard-card-label">当前在线</div>
|
|
58
|
-
<div class="dashboard-card-value-row">
|
|
59
|
-
<div class="dashboard-card-main dashboard-card-main--metric dashboard-card-main--primary">{{ $Computed.onlineCount }}</div>
|
|
48
|
+
<div class="dashboard-card-main dashboard-card-main--metric dashboard-card-main--success">{{ $Computed.dailyTodayCount }}</div>
|
|
60
49
|
</div>
|
|
61
50
|
</div>
|
|
62
51
|
</div>
|
|
@@ -88,14 +77,11 @@ const $Data = reactive({
|
|
|
88
77
|
apiCount: 0,
|
|
89
78
|
roleCount: 0
|
|
90
79
|
},
|
|
91
|
-
|
|
80
|
+
dailyStats: {
|
|
92
81
|
today: {
|
|
93
82
|
count: 0
|
|
94
83
|
}
|
|
95
84
|
},
|
|
96
|
-
onlineStats: {
|
|
97
|
-
onlineCount: 0
|
|
98
|
-
},
|
|
99
85
|
errorStats: {
|
|
100
86
|
today: {
|
|
101
87
|
count: 0
|
|
@@ -106,11 +92,10 @@ const $Data = reactive({
|
|
|
106
92
|
const $Method = {
|
|
107
93
|
fetchData: async function () {
|
|
108
94
|
try {
|
|
109
|
-
const [overviewRes,
|
|
95
|
+
const [overviewRes, dailyStatsRes, errorStatsRes] = await Promise.all([$Http("/core/dashboard/systemOverview", {}, [""]), $Http("/core/tongJi/dailyStats", {}, [""]), $Http("/core/tongJi/errorStats", {}, [""])]);
|
|
110
96
|
|
|
111
97
|
Object.assign($Data.permissionStats, overviewRes.data);
|
|
112
|
-
$Data.
|
|
113
|
-
$Data.onlineStats.onlineCount = Number(onlineStatsRes.data?.onlineCount || 0);
|
|
98
|
+
$Data.dailyStats.today.count = Number(dailyStatsRes.data?.today?.count || 0);
|
|
114
99
|
$Data.errorStats.today.count = Number(errorStatsRes.data?.today?.count || 0);
|
|
115
100
|
} catch (_error) {
|
|
116
101
|
// 静默失败:不阻断页面展示
|
|
@@ -119,11 +104,8 @@ const $Method = {
|
|
|
119
104
|
};
|
|
120
105
|
|
|
121
106
|
const $Computed = reactive({
|
|
122
|
-
|
|
123
|
-
return $Data.
|
|
124
|
-
}),
|
|
125
|
-
onlineCount: computed(() => {
|
|
126
|
-
return $Data.onlineStats.onlineCount;
|
|
107
|
+
dailyTodayCount: computed(() => {
|
|
108
|
+
return $Data.dailyStats.today.count;
|
|
127
109
|
}),
|
|
128
110
|
errorTodayCount: computed(() => {
|
|
129
111
|
return $Data.errorStats.today.count;
|
|
@@ -99,17 +99,19 @@ import { reactive } from "vue";
|
|
|
99
99
|
|
|
100
100
|
const $Data = reactive({
|
|
101
101
|
columns: withDefaultColumns([
|
|
102
|
-
{ colKey: "productName", title: "产品名称" },
|
|
102
|
+
{ colKey: "productName", title: "产品名称", width:120 },
|
|
103
103
|
{ colKey: "productCode", title: "产品代号", width: 150 },
|
|
104
|
-
|
|
104
|
+
|
|
105
|
+
{ colKey: "errorType", title: "错误类型", width: 120 },
|
|
106
|
+
{ colKey: "message", title: "错误信息", ellipsis: true },
|
|
107
|
+
{ colKey: "productVersion", title: "产品版本", width: 130 },
|
|
105
108
|
{ colKey: "pageName", title: "页面名称" },
|
|
106
109
|
{ colKey: "pagePath", title: "页面路径", width: 220, ellipsis: true },
|
|
107
|
-
|
|
108
|
-
{ colKey: "deviceType", title: "设备类型", width:
|
|
109
|
-
{ colKey: "browserName", title: "浏览器", width:
|
|
110
|
-
{ colKey: "osName", title: "操作系统", width:
|
|
111
|
-
{ colKey: "hitCount", title: "次数", width: 100 },
|
|
112
|
-
{ colKey: "message", title: "错误信息", ellipsis: true },
|
|
110
|
+
|
|
111
|
+
{ colKey: "deviceType", title: "设备类型", width: 100 },
|
|
112
|
+
{ colKey: "browserName", title: "浏览器", width: 100 },
|
|
113
|
+
{ colKey: "osName", title: "操作系统", width: 100 },
|
|
114
|
+
{ colKey: "hitCount", title: "次数", width: 100 },
|
|
113
115
|
{ colKey: "source", title: "来源", width: 100 },
|
|
114
116
|
{ colKey: "reportTime", title: "上报时间", width: 170 },
|
|
115
117
|
{ colKey: "firstReportTime", title: "首次上报", width: 170, detail: true },
|
|
@@ -122,7 +124,7 @@ const $Data = reactive({
|
|
|
122
124
|
{ colKey: "engineName", title: "渲染引擎", detail: true },
|
|
123
125
|
{ colKey: "cpuArchitecture", title: "CPU架构", detail: true },
|
|
124
126
|
{ colKey: "userAgent", title: "UA字符串", detail: true },
|
|
125
|
-
{ colKey: "detail", title: "错误详情", detail: true }
|
|
127
|
+
{ colKey: "detail", title: "错误详情", detail: true }
|
|
126
128
|
]),
|
|
127
129
|
endpoints: {
|
|
128
130
|
list: {
|
|
@@ -14,43 +14,43 @@
|
|
|
14
14
|
<t-row :gutter="[16, 16]">
|
|
15
15
|
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
16
16
|
<div class="metric-card">
|
|
17
|
-
<span class="metric-label"
|
|
18
|
-
<strong class="metric-value-
|
|
17
|
+
<span class="metric-label">今日在线</span>
|
|
18
|
+
<strong class="metric-value-daily">{{ item.today }}</strong>
|
|
19
19
|
</div>
|
|
20
20
|
</t-col>
|
|
21
21
|
|
|
22
22
|
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
23
23
|
<div class="metric-card">
|
|
24
|
-
<span class="metric-label"
|
|
25
|
-
<strong class="metric-value-
|
|
24
|
+
<span class="metric-label">昨日在线</span>
|
|
25
|
+
<strong class="metric-value-daily">{{ item.yesterday }}</strong>
|
|
26
26
|
</div>
|
|
27
27
|
</t-col>
|
|
28
28
|
|
|
29
29
|
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
30
30
|
<div class="metric-card">
|
|
31
|
-
<span class="metric-label"
|
|
32
|
-
<strong class="metric-value-
|
|
31
|
+
<span class="metric-label">前天在线</span>
|
|
32
|
+
<strong class="metric-value-daily">{{ item.dayBeforeYesterday }}</strong>
|
|
33
33
|
</div>
|
|
34
34
|
</t-col>
|
|
35
35
|
|
|
36
36
|
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
37
37
|
<div class="metric-card">
|
|
38
|
-
<span class="metric-label"
|
|
39
|
-
<strong class="metric-value-
|
|
38
|
+
<span class="metric-label">近7天在线</span>
|
|
39
|
+
<strong class="metric-value-daily">{{ item.recent7 }}</strong>
|
|
40
40
|
</div>
|
|
41
41
|
</t-col>
|
|
42
42
|
|
|
43
43
|
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
44
44
|
<div class="metric-card">
|
|
45
|
-
<span class="metric-label">近30
|
|
46
|
-
<strong class="metric-value-
|
|
45
|
+
<span class="metric-label">近30天在线</span>
|
|
46
|
+
<strong class="metric-value-daily">{{ item.recent30 }}</strong>
|
|
47
47
|
</div>
|
|
48
48
|
</t-col>
|
|
49
49
|
|
|
50
50
|
<t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
|
|
51
51
|
<div class="metric-card">
|
|
52
|
-
<span class="metric-label"
|
|
53
|
-
<strong class="metric-value-
|
|
52
|
+
<span class="metric-label">本月在线</span>
|
|
53
|
+
<strong class="metric-value-daily">{{ item.month }}</strong>
|
|
54
54
|
</div>
|
|
55
55
|
</t-col>
|
|
56
56
|
</t-row>
|
|
@@ -75,18 +75,17 @@ const $Data = reactive({
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
const $Method = {
|
|
78
|
-
buildProjectRow: function (
|
|
78
|
+
buildProjectRow: function (item) {
|
|
79
79
|
return {
|
|
80
|
-
key: String(
|
|
81
|
-
productName: String(
|
|
82
|
-
productCode: String(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
month: Number(visitItem?.month || 0)
|
|
80
|
+
key: String(item?.key || item?.productCode || ""),
|
|
81
|
+
productName: String(item?.productName || "-"),
|
|
82
|
+
productCode: String(item?.productCode || ""),
|
|
83
|
+
today: Number(item?.today || 0),
|
|
84
|
+
yesterday: Number(item?.yesterday || 0),
|
|
85
|
+
dayBeforeYesterday: Number(item?.dayBeforeYesterday || 0),
|
|
86
|
+
recent7: Number(item?.recent7 || 0),
|
|
87
|
+
recent30: Number(item?.recent30 || 0),
|
|
88
|
+
month: Number(item?.month || 0)
|
|
90
89
|
};
|
|
91
90
|
},
|
|
92
91
|
formatProductTitle: function (row) {
|
|
@@ -99,33 +98,11 @@ const $Method = {
|
|
|
99
98
|
|
|
100
99
|
return productName || productCode || "-";
|
|
101
100
|
},
|
|
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
101
|
fetchData: async function () {
|
|
126
102
|
try {
|
|
127
|
-
const
|
|
128
|
-
|
|
103
|
+
const dailyStatsRes = await $Http("/core/tongJi/dailyStats", {}, [""]);
|
|
104
|
+
|
|
105
|
+
$Data.productState.options = (dailyStatsRes.data?.products || []).map((item) => $Method.buildProjectRow(item)).filter((item) => Boolean(item.key));
|
|
129
106
|
} catch (_error) {
|
|
130
107
|
// 静默失败:不阻断页面展示
|
|
131
108
|
}
|
|
@@ -183,10 +160,12 @@ $Method.fetchData();
|
|
|
183
160
|
@include dashboardCard.dashboardCardLabel();
|
|
184
161
|
}
|
|
185
162
|
|
|
186
|
-
.metric-value-
|
|
187
|
-
@include dashboardCard.dashboardCardNumericValue(var(--
|
|
163
|
+
.metric-value-daily {
|
|
164
|
+
@include dashboardCard.dashboardCardNumericValue(var(--success-color));
|
|
188
165
|
|
|
189
|
-
color: var(--
|
|
166
|
+
color: var(--success-color);
|
|
167
|
+
text-align: left;
|
|
168
|
+
white-space: nowrap;
|
|
190
169
|
}
|
|
191
170
|
|
|
192
171
|
.metric-card {
|
|
@@ -201,12 +180,4 @@ $Method.fetchData();
|
|
|
201
180
|
justify-content: flex-start;
|
|
202
181
|
padding: 12px;
|
|
203
182
|
}
|
|
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
183
|
</style>
|