@befly-addon/admin 1.8.2 → 1.8.5
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/403_1/index.vue +9 -10
- package/adminViews/config/dict/components/edit.vue +39 -36
- package/adminViews/config/dict/index.vue +127 -206
- package/adminViews/config/dictType/components/edit.vue +38 -36
- package/adminViews/config/dictType/index.vue +105 -197
- package/adminViews/config/system/components/edit.vue +75 -70
- package/adminViews/config/system/index.vue +134 -235
- package/adminViews/index/components/userInfo.vue +67 -77
- package/adminViews/log/email/index.vue +154 -230
- package/adminViews/log/login/index.vue +66 -157
- package/adminViews/log/operate/index.vue +110 -196
- package/adminViews/login_1/index.vue +29 -39
- package/adminViews/people/admin/components/edit.vue +61 -70
- package/adminViews/people/admin/index.vue +88 -204
- package/adminViews/permission/api/index.vue +52 -62
- package/adminViews/permission/menu/index.vue +43 -53
- package/adminViews/permission/role/components/api.vue +168 -169
- package/adminViews/permission/role/components/edit.vue +43 -45
- package/adminViews/permission/role/components/menu.vue +143 -151
- package/adminViews/permission/role/index.vue +129 -224
- package/adminViews/tsconfig.json +14 -0
- package/package.json +3 -3
|
@@ -1,76 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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>
|
|
2
|
+
<PagedTableDetail class="page-dict-type page-table" :columns="$Data.columns" :endpoints="$Data.endpoints">
|
|
3
|
+
<template #toolLeft>
|
|
4
|
+
<TButton theme="primary" @click="onAdd">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<ILucidePlus />
|
|
7
|
+
</template>
|
|
8
|
+
</TButton>
|
|
9
|
+
</template>
|
|
56
10
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
11
|
+
<template #toolRight="scope">
|
|
12
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索类型名称" clearable @enter="handleSearch(scope.reload)" @clear="handleSearch(scope.reload)">
|
|
13
|
+
<template #suffix-icon>
|
|
14
|
+
<ILucideSearch />
|
|
15
|
+
</template>
|
|
16
|
+
</TInput>
|
|
17
|
+
<TButton shape="circle" @click="handleRefresh(scope.reload)">
|
|
18
|
+
<template #icon>
|
|
19
|
+
<ILucideRotateCw />
|
|
20
|
+
</template>
|
|
21
|
+
</TButton>
|
|
22
|
+
</template>
|
|
61
23
|
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
24
|
+
<template #operation="{ row, deleteRow }">
|
|
25
|
+
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
26
|
+
<TButton theme="primary" size="small">
|
|
27
|
+
操作
|
|
28
|
+
<template #suffix> <ILucideChevronDown /></template>
|
|
29
|
+
</TButton>
|
|
30
|
+
<TDropdownMenu slot="dropdown">
|
|
31
|
+
<TDropdownItem value="upd">
|
|
32
|
+
<ILucidePencil />
|
|
33
|
+
编辑
|
|
34
|
+
</TDropdownItem>
|
|
35
|
+
<TDropdownItem value="del" :divider="true">
|
|
36
|
+
<ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
37
|
+
删除
|
|
38
|
+
</TDropdownItem>
|
|
39
|
+
</TDropdownMenu>
|
|
40
|
+
</TDropdown>
|
|
41
|
+
</template>
|
|
65
42
|
|
|
66
|
-
<
|
|
67
|
-
|
|
43
|
+
<template #dialogs="scope">
|
|
44
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
45
|
+
</template>
|
|
46
|
+
</PagedTableDetail>
|
|
68
47
|
</template>
|
|
69
48
|
|
|
70
49
|
<script setup lang="ts">
|
|
71
|
-
import {
|
|
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";
|
|
50
|
+
import { Button as TButton, Dropdown as TDropdown, DropdownItem as TDropdownItem, DropdownMenu as TDropdownMenu, Input as TInput } from "tdesign-vue-next";
|
|
74
51
|
import ILucidePlus from "~icons/lucide/plus";
|
|
75
52
|
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
76
53
|
import ILucideSearch from "~icons/lucide/search";
|
|
@@ -78,15 +55,10 @@ import ILucidePencil from "~icons/lucide/pencil";
|
|
|
78
55
|
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
79
56
|
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
80
57
|
import EditDialog from "./components/edit.vue";
|
|
81
|
-
import
|
|
82
|
-
import { $Http } from "@/plugins/http";
|
|
58
|
+
import PagedTableDetail from "@/components/pagedTableDetail.vue";
|
|
83
59
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
84
60
|
|
|
85
61
|
const $Data = $ref({
|
|
86
|
-
tableData: [],
|
|
87
|
-
loading: false,
|
|
88
|
-
activeRowKeys: [],
|
|
89
|
-
currentRow: null,
|
|
90
62
|
searchKeyword: "",
|
|
91
63
|
columns: withDefaultColumns([
|
|
92
64
|
{ colKey: "code", title: "类型代码" },
|
|
@@ -95,143 +67,79 @@ const $Data = $ref({
|
|
|
95
67
|
{ colKey: "sort", title: "排序" },
|
|
96
68
|
{ colKey: "operation", title: "操作" }
|
|
97
69
|
]),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
70
|
+
endpoints: {
|
|
71
|
+
list: {
|
|
72
|
+
path: "/addon/admin/dictType/list",
|
|
73
|
+
dropValues: [0, ""],
|
|
74
|
+
dropKeyValue: {
|
|
75
|
+
keyword: [""]
|
|
76
|
+
},
|
|
77
|
+
buildData: () => {
|
|
78
|
+
return {
|
|
79
|
+
keyword: $Data.searchKeyword
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
delete: {
|
|
84
|
+
path: "/addon/admin/dictType/del",
|
|
85
|
+
idKey: "id",
|
|
86
|
+
confirm: (row) => {
|
|
87
|
+
return {
|
|
88
|
+
header: "确认删除",
|
|
89
|
+
body: `确认删除类型“${row.name}”吗?`,
|
|
90
|
+
confirmBtn: "删除",
|
|
91
|
+
status: "warning"
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
104
95
|
},
|
|
105
96
|
editVisible: false,
|
|
106
97
|
actionType: "add",
|
|
107
98
|
rowData: {}
|
|
108
99
|
});
|
|
109
100
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
async apiDictTypeList() {
|
|
115
|
-
$Data.loading = true;
|
|
116
|
-
try {
|
|
117
|
-
const res = await $Http.post(
|
|
118
|
-
"/addon/admin/dictType/list",
|
|
119
|
-
{
|
|
120
|
-
page: $Data.pagerConfig.currentPage,
|
|
121
|
-
limit: $Data.pagerConfig.limit,
|
|
122
|
-
keyword: $Data.searchKeyword
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
dropValues: [0, ""],
|
|
126
|
-
dropKeyValue: {
|
|
127
|
-
page: [],
|
|
128
|
-
limit: [],
|
|
129
|
-
keyword: [""]
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
$Data.tableData = res.data.lists || [];
|
|
134
|
-
$Data.pagerConfig.total = res.data.total || 0;
|
|
101
|
+
function onAdd(): void {
|
|
102
|
+
onAction("add", {});
|
|
103
|
+
}
|
|
135
104
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
} else {
|
|
140
|
-
$Data.currentRow = null;
|
|
141
|
-
$Data.activeRowKeys = [];
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
MessagePlugin.error("加载数据失败");
|
|
145
|
-
} finally {
|
|
146
|
-
$Data.loading = false;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
async apiDictTypeDel(row) {
|
|
150
|
-
let dialog = null;
|
|
151
|
-
let destroyed = false;
|
|
105
|
+
function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
|
|
106
|
+
reload({ keepSelection: true });
|
|
107
|
+
}
|
|
152
108
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (dialog && typeof dialog.destroy === "function") {
|
|
157
|
-
dialog.destroy();
|
|
158
|
-
}
|
|
159
|
-
};
|
|
109
|
+
function handleSearch(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
|
|
110
|
+
reload({ keepSelection: false, resetPage: true });
|
|
111
|
+
}
|
|
160
112
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
confirmBtn: "删除",
|
|
166
|
-
cancelBtn: "取消",
|
|
167
|
-
onConfirm: async () => {
|
|
168
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
169
|
-
dialog.setConfirmLoading(true);
|
|
170
|
-
}
|
|
113
|
+
function handleRefresh(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
|
|
114
|
+
$Data.searchKeyword = "";
|
|
115
|
+
reload({ keepSelection: false, resetPage: true });
|
|
116
|
+
}
|
|
171
117
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
await $Method.apiDictTypeList();
|
|
179
|
-
} catch (error) {
|
|
180
|
-
MessagePlugin.error("删除失败");
|
|
181
|
-
} finally {
|
|
182
|
-
if (dialog && typeof dialog.setConfirmLoading === "function") {
|
|
183
|
-
dialog.setConfirmLoading(false);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
onClose: () => {
|
|
188
|
-
destroy();
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
handleSearch() {
|
|
193
|
-
$Data.pagerConfig.currentPage = 1;
|
|
194
|
-
$Method.apiDictTypeList();
|
|
195
|
-
},
|
|
196
|
-
handleRefresh() {
|
|
197
|
-
$Data.searchKeyword = "";
|
|
198
|
-
$Data.pagerConfig.currentPage = 1;
|
|
199
|
-
$Method.apiDictTypeList();
|
|
200
|
-
},
|
|
201
|
-
onPageChange({ currentPage }) {
|
|
202
|
-
$Data.pagerConfig.currentPage = currentPage;
|
|
203
|
-
$Method.apiDictTypeList();
|
|
204
|
-
},
|
|
205
|
-
handleSizeChange({ pageSize }) {
|
|
206
|
-
$Data.pagerConfig.limit = pageSize;
|
|
207
|
-
$Data.pagerConfig.currentPage = 1;
|
|
208
|
-
$Method.apiDictTypeList();
|
|
209
|
-
},
|
|
210
|
-
onActiveChange(value, context) {
|
|
211
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
$Data.activeRowKeys = value;
|
|
215
|
-
$Data.currentRow = context.currentRowData;
|
|
216
|
-
},
|
|
217
|
-
onAction(type, row) {
|
|
218
|
-
if (type === "add") {
|
|
219
|
-
$Data.actionType = "add";
|
|
220
|
-
$Data.rowData = {};
|
|
221
|
-
$Data.editVisible = true;
|
|
222
|
-
} else if (type === "upd") {
|
|
223
|
-
$Data.actionType = "upd";
|
|
224
|
-
$Data.rowData = { ...row };
|
|
225
|
-
$Data.editVisible = true;
|
|
226
|
-
} else if (type === "del") {
|
|
227
|
-
$Method.apiDictTypeDel(row);
|
|
228
|
-
}
|
|
118
|
+
function onAction(type: string, row: Record<string, unknown>): void {
|
|
119
|
+
if (type === "add") {
|
|
120
|
+
$Data.actionType = "add";
|
|
121
|
+
$Data.rowData = {};
|
|
122
|
+
$Data.editVisible = true;
|
|
123
|
+
return;
|
|
229
124
|
}
|
|
230
|
-
};
|
|
231
125
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
});
|
|
126
|
+
if (type === "upd") {
|
|
127
|
+
$Data.actionType = "upd";
|
|
128
|
+
$Data.rowData = Object.assign({}, row);
|
|
129
|
+
$Data.editVisible = true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function onDropdownAction(data: unknown, row: Record<string, unknown>, deleteRow: (r: Record<string, unknown>) => void): void {
|
|
134
|
+
const record = data as Record<string, unknown>;
|
|
135
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
136
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
137
|
+
if (cmd === "del") {
|
|
138
|
+
deleteRow(row);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
onAction(cmd, row);
|
|
142
|
+
}
|
|
235
143
|
</script>
|
|
236
144
|
|
|
237
145
|
<style scoped lang="scss">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<TForm :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($
|
|
2
|
+
<PageDialog v-model="dialogVisible" :title="$Prop.actionType === 'upd' ? '编辑配置' : '添加配置'" :confirm-loading="$Data.submitting" @confirm="onSubmit">
|
|
3
|
+
<TForm :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)">
|
|
4
4
|
<TFormItem label="配置名称" prop="name">
|
|
5
5
|
<TInput v-model="$Data.formData.name" placeholder="请输入配置名称" :disabled="$Data.isSystem" />
|
|
6
6
|
</TFormItem>
|
|
@@ -37,15 +37,14 @@
|
|
|
37
37
|
</TRadioGroup>
|
|
38
38
|
</TFormItem>
|
|
39
39
|
</TForm>
|
|
40
|
-
|
|
41
|
-
<TButton @click="$Method.onClose">取消</TButton>
|
|
42
|
-
<TButton theme="primary" :loading="$Data.submitting" @click="$Method.onSubmit">确定</TButton>
|
|
43
|
-
</template>
|
|
44
|
-
</TDialog>
|
|
40
|
+
</PageDialog>
|
|
45
41
|
</template>
|
|
46
42
|
|
|
47
43
|
<script setup lang="ts">
|
|
48
|
-
import {
|
|
44
|
+
import { computed } from "vue";
|
|
45
|
+
|
|
46
|
+
import { 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, MessagePlugin } from "tdesign-vue-next";
|
|
47
|
+
import PageDialog from "@/components/pageDialog.vue";
|
|
49
48
|
import { $Http } from "@/plugins/http";
|
|
50
49
|
|
|
51
50
|
const $Prop = defineProps({
|
|
@@ -63,15 +62,28 @@ const $Prop = defineProps({
|
|
|
63
62
|
}
|
|
64
63
|
});
|
|
65
64
|
|
|
66
|
-
const $Emit = defineEmits
|
|
65
|
+
const $Emit = defineEmits<{
|
|
66
|
+
(e: "update:modelValue", value: boolean): void;
|
|
67
|
+
(e: "success"): void;
|
|
68
|
+
}>();
|
|
69
|
+
|
|
70
|
+
type PageDialogEventContext = {
|
|
71
|
+
close: () => void;
|
|
72
|
+
};
|
|
67
73
|
|
|
68
74
|
// 表单引用
|
|
69
|
-
const $
|
|
75
|
+
const $From = $shallowRef({
|
|
70
76
|
form: null
|
|
71
77
|
});
|
|
72
78
|
|
|
79
|
+
const dialogVisible = computed({
|
|
80
|
+
get: () => $Prop.modelValue,
|
|
81
|
+
set: (value) => {
|
|
82
|
+
$Emit("update:modelValue", value);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
73
86
|
const $Data = $ref({
|
|
74
|
-
visible: false,
|
|
75
87
|
submitting: false,
|
|
76
88
|
isSystem: false,
|
|
77
89
|
formData: {
|
|
@@ -100,72 +112,65 @@ const $Data2 = $shallowRef({
|
|
|
100
112
|
groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
|
|
101
113
|
});
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
$Method.onShow();
|
|
107
|
-
},
|
|
115
|
+
async function initData(): Promise<void> {
|
|
116
|
+
onShow();
|
|
117
|
+
}
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
119
|
+
function onShow(): void {
|
|
120
|
+
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
121
|
+
const row = $Prop.rowData as Record<string, unknown>;
|
|
122
|
+
$Data.formData.id = (row["id"] as number) || 0;
|
|
123
|
+
$Data.formData.name = (row["name"] as string) || "";
|
|
124
|
+
$Data.formData.code = (row["code"] as string) || "";
|
|
125
|
+
$Data.formData.value = (row["value"] as string) || "";
|
|
126
|
+
$Data.formData.valueType = (row["valueType"] as string) || "string";
|
|
127
|
+
$Data.formData.group = (row["group"] as string) || "";
|
|
128
|
+
$Data.formData.sort = (row["sort"] as number) || 0;
|
|
129
|
+
$Data.formData.description = (row["description"] as string) || "";
|
|
130
|
+
$Data.formData.state = (row["state"] as number) || 1;
|
|
131
|
+
$Data.isSystem = row["isSystem"] === 1;
|
|
132
|
+
} else {
|
|
133
|
+
$Data.formData = {
|
|
134
|
+
id: 0,
|
|
135
|
+
name: "",
|
|
136
|
+
code: "",
|
|
137
|
+
value: "",
|
|
138
|
+
valueType: "string",
|
|
139
|
+
group: "",
|
|
140
|
+
sort: 0,
|
|
141
|
+
description: "",
|
|
142
|
+
state: 1
|
|
143
|
+
};
|
|
144
|
+
$Data.isSystem = false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
137
147
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
148
|
+
async function onSubmit(context?: PageDialogEventContext): Promise<void> {
|
|
149
|
+
const valid = await $From.form?.validate();
|
|
150
|
+
if (valid !== true) return;
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
|
|
154
|
-
$Emit("success");
|
|
155
|
-
$Method.onClose();
|
|
156
|
-
} else {
|
|
157
|
-
MessagePlugin.error(res.msg || "操作失败");
|
|
152
|
+
$Data.submitting = true;
|
|
153
|
+
try {
|
|
154
|
+
const api = $Prop.actionType === "upd" ? "/addon/admin/sysConfig/upd" : "/addon/admin/sysConfig/ins";
|
|
155
|
+
const res = await $Http.post(api, $Data.formData);
|
|
156
|
+
|
|
157
|
+
if (res.code === 0) {
|
|
158
|
+
MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
|
|
159
|
+
$Emit("success");
|
|
160
|
+
if (context && typeof context.close === "function") {
|
|
161
|
+
context.close();
|
|
158
162
|
}
|
|
159
|
-
}
|
|
160
|
-
MessagePlugin.error("操作失败");
|
|
161
|
-
} finally {
|
|
162
|
-
$Data.submitting = false;
|
|
163
|
+
} else {
|
|
164
|
+
MessagePlugin.error(res.msg || "操作失败");
|
|
163
165
|
}
|
|
166
|
+
} catch (error) {
|
|
167
|
+
MessagePlugin.error("操作失败");
|
|
168
|
+
} finally {
|
|
169
|
+
$Data.submitting = false;
|
|
164
170
|
}
|
|
165
|
-
}
|
|
171
|
+
}
|
|
166
172
|
|
|
167
|
-
|
|
168
|
-
$Method.initData();
|
|
173
|
+
initData();
|
|
169
174
|
</script>
|
|
170
175
|
|
|
171
176
|
<style scoped lang="scss"></style>
|