befly-admin-ui 1.8.14 → 1.8.16

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 (31) hide show
  1. package/package.json +2 -2
  2. package/utils/arrayToTree.js +1 -4
  3. package/views/config/dict/components/edit.vue +12 -23
  4. package/views/config/dict/index.vue +13 -19
  5. package/views/config/dictType/components/edit.vue +12 -23
  6. package/views/config/dictType/index.vue +8 -8
  7. package/views/config/system/components/edit.vue +24 -39
  8. package/views/config/system/index.vue +8 -8
  9. package/views/index/components/addonList.vue +4 -17
  10. package/views/index/components/environmentInfo.vue +4 -19
  11. package/views/index/components/operationLogs.vue +3 -15
  12. package/views/index/components/performanceMetrics.vue +4 -15
  13. package/views/index/components/quickActions.vue +1 -1
  14. package/views/index/components/serviceStatus.vue +5 -26
  15. package/views/index/components/systemNotifications.vue +3 -13
  16. package/views/index/components/systemOverview.vue +3 -9
  17. package/views/index/components/systemResources.vue +5 -17
  18. package/views/index/components/userInfo.vue +26 -49
  19. package/views/index/index.vue +1 -1
  20. package/views/log/email/index.vue +23 -40
  21. package/views/log/login/index.vue +4 -4
  22. package/views/log/operate/index.vue +6 -6
  23. package/views/login_1/index.vue +7 -8
  24. package/views/people/admin/components/edit.vue +12 -29
  25. package/views/people/admin/index.vue +7 -7
  26. package/views/permission/api/index.vue +10 -16
  27. package/views/permission/menu/index.vue +9 -15
  28. package/views/permission/role/components/api.vue +41 -60
  29. package/views/permission/role/components/edit.vue +7 -19
  30. package/views/permission/role/components/menu.vue +33 -52
  31. package/views/permission/role/index.vue +8 -8
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "befly-admin-ui",
3
- "version": "1.8.14",
4
- "gitHead": "3f389979b8d565fe0476e0859df5a2c94627137c",
3
+ "version": "1.8.16",
4
+ "gitHead": "964aa96007544f0f7a0f129bbe1d234a5ea59a08",
5
5
  "private": false,
6
6
  "description": "Befly - 管理后台功能组件",
