feat(home): add task operation dialog component

Listen to OPERATION_CHANNEL events to open the dialog, enabling task operations from other components.
This commit is contained in:
duanshuwen
2026-04-06 19:55:16 +08:00
parent 66e92939a8
commit f8ddecc6dd

View File

@@ -7,18 +7,25 @@
</div> </div>
<TaskList /> <TaskList />
</div> </div>
<TaskOperationDialog ref="taskOperationDialogRef" />
</layout> </layout>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import TaskList from '@renderer/components/TaskList/index.vue' import TaskList from '@renderer/components/TaskList/index.vue'
import TaskOperationDialog from '@renderer/views/home/components/TaskOperationDialog.vue'
import ChatHistory from './ChatHistory.vue' import ChatHistory from './ChatHistory.vue'
import ChatBox from './ChatBox.vue' import ChatBox from './ChatBox.vue'
import { ref } from 'vue' import { ref } from 'vue'
/// 是否显示引导页 import emitter from '@utils/emitter'
// 是否显示引导页
const guide = ref(true) const guide = ref(true)
/// 选择的历史会话ID // 选择的历史会话ID
const selectedConversationId = ref('') const selectedConversationId = ref('')
// 任务操作弹窗引用
const taskOperationDialogRef = ref()
/// 处理新对话事件切换到引导页并清空选中的历史会话ID /// 处理新对话事件切换到引导页并清空选中的历史会话ID
const handleNewChat = () => { const handleNewChat = () => {
@@ -32,4 +39,8 @@ const handleSelectChat = (conversationId: string) => {
selectedConversationId.value = conversationId; selectedConversationId.value = conversationId;
}; };
// 监听任务操作弹窗关闭事件
emitter.on('OPERATION_CHANNEL', (item) => {
taskOperationDialogRef.value?.open(item);
});
</script> </script>