@befly-addon/admin 1.1.29 → 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.
Files changed (123) hide show
  1. package/apis/admin/cacheRefresh.ts +29 -24
  2. package/apis/admin/del.ts +12 -12
  3. package/apis/admin/detail.ts +9 -41
  4. package/apis/admin/ins.ts +28 -21
  5. package/apis/admin/list.ts +12 -12
  6. package/apis/admin/upd.ts +49 -14
  7. package/apis/api/all.ts +14 -10
  8. package/apis/api/list.ts +16 -25
  9. package/apis/auth/login.ts +55 -52
  10. package/apis/auth/sendSmsCode.ts +6 -6
  11. package/apis/dashboard/configStatus.ts +18 -18
  12. package/apis/dashboard/environmentInfo.ts +12 -12
  13. package/apis/dashboard/performanceMetrics.ts +5 -5
  14. package/apis/dashboard/permissionStats.ts +7 -7
  15. package/apis/dashboard/serviceStatus.ts +29 -29
  16. package/apis/dashboard/systemInfo.ts +5 -5
  17. package/apis/dashboard/systemOverview.ts +7 -7
  18. package/apis/dashboard/systemResources.ts +8 -8
  19. package/apis/dict/all.ts +24 -7
  20. package/apis/dict/del.ts +9 -17
  21. package/apis/dict/detail.ts +30 -16
  22. package/apis/dict/ins.ts +36 -18
  23. package/apis/dict/items.ts +27 -0
  24. package/apis/dict/list.ts +35 -10
  25. package/apis/dict/upd.ts +54 -20
  26. package/apis/dictType/all.ts +11 -0
  27. package/apis/dictType/del.ts +32 -0
  28. package/apis/dictType/detail.ts +17 -0
  29. package/apis/dictType/ins.ts +30 -0
  30. package/apis/dictType/list.ts +22 -0
  31. package/apis/dictType/upd.ts +42 -0
  32. package/apis/email/config.ts +4 -4
  33. package/apis/email/logList.ts +10 -10
  34. package/apis/email/send.ts +18 -18
  35. package/apis/email/verify.ts +5 -5
  36. package/apis/loginLog/list.ts +10 -10
  37. package/apis/menu/all.ts +17 -20
  38. package/apis/menu/list.ts +12 -13
  39. package/apis/operateLog/list.ts +10 -10
  40. package/apis/role/all.ts +7 -7
  41. package/apis/role/apiSave.ts +14 -16
  42. package/apis/role/apis.ts +24 -0
  43. package/apis/role/del.ts +27 -19
  44. package/apis/role/detail.ts +6 -7
  45. package/apis/role/ins.ts +10 -10
  46. package/apis/role/list.ts +11 -11
  47. package/apis/role/menuSave.ts +12 -14
  48. package/apis/role/menus.ts +24 -0
  49. package/apis/role/save.ts +14 -15
  50. package/apis/role/upd.ts +10 -10
  51. package/apis/sysConfig/all.ts +5 -6
  52. package/apis/sysConfig/del.ts +10 -10
  53. package/apis/sysConfig/get.ts +10 -11
  54. package/apis/sysConfig/ins.ts +11 -11
  55. package/apis/sysConfig/list.ts +9 -9
  56. package/apis/sysConfig/upd.ts +11 -11
  57. package/libs/emailHelper.ts +7 -7
  58. package/package.json +46 -34
  59. package/plugins/email.ts +9 -9
  60. package/tables/admin.json +0 -6
  61. package/tables/dict.json +13 -19
  62. package/tables/dictType.json +28 -0
  63. package/tables/role.json +4 -2
  64. package/views/403_1/index.vue +19 -3
  65. package/views/config/dict/components/edit.vue +76 -124
  66. package/views/config/dict/index.vue +142 -84
  67. package/views/config/dictType/components/edit.vue +105 -0
  68. package/views/config/dictType/index.vue +242 -0
  69. package/views/config/index.vue +12 -0
  70. package/views/config/system/components/edit.vue +36 -36
  71. package/views/config/system/index.vue +79 -50
  72. package/views/index/components/addonList.vue +3 -3
  73. package/views/index/components/environmentInfo.vue +10 -10
  74. package/views/index/components/operationLogs.vue +10 -10
  75. package/views/index/components/performanceMetrics.vue +8 -8
  76. package/views/index/components/quickActions.vue +3 -3
  77. package/views/index/components/serviceStatus.vue +19 -19
  78. package/views/index/components/systemNotifications.vue +12 -12
  79. package/views/index/components/systemOverview.vue +7 -7
  80. package/views/index/components/systemResources.vue +11 -11
  81. package/views/index/components/userInfo.vue +20 -19
  82. package/views/index/index.vue +12 -5
  83. package/views/log/email/index.vue +58 -51
  84. package/views/log/index.vue +12 -0
  85. package/views/log/login/index.vue +45 -38
  86. package/views/log/operate/index.vue +55 -48
  87. package/views/login_1/index.vue +191 -2
  88. package/views/people/admin/components/edit.vue +28 -29
  89. package/views/people/admin/index.vue +76 -40
  90. package/views/people/index.vue +12 -0
  91. package/views/permission/api/index.vue +21 -15
  92. package/views/permission/index.vue +12 -0
  93. package/views/permission/menu/index.vue +31 -16
  94. package/views/permission/role/components/api.vue +23 -23
  95. package/views/permission/role/components/edit.vue +18 -18
  96. package/views/permission/role/components/menu.vue +17 -19
  97. package/views/permission/role/index.vue +84 -49
  98. package/apis/admin/roleDetail.ts +0 -29
  99. package/apis/admin/roleSave.ts +0 -39
  100. package/apis/auth/logout.ts +0 -17
  101. package/apis/auth/register.ts +0 -43
  102. package/apis/dashboard/changelog.ts +0 -31
  103. package/apis/role/apiDetail.ts +0 -24
  104. package/apis/role/menuDetail.ts +0 -24
  105. package/views/403_1/meta.json +0 -4
  106. package/views/config/dict/meta.json +0 -4
  107. package/views/config/meta.json +0 -4
  108. package/views/config/system/meta.json +0 -4
  109. package/views/index/meta.json +0 -4
  110. package/views/log/email/meta.json +0 -4
  111. package/views/log/login/meta.json +0 -4
  112. package/views/log/meta.json +0 -4
  113. package/views/log/operate/meta.json +0 -4
  114. package/views/login_1/components/emailLoginForm.vue +0 -174
  115. package/views/login_1/components/registerForm.vue +0 -175
  116. package/views/login_1/components/welcomePanel.vue +0 -61
  117. package/views/login_1/meta.json +0 -4
  118. package/views/people/admin/meta.json +0 -4
  119. package/views/people/meta.json +0 -4
  120. package/views/permission/api/meta.json +0 -4
  121. package/views/permission/menu/meta.json +0 -4
  122. package/views/permission/meta.json +0 -4
  123. package/views/permission/role/meta.json +0 -4
