@befly-addon/admin 1.8.2 → 1.8.4
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/config/dict/components/edit.vue +12 -6
- package/adminViews/config/dict/index.vue +97 -177
- package/adminViews/config/dictType/components/edit.vue +12 -7
- package/adminViews/config/dictType/index.vue +93 -185
- package/adminViews/config/system/components/edit.vue +7 -4
- package/adminViews/config/system/index.vue +122 -213
- package/adminViews/log/email/index.vue +92 -157
- package/adminViews/log/login/index.vue +44 -121
- package/adminViews/log/operate/index.vue +82 -153
- package/adminViews/login_1/index.vue +6 -9
- package/adminViews/people/admin/components/edit.vue +5 -2
- package/adminViews/people/admin/index.vue +77 -192
- package/adminViews/permission/role/components/api.vue +4 -1
- package/adminViews/permission/role/components/edit.vue +4 -1
- package/adminViews/permission/role/components/menu.vue +4 -1
- package/adminViews/permission/role/index.vue +118 -213
- package/package.json +3 -3
|
@@ -56,7 +56,10 @@ const $Prop = defineProps({
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
const $Emit = defineEmits
|
|
59
|
+
const $Emit = defineEmits<{
|
|
60
|
+
(e: "update:modelValue", value: boolean): void;
|
|
61
|
+
(e: "success"): void;
|
|
62
|
+
}>();
|
|
60
63
|
|
|
61
64
|
const $Data = $ref({
|
|
62
65
|
visible: false,
|
|
@@ -60,7 +60,10 @@ const $Prop = defineProps({
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
const $Emit = defineEmits
|
|
63
|
+
const $Emit = defineEmits<{
|
|
64
|
+
(e: "update:modelValue", value: boolean): void;
|
|
65
|
+
(e: "success"): void;
|
|
66
|
+
}>();
|
|
64
67
|
|
|
65
68
|
// 表单引用
|
|
66
69
|
const $From = $shallowRef({
|
|
@@ -57,7 +57,10 @@ const $Prop = defineProps({
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
const $Emit = defineEmits
|
|
60
|
+
const $Emit = defineEmits<{
|
|
61
|
+
(e: "update:modelValue", value: boolean): void;
|
|
62
|
+
(e: "success"): void;
|
|
63
|
+
}>();
|
|
61
64
|
|
|
62
65
|
const $Data = $ref({
|
|
63
66
|
visible: false,
|
|
@@ -1,95 +1,77 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<PagedTableDetailPage 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="$Method.onAdd">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<ILucidePlus />
|
|
7
|
+
</template>
|
|
8
|
+
</TButton>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<template #toolRight="scope">
|
|
12
|
+
<TButton shape="circle" @click="$Method.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
|
+
{{ $Method.getPathCount(row.menus) }}
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<template #apiCount="{ row }">
|
|
30
|
+
{{ $Method.getPathCount(row.apis) }}
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<template #operation="{ row, deleteRow }">
|
|
34
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.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="$Method.onDialogSuccess(scope.reload)" />
|
|
63
|
+
|
|
64
|
+
<!-- 菜单权限对话框组件 -->
|
|
65
|
+
<MenuDialog v-if="$Data.menuVisible" v-model="$Data.menuVisible" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
66
|
+
|
|
67
|
+
<!-- 接口权限对话框组件 -->
|
|
68
|
+
<ApiDialog v-if="$Data.apiVisible" v-model="$Data.apiVisible" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
69
|
+
</template>
|
|
70
|
+
</PagedTableDetailPage>
|
|
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 PagedTableDetailPage from "@/components/PagedTableDetailPage.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,
|
|
@@ -136,138 +124,55 @@ const $Data = $ref({
|
|
|
136
124
|
|
|
137
125
|
// 方法
|
|
138
126
|
const $Method = {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return value.filter((p) => typeof p === "string" && p.trim().length > 0).length;
|
|
127
|
+
onAdd() {
|
|
128
|
+
$Method.onAction("add", {});
|
|
142
129
|
},
|
|
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
130
|
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
}
|
|
131
|
+
onReload(reload) {
|
|
132
|
+
reload({ keepSelection: true });
|
|
176
133
|
},
|
|
177
134
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
let dialog = null;
|
|
181
|
-
let destroyed = false;
|
|
182
|
-
|
|
183
|
-
const destroy = () => {
|
|
184
|
-
if (destroyed) return;
|
|
185
|
-
destroyed = true;
|
|
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
|
-
}
|
|
201
|
-
|
|
202
|
-
try {
|
|
203
|
-
await $Http.post("/addon/admin/role/del", {
|
|
204
|
-
id: row.id
|
|
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
|
-
});
|
|
135
|
+
onDialogSuccess(reload) {
|
|
136
|
+
reload({ keepSelection: true });
|
|
221
137
|
},
|
|
222
138
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
139
|
+
getPathCount(value) {
|
|
140
|
+
if (!Array.isArray(value)) return 0;
|
|
141
|
+
return value.filter((p) => typeof p === "string" && p.trim().length > 0).length;
|
|
226
142
|
},
|
|
143
|
+
onAction(command, rowData) {
|
|
144
|
+
$Data.actionType = command;
|
|
227
145
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
146
|
+
if (command === "add") {
|
|
147
|
+
$Data.rowData = {};
|
|
148
|
+
} else {
|
|
149
|
+
$Data.rowData = Object.assign({}, rowData);
|
|
150
|
+
}
|
|
233
151
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
$Method.apiRoleList();
|
|
239
|
-
},
|
|
152
|
+
if (command === "add" || command === "upd") {
|
|
153
|
+
$Data.editVisible = true;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
240
156
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// 禁止取消高亮:如果新值为空,保持当前选中
|
|
244
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
157
|
+
if (command === "menu") {
|
|
158
|
+
$Data.menuVisible = true;
|
|
245
159
|
return;
|
|
246
160
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
161
|
+
|
|
162
|
+
if (command === "api") {
|
|
163
|
+
$Data.apiVisible = true;
|
|
251
164
|
}
|
|
252
165
|
},
|
|
253
166
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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);
|
|
167
|
+
onDropdownAction(data, rowData, deleteRow) {
|
|
168
|
+
const cmd = data && data.value ? String(data.value) : "";
|
|
169
|
+
if (cmd === "del") {
|
|
170
|
+
deleteRow(rowData);
|
|
171
|
+
return;
|
|
266
172
|
}
|
|
173
|
+
$Method.onAction(cmd, rowData);
|
|
267
174
|
}
|
|
268
175
|
};
|
|
269
|
-
|
|
270
|
-
$Method.initData();
|
|
271
176
|
</script>
|
|
272
177
|
|
|
273
178
|
<style scoped lang="scss">
|
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.4",
|
|
4
|
+
"gitHead": "9823cc29996ba9950dd08bfd72856e3b65815039",
|
|
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"
|