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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/button/Theme.vue +2 -1
- package/dist/runtime/components/layout/Login.d.vue.ts +20 -0
- package/dist/runtime/components/layout/Login.vue +36 -0
- package/dist/runtime/components/layout/Login.vue.d.ts +20 -0
- package/dist/runtime/components/layout/button/Collapse.vue +15 -0
- package/dist/runtime/components/layout/{ModuleMenu.vue → button/ModuleMenu.vue} +1 -1
- package/dist/runtime/components/layout/button/ThemePicker.d.vue.ts +3 -0
- package/dist/runtime/components/layout/{ThemePicker.vue → button/ThemePicker.vue} +23 -6
- package/dist/runtime/components/layout/button/ThemePicker.vue.d.ts +3 -0
- package/dist/runtime/components/layout/{UserMenu.vue → button/UserMenu.vue} +5 -6
- package/dist/runtime/components/layout/default.d.vue.ts +2 -2
- package/dist/runtime/components/layout/default.vue +41 -34
- package/dist/runtime/components/layout/default.vue.d.ts +2 -2
- package/dist/runtime/components/sys/company/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/company/CreateModal.vue +23 -0
- package/dist/runtime/components/sys/company/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/company/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/company/Table.vue +53 -0
- package/dist/runtime/components/sys/company/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/department/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/department/CreateModal.vue +77 -0
- package/dist/runtime/components/sys/department/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/department/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/department/Table.vue +61 -0
- package/dist/runtime/components/sys/department/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/job-title/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/job-title/CreateModal.vue +26 -0
- package/dist/runtime/components/sys/job-title/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/job-title/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/job-title/Table.vue +67 -0
- package/dist/runtime/components/sys/job-title/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/menu/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/menu/CreateModal.vue +58 -0
- package/dist/runtime/components/sys/menu/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/menu/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/menu/Table.vue +96 -0
- package/dist/runtime/components/sys/menu/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/role/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/role/CreateModal.vue +86 -0
- package/dist/runtime/components/sys/role/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/role/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/role/Table.vue +68 -0
- package/dist/runtime/components/sys/role/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/user/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/user/CreateModal.vue +179 -0
- package/dist/runtime/components/sys/user/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/user/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/user/Table.vue +168 -0
- package/dist/runtime/components/sys/user/Table.vue.d.ts +3 -0
- package/dist/runtime/components/table/Page.vue +46 -48
- package/dist/runtime/components/table/Pagination.vue +1 -1
- package/dist/runtime/components/table/index.vue +1 -1
- package/dist/runtime/composables/useApp.d.ts +6 -0
- package/dist/runtime/composables/useApp.js +28 -1
- package/dist/runtime/composables/useTheme.d.ts +8 -0
- package/dist/runtime/composables/useTheme.js +34 -1
- package/dist/runtime/types/app.d.ts +4 -0
- package/package.json +1 -1
- /package/dist/runtime/components/layout/{ThemePicker.d.vue.ts → button/Collapse.d.vue.ts} +0 -0
- /package/dist/runtime/components/layout/{ThemePicker.vue.d.ts → button/Collapse.vue.d.ts} +0 -0
- /package/dist/runtime/components/layout/{ModuleMenu.d.vue.ts → button/ModuleMenu.d.vue.ts} +0 -0
- /package/dist/runtime/components/layout/{ModuleMenu.vue.d.ts → button/ModuleMenu.vue.d.ts} +0 -0
- /package/dist/runtime/components/layout/{UserMenu.d.vue.ts → button/UserMenu.d.vue.ts} +0 -0
- /package/dist/runtime/components/layout/{UserMenu.vue.d.ts → button/UserMenu.vue.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JobTitle } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: JobTitle;
|
|
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: JobTitle) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: JobTitle) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/CreateModalTemplateFormWithApi.vue";
|
|
4
|
+
import { useJobTitleApi } 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: 'name', type: 'input', label: '\u540D\u79F0', colSpan: '12', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') },
|
|
18
|
+
{ name: 'disabled', type: 'switch', colSpan: '12', label: '\u7981\u7528' },
|
|
19
|
+
{ name: 'description', type: 'textarea', label: '\u63CF\u8FF0', colSpan: '24', zodType: z.string().optional().nullable() },
|
|
20
|
+
{ name: 'remark', type: 'textarea', label: '\u5907\u6CE8', colSpan: '24', zodType: z.string().optional().nullable() }
|
|
21
|
+
]"
|
|
22
|
+
:model-value="model"
|
|
23
|
+
:default-model-value="{ disabled: false }"
|
|
24
|
+
:api-group="useJobTitleApi"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JobTitle } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: JobTitle;
|
|
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: JobTitle) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: JobTitle) => 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,67 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlay } from "@nuxt/ui/composables";
|
|
3
|
+
import { useJobTitleApi } from "#v/composables";
|
|
4
|
+
import SysJobTitlesCreateModal from "./CreateModal.vue";
|
|
5
|
+
import { getOprColumns, booleanOptions } from "#v/constants";
|
|
6
|
+
import UBadge from "@nuxt/ui/components/Badge.vue";
|
|
7
|
+
import { h } from "vue";
|
|
8
|
+
import TablePage from "#v/components/table/Page.vue";
|
|
9
|
+
const overlay = useOverlay();
|
|
10
|
+
const createModal = overlay.create(SysJobTitlesCreateModal);
|
|
11
|
+
const columns = [
|
|
12
|
+
{
|
|
13
|
+
accessorKey: "name",
|
|
14
|
+
header: "\u804C\u4F4D\u540D\u79F0",
|
|
15
|
+
sortOption: true,
|
|
16
|
+
filterOption: {
|
|
17
|
+
type: "input",
|
|
18
|
+
initHide: false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
accessorKey: "description",
|
|
23
|
+
header: "\u63CF\u8FF0",
|
|
24
|
+
sortOption: true,
|
|
25
|
+
filterOption: {
|
|
26
|
+
type: "input"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
accessorKey: "disabled",
|
|
31
|
+
header: "\u7981\u7528",
|
|
32
|
+
cell: ({ cell }) => h(
|
|
33
|
+
UBadge,
|
|
34
|
+
{
|
|
35
|
+
modelValue: cell.getValue(),
|
|
36
|
+
label: cell.getValue() ? "\u662F" : "\u5426",
|
|
37
|
+
variant: "soft",
|
|
38
|
+
color: cell.getValue() ? "error" : "neutral"
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
sortOption: true,
|
|
42
|
+
filterOption: {
|
|
43
|
+
type: "select",
|
|
44
|
+
items: booleanOptions
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
accessorKey: "remark",
|
|
49
|
+
header: "\u5907\u6CE8",
|
|
50
|
+
sortOption: true
|
|
51
|
+
},
|
|
52
|
+
...getOprColumns()
|
|
53
|
+
];
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<TablePage
|
|
58
|
+
name="sys-job-title"
|
|
59
|
+
cn-name="职位信息"
|
|
60
|
+
:use-api-group="useJobTitleApi"
|
|
61
|
+
:biz-columns="columns"
|
|
62
|
+
:extra-order-query-options="[
|
|
63
|
+
{ field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
|
|
64
|
+
]"
|
|
65
|
+
@edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
|
|
66
|
+
/>
|
|
67
|
+
</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 { Menu } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: Menu;
|
|
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: Menu) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: Menu) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
|
|
4
|
+
import { useMenuApi, useFormSubmission, useFormValues } from "#v/composables";
|
|
5
|
+
import { toRef } from "vue";
|
|
6
|
+
import { menuTypeOptions } from "#v/constants";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
model: { type: null, required: true }
|
|
9
|
+
});
|
|
10
|
+
const emit = defineEmits(["close", "save"]);
|
|
11
|
+
const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, disabled: false, isAdmin: false });
|
|
12
|
+
const { onSubmit } = useFormSubmission(
|
|
13
|
+
toRef(oldValues),
|
|
14
|
+
toRef(newValues),
|
|
15
|
+
(close) => emit("close", close),
|
|
16
|
+
(model) => emit("save", model),
|
|
17
|
+
useMenuApi,
|
|
18
|
+
["staticRouteKeys"]
|
|
19
|
+
);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<FormCreateModalTemplate
|
|
24
|
+
title="菜单信息"
|
|
25
|
+
:on-close="(ok) => emit('close', ok)"
|
|
26
|
+
:fields="[
|
|
27
|
+
{ name: 'name', type: 'input', label: '\u83DC\u5355\u540D\u79F0', colSpan: '12', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') },
|
|
28
|
+
{ name: 'type', type: 'radio-select', items: menuTypeOptions, orientation: 'horizontal', label: '\u83DC\u5355\u7C7B\u578B', colSpan: '12', zodType: z.string() },
|
|
29
|
+
{
|
|
30
|
+
name: 'parentId',
|
|
31
|
+
label: '\u4E0A\u7EA7\u83DC\u5355',
|
|
32
|
+
colSpan: '12',
|
|
33
|
+
type: 'async-tree-select',
|
|
34
|
+
labelField: 'name',
|
|
35
|
+
searchFields: ['name'],
|
|
36
|
+
listApi: useMenuApi().list,
|
|
37
|
+
fetchAll: true,
|
|
38
|
+
enableEmptyOption: true,
|
|
39
|
+
initModelValues: newValues.parent,
|
|
40
|
+
onUpdateInitModelValues: (newInitModelValues) => newValues.parent = newInitModelValues,
|
|
41
|
+
extraQuery: {
|
|
42
|
+
orderQuery: [
|
|
43
|
+
{ field: 'order', order: 'asc' }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
zodType: z.number().min(0)
|
|
47
|
+
},
|
|
48
|
+
{ name: 'order', type: 'input', label: '\u83DC\u5355\u6392\u5E8F', colSpan: '12', zodType: z.string() },
|
|
49
|
+
{ name: 'staticRouteKeys', type: 'dynamic-input', label: '\u83DC\u5355\u9759\u6001\u8DEF\u7531', colSpan: '24', zodType: z.array(z.string()), required: newValues.type !== 'button' },
|
|
50
|
+
{ name: 'permission', type: 'input', label: '\u83DC\u5355\u6743\u9650', colSpan: '24', zodType: z.string(), hidden: newValues.type !== 'button' },
|
|
51
|
+
{ name: 'disabled', type: 'button-switch', label: '\u662F\u5426\u7981\u7528', colSpan: '12', zodType: z.boolean() },
|
|
52
|
+
{ name: 'isAdmin', type: 'button-switch', label: '\u662F\u5426\u662F\u7CFB\u7EDF\u83DC\u5355', colSpan: '12', zodType: z.boolean() }
|
|
53
|
+
]"
|
|
54
|
+
:model-value="newValues"
|
|
55
|
+
@update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
|
|
56
|
+
@submit="onSubmit"
|
|
57
|
+
/>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Menu } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: Menu;
|
|
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: Menu) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: Menu) => 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,96 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlay } from "@nuxt/ui/composables";
|
|
3
|
+
import { useMenuApi } from "#v/composables";
|
|
4
|
+
import SysMenusCreateModal from "./CreateModal.vue";
|
|
5
|
+
import { getOprColumns } from "#v/constants";
|
|
6
|
+
import UBadge from "@nuxt/ui/components/Badge.vue";
|
|
7
|
+
import TablePage from "#v/components/table/Page.vue";
|
|
8
|
+
import { h } from "vue";
|
|
9
|
+
const overlay = useOverlay();
|
|
10
|
+
const createModal = overlay.create(SysMenusCreateModal);
|
|
11
|
+
const columns = [
|
|
12
|
+
{
|
|
13
|
+
accessorKey: "type",
|
|
14
|
+
header: "\u83DC\u5355\u7C7B\u578B",
|
|
15
|
+
cell: ({ row }) => {
|
|
16
|
+
switch (row.original.type) {
|
|
17
|
+
case "catalog":
|
|
18
|
+
return h(UBadge, {
|
|
19
|
+
icon: "i-lucide-folder",
|
|
20
|
+
variant: "subtle",
|
|
21
|
+
color: "neutral"
|
|
22
|
+
}, {
|
|
23
|
+
default: () => "\u76EE\u5F55"
|
|
24
|
+
});
|
|
25
|
+
case "menu":
|
|
26
|
+
return h(UBadge, {
|
|
27
|
+
icon: "i-lucide-menu",
|
|
28
|
+
variant: "subtle",
|
|
29
|
+
color: "primary"
|
|
30
|
+
}, {
|
|
31
|
+
default: () => "\u83DC\u5355"
|
|
32
|
+
});
|
|
33
|
+
case "button":
|
|
34
|
+
return h(UBadge, {
|
|
35
|
+
icon: "i-lucide-mouse-pointer-click",
|
|
36
|
+
variant: "subtle",
|
|
37
|
+
color: "warning"
|
|
38
|
+
}, {
|
|
39
|
+
default: () => "\u6309\u94AE"
|
|
40
|
+
});
|
|
41
|
+
default:
|
|
42
|
+
return row.original.type;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
accessorKey: "isAdmin",
|
|
48
|
+
header: "\u662F\u5426\u662F\u7CFB\u7EDF\u83DC\u5355",
|
|
49
|
+
sortOption: true,
|
|
50
|
+
filterOption: {
|
|
51
|
+
type: "select",
|
|
52
|
+
items: [
|
|
53
|
+
{ label: "\u662F", value: true, color: "primary" },
|
|
54
|
+
{ label: "\u5426", value: false, color: "neutral" }
|
|
55
|
+
],
|
|
56
|
+
initHide: false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{ accessorKey: "name", header: "\u83DC\u5355\u540D\u79F0", filterOption: { type: "input" }, sortOption: true },
|
|
60
|
+
{ accessorKey: "staticRouteKeys", header: "\u9759\u6001\u8DEF\u7531\u952E\u503C", filterOption: { type: "input" }, sortOption: true },
|
|
61
|
+
{
|
|
62
|
+
accessorKey: "disabled",
|
|
63
|
+
header: "\u662F\u5426\u7981\u7528",
|
|
64
|
+
filterOption: {
|
|
65
|
+
type: "select",
|
|
66
|
+
items: [
|
|
67
|
+
{ label: "\u662F", value: true, color: "error" },
|
|
68
|
+
{ label: "\u5426", value: false, color: "neutral" }
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{ accessorKey: "permission", header: "\u6743\u9650\u6807\u8BC6", filterOption: { type: "input" }, sortOption: true },
|
|
73
|
+
{ accessorKey: "order", header: "\u6392\u5E8F", filterOption: { type: "input" }, sortOption: true },
|
|
74
|
+
...getOprColumns(null)
|
|
75
|
+
];
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<TablePage
|
|
80
|
+
name="sys-menu"
|
|
81
|
+
cn-name="菜单信息"
|
|
82
|
+
:use-api-group="useMenuApi"
|
|
83
|
+
:biz-columns="columns"
|
|
84
|
+
fetch-all
|
|
85
|
+
:extra-order-query-options="[
|
|
86
|
+
{ field: 'order', label: '\u6392\u5E8F', defaultOpr: 'asc' }
|
|
87
|
+
]"
|
|
88
|
+
treeify-col-name="parentId"
|
|
89
|
+
:extra-row-actions="[{
|
|
90
|
+
icon: 'i-lucide-clipboard-plus',
|
|
91
|
+
label: '\u4EE5\u6B64\u4F5C\u4E3A\u7236\u83DC\u5355\u590D\u5236',
|
|
92
|
+
fnWithModal: async (raw) => await createModal.open({ model: useMenuApi().copyAsParent?.(raw) ?? { id: 0 } }).result
|
|
93
|
+
}]"
|
|
94
|
+
@edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
|
|
95
|
+
/>
|
|
96
|
+
</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 { Role } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: Role;
|
|
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: Role) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: Role) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
|
|
4
|
+
import { useFormSubmission, useFormValues, useMenuApi, useRoleApi } from "#v/composables";
|
|
5
|
+
import { computed, onMounted, ref, toRef } from "vue";
|
|
6
|
+
import { treeifyOptions } from "#v/utils";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
model: { type: null, required: true }
|
|
9
|
+
});
|
|
10
|
+
const emit = defineEmits(["close", "save"]);
|
|
11
|
+
const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, disabled: false, isAdmin: false });
|
|
12
|
+
const { onSubmit } = useFormSubmission(
|
|
13
|
+
toRef(oldValues),
|
|
14
|
+
toRef(newValues),
|
|
15
|
+
(close) => emit("close", close),
|
|
16
|
+
(model) => emit("save", model),
|
|
17
|
+
useRoleApi,
|
|
18
|
+
["menus"]
|
|
19
|
+
);
|
|
20
|
+
const menus = ref([]);
|
|
21
|
+
const onFetchMenus = async () => {
|
|
22
|
+
const { data } = await useMenuApi().list({
|
|
23
|
+
pagination: { pageNum: 0, pageSize: 0 },
|
|
24
|
+
orderQuery: [
|
|
25
|
+
{ field: "order", order: "asc" }
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
if (data.value.data) {
|
|
29
|
+
menus.value = data.value.data.list;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const sourceTreeItems = computed(() => treeifyOptions(
|
|
33
|
+
menus.value,
|
|
34
|
+
() => {
|
|
35
|
+
},
|
|
36
|
+
"name",
|
|
37
|
+
"id",
|
|
38
|
+
"parentId"
|
|
39
|
+
));
|
|
40
|
+
const targetTreeItems = computed({
|
|
41
|
+
get() {
|
|
42
|
+
const sortedMenus = (newValues.value.menus || []).sort((a, b) => a.order?.localeCompare(b.order || "") || 0);
|
|
43
|
+
return treeifyOptions(
|
|
44
|
+
sortedMenus,
|
|
45
|
+
() => {
|
|
46
|
+
},
|
|
47
|
+
"name",
|
|
48
|
+
"id",
|
|
49
|
+
"parentId"
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
set(newVal) {
|
|
53
|
+
const newMenuIds = newVal.map((item) => Number(item.value));
|
|
54
|
+
newValues.value.menus = menus.value.filter((menu) => newMenuIds.includes(menu.id));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
onMounted(async () => {
|
|
58
|
+
await onFetchMenus();
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<FormCreateModalTemplate
|
|
64
|
+
title="角色信息"
|
|
65
|
+
:on-close="(ok) => emit('close', ok)"
|
|
66
|
+
:fields="[
|
|
67
|
+
{ name: 'name', type: 'input', label: '\u89D2\u8272\u540D\u79F0', colSpan: '12', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') },
|
|
68
|
+
{ name: 'isAdmin', type: 'button-switch', label: '\u662F\u5426\u662F\u7CFB\u7EDF\u89D2\u8272', colSpan: '12', zodType: z.boolean() },
|
|
69
|
+
{
|
|
70
|
+
name: 'menus',
|
|
71
|
+
label: '\u83DC\u5355\u6743\u9650',
|
|
72
|
+
colSpan: '24',
|
|
73
|
+
zodType: z.array(z.object({ id: z.number() })),
|
|
74
|
+
type: 'tree-select-transfer',
|
|
75
|
+
sourceTreeItems,
|
|
76
|
+
targetTreeItems,
|
|
77
|
+
onUpdateTargetTreeItems: (newVal) => targetTreeItems = newVal
|
|
78
|
+
},
|
|
79
|
+
{ name: 'disabled', type: 'button-switch', label: '\u662F\u5426\u7981\u7528', colSpan: '12', zodType: z.boolean() },
|
|
80
|
+
{ name: 'remark', type: 'input', label: '\u5907\u6CE8', colSpan: '24', zodType: z.string().optional().nullable() }
|
|
81
|
+
]"
|
|
82
|
+
:model-value="newValues"
|
|
83
|
+
@update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
|
|
84
|
+
@submit="onSubmit"
|
|
85
|
+
/>
|
|
86
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Role } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: Role;
|
|
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: Role) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: Role) => 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,68 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlay } from "@nuxt/ui/composables";
|
|
3
|
+
import { useRoleApi } from "#v/composables";
|
|
4
|
+
import SysRolesCreateModal from "./CreateModal.vue";
|
|
5
|
+
import { getOprColumns } from "#v/constants";
|
|
6
|
+
import UBadge from "@nuxt/ui/components/Badge.vue";
|
|
7
|
+
import { h } from "vue";
|
|
8
|
+
const overlay = useOverlay();
|
|
9
|
+
const createModal = overlay.create(SysRolesCreateModal);
|
|
10
|
+
const columns = [
|
|
11
|
+
{
|
|
12
|
+
accessorKey: "name",
|
|
13
|
+
header: "\u89D2\u8272\u540D\u79F0",
|
|
14
|
+
sortOption: true,
|
|
15
|
+
filterOption: {
|
|
16
|
+
type: "input",
|
|
17
|
+
initHide: false
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
accessorKey: "isAdmin",
|
|
22
|
+
header: "\u662F\u5426\u662F\u7CFB\u7EDF\u89D2\u8272",
|
|
23
|
+
sortOption: true,
|
|
24
|
+
filterOption: {
|
|
25
|
+
type: "input",
|
|
26
|
+
initHide: false
|
|
27
|
+
},
|
|
28
|
+
cell: ({ row }) => h(
|
|
29
|
+
UBadge,
|
|
30
|
+
{
|
|
31
|
+
label: row.original.isAdmin ? "\u662F" : "\u5426",
|
|
32
|
+
variant: "soft",
|
|
33
|
+
color: row.original.isAdmin ? "primary" : "neutral"
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
accessorKey: "disabled",
|
|
39
|
+
header: "\u662F\u5426\u7981\u7528",
|
|
40
|
+
cell: ({ row }) => h(
|
|
41
|
+
UBadge,
|
|
42
|
+
{
|
|
43
|
+
variant: "soft",
|
|
44
|
+
color: row.original.disabled ? "error" : "neutral"
|
|
45
|
+
},
|
|
46
|
+
() => row.original.disabled ? "\u662F" : "\u5426"
|
|
47
|
+
)
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
accessorKey: "remark",
|
|
51
|
+
header: "\u5907\u6CE8",
|
|
52
|
+
filterOption: {
|
|
53
|
+
type: "input"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
...getOprColumns()
|
|
57
|
+
];
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<TablePage
|
|
62
|
+
name="sys-role"
|
|
63
|
+
cn-name="角色信息"
|
|
64
|
+
:use-api-group="useRoleApi"
|
|
65
|
+
:biz-columns="columns"
|
|
66
|
+
@edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
|
|
67
|
+
/>
|
|
68
|
+
</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 { User } from 'v-nuxt-ui/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: User;
|
|
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: User) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onClose?: ((args_0: boolean) => any) | undefined;
|
|
10
|
+
onSave?: ((args_0: User) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|