@befly-addon/admin 1.1.30 → 1.1.31
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/apis/admin/cacheRefresh.ts +29 -21
- package/apis/admin/del.ts +10 -10
- package/apis/admin/detail.ts +7 -7
- package/apis/admin/ins.ts +11 -11
- package/apis/admin/list.ts +10 -10
- package/apis/admin/upd.ts +14 -14
- package/apis/api/all.ts +8 -8
- package/apis/api/list.ts +10 -10
- package/apis/auth/login.ts +43 -43
- package/apis/auth/sendSmsCode.ts +6 -6
- package/apis/dashboard/configStatus.ts +18 -18
- package/apis/dashboard/environmentInfo.ts +12 -12
- package/apis/dashboard/performanceMetrics.ts +5 -5
- package/apis/dashboard/permissionStats.ts +7 -7
- package/apis/dashboard/serviceStatus.ts +29 -29
- package/apis/dashboard/systemInfo.ts +5 -5
- package/apis/dashboard/systemOverview.ts +7 -7
- package/apis/dashboard/systemResources.ts +8 -8
- package/apis/dict/all.ts +16 -16
- package/apis/dict/del.ts +6 -6
- package/apis/dict/detail.ts +19 -19
- package/apis/dict/ins.ts +9 -9
- package/apis/dict/items.ts +8 -8
- package/apis/dict/list.ts +22 -22
- package/apis/dict/upd.ts +11 -11
- package/apis/dictType/all.ts +5 -5
- package/apis/dictType/del.ts +8 -8
- package/apis/dictType/detail.ts +6 -6
- package/apis/dictType/ins.ts +7 -7
- package/apis/dictType/list.ts +8 -10
- package/apis/dictType/upd.ts +8 -8
- package/apis/email/config.ts +4 -4
- package/apis/email/logList.ts +8 -8
- package/apis/email/send.ts +18 -18
- package/apis/email/verify.ts +5 -5
- package/apis/loginLog/list.ts +8 -8
- package/apis/menu/all.ts +16 -18
- package/apis/menu/list.ts +12 -12
- package/apis/operateLog/list.ts +8 -8
- package/apis/role/all.ts +7 -7
- package/apis/role/apiSave.ts +10 -13
- package/apis/role/apis.ts +7 -12
- package/apis/role/del.ts +14 -14
- package/apis/role/detail.ts +6 -6
- package/apis/role/ins.ts +10 -10
- package/apis/role/list.ts +11 -11
- package/apis/role/menuSave.ts +8 -11
- package/apis/role/menus.ts +7 -12
- package/apis/role/save.ts +12 -12
- package/apis/role/upd.ts +10 -10
- package/apis/sysConfig/all.ts +5 -5
- package/apis/sysConfig/del.ts +9 -9
- package/apis/sysConfig/get.ts +9 -9
- package/apis/sysConfig/ins.ts +11 -11
- package/apis/sysConfig/list.ts +9 -9
- package/apis/sysConfig/upd.ts +10 -10
- package/libs/emailHelper.ts +7 -7
- package/package.json +46 -34
- package/plugins/email.ts +9 -9
- package/tables/role.json +4 -2
- package/views/403_1/index.vue +19 -3
- package/views/config/dict/components/edit.vue +26 -28
- package/views/config/dict/index.vue +88 -52
- package/views/config/dictType/components/edit.vue +22 -23
- package/views/config/dictType/index.vue +82 -46
- package/views/config/index.vue +12 -0
- package/views/config/system/components/edit.vue +36 -36
- package/views/config/system/index.vue +79 -50
- package/views/index/components/addonList.vue +3 -3
- package/views/index/components/environmentInfo.vue +10 -10
- package/views/index/components/operationLogs.vue +10 -10
- package/views/index/components/performanceMetrics.vue +8 -8
- package/views/index/components/quickActions.vue +3 -3
- package/views/index/components/serviceStatus.vue +19 -19
- package/views/index/components/systemNotifications.vue +12 -12
- package/views/index/components/systemOverview.vue +7 -7
- package/views/index/components/systemResources.vue +11 -11
- package/views/index/components/userInfo.vue +20 -19
- package/views/index/index.vue +12 -5
- package/views/log/email/index.vue +58 -51
- package/views/log/index.vue +12 -0
- package/views/log/login/index.vue +45 -38
- package/views/log/operate/index.vue +55 -48
- package/views/login_1/index.vue +25 -18
- package/views/people/admin/components/edit.vue +25 -26
- package/views/people/admin/index.vue +76 -40
- package/views/people/index.vue +12 -0
- package/views/permission/api/index.vue +21 -15
- package/views/permission/index.vue +12 -0
- package/views/permission/menu/index.vue +31 -16
- package/views/permission/role/components/api.vue +21 -21
- package/views/permission/role/components/edit.vue +18 -18
- package/views/permission/role/components/menu.vue +14 -16
- package/views/permission/role/index.vue +84 -49
- package/views/403_1/meta.json +0 -4
- package/views/config/dict/meta.json +0 -4
- package/views/config/dictType/meta.json +0 -4
- package/views/config/meta.json +0 -4
- package/views/config/system/meta.json +0 -4
- package/views/index/meta.json +0 -4
- package/views/log/email/meta.json +0 -4
- package/views/log/login/meta.json +0 -4
- package/views/log/meta.json +0 -4
- package/views/log/operate/meta.json +0 -4
- package/views/login_1/meta.json +0 -4
- package/views/people/admin/meta.json +0 -4
- package/views/people/meta.json +0 -4
- package/views/permission/api/meta.json +0 -4
- package/views/permission/menu/meta.json +0 -4
- package/views/permission/meta.json +0 -4
- package/views/permission/role/meta.json +0 -4
|
@@ -84,13 +84,20 @@
|
|
|
84
84
|
</template>
|
|
85
85
|
|
|
86
86
|
<script setup>
|
|
87
|
-
import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, Space as TSpace, MessagePlugin } from
|
|
88
|
-
import ILucideRotateCw from
|
|
89
|
-
import ILucideSend from
|
|
90
|
-
import ILucideCheckCircle from
|
|
91
|
-
import DetailPanel from
|
|
92
|
-
import { $Http } from
|
|
93
|
-
import { withDefaultColumns } from
|
|
87
|
+
import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, Space as TSpace, MessagePlugin } from "tdesign-vue-next";
|
|
88
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
89
|
+
import ILucideSend from "~icons/lucide/send";
|
|
90
|
+
import ILucideCheckCircle from "~icons/lucide/check-circle";
|
|
91
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
92
|
+
import { $Http } from "@/plugins/http";
|
|
93
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
94
|
+
|
|
95
|
+
definePage({
|
|
96
|
+
meta: {
|
|
97
|
+
title: "邮件日志",
|
|
98
|
+
order: 2
|
|
99
|
+
}
|
|
100
|
+
});
|
|
94
101
|
|
|
95
102
|
const sendFormRef = $ref(null);
|
|
96
103
|
|
|
@@ -99,25 +106,25 @@ const $Data = $ref({
|
|
|
99
106
|
tableData: [],
|
|
100
107
|
loading: false,
|
|
101
108
|
columns: withDefaultColumns([
|
|
102
|
-
{ colKey:
|
|
103
|
-
{ colKey:
|
|
104
|
-
{ colKey:
|
|
105
|
-
{ colKey:
|
|
106
|
-
{ colKey:
|
|
107
|
-
{ colKey:
|
|
109
|
+
{ colKey: "username", title: "发送人", fixed: "left" },
|
|
110
|
+
{ colKey: "id", title: "序号" },
|
|
111
|
+
{ colKey: "toEmail", title: "收件人" },
|
|
112
|
+
{ colKey: "subject", title: "主题" },
|
|
113
|
+
{ colKey: "sendTime", title: "发送时间" },
|
|
114
|
+
{ colKey: "sendResult", title: "发送结果" }
|
|
108
115
|
]),
|
|
109
116
|
detailFields: [
|
|
110
|
-
{ colKey:
|
|
111
|
-
{ colKey:
|
|
112
|
-
{ colKey:
|
|
113
|
-
{ colKey:
|
|
114
|
-
{ colKey:
|
|
115
|
-
{ colKey:
|
|
116
|
-
{ colKey:
|
|
117
|
-
{ colKey:
|
|
118
|
-
{ colKey:
|
|
119
|
-
{ colKey:
|
|
120
|
-
{ colKey:
|
|
117
|
+
{ colKey: "username", title: "发送人账号" },
|
|
118
|
+
{ colKey: "nickname", title: "发送人昵称" },
|
|
119
|
+
{ colKey: "toEmail", title: "收件人" },
|
|
120
|
+
{ colKey: "ccEmail", title: "抄送" },
|
|
121
|
+
{ colKey: "bccEmail", title: "密送" },
|
|
122
|
+
{ colKey: "subject", title: "主题" },
|
|
123
|
+
{ colKey: "content", title: "内容" },
|
|
124
|
+
{ colKey: "sendTime", title: "发送时间" },
|
|
125
|
+
{ colKey: "sendResult", title: "发送结果" },
|
|
126
|
+
{ colKey: "messageId", title: "消息ID" },
|
|
127
|
+
{ colKey: "failReason", title: "失败原因" }
|
|
121
128
|
],
|
|
122
129
|
pagerConfig: {
|
|
123
130
|
currentPage: 1,
|
|
@@ -129,15 +136,15 @@ const $Data = $ref({
|
|
|
129
136
|
sendDialogVisible: false,
|
|
130
137
|
sending: false,
|
|
131
138
|
sendForm: {
|
|
132
|
-
to:
|
|
133
|
-
cc:
|
|
134
|
-
subject:
|
|
135
|
-
content:
|
|
139
|
+
to: "",
|
|
140
|
+
cc: "",
|
|
141
|
+
subject: "",
|
|
142
|
+
content: ""
|
|
136
143
|
},
|
|
137
144
|
sendRules: {
|
|
138
|
-
to: [{ required: true, message:
|
|
139
|
-
subject: [{ required: true, message:
|
|
140
|
-
content: [{ required: true, message:
|
|
145
|
+
to: [{ required: true, message: "请输入收件人邮箱", trigger: "blur" }],
|
|
146
|
+
subject: [{ required: true, message: "请输入邮件主题", trigger: "blur" }],
|
|
147
|
+
content: [{ required: true, message: "请输入邮件内容", trigger: "blur" }]
|
|
141
148
|
}
|
|
142
149
|
});
|
|
143
150
|
|
|
@@ -151,7 +158,7 @@ const $Method = {
|
|
|
151
158
|
async apiEmailLogList() {
|
|
152
159
|
$Data.loading = true;
|
|
153
160
|
try {
|
|
154
|
-
const res = await $Http(
|
|
161
|
+
const res = await $Http("/addon/admin/email/logList", {
|
|
155
162
|
page: $Data.pagerConfig.currentPage,
|
|
156
163
|
limit: $Data.pagerConfig.limit
|
|
157
164
|
});
|
|
@@ -166,7 +173,7 @@ const $Method = {
|
|
|
166
173
|
$Data.activeRowKeys = [];
|
|
167
174
|
}
|
|
168
175
|
} catch (error) {
|
|
169
|
-
MessagePlugin.error(
|
|
176
|
+
MessagePlugin.error("加载数据失败");
|
|
170
177
|
} finally {
|
|
171
178
|
$Data.loading = false;
|
|
172
179
|
}
|
|
@@ -175,10 +182,10 @@ const $Method = {
|
|
|
175
182
|
// 打开发送弹框
|
|
176
183
|
openSendDialog() {
|
|
177
184
|
$Data.sendForm = {
|
|
178
|
-
to:
|
|
179
|
-
cc:
|
|
180
|
-
subject:
|
|
181
|
-
content:
|
|
185
|
+
to: "",
|
|
186
|
+
cc: "",
|
|
187
|
+
subject: "",
|
|
188
|
+
content: ""
|
|
182
189
|
};
|
|
183
190
|
$Data.sendDialogVisible = true;
|
|
184
191
|
},
|
|
@@ -190,7 +197,7 @@ const $Method = {
|
|
|
190
197
|
|
|
191
198
|
$Data.sending = true;
|
|
192
199
|
try {
|
|
193
|
-
const res = await $Http(
|
|
200
|
+
const res = await $Http("/addon/admin/email/send", {
|
|
194
201
|
to: $Data.sendForm.to,
|
|
195
202
|
subject: $Data.sendForm.subject,
|
|
196
203
|
content: $Data.sendForm.content,
|
|
@@ -199,14 +206,14 @@ const $Method = {
|
|
|
199
206
|
});
|
|
200
207
|
|
|
201
208
|
if (res.code === 0) {
|
|
202
|
-
MessagePlugin.success(
|
|
209
|
+
MessagePlugin.success("发送成功");
|
|
203
210
|
$Data.sendDialogVisible = false;
|
|
204
211
|
$Method.apiEmailLogList();
|
|
205
212
|
} else {
|
|
206
|
-
MessagePlugin.error(res.msg ||
|
|
213
|
+
MessagePlugin.error(res.msg || "发送失败");
|
|
207
214
|
}
|
|
208
215
|
} catch (error) {
|
|
209
|
-
MessagePlugin.error(
|
|
216
|
+
MessagePlugin.error("发送失败");
|
|
210
217
|
} finally {
|
|
211
218
|
$Data.sending = false;
|
|
212
219
|
}
|
|
@@ -215,14 +222,14 @@ const $Method = {
|
|
|
215
222
|
// 验证配置
|
|
216
223
|
async onVerify() {
|
|
217
224
|
try {
|
|
218
|
-
const res = await $Http(
|
|
225
|
+
const res = await $Http("/addon/admin/email/verify");
|
|
219
226
|
if (res.code === 0) {
|
|
220
|
-
MessagePlugin.success(
|
|
227
|
+
MessagePlugin.success("邮件服务配置正常");
|
|
221
228
|
} else {
|
|
222
|
-
MessagePlugin.error(res.msg ||
|
|
229
|
+
MessagePlugin.error(res.msg || "配置异常");
|
|
223
230
|
}
|
|
224
231
|
} catch (error) {
|
|
225
|
-
MessagePlugin.error(
|
|
232
|
+
MessagePlugin.error("验证失败");
|
|
226
233
|
}
|
|
227
234
|
},
|
|
228
235
|
|
|
@@ -257,14 +264,14 @@ const $Method = {
|
|
|
257
264
|
|
|
258
265
|
// 格式化时间
|
|
259
266
|
formatTime(timestamp) {
|
|
260
|
-
if (!timestamp) return
|
|
267
|
+
if (!timestamp) return "-";
|
|
261
268
|
const date = new Date(timestamp);
|
|
262
269
|
const year = date.getFullYear();
|
|
263
|
-
const month = String(date.getMonth() + 1).padStart(2,
|
|
264
|
-
const day = String(date.getDate()).padStart(2,
|
|
265
|
-
const hours = String(date.getHours()).padStart(2,
|
|
266
|
-
const minutes = String(date.getMinutes()).padStart(2,
|
|
267
|
-
const seconds = String(date.getSeconds()).padStart(2,
|
|
270
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
271
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
272
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
273
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
274
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
268
275
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
269
276
|
}
|
|
270
277
|
};
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
{{ $Method.formatTime(row.loginTime) }}
|
|
23
23
|
</template>
|
|
24
24
|
<template #deviceType="{ row }">
|
|
25
|
-
<TTag shape="round" variant="light-outline">{{ row.deviceType ||
|
|
25
|
+
<TTag shape="round" variant="light-outline">{{ row.deviceType || "desktop" }}</TTag>
|
|
26
26
|
</template>
|
|
27
27
|
</TTable>
|
|
28
28
|
</div>
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
{{ $Method.formatTime(value) }}
|
|
38
38
|
</template>
|
|
39
39
|
<template #deviceType="{ value }">
|
|
40
|
-
<TTag shape="round" variant="light-outline">{{ value ||
|
|
40
|
+
<TTag shape="round" variant="light-outline">{{ value || "desktop" }}</TTag>
|
|
41
41
|
</template>
|
|
42
42
|
</DetailPanel>
|
|
43
43
|
</div>
|
|
@@ -50,43 +50,50 @@
|
|
|
50
50
|
</template>
|
|
51
51
|
|
|
52
52
|
<script setup>
|
|
53
|
-
import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, MessagePlugin } from
|
|
54
|
-
import ILucideRotateCw from
|
|
55
|
-
import DetailPanel from
|
|
56
|
-
import { $Http } from
|
|
57
|
-
import { withDefaultColumns } from
|
|
53
|
+
import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, MessagePlugin } from "tdesign-vue-next";
|
|
54
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
55
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
56
|
+
import { $Http } from "@/plugins/http";
|
|
57
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
58
|
+
|
|
59
|
+
definePage({
|
|
60
|
+
meta: {
|
|
61
|
+
title: "登录日志",
|
|
62
|
+
order: 1
|
|
63
|
+
}
|
|
64
|
+
});
|
|
58
65
|
|
|
59
66
|
// 响应式数据
|
|
60
67
|
const $Data = $ref({
|
|
61
68
|
tableData: [],
|
|
62
69
|
loading: false,
|
|
63
70
|
columns: withDefaultColumns([
|
|
64
|
-
{ colKey:
|
|
65
|
-
{ colKey:
|
|
66
|
-
{ colKey:
|
|
67
|
-
{ colKey:
|
|
68
|
-
{ colKey:
|
|
69
|
-
{ colKey:
|
|
70
|
-
{ colKey:
|
|
71
|
-
{ colKey:
|
|
71
|
+
{ colKey: "username", title: "用户名", fixed: "left" },
|
|
72
|
+
{ colKey: "id", title: "序号" },
|
|
73
|
+
{ colKey: "ip", title: "登录IP" },
|
|
74
|
+
{ colKey: "browserName", title: "浏览器" },
|
|
75
|
+
{ colKey: "osName", title: "操作系统" },
|
|
76
|
+
{ colKey: "deviceType", title: "设备类型" },
|
|
77
|
+
{ colKey: "loginTime", title: "登录时间" },
|
|
78
|
+
{ colKey: "loginResult", title: "登录结果" }
|
|
72
79
|
]),
|
|
73
80
|
// 详情面板显示更多字段
|
|
74
81
|
detailFields: [
|
|
75
|
-
{ colKey:
|
|
76
|
-
{ colKey:
|
|
77
|
-
{ colKey:
|
|
78
|
-
{ colKey:
|
|
79
|
-
{ colKey:
|
|
80
|
-
{ colKey:
|
|
81
|
-
{ colKey:
|
|
82
|
-
{ colKey:
|
|
83
|
-
{ colKey:
|
|
84
|
-
{ colKey:
|
|
85
|
-
{ colKey:
|
|
86
|
-
{ colKey:
|
|
87
|
-
{ colKey:
|
|
88
|
-
{ colKey:
|
|
89
|
-
{ colKey:
|
|
82
|
+
{ colKey: "username", title: "用户名" },
|
|
83
|
+
{ colKey: "nickname", title: "昵称" },
|
|
84
|
+
{ colKey: "ip", title: "登录IP" },
|
|
85
|
+
{ colKey: "browserName", title: "浏览器" },
|
|
86
|
+
{ colKey: "browserVersion", title: "浏览器版本" },
|
|
87
|
+
{ colKey: "osName", title: "操作系统" },
|
|
88
|
+
{ colKey: "osVersion", title: "系统版本" },
|
|
89
|
+
{ colKey: "deviceType", title: "设备类型" },
|
|
90
|
+
{ colKey: "deviceVendor", title: "设备厂商" },
|
|
91
|
+
{ colKey: "deviceModel", title: "设备型号" },
|
|
92
|
+
{ colKey: "engineName", title: "渲染引擎" },
|
|
93
|
+
{ colKey: "cpuArchitecture", title: "CPU架构" },
|
|
94
|
+
{ colKey: "loginTime", title: "登录时间" },
|
|
95
|
+
{ colKey: "loginResult", title: "登录结果" },
|
|
96
|
+
{ colKey: "failReason", title: "失败原因" }
|
|
90
97
|
],
|
|
91
98
|
pagerConfig: {
|
|
92
99
|
currentPage: 1,
|
|
@@ -107,7 +114,7 @@ const $Method = {
|
|
|
107
114
|
async apiLoginLogList() {
|
|
108
115
|
$Data.loading = true;
|
|
109
116
|
try {
|
|
110
|
-
const res = await $Http(
|
|
117
|
+
const res = await $Http("/addon/admin/loginLog/list", {
|
|
111
118
|
page: $Data.pagerConfig.currentPage,
|
|
112
119
|
limit: $Data.pagerConfig.limit
|
|
113
120
|
});
|
|
@@ -123,7 +130,7 @@ const $Method = {
|
|
|
123
130
|
$Data.activeRowKeys = [];
|
|
124
131
|
}
|
|
125
132
|
} catch (error) {
|
|
126
|
-
MessagePlugin.error(
|
|
133
|
+
MessagePlugin.error("加载数据失败");
|
|
127
134
|
} finally {
|
|
128
135
|
$Data.loading = false;
|
|
129
136
|
}
|
|
@@ -160,14 +167,14 @@ const $Method = {
|
|
|
160
167
|
|
|
161
168
|
// 格式化时间
|
|
162
169
|
formatTime(timestamp) {
|
|
163
|
-
if (!timestamp) return
|
|
170
|
+
if (!timestamp) return "-";
|
|
164
171
|
const date = new Date(timestamp);
|
|
165
172
|
const year = date.getFullYear();
|
|
166
|
-
const month = String(date.getMonth() + 1).padStart(2,
|
|
167
|
-
const day = String(date.getDate()).padStart(2,
|
|
168
|
-
const hours = String(date.getHours()).padStart(2,
|
|
169
|
-
const minutes = String(date.getMinutes()).padStart(2,
|
|
170
|
-
const seconds = String(date.getSeconds()).padStart(2,
|
|
173
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
174
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
175
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
176
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
177
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
171
178
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
172
179
|
}
|
|
173
180
|
};
|
|
@@ -70,41 +70,48 @@
|
|
|
70
70
|
</template>
|
|
71
71
|
|
|
72
72
|
<script setup>
|
|
73
|
-
import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Select as TSelect, Option as TOption, MessagePlugin } from
|
|
74
|
-
import ILucideRotateCw from
|
|
75
|
-
import DetailPanel from
|
|
76
|
-
import { $Http } from
|
|
77
|
-
import { withDefaultColumns } from
|
|
73
|
+
import { Button as TButton, Table as TTable, Tag as TTag, Pagination as TPagination, Select as TSelect, Option as TOption, MessagePlugin } from "tdesign-vue-next";
|
|
74
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
75
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
76
|
+
import { $Http } from "@/plugins/http";
|
|
77
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
78
|
+
|
|
79
|
+
definePage({
|
|
80
|
+
meta: {
|
|
81
|
+
title: "操作日志",
|
|
82
|
+
order: 3
|
|
83
|
+
}
|
|
84
|
+
});
|
|
78
85
|
|
|
79
86
|
// 响应式数据
|
|
80
87
|
const $Data = $ref({
|
|
81
88
|
tableData: [],
|
|
82
89
|
loading: false,
|
|
83
90
|
columns: withDefaultColumns([
|
|
84
|
-
{ colKey:
|
|
85
|
-
{ colKey:
|
|
86
|
-
{ colKey:
|
|
87
|
-
{ colKey:
|
|
88
|
-
{ colKey:
|
|
89
|
-
{ colKey:
|
|
90
|
-
{ colKey:
|
|
91
|
-
{ colKey:
|
|
92
|
-
{ colKey:
|
|
91
|
+
{ colKey: "username", title: "操作人", fixed: "left", width: 100 },
|
|
92
|
+
{ colKey: "id", title: "序号", width: 80 },
|
|
93
|
+
{ colKey: "module", title: "模块", width: 100 },
|
|
94
|
+
{ colKey: "action", title: "操作", width: 80 },
|
|
95
|
+
{ colKey: "path", title: "请求路径", ellipsis: true },
|
|
96
|
+
{ colKey: "ip", title: "IP地址", width: 130 },
|
|
97
|
+
{ colKey: "duration", title: "耗时", width: 100 },
|
|
98
|
+
{ colKey: "operateTime", title: "操作时间", width: 170 },
|
|
99
|
+
{ colKey: "result", title: "结果", width: 80 }
|
|
93
100
|
]),
|
|
94
101
|
detailFields: [
|
|
95
|
-
{ colKey:
|
|
96
|
-
{ colKey:
|
|
97
|
-
{ colKey:
|
|
98
|
-
{ colKey:
|
|
99
|
-
{ colKey:
|
|
100
|
-
{ colKey:
|
|
101
|
-
{ colKey:
|
|
102
|
-
{ colKey:
|
|
103
|
-
{ colKey:
|
|
104
|
-
{ colKey:
|
|
105
|
-
{ colKey:
|
|
106
|
-
{ colKey:
|
|
107
|
-
{ colKey:
|
|
102
|
+
{ colKey: "username", title: "操作人账号" },
|
|
103
|
+
{ colKey: "nickname", title: "操作人昵称" },
|
|
104
|
+
{ colKey: "module", title: "操作模块" },
|
|
105
|
+
{ colKey: "action", title: "操作类型" },
|
|
106
|
+
{ colKey: "method", title: "请求方法" },
|
|
107
|
+
{ colKey: "path", title: "请求路径" },
|
|
108
|
+
{ colKey: "ip", title: "IP地址" },
|
|
109
|
+
{ colKey: "params", title: "请求参数" },
|
|
110
|
+
{ colKey: "response", title: "响应内容" },
|
|
111
|
+
{ colKey: "duration", title: "耗时" },
|
|
112
|
+
{ colKey: "operateTime", title: "操作时间" },
|
|
113
|
+
{ colKey: "result", title: "操作结果" },
|
|
114
|
+
{ colKey: "remark", title: "备注" }
|
|
108
115
|
],
|
|
109
116
|
pagerConfig: {
|
|
110
117
|
currentPage: 1,
|
|
@@ -114,22 +121,22 @@ const $Data = $ref({
|
|
|
114
121
|
currentRow: null,
|
|
115
122
|
activeRowKeys: [],
|
|
116
123
|
filter: {
|
|
117
|
-
module:
|
|
118
|
-
action:
|
|
124
|
+
module: "",
|
|
125
|
+
action: "",
|
|
119
126
|
result: null
|
|
120
127
|
},
|
|
121
128
|
moduleOptions: [
|
|
122
|
-
{ label:
|
|
123
|
-
{ label:
|
|
124
|
-
{ label:
|
|
125
|
-
{ label:
|
|
126
|
-
{ label:
|
|
129
|
+
{ label: "管理员", value: "管理员" },
|
|
130
|
+
{ label: "角色", value: "角色" },
|
|
131
|
+
{ label: "菜单", value: "菜单" },
|
|
132
|
+
{ label: "接口", value: "接口" },
|
|
133
|
+
{ label: "字典", value: "字典" }
|
|
127
134
|
],
|
|
128
135
|
actionOptions: [
|
|
129
|
-
{ label:
|
|
130
|
-
{ label:
|
|
131
|
-
{ label:
|
|
132
|
-
{ label:
|
|
136
|
+
{ label: "新增", value: "新增" },
|
|
137
|
+
{ label: "编辑", value: "编辑" },
|
|
138
|
+
{ label: "删除", value: "删除" },
|
|
139
|
+
{ label: "查询", value: "查询" }
|
|
133
140
|
]
|
|
134
141
|
});
|
|
135
142
|
|
|
@@ -143,7 +150,7 @@ const $Method = {
|
|
|
143
150
|
async apiOperateLogList() {
|
|
144
151
|
$Data.loading = true;
|
|
145
152
|
try {
|
|
146
|
-
const res = await $Http(
|
|
153
|
+
const res = await $Http("/addon/admin/operateLog/list", {
|
|
147
154
|
page: $Data.pagerConfig.currentPage,
|
|
148
155
|
limit: $Data.pagerConfig.limit
|
|
149
156
|
});
|
|
@@ -158,7 +165,7 @@ const $Method = {
|
|
|
158
165
|
$Data.activeRowKeys = [];
|
|
159
166
|
}
|
|
160
167
|
} catch (error) {
|
|
161
|
-
MessagePlugin.error(
|
|
168
|
+
MessagePlugin.error("加载数据失败");
|
|
162
169
|
} finally {
|
|
163
170
|
$Data.loading = false;
|
|
164
171
|
}
|
|
@@ -201,22 +208,22 @@ const $Method = {
|
|
|
201
208
|
|
|
202
209
|
// 格式化时间
|
|
203
210
|
formatTime(timestamp) {
|
|
204
|
-
if (!timestamp) return
|
|
211
|
+
if (!timestamp) return "-";
|
|
205
212
|
const date = new Date(timestamp);
|
|
206
213
|
const year = date.getFullYear();
|
|
207
|
-
const month = String(date.getMonth() + 1).padStart(2,
|
|
208
|
-
const day = String(date.getDate()).padStart(2,
|
|
209
|
-
const hours = String(date.getHours()).padStart(2,
|
|
210
|
-
const minutes = String(date.getMinutes()).padStart(2,
|
|
211
|
-
const seconds = String(date.getSeconds()).padStart(2,
|
|
214
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
215
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
216
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
217
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
218
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
212
219
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
213
220
|
},
|
|
214
221
|
|
|
215
222
|
// 格式化 JSON
|
|
216
223
|
formatJson(value) {
|
|
217
|
-
if (!value) return
|
|
224
|
+
if (!value) return "-";
|
|
218
225
|
try {
|
|
219
|
-
const obj = typeof value ===
|
|
226
|
+
const obj = typeof value === "string" ? JSON.parse(value) : value;
|
|
220
227
|
return JSON.stringify(obj, null, 2);
|
|
221
228
|
} catch {
|
|
222
229
|
return value;
|
package/views/login_1/index.vue
CHANGED
|
@@ -64,13 +64,20 @@
|
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<script setup>
|
|
67
|
-
import { useRouter } from
|
|
68
|
-
import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, Checkbox as TCheckbox, InputAdornment as TInputAdornment, Select as TSelect, Option as TOption, MessagePlugin } from
|
|
69
|
-
import ILucideUser from
|
|
70
|
-
import ILucideLock from
|
|
71
|
-
import { $Http } from
|
|
72
|
-
import { $Storage } from
|
|
73
|
-
import { hashPassword } from
|
|
67
|
+
import { useRouter } from "vue-router";
|
|
68
|
+
import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, Checkbox as TCheckbox, InputAdornment as TInputAdornment, Select as TSelect, Option as TOption, MessagePlugin } from "tdesign-vue-next";
|
|
69
|
+
import ILucideUser from "~icons/lucide/user";
|
|
70
|
+
import ILucideLock from "~icons/lucide/lock";
|
|
71
|
+
import { $Http } from "@/plugins/http";
|
|
72
|
+
import { $Storage } from "@/plugins/storage";
|
|
73
|
+
import { hashPassword } from "befly-vite/utils/hashPassword";
|
|
74
|
+
|
|
75
|
+
definePage({
|
|
76
|
+
meta: {
|
|
77
|
+
title: "登录页",
|
|
78
|
+
order: 100
|
|
79
|
+
}
|
|
80
|
+
});
|
|
74
81
|
|
|
75
82
|
const router = useRouter();
|
|
76
83
|
|
|
@@ -84,16 +91,16 @@ const $Data = $ref({
|
|
|
84
91
|
loading: false,
|
|
85
92
|
rememberMe: false,
|
|
86
93
|
formData: {
|
|
87
|
-
loginType:
|
|
88
|
-
account:
|
|
89
|
-
password:
|
|
94
|
+
loginType: "username",
|
|
95
|
+
account: "",
|
|
96
|
+
password: ""
|
|
90
97
|
}
|
|
91
98
|
});
|
|
92
99
|
|
|
93
100
|
const $Data2 = $shallowRef({
|
|
94
101
|
formRules: {
|
|
95
|
-
account: [{ required: true, message:
|
|
96
|
-
password: [{ required: true, message:
|
|
102
|
+
account: [{ required: true, message: "请输入账号", trigger: "blur" }],
|
|
103
|
+
password: [{ required: true, message: "请输入密码", trigger: "blur" }]
|
|
97
104
|
}
|
|
98
105
|
});
|
|
99
106
|
|
|
@@ -108,26 +115,26 @@ const $Method = {
|
|
|
108
115
|
// 对密码进行 SHA-256 加密
|
|
109
116
|
const hashedPassword = await hashPassword($Data.formData.password);
|
|
110
117
|
|
|
111
|
-
const res = await $Http(
|
|
118
|
+
const res = await $Http("/addon/admin/auth/login", {
|
|
112
119
|
loginType: $Data.formData.loginType,
|
|
113
120
|
account: $Data.formData.account,
|
|
114
121
|
password: hashedPassword
|
|
115
122
|
});
|
|
116
123
|
|
|
117
124
|
// 先保存 token
|
|
118
|
-
$Storage.local.set(
|
|
125
|
+
$Storage.local.set("token", res.data.token);
|
|
119
126
|
|
|
120
127
|
// 如果返回用户信息,也可以存储
|
|
121
128
|
if (res.data.userInfo) {
|
|
122
|
-
$Storage.local.set(
|
|
129
|
+
$Storage.local.set("userInfo", res.data.userInfo);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
|
-
MessagePlugin.success(res.msg ||
|
|
132
|
+
MessagePlugin.success(res.msg || "登录成功");
|
|
126
133
|
|
|
127
134
|
// 跳转到首页,路由守卫会自动加载菜单
|
|
128
|
-
await router.push(
|
|
135
|
+
await router.push("/");
|
|
129
136
|
} catch (error) {
|
|
130
|
-
|
|
137
|
+
MessagePlugin.error("登录失败");
|
|
131
138
|
} finally {
|
|
132
139
|
$Data.loading = false;
|
|
133
140
|
}
|