+
+
+ {{ item.label }}
+
+
🔗 在企微审批中打开
@@ -114,7 +138,18 @@ interface Emits {
(e: 'action', action: string): void
}
-defineEmits
()
+const emit = defineEmits()
+
+// ============================================================================
+// 常量
+// ============================================================================
+
+/** 审批动作列表(均降级为跳转企微审批原系统) */
+const approvalActions: ReadonlyArray<{ action: string; label: string }> = [
+ { action: 'approve', label: '✅ 通过' },
+ { action: 'reject', label: '❌ 拒绝' },
+ { action: 'transfer', label: '🔄 转交' },
+]
// ============================================================================
// 状态
@@ -168,6 +203,18 @@ const apvStatusText = computed(() => {
// 方法
// ============================================================================
+/**
+ * 处理审批动作点击(降级跳转)
+ *
+ * 说明:跳转本身由 原生完成(避免被浏览器拦截弹窗),
+ * 此处仅把动作透传给父组件,供其记录/埋点,不做任何状态变更或成功提示。
+ *
+ * @param action - 动作标识:approve/reject/transfer/open
+ */
+function handleApprovalAction(action: string): void {
+ emit('action', action)
+}
+
/**
* 格式化企微申请时间(秒级时间戳 → 可读时间)
*
@@ -288,6 +335,17 @@ function formatApplyTime(applyTime: any): string {
border-color: var(--accent);
}
+/* ---- 降级跳转提示 ---- */
+.apv-action-hint {
+ font-size: 12px;
+ line-height: 1.5;
+ color: var(--color-warning);
+ background-color: rgba(230, 162, 60, 0.08);
+ border: 1px solid rgba(230, 162, 60, 0.25);
+ border-radius: var(--radius-md);
+ padding: 8px 12px;
+}
+
/* ---- 操作按钮 ---- */
.tic-actions {
display: flex;
diff --git a/src/frontend-agent/src/composables/useWebSocket.ts b/src/frontend-agent/src/composables/useWebSocket.ts
index ba6e8a6..d392e87 100644
--- a/src/frontend-agent/src/composables/useWebSocket.ts
+++ b/src/frontend-agent/src/composables/useWebSocket.ts
@@ -15,6 +15,7 @@
import { useAgentStore } from '@/stores/agent'
import { useConversationStore } from '@/stores/conversation'
+import { useTodoStore } from '@/stores/todo'
// --------------------------------------------------------------------------
// 常量配置
@@ -472,6 +473,26 @@ export function useWebSocket() {
}
break
+ case 'todo_status_changed':
+ // 审批降级跳转配套:企微审批回调回写后,后端推送待办状态变更。
+ // 审批人在企微原系统完成操作 → 服务台待办最终一致(此处刷新列表即可,
+ // 后端已就地更新缓存条目,fetchTodoList 命中缓存可立即反映新状态)。
+ if (msg.data) {
+ const todoStore = useTodoStore()
+ // 当前正打开的待办若被终结,同步更新其状态,避免详情页仍显示「审批中」
+ if (
+ todoStore.currentTodoItem &&
+ todoStore.currentTodoItem.id === msg.data.item_id
+ ) {
+ todoStore.currentTodoItem.status = msg.data.status
+ if (todoStore.currentTodoItem.description) {
+ todoStore.currentTodoItem.description.sp_status = msg.data.sp_status
+ }
+ }
+ todoStore.fetchTodoList()
+ }
+ break
+
default:
console.warn(`[WebSocket] 未知消息类型: ${msg.type}`)
}