v-nuxt-ui 0.2.4 → 0.2.5
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/AsyncSelect.d.vue.ts +25 -0
- package/dist/runtime/components/AsyncSelect.vue +178 -0
- package/dist/runtime/components/AsyncSelect.vue.d.ts +25 -0
- package/dist/runtime/components/AsyncTreeSelect.d.vue.ts +23 -0
- package/dist/runtime/components/AsyncTreeSelect.vue +151 -0
- package/dist/runtime/components/AsyncTreeSelect.vue.d.ts +23 -0
- package/dist/runtime/components/Empty.d.vue.ts +1 -1
- package/dist/runtime/components/Empty.vue.d.ts +1 -1
- package/dist/runtime/components/date-picker/Input.d.vue.ts +2 -2
- package/dist/runtime/components/date-picker/Input.vue.d.ts +2 -2
- package/dist/runtime/components/flow/FlowEdge.client.vue +6 -4
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +14 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue +43 -7
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +14 -0
- package/dist/runtime/components/flow/FlowNode.client.vue +32 -25
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +3 -0
- package/dist/runtime/components/flow/FlowToolbar.vue +16 -1
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +3 -0
- package/dist/runtime/components/form/field/AsyncObjectSelect.d.vue.ts +4 -2
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue +16 -13
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue.d.ts +4 -2
- package/dist/runtime/components/form/field/AsyncSelect.d.vue.ts +8 -12
- package/dist/runtime/components/form/field/AsyncSelect.vue +31 -146
- package/dist/runtime/components/form/field/AsyncSelect.vue.d.ts +8 -12
- package/dist/runtime/components/form/field/AsyncTreeSelect.d.vue.ts +3 -5
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue +31 -112
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue.d.ts +3 -5
- package/dist/runtime/components/form/field/index.vue +3 -41
- package/dist/runtime/components/sys/department/CreateModal.vue +9 -9
- package/dist/runtime/components/sys/menu/CreateModal.vue +3 -3
- package/dist/runtime/components/sys/user/CreateModal.vue +9 -7
- package/dist/runtime/components/sys/user/Table.vue +3 -3
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.d.vue.ts +2 -6
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +28 -122
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue.d.ts +2 -6
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +2 -2
- package/dist/runtime/components/table/settings/UserTableColumnModal.d.vue.ts +2 -2
- package/dist/runtime/components/table/settings/UserTableColumnModal.vue.d.ts +2 -2
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +2 -0
- package/dist/runtime/composables/flow/useFlowStyles.js +3 -0
- package/dist/runtime/constants/columns.js +2 -2
- package/dist/runtime/constants/flow.d.ts +4 -0
- package/dist/runtime/constants/flow.js +1 -0
- package/dist/runtime/types/components/async-select.d.ts +30 -0
- package/dist/runtime/types/components/async-select.js +0 -0
- package/dist/runtime/types/components/form/field.d.ts +8 -25
- package/dist/runtime/types/components/index.d.ts +1 -0
- package/dist/runtime/types/components/index.js +1 -0
- package/dist/runtime/types/components/table/column.d.ts +3 -27
- package/package.json +18 -18
|
@@ -1,169 +1,54 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { useFetching } from "#v/composables";
|
|
5
|
-
import { isEmptyString } from "#v/utils";
|
|
6
|
-
import { useOverlay } from "@nuxt/ui/runtime/composables/useOverlay.js";
|
|
7
|
-
import { useDebounceFn } from "@vueuse/core";
|
|
8
|
-
import { useApp } from "#v/composables/useApp";
|
|
2
|
+
import VAsyncSelect from "#v/components/AsyncSelect.vue";
|
|
3
|
+
import { computed } from "vue";
|
|
9
4
|
const props = defineProps({
|
|
5
|
+
initModel: { type: null, required: false },
|
|
6
|
+
onUpdateInitModel: { type: Function, required: false },
|
|
7
|
+
label: { type: String, required: false },
|
|
8
|
+
floatingPlaceholder: { type: Boolean, required: false },
|
|
9
|
+
disabled: { type: Boolean, required: false },
|
|
10
|
+
placeholder: { type: String, required: false },
|
|
11
|
+
size: { type: null, required: false },
|
|
12
|
+
icon: { type: null, required: false },
|
|
10
13
|
listApi: { type: Function, required: true },
|
|
14
|
+
searchFields: { type: Function, required: false },
|
|
15
|
+
likeSearchFields: { type: Array, required: false },
|
|
11
16
|
extraQuery: { type: Object, required: false, default: () => ({
|
|
12
17
|
pagination: { pageNum: 1, pageSize: 10 },
|
|
13
18
|
orderQuery: [
|
|
14
19
|
{ field: "createdAt", order: "desc" }
|
|
15
20
|
]
|
|
16
21
|
}) },
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
extraSearchFieldFn: { type: Function, required: false },
|
|
21
|
-
labelField: { type: null, required: false, default: "name" },
|
|
22
|
-
valueField: { type: null, required: true, default: "id" },
|
|
22
|
+
fetchAll: { type: Boolean, required: false },
|
|
23
|
+
labelField: { type: null, required: true },
|
|
24
|
+
valueField: { type: null, required: true },
|
|
23
25
|
labelRenderFn: { type: Function, required: false },
|
|
24
26
|
enableEmptyOption: { type: Boolean, required: false },
|
|
25
|
-
disableOprSelector: { type: Boolean, required: false },
|
|
26
27
|
multiple: { type: Boolean, required: false },
|
|
27
|
-
|
|
28
|
-
size: { type: null, required: false },
|
|
28
|
+
afterSelect: { type: Function, required: false },
|
|
29
29
|
canCreate: { type: Boolean, required: false },
|
|
30
|
-
createModalComponent: { type:
|
|
31
|
-
createModalOpenProps: { type: Object, required: false }
|
|
32
|
-
icon: { type: String, required: false },
|
|
33
|
-
disabled: { type: Boolean, required: false }
|
|
30
|
+
createModalComponent: { type: null, required: false },
|
|
31
|
+
createModalOpenProps: { type: Object, required: false }
|
|
34
32
|
});
|
|
35
33
|
const modelValue = defineModel("modelValue", { type: null, ...{ required: true } });
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const newSearchedData = [];
|
|
42
|
-
if (props.enableEmptyOption) {
|
|
43
|
-
newSearchedData.push({
|
|
44
|
-
[props.valueField]: 0,
|
|
45
|
-
[props.labelField]: "\u65E0"
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
newSearchedData.push(...currentSelectedData.value);
|
|
49
|
-
searchedData.value.forEach((searchedItem) => {
|
|
50
|
-
const idx = newSearchedData.findIndex((item) => item[props.valueField] === searchedItem[props.valueField]);
|
|
51
|
-
if (idx === -1) {
|
|
52
|
-
newSearchedData.push(searchedItem);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return newSearchedData;
|
|
56
|
-
});
|
|
57
|
-
const items = computed(
|
|
58
|
-
() => fetching.value ? currentSelectedData.value.map((p) => ({
|
|
59
|
-
label: String(props.labelRenderFn ? props.labelRenderFn(p) : p[props.labelField] ?? ""),
|
|
60
|
-
value: p[props.valueField]
|
|
61
|
-
})).filter((p) => p.label && !isEmptyString(String(p.value))) : allData.value.map((p) => ({
|
|
62
|
-
label: String(props.labelRenderFn ? props.labelRenderFn(p) : p[props.labelField] ?? ""),
|
|
63
|
-
value: p[props.valueField]
|
|
64
|
-
})).filter((p) => p.label && !isEmptyString(String(p.value)))
|
|
65
|
-
);
|
|
66
|
-
const onSelect = (newVal) => {
|
|
67
|
-
modelValue.value = newVal;
|
|
68
|
-
if (Array.isArray(newVal)) {
|
|
69
|
-
const newInitModelValues = [];
|
|
70
|
-
newVal.forEach((val) => {
|
|
71
|
-
const foundItem = allData.value.find((p) => p[props.valueField] === val);
|
|
72
|
-
if (foundItem) {
|
|
73
|
-
newInitModelValues.push(foundItem);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
props.onUpdateInitModelValues?.(newInitModelValues);
|
|
77
|
-
} else {
|
|
78
|
-
const newInitModelValues = allData.value.find((p) => p[props.valueField] === newVal);
|
|
79
|
-
props.onUpdateInitModelValues?.(newInitModelValues);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const { fetching, startFetching, endFetching } = useFetching();
|
|
83
|
-
const onFetchItems = async () => {
|
|
84
|
-
try {
|
|
85
|
-
startFetching();
|
|
86
|
-
const query = {
|
|
87
|
-
pagination: { pageNum: 1, pageSize: 10 },
|
|
88
|
-
whereQuery: { items: [] }
|
|
34
|
+
const asyncSelectModelValue = computed({
|
|
35
|
+
get() {
|
|
36
|
+
return {
|
|
37
|
+
values: modelValue.value,
|
|
38
|
+
extraModels: props.initModel
|
|
89
39
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
if (props.extraSearchFieldFn !== void 0) {
|
|
96
|
-
query.whereQuery?.items?.push(props.extraSearchFieldFn(searchTerm.value));
|
|
97
|
-
}
|
|
98
|
-
const result = await props.listApi(defu(query, props.extraQuery));
|
|
99
|
-
if (result.data) {
|
|
100
|
-
searchedData.value = result.data.value.data?.list ?? [];
|
|
101
|
-
}
|
|
102
|
-
} finally {
|
|
103
|
-
endFetching();
|
|
40
|
+
},
|
|
41
|
+
set(newModelValue) {
|
|
42
|
+
modelValue.value = newModelValue.values;
|
|
43
|
+
props.onUpdateInitModel?.(newModelValue.extraModels);
|
|
104
44
|
}
|
|
105
|
-
};
|
|
106
|
-
const onDebounceFetchItems = useDebounceFn(onFetchItems, 512);
|
|
107
|
-
const onCreateNew = async () => {
|
|
108
|
-
if (!props.createModalComponent) return;
|
|
109
|
-
open.value = false;
|
|
110
|
-
const modal = useOverlay().create(props.createModalComponent);
|
|
111
|
-
modal.open({
|
|
112
|
-
model: { id: 0 },
|
|
113
|
-
...props.createModalOpenProps,
|
|
114
|
-
onSave: (newModel) => {
|
|
115
|
-
searchedData.value.push(newModel);
|
|
116
|
-
const newValue = newModel[props.valueField];
|
|
117
|
-
if (props.multiple) {
|
|
118
|
-
const currentValues = Array.isArray(modelValue.value) ? [...modelValue.value] : [];
|
|
119
|
-
currentValues.push(newValue);
|
|
120
|
-
onSelect(currentValues);
|
|
121
|
-
} else {
|
|
122
|
-
onSelect(newValue);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
};
|
|
45
|
+
});
|
|
127
46
|
</script>
|
|
128
47
|
|
|
129
48
|
<template>
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
:search-term="searchTerm"
|
|
134
|
-
:items="items"
|
|
135
|
-
:create-item="canCreate && createModalComponent && {
|
|
136
|
-
position: 'top',
|
|
137
|
-
when: 'always'
|
|
138
|
-
}"
|
|
139
|
-
value-key="value"
|
|
140
|
-
ignore-filter
|
|
141
|
-
:multiple="multiple"
|
|
142
|
-
:icon="icon ? icon : multiple ? 'i-lucide-list-todo' : 'i-lucide-list'"
|
|
143
|
-
:loading="fetching"
|
|
144
|
-
:placeholder="placeholder"
|
|
49
|
+
<VAsyncSelect
|
|
50
|
+
v-bind="props"
|
|
51
|
+
v-model="asyncSelectModelValue"
|
|
145
52
|
class="w-full"
|
|
146
|
-
:search-input="{
|
|
147
|
-
icon: 'i-lucide-search',
|
|
148
|
-
loading: fetching
|
|
149
|
-
}"
|
|
150
|
-
:disabled="disabled"
|
|
151
|
-
:reset-search-term-on-select="false"
|
|
152
|
-
:ui="{ content: !useApp().isMobile.value && 'min-w-fit' }"
|
|
153
|
-
@update:open="(newOpen) => {
|
|
154
|
-
open = newOpen;
|
|
155
|
-
if (newOpen) {
|
|
156
|
-
onFetchItems();
|
|
157
|
-
} else {
|
|
158
|
-
searchTerm = '';
|
|
159
|
-
}
|
|
160
|
-
}"
|
|
161
|
-
@update:search-term="(newValue) => {
|
|
162
|
-
if (!open) return;
|
|
163
|
-
searchTerm = newValue;
|
|
164
|
-
onDebounceFetchItems();
|
|
165
|
-
}"
|
|
166
|
-
@update:model-value="onSelect"
|
|
167
|
-
@create="onCreateNew"
|
|
168
53
|
/>
|
|
169
54
|
</template>
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { VFormFieldAsyncSelectProps } from '#v/types';
|
|
1
|
+
import type { AsyncSelectValue } from '#v/types';
|
|
3
2
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
createModalOpenProps?: Record<string, any>;
|
|
10
|
-
} & {
|
|
11
|
-
modelValue: string[] | number[] | number | string | null | undefined;
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
4
|
+
initModel?: any | any[];
|
|
5
|
+
onUpdateInitModel?(model: any | any[] | undefined): void;
|
|
6
|
+
} & import("#v/types").VAsyncSelectProps<T> & {
|
|
7
|
+
modelValue: AsyncSelectValue;
|
|
12
8
|
}) & {
|
|
13
|
-
"onUpdate:modelValue"?: ((value:
|
|
9
|
+
"onUpdate:modelValue"?: ((value: AsyncSelectValue) => any) | undefined;
|
|
14
10
|
}> & (typeof globalThis extends {
|
|
15
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
16
12
|
} ? P : {});
|
|
17
13
|
expose: (exposed: {}) => void;
|
|
18
14
|
attrs: any;
|
|
19
15
|
slots: {};
|
|
20
|
-
emit: (event: "update:modelValue", value:
|
|
16
|
+
emit: (event: "update:modelValue", value: AsyncSelectValue) => void;
|
|
21
17
|
}>) => import("vue").VNode & {
|
|
22
18
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
23
19
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
2
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
} & {
|
|
3
|
+
initModel?: any | any[];
|
|
4
|
+
onUpdateInitModel?(model: any | any[] | undefined): void;
|
|
5
|
+
} & import("#v/types").VAsyncSelectProps<T> & {
|
|
8
6
|
modelValue: number | undefined;
|
|
9
7
|
}) & {
|
|
10
8
|
"onUpdate:modelValue"?: ((value: number | undefined) => any) | undefined;
|
|
@@ -1,133 +1,52 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { flattenTree, treeifyOptions, isEmptyString } from "#v/utils";
|
|
5
|
-
import { defu } from "defu";
|
|
2
|
+
import VAsyncTreeSelect from "#v/components/AsyncTreeSelect.vue";
|
|
3
|
+
import { computed } from "vue";
|
|
6
4
|
const props = defineProps({
|
|
7
|
-
|
|
5
|
+
initModel: { type: null, required: false },
|
|
6
|
+
onUpdateInitModel: { type: Function, required: false },
|
|
7
|
+
label: { type: String, required: false },
|
|
8
|
+
floatingPlaceholder: { type: Boolean, required: false },
|
|
9
|
+
disabled: { type: Boolean, required: false },
|
|
10
|
+
placeholder: { type: String, required: false },
|
|
11
|
+
size: { type: null, required: false },
|
|
12
|
+
icon: { type: null, required: false },
|
|
8
13
|
listApi: { type: Function, required: true },
|
|
14
|
+
searchFields: { type: Function, required: false },
|
|
15
|
+
likeSearchFields: { type: Array, required: false },
|
|
9
16
|
extraQuery: { type: Object, required: false, default: () => ({
|
|
10
17
|
orderQuery: [
|
|
11
18
|
{ field: "createdAt", order: "desc" }
|
|
12
19
|
]
|
|
13
20
|
}) },
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
extraSearchFieldFn: { type: Function, required: false },
|
|
18
|
-
labelField: { type: null, required: false, default: "name" },
|
|
19
|
-
valueField: { type: null, required: true, default: "id" },
|
|
21
|
+
fetchAll: { type: Boolean, required: false },
|
|
22
|
+
labelField: { type: null, required: true },
|
|
23
|
+
valueField: { type: null, required: true },
|
|
20
24
|
labelRenderFn: { type: Function, required: false },
|
|
21
25
|
enableEmptyOption: { type: Boolean, required: false },
|
|
22
|
-
disableOprSelector: { type: Boolean, required: false },
|
|
23
26
|
multiple: { type: Boolean, required: false },
|
|
24
|
-
|
|
25
|
-
size: { type: null, required: false },
|
|
27
|
+
afterSelect: { type: Function, required: false },
|
|
26
28
|
canCreate: { type: Boolean, required: false },
|
|
27
29
|
createModalComponent: { type: null, required: false },
|
|
28
|
-
createModalOpenProps: { type: Object, required: false }
|
|
29
|
-
icon: { type: String, required: false },
|
|
30
|
-
disabled: { type: Boolean, required: false }
|
|
30
|
+
createModalOpenProps: { type: Object, required: false }
|
|
31
31
|
});
|
|
32
32
|
const modelValue = defineModel("modelValue", { type: null, ...{ required: true } });
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const newSearchedData = [...searchedData.value];
|
|
39
|
-
const flattenInitModelValues = [props.initModelValues ?? []].flat();
|
|
40
|
-
flattenInitModelValues.forEach((initModelValue) => {
|
|
41
|
-
const idx = newSearchedData.findIndex((item) => item[props.valueField] === initModelValue[props.valueField]);
|
|
42
|
-
if (idx === -1) {
|
|
43
|
-
newSearchedData.unshift(initModelValue);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return newSearchedData;
|
|
47
|
-
});
|
|
48
|
-
const onSelect = (newVal) => {
|
|
49
|
-
modelValue.value = newVal;
|
|
50
|
-
const newInitModelValues = allData.value.find((p) => p[props.valueField] === newVal);
|
|
51
|
-
props.onUpdateInitModelValues?.(newInitModelValues);
|
|
52
|
-
open.value = false;
|
|
53
|
-
};
|
|
54
|
-
const items = computed(() => {
|
|
55
|
-
const options = treeifyOptions(
|
|
56
|
-
allData.value,
|
|
57
|
-
onSelect,
|
|
58
|
-
props.labelField,
|
|
59
|
-
props.valueField,
|
|
60
|
-
"parentId"
|
|
61
|
-
);
|
|
62
|
-
options.unshift({
|
|
63
|
-
label: "\u65E0",
|
|
64
|
-
value: 0,
|
|
65
|
-
onSelect: () => onSelect(0)
|
|
66
|
-
});
|
|
67
|
-
return options;
|
|
68
|
-
});
|
|
69
|
-
const expandedItemValues = computed(() => flattenTree(items.value).filter((item) => item !== void 0).map((item) => item.value ?? ""));
|
|
70
|
-
const { fetching, startFetching, endFetching } = useFetching();
|
|
71
|
-
const onFetchItems = async () => {
|
|
72
|
-
try {
|
|
73
|
-
startFetching();
|
|
74
|
-
const query = {
|
|
75
|
-
pagination: { pageNum: 1, pageSize: props.fetchAll ? 0 : 10 },
|
|
76
|
-
whereQuery: { items: [] }
|
|
33
|
+
const asyncTreeSelectModelValue = computed({
|
|
34
|
+
get() {
|
|
35
|
+
return {
|
|
36
|
+
values: modelValue.value,
|
|
37
|
+
extraModels: props.initModel
|
|
77
38
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
const result = await props.listApi(defu(query, props.extraQuery));
|
|
84
|
-
if (result.data) {
|
|
85
|
-
searchedData.value = result.data.value.data?.list ?? [];
|
|
86
|
-
}
|
|
87
|
-
} finally {
|
|
88
|
-
endFetching();
|
|
39
|
+
},
|
|
40
|
+
set(newModelValue) {
|
|
41
|
+
modelValue.value = newModelValue.values;
|
|
42
|
+
props.onUpdateInitModel?.(newModelValue.extraModels);
|
|
89
43
|
}
|
|
90
|
-
};
|
|
44
|
+
});
|
|
91
45
|
</script>
|
|
92
46
|
|
|
93
47
|
<template>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}"
|
|
99
|
-
@update:open="(newOpen) => {
|
|
100
|
-
open = newOpen;
|
|
101
|
-
if (newOpen) {
|
|
102
|
-
onFetchItems();
|
|
103
|
-
}
|
|
104
|
-
}"
|
|
105
|
-
>
|
|
106
|
-
<UButton
|
|
107
|
-
:label="modelValue === 0 ? '\u65E0' : allData.find((item) => item[valueField] === modelValue)?.[labelField] ?? ' '"
|
|
108
|
-
color="neutral"
|
|
109
|
-
variant="outline"
|
|
110
|
-
block
|
|
111
|
-
icon="i-lucide-folder-tree"
|
|
112
|
-
:loading="fetching"
|
|
113
|
-
trailing-icon="i-lucide-chevron-down"
|
|
114
|
-
:disabled="disabled"
|
|
115
|
-
:ui="{
|
|
116
|
-
leadingIcon: 'text-dimmed',
|
|
117
|
-
trailingIcon: 'text-dimmed'
|
|
118
|
-
}"
|
|
119
|
-
/>
|
|
120
|
-
|
|
121
|
-
<template #content>
|
|
122
|
-
<UTree
|
|
123
|
-
:model-value="treeModelValue"
|
|
124
|
-
:items="items"
|
|
125
|
-
:disabled="fetching"
|
|
126
|
-
:expanded="expandedItemValues"
|
|
127
|
-
:get-key="(i) => i.value"
|
|
128
|
-
multiple
|
|
129
|
-
class="p-1 max-h-80 overflow-auto"
|
|
130
|
-
/>
|
|
131
|
-
</template>
|
|
132
|
-
</UPopover>
|
|
48
|
+
<VAsyncTreeSelect
|
|
49
|
+
v-bind="props"
|
|
50
|
+
v-model="asyncTreeSelectModelValue"
|
|
51
|
+
/>
|
|
133
52
|
</template>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
2
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
} & {
|
|
3
|
+
initModel?: any | any[];
|
|
4
|
+
onUpdateInitModel?(model: any | any[] | undefined): void;
|
|
5
|
+
} & import("#v/types").VAsyncSelectProps<T> & {
|
|
8
6
|
modelValue: number | undefined;
|
|
9
7
|
}) & {
|
|
10
8
|
"onUpdate:modelValue"?: ((value: number | undefined) => any) | undefined;
|
|
@@ -134,55 +134,17 @@ const fieldModelValue = computed({
|
|
|
134
134
|
<FormFieldAsyncSelect
|
|
135
135
|
v-else-if="field.type === 'async-select'"
|
|
136
136
|
v-model="fieldModelValue"
|
|
137
|
-
|
|
138
|
-
:list-api="field.listApi"
|
|
139
|
-
:extra-query="field.extraQuery"
|
|
140
|
-
:init-model-values="field.initModelValues"
|
|
141
|
-
:search-fields="field.searchFields"
|
|
142
|
-
:label-field="field.labelField"
|
|
143
|
-
:label-render-fn="field.labelRenderFn"
|
|
144
|
-
:value-field="field.valueField"
|
|
145
|
-
:multiple="field.multiple"
|
|
146
|
-
:placeholder="field.placeholder"
|
|
147
|
-
:disabled="field.disabled"
|
|
148
|
-
:enable-empty-option="field.enableEmptyOption"
|
|
149
|
-
:extra-search-field-fn="field.extraSearchFieldFn"
|
|
150
|
-
:can-create="field.canCreate"
|
|
151
|
-
:create-modal-component="field.createModalComponent"
|
|
152
|
-
:create-modal-open-props="field.createModalOpenProps"
|
|
153
|
-
@update-init-model-values="field.onUpdateInitModelValues"
|
|
137
|
+
v-bind="field"
|
|
154
138
|
/>
|
|
155
139
|
<FormFieldAsyncObjectSelect
|
|
156
140
|
v-else-if="field.type === 'async-object-select'"
|
|
157
141
|
v-model="fieldModelValue"
|
|
158
|
-
|
|
159
|
-
:list-api="field.listApi"
|
|
160
|
-
:extra-query="field.extraQuery"
|
|
161
|
-
:init-model-values="field.initModelValues"
|
|
162
|
-
:search-fields="field.searchFields"
|
|
163
|
-
:label-field="field.labelField"
|
|
164
|
-
:label-render-fn="field.labelRenderFn"
|
|
165
|
-
:value-field="field.valueField"
|
|
166
|
-
:multiple="field.multiple"
|
|
167
|
-
:placeholder="field.placeholder"
|
|
168
|
-
:disabled="field.disabled"
|
|
169
|
-
@update-init-model-values="field.onUpdateInitModelValues"
|
|
142
|
+
v-bind="field"
|
|
170
143
|
/>
|
|
171
144
|
<FormFieldAsyncTreeSelect
|
|
172
145
|
v-else-if="field.type === 'async-tree-select'"
|
|
173
146
|
v-model="fieldModelValue"
|
|
174
|
-
|
|
175
|
-
:list-api="field.listApi"
|
|
176
|
-
:extra-query="field.extraQuery"
|
|
177
|
-
:init-model-values="field.initModelValues"
|
|
178
|
-
:search-fields="field.searchFields"
|
|
179
|
-
:label-field="field.labelField"
|
|
180
|
-
:value-field="field.valueField"
|
|
181
|
-
:multiple="field.multiple"
|
|
182
|
-
:placeholder="field.placeholder"
|
|
183
|
-
:fetch-all="field.fetchAll"
|
|
184
|
-
:disabled="field.disabled"
|
|
185
|
-
@update-init-model-values="field.onUpdateInitModelValues"
|
|
147
|
+
v-bind="field"
|
|
186
148
|
/>
|
|
187
149
|
<FormFieldTreeSelectTransfer
|
|
188
150
|
v-else-if="field.type === 'tree-select-transfer'"
|
|
@@ -39,11 +39,11 @@ const { onSubmit } = useFormSubmission(
|
|
|
39
39
|
type: 'async-tree-select',
|
|
40
40
|
labelField: 'name',
|
|
41
41
|
valueField: 'id',
|
|
42
|
-
|
|
42
|
+
likeSearchFields: ['name'],
|
|
43
43
|
listApi: useDepartmentApi().list,
|
|
44
44
|
fetchAll: true,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
initModel: newValues.parent,
|
|
46
|
+
onUpdateInitModel: (newInitModelValues) => newValues.parent = newInitModelValues,
|
|
47
47
|
zodType: z.number().min(0)
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -53,10 +53,10 @@ const { onSubmit } = useFormSubmission(
|
|
|
53
53
|
type: 'async-select',
|
|
54
54
|
labelField: 'nickname',
|
|
55
55
|
valueField: 'id',
|
|
56
|
-
|
|
56
|
+
likeSearchFields: ['nickname'],
|
|
57
57
|
listApi: useCompanyApi().list,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
initModel: newValues.company,
|
|
59
|
+
onUpdateInitModel: (newInitModelValues) => newValues.company = newInitModelValues,
|
|
60
60
|
zodType: z.number().min(0)
|
|
61
61
|
},
|
|
62
62
|
{
|
|
@@ -66,10 +66,10 @@ const { onSubmit } = useFormSubmission(
|
|
|
66
66
|
type: 'async-select',
|
|
67
67
|
labelField: 'nickname',
|
|
68
68
|
valueField: 'id',
|
|
69
|
-
|
|
69
|
+
likeSearchFields: ['nickname'],
|
|
70
70
|
listApi: useUserApi().list,
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
initModel: newValues.leader,
|
|
72
|
+
onUpdateInitModel: (newInitModelValues) => newValues.leader = newInitModelValues,
|
|
73
73
|
zodType: z.number().min(0)
|
|
74
74
|
}
|
|
75
75
|
]"
|
|
@@ -33,12 +33,12 @@ const { onSubmit } = useFormSubmission(
|
|
|
33
33
|
type: 'async-tree-select',
|
|
34
34
|
labelField: 'name',
|
|
35
35
|
valueField: 'id',
|
|
36
|
-
|
|
36
|
+
likeSearchFields: ['name'],
|
|
37
37
|
listApi: useMenuApi().list,
|
|
38
38
|
fetchAll: true,
|
|
39
39
|
enableEmptyOption: true,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
initModel: newValues.parent,
|
|
41
|
+
onUpdateInitModel: (newInitModelValues) => newValues.parent = newInitModelValues,
|
|
42
42
|
extraQuery: {
|
|
43
43
|
orderQuery: [
|
|
44
44
|
{ field: 'order', order: 'asc' }
|
|
@@ -134,11 +134,11 @@ const fields = computed(() => [
|
|
|
134
134
|
type: "async-tree-select",
|
|
135
135
|
labelField: "name",
|
|
136
136
|
valueField: "id",
|
|
137
|
-
|
|
137
|
+
likeSearchFields: ["name"],
|
|
138
138
|
listApi: useDepartmentApi().list,
|
|
139
139
|
fetchAll: true,
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
initModel: newValues.value.department,
|
|
141
|
+
onUpdateInitModel: updateDepartment,
|
|
142
142
|
zodType: z.number().min(0)
|
|
143
143
|
},
|
|
144
144
|
{
|
|
@@ -148,10 +148,10 @@ const fields = computed(() => [
|
|
|
148
148
|
type: "async-select",
|
|
149
149
|
labelField: "nickname",
|
|
150
150
|
valueField: "id",
|
|
151
|
-
|
|
151
|
+
likeSearchFields: ["nickname"],
|
|
152
152
|
listApi: useUserApi().list,
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
initModel: newValues.value.supervisor,
|
|
154
|
+
onUpdateInitModel: updateSupervisor,
|
|
155
155
|
enableEmptyOption: true,
|
|
156
156
|
zodType: z.number().min(0).optional()
|
|
157
157
|
},
|
|
@@ -201,7 +201,9 @@ onMounted(async () => {
|
|
|
201
201
|
>
|
|
202
202
|
<template #after-form>
|
|
203
203
|
<div class="border-t pt-4 mt-4">
|
|
204
|
-
<div class="font-semibold mb-2">
|
|
204
|
+
<div class="font-semibold mb-2">
|
|
205
|
+
Table 权限
|
|
206
|
+
</div>
|
|
205
207
|
<TablePermissionTab v-model="tablePermissions" />
|
|
206
208
|
</div>
|
|
207
209
|
</template>
|
|
@@ -41,7 +41,7 @@ const columns = [
|
|
|
41
41
|
filterOption: {
|
|
42
42
|
type: "async-select",
|
|
43
43
|
listApi: useDepartmentApi().list,
|
|
44
|
-
|
|
44
|
+
likeSearchFields: ["name"],
|
|
45
45
|
labelField: "name",
|
|
46
46
|
valueField: "id",
|
|
47
47
|
multiple: true,
|
|
@@ -56,7 +56,7 @@ const columns = [
|
|
|
56
56
|
filterOption: {
|
|
57
57
|
type: "async-select",
|
|
58
58
|
listApi: useUserApi().list,
|
|
59
|
-
|
|
59
|
+
likeSearchFields: ["name"],
|
|
60
60
|
labelField: "name",
|
|
61
61
|
valueField: "id",
|
|
62
62
|
multiple: true,
|
|
@@ -70,7 +70,7 @@ const columns = [
|
|
|
70
70
|
filterOption: {
|
|
71
71
|
type: "async-select",
|
|
72
72
|
listApi: useRoleApi().list,
|
|
73
|
-
|
|
73
|
+
likeSearchFields: ["name"],
|
|
74
74
|
labelField: "name",
|
|
75
75
|
valueField: "id",
|
|
76
76
|
multiple: true,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WhereQueryItem, VAsyncSelectProps } from '#v/types';
|
|
2
2
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
4
|
-
label: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
triggerFetching?: () => Promise<void>;
|
|
7
|
-
} & VFormFieldAsyncSelectProps<T> & {
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(VAsyncSelectProps<T> & {
|
|
8
4
|
whereQueryItem: WhereQueryItem<T>;
|
|
9
5
|
}) & {
|
|
10
6
|
"onUpdate:whereQueryItem"?: ((value: WhereQueryItem<T>) => any) | undefined;
|