befly-admin-ui 1.10.1 → 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 -402
  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 +51 -55
  8. package/views/config/dictType/components/edit.vue +81 -57
  9. package/views/config/dictType/index.vue +37 -39
  10. package/views/config/system/components/edit.vue +97 -86
  11. package/views/config/system/index.vue +35 -37
  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 +96 -85
  22. package/views/log/error/index.vue +111 -117
  23. package/views/log/login/index.vue +15 -13
  24. package/views/log/operate/index.vue +31 -31
  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 +27 -28
  28. package/views/permission/api/index.vue +44 -45
  29. package/views/permission/menu/index.vue +35 -35
  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 +47 -49
  34. package/views/resource/gallery/index.vue +77 -78
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <PageTableDetail class="page-gallery page-table" :columns="$Data.columns" :endpoints="$Data.endpoints" :table-slot-names="['thumbnail', 'fileSize', 'isImage', 'createdAt', 'updatedAt']">
3
3
  <template #toolLeft="scope">
4
- <TUpload :action="$Config.uploadPath" :headers="uploadHeaders" :show-image-file-name="false" :file-list-display="() => null" accept="image/*" @success="onUploadSuccess($event, scope.reload)">
4
+ <TUpload :action="$Config.uploadPath" :headers="$Const.uploadHeaders" :show-image-file-name="false" :file-list-display="() => null" accept="image/*" @success="$Method.onUploadSuccess($event, scope.reload)">
5
5
  <TButton theme="primary">
6
6
  <template #icon>
7
7
  <UploadIcon />
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <template #toolRight="scope">
15
- <TInput v-model="$Data.keyword" placeholder="搜索图片名称" clearable @enter="handleSearch(scope.reload)" @clear="handleSearch(scope.reload)">
15
+ <TInput v-model="$Data.keyword" placeholder="搜索图片名称" clearable @enter="$Method.handleSearch(scope.reload)" @clear="$Method.handleSearch(scope.reload)">
16
16
  <template #suffix-icon>
17
17
  <SearchIcon />
18
18
  </template>
@@ -24,7 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <template #fileSize="{ row }">
27
- {{ formatFileSize(row.fileSize) }}
27
+ {{ $Method.formatFileSize(row.fileSize) }}
28
28
  </template>
29
29
 
30
30
  <template #isImage="{ row }">
@@ -33,17 +33,17 @@
33
33
  </template>
34
34
 
35
35
  <template #createdAt="{ row }">
36
- {{ formatDateTime(row.createdAt) }}
36
+ {{ $Method.formatDateTime(row.createdAt) }}
37
37
  </template>
38
38
 
39
39
  <template #updatedAt="{ row }">
40
- {{ formatDateTime(row.updatedAt) }}
40
+ {{ $Method.formatDateTime(row.updatedAt) }}
41
41
  </template>
42
42
 
43
43
  <template #detail="scope">
44
44
  <div class="gallery-detail" v-if="scope.row">
45
45
  <div class="detail-actions">
46
- <TButton variant="outline" size="small" @click="copyUrl(scope.row.url)">复制链接</TButton>
46
+ <TButton variant="outline" size="small" @click="$Method.copyUrl(scope.row.url)">复制链接</TButton>
47
47
  </div>
48
48
 
49
49
  <DetailPanel :data="scope.row" :fields="$Data.columns">
@@ -53,17 +53,17 @@
53
53
  </div>
54
54
  </template>
55
55
  <template #fileSize="slotScope">
56
- {{ formatFileSize(slotScope.value) }}
56
+ {{ $Method.formatFileSize(slotScope.value) }}
57
57
  </template>
58
58
  <template #isImage="slotScope">
59
59
  <TTag v-if="slotScope.value === 1" shape="round" theme="success" variant="light-outline">图片</TTag>
60
60
  <TTag v-else shape="round" variant="light-outline">文件</TTag>
61
61
  </template>
62
62
  <template #createdAt="slotScope">
63
- {{ formatDateTime(slotScope.value) }}
63
+ {{ $Method.formatDateTime(slotScope.value) }}
64
64
  </template>
65
65
  <template #updatedAt="slotScope">
66
- {{ formatDateTime(slotScope.value) }}
66
+ {{ $Method.formatDateTime(slotScope.value) }}
67
67
  </template>
68
68
  <template #url="slotScope">
69
69
  <a class="detail-link" :href="slotScope.value" target="_blank" rel="noreferrer">{{ slotScope.value }}</a>
@@ -86,8 +86,73 @@ import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
86
86
  import { $Config } from "@/plugins/config.js";
87
87
  import { $Store } from "@/plugins/store.js";
88
88
 
