@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.0.30",
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": "178b2045d0a76ba734ec623b7e478b3024a58e6d",
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
  }
@@ -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
- <TinyButton type="primary" @click="$Method.goHome">返回首页</TinyButton>
9
- <TinyButton @click="$Method.goBack">返回上一页</TinyButton>
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, useRoute } from 'vue-router';
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
- <TinyDialogBox 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
- <TinyForm :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)">
4
- <TinyFormItem label="用户名" prop="username">
5
- <TinyInput v-model="$Data.formData.username" placeholder="请输入用户名" :disabled="$Prop.actionType === 'upd'" />
6
- </TinyFormItem>
7
- <TinyFormItem label="邮箱" prop="email">
8
- <TinyInput v-model="$Data.formData.email" placeholder="请输入邮箱" />
9
- </TinyFormItem>
10
- <TinyFormItem v-if="$Prop.actionType === 'add'" label="密码" prop="password">
11
- <TinyInput v-model="$Data.formData.password" type="password" placeholder="请输入密码,至少6位" />
12
- </TinyFormItem>
13
- <TinyFormItem label="姓名" prop="name">
14
- <TinyInput v-model="$Data.formData.name" placeholder="请输入姓名" />
15
- </TinyFormItem>
16
- <TinyFormItem label="昵称" prop="nickname">
17
- <TinyInput v-model="$Data.formData.nickname" placeholder="请输入昵称" />
18
- </TinyFormItem>
19
- <TinyFormItem label="手机号" prop="phone">
20
- <TinyInput v-model="$Data.formData.phone" placeholder="请输入手机号" />
21
- </TinyFormItem>
22
- <TinyFormItem v-if="$Prop.actionType === 'upd'" label="状态" prop="state">
23
- <TinyRadioGroup v-model="$Data.formData.state">
24
- <TinyRadio :label="1">正常</TinyRadio>
25
- <TinyRadio :label="2">禁用</TinyRadio>
26
- </TinyRadioGroup>
27
- </TinyFormItem>
28
- </TinyForm>
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
- <TinyButton @click="$Method.onClose">取消</TinyButton>
31
- <TinyButton type="primary" @click="$Method.onSubmit">确定</TinyButton>
30
+ <t-button @click="$Method.onClose">取消</t-button>
31
+ <t-button type="primary" @click="$Method.onSubmit">确定</t-button>
32
32
  </template>
33
- </TinyDialogBox>
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
- Modal.message({
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
- Modal.message({
136
+ MessagePlugin.info({
138
137
  message: '提交失败',
139
138
  status: 'error'
140
139
  });
@@ -1,22 +1,21 @@
1
1
  <template>
2
- <TinyDialogBox v-model:visible="$Data.visible" title="分配角色" width="600px" :append-to-body="true" :show-footer="true" :esc-closable="false" top="20vh" @close="$Method.onClose">
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
- <TinyTag type="info">{{ $Prop.rowData.username }}</TinyTag>
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
- <TinySelect v-model="$Data.checkedRoleCode" :options="$Data.roleOptions" placeholder="请选择角色" />
9
+ <t-select v-model="$Data.checkedRoleCode" :options="$Data.roleOptions" placeholder="请选择角色" />
10
10
  </div>
11
11
  <template #footer>
12
- <TinyButton @click="$Method.onClose">取消</TinyButton>
13
- <TinyButton type="primary" @click="$Method.onSubmit">确定</TinyButton>
12
+ <t-button @click="$Method.onClose">取消</t-button>
13
+ <t-button type="primary" @click="$Method.onSubmit">确定</t-button>
14
14
  </template>
15
- </TinyDialogBox>
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
- Modal.message({ message: '加载角色列表失败', status: 'error' });
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
- Modal.message({ message: '请选择角色', status: 'warning' });
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
- Modal.message({ message: '角色分配成功', status: 'success' });
108
+ MessagePlugin.info({ message: '角色分配成功', status: 'success' });
110
109
  $Method.onClose();
111
110
  $Emit('success');
112
111
  } else {
113
- Modal.message({ message: res.msg || '分配失败', status: 'error' });
112
+ MessagePlugin.info({ message: res.msg || '分配失败', status: 'error' });
114
113
  }
115
114
  } catch (error) {
116
115
  console.error('分配失败:', error);
117
- Modal.message({ message: '分配失败', status: 'error' });
116
+ MessagePlugin.info({ message: '分配失败', status: 'error' });
118
117
  }
119
118
  }
120
119
  };
