v-nuxt-ui 0.1.18 → 0.1.20

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.
Files changed (65) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/button/Theme.vue +2 -1
  3. package/dist/runtime/components/layout/Login.d.vue.ts +20 -0
  4. package/dist/runtime/components/layout/Login.vue +36 -0
  5. package/dist/runtime/components/layout/Login.vue.d.ts +20 -0
  6. package/dist/runtime/components/layout/button/Collapse.vue +15 -0
  7. package/dist/runtime/components/layout/{ModuleMenu.vue → button/ModuleMenu.vue} +1 -1
  8. package/dist/runtime/components/layout/button/ThemePicker.d.vue.ts +3 -0
  9. package/dist/runtime/components/layout/{ThemePicker.vue → button/ThemePicker.vue} +23 -6
  10. package/dist/runtime/components/layout/button/ThemePicker.vue.d.ts +3 -0
  11. package/dist/runtime/components/layout/{UserMenu.vue → button/UserMenu.vue} +5 -6
  12. package/dist/runtime/components/layout/default.d.vue.ts +2 -2
  13. package/dist/runtime/components/layout/default.vue +41 -34
  14. package/dist/runtime/components/layout/default.vue.d.ts +2 -2
  15. package/dist/runtime/components/sys/company/CreateModal.d.vue.ts +13 -0
  16. package/dist/runtime/components/sys/company/CreateModal.vue +23 -0
  17. package/dist/runtime/components/sys/company/CreateModal.vue.d.ts +13 -0
  18. package/dist/runtime/components/sys/company/Table.d.vue.ts +3 -0
  19. package/dist/runtime/components/sys/company/Table.vue +53 -0
  20. package/dist/runtime/components/sys/company/Table.vue.d.ts +3 -0
  21. package/dist/runtime/components/sys/department/CreateModal.d.vue.ts +13 -0
  22. package/dist/runtime/components/sys/department/CreateModal.vue +77 -0
  23. package/dist/runtime/components/sys/department/CreateModal.vue.d.ts +13 -0
  24. package/dist/runtime/components/sys/department/Table.d.vue.ts +3 -0
  25. package/dist/runtime/components/sys/department/Table.vue +61 -0
  26. package/dist/runtime/components/sys/department/Table.vue.d.ts +3 -0
  27. package/dist/runtime/components/sys/job-title/CreateModal.d.vue.ts +13 -0
  28. package/dist/runtime/components/sys/job-title/CreateModal.vue +26 -0
  29. package/dist/runtime/components/sys/job-title/CreateModal.vue.d.ts +13 -0
  30. package/dist/runtime/components/sys/job-title/Table.d.vue.ts +3 -0
  31. package/dist/runtime/components/sys/job-title/Table.vue +67 -0
  32. package/dist/runtime/components/sys/job-title/Table.vue.d.ts +3 -0
  33. package/dist/runtime/components/sys/menu/CreateModal.d.vue.ts +13 -0
  34. package/dist/runtime/components/sys/menu/CreateModal.vue +58 -0
  35. package/dist/runtime/components/sys/menu/CreateModal.vue.d.ts +13 -0
  36. package/dist/runtime/components/sys/menu/Table.d.vue.ts +3 -0
  37. package/dist/runtime/components/sys/menu/Table.vue +96 -0
  38. package/dist/runtime/components/sys/menu/Table.vue.d.ts +3 -0
  39. package/dist/runtime/components/sys/role/CreateModal.d.vue.ts +13 -0
  40. package/dist/runtime/components/sys/role/CreateModal.vue +86 -0
  41. package/dist/runtime/components/sys/role/CreateModal.vue.d.ts +13 -0
  42. package/dist/runtime/components/sys/role/Table.d.vue.ts +3 -0
  43. package/dist/runtime/components/sys/role/Table.vue +68 -0
  44. package/dist/runtime/components/sys/role/Table.vue.d.ts +3 -0
  45. package/dist/runtime/components/sys/user/CreateModal.d.vue.ts +13 -0
  46. package/dist/runtime/components/sys/user/CreateModal.vue +179 -0
  47. package/dist/runtime/components/sys/user/CreateModal.vue.d.ts +13 -0
  48. package/dist/runtime/components/sys/user/Table.d.vue.ts +3 -0
  49. package/dist/runtime/components/sys/user/Table.vue +168 -0
  50. package/dist/runtime/components/sys/user/Table.vue.d.ts +3 -0
  51. package/dist/runtime/components/table/Page.vue +46 -48
  52. package/dist/runtime/components/table/Pagination.vue +1 -1
  53. package/dist/runtime/components/table/index.vue +1 -1
  54. package/dist/runtime/composables/useApp.d.ts +6 -0
  55. package/dist/runtime/composables/useApp.js +28 -1
  56. package/dist/runtime/composables/useTheme.d.ts +8 -0
  57. package/dist/runtime/composables/useTheme.js +34 -1
  58. package/dist/runtime/types/app.d.ts +4 -0
  59. package/package.json +1 -1
  60. /package/dist/runtime/components/layout/{ThemePicker.d.vue.ts → button/Collapse.d.vue.ts} +0 -0
  61. /package/dist/runtime/components/layout/{ThemePicker.vue.d.ts → button/Collapse.vue.d.ts} +0 -0
  62. /package/dist/runtime/components/layout/{ModuleMenu.d.vue.ts → button/ModuleMenu.d.vue.ts} +0 -0
  63. /package/dist/runtime/components/layout/{ModuleMenu.vue.d.ts → button/ModuleMenu.vue.d.ts} +0 -0
  64. /package/dist/runtime/components/layout/{UserMenu.d.vue.ts → button/UserMenu.d.vue.ts} +0 -0
  65. /package/dist/runtime/components/layout/{UserMenu.vue.d.ts → button/UserMenu.vue.d.ts} +0 -0
