feat: 优化创建分组字段填充

This commit is contained in:
tbphp
2025-07-23 18:39:17 +08:00
parent 529513f848
commit 2d41a1b45d
3 changed files with 107 additions and 15 deletions

View File

@@ -15,6 +15,7 @@ interface Props {
interface Emits {
(e: "group-select", group: Group): void;
(e: "refresh"): void;
(e: "refresh-and-select", groupId: number): void;
}
const props = withDefaults(defineProps<Props>(), {
@@ -67,15 +68,8 @@ function handleGroupCreated(_group: Group) {
}
function handleSwitchToGroup(groupId: number) {
// 创建成功后,等待列表刷新完成,然后切换到新创建的分组
emit("refresh");
// 延迟选择新分组,确保列表已更新
setTimeout(() => {
const newGroup = props.groups.find(g => g.id === groupId);
if (newGroup) {
emit("group-select", newGroup);
}
}, 100);
// 创建成功后,通知父组件刷新并切换到新创建的分组
emit("refresh-and-select", groupId);
}
</script>