@@ -2,71 +2,61 @@
2
2
  <div class="page-admin page-table">
3
3
  <div class="main-tool">
4
4
  <div class="left">
5
- <TinyButton type="primary" @click="$Method.onAction('add', {})">
5
+ <t-button type="primary" @click="$Method.onAction('add', {})">
6
6
  <template #icon>
7
7
  <IconLucidePlus />
8
8
  </template>
9
9
  添加管理员
10
- </TinyButton>
10
+ </t-button>
11
11
  </div>
12
12
  <div class="right">
13
- <TinyButton @click="$Method.handleRefresh">
13
+ <t-button @click="$Method.handleRefresh">
14
14
  <template #icon>
15
15
  <IconLucideRotateCw />
16
16
  </template>
17
- </TinyButton>
17
+ </t-button>
18
18
  </div>
19
19
  <div class="right">
20
- <TinyButton @click="$Method.handleRefresh">
20
+ <t-button @click="$Method.handleRefresh">
21
21
  <template #icon>
22
22
  <IconLucideRotateCw />
23
23
  </template>
24
24
  刷新
25
- </TinyButton>
25
+ </t-button>
26
26
  </div>
27
27
  </div>
28
28
 
29
29
  <div class="main-table">
30
- <TinyGrid :data="$Data.tableData" header-cell-class-name="custom-table-cell-class" size="small" height="100%" seq-serial>
31
- <TinyGridColumn type="index" title="序号" :width="60" />
32
- <TinyGridColumn field="username" title="用户名" />
33
- <TinyGridColumn field="email" title="邮箱" :width="200" />
34
- <TinyGridColumn field="nickname" title="昵称" :width="150" />
35
- <TinyGridColumn field="roleCode" title="角色" :width="120" />
36
- <TinyGridColumn field="state" title="状态" :width="100">
37
- <template #default="{ row }">
38
- <TinyTag v-if="row.state === 1" type="success">正常</TinyTag>
39
- <TinyTag v-else-if="row.state === 2" type="warning">禁用</TinyTag>
40
- <TinyTag v-else type="danger">已删除</TinyTag>
41
- </template>
42
- </TinyGridColumn>
43
- <TinyGridColumn title="操作" :width="120" align="right">
44
- <template #default="{ row }">
45
- <TinyDropdown title="操作" trigger="click" size="small" border visible-arrow @item-click="(data) => $Method.onAction(data.itemData.command, row)">
46
- <template #dropdown>
47
- <TinyDropdownMenu>
48
- <TinyDropdownItem :item-data="{ command: 'role' }">
49
- <IconLucideUser />
50
- 分配角色
51
- </TinyDropdownItem>
52
- <TinyDropdownItem :item-data="{ command: 'upd' }">
53
- <IconLucidePencil />
54
- 编辑
55
- </TinyDropdownItem>
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
- <TinyPager :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.pageSize" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @size-change="$Method.handleSizeChange" />
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
- Modal.message({
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
- Modal.confirm({
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
- Modal.message({ message: '删除成功', status: 'success' });
140
+ MessagePlugin.info({ message: '删除成功', status: 'success' });
143
141
  $Method.apiAdminList();
144
142
  } else {
145
- Modal.message({ message: res.msg || '删除失败', status: 'error' });
143
+ MessagePlugin.info({ message: res.msg || '删除失败', status: 'error' });
146
144
  }
147
145
  } catch (error) {
148
146
  console.error('删除失败:', error);
149
- Modal.message({ message: '删除失败', status: 'error' });
147
+ MessagePlugin.info({ message: '删除失败', status: 'error' });
150
148
  }
151
149
  });
152
150
  },
@@ -1,41 +1,40 @@
1
1
  <template>
