|
@@ -1,5 +1,4 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import type { Recordable } from '@vben/types';
|
|
|
|
|
import type { SelectValue } from 'ant-design-vue/es/select';
|
|
import type { SelectValue } from 'ant-design-vue/es/select';
|
|
|
|
|
|
|
|
import type { ApiConfig } from '../types';
|
|
import type { ApiConfig } from '../types';
|
|
@@ -53,7 +52,7 @@ const modelValue = useVModel(props, 'value', emit, {
|
|
|
defaultValue: props.value,
|
|
defaultValue: props.value,
|
|
|
passive: true,
|
|
passive: true,
|
|
|
});
|
|
});
|
|
|
-const treeData = ref<Recordable<any>[]>([]);
|
|
|
|
|
|
|
+const treeData = ref<Record<string, any>[]>([]);
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
const isFirstLoad = ref(true);
|
|
const isFirstLoad = ref(true);
|
|
|
const getTreeData = computed(() => {
|
|
const getTreeData = computed(() => {
|
|
@@ -71,7 +70,7 @@ const fetch = async () => {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
const res = await api(props.api.params);
|
|
const res = await api(props.api.params);
|
|
|
if (Array.isArray(res)) {
|
|
if (Array.isArray(res)) {
|
|
|
- treeData.value = (res as Recordable<any>[]) || [];
|
|
|
|
|
|
|
+ treeData.value = res || [];
|
|
|
} else {
|
|
} else {
|
|
|
treeData.value = props.api.result ? get(res, props.api.result) : [];
|
|
treeData.value = props.api.result ? get(res, props.api.result) : [];
|
|
|
}
|
|
}
|
|
@@ -108,7 +107,6 @@ watch(
|
|
|
:show-search="showSearch"
|
|
:show-search="showSearch"
|
|
|
:tree-data="getTreeData"
|
|
:tree-data="getTreeData"
|
|
|
:tree-node-filter-prop="fieldNames.label"
|
|
:tree-node-filter-prop="fieldNames.label"
|
|
|
- v-bind="$attrs"
|
|
|
|
|
class="w-full"
|
|
class="w-full"
|
|
|
@dropdown-visible-change="handleFetch"
|
|
@dropdown-visible-change="handleFetch"
|
|
|
>
|
|
>
|