befly-admin-ui 1.10.1 → 1.10.2
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
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<PageDialog v-model="dialogVisible" :title="$
|
|
2
|
+
<PageDialog v-model="$Computed.dialogVisible" :title="$Computed.dialogTitle" :confirm-loading="$Data.submitting" @confirm="$Method.onSubmit">
|
|
3
3
|
<div class="comp-role-edit">
|
|
4
|
-
<TForm
|
|
4
|
+
<TForm
|
|
5
|
+
:model="$Data.formData"
|
|
6
|
+
label-width="120px"
|
|
7
|
+
label-position="left"
|
|
8
|
+
:rules="$Const.formRules"
|
|
9
|
+
:ref="
|
|
10
|
+
(value) => {
|
|
11
|
+
$From.formRef = value;
|
|
12
|
+
}
|
|
13
|
+
"
|
|
14
|
+
>
|
|
5
15
|
<TFormItem label="角色名称" prop="name">
|
|
6
16
|
<TInput v-model="$Data.formData.name" placeholder="请输入角色名称" />
|
|
7
17
|
</TFormItem>
|
|
@@ -39,7 +49,7 @@ import {
|
|
|
39
49
|
MessagePlugin
|
|
40
50
|
} from "tdesign-vue-next";
|
|
41
51
|
import PageDialog from "befly-admin-ui/components/pageDialog.vue";
|
|
42
|
-
import { $Http } from "@/plugins/http";
|
|
52
|
+
import { $Http } from "@/plugins/http.js";
|
|
43
53
|
import { fieldClear } from "befly-admin-ui/utils/fieldClear";
|
|
44
54
|
|
|
45
55
|
const $Prop = defineProps({
|
|
@@ -59,24 +69,17 @@ const $Prop = defineProps({
|
|
|
59
69
|
|
|
60
70
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
description: "",
|
|
74
|
-
sort: 0,
|
|
75
|
-
state: 1
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const $Data2 = reactive({
|
|
72
|
+
const $Const = {
|
|
73
|
+
createDefaultFormData() {
|
|
74
|
+
return {
|
|
75
|
+
id: 0,
|
|
76
|
+
name: "",
|
|
77
|
+
code: "",
|
|
78
|
+
description: "",
|
|
79
|
+
sort: 0,
|
|
80
|
+
state: 1
|
|
81
|
+
};
|
|
82
|
+
},
|
|
80
83
|
formRules: {
|
|
81
84
|
name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
|
|
82
85
|
code: [
|
|
@@ -85,47 +88,66 @@ const $Data2 = reactive({
|
|
|
85
88
|
],
|
|
86
89
|
sort: [{ type: "number", message: "排序必须是数字", trigger: "blur" }]
|
|
87
90
|
}
|
|
88
|
-
}
|
|
91
|
+
};
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
}
|
|
93
|
+
const $From = {
|
|
94
|
+
formRef: null
|
|
95
|
+
};
|
|
95
96
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
$Emit("update:modelValue", value);
|
|
100
|
-
}
|
|
97
|
+
const $Data = reactive({
|
|
98
|
+
submitting: false,
|
|
99
|
+
formData: $Const.createDefaultFormData()
|
|
101
100
|
});
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
const $Computed = reactive({
|
|
103
|
+
dialogVisible: computed({
|
|
104
|
+
get: () => $Prop.modelValue,
|
|
105
|
+
set: (value) => {
|
|
106
|
+
$Emit("update:modelValue", value);
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
dialogTitle: computed(() => ($Prop.actionType === "upd" ? "更新角色" : "添加角色"))
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const $Method = {
|
|
113
|
+
resetFormData() {
|
|
114
|
+
Object.assign($Data.formData, $Const.createDefaultFormData());
|
|
115
|
+
},
|
|
116
|
+
initData() {
|
|
117
|
+
if ($Prop.actionType === "upd" && $Prop.rowData.id) {
|
|
118
|
+
Object.assign($Data.formData, $Const.createDefaultFormData(), $Prop.rowData);
|
|
108
119
|
return;
|
|
109
120
|
}
|
|
110
121
|
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
$Method.resetFormData();
|
|
123
|
+
},
|
|
124
|
+
async onSubmit(context) {
|
|
125
|
+
try {
|
|
126
|
+
const form = $From.formRef;
|
|
127
|
+
if (!form) {
|
|
128
|
+
MessagePlugin.warning("表单未就绪");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const valid = await form.validate();
|
|
133
|
+
if (!valid) return;
|
|
113
134
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
$Data.submitting = true;
|
|
136
|
+
const formData = $Prop.actionType === "add" ? fieldClear($Data.formData, { omitKeys: ["id", "state"] }) : $Data.formData;
|
|
137
|
+
const res = await $Http($Prop.actionType === "upd" ? "/core/role/update" : "/core/role/insert", formData);
|
|
117
138
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
MessagePlugin.success(res.msg);
|
|
140
|
+
$Emit("success");
|
|
141
|
+
if (context && typeof context.close === "function") {
|
|
142
|
+
context.close();
|
|
143
|
+
}
|
|
144
|
+
} catch (error) {
|
|
145
|
+
MessagePlugin.error(error.msg || error.message || "提交失败");
|
|
146
|
+
} finally {
|
|
147
|
+
$Data.submitting = false;
|
|
122
148
|
}
|
|
123
|
-
} catch (error) {
|
|
124
|
-
MessagePlugin.error(error.msg || error.message || "提交失败");
|
|
125
|
-
} finally {
|
|
126
|
-
$Data.submitting = false;
|
|
127
149
|
}
|
|
128
|
-
}
|
|
150
|
+
};
|
|
129
151
|
|
|
130
|
-
initData();
|
|
152
|
+
$Method.initData();
|
|
131
153
|
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<PageDialog v-model="dialogVisible" title="菜单权限" width="900px" :confirm-loading="$Data.submitting" @confirm="onSubmit">
|
|
2
|
+
<PageDialog v-model="$Computed.dialogVisible" title="菜单权限" width="900px" :confirm-loading="$Data.submitting" @confirm="$Method.onSubmit">
|
|
3
3
|
<div class="comp-role-menu">
|
|
4
4
|
<!-- 搜索框 -->
|
|
5
5
|
<div class="search-box">
|
|
6
|
-
<TInput v-model="$Data.searchText" placeholder="搜索菜单名称或路径" clearable @change="onSearch">
|
|
6
|
+
<TInput v-model="$Data.searchText" placeholder="搜索菜单名称或路径" clearable @change="$Method.onSearch">
|
|
7
7
|
<template #prefix-icon>
|
|
8
8
|
<SearchIcon />
|
|
9
9
|
</template>
|
|
@@ -38,7 +38,7 @@ import { computed, reactive } from "vue";
|
|
|
38
38
|
import { CheckboxGroup as TCheckboxGroup, Checkbox as TCheckbox, Input as TInput, MessagePlugin } from "tdesign-vue-next";
|
|
39
39
|
import { SearchIcon } from "tdesign-icons-vue-next";
|
|
40
40
|
import PageDialog from "befly-admin-ui/components/pageDialog.vue";
|
|
41
|
-
import { $Http } from "@/plugins/http";
|
|
41
|
+
import { $Http } from "@/plugins/http.js";
|
|
42
42
|
import { arrayToTree } from "befly-admin-ui/utils/arrayToTree";
|
|
43
43
|
|
|
44
44
|
const $Prop = defineProps({
|
|
@@ -54,13 +54,6 @@ const $Prop = defineProps({
|
|
|
54
54
|
|
|
55
55
|
const $Emit = defineEmits(["update:modelValue", "success"]);
|
|
56
56
|
|
|
57
|
-
const dialogVisible = computed({
|
|
58
|
-
get: () => $Prop.modelValue,
|
|
59
|
-
set: (value) => {
|
|
60
|
-
$Emit("update:modelValue", value);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
57
|
const $Data = reactive({
|
|
65
58
|
submitting: false,
|
|
66
59
|
searchText: "",
|
|
@@ -69,130 +62,135 @@ const $Data = reactive({
|
|
|
69
62
|
checkedMenuPaths: []
|
|
70
63
|
});
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
|
|
81
|
-
|
|
82
|
-
const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
|
|
83
|
-
const roots = Array.isArray(treeResult?.tree) ? treeResult.tree : [];
|
|
84
|
-
|
|
85
|
-
const groups = [];
|
|
86
|
-
for (const root of roots) {
|
|
87
|
-
const rootPath = typeof root?.path === "string" ? root.path : "";
|
|
88
|
-
const rootName = typeof root?.name === "string" ? root.name : "";
|
|
89
|
-
|
|
90
|
-
const menus = [];
|
|
91
|
-
|
|
92
|
-
const walk = (node, depth) => {
|
|
93
|
-
const name = typeof node["name"] === "string" ? String(node["name"]) : "";
|
|
94
|
-
const path = typeof node["path"] === "string" ? String(node["path"]) : "";
|
|
95
|
-
if (path.length > 0) {
|
|
96
|
-
menus.push({
|
|
97
|
-
value: path,
|
|
98
|
-
name: name,
|
|
99
|
-
path: path,
|
|
100
|
-
depth: depth,
|
|
101
|
-
label: `${name} ${path}`.trim()
|
|
102
|
-
});
|
|
103
|
-
}
|
|
65
|
+
const $Computed = reactive({
|
|
66
|
+
dialogVisible: computed({
|
|
67
|
+
get: () => $Prop.modelValue,
|
|
68
|
+
set: (value) => {
|
|
69
|
+
$Emit("update:modelValue", value);
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
});
|
|
104
73
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
74
|
+
const $Method = {
|
|
75
|
+
async initData() {
|
|
76
|
+
await Promise.all([$Method.apiMenuAll(), $Method.apiRoleMenuDetail()]);
|
|
77
|
+
$Data.filteredMenuGroups = $Data.menuGroups;
|
|
78
|
+
},
|
|
79
|
+
async apiMenuAll() {
|
|
80
|
+
try {
|
|
81
|
+
const res = await $Http("/core/menu/all", {}, [""]);
|
|
82
|
+
const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
|
|
83
|
+
|
|
84
|
+
const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
|
|
85
|
+
const roots = Array.isArray(treeResult?.tree) ? treeResult.tree : [];
|
|
86
|
+
|
|
87
|
+
const groups = [];
|
|
88
|
+
for (const root of roots) {
|
|
89
|
+
const rootPath = typeof root?.path === "string" ? root.path : "";
|
|
90
|
+
const rootName = typeof root?.name === "string" ? root.name : "";
|
|
91
|
+
const menus = [];
|
|
92
|
+
|
|
93
|
+
const walk = (node, depth) => {
|
|
94
|
+
const name = typeof node["name"] === "string" ? String(node["name"]) : "";
|
|
95
|
+
const path = typeof node["path"] === "string" ? String(node["path"]) : "";
|
|
96
|
+
if (path.length > 0) {
|
|
97
|
+
menus.push({
|
|
98
|
+
value: path,
|
|
99
|
+
name: name,
|
|
100
|
+
path: path,
|
|
101
|
+
depth: depth,
|
|
102
|
+
label: `${name} ${path}`.trim()
|
|
103
|
+
});
|
|
109
104
|
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
105
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
}
|
|
106
|
+
const children = Array.isArray(node["children"]) ? node["children"] : [];
|
|
107
|
+
for (const child of children) {
|
|
108
|
+
if (child && typeof child === "object") {
|
|
109
|
+
walk(child, depth + 1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
} catch (error) {
|
|
125
|
-
MessagePlugin.error(error.msg || error.message || "加载菜单失败");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
114
|
+
walk(root, 0);
|
|
128
115
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
roleCode: $Prop.rowData.code
|
|
137
|
-
},
|
|
138
|
-
[""]
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
$Data.checkedMenuPaths = Array.isArray(res.data) ? res.data : [];
|
|
142
|
-
} catch (error) {
|
|
143
|
-
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
144
|
-
}
|
|
145
|
-
}
|
|
116
|
+
const groupTitle = rootName.length > 0 ? rootName : rootPath;
|
|
117
|
+
groups.push({
|
|
118
|
+
name: rootPath.length > 0 ? rootPath : groupTitle,
|
|
119
|
+
title: groupTitle.length > 0 ? groupTitle : "未命名菜单",
|
|
120
|
+
menus: menus
|
|
121
|
+
});
|
|
122
|
+
}
|
|
146
123
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
124
|
+
$Data.menuGroups = groups;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
MessagePlugin.error(error.msg || error.message || "加载菜单失败");
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
async apiRoleMenuDetail() {
|
|
130
|
+
if (!$Prop.rowData.id) return;
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
const res = await $Http(
|
|
134
|
+
"/core/role/menus",
|
|
135
|
+
{
|
|
136
|
+
roleCode: $Prop.rowData.code
|
|
137
|
+
},
|
|
138
|
+
[""]
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
$Data.checkedMenuPaths = Array.isArray(res.data) ? res.data : [];
|
|
142
|
+
} catch (error) {
|
|
143
|
+
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
onSearch() {
|
|
147
|
+
const kw = typeof $Data.searchText === "string" ? $Data.searchText.trim().toLowerCase() : "";
|
|
148
|
+
if (kw.length === 0) {
|
|
149
|
+
$Data.filteredMenuGroups = $Data.menuGroups;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
153
152
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
$Data.filteredMenuGroups = $Data.menuGroups
|
|
154
|
+
.map((group) => {
|
|
155
|
+
const groupRecord = group && typeof group === "object" ? group : null;
|
|
156
|
+
const groupMenus = groupRecord && Array.isArray(groupRecord["menus"]) ? groupRecord["menus"] : [];
|
|
157
|
+
const menus = groupMenus.filter((menu) => {
|
|
158
|
+
const menuRecord = menu && typeof menu === "object" ? menu : null;
|
|
159
|
+
const label = menuRecord && typeof menuRecord["label"] === "string" ? String(menuRecord["label"]) : "";
|
|
160
|
+
return label.toLowerCase().includes(kw);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
name: groupRecord && typeof groupRecord["name"] === "string" ? String(groupRecord["name"]) : "",
|
|
165
|
+
title: groupRecord && typeof groupRecord["title"] === "string" ? String(groupRecord["title"]) : "",
|
|
166
|
+
menus: menus
|
|
167
|
+
};
|
|
168
|
+
})
|
|
169
|
+
.filter((group) => group.menus.length > 0);
|
|
170
|
+
},
|
|
171
|
+
async onSubmit(context) {
|
|
172
|
+
try {
|
|
173
|
+
$Data.submitting = true;
|
|
158
174
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return label.toLowerCase().includes(kw);
|
|
175
|
+
await $Http("/core/role/menuSave", {
|
|
176
|
+
roleCode: $Prop.rowData.code,
|
|
177
|
+
menuPaths: $Data.checkedMenuPaths
|
|
163
178
|
});
|
|
164
179
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
async function onSubmit(context) {
|
|
175
|
-
try {
|
|
176
|
-
$Data.submitting = true;
|
|
177
|
-
|
|
178
|
-
const res = await $Http("/core/role/menuSave", {
|
|
179
|
-
roleCode: $Prop.rowData.code,
|
|
180
|
-
menuPaths: $Data.checkedMenuPaths
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
MessagePlugin.success("保存成功");
|
|
184
|
-
$Emit("success");
|
|
185
|
-
if (context && typeof context.close === "function") {
|
|
186
|
-
context.close();
|
|
180
|
+
MessagePlugin.success("保存成功");
|
|
181
|
+
$Emit("success");
|
|
182
|
+
if (context && typeof context.close === "function") {
|
|
183
|
+
context.close();
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
MessagePlugin.error(error.msg || error.message || "保存失败");
|
|
187
|
+
} finally {
|
|
188
|
+
$Data.submitting = false;
|
|
187
189
|
}
|
|
188
|
-
} catch (error) {
|
|
189
|
-
MessagePlugin.error(error.msg || error.message || "保存失败");
|
|
190
|
-
} finally {
|
|
191
|
-
$Data.submitting = false;
|
|
192
190
|
}
|
|
193
|
-
}
|
|
191
|
+
};
|
|
194
192
|
|
|
195
|
-
initData();
|
|
193
|
+
$Method.initData();
|
|
196
194
|
</script>
|
|
197
195
|
|
|
198
196
|
<style scoped lang="scss">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<PageTableDetail class="page-role page-table" :columns="$Data.columns" :endpoints="$Data.endpoints" :table-slot-names="['state', 'menuCount', 'apiCount']">
|
|
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>
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<template #menuCount="{ row }">
|
|
18
|
-
{{ getPathCount(row.menus) }}
|
|
18
|
+
{{ $Method.getPathCount(row.menus) }}
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<template #apiCount="{ row }">
|
|
22
|
-
{{ getPathCount(row.apis) }}
|
|
22
|
+
{{ $Method.getPathCount(row.apis) }}
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<template #operation="{ row, deleteRow }">
|
|
26
|
-
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
26
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
|
|
27
27
|
<TButton theme="primary" size="small">
|
|
28
28
|
操作
|
|
29
29
|
<template #suffix><ChevronDownIcon /></template>
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
|
|
52
52
|
<template #dialogs="scope">
|
|
53
53
|
<!-- 编辑对话框组件 -->
|
|
54
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
54
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
55
55
|
|
|
56
56
|
<!-- 菜单权限对话框组件 -->
|
|
57
|
-
<MenuDialog v-if="$Data.menuVisible" v-model="$Data.menuVisible" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
57
|
+
<MenuDialog v-if="$Data.menuVisible" v-model="$Data.menuVisible" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
58
58
|
|
|
59
59
|
<!-- 接口权限对话框组件 -->
|
|
60
|
-
<ApiDialog v-if="$Data.apiVisible" v-model="$Data.apiVisible" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
60
|
+
<ApiDialog v-if="$Data.apiVisible" v-model="$Data.apiVisible" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
61
61
|
</template>
|
|
62
62
|
</PageTableDetail>
|
|
63
63
|
</template>
|
|
@@ -109,53 +109,51 @@ const $Data = reactive({
|
|
|
109
109
|
rowData: {}
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
function onAction(command, rowData) {
|
|
126
|
-
$Data.actionType = command;
|
|
127
|
-
|
|
128
|
-
if (command === "add") {
|
|
129
|
-
$Data.rowData = {};
|
|
130
|
-
} else {
|
|
131
|
-
$Data.rowData = Object.assign({}, rowData);
|
|
132
|
-
}
|
|
112
|
+
const $Method = {
|
|
113
|
+
onAdd() {
|
|
114
|
+
$Method.onAction("add", {});
|
|
115
|
+
},
|
|
116
|
+
onDialogSuccess(reload) {
|
|
117
|
+
reload({ keepSelection: true });
|
|
118
|
+
},
|
|
119
|
+
getPathCount(value) {
|
|
120
|
+
if (!Array.isArray(value)) return 0;
|
|
121
|
+
return value.filter((path) => typeof path === "string" && path.trim().length > 0).length;
|
|
122
|
+
},
|
|
123
|
+
onAction(command, rowData) {
|
|
124
|
+
$Data.actionType = command;
|
|
133
125
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
if (command === "add") {
|
|
127
|
+
$Data.rowData = {};
|
|
128
|
+
} else {
|
|
129
|
+
$Data.rowData = Object.assign({}, rowData);
|
|
130
|
+
}
|
|
138
131
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
132
|
+
if (command === "add" || command === "upd") {
|
|
133
|
+
$Data.editVisible = true;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
137
|
+
if (command === "menu") {
|
|
138
|
+
$Data.menuVisible = true;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
148
141
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
142
|
+
if (command === "api") {
|
|
143
|
+
$Data.apiVisible = true;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
onDropdownAction(data, rowData, deleteRow) {
|
|
147
|
+
const record = data;
|
|
148
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
149
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
150
|
+
if (cmd === "del") {
|
|
151
|
+
deleteRow(rowData);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
$Method.onAction(cmd, rowData);
|
|
156
155
|
}
|
|
157
|
-
|
|
158
|
-
}
|
|
156
|
+
};
|
|
159
157
|
</script>
|
|
160
158
|
|
|
161
159
|
<style scoped lang="scss">
|