@befly-addon/admin 1.0.30 → 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 -3
- package/views/403/index.vue +3 -5
- package/views/admin/components/edit.vue +32 -33
- package/views/admin/components/role.vue +11 -12
- package/views/admin/index.vue +47 -49
- package/views/dict/components/edit.vue +31 -32
- package/views/dict/index.vue +43 -45
- package/views/index/components/addonList.vue +1 -2
- package/views/index/components/operationLogs.vue +2 -3
- package/views/index/components/quickActions.vue +2 -4
- 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 +13 -14
- package/views/login/components/registerForm.vue +19 -20
- package/views/menu/components/edit.vue +25 -26
- package/views/menu/index.vue +45 -48
- package/views/news/index.vue +0 -2
- package/views/role/components/api.vue +10 -11
- package/views/role/components/edit.vue +26 -27
- package/views/role/components/menu.vue +10 -12
- package/views/role/index.vue +49 -51
- package/views/user/index.vue +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@befly-addon/admin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "Befly - 管理后台功能组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -39,8 +39,9 @@
|
|
|
39
39
|
"url": "https://github.com/chenbimo/befly.git",
|
|
40
40
|
"directory": "packages/addon-admin"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "7f8bd9dc5342e59953997d58e6abf6ca2469b211",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"befly": "3.8.12"
|
|
44
|
+
"befly": "3.8.12",
|
|
45
|
+
"tdesign-vue-next": "^1.10.6"
|
|
45
46
|
}
|
|
46
47
|
}
|
package/views/403/index.vue
CHANGED
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
<h1 class="error-title">无权限访问</h1>
|
|
6
6
|
<p class="error-description">抱歉,您没有访问该页面的权限</p>
|
|
7
7
|
<div class="error-actions">
|
|
8
|
-
<
|
|
9
|
-
<
|
|
8
|
+
<t-button type="primary" @click="$Method.goHome">返回首页</t-button>
|
|
9
|
+
<t-button @click="$Method.goBack">返回上一页</t-button>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup>
|
|
16
|
-
import { useRouter
|
|
17
|
-
import { Button as TinyButton } from '@opentiny/vue';
|
|
18
|
-
|
|
16
|
+
import { useRouter } from 'vue-router';
|
|
19
17
|
const router = useRouter();
|
|
20
18
|
|
|
21
19
|
const $Method = {
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
</
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
</
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
</
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
</
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
</
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
</
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
</
|
|
27
|
-
</
|
|
28
|
-
</
|
|
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
|
+
<t-form :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)">
|
|
4
|
+
<t-form-item label="用户名" prop="username">
|
|
5
|
+
<t-input v-model="$Data.formData.username" placeholder="请输入用户名" :disabled="$Prop.actionType === 'upd'" />
|
|
6
|
+
</t-form-item>
|
|
7
|
+
<t-form-item label="邮箱" prop="email">
|
|
8
|
+
<t-input v-model="$Data.formData.email" placeholder="请输入邮箱" />
|
|
9
|
+
</t-form-item>
|
|
10
|
+
<t-form-item v-if="$Prop.actionType === 'add'" label="密码" prop="password">
|
|
11
|
+
<t-input v-model="$Data.formData.password" type="password" placeholder="请输入密码,至少6位" />
|
|
12
|
+
</t-form-item>
|
|
13
|
+
<t-form-item label="姓名" prop="name">
|
|
14
|
+
<t-input v-model="$Data.formData.name" placeholder="请输入姓名" />
|
|
15
|
+
</t-form-item>
|
|
16
|
+
<t-form-item label="昵称" prop="nickname">
|
|
17
|
+
<t-input v-model="$Data.formData.nickname" placeholder="请输入昵称" />
|
|
18
|
+
</t-form-item>
|
|
19
|
+
<t-form-item label="手机号" prop="phone">
|
|
20
|
+
<t-input v-model="$Data.formData.phone" placeholder="请输入手机号" />
|
|
21
|
+
</t-form-item>
|
|
22
|
+
<t-form-item v-if="$Prop.actionType === 'upd'" label="状态" prop="state">
|
|
23
|
+
<t-radio-group v-model="$Data.formData.state">
|
|
24
|
+
<t-radio :label="1">正常</t-radio>
|
|
25
|
+
<t-radio :label="2">禁用</t-radio>
|
|
26
|
+
</t-radio-group>
|
|
27
|
+
</t-form-item>
|
|
28
|
+
</t-form>
|
|
29
29
|
<template #footer>
|
|
30
|
-
<
|
|
31
|
-
<
|
|
30
|
+
<t-button @click="$Method.onClose">取消</t-button>
|
|
31
|
+
<t-button type="primary" @click="$Method.onSubmit">确定</t-button>
|
|
32
32
|
</template>
|
|
33
|
-
</
|
|
33
|
+
</t-dialog>
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script setup>
|
|
37
|
-
import { Button as TinyButton, DialogBox as TinyDialogBox, Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput, Radio as TinyRadio, RadioGroup as TinyRadioGroup, Modal } from '@opentiny/vue';
|
|
38
37
|
import { $Http } from '@/plugins/http';
|
|
39
38
|
|
|
40
39
|
const $Prop = defineProps({
|
|
@@ -126,7 +125,7 @@ const $Method = {
|
|
|
126
125
|
|
|
127
126
|
const res = await $Http($Prop.actionType === 'upd' ? '/addon/admin/admin/upd' : '/addon/admin/admin/ins', $Data.formData);
|
|
128
127
|
|
|
129
|
-
|
|
128
|
+
MessagePlugin.info({
|
|
130
129
|
message: $Prop.actionType === 'upd' ? '编辑成功' : '添加成功',
|
|
131
130
|
status: 'success'
|
|
132
131
|
});
|
|
@@ -134,7 +133,7 @@ const $Method = {
|
|
|
134
133
|
$Method.onClose();
|
|
135
134
|
} catch (error) {
|
|
136
135
|
console.error('提交失败:', error);
|
|
137
|
-
|
|
136
|
+
MessagePlugin.info({
|
|
138
137
|
message: '提交失败',
|
|
139
138
|
status: 'error'
|
|
140
139
|
});
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<t-dialog v-model:visible="$Data.visible" title="分配角色" width="600px" :append-to-body="true" :show-footer="true" :esc-closable="false" top="20vh" @close="$Method.onClose">
|
|
3
3
|
<div class="role-dialog">
|
|
4
4
|
<div class="user-info">
|
|
5
|
-
<
|
|
5
|
+
<t-tag type="info">{{ $Prop.rowData.username }}</t-tag>
|
|
6
6
|
<span class="user-email">{{ $Prop.rowData.email }}</span>
|
|
7
7
|
</div>
|
|
8
8
|
<tiny-divider />
|
|
9
|
-
<
|
|
9
|
+
<t-select v-model="$Data.checkedRoleCode" :options="$Data.roleOptions" placeholder="请选择角色" />
|
|
10
10
|
</div>
|
|
11
11
|
<template #footer>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
12
|
+
<t-button @click="$Method.onClose">取消</t-button>
|
|
13
|
+
<t-button type="primary" @click="$Method.onSubmit">确定</t-button>
|
|
14
14
|
</template>
|
|
15
|
-
</
|
|
15
|
+
</t-dialog>
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup>
|
|
19
|
-
import { Button as TinyButton, DialogBox as TinyDialogBox, Select as TinySelect, Tag as TinyTag, Modal } from '@opentiny/vue';
|
|
20
19
|
import { $Http } from '@/plugins/http';
|
|
21
20
|
|
|
22
21
|
const $Prop = defineProps({
|
|
@@ -74,7 +73,7 @@ const $Method = {
|
|
|
74
73
|
}));
|
|
75
74
|
} catch (error) {
|
|
76
75
|
console.error('加载角色列表失败:', error);
|
|
77
|
-
|
|
76
|
+
MessagePlugin.info({ message: '加载角色列表失败', status: 'error' });
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
79
|
|
|
@@ -95,7 +94,7 @@ const $Method = {
|
|
|
95
94
|
// 提交角色分配
|
|
96
95
|
async onSubmit() {
|
|
97
96
|
if (!$Data.checkedRoleCode) {
|
|
98
|
-
|
|
97
|
+
MessagePlugin.info({ message: '请选择角色', status: 'warning' });
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
101
100
|
|
|
@@ -106,15 +105,15 @@ const $Method = {
|
|
|
106
105
|
});
|
|
107
106
|
|
|
108
107
|
if (res.code === 0) {
|
|
109
|
-
|
|
108
|
+
MessagePlugin.info({ message: '角色分配成功', status: 'success' });
|
|
110
109
|
$Method.onClose();
|
|
111
110
|
$Emit('success');
|
|
112
111
|
} else {
|
|
113
|
-
|
|
112
|
+
MessagePlugin.info({ message: res.msg || '分配失败', status: 'error' });
|
|
114
113
|
}
|
|
115
114
|
} catch (error) {
|
|
116
115
|
console.error('分配失败:', error);
|
|
117
|
-
|
|
116
|
+
MessagePlugin.info({ message: '分配失败', status: 'error' });
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
};
|
package/views/admin/index.vue
CHANGED
|
@@ -2,71 +2,61 @@
|
|
|
2
2
|
<div class="page-admin 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
|
+
</t-button>
|
|
18
18
|
</div>
|
|
19
19
|
<div class="right">
|
|
20
|
-
<
|
|
20
|
+
<t-button @click="$Method.handleRefresh">
|
|
21
21
|
<template #icon>
|
|
22
22
|
<IconLucideRotateCw />
|
|
23
23
|
</template>
|
|
24
24
|
刷新
|
|
25
|
-
</
|
|
25
|
+
</t-button>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<div class="main-table">
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<TinyDropdownItem :item-data="{ command: 'del' }" divided>
|
|
57
|
-
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
58
|
-
删除
|
|
59
|
-
</TinyDropdownItem>
|
|
60
|
-
</TinyDropdownMenu>
|
|
61
|
-
</template>
|
|
62
|
-
</TinyDropdown>
|
|
63
|
-
</template>
|
|
64
|
-
</TinyGridColumn>
|
|
65
|
-
</TinyGrid>
|
|
30
|
+
<t-table :data="$Data.tableData" :columns="$Data.columns" header-cell-class-name="custom-table-cell-class" size="small" height="100%" row-key="id">
|
|
31
|
+
<template #state="{ row }">
|
|
32
|
+
<t-tag v-if="row.state === 1" theme="success">正常</t-tag>
|
|
33
|
+
<t-tag v-else-if="row.state === 2" theme="warning">禁用</t-tag>
|
|
34
|
+
<t-tag v-else theme="danger">已删除</t-tag>
|
|
35
|
+
</template>
|
|
36
|
+
<template #operation="{ row }">
|
|
37
|
+
<t-dropdown trigger="click" min-column-width="120" @click="(data) => $Method.onAction(data.value, row)">
|
|
38
|
+
<t-button variant="text" size="small">操作</t-button>
|
|
39
|
+
<t-dropdown-menu slot="dropdown">
|
|
40
|
+
<t-dropdown-item value="role">
|
|
41
|
+
<IconLucideUser />
|
|
42
|
+
分配角色
|
|
43
|
+
</t-dropdown-item>
|
|
44
|
+
<t-dropdown-item value="upd">
|
|
45
|
+
<IconLucidePencil />
|
|
46
|
+
编辑
|
|
47
|
+
</t-dropdown-item>
|
|
48
|
+
<t-dropdown-item value="del" :divider="true">
|
|
49
|
+
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
50
|
+
删除
|
|
51
|
+
</t-dropdown-item>
|
|
52
|
+
</t-dropdown-menu>
|
|
53
|
+
</t-dropdown>
|
|
54
|
+
</template>
|
|
55
|
+
</t-table>
|
|
66
56
|
</div>
|
|
67
57
|
|
|
68
58
|
<div class="main-page">
|
|
69
|
-
<
|
|
59
|
+
<t-pagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.pageSize" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @size-change="$Method.handleSizeChange" />
|
|
70
60
|
</div>
|
|
71
61
|
|
|
72
62
|
<!-- 编辑对话框组件 -->
|
|
@@ -78,7 +68,6 @@
|
|
|
78
68
|
</template>
|
|
79
69
|
|
|
80
70
|
<script setup>
|
|
81
|
-
import { Button as TinyButton, Grid as TinyGrid, GridColumn as TinyGridColumn, Tag as TinyTag, Dropdown as TinyDropdown, DropdownMenu as TinyDropdownMenu, DropdownItem as TinyDropdownItem, Pager as TinyPager, Modal } from '@opentiny/vue';
|
|
82
71
|
import IconLucidePlus from '~icons/lucide/plus';
|
|
83
72
|
import IconLucideRotateCw from '~icons/lucide/rotate-cw';
|
|
84
73
|
import IconLucidePencil from '~icons/lucide/pencil';
|
|
@@ -92,6 +81,15 @@ import { $Http } from '@/plugins/http';
|
|
|
92
81
|
// 响应式数据
|
|
93
82
|
const $Data = $ref({
|
|
94
83
|
tableData: [],
|
|
84
|
+
columns: [
|
|
85
|
+
{ colKey: 'index', title: '序号', width: 60, align: 'center' },
|
|
86
|
+
{ colKey: 'username', title: '用户名' },
|
|
87
|
+
{ colKey: 'email', title: '邮箱', width: 200 },
|
|
88
|
+
{ colKey: 'nickname', title: '昵称', width: 150 },
|
|
89
|
+
{ colKey: 'roleCode', title: '角色', width: 120 },
|
|
90
|
+
{ colKey: 'state', title: '状态', width: 100 },
|
|
91
|
+
{ colKey: 'operation', title: '操作', width: 120, align: 'right' }
|
|
92
|
+
],
|
|
95
93
|
pagerConfig: {
|
|
96
94
|
currentPage: 1,
|
|
97
95
|
pageSize: 30,
|
|
@@ -122,7 +120,7 @@ const $Method = {
|
|
|
122
120
|
$Data.pagerConfig.total = res.data.total || 0;
|
|
123
121
|
} catch (error) {
|
|
124
122
|
console.error('加载管理员列表失败:', error);
|
|
125
|
-
|
|
123
|
+
MessagePlugin.info({
|
|
126
124
|
message: '加载数据失败',
|
|
127
125
|
status: 'error'
|
|
128
126
|
});
|
|
@@ -131,7 +129,7 @@ const $Method = {
|
|
|
131
129
|
|
|
132
130
|
// 删除管理员
|
|
133
131
|
async apiAdminDel(row) {
|
|
134
|
-
|
|
132
|
+
DialogPlugin.confirm({
|
|
135
133
|
header: '确认删除',
|
|
136
134
|
body: `确定要删除管理员"${row.username}" 吗?`,
|
|
137
135
|
status: 'warning'
|
|
@@ -139,14 +137,14 @@ const $Method = {
|
|
|
139
137
|
try {
|
|
140
138
|
const res = await $Http('/addon/admin/admin/del', { id: row.id });
|
|
141
139
|
if (res.code === 0) {
|
|
142
|
-
|
|
140
|
+
MessagePlugin.info({ message: '删除成功', status: 'success' });
|
|
143
141
|
$Method.apiAdminList();
|
|
144
142
|
} else {
|
|
145
|
-
|
|
143
|
+
MessagePlugin.info({ message: res.msg || '删除失败', status: 'error' });
|
|
146
144
|
}
|
|
147
145
|
} catch (error) {
|
|
148
146
|
console.error('删除失败:', error);
|
|
149
|
-
|
|
147
|
+
MessagePlugin.info({ message: '删除失败', status: 'error' });
|
|
150
148
|
}
|
|
151
149
|
});
|
|
152
150
|
},
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
</
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
</
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
</
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
</
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
</
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
</
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
</
|
|
27
|
-
</
|
|
28
|
-
</
|
|
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
|
+
<t-form :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)">
|
|
4
|
+
<t-form-item label="字典名称" prop="name">
|
|
5
|
+
<t-input v-model="$Data.formData.name" placeholder="请输入字典名称" />
|
|
6
|
+
</t-form-item>
|
|
7
|
+
<t-form-item label="字典代码" prop="code">
|
|
8
|
+
<t-input v-model="$Data.formData.code" placeholder="请输入字典代码,如:gender" />
|
|
9
|
+
</t-form-item>
|
|
10
|
+
<t-form-item label="字典值" prop="value">
|
|
11
|
+
<t-input v-model="$Data.formData.value" placeholder="请输入字典值" />
|
|
12
|
+
</t-form-item>
|
|
13
|
+
<t-form-item label="父级ID" prop="pid">
|
|
14
|
+
<t-input-number v-model="$Data.formData.pid" :min="0" :max="999999999999999" />
|
|
15
|
+
</t-form-item>
|
|
16
|
+
<t-form-item label="排序" prop="sort">
|
|
17
|
+
<t-input-number v-model="$Data.formData.sort" :min="0" :max="9999" />
|
|
18
|
+
</t-form-item>
|
|
19
|
+
<t-form-item label="描述" prop="description">
|
|
20
|
+
<t-input v-model="$Data.formData.description" type="textarea" placeholder="请输入描述" :rows="3" />
|
|
21
|
+
</t-form-item>
|
|
22
|
+
<t-form-item label="状态" prop="state">
|
|
23
|
+
<t-radio-group v-model="$Data.formData.state">
|
|
24
|
+
<t-radio :label="1">正常</t-radio>
|
|
25
|
+
<t-radio :label="2">禁用</t-radio>
|
|
26
|
+
</t-radio-group>
|
|
27
|
+
</t-form-item>
|
|
28
|
+
</t-form>
|
|
29
29
|
<template #footer>
|
|
30
|
-
<
|
|
31
|
-
<
|
|
30
|
+
<t-button @click="$Method.onClose">取消</t-button>
|
|
31
|
+
<t-button type="primary" @click="$Method.onSubmit">确定</t-button>
|
|
32
32
|
</template>
|
|
33
|
-
</
|
|
33
|
+
</t-dialog>
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script setup>
|
|
37
37
|
import { watch } from 'vue';
|
|
38
|
-
import { Button as TinyButton, DialogBox as TinyDialogBox, Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput, Numeric as TinyNumeric, Radio as TinyRadio, RadioGroup as TinyRadioGroup, Modal } from '@opentiny/vue';
|
|
39
38
|
import { $Http } from '@/plugins/http';
|
|
40
39
|
|
|
41
40
|
const $Prop = defineProps({
|
|
@@ -129,7 +128,7 @@ const $Method = {
|
|
|
129
128
|
|
|
130
129
|
const res = await $Http($Prop.actionType === 'add' ? '/addon/admin/dictIns' : '/addon/admin/dictUpd', $Data.formData);
|
|
131
130
|
|
|
132
|
-
|
|
131
|
+
MessagePlugin.info({
|
|
133
132
|
message: $Prop.actionType === 'add' ? '添加成功' : '编辑成功',
|
|
134
133
|
status: 'success'
|
|
135
134
|
});
|
package/views/dict/index.vue
CHANGED
|
@@ -2,61 +2,49 @@
|
|
|
2
2
|
<div class="page-dict 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
|
-
</TinyDropdownItem>
|
|
46
|
-
<TinyDropdownItem :item-data="{ command: 'del' }" divided>
|
|
47
|
-
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
48
|
-
删除
|
|
49
|
-
</TinyDropdownItem>
|
|
50
|
-
</TinyDropdownMenu>
|
|
51
|
-
</template>
|
|
52
|
-
</TinyDropdown>
|
|
53
|
-
</template>
|
|
54
|
-
</TinyGridColumn>
|
|
55
|
-
</TinyGrid>
|
|
22
|
+
<t-table :data="$Data.dictList" :columns="$Data.columns" header-cell-class-name="custom-table-cell-class" size="small" height="100%" row-key="id">
|
|
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="del" :divider="true">
|
|
37
|
+
<IconLucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
|
|
38
|
+
删除
|
|
39
|
+
</t-dropdown-item>
|
|
40
|
+
</t-dropdown-menu>
|
|
41
|
+
</t-dropdown>
|
|
42
|
+
</template>
|
|
43
|
+
</t-table>
|
|
56
44
|
</div>
|
|
57
45
|
|
|
58
46
|
<div class="main-page">
|
|
59
|
-
<
|
|
47
|
+
<t-pagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.pageSize" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @size-change="$Method.handleSizeChange" />
|
|
60
48
|
</div>
|
|
61
49
|
|
|
62
50
|
<!-- 编辑对话框组件 -->
|
|
@@ -65,7 +53,6 @@
|
|
|
65
53
|
</template>
|
|
66
54
|
|
|
67
55
|
<script setup>
|
|
68
|
-
import { Button as TinyButton, Grid as TinyGrid, GridColumn as TinyGridColumn, Tag as TinyTag, Dropdown as TinyDropdown, DropdownMenu as TinyDropdownMenu, DropdownItem as TinyDropdownItem, Pager as TinyPager, Modal } from '@opentiny/vue';
|
|
69
56
|
import IconLucidePlus from '~icons/lucide/plus';
|
|
70
57
|
import IconLucideRotateCw from '~icons/lucide/rotate-cw';
|
|
71
58
|
import IconLucidePencil from '~icons/lucide/pencil';
|
|
@@ -77,6 +64,17 @@ import { $Http } from '@/plugins/http';
|
|
|
77
64
|
// 响应式数据
|
|
78
65
|
const $Data = $ref({
|
|
79
66
|
dictList: [],
|
|
67
|
+
columns: [
|
|
68
|
+
{ colKey: 'index', title: '序号', width: 60, align: 'center' },
|
|
69
|
+
{ colKey: 'name', title: '字典名称' },
|
|
70
|
+
{ colKey: 'code', title: '字典代码', width: 150 },
|
|
71
|
+
{ colKey: 'value', title: '字典值', width: 200 },
|
|
72
|
+
{ colKey: 'pid', title: '父级ID', width: 100 },
|
|
73
|
+
{ colKey: 'sort', title: '排序', width: 80 },
|
|
74
|
+
{ colKey: 'description', title: '描述', ellipsis: true },
|
|
75
|
+
{ colKey: 'state', title: '状态', width: 100 },
|
|
76
|
+
{ colKey: 'operation', title: '操作', width: 120, align: 'right' }
|
|
77
|
+
],
|
|
80
78
|
pagerConfig: {
|
|
81
79
|
currentPage: 1,
|
|
82
80
|
pageSize: 30,
|
|
@@ -106,7 +104,7 @@ const $Method = {
|
|
|
106
104
|
$Data.pagerConfig.total = res.data.total || 0;
|
|
107
105
|
} catch (error) {
|
|
108
106
|
console.error('加载字典列表失败:', error);
|
|
109
|
-
|
|
107
|
+
MessagePlugin.info({
|
|
110
108
|
message: '加载数据失败',
|
|
111
109
|
status: 'error'
|
|
112
110
|
});
|
|
@@ -115,7 +113,7 @@ const $Method = {
|
|
|
115
113
|
|
|
116
114
|
// 删除字典
|
|
117
115
|
async apiDictDel(row) {
|
|
118
|
-
|
|
116
|
+
DialogPlugin.confirm({
|
|
119
117
|
header: '确认删除',
|
|
120
118
|
body: `确定要删除字典"${row.name}" 吗?`,
|
|
121
119
|
status: 'warning'
|
|
@@ -123,14 +121,14 @@ const $Method = {
|
|
|
123
121
|
try {
|
|
124
122
|
const res = await $Http('/addon/admin/dict/del', { id: row.id });
|
|
125
123
|
if (res.code === 0) {
|
|
126
|
-
|
|
124
|
+
MessagePlugin.info({ message: '删除成功', status: 'success' });
|
|
127
125
|
$Method.apiDictList();
|
|
128
126
|
} else {
|
|
129
|
-
|
|
127
|
+
MessagePlugin.info({ message: res.msg || '删除失败', status: 'error' });
|
|
130
128
|
}
|
|
131
129
|
} catch (error) {
|
|
132
130
|
console.error('删除失败:', error);
|
|
133
|
-
|
|
131
|
+
MessagePlugin.info({ message: '删除失败', status: 'error' });
|
|
134
132
|
}
|
|
135
133
|
});
|
|
136
134
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div class="addon-info">
|
|
14
14
|
<div class="addon-title">
|
|
15
15
|
<span class="addon-name">{{ addon.title }}</span>
|
|
16
|
-
<
|
|
16
|
+
<t-tag type="success" size="small">{{ addon.version }}</t-tag>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="addon-desc">{{ addon.description }}</div>
|
|
19
19
|
</div>
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup>
|
|
27
27
|
import IconLucideBox from '~icons/lucide/box';
|
|
28
|
-
import { Tag as TinyTag } from '@opentiny/vue';
|
|
29
28
|
import IconLucidePackage from '~icons/lucide/package';
|
|
30
29
|
import { $Http } from '@/plugins/http';
|
|
31
30
|
|