7
7
  "keywords": [
@@ -62,14 +62,11 @@ export function arrayToTree(items, id = "id", pid = "pid", children = "children"
62
62
  const nodeObj = node;
63
63
  const raw = nodeObj[sortKey];
64
64
  if (typeof raw !== "number") {
65
- return 999999;
65
+ return 1;
66
66
  }
67
67
  if (!Number.isFinite(raw)) {
68
68
  return 999999;
69
69
  }
70
- if (raw < 1) {
71
- return 999999;
72
- }
73
70
  return raw;
74
71
  };
75
72
  const compareNode = (a, b) => {
@@ -22,7 +22,7 @@
22
22
  </PageDialog>
23
23
  </template>
24
24
 
25
- <script setup lang="ts">
25
+ <script setup>
26
26
  import { computed, reactive, ref } from "vue";
27
27
 
28
28
  import { Form as TForm, FormItem as TFormItem, Input as TInput, Select as TSelect, Option as TOption, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
@@ -36,21 +36,14 @@ const props = defineProps({
36
36
  typeList: Array
37
37
  });
38
38
 
39
- const $Emit = defineEmits<{
40
- (e: "update:modelValue", value: boolean): void;
41
- (e: "success"): void;
42
- }>();
39
+ const $Emit = defineEmits(["update:modelValue", "success"]);
43
40
 
44
41
  const visible = computed({
45
42
  get: () => props.modelValue,
46
43
  set: (val) => $Emit("update:modelValue", val)
47
44
  });
48
45
 
49
- type TDesignFormInstance = {
50
- validate: () => Promise<unknown>;
51
- };
52
-
53
- const formRef = ref<TDesignFormInstance | null>(null);
46
+ const formRef = ref(null);
54
47
 
55
48
  const $Data = reactive({
56
49
  formData: {
@@ -67,7 +60,7 @@ const $Data = reactive({
67
60
  }
68
61
  });
69
62
 
70
- async function handleSubmit(): Promise<void> {
63
+ async function handleSubmit() {
71
64
  try {
72
65
  const form = formRef.value;
73
66
  if (!form) {
@@ -78,7 +71,7 @@ async function handleSubmit(): Promise<void> {
78
71
  const valid = await form.validate();
79
72
  if (valid !== true) return;
80
73
  const apiUrl = props.actionType === "add" ? "/core/dict/ins" : "/core/dict/upd";
81
- const params: Record<string, unknown> = {
74
+ const params = {
82
75
  typeCode: $Data.formData.typeCode,
83
76
  key: $Data.formData.key,
84
77
  label: $Data.formData.label,
@@ -86,20 +79,16 @@ async function handleSubmit(): Promise<void> {
86
79
  remark: $Data.formData.remark
87
80
  };
88
81
  if (props.actionType === "upd" && props.rowData) {
89
- const row = props.rowData as Record<string, unknown>;
82
+ const row = props.rowData;
90
83
  params["id"] = row["id"];
91
84
  }
92
85
 
93
- const res = await $Http.post(apiUrl, params);
94
- if (res.code === 0) {
95
- MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
96
- visible.value = false;
97
- $Emit("success");
98
- } else {
99
- MessagePlugin.error(res.msg || "操作失败");
100
- }
101
- } catch (_error) {
102
- MessagePlugin.error("操作失败");
86
+ await $Http.json(apiUrl, params);
87
+ MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
88
+ visible.value = false;
89
+ $Emit("success");
90
+ } catch (error) {
91
+ MessagePlugin.error(error.msg || error.message || "操作失败");
103
92
  }
104
93
  }
105
94
 
@@ -49,7 +49,7 @@
49
49
  </PagedTableDetail>
50
50
  </template>
51
51
 
52
- <script setup lang="ts">
52
+ <script setup>
53
53
  import { onMounted, reactive } from "vue";
54
54
 
55
55
  import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Input as TInput, Option as TOption, Select as TSelect, MessagePlugin } from "tdesign-vue-next";
@@ -101,44 +101,38 @@ const $Data = reactive({
101
101
  rowData: {}
102
102
  });
103
103
 
104
- function onAdd(): void {
104
+ function onAdd() {
105
105
  onAction("add", {});
106
106
  }
107
107
 
108
- function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
108
+ function onDialogSuccess(reload) {
109
109
  reload({ keepSelection: true });
110
110
  }
111
111
 
112
- async function initData(): Promise<void> {
112
+ async function initData() {
113
113
  await apiDictTypeAll();
114
114
  }
115
115
 
116
- async function apiDictTypeAll(): Promise<void> {
116
+ async function apiDictTypeAll() {
117
117
  try {
118
- const res = await $Http.post(
119
- "/core/dictType/all",
120
- {},
121
- {
122
- dropValues: [""]
123
- }
124
- );
118
+ const res = await $Http.json("/core/dictType/all", {}, [""]);
125
119
  $Data.typeList = res.data.lists || [];
126
- } catch (_error) {
127
- MessagePlugin.error("加载数据失败");
120
+ } catch (error) {
121
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
128
122
  }
129
123
  }
130
124
 
131
- function handleSearch(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
125
+ function handleSearch(reload) {
132
126
  reload({ keepSelection: false, resetPage: true });
133
127
  }
134
128
 
135
- function handleRefresh(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
129
+ function handleRefresh(reload) {
136
130
  $Data.searchTypeCode = "";
137
131
  $Data.searchKeyword = "";
138
132
  reload({ keepSelection: false, resetPage: true });
139
133
  }
140
134
 
141
- function onAction(type: string, row: Record<string, unknown>): void {
135
+ function onAction(type, row) {
142
136
  if (type === "add") {
143
137
  $Data.actionType = "add";
144
138
  $Data.rowData = {};
@@ -153,8 +147,8 @@ function onAction(type: string, row: Record<string, unknown>): void {
153
147
  }
154
148
  }
155
149
 
156
- function onDropdownAction(data: unknown, row: Record<string, unknown>, deleteRow: (r: Record<string, unknown>) => void): void {
157
- const record = data as Record<string, unknown>;
150
+ function onDropdownAction(data, row, deleteRow) {
151
+ const record = data;
158
152
  const rawValue = record && record["value"] ? record["value"] : "";
159
153
  const cmd = rawValue ? String(rawValue) : "";
160
154
  if (cmd === "del") {
@@ -17,7 +17,7 @@
17
17
  </PageDialog>
18
18
  </template>
19
19
 
20
- <script setup lang="ts">
20
+ <script setup>
21
21
  import { computed, reactive, ref } from "vue";
22
22
 
23
23
  import { Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
@@ -30,21 +30,14 @@ const props = defineProps({
30
30
  rowData: Object
31
31
  });
32
32
 
33
- const $Emit = defineEmits<{
34
- (e: "update:modelValue", value: boolean): void;
35
- (e: "success"): void;
36
- }>();
33
+ const $Emit = defineEmits(["update:modelValue", "success"]);
37
34
 
38
35
  const visible = computed({
39
36
  get: () => props.modelValue,
40
37
  set: (val) => $Emit("update:modelValue", val)
41
38
  });
42
39
 
43
- type TDesignFormInstance = {
44
- validate: () => Promise<unknown>;
45
- };
46
-
47
- const formRef = ref<TDesignFormInstance | null>(null);
40
+ const formRef = ref(null);
48
41
 
49
42
  const $Data = reactive({
50
43
  formData: {
@@ -59,7 +52,7 @@ const $Data = reactive({
59
52
  }
60
53
  });
61
54
 
62
- async function handleSubmit(): Promise<void> {
55
+ async function handleSubmit() {
63
56
  const form = formRef.value;
64
57
  if (!form) {
65
58
  MessagePlugin.warning("表单未就绪");
@@ -71,27 +64,23 @@ async function handleSubmit(): Promise<void> {
71
64
 
72
65
  try {
73
66
  const apiUrl = props.actionType === "add" ? "/core/dictType/ins" : "/core/dictType/upd";
74
- const params: Record<string, unknown> = {
67
+ const params = {
75
68
  code: $Data.formData.code,
76
69
  name: $Data.formData.name,
77
70
  description: $Data.formData.description,
78
71
  sort: $Data.formData.sort
79
72
  };
80
73
  if (props.actionType === "upd" && props.rowData) {
81
- const row = props.rowData as Record<string, unknown>;
74
+ const row = props.rowData;
82
75
  params["id"] = row["id"];
83
76
  }
84
77
 
85
- const res = await $Http.post(apiUrl, params);
86
- if (res.code === 0) {
87
- MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
88
- visible.value = false;
89
- $Emit("success");
90
- } else {
91
- MessagePlugin.error(res.msg || "操作失败");
92
- }
93
- } catch (_error) {
94
- MessagePlugin.error("操作失败");
78
+ await $Http.json(apiUrl, params);
79
+ MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
80
+ visible.value = false;
81
+ $Emit("success");
82
+ } catch (error) {
83
+ MessagePlugin.error(error.msg || error.message || "操作失败");
95
84
  }
96
85
  }
97
86
 
@@ -46,7 +46,7 @@
46
46
  </PagedTableDetail>
47
47
  </template>
48
48
 
49
- <script setup lang="ts">
49
+ <script setup>
50
50
  import { reactive } from "vue";
51
51
  import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Input as TInput } from "tdesign-vue-next";
52
52
  import { AddIcon, ChevronDownIcon, DeleteIcon, EditIcon, RefreshIcon, SearchIcon } from "tdesign-icons-vue-next";
@@ -94,24 +94,24 @@ const $Data = reactive({
94
94
  rowData: {}
95
95
  });
96
96
 
97
- function onAdd(): void {
97
+ function onAdd() {
98
98
  onAction("add", {});
99
99
  }
100
100
 
101
- function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
101
+ function onDialogSuccess(reload) {
102
102
  reload({ keepSelection: true });
103
103
  }
104
104
 
105
- function handleSearch(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
105
+ function handleSearch(reload) {
106
106
  reload({ keepSelection: false, resetPage: true });
107
107
  }
108
108
 
109
- function handleRefresh(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
109
+ function handleRefresh(reload) {
110
110
  $Data.searchKeyword = "";
111
111
  reload({ keepSelection: false, resetPage: true });
112
112
  }
113
113
 
114
- function onAction(type: string, row: Record<string, unknown>): void {
114
+ function onAction(type, row) {
115
115
  if (type === "add") {
116
116
  $Data.actionType = "add";
117
117
  $Data.rowData = {};
@@ -126,8 +126,8 @@ function onAction(type: string, row: Record<string, unknown>): void {
126
126
  }
127
127
  }
128
128
 
129
- function onDropdownAction(data: unknown, row: Record<string, unknown>, deleteRow: (r: Record<string, unknown>) => void): void {
130
- const record = data as Record<string, unknown>;
129
+ function onDropdownAction(data, row, deleteRow) {
130
+ const record = data;
131
131
  const rawValue = record && record["value"] ? record["value"] : "";
132
132
  const cmd = rawValue ? String(rawValue) : "";
133
133
  if (cmd === "del") {
@@ -40,7 +40,7 @@
40
40
  </PageDialog>
41
41
  </template>
42
42
 
43
- <script setup lang="ts">
43
+ <script setup>
44
44
  import { computed, reactive, ref } from "vue";
45
45
 
46
46
  import { Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, Select as TSelect, Option as TOption, RadioGroup as TRadioGroup, Radio as TRadio, MessagePlugin } from "tdesign-vue-next";
@@ -62,21 +62,10 @@ const $Prop = defineProps({
62
62
  }
63
63
  });
64
64
 
65
- const $Emit = defineEmits<{
66
- (e: "update:modelValue", value: boolean): void;
67
- (e: "success"): void;
68
- }>();
69
-
70
- type PageDialogEventContext = {
71
- close: () => void;
72
- };
65
+ const $Emit = defineEmits(["update:modelValue", "success"]);
73
66
 
74
67
  // 表单引用
75
- type TDesignFormInstance = {
76
- validate: () => Promise<unknown>;
77
- };
78
-
79
- const formRef = ref<TDesignFormInstance | null>(null);
68
+ const formRef = ref(null);
80
69
 
81
70
  const dialogVisible = computed({
82
71
  get: () => $Prop.modelValue,
@@ -114,22 +103,22 @@ const $Data2 = reactive({
114
103
  groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
115
104
  });
116
105
 
117
- async function initData(): Promise<void> {
106
+ async function initData() {
118
107
  onShow();
119
108
  }
120
109
 
121
- function onShow(): void {
110
+ function onShow() {
122
111
  if ($Prop.actionType === "upd" && $Prop.rowData) {
123
- const row = $Prop.rowData as Record<string, unknown>;
124
- $Data.formData.id = (row["id"] as number) || 0;
125
- $Data.formData.name = (row["name"] as string) || "";
126
- $Data.formData.code = (row["code"] as string) || "";
127
- $Data.formData.value = (row["value"] as string) || "";
128
- $Data.formData.valueType = (row["valueType"] as string) || "string";
129
- $Data.formData.group = (row["group"] as string) || "";
130
- $Data.formData.sort = (row["sort"] as number) || 0;
131
- $Data.formData.description = (row["description"] as string) || "";
132
- $Data.formData.state = (row["state"] as number) || 1;
112
+ const row = $Prop.rowData;
113
+ $Data.formData.id = row["id"] || 0;
114
+ $Data.formData.name = row["name"] || "";
115
+ $Data.formData.code = row["code"] || "";
116
+ $Data.formData.value = row["value"] || "";
117
+ $Data.formData.valueType = row["valueType"] || "string";
118
+ $Data.formData.group = row["group"] || "";
119
+ $Data.formData.sort = row["sort"] || 0;
120
+ $Data.formData.description = row["description"] || "";
121
+ $Data.formData.state = row["state"] || 1;
133
122
  $Data.isSystem = row["isSystem"] === 1;
134
123
  } else {
135
124
  $Data.formData = {
@@ -147,7 +136,7 @@ function onShow(): void {
147
136
  }
148
137
  }
149
138
 
150
- async function onSubmit(context?: PageDialogEventContext): Promise<void> {
139
+ async function onSubmit(context) {
151
140
  const form = formRef.value;
152
141
  if (!form) {
153
142
  MessagePlugin.warning("表单未就绪");
@@ -160,19 +149,15 @@ async function onSubmit(context?: PageDialogEventContext): Promise<void> {
160
149
  $Data.submitting = true;
161
150
  try {
162
151
  const api = $Prop.actionType === "upd" ? "/core/sysConfig/upd" : "/core/sysConfig/ins";
163
- const res = await $Http.post(api, $Data.formData);
164
-
165
- if (res.code === 0) {
166
- MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
167
- $Emit("success");
168
- if (context && typeof context.close === "function") {
169
- context.close();
170
- }
171
- } else {
172
- MessagePlugin.error(res.msg || "操作失败");
152
+ await $Http.json(api, $Data.formData);
153
+
154
+ MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
155
+ $Emit("success");
156
+ if (context && typeof context.close === "function") {
157
+ context.close();
173
158
  }
174
- } catch (_error) {
175
- MessagePlugin.error("操作失败");
159
+ } catch (error) {
160
+ MessagePlugin.error(error.msg || error.message || "操作失败");
176
161
  } finally {
177
162
  $Data.submitting = false;
178
163
  }
@@ -74,7 +74,7 @@
74
74
  </PagedTableDetail>
75
75
  </template>
76
76
 
77
- <script setup lang="ts">
77
+ <script setup>
78
78
  import { reactive } from "vue";
79
79
  import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Option as TOption, Select as TSelect, Tag as TTag } from "tdesign-vue-next";
80
80
  import { AddIcon, ChevronDownIcon, DeleteIcon, EditIcon, RefreshIcon } from "tdesign-icons-vue-next";
@@ -132,23 +132,23 @@ const $Data = reactive({
132
132
  groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
133
133
  });
134
134
 
135
- function onAdd(): void {
135
+ function onAdd() {
136
136
  onAction("add", {});
137
137
  }
138
138
 
139
- function handleFilter(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
139
+ function handleFilter(reload) {
140
140
  reload({ keepSelection: false, resetPage: true });
141
141
  }
142
142
 
143
- function onReload(reload: (options: { keepSelection?: boolean }) => void): void {
143
+ function onReload(reload) {
144
144
  reload({ keepSelection: true });
145
145
  }
146
146
 
147
- function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
147
+ function onDialogSuccess(reload) {
148
148
  reload({ keepSelection: true });
149
149
  }
150
150
 
151
- function onAction(command: string, rowData: Record<string, unknown>): void {
151
+ function onAction(command, rowData) {
152
152
  $Data.actionType = command;
153
153
  if (command === "add") {
154
154
  $Data.rowData = {};
@@ -161,8 +161,8 @@ function onAction(command: string, rowData: Record<string, unknown>): void {
161
161
  }
162
162
  }
163
163
 
164
- function onDropdownAction(data: unknown, rowData: Record<string, unknown>, deleteRow: (row: Record<string, unknown>) => void): void {
165
- const record = data as Record<string, unknown>;
164
+ function onDropdownAction(data, rowData, deleteRow) {
165
+ const record = data;
166
166
  const rawValue = record && record["value"] ? record["value"] : "";
167
167
  const cmd = rawValue ? String(rawValue) : "";
168
168
  if (cmd === "del") {
@@ -23,32 +23,19 @@
23
23
  </div>
24
24
  </template>
25
25
 
26
- <script setup lang="ts">
26
+ <script setup>
27
27
  import { reactive } from "vue";
28
28
  import { MenuIcon, SystemStorageIcon } from "tdesign-icons-vue-next";
29
29
  import { $Http } from "@/plugins/http";
30
30
 
31
- type AddonListItem = {
32
- name: string;
33
- title: string;
34
- version: string;
35
- description: string;
36
- };
37
-
38
31
  // 组件内部数据
39
- const addonList = reactive<AddonListItem[]>([]);
32
+ const addonList = reactive([]);
40
33
 
41
34
  // 获取数据
42
35
  const fetchData = async () => {
43
36
  try {
44
- const { data } = await $Http.post(
45
- "/core/dashboard/addonList",
46
- {},
47
- {
48
- dropValues: [""]
49
- }
50
- );
51
- addonList.splice(0, addonList.length, ...data);
37
+ const res = await $Http.json("/core/dashboard/addonList", {}, [""]);
38
+ addonList.splice(0, addonList.length, ...res.data);
52
39
  } catch (_error) {
53
40
  // 静默失败:不阻断页面展示
54
41
  }
@@ -35,22 +35,13 @@
35
35
  </div>
36
36
  </template>
37
37
 
38
- <script setup lang="ts">
38
+ <script setup>
39
39
  import { reactive } from "vue";
40
40
  import { ServerIcon } from "tdesign-icons-vue-next";
41
41
  import { $Http } from "@/plugins/http";
42
42
 
43
- type EnvironmentInfo = {
44
- os: string;
45
- server: string;
46
- nodeVersion: string;
47
- database: string;
48
- cache: string;
49
- timezone: string;
50
- };
51
-
52
43
  // 组件内部数据
53
- const environmentInfo = reactive<EnvironmentInfo>({
44
+ const environmentInfo = reactive({
54
45
  os: "",
55
46
  server: "",
56
47
  nodeVersion: "",
@@ -62,14 +53,8 @@ const environmentInfo = reactive<EnvironmentInfo>({
62
53
  // 获取数据
63
54
  const fetchData = async () => {
64
55
  try {
65
- const { data } = await $Http.post(
66
- "/core/dashboard/environmentInfo",
67
- {},
68
- {
69
- dropValues: [""]
70
- }
71
- );
72
- Object.assign(environmentInfo, data);
56
+ const res = await $Http.json("/core/dashboard/environmentInfo", {}, [""]);
57
+ Object.assign(environmentInfo, res.data);
73
58
  } catch (_error) {
74
59
  // 静默失败:不阻断页面展示
75
60
  }
@@ -33,24 +33,12 @@
33
33
  </div>
34
34
  </template>
35
35
 
36
- <script setup lang="ts">
36
+ <script setup>
37
37
  import { reactive } from "vue";
38
38
  import { CodeIcon } from "tdesign-icons-vue-next";
39
39
 
40
- type OperationLogStatus = "success" | "failed";
41
-
42
- type OperationLogItem = {
43
- id: number;
44
- userName: string;
45
- action: string;
46
- module: string;
47
- ip: string;
48
- status: OperationLogStatus;
49
- createdAt: number;
50
- };
51
-
52
40
  // 组件内部数据
53
- const operationLogs = reactive<OperationLogItem[]>([
41
+ const operationLogs = reactive([
54
42
  { id: 1, userName: "管理员", action: "创建角色", module: "权限管理", ip: "192.168.1.100", status: "success", createdAt: Date.now() - 120000 },
55
43
  { id: 2, userName: "张三", action: "修改菜单", module: "系统设置", ip: "192.168.1.101", status: "success", createdAt: Date.now() - 900000 },
56
44
  { id: 3, userName: "李四", action: "删除接口", module: "接口管理", ip: "192.168.1.102", status: "failed", createdAt: Date.now() - 3600000 },
@@ -58,7 +46,7 @@ const operationLogs = reactive<OperationLogItem[]>([
58
46
  { id: 5, userName: "王五", action: "登录系统", module: "系统", ip: "192.168.1.103", status: "success", createdAt: Date.now() - 10800000 }
59
47
  ]);
60
48
 
61
- const formatTime = (timestamp: number): string => {
49
+ const formatTime = (timestamp) => {
62
50
  const date = new Date(timestamp);
63
51
  const month = String(date.getMonth() + 1).padStart(2, "0");
64
52
  const day = String(date.getDate()).padStart(2, "0");
@@ -52,36 +52,25 @@
52
52
  </div>
53
53
  </template>
54
54
 
55
- <script setup lang="ts">
55
+ <script setup>
56
56
  import { reactive } from "vue";
57
57
  import { ChartIcon, ErrorCircleIcon, ErrorTriangleIcon, TimeIcon, TrendingUpIcon } from "tdesign-icons-vue-next";
58
58
  import { $Http } from "@/plugins/http";
59
59
 
60
- type SlowestApiInfo = {
61
- path: string;
62
- time: number;
63
- };
64
-
65
60
  // 组件内部数据
66
61
  const performanceMetrics = reactive({
67
62
  avgResponseTime: 0,
68
63
  qps: 0,
69
64
  errorRate: 0,
70
65
  activeConnections: 0,
71
- slowestApi: null as SlowestApiInfo | null
66
+ slowestApi: null
72
67
  });
73
68
 
74
69
  // 获取数据
75
70
  const fetchData = async () => {
76
71
  try {
77
- const { data } = await $Http.post(
78
- "/core/dashboard/performanceMetrics",
79
- {},
80
- {
81
- dropValues: [""]
82
- }
83
- );
84
- Object.assign(performanceMetrics, data);
72
+ const res = await $Http.json("/core/dashboard/performanceMetrics", {}, [""]);
73
+ Object.assign(performanceMetrics, res.data);
85
74
  } catch (_error) {
86
75
  // 静默失败:不阻断页面展示
87
76
  }
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  </template>
13
13
 
14
- <script setup lang="ts">
14
+ <script setup>
15
15
  import { Button as TButton } from "tdesign-vue-next";
16
16
  import { RefreshIcon } from "tdesign-icons-vue-next";
17
17