befly-admin-ui 1.10.0 → 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 -398
- 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 +53 -68
- package/views/config/dictType/components/edit.vue +81 -57
- package/views/config/dictType/index.vue +39 -51
- package/views/config/system/components/edit.vue +97 -86
- package/views/config/system/index.vue +37 -51
- 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 +99 -100
- package/views/log/error/index.vue +112 -130
- package/views/log/login/index.vue +17 -28
- package/views/log/operate/index.vue +33 -46
- package/views/login_1/index.vue +50 -32
- package/views/people/admin/components/edit.vue +1 -1
- package/views/people/admin/index.vue +28 -29
- package/views/permission/api/index.vue +46 -58
- package/views/permission/menu/index.vue +46 -52
- 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 +49 -63
- package/views/resource/gallery/index.vue +78 -88
package/views/login_1/index.vue
CHANGED
|
@@ -20,7 +20,18 @@
|
|
|
20
20
|
<h2 class="login-title">欢迎回来</h2>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
|
-
<TForm
|
|
23
|
+
<TForm
|
|
24
|
+
:model="$Data.formData"
|
|
25
|
+
:rules="$Const.formRules"
|
|
26
|
+
:ref="
|
|
27
|
+
(value) => {
|
|
28
|
+
$From.formRef = value;
|
|
29
|
+
}
|
|
30
|
+
"
|
|
31
|
+
class="login-form"
|
|
32
|
+
:show-message="false"
|
|
33
|
+
label-width="0"
|
|
34
|
+
>
|
|
24
35
|
<TFormItem prop="account">
|
|
25
36
|
<TInputAdornment>
|
|
26
37
|
<template #prepend>
|
|
@@ -30,7 +41,7 @@
|
|
|
30
41
|
<TOption value="phone" label="手机号" />
|
|
31
42
|
</TSelect>
|
|
32
43
|
</template>
|
|
33
|
-
<TInput v-model="$Data.formData.account" :placeholder="$Data.formData.loginType === 'username' ? '请输入用户名' : $Data.formData.loginType === 'email' ? '请输入邮箱' : '请输入手机号'" size="large" clearable @enter="apiLogin">
|
|
44
|
+
<TInput v-model="$Data.formData.account" :placeholder="$Data.formData.loginType === 'username' ? '请输入用户名' : $Data.formData.loginType === 'email' ? '请输入邮箱' : '请输入手机号'" size="large" clearable @enter="$Method.apiLogin">
|
|
34
45
|
<template #prefix-icon>
|
|
35
46
|
<UserIcon />
|
|
36
47
|
</template>
|
|
@@ -39,7 +50,7 @@
|
|
|
39
50
|
</TFormItem>
|
|
40
51
|
|
|
41
52
|
<TFormItem prop="password">
|
|
42
|
-
<TInput v-model="$Data.formData.password" type="password" placeholder="密码" size="large" clearable @enter="apiLogin">
|
|
53
|
+
<TInput v-model="$Data.formData.password" type="password" placeholder="密码" size="large" clearable @enter="$Method.apiLogin">
|
|
43
54
|
<template #prefix-icon>
|
|
44
55
|
<LockOnIcon />
|
|
45
56
|
</template>
|
|
@@ -51,7 +62,7 @@
|
|
|
51
62
|
<a href="#" class="link-text">忘记密码?</a>
|
|
52
63
|
</div>
|
|
53
64
|
|
|
54
|
-
<TButton theme="primary" class="login-btn" size="large" block :loading="$Data.loading" @click="apiLogin">登录</TButton>
|
|
65
|
+
<TButton theme="primary" class="login-btn" size="large" block :loading="$Data.loading" @click="$Method.apiLogin">登录</TButton>
|
|
55
66
|
</TForm>
|
|
56
67
|
|
|
57
68
|
<div class="login-footer">
|
|
@@ -63,7 +74,7 @@
|
|
|
63
74
|
</template>
|
|
64
75
|
|
|
65
76
|
<script setup>
|
|
66
|
-
import { reactive
|
|
77
|
+
import { reactive } from "vue";
|
|
67
78
|
import { useRouter } from "vue-router";
|
|
68
79
|
import { Form as TForm, FormItem as TFormItem, Input as TInput, Button as TButton, Checkbox as TCheckbox, InputAdornment as TInputAdornment, Select as TSelect, Option as TOption, MessagePlugin } from "tdesign-vue-next";
|
|
69
80
|
import { LockOnIcon, UserIcon } from "tdesign-icons-vue-next";
|
|
@@ -74,16 +85,21 @@ import { $Store } from "@/plugins/store.js";
|
|
|
74
85
|
|
|
75
86
|
const router = useRouter();
|
|
76
87
|
|
|
77
|
-
const
|
|
88
|
+
const $Const = {
|
|
89
|
+
formRules: {
|
|
90
|
+
account: [{ required: true, message: "请输入账号", trigger: "blur" }],
|
|
91
|
+
password: [{ required: true, message: "请输入密码", trigger: "blur" }]
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const $From = {
|
|
96
|
+
formRef: null
|
|
97
|
+
};
|
|
78
98
|
|
|
79
99
|
// 数据定义
|
|
80
100
|
const $Data = reactive({
|
|
81
101
|
loading: false,
|
|
82
102
|
rememberMe: false,
|
|
83
|
-
formRules: {
|
|
84
|
-
account: [{ required: true, message: "请输入账号", trigger: "blur" }],
|
|
85
|
-
password: [{ required: true, message: "请输入密码", trigger: "blur" }]
|
|
86
|
-
},
|
|
87
103
|
formData: {
|
|
88
104
|
loginType: "username",
|
|
89
105
|
account: "",
|
|
@@ -91,36 +107,38 @@ const $Data = reactive({
|
|
|
91
107
|
}
|
|
92
108
|
});
|
|
93
109
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
const $Method = {
|
|
111
|
+
async apiLogin() {
|
|
112
|
+
try {
|
|
113
|
+
if ($From.formRef === null) {
|
|
114
|
+
MessagePlugin.error("表单未就绪");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
100
117
|
|
|
101
|
-
|
|
118
|
+
await $From.formRef.validate();
|
|
102
119
|
|
|
103
|
-
|
|
120
|
+
$Data.loading = true;
|
|
104
121
|
|
|
105
|
-
|
|
122
|
+
const hashedPassword = await hashPassword($Data.formData.password);
|
|
106
123
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
const res = await $Http("/core/auth/login", {
|
|
125
|
+
loginType: $Data.formData.loginType,
|
|
126
|
+
account: $Data.formData.account,
|
|
127
|
+
password: hashedPassword
|
|
128
|
+
});
|
|
112
129
|
|
|
113
|
-
|
|
130
|
+
$Store.local.set($Config.tokenName, res.data.token);
|
|
114
131
|
|
|
115
|
-
|
|
132
|
+
MessagePlugin.success(res.msg || "登录成功");
|
|
116
133
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
await router.push($Config.homePath);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
MessagePlugin.error(error.msg || error.message || "登录失败");
|
|
137
|
+
} finally {
|
|
138
|
+
$Data.loading = false;
|
|
139
|
+
}
|
|
122
140
|
}
|
|
123
|
-
}
|
|
141
|
+
};
|
|
124
142
|
</script>
|
|
125
143
|
|
|
126
144
|
<style scoped lang="scss">
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
MessagePlugin
|
|
39
39
|
} from "tdesign-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 { fieldClear } from "befly-admin-ui/utils/fieldClear";
|
|
43
43
|
import { hashPassword } from "befly-admin-ui/utils/hashPassword";
|
|
44
44
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<PageTableDetail class="page-admin" :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>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<template #operation="{ row, deleteRow }">
|
|
18
|
-
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
18
|
+
<TDropdown trigger="click" placement="bottom-right" @click="$Method.onDropdownAction($event, row, deleteRow)">
|
|
19
19
|
<TButton theme="primary" size="small">
|
|
20
20
|
操作
|
|
21
21
|
<template #suffix><ChevronDownIcon /></template>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<template #dialogs="scope">
|
|
37
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
37
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.onDialogSuccess(scope.reload)" />
|
|
38
38
|
</template>
|
|
39
39
|
</PageTableDetail>
|
|
40
40
|
</template>
|
|
@@ -58,7 +58,7 @@ const $Data = reactive({
|
|
|
58
58
|
]),
|
|
59
59
|
endpoints: {
|
|
60
60
|
list: {
|
|
61
|
-
path: "/core/admin/
|
|
61
|
+
path: "/core/admin/select",
|
|
62
62
|
dropValues: [""]
|
|
63
63
|
},
|
|
64
64
|
delete: {
|
|
@@ -76,32 +76,31 @@ const $Data = reactive({
|
|
|
76
76
|
rowData: {}
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
79
|
+
const $Method = {
|
|
80
|
+
onAdd() {
|
|
81
|
+
$Method.onAction("add", {});
|
|
82
|
+
},
|
|
83
|
+
onDialogSuccess(reload) {
|
|
84
|
+
reload({ keepSelection: true });
|
|
85
|
+
},
|
|
86
|
+
onAction(command, rowData) {
|
|
87
|
+
$Data.actionType = command;
|
|
88
|
+
$Data.rowData = rowData;
|
|
89
|
+
if (command === "add" || command === "upd") {
|
|
90
|
+
$Data.editVisible = true;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onDropdownAction(data, rowData, deleteRow) {
|
|
94
|
+
const record = data;
|
|
95
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
96
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
97
|
+
if (cmd === "del") {
|
|
98
|
+
deleteRow(rowData);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
$Method.onAction(cmd, rowData);
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
}
|
|
103
|
+
};
|
|
105
104
|
</script>
|
|
106
105
|
|
|
107
106
|
<style scoped lang="scss">
|
|
@@ -2,25 +2,18 @@
|
|
|
2
2
|
<div class="page-api page-table">
|
|
3
3
|
<div class="main-tool">
|
|
4
4
|
<div class="left">
|
|
5
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索接口名称或路径" clearable style="width: 300px" @enter="handleSearch" @clear="handleSearch">
|
|
5
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索接口名称或路径" clearable style="width: 300px" @enter="$Method.handleSearch" @clear="$Method.handleSearch">
|
|
6
6
|
<template #suffix-icon>
|
|
7
7
|
<SearchIcon />
|
|
8
8
|
</template>
|
|
9
9
|
</TInput>
|
|
10
10
|
<span style="margin-left: 16px; color: var(--text-secondary); font-size: 13px">共 {{ $Data.allData.length }} 个接口</span>
|
|
11
11
|
</div>
|
|
12
|
-
<div class="right">
|
|
13
|
-
<TButton shape="circle" @click="handleRefresh">
|
|
14
|
-
<template #icon>
|
|
15
|
-
<RefreshIcon />
|
|
16
|
-
</template>
|
|
17
|
-
</TButton>
|
|
18
|
-
</div>
|
|
19
12
|
</div>
|
|
20
13
|
|
|
21
14
|
<div class="main-content">
|
|
22
15
|
<div class="main-table">
|
|
23
|
-
<TTable :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - var(--search-height) - var(--layout-gap) * 2)" active-row-type="single" @active-change="onActiveChange">
|
|
16
|
+
<TTable :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - var(--search-height) - var(--layout-gap) * 2)" active-row-type="single" @active-change="$Method.onActiveChange">
|
|
24
17
|
<template #method="{ row }">
|
|
25
18
|
<TTag v-if="row.method === 'GET'" shape="round" theme="success" variant="light-outline">GET</TTag>
|
|
26
19
|
<TTag v-else-if="row.method === 'POST'" shape="round" theme="primary" variant="light-outline">POST</TTag>
|
|
@@ -60,10 +53,10 @@
|
|
|
60
53
|
|
|
61
54
|
<script setup>
|
|
62
55
|
import { reactive } from "vue";
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
56
|
+
import { Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
|
|
57
|
+
import { SearchIcon } from "tdesign-icons-vue-next";
|
|
65
58
|
import DetailPanel from "befly-admin-ui/components/detailPanel.vue";
|
|
66
|
-
import { $Http } from "@/plugins/http";
|
|
59
|
+
import { $Http } from "@/plugins/http.js";
|
|
67
60
|
import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
|
|
68
61
|
|
|
69
62
|
// 响应式数据
|
|
@@ -83,56 +76,51 @@ const $Data = reactive({
|
|
|
83
76
|
activeRowKeys: []
|
|
84
77
|
});
|
|
85
78
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
async
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
79
|
+
const $Method = {
|
|
80
|
+
async initData() {
|
|
81
|
+
await $Method.loadApiAll();
|
|
82
|
+
},
|
|
83
|
+
async loadApiAll() {
|
|
84
|
+
$Data.loading = true;
|
|
85
|
+
try {
|
|
86
|
+
const res = await $Http("/core/api/all", {}, [""]);
|
|
87
|
+
const list = res.data?.lists || [];
|
|
88
|
+
$Data.allData = list;
|
|
89
|
+
$Data.tableData = list;
|
|
97
90
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
if ($Data.tableData.length > 0) {
|
|
92
|
+
$Data.currentRow = $Data.tableData[0];
|
|
93
|
+
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
94
|
+
} else {
|
|
95
|
+
$Data.currentRow = null;
|
|
96
|
+
$Data.activeRowKeys = [];
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
100
|
+
} finally {
|
|
101
|
+
$Data.loading = false;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
handleSearch() {
|
|
105
|
+
if (!$Data.searchKeyword) {
|
|
106
|
+
$Data.tableData = $Data.allData;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const keyword = String($Data.searchKeyword).toLowerCase();
|
|
110
|
+
$Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
|
|
111
|
+
},
|
|
112
|
+
onActiveChange(value, context) {
|
|
113
|
+
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
$Data.activeRowKeys = value;
|
|
117
|
+
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
118
|
+
$Data.currentRow = context.activeRowList[0].row;
|
|
104
119
|
}
|
|
105
|
-
} catch (error) {
|
|
106
|
-
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
107
|
-
} finally {
|
|
108
|
-
$Data.loading = false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function handleRefresh() {
|
|
113
|
-
loadApiAll();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function handleSearch() {
|
|
117
|
-
if (!$Data.searchKeyword) {
|
|
118
|
-
$Data.tableData = $Data.allData;
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const keyword = String($Data.searchKeyword).toLowerCase();
|
|
122
|
-
$Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function onActiveChange(value, context) {
|
|
126
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
$Data.activeRowKeys = value;
|
|
130
|
-
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
131
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
132
120
|
}
|
|
133
|
-
}
|
|
121
|
+
};
|
|
134
122
|
|
|
135
|
-
initData();
|
|
123
|
+
$Method.initData();
|
|
136
124
|
</script>
|
|
137
125
|
|
|
138
126
|
<style scoped lang="scss">
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page-menu page-table">
|
|
3
|
-
<div class="main-tool">
|
|
4
|
-
<div class="left"></div>
|
|
5
|
-
<div class="right">
|
|
6
|
-
<TButton shape="circle" @click="handleRefresh">
|
|
7
|
-
<template #icon>
|
|
8
|
-
<RefreshIcon />
|
|
9
|
-
</template>
|
|
10
|
-
</TButton>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
3
|
<div class="main-content">
|
|
15
4
|
<div class="main-table">
|
|
16
|
-
<TTable
|
|
5
|
+
<TTable
|
|
6
|
+
:data="$Data.tableData"
|
|
7
|
+
:columns="$Data.columns"
|
|
8
|
+
:loading="$Data.loading"
|
|
9
|
+
:active-row-keys="$Data.activeRowKeys"
|
|
10
|
+
row-key="id"
|
|
11
|
+
height="calc(100vh - var(--layout-gap) * 2)"
|
|
12
|
+
active-row-type="single"
|
|
13
|
+
:tree="{ childrenKey: 'children', treeNodeColumnIndex: 0, defaultExpandAll: true }"
|
|
14
|
+
@active-change="$Method.onActiveChange"
|
|
15
|
+
>
|
|
17
16
|
<template #state="{ row }">
|
|
18
17
|
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
19
18
|
<TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
|
|
@@ -31,10 +30,9 @@
|
|
|
31
30
|
|
|
32
31
|
<script setup>
|
|
33
32
|
import { reactive } from "vue";
|
|
34
|
-
import {
|
|
35
|
-
import { RefreshIcon } from "tdesign-icons-vue-next";
|
|
33
|
+
import { Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
|
|
36
34
|
import DetailPanel from "befly-admin-ui/components/detailPanel.vue";
|
|
37
|
-
import { $Http } from "@/plugins/http";
|
|
35
|
+
import { $Http } from "@/plugins/http.js";
|
|
38
36
|
import { arrayToTree } from "befly-admin-ui/utils/arrayToTree";
|
|
39
37
|
import { withDefaultColumns } from "befly-admin-ui/utils/withDefaultColumns";
|
|
40
38
|
|
|
@@ -53,49 +51,45 @@ const $Data = reactive({
|
|
|
53
51
|
activeRowKeys: []
|
|
54
52
|
});
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
async
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
const $Method = {
|
|
55
|
+
async initData() {
|
|
56
|
+
await $Method.apiMenuList();
|
|
57
|
+
},
|
|
58
|
+
async apiMenuList() {
|
|
59
|
+
$Data.loading = true;
|
|
60
|
+
try {
|
|
61
|
+
const res = await $Http("/core/menu/all", {}, [""]);
|
|
62
|
+
const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
$Data.tableData = treeResult.tree;
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
if ($Data.tableData.length > 0) {
|
|
69
|
+
$Data.currentRow = $Data.tableData[0];
|
|
70
|
+
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
71
|
+
} else {
|
|
72
|
+
$Data.currentRow = null;
|
|
73
|
+
$Data.activeRowKeys = [];
|
|
74
|
+
}
|
|
75
|
+
} catch (error) {
|
|
76
|
+
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
77
|
+
} finally {
|
|
78
|
+
$Data.loading = false;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onActiveChange(value, context) {
|
|
82
|
+
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
$Data.activeRowKeys = value;
|
|
86
|
+
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
87
|
+
$Data.currentRow = context.activeRowList[0].row;
|
|
76
88
|
}
|
|
77
|
-
} catch (error) {
|
|
78
|
-
MessagePlugin.error(error.msg || error.message || "加载数据失败");
|
|
79
|
-
} finally {
|
|
80
|
-
$Data.loading = false;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function handleRefresh() {
|
|
85
|
-
apiMenuList();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function onActiveChange(value, context) {
|
|
89
|
-
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
$Data.activeRowKeys = value;
|
|
93
|
-
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
94
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
95
89
|
}
|
|
96
|
-
}
|
|
90
|
+
};
|
|
97
91
|
|
|
98
|
-
initData();
|
|
92
|
+
$Method.initData();
|
|
99
93
|
</script>
|
|
100
94
|
|
|
101
95
|
<style scoped lang="scss">
|