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,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,16 +12,11 @@
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>
19
19
  </TInput>
20
- <TButton shape="circle" @click="handleRefresh(scope.reload)">
21
- <template #icon>
22
- <RefreshIcon />
23
- </template>
24
- </TButton>
25
20
  </template>
26
21
 
27
22
  <template #thumbnail="{ row }">
@@ -29,7 +24,7 @@
29
24
  </template>
30
25
 
31
26
  <template #fileSize="{ row }">
32
- {{ formatFileSize(row.fileSize) }}
27
+ {{ $Method.formatFileSize(row.fileSize) }}
33
28
  </template>
34
29
 
35
30
  <template #isImage="{ row }">
@@ -38,17 +33,17 @@
38
33
  </template>
39
34
 
40
35
  <template #createdAt="{ row }">
41
- {{ formatDateTime(row.createdAt) }}
36
+ {{ $Method.formatDateTime(row.createdAt) }}
42
37
  </template>
43
38
 
44
39
  <template #updatedAt="{ row }">
45
- {{ formatDateTime(row.updatedAt) }}
40
+ {{ $Method.formatDateTime(row.updatedAt) }}
46
41
  </template>
47
42
 
48
43
  <template #detail="scope">
49
44
  <div class="gallery-detail" v-if="scope.row">
50
45
  <div class="detail-actions">
51
- <TButton variant="outline" size="small" @click="copyUrl(scope.row.url)">复制链接</TButton>
46
+ <TButton variant="outline" size="small" @click="$Method.copyUrl(scope.row.url)">复制链接</TButton>
52
47
  </div>
53
48
 
54
49
  <DetailPanel :data="scope.row" :fields="$Data.columns">
@@ -58,17 +53,17 @@
58
53
  </div>
59
54
  </template>
60
55
  <template #fileSize="slotScope">
61
- {{ formatFileSize(slotScope.value) }}
56
+ {{ $Method.formatFileSize(slotScope.value) }}
62
57
  </template>
63
58
  <template #isImage="slotScope">
64
59
  <TTag v-if="slotScope.value === 1" shape="round" theme="success" variant="light-outline">图片</TTag>
65
60
  <TTag v-else shape="round" variant="light-outline">文件</TTag>
66
61
  </template>
67
62
  <template #createdAt="slotScope">
68
- {{ formatDateTime(slotScope.value) }}
63
+ {{ $Method.formatDateTime(slotScope.value) }}
69
64
  </template>
70
65
  <template #updatedAt="slotScope">
71
- {{ formatDateTime(slotScope.value) }}
66
+ {{ $Method.formatDateTime(slotScope.value) }}
72
67
  </template>
73
68
  <template #url="slotScope">
74
69
  <a class="detail-link" :href="slotScope.value" target="_blank" rel="noreferrer">{{ slotScope.value }}</a>
@@ -83,7 +78,7 @@
83
78
  <script setup>
84
79
  import { reactive } from "vue";
85
80
  import { Button as TButton, Image as TImage, Input as TInput, MessagePlugin, Tag as TTag, Upload as TUpload } from "tdesign-vue-next";
86
- import { RefreshIcon, SearchIcon, UploadIcon } from "tdesign-icons-vue-next";
81
+ import { SearchIcon, UploadIcon } from "tdesign-icons-vue-next";
87
82
 
88
83
  import DetailPanel from "befly-admin-ui/components/detailPanel.vue";
89
84
  import PageTableDetail from "befly-admin-ui/components/pageTableDetail.vue";
@@ -91,8 +86,73 @@ import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
91
86
  import { $Config } from "@/plugins/config.js";
92
87
  import { $Store } from "@/plugins/store.js";
93
88
 
94
- const uploadHeaders = {
95
- 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
+ }
96
156
  };
97
157
 
98
158
  const $Data = reactive({
@@ -100,7 +160,7 @@ const $Data = reactive({
100
160
  columns: withDefaultColumns([
101
161
  { colKey: "thumbnail", title: "缩略图", width: 96 },
102
162
  { colKey: "fileName", title: "文件名" },
103
- { colKey: "fileExt", title: "扩展名", width: 100, format: formatFileExt },
163
+ { colKey: "fileExt", title: "扩展名", width: 100, format: $Method.formatFileExt },
104
164
  { colKey: "fileSize", title: "大小", width: 110 },
105
165
  { colKey: "isImage", title: "类型", width: 90 },
106
166
  { colKey: "createdAt", title: "创建时间", width: 170 },
@@ -126,76 +186,6 @@ const $Data = reactive({
126
186
  }
127
187
  }
128
188
  });
129
-
130
- function handleSearch(reload) {
131
- reload({ keepSelection: false, resetPage: true });
132
- }
133
-
134
- function handleRefresh(reload) {
135
- reload({ keepSelection: true });
136
- }
137
-
138
- async function copyUrl(url) {
139
- try {
140
- await navigator.clipboard.writeText(url);
141
- MessagePlugin.success("图片链接已复制");
142
- } catch (error) {
143
- MessagePlugin.error(error?.message || "复制失败");
144
- }
145
- }
146
-
147
- function formatFileSize(fileSize) {
148
- if (!Number.isFinite(fileSize) || fileSize <= 0) {
149
- return "0 B";
150
- }
151
-
152
- if (fileSize < 1024) {
153
- return `${fileSize} B`;
154
- }
155
-
156
- if (fileSize < 1024 * 1024) {
157
- return `${(fileSize / 1024).toFixed(1)} KB`;
158
- }
159
-
160
- return `${(fileSize / 1024 / 1024).toFixed(1)} MB`;
161
- }
162
-
163
- function formatFileExt(fileExt) {
164
- if (typeof fileExt !== "string" || fileExt.length === 0) {
165
- return "未知格式";
166
- }
167
-
168
- return fileExt.replace(/^\./, "").toUpperCase();
169
- }
170
-
171
- function formatDateTime(value) {
172
- if (!value) {
173
- return "-";
174
- }
175
-
176
- const date = new Date(value);
177
- if (!Number.isFinite(date.getTime())) {
178
- return value;
179
- }
180
-
181
- const year = date.getFullYear();
182
- const month = String(date.getMonth() + 1).padStart(2, "0");
183
- const day = String(date.getDate()).padStart(2, "0");
184
- const hours = String(date.getHours()).padStart(2, "0");
185
- const minutes = String(date.getMinutes()).padStart(2, "0");
186
- const seconds = String(date.getSeconds()).padStart(2, "0");
187
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
188
- }
189
-
190
- function onUploadSuccess(res, reload) {
191
- if (res.response?.code !== 0 || res.response?.data?.isImage !== 1) {
192
- MessagePlugin.error(res.response?.msg || "上传失败");
193
- return;
194
- }
195
-
196
- MessagePlugin.success("上传成功");
197
- reload({ keepSelection: false, resetPage: true });
198
- }
199
189
  </script>
200
190
 
201
191
  <style scoped lang="scss">