befly-admin-ui 1.10.9 → 1.10.10
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.
- package/components/detailPanel.vue +1 -1
- package/components/pageDialog.vue +13 -13
- package/components/pageTableDetail.vue +16 -16
- package/layouts/default.vue +13 -13
- package/package.json +1 -1
- package/views/config/dict/components/edit.vue +4 -4
- package/views/config/dict/index.vue +7 -7
- package/views/config/dictType/components/edit.vue +4 -4
- package/views/config/dictType/index.vue +5 -5
- package/views/config/system/components/edit.vue +5 -5
- package/views/config/system/index.vue +5 -5
- package/views/index/components/addonList.vue +1 -1
- package/views/index/components/environmentInfo.vue +1 -1
- package/views/index/components/operationLogs.vue +1 -1
- package/views/index/components/performanceMetrics.vue +1 -1
- package/views/index/components/serviceStatus.vue +2 -2
- package/views/index/components/systemNotifications.vue +1 -1
- package/views/index/components/systemOverview.vue +15 -15
- package/views/index/components/systemResources.vue +1 -1
- package/views/index/components/userInfo.vue +3 -3
- package/views/log/email/index.vue +6 -6
- package/views/log/error/index.vue +9 -9
- package/views/log/login/index.vue +1 -1
- package/views/log/operate/index.vue +3 -3
- package/views/login_1/index.vue +1 -1
- package/views/people/admin/components/edit.vue +7 -7
- package/views/people/admin/index.vue +4 -4
- package/views/permission/api/index.vue +4 -4
- package/views/permission/menu/index.vue +3 -3
- package/views/permission/role/components/api.vue +5 -5
- package/views/permission/role/components/edit.vue +4 -4
- package/views/permission/role/components/menu.vue +5 -5
- package/views/permission/role/index.vue +5 -5
- package/views/resource/gallery/index.vue +6 -6
|
@@ -69,7 +69,7 @@ const $Prop = defineProps({
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
const $Method = {
|
|
72
|
-
buildNormalizedFields() {
|
|
72
|
+
buildNormalizedFields: function () {
|
|
73
73
|
const row = $Prop.data && typeof $Prop.data === "object" ? $Prop.data : null;
|
|
74
74
|
const dataId = row && Object.hasOwn(row, "id") ? row.id : undefined;
|
|
75
75
|
|
|
@@ -79,16 +79,16 @@ const $Data = reactive({
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
const $Method = {
|
|
82
|
-
clearTimer(timer) {
|
|
82
|
+
clearTimer: function (timer) {
|
|
83
83
|
if (timer) {
|
|
84
84
|
clearTimeout(timer);
|
|
85
85
|
}
|
|
86
86
|
return null;
|
|
87
87
|
},
|
|
88
|
-
open() {
|
|
88
|
+
open: function () {
|
|
89
89
|
$Emit("update:modelValue", true);
|
|
90
90
|
},
|
|
91
|
-
close() {
|
|
91
|
+
close: function () {
|
|
92
92
|
$From.openDelayTimer = $Method.clearTimer($From.openDelayTimer);
|
|
93
93
|
$From.closeDelayTimer = $Method.clearTimer($From.closeDelayTimer);
|
|
94
94
|
|
|
@@ -99,14 +99,14 @@ const $Method = {
|
|
|
99
99
|
$From.closeDelayTimer = null;
|
|
100
100
|
}, $Const.closeDelay);
|
|
101
101
|
},
|
|
102
|
-
toggle() {
|
|
102
|
+
toggle: function () {
|
|
103
103
|
if ($Data.innerVisible) {
|
|
104
104
|
$Method.close();
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
$Method.open();
|
|
108
108
|
},
|
|
109
|
-
createEventContext(trigger) {
|
|
109
|
+
createEventContext: function (trigger) {
|
|
110
110
|
return {
|
|
111
111
|
trigger: trigger,
|
|
112
112
|
visible: $Data.innerVisible,
|
|
@@ -116,7 +116,7 @@ const $Method = {
|
|
|
116
116
|
getVisible: () => $Data.innerVisible
|
|
117
117
|
};
|
|
118
118
|
},
|
|
119
|
-
applyModelValue(value) {
|
|
119
|
+
applyModelValue: function (value) {
|
|
120
120
|
if (value) {
|
|
121
121
|
// 关键点:先渲染为 false,再延迟 true,保证 v-if + 初次 visible=true 时也能触发进入动画
|
|
122
122
|
$From.openDelayTimer = $Method.clearTimer($From.openDelayTimer);
|
|
@@ -131,7 +131,7 @@ const $Method = {
|
|
|
131
131
|
$From.openDelayTimer = $Method.clearTimer($From.openDelayTimer);
|
|
132
132
|
$Data.innerVisible = false;
|
|
133
133
|
},
|
|
134
|
-
closeByTrigger(trigger) {
|
|
134
|
+
closeByTrigger: function (trigger) {
|
|
135
135
|
// 固定交互:confirm 不自动关闭(等待异步提交成功后由调用侧 context.close() 决定关闭)
|
|
136
136
|
if (trigger === "confirm") {
|
|
137
137
|
return;
|
|
@@ -139,32 +139,32 @@ const $Method = {
|
|
|
139
139
|
// cancel/close 自动关闭
|
|
140
140
|
$Method.close();
|
|
141
141
|
},
|
|
142
|
-
onDialogClose() {
|
|
142
|
+
onDialogClose: function () {
|
|
143
143
|
const context = $Method.createEventContext("close");
|
|
144
144
|
$Method.closeByTrigger("close");
|
|
145
145
|
$Emit("close", context);
|
|
146
146
|
},
|
|
147
|
-
onDialogConfirm() {
|
|
147
|
+
onDialogConfirm: function () {
|
|
148
148
|
const context = $Method.createEventContext("confirm");
|
|
149
149
|
$Emit("confirm", context);
|
|
150
150
|
$Method.closeByTrigger("confirm");
|
|
151
151
|
},
|
|
152
|
-
onDialogCancel() {
|
|
152
|
+
onDialogCancel: function () {
|
|
153
153
|
const context = $Method.createEventContext("cancel");
|
|
154
154
|
$Emit("cancel", context);
|
|
155
155
|
$Method.closeByTrigger("cancel");
|
|
156
156
|
},
|
|
157
|
-
onFooterConfirm() {
|
|
157
|
+
onFooterConfirm: function () {
|
|
158
158
|
const context = $Method.createEventContext("confirm");
|
|
159
159
|
$Emit("confirm", context);
|
|
160
160
|
$Method.closeByTrigger("confirm");
|
|
161
161
|
},
|
|
162
|
-
onFooterClose() {
|
|
162
|
+
onFooterClose: function () {
|
|
163
163
|
const context = $Method.createEventContext("cancel");
|
|
164
164
|
$Emit("cancel", context);
|
|
165
165
|
$Method.closeByTrigger("cancel");
|
|
166
166
|
},
|
|
167
|
-
getVisible() {
|
|
167
|
+
getVisible: function () {
|
|
168
168
|
return $Data.innerVisible;
|
|
169
169
|
}
|
|
170
170
|
};
|
|
@@ -112,14 +112,14 @@ const $Data = reactive({
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
const $Method = {
|
|
115
|
-
getColKey(col) {
|
|
115
|
+
getColKey: function (col) {
|
|
116
116
|
const record = col;
|
|
117
117
|
const rawColKey = record["colKey"];
|
|
118
118
|
if (typeof rawColKey === "string") return rawColKey;
|
|
119
119
|
if (typeof rawColKey === "number") return String(rawColKey);
|
|
120
120
|
return "";
|
|
121
121
|
},
|
|
122
|
-
filterValidColumns(input) {
|
|
122
|
+
filterValidColumns: function (input) {
|
|
123
123
|
if (!Array.isArray(input)) {
|
|
124
124
|
return [];
|
|
125
125
|
}
|
|
@@ -139,7 +139,7 @@ const $Method = {
|
|
|
139
139
|
|
|
140
140
|
return out;
|
|
141
141
|
},
|
|
142
|
-
mergeDetailColumns(mainColumns, extraColumns) {
|
|
142
|
+
mergeDetailColumns: function (mainColumns, extraColumns) {
|
|
143
143
|
const out = [];
|
|
144
144
|
const set = new Set();
|
|
145
145
|
|
|
@@ -164,17 +164,17 @@ const $Method = {
|
|
|
164
164
|
|
|
165
165
|
return out;
|
|
166
166
|
},
|
|
167
|
-
formatTableCell(row, colKey) {
|
|
167
|
+
formatTableCell: function (row, colKey) {
|
|
168
168
|
const record = row && typeof row === "object" ? row : {};
|
|
169
169
|
const value = record[colKey];
|
|
170
170
|
const field = $Computed.columnsMeta.tableColumnMap[colKey] || {};
|
|
171
171
|
return formatFieldValue(value, field);
|
|
172
172
|
},
|
|
173
|
-
setCurrentRow(row) {
|
|
173
|
+
setCurrentRow: function (row) {
|
|
174
174
|
$Data.currentRow = row;
|
|
175
175
|
$Emit("row-change", { row: row });
|
|
176
176
|
},
|
|
177
|
-
getRowKeyValue(row) {
|
|
177
|
+
getRowKeyValue: function (row) {
|
|
178
178
|
const key = $Prop.rowKey;
|
|
179
179
|
if (!key) return null;
|
|
180
180
|
|
|
@@ -184,7 +184,7 @@ const $Method = {
|
|
|
184
184
|
if (typeof raw === "number") return raw;
|
|
185
185
|
return null;
|
|
186
186
|
},
|
|
187
|
-
applyAutoSelection(list, preferKey) {
|
|
187
|
+
applyAutoSelection: function (list, preferKey) {
|
|
188
188
|
if (!Array.isArray(list) || list.length === 0) {
|
|
189
189
|
$Method.setCurrentRow(null);
|
|
190
190
|
$Data.activeRowKeys = [];
|
|
@@ -213,14 +213,14 @@ const $Method = {
|
|
|
213
213
|
|
|
214
214
|
$Data.activeRowKeys = [firstKey];
|
|
215
215
|
},
|
|
216
|
-
getLastPage(total, limit) {
|
|
216
|
+
getLastPage: function (total, limit) {
|
|
217
217
|
if (total <= 0) return 1;
|
|
218
218
|
if (limit <= 0) return 1;
|
|
219
219
|
const pages = Math.ceil(total / limit);
|
|
220
220
|
if (!Number.isFinite(pages) || pages <= 0) return 1;
|
|
221
221
|
return pages;
|
|
222
222
|
},
|
|
223
|
-
async
|
|
223
|
+
loadList: async function (options) {
|
|
224
224
|
const listEndpoint = $Prop.endpoints?.list;
|
|
225
225
|
if (!listEndpoint) {
|
|
226
226
|
return;
|
|
@@ -290,7 +290,7 @@ const $Method = {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
},
|
|
293
|
-
async
|
|
293
|
+
reload: async function (options) {
|
|
294
294
|
if (options?.resetPage) {
|
|
295
295
|
$Data.pager.currentPage = 1;
|
|
296
296
|
}
|
|
@@ -299,16 +299,16 @@ const $Method = {
|
|
|
299
299
|
allowPageFallback: true
|
|
300
300
|
});
|
|
301
301
|
},
|
|
302
|
-
onPageChange(info) {
|
|
302
|
+
onPageChange: function (info) {
|
|
303
303
|
$Data.pager.currentPage = info.currentPage;
|
|
304
304
|
$Method.reload({ keepSelection: true });
|
|
305
305
|
},
|
|
306
|
-
onPageSizeChange(info) {
|
|
306
|
+
onPageSizeChange: function (info) {
|
|
307
307
|
$Data.pager.limit = info.pageSize;
|
|
308
308
|
$Data.pager.currentPage = 1;
|
|
309
309
|
$Method.reload({ keepSelection: false });
|
|
310
310
|
},
|
|
311
|
-
onActiveChange(value, context) {
|
|
311
|
+
onActiveChange: function (value, context) {
|
|
312
312
|
if (value.length === 0) {
|
|
313
313
|
if ($Data.activeRowKeys.length > 0) {
|
|
314
314
|
return;
|
|
@@ -337,7 +337,7 @@ const $Method = {
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
},
|
|
340
|
-
getDeleteConfirmContent(ep, row) {
|
|
340
|
+
getDeleteConfirmContent: function (ep, row) {
|
|
341
341
|
const confirm = ep.confirm;
|
|
342
342
|
if (!confirm) {
|
|
343
343
|
return {
|
|
@@ -353,7 +353,7 @@ const $Method = {
|
|
|
353
353
|
|
|
354
354
|
return confirm;
|
|
355
355
|
},
|
|
356
|
-
async
|
|
356
|
+
deleteRow: async function (row) {
|
|
357
357
|
const ep = $Prop.endpoints?.delete;
|
|
358
358
|
if (!ep) {
|
|
359
359
|
MessagePlugin.error("未配置删除接口");
|
|
@@ -425,7 +425,7 @@ const $Method = {
|
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
427
|
},
|
|
428
|
-
buildOperationSlotProps(scope) {
|
|
428
|
+
buildOperationSlotProps: function (scope) {
|
|
429
429
|
const out = {};
|
|
430
430
|
|
|
431
431
|
for (const key of Object.keys(scope)) {
|
package/layouts/default.vue
CHANGED
|
@@ -114,7 +114,7 @@ const router = useRouter();
|
|
|
114
114
|
const route = useRoute();
|
|
115
115
|
|
|
116
116
|
const $Const = {
|
|
117
|
-
createPasswordForm() {
|
|
117
|
+
createPasswordForm: function () {
|
|
118
118
|
return {
|
|
119
119
|
password: "",
|
|
120
120
|
confirmPassword: ""
|
|
@@ -152,10 +152,10 @@ const $Data = reactive({
|
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
const $Method = {
|
|
155
|
-
isString(value) {
|
|
155
|
+
isString: function (value) {
|
|
156
156
|
return typeof value === "string";
|
|
157
157
|
},
|
|
158
|
-
normalizePath(path) {
|
|
158
|
+
normalizePath: function (path) {
|
|
159
159
|
if (!$Method.isString(path)) {
|
|
160
160
|
return path;
|
|
161
161
|
}
|
|
@@ -163,7 +163,7 @@ const $Method = {
|
|
|
163
163
|
const normalized = path.replace(/\/+$/, "");
|
|
164
164
|
return normalized.length === 0 ? "/" : normalized;
|
|
165
165
|
},
|
|
166
|
-
normalizeParentPath(parentPath) {
|
|
166
|
+
normalizeParentPath: function (parentPath) {
|
|
167
167
|
if (!$Method.isString(parentPath)) {
|
|
168
168
|
return "";
|
|
169
169
|
}
|
|
@@ -175,14 +175,14 @@ const $Method = {
|
|
|
175
175
|
|
|
176
176
|
return normalized;
|
|
177
177
|
},
|
|
178
|
-
normalizeAvatarUrl(value) {
|
|
178
|
+
normalizeAvatarUrl: function (value) {
|
|
179
179
|
if (!$Method.isString(value) || value.length === 0) {
|
|
180
180
|
return "";
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
return value;
|
|
184
184
|
},
|
|
185
|
-
async
|
|
185
|
+
fetchUserInfo: async function () {
|
|
186
186
|
try {
|
|
187
187
|
const res = await $Http("/core/admin/detail", {}, [""]);
|
|
188
188
|
const userInfo = res?.data && typeof res.data === "object" ? res.data : {};
|
|
@@ -196,7 +196,7 @@ const $Method = {
|
|
|
196
196
|
MessagePlugin.error(error.msg || error.message || "获取管理员信息失败");
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
|
-
async
|
|
199
|
+
fetchUserMenus: async function () {
|
|
200
200
|
try {
|
|
201
201
|
const { data } = await $Http("/core/menu/all");
|
|
202
202
|
const lists = Array.isArray(data?.lists) ? data.lists : [];
|
|
@@ -216,7 +216,7 @@ const $Method = {
|
|
|
216
216
|
MessagePlugin.error(error.msg || error.message || "获取用户菜单失败");
|
|
217
217
|
}
|
|
218
218
|
},
|
|
219
|
-
setActiveMenu() {
|
|
219
|
+
setActiveMenu: function () {
|
|
220
220
|
const currentPath = route.path;
|
|
221
221
|
const normalizedCurrentPath = $Method.normalizePath(currentPath);
|
|
222
222
|
|
|
@@ -251,12 +251,12 @@ const $Method = {
|
|
|
251
251
|
$Data.expandedKeys = expandedKeys;
|
|
252
252
|
$Data.currentMenuKey = currentPath;
|
|
253
253
|
},
|
|
254
|
-
onMenuClick(path) {
|
|
254
|
+
onMenuClick: function (path) {
|
|
255
255
|
if ($Method.isString(path) && path.startsWith("/")) {
|
|
256
256
|
router.push(path);
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
|
-
async
|
|
259
|
+
handleLogout: async function () {
|
|
260
260
|
let dialog = null;
|
|
261
261
|
let destroyed = false;
|
|
262
262
|
|
|
@@ -296,11 +296,11 @@ const $Method = {
|
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
298
|
},
|
|
299
|
-
openPasswordDialog() {
|
|
299
|
+
openPasswordDialog: function () {
|
|
300
300
|
$Data.passwordForm = $Const.createPasswordForm();
|
|
301
301
|
$Data.passwordDialogVisible = true;
|
|
302
302
|
},
|
|
303
|
-
onUserDropdownAction(data) {
|
|
303
|
+
onUserDropdownAction: function (data) {
|
|
304
304
|
const record = data;
|
|
305
305
|
const rawValue = record && record["value"] ? record["value"] : "";
|
|
306
306
|
const cmd = rawValue ? String(rawValue) : "";
|
|
@@ -314,7 +314,7 @@ const $Method = {
|
|
|
314
314
|
$Method.handleLogout();
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
|
-
async
|
|
317
|
+
onPasswordSubmit: async function (context) {
|
|
318
318
|
const form = $From.passwordFormRef;
|
|
319
319
|
if (form === null) {
|
|
320
320
|
MessagePlugin.warning("表单未就绪");
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@ const $Prop = defineProps({
|
|
|
48
48
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
49
49
|
|
|
50
50
|
const $Const = {
|
|
51
|
-
createDefaultFormData() {
|
|
51
|
+
createDefaultFormData: function () {
|
|
52
52
|
return {
|
|
53
53
|
typeCode: "",
|
|
54
54
|
key: "",
|
|
@@ -81,10 +81,10 @@ const $Computed = reactive({
|
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
const $Method = {
|
|
84
|
-
resetFormData() {
|
|
84
|
+
resetFormData: function () {
|
|
85
85
|
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
86
86
|
},
|
|
87
|
-
initData() {
|
|
87
|
+
initData: function () {
|
|
88
88
|
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
89
89
|
$Data.formData.typeCode = $Prop.rowData.typeCode || "";
|
|
90
90
|
$Data.formData.key = $Prop.rowData.key || "";
|
|
@@ -96,7 +96,7 @@ const $Method = {
|
|
|
96
96
|
|
|
97
97
|
$Method.resetFormData();
|
|
98
98
|
},
|
|
99
|
-
async
|
|
99
|
+
handleSubmit: async function () {
|
|
100
100
|
try {
|
|
101
101
|
const form = $From.formRef;
|
|
102
102
|
if (!form) {
|
|
@@ -98,16 +98,16 @@ const $Data = reactive({
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
const $Method = {
|
|
101
|
-
onAdd() {
|
|
101
|
+
onAdd: function () {
|
|
102
102
|
$Method.onAction("add", {});
|
|
103
103
|
},
|
|
104
|
-
onDialogSuccess(reload) {
|
|
104
|
+
onDialogSuccess: function (reload) {
|
|
105
105
|
reload({ keepSelection: true });
|
|
106
106
|
},
|
|
107
|
-
async
|
|
107
|
+
initData: async function () {
|
|
108
108
|
await $Method.apiDictTypeAll();
|
|
109
109
|
},
|
|
110
|
-
async
|
|
110
|
+
apiDictTypeAll: async function () {
|
|
111
111
|
try {
|
|
112
112
|
const res = await $Http("/core/dictType/all", {}, [""]);
|
|
113
113
|
$Data.typeList = res.data.lists || [];
|
|
@@ -115,10 +115,10 @@ const $Method = {
|
|
|
115
115
|
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
handleSearch(reload) {
|
|
118
|
+
handleSearch: function (reload) {
|
|
119
119
|
reload({ keepSelection: false, resetPage: true });
|
|
120
120
|
},
|
|
121
|
-
onAction(type, row) {
|
|
121
|
+
onAction: function (type, row) {
|
|
122
122
|
if (type === "add") {
|
|
123
123
|
$Data.actionType = "add";
|
|
124
124
|
$Data.rowData = {};
|
|
@@ -132,7 +132,7 @@ const $Method = {
|
|
|
132
132
|
$Data.editVisible = true;
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
|
-
onDropdownAction(data, row, deleteRow) {
|
|
135
|
+
onDropdownAction: function (data, row, deleteRow) {
|
|
136
136
|
const record = data;
|
|
137
137
|
const rawValue = record && record["value"] ? record["value"] : "";
|
|
138
138
|
const cmd = rawValue ? String(rawValue) : "";
|
|
@@ -42,7 +42,7 @@ const $Prop = defineProps({
|
|
|
42
42
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
43
43
|
|
|
44
44
|
const $Const = {
|
|
45
|
-
createDefaultFormData() {
|
|
45
|
+
createDefaultFormData: function () {
|
|
46
46
|
return {
|
|
47
47
|
code: "",
|
|
48
48
|
name: "",
|
|
@@ -73,10 +73,10 @@ const $Computed = reactive({
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
const $Method = {
|
|
76
|
-
resetFormData() {
|
|
76
|
+
resetFormData: function () {
|
|
77
77
|
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
78
78
|
},
|
|
79
|
-
initData() {
|
|
79
|
+
initData: function () {
|
|
80
80
|
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
81
81
|
$Data.formData.code = $Prop.rowData.code || "";
|
|
82
82
|
$Data.formData.name = $Prop.rowData.name || "";
|
|
@@ -87,7 +87,7 @@ const $Method = {
|
|
|
87
87
|
|
|
88
88
|
$Method.resetFormData();
|
|
89
89
|
},
|
|
90
|
-
async
|
|
90
|
+
handleSubmit: async function () {
|
|
91
91
|
const form = $From.formRef;
|
|
92
92
|
if (!form) {
|
|
93
93
|
MessagePlugin.warning("表单未就绪");
|
|
@@ -91,16 +91,16 @@ const $Data = reactive({
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
const $Method = {
|
|
94
|
-
onAdd() {
|
|
94
|
+
onAdd: function () {
|
|
95
95
|
$Method.onAction("add", {});
|
|
96
96
|
},
|
|
97
|
-
onDialogSuccess(reload) {
|
|
97
|
+
onDialogSuccess: function (reload) {
|
|
98
98
|
reload({ keepSelection: true });
|
|
99
99
|
},
|
|
100
|
-
handleSearch(reload) {
|
|
100
|
+
handleSearch: function (reload) {
|
|
101
101
|
reload({ keepSelection: false, resetPage: true });
|
|
102
102
|
},
|
|
103
|
-
onAction(type, row) {
|
|
103
|
+
onAction: function (type, row) {
|
|
104
104
|
if (type === "add") {
|
|
105
105
|
$Data.actionType = "add";
|
|
106
106
|
$Data.rowData = {};
|
|
@@ -114,7 +114,7 @@ const $Method = {
|
|
|
114
114
|
$Data.editVisible = true;
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
onDropdownAction(data, row, deleteRow) {
|
|
117
|
+
onDropdownAction: function (data, row, deleteRow) {
|
|
118
118
|
const record = data;
|
|
119
119
|
const rawValue = record && record["value"] ? record["value"] : "";
|
|
120
120
|
const cmd = rawValue ? String(rawValue) : "";
|
|
@@ -75,7 +75,7 @@ const $Prop = defineProps({
|
|
|
75
75
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
76
76
|
|
|
77
77
|
const $Const = {
|
|
78
|
-
createDefaultFormData() {
|
|
78
|
+
createDefaultFormData: function () {
|
|
79
79
|
return {
|
|
80
80
|
id: 0,
|
|
81
81
|
name: "",
|
|
@@ -121,14 +121,14 @@ const $Computed = reactive({
|
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
const $Method = {
|
|
124
|
-
resetFormData() {
|
|
124
|
+
resetFormData: function () {
|
|
125
125
|
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
126
126
|
$Data.isSystem = false;
|
|
127
127
|
},
|
|
128
|
-
initData() {
|
|
128
|
+
initData: function () {
|
|
129
129
|
$Method.onShow();
|
|
130
130
|
},
|
|
131
|
-
onShow() {
|
|
131
|
+
onShow: function () {
|
|
132
132
|
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
133
133
|
const row = $Prop.rowData;
|
|
134
134
|
$Data.formData.id = row["id"] || 0;
|
|
@@ -146,7 +146,7 @@ const $Method = {
|
|
|
146
146
|
|
|
147
147
|
$Method.resetFormData();
|
|
148
148
|
},
|
|
149
|
-
async
|
|
149
|
+
onSubmit: async function (context) {
|
|
150
150
|
const form = $From.formRef;
|
|
151
151
|
if (!form) {
|
|
152
152
|
MessagePlugin.warning("表单未就绪");
|
|
@@ -126,16 +126,16 @@ const $Data = reactive({
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
const $Method = {
|
|
129
|
-
onAdd() {
|
|
129
|
+
onAdd: function () {
|
|
130
130
|
$Method.onAction("add", {});
|
|
131
131
|
},
|
|
132
|
-
handleFilter(reload) {
|
|
132
|
+
handleFilter: function (reload) {
|
|
133
133
|
reload({ keepSelection: false, resetPage: true });
|
|
134
134
|
},
|
|
135
|
-
onDialogSuccess(reload) {
|
|
135
|
+
onDialogSuccess: function (reload) {
|
|
136
136
|
reload({ keepSelection: true });
|
|
137
137
|
},
|
|
138
|
-
onAction(command, rowData) {
|
|
138
|
+
onAction: function (command, rowData) {
|
|
139
139
|
$Data.actionType = command;
|
|
140
140
|
if (command === "add") {
|
|
141
141
|
$Data.rowData = {};
|
|
@@ -147,7 +147,7 @@ const $Method = {
|
|
|
147
147
|
$Data.editVisible = true;
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
|
-
onDropdownAction(data, rowData, deleteRow) {
|
|
150
|
+
onDropdownAction: function (data, rowData, deleteRow) {
|
|
151
151
|
const record = data;
|
|
152
152
|
const rawValue = record && record["value"] ? record["value"] : "";
|
|
153
153
|
const cmd = rawValue ? String(rawValue) : "";
|
|
@@ -50,7 +50,7 @@ const $Const = {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const $Method = {
|
|
53
|
-
formatTime(timestamp) {
|
|
53
|
+
formatTime: function (timestamp) {
|
|
54
54
|
const date = new Date(timestamp);
|
|
55
55
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
56
56
|
const day = String(date.getDate()).padStart(2, "0");
|
|
@@ -40,7 +40,7 @@ const $Const = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const $Method = {
|
|
43
|
-
async
|
|
43
|
+
fetchData: async function () {
|
|
44
44
|
try {
|
|
45
45
|
const res = await $Http("/core/dashboard/serviceStatus", {}, [""]);
|
|
46
46
|
const nextServices = Array.isArray(res.data?.services) ? res.data.services.filter((service) => service?.name !== "OSS存储") : [];
|
|
@@ -49,7 +49,7 @@ const $Method = {
|
|
|
49
49
|
// 静默失败:不阻断页面展示
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
getStatusText(status) {
|
|
52
|
+
getStatusText: function (status) {
|
|
53
53
|
return $Const.statusTextMap[status] || status;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
@@ -235,7 +235,7 @@ const $Data = reactive({
|
|
|
235
235
|
});
|
|
236
236
|
|
|
237
237
|
const $Method = {
|
|
238
|
-
buildFallbackProduct() {
|
|
238
|
+
buildFallbackProduct: function () {
|
|
239
239
|
const days = $Method.sortTrendList($Data.realtimeStats.days, "reportDate");
|
|
240
240
|
|
|
241
241
|
return {
|
|
@@ -252,7 +252,7 @@ const $Method = {
|
|
|
252
252
|
totalUv: $Method.sumTrendField(days, "uv")
|
|
253
253
|
};
|
|
254
254
|
},
|
|
255
|
-
getReportDateNumber(timestamp) {
|
|
255
|
+
getReportDateNumber: function (timestamp) {
|
|
256
256
|
return Number(
|
|
257
257
|
new Intl.DateTimeFormat("en-CA", {
|
|
258
258
|
year: "numeric",
|
|
@@ -263,7 +263,7 @@ const $Method = {
|
|
|
263
263
|
.replace(/[^0-9]/g, "")
|
|
264
264
|
);
|
|
265
265
|
},
|
|
266
|
-
buildRecentReportDateList(limit) {
|
|
266
|
+
buildRecentReportDateList: function (limit) {
|
|
267
267
|
const list = [];
|
|
268
268
|
|
|
269
269
|
for (let i = limit - 1; i >= 0; i--) {
|
|
@@ -272,7 +272,7 @@ const $Method = {
|
|
|
272
272
|
|
|
273
273
|
return list;
|
|
274
274
|
},
|
|
275
|
-
buildFilledTrendDays(list, limit) {
|
|
275
|
+
buildFilledTrendDays: function (list, limit) {
|
|
276
276
|
const dateList = $Method.buildRecentReportDateList(limit);
|
|
277
277
|
const dataMap = new Map();
|
|
278
278
|
|
|
@@ -294,7 +294,7 @@ const $Method = {
|
|
|
294
294
|
);
|
|
295
295
|
});
|
|
296
296
|
},
|
|
297
|
-
sumTrendRange(list) {
|
|
297
|
+
sumTrendRange: function (list) {
|
|
298
298
|
let pv = 0;
|
|
299
299
|
let uv = 0;
|
|
300
300
|
|
|
@@ -308,7 +308,7 @@ const $Method = {
|
|
|
308
308
|
uv: uv
|
|
309
309
|
};
|
|
310
310
|
},
|
|
311
|
-
ensureSelectedProduct() {
|
|
311
|
+
ensureSelectedProduct: function () {
|
|
312
312
|
const list = $Computed.productOptions;
|
|
313
313
|
|
|
314
314
|
if (list.length === 0) {
|
|
@@ -323,10 +323,10 @@ const $Method = {
|
|
|
323
323
|
const currentProduct = list.find((item) => item.productName === $Data.productInfo.productName);
|
|
324
324
|
$Data.productState.selectedKey = currentProduct?.key || "all-products";
|
|
325
325
|
},
|
|
326
|
-
selectProduct(productKey) {
|
|
326
|
+
selectProduct: function (productKey) {
|
|
327
327
|
$Data.productState.selectedKey = String(productKey || "");
|
|
328
328
|
},
|
|
329
|
-
sumTrendField(list, field) {
|
|
329
|
+
sumTrendField: function (list, field) {
|
|
330
330
|
let total = 0;
|
|
331
331
|
|
|
332
332
|
for (const item of list) {
|
|
@@ -335,13 +335,13 @@ const $Method = {
|
|
|
335
335
|
|
|
336
336
|
return total;
|
|
337
337
|
},
|
|
338
|
-
sortTrendList(list, keyField) {
|
|
338
|
+
sortTrendList: function (list, keyField) {
|
|
339
339
|
const result = Array.isArray(list) ? list.slice() : [];
|
|
340
340
|
|
|
341
341
|
result.sort((a, b) => Number(a?.[keyField] || 0) - Number(b?.[keyField] || 0));
|
|
342
342
|
return result;
|
|
343
343
|
},
|
|
344
|
-
buildTrendPreview(list, maxCount) {
|
|
344
|
+
buildTrendPreview: function (list, maxCount) {
|
|
345
345
|
if (list.length <= maxCount) {
|
|
346
346
|
return list;
|
|
347
347
|
}
|
|
@@ -362,7 +362,7 @@ const $Method = {
|
|
|
362
362
|
|
|
363
363
|
return preview;
|
|
364
364
|
},
|
|
365
|
-
buildTrendBars(list, maxValue) {
|
|
365
|
+
buildTrendBars: function (list, maxValue) {
|
|
366
366
|
const result = [];
|
|
367
367
|
|
|
368
368
|
for (const item of list) {
|
|
@@ -380,7 +380,7 @@ const $Method = {
|
|
|
380
380
|
|
|
381
381
|
return result;
|
|
382
382
|
},
|
|
383
|
-
getTrendMax(list) {
|
|
383
|
+
getTrendMax: function (list) {
|
|
384
384
|
let max = 0;
|
|
385
385
|
|
|
386
386
|
for (const item of list) {
|
|
@@ -398,7 +398,7 @@ const $Method = {
|
|
|
398
398
|
|
|
399
399
|
return max > 0 ? max : 1;
|
|
400
400
|
},
|
|
401
|
-
formatDeviceType(deviceType) {
|
|
401
|
+
formatDeviceType: function (deviceType) {
|
|
402
402
|
if (deviceType === "desktop") {
|
|
403
403
|
return "桌面端";
|
|
404
404
|
}
|
|
@@ -425,7 +425,7 @@ const $Method = {
|
|
|
425
425
|
|
|
426
426
|
return String(deviceType || "Unknown");
|
|
427
427
|
},
|
|
428
|
-
formatReportDate(reportDate) {
|
|
428
|
+
formatReportDate: function (reportDate) {
|
|
429
429
|
const text = String(reportDate || "");
|
|
430
430
|
|
|
431
431
|
if (text.length !== 8) {
|
|
@@ -434,7 +434,7 @@ const $Method = {
|
|
|
434
434
|
|
|
435
435
|
return `${text.slice(4, 6)}-${text.slice(6, 8)}`;
|
|
436
436
|
},
|
|
437
|
-
async
|
|
437
|
+
fetchData: async function () {
|
|
438
438
|
try {
|
|
439
439
|
const [overviewRes, onlineStatsRes, infoStatsRes, errorStatsRes] = await Promise.all([$Http("/core/dashboard/systemOverview", {}, [""]), $Http("/core/tongJi/onlineStats", {}, [""]), $Http("/core/tongJi/infoStats", {}, [""]), $Http("/core/tongJi/errorStats", {}, [""])]);
|
|
440
440
|
|
|
@@ -52,7 +52,7 @@ const $Data = reactive({
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const $Method = {
|
|
55
|
-
async
|
|
55
|
+
fetchData: async function () {
|
|
56
56
|
try {
|
|
57
57
|
const res = await $Http("/core/admin/detail", {}, [""]);
|
|
58
58
|
Object.assign($Data.userInfo, res.data);
|
|
@@ -60,7 +60,7 @@ const $Method = {
|
|
|
60
60
|
MessagePlugin.error(error.msg || error.message || "获取用户信息失败");
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
|
-
async
|
|
63
|
+
handleRefreshCache: async function () {
|
|
64
64
|
try {
|
|
65
65
|
$Data.refreshing = true;
|
|
66
66
|
const result = await $Http("/core/admin/cacheRefresh");
|
|
@@ -87,7 +87,7 @@ const $Method = {
|
|
|
87
87
|
$Data.refreshing = false;
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
formatTime(timestamp) {
|
|
90
|
+
formatTime: function (timestamp) {
|
|
91
91
|
if (!timestamp) return "";
|
|
92
92
|
const date = new Date(Number(timestamp));
|
|
93
93
|
const now = new Date();
|
|
@@ -81,7 +81,7 @@ import { reactive } from "vue";
|
|
|
81
81
|
import { $Http } from "@/plugins/http.js";
|
|
82
82
|
|
|
83
83
|
const $Const = {
|
|
84
|
-
createSendForm() {
|
|
84
|
+
createSendForm: function () {
|
|
85
85
|
return {
|
|
86
86
|
to: "",
|
|
87
87
|
cc: "",
|
|
@@ -127,14 +127,14 @@ const $Data = reactive({
|
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
const $Method = {
|
|
130
|
-
onCancelSend() {
|
|
130
|
+
onCancelSend: function () {
|
|
131
131
|
$Data.sendDialogVisible = false;
|
|
132
132
|
},
|
|
133
|
-
openSendDialog() {
|
|
133
|
+
openSendDialog: function () {
|
|
134
134
|
$Data.sendForm = $Const.createSendForm();
|
|
135
135
|
$Data.sendDialogVisible = true;
|
|
136
136
|
},
|
|
137
|
-
async
|
|
137
|
+
onSend: async function (reload, context) {
|
|
138
138
|
const form = $From.sendFormRef;
|
|
139
139
|
if (!form) {
|
|
140
140
|
MessagePlugin.warning("表单未就绪");
|
|
@@ -169,7 +169,7 @@ const $Method = {
|
|
|
169
169
|
$Data.sending = false;
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
|
-
async
|
|
172
|
+
onVerify: async function () {
|
|
173
173
|
try {
|
|
174
174
|
await $Http("/core/email/verify");
|
|
175
175
|
MessagePlugin.success("邮件服务配置正常");
|
|
@@ -177,7 +177,7 @@ const $Method = {
|
|
|
177
177
|
MessagePlugin.error(error.msg || error.message || "验证失败");
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
|
-
formatTime(timestamp) {
|
|
180
|
+
formatTime: function (timestamp) {
|
|
181
181
|
if (!timestamp) return "-";
|
|
182
182
|
const date = new Date(timestamp);
|
|
183
183
|
const year = date.getFullYear();
|
|
@@ -170,13 +170,13 @@ const $Data = reactive({
|
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
const $Method = {
|
|
173
|
-
handleFilter(reload) {
|
|
173
|
+
handleFilter: function (reload) {
|
|
174
174
|
reload({ keepSelection: false, resetPage: true });
|
|
175
175
|
},
|
|
176
|
-
isDetailExpanded(id) {
|
|
176
|
+
isDetailExpanded: function (id) {
|
|
177
177
|
return Number($Data.detailExpandedId) === Number(id || 0);
|
|
178
178
|
},
|
|
179
|
-
toggleDetailExpand(id) {
|
|
179
|
+
toggleDetailExpand: function (id) {
|
|
180
180
|
const nextId = Number(id || 0);
|
|
181
181
|
|
|
182
182
|
if (Number($Data.detailExpandedId) === nextId) {
|
|
@@ -186,7 +186,7 @@ const $Method = {
|
|
|
186
186
|
|
|
187
187
|
$Data.detailExpandedId = nextId;
|
|
188
188
|
},
|
|
189
|
-
async
|
|
189
|
+
handleCopyDetail: async function (value) {
|
|
190
190
|
const text = $Method.formatDetail(value);
|
|
191
191
|
if (text === "-") {
|
|
192
192
|
MessagePlugin.warning("暂无可复制的错误详情");
|
|
@@ -200,7 +200,7 @@ const $Method = {
|
|
|
200
200
|
MessagePlugin.error("复制失败,请检查浏览器剪贴板权限");
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
|
-
getErrorTheme(errorType) {
|
|
203
|
+
getErrorTheme: function (errorType) {
|
|
204
204
|
if (errorType === "vue") {
|
|
205
205
|
return "danger";
|
|
206
206
|
}
|
|
@@ -215,7 +215,7 @@ const $Method = {
|
|
|
215
215
|
|
|
216
216
|
return "default";
|
|
217
217
|
},
|
|
218
|
-
formatErrorType(errorType) {
|
|
218
|
+
formatErrorType: function (errorType) {
|
|
219
219
|
if (errorType === "vue") {
|
|
220
220
|
return "Vue";
|
|
221
221
|
}
|
|
@@ -230,7 +230,7 @@ const $Method = {
|
|
|
230
230
|
|
|
231
231
|
return errorType || "Unknown";
|
|
232
232
|
},
|
|
233
|
-
formatDeviceType(deviceType) {
|
|
233
|
+
formatDeviceType: function (deviceType) {
|
|
234
234
|
if (deviceType === "desktop") {
|
|
235
235
|
return "桌面端";
|
|
236
236
|
}
|
|
@@ -249,7 +249,7 @@ const $Method = {
|
|
|
249
249
|
|
|
250
250
|
return deviceType || "Unknown";
|
|
251
251
|
},
|
|
252
|
-
formatTime(timestamp) {
|
|
252
|
+
formatTime: function (timestamp) {
|
|
253
253
|
const value = Number(timestamp || 0);
|
|
254
254
|
|
|
255
255
|
if (!value) {
|
|
@@ -270,7 +270,7 @@ const $Method = {
|
|
|
270
270
|
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
271
271
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
272
272
|
},
|
|
273
|
-
formatDetail(value) {
|
|
273
|
+
formatDetail: function (value) {
|
|
274
274
|
if (!value) {
|
|
275
275
|
return "-";
|
|
276
276
|
}
|
|
@@ -115,10 +115,10 @@ const $Data = reactive({
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
const $Method = {
|
|
118
|
-
handleFilter(reload) {
|
|
118
|
+
handleFilter: function (reload) {
|
|
119
119
|
reload({ keepSelection: false, resetPage: true });
|
|
120
120
|
},
|
|
121
|
-
formatTime(timestamp) {
|
|
121
|
+
formatTime: function (timestamp) {
|
|
122
122
|
if (!timestamp) return "-";
|
|
123
123
|
const date = new Date(timestamp);
|
|
124
124
|
const year = date.getFullYear();
|
|
@@ -129,7 +129,7 @@ const $Method = {
|
|
|
129
129
|
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
130
130
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
131
131
|
},
|
|
132
|
-
formatJson(value) {
|
|
132
|
+
formatJson: function (value) {
|
|
133
133
|
if (!value) return "-";
|
|
134
134
|
try {
|
|
135
135
|
const obj = typeof value === "string" ? JSON.parse(value) : value;
|
package/views/login_1/index.vue
CHANGED
|
@@ -64,7 +64,7 @@ const $Const = {
|
|
|
64
64
|
add: "添加管理员",
|
|
65
65
|
upd: "编辑管理员"
|
|
66
66
|
},
|
|
67
|
-
createDefaultFormData() {
|
|
67
|
+
createDefaultFormData: function () {
|
|
68
68
|
return {
|
|
69
69
|
id: null,
|
|
70
70
|
username: "",
|
|
@@ -115,10 +115,10 @@ const $Data = reactive({
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
const $Method = {
|
|
118
|
-
resetFormData() {
|
|
118
|
+
resetFormData: function () {
|
|
119
119
|
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
120
120
|
},
|
|
121
|
-
assignFormData(rowData) {
|
|
121
|
+
assignFormData: function (rowData) {
|
|
122
122
|
Object.assign($Data.formData, $Const.createDefaultFormData(), {
|
|
123
123
|
id: rowData.id ?? null,
|
|
124
124
|
username: rowData.username || "",
|
|
@@ -127,7 +127,7 @@ const $Method = {
|
|
|
127
127
|
state: typeof rowData.state === "number" ? rowData.state : 1
|
|
128
128
|
});
|
|
129
129
|
},
|
|
130
|
-
async
|
|
130
|
+
apiRoleLists: async function () {
|
|
131
131
|
try {
|
|
132
132
|
const result = await $Http("/core/role/all", {}, [""]);
|
|
133
133
|
const roleList = Array.isArray(result.data?.lists) ? result.data.lists : [];
|
|
@@ -141,10 +141,10 @@ const $Method = {
|
|
|
141
141
|
MessagePlugin.error(error.msg || error.message || "加载角色列表失败");
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
|
-
buildSubmitData() {
|
|
144
|
+
buildSubmitData: function () {
|
|
145
145
|
return $Computed.isAdd ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : fieldClear($Data.formData, { omitKeys: ["password"] });
|
|
146
146
|
},
|
|
147
|
-
async
|
|
147
|
+
initData: async function () {
|
|
148
148
|
await $Method.apiRoleLists();
|
|
149
149
|
if ($Computed.isUpdate && $Prop.rowData.id) {
|
|
150
150
|
$Method.assignFormData($Prop.rowData);
|
|
@@ -153,7 +153,7 @@ const $Method = {
|
|
|
153
153
|
|
|
154
154
|
$Method.resetFormData();
|
|
155
155
|
},
|
|
156
|
-
async
|
|
156
|
+
onSubmit: async function (context) {
|
|
157
157
|
try {
|
|
158
158
|
const form = $From.formRef;
|
|
159
159
|
if (!form) {
|
|
@@ -78,20 +78,20 @@ const $Data = reactive({
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
const $Method = {
|
|
81
|
-
onAdd() {
|
|
81
|
+
onAdd: function () {
|
|
82
82
|
$Method.onAction("add", {});
|
|
83
83
|
},
|
|
84
|
-
onDialogSuccess(reload) {
|
|
84
|
+
onDialogSuccess: function (reload) {
|
|
85
85
|
reload({ keepSelection: true });
|
|
86
86
|
},
|
|
87
|
-
onAction(command, rowData) {
|
|
87
|
+
onAction: function (command, rowData) {
|
|
88
88
|
$Data.actionType = command;
|
|
89
89
|
$Data.rowData = rowData;
|
|
90
90
|
if (command === "add" || command === "upd") {
|
|
91
91
|
$Data.editVisible = true;
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
-
onDropdownAction(data, rowData, deleteRow) {
|
|
94
|
+
onDropdownAction: function (data, rowData, deleteRow) {
|
|
95
95
|
const record = data;
|
|
96
96
|
const rawValue = record && record["value"] ? record["value"] : "";
|
|
97
97
|
const cmd = rawValue ? String(rawValue) : "";
|
|
@@ -78,10 +78,10 @@ const $Data = reactive({
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
const $Method = {
|
|
81
|
-
async
|
|
81
|
+
initData: async function () {
|
|
82
82
|
await $Method.loadApiAll();
|
|
83
83
|
},
|
|
84
|
-
async
|
|
84
|
+
loadApiAll: async function () {
|
|
85
85
|
$Data.loading = true;
|
|
86
86
|
try {
|
|
87
87
|
const res = await $Http("/core/api/all", {}, [""]);
|
|
@@ -102,7 +102,7 @@ const $Method = {
|
|
|
102
102
|
$Data.loading = false;
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
-
handleSearch() {
|
|
105
|
+
handleSearch: function () {
|
|
106
106
|
if (!$Data.searchKeyword) {
|
|
107
107
|
$Data.tableData = $Data.allData;
|
|
108
108
|
return;
|
|
@@ -110,7 +110,7 @@ const $Method = {
|
|
|
110
110
|
const keyword = String($Data.searchKeyword).toLowerCase();
|
|
111
111
|
$Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
|
|
112
112
|
},
|
|
113
|
-
onActiveChange(value, context) {
|
|
113
|
+
onActiveChange: function (value, context) {
|
|
114
114
|
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
@@ -53,10 +53,10 @@ const $Data = reactive({
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
const $Method = {
|
|
56
|
-
async
|
|
56
|
+
initData: async function () {
|
|
57
57
|
await $Method.apiMenuList();
|
|
58
58
|
},
|
|
59
|
-
async
|
|
59
|
+
apiMenuList: async function () {
|
|
60
60
|
$Data.loading = true;
|
|
61
61
|
try {
|
|
62
62
|
const res = await $Http("/core/menu/all", {}, [""]);
|
|
@@ -79,7 +79,7 @@ const $Method = {
|
|
|
79
79
|
$Data.loading = false;
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
onActiveChange(value, context) {
|
|
82
|
+
onActiveChange: function (value, context) {
|
|
83
83
|
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
@@ -70,7 +70,7 @@ const $Computed = reactive({
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
const $Method = {
|
|
73
|
-
async
|
|
73
|
+
initData: async function () {
|
|
74
74
|
await Promise.all([$Method.apiApiAll(), $Method.apiRoleApiDetail()]);
|
|
75
75
|
|
|
76
76
|
const merged = new Set();
|
|
@@ -99,7 +99,7 @@ const $Method = {
|
|
|
99
99
|
$Data.checkedApiPaths = Array.from(merged);
|
|
100
100
|
$Data.filteredApiData = $Data.apiData;
|
|
101
101
|
},
|
|
102
|
-
async
|
|
102
|
+
apiApiAll: async function () {
|
|
103
103
|
try {
|
|
104
104
|
const res = await $Http("/core/api/all", {}, [""]);
|
|
105
105
|
|
|
@@ -156,7 +156,7 @@ const $Method = {
|
|
|
156
156
|
MessagePlugin.error(error.msg || error.message || "加载接口失败");
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
|
-
async
|
|
159
|
+
apiRoleApiDetail: async function () {
|
|
160
160
|
if (!$Prop.rowData.id) return;
|
|
161
161
|
|
|
162
162
|
try {
|
|
@@ -175,7 +175,7 @@ const $Method = {
|
|
|
175
175
|
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
176
176
|
}
|
|
177
177
|
},
|
|
178
|
-
onSearch() {
|
|
178
|
+
onSearch: function () {
|
|
179
179
|
if (!$Data.searchText) {
|
|
180
180
|
$Data.filteredApiData = $Data.apiData;
|
|
181
181
|
return;
|
|
@@ -201,7 +201,7 @@ const $Method = {
|
|
|
201
201
|
})
|
|
202
202
|
.filter((group) => group.apis.length > 0);
|
|
203
203
|
},
|
|
204
|
-
async
|
|
204
|
+
onSubmit: async function (context) {
|
|
205
205
|
try {
|
|
206
206
|
$Data.submitting = true;
|
|
207
207
|
|
|
@@ -70,7 +70,7 @@ const $Prop = defineProps({
|
|
|
70
70
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
71
71
|
|
|
72
72
|
const $Const = {
|
|
73
|
-
createDefaultFormData() {
|
|
73
|
+
createDefaultFormData: function () {
|
|
74
74
|
return {
|
|
75
75
|
id: 0,
|
|
76
76
|
name: "",
|
|
@@ -110,10 +110,10 @@ const $Computed = reactive({
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
const $Method = {
|
|
113
|
-
resetFormData() {
|
|
113
|
+
resetFormData: function () {
|
|
114
114
|
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
115
115
|
},
|
|
116
|
-
initData() {
|
|
116
|
+
initData: function () {
|
|
117
117
|
if ($Prop.actionType === "upd" && $Prop.rowData.id) {
|
|
118
118
|
Object.assign($Data.formData, $Const.createDefaultFormData(), $Prop.rowData);
|
|
119
119
|
return;
|
|
@@ -121,7 +121,7 @@ const $Method = {
|
|
|
121
121
|
|
|
122
122
|
$Method.resetFormData();
|
|
123
123
|
},
|
|
124
|
-
async
|
|
124
|
+
onSubmit: async function (context) {
|
|
125
125
|
try {
|
|
126
126
|
const form = $From.formRef;
|
|
127
127
|
if (!form) {
|
|
@@ -72,11 +72,11 @@ const $Computed = reactive({
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
const $Method = {
|
|
75
|
-
async
|
|
75
|
+
initData: async function () {
|
|
76
76
|
await Promise.all([$Method.apiMenuAll(), $Method.apiRoleMenuDetail()]);
|
|
77
77
|
$Data.filteredMenuGroups = $Data.menuGroups;
|
|
78
78
|
},
|
|
79
|
-
async
|
|
79
|
+
apiMenuAll: async function () {
|
|
80
80
|
try {
|
|
81
81
|
const res = await $Http("/core/menu/all", {}, [""]);
|
|
82
82
|
const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
|
|
@@ -126,7 +126,7 @@ const $Method = {
|
|
|
126
126
|
MessagePlugin.error(error.msg || error.message || "加载菜单失败");
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
|
-
async
|
|
129
|
+
apiRoleMenuDetail: async function () {
|
|
130
130
|
if (!$Prop.rowData.id) return;
|
|
131
131
|
|
|
132
132
|
try {
|
|
@@ -143,7 +143,7 @@ const $Method = {
|
|
|
143
143
|
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
onSearch() {
|
|
146
|
+
onSearch: function () {
|
|
147
147
|
const kw = typeof $Data.searchText === "string" ? $Data.searchText.trim().toLowerCase() : "";
|
|
148
148
|
if (kw.length === 0) {
|
|
149
149
|
$Data.filteredMenuGroups = $Data.menuGroups;
|
|
@@ -168,7 +168,7 @@ const $Method = {
|
|
|
168
168
|
})
|
|
169
169
|
.filter((group) => group.menus.length > 0);
|
|
170
170
|
},
|
|
171
|
-
async
|
|
171
|
+
onSubmit: async function (context) {
|
|
172
172
|
try {
|
|
173
173
|
$Data.submitting = true;
|
|
174
174
|
|
|
@@ -111,17 +111,17 @@ const $Data = reactive({
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
const $Method = {
|
|
114
|
-
onAdd() {
|
|
114
|
+
onAdd: function () {
|
|
115
115
|
$Method.onAction("add", {});
|
|
116
116
|
},
|
|
117
|
-
onDialogSuccess(reload) {
|
|
117
|
+
onDialogSuccess: function (reload) {
|
|
118
118
|
reload({ keepSelection: true });
|
|
119
119
|
},
|
|
120
|
-
getPathCount(value) {
|
|
120
|
+
getPathCount: function (value) {
|
|
121
121
|
if (!Array.isArray(value)) return 0;
|
|
122
122
|
return value.filter((path) => typeof path === "string" && path.trim().length > 0).length;
|
|
123
123
|
},
|
|
124
|
-
onAction(command, rowData) {
|
|
124
|
+
onAction: function (command, rowData) {
|
|
125
125
|
$Data.actionType = command;
|
|
126
126
|
|
|
127
127
|
if (command === "add") {
|
|
@@ -144,7 +144,7 @@ const $Method = {
|
|
|
144
144
|
$Data.apiVisible = true;
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
|
-
onDropdownAction(data, rowData, deleteRow) {
|
|
147
|
+
onDropdownAction: function (data, rowData, deleteRow) {
|
|
148
148
|
const record = data;
|
|
149
149
|
const rawValue = record && record["value"] ? record["value"] : "";
|
|
150
150
|
const cmd = rawValue ? String(rawValue) : "";
|
|
@@ -93,10 +93,10 @@ const $Const = {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
const $Method = {
|
|
96
|
-
handleSearch(reload) {
|
|
96
|
+
handleSearch: function (reload) {
|
|
97
97
|
reload({ keepSelection: false, resetPage: true });
|
|
98
98
|
},
|
|
99
|
-
async
|
|
99
|
+
copyUrl: async function (url) {
|
|
100
100
|
try {
|
|
101
101
|
await navigator.clipboard.writeText(url);
|
|
102
102
|
MessagePlugin.success("图片链接已复制");
|
|
@@ -104,7 +104,7 @@ const $Method = {
|
|
|
104
104
|
MessagePlugin.error(error?.message || "复制失败");
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
-
formatFileSize(fileSize) {
|
|
107
|
+
formatFileSize: function (fileSize) {
|
|
108
108
|
if (!Number.isFinite(fileSize) || fileSize <= 0) {
|
|
109
109
|
return "0 B";
|
|
110
110
|
}
|
|
@@ -119,14 +119,14 @@ const $Method = {
|
|
|
119
119
|
|
|
120
120
|
return `${(fileSize / 1024 / 1024).toFixed(1)} MB`;
|
|
121
121
|
},
|
|
122
|
-
formatFileExt(fileExt) {
|
|
122
|
+
formatFileExt: function (fileExt) {
|
|
123
123
|
if (typeof fileExt !== "string" || fileExt.length === 0) {
|
|
124
124
|
return "未知格式";
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
return fileExt.replace(/^\./, "").toUpperCase();
|
|
128
128
|
},
|
|
129
|
-
formatDateTime(value) {
|
|
129
|
+
formatDateTime: function (value) {
|
|
130
130
|
if (!value) {
|
|
131
131
|
return "-";
|
|
132
132
|
}
|
|
@@ -144,7 +144,7 @@ const $Method = {
|
|
|
144
144
|
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
145
145
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
146
146
|
},
|
|
147
|
-
onUploadSuccess(res, reload) {
|
|
147
|
+
onUploadSuccess: function (res, reload) {
|
|
148
148
|
if (res.response?.code !== 0 || res.response?.data?.isImage !== 1) {
|
|
149
149
|
MessagePlugin.error(res.response?.msg || "上传失败");
|
|
150
150
|
return;
|