@befly-addon/admin 1.8.1 → 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,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TDialog v-model:visible="visible" :header="actionType === 'add' ? '添加字典项' : '编辑字典项'" width="600px" @confirm="$Method.handleSubmit" @close="$Method.handleClose">
|
|
3
|
-
<TForm
|
|
3
|
+
<TForm :data="$Data.formData" :rules="$Data.rules" label-width="100px" :ref="(el) => ($From.form = el)">
|
|
4
4
|
<TFormItem label="字典类型" name="typeCode">
|
|
5
5
|
<TSelect v-model="$Data.formData.typeCode" placeholder="请选择字典类型" filterable>
|
|
6
6
|
<TOption v-for="item in typeList" :key="item.code" :value="item.code" :label="item.name" />
|
|
@@ -35,14 +35,19 @@ const props = defineProps({
|
|
|
35
35
|
typeList: Array
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const $Emit = defineEmits<{
|
|
39
|
+
(e: "update:modelValue", value: boolean): void;
|
|
40
|
+
(e: "success"): void;
|
|
41
|
+
}>();
|
|
39
42
|
|
|
40
43
|
const visible = computed({
|
|
41
44
|
get: () => props.modelValue,
|
|
42
|
-
set: (val) =>
|
|
45
|
+
set: (val) => $Emit("update:modelValue", val)
|
|
43
46
|
});
|
|
44
47
|
|
|
45
|
-
const
|
|
48
|
+
const $From = $shallowRef({
|
|
49
|
+
form: null
|
|
50
|
+
});
|
|
46
51
|
|
|
47
52
|
const $Data = $ref({
|
|
48
53
|
formData: {
|
|
@@ -62,7 +67,8 @@ const $Data = $ref({
|
|
|
62
67
|
const $Method = {
|
|
63
68
|
async handleSubmit() {
|
|
64
69
|
try {
|
|
65
|
-
const valid = await
|
|
70
|
+
const valid = await $From.form.validate();
|
|
71
|
+
if (valid !== true) return;
|
|
66
72
|
const apiUrl = props.actionType === "add" ? "/addon/admin/dict/ins" : "/addon/admin/dict/upd";
|
|
67
73
|
const params = {
|
|
68
74
|
typeCode: $Data.formData.typeCode,
|
|
@@ -79,7 +85,7 @@ const $Method = {
|
|
|
79
85
|
if (res.code === 0) {
|
|
80
86
|
MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
|
|
81
87
|
visible.value = false;
|
|
82
|
-
|
|
88
|
+
$Emit("success");
|
|
83
89
|
} else {
|
|
84
90
|
MessagePlugin.error(res.msg || "操作失败");
|
|
85
91
|
}
|
|
@@ -1,79 +1,58 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
<div class="right">
|
|
12
|
-
<TSelect v-model="$Data.searchTypeCode" placeholder="请选择字典类型" clearable filterable @change="$Method.handleSearch">
|
|
13
|
-
<TOption v-for="item in $Data.typeList" :key="item.code" :value="item.code" :label="item.name" />
|
|
14
|
-
</TSelect>
|
|
15
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索键/标签" clearable @enter="$Method.handleSearch" @clear="$Method.handleSearch">
|
|
16
|
-
<template #suffix-icon>
|
|
17
|
-
<ILucideSearch />
|
|
18
|
-
</template>
|
|
19
|
-
</TInput>
|
|
20
|
-
<TButton shape="circle" @click="$Method.handleRefresh">
|
|
21
|
-
<template #icon>
|
|
22
|
-
<ILucideRotateCw />
|
|
23
|
-
</template>
|
|
24
|
-
</TButton>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="main-content">
|
|
28
|
-
<div class="main-table">
|
|
29
|
-
<TTable
|
|
30
|
-
:data="$Data.tableData"
|
|
31
|
-
:columns="$Data.columns"
|
|
32
|
-
:loading="$Data.loading"
|
|
33
|
-
:active-row-keys="$Data.activeRowKeys"
|
|
34
|
-
row-key="id"
|
|
35
|
-
height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
|
|
36
|
-
active-row-type="single"
|
|
37
|
-
@active-change="$Method.onActiveChange"
|
|
38
|
-
>
|
|
39
|
-
<template #operation="{ row }">
|
|
40
|
-
<TDropdown trigger="click" placement="bottom-right" @click="(data) => $Method.onAction(data.value, row)">
|
|
41
|
-
<TButton theme="primary" size="small">
|
|
42
|
-
操作
|
|
43
|
-
<template #suffix> <ILucideChevronDown /></template>
|
|
44
|
-
</TButton>
|
|
45
|
-
<TDropdownMenu slot="dropdown">
|
|
46
|
-
<TDropdownItem value="upd">
|
|
47
|
-
<ILucidePencil />
|
|
48
|
-
编辑
|
|
49
|
-
</TDropdownItem>
|
|
50
|
-
<TDropdownItem value="del" :divider="true">
|
|
51
|
-
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
52
|
-
删除
|
|
53
|
-
</TDropdownItem>
|
|
54
|
-
</TDropdownMenu>
|
|
55
|
-
</TDropdown>
|
|
56
|
-
</template>
|
|
57
|
-
</TTable>
|
|
58
|
-
</div>
|
|
2
|
+
<PagedTableDetailPage class="page-dict page-table" :columns="$Data.columns" :endpoints="$Data.endpoints">
|
|
3
|
+
<template #toolLeft>
|
|
4
|
+
<TButton theme="primary" @click="$Method.onAdd">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<ILucidePlus />
|
|
7
|
+
</template>
|
|
8
|
+
</TButton>
|
|
9
|
+
</template>
|
|
59
10
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
11
|
+
<template #toolRight="scope">
|
|
12
|
+
<TSelect v-model="$Data.searchTypeCode" placeholder="请选择字典类型" clearable filterable @change="$Method.handleSearch(scope.reload)">
|
|
13
|
+
<TOption v-for="item in $Data.typeList" :key="item.code" :value="item.code" :label="item.name" />
|
|
14
|
+
</TSelect>
|
|
15
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索键/标签" clearable @enter="$Method.handleSearch(scope.reload)" @clear="$Method.handleSearch(scope.reload)">
|
|
16
|
+
<template #suffix-icon>
|
|
17
|
+
<ILucideSearch />
|
|
18
|
+
</template>
|
|
19
|
+
</TInput>
|
|
20
|
+
<TButton shape="circle" @click="$Method.handleRefresh(scope.reload)">
|
|
21
|
+
<template #icon>
|
|
22
|
+
<ILucideRotateCw />
|
|
23
|
+
</template>
|
|
24
|
+
</TButton>
|
|
25
|
+
</template>
|
|
64
26
|
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
|
|
27
|
+
<template #operation="{ row, deleteRow }">
|
|
28
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
|
|
29
|
+
<TButton theme="primary" size="small">
|
|
30
|
+
操作
|
|
31
|
+
<template #suffix> <ILucideChevronDown /></template>
|
|
32
|
+
</TButton>
|
|
33
|
+
<TDropdownMenu slot="dropdown">
|
|
34
|
+
<TDropdownItem value="upd">
|
|
35
|
+
<ILucidePencil />
|
|
36
|
+
编辑
|
|
37
|
+
</TDropdownItem>
|
|
38
|
+
<TDropdownItem value="del" :divider="true">
|
|
39
|
+
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
40
|
+
删除
|
|
41
|
+
</TDropdownItem>
|
|
42
|
+
</TDropdownMenu>
|
|
43
|
+
</TDropdown>
|
|
44
|
+
</template>
|
|
68
45
|
|
|
69
|
-
<
|
|
70
|
-
|
|
46
|
+
<template #dialogs="scope">
|
|
47
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" :type-list="$Data.typeList" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
48
|
+
</template>
|
|
49
|
+
</PagedTableDetailPage>
|
|
71
50
|
</template>
|
|
72
51
|
|
|
73
52
|
<script setup lang="ts">
|
|
74
53
|
import { onMounted } from "vue";
|
|
75
54
|
|
|
76
|
-
import { Button as TButton,
|
|
55
|
+
import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Input as TInput, Option as TOption, Select as TSelect, MessagePlugin } from "tdesign-vue-next";
|
|
77
56
|
import ILucidePlus from "~icons/lucide/plus";
|
|
78
57
|
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
79
58
|
import ILucideSearch from "~icons/lucide/search";
|
|
@@ -81,16 +60,12 @@ import ILucidePencil from "~icons/lucide/pencil";
|
|
|
81
60
|
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
82
61
|
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
83
62
|
import EditDialog from "./components/edit.vue";
|
|
84
|
-
import DetailPanel from "@/components/DetailPanel.vue";
|
|
85
63
|
import { $Http } from "@/plugins/http";
|
|
64
|
+
import PagedTableDetailPage from "@/components/PagedTableDetailPage.vue";
|
|
86
65
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
87
66
|
|
|
88
67
|
const $Data = $ref({
|
|
89
|
-
tableData: [],
|
|
90
68
|
typeList: [],
|
|
91
|
-
loading: false,
|
|
92
|
-
activeRowKeys: [],
|
|
93
|
-
currentRow: null,
|
|
94
69
|
searchTypeCode: "",
|
|
95
70
|
searchKeyword: "",
|
|
96
71
|
columns: withDefaultColumns([
|
|
@@ -102,12 +77,29 @@ const $Data = $ref({
|
|
|
102
77
|
{ colKey: "remark", title: "备注" },
|
|
103
78
|
{ colKey: "operation", title: "操作" }
|
|
104
79
|
]),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
80
|
+
endpoints: {
|
|
81
|
+
list: {
|
|
82
|
+
path: "/addon/admin/dict/list",
|
|
83
|
+
dropValues: [""],
|
|
84
|
+
buildData: () => {
|
|
85
|
+
return {
|
|
86
|
+
typeCode: $Data.searchTypeCode,
|
|
87
|
+
keyword: $Data.searchKeyword
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
delete: {
|
|
92
|
+
path: "/addon/admin/dict/del",
|
|
93
|
+
idKey: "id",
|
|
94
|
+
confirm: (row) => {
|
|
95
|
+
return {
|
|
96
|
+
header: "确认删除",
|
|
97
|
+
body: `确认删除字典项“${row.label}”吗?`,
|
|
98
|
+
confirmBtn: "删除",
|
|
99
|
+
status: "warning"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
111
103
|
},
|
|
112
104
|
editVisible: false,
|
|
113
105
|
actionType: "add",
|
|
@@ -115,9 +107,16 @@ const $Data = $ref({
|
|
|
115
107
|
});
|
|
116
108
|
|
|
117
109
|
const $Method = {
|
|
110
|
+
onAdd() {
|
|
111
|
+
$Method.onAction("add", {});
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
onDialogSuccess(reload) {
|
|
115
|
+
reload({ keepSelection: true });
|
|
116
|
+
},
|
|
117
|
+
|
|
118
118
|
async initData() {
|
|
119
119
|
await $Method.apiDictTypeAll();
|
|
120
|
-
await $Method.apiDictList();
|
|
121
120
|
},
|
|
122
121
|
async apiDictTypeAll() {
|
|
123
122
|
try {
|
|
@@ -133,118 +132,39 @@ const $Method = {
|
|
|
133
132
|
MessagePlugin.error("加载数据失败");
|
|
134
133
|
}
|
|
135
134
|
},
|
|
136
|
-
async apiDictList() {
|
|
137
|
-
$Data.loading = true;
|
|
138
|
-
try {
|
|
139
|
-
const res = await $Http.post(
|
|
140
|
-
"/addon/admin/dict/list",
|
|
141
|
-
{
|
|
142
|
-
page: $Data.pagerConfig.currentPage,
|
|
143
|
-
limit: $Data.pagerConfig.limit,
|
|
144
|
-
typeCode: $Data.searchTypeCode,
|
|
145
|
-
keyword: $Data.searchKeyword
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
dropValues: [""]
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
$Data.tableData = res.data.lists || [];
|
|
152
|
-
$Data.pagerConfig.total = res.data.total || 0;
|
|
153
135
|
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
}
|
|
136
|
+
handleSearch(reload) {
|
|
137
|
+
reload({ keepSelection: false, resetPage: true });
|
|
166
138
|
},
|
|
167
|
-
async apiDictDel(row) {
|
|
168
|
-
let dialog = null;
|
|
169
|
-
let destroyed = false;
|
|
170
|
-
|
|
171
|
-
const destroy = () => {
|
|
172
|
-
if (destroyed) return;
|
|
173
|
-
destroyed = true;
|
|
174
|
-
if (dialog && typeof dialog.destroy === "function") {
|
|
175
|
-
dialog.destroy();
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
dialog = DialogPlugin.confirm({
|
|
180
|
-
header: "确认删除",
|
|
181
|
-
body: `确认删除字典项“${row.label}”吗?`,
|
|
182
|
-
status: "warning",
|
|
183
|
-
confirmBtn: "删除",
|
|
184
|
-
cancelBtn: "取消",
|
|
185
|
-
onConfirm: async () => {
|
|
186
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
187
|
-
dialog.setConfirmLoading(true);
|
|
188
|
-
}
|
|
189
139
|
|
|
190
|
-
|
|
191
|
-
await $Http.post("/addon/admin/dict/del", {
|
|
192
|
-
id: row.id
|
|
193
|
-
});
|
|
194
|
-
MessagePlugin.success("删除成功");
|
|
195
|
-
destroy();
|
|
196
|
-
await $Method.apiDictList();
|
|
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
|
-
handleSearch() {
|
|
211
|
-
$Data.pagerConfig.currentPage = 1;
|
|
212
|
-
$Method.apiDictList();
|
|
213
|
-
},
|
|
214
|
-
handleRefresh() {
|
|
140
|
+
handleRefresh(reload) {
|
|
215
141
|
$Data.searchTypeCode = "";
|
|
216
142
|
$Data.searchKeyword = "";
|
|
217
|
-
|
|
218
|
-
$Method.apiDictList();
|
|
219
|
-
},
|
|
220
|
-
onPageChange({ currentPage }) {
|
|
221
|
-
$Data.pagerConfig.currentPage = currentPage;
|
|
222
|
-
$Method.apiDictList();
|
|
223
|
-
},
|
|
224
|
-
handleSizeChange({ pageSize }) {
|
|
225
|
-
$Data.pagerConfig.limit = pageSize;
|
|
226
|
-
$Data.pagerConfig.currentPage = 1;
|
|
227
|
-
$Method.apiDictList();
|
|
228
|
-
},
|
|
229
|
-
onActiveChange(value, context) {
|
|
230
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
$Data.activeRowKeys = value;
|
|
234
|
-
$Data.currentRow = context.currentRowData;
|
|
143
|
+
reload({ keepSelection: false, resetPage: true });
|
|
235
144
|
},
|
|
145
|
+
|
|
236
146
|
onAction(type, row) {
|
|
237
147
|
if (type === "add") {
|
|
238
148
|
$Data.actionType = "add";
|
|
239
149
|
$Data.rowData = {};
|
|
240
150
|
$Data.editVisible = true;
|
|
241
|
-
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (type === "upd") {
|
|
242
155
|
$Data.actionType = "upd";
|
|
243
|
-
$Data.rowData = {
|
|
156
|
+
$Data.rowData = Object.assign({}, row);
|
|
244
157
|
$Data.editVisible = true;
|
|
245
|
-
} else if (type === "del") {
|
|
246
|
-
$Method.apiDictDel(row);
|
|
247
158
|
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
onDropdownAction(data, row, deleteRow) {
|
|
162
|
+
const cmd = data && data.value ? String(data.value) : "";
|
|
163
|
+
if (cmd === "del") {
|
|
164
|
+
deleteRow(row);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
$Method.onAction(cmd, row);
|
|
248
168
|
}
|
|
249
169
|
};
|
|
250
170
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TDialog v-model:visible="visible" :header="actionType === 'add' ? '添加字典类型' : '编辑字典类型'" width="600px" @confirm="$Method.handleSubmit" @close="$Method.handleClose">
|
|
3
|
-
<TForm
|
|
3
|
+
<TForm :data="$Data.formData" :rules="$Data.rules" label-width="100px" :ref="(el) => ($From.form = el)">
|
|
4
4
|
<TFormItem label="类型代码" name="code">
|
|
5
5
|
<TInput v-model="$Data.formData.code" placeholder="请输入类型代码(英文/数字/下划线)" :disabled="actionType === 'upd'" />
|
|
6
6
|
</TFormItem>
|
|
@@ -29,14 +29,19 @@ const props = defineProps({
|
|
|
29
29
|
rowData: Object
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const $Emit = defineEmits<{
|
|
33
|
+
(e: "update:modelValue", value: boolean): void;
|
|
34
|
+
(e: "success"): void;
|
|
35
|
+
}>();
|
|
33
36
|
|
|
34
37
|
const visible = computed({
|
|
35
38
|
get: () => props.modelValue,
|
|
36
|
-
set: (val) =>
|
|
39
|
+
set: (val) => $Emit("update:modelValue", val)
|
|
37
40
|
});
|
|
38
41
|
|
|
39
|
-
const
|
|
42
|
+
const $From = $shallowRef({
|
|
43
|
+
form: null
|
|
44
|
+
});
|
|
40
45
|
|
|
41
46
|
const $Data = $ref({
|
|
42
47
|
formData: {
|
|
@@ -53,8 +58,8 @@ const $Data = $ref({
|
|
|
53
58
|
|
|
54
59
|
const $Method = {
|
|
55
60
|
async handleSubmit() {
|
|
56
|
-
const valid = await
|
|
57
|
-
if (
|
|
61
|
+
const valid = await $From.form.validate();
|
|
62
|
+
if (valid !== true) return;
|
|
58
63
|
|
|
59
64
|
try {
|
|
60
65
|
const apiUrl = props.actionType === "add" ? "/addon/admin/dictType/ins" : "/addon/admin/dictType/upd";
|
|
@@ -72,7 +77,7 @@ const $Method = {
|
|
|
72
77
|
if (res.code === 0) {
|
|
73
78
|
MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
|
|
74
79
|
visible.value = false;
|
|
75
|
-
|
|
80
|
+
$Emit("success");
|
|
76
81
|
} else {
|
|
77
82
|
MessagePlugin.error(res.msg || "操作失败");
|
|
78
83
|
}
|