@befly-addon/admin 1.0.31 → 1.0.32
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/package.json +4 -30
- package/views/403/index.vue +2 -4
- package/views/admin/components/edit.vue +32 -40
- package/views/admin/components/role.vue +11 -16
- package/views/admin/index.vue +47 -57
- package/views/dict/components/edit.vue +31 -40
- package/views/dict/index.vue +43 -53
- package/views/index/components/addonList.vue +1 -2
- package/views/index/components/operationLogs.vue +2 -3
- package/views/index/components/quickActions.vue +2 -3
- package/views/index/components/systemNotifications.vue +1 -2
- package/views/index/components/systemResources.vue +0 -1
- package/views/index/components/userInfo.vue +2 -3
- package/views/login/components/emailLoginForm.vue +12 -17
- package/views/login/components/registerForm.vue +19 -23
- package/views/menu/components/edit.vue +25 -34
- package/views/menu/index.vue +45 -56
- package/views/news/index.vue +0 -1
- package/views/role/components/api.vue +10 -16
- package/views/role/components/edit.vue +26 -35
- package/views/role/components/menu.vue +10 -15
- package/views/role/index.vue +49 -59
- package/views/user/index.vue +4 -6
package/views/menu/index.vue
CHANGED
|
@@ -2,64 +2,53 @@
|
|
|
2
2
|
<div class="page-menu page-table">
|
|
3
3
|
<div class="main-tool">
|
|
4
4
|
<div class="left">
|
|
5
|
-
<
|
|
5
|
+
<t-button type="primary" @click="$Method.onAction('add', {})">
|
|
6
6
|
<template #icon>
|
|
7
7
|
<IconLucidePlus />
|
|
8
8
|
</template>
|
|
9
9
|
添加菜单
|
|
10
|
-
</
|
|
10
|
+
</t-button>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="right">
|
|
13
|
-
<
|
|
13
|
+
<t-button @click="$Method.handleRefresh">
|
|
14
14
|
<template #icon>
|
|
15
15
|
<IconLucideRotateCw />
|
|
16
16
|
</template>
|
|
17
17
|
刷新
|
|
18
|
-
</
|
|
18
|
+
</t-button>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
21
|
<div class="main-table">
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</TinyDropdownItem>
|
|
49
|
-
<TinyDropdownItem :item-data="{ command: 'del' }" divided>
|
|
50
|
-
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
51
|
-
删除
|
|
52
|
-
</TinyDropdownItem>
|
|
53
|
-
</TinyDropdownMenu>
|
|
54
|
-
</template>
|
|
55
|
-
</TinyDropdown>
|
|
56
|
-
</template>
|
|
57
|
-
</TinyGridColumn>
|
|
58
|
-
</TinyGrid>
|
|
22
|
+
<t-table :data="$Data.menuList" :columns="$Data.columns" header-cell-class-name="custom-table-cell-class" size="small" height="100%" row-key="id">
|
|
23
|
+
<template #icon="{ row }">
|
|
24
|
+
<IconLucideSquare v-if="row.icon" />
|
|
25
|
+
<span v-else>-</span>
|
|
26
|
+
</template>
|
|
27
|
+
<template #state="{ row }">
|
|
28
|
+
<t-tag v-if="row.state === 1" theme="success">正常</t-tag>
|
|
29
|
+
<t-tag v-else-if="row.state === 2" theme="warning">禁用</t-tag>
|
|
30
|
+
<t-tag v-else theme="danger">已删除</t-tag>
|
|
31
|
+
</template>
|
|
32
|
+
<template #operation="{ row }">
|
|
33
|
+
<t-dropdown trigger="click" min-column-width="120" @click="(data) => $Method.onAction(data.value, row)">
|
|
34
|
+
<t-button variant="text" size="small">操作</t-button>
|
|
35
|
+
<t-dropdown-menu slot="dropdown">
|
|
36
|
+
<t-dropdown-item value="upd">
|
|
37
|
+
<IconLucidePencil />
|
|
38
|
+
编辑
|
|
39
|
+
</t-dropdown-item>
|
|
40
|
+
<t-dropdown-item value="del" :divider="true">
|
|
41
|
+
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
42
|
+
删除
|
|
43
|
+
</t-dropdown-item>
|
|
44
|
+
</t-dropdown-menu>
|
|
45
|
+
</t-dropdown>
|
|
46
|
+
</template>
|
|
47
|
+
</t-table>
|
|
59
48
|
</div>
|
|
60
49
|
|
|
61
50
|
<div class="main-page">
|
|
62
|
-
<
|
|
51
|
+
<t-pagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.pageSize" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @size-change="$Method.handleSizeChange" />
|
|
63
52
|
</div>
|
|
64
53
|
|
|
65
54
|
<!-- 编辑对话框组件 -->
|
|
@@ -68,15 +57,6 @@
|
|
|
68
57
|
</template>
|
|
69
58
|
|
|
70
59
|
<script setup>
|
|
71
|
-
import TinyButton from '@opentiny/vue-button';
|
|
72
|
-
import TinyGrid from '@opentiny/vue-grid';
|
|
73
|
-
import TinyGridColumn from '@opentiny/vue-grid-column';
|
|
74
|
-
import TinyTag from '@opentiny/vue-tag';
|
|
75
|
-
import TinyDropdown from '@opentiny/vue-dropdown';
|
|
76
|
-
import TinyDropdownMenu from '@opentiny/vue-dropdown-menu';
|
|
77
|
-
import TinyDropdownItem from '@opentiny/vue-dropdown-item';
|
|
78
|
-
import TinyPager from '@opentiny/vue-pager';
|
|
79
|
-
import Modal from '@opentiny/vue-modal';
|
|
80
60
|
import IconLucidePlus from '~icons/lucide/plus';
|
|
81
61
|
import IconLucideRotateCw from '~icons/lucide/rotate-cw';
|
|
82
62
|
import IconLucideSquare from '~icons/lucide/square';
|
|
@@ -89,6 +69,15 @@ import { $Http } from '@/plugins/http';
|
|
|
89
69
|
// 响应式数据
|
|
90
70
|
const $Data = $ref({
|
|
91
71
|
menuList: [],
|
|
72
|
+
columns: [
|
|
73
|
+
{ colKey: 'index', title: '序号', width: 60, align: 'center' },
|
|
74
|
+
{ colKey: 'name', title: '菜单名称' },
|
|
75
|
+
{ colKey: 'path', title: '路径', width: 200 },
|
|
76
|
+
{ colKey: 'icon', title: '图标', width: 100 },
|
|
77
|
+
{ colKey: 'sort', title: '排序', width: 80 },
|
|
78
|
+
{ colKey: 'state', title: '状态', width: 100 },
|
|
79
|
+
{ colKey: 'operation', title: '操作', width: 120, align: 'right' }
|
|
80
|
+
],
|
|
92
81
|
pagerConfig: {
|
|
93
82
|
currentPage: 1,
|
|
94
83
|
pageSize: 30,
|
|
@@ -118,7 +107,7 @@ const $Method = {
|
|
|
118
107
|
$Data.pagerConfig.total = res.data.total || 0;
|
|
119
108
|
} catch (error) {
|
|
120
109
|
console.error('加载菜单列表失败:', error);
|
|
121
|
-
|
|
110
|
+
MessagePlugin.info({
|
|
122
111
|
message: '加载数据失败',
|
|
123
112
|
status: 'error'
|
|
124
113
|
});
|
|
@@ -127,7 +116,7 @@ const $Method = {
|
|
|
127
116
|
|
|
128
117
|
// 删除菜单
|
|
129
118
|
async apiMenuDel(row) {
|
|
130
|
-
|
|
119
|
+
DialogPlugin.confirm({
|
|
131
120
|
header: '确认删除',
|
|
132
121
|
body: `确定要删除菜单"${row.name}" 吗?`,
|
|
133
122
|
status: 'warning'
|
|
@@ -135,14 +124,14 @@ const $Method = {
|
|
|
135
124
|
try {
|
|
136
125
|
const res = await $Http('/addon/admin/menu/del', { id: row.id });
|
|
137
126
|
if (res.code === 0) {
|
|
138
|
-
|
|
127
|
+
MessagePlugin.info({ message: '删除成功', status: 'success' });
|
|
139
128
|
$Method.apiMenuList();
|
|
140
129
|
} else {
|
|
141
|
-
|
|
130
|
+
MessagePlugin.info({ message: res.msg || '删除失败', status: 'error' });
|
|
142
131
|
}
|
|
143
132
|
} catch (error) {
|
|
144
133
|
console.error('删除失败:', error);
|
|
145
|
-
|
|
134
|
+
MessagePlugin.info({ message: '删除失败', status: 'error' });
|
|
146
135
|
}
|
|
147
136
|
});
|
|
148
137
|
},
|
package/views/news/index.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<t-dialog v-model:visible="$Data.visible" title="接口权限" width="900px" :append-to-body="true" :show-footer="true" top="5vh" @close="$Method.onClose">
|
|
3
3
|
<div class="comp-role-api">
|
|
4
4
|
<!-- 搜索框 -->
|
|
5
5
|
<div class="search-box">
|
|
@@ -21,24 +21,18 @@
|
|
|
21
21
|
|
|
22
22
|
<template #footer>
|
|
23
23
|
<div class="footer-left">
|
|
24
|
-
<
|
|
25
|
-
<
|
|
24
|
+
<t-button size="small" @click="$Method.onCheckAll">全选</t-button>
|
|
25
|
+
<t-button size="small" @click="$Method.onUncheckAll">取消全选</t-button>
|
|
26
26
|
</div>
|
|
27
27
|
<div class="footer-right">
|
|
28
|
-
<
|
|
29
|
-
<
|
|
28
|
+
<t-button @click="$Method.onClose">取消</t-button>
|
|
29
|
+
<t-button type="primary" @click="$Method.onSubmit">保存</t-button>
|
|
30
30
|
</div>
|
|
31
31
|
</template>
|
|
32
|
-
</
|
|
32
|
+
</t-dialog>
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script setup>
|
|
36
|
-
import TinyButton from '@opentiny/vue-button';
|
|
37
|
-
import TinyDialogBox from '@opentiny/vue-dialog-box';
|
|
38
|
-
import TinySearch from '@opentiny/vue-search';
|
|
39
|
-
import TinyCheckbox from '@opentiny/vue-checkbox';
|
|
40
|
-
import TinyCheckboxGroup from '@opentiny/vue-checkbox-group';
|
|
41
|
-
import Modal from '@opentiny/vue-modal';
|
|
42
36
|
import { $Http } from '@/plugins/http';
|
|
43
37
|
|
|
44
38
|
const $Prop = defineProps({
|
|
@@ -113,7 +107,7 @@ const $Method = {
|
|
|
113
107
|
$Data.apiData = Array.from(apiMap.values());
|
|
114
108
|
} catch (error) {
|
|
115
109
|
console.error('加载接口失败:', error);
|
|
116
|
-
|
|
110
|
+
MessagePlugin.info({ message: '加载接口失败', status: 'error' });
|
|
117
111
|
}
|
|
118
112
|
},
|
|
119
113
|
|
|
@@ -173,21 +167,21 @@ const $Method = {
|
|
|
173
167
|
});
|
|
174
168
|
|
|
175
169
|
if (res.code === 0) {
|
|
176
|
-
|
|
170
|
+
MessagePlugin.info({
|
|
177
171
|
message: '保存成功',
|
|
178
172
|
status: 'success'
|
|
179
173
|
});
|
|
180
174
|
$Data.visible = false;
|
|
181
175
|
$Emit('success');
|
|
182
176
|
} else {
|
|
183
|
-
|
|
177
|
+
MessagePlugin.info({
|
|
184
178
|
message: res.msg || '保存失败',
|
|
185
179
|
status: 'error'
|
|
186
180
|
});
|
|
187
181
|
}
|
|
188
182
|
} catch (error) {
|
|
189
183
|
console.error('保存失败:', error);
|
|
190
|
-
|
|
184
|
+
MessagePlugin.info({
|
|
191
185
|
message: '保存失败',
|
|
192
186
|
status: 'error'
|
|
193
187
|
});
|
|
@@ -1,44 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<t-dialog v-model:visible="$Data.visible" :title="$Prop.actionType === 'upd' ? '更新角色' : '添加角色'" width="600px" :append-to-body="true" :show-footer="true" :esc-closable="false" top="10vh" @close="$Method.onClose">
|
|
3
3
|
<div class="comp-role-edit">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
</
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
</
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
</
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
</
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
</
|
|
22
|
-
</
|
|
23
|
-
</
|
|
4
|
+
<t-form :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)">
|
|
5
|
+
<t-form-item label="角色名称" prop="name">
|
|
6
|
+
<t-input v-model="$Data.formData.name" placeholder="请输入角色名称" />
|
|
7
|
+
</t-form-item>
|
|
8
|
+
<t-form-item label="角色代码" prop="code">
|
|
9
|
+
<t-input v-model="$Data.formData.code" placeholder="请输入角色代码,如:admin" />
|
|
10
|
+
</t-form-item>
|
|
11
|
+
<t-form-item label="角色描述" prop="description">
|
|
12
|
+
<t-input v-model="$Data.formData.description" type="textarea" placeholder="请输入角色描述" :rows="3" />
|
|
13
|
+
</t-form-item>
|
|
14
|
+
<t-form-item label="排序" prop="sort">
|
|
15
|
+
<t-input-number v-model="$Data.formData.sort" :min="0" :max="9999" />
|
|
16
|
+
</t-form-item>
|
|
17
|
+
<t-form-item label="状态" prop="state">
|
|
18
|
+
<t-radio-group v-model="$Data.formData.state">
|
|
19
|
+
<t-radio :label="1">正常</t-radio>
|
|
20
|
+
<t-radio :label="2">禁用</t-radio>
|
|
21
|
+
</t-radio-group>
|
|
22
|
+
</t-form-item>
|
|
23
|
+
</t-form>
|
|
24
24
|
</div>
|
|
25
25
|
<template #footer>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
26
|
+
<t-button @click="$Method.onClose">取消</t-button>
|
|
27
|
+
<t-button type="primary" @click="$Method.onSubmit">确定</t-button>
|
|
28
28
|
</template>
|
|
29
|
-
</
|
|
29
|
+
</t-dialog>
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script setup>
|
|
33
|
-
import TinyButton from '@opentiny/vue-button';
|
|
34
|
-
import TinyDialogBox from '@opentiny/vue-dialog-box';
|
|
35
|
-
import TinyForm from '@opentiny/vue-form';
|
|
36
|
-
import TinyFormItem from '@opentiny/vue-form-item';
|
|
37
|
-
import TinyInput from '@opentiny/vue-input';
|
|
38
|
-
import TinyNumeric from '@opentiny/vue-numeric';
|
|
39
|
-
import TinyRadio from '@opentiny/vue-radio';
|
|
40
|
-
import TinyRadioGroup from '@opentiny/vue-radio-group';
|
|
41
|
-
import Modal from '@opentiny/vue-modal';
|
|
42
33
|
import { $Http } from '@/plugins/http';
|
|
43
34
|
|
|
44
35
|
const $Prop = defineProps({
|
|
@@ -115,7 +106,7 @@ const $Method = {
|
|
|
115
106
|
|
|
116
107
|
const res = await $Http($Prop.actionType === 'upd' ? '/addon/admin/roleUpd' : '/addon/admin/roleIns', $Data.formData);
|
|
117
108
|
|
|
118
|
-
|
|
109
|
+
MessagePlugin.info({
|
|
119
110
|
message: $Prop.actionType === 'upd' ? '更新成功' : '添加成功',
|
|
120
111
|
status: 'success'
|
|
121
112
|
});
|
|
@@ -123,7 +114,7 @@ const $Method = {
|
|
|
123
114
|
$Emit('success');
|
|
124
115
|
} catch (error) {
|
|
125
116
|
console.error('提交失败:', error);
|
|
126
|
-
|
|
117
|
+
MessagePlugin.info({
|
|
127
118
|
message: '提交失败',
|
|
128
119
|
status: 'error'
|
|
129
120
|
});
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<t-dialog v-model:visible="$Data.visible" title="菜单权限" width="600px" :append-to-body="true" :show-footer="true" top="10vh" @close="$Method.onClose">
|
|
3
3
|
<div class="comp-role-menu">
|
|
4
|
-
<
|
|
4
|
+
<t-tree :data="$Data.menuTreeData" node-key="id" show-checkbox default-expand-all :props="{ label: 'name' }" :ref="(el) => ($From.tree = el)" />
|
|
5
5
|
</div>
|
|
6
6
|
<template #footer>
|
|
7
|
-
<
|
|
8
|
-
<
|
|
7
|
+
<t-button @click="$Method.onClose">取消</t-button>
|
|
8
|
+
<t-button type="primary" @click="$Method.onSubmit">保存</t-button>
|
|
9
9
|
</template>
|
|
10
|
-
</
|
|
10
|
+
</t-dialog>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script setup>
|
|
14
14
|
import { nextTick } from 'vue';
|
|
15
|
-
import TinyButton from '@opentiny/vue-button';
|
|
16
|
-
import TinyDialogBox from '@opentiny/vue-dialog-box';
|
|
17
|
-
import TinyTree from '@opentiny/vue-tree';
|
|
18
|
-
import Modal from '@opentiny/vue-modal';
|
|
19
|
-
|
|
20
15
|
import { arrayToTree } from '@/utils';
|
|
21
16
|
import { $Http } from '@/plugins/http';
|
|
22
17
|
|
|
@@ -73,7 +68,7 @@ const $Method = {
|
|
|
73
68
|
$Data.menuTreeData = arrayToTree(menuList);
|
|
74
69
|
} catch (error) {
|
|
75
70
|
console.error('加载菜单失败:', error);
|
|
76
|
-
|
|
71
|
+
MessagePlugin.info({ message: '加载菜单失败', status: 'error' });
|
|
77
72
|
}
|
|
78
73
|
},
|
|
79
74
|
|
|
@@ -104,7 +99,7 @@ const $Method = {
|
|
|
104
99
|
async onSubmit() {
|
|
105
100
|
try {
|
|
106
101
|
if (!$From.tree) {
|
|
107
|
-
|
|
102
|
+
MessagePlugin.info({ message: '菜单树未初始化', status: 'error' });
|
|
108
103
|
return;
|
|
109
104
|
}
|
|
110
105
|
|
|
@@ -119,21 +114,21 @@ const $Method = {
|
|
|
119
114
|
});
|
|
120
115
|
|
|
121
116
|
if (res.code === 0) {
|
|
122
|
-
|
|
117
|
+
MessagePlugin.info({
|
|
123
118
|
message: '保存成功',
|
|
124
119
|
status: 'success'
|
|
125
120
|
});
|
|
126
121
|
$Data.visible = false;
|
|
127
122
|
$Emit('success');
|
|
128
123
|
} else {
|
|
129
|
-
|
|
124
|
+
MessagePlugin.info({
|
|
130
125
|
message: res.msg || '保存失败',
|
|
131
126
|
status: 'error'
|
|
132
127
|
});
|
|
133
128
|
}
|
|
134
129
|
} catch (error) {
|
|
135
130
|
console.error('保存失败:', error);
|
|
136
|
-
|
|
131
|
+
MessagePlugin.info({
|
|
137
132
|
message: '保存失败',
|
|
138
133
|
status: 'error'
|
|
139
134
|
});
|
package/views/role/index.vue
CHANGED
|
@@ -2,67 +2,57 @@
|
|
|
2
2
|
<div class="page-role page-table">
|
|
3
3
|
<div class="main-tool">
|
|
4
4
|
<div class="left">
|
|
5
|
-
<
|
|
5
|
+
<t-button type="primary" @click="$Method.onAction('add', {})">
|
|
6
6
|
<template #icon>
|
|
7
7
|
<IconLucidePlus />
|
|
8
8
|
</template>
|
|
9
9
|
添加角色
|
|
10
|
-
</
|
|
10
|
+
</t-button>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="right">
|
|
13
|
-
<
|
|
13
|
+
<t-button @click="$Method.handleRefresh">
|
|
14
14
|
<template #icon>
|
|
15
15
|
<IconLucideRotateCw />
|
|
16
16
|
</template>
|
|
17
17
|
刷新
|
|
18
|
-
</
|
|
18
|
+
</t-button>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
21
|
<div class="main-table">
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<TinyDropdownItem :item-data="{ command: 'del' }" divided>
|
|
53
|
-
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
54
|
-
删除
|
|
55
|
-
</TinyDropdownItem>
|
|
56
|
-
</TinyDropdownMenu>
|
|
57
|
-
</template>
|
|
58
|
-
</TinyDropdown>
|
|
59
|
-
</template>
|
|
60
|
-
</TinyGridColumn>
|
|
61
|
-
</TinyGrid>
|
|
22
|
+
<t-table :data="$Data.tableData" :columns="$Data.columns" header-cell-class-name="custom-table-cell-class" size="small" height="100%" row-key="id" bordered>
|
|
23
|
+
<template #state="{ row }">
|
|
24
|
+
<t-tag v-if="row.state === 1" theme="success">正常</t-tag>
|
|
25
|
+
<t-tag v-else-if="row.state === 2" theme="warning">禁用</t-tag>
|
|
26
|
+
<t-tag v-else theme="danger">已删除</t-tag>
|
|
27
|
+
</template>
|
|
28
|
+
<template #operation="{ row }">
|
|
29
|
+
<t-dropdown trigger="click" min-column-width="120" @click="(data) => $Method.onAction(data.value, row)">
|
|
30
|
+
<t-button variant="text" size="small">操作</t-button>
|
|
31
|
+
<t-dropdown-menu slot="dropdown">
|
|
32
|
+
<t-dropdown-item value="upd">
|
|
33
|
+
<IconLucidePencil />
|
|
34
|
+
编辑
|
|
35
|
+
</t-dropdown-item>
|
|
36
|
+
<t-dropdown-item value="menu">
|
|
37
|
+
<IconLucideSettings />
|
|
38
|
+
菜单权限
|
|
39
|
+
</t-dropdown-item>
|
|
40
|
+
<t-dropdown-item value="api">
|
|
41
|
+
<IconLucideCode />
|
|
42
|
+
接口权限
|
|
43
|
+
</t-dropdown-item>
|
|
44
|
+
<t-dropdown-item value="del" :divider="true">
|
|
45
|
+
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
46
|
+
删除
|
|
47
|
+
</t-dropdown-item>
|
|
48
|
+
</t-dropdown-menu>
|
|
49
|
+
</t-dropdown>
|
|
50
|
+
</template>
|
|
51
|
+
</t-table>
|
|
62
52
|
</div>
|
|
63
53
|
|
|
64
54
|
<div class="main-page">
|
|
65
|
-
<
|
|
55
|
+
<t-pagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.pageSize" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @size-change="$Method.handleSizeChange" />
|
|
66
56
|
</div>
|
|
67
57
|
|
|
68
58
|
<!-- 编辑对话框组件 -->
|
|
@@ -77,15 +67,6 @@
|
|
|
77
67
|
</template>
|
|
78
68
|
|
|
79
69
|
<script setup>
|
|
80
|
-
import TinyButton from '@opentiny/vue-button';
|
|
81
|
-
import TinyGrid from '@opentiny/vue-grid';
|
|
82
|
-
import TinyGridColumn from '@opentiny/vue-grid-column';
|
|
83
|
-
import TinyTag from '@opentiny/vue-tag';
|
|
84
|
-
import TinyDropdown from '@opentiny/vue-dropdown';
|
|
85
|
-
import TinyDropdownMenu from '@opentiny/vue-dropdown-menu';
|
|
86
|
-
import TinyDropdownItem from '@opentiny/vue-dropdown-item';
|
|
87
|
-
import TinyPager from '@opentiny/vue-pager';
|
|
88
|
-
import Modal from '@opentiny/vue-modal';
|
|
89
70
|
import IconLucidePlus from '~icons/lucide/plus';
|
|
90
71
|
import IconLucideRotateCw from '~icons/lucide/rotate-cw';
|
|
91
72
|
import IconLucidePencil from '~icons/lucide/pencil';
|
|
@@ -100,6 +81,15 @@ import { $Http } from '@/plugins/http';
|
|
|
100
81
|
// 响应式数据
|
|
101
82
|
const $Data = $ref({
|
|
102
83
|
tableData: [],
|
|
84
|
+
columns: [
|
|
85
|
+
{ colKey: 'index', title: '序号', width: 100, align: 'center' },
|
|
86
|
+
{ colKey: 'name', title: '角色名称', width: 150 },
|
|
87
|
+
{ colKey: 'code', title: '角色代码', width: 150 },
|
|
88
|
+
{ colKey: 'description', title: '描述', minWidth: 150, ellipsis: true },
|
|
89
|
+
{ colKey: 'sort', title: '排序', width: 80, align: 'center' },
|
|
90
|
+
{ colKey: 'state', title: '状态', width: 100, align: 'center' },
|
|
91
|
+
{ colKey: 'operation', title: '操作', width: 120, align: 'center', fixed: 'right' }
|
|
92
|
+
],
|
|
103
93
|
pagerConfig: {
|
|
104
94
|
currentPage: 1,
|
|
105
95
|
pageSize: 30,
|
|
@@ -130,7 +120,7 @@ const $Method = {
|
|
|
130
120
|
$Data.pagerConfig.total = res.data.total || 0;
|
|
131
121
|
} catch (error) {
|
|
132
122
|
console.error('加载角色列表失败:', error);
|
|
133
|
-
|
|
123
|
+
MessagePlugin.info({
|
|
134
124
|
message: '加载数据失败',
|
|
135
125
|
status: 'error'
|
|
136
126
|
});
|
|
@@ -139,7 +129,7 @@ const $Method = {
|
|
|
139
129
|
|
|
140
130
|
// 删除角色
|
|
141
131
|
async apiRoleDel(row) {
|
|
142
|
-
|
|
132
|
+
DialogPlugin.confirm({
|
|
143
133
|
header: '确认删除',
|
|
144
134
|
body: `确定要删除角色"${row.name}" 吗?`,
|
|
145
135
|
status: 'warning'
|
|
@@ -147,14 +137,14 @@ const $Method = {
|
|
|
147
137
|
try {
|
|
148
138
|
const res = await $Http('/addon/admin/role/del', { id: row.id });
|
|
149
139
|
if (res.code === 0) {
|
|
150
|
-
|
|
140
|
+
MessagePlugin.info({ message: '删除成功', status: 'success' });
|
|
151
141
|
$Method.apiRoleList();
|
|
152
142
|
} else {
|
|
153
|
-
|
|
143
|
+
MessagePlugin.info({ message: res.msg || '删除失败', status: 'error' });
|
|
154
144
|
}
|
|
155
145
|
} catch (error) {
|
|
156
146
|
console.error('删除失败:', error);
|
|
157
|
-
|
|
147
|
+
MessagePlugin.info({ message: '删除失败', status: 'error' });
|
|
158
148
|
}
|
|
159
149
|
});
|
|
160
150
|
},
|
package/views/user/index.vue
CHANGED
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
<div class="table-wrapper">
|
|
35
35
|
<t-table :data="$Data.userList" :columns="$Data.columns" row-key="id" :loading="$Data.loading" bordered stripe hover max-height="100%">
|
|
36
36
|
<template #state="{ row }">
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
37
|
+
<t-tag v-if="row.state === 1" type="success">正常</t-tag>
|
|
38
|
+
<t-tag v-else-if="row.state === 2" type="warning">禁用</t-tag>
|
|
39
|
+
<t-tag v-else type="danger">已删除</t-tag>
|
|
40
40
|
</template>
|
|
41
41
|
|
|
42
42
|
<template #lastLoginTime="{ row }">
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
<t-dialog v-model:visible="$Data.roleVisible" header="分配角色" width="600px" :on-confirm="$Method.handleRoleSubmit">
|
|
64
64
|
<div class="role-dialog">
|
|
65
65
|
<div class="user-info">
|
|
66
|
-
<
|
|
66
|
+
<t-tag type="primary">{{ $Data.currentUser.username }}</t-tag>
|
|
67
67
|
<span class="user-email">{{ $Data.currentUser.email }}</span>
|
|
68
68
|
</div>
|
|
69
69
|
<t-divider />
|
|
@@ -74,8 +74,6 @@
|
|
|
74
74
|
</template>
|
|
75
75
|
|
|
76
76
|
<script setup>
|
|
77
|
-
import TinyTag from '@opentiny/vue-tag';
|
|
78
|
-
import Modal from '@opentiny/vue-modal';
|
|
79
77
|
import IconLucidePlus from '~icons/lucide/plus';
|
|
80
78
|
import IconLucideSearch from '~icons/lucide/search';
|
|
81
79
|
import IconLucideRotateCw from '~icons/lucide/rotate-cw';
|