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
@@ -20,7 +20,18 @@
20
20
  <h2 class="login-title">欢迎回来</h2>
21
21
  </div>
22
22
 
23
- <TForm :model="$Data.formData" :rules="$Data.formRules" ref="formRef" class="login-form" :show-message="false" label-width="0">
23
+ <TForm
24
+ :model="$Data.formData"
25
+ :rules="$Const.formRules"
26
+ :ref="
27
+ (value) => {
28
+ $From.formRef = value;
29
+ }
30
+ "
31
+ class="login-form"
32
+ :show-message="false"
33
+ label-width="0"
34
+ >
24
35
  <TFormItem prop="account">
25
36
  <TInputAdornment>
26
37
  <template #prepend>
@@ -30,7 +41,7 @@
30
41
  <TOption value="phone" label="手机号" />
31
42
  </TSelect>
32
43
  </template>
33
- <TInput v-model="$Data.formData.account" :placeholder="$Data.formData.loginType === 'username' ? '请输入用户名' : $Data.formData.loginType === 'email' ? '请输入邮箱' : '请输入手机号'" size="large" clearable @enter="apiLogin">
44
+ <TInput v-model="$Data.formData.account" :placeholder="$Data.formData.loginType === 'username' ? '请输入用户名' : $Data.formData.loginType === 'email' ? '请输入邮箱' : '请输入手机号'" size="large" clearable @enter="$Method.apiLogin">
34
45
  <template #prefix-icon>
35
46
  <UserIcon />
36
47
  </template>
@@ -39,7 +50,7 @@
39
50
  </TFormItem>
40
51
 
41
52
  <TFormItem prop="password">
42
- <TInput v-model="$Data.formData.password" type="password" placeholder="密码" size="large" clearable @enter="apiLogin">
53
+ <TInput v-model="$Data.formData.password" type="password" placeholder="密码" size="large" clearable @enter="$Method.apiLogin">
43
54
  <template #prefix-icon>
44
55
  <LockOnIcon />
45
56
  </template>
@@ -51,7 +62,7 @@
51
62
  <a href="#" class="link-text">忘记密码?</a>
52
63
  </div>
53
64
 
54
- <TButton theme="primary" class="login-btn" size="large" block :loading="$Data.loading" @click="apiLogin">登录</TButton>
65
+ <TButton theme="primary" class="login-btn" size="large" block :loading="$Data.loading" @click="$Method.apiLogin">登录</TButton>
55
66
  </TForm>
56
67
 
57
68
  <div class="login-footer">
@@ -63,7 +74,7 @@
63
74
  </template>
64
75
 
65
76
  <script setup>
66
- import { reactive, ref } from "vue";
77
+ import { reactive } from "vue";
67
78
  import { useRouter } from "vue-router";
68
79
  import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, Checkbox as TCheckbox, InputAdornment as TInputAdornment, Select as TSelect, Option as TOption, MessagePlugin } from "tdesign-vue-next";
69
80
  import { LockOnIcon, UserIcon } from "tdesign-icons-vue-next";
@@ -74,16 +85,21 @@ import { $Store } from "@/plugins/store.js";
74
85
 
75
86
  const router = useRouter();
76
87
 
77
- const formRef = ref(null);
88
+ const $Const = {
89
+ formRules: {
90
+ account: [{ required: true, message: "请输入账号", trigger: "blur" }],
91
+ password: [{ required: true, message: "请输入密码", trigger: "blur" }]
92
+ }
93
+ };
94
+
95
+ const $From = {
96
+ formRef: null
97
+ };
78
98
 
79
99
  // 数据定义
