@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
|
@@ -2,7 +2,7 @@
|
|
|
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="
|
|
5
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索接口名称或路径" clearable style="width: 300px" @enter="handleSearch" @clear="handleSearch">
|
|
6
6
|
<template #suffix-icon>
|
|
7
7
|
<ILucideSearch />
|
|
8
8
|
</template>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<span style="margin-left: 16px; color: var(--text-secondary); font-size: 13px">共 {{ $Data.allData.length }} 个接口</span>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="right">
|
|
13
|
-
<TButton shape="circle" @click="
|
|
13
|
+
<TButton shape="circle" @click="handleRefresh">
|
|
14
14
|
<template #icon>
|
|
15
15
|
<ILucideRotateCw />
|
|
16
16
|
</template>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<div class="main-content">
|
|
22
22
|
<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="
|
|
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">
|
|
24
24
|
<template #method="{ row }">
|
|
25
25
|
<TTag v-if="row.method === 'GET'" shape="round" theme="success" variant="light-outline">GET</TTag>
|
|
26
26
|
<TTag v-else-if="row.method === 'POST'" shape="round" theme="primary" variant="light-outline">POST</TTag>
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
import { Button as TButton, Table as TTable, Tag as TTag, Input as TInput, MessagePlugin } from "tdesign-vue-next";
|
|
63
63
|
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
64
64
|
import ILucideSearch from "~icons/lucide/search";
|
|
65
|
-
import DetailPanel from "@/components/
|
|
65
|
+
import DetailPanel from "@/components/detailPanel.vue";
|
|
66
66
|
import { $Http } from "@/plugins/http";
|
|
67
67
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
68
68
|
|
|
@@ -83,72 +83,62 @@ const $Data = $ref({
|
|
|
83
83
|
activeRowKeys: []
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
await $Method.loadApiAll();
|
|
90
|
-
},
|
|
86
|
+
async function initData(): Promise<void> {
|
|
87
|
+
await loadApiAll();
|
|
88
|
+
}
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
dropValues: [""]
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
const list = res.data?.lists || [];
|
|
104
|
-
$Data.allData = list;
|
|
105
|
-
$Data.tableData = list;
|
|
106
|
-
|
|
107
|
-
// 自动高亮第一行
|
|
108
|
-
if ($Data.tableData.length > 0) {
|
|
109
|
-
$Data.currentRow = $Data.tableData[0];
|
|
110
|
-
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
111
|
-
} else {
|
|
112
|
-
$Data.currentRow = null;
|
|
113
|
-
$Data.activeRowKeys = [];
|
|
90
|
+
async function loadApiAll(): Promise<void> {
|
|
91
|
+
$Data.loading = true;
|
|
92
|
+
try {
|
|
93
|
+
const res = await $Http.post(
|
|
94
|
+
"/addon/admin/api/all",
|
|
95
|
+
{},
|
|
96
|
+
{
|
|
97
|
+
dropValues: [""]
|
|
114
98
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
99
|
+
);
|
|
100
|
+
const list = res.data?.lists || [];
|
|
101
|
+
$Data.allData = list;
|
|
102
|
+
$Data.tableData = list;
|
|
103
|
+
|
|
104
|
+
if ($Data.tableData.length > 0) {
|
|
105
|
+
$Data.currentRow = $Data.tableData[0];
|
|
106
|
+
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
107
|
+
} else {
|
|
108
|
+
$Data.currentRow = null;
|
|
109
|
+
$Data.activeRowKeys = [];
|
|
119
110
|
}
|
|
120
|
-
}
|
|
111
|
+
} catch (error) {
|
|
112
|
+
MessagePlugin.error("加载数据失败");
|
|
113
|
+
} finally {
|
|
114
|
+
$Data.loading = false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
118
|
+
function handleRefresh(): void {
|
|
119
|
+
loadApiAll();
|
|
120
|
+
}
|
|
126
121
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
122
|
+
function handleSearch(): void {
|
|
123
|
+
if (!$Data.searchKeyword) {
|
|
124
|
+
$Data.tableData = $Data.allData;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const keyword = String($Data.searchKeyword).toLowerCase();
|
|
128
|
+
$Data.tableData = $Data.allData.filter((item) => item.name?.toLowerCase().includes(keyword) || item.path?.toLowerCase().includes(keyword));
|
|
129
|
+
}
|
|
136
130
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
$Data.
|
|
144
|
-
// 更新当前高亮的行数据
|
|
145
|
-
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
146
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
147
|
-
}
|
|
131
|
+
function onActiveChange(value: unknown[], context: { activeRowList?: Array<{ row: unknown }> }): void {
|
|
132
|
+
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
$Data.activeRowKeys = value;
|
|
136
|
+
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
137
|
+
$Data.currentRow = context.activeRowList[0].row as never;
|
|
148
138
|
}
|
|
149
|
-
}
|
|
139
|
+
}
|
|
150
140
|
|
|
151
|
-
|
|
141
|
+
initData();
|
|
152
142
|
</script>
|
|
153
143
|
|
|
154
144
|
<style scoped lang="scss">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="main-tool">
|
|
4
4
|
<div class="left"></div>
|
|
5
5
|
<div class="right">
|
|
6
|
-
<TButton shape="circle" @click="
|
|
6
|
+
<TButton shape="circle" @click="handleRefresh">
|
|
7
7
|
<template #icon>
|
|
8
8
|
<ILucideRotateCw />
|
|
9
9
|
</template>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
height="calc(100vh - var(--search-height) - var(--layout-gap) * 2)"
|
|
23
23
|
active-row-type="single"
|
|
24
24
|
:tree="{ childrenKey: 'children', treeNodeColumnIndex: 0, defaultExpandAll: true }"
|
|
25
|
-
@active-change="
|
|
25
|
+
@active-change="onActiveChange"
|
|
26
26
|
>
|
|
27
27
|
<template #state="{ row }">
|
|
28
28
|
<TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<script setup lang="ts">
|
|
43
43
|
import { Button as TButton, Table as TTable, Tag as TTag, MessagePlugin } from "tdesign-vue-next";
|
|
44
44
|
import ILucideRotateCw from "~icons/lucide/rotate-cw";
|
|
45
|
-
import DetailPanel from "@/components/
|
|
45
|
+
import DetailPanel from "@/components/detailPanel.vue";
|
|
46
46
|
import { $Http } from "@/plugins/http";
|
|
47
47
|
import { arrayToTree } from "befly-shared/utils/arrayToTree";
|
|
48
48
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
@@ -62,65 +62,55 @@ const $Data = $ref({
|
|
|
62
62
|
activeRowKeys: []
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
await $Method.apiMenuList();
|
|
69
|
-
},
|
|
65
|
+
async function initData(): Promise<void> {
|
|
66
|
+
await apiMenuList();
|
|
67
|
+
}
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
|
|
69
|
+
async function apiMenuList(): Promise<void> {
|
|
70
|
+
$Data.loading = true;
|
|
71
|
+
try {
|
|
72
|
+
const res = await $Http.post(
|
|
73
|
+
"/addon/admin/menu/all",
|
|
74
|
+
{},
|
|
75
|
+
{
|
|
76
|
+
dropValues: [""]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const lists = Array.isArray(res?.data?.lists) ? res.data.lists : [];
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
const treeResult = arrayToTree(lists, "path", "parentPath", "children", "sort");
|
|
85
82
|
|
|
86
|
-
|
|
87
|
-
$Data.tableData = treeResult.tree;
|
|
83
|
+
$Data.tableData = treeResult.tree;
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
$Data.activeRowKeys = [];
|
|
96
|
-
}
|
|
97
|
-
} catch (error) {
|
|
98
|
-
MessagePlugin.error("加载数据失败");
|
|
99
|
-
} finally {
|
|
100
|
-
$Data.loading = false;
|
|
85
|
+
if ($Data.tableData.length > 0) {
|
|
86
|
+
$Data.currentRow = $Data.tableData[0];
|
|
87
|
+
$Data.activeRowKeys = [$Data.tableData[0].id];
|
|
88
|
+
} else {
|
|
89
|
+
$Data.currentRow = null;
|
|
90
|
+
$Data.activeRowKeys = [];
|
|
101
91
|
}
|
|
102
|
-
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
MessagePlugin.error("加载数据失败");
|
|
94
|
+
} finally {
|
|
95
|
+
$Data.loading = false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
99
|
+
function handleRefresh(): void {
|
|
100
|
+
apiMenuList();
|
|
101
|
+
}
|
|
108
102
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
$Data.
|
|
116
|
-
// 更新当前高亮的行数据
|
|
117
|
-
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
118
|
-
$Data.currentRow = context.activeRowList[0].row;
|
|
119
|
-
}
|
|
103
|
+
function onActiveChange(value: unknown[], context: { activeRowList?: Array<{ row: unknown }> }): void {
|
|
104
|
+
if (value.length === 0 && $Data.activeRowKeys.length > 0) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
$Data.activeRowKeys = value;
|
|
108
|
+
if (context.activeRowList && context.activeRowList.length > 0) {
|
|
109
|
+
$Data.currentRow = context.activeRowList[0].row as never;
|
|
120
110
|
}
|
|
121
|
-
}
|
|
111
|
+
}
|
|
122
112
|
|
|
123
|
-
|
|
113
|
+
initData();
|
|
124
114
|
</script>
|
|
125
115
|
|
|
126
116
|
<style scoped lang="scss">
|