diff --git a/backend/app/service/ApprovalService.php b/backend/app/service/ApprovalService.php
index 40a2a85..3c7149e 100644
--- a/backend/app/service/ApprovalService.php
+++ b/backend/app/service/ApprovalService.php
@@ -72,9 +72,12 @@ class ApprovalService
}
$currentNodeIds = $order->current_nodes ?? [];
+ error_log("🔍 当前节点 IDs: " . json_encode($currentNodeIds));
+
$currentNode = ApprovalNode::whereIn('id', $currentNodeIds)->first();
if (!$currentNode) {
+ error_log("❌ 未找到节点,IDs: " . json_encode($currentNodeIds));
throw new \Exception('当前节点不存在');
}
@@ -501,18 +504,8 @@ class ApprovalService
{
$baseUrl = 'https://xsm.dev.hnxinyouhe.com';
- switch ($order->business_type) {
- case 'business_trip':
- return "{$baseUrl}/business-trip/detail/{$order->business_id}";
- case 'expense':
- return "{$baseUrl}/expense/detail/{$order->business_id}";
- case 'leave':
- return "{$baseUrl}/leave/detail/{$order->business_id}";
- case 'purchase':
- return "{$baseUrl}/purchase/detail/{$order->business_id}";
- default:
- return "{$baseUrl}/approval/detail/{$order->id}";
- }
+ // 统一使用审批详情页,不再跳转到具体业务模块的详情页
+ return "{$baseUrl}/approval/detail/{$order->id}";
}
/**
diff --git a/backend/app/service/BusinessTripService.php b/backend/app/service/BusinessTripService.php
index e90817d..47a2bdf 100644
--- a/backend/app/service/BusinessTripService.php
+++ b/backend/app/service/BusinessTripService.php
@@ -295,12 +295,9 @@ class BusinessTripService
return;
}
- // 构建审批链接(使用 approval_order 的 ID)
+ // 构建审批链接(统一使用审批详情页)
$approvalUrl = "https://xsm.dev.hnxinyouhe.com/approval/detail/{$approvalOrder->id}";
- // 构建业务详情链接(用于查看详情按钮)
- $detailUrl = "https://xsm.dev.hnxinyouhe.com/business-trip/detail/{$businessTrip->id}";
-
// 构建内容
$content = "**出差原因**: {$businessTrip->reason}\n";
$content .= "**目的地**: {$businessTrip->destination}\n";
@@ -317,7 +314,7 @@ class BusinessTripService
'applicant' => $businessTrip->user->name,
'type' => '出差申请',
'content' => $content,
- 'url' => $detailUrl,
+ 'url' => $approvalUrl,
'order_id' => $approvalOrder->id, // 添加 order_id 以显示审批按钮
]);
error_log("✅ 审批人通知成功: approver_id={$approverId}");
@@ -356,7 +353,16 @@ class BusinessTripService
{
try {
$notificationService = new \app\service\FeishuNotificationService();
- $detailUrl = "https://xsm.dev.hnxinyouhe.com/business-trip/detail/{$businessTrip->id}";
+
+ // 获取关联的审批订单
+ $approvalOrder = \app\model\ApprovalOrder::where('business_id', $businessTrip->id)
+ ->where('business_type', 'business_trip')
+ ->first();
+
+ // 统一使用审批详情页
+ $detailUrl = $approvalOrder
+ ? "https://xsm.dev.hnxinyouhe.com/approval/detail/{$approvalOrder->id}"
+ : "https://xsm.dev.hnxinyouhe.com/approval/list";
if ($action === 'approve') {
$title = '出差申请已通过';
@@ -642,7 +648,9 @@ class BusinessTripService
{
try {
$notificationService = new \app\service\FeishuNotificationService();
- $detailUrl = "https://xsm.dev.hnxinyouhe.com/business-trip/detail/{$businessTrip->id}";
+
+ // 统一使用审批详情页
+ $detailUrl = "https://xsm.dev.hnxinyouhe.com/approval/detail/{$approvalOrder->id}";
// 获取审批人和抄送人
$formData = $approvalOrder->form_data ?? [];
diff --git a/frontend/src/pages/approval/detail.tsx b/frontend/src/pages/approval/detail.tsx
index d980342..1819894 100644
--- a/frontend/src/pages/approval/detail.tsx
+++ b/frontend/src/pages/approval/detail.tsx
@@ -135,17 +135,22 @@ export default function ApprovalDetail() {
return
}
- const appId = 'cli_a8033d607cba500d'
+ // 从 URL 获取 company 参数,不需要 appId(后端会自动识别)
+ const urlParams = new URLSearchParams(window.location.search)
+ const companyParam = urlParams.get('company')
+ console.log('🔍 URL 中的 company 参数:', companyParam)
+
const requestAuthCode = (apiObj: any, source: string) => {
console.log(`🚀 使用 ${source} 调用 requestAuthCode`)
+ // 不传 appId,让飞书自动选择(后端会根据 company 参数处理)
apiObj.requestAuthCode({
- appId: appId,
success: async (res: any) => {
console.log(`✅ ${source}.requestAuthCode 成功:`, res)
console.log('🔑 authCode:', res.code?.substring(0, 30) + '...')
try {
console.log('📡 调用后端登录API...')
- const result = await authApi.feishuLogin(res.code)
+ // 传递 company 参数
+ const result = await authApi.feishuLogin(res.code, companyParam || undefined)
console.log('✅ 后端登录成功:', result.user?.name)
login(result.user, result.token)
Toast.show('登录成功')
@@ -243,14 +248,18 @@ export default function ApprovalDetail() {
if (!success) {
console.log('❌ 免登失败,跳转登录页')
Toast.show('免登失败,请使用其他方式登录')
- window.location.href = '/login?redirect=' + encodeURIComponent(window.location.pathname + window.location.search)
+ // 保留 company 参数
+ const currentUrl = window.location.pathname + window.location.search
+ window.location.href = '/login?redirect=' + encodeURIComponent(currentUrl)
return
}
console.log('✅ 免登成功,继续加载详情')
} else {
console.log('⚠️ 不在飞书内或 tt 对象不可用')
Toast.show('请先登录')
- window.location.href = '/login?redirect=' + encodeURIComponent(window.location.pathname + window.location.search)
+ // 保留 company 参数
+ const currentUrl = window.location.pathname + window.location.search
+ window.location.href = '/login?redirect=' + encodeURIComponent(currentUrl)
return
}
} else {
@@ -676,13 +685,19 @@ export default function ApprovalDetail() {
{(canCancel || canApprove) && (
{canCancel && (
-