fix: 修复会签场景下消息卡片更新问题
- 添加 updateMessageCardsForPartialApprove 方法处理会签部分通过 - 会签一人通过后,其他人的消息卡片显示进度并保留按钮 - 修复 Dockerfile 构建顺序问题 - 修复前端类型定义问题 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,7 @@ export default function ApprovalDetail({ id }: ApprovalDetailProps) {
|
||||
return <div className={styles.error}>加载失败: {error.message}</div>
|
||||
}
|
||||
|
||||
const order = data?.data
|
||||
const order = data
|
||||
|
||||
if (!order) {
|
||||
return <div className={styles.empty}>未找到审批详情</div>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function ApprovalList({ type = 'my', onItemClick }: ApprovalListP
|
||||
return <div className={styles.error}>加载失败: {error.message}</div>
|
||||
}
|
||||
|
||||
const list = data?.data?.list || []
|
||||
const list = data?.list || []
|
||||
|
||||
if (list.length === 0) {
|
||||
return <div className={styles.empty}>暂无数据</div>
|
||||
|
||||
@@ -31,6 +31,7 @@ export interface ApprovalOrder {
|
||||
status: ApprovalStatus
|
||||
currentNodes: string[]
|
||||
flowId: string
|
||||
flow?: ApprovalFlow
|
||||
formData: Record<string, any>
|
||||
attachments: Attachment[]
|
||||
timeline: ApprovalTimeline[]
|
||||
|
||||
@@ -74,11 +74,24 @@ interface ApprovalRecord {
|
||||
}
|
||||
}
|
||||
|
||||
interface User {
|
||||
id: number
|
||||
name: string
|
||||
avatar?: string
|
||||
status?: number
|
||||
}
|
||||
|
||||
interface ApprovalNode {
|
||||
id: number
|
||||
type: string
|
||||
name: string
|
||||
approvers: number[]
|
||||
approvers: number[] | User[]
|
||||
actual_approvers?: User[]
|
||||
actual_cc_users?: User[]
|
||||
approver_statuses?: Array<{
|
||||
user: User
|
||||
action_name: string
|
||||
}>
|
||||
}
|
||||
|
||||
interface ApprovalDetail {
|
||||
@@ -99,6 +112,8 @@ interface ApprovalDetail {
|
||||
}
|
||||
form_data: Record<string, any>
|
||||
records: ApprovalRecord[]
|
||||
actual_approvers?: User[]
|
||||
actual_cc_users?: User[]
|
||||
}
|
||||
|
||||
export default function ApprovalDetail() {
|
||||
@@ -408,15 +423,20 @@ export default function ApprovalDetail() {
|
||||
approvers: node?.approvers,
|
||||
userId: user.id,
|
||||
userIdType: typeof user.id,
|
||||
isInApprovers: node?.approvers?.includes(user.id),
|
||||
// 尝试类型转换后的检查
|
||||
isInApproversAsString: node?.approvers?.includes(String(user.id)),
|
||||
isInApproversAsNumber: node?.approvers?.includes(Number(user.id)),
|
||||
})
|
||||
|
||||
if (node && node.approvers) {
|
||||
// 尝试多种方式匹配
|
||||
const matches = node.approvers.some(a => a === user.id || a === String(user.id) || Number(a) === user.id)
|
||||
// 检查用户是否在审批人列表中(支持 number[] 和 User[] 两种格式)
|
||||
const approversArray = node.approvers as Array<number | User>
|
||||
const matches = approversArray.some(a => {
|
||||
if (typeof a === 'number') {
|
||||
return a === user.id
|
||||
} else if (a && typeof a === 'object') {
|
||||
return a.id === user.id
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
console.log(`🔍 节点 ${nodeId} 匹配结果:`, { matches })
|
||||
|
||||
if (matches) {
|
||||
@@ -760,11 +780,6 @@ export default function ApprovalDetail() {
|
||||
}
|
||||
closeOnMaskClick={false}
|
||||
closeOnAction={false}
|
||||
onConfirm={handleConfirmApprove}
|
||||
onCancel={() => {
|
||||
console.log('弹框取消')
|
||||
setCommentVisible(false)
|
||||
}}
|
||||
actions={[
|
||||
[
|
||||
{
|
||||
@@ -778,7 +793,7 @@ export default function ApprovalDetail() {
|
||||
{
|
||||
key: 'confirm',
|
||||
text: '确认',
|
||||
primary: true,
|
||||
bold: true,
|
||||
onClick: () => {
|
||||
console.log('点击确认按钮')
|
||||
handleConfirmApprove()
|
||||
|
||||
Reference in New Issue
Block a user