80
100
  const $Data = reactive({
81
101
  loading: false,
82
102
  rememberMe: false,
83
- formRules: {
84
- account: [{ required: true, message: "请输入账号", trigger: "blur" }],
85
- password: [{ required: true, message: "请输入密码", trigger: "blur" }]
86
- },
87
103
  formData: {
88
104
  loginType: "username",
89
105
  account: "",
@@ -91,36 +107,38 @@ const $Data = reactive({
91
107
  }
92
108
  });
93
109
 
94
- async function apiLogin() {
95
- try {
96
- if (formRef.value === null) {
97
- MessagePlugin.error("表单未就绪");
98
- return;
99
- }
110
+ const $Method = {
111
+ async apiLogin() {
112
+ try {
113
+ if ($From.formRef === null) {
114
+ MessagePlugin.error("表单未就绪");
115
+ return;
116
+ }
100
117
 
101
- await formRef.value.validate();
118
+ await $From.formRef.validate();
102
119
 
103
- $Data.loading = true;
120
+ $Data.loading = true;
104
121
 
105
- const hashedPassword = await hashPassword($Data.formData.password);
122
+ const hashedPassword = await hashPassword($Data.formData.password);
106
123
 
107
- const res = await $Http("/core/auth/login", {
108
- loginType: $Data.formData.loginType,
109
- account: $Data.formData.account,
110
- password: hashedPassword
111
- });
124
+ const res = await $Http("/core/auth/login", {
125
+ loginType: $Data.formData.loginType,
126
+ account: $Data.formData.account,
127
+ password: hashedPassword
128
+ });
112
129
 
113
- $Store.local.set($Config.tokenName, res.data.token);
130
+ $Store.local.set($Config.tokenName, res.data.token);
114
131
 
115
- MessagePlugin.success(res.msg || "登录成功");
132
+ MessagePlugin.success(res.msg || "登录成功");
116
133
 
117
- await router.push($Config.homePath);
118
- } catch (error) {
119
- MessagePlugin.error(error.msg || error.message || "登录失败");
120
- } finally {
121
- $Data.loading = false;
134
+ await router.push($Config.homePath);
135
+ } catch (error) {
136
+ MessagePlugin.error(error.msg || error.message || "登录失败");
137
+ } finally {
138
+ $Data.loading = false;
139
+ }
122
140
  }
123
- }
141
+ };
124
142
  </script>
125
143
 
126
144
  <style scoped lang="scss">
@@ -38,7 +38,7 @@ import {
38
38
  MessagePlugin
39
39
  } from "tdesign-vue-next";
40
40
  import PageDialog from "befly-admin-ui/components/pageDialog.vue";
41
- import { $Http } from "@/plugins/http";
41
+ import { $Http } from "@/plugins/http.js";
42
42
  import { fieldClear } from "befly-admin-ui/utils/fieldClear";
43
43
  import { hashPassword } from "befly-admin-ui/utils/hashPassword";
44
44
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <PageTableDetail class="page-admin" :columns="$Data.columns" :endpoints="$Data.endpoints">
3
3
  <template #toolLeft>
4
- <TButton theme="primary" @click="onAdd">
4
+ <TButton theme="primary" @click="$Method.onAdd">
5
5
  <template #icon>
6
6
  <AddIcon />
7
7
  </template>
@@ -15,7 +15,7 @@
15
15
  </template>
16
16
 
17
17
  <template #operation="{ row, deleteRow }">
18
- <TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
18
+ <TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
19
19
  <TButton theme="primary" size="small">
20
20
  操作
21
21
  <template #suffix><ChevronDownIcon /></template>
@@ -34,7 +34,7 @@
34
34
  </template>
35
35
 
36
36
  <template #dialogs="scope">
37
- <EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
37
+ <EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
38
38
  </template>
39
39
  </PageTableDetail>
40
40
  </template>
@@ -58,7 +58,7 @@ const $Data = reactive({
58
58
  ]),
59
59
  endpoints: {
60
60
  list: {
61
- path: "/core/admin/list",
61
+ path: "/core/admin/select",
62
62
  dropValues: [""]
63
63
  },
64
64
  delete: {
@@ -76,32 +76,31 @@ const $Data = reactive({
76
76
  rowData: {}
77
77
  });
78
78
 
79
- function onAdd() {
80
- onAction("add", {});
81
- }
82
-
83
- function onDialogSuccess(reload) {
84
- reload({ keepSelection: true });
85
- }
86
-
87
- function onAction(command, rowData) {
88
- $Data.actionType = command;
89
- $Data.rowData = rowData;
90
- if (command === "add" || command === "upd") {
91
- $Data.editVisible = true;
92
- }
93
- }
94
-
95
- function onDropdownAction(data, rowData, deleteRow) {
96
- const record = data;
97
- const rawValue = record && record["value"] ? record["value"] : "";
98
- const cmd = rawValue ? String(rawValue) : "";
99
- if (cmd === "del") {
100
- deleteRow(rowData);
101
- return;
79
+ const $Method = {
80
+ onAdd() {
81
+ $Method.onAction("add", {});
82
+ },
83
+ onDialogSuccess(reload) {
84
+ reload({ keepSelection: true });
85
+ },
86
+ onAction(command, rowData) {
87
+ $Data.actionType = command;
88
+ $Data.rowData = rowData;
89
+ if (command === "add" || command === "upd") {
90
+ $Data.editVisible = true;
91
+ }
92
+ },
93
+ onDropdownAction(data, rowData, deleteRow) {
94
+ const record = data;
95
+ const rawValue = record && record["value"] ? record["value"] : "";
96
+ const cmd = rawValue ? String(rawValue) : "";
97
+ if (cmd === "del") {
98
+ deleteRow(rowData);
99
+ return;
100
+ }
101
+ $Method.onAction(cmd, rowData);
102
102
  }
103
- onAction(cmd, rowData);
104
- }
103
+ };
105
104
  </script>
106
105
 
107
106
  <style scoped lang="scss">
@@ -2,25 +2,18 @@
2
2
  <div class="page-api page-table">
3
3
  <div class="main-tool">
4
4
  <div class="left">
5
- <TInput v-model="$Data.searchKeyword" placeholder="搜索接口名称或路径" clearable style="width: 300px" @enter="handleSearch" @clear="handleSearch">
5
+ <TInput v-model="$Data.searchKeyword" placeholder="搜索接口名称或路径" clearable style="width: 300px" @enter="$Method.handleSearch" @clear="$Method.handleSearch">
6
6
  <template #suffix-icon>
7
7
  <SearchIcon />
8
8
  </template>
9
9
  </TInput>
10
10
  <span style="margin-left: 16px; color: var(--text-secondary); font-size: 13px">共 {{ $Data.allData.length }} 个接口</span>
11
11
  </div>
12
- <div class="right">
13
- <TButton shape="circle" @click="handleRefresh">
14
- <template #icon>
15
- <RefreshIcon />
16
- </template>
17
- </TButton>
18
- </div>
19
12
  </div>
20
13
 
21
14
  <div class="main-content">
22
15
  <div class="main-table">
23
- <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(--layout-gap) * 2)" active-row-type="single" @active-change="onActiveChange">
16
+ <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(--layout-gap) * 2)" active-row-type="single" @active-change="$Method.onActiveChange">
24
17
  <template #method="{ row }">
25
18
  <TTag v-if="row.method === 'GET'" shape="round" theme="success" variant="light-outline">GET</TTag>
26
19
  <TTag v-else-if="row.method === 'POST'" shape="round" theme="primary" variant="light-outline">POST</TTag>
@@ -60,10 +53,10 @@
60
53
 
61
54
  <script setup>
62
55
  import { reactive } from "vue";
63
- import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
64
- import { RefreshIcon, SearchIcon } from "tdesign-icons-vue-next";
56
+ import { Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
57
+ import { SearchIcon } from "tdesign-icons-vue-next";
65
58
  import DetailPanel from "befly-admin-ui/components/detailPanel.vue";
66
- import { $Http } from "@/plugins/http";
59
+ import { $Http } from "@/plugins/http.js";
67
60
  import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
68
61
 
69
62
  // 响应式数据
@@ -83,56 +76,51 @@ const $Data = reactive({
83
76
  activeRowKeys: []
84
77
  });
85
78
 
86
- async function initData() {
87
- await loadApiAll();
88
- }
89
-
90
- async function loadApiAll() {
91
- $Data.loading = true;
92
- try {
93
- const res = await $Http("/core/api/all", {}, [""]);
94
- const list = res.data?.lists || [];
95
- $Data.allData = list;
96
- $Data.tableData = list;
79
+ const $Method = {
80
+ async initData() {
81
+ await $Method.loadApiAll();
82
+ },
83
+ async loadApiAll() {
84
+ $Data.loading = true;
85
+ try {
86
+ const res = await $Http("/core/api/all", {}, [""]);
87
+ const list = res.data?.lists || [];
88
+ $Data.allData = list;
89
+ $Data.tableData = list;
97
90
 
98
- if ($Data.tableData.length > 0) {
99
- $Data.currentRow = $Data.tableData[0];
100
- $Data.activeRowKeys = [$Data.tableData[0].id];
101
- } else {
102
- $Data.currentRow = null;
103
- $Data.activeRowKeys = [];
91
+ if ($Data.tableData.length > 0) {
92
+ $Data.currentRow = $Data.tableData[0];
93
+ $Data.activeRowKeys = [$Data.tableData[0].id];
94
+ } else {
95
+ $Data.currentRow = null;
96
+ $Data.activeRowKeys = [];
97
+ }
98
+ } catch (error) {
99
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
100
+ } finally {
101
+ $Data.loading = false;
102
+ }
103
+ },
104
+ handleSearch() {
105
+ if (!$Data.searchKeyword) {
106
+ $Data.tableData = $Data.allData;
107
+ return;
108
+ }
109
+ const keyword = String($Data.searchKeyword).toLowerCase();
110
+ $Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
111
+ },
112
+ onActiveChange(value, context) {
113
+ if (value.length === 0 && $Data.activeRowKeys.length > 0) {
114
+ return;
115
+ }
116
+ $Data.activeRowKeys = value;
117
+ if (context.activeRowList && context.activeRowList.length > 0) {
118
+ $Data.currentRow = context.activeRowList[0].row;
104
119
  }
105
- } catch (error) {
106
- MessagePlugin.error(error.msg || error.message || "加载数据失败");
107
- } finally {
108
- $Data.loading = false;
109
- }
110
- }
111
-
112
- function handleRefresh() {
113
- loadApiAll();
114
- }
115
-
116
- function handleSearch() {
117
- if (!$Data.searchKeyword) {
118
- $Data.tableData = $Data.allData;
119
- return;
120
- }
121
- const keyword = String($Data.searchKeyword).toLowerCase();
122
- $Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
123
- }
124
-
125
- function onActiveChange(value, context) {
126
- if (value.length === 0 && $Data.activeRowKeys.length > 0) {
127
- return;
128
- }
129
- $Data.activeRowKeys = value;
130
- if (context.activeRowList && context.activeRowList.length > 0) {
131
- $Data.currentRow = context.activeRowList[0].row;
132
120
  }
133
- }
121
+ };
134
122
 
135
- initData();
123
+ $Method.initData();
136
124
  </script>
137
125
 
138
126
  <style scoped lang="scss">
@@ -1,19 +1,18 @@
1
1
  <template>
2
2
  <div class="page-menu page-table">
3
- <div class="main-tool">
4
- <div class="left"></div>
5
- <div class="right">
6
- <TButton shape="circle" @click="handleRefresh">
7
- <template #icon>
8
- <RefreshIcon />
9
- </template>
10
- </TButton>
11
- </div>
12
- </div>
13
-
14
3
  <div class="main-content">
15
4
  <div class="main-table">
16
- <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(--layout-gap) * 2)" active-row-type="single" :tree="{ childrenKey: 'children', treeNodeColumnIndex: 0, defaultExpandAll: true }" @active-change="onActiveChange">
5
+ <TTable
6
+ :data="$Data.tableData"
7
+ :columns="$Data.columns"
8
+ :loading="$Data.loading"
9
+ :active-row-keys="$Data.activeRowKeys"
10
+ row-key="id"
11
+ height="calc(100vh - var(--layout-gap) * 2)"
12
+ active-row-type="single"
13
+ :tree="{ childrenKey: 'children', treeNodeColumnIndex: 0, defaultExpandAll: true }"
14
+ @active-change="$Method.onActiveChange"
15
+ >
17
16
  <template #state="{ row }">
18
17
  <TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
19
18
  <TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
@@ -31,10 +30,9 @@
31
30
 
32
31
  <script setup>
33
32
  import { reactive } from "vue";
34
- import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
35
- import { RefreshIcon } from "tdesign-icons-vue-next";
33
+ import { Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
36
34
  import DetailPanel from "befly-admin-ui/components/detailPanel.vue";
37
- import { $Http } from "@/plugins/http";
35
+ import { $Http } from "@/plugins/http.js";
38
36
  import { arrayToTree } from "befly-admin-ui/utils/arrayToTree";
39
37
  import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
40
38
 
@@ -53,49 +51,45 @@ const $Data = reactive({
53
51
  activeRowKeys: []
54
52
  });
55
53
 
56
- async function initData() {
57
- await apiMenuList();
58
- }
59
-
60
- async function apiMenuList() {
61
- $Data.loading = true;
62
- try {
63
- const res = await $Http("/core/menu/all", {}, [""]);
64
- const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
54
+ const $Method = {
55
+ async initData() {
56
+ await $Method.apiMenuList();
57
+ },
58
+ async apiMenuList() {
59
+ $Data.loading = true;
60
+ try {
61
+ const res = await $Http("/core/menu/all", {}, [""]);
62
+ const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
65
63
 
66
- const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
64
+ const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
67
65
 
68
- $Data.tableData = treeResult.tree;
66
+ $Data.tableData = treeResult.tree;
69
67
 
70
- if ($Data.tableData.length > 0) {
71
- $Data.currentRow = $Data.tableData[0];
72
- $Data.activeRowKeys = [$Data.tableData[0].id];
73
- } else {
74
- $Data.currentRow = null;
75
- $Data.activeRowKeys = [];
68
+ if ($Data.tableData.length > 0) {
69
+ $Data.currentRow = $Data.tableData[0];
70
+ $Data.activeRowKeys = [$Data.tableData[0].id];
71
+ } else {
72
+ $Data.currentRow = null;
73
+ $Data.activeRowKeys = [];
74
+ }
75
+ } catch (error) {
76
+ MessagePlugin.error(error.msg || error.message || "加载数据失败");
77
+ } finally {
78
+ $Data.loading = false;
79
+ }
80
+ },
81
+ onActiveChange(value, context) {
82
+ if (value.length === 0 && $Data.activeRowKeys.length > 0) {
83
+ return;
84
+ }
85
+ $Data.activeRowKeys = value;
86
+ if (context.activeRowList && context.activeRowList.length > 0) {
87
+ $Data.currentRow = context.activeRowList[0].row;
76
88
  }
77
- } catch (error) {
78
- MessagePlugin.error(error.msg || error.message || "加载数据失败");
79
- } finally {
80
- $Data.loading = false;
81
- }
82
- }
83
-
84
- function handleRefresh() {
85
- apiMenuList();
86
- }
87
-
88
- function onActiveChange(value, context) {
89
- if (value.length === 0 && $Data.activeRowKeys.length > 0) {
90
- return;
91
- }
92
- $Data.activeRowKeys = value;
93
- if (context.activeRowList && context.activeRowList.length > 0) {
94
- $Data.currentRow = context.activeRowList[0].row;
95
89
  }
96
- }
90
+ };
97
91
 
98
- initData();
92
+ $Method.initData();
99
93
  </script>
100
94
 
101
95
  <style scoped lang="scss">