@befly-addon/admin 1.0.24 → 1.0.26

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.
@@ -7,7 +7,6 @@ import { Yes, No } from 'befly';
7
7
  export default {
8
8
  name: '管理员角色保存',
9
9
  fields: {
10
- adminId: Fields._id,
11
10
  roleCode: {
12
11
  name: '角色编码',
13
12
  type: 'string',
@@ -33,7 +32,7 @@ export default {
33
32
  // 更新管理员的角色ID、角色编码和角色类型
34
33
  await befly.db.updData({
35
34
  table: 'addon_admin_admin',
36
- where: { id: ctx.body.adminId },
35
+ where: { id: ctx.body.id },
37
36
  data: {
38
37
  roleId: role.id,
39
38
  roleCode: role.code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "Befly - 管理后台功能组件",
5
5
  "type": "module",
6
6
  "private": false,
@@ -39,7 +39,7 @@
39
39
  "url": "https://github.com/chenbimo/befly.git",
40
40
  "directory": "packages/addon-admin"
41
41
  },
42
- "gitHead": "f3f4db9f70580b0103c9dab3891c816ed6b03135",
42
+ "gitHead": "ca96814c3b67376809086cd8bef8e7816b736483",
43
43
  "dependencies": {
44
44
  "befly": "3.8.12"
45
45
  }
package/util.ts CHANGED
@@ -1,14 +1,25 @@
1
- import type { RouteRecordRaw } from 'vue-router';
1
+ import type { RouteRecordRaw, Component } from 'vue-router';
2
+
3
+ /**
4
+ * 布局配置接口
5
+ */
6
+ export interface LayoutConfig {
7
+ path: string;
8
+ layoutName: string;
9
+ component: Component;
10
+ children?: LayoutConfig[];
11
+ meta?: Record<string, any>;
12
+ }
2
13
 
3
14
  /**
4
15
  * 自定义布局处理函数
5
16
  * 根据文件名后缀判断使用哪个布局
6
17
  * @param routes - 原始路由配置
7
18
  * @param inheritLayout - 继承的布局名称(来自父级目录)
8
- * @returns 处理后的路由配置
19
+ * @returns 处理后的布局配置(不包含实际的布局组件导入)
9
20
  */
10
- export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): RouteRecordRaw[] {
11
- const result: RouteRecordRaw[] = [];
21
+ export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): LayoutConfig[] {
22
+ const result: LayoutConfig[] = [];
12
23
 
13
24
  for (const route of routes) {
14
25
  const currentPath = route.path || '';
@@ -23,9 +34,11 @@ export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): RouteReco
23
34
  const cleanPath = pathMatch ? currentPath.replace(/_\d+$/, '') : currentPath;
24
35
 
25
36
  result.push({
26
- ...route,
27
37
  path: cleanPath,
28
- children: Layouts(route.children, currentLayout)
38
+ layoutName: currentLayout || 'default',
39
+ component: route.component!,
40
+ children: Layouts(route.children, currentLayout),
41
+ meta: route.meta
29
42
  });
30
43
  continue;
31
44
  }
@@ -51,19 +64,12 @@ export function Layouts(routes: RouteRecordRaw[], inheritLayout = ''): RouteReco
51
64
  cleanPath = lastPart;
52
65
  }
53
66
 
54
- // 根据布局名称加载对应组件
55
- const layoutComponent = layoutName === 'default' ? () => import('@/layouts/default.vue') : () => import(`@/layouts/${layoutName}.vue`);
56
-
57
- // 包裹布局
67
+ // 返回布局配置(不执行实际导入)
58
68
  result.push({
59
69
  path: cleanPath,
60
- component: layoutComponent,
61
- children: [
62
- {
63
- ...route,
64
- path: ''
65
- }
66
- ]
70
+ layoutName: layoutName,
71
+ component: route.component!,
72
+ meta: route.meta
67
73
  });
68
74
  }
69
75
 
@@ -15,7 +15,6 @@
15
15
  <script setup>
16
16
  import { useRouter, useRoute } from 'vue-router';
17
17
  import { Button as TinyButton } from '@opentiny/vue';
18
- import { useRouter } from 'vue-router';
19
18
 
20
19
  const router = useRouter();
21
20
 
@@ -34,9 +34,8 @@
34
34
  </template>
35
35
 
36
36
  <script setup>
37
- import { shallowRef } from 'vue';
37
+ import { $ref, $shallowRef } from 'vue-macros/macros';
38
38
  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';
39
- import { Modal } from '@opentiny/vue';
40
39
  import { $Http } from '@/plugins/http';
41
40
 
42
41
  const $Prop = defineProps({
@@ -16,9 +16,8 @@
16
16
  </template>
17
17
 
18
18
  <script setup>
19
- import { shallowRef } from 'vue';
19
+ import { $ref } from 'vue-macros/macros';
20
20
  import { Button as TinyButton, DialogBox as TinyDialogBox, Select as TinySelect, Tag as TinyTag, Modal } from '@opentiny/vue';
21
- import { Modal } from '@opentiny/vue';
22
21
  import { $Http } from '@/plugins/http';
23
22
 
24
23
  const $Prop = defineProps({
@@ -78,6 +78,7 @@
78
78
  </template>
79
79
 
80
80
  <script setup>
81
+ import { $ref } from 'vue-macros/macros';
81
82
  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
83
  import IconLucidePlus from '~icons/lucide/plus';
83
84
  import IconLucideRotateCw from '~icons/lucide/rotate-cw';
@@ -34,9 +34,9 @@
34
34
  </template>
35
35
 
36
36
  <script setup>
37
- import { watch, shallowRef } from 'vue';
37
+ import { $ref, $shallowRef } from 'vue-macros/macros';
38
+ import { watch } from 'vue';
38
39
  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
- import { Modal } from '@opentiny/vue';
40
40
  import { $Http } from '@/plugins/http';
41
41
 
42
42
  const $Prop = defineProps({
@@ -65,6 +65,7 @@
65
65
  </template>
66
66
 
67
67
  <script setup>
68
+ import { $ref } from 'vue-macros/macros';
68
69
  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
70
  import IconLucidePlus from '~icons/lucide/plus';
70
71
  import IconLucideRotateCw from '~icons/lucide/rotate-cw';
@@ -74,8 +75,6 @@ import IconLucideTrash2 from '~icons/lucide/trash-2';
74
75
  import EditDialog from './components/edit.vue';
75
76
  import { $Http } from '@/plugins/http';
76
77
 
77
- import EditDialog from './components/edit.vue';
78
-
79
78
  // 响应式数据
80
79
  const $Data = $ref({
81
80
  dictList: [],
@@ -24,6 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <script setup>
27
+ import { $ref } from 'vue-macros/macros';
27
28
  import IconLucideBox from '~icons/lucide/box';
28
29
  import { Tag as TinyTag } from '@opentiny/vue';
29
30
  import IconLucidePackage from '~icons/lucide/package';
@@ -36,6 +36,7 @@
36
36
  </template>
37
37
 
38
38
  <script setup>
39
+ import { $ref } from 'vue-macros/macros';
39
40
  import IconLucideServer from '~icons/lucide/server';
40
41
  import { $Http } from '@/plugins/http';
41
42
 
@@ -34,6 +34,7 @@
34
34
  </template>
35
35
 
36
36
  <script setup>
37
+ import { $ref } from 'vue-macros/macros';
37
38
  import { Tag as TinyTag } from '@opentiny/vue';
38
39
  import IconLucideFileText from '~icons/lucide/file-text';
39
40
 
@@ -53,6 +53,7 @@
53
53
  </template>
54
54
 
55
55
  <script setup>
56
+ import { $ref } from 'vue-macros/macros';
56
57
  import IconLucideActivity from '~icons/lucide/activity';
57
58
  import IconLucideTrendingUp from '~icons/lucide/trending-up';
58
59
  import IconLucideAlertCircle from '~icons/lucide/alert-circle';
@@ -35,6 +35,7 @@
35
35
  </template>
36
36
 
37
37
  <script setup>
38
+ import { $ref } from 'vue-macros/macros';
38
39
  import IconLucideCheckCircle from '~icons/lucide/check-circle';
39
40
  import IconLucideZap from '~icons/lucide/zap';
40
41
  import IconLucideCloud from '~icons/lucide/cloud';
@@ -26,6 +26,7 @@
26
26
  </template>
27
27
 
28
28
  <script setup>
29
+ import { $ref } from 'vue-macros/macros';
29
30
  import IconLucideBell from '~icons/lucide/bell';
30
31
  import IconLucideCheckCircle from '~icons/lucide/check-circle';
31
32
  import IconLucideAlertTriangle from '~icons/lucide/alert-triangle';
@@ -39,6 +39,7 @@
39
39
  </template>
40
40
 
41
41
  <script setup>
42
+ import { $ref } from 'vue-macros/macros';
42
43
  import IconLucideWebhook from '~icons/lucide/webhook';
43
44
  import IconLucideUsers from '~icons/lucide/users';
44
45
  import IconLucideUser from '~icons/lucide/user';
@@ -39,6 +39,7 @@
39
39
  </template>
40
40
 
41
41
  <script setup>
42
+ import { $ref } from 'vue-macros/macros';
42
43
  import IconLucideDisc from '~icons/lucide/disc';
43
44
  import { Progress as TinyProgress } from '@opentiny/vue';
44
45
  import IconLucideCpu from '~icons/lucide/cpu';
@@ -37,6 +37,7 @@
37
37
  </template>
38
38
 
39
39
  <script setup>
40
+ import { $ref } from 'vue-macros/macros';
40
41
  import IconLucidePhone from '~icons/lucide/phone';
41
42
  import IconLucideClock from '~icons/lucide/clock';
42
43
  import { Button as TinyButton } from '@opentiny/vue';
@@ -25,7 +25,7 @@
25
25
  </template>
26
26
 
27
27
  <script setup lang="ts">
28
- import { shallowRef } from 'vue';
28
+ import { $ref, $shallowRef } from 'vue-macros/macros';
29
29
  import { useRouter, useRoute } from 'vue-router';
30
30
  import { Button as TinyButton, Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput, Modal } from '@opentiny/vue';
31
31
  import IconLucideUser from '~icons/lucide/user';
@@ -37,7 +37,7 @@
37
37
  </template>
38
38
 
39
39
  <script setup>
40
- import { shallowRef } from 'vue';
40
+ import { $ref, $shallowRef } from 'vue-macros/macros';
41
41
  import { Button as TinyButton, Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput } from '@opentiny/vue';
42
42
  import IconLucideUser from '~icons/lucide/user';
43
43
  import IconLucideMail from '~icons/lucide/mail';
@@ -26,6 +26,7 @@
26
26
  </template>
27
27
 
28
28
  <script setup>
29
+ import { $ref } from 'vue-macros/macros';
29
30
  import WelcomePanel from './components/welcomePanel.vue';
30
31
  import EmailLoginForm from './components/emailLoginForm.vue';
31
32
  import RegisterForm from './components/registerForm.vue';
@@ -28,7 +28,8 @@
28
28
  </template>
29
29
 
30
30
  <script setup>
31
- import { watch, shallowRef } from 'vue';
31
+ import { $ref, $shallowRef } from 'vue-macros/macros';
32
+ import { watch } from 'vue';
32
33
  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';
33
34
  import { $Http } from '@/plugins/http';
34
35
 
@@ -68,6 +68,7 @@
68
68
  </template>
69
69
 
70
70
  <script setup>
71
+ import { $ref } from 'vue-macros/macros';
71
72
  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';
72
73
  import IconLucidePlus from '~icons/lucide/plus';
73
74
  import IconLucideRotateCw from '~icons/lucide/rotate-cw';
@@ -33,6 +33,7 @@
33
33
  </template>
34
34
 
35
35
  <script setup>
36
+ import { $ref } from 'vue-macros/macros';
36
37
  import { Button as TinyButton, DialogBox as TinyDialogBox, Search as TinySearch, Checkbox as TinyCheckbox, CheckboxGroup as TinyCheckboxGroup, Modal } from '@opentiny/vue';
37
38
  import { $Http } from '@/plugins/http';
38
39
 
@@ -30,7 +30,7 @@
30
30
  </template>
31
31
 
32
32
  <script setup>
33
- import { shallowRef } from 'vue';
33
+ import { $ref, $shallowRef } from 'vue-macros/macros';
34
34
  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';
35
35
  import { $Http } from '@/plugins/http';
36
36
 
@@ -11,7 +11,8 @@
11
11
  </template>
12
12
 
13
13
  <script setup>
14
- import { nextTick, shallowRef } from 'vue';
14
+ import { $ref, $shallowRef } from 'vue-macros/macros';
15
+ import { nextTick } from 'vue';
15
16
  import { Button as TinyButton, DialogBox as TinyDialogBox, Tree as TinyTree, Modal } from '@opentiny/vue';
16
17
 
17
18
  import { arrayToTree } from '@/utils';
@@ -77,6 +77,7 @@
77
77
  </template>
78
78
 
79
79
  <script setup>
80
+ import { $ref } from 'vue-macros/macros';
80
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';
81
82
  import IconLucidePlus from '~icons/lucide/plus';
82
83
  import IconLucideRotateCw from '~icons/lucide/rotate-cw';
@@ -74,6 +74,7 @@
74
74
  </template>
75
75
 
76
76
  <script setup>
77
+ import { $ref } from 'vue-macros/macros';
77
78
  import { Tag as TinyTag, Modal } from '@opentiny/vue';
78
79
  import IconLucidePlus from '~icons/lucide/plus';
79
80
  import IconLucideSearch from '~icons/lucide/search';