package/dist/module.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "dependencies": [
8
8
  "@nuxt/ui"
9
9
  ],
10
- "version": "0.1.18",
10
+ "version": "0.1.20",
11
11
  "builder": {
12
12
  "@nuxt/module-builder": "1.0.2",
13
13
  "unbuild": "3.6.1"
@@ -11,6 +11,7 @@ const props = defineProps({
11
11
  });
12
12
  const slots = defineSlots();
13
13
  const colorMode = useColorMode();
14
+ const emojiFlag = computed(() => props.locale ? getEmojiFlag(props.locale) : "");
14
15
  const chipColor = computed(() => {
15
16
  if (!props.chip) return void 0;
16
17
  if (props.chip === "black") return "black";
@@ -37,7 +38,7 @@ const chipColor = computed(() => {
37
38
  />
38
39
  </slot>
39
40
  <slot v-else-if="locale" name="leading">
40
- {{ getEmojiFlag(locale) }}
41
+ {{ emojiFlag }}
41
42
  </slot>
42
43
  <slot v-else name="leading" />
43
44
  </template>
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ title: string;
3
+ backgroundImage: string;
4
+ backgroundImageClass?: string;
5
+ logo: string;
6
+ logoClass?: string;
7
+ };
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,36 @@
1
+ <script setup>
2
+ defineProps({
3
+ title: { type: String, required: true },
4
+ backgroundImage: { type: String, required: true },
5
+ backgroundImageClass: { type: String, required: false },
6
+ logo: { type: String, required: true },
7
+ logoClass: { type: String, required: false }
8
+ });
9
+ </script>
10
+
11
+ <template>
12
+ <div class="fixed inset-0 flex flex-col items-center justify-center px-3">
13
+ <img
14
+ :src="backgroundImage"
15
+ alt="Veken Building"
16
+ class="absolute w-screen h-screen object-cover object-left opacity-8"
17
+ :class="backgroundImageClass"
18
+ >
19
+ <UCard class="w-full max-w-md z-10">
20
+ <template #header>
21
+ <div class="flex flex-wrap gap-3 items-center justify-between">
22
+ <img
23
+ :src="logo"
24
+ alt="Veken Logo"
25
+ class="h-9"
26
+ :class="logoClass"
27
+ >
28
+ <div class="font-bold text-lg">
29
+ {{ title }}
30
+ </div>
31
+ </div>
32
+ </template>
33
+ <slot />
34
+ </UCard>
35
+ </div>
36
+ </template>
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ title: string;
3
+ backgroundImage: string;
4
+ backgroundImageClass?: string;
5
+ logo: string;
6
+ logoClass?: string;
7
+ };
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,15 @@
1
+ <script setup>
2
+ import { useApp, useTheme } from "#v/composables";
3
+ const app = useApp();
4
+ const theme = useTheme();
5
+ </script>
6
+
7
+ <template>
8
+ <UButton
9
+ :icon="theme.sidebarSide.value === 'left' ? 'i-lucide-panel-left' : 'i-lucide-panel-right'"
10
+ color="neutral"
11
+ variant="ghost"
12
+ aria-label="Toggle sidebar"
13
+ @click="app.sidebarCollapsed.value = !app.sidebarCollapsed.value"
14
+ />
15
+ </template>
@@ -42,7 +42,7 @@ const items = computed(() => {
42
42
  }"
43
43
  color="neutral"
44
44
  variant="ghost"
45
- :square="collapsed"
45
+ square
46
46
  class="data-[state=open]:bg-elevated"
47
47
  />
48
48
  </UDropdownMenu>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -2,6 +2,7 @@
2
2
  import { useTheme } from "#v/composables";
3
3
  import ButtonTheme from "#v/components/button/Theme.vue";
4
4
  const theme = useTheme();
5
+ const neutralColorOptions = theme.neutralColors.map((c) => ({ color: c, chip: c === "neutral" ? "old-neutral" : c }));
5
6
  </script>
6
7
 
7
8
  <template>
@@ -53,12 +54,12 @@ const theme = useTheme();
53
54
 
54
55
  <div class="grid grid-cols-3 gap-2 -mx-2">
55
56
  <ButtonTheme
56
- v-for="color in theme.neutralColors"
57
- :key="color"
58
- :label="color"
59
- :chip="color === 'neutral' ? 'old-neutral' : color"
60
- :selected="theme.neutral.value === color"
61
- @click="theme.neutral.value = color"
57
+ v-for="item in neutralColorOptions"
58
+ :key="item.color"
59
+ :label="item.color"
60
+ :chip="item.chip"
61
+ :selected="theme.neutral.value === item.color"
62
+ @click="theme.neutral.value = item.color"
62
63
  />
63
64
  </div>
64
65
  </fieldset>
@@ -95,6 +96,22 @@ const theme = useTheme();
95
96
  />
96
97
  </div>
97
98
  </fieldset>
99
+
100
+ <fieldset>
101
+ <legend class="text-[11px] leading-none font-semibold mb-2">
102
+ 侧边栏样式
103
+ </legend>
104
+
105
+ <div class="grid grid-cols-3 gap-2 -mx-2">
106
+ <ButtonTheme
107
+ v-for="m in theme.sidebarVariantOptions.value"
108
+ :key="m.label"
109
+ v-bind="m"
110
+ :selected="theme.sidebarVariant.value === m.value"
111
+ @click="theme.sidebarVariant.value = m.value"
112
+ />
113
+ </div>
114
+ </fieldset>
98
115
  </template>
99
116
  </UPopover>
100
117
  </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -44,19 +44,18 @@ const items = computed(() => [
44
44
  <UDropdownMenu
45
45
  :items="items"
46
46
  :content="{ align: 'center', collisionPadding: 12 }"
47
- :ui="{ content: collapsed || headerMode ? 'w-48' : 'w-(--reka-dropdown-menu-trigger-width)' }"
47
+ :ui="{ content: 'w-(--reka-dropdown-menu-trigger-width) min-w-48' }"
48
48
  >
49
49
  <UButton
50
- :label="collapsed || headerMode && app.isMobile.value ? void 0 : auth.loginUser.value?.nickname ?? 'Hello'"
50
+ :label="auth.loginUser.value?.nickname ?? 'Hello'"
51
51
  leading-icon="i-lucide-user-circle"
52
52
  :trailing-icon="collapsed || headerMode ? void 0 : 'i-lucide-chevrons-up-down'"
53
53
  color="neutral"
54
54
  variant="ghost"
55
- block
56
- :square="collapsed || headerMode"
57
- class="data-[state=open]:bg-elevated"
55
+ square
56
+ class="data-[state=open]:bg-elevated w-full overflow-hidden"
58
57
  :ui="{
59
- trailingIcon: 'text-dimmed'
58
+ trailingIcon: 'text-dimmed ms-auto'
60
59
  }"
61
60
  />
62
61
 
@@ -1,6 +1,6 @@
1
- declare var __VLS_49: {};
1
+ declare var __VLS_42: {};
2
2
  type __VLS_Slots = {} & {
3
- default?: (props: typeof __VLS_49) => any;
3
+ default?: (props: typeof __VLS_42) => any;
4
4
  };
5
5
  declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
6
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,18 +1,16 @@
1
1
  <script setup>
2
- import { useApp, useSidebarMenus, useAuth } from "#v/composables";
2
+ import { useSidebarMenus, useAuth, useTheme, useApp } from "#v/composables";
3
3
  import { useRoute } from "nuxt/app";
4
4
  import { stringsJoin } from "#v/utils";
5
- import UDashboardGroup from "@nuxt/ui/components/DashboardGroup.vue";
6
- import UDashboardSidebar from "@nuxt/ui/components/DashboardSidebar.vue";
7
5
  import UNavigationMenu from "@nuxt/ui/components/NavigationMenu.vue";
8
6
  import ScrollArea from "#v/components/ScrollArea.vue";
9
- import LayoutModuleMenu from "#v/components/layout/ModuleMenu.vue";
10
- import LayoutThemePicker from "#v/components/layout/ThemePicker.vue";
11
- import LayoutUserMenu from "#v/components/layout/UserMenu.vue";
7
+ import LayoutModuleMenu from "#v/components/layout/button/ModuleMenu.vue";
8
+ import LayoutThemePicker from "#v/components/layout/button/ThemePicker.vue";
9
+ import LayoutUserMenu from "#v/components/layout/button/UserMenu.vue";
12
10
  import Watermark from "#v/components/Watermark.vue";
13
- import { ref, watch } from "vue";
14
- const open = ref(false);
11
+ import { watch } from "vue";
15
12
  const app = useApp();
13
+ const theme = useTheme();
16
14
  const loginUser = useAuth().loginUser;
17
15
  const route = useRoute();
18
16
  const { sidebarMenus, expandSidebarMenu, breadcrumbs, getBreadcrumbs } = useSidebarMenus();
@@ -31,53 +29,62 @@ watch(
31
29
  </script>
32
30
 
33
31
  <template>
34
- <UDashboardGroup unit="rem">
35
- <UDashboardSidebar
36
- id="sidebar"
37
- v-model:open="open"
38
- collapsible
39
- resizable
40
- :min-size="app.appConfig.value.siderMinWidth"
41
- :max-size="app.appConfig.value.siderMaxWidth"
32
+ <div
33
+ class="flex flex-1 h-full"
34
+ :class="[
35
+ theme.sidebarVariant.value === 'inset' && 'bg-neutral-50 dark:bg-neutral-950',
36
+ theme.sidebarSide.value === 'right' && 'flex-row-reverse'
37
+ ]"
38
+ >
39
+ <!-- sidebar -->
40
+ <USidebar
41
+ v-model:open="app.sidebarCollapsed.value"
42
+ :variant="theme.sidebarVariant.value"
43
+ :collapsible="theme.sidebarCollapsible.value"
44
+ :side="theme.sidebarSide.value"
42
45
  :ui="{
43
- root: 'bg-muted min-w-[65px]',
44
- // 64 + 1: 1 is border-r
45
- footer: 'lg:border-t lg:border-default sm:px-4',
46
46
  body: 'px-0 sm:px-0',
47
- header: 'border-b border-default sm:px-4'
47
+ footer: 'h-(--ui-footer-height)'
48
48
  }"
49
49
  >
50
- <template #header="{ collapsed }">
51
- <LayoutModuleMenu :collapsed="collapsed" class="w-full" />
52
- <LayoutThemePicker v-if="!collapsed" class="ml-auto" />
50
+ <template #header="{ state }">
51
+ <LayoutModuleMenu :collapsed="state === 'collapsed'" class="flex-1" />
52
+ <LayoutThemePicker v-if="state !== 'collapsed'" class="ml-auto" />
53
53
  </template>
54
- <template #default="{ collapsed }">
54
+
55
+ <template #default="{ state }">
55
56
  <ScrollArea>
56
57
  <div class="px-4 flex flex-col gap-2">
57
58
  <UNavigationMenu
58
59
  :items="sidebarMenus"
59
- :collapsed="collapsed"
60
+ :collapsed="state === 'collapsed'"
60
61
  trailing-icon="i-lucide-chevron-down"
61
62
  orientation="vertical"
62
63
  tooltip
63
64
  popover
65
+ :ui="{ link: 'px-1.5 overflow-hidden' }"
64
66
  />
65
67
  </div>
66
68
  </ScrollArea>
67
69
  </template>
68
70
 
69
- <template #footer="{ collapsed }">
70
- <LayoutUserMenu :collapsed="collapsed" />
71
+ <template #footer="{ state }">
72
+ <LayoutUserMenu :collapsed="state === 'collapsed'" />
71
73
  </template>
72
- </UDashboardSidebar>
74
+ </USidebar>
73
75
 
74
- <Watermark
75
- :text="stringsJoin([
76
+ <!-- main content -->
77
+ <div
78
+ class="flex-1 flex flex-col w-full overflow-hidden lg:peer-data-[variant=floating]:my-4 peer-data-[variant=inset]:m-4 lg:peer-data-[variant=inset]:not-peer-data-[collapsible=offcanvas]:ms-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:ring peer-data-[variant=inset]:ring-default bg-default"
79
+ >
80
+ <Watermark
81
+ :text="stringsJoin([
76
82
  loginUser?.nickname ?? loginUser?.username,
77
83
  loginUser?.department?.company?.nickname ?? loginUser?.department?.name
78
84
  ], '@')"
79
- >
80
- <slot />
81
- </Watermark>
82
- </UDashboardGroup>
85
+ >
86
+ <slot />
87
+ </Watermark>
88
+ </div>
89
+ </div>
83
90
  </template>
@@ -1,6 +1,6 @@
1
- declare var __VLS_49: {};
1
+ declare var __VLS_42: {};
2
2
  type __VLS_Slots = {} & {
3
- default?: (props: typeof __VLS_49) => any;
3
+ default?: (props: typeof __VLS_42) => any;
4
4
  };
5
5
  declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
6
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,13 @@
1
+ import type { Company } from 'v-nuxt-ui/types';
2
+ type __VLS_Props = {
3
+ model: Company;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: Company) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: Company) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import * as z from "zod";
3
+ import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
4
+ import { useCompanyApi } from "#v/composables";
5
+ defineProps({
6
+ model: { type: null, required: true }
7
+ });
8
+ const emit = defineEmits(["close", "save"]);
9
+ </script>
10
+
11
+ <template>
12
+ <FormCreateModalTemplateWithApi
13
+ title="公司信息"
14
+ :on-close="(ok) => emit('close', ok)"
15
+ :on-save="(model) => emit('save', model)"
16
+ :fields="[
17
+ { name: 'fullname', type: 'input', label: '\u516C\u53F8\u5168\u79F0', colSpan: '24', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') },
18
+ { name: 'nickname', type: 'input', label: '\u516C\u53F8\u7B80\u79F0', colSpan: '24', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') }
19
+ ]"
20
+ :model-value="model"
21
+ :api-group="useCompanyApi"
22
+ />
23
+ </template>
@@ -0,0 +1,13 @@
1
+ import type { Company } from 'v-nuxt-ui/types';
2
+ type __VLS_Props = {
3
+ model: Company;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: Company) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: Company) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,53 @@
1
+ <script setup>
2
+ import { useOverlay } from "@nuxt/ui/composables";
3
+ import { useCompanyApi } from "#v/composables";
4
+ import SysCompaniesCreateModal from "./CreateModal.vue";
5
+ import { getOprColumns } from "#v/constants";
6
+ import TablePage from "#v/components/table/Page.vue";
7
+ const overlay = useOverlay();
8
+ const createModal = overlay.create(SysCompaniesCreateModal);
9
+ const columns = [
10
+ {
11
+ accessorKey: "fullname",
12
+ header: "\u516C\u53F8\u5168\u79F0",
13
+ meta: {
14
+ class: {
15
+ td: "w-300"
16
+ }
17
+ },
18
+ sortOption: true,
19
+ filterOption: {
20
+ type: "input",
21
+ initHide: false
22
+ }
23
+ },
24
+ {
25
+ accessorKey: "nickname",
26
+ header: "\u516C\u53F8\u7B80\u79F0",
27
+ meta: {
28
+ class: {
29
+ td: "w-300"
30
+ }
31
+ },
32
+ sortOption: true,
33
+ filterOption: {
34
+ type: "input",
35
+ initHide: false
36
+ }
37
+ },
38
+ ...getOprColumns()
39
+ ];
40
+ </script>
41
+
42
+ <template>
43
+ <TablePage
44
+ name="sys-company"
45
+ cn-name="公司信息"
46
+ :use-api-group="useCompanyApi"
47
+ :biz-columns="columns"
48
+ :extra-order-query-options="[
49
+ { field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
50
+ ]"
51
+ @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
52
+ />
53
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { Department } from 'v-nuxt-ui/types';
2
+ type __VLS_Props = {
3
+ model: Department;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: Department) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: Department) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,77 @@
1
+ <script setup>
2
+ import * as z from "zod";
3
+ import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
4
+ import { useCompanyApi, useDepartmentApi, useFormSubmission, useFormValues, useUserApi } from "#v/composables";
5
+ import { toRef, watch } from "vue";
6
+ const props = defineProps({
7
+ model: { type: null, required: true }
8
+ });
9
+ const emit = defineEmits(["close", "save"]);
10
+ const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0 });
11
+ watch(
12
+ () => newValues.value.parentId,
13
+ () => {
14
+ if (!newValues.value.companyId) {
15
+ newValues.value.companyId = newValues.value.parent?.companyId;
16
+ newValues.value.company = newValues.value.parent?.company;
17
+ }
18
+ }
19
+ );
20
+ const { onSubmit } = useFormSubmission(
21
+ toRef(oldValues),
22
+ toRef(newValues),
23
+ (close) => emit("close", close),
24
+ (model) => emit("save", model),
25
+ useDepartmentApi
26
+ );
27
+ </script>
28
+
29
+ <template>
30
+ <FormCreateModalTemplate
31
+ title="部门信息"
32
+ :on-close="(ok) => emit('close', ok)"
33
+ :fields="[
34
+ { name: 'name', type: 'input', label: '\u90E8\u95E8\u540D\u79F0', colSpan: '12', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') },
35
+ {
36
+ name: 'parentId',
37
+ label: '\u4E0A\u7EA7\u90E8\u95E8',
38
+ colSpan: '12',
39
+ type: 'async-tree-select',
40
+ labelField: 'name',
41
+ searchFields: ['name'],
42
+ listApi: useDepartmentApi().list,
43
+ fetchAll: true,
44
+ initModelValues: newValues.parent,
45
+ onUpdateInitModelValues: (newInitModelValues) => newValues.parent = newInitModelValues,
46
+ zodType: z.number().min(0)
47
+ },
48
+ {
49
+ name: 'companyId',
50
+ label: '\u96B6\u5C5E\u516C\u53F8',
51
+ colSpan: '12',
52
+ type: 'async-select',
53
+ labelField: 'nickname',
54
+ searchFields: ['nickname'],
55
+ listApi: useCompanyApi().list,
56
+ initModelValues: newValues.company,
57
+ onUpdateInitModelValues: (newInitModelValues) => newValues.company = newInitModelValues,
58
+ zodType: z.number().min(0)
59
+ },
60
+ {
61
+ name: 'leaderId',
62
+ label: '\u76F4\u5C5E\u9886\u5BFC',
63
+ colSpan: '12',
64
+ type: 'async-select',
65
+ labelField: 'nickname',
66
+ searchFields: ['nickname'],
67
+ listApi: useUserApi().list,
68
+ initModelValues: newValues.leader,
69
+ onUpdateInitModelValues: (newInitModelValues) => newValues.leader = newInitModelValues,
70
+ zodType: z.number().min(0)
71
+ }
72
+ ]"
73
+ :model-value="newValues"
74
+ @update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
75
+ @submit="onSubmit"
76
+ />
77
+ </template>
@@ -0,0 +1,13 @@
1
+ import type { Department } from 'v-nuxt-ui/types';
2
+ type __VLS_Props = {
3
+ model: Department;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: Department) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: Department) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,61 @@
1
+ <script setup>
2
+ import { useOverlay } from "@nuxt/ui/composables";
3
+ import { useDepartmentApi } from "#v/composables";
4
+ import SysDepartmentsCreateModal from "./CreateModal.vue";
5
+ import { getOprColumns } from "#v/constants";
6
+ import TablePage from "#v/components/table/Page.vue";
7
+ const overlay = useOverlay();
8
+ const createModal = overlay.create(SysDepartmentsCreateModal);
9
+ const columns = [
10
+ {
11
+ accessorKey: "name",
12
+ header: "\u90E8\u95E8\u540D\u79F0",
13
+ sortOption: true,
14
+ filterOption: {
15
+ type: "input",
16
+ initHide: false
17
+ }
18
+ },
19
+ {
20
+ accessorKey: "companyId",
21
+ header: "\u96B6\u5C5E\u516C\u53F8",
22
+ sortOption: true,
23
+ cell: ({ row }) => row.original.company?.nickname
24
+ },
25
+ {
26
+ accessorKey: "parentId",
27
+ header: "\u4E0A\u7EA7\u90E8\u95E8",
28
+ sortOption: true,
29
+ cell: ({ row }) => row.original.parent?.name ?? "\u65E0"
30
+ },
31
+ {
32
+ accessorKey: "leaderId",
33
+ header: "\u76F4\u7BA1\u9886\u5BFC",
34
+ sortOption: true,
35
+ cell: ({ row }) => row.original.leader?.nickname
36
+ },
37
+ ...getOprColumns()
38
+ ];
39
+ </script>
40
+
41
+ <template>
42
+ <TablePage
43
+ name="sys-department"
44
+ cn-name="部门信息"
45
+ :use-api-group="useDepartmentApi"
46
+ :biz-columns="columns"
47
+ fetch-all
48
+ :extra-order-query-options="[
49
+ { field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
50
+ ]"
51
+ treeify-col-name="parentId"
52
+ :extra-row-actions="[{
53
+ icon: 'i-lucide-clipboard-plus',
54
+ label: '\u4EE5\u6B64\u4F5C\u4E3A\u7236\u90E8\u95E8\u590D\u5236',
55
+ asyncFn: async (raw) => {
56
+ await createModal.open({ model: useDepartmentApi().copyAsParent?.(raw) ?? { id: 0 } });
57
+ }
58
+ }]"
59
+ @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
60
+ />
61
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;