@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
|
@@ -1,88 +1,81 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<PagedTableDetailPage class="page-sys-config page-table" :columns="$Data.columns" :endpoints="$Data.endpoints" :table-slot-names="['isSystem', 'valueType', 'state']">
|
|
3
|
+
<template #toolLeft="scope">
|
|
4
|
+
<TButton theme="primary" @click="$Method.onAdd">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<ILucidePlus />
|
|
7
|
+
</template>
|
|
8
|
+
新增配置
|
|
9
|
+
</TButton>
|
|
10
|
+
<TSelect v-model="$Data.filter.group" placeholder="配置分组" clearable style="width: 150px" @change="$Method.handleFilter(scope.reload)">
|
|
11
|
+
<TOption v-for="item in $Data.groupOptions" :key="item" :label="item" :value="item" />
|
|
12
|
+
</TSelect>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<template #toolRight="scope">
|
|
16
|
+
<TButton shape="circle" @click="$Method.onReload(scope.reload)">
|
|
17
|
+
<template #icon>
|
|
18
|
+
<ILucideRotateCw />
|
|
19
|
+
</template>
|
|
20
|
+
</TButton>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<template #isSystem="{ row }">
|
|
24
|
+
<TTag v-if="row.isSystem === 1" shape="round" theme="warning" variant="light-outline">系统</TTag>
|
|
25
|
+
<TTag v-else shape="round" variant="light-outline">自定义</TTag>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<template #valueType="{ row }">
|
|
29
|
+
<TTag shape="round" variant="light-outline">{{ row.valueType }}</TTag>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<template #state="{ row }">
|
|
33
|
+
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
34
|
+
<TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<template #operation="{ row, deleteRow }">
|
|
38
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
|
|
39
|
+
<TButton theme="primary" size="small">
|
|
40
|
+
操作
|
|
41
|
+
<template #suffix><ILucideChevronDown /></template>
|
|
10
42
|
</TButton>
|
|
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
|
-
|
|
43
|
-
</TButton>
|
|
44
|
-
<TDropdownMenu slot="dropdown">
|
|
45
|
-
<TDropdownItem value="upd">
|
|
46
|
-
<ILucidePencil />
|
|
47
|
-
编辑
|
|
48
|
-
</TDropdownItem>
|
|
49
|
-
<TDropdownItem v-if="row.isSystem !== 1" value="del" :divider="true">
|
|
50
|
-
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
51
|
-
删除
|
|
52
|
-
</TDropdownItem>
|
|
53
|
-
</TDropdownMenu>
|
|
54
|
-
</TDropdown>
|
|
55
|
-
</template>
|
|
56
|
-
</TTable>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<div class="main-detail">
|
|
60
|
-
<DetailPanel :data="$Data.currentRow" :fields="$Data.detailFields">
|
|
61
|
-
<template #isSystem="{ value }">
|
|
62
|
-
<TTag v-if="value === 1" shape="round" theme="warning" variant="light-outline">系统配置</TTag>
|
|
63
|
-
<TTag v-else shape="round" variant="light-outline">自定义配置</TTag>
|
|
64
|
-
</template>
|
|
65
|
-
<template #valueType="{ value }">
|
|
66
|
-
<TTag shape="round" variant="light-outline">{{ value }}</TTag>
|
|
67
|
-
</template>
|
|
68
|
-
<template #value="{ value }">
|
|
69
|
-
<pre class="config-value">{{ value }}</pre>
|
|
70
|
-
</template>
|
|
71
|
-
</DetailPanel>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="main-page">
|
|
76
|
-
<TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<!-- 编辑对话框 -->
|
|
80
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.apiConfigList" />
|
|
81
|
-
</div>
|
|
43
|
+
<TDropdownMenu slot="dropdown">
|
|
44
|
+
<TDropdownItem value="upd">
|
|
45
|
+
<ILucidePencil />
|
|
46
|
+
编辑
|
|
47
|
+
</TDropdownItem>
|
|
48
|
+
<TDropdownItem v-if="row.isSystem !== 1" value="del" :divider="true">
|
|
49
|
+
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
50
|
+
删除
|
|
51
|
+
</TDropdownItem>
|
|
52
|
+
</TDropdownMenu>
|
|
53
|
+
</TDropdown>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<template #detail="scope">
|
|
57
|
+
<DetailPanel :data="scope.currentRow" :fields="$Data.detailFields">
|
|
58
|
+
<template #isSystem="slotScope">
|
|
59
|
+
<TTag v-if="slotScope.value === 1" shape="round" theme="warning" variant="light-outline">系统配置</TTag>
|
|
60
|
+
<TTag v-else shape="round" variant="light-outline">自定义配置</TTag>
|
|
61
|
+
</template>
|
|
62
|
+
<template #valueType="slotScope">
|
|
63
|
+
<TTag shape="round" variant="light-outline">{{ slotScope.value }}</TTag>
|
|
64
|
+
</template>
|
|
65
|
+
<template #value="slotScope">
|
|
66
|
+
<pre class="config-value">{{ slotScope.value }}</pre>
|
|
67
|
+
</template>
|
|
68
|
+
</DetailPanel>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<template #dialogs="scope">
|
|
72
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
73
|
+
</template>
|
|
74
|
+
</PagedTableDetailPage>
|
|
82
75
|
</template>
|
|
83
76
|
|
|
84
77
|
<script setup lang="ts">
|
|
85
|
-
import { Button as TButton,
|
|
78
|
+
import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Option as TOption, Select as TSelect, Tag as TTag } from "tdesign-vue-next";
|
|
86
79
|
import ILucidePlus from "~icons/lucide/plus";
|
|
87
80
|
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
88
81
|
import ILucidePencil from "~icons/lucide/pencil";
|
|
@@ -90,13 +83,11 @@ import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
|
90
83
|
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
91
84
|
import EditDialog from "./components/edit.vue";
|
|
92
85
|
import DetailPanel from "@/components/DetailPanel.vue";
|
|
93
|
-
import
|
|
86
|
+
import PagedTableDetailPage from "@/components/PagedTableDetailPage.vue";
|
|
94
87
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
95
88
|
|
|
96
89
|
// 响应式数据
|
|
97
90
|
const $Data = $ref({
|
|
98
|
-
tableData: [],
|
|
99
|
-
loading: false,
|
|
100
91
|
columns: withDefaultColumns([
|
|
101
92
|
{ colKey: "name", title: "配置名称", fixed: "left", width: 150 },
|
|
102
93
|
{ colKey: "code", title: "配置代码", ellipsis: true },
|
|
@@ -118,13 +109,32 @@ const $Data = $ref({
|
|
|
118
109
|
{ colKey: "isSystem", title: "配置类型" },
|
|
119
110
|
{ colKey: "description", title: "描述说明" }
|
|
120
111
|
],
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
endpoints: {
|
|
113
|
+
list: {
|
|
114
|
+
path: "/addon/admin/sysConfig/list",
|
|
115
|
+
dropValues: [0, ""],
|
|
116
|
+
dropKeyValue: {
|
|
117
|
+
group: [""]
|
|
118
|
+
},
|
|
119
|
+
buildData: () => {
|
|
120
|
+
return {
|
|
121
|
+
group: $Data.filter.group
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
delete: {
|
|
126
|
+
path: "/addon/admin/sysConfig/del",
|
|
127
|
+
idKey: "id",
|
|
128
|
+
confirm: (row) => {
|
|
129
|
+
return {
|
|
130
|
+
header: "确认删除",
|
|
131
|
+
body: `确认删除配置“${row.name}”吗?`,
|
|
132
|
+
confirmBtn: "删除",
|
|
133
|
+
status: "warning"
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
125
137
|
},
|
|
126
|
-
currentRow: null,
|
|
127
|
-
activeRowKeys: [],
|
|
128
138
|
editVisible: false,
|
|
129
139
|
actionType: "add",
|
|
130
140
|
rowData: {},
|
|
@@ -136,145 +146,44 @@ const $Data = $ref({
|
|
|
136
146
|
|
|
137
147
|
// 方法
|
|
138
148
|
const $Method = {
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
onAdd() {
|
|
150
|
+
$Method.onAction("add", {});
|
|
141
151
|
},
|
|
142
152
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
$Data.loading = true;
|
|
146
|
-
try {
|
|
147
|
-
const res = await $Http.post(
|
|
148
|
-
"/addon/admin/sysConfig/list",
|
|
149
|
-
{
|
|
150
|
-
page: $Data.pagerConfig.currentPage,
|
|
151
|
-
limit: $Data.pagerConfig.limit,
|
|
152
|
-
group: $Data.filter.group
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
dropValues: [0, ""],
|
|
156
|
-
dropKeyValue: {
|
|
157
|
-
page: [],
|
|
158
|
-
limit: [],
|
|
159
|
-
group: [""]
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
$Data.tableData = res.data.lists || [];
|
|
164
|
-
$Data.pagerConfig.total = res.data.total || 0;
|
|
165
|
-
|
|
166
|
-
if ($Data.tableData.length > 0) {
|
|
167
|
-
$Data.currentRow = $Data.tableData[0];
|
|
168
|
-
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
169
|
-
} else {
|
|
170
|
-
$Data.currentRow = null;
|
|
171
|
-
$Data.activeRowKeys = [];
|
|
172
|
-
}
|
|
173
|
-
} catch (error) {
|
|
174
|
-
MessagePlugin.error("加载数据失败");
|
|
175
|
-
} finally {
|
|
176
|
-
$Data.loading = false;
|
|
177
|
-
}
|
|
153
|
+
handleFilter(reload) {
|
|
154
|
+
reload({ keepSelection: false, resetPage: true });
|
|
178
155
|
},
|
|
179
156
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (row.isSystem === 1) {
|
|
183
|
-
MessagePlugin.warning("系统配置不允许删除");
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
let dialog = null;
|
|
188
|
-
let destroyed = false;
|
|
189
|
-
|
|
190
|
-
const destroy = () => {
|
|
191
|
-
if (destroyed) return;
|
|
192
|
-
destroyed = true;
|
|
193
|
-
if (dialog && typeof dialog.destroy === "function") {
|
|
194
|
-
dialog.destroy();
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
dialog = DialogPlugin.confirm({
|
|
199
|
-
header: "确认删除",
|
|
200
|
-
body: `确认删除配置“${row.name}”吗?`,
|
|
201
|
-
status: "warning",
|
|
202
|
-
confirmBtn: "删除",
|
|
203
|
-
cancelBtn: "取消",
|
|
204
|
-
onConfirm: async () => {
|
|
205
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
206
|
-
dialog.setConfirmLoading(true);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
try {
|
|
210
|
-
await $Http.post("/addon/admin/sysConfig/del", {
|
|
211
|
-
id: row.id
|
|
212
|
-
});
|
|
213
|
-
MessagePlugin.success("删除成功");
|
|
214
|
-
destroy();
|
|
215
|
-
await $Method.apiConfigList();
|
|
216
|
-
} catch (error) {
|
|
217
|
-
MessagePlugin.error("删除失败");
|
|
218
|
-
} finally {
|
|
219
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
220
|
-
dialog.setConfirmLoading(false);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
onClose: () => {
|
|
225
|
-
destroy();
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
// 筛选
|
|
231
|
-
handleFilter() {
|
|
232
|
-
$Data.pagerConfig.currentPage = 1;
|
|
233
|
-
$Method.apiConfigList();
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
// 刷新
|
|
237
|
-
handleRefresh() {
|
|
238
|
-
$Method.apiConfigList();
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
// 分页改变
|
|
242
|
-
onPageChange(currentPage) {
|
|
243
|
-
$Data.pagerConfig.currentPage = currentPage;
|
|
244
|
-
$Method.apiConfigList();
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
// 每页条数改变
|
|
248
|
-
handleSizeChange(pageSize) {
|
|
249
|
-
$Data.pagerConfig.limit = pageSize;
|
|
250
|
-
$Data.pagerConfig.currentPage = 1;
|
|
251
|
-
$Method.apiConfigList();
|
|
157
|
+
onReload(reload) {
|
|
158
|
+
reload({ keepSelection: true });
|
|
252
159
|
},
|
|
253
160
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
$Data.activeRowKeys = value;
|
|
260
|
-
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
261
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
262
|
-
}
|
|
161
|
+
onDialogSuccess(reload) {
|
|
162
|
+
reload({ keepSelection: true });
|
|
263
163
|
},
|
|
264
164
|
|
|
265
|
-
// 操作菜单点击
|
|
266
165
|
onAction(command, rowData) {
|
|
267
166
|
$Data.actionType = command;
|
|
268
|
-
|
|
167
|
+
if (command === "add") {
|
|
168
|
+
$Data.rowData = {};
|
|
169
|
+
} else {
|
|
170
|
+
$Data.rowData = Object.assign({}, rowData);
|
|
171
|
+
}
|
|
172
|
+
|
|
269
173
|
if (command === "add" || command === "upd") {
|
|
270
174
|
$Data.editVisible = true;
|
|
271
|
-
} else if (command === "del") {
|
|
272
|
-
$Method.apiConfigDel(rowData);
|
|
273
175
|
}
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
onDropdownAction(data, rowData, deleteRow) {
|
|
179
|
+
const cmd = data && data.value ? String(data.value) : "";
|
|
180
|
+
if (cmd === "del") {
|
|
181
|
+
deleteRow(rowData);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
$Method.onAction(cmd, rowData);
|
|
274
185
|
}
|
|
275
186
|
};
|
|
276
|
-
|
|
277
|
-
$Method.initData();
|
|
278
187
|
</script>
|
|
279
188
|
|
|
280
189
|
<style scoped lang="scss">
|