@befly-addon/admin 1.1.30 → 1.1.32
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/apis/admin/cacheRefresh.ts +29 -21
- package/apis/admin/del.ts +10 -10
- package/apis/admin/detail.ts +7 -7
- package/apis/admin/ins.ts +11 -11
- package/apis/admin/list.ts +10 -10
- package/apis/admin/upd.ts +14 -14
- package/apis/api/all.ts +8 -8
- package/apis/api/list.ts +10 -10
- package/apis/auth/login.ts +43 -43
- package/apis/auth/sendSmsCode.ts +6 -6
- package/apis/dashboard/configStatus.ts +18 -18
- package/apis/dashboard/environmentInfo.ts +12 -12
- package/apis/dashboard/performanceMetrics.ts +5 -5
- package/apis/dashboard/permissionStats.ts +7 -7
- package/apis/dashboard/serviceStatus.ts +29 -29
- package/apis/dashboard/systemInfo.ts +5 -5
- package/apis/dashboard/systemOverview.ts +7 -7
- package/apis/dashboard/systemResources.ts +8 -8
- package/apis/dict/all.ts +16 -16
- package/apis/dict/del.ts +6 -6
- package/apis/dict/detail.ts +19 -19
- package/apis/dict/ins.ts +9 -9
- package/apis/dict/items.ts +8 -8
- package/apis/dict/list.ts +22 -22
- package/apis/dict/upd.ts +11 -11
- package/apis/dictType/all.ts +5 -5
- package/apis/dictType/del.ts +8 -8
- package/apis/dictType/detail.ts +6 -6
- package/apis/dictType/ins.ts +7 -7
- package/apis/dictType/list.ts +8 -10
- package/apis/dictType/upd.ts +8 -8
- package/apis/email/config.ts +4 -4
- package/apis/email/logList.ts +8 -8
- package/apis/email/send.ts +18 -18
- package/apis/email/verify.ts +5 -5
- package/apis/loginLog/list.ts +8 -8
- package/apis/menu/all.ts +16 -18
- package/apis/menu/list.ts +12 -12
- package/apis/operateLog/list.ts +8 -8
- package/apis/role/all.ts +7 -7
- package/apis/role/apiSave.ts +10 -13
- package/apis/role/apis.ts +7 -12
- package/apis/role/del.ts +14 -14
- package/apis/role/detail.ts +6 -6
- package/apis/role/ins.ts +10 -10
- package/apis/role/list.ts +11 -11
- package/apis/role/menuSave.ts +8 -11
- package/apis/role/menus.ts +7 -12
- package/apis/role/save.ts +12 -12
- package/apis/role/upd.ts +10 -10
- package/apis/sysConfig/all.ts +5 -5
- package/apis/sysConfig/del.ts +9 -9
- package/apis/sysConfig/get.ts +9 -9
- package/apis/sysConfig/ins.ts +11 -11
- package/apis/sysConfig/list.ts +9 -9
- package/apis/sysConfig/upd.ts +10 -10
- package/libs/emailHelper.ts +7 -7
- package/package.json +46 -34
- package/plugins/email.ts +9 -9
- package/tables/role.json +4 -2
- package/views/403_1/index.vue +19 -3
- package/views/config/dict/components/edit.vue +26 -28
- package/views/config/dict/index.vue +88 -52
- package/views/config/dictType/components/edit.vue +22 -23
- package/views/config/dictType/index.vue +82 -46
- package/views/config/index.vue +12 -0
- package/views/config/system/components/edit.vue +36 -36
- package/views/config/system/index.vue +79 -50
- package/views/index/components/addonList.vue +3 -3
- package/views/index/components/environmentInfo.vue +10 -10
- package/views/index/components/operationLogs.vue +10 -10
- package/views/index/components/performanceMetrics.vue +8 -8
- package/views/index/components/quickActions.vue +3 -3
- package/views/index/components/serviceStatus.vue +19 -19
- package/views/index/components/systemNotifications.vue +12 -12
- package/views/index/components/systemOverview.vue +7 -7
- package/views/index/components/systemResources.vue +11 -11
- package/views/index/components/userInfo.vue +20 -19
- package/views/index/index.vue +12 -5
- package/views/log/email/index.vue +58 -51
- package/views/log/index.vue +12 -0
- package/views/log/login/index.vue +45 -38
- package/views/log/operate/index.vue +55 -48
- package/views/login_1/index.vue +25 -18
- package/views/people/admin/components/edit.vue +25 -26
- package/views/people/admin/index.vue +76 -40
- package/views/people/index.vue +12 -0
- package/views/permission/api/index.vue +21 -15
- package/views/permission/index.vue +12 -0
- package/views/permission/menu/index.vue +31 -16
- package/views/permission/role/components/api.vue +21 -21
- package/views/permission/role/components/edit.vue +18 -18
- package/views/permission/role/components/menu.vue +14 -16
- package/views/permission/role/index.vue +84 -49
- package/views/403_1/meta.json +0 -4
- package/views/config/dict/meta.json +0 -4
- package/views/config/dictType/meta.json +0 -4
- package/views/config/meta.json +0 -4
- package/views/config/system/meta.json +0 -4
- package/views/index/meta.json +0 -4
- package/views/log/email/meta.json +0 -4
- package/views/log/login/meta.json +0 -4
- package/views/log/meta.json +0 -4
- package/views/log/operate/meta.json +0 -4
- package/views/login_1/meta.json +0 -4
- package/views/people/admin/meta.json +0 -4
- package/views/people/meta.json +0 -4
- package/views/permission/api/meta.json +0 -4
- package/views/permission/menu/meta.json +0 -4
- package/views/permission/meta.json +0 -4
- package/views/permission/role/meta.json +0 -4
|
@@ -45,10 +45,10 @@ import {
|
|
|
45
45
|
Radio as TRadio,
|
|
46
46
|
Button as TButton,
|
|
47
47
|
MessagePlugin
|
|
48
|
-
} from
|
|
49
|
-
import { $Http } from
|
|
50
|
-
import { fieldClear } from
|
|
51
|
-
import { hashPassword } from
|
|
48
|
+
} from "tdesign-vue-next";
|
|
49
|
+
import { $Http } from "@/plugins/http";
|
|
50
|
+
import { fieldClear } from "befly-vite/utils/fieldClear";
|
|
51
|
+
import { hashPassword } from "befly-vite/utils/hashPassword";
|
|
52
52
|
|
|
53
53
|
const $Prop = defineProps({
|
|
54
54
|
modelValue: {
|
|
@@ -57,7 +57,7 @@ const $Prop = defineProps({
|
|
|
57
57
|
},
|
|
58
58
|
actionType: {
|
|
59
59
|
type: String,
|
|
60
|
-
default:
|
|
60
|
+
default: "add"
|
|
61
61
|
},
|
|
62
62
|
rowData: {
|
|
63
63
|
type: Object,
|
|
@@ -65,7 +65,7 @@ const $Prop = defineProps({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const $Emit = defineEmits([
|
|
68
|
+
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
69
69
|
|
|
70
70
|
// 表单引用
|
|
71
71
|
const $From = $shallowRef({
|
|
@@ -77,14 +77,14 @@ const $Data = $ref({
|
|
|
77
77
|
submitting: false,
|
|
78
78
|
allRoleLists: [],
|
|
79
79
|
keys: {
|
|
80
|
-
label:
|
|
81
|
-
value:
|
|
80
|
+
label: "name",
|
|
81
|
+
value: "code"
|
|
82
82
|
},
|
|
83
83
|
formData: {
|
|
84
84
|
id: null,
|
|
85
|
-
username:
|
|
86
|
-
password:
|
|
87
|
-
nickname:
|
|
85
|
+
username: "",
|
|
86
|
+
password: "",
|
|
87
|
+
nickname: "",
|
|
88
88
|
roleCode: null,
|
|
89
89
|
state: 1
|
|
90
90
|
}
|
|
@@ -92,13 +92,13 @@ const $Data = $ref({
|
|
|
92
92
|
|
|
93
93
|
const $Data2 = $shallowRef({
|
|
94
94
|
formRules: {
|
|
95
|
-
username: [{ required: true, message:
|
|
95
|
+
username: [{ required: true, message: "请输入用户名", trigger: "blur" }],
|
|
96
96
|
password: [
|
|
97
|
-
{ required: true, message:
|
|
98
|
-
{ min: 6, message:
|
|
97
|
+
{ required: true, message: "请输入密码", trigger: "blur" },
|
|
98
|
+
{ min: 6, message: "密码至少6位", trigger: "blur" }
|
|
99
99
|
],
|
|
100
|
-
roleCode: [{ required: true, message:
|
|
101
|
-
nickname: [{ min: 2, max: 50, message:
|
|
100
|
+
roleCode: [{ required: true, message: "请选择角色", trigger: "change" }],
|
|
101
|
+
nickname: [{ min: 2, max: 50, message: "昵称长度在 2 到 50 个字符", trigger: "blur" }]
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
@@ -107,7 +107,7 @@ const $Method = {
|
|
|
107
107
|
async initData() {
|
|
108
108
|
$Method.onShow();
|
|
109
109
|
await $Method.apiRoleLists();
|
|
110
|
-
if ($Prop.actionType ===
|
|
110
|
+
if ($Prop.actionType === "upd" && $Prop.rowData.id) {
|
|
111
111
|
$Data.formData = { ...$Prop.rowData };
|
|
112
112
|
}
|
|
113
113
|
},
|
|
@@ -121,17 +121,16 @@ const $Method = {
|
|
|
121
121
|
onClose() {
|
|
122
122
|
$Data.visible = false;
|
|
123
123
|
setTimeout(() => {
|
|
124
|
-
$Emit(
|
|
124
|
+
$Emit("update:modelValue", false);
|
|
125
125
|
}, 300);
|
|
126
126
|
},
|
|
127
127
|
|
|
128
128
|
async apiRoleLists() {
|
|
129
129
|
try {
|
|
130
|
-
const result = await $Http(
|
|
130
|
+
const result = await $Http("/addon/admin/role/all");
|
|
131
131
|
$Data.allRoleLists = result.data || [];
|
|
132
132
|
} catch (error) {
|
|
133
|
-
|
|
134
|
-
MessagePlugin.error('加载角色列表失败');
|
|
133
|
+
MessagePlugin.error("加载角色列表失败");
|
|
135
134
|
}
|
|
136
135
|
},
|
|
137
136
|
|
|
@@ -141,20 +140,20 @@ const $Method = {
|
|
|
141
140
|
if (!valid) return;
|
|
142
141
|
|
|
143
142
|
$Data.submitting = true;
|
|
144
|
-
const formData = $Prop.actionType ===
|
|
143
|
+
const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : fieldClear($Data.formData, { omitKeys: ["password"] });
|
|
145
144
|
|
|
146
145
|
// 添加管理员时,对密码进行 SHA-256 加密
|
|
147
|
-
if ($Prop.actionType ===
|
|
146
|
+
if ($Prop.actionType === "add" && formData.password) {
|
|
148
147
|
formData.password = await hashPassword(formData.password);
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
const result = await $Http($Prop.actionType ===
|
|
150
|
+
const result = await $Http($Prop.actionType === "upd" ? "/addon/admin/admin/upd" : "/addon/admin/admin/ins", formData);
|
|
152
151
|
|
|
153
152
|
MessagePlugin.success(result.msg);
|
|
154
|
-
$Emit(
|
|
153
|
+
$Emit("success");
|
|
155
154
|
$Method.onClose();
|
|
156
155
|
} catch (error) {
|
|
157
|
-
MessagePlugin.error(error.msg ||
|
|
156
|
+
MessagePlugin.error(error.msg || "提交失败");
|
|
158
157
|
} finally {
|
|
159
158
|
$Data.submitting = false;
|
|
160
159
|
}
|
|
@@ -19,7 +19,16 @@
|
|
|
19
19
|
|
|
20
20
|
<div class="main-content">
|
|
21
21
|
<div class="main-table">
|
|
22
|
-
<TTable
|
|
22
|
+
<TTable
|
|
23
|
+
:data="$Data.tableData"
|
|
24
|
+
:columns="$Data.columns"
|
|
25
|
+
:loading="$Data.loading"
|
|
26
|
+
:active-row-keys="$Data.activeRowKeys"
|
|
27
|
+
row-key="id"
|
|
28
|
+
height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
|
|
29
|
+
active-row-type="single"
|
|
30
|
+
@active-change="$Method.onActiveChange"
|
|
31
|
+
>
|
|
23
32
|
<template #state="{ row }">
|
|
24
33
|
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
25
34
|
<TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
|
|
@@ -61,38 +70,45 @@
|
|
|
61
70
|
</template>
|
|
62
71
|
|
|
63
72
|
<script setup>
|
|
64
|
-
import { Button as TButton, Table as TTable, Tag as TTag, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from
|
|
65
|
-
import ILucidePlus from
|
|
66
|
-
import ILucideRotateCw from
|
|
67
|
-
import ILucidePencil from
|
|
68
|
-
import ILucideTrash2 from
|
|
69
|
-
import ILucideChevronDown from
|
|
70
|
-
import EditDialog from
|
|
71
|
-
import DetailPanel from
|
|
72
|
-
import { $Http } from
|
|
73
|
-
import { withDefaultColumns } from
|
|
73
|
+
import { Button as TButton, Table as TTable, Tag as TTag, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
|
|
74
|
+
import ILucidePlus from "~icons/lucide/plus";
|
|
75
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
76
|
+
import ILucidePencil from "~icons/lucide/pencil";
|
|
77
|
+
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
78
|
+
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
79
|
+
import EditDialog from "./components/edit.vue";
|
|
80
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
81
|
+
import { $Http } from "@/plugins/http";
|
|
82
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
83
|
+
|
|
84
|
+
definePage({
|
|
85
|
+
meta: {
|
|
86
|
+
title: "管理员",
|
|
87
|
+
order: 1
|
|
88
|
+
}
|
|
89
|
+
});
|
|
74
90
|
|
|
75
91
|
// 响应式数据
|
|
76
92
|
const $Data = $ref({
|
|
77
93
|
tableData: [],
|
|
78
94
|
loading: false,
|
|
79
95
|
columns: withDefaultColumns([
|
|
80
|
-
{ colKey:
|
|
81
|
-
{ colKey:
|
|
82
|
-
{ colKey:
|
|
83
|
-
{ colKey:
|
|
84
|
-
{ colKey:
|
|
85
|
-
{ colKey:
|
|
96
|
+
{ colKey: "username", title: "用户名", fixed: "left" },
|
|
97
|
+
{ colKey: "id", title: "序号" },
|
|
98
|
+
{ colKey: "nickname", title: "昵称" },
|
|
99
|
+
{ colKey: "roleCode", title: "角色" },
|
|
100
|
+
{ colKey: "state", title: "状态" },
|
|
101
|
+
{ colKey: "operation", title: "操作" }
|
|
86
102
|
]),
|
|
87
103
|
pagerConfig: {
|
|
88
104
|
currentPage: 1,
|
|
89
105
|
limit: 30,
|
|
90
106
|
total: 0,
|
|
91
|
-
align:
|
|
92
|
-
layout:
|
|
107
|
+
align: "right",
|
|
108
|
+
layout: "total, prev, pager, next, jumper"
|
|
93
109
|
},
|
|
94
110
|
editVisible: false,
|
|
95
|
-
actionType:
|
|
111
|
+
actionType: "add",
|
|
96
112
|
rowData: {},
|
|
97
113
|
currentRow: null,
|
|
98
114
|
activeRowKeys: []
|
|
@@ -108,7 +124,7 @@ const $Method = {
|
|
|
108
124
|
async apiAdminList() {
|
|
109
125
|
$Data.loading = true;
|
|
110
126
|
try {
|
|
111
|
-
const res = await $Http(
|
|
127
|
+
const res = await $Http("/addon/admin/admin/list", {
|
|
112
128
|
page: $Data.pagerConfig.currentPage,
|
|
113
129
|
limit: $Data.pagerConfig.limit
|
|
114
130
|
});
|
|
@@ -124,8 +140,7 @@ const $Method = {
|
|
|
124
140
|
$Data.activeRowKeys = [];
|
|
125
141
|
}
|
|
126
142
|
} catch (error) {
|
|
127
|
-
|
|
128
|
-
MessagePlugin.error('加载数据失败');
|
|
143
|
+
MessagePlugin.error("加载数据失败");
|
|
129
144
|
} finally {
|
|
130
145
|
$Data.loading = false;
|
|
131
146
|
}
|
|
@@ -133,22 +148,43 @@ const $Method = {
|
|
|
133
148
|
|
|
134
149
|
// 删除管理员
|
|
135
150
|
async apiAdminDel(row) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
let dialog = null;
|
|
152
|
+
let destroyed = false;
|
|
153
|
+
|
|
154
|
+
const destroy = () => {
|
|
155
|
+
if (destroyed) return;
|
|
156
|
+
destroyed = true;
|
|
157
|
+
if (dialog && typeof dialog.destroy === "function") {
|
|
158
|
+
dialog.destroy();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
dialog = DialogPlugin.confirm({
|
|
163
|
+
header: "确认删除",
|
|
164
|
+
body: `确认删除管理员“${row.username}”吗?`,
|
|
165
|
+
status: "warning",
|
|
166
|
+
confirmBtn: "删除",
|
|
167
|
+
cancelBtn: "取消",
|
|
168
|
+
onConfirm: async () => {
|
|
169
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
170
|
+
dialog.setConfirmLoading(true);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
await $Http("/addon/admin/admin/del", { id: row.id });
|
|
175
|
+
MessagePlugin.success("删除成功");
|
|
176
|
+
destroy();
|
|
177
|
+
await $Method.apiAdminList();
|
|
178
|
+
} catch (error) {
|
|
179
|
+
MessagePlugin.error("删除失败");
|
|
180
|
+
} finally {
|
|
181
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
182
|
+
dialog.setConfirmLoading(false);
|
|
183
|
+
}
|
|
148
184
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
185
|
+
},
|
|
186
|
+
onClose: () => {
|
|
187
|
+
destroy();
|
|
152
188
|
}
|
|
153
189
|
});
|
|
154
190
|
},
|
|
@@ -188,9 +224,9 @@ const $Method = {
|
|
|
188
224
|
onAction(command, rowData) {
|
|
189
225
|
$Data.actionType = command;
|
|
190
226
|
$Data.rowData = rowData;
|
|
191
|
-
if (command ===
|
|
227
|
+
if (command === "add" || command === "upd") {
|
|
192
228
|
$Data.editVisible = true;
|
|
193
|
-
} else if (command ===
|
|
229
|
+
} else if (command === "del") {
|
|
194
230
|
$Method.apiAdminDel(rowData);
|
|
195
231
|
}
|
|
196
232
|
}
|
|
@@ -51,25 +51,32 @@
|
|
|
51
51
|
</template>
|
|
52
52
|
|
|
53
53
|
<script setup>
|
|
54
|
-
import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from
|
|
55
|
-
import ILucideRotateCw from
|
|
56
|
-
import ILucideSearch from
|
|
57
|
-
import { $Http } from
|
|
58
|
-
import { withDefaultColumns } from
|
|
59
|
-
import DetailPanel from
|
|
54
|
+
import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
|
|
55
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
56
|
+
import ILucideSearch from "~icons/lucide/search";
|
|
57
|
+
import { $Http } from "@/plugins/http";
|
|
58
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
59
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
60
|
+
|
|
61
|
+
definePage({
|
|
62
|
+
meta: {
|
|
63
|
+
title: "接口列表",
|
|
64
|
+
order: 3
|
|
65
|
+
}
|
|
66
|
+
});
|
|
60
67
|
|
|
61
68
|
// 响应式数据
|
|
62
69
|
const $Data = $ref({
|
|
63
70
|
tableData: [],
|
|
64
71
|
allData: [],
|
|
65
72
|
loading: false,
|
|
66
|
-
searchKeyword:
|
|
73
|
+
searchKeyword: "",
|
|
67
74
|
columns: withDefaultColumns([
|
|
68
|
-
{ colKey:
|
|
69
|
-
{ colKey:
|
|
70
|
-
{ colKey:
|
|
71
|
-
{ colKey:
|
|
72
|
-
{ colKey:
|
|
75
|
+
{ colKey: "name", title: "接口名称" },
|
|
76
|
+
{ colKey: "id", title: "序号" },
|
|
77
|
+
{ colKey: "path", title: "接口路径" },
|
|
78
|
+
{ colKey: "method", title: "请求方法" },
|
|
79
|
+
{ colKey: "addonName", title: "所属组件" }
|
|
73
80
|
]),
|
|
74
81
|
currentRow: null,
|
|
75
82
|
activeRowKeys: []
|
|
@@ -85,7 +92,7 @@ const $Method = {
|
|
|
85
92
|
async loadApiAll() {
|
|
86
93
|
$Data.loading = true;
|
|
87
94
|
try {
|
|
88
|
-
const res = await $Http(
|
|
95
|
+
const res = await $Http("/addon/admin/api/all");
|
|
89
96
|
const list = res.data?.lists || [];
|
|
90
97
|
$Data.allData = list;
|
|
91
98
|
$Data.tableData = list;
|
|
@@ -99,8 +106,7 @@ const $Method = {
|
|
|
99
106
|
$Data.activeRowKeys = [];
|
|
100
107
|
}
|
|
101
108
|
} catch (error) {
|
|
102
|
-
|
|
103
|
-
MessagePlugin.error('加载数据失败');
|
|
109
|
+
MessagePlugin.error("加载数据失败");
|
|
104
110
|
} finally {
|
|
105
111
|
$Data.loading = false;
|
|
106
112
|
}
|
|
@@ -13,7 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
<div class="main-content">
|
|
15
15
|
<div class="main-table">
|
|
16
|
-
<TTable
|
|
16
|
+
<TTable
|
|
17
|
+
:data="$Data.tableData"
|
|
18
|
+
:columns="$Data.columns"
|
|
19
|
+
:loading="$Data.loading"
|
|
20
|
+
:active-row-keys="$Data.activeRowKeys"
|
|
21
|
+
row-key="id"
|
|
22
|
+
height="calc(100vh - var(--search-height) - var(--layout-gap) * 2)"
|
|
23
|
+
active-row-type="single"
|
|
24
|
+
:tree="{ childrenKey: 'children', treeNodeColumnIndex: 0, defaultExpandAll: true }"
|
|
25
|
+
@active-change="$Method.onActiveChange"
|
|
26
|
+
>
|
|
17
27
|
<template #state="{ row }">
|
|
18
28
|
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
19
29
|
<TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
|
|
@@ -30,24 +40,30 @@
|
|
|
30
40
|
</template>
|
|
31
41
|
|
|
32
42
|
<script setup>
|
|
33
|
-
import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from
|
|
34
|
-
import ILucideRotateCw from
|
|
35
|
-
import DetailPanel from
|
|
36
|
-
import { $Http } from
|
|
37
|
-
import { withDefaultColumns } from
|
|
38
|
-
|
|
43
|
+
import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
|
|
44
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
45
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
46
|
+
import { $Http } from "@/plugins/http";
|
|
47
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
48
|
+
|
|
49
|
+
definePage({
|
|
50
|
+
meta: {
|
|
51
|
+
title: "菜单列表",
|
|
52
|
+
order: 2
|
|
53
|
+
}
|
|
54
|
+
});
|
|
39
55
|
|
|
40
56
|
// 响应式数据
|
|
41
57
|
const $Data = $ref({
|
|
42
58
|
tableData: [],
|
|
43
59
|
loading: false,
|
|
44
60
|
columns: withDefaultColumns([
|
|
45
|
-
{ colKey:
|
|
46
|
-
{ colKey:
|
|
47
|
-
{ colKey:
|
|
48
|
-
{ colKey:
|
|
49
|
-
{ colKey:
|
|
50
|
-
{ colKey:
|
|
61
|
+
{ colKey: "name", title: "菜单名称", fixed: "left" },
|
|
62
|
+
{ colKey: "id", title: "序号" },
|
|
63
|
+
{ colKey: "path", title: "路由路径" },
|
|
64
|
+
{ colKey: "icon", title: "图标" },
|
|
65
|
+
{ colKey: "sort", title: "排序" },
|
|
66
|
+
{ colKey: "state", title: "状态" }
|
|
51
67
|
]),
|
|
52
68
|
currentRow: null,
|
|
53
69
|
activeRowKeys: []
|
|
@@ -63,7 +79,7 @@ const $Method = {
|
|
|
63
79
|
async apiMenuList() {
|
|
64
80
|
$Data.loading = true;
|
|
65
81
|
try {
|
|
66
|
-
const res = await $Http(
|
|
82
|
+
const res = await $Http("/addon/admin/menu/list");
|
|
67
83
|
// 构建树形结构
|
|
68
84
|
$Data.tableData = $Method.buildTree(res.data || []);
|
|
69
85
|
|
|
@@ -76,8 +92,7 @@ const $Method = {
|
|
|
76
92
|
$Data.activeRowKeys = [];
|
|
77
93
|
}
|
|
78
94
|
} catch (error) {
|
|
79
|
-
|
|
80
|
-
MessagePlugin.error('加载数据失败');
|
|
95
|
+
MessagePlugin.error("加载数据失败");
|
|
81
96
|
} finally {
|
|
82
97
|
$Data.loading = false;
|
|
83
98
|
}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
<div class="group-header">{{ group.title }}</div>
|
|
17
17
|
<div class="api-checkbox-list">
|
|
18
18
|
<TCheckboxGroup v-model="$Data.checkedApiIds">
|
|
19
|
-
<TCheckbox v-for="api in group.apis" :key="api.id" :value="api.id">
|
|
19
|
+
<TCheckbox v-for="api in group.apis" :key="api.id" :value="api.id">
|
|
20
|
+
{{ api.label }}
|
|
21
|
+
</TCheckbox>
|
|
20
22
|
</TCheckboxGroup>
|
|
21
23
|
</div>
|
|
22
24
|
</div>
|
|
@@ -35,9 +37,9 @@
|
|
|
35
37
|
</template>
|
|
36
38
|
|
|
37
39
|
<script setup>
|
|
38
|
-
import { Dialog as TDialog, Input as TInput, CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, Button as TButton, MessagePlugin } from
|
|
39
|
-
import ILucideSearch from
|
|
40
|
-
import { $Http } from
|
|
40
|
+
import { Dialog as TDialog, Input as TInput, CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, Button as TButton, MessagePlugin } from "tdesign-vue-next";
|
|
41
|
+
import ILucideSearch from "~icons/lucide/search";
|
|
42
|
+
import { $Http } from "@/plugins/http";
|
|
41
43
|
|
|
42
44
|
const $Prop = defineProps({
|
|
43
45
|
modelValue: {
|
|
@@ -50,14 +52,14 @@ const $Prop = defineProps({
|
|
|
50
52
|
}
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
const $Emit = defineEmits([
|
|
55
|
+
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
54
56
|
|
|
55
57
|
const $Data = $ref({
|
|
56
58
|
visible: false,
|
|
57
59
|
submitting: false,
|
|
58
60
|
apiData: [],
|
|
59
61
|
filteredApiData: [],
|
|
60
|
-
searchText:
|
|
62
|
+
searchText: "",
|
|
61
63
|
checkedApiIds: []
|
|
62
64
|
});
|
|
63
65
|
|
|
@@ -78,21 +80,21 @@ const $Method = {
|
|
|
78
80
|
onClose() {
|
|
79
81
|
$Data.visible = false;
|
|
80
82
|
setTimeout(() => {
|
|
81
|
-
$Emit(
|
|
83
|
+
$Emit("update:modelValue", false);
|
|
82
84
|
}, 300);
|
|
83
85
|
},
|
|
84
86
|
|
|
85
87
|
// 加载所有接口
|
|
86
88
|
async apiApiAll() {
|
|
87
89
|
try {
|
|
88
|
-
const res = await $Http(
|
|
90
|
+
const res = await $Http("/addon/admin/api/all");
|
|
89
91
|
|
|
90
92
|
// 将接口列表按 addonTitle 分组
|
|
91
93
|
const apiMap = new Map();
|
|
92
94
|
|
|
93
95
|
res.data.lists.forEach((api) => {
|
|
94
|
-
const addonTitle = api.addonTitle || api.addonName ||
|
|
95
|
-
const addonName = api.addonName ||
|
|
96
|
+
const addonTitle = api.addonTitle || api.addonName || "项目接口";
|
|
97
|
+
const addonName = api.addonName || "project";
|
|
96
98
|
|
|
97
99
|
if (!apiMap.has(addonName)) {
|
|
98
100
|
apiMap.set(addonName, {
|
|
@@ -111,8 +113,7 @@ const $Method = {
|
|
|
111
113
|
|
|
112
114
|
$Data.apiData = Array.from(apiMap.values());
|
|
113
115
|
} catch (error) {
|
|
114
|
-
|
|
115
|
-
MessagePlugin.error('加载接口失败');
|
|
116
|
+
MessagePlugin.error("加载接口失败");
|
|
116
117
|
}
|
|
117
118
|
},
|
|
118
119
|
|
|
@@ -121,13 +122,13 @@ const $Method = {
|
|
|
121
122
|
if (!$Prop.rowData.id) return;
|
|
122
123
|
|
|
123
124
|
try {
|
|
124
|
-
const res = await $Http(
|
|
125
|
+
const res = await $Http("/addon/admin/role/apis", {
|
|
125
126
|
roleCode: $Prop.rowData.code
|
|
126
127
|
});
|
|
127
128
|
|
|
128
129
|
$Data.checkedApiIds = res.data.apiIds || [];
|
|
129
130
|
} catch (error) {
|
|
130
|
-
|
|
131
|
+
MessagePlugin.error("加载数据失败");
|
|
131
132
|
}
|
|
132
133
|
},
|
|
133
134
|
|
|
@@ -152,21 +153,20 @@ const $Method = {
|
|
|
152
153
|
try {
|
|
153
154
|
$Data.submitting = true;
|
|
154
155
|
|
|
155
|
-
const res = await $Http(
|
|
156
|
+
const res = await $Http("/addon/admin/role/apiSave", {
|
|
156
157
|
roleCode: $Prop.rowData.code,
|
|
157
158
|
apiIds: $Data.checkedApiIds
|
|
158
159
|
});
|
|
159
160
|
|
|
160
161
|
if (res.code === 0) {
|
|
161
|
-
MessagePlugin.success(
|
|
162
|
+
MessagePlugin.success("保存成功");
|
|
162
163
|
$Data.visible = false;
|
|
163
|
-
$Emit(
|
|
164
|
+
$Emit("success");
|
|
164
165
|
} else {
|
|
165
|
-
MessagePlugin.error(res.msg ||
|
|
166
|
+
MessagePlugin.error(res.msg || "保存失败");
|
|
166
167
|
}
|
|
167
168
|
} catch (error) {
|
|
168
|
-
|
|
169
|
-
MessagePlugin.error('保存失败');
|
|
169
|
+
MessagePlugin.error("保存失败");
|
|
170
170
|
} finally {
|
|
171
171
|
$Data.submitting = false;
|
|
172
172
|
}
|
|
@@ -215,7 +215,7 @@ $Method.initData();
|
|
|
215
215
|
gap: 8px;
|
|
216
216
|
|
|
217
217
|
&::before {
|
|
218
|
-
content:
|
|
218
|
+
content: "";
|
|
219
219
|
width: 8px;
|
|
220
220
|
height: 8px;
|
|
221
221
|
border-radius: 50%;
|