befly-admin-ui 1.10.0 → 1.10.2

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 (34) hide show
  1. package/components/detailPanel.vue +52 -54
  2. package/components/pageDialog.vue +131 -117
  3. package/components/pageTableDetail.vue +381 -398
  4. package/layouts/default.vue +212 -215
  5. package/package.json +2 -2
  6. package/views/config/dict/components/edit.vue +83 -60
  7. package/views/config/dict/index.vue +53 -68
  8. package/views/config/dictType/components/edit.vue +81 -57
  9. package/views/config/dictType/index.vue +39 -51
  10. package/views/config/system/components/edit.vue +97 -86
  11. package/views/config/system/index.vue +37 -51
  12. package/views/index/components/addonList.vue +14 -11
  13. package/views/index/components/environmentInfo.vue +25 -22
  14. package/views/index/components/operationLogs.vue +20 -16
  15. package/views/index/components/performanceMetrics.vue +24 -21
  16. package/views/index/components/serviceStatus.vue +26 -22
  17. package/views/index/components/systemNotifications.vue +24 -19
  18. package/views/index/components/systemOverview.vue +368 -385
  19. package/views/index/components/systemResources.vue +22 -19
  20. package/views/index/components/userInfo.vue +56 -56
  21. package/views/log/email/index.vue +99 -100
  22. package/views/log/error/index.vue +112 -130
  23. package/views/log/login/index.vue +17 -28
  24. package/views/log/operate/index.vue +33 -46
  25. package/views/login_1/index.vue +50 -32
  26. package/views/people/admin/components/edit.vue +1 -1
  27. package/views/people/admin/index.vue +28 -29
  28. package/views/permission/api/index.vue +46 -58
  29. package/views/permission/menu/index.vue +46 -52
  30. package/views/permission/role/components/api.vue +143 -144
  31. package/views/permission/role/components/edit.vue +74 -52
  32. package/views/permission/role/components/menu.vue +119 -121
  33. package/views/permission/role/index.vue +49 -63
  34. package/views/resource/gallery/index.vue +78 -88
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <PageDialog v-model="dialogVisible" title="接口权限" width="900px" :confirm-loading="$Data.submitting" @confirm="onSubmit">
2
+ <PageDialog v-model="$Computed.dialogVisible" title="接口权限" width="900px" :confirm-loading="$Data.submitting" @confirm="$Method.onSubmit">
3
3
  <div class="comp-role-api">
4
4
  <!-- 搜索框 -->
5
5
  <div class="search-box">
6
- <TInput v-model="$Data.searchText" placeholder="搜索接口名称或路径" clearable @change="onSearch">
6
+ <TInput v-model="$Data.searchText" placeholder="搜索接口名称或路径" clearable @change="$Method.onSearch">
7
7
  <template #prefix-icon>
8
8
  <SearchIcon />
9
9
  </template>
@@ -37,7 +37,7 @@ import { computed, reactive } from "vue";
37
37
  import { Input as TInput, CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, MessagePlugin } from "tdesign-vue-next";
38
38
  import { SearchIcon } from "tdesign-icons-vue-next";
39
39
  import PageDialog from "befly-admin-ui/components/pageDialog.vue";
40
- import { $Http } from "@/plugins/http";
40
+ import { $Http } from "@/plugins/http.js";
41
41
 
