diff --git a/web/src/views/CompanyDashboard.vue b/web/src/views/CompanyDashboard.vue index b9bbc01..8e6881d 100644 --- a/web/src/views/CompanyDashboard.vue +++ b/web/src/views/CompanyDashboard.vue @@ -111,8 +111,11 @@
-

🤖 Agent 状态监控

- {{ companyStatus?.agents?.length || 0 }} 个 +
+

🤖 Agent 状态监控

+ {{ companyStatus?.agents?.length || 0 }} 个 +
+
@@ -168,6 +171,7 @@ +
@@ -517,6 +521,37 @@ + + +
@@ -569,6 +604,49 @@ const showDropdown = ref(false) const expandedAgent = ref(null) const agentSkills = ref([]) +const showHireModal = ref(false) +const hiring = ref(false) +const hireForm = ref({ role: '', name: '' }) + +function openHireModal() { + hireForm.value = { role: '', name: '' }; + showHireModal.value = true; + if (templates.value.length === 0) loadTemplates(); +} + +async function submitHire() { + if (!hireForm.value.role || !selectedCompany.value) return; + hiring.value = true; + try { + const tpl = templates.value.find(t => t.id === hireForm.value.role); + await axios.post(`/api/company/${selectedCompany.value.id}/hire`, { + role: hireForm.value.role, + name: hireForm.value.name || undefined, + type: tpl?.type, + description: tpl?.description + }); + showHireModal.value = false; + await loadCompanyStatus(selectedCompany.value.id); + await loadCompanyAgents(selectedCompany.value.id); + } catch (e) { + alert(`❌ 雇佣失败: ${e.response?.data?.error || e.message}`); + } finally { + hiring.value = false; + } +} + +async function fireAgent(agentId, agentName) { + if (!selectedCompany.value) return; + if (!confirm(`⚠️ 确定要彻底解雇 ${agentName || agentId} 吗?将停止其所有运行进程并归档数据!`)) return; + try { + await axios.post(`/api/company/${selectedCompany.value.id}/fire`, { role: agentId }); + await loadCompanyStatus(selectedCompany.value.id); + await loadCompanyAgents(selectedCompany.value.id); + } catch (e) { + alert(`❌ 解雇失败: ${e.response?.data?.error || e.message}`); + } +} + // Files tab const companyFiles = ref(null) const selectedFilePath = ref(null) @@ -1539,6 +1617,7 @@ function closeDropdown() { .btn-action-chat { color: var(--accent-light); } .btn-action-skills { color: var(--blue-text, #60a5fa); } .btn-action-train { color: var(--purple-text, #a78bfa); } +.btn-action-fire { color: var(--red-text, #ef4444); } /* Expandable Skills Panel */ .agent-expand-panel {