2
- <TinyDialogBox 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
- <TinyForm :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($From.form = el)">
4
- <TinyFormItem label="字典名称" prop="name">
5
- <TinyInput v-model="$Data.formData.name" placeholder="请输入字典名称" />
6
- </TinyFormItem>
7
- <TinyFormItem label="字典代码" prop="code">
8
- <TinyInput v-model="$Data.formData.code" placeholder="请输入字典代码,如:gender" />
9
- </TinyFormItem>
10
- <TinyFormItem label="字典值" prop="value">
11
- <TinyInput v-model="$Data.formData.value" placeholder="请输入字典值" />
12
- </TinyFormItem>
13
- <TinyFormItem label="父级ID" prop="pid">
14
- <TinyNumeric v-model="$Data.formData.pid" :min="0" :max="999999999999999" />
15
- </TinyFormItem>
16
- <TinyFormItem label="排序" prop="sort">
17
- <TinyNumeric v-model="$Data.formData.sort" :min="0" :max="9999" />
18
- </TinyFormItem>
19
- <TinyFormItem label="描述" prop="description">
20
- <TinyInput v-model="$Data.formData.description" type="textarea" placeholder="请输入描述" :rows="3" />
21
- </TinyFormItem>
22
- <TinyFormItem label="状态" prop="state">
23
- <TinyRadioGroup v-model="$Data.formData.state">
24
- <TinyRadio :label="1">正常</TinyRadio>
25
- <TinyRadio :label="2">禁用</TinyRadio>
26
- </TinyRadioGroup>
27
- </TinyFormItem>
28
- </TinyForm>
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
- <TinyButton @click="$Method.onClose">取消</TinyButton>
31
- <TinyButton type="primary" @click="$Method.onSubmit">确定</TinyButton>
30
+ <t-button @click="$Method.onClose">取消</t-button>
31
+ <t-button type="primary" @click="$Method.onSubmit">确定</t-button>
32
32
  </template>
33
- </TinyDialogBox>
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
- Modal.message({
131
+ MessagePlugin.info({
133
132
  message: $Prop.actionType === 'add' ? '添加成功' : '编辑成功',
134
133
  status: 'success'
135
134
  });
@@ -2,61 +2,49 @@
2
2
  <div class="page-dict page-table">
3
3
  <div class="main-tool">
4
4
  <div class="left">
5
- <TinyButton type="primary" @click="$Method.onAction('add', {})">
5
+ <t-button type="primary" @click="$Method.onAction('add', {})">
6
6
  <template #icon>
7
7
  <IconLucidePlus />
8
8
  </template>
9
9
  添加字典
10
- </TinyButton>
10
+ </t-button>
11
11
  </div>
12
12
  <div class="right">
13
- <TinyButton @click="$Method.handleRefresh">
13
+ <t-button @click="$Method.handleRefresh">
14
14
  <template #icon>
15
15
  <IconLucideRotateCw />
16
16
  </template>
17
17
  刷新
18
- </TinyButton>
18
+ </t-button>
19
19
  </div>
20
20
  </div>
21
21
  <div class="main-table">
22
- <TinyGrid :data="$Data.dictList" header-cell-class-name="custom-table-cell-class" size="small" height="100%" seq-serial>
23
- <TinyGridColumn type="index" title="序号" :width="60" />
24
- <TinyGridColumn field="name" title="字典名称" />
25
- <TinyGridColumn field="code" title="字典代码" :width="150" />
26
- <TinyGridColumn field="value" title="字典值" :width="200" />
27
- <TinyGridColumn field="pid" title="父级ID" :width="100" />
28
- <TinyGridColumn field="sort" title="排序" :width="80" />
29
- <TinyGridColumn field="description" title="描述" />
30
- <TinyGridColumn field="state" title="状态" :width="100">
31
- <template #default="{ row }">
32
- <TinyTag v-if="row.state === 1" type="success">正常</TinyTag>
33
- <TinyTag v-else-if="row.state === 2" type="warning">禁用</TinyTag>
34
- <TinyTag v-else type="danger">已删除</TinyTag>
35
- </template>
36
- </TinyGridColumn>
37
- <TinyGridColumn title="操作" :width="120" align="right">
38
- <template #default="{ row }">
39
- <TinyDropdown title="操作" trigger="click" size="small" border visible-arrow @item-click="(data) => $Method.onAction(data.itemData.command, row)">
40
- <template #dropdown>
41
- <TinyDropdownMenu>
42
- <TinyDropdownItem :item-data="{ command: 'upd' }">
43
- <IconLucidePencil />
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
- <TinyPager :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.pageSize" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @size-change="$Method.handleSizeChange" />
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
- Modal.message({
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
- Modal.confirm({
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
- Modal.message({ message: '删除成功', status: 'success' });
124
+ MessagePlugin.info({ message: '删除成功', status: 'success' });
127
125
  $Method.apiDictList();
128
126
  } else {
129
- Modal.message({ message: res.msg || '删除失败', status: 'error' });
127
+ MessagePlugin.info({ message: res.msg || '删除失败', status: 'error' });
130
128
  }
131
129
  } catch (error) {
132
130
  console.error('删除失败:', error);
133
- Modal.message({ message: '删除失败', status: 'error' });
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
- <TinyTag type="success" size="small">{{ addon.version }}</TinyTag>
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