@befly-addon/admin 1.1.34 → 1.2.0
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/apis/admin/cacheRefresh.ts +2 -2
- package/apis/menu/all.ts +8 -9
- package/apis/menu/list.ts +1 -2
- package/apis/role/apiSave.ts +3 -3
- package/apis/role/apis.ts +3 -3
- package/apis/role/menuSave.ts +2 -2
- package/apis/role/menus.ts +3 -3
- package/package.json +21 -21
- package/plugins/email.ts +3 -8
- package/tables/api.json +1 -20
- package/tables/menu.json +6 -11
- package/tables/role.json +4 -4
- package/views/403_1/index.vue +0 -75
- package/views/config/dict/components/edit.vue +0 -109
- package/views/config/dict/index.vue +0 -266
- package/views/config/dictType/components/edit.vue +0 -100
- package/views/config/dictType/index.vue +0 -244
- package/views/config/index.vue +0 -12
- package/views/config/system/components/edit.vue +0 -171
- package/views/config/system/index.vue +0 -286
- package/views/index/components/addonList.vue +0 -132
- package/views/index/components/environmentInfo.vue +0 -100
- package/views/index/components/operationLogs.vue +0 -112
- package/views/index/components/performanceMetrics.vue +0 -145
- package/views/index/components/quickActions.vue +0 -30
- package/views/index/components/serviceStatus.vue +0 -192
- package/views/index/components/systemNotifications.vue +0 -137
- package/views/index/components/systemOverview.vue +0 -190
- package/views/index/components/systemResources.vue +0 -111
- package/views/index/components/userInfo.vue +0 -204
- package/views/index/index.vue +0 -74
- package/views/log/email/index.vue +0 -292
- package/views/log/index.vue +0 -12
- package/views/log/login/index.vue +0 -187
- package/views/log/operate/index.vue +0 -249
- package/views/login_1/index.vue +0 -415
- package/views/people/admin/components/edit.vue +0 -168
- package/views/people/admin/index.vue +0 -240
- package/views/people/index.vue +0 -12
- package/views/permission/api/index.vue +0 -149
- package/views/permission/index.vue +0 -12
- package/views/permission/menu/index.vue +0 -128
- package/views/permission/role/components/api.vue +0 -261
- package/views/permission/role/components/edit.vue +0 -142
- package/views/permission/role/components/menu.vue +0 -116
- package/views/permission/role/index.vue +0 -263
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="page-dict 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
|
-
<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>
|
|
59
|
-
|
|
60
|
-
<div class="main-detail">
|
|
61
|
-
<DetailPanel :data="$Data.currentRow" :fields="$Data.columns" />
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<div class="main-page">
|
|
66
|
-
<TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" :type-list="$Data.typeList" @success="$Method.apiDictList" />
|
|
70
|
-
</div>
|
|
71
|
-
</template>
|
|
72
|
-
|
|
73
|
-
<script setup>
|
|
74
|
-
import { onMounted } from "vue";
|
|
75
|
-
|
|
76
|
-
import { Button as TButton, Table as TTable, Input as TInput, Select as TSelect, Option as TOption, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
|
|
77
|
-
import ILucidePlus from "~icons/lucide/plus";
|
|
78
|
-
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
79
|
-
import ILucideSearch from "~icons/lucide/search";
|
|
80
|
-
import ILucidePencil from "~icons/lucide/pencil";
|
|
81
|
-
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
82
|
-
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
83
|
-
import EditDialog from "./components/edit.vue";
|
|
84
|
-
import DetailPanel from "@/components/DetailPanel.vue";
|
|
85
|
-
import { $Http } from "@/plugins/http";
|
|
86
|
-
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
87
|
-
|
|
88
|
-
definePage({
|
|
89
|
-
meta: {
|
|
90
|
-
title: "字典列表",
|
|
91
|
-
order: 1
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const $Data = $ref({
|
|
96
|
-
tableData: [],
|
|
97
|
-
typeList: [],
|
|
98
|
-
loading: false,
|
|
99
|
-
activeRowKeys: [],
|
|
100
|
-
currentRow: null,
|
|
101
|
-
searchTypeCode: "",
|
|
102
|
-
searchKeyword: "",
|
|
103
|
-
columns: withDefaultColumns([
|
|
104
|
-
{ colKey: "id", title: "ID" },
|
|
105
|
-
{ colKey: "typeName", title: "类型名称" },
|
|
106
|
-
{ colKey: "typeCode", title: "类型代码" },
|
|
107
|
-
{ colKey: "label", title: "标签" },
|
|
108
|
-
{ colKey: "key", title: "键值" },
|
|
109
|
-
{ colKey: "sort", title: "排序", width: 100 },
|
|
110
|
-
{ colKey: "remark", title: "备注" },
|
|
111
|
-
{ colKey: "operation", title: "操作" }
|
|
112
|
-
]),
|
|
113
|
-
pagerConfig: {
|
|
114
|
-
currentPage: 1,
|
|
115
|
-
limit: 30,
|
|
116
|
-
total: 0,
|
|
117
|
-
align: "right",
|
|
118
|
-
layout: "total, prev, pager, next, jumper"
|
|
119
|
-
},
|
|
120
|
-
editVisible: false,
|
|
121
|
-
actionType: "add",
|
|
122
|
-
rowData: {}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const $Method = {
|
|
126
|
-
async initData() {
|
|
127
|
-
await $Method.apiDictTypeAll();
|
|
128
|
-
await $Method.apiDictList();
|
|
129
|
-
},
|
|
130
|
-
async apiDictTypeAll() {
|
|
131
|
-
try {
|
|
132
|
-
const res = await $Http("/addon/admin/dictType/all");
|
|
133
|
-
$Data.typeList = res.data.lists || [];
|
|
134
|
-
} catch (error) {
|
|
135
|
-
MessagePlugin.error("加载数据失败");
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
async apiDictList() {
|
|
139
|
-
$Data.loading = true;
|
|
140
|
-
try {
|
|
141
|
-
const res = await $Http("/addon/admin/dict/list", {
|
|
142
|
-
page: $Data.pagerConfig.currentPage,
|
|
143
|
-
limit: $Data.pagerConfig.limit,
|
|
144
|
-
typeCode: $Data.searchTypeCode,
|
|
145
|
-
keyword: $Data.searchKeyword
|
|
146
|
-
});
|
|
147
|
-
$Data.tableData = res.data.lists || [];
|
|
148
|
-
$Data.pagerConfig.total = res.data.total || 0;
|
|
149
|
-
|
|
150
|
-
if ($Data.tableData.length > 0) {
|
|
151
|
-
$Data.currentRow = $Data.tableData[0];
|
|
152
|
-
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
153
|
-
} else {
|
|
154
|
-
$Data.currentRow = null;
|
|
155
|
-
$Data.activeRowKeys = [];
|
|
156
|
-
}
|
|
157
|
-
} catch (error) {
|
|
158
|
-
MessagePlugin.error("加载数据失败");
|
|
159
|
-
} finally {
|
|
160
|
-
$Data.loading = false;
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
async apiDictDel(row) {
|
|
164
|
-
let dialog = null;
|
|
165
|
-
let destroyed = false;
|
|
166
|
-
|
|
167
|
-
const destroy = () => {
|
|
168
|
-
if (destroyed) return;
|
|
169
|
-
destroyed = true;
|
|
170
|
-
if (dialog && typeof dialog.destroy === "function") {
|
|
171
|
-
dialog.destroy();
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
dialog = DialogPlugin.confirm({
|
|
176
|
-
header: "确认删除",
|
|
177
|
-
body: `确认删除字典项“${row.label}”吗?`,
|
|
178
|
-
status: "warning",
|
|
179
|
-
confirmBtn: "删除",
|
|
180
|
-
cancelBtn: "取消",
|
|
181
|
-
onConfirm: async () => {
|
|
182
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
183
|
-
dialog.setConfirmLoading(true);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
await $Http("/addon/admin/dict/del", { id: row.id });
|
|
188
|
-
MessagePlugin.success("删除成功");
|
|
189
|
-
destroy();
|
|
190
|
-
await $Method.apiDictList();
|
|
191
|
-
} catch (error) {
|
|
192
|
-
MessagePlugin.error("删除失败");
|
|
193
|
-
} finally {
|
|
194
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
195
|
-
dialog.setConfirmLoading(false);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
onClose: () => {
|
|
200
|
-
destroy();
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
},
|
|
204
|
-
handleSearch() {
|
|
205
|
-
$Data.pagerConfig.currentPage = 1;
|
|
206
|
-
$Method.apiDictList();
|
|
207
|
-
},
|
|
208
|
-
handleRefresh() {
|
|
209
|
-
$Data.searchTypeCode = "";
|
|
210
|
-
$Data.searchKeyword = "";
|
|
211
|
-
$Data.pagerConfig.currentPage = 1;
|
|
212
|
-
$Method.apiDictList();
|
|
213
|
-
},
|
|
214
|
-
onPageChange({ currentPage }) {
|
|
215
|
-
$Data.pagerConfig.currentPage = currentPage;
|
|
216
|
-
$Method.apiDictList();
|
|
217
|
-
},
|
|
218
|
-
handleSizeChange({ pageSize }) {
|
|
219
|
-
$Data.pagerConfig.limit = pageSize;
|
|
220
|
-
$Data.pagerConfig.currentPage = 1;
|
|
221
|
-
$Method.apiDictList();
|
|
222
|
-
},
|
|
223
|
-
onActiveChange(value, context) {
|
|
224
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
$Data.activeRowKeys = value;
|
|
228
|
-
$Data.currentRow = context.currentRowData;
|
|
229
|
-
},
|
|
230
|
-
onAction(type, row) {
|
|
231
|
-
if (type === "add") {
|
|
232
|
-
$Data.actionType = "add";
|
|
233
|
-
$Data.rowData = {};
|
|
234
|
-
$Data.editVisible = true;
|
|
235
|
-
} else if (type === "upd") {
|
|
236
|
-
$Data.actionType = "upd";
|
|
237
|
-
$Data.rowData = { ...row };
|
|
238
|
-
$Data.editVisible = true;
|
|
239
|
-
} else if (type === "del") {
|
|
240
|
-
$Method.apiDictDel(row);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
onMounted(() => {
|
|
246
|
-
$Method.initData();
|
|
247
|
-
});
|
|
248
|
-
</script>
|
|
249
|
-
|
|
250
|
-
<style scoped lang="scss">
|
|
251
|
-
.page-dict {
|
|
252
|
-
.main-tool .right {
|
|
253
|
-
display: flex;
|
|
254
|
-
gap: 8px;
|
|
255
|
-
align-items: center;
|
|
256
|
-
|
|
257
|
-
.t-select {
|
|
258
|
-
width: 200px;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.t-input {
|
|
262
|
-
width: 240px;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
</style>
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<TDialog v-model:visible="visible" :header="actionType === 'add' ? '添加字典类型' : '编辑字典类型'" width="600px" @confirm="$Method.handleSubmit" @close="$Method.handleClose">
|
|
3
|
-
<TForm ref="formRef" :data="$Data.formData" :rules="$Data.rules" label-width="100px">
|
|
4
|
-
<TFormItem label="类型代码" name="code">
|
|
5
|
-
<TInput v-model="$Data.formData.code" placeholder="请输入类型代码(英文/数字/下划线)" :disabled="actionType === 'upd'" />
|
|
6
|
-
</TFormItem>
|
|
7
|
-
<TFormItem label="类型名称" name="name">
|
|
8
|
-
<TInput v-model="$Data.formData.name" placeholder="请输入类型名称" />
|
|
9
|
-
</TFormItem>
|
|
10
|
-
<TFormItem label="描述" name="description">
|
|
11
|
-
<TTextarea v-model="$Data.formData.description" placeholder="请输入描述信息" :autosize="{ minRows: 3, maxRows: 6 }" />
|
|
12
|
-
</TFormItem>
|
|
13
|
-
<TFormItem label="排序" name="sort">
|
|
14
|
-
<TInputNumber v-model="$Data.formData.sort" :min="0" placeholder="请输入排序值" />
|
|
15
|
-
</TFormItem>
|
|
16
|
-
</TForm>
|
|
17
|
-
</TDialog>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup>
|
|
21
|
-
import { computed } from "vue";
|
|
22
|
-
|
|
23
|
-
import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
|
|
24
|
-
import { $Http } from "@/plugins/http";
|
|
25
|
-
|
|
26
|
-
const props = defineProps({
|
|
27
|
-
modelValue: Boolean,
|
|
28
|
-
actionType: String,
|
|
29
|
-
rowData: Object
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const emit = defineEmits(["update:modelValue", "success"]);
|
|
33
|
-
|
|
34
|
-
const visible = computed({
|
|
35
|
-
get: () => props.modelValue,
|
|
36
|
-
set: (val) => emit("update:modelValue", val)
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const formRef = $ref(null);
|
|
40
|
-
|
|
41
|
-
const $Data = $ref({
|
|
42
|
-
formData: {
|
|
43
|
-
code: "",
|
|
44
|
-
name: "",
|
|
45
|
-
description: "",
|
|
46
|
-
sort: 0
|
|
47
|
-
},
|
|
48
|
-
rules: {
|
|
49
|
-
code: [{ required: true, message: "请输入类型代码" }],
|
|
50
|
-
name: [{ required: true, message: "请输入类型名称" }]
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const $Method = {
|
|
55
|
-
async handleSubmit() {
|
|
56
|
-
const valid = await formRef.validate();
|
|
57
|
-
if (!valid) return;
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
const apiUrl = props.actionType === "add" ? "/addon/admin/dictType/ins" : "/addon/admin/dictType/upd";
|
|
61
|
-
const params = {
|
|
62
|
-
code: $Data.formData.code,
|
|
63
|
-
name: $Data.formData.name,
|
|
64
|
-
description: $Data.formData.description,
|
|
65
|
-
sort: $Data.formData.sort
|
|
66
|
-
};
|
|
67
|
-
if (props.actionType === "upd") {
|
|
68
|
-
params.id = props.rowData.id;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const res = await $Http(apiUrl, params);
|
|
72
|
-
if (res.code === 0) {
|
|
73
|
-
MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
|
|
74
|
-
visible.value = false;
|
|
75
|
-
emit("success");
|
|
76
|
-
} else {
|
|
77
|
-
MessagePlugin.error(res.msg || "操作失败");
|
|
78
|
-
}
|
|
79
|
-
} catch (error) {
|
|
80
|
-
MessagePlugin.error("操作失败");
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
handleClose() {
|
|
84
|
-
visible.value = false;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// 该组件由父组件 v-if 控制挂载/卸载,因此无需 watch:创建时初始化一次即可
|
|
89
|
-
if (props.actionType === "upd" && props.rowData) {
|
|
90
|
-
$Data.formData.code = props.rowData.code || "";
|
|
91
|
-
$Data.formData.name = props.rowData.name || "";
|
|
92
|
-
$Data.formData.description = props.rowData.description || "";
|
|
93
|
-
$Data.formData.sort = props.rowData.sort || 0;
|
|
94
|
-
} else {
|
|
95
|
-
$Data.formData.code = "";
|
|
96
|
-
$Data.formData.name = "";
|
|
97
|
-
$Data.formData.description = "";
|
|
98
|
-
$Data.formData.sort = 0;
|
|
99
|
-
}
|
|
100
|
-
</script>
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="page-dict-type 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
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索类型名称" clearable @enter="$Method.handleSearch" @clear="$Method.handleSearch">
|
|
13
|
-
<template #suffix-icon>
|
|
14
|
-
<ILucideSearch />
|
|
15
|
-
</template>
|
|
16
|
-
</TInput>
|
|
17
|
-
<TButton shape="circle" @click="$Method.handleRefresh">
|
|
18
|
-
<template #icon>
|
|
19
|
-
<ILucideRotateCw />
|
|
20
|
-
</template>
|
|
21
|
-
</TButton>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="main-content">
|
|
25
|
-
<div class="main-table">
|
|
26
|
-
<TTable
|
|
27
|
-
:data="$Data.tableData"
|
|
28
|
-
:columns="$Data.columns"
|
|
29
|
-
:loading="$Data.loading"
|
|
30
|
-
:active-row-keys="$Data.activeRowKeys"
|
|
31
|
-
row-key="id"
|
|
32
|
-
height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
|
|
33
|
-
active-row-type="single"
|
|
34
|
-
@active-change="$Method.onActiveChange"
|
|
35
|
-
>
|
|
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="del" :divider="true">
|
|
48
|
-
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
49
|
-
删除
|
|
50
|
-
</TDropdownItem>
|
|
51
|
-
</TDropdownMenu>
|
|
52
|
-
</TDropdown>
|
|
53
|
-
</template>
|
|
54
|
-
</TTable>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div class="main-detail">
|
|
58
|
-
<DetailPanel :data="$Data.currentRow" :fields="$Data.columns" />
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<div class="main-page">
|
|
63
|
-
<TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.apiDictTypeList" />
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
|
|
70
|
-
<script setup>
|
|
71
|
-
import { onMounted } from "vue";
|
|
72
|
-
|
|
73
|
-
import { Button as TButton, Table as TTable, Input as TInput, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
|
|
74
|
-
import ILucidePlus from "~icons/lucide/plus";
|
|
75
|
-
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
76
|
-
import ILucideSearch from "~icons/lucide/search";
|
|
77
|
-
import ILucidePencil from "~icons/lucide/pencil";
|
|
78
|
-
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
79
|
-
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
80
|
-
import EditDialog from "./components/edit.vue";
|
|
81
|
-
import DetailPanel from "@/components/DetailPanel.vue";
|
|
82
|
-
import { $Http } from "@/plugins/http";
|
|
83
|
-
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
84
|
-
|
|
85
|
-
definePage({
|
|
86
|
-
meta: {
|
|
87
|
-
title: "字典类型",
|
|
88
|
-
order: 0
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const $Data = $ref({
|
|
93
|
-
tableData: [],
|
|
94
|
-
loading: false,
|
|
95
|
-
activeRowKeys: [],
|
|
96
|
-
currentRow: null,
|
|
97
|
-
searchKeyword: "",
|
|
98
|
-
columns: withDefaultColumns([
|
|
99
|
-
{ colKey: "id", title: "ID" },
|
|
100
|
-
{ colKey: "code", title: "类型代码" },
|
|
101
|
-
{ colKey: "name", title: "类型名称" },
|
|
102
|
-
{ colKey: "description", title: "描述" },
|
|
103
|
-
{ colKey: "sort", title: "排序" },
|
|
104
|
-
{ colKey: "operation", title: "操作" }
|
|
105
|
-
]),
|
|
106
|
-
pagerConfig: {
|
|
107
|
-
currentPage: 1,
|
|
108
|
-
limit: 30,
|
|
109
|
-
total: 0,
|
|
110
|
-
align: "right",
|
|
111
|
-
layout: "total, prev, pager, next, jumper"
|
|
112
|
-
},
|
|
113
|
-
editVisible: false,
|
|
114
|
-
actionType: "add",
|
|
115
|
-
rowData: {}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const $Method = {
|
|
119
|
-
async initData() {
|
|
120
|
-
await $Method.apiDictTypeList();
|
|
121
|
-
},
|
|
122
|
-
async apiDictTypeList() {
|
|
123
|
-
$Data.loading = true;
|
|
124
|
-
try {
|
|
125
|
-
const res = await $Http("/addon/admin/dictType/list", {
|
|
126
|
-
page: $Data.pagerConfig.currentPage,
|
|
127
|
-
limit: $Data.pagerConfig.limit,
|
|
128
|
-
keyword: $Data.searchKeyword
|
|
129
|
-
});
|
|
130
|
-
$Data.tableData = res.data.lists || [];
|
|
131
|
-
$Data.pagerConfig.total = res.data.total || 0;
|
|
132
|
-
|
|
133
|
-
if ($Data.tableData.length > 0) {
|
|
134
|
-
$Data.currentRow = $Data.tableData[0];
|
|
135
|
-
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
136
|
-
} else {
|
|
137
|
-
$Data.currentRow = null;
|
|
138
|
-
$Data.activeRowKeys = [];
|
|
139
|
-
}
|
|
140
|
-
} catch (error) {
|
|
141
|
-
MessagePlugin.error("加载数据失败");
|
|
142
|
-
} finally {
|
|
143
|
-
$Data.loading = false;
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
async apiDictTypeDel(row) {
|
|
147
|
-
let dialog = null;
|
|
148
|
-
let destroyed = false;
|
|
149
|
-
|
|
150
|
-
const destroy = () => {
|
|
151
|
-
if (destroyed) return;
|
|
152
|
-
destroyed = true;
|
|
153
|
-
if (dialog && typeof dialog.destroy === "function") {
|
|
154
|
-
dialog.destroy();
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
dialog = DialogPlugin.confirm({
|
|
159
|
-
header: "确认删除",
|
|
160
|
-
body: `确认删除类型“${row.name}”吗?`,
|
|
161
|
-
status: "warning",
|
|
162
|
-
confirmBtn: "删除",
|
|
163
|
-
cancelBtn: "取消",
|
|
164
|
-
onConfirm: async () => {
|
|
165
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
166
|
-
dialog.setConfirmLoading(true);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
try {
|
|
170
|
-
await $Http("/addon/admin/dictType/del", { id: row.id });
|
|
171
|
-
MessagePlugin.success("删除成功");
|
|
172
|
-
destroy();
|
|
173
|
-
await $Method.apiDictTypeList();
|
|
174
|
-
} catch (error) {
|
|
175
|
-
MessagePlugin.error("删除失败");
|
|
176
|
-
} finally {
|
|
177
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
178
|
-
dialog.setConfirmLoading(false);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
onClose: () => {
|
|
183
|
-
destroy();
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
handleSearch() {
|
|
188
|
-
$Data.pagerConfig.currentPage = 1;
|
|
189
|
-
$Method.apiDictTypeList();
|
|
190
|
-
},
|
|
191
|
-
handleRefresh() {
|
|
192
|
-
$Data.searchKeyword = "";
|
|
193
|
-
$Data.pagerConfig.currentPage = 1;
|
|
194
|
-
$Method.apiDictTypeList();
|
|
195
|
-
},
|
|
196
|
-
onPageChange({ currentPage }) {
|
|
197
|
-
$Data.pagerConfig.currentPage = currentPage;
|
|
198
|
-
$Method.apiDictTypeList();
|
|
199
|
-
},
|
|
200
|
-
handleSizeChange({ pageSize }) {
|
|
201
|
-
$Data.pagerConfig.limit = pageSize;
|
|
202
|
-
$Data.pagerConfig.currentPage = 1;
|
|
203
|
-
$Method.apiDictTypeList();
|
|
204
|
-
},
|
|
205
|
-
onActiveChange(value, context) {
|
|
206
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
$Data.activeRowKeys = value;
|
|
210
|
-
$Data.currentRow = context.currentRowData;
|
|
211
|
-
},
|
|
212
|
-
onAction(type, row) {
|
|
213
|
-
if (type === "add") {
|
|
214
|
-
$Data.actionType = "add";
|
|
215
|
-
$Data.rowData = {};
|
|
216
|
-
$Data.editVisible = true;
|
|
217
|
-
} else if (type === "upd") {
|
|
218
|
-
$Data.actionType = "upd";
|
|
219
|
-
$Data.rowData = { ...row };
|
|
220
|
-
$Data.editVisible = true;
|
|
221
|
-
} else if (type === "del") {
|
|
222
|
-
$Method.apiDictTypeDel(row);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
onMounted(() => {
|
|
228
|
-
$Method.initData();
|
|
229
|
-
});
|
|
230
|
-
</script>
|
|
231
|
-
|
|
232
|
-
<style scoped lang="scss">
|
|
233
|
-
.page-dict-type {
|
|
234
|
-
.main-tool .right {
|
|
235
|
-
display: flex;
|
|
236
|
-
gap: 8px;
|
|
237
|
-
align-items: center;
|
|
238
|
-
|
|
239
|
-
.t-input {
|
|
240
|
-
width: 240px;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
</style>
|