befly-admin-ui 1.10.1 → 1.10.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/components/detailPanel.vue +52 -54
- package/components/pageDialog.vue +131 -117
- package/components/pageTableDetail.vue +381 -402
- package/layouts/default.vue +212 -215
- package/package.json +2 -2
- package/views/config/dict/components/edit.vue +83 -60
- package/views/config/dict/index.vue +51 -55
- package/views/config/dictType/components/edit.vue +81 -57
- package/views/config/dictType/index.vue +37 -39
- package/views/config/system/components/edit.vue +97 -86
- package/views/config/system/index.vue +35 -37
- package/views/index/components/addonList.vue +14 -11
- package/views/index/components/environmentInfo.vue +25 -22
- package/views/index/components/operationLogs.vue +20 -16
- package/views/index/components/performanceMetrics.vue +24 -21
- package/views/index/components/serviceStatus.vue +26 -22
- package/views/index/components/systemNotifications.vue +24 -19
- package/views/index/components/systemOverview.vue +368 -385
- package/views/index/components/systemResources.vue +22 -19
- package/views/index/components/userInfo.vue +56 -56
- package/views/log/email/index.vue +96 -85
- package/views/log/error/index.vue +111 -117
- package/views/log/login/index.vue +15 -13
- package/views/log/operate/index.vue +31 -31
- package/views/login_1/index.vue +50 -32
- package/views/people/admin/components/edit.vue +1 -1
- package/views/people/admin/index.vue +27 -28
- package/views/permission/api/index.vue +44 -45
- package/views/permission/menu/index.vue +35 -35
- package/views/permission/role/components/api.vue +143 -144
- package/views/permission/role/components/edit.vue +74 -52
- package/views/permission/role/components/menu.vue +119 -121
- package/views/permission/role/index.vue +47 -49
- package/views/resource/gallery/index.vue +77 -78
- package/LICENSE +0 -201
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<PageDialog v-model="visible" :title="
|
|
3
|
-
<TForm
|
|
2
|
+
<PageDialog v-model="$Computed.visible" :title="$Computed.dialogTitle" @confirm="$Method.handleSubmit">
|
|
3
|
+
<TForm
|
|
4
|
+
:data="$Data.formData"
|
|
5
|
+
:rules="$Const.formRules"
|
|
6
|
+
label-width="100px"
|
|
7
|
+
:ref="
|
|
8
|
+
(value) => {
|
|
9
|
+
$From.formRef = value;
|
|
10
|
+
}
|
|
11
|
+
"
|
|
12
|
+
>
|
|
4
13
|
<TFormItem label="字典类型" name="typeCode">
|
|
5
14
|
<TSelect v-model="$Data.formData.typeCode" placeholder="请选择字典类型" filterable>
|
|
6
15
|
<TOption v-for="item in typeList" :key="item.code" :value="item.code" :label="item.name" />
|
|
@@ -23,13 +32,13 @@
|
|
|
23
32
|
</template>
|
|
24
33
|
|
|
25
34
|
<script setup>
|
|
26
|
-
import { computed, reactive
|
|
35
|
+
import { computed, reactive } from "vue";
|
|
27
36
|
|
|
28
37
|
import { Form as TForm, FormItem as TFormItem, Input as TInput, Select as TSelect, Option as TOption, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
|
|
29
38
|
import PageDialog from "befly-admin-ui/components/pageDialog.vue";
|
|
30
|
-
import { $Http } from "@/plugins/http";
|
|
39
|
+
import { $Http } from "@/plugins/http.js";
|
|
31
40
|
|
|
32
|
-
const
|
|
41
|
+
const $Prop = defineProps({
|
|
33
42
|
modelValue: Boolean,
|
|
34
43
|
actionType: String,
|
|
35
44
|
rowData: Object,
|
|
@@ -38,72 +47,86 @@ const props = defineProps({
|
|
|
38
47
|
|
|
39
48
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
40
49
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
typeCode: "",
|
|
51
|
-
key: "",
|
|
52
|
-
label: "",
|
|
53
|
-
sort: 0,
|
|
54
|
-
remark: ""
|
|
50
|
+
const $Const = {
|
|
51
|
+
createDefaultFormData() {
|
|
52
|
+
return {
|
|
53
|
+
typeCode: "",
|
|
54
|
+
key: "",
|
|
55
|
+
label: "",
|
|
56
|
+
sort: 0,
|
|
57
|
+
remark: ""
|
|
58
|
+
};
|
|
55
59
|
},
|
|
56
|
-
|
|
60
|
+
formRules: {
|
|
57
61
|
typeCode: [{ required: true, message: "请选择字典类型" }],
|
|
58
62
|
key: [{ required: true, message: "请输入键值" }],
|
|
59
63
|
label: [{ required: true, message: "请输入标签" }]
|
|
60
64
|
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const $From = {
|
|
68
|
+
formRef: null
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const $Data = reactive({
|
|
72
|
+
formData: $Const.createDefaultFormData()
|
|
61
73
|
});
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
const $Computed = reactive({
|
|
76
|
+
visible: computed({
|
|
77
|
+
get: () => $Prop.modelValue,
|
|
78
|
+
set: (value) => $Emit("update:modelValue", value)
|
|
79
|
+
}),
|
|
80
|
+
dialogTitle: computed(() => ($Prop.actionType === "add" ? "添加字典项" : "编辑字典项"))
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const $Method = {
|
|
84
|
+
resetFormData() {
|
|
85
|
+
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
86
|
+
},
|
|
87
|
+
initData() {
|
|
88
|
+
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
89
|
+
$Data.formData.typeCode = $Prop.rowData.typeCode || "";
|
|
90
|
+
$Data.formData.key = $Prop.rowData.key || "";
|
|
91
|
+
$Data.formData.label = $Prop.rowData.label || "";
|
|
92
|
+
$Data.formData.sort = $Prop.rowData.sort || 0;
|
|
93
|
+
$Data.formData.remark = $Prop.rowData.remark || "";
|
|
68
94
|
return;
|
|
69
95
|
}
|
|
70
96
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
if (props.actionType === "upd" && props.rowData) {
|
|
82
|
-
const row = props.rowData;
|
|
83
|
-
params["id"] = row["id"];
|
|
84
|
-
}
|
|
97
|
+
$Method.resetFormData();
|
|
98
|
+
},
|
|
99
|
+
async handleSubmit() {
|
|
100
|
+
try {
|
|
101
|
+
const form = $From.formRef;
|
|
102
|
+
if (!form) {
|
|
103
|
+
MessagePlugin.warning("表单未就绪");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
85
106
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
const valid = await form.validate();
|
|
108
|
+
if (valid !== true) return;
|
|
109
|
+
const apiUrl = $Prop.actionType === "add" ? "/core/dict/insert" : "/core/dict/update";
|
|
110
|
+
const params = {
|
|
111
|
+
typeCode: $Data.formData.typeCode,
|
|
112
|
+
key: $Data.formData.key,
|
|
113
|
+
label: $Data.formData.label,
|
|
114
|
+
sort: $Data.formData.sort,
|
|
115
|
+
remark: $Data.formData.remark
|
|
116
|
+
};
|
|
117
|
+
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
118
|
+
params["id"] = $Prop.rowData.id;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
await $Http(apiUrl, params);
|
|
122
|
+
MessagePlugin.success($Prop.actionType === "add" ? "添加成功" : "更新成功");
|
|
123
|
+
$Computed.visible = false;
|
|
124
|
+
$Emit("success");
|
|
125
|
+
} catch (error) {
|
|
126
|
+
MessagePlugin.error(error.msg || error.message || "操作失败");
|
|
127
|
+
}
|
|
92
128
|
}
|
|
93
|
-
}
|
|
129
|
+
};
|
|
94
130
|
|
|
95
|
-
|
|
96
|
-
if (props.actionType === "upd" && props.rowData) {
|
|
97
|
-
$Data.formData.typeCode = props.rowData.typeCode || "";
|
|
98
|
-
$Data.formData.key = props.rowData.key || "";
|
|
99
|
-
$Data.formData.label = props.rowData.label || "";
|
|
100
|
-
$Data.formData.sort = props.rowData.sort || 0;
|
|
101
|
-
$Data.formData.remark = props.rowData.remark || "";
|
|
102
|
-
} else {
|
|
103
|
-
$Data.formData.typeCode = "";
|
|
104
|
-
$Data.formData.key = "";
|
|
105
|
-
$Data.formData.label = "";
|
|
106
|
-
$Data.formData.sort = 0;
|
|
107
|
-
$Data.formData.remark = "";
|
|
108
|
-
}
|
|
131
|
+
$Method.initData();
|
|
109
132
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<PageTableDetail class="page-dict page-table" :columns="$Data.columns" :endpoints="$Data.endpoints">
|
|
3
3
|
<template #toolLeft>
|
|
4
|
-
<TButton theme="primary" @click="onAdd">
|
|
4
|
+
<TButton theme="primary" @click="$Method.onAdd">
|
|
5
5
|
<template #icon>
|
|
6
6
|
<AddIcon />
|
|
7
7
|
</template>
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<template #toolRight="scope">
|
|
12
|
-
<TSelect v-model="$Data.searchTypeCode" placeholder="请选择字典类型" clearable filterable @change="handleSearch(scope.reload)">
|
|
12
|
+
<TSelect v-model="$Data.searchTypeCode" placeholder="请选择字典类型" clearable filterable @change="$Method.handleSearch(scope.reload)">
|
|
13
13
|
<TOption v-for="item in $Data.typeList" :key="item.code" :value="item.code" :label="item.name" />
|
|
14
14
|
</TSelect>
|
|
15
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索键/标签" clearable @enter="handleSearch(scope.reload)" @clear="handleSearch(scope.reload)">
|
|
15
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索键/标签" clearable @enter="$Method.handleSearch(scope.reload)" @clear="$Method.handleSearch(scope.reload)">
|
|
16
16
|
<template #suffix-icon>
|
|
17
17
|
<SearchIcon />
|
|
18
18
|
</template>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<template #operation="{ row, deleteRow }">
|
|
23
|
-
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
23
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
|
|
24
24
|
<TButton theme="primary" size="small">
|
|
25
25
|
操作
|
|
26
26
|
<template #suffix><ChevronDownIcon /></template>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</template>
|
|
40
40
|
|
|
41
41
|
<template #dialogs="scope">
|
|
42
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" :type-list="$Data.typeList" @success="onDialogSuccess(scope.reload)" />
|
|
42
|
+
<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)" />
|
|
43
43
|
</template>
|
|
44
44
|
</PageTableDetail>
|
|
45
45
|
</template>
|
|
@@ -50,7 +50,7 @@ import { onMounted, reactive } from "vue";
|
|
|
50
50
|
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";
|
|
51
51
|
import { AddIcon, ChevronDownIcon, DeleteIcon, EditIcon, SearchIcon } from "tdesign-icons-vue-next";
|
|
52
52
|
import EditDialog from "./components/edit.vue";
|
|
53
|
-
import { $Http } from "@/plugins/http";
|
|
53
|
+
import { $Http } from "@/plugins/http.js";
|
|
54
54
|
import PageTableDetail from "befly-admin-ui/components/pageTableDetail.vue";
|
|
55
55
|
import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
|
|
56
56
|
|
|
@@ -96,59 +96,55 @@ const $Data = reactive({
|
|
|
96
96
|
rowData: {}
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
$Data.rowData = {};
|
|
128
|
-
$Data.editVisible = true;
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (type === "upd") {
|
|
133
|
-
$Data.actionType = "upd";
|
|
134
|
-
$Data.rowData = Object.assign({}, row);
|
|
135
|
-
$Data.editVisible = true;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
99
|
+
const $Method = {
|
|
100
|
+
onAdd() {
|
|
101
|
+
$Method.onAction("add", {});
|
|
102
|
+
},
|
|
103
|
+
onDialogSuccess(reload) {
|
|
104
|
+
reload({ keepSelection: true });
|
|
105
|
+
},
|
|
106
|
+
async initData() {
|
|
107
|
+
await $Method.apiDictTypeAll();
|
|
108
|
+
},
|
|
109
|
+
async apiDictTypeAll() {
|
|
110
|
+
try {
|
|
111
|
+
const res = await $Http("/core/dictType/all", {}, [""]);
|
|
112
|
+
$Data.typeList = res.data.lists || [];
|
|
113
|
+
} catch (error) {
|
|
114
|
+
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
handleSearch(reload) {
|
|
118
|
+
reload({ keepSelection: false, resetPage: true });
|
|
119
|
+
},
|
|
120
|
+
onAction(type, row) {
|
|
121
|
+
if (type === "add") {
|
|
122
|
+
$Data.actionType = "add";
|
|
123
|
+
$Data.rowData = {};
|
|
124
|
+
$Data.editVisible = true;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
138
127
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
128
|
+
if (type === "upd") {
|
|
129
|
+
$Data.actionType = "upd";
|
|
130
|
+
$Data.rowData = Object.assign({}, row);
|
|
131
|
+
$Data.editVisible = true;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
onDropdownAction(data, row, deleteRow) {
|
|
135
|
+
const record = data;
|
|
136
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
137
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
138
|
+
if (cmd === "del") {
|
|
139
|
+
deleteRow(row);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
$Method.onAction(cmd, row);
|
|
146
143
|
}
|
|
147
|
-
|
|
148
|
-
}
|
|
144
|
+
};
|
|
149
145
|
|
|
150
146
|
onMounted(() => {
|
|
151
|
-
initData();
|
|
147
|
+
$Method.initData();
|
|
152
148
|
});
|
|
153
149
|
</script>
|
|
154
150
|
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<PageDialog v-model="visible" :title="
|
|
3
|
-
<TForm
|
|
2
|
+
<PageDialog v-model="$Computed.visible" :title="$Computed.dialogTitle" @confirm="$Method.handleSubmit">
|
|
3
|
+
<TForm
|
|
4
|
+
:data="$Data.formData"
|
|
5
|
+
:rules="$Const.formRules"
|
|
6
|
+
label-width="100px"
|
|
7
|
+
:ref="
|
|
8
|
+
(value) => {
|
|
9
|
+
$From.formRef = value;
|
|
10
|
+
}
|
|
11
|
+
"
|
|
12
|
+
>
|
|
4
13
|
<TFormItem label="类型代码" name="code">
|
|
5
14
|
<TInput v-model="$Data.formData.code" placeholder="请输入类型代码(英文/数字/下划线)" :disabled="actionType === 'upd'" />
|
|
6
15
|
</TFormItem>
|
|
@@ -18,13 +27,13 @@
|
|
|
18
27
|
</template>
|
|
19
28
|
|
|
20
29
|
<script setup>
|
|
21
|
-
import { computed, reactive
|
|
30
|
+
import { computed, reactive } from "vue";
|
|
22
31
|
|
|
23
32
|
import { Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
|
|
24
33
|
import PageDialog from "befly-admin-ui/components/pageDialog.vue";
|
|
25
|
-
import { $Http } from "@/plugins/http";
|
|
34
|
+
import { $Http } from "@/plugins/http.js";
|
|
26
35
|
|
|
27
|
-
const
|
|
36
|
+
const $Prop = defineProps({
|
|
28
37
|
modelValue: Boolean,
|
|
29
38
|
actionType: String,
|
|
30
39
|
rowData: Object
|
|
@@ -32,68 +41,83 @@ const props = defineProps({
|
|
|
32
41
|
|
|
33
42
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
34
43
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
formData: {
|
|
44
|
-
code: "",
|
|
45
|
-
name: "",
|
|
46
|
-
description: "",
|
|
47
|
-
sort: 0
|
|
44
|
+
const $Const = {
|
|
45
|
+
createDefaultFormData() {
|
|
46
|
+
return {
|
|
47
|
+
code: "",
|
|
48
|
+
name: "",
|
|
49
|
+
description: "",
|
|
50
|
+
sort: 0
|
|
51
|
+
};
|
|
48
52
|
},
|
|
49
|
-
|
|
53
|
+
formRules: {
|
|
50
54
|
code: [{ required: true, message: "请输入类型代码" }],
|
|
51
55
|
name: [{ required: true, message: "请输入类型名称" }]
|
|
52
56
|
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const $From = {
|
|
60
|
+
formRef: null
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const $Data = reactive({
|
|
64
|
+
formData: $Const.createDefaultFormData()
|
|
53
65
|
});
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
const $Computed = reactive({
|
|
68
|
+
visible: computed({
|
|
69
|
+
get: () => $Prop.modelValue,
|
|
70
|
+
set: (value) => $Emit("update:modelValue", value)
|
|
71
|
+
}),
|
|
72
|
+
dialogTitle: computed(() => ($Prop.actionType === "add" ? "添加字典类型" : "编辑字典类型"))
|
|
73
|
+
});
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
const $Method = {
|
|
76
|
+
resetFormData() {
|
|
77
|
+
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
78
|
+
},
|
|
79
|
+
initData() {
|
|
80
|
+
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
81
|
+
$Data.formData.code = $Prop.rowData.code || "";
|
|
82
|
+
$Data.formData.name = $Prop.rowData.name || "";
|
|
83
|
+
$Data.formData.description = $Prop.rowData.description || "";
|
|
84
|
+
$Data.formData.sort = $Prop.rowData.sort || 0;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
64
87
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
if (props.actionType === "upd" && props.rowData) {
|
|
74
|
-
const row = props.rowData;
|
|
75
|
-
params["id"] = row["id"];
|
|
88
|
+
$Method.resetFormData();
|
|
89
|
+
},
|
|
90
|
+
async handleSubmit() {
|
|
91
|
+
const form = $From.formRef;
|
|
92
|
+
if (!form) {
|
|
93
|
+
MessagePlugin.warning("表单未就绪");
|
|
94
|
+
return;
|
|
76
95
|
}
|
|
77
96
|
|
|
78
|
-
await
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
const valid = await form.validate();
|
|
98
|
+
if (valid !== true) return;
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
const apiUrl = $Prop.actionType === "add" ? "/core/dictType/insert" : "/core/dictType/update";
|
|
102
|
+
const params = {
|
|
103
|
+
code: $Data.formData.code,
|
|
104
|
+
name: $Data.formData.name,
|
|
105
|
+
description: $Data.formData.description,
|
|
106
|
+
sort: $Data.formData.sort
|
|
107
|
+
};
|
|
108
|
+
if ($Prop.actionType === "upd" && $Prop.rowData) {
|
|
109
|
+
params["id"] = $Prop.rowData.id;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
await $Http(apiUrl, params);
|
|
113
|
+
MessagePlugin.success($Prop.actionType === "add" ? "添加成功" : "更新成功");
|
|
114
|
+
$Computed.visible = false;
|
|
115
|
+
$Emit("success");
|
|
116
|
+
} catch (error) {
|
|
117
|
+
MessagePlugin.error(error.msg || error.message || "操作失败");
|
|
118
|
+
}
|
|
84
119
|
}
|
|
85
|
-
}
|
|
120
|
+
};
|
|
86
121
|
|
|
87
|
-
|
|
88
|
-
if (props.actionType === "upd" && props.rowData) {
|
|
89
|
-
$Data.formData.code = props.rowData.code || "";
|
|
90
|
-
$Data.formData.name = props.rowData.name || "";
|
|
91
|
-
$Data.formData.description = props.rowData.description || "";
|
|
92
|
-
$Data.formData.sort = props.rowData.sort || 0;
|
|
93
|
-
} else {
|
|
94
|
-
$Data.formData.code = "";
|
|
95
|
-
$Data.formData.name = "";
|
|
96
|
-
$Data.formData.description = "";
|
|
97
|
-
$Data.formData.sort = 0;
|
|
98
|
-
}
|
|
122
|
+
$Method.initData();
|
|
99
123
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<PageTableDetail class="page-dict-type page-table" :columns="$Data.columns" :endpoints="$Data.endpoints">
|
|
3
3
|
<template #toolLeft>
|
|
4
|
-
<TButton theme="primary" @click="onAdd">
|
|
4
|
+
<TButton theme="primary" @click="$Method.onAdd">
|
|
5
5
|
<template #icon>
|
|
6
6
|
<AddIcon />
|
|
7
7
|
</template>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<template #toolRight="scope">
|
|
12
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索类型名称" clearable @enter="handleSearch(scope.reload)" @clear="handleSearch(scope.reload)">
|
|
12
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索类型名称" clearable @enter="$Method.handleSearch(scope.reload)" @clear="$Method.handleSearch(scope.reload)">
|
|
13
13
|
<template #suffix-icon>
|
|
14
14
|
<SearchIcon />
|
|
15
15
|
</template>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<template #operation="{ row, deleteRow }">
|
|
20
|
-
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
20
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
|
|
21
21
|
<TButton theme="primary" size="small">
|
|
22
22
|
操作
|
|
23
23
|
<template #suffix><ChevronDownIcon /></template>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<template #dialogs="scope">
|
|
39
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
39
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
40
40
|
</template>
|
|
41
41
|
</PageTableDetail>
|
|
42
42
|
</template>
|
|
@@ -89,43 +89,41 @@ const $Data = reactive({
|
|
|
89
89
|
rowData: {}
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (type === "upd") {
|
|
113
|
-
$Data.actionType = "upd";
|
|
114
|
-
$Data.rowData = Object.assign({}, row);
|
|
115
|
-
$Data.editVisible = true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
92
|
+
const $Method = {
|
|
93
|
+
onAdd() {
|
|
94
|
+
$Method.onAction("add", {});
|
|
95
|
+
},
|
|
96
|
+
onDialogSuccess(reload) {
|
|
97
|
+
reload({ keepSelection: true });
|
|
98
|
+
},
|
|
99
|
+
handleSearch(reload) {
|
|
100
|
+
reload({ keepSelection: false, resetPage: true });
|
|
101
|
+
},
|
|
102
|
+
onAction(type, row) {
|
|
103
|
+
if (type === "add") {
|
|
104
|
+
$Data.actionType = "add";
|
|
105
|
+
$Data.rowData = {};
|
|
106
|
+
$Data.editVisible = true;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
118
109
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
if (type === "upd") {
|
|
111
|
+
$Data.actionType = "upd";
|
|
112
|
+
$Data.rowData = Object.assign({}, row);
|
|
113
|
+
$Data.editVisible = true;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
onDropdownAction(data, row, deleteRow) {
|
|
117
|
+
const record = data;
|
|
118
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
119
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
120
|
+
if (cmd === "del") {
|
|
121
|
+
deleteRow(row);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
$Method.onAction(cmd, row);
|
|
126
125
|
}
|
|
127
|
-
|
|
128
|
-
}
|
|
126
|
+
};
|
|
129
127
|
</script>
|
|
130
128
|
|
|
131
129
|
<style scoped lang="scss">
|