@befly-addon/admin 1.1.29 → 1.1.31
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 +29 -24
- package/apis/admin/del.ts +12 -12
- package/apis/admin/detail.ts +9 -41
- package/apis/admin/ins.ts +28 -21
- package/apis/admin/list.ts +12 -12
- package/apis/admin/upd.ts +49 -14
- package/apis/api/all.ts +14 -10
- package/apis/api/list.ts +16 -25
- package/apis/auth/login.ts +55 -52
- package/apis/auth/sendSmsCode.ts +6 -6
- package/apis/dashboard/configStatus.ts +18 -18
- package/apis/dashboard/environmentInfo.ts +12 -12
- package/apis/dashboard/performanceMetrics.ts +5 -5
- package/apis/dashboard/permissionStats.ts +7 -7
- package/apis/dashboard/serviceStatus.ts +29 -29
- package/apis/dashboard/systemInfo.ts +5 -5
- package/apis/dashboard/systemOverview.ts +7 -7
- package/apis/dashboard/systemResources.ts +8 -8
- package/apis/dict/all.ts +24 -7
- package/apis/dict/del.ts +9 -17
- package/apis/dict/detail.ts +30 -16
- package/apis/dict/ins.ts +36 -18
- package/apis/dict/items.ts +27 -0
- package/apis/dict/list.ts +35 -10
- package/apis/dict/upd.ts +54 -20
- package/apis/dictType/all.ts +11 -0
- package/apis/dictType/del.ts +32 -0
- package/apis/dictType/detail.ts +17 -0
- package/apis/dictType/ins.ts +30 -0
- package/apis/dictType/list.ts +22 -0
- package/apis/dictType/upd.ts +42 -0
- package/apis/email/config.ts +4 -4
- package/apis/email/logList.ts +10 -10
- package/apis/email/send.ts +18 -18
- package/apis/email/verify.ts +5 -5
- package/apis/loginLog/list.ts +10 -10
- package/apis/menu/all.ts +17 -20
- package/apis/menu/list.ts +12 -13
- package/apis/operateLog/list.ts +10 -10
- package/apis/role/all.ts +7 -7
- package/apis/role/apiSave.ts +14 -16
- package/apis/role/apis.ts +24 -0
- package/apis/role/del.ts +27 -19
- package/apis/role/detail.ts +6 -7
- package/apis/role/ins.ts +10 -10
- package/apis/role/list.ts +11 -11
- package/apis/role/menuSave.ts +12 -14
- package/apis/role/menus.ts +24 -0
- package/apis/role/save.ts +14 -15
- package/apis/role/upd.ts +10 -10
- package/apis/sysConfig/all.ts +5 -6
- package/apis/sysConfig/del.ts +10 -10
- package/apis/sysConfig/get.ts +10 -11
- package/apis/sysConfig/ins.ts +11 -11
- package/apis/sysConfig/list.ts +9 -9
- package/apis/sysConfig/upd.ts +11 -11
- package/libs/emailHelper.ts +7 -7
- package/package.json +46 -34
- package/plugins/email.ts +9 -9
- package/tables/admin.json +0 -6
- package/tables/dict.json +13 -19
- package/tables/dictType.json +28 -0
- package/tables/role.json +4 -2
- package/views/403_1/index.vue +19 -3
- package/views/config/dict/components/edit.vue +76 -124
- package/views/config/dict/index.vue +142 -84
- package/views/config/dictType/components/edit.vue +105 -0
- package/views/config/dictType/index.vue +242 -0
- package/views/config/index.vue +12 -0
- package/views/config/system/components/edit.vue +36 -36
- package/views/config/system/index.vue +79 -50
- package/views/index/components/addonList.vue +3 -3
- package/views/index/components/environmentInfo.vue +10 -10
- package/views/index/components/operationLogs.vue +10 -10
- package/views/index/components/performanceMetrics.vue +8 -8
- package/views/index/components/quickActions.vue +3 -3
- package/views/index/components/serviceStatus.vue +19 -19
- package/views/index/components/systemNotifications.vue +12 -12
- package/views/index/components/systemOverview.vue +7 -7
- package/views/index/components/systemResources.vue +11 -11
- package/views/index/components/userInfo.vue +20 -19
- package/views/index/index.vue +12 -5
- package/views/log/email/index.vue +58 -51
- package/views/log/index.vue +12 -0
- package/views/log/login/index.vue +45 -38
- package/views/log/operate/index.vue +55 -48
- package/views/login_1/index.vue +191 -2
- package/views/people/admin/components/edit.vue +28 -29
- package/views/people/admin/index.vue +76 -40
- package/views/people/index.vue +12 -0
- package/views/permission/api/index.vue +21 -15
- package/views/permission/index.vue +12 -0
- package/views/permission/menu/index.vue +31 -16
- package/views/permission/role/components/api.vue +23 -23
- package/views/permission/role/components/edit.vue +18 -18
- package/views/permission/role/components/menu.vue +17 -19
- package/views/permission/role/index.vue +84 -49
- package/apis/admin/roleDetail.ts +0 -29
- package/apis/admin/roleSave.ts +0 -39
- package/apis/auth/logout.ts +0 -17
- package/apis/auth/register.ts +0 -43
- package/apis/dashboard/changelog.ts +0 -31
- package/apis/role/apiDetail.ts +0 -24
- package/apis/role/menuDetail.ts +0 -24
- package/views/403_1/meta.json +0 -4
- package/views/config/dict/meta.json +0 -4
- package/views/config/meta.json +0 -4
- package/views/config/system/meta.json +0 -4
- package/views/index/meta.json +0 -4
- package/views/log/email/meta.json +0 -4
- package/views/log/login/meta.json +0 -4
- package/views/log/meta.json +0 -4
- package/views/log/operate/meta.json +0 -4
- package/views/login_1/components/emailLoginForm.vue +0 -174
- package/views/login_1/components/registerForm.vue +0 -175
- package/views/login_1/components/welcomePanel.vue +0 -61
- package/views/login_1/meta.json +0 -4
- package/views/people/admin/meta.json +0 -4
- package/views/people/meta.json +0 -4
- package/views/permission/api/meta.json +0 -4
- package/views/permission/menu/meta.json +0 -4
- package/views/permission/meta.json +0 -4
- package/views/permission/role/meta.json +0 -4
|
@@ -0,0 +1,242 @@
|
|
|
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 { 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";
|
|
72
|
+
import ILucidePlus from "~icons/lucide/plus";
|
|
73
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
74
|
+
import ILucideSearch from "~icons/lucide/search";
|
|
75
|
+
import ILucidePencil from "~icons/lucide/pencil";
|
|
76
|
+
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
77
|
+
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
78
|
+
import EditDialog from "./components/edit.vue";
|
|
79
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
80
|
+
import { $Http } from "@/plugins/http";
|
|
81
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
82
|
+
|
|
83
|
+
definePage({
|
|
84
|
+
meta: {
|
|
85
|
+
title: "字典类型",
|
|
86
|
+
order: 0
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const $Data = $ref({
|
|
91
|
+
tableData: [],
|
|
92
|
+
loading: false,
|
|
93
|
+
activeRowKeys: [],
|
|
94
|
+
currentRow: null,
|
|
95
|
+
searchKeyword: "",
|
|
96
|
+
columns: withDefaultColumns([
|
|
97
|
+
{ colKey: "id", title: "ID" },
|
|
98
|
+
{ colKey: "code", title: "类型代码" },
|
|
99
|
+
{ colKey: "name", title: "类型名称" },
|
|
100
|
+
{ colKey: "description", title: "描述" },
|
|
101
|
+
{ colKey: "sort", title: "排序" },
|
|
102
|
+
{ colKey: "operation", title: "操作" }
|
|
103
|
+
]),
|
|
104
|
+
pagerConfig: {
|
|
105
|
+
currentPage: 1,
|
|
106
|
+
limit: 30,
|
|
107
|
+
total: 0,
|
|
108
|
+
align: "right",
|
|
109
|
+
layout: "total, prev, pager, next, jumper"
|
|
110
|
+
},
|
|
111
|
+
editVisible: false,
|
|
112
|
+
actionType: "add",
|
|
113
|
+
rowData: {}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const $Method = {
|
|
117
|
+
async initData() {
|
|
118
|
+
await $Method.apiDictTypeList();
|
|
119
|
+
},
|
|
120
|
+
async apiDictTypeList() {
|
|
121
|
+
$Data.loading = true;
|
|
122
|
+
try {
|
|
123
|
+
const res = await $Http("/addon/admin/dictType/list", {
|
|
124
|
+
page: $Data.pagerConfig.currentPage,
|
|
125
|
+
limit: $Data.pagerConfig.limit,
|
|
126
|
+
keyword: $Data.searchKeyword
|
|
127
|
+
});
|
|
128
|
+
$Data.tableData = res.data.lists || [];
|
|
129
|
+
$Data.pagerConfig.total = res.data.total || 0;
|
|
130
|
+
|
|
131
|
+
if ($Data.tableData.length > 0) {
|
|
132
|
+
$Data.currentRow = $Data.tableData[0];
|
|
133
|
+
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
134
|
+
} else {
|
|
135
|
+
$Data.currentRow = null;
|
|
136
|
+
$Data.activeRowKeys = [];
|
|
137
|
+
}
|
|
138
|
+
} catch (error) {
|
|
139
|
+
MessagePlugin.error("加载数据失败");
|
|
140
|
+
} finally {
|
|
141
|
+
$Data.loading = false;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
async apiDictTypeDel(row) {
|
|
145
|
+
let dialog = null;
|
|
146
|
+
let destroyed = false;
|
|
147
|
+
|
|
148
|
+
const destroy = () => {
|
|
149
|
+
if (destroyed) return;
|
|
150
|
+
destroyed = true;
|
|
151
|
+
if (dialog && typeof dialog.destroy === "function") {
|
|
152
|
+
dialog.destroy();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
dialog = DialogPlugin.confirm({
|
|
157
|
+
header: "确认删除",
|
|
158
|
+
body: `确认删除类型“${row.name}”吗?`,
|
|
159
|
+
status: "warning",
|
|
160
|
+
confirmBtn: "删除",
|
|
161
|
+
cancelBtn: "取消",
|
|
162
|
+
onConfirm: async () => {
|
|
163
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
164
|
+
dialog.setConfirmLoading(true);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
await $Http("/addon/admin/dictType/del", { id: row.id });
|
|
169
|
+
MessagePlugin.success("删除成功");
|
|
170
|
+
destroy();
|
|
171
|
+
await $Method.apiDictTypeList();
|
|
172
|
+
} catch (error) {
|
|
173
|
+
MessagePlugin.error("删除失败");
|
|
174
|
+
} finally {
|
|
175
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
176
|
+
dialog.setConfirmLoading(false);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
onClose: () => {
|
|
181
|
+
destroy();
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
handleSearch() {
|
|
186
|
+
$Data.pagerConfig.currentPage = 1;
|
|
187
|
+
$Method.apiDictTypeList();
|
|
188
|
+
},
|
|
189
|
+
handleRefresh() {
|
|
190
|
+
$Data.searchKeyword = "";
|
|
191
|
+
$Data.pagerConfig.currentPage = 1;
|
|
192
|
+
$Method.apiDictTypeList();
|
|
193
|
+
},
|
|
194
|
+
onPageChange({ currentPage }) {
|
|
195
|
+
$Data.pagerConfig.currentPage = currentPage;
|
|
196
|
+
$Method.apiDictTypeList();
|
|
197
|
+
},
|
|
198
|
+
handleSizeChange({ pageSize }) {
|
|
199
|
+
$Data.pagerConfig.limit = pageSize;
|
|
200
|
+
$Data.pagerConfig.currentPage = 1;
|
|
201
|
+
$Method.apiDictTypeList();
|
|
202
|
+
},
|
|
203
|
+
onActiveChange(value, context) {
|
|
204
|
+
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
$Data.activeRowKeys = value;
|
|
208
|
+
$Data.currentRow = context.currentRowData;
|
|
209
|
+
},
|
|
210
|
+
onAction(type, row) {
|
|
211
|
+
if (type === "add") {
|
|
212
|
+
$Data.actionType = "add";
|
|
213
|
+
$Data.rowData = {};
|
|
214
|
+
$Data.editVisible = true;
|
|
215
|
+
} else if (type === "upd") {
|
|
216
|
+
$Data.actionType = "upd";
|
|
217
|
+
$Data.rowData = { ...row };
|
|
218
|
+
$Data.editVisible = true;
|
|
219
|
+
} else if (type === "del") {
|
|
220
|
+
$Method.apiDictTypeDel(row);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
onMounted(() => {
|
|
226
|
+
$Method.initData();
|
|
227
|
+
});
|
|
228
|
+
</script>
|
|
229
|
+
|
|
230
|
+
<style scoped lang="scss">
|
|
231
|
+
.page-dict-type {
|
|
232
|
+
.main-tool .right {
|
|
233
|
+
display: flex;
|
|
234
|
+
gap: 8px;
|
|
235
|
+
align-items: center;
|
|
236
|
+
|
|
237
|
+
.t-input {
|
|
238
|
+
width: 240px;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
</style>
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
</template>
|
|
46
46
|
|
|
47
47
|
<script setup>
|
|
48
|
-
import { watch } from
|
|
49
|
-
import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, Select as TSelect, Option as TOption, RadioGroup as TRadioGroup, Radio as TRadio, Button as TButton, MessagePlugin } from
|
|
50
|
-
import { $Http } from
|
|
48
|
+
import { watch } from "vue";
|
|
49
|
+
import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, Select as TSelect, Option as TOption, RadioGroup as TRadioGroup, Radio as TRadio, Button as TButton, MessagePlugin } from "tdesign-vue-next";
|
|
50
|
+
import { $Http } from "@/plugins/http";
|
|
51
51
|
|
|
52
52
|
const $Prop = defineProps({
|
|
53
53
|
modelValue: {
|
|
@@ -56,7 +56,7 @@ const $Prop = defineProps({
|
|
|
56
56
|
},
|
|
57
57
|
actionType: {
|
|
58
58
|
type: String,
|
|
59
|
-
default:
|
|
59
|
+
default: "add"
|
|
60
60
|
},
|
|
61
61
|
rowData: {
|
|
62
62
|
type: Object,
|
|
@@ -64,7 +64,7 @@ const $Prop = defineProps({
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
const $Emit = defineEmits([
|
|
67
|
+
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
68
68
|
|
|
69
69
|
// 表单引用
|
|
70
70
|
const $Form = $shallowRef({
|
|
@@ -77,28 +77,28 @@ const $Data = $ref({
|
|
|
77
77
|
isSystem: false,
|
|
78
78
|
formData: {
|
|
79
79
|
id: 0,
|
|
80
|
-
name:
|
|
81
|
-
code:
|
|
82
|
-
value:
|
|
83
|
-
valueType:
|
|
84
|
-
group:
|
|
80
|
+
name: "",
|
|
81
|
+
code: "",
|
|
82
|
+
value: "",
|
|
83
|
+
valueType: "string",
|
|
84
|
+
group: "",
|
|
85
85
|
sort: 0,
|
|
86
|
-
description:
|
|
86
|
+
description: "",
|
|
87
87
|
state: 1
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
const $Data2 = $shallowRef({
|
|
92
92
|
formRules: {
|
|
93
|
-
name: [{ required: true, message:
|
|
93
|
+
name: [{ required: true, message: "请输入配置名称", trigger: "blur" }],
|
|
94
94
|
code: [
|
|
95
|
-
{ required: true, message:
|
|
96
|
-
{ pattern: /^[a-zA-Z0-9_]+$/, message:
|
|
95
|
+
{ required: true, message: "请输入配置代码", trigger: "blur" },
|
|
96
|
+
{ pattern: /^[a-zA-Z0-9_]+$/, message: "配置代码只能包含字母、数字和下划线", trigger: "blur" }
|
|
97
97
|
],
|
|
98
|
-
value: [{ required: true, message:
|
|
99
|
-
valueType: [{ required: true, message:
|
|
98
|
+
value: [{ required: true, message: "请输入配置值", trigger: "blur" }],
|
|
99
|
+
valueType: [{ required: true, message: "请选择值类型", trigger: "change" }]
|
|
100
100
|
},
|
|
101
|
-
groupOptions: [
|
|
101
|
+
groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
// 方法集合
|
|
@@ -109,27 +109,27 @@ const $Method = {
|
|
|
109
109
|
|
|
110
110
|
onShow() {
|
|
111
111
|
$Data.visible = true;
|
|
112
|
-
if ($Prop.actionType ===
|
|
112
|
+
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
113
113
|
$Data.formData.id = $Prop.rowData.id || 0;
|
|
114
|
-
$Data.formData.name = $Prop.rowData.name ||
|
|
115
|
-
$Data.formData.code = $Prop.rowData.code ||
|
|
116
|
-
$Data.formData.value = $Prop.rowData.value ||
|
|
117
|
-
$Data.formData.valueType = $Prop.rowData.valueType ||
|
|
118
|
-
$Data.formData.group = $Prop.rowData.group ||
|
|
114
|
+
$Data.formData.name = $Prop.rowData.name || "";
|
|
115
|
+
$Data.formData.code = $Prop.rowData.code || "";
|
|
116
|
+
$Data.formData.value = $Prop.rowData.value || "";
|
|
117
|
+
$Data.formData.valueType = $Prop.rowData.valueType || "string";
|
|
118
|
+
$Data.formData.group = $Prop.rowData.group || "";
|
|
119
119
|
$Data.formData.sort = $Prop.rowData.sort || 0;
|
|
120
|
-
$Data.formData.description = $Prop.rowData.description ||
|
|
120
|
+
$Data.formData.description = $Prop.rowData.description || "";
|
|
121
121
|
$Data.formData.state = $Prop.rowData.state || 1;
|
|
122
122
|
$Data.isSystem = $Prop.rowData.isSystem === 1;
|
|
123
123
|
} else {
|
|
124
124
|
$Data.formData = {
|
|
125
125
|
id: 0,
|
|
126
|
-
name:
|
|
127
|
-
code:
|
|
128
|
-
value:
|
|
129
|
-
valueType:
|
|
130
|
-
group:
|
|
126
|
+
name: "",
|
|
127
|
+
code: "",
|
|
128
|
+
value: "",
|
|
129
|
+
valueType: "string",
|
|
130
|
+
group: "",
|
|
131
131
|
sort: 0,
|
|
132
|
-
description:
|
|
132
|
+
description: "",
|
|
133
133
|
state: 1
|
|
134
134
|
};
|
|
135
135
|
$Data.isSystem = false;
|
|
@@ -138,7 +138,7 @@ const $Method = {
|
|
|
138
138
|
|
|
139
139
|
onClose() {
|
|
140
140
|
$Data.visible = false;
|
|
141
|
-
$Emit(
|
|
141
|
+
$Emit("update:modelValue", false);
|
|
142
142
|
},
|
|
143
143
|
|
|
144
144
|
async onSubmit() {
|
|
@@ -147,18 +147,18 @@ const $Method = {
|
|
|
147
147
|
|
|
148
148
|
$Data.submitting = true;
|
|
149
149
|
try {
|
|
150
|
-
const api = $Prop.actionType ===
|
|
150
|
+
const api = $Prop.actionType === "upd" ? "/addon/admin/sysConfig/upd" : "/addon/admin/sysConfig/ins";
|
|
151
151
|
const res = await $Http(api, $Data.formData);
|
|
152
152
|
|
|
153
153
|
if (res.code === 0) {
|
|
154
|
-
MessagePlugin.success($Prop.actionType ===
|
|
155
|
-
$Emit(
|
|
154
|
+
MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
|
|
155
|
+
$Emit("success");
|
|
156
156
|
$Method.onClose();
|
|
157
157
|
} else {
|
|
158
|
-
MessagePlugin.error(res.msg ||
|
|
158
|
+
MessagePlugin.error(res.msg || "操作失败");
|
|
159
159
|
}
|
|
160
160
|
} catch (error) {
|
|
161
|
-
MessagePlugin.error(
|
|
161
|
+
MessagePlugin.error("操作失败");
|
|
162
162
|
} finally {
|
|
163
163
|
$Data.submitting = false;
|
|
164
164
|
}
|
|
@@ -82,42 +82,49 @@
|
|
|
82
82
|
</template>
|
|
83
83
|
|
|
84
84
|
<script setup>
|
|
85
|
-
import { Button as TButton, Table as TTable, Tag as TTag, Select as TSelect, Option as TOption, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from
|
|
86
|
-
import ILucidePlus from
|
|
87
|
-
import ILucideRotateCw from
|
|
88
|
-
import ILucidePencil from
|
|
89
|
-
import ILucideTrash2 from
|
|
90
|
-
import ILucideChevronDown from
|
|
91
|
-
import EditDialog from
|
|
92
|
-
import DetailPanel from
|
|
93
|
-
import { $Http } from
|
|
94
|
-
import { withDefaultColumns } from
|
|
85
|
+
import { Button as TButton, Table as TTable, Tag as TTag, Select as TSelect, Option as TOption, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
|
|
86
|
+
import ILucidePlus from "~icons/lucide/plus";
|
|
87
|
+
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
88
|
+
import ILucidePencil from "~icons/lucide/pencil";
|
|
89
|
+
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
90
|
+
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
91
|
+
import EditDialog from "./components/edit.vue";
|
|
92
|
+
import DetailPanel from "@/components/DetailPanel.vue";
|
|
93
|
+
import { $Http } from "@/plugins/http";
|
|
94
|
+
import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
|
|
95
|
+
|
|
96
|
+
definePage({
|
|
97
|
+
meta: {
|
|
98
|
+
title: "系统配置",
|
|
99
|
+
order: 2
|
|
100
|
+
}
|
|
101
|
+
});
|
|
95
102
|
|
|
96
103
|
// 响应式数据
|
|
97
104
|
const $Data = $ref({
|
|
98
105
|
tableData: [],
|
|
99
106
|
loading: false,
|
|
100
107
|
columns: withDefaultColumns([
|
|
101
|
-
{ colKey:
|
|
102
|
-
{ colKey:
|
|
103
|
-
{ colKey:
|
|
104
|
-
{ colKey:
|
|
105
|
-
{ colKey:
|
|
106
|
-
{ colKey:
|
|
107
|
-
{ colKey:
|
|
108
|
-
{ colKey:
|
|
109
|
-
{ colKey:
|
|
110
|
-
{ colKey:
|
|
108
|
+
{ colKey: "name", title: "配置名称", fixed: "left", width: 150 },
|
|
109
|
+
{ colKey: "id", title: "序号", width: 80 },
|
|
110
|
+
{ colKey: "code", title: "配置代码", ellipsis: true },
|
|
111
|
+
{ colKey: "value", title: "配置值", ellipsis: true, width: 200 },
|
|
112
|
+
{ colKey: "valueType", title: "值类型", width: 100 },
|
|
113
|
+
{ colKey: "group", title: "分组", width: 100 },
|
|
114
|
+
{ colKey: "sort", title: "排序", width: 80 },
|
|
115
|
+
{ colKey: "isSystem", title: "类型", width: 80 },
|
|
116
|
+
{ colKey: "state", title: "状态", width: 80 },
|
|
117
|
+
{ colKey: "operation", title: "操作", width: 100 }
|
|
111
118
|
]),
|
|
112
119
|
detailFields: [
|
|
113
|
-
{ colKey:
|
|
114
|
-
{ colKey:
|
|
115
|
-
{ colKey:
|
|
116
|
-
{ colKey:
|
|
117
|
-
{ colKey:
|
|
118
|
-
{ colKey:
|
|
119
|
-
{ colKey:
|
|
120
|
-
{ colKey:
|
|
120
|
+
{ colKey: "name", title: "配置名称" },
|
|
121
|
+
{ colKey: "code", title: "配置代码" },
|
|
122
|
+
{ colKey: "value", title: "配置值" },
|
|
123
|
+
{ colKey: "valueType", title: "值类型" },
|
|
124
|
+
{ colKey: "group", title: "配置分组" },
|
|
125
|
+
{ colKey: "sort", title: "排序" },
|
|
126
|
+
{ colKey: "isSystem", title: "配置类型" },
|
|
127
|
+
{ colKey: "description", title: "描述说明" }
|
|
121
128
|
],
|
|
122
129
|
pagerConfig: {
|
|
123
130
|
currentPage: 1,
|
|
@@ -127,12 +134,12 @@ const $Data = $ref({
|
|
|
127
134
|
currentRow: null,
|
|
128
135
|
activeRowKeys: [],
|
|
129
136
|
editVisible: false,
|
|
130
|
-
actionType:
|
|
137
|
+
actionType: "add",
|
|
131
138
|
rowData: {},
|
|
132
139
|
filter: {
|
|
133
|
-
group:
|
|
140
|
+
group: ""
|
|
134
141
|
},
|
|
135
|
-
groupOptions: [
|
|
142
|
+
groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
|
|
136
143
|
});
|
|
137
144
|
|
|
138
145
|
// 方法
|
|
@@ -145,7 +152,7 @@ const $Method = {
|
|
|
145
152
|
async apiConfigList() {
|
|
146
153
|
$Data.loading = true;
|
|
147
154
|
try {
|
|
148
|
-
const res = await $Http(
|
|
155
|
+
const res = await $Http("/addon/admin/sysConfig/list", {
|
|
149
156
|
page: $Data.pagerConfig.currentPage,
|
|
150
157
|
limit: $Data.pagerConfig.limit
|
|
151
158
|
});
|
|
@@ -160,7 +167,7 @@ const $Method = {
|
|
|
160
167
|
$Data.activeRowKeys = [];
|
|
161
168
|
}
|
|
162
169
|
} catch (error) {
|
|
163
|
-
MessagePlugin.error(
|
|
170
|
+
MessagePlugin.error("加载数据失败");
|
|
164
171
|
} finally {
|
|
165
172
|
$Data.loading = false;
|
|
166
173
|
}
|
|
@@ -169,25 +176,47 @@ const $Method = {
|
|
|
169
176
|
// 删除配置
|
|
170
177
|
async apiConfigDel(row) {
|
|
171
178
|
if (row.isSystem === 1) {
|
|
172
|
-
MessagePlugin.warning(
|
|
179
|
+
MessagePlugin.warning("系统配置不允许删除");
|
|
173
180
|
return;
|
|
174
181
|
}
|
|
175
182
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
let dialog = null;
|
|
184
|
+
let destroyed = false;
|
|
185
|
+
|
|
186
|
+
const destroy = () => {
|
|
187
|
+
if (destroyed) return;
|
|
188
|
+
destroyed = true;
|
|
189
|
+
if (dialog && typeof dialog.destroy === "function") {
|
|
190
|
+
dialog.destroy();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
dialog = DialogPlugin.confirm({
|
|
195
|
+
header: "确认删除",
|
|
196
|
+
body: `确认删除配置“${row.name}”吗?`,
|
|
197
|
+
status: "warning",
|
|
198
|
+
confirmBtn: "删除",
|
|
199
|
+
cancelBtn: "取消",
|
|
200
|
+
onConfirm: async () => {
|
|
201
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
202
|
+
dialog.setConfirmLoading(true);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
await $Http("/addon/admin/sysConfig/del", { id: row.id });
|
|
207
|
+
MessagePlugin.success("删除成功");
|
|
208
|
+
destroy();
|
|
209
|
+
await $Method.apiConfigList();
|
|
210
|
+
} catch (error) {
|
|
211
|
+
MessagePlugin.error("删除失败");
|
|
212
|
+
} finally {
|
|
213
|
+
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
214
|
+
dialog.setConfirmLoading(false);
|
|
215
|
+
}
|
|
188
216
|
}
|
|
189
|
-
}
|
|
190
|
-
|
|
217
|
+
},
|
|
218
|
+
onClose: () => {
|
|
219
|
+
destroy();
|
|
191
220
|
}
|
|
192
221
|
});
|
|
193
222
|
},
|
|
@@ -231,9 +260,9 @@ const $Method = {
|
|
|
231
260
|
onAction(command, rowData) {
|
|
232
261
|
$Data.actionType = command;
|
|
233
262
|
$Data.rowData = rowData;
|
|
234
|
-
if (command ===
|
|
263
|
+
if (command === "add" || command === "upd") {
|
|
235
264
|
$Data.editVisible = true;
|
|
236
|
-
} else if (command ===
|
|
265
|
+
} else if (command === "del") {
|
|
237
266
|
$Method.apiConfigDel(rowData);
|
|
238
267
|
}
|
|
239
268
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script setup>
|
|
27
|
-
import { $Http } from
|
|
27
|
+
import { $Http } from "@/plugins/http";
|
|
28
28
|
|
|
29
29
|
// 组件内部数据
|
|
30
30
|
const addonList = $ref([]);
|
|
@@ -32,10 +32,10 @@ const addonList = $ref([]);
|
|
|
32
32
|
// 获取数据
|
|
33
33
|
const fetchData = async () => {
|
|
34
34
|
try {
|
|
35
|
-
const { data } = await $Http(
|
|
35
|
+
const { data } = await $Http("/addon/admin/dashboard/addonList");
|
|
36
36
|
addonList.splice(0, addonList.length, ...data);
|
|
37
37
|
} catch (error) {
|
|
38
|
-
|
|
38
|
+
// 静默失败:不阻断页面展示
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -36,26 +36,26 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<script setup>
|
|
39
|
-
import ILucideServer from
|
|
40
|
-
import { $Http } from
|
|
39
|
+
import ILucideServer from "~icons/lucide/server";
|
|
40
|
+
import { $Http } from "@/plugins/http";
|
|
41
41
|
|
|
42
42
|
// 组件内部数据
|
|
43
43
|
const environmentInfo = $ref({
|
|
44
|
-
os:
|
|
45
|
-
server:
|
|
46
|
-
nodeVersion:
|
|
47
|
-
database:
|
|
48
|
-
cache:
|
|
49
|
-
timezone:
|
|
44
|
+
os: "",
|
|
45
|
+
server: "",
|
|
46
|
+
nodeVersion: "",
|
|
47
|
+
database: "",
|
|
48
|
+
cache: "",
|
|
49
|
+
timezone: ""
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
// 获取数据
|
|
53
53
|
const fetchData = async () => {
|
|
54
54
|
try {
|
|
55
|
-
const { data } = await $Http(
|
|
55
|
+
const { data } = await $Http("/addon/admin/dashboard/environmentInfo");
|
|
56
56
|
Object.assign(environmentInfo, data);
|
|
57
57
|
} catch (error) {
|
|
58
|
-
|
|
58
|
+
// 静默失败:不阻断页面展示
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
|