debug: 增加审批弹框的调试日志
- 添加按钮点击和API调用的日志 - 添加弹框关闭的日志 - 添加 closeOnMaskClick 和 closeOnAction 配置 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -144,6 +144,7 @@ export default function ApprovalDetail() {
|
||||
|
||||
// 打开审批意见框
|
||||
const handleApprove = (action: 'approve' | 'reject') => {
|
||||
console.log('🔘 打开审批弹框:', { action, id })
|
||||
setActionType(action)
|
||||
setComment('')
|
||||
setCommentVisible(true)
|
||||
@@ -151,24 +152,30 @@ export default function ApprovalDetail() {
|
||||
|
||||
// 提交审批
|
||||
const handleConfirmApprove = async () => {
|
||||
console.log('📝 提交审批:', { actionType, id, comment })
|
||||
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur()
|
||||
}
|
||||
|
||||
try {
|
||||
if (actionType === 'approve') {
|
||||
console.log('✅ 调用同意API:', { id: Number(id), comment })
|
||||
await approvalApi.approve(Number(id), comment)
|
||||
Toast.show('已同意')
|
||||
} else if (actionType === 'reject') {
|
||||
console.log('❌ 调用拒绝API:', { id: Number(id), comment })
|
||||
await approvalApi.reject(Number(id), comment)
|
||||
Toast.show('已拒绝')
|
||||
} else if (actionType === 'cancel') {
|
||||
console.log('🔄 调用撤销API:', { id: Number(id) })
|
||||
await approvalApi.cancel(Number(id))
|
||||
Toast.show('已撤销')
|
||||
}
|
||||
setCommentVisible(false)
|
||||
loadDetail()
|
||||
} catch (error: any) {
|
||||
console.error('❌ 审批操作失败:', error)
|
||||
Toast.show(error.message || '操作失败')
|
||||
}
|
||||
}
|
||||
@@ -533,9 +540,17 @@ export default function ApprovalDetail() {
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
closeOnMaskClick={false}
|
||||
closeOnAction={false}
|
||||
onConfirm={handleConfirmApprove}
|
||||
onClose={() => setCommentVisible(false)}
|
||||
onCancel={() => setCommentVisible(false)}
|
||||
onClose={() => {
|
||||
console.log('弹框关闭')
|
||||
setCommentVisible(false)
|
||||
}}
|
||||
onCancel={() => {
|
||||
console.log('弹框取消')
|
||||
setCommentVisible(false)
|
||||
}}
|
||||
confirmText="确认"
|
||||
cancelText="取消"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user