42
42
  const $Prop = defineProps({
43
43
  modelValue: {
@@ -52,13 +52,6 @@ const $Prop = defineProps({
52
52
 
53
53
  const $Emit = defineEmits(["update:modelValue", "success"]);
54
54
 
55
- const dialogVisible = computed({
56
- get: () => $Prop.modelValue,
57
- set: (value) => {
58
- $Emit("update:modelValue", value);
59
- }
60
- });
61
-
62
55
  const $Data = reactive({
63
56
  submitting: false,
64
57
  apiData: [],
@@ -67,164 +60,170 @@ const $Data = reactive({
67
60
  checkedApiPaths: []
68
61
  });
69
62
 
70
- async function initData() {
71
- await Promise.all([apiApiAll(), apiRoleApiDetail()]);
63
+ const $Computed = reactive({
64
+ dialogVisible: computed({
65
+ get: () => $Prop.modelValue,
66
+ set: (value) => {
67
+ $Emit("update:modelValue", value);
68
+ }
69
+ })
70
+ });
71
+
72
+ const $Method = {
73
+ async initData() {
74
+ await Promise.all([$Method.apiApiAll(), $Method.apiRoleApiDetail()]);
72
75
 
73
- const merged = new Set();
74
- const current = Array.isArray($Data.checkedApiPaths) ? $Data.checkedApiPaths : [];
75
- for (const p of current) {
76
- if (typeof p === "string") {
77
- merged.add(p);
76
+ const merged = new Set();
77
+ const current = Array.isArray($Data.checkedApiPaths) ? $Data.checkedApiPaths : [];
78
+ for (const path of current) {
79
+ if (typeof path === "string") {
80
+ merged.add(path);
81
+ }
78
82
  }
79
- }
80
83
 
81
- const groups = Array.isArray($Data.apiData) ? $Data.apiData : [];
82
- for (const group of groups) {
83
- const groupRecord = group && typeof group === "object" ? group : null;
84
- const apis = groupRecord && Array.isArray(groupRecord["apis"]) ? groupRecord["apis"] : [];
85
- for (const api of apis) {
86
- const apiRecord = api && typeof api === "object" ? api : null;
87
- const authValue = apiRecord ? apiRecord["auth"] : undefined;
88
- const isPublic = authValue === 0 || authValue === "0" || authValue === false;
89
- const value = apiRecord && typeof apiRecord["value"] === "string" ? String(apiRecord["value"]) : "";
90
- if (isPublic && value) {
91
- merged.add(value);
84
+ const groups = Array.isArray($Data.apiData) ? $Data.apiData : [];
85
+ for (const group of groups) {
86
+ const groupRecord = group && typeof group === "object" ? group : null;
87
+ const apis = groupRecord && Array.isArray(groupRecord["apis"]) ? groupRecord["apis"] : [];
88
+ for (const api of apis) {
89
+ const apiRecord = api && typeof api === "object" ? api : null;
90
+ const authValue = apiRecord ? apiRecord["auth"] : undefined;
91
+ const isPublic = authValue === 0 || authValue === "0" || authValue === false;
92
+ const value = apiRecord && typeof apiRecord["value"] === "string" ? String(apiRecord["value"]) : "";
93
+ if (isPublic && value) {
94
+ merged.add(value);
95
+ }
92
96
  }
93
97
  }
94
- }
95
98
 
96
- $Data.checkedApiPaths = Array.from(merged);
97
- $Data.filteredApiData = $Data.apiData;
98
- }
99
+ $Data.checkedApiPaths = Array.from(merged);
100
+ $Data.filteredApiData = $Data.apiData;
101
+ },
102
+ async apiApiAll() {
103
+ try {
104
+ const res = await $Http("/core/api/all", {}, [""]);
105
+
106
+ const apiMap = new Map();
107
+ const resRecord = res && typeof res === "object" ? res : null;
108
+ const resData = resRecord && resRecord["data"] && typeof resRecord["data"] === "object" ? resRecord["data"] : null;
109
+ const lists = resData && Array.isArray(resData["lists"]) ? resData["lists"] : [];
110
+ for (const api of lists) {
111
+ const apiRecord = api && typeof api === "object" ? api : null;
112
+ const apiPath = apiRecord && typeof apiRecord["path"] === "string" ? String(apiRecord["path"]) : "";
113
+ if (!apiPath) {
114
+ continue;
115
+ }
99
116
 
100
- async function apiApiAll() {
101
- try {
102
- const res = await $Http("/core/api/all", {}, [""]);
117
+ const parentPath = apiRecord && typeof apiRecord["parentPath"] === "string" ? String(apiRecord["parentPath"]) : "";
118
+ const groupKey = parentPath || "(未分组)";
103
119
 
104
- const apiMap = new Map();
120
+ if (!apiMap.has(groupKey)) {
121
+ apiMap.set(groupKey, {
122
+ name: groupKey,
123
+ title: groupKey,
124
+ apis: []
125
+ });
126
+ }
105
127
 
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"] : [];
109
- for (const api of lists) {
110
- const apiRecord = api && typeof api === "object" ? api : null;
111
- const apiPath = apiRecord && typeof apiRecord["path"] === "string" ? String(apiRecord["path"]) : "";
112
- if (!apiPath) {
113
- continue;
128
+ apiMap.get(groupKey)?.apis.push({
129
+ value: apiPath,
130
+ name: (apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "") || apiPath,
131
+ path: apiPath,
132
+ label: `${(apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "") || ""} ${apiPath ? `(${apiPath})` : ""}`.trim(),
133
+ description: apiRecord ? apiRecord["description"] : undefined,
134
+ auth: apiRecord ? apiRecord["auth"] : undefined,
135
+ parentPath: parentPath
136
+ });
114
137
  }
115
138
 
116
- const parentPath = apiRecord && typeof apiRecord["parentPath"] === "string" ? String(apiRecord["parentPath"]) : "";
117
- const groupKey = parentPath || "(未分组)";
118
-
119
- if (!apiMap.has(groupKey)) {
120
- apiMap.set(groupKey, {
121
- name: groupKey,
122
- title: groupKey,
123
- apis: []
139
+ const groups = Array.from(apiMap.values());
140
+ for (const group of groups) {
141
+ group.apis.sort((a, b) => {
142
+ const ap = typeof a.path === "string" ? a.path : "";
143
+ const bp = typeof b.path === "string" ? b.path : "";
144
+ return ap.localeCompare(bp);
124
145
  });
125
146
  }
126
147
 
127
- apiMap.get(groupKey)?.apis.push({
128
- value: apiPath,
129
- name: (apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "") || apiPath,
130
- path: apiPath,
131
- label: `${(apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "") || ""} ${apiPath ? `(${apiPath})` : ""}`.trim(),
132
- description: apiRecord ? apiRecord["description"] : undefined,
133
- auth: apiRecord ? apiRecord["auth"] : undefined,
134
- parentPath: parentPath
148
+ groups.sort((a, b) => {
149
+ const at = typeof a.title === "string" ? a.title : "";
150
+ const bt = typeof b.title === "string" ? b.title : "";
151
+ return at.localeCompare(bt);
135
152
  });
136
- }
137
153
 
138
- const groups = Array.from(apiMap.values());
139
- for (const group of groups) {
140
- group.apis.sort((a, b) => {
141
- const ap = typeof a.path === "string" ? a.path : "";
142
- const bp = typeof b.path === "string" ? b.path : "";
143
- return ap.localeCompare(bp);
144
- });
154
+ $Data.apiData = groups;
155
+ } catch (error) {
156
+ MessagePlugin.error(error.msg || error.message || "加载接口失败");
157
+ }
158
+ },
159
+ async apiRoleApiDetail() {
160
+ if (!$Prop.rowData.id) return;
161
+
162
+ try {
163
+ const res = await $Http(
164
+ "/core/role/apis",
165
+ {
166
+ roleCode: $Prop.rowData.code
167
+ },
168
+ [""]
169
+ );
170
+
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 || "加载数据失败");
176
+ }
177
+ },
178
+ onSearch() {
179
+ if (!$Data.searchText) {
180
+ $Data.filteredApiData = $Data.apiData;
181
+ return;
145
182
  }
146
183
 
147
- groups.sort((a, b) => {
148
- const at = typeof a.title === "string" ? a.title : "";
149
- const bt = typeof b.title === "string" ? b.title : "";
150
- return at.localeCompare(bt);
151
- });
152
-
153
- $Data.apiData = groups;
154
- } catch (error) {
155
- MessagePlugin.error(error.msg || error.message || "加载接口失败");
156
- }
157
- }
158
-
159
- async function apiRoleApiDetail() {
160
- if (!$Prop.rowData.id) return;
161
-
162
- try {
163
- const res = await $Http(
164
- "/core/role/apis",
165
- {
166
- roleCode: $Prop.rowData.code
167
- },
168
- [""]
169
- );
170
-
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 || "加载数据失败");
176
- }
177
- }
178
-
179
- function onSearch() {
180
- if (!$Data.searchText) {
181
- $Data.filteredApiData = $Data.apiData;
182
- return;
183
- }
184
+ const searchLower = String($Data.searchText).toLowerCase();
185
+ $Data.filteredApiData = $Data.apiData
186
+ .map((group) => {
187
+ const groupRecord = group && typeof group === "object" ? group : null;
188
+ const groupApis = groupRecord && Array.isArray(groupRecord["apis"]) ? groupRecord["apis"] : [];
189
+ const apis = groupApis.filter((api) => {
190
+ const apiRecord = api && typeof api === "object" ? api : null;
191
+ const label = apiRecord && typeof apiRecord["label"] === "string" ? String(apiRecord["label"]) : "";
192
+ const name = apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "";
193
+ const path = apiRecord && typeof apiRecord["path"] === "string" ? String(apiRecord["path"]) : "";
194
+ return label.toLowerCase().includes(searchLower) || name.toLowerCase().includes(searchLower) || path.toLowerCase().includes(searchLower);
195
+ });
196
+ return {
197
+ name: groupRecord && typeof groupRecord["name"] === "string" ? String(groupRecord["name"]) : "",
198
+ title: groupRecord && typeof groupRecord["title"] === "string" ? String(groupRecord["title"]) : "",
199
+ apis: apis
200
+ };
201
+ })
202
+ .filter((group) => group.apis.length > 0);
203
+ },
204
+ async onSubmit(context) {
205
+ try {
206
+ $Data.submitting = true;
184
207
 
185
- const searchLower = String($Data.searchText).toLowerCase();
186
- $Data.filteredApiData = $Data.apiData
187
- .map((group) => {
188
- const groupRecord = group && typeof group === "object" ? group : null;
189
- const groupApis = groupRecord && Array.isArray(groupRecord["apis"]) ? groupRecord["apis"] : [];
190
- const apis = groupApis.filter((api) => {
191
- const apiRecord = api && typeof api === "object" ? api : null;
192
- const label = apiRecord && typeof apiRecord["label"] === "string" ? String(apiRecord["label"]) : "";
193
- const name = apiRecord && typeof apiRecord["name"] === "string" ? String(apiRecord["name"]) : "";
194
- const path = apiRecord && typeof apiRecord["path"] === "string" ? String(apiRecord["path"]) : "";
195
- return label.toLowerCase().includes(searchLower) || name.toLowerCase().includes(searchLower) || path.toLowerCase().includes(searchLower);
208
+ await $Http("/core/role/apiSave", {
209
+ roleCode: $Prop.rowData.code,
210
+ apiPaths: $Data.checkedApiPaths
196
211
  });
197
- return {
198
- name: groupRecord && typeof groupRecord["name"] === "string" ? String(groupRecord["name"]) : "",
199
- title: groupRecord && typeof groupRecord["title"] === "string" ? String(groupRecord["title"]) : "",
200
- apis: apis
201
- };
202
- })
203
- .filter((group) => group.apis.length > 0);
204
- }
205
-
206
- async function onSubmit(context) {
207
- try {
208
- $Data.submitting = true;
209
-
210
- const res = await $Http("/core/role/apiSave", {
211
- roleCode: $Prop.rowData.code,
212
- apiPaths: $Data.checkedApiPaths
213
- });
214
212
 
215
- MessagePlugin.success("保存成功");
216
- $Emit("success");
217
- if (context && typeof context.close === "function") {
218
- context.close();
213
+ MessagePlugin.success("保存成功");
214
+ $Emit("success");
215
+ if (context && typeof context.close === "function") {
216
+ context.close();
217
+ }
218
+ } catch (error) {
219
+ MessagePlugin.error(error.msg || error.message || "保存失败");
220
+ } finally {
221
+ $Data.submitting = false;
219
222
  }
220
- } catch (error) {
221
- MessagePlugin.error(error.msg || error.message || "保存失败");
222
- } finally {
223
- $Data.submitting = false;
224
223
  }
225
- }
224
+ };
226
225
 
227
- initData();
226
+ $Method.initData();
228
227
  </script>
229
228
 
230
229
  <style scoped lang="scss">
@@ -1,7 +1,17 @@
1
1
  <template>
2
- <PageDialog v-model="dialogVisible" :title="$Prop.actionType === 'upd' ? '更新角色' : '添加角色'" :confirm-loading="$Data.submitting" @confirm="onSubmit">
2
+ <PageDialog v-model="$Computed.dialogVisible" :title="$Computed.dialogTitle" :confirm-loading="$Data.submitting" @confirm="$Method.onSubmit">
3
3
  <div class="comp-role-edit">
4
- <TForm :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" ref="formRef">
4
+ <TForm
5
+ :model="$Data.formData"
6
+ label-width="120px"
7
+ label-position="left"
8
+ :rules="$Const.formRules"
9
+ :ref="
10
+ (value) => {
11
+ $From.formRef = value;
12
+ }
13
+ "
14
+ >
5
15
  <TFormItem label="角色名称" prop="name">
6
16
  <TInput v-model="$Data.formData.name" placeholder="请输入角色名称" />
7
17
  </TFormItem>
@@ -39,7 +49,7 @@ import {
39
49
  MessagePlugin
40
50
  } from "tdesign-vue-next";
41
51
  import PageDialog from "befly-admin-ui/components/pageDialog.vue";
42
- import { $Http } from "@/plugins/http";
52
+ import { $Http } from "@/plugins/http.js";
43
53
  import { fieldClear } from "befly-admin-ui/utils/fieldClear";
44
54
 
45
55
  const $Prop = defineProps({
@@ -59,24 +69,17 @@ const $Prop = defineProps({
59
69
 
60
70
  const $Emit = defineEmits(["update:modelValue", "success"]);
61
71
 
62
- // 表单引用
63
- const formRef = ref(null);
64
-
65
- const $Computed = {};
66
-
67
- const $Data = reactive({
68
- submitting: false,
69
- formData: {
70
- id: 0,
71
- name: "",
72
- code: "",
73
- description: "",
74
- sort: 0,
75
- state: 1
76
- }
77
- });
78
-
79
- const $Data2 = reactive({
72
+ const $Const = {
73
+ createDefaultFormData() {
74
+ return {
75
+ id: 0,
76
+ name: "",
77
+ code: "",
78
+ description: "",
79
+ sort: 0,
80
+ state: 1
81
+ };
82
+ },
80
83
  formRules: {
81
84
  name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
82
85
  code: [
@@ -85,47 +88,66 @@ const $Data2 = reactive({
85
88
  ],
86
89
  sort: [{ type: "number", message: "排序必须是数字", trigger: "blur" }]
87
90
  }
88
- });
91
+ };
89
92
 
90
- async function initData() {
91
- if ($Prop.actionType === "upd" && $Prop.rowData.id) {
92
- $Data.formData = Object.assign({}, $Prop.rowData);
93
- }
94
- }
93
+ const $From = {
94
+ formRef: null
95
+ };
95
96
 
96
- const dialogVisible = computed({
97
- get: () => $Prop.modelValue,
98
- set: (value) => {
99
- $Emit("update:modelValue", value);
100
- }
97
+ const $Data = reactive({
98
+ submitting: false,
99
+ formData: $Const.createDefaultFormData()
101
100
  });
102
101
 
103
- async function onSubmit(context) {
104
- try {
105
- const form = formRef.value;
106
- if (!form) {
107
- MessagePlugin.warning("表单未就绪");
102
+ const $Computed = reactive({
103
+ dialogVisible: computed({
104
+ get: () => $Prop.modelValue,
105
+ set: (value) => {
106
+ $Emit("update:modelValue", value);
107
+ }
108
+ }),
109
+ dialogTitle: computed(() => ($Prop.actionType === "upd" ? "更新角色" : "添加角色"))
110
+ });
111
+
112
+ const $Method = {
113
+ resetFormData() {
114
+ Object.assign($Data.formData, $Const.createDefaultFormData());
115
+ },
116
+ initData() {
117
+ if ($Prop.actionType === "upd" && $Prop.rowData.id) {
118
+ Object.assign($Data.formData, $Const.createDefaultFormData(), $Prop.rowData);
108
119
  return;
109
120
  }
110
121
 
111
- const valid = await form.validate();
112
- if (!valid) return;
122
+ $Method.resetFormData();
123
+ },
124
+ async onSubmit(context) {
125
+ try {
126
+ const form = $From.formRef;
127
+ if (!form) {
128
+ MessagePlugin.warning("表单未就绪");
129
+ return;
130
+ }
131
+
132
+ const valid = await form.validate();
133
+ if (!valid) return;
113
134
 
114
- $Data.submitting = true;
115
- const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : $Data.formData;
116
- const res = await $Http($Prop.actionType === "upd" ? "/core/role/update" : "/core/role/insert", formData);
135
+ $Data.submitting = true;
136
+ const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : $Data.formData;
137
+ const res = await $Http($Prop.actionType === "upd" ? "/core/role/update" : "/core/role/insert", formData);
117
138
 
118
- MessagePlugin.success(res.msg);
119
- $Emit("success");
120
- if (context && typeof context.close === "function") {
121
- context.close();
139
+ MessagePlugin.success(res.msg);
140
+ $Emit("success");
141
+ if (context && typeof context.close === "function") {
142
+ context.close();
143
+ }
144
+ } catch (error) {
145
+ MessagePlugin.error(error.msg || error.message || "提交失败");
146
+ } finally {
147
+ $Data.submitting = false;
122
148
  }
123
- } catch (error) {
124
- MessagePlugin.error(error.msg || error.message || "提交失败");
125
- } finally {
126
- $Data.submitting = false;
127
149
  }
128
- }
150
+ };
129
151
 
130
- initData();
152
+ $Method.initData();
131
153
  </script>