@@ -19,7 +19,16 @@
19
19
 
20
20
  <div class="main-content">
21
21
  <div class="main-table">
22
- <TTable :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)" active-row-type="single" @active-change="$Method.onActiveChange">
22
+ <TTable
23
+ :data="$Data.tableData"
24
+ :columns="$Data.columns"
25
+ :loading="$Data.loading"
26
+ :active-row-keys="$Data.activeRowKeys"
27
+ row-key="id"
28
+ height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
29
+ active-row-type="single"
30
+ @active-change="$Method.onActiveChange"
31
+ >
23
32
  <template #state="{ row }">
24
33
  <TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
25
34
  <TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
@@ -61,38 +70,45 @@
61
70
  </template>
62
71
 
63
72
  <script setup>
64
- import { Button as TButton, Table as TTable, Tag as TTag, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from 'tdesign-vue-next';
65
- import ILucidePlus from '~icons/lucide/plus';
66
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
67
- import ILucidePencil from '~icons/lucide/pencil';
68
- import ILucideTrash2 from '~icons/lucide/trash-2';
69
- import ILucideChevronDown from '~icons/lucide/chevron-down';
70
- import EditDialog from './components/edit.vue';
71
- import DetailPanel from '@/components/DetailPanel.vue';
72
- import { $Http } from '@/plugins/http';
73
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
73
+ import { Button as TButton, Table as TTable, Tag as TTag, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
74
+ import ILucidePlus from "~icons/lucide/plus";
75
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
76
+ import ILucidePencil from "~icons/lucide/pencil";
77
+ import ILucideTrash2 from "~icons/lucide/trash-2";
78
+ import ILucideChevronDown from "~icons/lucide/chevron-down";
79
+ import EditDialog from "./components/edit.vue";
80
+ import DetailPanel from "@/components/DetailPanel.vue";
81
+ import { $Http } from "@/plugins/http";
82
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
83
+
84
+ definePage({
85
+ meta: {
86
+ title: "管理员",
87
+ order: 1
88
+ }
89
+ });
74
90
 
75
91
  // 响应式数据
76
92
  const $Data = $ref({
77
93
  tableData: [],
78
94
  loading: false,
79
95
  columns: withDefaultColumns([
80
- { colKey: 'username', title: '用户名', fixed: 'left' },
81
- { colKey: 'id', title: '序号' },
82
- { colKey: 'nickname', title: '昵称' },
83
- { colKey: 'roleCode', title: '角色' },
84
- { colKey: 'state', title: '状态' },
85
- { colKey: 'operation', title: '操作' }
96
+ { colKey: "username", title: "用户名", fixed: "left" },
97
+ { colKey: "id", title: "序号" },
98
+ { colKey: "nickname", title: "昵称" },
99
+ { colKey: "roleCode", title: "角色" },
100
+ { colKey: "state", title: "状态" },
101
+ { colKey: "operation", title: "操作" }
86
102
  ]),
87
103
  pagerConfig: {
88
104
  currentPage: 1,
89
105
  limit: 30,
90
106
  total: 0,
91
- align: 'right',
92
- layout: 'total, prev, pager, next, jumper'
107
+ align: "right",
108
+ layout: "total, prev, pager, next, jumper"
93
109
  },
94
110
  editVisible: false,
95
- actionType: 'add',
111
+ actionType: "add",
96
112
  rowData: {},
97
113
  currentRow: null,
98
114
  activeRowKeys: []
@@ -108,7 +124,7 @@ const $Method = {
108
124
  async apiAdminList() {
109
125
  $Data.loading = true;
110
126
  try {
111
- const res = await $Http('/addon/admin/admin/list', {
127
+ const res = await $Http("/addon/admin/admin/list", {
112
128
  page: $Data.pagerConfig.currentPage,
113
129
  limit: $Data.pagerConfig.limit
114
130
  });
@@ -124,8 +140,7 @@ const $Method = {
124
140
  $Data.activeRowKeys = [];
125
141
  }
126
142
  } catch (error) {
127
- console.error('加载管理员列表失败:', error);
128
- MessagePlugin.error('加载数据失败');
143
+ MessagePlugin.error("加载数据失败");
129
144
  } finally {
130
145
  $Data.loading = false;
131
146
  }
@@ -133,22 +148,43 @@ const $Method = {
133
148
 
134
149
  // 删除管理员
135
150
  async apiAdminDel(row) {
136
- DialogPlugin.confirm({
137
- header: '确认删除',
138
- body: `确定要删除管理员“${row.username}” 吗?`,
139
- status: 'warning'
140
- }).then(async () => {
141
- try {
142
- const res = await $Http('/addon/admin/admin/del', { id: row.id });
143
- if (res.code === 0) {
144
- MessagePlugin.success('删除成功');
145
- $Method.apiAdminList();
146
- } else {
147
- MessagePlugin.error(res.msg || '删除失败');
151
+ let dialog = null;
152
+ let destroyed = false;
153
+
154
+ const destroy = () => {
155
+ if (destroyed) return;
156
+ destroyed = true;
157
+ if (dialog && typeof dialog.destroy === "function") {
158
+ dialog.destroy();
159
+ }
160
+ };
161
+
162
+ dialog = DialogPlugin.confirm({
163
+ header: "确认删除",
164
+ body: `确认删除管理员“${row.username}”吗?`,
165
+ status: "warning",
166
+ confirmBtn: "删除",
167
+ cancelBtn: "取消",
168
+ onConfirm: async () => {
169
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
170
+ dialog.setConfirmLoading(true);
171
+ }
172
+
173
+ try {
174
+ await $Http("/addon/admin/admin/del", { id: row.id });
175
+ MessagePlugin.success("删除成功");
176
+ destroy();
177
+ await $Method.apiAdminList();
178
+ } catch (error) {
179
+ MessagePlugin.error("删除失败");
180
+ } finally {
181
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
182
+ dialog.setConfirmLoading(false);
183
+ }
148
184
  }
149
- } catch (error) {
150
- console.error('删除失败:', error);
151
- MessagePlugin.error('删除失败');
185
+ },
186
+ onClose: () => {
187
+ destroy();
152
188
  }
153
189
  });
154
190
  },
@@ -188,9 +224,9 @@ const $Method = {
188
224
  onAction(command, rowData) {
189
225
  $Data.actionType = command;
190
226
  $Data.rowData = rowData;
191
- if (command === 'add' || command === 'upd') {
227
+ if (command === "add" || command === "upd") {
192
228
  $Data.editVisible = true;
193
- } else if (command === 'del') {
229
+ } else if (command === "del") {
194
230
  $Method.apiAdminDel(rowData);
195
231
  }
196
232
  }
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <RouterView />
3
+ </template>
4
+
5
+ <script setup>
6
+ definePage({
7
+ meta: {
8
+ title: "人员管理",
9
+ order: 10
10
+ }
11
+ });
12
+ </script>
@@ -51,25 +51,32 @@
51
51
  </template>
52
52
 
53
53
  <script setup>
54
- import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from 'tdesign-vue-next';
55
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
56
- import ILucideSearch from '~icons/lucide/search';
57
- import { $Http } from '@/plugins/http';
58
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
59
- import DetailPanel from '@/components/DetailPanel.vue';
54
+ import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
55
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
56
+ import ILucideSearch from "~icons/lucide/search";
57
+ import { $Http } from "@/plugins/http";
58
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
59
+ import DetailPanel from "@/components/DetailPanel.vue";
60
+
61
+ definePage({
62
+ meta: {
63
+ title: "接口列表",
64
+ order: 3
65
+ }
66
+ });
60
67
 
61
68
  // 响应式数据
62
69
  const $Data = $ref({
63
70
  tableData: [],
64
71
  allData: [],
65
72
  loading: false,
66
- searchKeyword: '',
73
+ searchKeyword: "",
67
74
  columns: withDefaultColumns([
68
- { colKey: 'name', title: '接口名称' },
69
- { colKey: 'id', title: '序号' },
70
- { colKey: 'path', title: '接口路径' },
71
- { colKey: 'method', title: '请求方法' },
72
- { colKey: 'addonName', title: '所属组件' }
75
+ { colKey: "name", title: "接口名称" },
76
+ { colKey: "id", title: "序号" },
77
+ { colKey: "path", title: "接口路径" },
78
+ { colKey: "method", title: "请求方法" },
79
+ { colKey: "addonName", title: "所属组件" }
73
80
  ]),
74
81
  currentRow: null,
75
82
  activeRowKeys: []
@@ -85,7 +92,7 @@ const $Method = {
85
92
  async loadApiAll() {
86
93
  $Data.loading = true;
87
94
  try {
88
- const res = await $Http('/addon/admin/api/all');
95
+ const res = await $Http("/addon/admin/api/all");
89
96
  const list = res.data?.lists || [];
90
97
  $Data.allData = list;
91
98
  $Data.tableData = list;
@@ -99,8 +106,7 @@ const $Method = {
99
106
  $Data.activeRowKeys = [];
100
107
  }
101
108
  } catch (error) {
102
- console.error('加载接口列表失败:', error);
103
- MessagePlugin.error('加载数据失败');
109
+ MessagePlugin.error("加载数据失败");
104
110
  } finally {
105
111
  $Data.loading = false;
106
112
  }
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <RouterView />
3
+ </template>
4
+
5
+ <script setup>
6
+ definePage({
7
+ meta: {
8
+ title: "权限设置",
9
+ order: 20
10
+ }
11
+ });
12
+ </script>
@@ -13,7 +13,17 @@
13
13
 
14
14
  <div class="main-content">
15
15
  <div class="main-table">
16
- <TTable v-bind="withTreeTableProps()" :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - var(--search-height) - var(--layout-gap) * 2)" active-row-type="single" @active-change="$Method.onActiveChange">
16
+ <TTable
17
+ :data="$Data.tableData"
18
+ :columns="$Data.columns"
19
+ :loading="$Data.loading"
20
+ :active-row-keys="$Data.activeRowKeys"
21
+ row-key="id"
22
+ height="calc(100vh - var(--search-height) - var(--layout-gap) * 2)"
23
+ active-row-type="single"
24
+ :tree="{ childrenKey: 'children', treeNodeColumnIndex: 0, defaultExpandAll: true }"
25
+ @active-change="$Method.onActiveChange"
26
+ >
17
27
  <template #state="{ row }">
18
28
  <TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
19
29
  <TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
@@ -30,24 +40,30 @@
30
40
  </template>
31
41
 
32
42
  <script setup>
33
- import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from 'tdesign-vue-next';
34
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
35
- import DetailPanel from '@/components/DetailPanel.vue';
36
- import { $Http } from '@/plugins/http';
37
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
38
- import { withTreeTableProps } from '@/utils';
43
+ import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
44
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
45
+ import DetailPanel from "@/components/DetailPanel.vue";
46
+ import { $Http } from "@/plugins/http";
47
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
48
+
49
+ definePage({
50
+ meta: {
51
+ title: "菜单列表",
52
+ order: 2
53
+ }
54
+ });
39
55
 
40
56
  // 响应式数据
41
57
  const $Data = $ref({
42
58
  tableData: [],
43
59
  loading: false,
44
60
  columns: withDefaultColumns([
45
- { colKey: 'name', title: '菜单名称', fixed: 'left' },
46
- { colKey: 'id', title: '序号' },
47
- { colKey: 'path', title: '路由路径' },
48
- { colKey: 'icon', title: '图标' },
49
- { colKey: 'sort', title: '排序' },
50
- { colKey: 'state', title: '状态' }
61
+ { colKey: "name", title: "菜单名称", fixed: "left" },
62
+ { colKey: "id", title: "序号" },
63
+ { colKey: "path", title: "路由路径" },
64
+ { colKey: "icon", title: "图标" },
65
+ { colKey: "sort", title: "排序" },
66
+ { colKey: "state", title: "状态" }
51
67
  ]),
52
68
  currentRow: null,
53
69
  activeRowKeys: []
@@ -63,7 +79,7 @@ const $Method = {
63
79
  async apiMenuList() {
64
80
  $Data.loading = true;
65
81
  try {
66
- const res = await $Http('/addon/admin/menu/list');
82
+ const res = await $Http("/addon/admin/menu/list");
67
83
  // 构建树形结构
68
84
  $Data.tableData = $Method.buildTree(res.data || []);
69
85
 
@@ -76,8 +92,7 @@ const $Method = {
76
92
  $Data.activeRowKeys = [];
77
93
  }
78
94
  } catch (error) {
79
- console.error('加载菜单列表失败:', error);
80
- MessagePlugin.error('加载数据失败');
95
+ MessagePlugin.error("加载数据失败");
81
96
  } finally {
82
97
  $Data.loading = false;
83
98
  }
@@ -16,7 +16,9 @@
16
16
  <div class="group-header">{{ group.title }}</div>
17
17
  <div class="api-checkbox-list">
18
18
  <TCheckboxGroup v-model="$Data.checkedApiIds">
19
- <TCheckbox v-for="api in group.apis" :key="api.id" :value="api.id"> {{ api.label }} </TCheckbox>
19
+ <TCheckbox v-for="api in group.apis" :key="api.id" :value="api.id">
20
+ {{ api.label }}
21
+ </TCheckbox>
20
22
  </TCheckboxGroup>
21
23
  </div>
22
24
  </div>
@@ -35,9 +37,9 @@
35
37
  </template>
36
38
 
37
39
  <script setup>
38
- import { Dialog as TDialog, Input as TInput, CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, Button as TButton, MessagePlugin } from 'tdesign-vue-next';
39
- import ILucideSearch from '~icons/lucide/search';
40
- import { $Http } from '@/plugins/http';
40
+ import { Dialog as TDialog, Input as TInput, CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, Button as TButton, MessagePlugin } from "tdesign-vue-next";
41
+ import ILucideSearch from "~icons/lucide/search";
42
+ import { $Http } from "@/plugins/http";
41
43
 
42
44
  const $Prop = defineProps({
43
45
  modelValue: {
@@ -50,14 +52,14 @@ const $Prop = defineProps({
50
52
  }
51
53
  });
52
54
 
53
- const $Emit = defineEmits(['update:modelValue', 'success']);
55
+ const $Emit = defineEmits(["update:modelValue", "success"]);
54
56
 
55
57
  const $Data = $ref({
56
58
  visible: false,
57
59
  submitting: false,
58
60
  apiData: [],
59
61
  filteredApiData: [],
60
- searchText: '',
62
+ searchText: "",
61
63
  checkedApiIds: []
62
64
  });
63
65
 
@@ -78,21 +80,21 @@ const $Method = {
78
80
  onClose() {
79
81
  $Data.visible = false;
80
82
  setTimeout(() => {
81
- $Emit('update:modelValue', false);
83
+ $Emit("update:modelValue", false);
82
84
  }, 300);
83
85
  },
84
86
 
85
87
  // 加载所有接口
86
88
  async apiApiAll() {
87
89
  try {
88
- const res = await $Http('/addon/admin/api/all');
90
+ const res = await $Http("/addon/admin/api/all");
89
91
 
90
92
  // 将接口列表按 addonTitle 分组
91
93
  const apiMap = new Map();
92
94
 
93
95
  res.data.lists.forEach((api) => {
94
- const addonTitle = api.addonTitle || api.addonName || '项目接口';
95
- const addonName = api.addonName || 'project';
96
+ const addonTitle = api.addonTitle || api.addonName || "项目接口";
97
+ const addonName = api.addonName || "project";
96
98
 
97
99
  if (!apiMap.has(addonName)) {
98
100
  apiMap.set(addonName, {
@@ -111,8 +113,7 @@ const $Method = {
111
113
 
112
114
  $Data.apiData = Array.from(apiMap.values());
113
115
  } catch (error) {
114
- console.error('加载接口失败:', error);
115
- MessagePlugin.error('加载接口失败');
116
+ MessagePlugin.error("加载接口失败");
116
117
  }
117
118
  },
118
119
 
@@ -121,13 +122,13 @@ const $Method = {
121
122
  if (!$Prop.rowData.id) return;
122
123
 
123
124
  try {
124
- const res = await $Http('/addon/admin/role/apiDetail', {
125
- roleId: $Prop.rowData.id
125
+ const res = await $Http("/addon/admin/role/apis", {
126
+ roleCode: $Prop.rowData.code
126
127
  });
127
128
 
128
129
  $Data.checkedApiIds = res.data.apiIds || [];
129
130
  } catch (error) {
130
- console.error('加载角色接口失败:', error);
131
+ MessagePlugin.error("加载数据失败");
131
132
  }
132
133
  },
133
134
 
@@ -152,21 +153,20 @@ const $Method = {
152
153
  try {
153
154
  $Data.submitting = true;
154
155
 
155
- const res = await $Http('/addon/admin/role/apiSave', {
156
- roleId: $Prop.rowData.id,
156
+ const res = await $Http("/addon/admin/role/apiSave", {
157
+ roleCode: $Prop.rowData.code,
157
158
  apiIds: $Data.checkedApiIds
158
159
  });
159
160
 
160
161
  if (res.code === 0) {
161
- MessagePlugin.success('保存成功');
162
+ MessagePlugin.success("保存成功");
162
163
  $Data.visible = false;
163
- $Emit('success');
164
+ $Emit("success");
164
165
  } else {
165
- MessagePlugin.error(res.msg || '保存失败');
166
+ MessagePlugin.error(res.msg || "保存失败");
166
167
  }
167
168
  } catch (error) {
168
- console.error('保存失败:', error);
169
- MessagePlugin.error('保存失败');
169
+ MessagePlugin.error("保存失败");
170
170
  } finally {
171
171
  $Data.submitting = false;
172
172
  }
@@ -215,7 +215,7 @@ $Method.initData();
215
215
  gap: 8px;
216
216
 
217
217
  &::before {
218
- content: '';
218
+ content: "";
219
219
  width: 8px;
220
220
  height: 8px;
221
221
  border-radius: 50%;
@@ -41,9 +41,9 @@ import {
41
41
  Radio as TRadio,
42
42
  Button as TButton,
43
43
  MessagePlugin
44
- } from 'tdesign-vue-next';
45
- import { fieldClear } from 'befly-shared/fieldClear';
46
- import { $Http } from '@/plugins/http';
44
+ } from "tdesign-vue-next";
45
+ import { fieldClear } from "befly-vite/utils/fieldClear";
46
+ import { $Http } from "@/plugins/http";
47
47
 
48
48
  const $Prop = defineProps({
49
49
  modelValue: {
@@ -52,7 +52,7 @@ const $Prop = defineProps({
52
52
  },
53
53
  actionType: {
54
54
  type: String,
55
- default: 'add'
55
+ default: "add"
56
56
  },
57
57
  rowData: {
58
58
  type: Object,
@@ -60,7 +60,7 @@ const $Prop = defineProps({
60
60
  }
61
61
  });
62
62
 
63
- const $Emit = defineEmits(['update:modelValue', 'success']);
63
+ const $Emit = defineEmits(["update:modelValue", "success"]);
64
64
 
65
65
  // 表单引用
66
66
  const $From = $shallowRef({
@@ -74,9 +74,9 @@ const $Data = $ref({
74
74
  submitting: false,
75
75
  formData: {
76
76
  id: 0,
77
- name: '',
78
- code: '',
79
- description: '',
77
+ name: "",
78
+ code: "",
79
+ description: "",
80
80
  sort: 0,
81
81
  state: 1
82
82
  }
@@ -84,19 +84,19 @@ const $Data = $ref({
84
84
 
85
85
  const $Data2 = $shallowRef({
86
86
  formRules: {
87
- name: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
87
+ name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
88
88
  code: [
89
- { required: true, message: '请输入角色代码', trigger: 'blur' },
90
- { pattern: /^[a-zA-Z0-9_]+$/, message: '角色代码只能包含字母、数字和下划线', trigger: 'blur' }
89
+ { required: true, message: "请输入角色代码", trigger: "blur" },
90
+ { pattern: /^[a-zA-Z0-9_]+$/, message: "角色代码只能包含字母、数字和下划线", trigger: "blur" }
91
91
  ],
92
- sort: [{ type: 'number', message: '排序必须是数字', trigger: 'blur' }]
92
+ sort: [{ type: "number", message: "排序必须是数字", trigger: "blur" }]
93
93
  }
94
94
  });
95
95
 
96
96
  // 方法集合
97
97
  const $Method = {
98
98
  async initData() {
99
- if ($Prop.actionType === 'upd' && $Prop.rowData.id) {
99
+ if ($Prop.actionType === "upd" && $Prop.rowData.id) {
100
100
  $Data.formData = Object.assign({}, $Prop.rowData);
101
101
  }
102
102
  $Method.onShow();
@@ -110,7 +110,7 @@ const $Method = {
110
110
  onClose() {
111
111
  $Data.visible = false;
112
112
  setTimeout(() => {
113
- $Emit('update:modelValue', false);
113
+ $Emit("update:modelValue", false);
114
114
  }, 300);
115
115
  },
116
116
  async onSubmit() {
@@ -119,14 +119,14 @@ const $Method = {
119
119
  if (!valid) return;
120
120
 
121
121
  $Data.submitting = true;
122
- const formData = $Prop.actionType === 'add' ? fieldClear($Data.formData, { omitKeys: ['id', 'state'] }) : $Data.formData;
123
- const res = await $Http($Prop.actionType === 'upd' ? '/addon/admin/role/upd' : '/addon/admin/role/ins', formData);
122
+ const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : $Data.formData;
123
+ const res = await $Http($Prop.actionType === "upd" ? "/addon/admin/role/upd" : "/addon/admin/role/ins", formData);
124
124
 
125
125
  MessagePlugin.success(res.msg);
126
- $Emit('success');
126
+ $Emit("success");
127
127
  $Method.onClose();
128
128
  } catch (error) {
129
- MessagePlugin.error(error.msg || '提交失败');
129
+ MessagePlugin.error(error.msg || "提交失败");
130
130
  } finally {
131
131
  $Data.submitting = false;
132
132
  }