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
@@ -58,7 +58,7 @@
58
58
  </div>
59
59
  </template>
60
60
 
61
- <script setup lang="ts">
61
+ <script setup>
62
62
  import { reactive } from "vue";
63
63
  import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
64
64
  import { RefreshIcon, SearchIcon } from "tdesign-icons-vue-next";
@@ -83,20 +83,14 @@ const $Data = reactive({
83
83
  activeRowKeys: []
84
84
  });
85
85
 
86
- async function initData(): Promise<void> {
86
+ async function initData() {
87
87
  await loadApiAll();
88
88
  }
89
89
 
90
- async function loadApiAll(): Promise<void> {
90
+ async function loadApiAll() {
91
91
  $Data.loading = true;
92
92
  try {
93
- const res = await $Http.post(
94
- "/core/api/all",
95
- {},
96
- {
97
- dropValues: [""]
98
- }
99
- );
93
+ const res = await $Http.json("/core/api/all", {}, [""]);
100
94
  const list = res.data?.lists || [];
101
95
  $Data.allData = list;
102
96
  $Data.tableData = list;
@@ -108,18 +102,18 @@ async function loadApiAll(): Promise<void> {
108
102
  $Data.currentRow = null;
109
103
  $Data.activeRowKeys = [];
110
104
  }
111
- } catch (_error) {
112
- MessagePlugin.error("加载数据失败");
105
+ } catch (error) {
106
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
113
107
  } finally {
114
108
  $Data.loading = false;
115
109
  }
116
110
  }
117
111
 
118
- function handleRefresh(): void {
112
+ function handleRefresh() {
119
113
  loadApiAll();
120
114
  }
121
115
 
122
- function handleSearch(): void {
116
+ function handleSearch() {
123
117
  if (!$Data.searchKeyword) {
124
118
  $Data.tableData = $Data.allData;
125
119
  return;
@@ -128,13 +122,13 @@ function handleSearch(): void {
128
122
  $Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
129
123
  }
130
124
 
131
- function onActiveChange(value: unknown[], context: { activeRowList?: Array<{ row: unknown }> }): void {
125
+ function onActiveChange(value, context) {
132
126
  if (value.length === 0 && $Data.activeRowKeys.length > 0) {
133
127
  return;
134
128
  }
135
129
  $Data.activeRowKeys = value;
136
130
  if (context.activeRowList && context.activeRowList.length > 0) {
137
- $Data.currentRow = context.activeRowList[0].row as never;
131
+ $Data.currentRow = context.activeRowList[0].row;
138
132
  }
139
133
  }
140
134
 
@@ -29,7 +29,7 @@
29
29
  </div>
30
30
  </template>
31
31
 
32
- <script setup lang="ts">
32
+ <script setup>
33
33
  import { reactive } from "vue";
34
34
  import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
35
35
  import { RefreshIcon } from "tdesign-icons-vue-next";
@@ -53,20 +53,14 @@ const $Data = reactive({
53
53
  activeRowKeys: []
54
54
  });
55
55
 
56
- async function initData(): Promise<void> {
56
+ async function initData() {
57
57
  await apiMenuList();
58
58
  }
59
59
 
60
- async function apiMenuList(): Promise<void> {
60
+ async function apiMenuList() {
61
61
  $Data.loading = true;
62
62
  try {
63
- const res = await $Http.post(
64
- "/core/menu/all",
65
- {},
66
- {
67
- dropValues: [""]
68
- }
69
- );
63
+ const res = await $Http.json("/core/menu/all", {}, [""]);
70
64
  const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
71
65
 
72
66
  const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
@@ -80,24 +74,24 @@ async function apiMenuList(): Promise<void> {
80
74
  $Data.currentRow = null;
81
75
  $Data.activeRowKeys = [];
82
76
  }
83
- } catch (_error) {
84
- MessagePlugin.error("加载数据失败");
77
+ } catch (error) {
78
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
85
79
  } finally {
86
80
  $Data.loading = false;
87
81
  }
88
82
  }
89
83
 
90
- function handleRefresh(): void {
84
+ function handleRefresh() {
91
85
  apiMenuList();
92
86
  }
93
87
 
94
- function onActiveChange(value: unknown[], context: { activeRowList?: Array<{ row: unknown }> }): void {
88
+ function onActiveChange(value, context) {
95
89
  if (value.length === 0 && $Data.activeRowKeys.length > 0) {
96
90
  return;
97
91
  }
98
92
  $Data.activeRowKeys = value;
99
93
  if (context.activeRowList && context.activeRowList.length > 0) {
100
- $Data.currentRow = context.activeRowList[0].row as never;
94
+ $Data.currentRow = context.activeRowList[0].row;
101
95
  }
102
96
  }
103
97
 
@@ -31,7 +31,7 @@
31
31
  </PageDialog>
32
32
  </template>
33
33
 
34
- <script setup lang="ts">
34
+ <script setup>
35
35
  import { computed, reactive } from "vue";
36
36
 
37
37
  import { Input as TInput, CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, MessagePlugin } from "tdesign-vue-next";
@@ -50,14 +50,7 @@ const $Prop = defineProps({
50
50
  }
51
51
  });
52
52
 
53
- const $Emit = defineEmits<{
54
- (e: "update:modelValue", value: boolean): void;
55
- (e: "success"): void;
56
- }>();
57
-
58
- type PageDialogEventContext = {
59
- close: () => void;
60
- };
53
+ const $Emit = defineEmits(["update:modelValue", "success"]);
61
54
 
62
55
  const dialogVisible = computed({
63
56
  get: () => $Prop.modelValue,
@@ -74,10 +67,10 @@ const $Data = reactive({
74
67
  checkedApiPaths: []
75
68
  });
76
69
 
77
- async function initData(): Promise<void> {
70
+ async function initData() {
78
71
  await Promise.all([apiApiAll(), apiRoleApiDetail()]);
79
72
 
80
- const merged = new Set<string>();
73
+ const merged = new Set();
81
74
  const current = Array.isArray($Data.checkedApiPaths) ? $Data.checkedApiPaths : [];
82
75
  for (const p of current) {
83
76
  if (typeof p === "string") {
@@ -85,12 +78,12 @@ async function initData(): Promise<void> {
85
78
  }
86
79
  }
87
80
 
88
- const groups = Array.isArray($Data.apiData) ? ($Data.apiData as unknown[]) : [];
81
+ const groups = Array.isArray($Data.apiData) ? $Data.apiData : [];
89
82
  for (const group of groups) {
90
- const groupRecord = group && typeof group === "object" ? (group as Record<string, unknown>) : null;
91
- const apis = groupRecord && Array.isArray(groupRecord["apis"]) ? (groupRecord["apis"] as unknown[]) : [];
83
+ const groupRecord = group && typeof group === "object" ? group : null;
84
+ const apis = groupRecord && Array.isArray(groupRecord["apis"]) ? groupRecord["apis"] : [];
92
85
  for (const api of apis) {
93
- const apiRecord = api && typeof api === "object" ? (api as Record<string, unknown>) : null;
86
+ const apiRecord = api && typeof api === "object" ? api : null;
94
87
  const authValue = apiRecord ? apiRecord["auth"] : undefined;
95
88
  const isPublic = authValue === 0 || authValue === "0" || authValue === false;
96
89
  const value = apiRecord && typeof apiRecord["value"] === "string" ? String(apiRecord["value"]) : "";
@@ -100,27 +93,21 @@ async function initData(): Promise<void> {
100
93
  }
101
94
  }
102
95
 
103
- $Data.checkedApiPaths = Array.from(merged) as never;
96
+ $Data.checkedApiPaths = Array.from(merged);
104
97
  $Data.filteredApiData = $Data.apiData;
105
98
  }
106
99
 
107
- async function apiApiAll(): Promise<void> {
100
+ async function apiApiAll() {
108
101
  try {
109
- const res = await $Http.post(
110
- "/core/api/all",
111
- {},
112
- {
113
- dropValues: [""]
114
- }
115
- );
102
+ const res = await $Http.json("/core/api/all", {}, [""]);
116
103
 
117
- const apiMap = new Map<string, { name: string; title: string; apis: unknown[] }>();
104
+ const apiMap = new Map();
118
105
 
119
- const resRecord = res && typeof res === "object" ? (res as Record<string, unknown>) : null;
120
- const resData = resRecord && resRecord["data"] && typeof resRecord["data"] === "object" ? (resRecord["data"] as Record<string, unknown>) : null;
121
- const lists = resData && Array.isArray(resData["lists"]) ? (resData["lists"] as unknown[]) : [];
106
+ const resRecord = res && typeof res === "object" ? res : null;
107
+ const resData = resRecord && resRecord["data"] && typeof resRecord["data"] === "object" ? resRecord["data"] : null;
108
+ const lists = resData && Array.isArray(resData["lists"]) ? resData["lists"] : [];
122
109
  for (const api of lists) {
123
- const apiRecord = api && typeof api === "object" ? (api as Record<string, unknown>) : null;
110
+ const apiRecord = api && typeof api === "object" ? api : null;
124
111
  const apiPath = apiRecord && typeof apiRecord["path"] === "string" ? String(apiRecord["path"]) : "";
125
112
  if (!apiPath) {
126
113
  continue;
@@ -163,47 +150,45 @@ async function apiApiAll(): Promise<void> {
163
150
  return at.localeCompare(bt);
164
151
  });
165
152
 
166
- $Data.apiData = groups as never;
167
- } catch (_error) {
168
- MessagePlugin.error("加载接口失败");
153
+ $Data.apiData = groups;
154
+ } catch (error) {
155
+ MessagePlugin.error(error.msg || error.message || "加载接口失败");
169
156
  }
170
157
  }
171
158
 
172
- async function apiRoleApiDetail(): Promise<void> {
159
+ async function apiRoleApiDetail() {
173
160
  if (!$Prop.rowData.id) return;
174
161
 
175
162
  try {
176
- const res = await $Http.post(
163
+ const res = await $Http.json(
177
164
  "/core/role/apis",
178
165
  {
179
166
  roleCode: $Prop.rowData.code
180
167
  },
181
- {
182
- dropValues: [""]
183
- }
168
+ [""]
184
169
  );
185
170
 
186
- const resRecord = res && typeof res === "object" ? (res as Record<string, unknown>) : null;
187
- const resData = resRecord && resRecord["data"] && typeof resRecord["data"] === "object" ? (resRecord["data"] as Record<string, unknown>) : null;
188
- $Data.checkedApiPaths = resData && Array.isArray(resData["apiPaths"]) ? (resData["apiPaths"] as never) : ([] as never);
189
- } catch (_error) {
190
- MessagePlugin.error("加载数据失败");
171
+ const resRecord = res && typeof res === "object" ? res : null;
172
+ const resData = resRecord && resRecord["data"] && typeof resRecord["data"] === "object" ? resRecord["data"] : null;
173
+ $Data.checkedApiPaths = resData && Array.isArray(resData["apiPaths"]) ? resData["apiPaths"] : [];
174
+ } catch (error) {
175
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
191
176
  }
192
177
  }
193
178
 
194
- function onSearch(): void {
179
+ function onSearch() {
195
180
  if (!$Data.searchText) {
196
181
  $Data.filteredApiData = $Data.apiData;
197
182
  return;
198
183
  }
199
184
 
200
185
  const searchLower = String($Data.searchText).toLowerCase();
201
- $Data.filteredApiData = ($Data.apiData as unknown[])
186
+ $Data.filteredApiData = $Data.apiData
202
187
  .map((group) => {
203
- const groupRecord = group && typeof group === "object" ? (group as Record<string, unknown>) : null;
204
- const groupApis = groupRecord && Array.isArray(groupRecord["apis"]) ? (groupRecord["apis"] as unknown[]) : [];
188
+ const groupRecord = group && typeof group === "object" ? group : null;
189
+ const groupApis = groupRecord && Array.isArray(groupRecord["apis"]) ? groupRecord["apis"] : [];
205
190
  const apis = groupApis.filter((api) => {
206
- const apiRecord = api && typeof api === "object" ? (api as Record<string, unknown>) : null;
191
+ const apiRecord = api && typeof api === "object" ? api : null;
207
192
  const label = apiRecord && typeof apiRecord["label"] === "string" ? String(apiRecord["label"]) : "";
208
193
  const name = apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "";
209
194
  const path = apiRecord && typeof apiRecord["path"] === "string" ? String(apiRecord["path"]) : "";
@@ -215,29 +200,25 @@ function onSearch(): void {
215
200
  apis: apis
216
201
  };
217
202
  })
218
- .filter((group) => group.apis.length > 0) as never;
203
+ .filter((group) => group.apis.length > 0);
219
204
  }
220
205
 
221
- async function onSubmit(context?: PageDialogEventContext): Promise<void> {
206
+ async function onSubmit(context) {
222
207
  try {
223
208
  $Data.submitting = true;
224
209
 
225
- const res = await $Http.post("/core/role/apiSave", {
210
+ const res = await $Http.json("/core/role/apiSave", {
226
211
  roleCode: $Prop.rowData.code,
227
212
  apiPaths: $Data.checkedApiPaths
228
213
  });
229
214
 
230
- if (res.code === 0) {
231
- MessagePlugin.success("保存成功");
232
- $Emit("success");
233
- if (context && typeof context.close === "function") {
234
- context.close();
235
- }
236
- } else {
237
- MessagePlugin.error(res.msg || "保存失败");
215
+ MessagePlugin.success("保存成功");
216
+ $Emit("success");
217
+ if (context && typeof context.close === "function") {
218
+ context.close();
238
219
  }
239
- } catch (_error) {
240
- MessagePlugin.error("保存失败");
220
+ } catch (error) {
221
+ MessagePlugin.error(error.msg || error.message || "保存失败");
241
222
  } finally {
242
223
  $Data.submitting = false;
243
224
  }
@@ -25,7 +25,7 @@
25
25
  </PageDialog>
26
26
  </template>
27
27
 
28
- <script setup lang="ts">
28
+ <script setup>
29
29
  import { computed, reactive, ref } from "vue";
30
30
 
31
31
  import {
@@ -36,7 +36,6 @@ import {
36
36
  InputNumber as TInputNumber,
37
37
  RadioGroup as TRadioGroup,
38
38
  Radio as TRadio,
39
- Button as TButton,
40
39
  MessagePlugin
41
40
  } from "tdesign-vue-next";
42
41
  import PageDialog from "@/components/pageDialog.vue";
@@ -58,21 +57,10 @@ const $Prop = defineProps({
58
57
  }
59
58
  });
60
59
 
61
- const $Emit = defineEmits<{
62
- (e: "update:modelValue", value: boolean): void;
63
- (e: "success"): void;
64
- }>();
65
-
66
- type PageDialogEventContext = {
67
- close: () => void;
68
- };
60
+ const $Emit = defineEmits(["update:modelValue", "success"]);
69
61
 
70
62
  // 表单引用
71
- type TDesignFormInstance = {
72
- validate: () => Promise<unknown>;
73
- };
74
-
75
- const formRef = ref<TDesignFormInstance | null>(null);
63
+ const formRef = ref(null);
76
64
 
77
65
  const $Computed = {};
78
66
 
@@ -99,7 +87,7 @@ const $Data2 = reactive({
99
87
  }
100
88
  });
101
89
 
102
- async function initData(): Promise<void> {
90
+ async function initData() {
103
91
  if ($Prop.actionType === "upd" && $Prop.rowData.id) {
104
92
  $Data.formData = Object.assign({}, $Prop.rowData);
105
93
  }
@@ -112,7 +100,7 @@ const dialogVisible = computed({
112
100
  }
113
101
  });
114
102
 
115
- async function onSubmit(context?: PageDialogEventContext): Promise<void> {
103
+ async function onSubmit(context) {
116
104
  try {
117
105
  const form = formRef.value;
118
106
  if (!form) {
@@ -125,7 +113,7 @@ async function onSubmit(context?: PageDialogEventContext): Promise<void> {
125
113
 
126
114
  $Data.submitting = true;
127
115
  const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : $Data.formData;
128
- const res = await $Http.post($Prop.actionType === "upd" ? "/core/role/upd" : "/core/role/ins", formData);
116
+ const res = await $Http.json($Prop.actionType === "upd" ? "/core/role/upd" : "/core/role/ins", formData);
129
117
 
130
118
  MessagePlugin.success(res.msg);
131
119
  $Emit("success");
@@ -133,7 +121,7 @@ async function onSubmit(context?: PageDialogEventContext): Promise<void> {
133
121
  context.close();
134
122
  }
135
123
  } catch (error) {
136
- MessagePlugin.error((error as { msg?: string }).msg || "提交失败");
124
+ MessagePlugin.error(error.msg || error.message || "提交失败");
137
125
  } finally {
138
126
  $Data.submitting = false;
139
127
  }
@@ -32,7 +32,7 @@
32
32
  </PageDialog>
33
33
  </template>
34
34
 
35
- <script setup lang="ts">
35
+ <script setup>
36
36
  import { computed, reactive } from "vue";
37
37
 
38
38
  import { CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, Input as TInput, MessagePlugin } from "tdesign-vue-next";
@@ -52,14 +52,7 @@ const $Prop = defineProps({
52
52
  }
53
53
  });
54
54
 
55
- const $Emit = defineEmits<{
56
- (e: "update:modelValue", value: boolean): void;
57
- (e: "success"): void;
58
- }>();
59
-
60
- type PageDialogEventContext = {
61
- close: () => void;
62
- };
55
+ const $Emit = defineEmits(["update:modelValue", "success"]);
63
56
 
64
57
  const dialogVisible = computed({
65
58
  get: () => $Prop.modelValue,
@@ -76,33 +69,27 @@ const $Data = reactive({
76
69
  checkedMenuPaths: []
77
70
  });
78
71
 
79
- async function initData(): Promise<void> {
72
+ async function initData() {
80
73
  await Promise.all([apiMenuAll(), apiRoleMenuDetail()]);
81
74
  $Data.filteredMenuGroups = $Data.menuGroups;
82
75
  }
83
76
 
84
- async function apiMenuAll(): Promise<void> {
77
+ async function apiMenuAll() {
85
78
  try {
86
- const res = await $Http.post(
87
- "/core/menu/all",
88
- {},
89
- {
90
- dropValues: [""]
91
- }
92
- );
79
+ const res = await $Http.json("/core/menu/all", {}, [""]);
93
80
  const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
94
81
 
95
82
  const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
96
83
  const roots = Array.isArray(treeResult?.tree) ? treeResult.tree : [];
97
84
 
98
- const groups: Array<{ name: string; title: string; menus: unknown[] }> = [];
85
+ const groups = [];
99
86
  for (const root of roots) {
100
87
  const rootPath = typeof root?.path === "string" ? root.path : "";
101
88
  const rootName = typeof root?.name === "string" ? root.name : "";
102
89
 
103
- const menus: unknown[] = [];
90
+ const menus = [];
104
91
 
105
- const walk = (node: Record<string, unknown>, depth: number): void => {
92
+ const walk = (node, depth) => {
106
93
  const name = typeof node["name"] === "string" ? String(node["name"]) : "";
107
94
  const path = typeof node["path"] === "string" ? String(node["path"]) : "";
108
95
  if (path.length > 0) {
@@ -115,15 +102,15 @@ async function apiMenuAll(): Promise<void> {
115
102
  });
116
103
  }
117
104
 
118
- const children = Array.isArray(node["children"]) ? (node["children"] as unknown[]) : [];
105
+ const children = Array.isArray(node["children"]) ? node["children"] : [];
119
106
  for (const child of children) {
120
107
  if (child && typeof child === "object") {
121
- walk(child as Record<string, unknown>, depth + 1);
108
+ walk(child, depth + 1);
122
109
  }
123
110
  }
124
111
  };
125
112
 
126
- walk(root as Record<string, unknown>, 0);
113
+ walk(root, 0);
127
114
 
128
115
  const groupTitle = rootName.length > 0 ? rootName : rootPath;
129
116
  groups.push({
@@ -133,46 +120,44 @@ async function apiMenuAll(): Promise<void> {
133
120
  });
134
121
  }
135
122
 
136
- $Data.menuGroups = groups as never;
137
- } catch (_error) {
138
- MessagePlugin.error("加载菜单失败");
123
+ $Data.menuGroups = groups;
124
+ } catch (error) {
125
+ MessagePlugin.error(error.msg || error.message || "加载菜单失败");
139
126
  }
140
127
  }
141
128
 
142
- async function apiRoleMenuDetail(): Promise<void> {
129
+ async function apiRoleMenuDetail() {
143
130
  if (!$Prop.rowData.id) return;
144
131
 
145
132
  try {
146
- const res = await $Http.post(
133
+ const res = await $Http.json(
147
134
  "/core/role/menus",
148
135
  {
149
136
  roleCode: $Prop.rowData.code
150
137
  },
151
- {
152
- dropValues: [""]
153
- }
138
+ [""]
154
139
  );
155
140
 
156
141
  $Data.checkedMenuPaths = Array.isArray(res.data) ? res.data : [];
157
- } catch (_error) {
158
- MessagePlugin.error("加载数据失败");
142
+ } catch (error) {
143
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
159
144
  }
160
145
  }
161
146
 
162
- function onSearch(): void {
147
+ function onSearch() {
163
148
  const kw = typeof $Data.searchText === "string" ? $Data.searchText.trim().toLowerCase() : "";
164
149
  if (kw.length === 0) {
165
150
  $Data.filteredMenuGroups = $Data.menuGroups;
166
151
  return;
167
152
  }
168
153
 
169
- $Data.filteredMenuGroups = ($Data.menuGroups as unknown[])
154
+ $Data.filteredMenuGroups = $Data.menuGroups
170
155
  .map((group) => {
171
- const groupRecord = group && typeof group === "object" ? (group as Record<string, unknown>) : null;
172
- const groupMenus = groupRecord && Array.isArray(groupRecord["menus"]) ? (groupRecord["menus"] as unknown[]) : [];
156
+ const groupRecord = group && typeof group === "object" ? group : null;
157
+ const groupMenus = groupRecord && Array.isArray(groupRecord["menus"]) ? groupRecord["menus"] : [];
173
158
 
174
159
  const menus = groupMenus.filter((menu) => {
175
- const menuRecord = menu && typeof menu === "object" ? (menu as Record<string, unknown>) : null;
160
+ const menuRecord = menu && typeof menu === "object" ? menu : null;
176
161
  const label = menuRecord && typeof menuRecord["label"] === "string" ? String(menuRecord["label"]) : "";
177
162
  return label.toLowerCase().includes(kw);
178
163
  });
@@ -183,29 +168,25 @@ function onSearch(): void {
183
168
  menus: menus
184
169
  };
185
170
  })
186
- .filter((group) => group.menus.length > 0) as never;
171
+ .filter((group) => group.menus.length > 0);
187
172
  }
188
173
 
189
- async function onSubmit(context?: PageDialogEventContext): Promise<void> {
174
+ async function onSubmit(context) {
190
175
  try {
191
176
  $Data.submitting = true;
192
177
 
193
- const res = await $Http.post("/core/role/menuSave", {
178
+ const res = await $Http.json("/core/role/menuSave", {
194
179
  roleCode: $Prop.rowData.code,
195
180
  menuPaths: $Data.checkedMenuPaths
196
181
  });
197
182
 
198
- if (res.code === 0) {
199
- MessagePlugin.success("保存成功");
200
- $Emit("success");
201
- if (context && typeof context.close === "function") {
202
- context.close();
203
- }
204
- } else {
205
- MessagePlugin.error(res.msg || "保存失败");
183
+ MessagePlugin.success("保存成功");
184
+ $Emit("success");
185
+ if (context && typeof context.close === "function") {
186
+ context.close();
206
187
  }
207
- } catch (_error) {
208
- MessagePlugin.error("保存失败");
188
+ } catch (error) {
189
+ MessagePlugin.error(error.msg || error.message || "保存失败");
209
190
  } finally {
210
191
  $Data.submitting = false;
211
192
  }
@@ -70,7 +70,7 @@
70
70
  </PagedTableDetail>
71
71
  </template>
72
72
 
73
- <script setup lang="ts">
73
+ <script setup>
74
74
  import { reactive } from "vue";
75
75
  import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Tag as TTag } from "tdesign-vue-next";
76
76
  import { AddIcon, ChevronDownIcon, CodeIcon, DeleteIcon, EditIcon, RefreshIcon, SettingIcon } from "tdesign-icons-vue-next";
@@ -117,24 +117,24 @@ const $Data = reactive({
117
117
  rowData: {}
118
118
  });
119
119
 
120
- function onAdd(): void {
120
+ function onAdd() {
121
121
  onAction("add", {});
122
122
  }
123
123
 
124
- function onReload(reload: (options: { keepSelection?: boolean }) => void): void {
124
+ function onReload(reload) {
125
125
  reload({ keepSelection: true });
126
126
  }
127
127
 
128
- function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
128
+ function onDialogSuccess(reload) {
129
129
  reload({ keepSelection: true });
130
130
  }
131
131
 
132
- function getPathCount(value: unknown): number {
132
+ function getPathCount(value) {
133
133
  if (!Array.isArray(value)) return 0;
134
134
  return value.filter((p) => typeof p === "string" && p.trim().length > 0).length;
135
135
  }
136
136
 
137
- function onAction(command: string, rowData: Record<string, unknown>): void {
137
+ function onAction(command, rowData) {
138
138
  $Data.actionType = command;
139
139
 
140
140
  if (command === "add") {
@@ -158,8 +158,8 @@ function onAction(command: string, rowData: Record<string, unknown>): void {
158
158
  }
159
159
  }
160
160
 
161
- function onDropdownAction(data: unknown, rowData: Record<string, unknown>, deleteRow: (row: Record<string, unknown>) => void): void {
162
- const record = data as Record<string, unknown>;
161
+ function onDropdownAction(data, rowData, deleteRow) {
162
+ const record = data;
163
163
  const rawValue = record && record["value"] ? record["value"] : "";
164
164
  const cmd = rawValue ? String(rawValue) : "";
165
165
  if (cmd === "del") {