fix: 取值

This commit is contained in:
dap
2026-03-23 13:29:04 +08:00
parent 8133ebf501
commit 457c59e6a8
3 changed files with 27 additions and 4 deletions

View File

@@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Key } from 'antdv-next/dist/table/interface';
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import type { CategoryTree } from '#/api/workflow/category/model'; import type { CategoryTree } from '#/api/workflow/category/model';
@@ -20,7 +22,7 @@ const emit = defineEmits<{
/** /**
* 点击节点的事件 * 点击节点的事件
*/ */
select: []; select: [keys: string[]];
}>(); }>();
const selectCode = defineModel('selectCode', { const selectCode = defineModel('selectCode', {
@@ -54,6 +56,10 @@ async function handleReload() {
} }
onMounted(loadTree); onMounted(loadTree);
function handleSelect(keys: Key[]) {
emit('select', keys as string[]);
}
</script> </script>
<template> <template>
@@ -83,6 +89,7 @@ onMounted(loadTree);
</InputSearch> </InputSearch>
</div> </div>
<div class="h-full overflow-x-hidden px-[8px]"> <div class="h-full overflow-x-hidden px-[8px]">
<!-- TODO: 适配antdv-next -->
<Tree <Tree
v-bind="$attrs" v-bind="$attrs"
v-if="categoryTreeArray.length > 0" v-if="categoryTreeArray.length > 0"
@@ -93,7 +100,13 @@ onMounted(loadTree);
:tree-data="categoryTreeArray" :tree-data="categoryTreeArray"
:virtual="false" :virtual="false"
default-expand-all default-expand-all
@select="$emit('select')" @select="handleSelect"
:styles="{
item: {
'--ant-tree-node-selected-bg':
'var(--ant-color-primary-bg-hover)',
},
}"
> >
<template #title="{ label }"> <template #title="{ label }">
<span v-if="label.includes(searchValue)"> <span v-if="label.includes(searchValue)">

View File

@@ -266,6 +266,11 @@ async function handleReload(type: 'add' | 'update') {
} }
await tableApi.reload(); await tableApi.reload();
} }
function handleCategorySelect(keys: string[]) {
selectedCode.value = keys;
tableApi.reload();
}
</script> </script>
<template> <template>
@@ -275,7 +280,7 @@ async function handleReload(type: 'add' | 'update') {
v-model:select-code="selectedCode" v-model:select-code="selectedCode"
class="w-[260px]" class="w-[260px]"
@reload="() => tableApi.reload()" @reload="() => tableApi.reload()"
@select="() => tableApi.reload()" @select="handleCategorySelect"
/> />
<BasicTable class="flex-1 overflow-hidden"> <BasicTable class="flex-1 overflow-hidden">
<template #toolbar-actions> <template #toolbar-actions>

View File

@@ -161,6 +161,11 @@ function handleInfo(row: any) {
flowInfoModalApi.setData({ businessId: row.businessId }); flowInfoModalApi.setData({ businessId: row.businessId });
flowInfoModalApi.open(); flowInfoModalApi.open();
} }
function handleCategorySelect(keys: string[]) {
selectedCode.value = keys;
tableApi.reload();
}
</script> </script>
<template> <template>
@@ -170,7 +175,7 @@ function handleInfo(row: any) {
v-model:select-code="selectedCode" v-model:select-code="selectedCode"
class="w-[260px]" class="w-[260px]"
@reload="() => tableApi.reload()" @reload="() => tableApi.reload()"
@select="() => tableApi.reload()" @select="handleCategorySelect"
/> />
<BasicTable class="flex-1 overflow-hidden"> <BasicTable class="flex-1 overflow-hidden">
<template #toolbar-actions> <template #toolbar-actions>