@befly-addon/admin 1.2.0 → 1.2.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.
- package/adminViews/403_1/index.vue +75 -0
- package/adminViews/config/dict/components/edit.vue +109 -0
- package/adminViews/config/dict/index.vue +266 -0
- package/adminViews/config/dictType/components/edit.vue +100 -0
- package/adminViews/config/dictType/index.vue +244 -0
- package/adminViews/config/index.vue +12 -0
- package/adminViews/config/system/components/edit.vue +171 -0
- package/adminViews/config/system/index.vue +286 -0
- package/adminViews/index/components/addonList.vue +132 -0
- package/adminViews/index/components/environmentInfo.vue +100 -0
- package/adminViews/index/components/operationLogs.vue +112 -0
- package/adminViews/index/components/performanceMetrics.vue +145 -0
- package/adminViews/index/components/quickActions.vue +30 -0
- package/adminViews/index/components/serviceStatus.vue +192 -0
- package/adminViews/index/components/systemNotifications.vue +137 -0
- package/adminViews/index/components/systemOverview.vue +190 -0
- package/adminViews/index/components/systemResources.vue +111 -0
- package/adminViews/index/components/userInfo.vue +204 -0
- package/adminViews/index/index.vue +74 -0
- package/adminViews/log/email/index.vue +292 -0
- package/adminViews/log/index.vue +12 -0
- package/adminViews/log/login/index.vue +187 -0
- package/adminViews/log/operate/index.vue +249 -0
- package/adminViews/login_1/index.vue +415 -0
- package/adminViews/people/admin/components/edit.vue +168 -0
- package/adminViews/people/admin/index.vue +240 -0
- package/adminViews/people/index.vue +12 -0
- package/adminViews/permission/api/index.vue +149 -0
- package/adminViews/permission/index.vue +12 -0
- package/adminViews/permission/menu/index.vue +130 -0
- package/adminViews/permission/role/components/api.vue +361 -0
- package/adminViews/permission/role/components/edit.vue +142 -0
- package/adminViews/permission/role/components/menu.vue +118 -0
- package/adminViews/permission/role/index.vue +263 -0
- package/package.json +12 -10
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-role page-table">
|
|
3
|
+
<div class="main-tool">
|
|
4
|
+
<div class="left">
|
|
5
|
+
<TButton theme="primary" @click="$Method.onAction('add', {})">
|
|
6
|
+
<template #icon>
|
|
7
|
+
<ILucidePlus />
|
|
8
|
+
</template>
|
|
9
|
+
</TButton>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="right">
|
|
12
|
+
<TButton shape="circle" @click="$Method.handleRefresh">
|
|
13
|
+
<template #icon>
|
|
14
|
+
<ILucideRotateCw />
|
|
15
|
+
</template>
|
|
16
|
+
</TButton>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="main-content">
|
|
20
|
+
<div class="main-table">
|
|
21
|
+
<TTable
|
|
22
|
+
:data="$Data.tableData"
|
|
23
|
+
:columns="$Data.columns"
|
|
24
|
+
:loading="$Data.loading"
|
|
25
|
+
:active-row-keys="$Data.activeRowKeys"
|
|
26
|
+
row-key="id"
|
|
27
|
+
height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
|
|
28
|
+
active-row-type="single"
|
|
29
|
+
@active-change="$Method.onActiveChange"
|
|
30
|
+
>
|
|
31
|
+
<template #state="{ row }">
|
|
32
|
+
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
33
|
+
<TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
|
|
34
|
+
<TTag v-else shape="round" theme="danger" variant="light-outline">已删除</TTag>
|
|
35
|
+
</template>
|
|
36
|
+
<template #operation="{ row }">
|
|
37
|
+
<TDropdown trigger="click" placement="bottom-right" @click="(data) => $Method.onAction(data.value, row)">
|
|
38
|
+
<TButton theme="primary" size="small">
|
|
39
|
+
操作
|
|
40
|
+
<template #suffix> <ILucideChevronDown /></template>
|
|
41
|
+
</TButton>
|
|
42
|
+
<TDropdownMenu slot="dropdown">
|
|
43
|
+
<TDropdownItem value="upd">
|
|
44
|
+
<ILucidePencil />
|
|
45
|
+
编辑
|
|
46
|
+
</TDropdownItem>
|
|
47
|
+
<TDropdownItem value="menu">
|
|
48
|
+
<ILucideSettings />
|
|
49
|
+
菜单权限
|
|
50
|
+
</TDropdownItem>
|
|
51
|
+
<TDropdownItem value="api">
|
|
52
|
+
<ILucideCode />
|
|
53
|
+
接口权限
|
|
54
|
+
</TDropdownItem>
|
|
55
|
+
<TDropdownItem value="del" :divider="true">
|
|
56
|
+
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
57
|
+
删除
|
|
58
|
+
</TDropdownItem>
|
|
59
|
+
</TDropdownMenu>
|
|
60
|
+
</TDropdown>
|
|
61
|
+
</template>
|
|
62
|
+
</TTable>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="main-detail">
|
|
66
|
+
<DetailPanel :data="$Data.currentRow" :fields="$Data.columns" />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="main-page">
|
|
71
|
+
<TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<!-- 编辑对话框组件 -->
|
|
75
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.apiRoleList" />
|
|
76
|
+
|
|
77
|
+
<!-- 菜单权限对话框组件 -->
|
|
78
|
+
<MenuDialog v-if="$Data.menuVisible" v-model="$Data.menuVisible" :row-data="$Data.rowData" @success="$Method.apiRoleList" />
|
|
79
|
+
|
|
80
|
+
<!-- 接口权限对话框组件 -->
|
|
81
|
+
<ApiDialog v-if="$Data.apiVisible" v-model="$Data.apiVisible" :row-data="$Data.rowData" @success="$Method.apiRoleList" />
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup>
|
|
86
|
+
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";
|
|
87
|
+
import ILucidePlus from "~icons/lucide/plus";
|
|
88
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
89
|
+
import ILucidePencil from "~icons/lucide/pencil";
|
|
90
|
+
import ILucideSettings from "~icons/lucide/settings";
|
|
91
|
+
import ILucideCode from "~icons/lucide/code";
|
|
92
|
+
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
93
|
+
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
94
|
+
import EditDialog from "./components/edit.vue";
|
|
95
|
+
import MenuDialog from "./components/menu.vue";
|
|
96
|
+
import ApiDialog from "./components/api.vue";
|
|
97
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
98
|
+
import { $Http } from "@/plugins/http";
|
|
99
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
100
|
+
|
|
101
|
+
definePage({
|
|
102
|
+
meta: {
|
|
103
|
+
title: "角色管理",
|
|
104
|
+
order: 1
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// 响应式数据
|
|
109
|
+
const $Data = $ref({
|
|
110
|
+
tableData: [],
|
|
111
|
+
loading: false,
|
|
112
|
+
activeRowKeys: [],
|
|
113
|
+
currentRow: null,
|
|
114
|
+
columns: withDefaultColumns([
|
|
115
|
+
{ colKey: "id", title: "ID" },
|
|
116
|
+
{ colKey: "name", title: "角色名称" },
|
|
117
|
+
{ colKey: "code", title: "角色代码" },
|
|
118
|
+
{ colKey: "description", title: "描述" },
|
|
119
|
+
{ colKey: "sort", title: "排序" },
|
|
120
|
+
{ colKey: "state", title: "状态" },
|
|
121
|
+
{ colKey: "operation", title: "操作" }
|
|
122
|
+
]),
|
|
123
|
+
pagerConfig: {
|
|
124
|
+
currentPage: 1,
|
|
125
|
+
limit: 30,
|
|
126
|
+
total: 0,
|
|
127
|
+
align: "right",
|
|
128
|
+
layout: "total, prev, pager, next, jumper"
|
|
129
|
+
},
|
|
130
|
+
editVisible: false,
|
|
131
|
+
menuVisible: false,
|
|
132
|
+
apiVisible: false,
|
|
133
|
+
actionType: "add",
|
|
134
|
+
rowData: {}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// 方法
|
|
138
|
+
const $Method = {
|
|
139
|
+
async initData() {
|
|
140
|
+
await $Method.apiRoleList();
|
|
141
|
+
},
|
|
142
|
+
// 加载角色列表
|
|
143
|
+
async apiRoleList() {
|
|
144
|
+
$Data.loading = true;
|
|
145
|
+
try {
|
|
146
|
+
const res = await $Http("/addon/admin/role/list", {
|
|
147
|
+
page: $Data.pagerConfig.currentPage,
|
|
148
|
+
limit: $Data.pagerConfig.limit
|
|
149
|
+
});
|
|
150
|
+
$Data.tableData = res.data.lists || [];
|
|
151
|
+
$Data.pagerConfig.total = res.data.total || 0;
|
|
152
|
+
|
|
153
|
+
// 自动选中并高亮第一行
|
|
154
|
+
if ($Data.tableData.length > 0) {
|
|
155
|
+
$Data.currentRow = $Data.tableData[0];
|
|
156
|
+
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
157
|
+
} else {
|
|
158
|
+
$Data.currentRow = null;
|
|
159
|
+
$Data.activeRowKeys = [];
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
MessagePlugin.error("加载数据失败");
|
|
163
|
+
} finally {
|
|
164
|
+
$Data.loading = false;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// 删除角色
|
|
169
|
+
async apiRoleDel(row) {
|
|
170
|
+
let dialog = null;
|
|
171
|
+
let destroyed = false;
|
|
172
|
+
|
|
173
|
+
const destroy = () => {
|
|
174
|
+
if (destroyed) return;
|
|
175
|
+
destroyed = true;
|
|
176
|
+
if (dialog && typeof dialog.destroy === "function") {
|
|
177
|
+
dialog.destroy();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
dialog = DialogPlugin.confirm({
|
|
182
|
+
header: "确认删除",
|
|
183
|
+
body: `确认删除角色“${row.name}”吗?`,
|
|
184
|
+
status: "warning",
|
|
185
|
+
confirmBtn: "删除",
|
|
186
|
+
cancelBtn: "取消",
|
|
187
|
+
onConfirm: async () => {
|
|
188
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
189
|
+
dialog.setConfirmLoading(true);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
await $Http("/addon/admin/role/del", { id: row.id });
|
|
194
|
+
MessagePlugin.success("删除成功");
|
|
195
|
+
destroy();
|
|
196
|
+
await $Method.apiRoleList();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
MessagePlugin.error("删除失败");
|
|
199
|
+
} finally {
|
|
200
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
201
|
+
dialog.setConfirmLoading(false);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
onClose: () => {
|
|
206
|
+
destroy();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
// 刷新
|
|
212
|
+
handleRefresh() {
|
|
213
|
+
$Method.apiRoleList();
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
// 分页改变
|
|
217
|
+
onPageChange({ currentPage }) {
|
|
218
|
+
$Data.pagerConfig.currentPage = currentPage;
|
|
219
|
+
$Method.apiRoleList();
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
// 每页条数改变
|
|
223
|
+
handleSizeChange({ pageSize }) {
|
|
224
|
+
$Data.pagerConfig.limit = pageSize;
|
|
225
|
+
$Data.pagerConfig.currentPage = 1;
|
|
226
|
+
$Method.apiRoleList();
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
// 高亮行变化
|
|
230
|
+
onActiveChange(value, context) {
|
|
231
|
+
// 禁止取消高亮:如果新值为空,保持当前选中
|
|
232
|
+
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
$Data.activeRowKeys = value;
|
|
236
|
+
// 更新当前高亮的行数据
|
|
237
|
+
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
238
|
+
$Data.currentRow = context.activeRowList[0].row;
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
// 操作菜单点击
|
|
243
|
+
onAction(command, rowData) {
|
|
244
|
+
$Data.actionType = command;
|
|
245
|
+
$Data.rowData = rowData;
|
|
246
|
+
if (command === "add" || command === "upd") {
|
|
247
|
+
$Data.editVisible = true;
|
|
248
|
+
} else if (command === "menu") {
|
|
249
|
+
$Data.menuVisible = true;
|
|
250
|
+
} else if (command === "api") {
|
|
251
|
+
$Data.apiVisible = true;
|
|
252
|
+
} else if (command === "del") {
|
|
253
|
+
$Method.apiRoleDel(rowData);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
$Method.initData();
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<style scoped lang="scss">
|
|
262
|
+
/* page styles */
|
|
263
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@befly-addon/admin",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"gitHead": "47bed37852a0435186337bae81258ae2de1d29a4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly - 管理后台功能组件",
|
|
7
7
|
"keywords": [
|
|
@@ -20,14 +20,16 @@
|
|
|
20
20
|
"directory": "packages/addon-admin"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"apis",
|
|
24
|
-
"libs",
|
|
25
23
|
"package.json",
|
|
26
|
-
"plugins",
|
|
27
24
|
"README.md",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
25
|
+
"tsconfig.json",
|
|
26
|
+
"adminViews/",
|
|
27
|
+
"apis/",
|
|
28
|
+
"appViews/",
|
|
29
|
+
"libs/",
|
|
30
|
+
"plugins/",
|
|
31
|
+
"styles/",
|
|
32
|
+
"tables/"
|
|
31
33
|
],
|
|
32
34
|
"type": "module",
|
|
33
35
|
"main": "package.json",
|
|
@@ -45,8 +47,8 @@
|
|
|
45
47
|
"preview": "vite preview"
|
|
46
48
|
},
|
|
47
49
|
"dependencies": {
|
|
48
|
-
"befly": "^3.10.
|
|
49
|
-
"befly-vite": "^1.2.
|
|
50
|
+
"befly": "^3.10.2",
|
|
51
|
+
"befly-vite": "^1.2.2",
|
|
50
52
|
"nodemailer": "^7.0.12",
|
|
51
53
|
"ua-parser-js": "^2.0.7"
|
|
52
54
|
},
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"strict": false,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"baseUrl": "."
|
|
10
|
+
},
|
|
11
|
+
"include": ["views/**/*.vue", "apis/**/*.ts", "plugins/**/*.ts", "libs/**/*.ts"],
|
|
12
|
+
"vueCompilerOptions": {
|
|
13
|
+
"globalTypesPath": "../../temp/volar/addonAdmin-global-types.d.ts"
|
|
14
|
+
}
|
|
15
|
+
}
|