@befly-addon/admin 1.8.2 → 1.8.5
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 +9 -10
- package/adminViews/config/dict/components/edit.vue +39 -36
- package/adminViews/config/dict/index.vue +127 -206
- package/adminViews/config/dictType/components/edit.vue +38 -36
- package/adminViews/config/dictType/index.vue +105 -197
- package/adminViews/config/system/components/edit.vue +75 -70
- package/adminViews/config/system/index.vue +134 -235
- package/adminViews/index/components/userInfo.vue +67 -77
- package/adminViews/log/email/index.vue +154 -230
- package/adminViews/log/login/index.vue +66 -157
- package/adminViews/log/operate/index.vue +110 -196
- package/adminViews/login_1/index.vue +29 -39
- package/adminViews/people/admin/components/edit.vue +61 -70
- package/adminViews/people/admin/index.vue +88 -204
- package/adminViews/permission/api/index.vue +52 -62
- package/adminViews/permission/menu/index.vue +43 -53
- package/adminViews/permission/role/components/api.vue +168 -169
- package/adminViews/permission/role/components/edit.vue +43 -45
- package/adminViews/permission/role/components/menu.vue +143 -151
- package/adminViews/permission/role/index.vue +129 -224
- package/adminViews/tsconfig.json +14 -0
- package/package.json +3 -3
|
@@ -1,95 +1,77 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<PagedTableDetail class="page-role page-table" :columns="$Data.columns" :endpoints="$Data.endpoints" :table-slot-names="['state', 'menuCount', 'apiCount']">
|
|
3
|
+
<template #toolLeft>
|
|
4
|
+
<TButton theme="primary" @click="onAdd">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<ILucidePlus />
|
|
7
|
+
</template>
|
|
8
|
+
</TButton>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<template #toolRight="scope">
|
|
12
|
+
<TButton shape="circle" @click="onReload(scope.reload)">
|
|
13
|
+
<template #icon>
|
|
14
|
+
<ILucideRotateCw />
|
|
15
|
+
</template>
|
|
16
|
+
</TButton>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<template #state="{ row }">
|
|
20
|
+
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
21
|
+
<TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
|
|
22
|
+
<TTag v-else shape="round" theme="danger" variant="light-outline">已删除</TTag>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<template #menuCount="{ row }">
|
|
26
|
+
{{ getPathCount(row.menus) }}
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<template #apiCount="{ row }">
|
|
30
|
+
{{ getPathCount(row.apis) }}
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<template #operation="{ row, deleteRow }">
|
|
34
|
+
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
35
|
+
<TButton theme="primary" size="small">
|
|
36
|
+
操作
|
|
37
|
+
<template #suffix> <ILucideChevronDown /></template>
|
|
9
38
|
</TButton>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<template #operation="{ row }">
|
|
43
|
-
<TDropdown trigger="click" placement="bottom-right" @click="(data) => $Method.onAction(data.value, row)">
|
|
44
|
-
<TButton theme="primary" size="small">
|
|
45
|
-
操作
|
|
46
|
-
<template #suffix> <ILucideChevronDown /></template>
|
|
47
|
-
</TButton>
|
|
48
|
-
<TDropdownMenu slot="dropdown">
|
|
49
|
-
<TDropdownItem value="upd">
|
|
50
|
-
<ILucidePencil />
|
|
51
|
-
编辑
|
|
52
|
-
</TDropdownItem>
|
|
53
|
-
<TDropdownItem value="menu">
|
|
54
|
-
<ILucideSettings />
|
|
55
|
-
菜单权限
|
|
56
|
-
</TDropdownItem>
|
|
57
|
-
<TDropdownItem value="api">
|
|
58
|
-
<ILucideCode />
|
|
59
|
-
接口权限
|
|
60
|
-
</TDropdownItem>
|
|
61
|
-
<TDropdownItem value="del" :divider="true">
|
|
62
|
-
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
63
|
-
删除
|
|
64
|
-
</TDropdownItem>
|
|
65
|
-
</TDropdownMenu>
|
|
66
|
-
</TDropdown>
|
|
67
|
-
</template>
|
|
68
|
-
</TTable>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div class="main-detail">
|
|
72
|
-
<DetailPanel :data="$Data.currentRow" :fields="$Data.columns" />
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div class="main-page">
|
|
77
|
-
<TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<!-- 编辑对话框组件 -->
|
|
81
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.apiRoleList" />
|
|
82
|
-
|
|
83
|
-
<!-- 菜单权限对话框组件 -->
|
|
84
|
-
<MenuDialog v-if="$Data.menuVisible" v-model="$Data.menuVisible" :row-data="$Data.rowData" @success="$Method.apiRoleList" />
|
|
85
|
-
|
|
86
|
-
<!-- 接口权限对话框组件 -->
|
|
87
|
-
<ApiDialog v-if="$Data.apiVisible" v-model="$Data.apiVisible" :row-data="$Data.rowData" @success="$Method.apiRoleList" />
|
|
88
|
-
</div>
|
|
39
|
+
<TDropdownMenu slot="dropdown">
|
|
40
|
+
<TDropdownItem value="upd">
|
|
41
|
+
<ILucidePencil />
|
|
42
|
+
编辑
|
|
43
|
+
</TDropdownItem>
|
|
44
|
+
<TDropdownItem value="menu">
|
|
45
|
+
<ILucideSettings />
|
|
46
|
+
菜单权限
|
|
47
|
+
</TDropdownItem>
|
|
48
|
+
<TDropdownItem value="api">
|
|
49
|
+
<ILucideCode />
|
|
50
|
+
接口权限
|
|
51
|
+
</TDropdownItem>
|
|
52
|
+
<TDropdownItem value="del" :divider="true">
|
|
53
|
+
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
54
|
+
删除
|
|
55
|
+
</TDropdownItem>
|
|
56
|
+
</TDropdownMenu>
|
|
57
|
+
</TDropdown>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<template #dialogs="scope">
|
|
61
|
+
<!-- 编辑对话框组件 -->
|
|
62
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
63
|
+
|
|
64
|
+
<!-- 菜单权限对话框组件 -->
|
|
65
|
+
<MenuDialog v-if="$Data.menuVisible" v-model="$Data.menuVisible" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
66
|
+
|
|
67
|
+
<!-- 接口权限对话框组件 -->
|
|
68
|
+
<ApiDialog v-if="$Data.apiVisible" v-model="$Data.apiVisible" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
69
|
+
</template>
|
|
70
|
+
</PagedTableDetail>
|
|
89
71
|
</template>
|
|
90
72
|
|
|
91
73
|
<script setup lang="ts">
|
|
92
|
-
import { Button as TButton,
|
|
74
|
+
import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Tag as TTag } from "tdesign-vue-next";
|
|
93
75
|
import ILucidePlus from "~icons/lucide/plus";
|
|
94
76
|
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
95
77
|
import ILucidePencil from "~icons/lucide/pencil";
|
|
@@ -100,16 +82,11 @@ import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
|
100
82
|
import EditDialog from "./components/edit.vue";
|
|
101
83
|
import MenuDialog from "./components/menu.vue";
|
|
102
84
|
import ApiDialog from "./components/api.vue";
|
|
103
|
-
import
|
|
104
|
-
import { $Http } from "@/plugins/http";
|
|
85
|
+
import PagedTableDetail from "@/components/pagedTableDetail.vue";
|
|
105
86
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
106
87
|
|
|
107
88
|
// 响应式数据
|
|
108
89
|
const $Data = $ref({
|
|
109
|
-
tableData: [],
|
|
110
|
-
loading: false,
|
|
111
|
-
activeRowKeys: [],
|
|
112
|
-
currentRow: null,
|
|
113
90
|
columns: withDefaultColumns([
|
|
114
91
|
{ colKey: "name", title: "角色名称" },
|
|
115
92
|
{ colKey: "code", title: "角色代码", width: 150 },
|
|
@@ -120,12 +97,23 @@ const $Data = $ref({
|
|
|
120
97
|
{ colKey: "description", title: "描述" },
|
|
121
98
|
{ colKey: "operation", title: "操作" }
|
|
122
99
|
]),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
100
|
+
endpoints: {
|
|
101
|
+
list: {
|
|
102
|
+
path: "/addon/admin/role/list",
|
|
103
|
+
dropValues: [""]
|
|
104
|
+
},
|
|
105
|
+
delete: {
|
|
106
|
+
path: "/addon/admin/role/del",
|
|
107
|
+
idKey: "id",
|
|
108
|
+
confirm: (row) => {
|
|
109
|
+
return {
|
|
110
|
+
header: "确认删除",
|
|
111
|
+
body: `确认删除角色“${row.name}”吗?`,
|
|
112
|
+
confirmBtn: "删除",
|
|
113
|
+
status: "warning"
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
129
117
|
},
|
|
130
118
|
editVisible: false,
|
|
131
119
|
menuVisible: false,
|
|
@@ -134,140 +122,57 @@ const $Data = $ref({
|
|
|
134
122
|
rowData: {}
|
|
135
123
|
});
|
|
136
124
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (!Array.isArray(value)) return 0;
|
|
141
|
-
return value.filter((p) => typeof p === "string" && p.trim().length > 0).length;
|
|
142
|
-
},
|
|
143
|
-
async initData() {
|
|
144
|
-
await $Method.apiRoleList();
|
|
145
|
-
},
|
|
146
|
-
// 加载角色列表
|
|
147
|
-
async apiRoleList() {
|
|
148
|
-
$Data.loading = true;
|
|
149
|
-
try {
|
|
150
|
-
const res = await $Http.post(
|
|
151
|
-
"/addon/admin/role/list",
|
|
152
|
-
{
|
|
153
|
-
page: $Data.pagerConfig.currentPage,
|
|
154
|
-
limit: $Data.pagerConfig.limit
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
dropValues: [""]
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
$Data.tableData = res.data.lists || [];
|
|
161
|
-
$Data.pagerConfig.total = res.data.total || 0;
|
|
162
|
-
|
|
163
|
-
// 自动选中并高亮第一行
|
|
164
|
-
if ($Data.tableData.length > 0) {
|
|
165
|
-
$Data.currentRow = $Data.tableData[0];
|
|
166
|
-
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
167
|
-
} else {
|
|
168
|
-
$Data.currentRow = null;
|
|
169
|
-
$Data.activeRowKeys = [];
|
|
170
|
-
}
|
|
171
|
-
} catch (error) {
|
|
172
|
-
MessagePlugin.error("加载数据失败");
|
|
173
|
-
} finally {
|
|
174
|
-
$Data.loading = false;
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
// 删除角色
|
|
179
|
-
async apiRoleDel(row) {
|
|
180
|
-
let dialog = null;
|
|
181
|
-
let destroyed = false;
|
|
125
|
+
function onAdd(): void {
|
|
126
|
+
onAction("add", {});
|
|
127
|
+
}
|
|
182
128
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (dialog && typeof dialog.destroy === "function") {
|
|
187
|
-
dialog.destroy();
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
dialog = DialogPlugin.confirm({
|
|
192
|
-
header: "确认删除",
|
|
193
|
-
body: `确认删除角色“${row.name}”吗?`,
|
|
194
|
-
status: "warning",
|
|
195
|
-
confirmBtn: "删除",
|
|
196
|
-
cancelBtn: "取消",
|
|
197
|
-
onConfirm: async () => {
|
|
198
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
199
|
-
dialog.setConfirmLoading(true);
|
|
200
|
-
}
|
|
129
|
+
function onReload(reload: (options: { keepSelection?: boolean }) => void): void {
|
|
130
|
+
reload({ keepSelection: true });
|
|
131
|
+
}
|
|
201
132
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
});
|
|
206
|
-
MessagePlugin.success("删除成功");
|
|
207
|
-
destroy();
|
|
208
|
-
await $Method.apiRoleList();
|
|
209
|
-
} catch (error) {
|
|
210
|
-
MessagePlugin.error("删除失败");
|
|
211
|
-
} finally {
|
|
212
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
213
|
-
dialog.setConfirmLoading(false);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
onClose: () => {
|
|
218
|
-
destroy();
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
},
|
|
133
|
+
function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
|
|
134
|
+
reload({ keepSelection: true });
|
|
135
|
+
}
|
|
222
136
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
137
|
+
function getPathCount(value: unknown): number {
|
|
138
|
+
if (!Array.isArray(value)) return 0;
|
|
139
|
+
return value.filter((p) => typeof p === "string" && p.trim().length > 0).length;
|
|
140
|
+
}
|
|
227
141
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
$Data.pagerConfig.currentPage = currentPage;
|
|
231
|
-
$Method.apiRoleList();
|
|
232
|
-
},
|
|
142
|
+
function onAction(command: string, rowData: Record<string, unknown>): void {
|
|
143
|
+
$Data.actionType = command;
|
|
233
144
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
$Data.
|
|
238
|
-
|
|
239
|
-
},
|
|
145
|
+
if (command === "add") {
|
|
146
|
+
$Data.rowData = {};
|
|
147
|
+
} else {
|
|
148
|
+
$Data.rowData = Object.assign({}, rowData);
|
|
149
|
+
}
|
|
240
150
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
$Data.activeRowKeys = value;
|
|
248
|
-
// 更新当前高亮的行数据
|
|
249
|
-
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
250
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
251
|
-
}
|
|
252
|
-
},
|
|
151
|
+
if (command === "add" || command === "upd") {
|
|
152
|
+
$Data.editVisible = true;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
253
155
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
$Data.rowData = rowData;
|
|
258
|
-
if (command === "add" || command === "upd") {
|
|
259
|
-
$Data.editVisible = true;
|
|
260
|
-
} else if (command === "menu") {
|
|
261
|
-
$Data.menuVisible = true;
|
|
262
|
-
} else if (command === "api") {
|
|
263
|
-
$Data.apiVisible = true;
|
|
264
|
-
} else if (command === "del") {
|
|
265
|
-
$Method.apiRoleDel(rowData);
|
|
266
|
-
}
|
|
156
|
+
if (command === "menu") {
|
|
157
|
+
$Data.menuVisible = true;
|
|
158
|
+
return;
|
|
267
159
|
}
|
|
268
|
-
};
|
|
269
160
|
|
|
270
|
-
|
|
161
|
+
if (command === "api") {
|
|
162
|
+
$Data.apiVisible = true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function onDropdownAction(data: unknown, rowData: Record<string, unknown>, deleteRow: (row: Record<string, unknown>) => void): void {
|
|
167
|
+
const record = data as Record<string, unknown>;
|
|
168
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
169
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
170
|
+
if (cmd === "del") {
|
|
171
|
+
deleteRow(rowData);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
onAction(cmd, rowData);
|
|
175
|
+
}
|
|
271
176
|
</script>
|
|
272
177
|
|
|
273
178
|
<style scoped lang="scss">
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noEmit": true,
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"types": ["vite/client", "unplugin-icons/types/vue"],
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"paths": {
|
|
9
|
+
"@/*": ["../../admin/src/*"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"include": ["**/*.vue", "**/*.ts", "**/*.d.ts"],
|
|
13
|
+
"exclude": ["node_modules", "dist", "logs", "temp"]
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@befly-addon/admin",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.8.5",
|
|
4
|
+
"gitHead": "607fe5ea9c06653ec6da8a9e4175d1f9c7b98c13",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly - 管理后台功能组件",
|
|
7
7
|
"keywords": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"ua-parser-js": "^2.0.8"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"befly": "3.16.
|
|
57
|
+
"befly": "^3.16.4"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"befly": "^3.14.0"
|