89
- const uploadHeaders = {
90
- Authorization: `Bearer ${$Store.local.get($Config.tokenName, "")}`
89
+ const $Const = {
90
+ uploadHeaders: {
91
+ Authorization: `Bearer ${$Store.local.get($Config.tokenName, "")}`
92
+ }
93
+ };
94
+
95
+ const $Method = {
96
+ handleSearch(reload) {
97
+ reload({ keepSelection: false, resetPage: true });
98
+ },
99
+ async copyUrl(url) {
100
+ try {
101
+ await navigator.clipboard.writeText(url);
102
+ MessagePlugin.success("图片链接已复制");
103
+ } catch (error) {
104
+ MessagePlugin.error(error?.message || "复制失败");
105
+ }
106
+ },
107
+ formatFileSize(fileSize) {
108
+ if (!Number.isFinite(fileSize) || fileSize <= 0) {
109
+ return "0 B";
110
+ }
111
+
112
+ if (fileSize < 1024) {
113
+ return `${fileSize} B`;
114
+ }
115
+
116
+ if (fileSize < 1024 * 1024) {
117
+ return `${(fileSize / 1024).toFixed(1)} KB`;
118
+ }
119
+
120
+ return `${(fileSize / 1024 / 1024).toFixed(1)} MB`;
121
+ },
122
+ formatFileExt(fileExt) {
123
+ if (typeof fileExt !== "string" || fileExt.length === 0) {
124
+ return "未知格式";
125
+ }
126
+
127
+ return fileExt.replace(/^\./, "").toUpperCase();
128
+ },
129
+ formatDateTime(value) {
130
+ if (!value) {
131
+ return "-";
132
+ }
133
+
134
+ const date = new Date(value);
135
+ if (!Number.isFinite(date.getTime())) {
136
+ return value;
137
+ }
138
+
139
+ const year = date.getFullYear();
140
+ const month = String(date.getMonth() + 1).padStart(2, "0");
141
+ const day = String(date.getDate()).padStart(2, "0");
142
+ const hours = String(date.getHours()).padStart(2, "0");
143
+ const minutes = String(date.getMinutes()).padStart(2, "0");
144
+ const seconds = String(date.getSeconds()).padStart(2, "0");
145
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
146
+ },
147
+ onUploadSuccess(res, reload) {
148
+ if (res.response?.code !== 0 || res.response?.data?.isImage !== 1) {
149
+ MessagePlugin.error(res.response?.msg || "上传失败");
150
+ return;
151
+ }
152
+
153
+ MessagePlugin.success("上传成功");
154
+ reload({ keepSelection: false, resetPage: true });
155
+ }
91
156
  };
92
157
 
93
158
  const $Data = reactive({
@@ -95,7 +160,7 @@ const $Data = reactive({
95
160
  columns: withDefaultColumns([
96
161
  { colKey: "thumbnail", title: "缩略图", width: 96 },
97
162
  { colKey: "fileName", title: "文件名" },
98
- { colKey: "fileExt", title: "扩展名", width: 100, format: formatFileExt },
163
+ { colKey: "fileExt", title: "扩展名", width: 100, format: $Method.formatFileExt },
99
164
  { colKey: "fileSize", title: "大小", width: 110 },
100
165
  { colKey: "isImage", title: "类型", width: 90 },
101
166
  { colKey: "createdAt", title: "创建时间", width: 170 },
@@ -121,72 +186,6 @@ const $Data = reactive({
121
186
  }
122
187
  }
123
188
  });
124
-
125
- function handleSearch(reload) {
126
- reload({ keepSelection: false, resetPage: true });
127
- }
128
-
129
- async function copyUrl(url) {
130
- try {
131
- await navigator.clipboard.writeText(url);
132
- MessagePlugin.success("图片链接已复制");
133
- } catch (error) {
134
- MessagePlugin.error(error?.message || "复制失败");
135
- }
136
- }
137
-
138
- function formatFileSize(fileSize) {
139
- if (!Number.isFinite(fileSize) || fileSize <= 0) {
140
- return "0 B";
141
- }
142
-
143
- if (fileSize < 1024) {
144
- return `${fileSize} B`;
145
- }
146
-
147
- if (fileSize < 1024 * 1024) {
148
- return `${(fileSize / 1024).toFixed(1)} KB`;
149
- }
150
-
151
- return `${(fileSize / 1024 / 1024).toFixed(1)} MB`;
152
- }
153
-
154
- function formatFileExt(fileExt) {
155
- if (typeof fileExt !== "string" || fileExt.length === 0) {
156
- return "未知格式";
157
- }
158
-
159
- return fileExt.replace(/^\./, "").toUpperCase();
160
- }
161
-
162
- function formatDateTime(value) {
163
- if (!value) {
164
- return "-";
165
- }
166
-
167
- const date = new Date(value);
168
- if (!Number.isFinite(date.getTime())) {
169
- return value;
170
- }
171
-
172
- const year = date.getFullYear();
173
- const month = String(date.getMonth() + 1).padStart(2, "0");
174
- const day = String(date.getDate()).padStart(2, "0");
175
- const hours = String(date.getHours()).padStart(2, "0");
176
- const minutes = String(date.getMinutes()).padStart(2, "0");
177
- const seconds = String(date.getSeconds()).padStart(2, "0");
178
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
179
- }
180
-
181
- function onUploadSuccess(res, reload) {
182
- if (res.response?.code !== 0 || res.response?.data?.isImage !== 1) {
183
- MessagePlugin.error(res.response?.msg || "上传失败");
184
- return;
185
- }
186
-
187
- MessagePlugin.success("上传成功");
188
- reload({ keepSelection: false, resetPage: true });
189
- }
190
189
  </script>
191
190
 
192
191
  <style scoped lang="scss">